@buoy-gg/storage 7.0.40 → 7.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +4 -0
  2. package/lib/commonjs/index.js +8 -1
  3. package/lib/commonjs/preset.js +9 -4
  4. package/lib/commonjs/storage/components/GameUIStorageBrowser.js +3 -2
  5. package/lib/commonjs/storage/components/MMKVInstanceSelector.js +3 -2
  6. package/lib/commonjs/storage/components/StorageActionButtons.js +6 -5
  7. package/lib/commonjs/storage/components/StorageEventCard.js +2 -1
  8. package/lib/commonjs/storage/components/StorageEventFilterView.js +7 -6
  9. package/lib/commonjs/storage/components/StorageKeyStats.js +5 -4
  10. package/lib/commonjs/storage/components/StorageTypeFilterBar.js +4 -3
  11. package/lib/commonjs/storage/hooks/useSecureStoreKeys.js +55 -12
  12. package/lib/commonjs/storage/sync/storageSyncAdapter.js +15 -1
  13. package/lib/commonjs/storage/utils/AsyncStorageListener.web.js +89 -0
  14. package/lib/commonjs/storage/utils/browserStorageLifecycle.js +10 -0
  15. package/lib/commonjs/storage/utils/browserStorageLifecycle.web.js +70 -0
  16. package/lib/commonjs/storage/utils/mmkvAvailability.web.js +21 -0
  17. package/lib/commonjs/storage/utils/storageLabels.js +13 -0
  18. package/lib/commonjs/storage/utils/storageLabels.web.js +13 -0
  19. package/lib/module/index.js +3 -1
  20. package/lib/module/preset.js +11 -5
  21. package/lib/module/storage/components/GameUIStorageBrowser.js +3 -2
  22. package/lib/module/storage/components/MMKVInstanceSelector.js +4 -3
  23. package/lib/module/storage/components/StorageActionButtons.js +6 -5
  24. package/lib/module/storage/components/StorageEventCard.js +2 -1
  25. package/lib/module/storage/components/StorageEventFilterView.js +7 -6
  26. package/lib/module/storage/components/StorageKeyStats.js +5 -4
  27. package/lib/module/storage/components/StorageTypeFilterBar.js +4 -3
  28. package/lib/module/storage/hooks/useSecureStoreKeys.js +55 -12
  29. package/lib/module/storage/sync/storageSyncAdapter.js +12 -0
  30. package/lib/module/storage/utils/AsyncStorageListener.web.js +76 -0
  31. package/lib/module/storage/utils/browserStorageLifecycle.js +6 -0
  32. package/lib/module/storage/utils/browserStorageLifecycle.web.js +66 -0
  33. package/lib/module/storage/utils/mmkvAvailability.web.js +15 -0
  34. package/lib/module/storage/utils/storageLabels.js +9 -0
  35. package/lib/module/storage/utils/storageLabels.web.js +9 -0
  36. package/lib/typescript/index.d.ts +1 -0
  37. package/lib/typescript/index.d.ts.map +1 -1
  38. package/lib/typescript/preset.d.ts.map +1 -1
  39. package/lib/typescript/storage/components/GameUIStorageBrowser.d.ts.map +1 -1
  40. package/lib/typescript/storage/components/MMKVInstanceSelector.d.ts +0 -8
  41. package/lib/typescript/storage/components/MMKVInstanceSelector.d.ts.map +1 -1
  42. package/lib/typescript/storage/components/StorageActionButtons.d.ts.map +1 -1
  43. package/lib/typescript/storage/components/StorageEventCard.d.ts +0 -7
  44. package/lib/typescript/storage/components/StorageEventCard.d.ts.map +1 -1
  45. package/lib/typescript/storage/components/StorageEventFilterView.d.ts.map +1 -1
  46. package/lib/typescript/storage/components/StorageKeyRow.d.ts +2 -6
  47. package/lib/typescript/storage/components/StorageKeyRow.d.ts.map +1 -1
  48. package/lib/typescript/storage/components/StorageKeyStats.d.ts.map +1 -1
  49. package/lib/typescript/storage/components/StorageTypeFilterBar.d.ts +0 -15
  50. package/lib/typescript/storage/components/StorageTypeFilterBar.d.ts.map +1 -1
  51. package/lib/typescript/storage/hooks/useSecureStoreKeys.d.ts +2 -2
  52. package/lib/typescript/storage/hooks/useSecureStoreKeys.d.ts.map +1 -1
  53. package/lib/typescript/storage/sync/storageSyncAdapter.d.ts +7 -13
  54. package/lib/typescript/storage/sync/storageSyncAdapter.d.ts.map +1 -1
  55. package/lib/typescript/storage/utils/AsyncStorageListener.web.d.ts +24 -0
  56. package/lib/typescript/storage/utils/AsyncStorageListener.web.d.ts.map +1 -0
  57. package/lib/typescript/storage/utils/browserStorageLifecycle.d.ts +3 -0
  58. package/lib/typescript/storage/utils/browserStorageLifecycle.d.ts.map +1 -0
  59. package/lib/typescript/storage/utils/browserStorageLifecycle.web.d.ts +2 -0
  60. package/lib/typescript/storage/utils/browserStorageLifecycle.web.d.ts.map +1 -0
  61. package/lib/typescript/storage/utils/mmkvAvailability.web.d.ts +4 -0
  62. package/lib/typescript/storage/utils/mmkvAvailability.web.d.ts.map +1 -0
  63. package/lib/typescript/storage/utils/storageLabels.d.ts +8 -0
  64. package/lib/typescript/storage/utils/storageLabels.d.ts.map +1 -0
  65. package/lib/typescript/storage/utils/storageLabels.web.d.ts +8 -0
  66. package/lib/typescript/storage/utils/storageLabels.web.d.ts.map +1 -0
  67. package/lib/web/index.mjs +5 -0
  68. package/package.json +40 -14
  69. package/lib/commonjs/storage/components/DiffViewer/DiffOptionsPanel.js +0 -356
  70. package/lib/commonjs/storage/components/DiffViewer/components/DiffSummary.js +0 -122
  71. package/lib/commonjs/storage/components/StorageKeyEditorScreen.js +0 -414
  72. package/lib/commonjs/storage/components/StorageScalarKeyEditor.js +0 -61
  73. package/lib/commonjs/storage/components/StorageValueEditModal.js +0 -24
  74. package/lib/commonjs/storage/hooks/useKeyEditor.js +0 -31
  75. package/lib/commonjs/storage/hooks/useTreeDraft.js +0 -25
  76. package/lib/module/storage/components/DiffViewer/DiffOptionsPanel.js +0 -352
  77. package/lib/module/storage/components/DiffViewer/components/DiffSummary.js +0 -118
  78. package/lib/module/storage/components/StorageKeyEditorScreen.js +0 -410
  79. package/lib/module/storage/components/StorageScalarKeyEditor.js +0 -57
  80. package/lib/module/storage/components/StorageValueEditModal.js +0 -20
  81. package/lib/module/storage/hooks/useKeyEditor.js +0 -27
  82. package/lib/module/storage/hooks/useTreeDraft.js +0 -21
  83. package/lib/typescript/storage/components/DiffViewer/DiffOptionsPanel.d.ts +0 -18
  84. package/lib/typescript/storage/components/DiffViewer/DiffOptionsPanel.d.ts.map +0 -1
  85. package/lib/typescript/storage/components/DiffViewer/components/DiffSummary.d.ts +0 -12
  86. package/lib/typescript/storage/components/DiffViewer/components/DiffSummary.d.ts.map +0 -1
  87. package/lib/typescript/storage/components/StorageKeyEditorScreen.d.ts +0 -42
  88. package/lib/typescript/storage/components/StorageKeyEditorScreen.d.ts.map +0 -1
  89. package/lib/typescript/storage/components/StorageScalarKeyEditor.d.ts +0 -24
  90. package/lib/typescript/storage/components/StorageScalarKeyEditor.d.ts.map +0 -1
  91. package/lib/typescript/storage/components/StorageValueEditModal.d.ts +0 -14
  92. package/lib/typescript/storage/components/StorageValueEditModal.d.ts.map +0 -1
  93. package/lib/typescript/storage/hooks/useKeyEditor.d.ts +0 -27
  94. package/lib/typescript/storage/hooks/useKeyEditor.d.ts.map +0 -1
  95. package/lib/typescript/storage/hooks/useTreeDraft.d.ts +0 -16
  96. package/lib/typescript/storage/hooks/useTreeDraft.d.ts.map +0 -1
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ var cn=Object.defineProperty;var zi=Object.getOwnPropertyDescriptor;var Ni=Object.getOwnPropertyNames;var $i=Object.prototype.hasOwnProperty;var Hn=(e,t)=>()=>(e&&(t=e(e=0)),t);var qn=(e,t)=>{for(var o in t)cn(e,o,{get:t[o],enumerable:!0})},ln=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ni(t))!$i.call(e,n)&&n!==o&&cn(e,n,{get:()=>t[n],enumerable:!(r=zi(t,n))||r.enumerable});return e},we=(e,t,o)=>(ln(e,t,"default"),o&&ln(o,t,"default"));var Hi=e=>ln(cn({},"__esModule",{value:!0}),e);var p=Hn(()=>{"use strict";typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis)});var Un={};qn(Un,{asyncStorage:()=>tt,asyncStorageCaps:()=>Ui,default:()=>ji,readMany:()=>Qt,removeMany:()=>ut,writeMany:()=>Pt});import qi from"@buoy-gg/shared-ui/web/asyncStorage";async function Qt(e){if(typeof tt.multiGet=="function")return await tt.multiGet(e);let t=await tt.getMany(e);return e.map(o=>[o,t[o]??null])}async function Pt(e){if(typeof tt.multiSet=="function")return tt.multiSet(e);let t={};for(let[o,r]of e)t[o]=r;return tt.setMany(t)}async function ut(e){return typeof tt.multiRemove=="function"?tt.multiRemove(e):tt.removeMany(e)}var tt,Ui,ji,Ot=Hn(()=>{"use strict";p();tt=qi,Ui={hasLegacyMultiApi:typeof tt?.multiGet=="function",hasMergeApi:typeof tt?.mergeItem=="function"};ji=tt});p();p();Ot();import Jn from"@buoy-gg/shared-ui/web/asyncStorage";import{classifyPreviewItem as Qi,createRestoreScope as Zi,emptyRestoreResult as Yn,failedRestore as es,isDevToolsStorageKey as Ct,registerStateSnapshotProvider as ts,unionKeys as pr,wontApply as Oo}from"@buoy-gg/shared-ui/web";p();Ot();import jn from"@buoy-gg/shared-ui/web/asyncStorage";import{isDevToolsStorageKey as Gi}from"@buoy-gg/shared-ui/web";async function Zt(){let e=await jn.getAllKeys();if(!e||e.length===0)return;let t=e.filter(o=>!Gi(o));t.length!==0&&await ut(t)}async function Gn(){await jn.clear()}p();p();p();function $e(e,t){let o=e.getString(t);if(o!==void 0&&o!=="")return{value:o,type:"string"};let r=e.getNumber(t);if(r!==void 0)return{value:r,type:"number"};let n=e.getBoolean(t);if(n!==void 0)return{value:n,type:"boolean"};if(o==="")return{value:"",type:"string"};let a=e.getBuffer(t);return a!==void 0?{value:`<ArrayBuffer ${a.byteLength} bytes>`,type:"buffer"}:{value:void 0,type:"unknown"}}function Ji(e,t){if(e===void 0)return"undefined";if(e===null)return"null";switch(t){case"string":return`"${e}"`;case"number":return String(e);case"boolean":return e?"true":"false";case"buffer":return e;case"unknown":return"unknown";default:return String(e)}}function dr(e,t){return e===t}var un=class{constructor(){this.listeners=[];this.instances=new Map;this.ignoredKeys=new Set(["@react_buoy_storage_event_filters","@react_buoy_storage_key_filters","@react_buoy_storage_is_monitoring","REACT_QUERY_OFFLINE_CACHE"])}shouldIgnoreKey(t){if(this.ignoredKeys.has(t))return!0;for(let o of this.ignoredKeys)if(t.startsWith(o))return!0;return!1}emit(t){this.listeners.length!==0&&this.listeners.forEach(o=>{try{o(t)}catch{}})}addInstance(t,o){if(this.instances.has(o))return;let r,n=new Map;try{for(let a of t.getAllKeys()??[])this.shouldIgnoreKey(a)||n.set(a,$e(t,a).value)}catch{}if(typeof t.addOnValueChangedListener=="function")try{r=t.addOnValueChangedListener(a=>{if(this.shouldIgnoreKey(a))return;let{value:s,type:u}=$e(t,a),d=n.get(a);if(u==="unknown"||s===void 0){n.delete(a);let y={action:"delete",timestamp:new Date,instanceId:o,data:{key:a,prevValue:d,success:!0}};this.emit(y)}else{n.set(a,s);let m={action:u==="string"?"set.string":u==="number"?"set.number":u==="boolean"?"set.boolean":u==="buffer"?"set.buffer":"set.string",timestamp:new Date,instanceId:o,data:{key:a,value:s,prevValue:d,valueType:u,success:!0}};this.emit(m)}})}catch{}this.instances.set(o,{instance:t,instanceId:o,originalMethods:{},nativeListenerUnsubscribe:r,lastKnownValues:n})}removeInstance(t){let o=this.instances.get(t);if(!o)return;let{nativeListenerUnsubscribe:r}=o;try{typeof r=="function"?r():typeof r?.remove=="function"&&r.remove()}catch{}this.instances.delete(t)}removeAllInstances(){Array.from(this.instances.keys()).forEach(o=>this.removeInstance(o))}addListener(t){return this.listeners.push(t),()=>{let o=this.listeners.indexOf(t);o>-1&&this.listeners.splice(o,1)}}removeAllListeners(){this.listeners=[]}hasInstance(t){return this.instances.has(t)}getMonitoredInstances(){return Array.from(this.instances.keys())}get instanceCount(){return this.instances.size}get listenerCount(){return this.listeners.length}get isActive(){return this.instances.size>0}},gr=new un;var yr=e=>gr.addListener(e);var dn=class{constructor(){this.instances=new Map}register(t,o,r){let n={id:t,instance:o,encrypted:r?.encrypted??!1,readOnly:o.isReadOnly??!1};this.instances.set(t,n)}unregister(t){this.instances.delete(t)}get(t){return this.instances.get(t)}getAll(){return Array.from(this.instances.values())}has(t){return this.instances.has(t)}count(){return this.instances.size}},Ie=new dn;function gn(e,t,o){Ie.register(e,t,o),gr.addInstance(t,e)}function yn(e){gr.removeInstance(e),Ie.unregister(e)}p();var pn=class{constructor(){this.module=null;this.keys=new Map;this.listeners=new Set}register(t,o){let r=this.signature();this.module=t;for(let n of o){let a=typeof n=="string"?{key:n,options:{}}:{key:n.key,description:n.description,options:{keychainService:n.keychainService,requireAuthentication:n.requireAuthentication,authenticationPrompt:n.authenticationPrompt}};this.keys.set(a.key,a)}this.signature()!==r&&this.notify()}unregister(t){this.keys.delete(t)&&this.notify()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}signature(){return JSON.stringify(Array.from(this.keys.values()))}notify(){this.listeners.forEach(t=>{try{t()}catch{}})}getModule(){return this.module}getAll(){return Array.from(this.keys.values())}count(){return this.keys.size}async deleteValue(t){let o=this.keys.get(t);!this.module||!o||await this.module.deleteItemAsync(t,o.options)}async setValue(t,o){let r=this.keys.get(t);if(!this.module)throw new Error("No SecureStore module is registered");if(!r)throw new Error(`SecureStore key "${t}" is not registered`);if(r.options.requireAuthentication)throw new Error(`SecureStore key "${t}" is biometric-protected \u2014 DevTools never writes it`);await this.module.setItemAsync(t,o,r.options)}},ee=new pn;function Yi(e,t){ee.register(e,t)}function Xi(e){ee.unregister(e)}function Xn(e,t){e.remove?e.remove(t):e.delete?.(t)}function os(){return{canCapture:!0,canRestore:!0}}async function Qn(){let e=[],t=(await Jn.getAllKeys()).filter(s=>!Ct(s)),o=(await Qt(t)).filter(s=>s[1]!==null),r={};for(let{id:s,instance:u}of Ie.getAll())try{r[s]=u.getAllKeys().filter(d=>!Ct(d)).map(d=>{let{value:g,type:y}=$e(u,d);return y==="buffer"&&e.push(`mmkv "${s}"/"${d}": ArrayBuffer value not capturable`),{key:d,value:g,valueType:y}})}catch{e.push(`mmkv "${s}": unreadable, captured without entries`),r[s]=[]}let n={},a=ee.getModule();for(let{key:s,options:u}of ee.getAll()){if(u.requireAuthentication){e.push(`secure "${s}": biometric-protected, not capturable`);continue}let d=null;if(a)try{d=await a.getItemAsync(s,u)}catch{e.push(`secure "${s}": unreadable, captured as unset`)}n[s]=d}return{data:{async:o,mmkv:r,secure:n},warnings:e}}async function rs(){let{data:e,warnings:t}=await Qn();return{data:e,warnings:t}}async function ns(e,t){let o=e,r=Zi(t),n=r.touch,a=Yn();if(!o)return es("empty storage snapshot");try{let d=(o.async??[]).filter(([f])=>!Ct(f)&&n(`async:${f}`)),g=new Set(d.map(([f])=>f)),m=(await Jn.getAllKeys()).filter(f=>!Ct(f)).filter(f=>!g.has(f)&&n(`async:${f}`));r.countExcluded((o.async??[]).length-d.length),m.length>0&&await ut(m),d.length>0&&await Pt(d),a.applied+=d.length+m.length}catch(d){a.ok=!1,a.warnings.push(`asyncstorage restore failed: ${String(d)}`)}for(let[d,g]of Object.entries(o.mmkv??{})){let y=Ie.get(d);if(!y){a.skipped.push({id:`mmkv:${d}`,reason:"instance not registered"});continue}if(y.instance.isReadOnly){a.skipped.push({id:`mmkv:${d}`,reason:"instance registered read-only"});continue}let{instance:m}=y;try{let f=new Set(g.map(b=>b.key)),k=m.getAllKeys().filter(b=>!Ct(b));for(let b of k)r.allows(`mmkv:${d}/${b}`)&&(f.has(b)||(Xn(m,b),a.applied+=1));for(let b of g)if(!Ct(b.key)&&n(`mmkv:${d}/${b.key}`)){if(b.valueType==="buffer"){a.skipped.push({id:`mmkv:${d}/${b.key}`,reason:"ArrayBuffer values cannot be restored"});continue}m.set(b.key,b.value),a.applied+=1}}catch(f){a.ok=!1,a.warnings.push(`mmkv "${d}" restore failed: ${String(f)}`)}}let s=o.secure??{};for(let{key:d,options:g}of ee.getAll())if(r.allows(`secure:${d}`)){if(g.requireAuthentication){d in s&&a.skipped.push({id:`secure:${d}`,reason:"biometric-protected keys are never written"});continue}try{if(d in s){let y=s[d];y===null?await ee.deleteValue(d):await ee.setValue(d,y)}else await ee.deleteValue(d);a.applied+=1}catch(y){a.ok=!1,a.warnings.push(`secure "${d}" restore failed: ${String(y)}`)}}for(let d of Object.keys(s))n(`secure:${d}`)&&(ee.getAll().some(g=>g.key===d)||a.skipped.push({id:`secure:${d}`,reason:"key no longer registered with registerSecureStoreKeys"}));let u=r.excludedWarning("item(s)");return u&&a.warnings.push(u),a}async function as(){let e=Yn();try{await Zt(),e.applied+=1}catch(t){e.ok=!1,e.warnings.push(`asyncstorage clear failed: ${String(t)}`)}for(let{id:t,instance:o}of Ie.getAll()){if(o.isReadOnly){e.skipped.push({id:`mmkv:${t}`,reason:"instance registered read-only"});continue}try{for(let r of o.getAllKeys().filter(n=>!Ct(n)))Xn(o,r),e.applied+=1}catch(r){e.ok=!1,e.warnings.push(`mmkv "${t}" clear failed: ${String(r)}`)}}for(let{key:t,options:o}of ee.getAll()){if(o.requireAuthentication){e.skipped.push({id:`secure:${t}`,reason:"biometric-protected keys are never written"});continue}try{await ee.deleteValue(t),e.applied+=1}catch(r){e.ok=!1,e.warnings.push(`secure "${t}" clear failed: ${String(r)}`)}}return e}var is=256*1024;function fn(e,t,o,r,n,a){return Qi({key:e,label:t,oldValue:o,newValue:r,inOld:n,inNew:a},{equal:Object.is,tooLarge:s=>typeof s=="string"&&s.length>is,tooLargeReason:"value too large to render a diff \u2014 restore still applies it"})}async function ss(e,t){let o=e??{async:[],mmkv:{},secure:{}},r=t===void 0,n=r?(await Qn()).data:t??{async:[],mmkv:{},secure:{}},a=[],s=[],u=new Map(n.async??[]),d=new Map(o.async??[]);for(let f of pr(u,d))Ct(f)||a.push(fn(`async:${f}`,f,u.get(f),d.get(f),u.has(f),d.has(f)));for(let f of pr(n.mmkv,o.mmkv)){let k=r?Ie.get(f):null,b=r&&!k,w=r&&k?.instance.isReadOnly===!0,h=new Map((n.mmkv?.[f]??[]).map(C=>[C.key,C])),v=new Map((o.mmkv?.[f]??[]).map(C=>[C.key,C]));for(let C of pr(h,v)){if(Ct(C))continue;let I=`mmkv:${f}/${C}`,M=`${f} \xB7 ${C}`,P=h.get(C),x=v.get(C),E=fn(I,M,P?.value,x?.value,h.has(C),v.has(C));b?E=Oo(E,"MMKV instance not registered"):w?E=Oo(E,"MMKV instance registered read-only"):(x?.valueType==="buffer"||P?.valueType==="buffer")&&(E=Oo(E,"ArrayBuffer values cannot be restored")),a.push(E)}}let g=n.secure??{},y=o.secure??{},m=r?new Map(ee.getAll().map(f=>[f.key,f])):null;for(let f of pr(g,y)){let k=fn(`secure:${f}`,f,g[f],y[f],f in g,f in y);if(r){let b=m?.get(f);b?b.options.requireAuthentication&&(k=Oo(k,"biometric-protected keys are never written")):k=Oo(k,"key no longer registered with registerSecureStoreKeys")}a.push(k)}return{items:a,notes:s}}ts({id:"storage",label:"Storage",status:os,capture:rs,restore:ns,clear:as,previewItems:ss});p();import{StorageIcon as Pu}from"@buoy-gg/floating-tools-core/web";import{createToolFactory as Ou,defineToolPreset as Lu}from"@buoy-gg/shared-ui/web";p();import{useState as lt,useCallback as Oe,useEffect as Fn,useRef as ii,useMemo as pt}from"react";var z={};qn(z,{AccessibilityInfo:()=>vs,ActivityIndicator:()=>fs,Alert:()=>me,Animated:()=>Ft,AppRegistry:()=>Ts,AppState:()=>xs,Appearance:()=>ws,BackHandler:()=>ks,Button:()=>ms,CheckBox:()=>Ws,Clipboard:()=>Cs,DeviceEventEmitter:()=>el,Dimensions:()=>Vs,Easing:()=>uo,FlatList:()=>fr,I18nManager:()=>Is,Image:()=>_s,ImageBackground:()=>zs,InteractionManager:()=>Es,Keyboard:()=>Ms,KeyboardAvoidingView:()=>Ns,LayoutAnimation:()=>Ks,Linking:()=>Rs,LogBox:()=>Zs,Modal:()=>mn,NativeEventEmitter:()=>As,NativeModules:()=>hs,PanResponder:()=>Bs,Picker:()=>$s,PixelRatio:()=>Ds,Platform:()=>Ps,Pressable:()=>ys,ProgressBar:()=>Hs,RefreshControl:()=>qs,SafeAreaView:()=>Us,ScrollView:()=>Lt,SectionList:()=>js,Share:()=>Os,StatusBar:()=>Gs,StyleSheet:()=>$,Switch:()=>ps,Text:()=>l,TextInput:()=>us,Touchable:()=>Js,TouchableHighlight:()=>ds,TouchableNativeFeedback:()=>Ys,TouchableOpacity:()=>A,TouchableWithoutFeedback:()=>gs,UIManager:()=>Ls,Vibration:()=>Fs,View:()=>i,VirtualizedList:()=>Xs,YellowBox:()=>Qs,findNodeHandle:()=>bs,unstable_createElement:()=>Ss,useColorScheme:()=>tl,useLocaleContext:()=>ol,useWindowDimensions:()=>rl});p();we(z,Qd);import*as Qd from"react-native-web";import{unstable_createElement as Ss,NativeModules as hs,AccessibilityInfo as vs,Animated as Ft,Appearance as ws,AppRegistry as Ts,AppState as xs,BackHandler as ks,Clipboard as Cs,Dimensions as Vs,Easing as uo,I18nManager as Is,Keyboard as Ms,InteractionManager as Es,LayoutAnimation as Ks,Linking as Rs,NativeEventEmitter as As,PanResponder as Bs,PixelRatio as Ds,Platform as Ps,Share as Os,StyleSheet as $,UIManager as Ls,Vibration as Fs,CheckBox as Ws,FlatList as fr,Image as _s,ImageBackground as zs,KeyboardAvoidingView as Ns,Picker as $s,ProgressBar as Hs,RefreshControl as qs,SafeAreaView as Us,SectionList as js,StatusBar as Gs,Touchable as Js,TouchableNativeFeedback as Ys,VirtualizedList as Xs,YellowBox as Qs,LogBox as Zs,DeviceEventEmitter as el,useColorScheme as tl,useLocaleContext as ol,useWindowDimensions as rl}from"react-native-web";import*as ie from"react-native-web";import{createElement as ls,forwardRef as cs}from"react";function it(e){let t=cs((r,n)=>{let{accessibilityState:a,accessibilityValue:s,...u}=r;for(let d of["busy","checked","disabled","expanded","selected"])a?.[d]!==void 0&&u[`aria-${d}`]===void 0&&(u[`aria-${d}`]=a[d]);for(let[d,g]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))s?.[d]!==void 0&&u[`aria-${g}`]===void 0&&(u[`aria-${g}`]=s[d]);return ls(e,{...u,ref:n})}),o=e.State;return o&&Object.assign(t,{State:o}),t.displayName=e.displayName??e.name??"NativeWebView",t}var i=it(ie.View),l=it(ie.Text),us=it(ie.TextInput),A=it(ie.TouchableOpacity),ds=it(ie.TouchableHighlight),gs=it(ie.TouchableWithoutFeedback),ys=it(ie.Pressable),Lt=it(ie.ScrollView),mn=it(ie.Modal),ps=it(ie.Switch),fs=it(ie.ActivityIndicator),ms=it(ie.Button),bs=ie.findNodeHandle,me={alert(e,t,o,r){if(typeof document>"u")return;let n=document.createElement("dialog");n.dataset.buoyRoot="",n.setAttribute("aria-label",e),n.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let a=document.createElement("h2");if(a.textContent=e,a.style.cssText="font-size:18px;margin:0 0 12px",n.appendChild(a),t){let g=document.createElement("p");g.textContent=t,g.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",n.appendChild(g)}let s=document.createElement("div");s.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let u=o?.length?o:[{text:"OK"}],d=()=>{n.close?.(),n.remove()};for(let g of u){let y=document.createElement("button");y.type="button",y.textContent=g.text??"OK",y.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${g.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,y.onclick=()=>{d(),g.onPress?.()},s.appendChild(y)}n.addEventListener("cancel",g=>{g.preventDefault(),r?.cancelable!==!1&&(d(),r?.onDismiss?.())}),n.appendChild(s),document.body.appendChild(n),n.showModal?n.showModal():n.setAttribute("open","")}};import Wn from"@buoy-gg/shared-ui/web/asyncStorage";import{JsModal as cu,ModalHeader as Le,TabSelector as uu,parseValue as du,devToolsStorageKeys as Co,macOSColors as gu,night as Je,ToolEmptyState as yu,Filter as pu,RefreshCw as fu,Search as mu,SearchBar as bu,PowerToggleButton as Su,ToolbarCopyButton as si,ToolbarClearButton as hu,truncatePayload as $r,TickProvider as li,useLimit as vu,TIER_LIMITS as wu,windowDragProps as Tu,usePersistedState as Hr,monoFont as qr}from"@buoy-gg/shared-ui/web";p();p();p();var te={async:"Local",asyncFull:"localStorage",mmkv:"Session",secure:"Secure",hasSecure:!1};import{useMemo as je,useCallback as ot,useState as oo,useEffect as ho,useRef as Bn}from"react";import{absoluteFill as Oa,useLimit as La,TIER_LIMITS as Tc,monoFont as Uo}from"@buoy-gg/shared-ui/web";import{Database as Fa,Zap as xc,ProBadge as Wa,ProUpgradeModal as kc,ToolEmptyState as Cc,resolveListEmptyState as Vc}from"@buoy-gg/shared-ui/web";import{isDevToolsStorageKey as ze}from"@buoy-gg/shared-ui/web";p();import{useCallback as aa,useState as bl}from"react";p();import{memo as il}from"react";import{macOSColors as Te,night as de,CompactRow as sl,TypeBadge as ea,HardDrive as ll,Square as cl,CheckSquare as ul,Edit3 as dl,EyeOff as gl,Pin as ta,Trash2 as yl,ExpandedInfoRow as bn,PillBadge as Lo,monoFont as yo}from"@buoy-gg/shared-ui/web";p();import{gameUIColors as mr}from"@buoy-gg/shared-ui/web";function go(e){switch(e){case"mmkv":return"MMKV";case"async":return"Async";case"secure":return"Secure";default:return e}}function br(e){switch(e){case"mmkv":return mr.info;case"async":return mr.warning;case"secure":return mr.success;default:return mr.muted}}p();function dt(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";let t=typeof e;return t==="object"?"object":t==="boolean"?"boolean":t==="number"?"number":t==="string"?"string":"unknown"}function Sr(e){if(typeof e!="string")return e;let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return e;try{return JSON.parse(e)}catch{return e}}var nl=40;function al(e){switch(typeof e){case"boolean":return e?"true":"false";case"number":return Number.isFinite(e)?String(e):null;case"string":return e.length===0?'""':e.length>nl?null:`"${e.replace(/\s+/g," ")}"`;default:return null}}function Zn(e){let t=dt(e),o=al(e);return o?`${t} \xB7 ${o}`:t}import{DataViewer as pl}from"@buoy-gg/shared-ui/web/dataViewer";import{Fragment as ml,jsx as q,jsxs as De}from"react/jsx-runtime";var oa=[Te.semantic.info,Te.semantic.success,Te.semantic.warning,Te.semantic.debug,"#FF6B9D","#00D9FF"];function ra(e){let t=e.split("").reduce((o,r)=>o+r.charCodeAt(0),0);return oa[t%oa.length]}var Sn=e=>{switch(e){case"required_present":return{label:"Valid",color:Te.semantic.success,sublabel:"Required"};case"required_missing":return{label:"Missing",color:Te.semantic.error,sublabel:"Required"};case"required_wrong_value":return{label:"Wrong",color:Te.semantic.warning,sublabel:"Invalid value"};case"required_wrong_type":return{label:"Type Error",color:Te.semantic.info,sublabel:"Wrong type"};case"optional_present":return{label:"Set",color:Te.semantic.debug,sublabel:"Optional"};default:return{label:"Set",color:Te.text.secondary,sublabel:String(e)}}},fl=e=>e==null?"undefined":typeof e=="string"?e:JSON.stringify(e),na=il(function({storageKey:t,isExpanded:o,onPress:r,isSelectMode:n=!1,isSelected:a=!1,onSelectionChange:s,eventCount:u,onViewHistory:d,onHideKey:g,isPinned:y=!1,onTogglePin:m,onEditKey:f,onToggleKey:k,onDeleteKey:b,editBlockedReason:w}){let h=f!=null&&w==null,v=Sn(t.status),C=t.value!==void 0&&t.value!==null,I=C&&typeof t.value=="boolean",M=t.key,P=go(t.storageType),x=Sr(t.value),E=x!==null&&typeof x=="object",re=De(i,{style:H.expandedContainer,children:[q(bn,{label:"Storage",children:q(Lo,{color:hr(t.storageType),children:P})}),t.storageType==="mmkv"&&t.instanceId&&q(bn,{label:"Instance",children:q(Lo,{color:ra(t.instanceId),icon:q(ll,{size:9,color:ra(t.instanceId)}),children:t.instanceId})}),u!=null&&u>0&&De(bn,{label:"Updates",children:[q(Lo,{color:Te.semantic.warning,children:String(u)}),u>1&&d&&q(A,{onPress:d,testID:"buoy-storage-key-history",accessibilityLabel:`View history for ${t.key}`,accessibilityRole:"button",style:H.viewHistoryButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:q(l,{style:H.viewHistoryText,children:"view history \u2192"})})]}),E?q(i,{style:H.dataViewerContainer,children:q(pl,{data:x,title:"",showTypeFilter:!0,rawMode:!0,initialExpanded:!0})}):De(i,{style:H.expandedRow,children:[q(l,{style:H.expandedLabel,children:"Value:"}),q(l,{style:H.expandedValue,numberOfLines:3,children:fl(t.value)||"undefined"})]}),t.status==="required_wrong_type"&&t.expectedType&&De(ml,{children:[De(i,{style:H.expandedRow,children:[q(l,{style:H.expandedLabel,children:"Type:"}),q(ea,{type:dt(t.value)})]}),De(i,{style:H.expandedRow,children:[q(l,{style:H.expandedLabel,children:"Expected:"}),q(ea,{type:t.expectedType})]})]}),t.status==="required_wrong_value"&&t.expectedValue&&De(i,{style:H.expandedRow,children:[q(l,{style:H.expandedLabel,children:"Expected:"}),q(l,{style:H.expandedExpected,children:String(t.expectedValue)})]}),t.description?De(i,{style:H.expandedRow,children:[q(l,{style:H.expandedLabel,children:"Info:"}),q(l,{style:H.expandedDescription,children:t.description})]}):null,w?De(i,{style:H.expandedRow,children:[q(l,{style:H.expandedLabel,children:"Edit:"}),q(l,{style:H.expandedDescription,children:w})]}):null,m||g||h?De(i,{style:H.actionRow,children:[h?De(A,{style:H.editButton,testID:"buoy-storage-key-edit",accessibilityLabel:I&&k?`Toggle ${t.key}`:`Edit ${t.key}`,accessibilityRole:"button",onPress:()=>I&&k?k(t):f?.(t),hitSlop:{top:6,bottom:6,left:6,right:6},children:[q(dl,{size:13,color:de.color.onAccent}),q(l,{style:H.editButtonText,children:I&&k?"Toggle":"Edit"})]}):null,m?De(A,{style:[H.actionChip,y&&H.actionChipActive],testID:"buoy-storage-key-pin",accessibilityLabel:y?`Unpin ${t.key}`:`Pin ${t.key} to top`,accessibilityRole:"button",onPress:()=>m(t.key),hitSlop:{top:6,bottom:6,left:6,right:6},children:[q(ta,{size:12,active:y,color:de.color.accent}),q(l,{style:[H.actionChipText,{color:de.color.accent}],children:y?"Unpin":"Pin to top"})]}):null,g?De(A,{style:H.actionChip,testID:"buoy-storage-key-hide",accessibilityLabel:`Hide ${t.key} from list`,accessibilityRole:"button",onPress:()=>g(t),hitSlop:{top:6,bottom:6,left:6,right:6},children:[q(gl,{size:12,color:de.color.warning}),q(l,{style:[H.actionChipText,{color:de.color.warning}],children:"Hide from list"})]}):null,h&&b?De(A,{style:[H.actionChip,H.dangerChip],testID:"buoy-storage-key-delete",accessibilityLabel:`Delete key ${t.key}`,accessibilityRole:"button",onPress:()=>b(t),hitSlop:{top:6,bottom:6,left:6,right:6},children:[q(yl,{size:12,color:de.color.danger}),q(l,{style:[H.actionChipText,{color:de.color.danger}],children:"Delete key"})]}):null]}):null]}),ve=()=>{s?.(t,!a)},be=n?q(A,{onPress:ve,testID:`buoy-storage-checkbox-${t.storageType}-${t.key}`,accessibilityLabel:`Select ${t.key}`,accessibilityRole:"checkbox",accessibilityState:{checked:a},style:H.checkboxContainer,hitSlop:{top:8,bottom:8,left:8,right:8},children:a?q(ul,{size:18,color:de.color.accent}):q(cl,{size:18,color:de.color.textTertiary})}):null;return De(i,{style:[H.rowContainer,a&&H.rowContainerSelected],children:[be,De(i,{style:H.compactRowWrapper,children:[q(sl,{statusDotColor:v.color,statusLabel:v.label,statusSublabel:v.sublabel,primaryText:M,secondaryText:C?I?dt(t.value):Zn(t.value):void 0,secondaryAccessory:I?q(Lo,{size:"sm",color:t.value?Te.semantic.success:Te.semantic.error,children:t.value?"true":"false"}):void 0,expandedContent:re,isExpanded:o,expandedGlowColor:v.color,customBadge:De(i,{style:H.badgeRow,children:[y&&q(ta,{size:12,active:!0,color:de.color.accent}),q(Lo,{color:hr(t.storageType),children:P})]}),showChevron:!n,onPress:n?ve:r?()=>r(t):void 0,testID:`buoy-storage-row-${t.storageType}-${t.key}`,accessibilityLabel:`${t.storageType} ${t.key}`}),u!=null&&u>1&&q(i,{style:[H.absCountBadge,o&&H.absCountBadgeExpanded,{backgroundColor:Te.semantic.warning+"22",borderColor:Te.semantic.warning+"55"}],pointerEvents:"none",children:q(l,{style:[H.absCountText,{color:Te.semantic.warning}],children:String(u)})})]})]})}),hr=e=>{switch(e){case"mmkv":return Te.semantic.info;case"async":return Te.semantic.warning;case"secure":return Te.semantic.success;default:return Te.text.secondary}},H=$.create({badgeRow:{flexDirection:"row",alignItems:"center",gap:6},expandedContainer:{gap:8},expandedRow:{flexDirection:"row",alignItems:"center",gap:10},expandedLabel:{fontSize:10,color:de.color.textTertiary,fontWeight:"600",minWidth:70,fontFamily:yo},expandedValue:{fontSize:11,color:de.color.textSecondary,fontFamily:yo,flex:1},expandedExpected:{fontSize:11,color:Te.semantic.warning,fontFamily:yo,flex:1},expandedDescription:{fontSize:11,color:de.color.textSecondary,flex:1},dataViewerContainer:{marginTop:6,marginBottom:6,backgroundColor:de.color.bg,borderRadius:6,borderWidth:1,borderColor:de.color.border,padding:6},rowContainer:{flexDirection:"row",alignItems:"flex-start"},rowContainerSelected:{backgroundColor:de.color.accentSoft,borderRadius:8},checkboxContainer:{paddingLeft:4,paddingRight:8,paddingTop:10,alignSelf:"flex-start"},compactRowWrapper:{flex:1},absCountBadge:{position:"absolute",top:4,right:10,paddingHorizontal:5,paddingVertical:1,borderRadius:4,borderWidth:1,zIndex:1},absCountBadgeExpanded:{top:13},absCountText:{fontSize:9,fontWeight:"700",fontFamily:yo},actionRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:8,marginTop:4},actionChip:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:6,paddingHorizontal:10,borderRadius:6,backgroundColor:de.color.surface,borderWidth:1,borderColor:de.color.border},dangerChip:{borderColor:de.color.danger+"55"},actionChipActive:{backgroundColor:de.color.accentSoft,borderColor:de.color.accentBorderStrong},editButton:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:8,paddingHorizontal:14,borderRadius:8,backgroundColor:de.color.accent},editButtonText:{color:de.color.onAccent,fontSize:12,fontWeight:"700"},actionChipText:{fontSize:11,fontWeight:"600",fontFamily:yo},viewHistoryButton:{marginLeft:4},viewHistoryText:{fontSize:10,fontWeight:"600",fontFamily:yo,color:de.color.accent}});import{SectionHeader as po,night as hn}from"@buoy-gg/shared-ui/web";import{jsx as Vt,jsxs as vr}from"react/jsx-runtime";function wr(e){return e.instanceId?`${e.storageType}-${e.instanceId}-${e.key}`:`${e.storageType}-${e.key}`}function vn({title:e,count:t,keys:o,emptyMessage:r,headerColor:n,isSelectMode:a=!1,selectedKeys:s=new Set,onSelectionChange:u,eventCountByKey:d,onViewHistory:g,onHideKey:y,pinnedKeys:m,onTogglePin:f,onEditKey:k,onToggleKey:b,onDeleteKey:w,editBlockedFor:h,onRowRef:v,onOpenKey:C}){let I=aa(E=>wr(E),[]),[M,P]=bl(null),x=aa(E=>{if(!E||typeof E.key!="string")return;if(C){C(E);return}let re=I(E);P(ve=>ve===re?null:re)},[I,C]);return o.length===0&&e==="Required Keys"?vr(i,{style:Fo.sectionContainer,children:[vr(po,{children:[Vt(po.Title,{children:e}),Vt(po.Badge,{count:0,color:n})]}),Vt(i,{style:Fo.emptySection,children:Vt(l,{style:Fo.emptySectionText,children:r})})]}):o.length===0?null:vr(i,{style:Fo.sectionContainer,children:[e?vr(po,{children:[Vt(po.Title,{children:e}),t>=0&&Vt(po.Badge,{count:t,color:n})]}):null,Vt(i,{style:Fo.sectionContent,children:o.map(E=>{let re=I(E);return Vt(i,{ref:v?ve=>v(re,ve):void 0,collapsable:!1,children:Vt(na,{storageKey:E,isExpanded:!a&&M===re,onPress:x,isSelectMode:a,isSelected:s.has(re),onSelectionChange:u,eventCount:d?.[E.key],onViewHistory:g?()=>g(E.key):void 0,onHideKey:y,onEditKey:k,onToggleKey:b,onDeleteKey:w,editBlockedReason:h?.(E),isPinned:m?.has(E.key),onTogglePin:f})},re)})})]})}var Fo=$.create({sectionContainer:{gap:8},sectionContent:{},emptySection:{backgroundColor:hn.color.surface,borderRadius:6,padding:16,borderWidth:1,borderColor:hn.color.border,alignItems:"center"},emptySectionText:{color:hn.color.textTertiary,fontSize:11,textAlign:"center"}});p();import{useCallback as Sl,useMemo as ia,useRef as sa,useState as la}from"react";import{EyeOff as hl,FileJson as vl,HardDrive as wl,night as Q,macOSColors as fo,Pin as Tl,PillBadge as Tr,Trash2 as xl,TypeBadge as kl,useSafeAreaInsets as Cl,monoFont as Wt}from"@buoy-gg/shared-ui/web";import{DataViewer as Vl,LiveExplorer as Il,ValueEditModal as Ml,updateNestedDataByPath as El,deleteNestedDataByPath as Kl}from"@buoy-gg/shared-ui/web/dataViewer";import{jsx as W,jsxs as xe}from"react/jsx-runtime";var Rl=300,St="buoy-storage-detail";function Al(e){let t=o=>o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return e.length===0?`${St}-explorer-root`:`${St}-explorer-${e.map(t).filter(Boolean).join("-")}`}var ca=[fo.semantic.info,fo.semantic.success,fo.semantic.warning,fo.semantic.debug,"#FF6B9D","#00D9FF"];function ua(e){let t=e.split("").reduce((o,r)=>o+r.charCodeAt(0),0);return ca[t%ca.length]}function da({storageKey:e,editBlockedReason:t,eventCount:o,onSave:r,onViewHistory:n,onDeleteKey:a,onHideKey:s,isPinned:u=!1,onTogglePin:d,applySafeAreaInset:g}){let y=Cl(),m=g?y.bottom:0,f=t==null,k=Sn(e.status),b=go(e.storageType),[w,h]=la(!1),[v,C]=la(0),I=sa(null),M=ia(()=>Sr(e.value),[e.value]),P=typeof e.value=="string"?e.value:JSON.stringify(e.value);I.current&&I.current.raw===P&&(I.current=null);let x=I.current?I.current.value:M,E=Sl(Y=>{let ye=typeof Y=="string"?Y:JSON.stringify(Y);I.current={raw:ye,value:Y},r(ye).catch(ne=>{I.current=null,me.alert("Couldn't save",ne instanceof Error?ne.message:String(ne))})},[r]),re=sa(x);re.current=x;let ve=ia(()=>{if(f)return{update:(Y,ye)=>{let ne=Y.length===0?ye:El(re.current,Y,ye);E(ne)},remove:Y=>{Y.length!==0&&E(Kl(re.current,Y))}}},[f,E]),be=d||s||f&&a;return xe(i,{style:D.screen,children:[W(i,{testID:`${St}-key`,accessibilityLabel:e.key}),xe(Lt,{testID:`${St}-scroll`,style:D.scroll,contentContainerStyle:[D.scrollContent,{paddingBottom:24+m}],keyboardShouldPersistTaps:"handled",children:[W(i,{style:D.section,children:xe(i,{style:D.editorContainer,children:[xe(i,{style:D.sectionHeaderRow,children:[W(l,{testID:`${St}-editor-header`,style:D.sectionHeaderAccentText,children:"Value Editor"}),f?xe(A,{onPress:()=>h(!0),testID:`${St}-raw`,accessibilityRole:"button",accessibilityLabel:"Edit raw JSON",style:D.rawButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:[W(vl,{size:13,color:Q.color.accent}),W(l,{style:D.rawButtonText,children:"Raw"})]}):null]}),xe(i,{style:D.sectionBody,children:[W(Il,{editable:f,label:"Value",value:x,defaultExpanded:["Value"],writer:ve,dataVersion:v,testIDForPath:Al,debounceMs:Rl}),f?W(l,{style:D.editorHint,children:"Edits write to the device as you make them \u2014 undo lives in the key's history."}):W(l,{style:D.blockedText,testID:`${St}-edit-blocked`,children:t})]})]})}),W(i,{style:D.section,children:xe(i,{style:D.infoContainer,children:[W(l,{style:D.sectionHeaderPlain,children:"Key Details"}),xe(i,{style:D.infoBody,children:[xe(i,{style:D.infoRow,children:[W(l,{style:D.infoLabel,children:"Status:"}),W(Tr,{color:k.color,testID:`${St}-status`,children:k.label}),W(l,{style:D.infoDim,children:k.sublabel})]}),xe(i,{style:D.infoRow,children:[W(l,{style:D.infoLabel,children:"Storage:"}),W(Tr,{color:hr(e.storageType),testID:`${St}-backend`,children:b}),W(l,{style:D.infoDim,children:dt(e.value)})]}),e.storageType==="mmkv"&&e.instanceId&&xe(i,{style:D.infoRow,children:[W(l,{style:D.infoLabel,children:"Instance:"}),W(Tr,{color:ua(e.instanceId),icon:W(wl,{size:9,color:ua(e.instanceId)}),children:e.instanceId})]}),o!=null&&o>0&&xe(i,{style:D.infoRow,children:[W(l,{style:D.infoLabel,children:"Updates:"}),W(Tr,{color:fo.semantic.warning,children:String(o)}),o>1&&n&&W(A,{onPress:n,testID:"buoy-storage-key-history",accessibilityLabel:`View history for ${e.key}`,accessibilityRole:"button",style:D.inlineLinkButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:W(l,{style:D.inlineLinkText,children:"view history \u2192"})})]}),e.status==="required_wrong_type"&&e.expectedType&&xe(i,{style:D.infoRow,children:[W(l,{style:D.infoLabel,children:"Expected:"}),W(kl,{type:e.expectedType}),xe(l,{style:D.infoDim,children:["got ",dt(e.value)]})]}),e.status==="required_wrong_value"&&e.expectedValue&&xe(i,{style:D.infoRow,children:[W(l,{style:D.infoLabel,children:"Expected:"}),W(l,{style:D.infoExpected,children:String(e.expectedValue)})]}),e.description?xe(i,{style:D.infoRow,children:[W(l,{style:D.infoLabel,children:"Info:"}),W(l,{style:D.infoDescription,children:e.description})]}):null]})]})}),W(i,{style:D.section,children:xe(i,{style:D.infoContainer,children:[W(l,{style:D.sectionHeaderPlain,children:"Value Explorer"}),W(i,{style:D.viewerBody,testID:`${St}-viewer`,children:x!==null&&typeof x=="object"?W(Vl,{title:"",data:x,showTypeFilter:!0,rawMode:!0,initialExpanded:!1}):W(l,{style:D.rawValueText,selectable:!0,children:P??"undefined"})})]})}),be?xe(i,{style:D.actionRow,children:[d?xe(A,{style:[D.actionChip,u&&D.actionChipActive],testID:"buoy-storage-key-pin",accessibilityLabel:u?`Unpin ${e.key}`:`Pin ${e.key} to top`,accessibilityRole:"button",onPress:()=>d(e.key),hitSlop:{top:6,bottom:6,left:6,right:6},children:[W(Tl,{size:12,active:u,color:Q.color.accent}),W(l,{style:[D.actionChipText,{color:Q.color.accent}],children:u?"Unpin":"Pin to top"})]}):null,s?xe(A,{style:D.actionChip,testID:"buoy-storage-key-hide",accessibilityLabel:`Hide ${e.key} from list`,accessibilityRole:"button",onPress:()=>s(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[W(hl,{size:12,color:Q.color.warning}),W(l,{style:[D.actionChipText,{color:Q.color.warning}],children:"Hide from list"})]}):null,f&&a?xe(A,{style:[D.actionChip,D.dangerChip],testID:"buoy-storage-key-delete",accessibilityLabel:`Delete key ${e.key}`,accessibilityRole:"button",onPress:()=>a(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[W(xl,{size:12,color:Q.color.danger}),W(l,{style:[D.actionChipText,{color:Q.color.danger}],children:"Delete key"})]}):null]}):null]}),w&&f?W(Ml,{path:[],value:x,onSave:Y=>{E(Y),C(ye=>ye+1),h(!1)},onCancel:()=>h(!1),saveLabel:"Apply",testIDPrefix:"buoy-storage-value"}):null]})}var D=$.create({screen:{flex:1,minHeight:0},scroll:{flex:1},scrollContent:{paddingHorizontal:8,paddingTop:8},section:{marginBottom:16},editorContainer:{minWidth:200,backgroundColor:Q.color.surface,borderRadius:6,borderWidth:1,borderColor:Q.color.accent+"4D",overflow:"hidden",shadowColor:Q.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},sectionHeaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",backgroundColor:Q.color.accent+"1A",paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:Q.color.accent+"33"},sectionHeaderAccentText:{fontWeight:"600",fontSize:12,color:Q.color.accent,letterSpacing:.5,textTransform:"uppercase",fontFamily:Wt},rawButton:{flexDirection:"row",alignItems:"center",gap:4},rawButtonText:{color:Q.color.accent,fontSize:11,fontWeight:"700"},sectionBody:{padding:8},editorHint:{color:Q.color.textTertiary,fontSize:10,paddingTop:8,paddingHorizontal:4,lineHeight:14},blockedText:{color:Q.color.textSecondary,fontSize:12,padding:12,lineHeight:18},infoContainer:{minWidth:200,backgroundColor:Q.color.surface,borderRadius:6,borderWidth:1,borderColor:Q.color.border,overflow:"hidden"},sectionHeaderPlain:{backgroundColor:Q.color.surfaceElevated,paddingHorizontal:12,paddingVertical:8,fontWeight:"600",fontSize:12,color:Q.color.textSecondary,borderBottomWidth:1,borderBottomColor:Q.color.border,letterSpacing:.5,textTransform:"uppercase",fontFamily:Wt},infoBody:{padding:12,gap:10},infoRow:{flexDirection:"row",alignItems:"center",gap:8},infoLabel:{fontSize:10,color:Q.color.textTertiary,fontWeight:"600",minWidth:64,fontFamily:Wt},infoDim:{color:Q.color.textTertiary,fontSize:10,fontFamily:Wt},infoExpected:{fontSize:11,color:fo.semantic.warning,fontFamily:Wt,flex:1},infoDescription:{fontSize:11,color:Q.color.textSecondary,flex:1},rawValueText:{color:Q.color.textSecondary,fontSize:11,fontFamily:Wt,lineHeight:16,padding:12},viewerBody:{backgroundColor:Q.color.bg,minHeight:48},inlineLinkButton:{marginLeft:4},inlineLinkText:{fontSize:10,fontWeight:"600",fontFamily:Wt,color:Q.color.accent},actionRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:8,paddingHorizontal:4},actionChip:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:6,paddingHorizontal:10,borderRadius:6,backgroundColor:Q.color.surface,borderWidth:1,borderColor:Q.color.border},dangerChip:{borderColor:Q.color.danger+"55"},actionChipActive:{backgroundColor:Q.color.accentSoft,borderColor:Q.color.accentBorderStrong},actionChipText:{fontSize:11,fontWeight:"600",fontFamily:Wt}});p();p();import{macOSColors as wn,night as _t,monoFont as Bl}from"@buoy-gg/shared-ui/web";import{jsx as Tn,jsxs as Pl}from"react/jsx-runtime";var Dl=[{id:"all",label:"All Types",color:null},{id:"async",label:te.async,color:wn.semantic.warning},{id:"mmkv",label:te.mmkv,color:wn.semantic.info},{id:"secure",label:"Secure",color:wn.semantic.success}];function _o({active:e,onChange:t,counts:o}){return Tn(i,{style:Wo.row,children:Dl.filter(r=>te.hasSecure||r.id!=="secure").map(r=>{let n=e===r.id,a=r.color??_t.color.accent;return Pl(A,{testID:`buoy-storage-type-${r.id}`,accessibilityRole:"button",accessibilityLabel:`Filter by ${r.label}`,accessibilityState:{selected:n},activeOpacity:.8,onPress:()=>t(r.id),style:[Wo.pill,{borderColor:_t.color.border},n&&[Wo.pillActive,r.color?{backgroundColor:r.color+"15",borderColor:r.color+"40"}:{backgroundColor:_t.color.accentSoft,borderColor:_t.color.accentBorderStrong}]],children:[Tn(l,{style:[Wo.label,n&&{color:a,fontWeight:"600"}],children:r.label}),Tn(l,{style:[Wo.value,{color:n?a:_t.color.textTertiary}],children:o[r.id]})]},r.id)})})}function xn(e){let t={all:e.length,async:0,mmkv:0,secure:0};for(let o of e)t[o.storageType]+=1;return t}var Wo=$.create({row:{flexDirection:"row",gap:8,marginTop:2},pill:{flex:1,backgroundColor:_t.color.buttonSurface,borderRadius:8,borderWidth:1,borderColor:_t.color.border,paddingVertical:6,paddingHorizontal:8,alignItems:"center",justifyContent:"center",minHeight:32},pillActive:{borderWidth:1,transform:[{scale:1.005}]},label:{fontSize:9,color:_t.color.textSecondary,textTransform:"uppercase",letterSpacing:.4,fontWeight:"500",marginBottom:1},value:{fontSize:12,fontWeight:"600",fontFamily:Bl,lineHeight:14}});import{macOSColors as zt,night as _e,monoFont as Ll}from"@buoy-gg/shared-ui/web";p();function zo(){try{return typeof window<"u"&&!!window.sessionStorage}catch{return!1}}function Ol(){return null}function kn(){return"Session storage is unavailable in this browser context."}import{jsx as eo,jsxs as No}from"react/jsx-runtime";var qg=zo();function ga({stats:e,tabStats:t,healthPercentage:o,healthStatus:r,healthColor:n,activeFilter:a="all",onFilterChange:s,activeStorageType:u="all",onStorageTypeChange:d,showStatus:g=!0}){let y=t||{validCount:e.presentRequiredCount+e.optionalCount,missingCount:e.missingCount,issuesCount:e.wrongValueCount+e.wrongTypeCount,asyncCount:e.asyncCount||0,mmkvCount:e.mmkvCount||0,secureCount:e.secureCount||0,totalCount:e.totalCount};return No(i,{style:He.container,children:[g?No(i,{style:He.filtersRow,children:[No(A,{style:[He.filterChip,a==="all"&&[He.filterChipActive,{backgroundColor:_e.color.accentSoft,borderColor:_e.color.accentBorderStrong,shadowColor:_e.color.accent}]],onPress:()=>s?.("all"),activeOpacity:.8,testID:"buoy-storage-status-all",accessibilityRole:"button",accessibilityLabel:"Valid keys",children:[eo(l,{style:[He.filterValue,{color:_e.color.text}],children:y.validCount}),eo(l,{style:He.filterLabel,children:"Valid"})]}),No(A,{style:[He.filterChip,a==="missing"&&[He.filterChipActive,{backgroundColor:zt.semantic.error+"10",borderColor:zt.semantic.error+"30",shadowColor:zt.semantic.error}]],onPress:()=>s?.("missing"),activeOpacity:.8,testID:"buoy-storage-status-missing",accessibilityRole:"button",accessibilityLabel:"Missing keys",children:[eo(l,{style:[He.filterValue,{color:y.missingCount>0?zt.semantic.error:_e.color.textTertiary}],children:y.missingCount}),eo(l,{style:He.filterLabel,children:"Missing"})]}),No(A,{style:[He.filterChip,a==="issues"&&[He.filterChipActive,{backgroundColor:zt.semantic.warning+"10",borderColor:zt.semantic.warning+"30",shadowColor:zt.semantic.warning}]],onPress:()=>s?.("issues"),activeOpacity:.8,testID:"buoy-storage-status-issues",accessibilityRole:"button",accessibilityLabel:"Issues keys",children:[eo(l,{style:[He.filterValue,{color:y.issuesCount>0?zt.semantic.warning:_e.color.textTertiary}],children:y.issuesCount}),eo(l,{style:He.filterLabel,children:"Issues"})]})]}):null,d&&eo(_o,{active:u,onChange:d,counts:{all:y.totalCount,async:y.asyncCount,mmkv:y.mmkvCount,secure:y.secureCount}})]})}var He=$.create({container:{backgroundColor:_e.color.surface,borderRadius:12,padding:16,borderWidth:1,borderColor:_e.color.border,gap:14,shadowColor:"#000000",shadowOpacity:.03,shadowRadius:12,shadowOffset:{width:0,height:2}},topRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},titleLeft:{flexDirection:"row",alignItems:"center",gap:8,flexShrink:1},healthDot:{width:6,height:6,borderRadius:3},titleText:{fontSize:12,fontWeight:"600",color:_e.color.text,letterSpacing:.5,textTransform:"uppercase"},titleDivider:{width:4,height:1,backgroundColor:_e.color.border,marginHorizontal:4},subtitleText:{color:_e.color.textTertiary,fontSize:11},healthBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:6,borderWidth:1},healthBadgeText:{fontSize:10,fontWeight:"600",fontVariant:["tabular-nums"]},healthProgressBar:{height:3,borderRadius:1.5,backgroundColor:_e.color.bg,overflow:"hidden"},healthProgressFill:{height:3,borderRadius:1.5},filtersRow:{flexDirection:"row",gap:10},filterChip:{flex:1,backgroundColor:_e.color.buttonSurface,borderRadius:8,borderWidth:1,borderColor:_e.color.border,paddingVertical:10,paddingHorizontal:12,alignItems:"center",justifyContent:"center",minHeight:44},filterChipActive:{borderWidth:1,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6,elevation:2,transform:[{scale:1.005}]},filterLabel:{fontSize:9,color:_e.color.textTertiary,textTransform:"uppercase",letterSpacing:.5,fontWeight:"500",marginTop:3},filterValue:{fontSize:18,fontWeight:"600",fontFamily:Ll,lineHeight:20}});p();Ot();import{useState as Cn,useEffect as Fl,useCallback as Wl,useRef as _l}from"react";import zl from"@buoy-gg/shared-ui/web/asyncStorage";p();function gt(e,t){return typeof e=="string"?t==="async":e.storageType?e.storageType===t:!0}function $o(e=[]){let[t,o]=Cn([]),[r,n]=Cn(!0),[a,s]=Cn(null),u=JSON.stringify(e),d=_l(e);d.current=e;let g=Wl(async()=>{let y=d.current;n(!0),s(null);try{let m=await zl.getAllKeys();if(!m||m.length===0){o([]),n(!1);return}let f=await Qt(m),k=[];f.forEach(([b,w])=>{let h=w;if(w)try{h=JSON.parse(w)}catch{h=w}let v=y.find(M=>gt(M,"async")?typeof M=="string"?M===b:M.key===b:!1),C="optional_present";v&&(h==null?C="required_missing":typeof v=="object"&&v.expectedValue!==void 0?C=h===v.expectedValue?"required_present":"required_wrong_value":typeof v=="object"&&v.expectedType!==void 0?C=(h===null?"null":typeof h).toLowerCase()===v.expectedType.toLowerCase()?"required_present":"required_wrong_type":C="required_present");let I={key:b,value:h,storageType:"async",status:C,category:v?"required":"optional",...typeof v=="object"&&v.expectedValue!==void 0&&{expectedValue:v.expectedValue},...typeof v=="object"&&v.expectedType!==void 0&&{expectedType:v.expectedType},...typeof v=="object"&&v.description!==void 0&&{description:v.description}};k.push(I)}),y.forEach(b=>{if(!gt(b,"async"))return;let w=typeof b=="string"?b:b.key;k.some(v=>v.key===w)||k.push({key:w,value:void 0,storageType:"async",status:"required_missing",category:"required",...typeof b=="object"&&b.expectedValue!==void 0&&{expectedValue:b.expectedValue},...typeof b=="object"&&b.expectedType!==void 0&&{expectedType:b.expectedType},...typeof b=="object"&&b.description!==void 0&&{description:b.description}})}),o(k)}catch(m){s(m instanceof Error?m:new Error("Failed to fetch storage data")),o([])}finally{n(!1)}},[u]);return Fl(()=>{g()},[g]),{storageKeys:t,isLoading:r,error:a,refresh:g}}p();import{subscribeToBrowserStorage as Nl}from"@buoy-gg/shared-ui/web/utils";var Vn=new Set,In,$l=!1,Hl=new Set(["@react_buoy_storage_event_filters","@react_buoy_storage_key_filters","@react_buoy_storage_is_monitoring","REACT_QUERY_OFFLINE_CACHE"]),ya=e=>[...Hl].some(t=>e.startsWith(t));async function pa(){In||typeof window>"u"||(In=Nl(e=>{if($l||e.area!=="localStorage"||e.key!==void 0&&ya(e.key))return;let{area:t,action:o,...r}=e;r.prevPairs&&(r.prevPairs=r.prevPairs.filter(([a])=>!ya(a)));let n={action:o,data:r,timestamp:new Date};for(let a of[...Vn])try{a(n)}catch{}}))}function xr(e){return Vn.add(e),()=>{Vn.delete(e)}}function fa(){return!!In}p();import{useState as mo,useEffect as ma,useCallback as ba,useRef as Sa}from"react";function ql(e,t,o=[]){let[r,n]=mo([]),[a,s]=mo(!0),[u,d]=mo(null),g=JSON.stringify(o),y=Sa(o);y.current=o;let m=ba(()=>{let f=y.current;s(!0),d(null);try{if(!e){n([]),s(!1);return}let k=e.getAllKeys();if(!k||k.length===0){let w=f.filter(h=>gt(h,"mmkv")).map(h=>{let v=typeof h=="string"?h:h.key,C=typeof h=="object"?h.description:void 0,I=typeof h=="object"?h.expectedValue:void 0,M=typeof h=="object"?h.expectedType:void 0;return{key:v,value:void 0,valueType:void 0,storageType:"mmkv",instanceId:t,status:"required_missing",category:"required",description:C,expectedValue:I,expectedType:M}});n(w),s(!1);return}let b=[];k.forEach(w=>{let{value:h,type:v}=$e(e,w),C=f.find(P=>gt(P,"mmkv")?typeof P=="string"?P===w:P.key===w:!1),I="optional_present";C&&(h===void 0?I="required_missing":typeof C=="object"&&C.expectedValue!==void 0?I=String(h)===String(C.expectedValue)?"required_present":"required_wrong_value":typeof C=="object"&&C.expectedType!==void 0?I=dr(v,C.expectedType)?"required_present":"required_wrong_type":I="required_present");let M={key:w,value:h,valueType:v!=="unknown"?v:void 0,storageType:"mmkv",instanceId:t,status:I,category:C?"required":"optional",lastUpdated:new Date,...typeof C=="object"&&C.expectedValue!==void 0&&{expectedValue:C.expectedValue},...typeof C=="object"&&C.expectedType!==void 0&&{expectedType:C.expectedType},...typeof C=="object"&&C.description!==void 0&&{description:C.description}};b.push(M)}),f.forEach(w=>{if(!gt(w,"mmkv"))return;let h=typeof w=="string"?w:w.key;b.some(C=>C.key===h)||b.push({key:h,value:void 0,valueType:void 0,storageType:"mmkv",instanceId:t,status:"required_missing",category:"required",...typeof w=="object"&&w.expectedValue!==void 0&&{expectedValue:w.expectedValue},...typeof w=="object"&&w.expectedType!==void 0&&{expectedType:w.expectedType},...typeof w=="object"&&w.description!==void 0&&{description:w.description}})}),n(b)}catch(k){d(k instanceof Error?k:new Error("Failed to fetch MMKV storage data")),n([])}finally{s(!1)}},[e,t,g]);return ma(()=>{m()},[m]),{storageKeys:r,isLoading:a,error:u,refresh:m}}function Mn(e,t=[]){let[o,r]=mo([]),[n,a]=mo(!0),[s,u]=mo(null),d=JSON.stringify(t),g=Sa(t);g.current=t;let y=ba(()=>{let m=g.current;a(!0),u(null);try{let f=[];e.forEach(({instance:k,id:b})=>{let w=k.getAllKeys();!w||w.length===0||w.forEach(h=>{let{value:v,type:C}=$e(k,h),I=m.find(x=>gt(x,"mmkv")?typeof x=="string"?x===h:x.key===h:!1),M="optional_present";I&&(v===void 0?M="required_missing":typeof I=="object"&&I.expectedValue!==void 0?M=String(v)===String(I.expectedValue)?"required_present":"required_wrong_value":typeof I=="object"&&I.expectedType!==void 0?M=dr(C,I.expectedType)?"required_present":"required_wrong_type":M="required_present");let P={key:h,value:v,valueType:C!=="unknown"?C:void 0,storageType:"mmkv",instanceId:b,status:M,category:I?"required":"optional",lastUpdated:new Date,...typeof I=="object"&&I.expectedValue!==void 0&&{expectedValue:I.expectedValue},...typeof I=="object"&&I.expectedType!==void 0&&{expectedType:I.expectedType},...typeof I=="object"&&I.description!==void 0&&{description:I.description}};f.push(P)})}),m.forEach(k=>{if(!gt(k,"mmkv"))return;let b=typeof k=="string"?k:k.key;if(!f.some(h=>h.key===b)){let h=e[0]?.id||"mmkv.default";f.push({key:b,value:void 0,valueType:void 0,storageType:"mmkv",instanceId:h,status:"required_missing",category:"required",...typeof k=="object"&&k.expectedValue!==void 0&&{expectedValue:k.expectedValue},...typeof k=="object"&&k.expectedType!==void 0&&{expectedType:k.expectedType},...typeof k=="object"&&k.description!==void 0&&{description:k.description}})}}),r(f)}catch(f){u(f instanceof Error?f:new Error("Failed to fetch multi-MMKV storage data")),r([])}finally{a(!1)}},[e,d]);return ma(()=>{y()},[y]),{storageKeys:o,isLoading:n,error:s,refresh:y}}p();import{useState as En,useEffect as Ul,useCallback as ha,useRef as kr}from"react";var jl="\u2022\u2022\u2022\u2022\u2022\u2022 (biometric protected)",Gl=3e3;function va(e){return JSON.stringify(e)}function wa(e=[],t={}){let{pollMs:o=Gl}=t,r=kr(e);r.current=e;let n=JSON.stringify(e),[a,s]=En([]),[u,d]=En(!0),[g,y]=En(null),m=kr(va([])),f=kr(!1),k=kr(!1),b=ha(h=>{let v=va(h);v!==m.current&&(m.current=v,s(h))},[]),w=ha(async()=>{if(!k.current){k.current=!0;try{let h=ee.getModule(),v=ee.getAll(),C=r.current.filter(x=>gt(x,"secure")),I=x=>C.find(E=>(typeof E=="string"?E:E.key)===x);if(!h||v.length===0&&C.length===0){b([]),f.current=!0,d(!1);return}f.current||d(!0),y(null);let M=[],P=[...v,...C.map(x=>typeof x=="string"?x:x.key).filter(x=>!v.some(E=>E.key===x)).map(x=>({key:x,options:{},description:void 0}))];for(let x of P){let E=I(x.key),re=typeof E=="object"?E:void 0,ve={...re?.expectedValue!==void 0&&{expectedValue:re.expectedValue},...re?.expectedType!==void 0&&{expectedType:re.expectedType}},be=re?.description??x.description;if(x.options.requireAuthentication){M.push({key:x.key,value:jl,storageType:"secure",status:E?"required_present":"optional_present",category:E?"required":"optional",description:be??"Protected by biometric authentication \u2014 value not read by DevTools",...ve,...x.options.keychainService&&{instanceId:x.options.keychainService}});continue}let Y=null;try{Y=await h.getItemAsync(x.key,x.options)}catch{}if(Y===null&&!E)continue;let ye=Y;if(Y)try{ye=JSON.parse(Y)}catch{ye=Y}let ne="optional_present";if(E)if(Y===null)ne="required_missing";else if(re?.expectedValue!==void 0)ne=String(ye)===String(re.expectedValue)?"required_present":"required_wrong_value";else if(re?.expectedType!==void 0){let ce=ye===null?"null":Array.isArray(ye)?"array":typeof ye,Xe=re.expectedType.toLowerCase();ne=ce===Xe||Xe==="string"&&typeof Y=="string"?"required_present":"required_wrong_type"}else ne="required_present";M.push({key:x.key,value:Y===null?void 0:ye,storageType:"secure",status:ne,category:E?"required":"optional",...be&&{description:be},...ve,...x.options.keychainService&&{instanceId:x.options.keychainService}})}b(M)}catch(h){y(h instanceof Error?h:new Error("Failed to read SecureStore")),b([])}finally{f.current=!0,k.current=!1,d(!1)}}},[b,n]);return Ul(()=>{w();let h=ee.subscribe(()=>{w()});if(o<=0)return h;let v=setInterval(w,o);return()=>{h(),clearInterval(v)}},[w,o]),{storageKeys:a,isLoading:u,error:g,refresh:w}}p();import{useState as Cr,useEffect as Vr}from"react";function Ho(e=!1){let[t,o]=Cr([]),[r,n]=Cr(!0),a=()=>{n(!0);try{let u=Ie.getAll().map(d=>{let{instance:g,id:y,encrypted:m,readOnly:f}=d,b=g.getAllKeys()?.length||0;return{id:y,instance:g,encrypted:m,readOnly:f,keyCount:b,size:void 0}});o(u)}catch{o([])}finally{n(!1)}};return Vr(()=>{a()},[]),Vr(()=>{if(!e)return;let s=setInterval(()=>{a()},1e3);return()=>clearInterval(s)},[e]),{instances:t,instanceCount:t.length,isLoading:r,refresh:a}}function Kn(e){let[t,o]=Cr(null);return Vr(()=>{if(!Ie){o(null);return}let r=Ie.get(e);if(!r){o(null);return}let a=r.instance.getAllKeys()?.length||0;o({...r,keyCount:a,size:void 0})},[e]),t}function Jl(e){let[t,o]=Cr(!1);return Vr(()=>{if(!Ie){o(!1);return}o(Ie.has(e))},[e]),t}p();import{useEffect as Yl,useRef as Ta}from"react";import{Check as Xl,macOSColors as to}from"@buoy-gg/shared-ui/web";import{jsx as So,jsxs as Zl}from"react/jsx-runtime";var Ql=2600,xa=180;function ka({onDone:e}){let t=Ta(new Ft.Value(0)).current,o=Ta(e);return o.current=e,Yl(()=>{let r=Ft.sequence([Ft.timing(t,{toValue:1,duration:xa,easing:uo.out(uo.quad),useNativeDriver:!0}),Ft.delay(Ql),Ft.timing(t,{toValue:0,duration:xa,easing:uo.in(uo.quad),useNativeDriver:!0})]);return r.start(({finished:n})=>{n&&o.current()}),()=>r.stop()},[t]),So(Ft.View,{pointerEvents:"box-none",style:[bo.wrap,{opacity:t,transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[-10,0]})}]}],testID:"buoy-storage-save-notice",children:Zl(A,{activeOpacity:.85,onPress:()=>o.current(),style:bo.toast,accessibilityRole:"button",accessibilityLabel:"Saved. Applies on the app's next launch. Tap to dismiss.",testID:"buoy-storage-save-notice-dismiss",children:[So(i,{style:bo.tick,children:So(Xl,{size:10,color:to.semantic.success})}),So(l,{style:bo.saved,children:"Saved"}),So(i,{style:bo.divider}),So(l,{style:bo.detail,children:"applies on next launch"})]})})}var bo=$.create({wrap:{position:"absolute",top:10,left:12,right:12,zIndex:100,elevation:100,alignItems:"center"},toast:{flexDirection:"row",alignItems:"center",paddingVertical:7,paddingLeft:8,paddingRight:12,borderRadius:999,backgroundColor:to.background.card,borderWidth:$.hairlineWidth,borderColor:to.border.default,shadowColor:"#000",shadowOpacity:.4,shadowRadius:14,shadowOffset:{width:0,height:5}},tick:{width:16,height:16,borderRadius:8,marginRight:7,alignItems:"center",justifyContent:"center",backgroundColor:to.semantic.successBackground},saved:{color:to.text.primary,fontSize:12,fontWeight:"600"},divider:{width:$.hairlineWidth,alignSelf:"stretch",marginHorizontal:8,backgroundColor:to.border.default},detail:{color:to.text.muted,fontSize:12}});p();import{useState as ec,useEffect as tc}from"react";import{Trash2 as Ir,CopyButton as oc,SquareDashed as rc,X as nc,ProUpgradeModal as ac,monoFont as ic}from"@buoy-gg/shared-ui/web";import{macOSColors as Ca,night as st}from"@buoy-gg/shared-ui/web";import{useIsPro as sc}from"@buoy-gg/license/web";import Va from"@buoy-gg/shared-ui/web/asyncStorage";import{jsx as qe,jsxs as Ia}from"react/jsx-runtime";function Ma({copyValue:e,mmkvInstances:t=[],activeStorageType:o="all",onClearComplete:r,isSelectMode:n=!1,onToggleSelectMode:a,selectedCount:s=0}){let[u,d]=ec(!1),g=sc();tc(()=>{u&&g&&d(!1)},[u,g]);let y=()=>{if(!g){d(!0);return}me.alert(`Clear ${te.asyncFull}`,`Delete all ${te.asyncFull} keys? This cannot be undone.`,[{text:"Cancel",style:"cancel"},{text:"Clear",style:"destructive",onPress:async()=>{try{await Va.clear(),r?.()}catch(M){me.alert("Error",`Failed: ${M}`)}}}])},m=(M,P)=>{if(!g){d(!0);return}me.alert(`Clear ${P}`,`Delete all keys from ${P}? This cannot be undone.`,[{text:"Cancel",style:"cancel"},{text:"Clear",style:"destructive",onPress:()=>{try{let x=t.find(E=>E.id===M);x&&(x.instance.clearAll(),r?.())}catch(x){me.alert("Error",`Failed: ${x}`)}}}])},f=()=>{if(!g){d(!0);return}me.alert(`Clear All ${te.mmkv}`,`Delete all keys from ${t.length} instances? This cannot be undone.`,[{text:"Cancel",style:"cancel"},{text:"Clear All",style:"destructive",onPress:()=>{try{t.forEach(M=>M.instance.clearAll()),r?.()}catch(M){me.alert("Error",`Failed: ${M}`)}}}])},k=()=>{if(!g){d(!0);return}me.alert("Clear All Storage","Delete all storage data? This cannot be undone.",[{text:"Cancel",style:"cancel"},{text:"Clear All",style:"destructive",onPress:async()=>{try{await Va.clear(),t.forEach(M=>M.instance.clearAll()),r?.()}catch(M){me.alert("Error",`Failed: ${M}`)}}}])},b=o==="all"||o==="async",w=o==="all"||o==="mmkv",h=o==="all",v=b&&!h,C=w&&!h,I=w&&t.length>1&&!h;return Ia(i,{style:ht.container,children:[a&&qe(A,{onPress:a,testID:"buoy-storage-select-mode",accessibilityLabel:n?"Exit selection mode":"Select keys",accessibilityRole:"button",style:[ht.actionButton,n&&ht.actionButtonActive],children:n?Ia(i,{style:ht.selectModeActiveContainer,children:[qe(nc,{size:14,color:st.color.accent}),s>0&&qe(l,{style:ht.selectedCountText,children:s})]}):qe(rc,{size:16,color:st.color.textSecondary})}),!n&&qe(oc,{value:e,size:16,testID:"buoy-storage-export-copy",buttonStyle:ht.actionButton,colors:{idle:st.color.textSecondary,success:Ca.semantic.success,error:Ca.semantic.error}}),!n&&h&&qe(A,{onPress:k,testID:"buoy-storage-clear-all",accessibilityLabel:"Clear all storage",accessibilityRole:"button",style:ht.actionButton,children:qe(Ir,{size:16,color:st.color.danger})}),!n&&v&&qe(A,{onPress:y,testID:"buoy-storage-clear-async",accessibilityLabel:`Clear ${te.asyncFull}`,accessibilityRole:"button",style:ht.actionButton,children:qe(Ir,{size:16,color:st.color.danger})}),!n&&I&&qe(A,{onPress:f,testID:"buoy-storage-clear-mmkv-all",accessibilityLabel:`Clear all ${te.mmkv} instances`,accessibilityRole:"button",style:ht.actionButton,children:qe(Ir,{size:16,color:st.color.danger})}),!n&&C&&t.length===1&&qe(A,{onPress:()=>m(t[0].id,t[0].id),testID:"buoy-storage-clear-mmkv",accessibilityLabel:`Clear ${te.mmkv} instance`,accessibilityRole:"button",style:ht.actionButton,children:qe(Ir,{size:16,color:st.color.danger})}),qe(ac,{visible:u,onClose:()=>d(!1),featureName:"Storage Editing"})]})}var ht=$.create({container:{flexDirection:"row",alignItems:"center",gap:8},actionButton:{width:32,height:32,alignItems:"center",justifyContent:"center",borderRadius:6,backgroundColor:st.color.buttonSurface,borderWidth:1,borderColor:st.color.border},actionButtonActive:{backgroundColor:st.color.accentSoft,borderColor:st.color.accentBorderStrong},selectModeActiveContainer:{flexDirection:"row",alignItems:"center",gap:2},selectedCountText:{fontSize:10,fontWeight:"700",color:st.color.accent,fontFamily:ic}});p();import{useState as cc,useEffect as uc}from"react";import{Trash2 as dc,CopyButton as gc,CheckSquare as yc,EyeOff as pc,ProUpgradeModal as fc,monoFont as mc}from"@buoy-gg/shared-ui/web";import{macOSColors as Ea,night as Ue}from"@buoy-gg/shared-ui/web";import{useIsPro as bc}from"@buoy-gg/license/web";p();Ot();function lc(e,t){if(typeof e.remove=="function"){e.remove(t);return}if(typeof e.delete=="function"){e.delete(t);return}throw new Error("MMKV instance exposes neither remove() nor delete()")}async function Mr(e,t){if(e.length===0)return;let o=e.filter(a=>a.storageType==="async"),r=e.filter(a=>a.storageType==="mmkv"),n=e.filter(a=>a.storageType==="secure");o.length>0&&await ut(o.map(a=>a.key));for(let a of n)await ee.deleteValue(a.key);if(r.length>0){let a={};r.forEach(s=>{let u=s.instanceId||"default";a[u]||(a[u]=[]),a[u].push(s.key)}),Object.entries(a).forEach(([s,u])=>{let d=t.find(g=>g.id===s);d&&u.forEach(g=>lc(d.instance,g))})}}import{jsx as It,jsxs as qo}from"react/jsx-runtime";function Ka({selectedKeys:e,mmkvInstances:t,onDeleteComplete:o,onHideKeys:r,onSelectAll:n,onClearSelection:a,totalVisibleKeys:s}){let[u,d]=cc(!1),g=bc();uc(()=>{u&&g&&d(!1)},[u,g]);let y=e.length,m=y===s&&s>0,f=()=>{let w={};return e.forEach(h=>{let v=h.instanceId?`[${h.storageType}:${h.instanceId}]`:`[${h.storageType}]`;w[`${v} ${h.key}`]=h.value}),{selectedCount:y,keys:w,timestamp:new Date().toISOString()}},k=()=>{y!==0&&r?.(e)},b=()=>{if(y!==0){if(!g){d(!0);return}me.alert("Delete Selected Keys",`Delete ${y} selected key${y>1?"s":""}? This cannot be undone.`,[{text:"Cancel",style:"cancel"},{text:"Delete",style:"destructive",onPress:async()=>{try{await Mr(e,t),o?.()}catch(w){me.alert("Error",`Failed to delete keys: ${w}`)}}}])}};return y===0?null:qo(i,{style:vt.container,children:[qo(i,{style:vt.leftSection,children:[qo(A,{style:vt.selectAllButton,onPress:m?a:n,testID:"buoy-storage-select-all",accessibilityLabel:m?"Deselect all keys":"Select all keys",accessibilityRole:"button",children:[It(yc,{size:14,color:m?Ue.color.accent:Ue.color.textSecondary}),It(l,{style:vt.selectAllText,children:m?"Deselect All":"Select All"})]}),It(i,{style:vt.countBadge,children:qo(l,{style:vt.countText,children:[y," selected"]})})]}),qo(i,{style:vt.actionsSection,children:[It(gc,{value:f(),size:14,testID:"buoy-storage-selection-copy",buttonStyle:vt.actionButton,colors:{idle:Ue.color.accent,success:Ea.semantic.success,error:Ea.semantic.error}}),r&&It(A,{style:vt.actionButton,onPress:k,testID:"buoy-storage-selection-hide",accessibilityLabel:"Hide selected keys",accessibilityRole:"button",children:It(pc,{size:14,color:Ue.color.warning})}),It(A,{style:vt.actionButton,onPress:b,testID:"buoy-storage-selection-delete",accessibilityLabel:"Delete selected keys",accessibilityRole:"button",children:It(dc,{size:14,color:Ue.color.danger})})]}),It(fc,{visible:u,onClose:()=>d(!1),featureName:"Storage Editing"})]})}var vt=$.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",backgroundColor:Ue.color.accentSoft,borderRadius:8,borderWidth:1,borderColor:Ue.color.accentBorderStrong,paddingHorizontal:12,paddingVertical:8,marginBottom:10},leftSection:{flexDirection:"row",alignItems:"center",gap:12},selectAllButton:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:4,paddingHorizontal:8,backgroundColor:Ue.color.surface,borderRadius:6,borderWidth:1,borderColor:Ue.color.border},selectAllText:{fontSize:11,fontWeight:"600",color:Ue.color.textSecondary},countBadge:{backgroundColor:Ue.color.accentFill,paddingHorizontal:8,paddingVertical:4,borderRadius:6},countText:{fontSize:11,fontWeight:"700",color:Ue.color.accent,fontFamily:mc},actionsSection:{flexDirection:"row",alignItems:"center",gap:8},actionButton:{width:28,height:28,alignItems:"center",justifyContent:"center",borderRadius:6,backgroundColor:Ue.color.surface,borderWidth:1,borderColor:Ue.color.border}});p();var Rn=new Set;function Ra(e){return Rn.add(e),()=>{Rn.delete(e)}}function Sc(){Rn.forEach(e=>{try{e()}catch{}})}p();import hc from"@buoy-gg/shared-ui/web/asyncStorage";function Er(e,t=[]){if(e.storageType==="mmkv"){if(e.valueType==="buffer")return"Buffer values can't be edited \u2014 the tool only ever sees their byte length, not their contents.";let o=t.find(r=>r.id===(e.instanceId||"default"));if(o?.readOnly)return`MMKV instance "${o.id}" is registered read-only.`}if(e.storageType==="secure"){if(ee.getAll().find(r=>r.key===e.key)?.options.requireAuthentication)return"Biometric-protected keys can't be edited \u2014 writing one would fire an auth prompt.";if(!ee.getModule())return"No SecureStore module is registered."}return null}function Ba(e,t){if(e.storageType==="mmkv"){let o=Pa(e);if(o==="number"&&(t.trim()===""||Number.isNaN(Number(t))))return"Must be a number \u2014 this MMKV key is stored as a number.";if(o==="boolean"){let r=t.trim().toLowerCase();if(r!=="true"&&r!=="false")return'Must be "true" or "false" \u2014 this MMKV key is stored as a boolean.'}return null}if(Da(e.value))try{JSON.parse(t)}catch(o){return`This key holds JSON \u2014 ${o instanceof Error?o.message:"invalid JSON"}`}return null}function vc(e){if(e==null)return"";if(typeof e=="string"){let t=e.trim();if(t.startsWith("{")||t.startsWith("["))try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return e}return typeof e=="object"?JSON.stringify(e,null,2):String(e)}async function An(e,t,o=[]){let r=Er(e,o);if(r)throw new Error(r);let n=Ba(e,t);if(n)throw new Error(n);switch(e.storageType){case"async":{await hc.setItem(e.key,Aa(e,t));return}case"secure":{await ee.setValue(e.key,Aa(e,t));return}case"mmkv":{let a=e.instanceId||"default",s=o.find(u=>u.id===a);if(!s)throw new Error(`MMKV instance "${a}" is not registered.`);s.instance.set(e.key,wc(e,t));return}default:throw new Error(`Unsupported storage type "${String(e.storageType)}"`)}}function Da(e){return e!==null&&typeof e=="object"}function Aa(e,t){return Da(e.value)?JSON.stringify(JSON.parse(t)):t}function Pa(e){return e.valueType?e.valueType:typeof e.value=="number"?"number":typeof e.value=="boolean"?"boolean":"string"}function wc(e,t){switch(Pa(e)){case"number":return Number(t);case"boolean":return t.trim().toLowerCase()==="true";default:return t}}import{gameUIColors as wo,macOSColors as Kr,night as N,HardDrive as _a}from"@buoy-gg/shared-ui/web";import{useIsPro as Ic}from"@buoy-gg/license/web";import{Fragment as Mc,jsx as J,jsxs as Re}from"react/jsx-runtime";var za=[Kr.semantic.info,Kr.semantic.success,Kr.semantic.warning,Kr.semantic.debug,"#FF6B9D","#00D9FF"];function vo(e){let t=e.split("").reduce((o,r)=>o+r.charCodeAt(0),0);return za[t%za.length]}var Cp=Tc["storage.keys"].free;function Na({requiredStorageKeys:e=[],showFilters:t=!1,ignoredPatterns:o=new Set(["@react_buoy"]),onTogglePattern:r,onAddPattern:n,searchQuery:a="",storageDataRef:s,eventCountByKey:u,lastWriteByKey:d,onViewHistory:g,enabledStorageTypes:y,statusFilter:m,onStatusFilterChange:f,onStatusCountsChange:k,pinnedKeys:b,onTogglePin:w,storageTypeFilter:h,onStorageTypeFilterChange:v,applySafeAreaInset:C,detailKey:I=null,onOpenKey:M,onCloseDetail:P}){let x=Ic(),E=La("storage.keys"),re=La("storage.mmkvInstances"),[ve,be]=oo(!1);ho(()=>{ve&&x&&be(!1)},[ve,x]);let[Y,ye]=oo("all"),ne=m!=null&&f!=null,ce=ne?m:Y,Xe=ne?f:ye,[Qe,xt]=oo("all"),At=h!=null&&v!=null,pe=At?h:Qe,io=At?v:xt,[ae,qt]=oo(null),Ze=Bn(null),Io=Bn(0),Se=Bn(new Map),Ne=ot((c,V)=>{V?Se.current.set(c,V):Se.current.delete(c)},[]),[Ut,Mo]=oo(0),[jt,Eo]=oo(!1),[so,Bt]=oo(new Set),{instances:Ee}=Ho(!1),{storageKeys:nr,isLoading:ar,error:ir,refresh:Gt}=$o(e),Qr=je(()=>Ee.map(c=>({instance:c.instance,id:c.id})),[Ee]),{storageKeys:Ko,isLoading:Zr,error:Ro,refresh:lo}=Mn(Qr,e),en=je(()=>ae?Ko.filter(c=>c.instanceId===ae):Ko,[Ko,ae]),{storageKeys:Jt,isLoading:sr,error:tn,refresh:lr}=wa(e),j=je(()=>[...nr,...en,...Jt],[nr,en,Jt]),Ve=je(()=>{if(!I)return null;let c=wr(I);return j.find(V=>wr(V)===c)??I},[I,j]),on=ar||Zr||sr,cr=ir||Ro||tn,Ke=ot(()=>{Gt(),lo(),lr()},[Gt,lo,lr]),nt=ot(c=>c.instanceId?`${c.storageType}-${c.instanceId}-${c.key}`:`${c.storageType}-${c.key}`,[]),rn=ot(()=>{Eo(c=>(c&&Bt(new Set),!c))},[]),at=ot((c,V)=>{let K=nt(c);Bt(et=>{let G=new Set(et);return V?G.add(K):G.delete(K),G})},[nt]),nn=ot(()=>{Bt(new Set),Eo(!1),Ke()},[Ke]),Ao=ot(c=>{c.forEach(V=>n?.(V.key)),Bt(new Set),Eo(!1)},[n]),Yt=ot(async(c,V)=>{if(!x)throw be(!0),new Error("Editing storage values is a Pro feature.");await An(c,V,Ee),Ke(),Mo(K=>K+1)},[x,Ee,Ke]),an=ot(c=>{Yt(c,JSON.stringify(!c.value)).catch(V=>{me.alert("Couldn't save",V instanceof Error?V.message:String(V))})},[Yt]),ur=ot((c,V)=>{if(!x){be(!0);return}me.alert("Delete key",`Delete "${c.key}"? This cannot be undone.`,[{text:"Cancel",style:"cancel"},{text:"Delete",style:"destructive",onPress:async()=>{try{await Mr([c],Ee.map(K=>({id:K.id,instance:K.instance}))),Ke(),V?.()}catch(K){me.alert("Error",`Failed to delete key: ${K}`)}}}])},[x,Ee,Ke]),Bo=ot(c=>Er(c,Ee),[Ee]),sn=je(()=>{let c=j,V={valid:c.filter(X=>X.status==="required_present"||X.status==="optional_present").length,missing:c.filter(X=>X.status==="required_missing").length,issues:c.filter(X=>X.status==="required_wrong_value"||X.status==="required_wrong_type").length,total:c.length},K=c.filter(X=>X.storageType==="async"),et=c.filter(X=>X.storageType==="mmkv"),G=c.filter(X=>X.storageType==="secure");return{summary:{valid:V.valid,missing:V.missing,issues:V.issues,total:V.total,timestamp:new Date().toISOString()},asyncStorage:K.reduce((X,Be)=>(X[Be.key]=Be.value,X),{}),mmkv:et.reduce((X,Be)=>{let Dt=Be.instanceId||"default";return X[Dt]||(X[Dt]={}),X[Dt][Be.key]=Be.value,X},{}),secure:G.reduce((X,Be)=>(X[Be.key]=Be.value,X),{})}},[j]);ho(()=>{s&&(s.current=j)},[j,s]),ho(()=>{let c,V=xr(K=>{clearTimeout(c),c=setTimeout(()=>{Gt()},100)});return()=>{clearTimeout(c),V()}},[Gt]),ho(()=>{let c,V=Ra(()=>{clearTimeout(c),c=setTimeout(Ke,100)});return()=>{clearTimeout(c),V()}},[Ke]),ho(()=>{let c,V=yr(K=>{(ae===null||K.instanceId===ae)&&(clearTimeout(c),c=setTimeout(()=>{lo()},100))});return()=>{clearTimeout(c),V()}},[lo,ae]);let Xt=je(()=>{let c=j,V=c.filter(G=>!ze(G.key)),K=c.filter(G=>ze(G.key));return{totalCount:c.length,requiredCount:V.filter(G=>G.category==="required").length,missingCount:V.filter(G=>G.status==="required_missing").length,wrongValueCount:V.filter(G=>G.status==="required_wrong_value").length,wrongTypeCount:V.filter(G=>G.status==="required_wrong_type").length,presentRequiredCount:V.filter(G=>G.status==="required_present").length,optionalCount:V.filter(G=>G.category==="optional").length,mmkvCount:c.filter(G=>G.storageType==="mmkv").length,asyncCount:c.filter(G=>G.storageType==="async").length,secureCount:c.filter(G=>G.storageType==="secure").length,devToolsCount:K.length}},[j]),bt=je(()=>{let c=j.filter(B=>!ze(B.key));pe!=="all"&&(c=c.filter(B=>B.storageType===pe));let V=c.filter(B=>B.status==="required_present"||B.status==="optional_present").length,K=c.filter(B=>B.status==="required_missing").length,et=c.filter(B=>B.status==="required_wrong_type"||B.status==="required_wrong_value").length,G=0,X=0,Be=0,Dt=0;return ce==="all"?(G=j.filter(B=>!ze(B.key)&&B.storageType==="async"&&(B.status==="required_present"||B.status==="optional_present")).length,X=j.filter(B=>!ze(B.key)&&B.storageType==="mmkv"&&(B.status==="required_present"||B.status==="optional_present")).length,Be=j.filter(B=>!ze(B.key)&&B.storageType==="secure"&&(B.status==="required_present"||B.status==="optional_present")).length,Dt=G+X+Be):ce==="missing"?(G=j.filter(B=>!ze(B.key)&&B.storageType==="async"&&B.status==="required_missing").length,X=j.filter(B=>!ze(B.key)&&B.storageType==="mmkv"&&B.status==="required_missing").length,Be=j.filter(B=>!ze(B.key)&&B.storageType==="secure"&&B.status==="required_missing").length,Dt=G+X+Be):ce==="issues"&&(G=j.filter(B=>!ze(B.key)&&B.storageType==="async"&&(B.status==="required_wrong_type"||B.status==="required_wrong_value")).length,X=j.filter(B=>!ze(B.key)&&B.storageType==="mmkv"&&(B.status==="required_wrong_type"||B.status==="required_wrong_value")).length,Be=j.filter(B=>!ze(B.key)&&B.storageType==="secure"&&(B.status==="required_wrong_type"||B.status==="required_wrong_value")).length,Dt=G+X+Be),{validCount:V,missingCount:K,issuesCount:et,asyncCount:G,mmkvCount:X,secureCount:Be,totalCount:Dt}},[j,ce,pe]);ho(()=>{k?.({validCount:bt.validCount,missingCount:bt.missingCount,issuesCount:bt.issuesCount})},[k,bt.validCount,bt.missingCount,bt.issuesCount]);let co=je(()=>[...j].sort((c,V)=>{let K={required_missing:1,required_wrong_type:2,required_wrong_value:3,required_present:4,optional_present:5};return(K[c.status]||999)-(K[V.status]||999)}),[j]),$n=je(()=>Array.from(new Set(j.map(c=>c.key))).sort(),[j]),We=je(()=>{let c=co;if(y&&y.size>0&&(c=c.filter(V=>y.has(V.storageType))),c=c.filter(V=>!Array.from(o).some(et=>V.key.includes(et))),a){let V=a.toLowerCase();c=c.filter(K=>K.key.toLowerCase().includes(V))}switch(ce){case"all":c=c.filter(V=>V.status==="required_present"||V.status==="optional_present");break;case"missing":c=c.filter(V=>V.status==="required_missing");break;case"issues":c=c.filter(V=>V.status==="required_wrong_type"||V.status==="required_wrong_value");break}if(pe!=="all"&&(c=c.filter(V=>V.storageType===pe)),b&&b.size>0){let V=c.filter(et=>b.has(et.key)),K=c.filter(et=>!b.has(et.key));c=[...V,...K]}return c},[co,ce,pe,o,a,ae,y,b]),S=je(()=>We.slice(0,E),[We,E]),T=je(()=>Math.max(0,We.length-E),[We.length,E]),F=T>0,fe=je(()=>{let c=We.filter(K=>!ze(K.key));return{totalCount:We.length,requiredCount:c.filter(K=>K.category==="required").length,missingCount:c.filter(K=>K.status==="required_missing").length,wrongValueCount:c.filter(K=>K.status==="required_wrong_value").length,wrongTypeCount:c.filter(K=>K.status==="required_wrong_type").length,presentRequiredCount:c.filter(K=>K.status==="required_present").length,optionalCount:c.filter(K=>K.category==="optional").length,mmkvCount:We.filter(K=>K.storageType==="mmkv").length,asyncCount:We.filter(K=>K.storageType==="async").length,secureCount:We.filter(K=>K.storageType==="secure").length,devToolsCount:We.filter(K=>ze(K.key)).length}},[We]),ue=je(()=>S.filter(c=>so.has(nt(c))),[S,so,nt]),kt=ot(()=>{let c=new Set(S.map(nt));Bt(c)},[S,nt]),Do=ot(()=>{Bt(new Set)},[]),Po=Xt.requiredCount>0?Math.round(Xt.presentRequiredCount/Xt.requiredCount*100):Xt.totalCount>0?100:0,Bi=Po>=90?"OPTIMAL":Po>=70?"WARNING":"CRITICAL",Di=Po>=90?wo.success:Po>=70?wo.warning:wo.error;if(Ve)return J(i,{style:_.root,children:J(da,{storageKey:Ve,editBlockedReason:Bo(Ve),eventCount:u?.[Ve.key],onSave:c=>Yt(Ve,c),onViewHistory:g?()=>g(Ve.key):void 0,onDeleteKey:c=>ur(c,()=>P?.()),onHideKey:c=>{Ao([c]),P?.()},isPinned:b?.has(Ve.key)??!1,onTogglePin:w,applySafeAreaInset:C})});if(on&&j.length===0)return Re(i,{style:_.emptyState,children:[J(Fa,{size:48,color:N.color.textTertiary}),J(l,{style:_.emptyTitle,children:"Loading storage keys..."})]});if(cr)return Re(i,{style:_.emptyState,children:[J(Fa,{size:48,color:wo.error}),J(l,{style:[_.emptyTitle,{color:wo.error}],children:"Error loading storage"}),J(l,{style:_.emptySubtitle,children:cr.message})]});let Pi=Re(Mc,{children:[pe==="mmkv"&&Ee.length===0&&Re(i,{style:_.emptyMMKVState,children:[J(l,{style:_.emptyMMKVTitle,children:"No MMKV Instances Detected"}),J(l,{style:_.emptyMMKVSubtitle,children:"MMKV instances must be registered with registerMMKVInstance()"}),J(l,{style:_.emptyMMKVCode,children:`import { registerMMKVInstance } from '@buoy-gg/storage';
3
+
4
+ const storage = createMMKV();
5
+ registerMMKVInstance('mmkv.default', storage);`})]}),pe==="mmkv"&&Ee.length>0&&Re(i,{style:_.instanceNavbar,children:[Re(i,{style:_.instanceNavbarHeader,children:[J(l,{style:_.instanceNavbarLabel,children:"INSTANCES"}),Ee.length>re&&J(Wa,{style:{transform:[{scale:.85}]}})]}),Re(Lt,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:_.instanceNavbarScroll,children:[(x||Ee.length===1)&&Re(A,{onPress:()=>qt(null),testID:"buoy-storage-instance-all",accessibilityRole:"button",accessibilityLabel:`All ${te.mmkv} instances`,style:[_.instanceNavbarButton,ae===null&&_.instanceNavbarButtonActive],children:[J(_a,{size:12,color:ae===null?N.color.text:N.color.textSecondary}),J(l,{style:[_.instanceNavbarButtonText,ae===null&&_.instanceNavbarButtonTextActive],children:"All"}),J(i,{style:_.instanceNavbarBadge,children:J(l,{style:_.instanceNavbarBadgeText,children:Ee.reduce((c,V)=>c+V.keyCount,0)})})]}),Ee.map((c,V)=>{let K=V>=re;return Re(A,{testID:`buoy-storage-instance-${c.id}`,accessibilityRole:"button",accessibilityLabel:`MMKV instance ${c.id}`,onPress:()=>{K?be(!0):qt(c.id)},style:[_.instanceNavbarButton,c.id===ae&&_.instanceNavbarButtonActive,{borderColor:K?N.color.border:vo(c.id)+"40",backgroundColor:c.id===ae?vo(c.id)+"20":N.color.surfaceElevated,opacity:K?.5:1}],children:[J(_a,{size:12,color:c.id===ae?vo(c.id):N.color.textSecondary}),J(l,{style:[_.instanceNavbarButtonText,c.id===ae&&{color:vo(c.id),fontWeight:"700"}],children:c.id}),J(i,{style:[_.instanceNavbarBadge,c.id===ae&&{backgroundColor:vo(c.id)+"30"}],children:J(l,{style:[_.instanceNavbarBadgeText,c.id===ae&&{color:vo(c.id)}],children:c.keyCount})})]},c.id)})]})]})]}),Oi=J(Ma,{copyValue:sn,mmkvInstances:Ee.map(c=>({id:c.id,instance:c.instance})),activeStorageType:pe,onClearComplete:Ke,isSelectMode:jt,onToggleSelectMode:rn,selectedCount:so.size}),Li=jt?J(Ka,{selectedKeys:ue,mmkvInstances:Ee.map(c=>({id:c.id,instance:c.instance})),onDeleteComplete:nn,onHideKeys:Ao,onSelectAll:kt,onClearSelection:Do,totalVisibleKeys:S.length}):null,Fi=F?Re(A,{style:_.limitBanner,onPress:()=>be(!0),activeOpacity:.8,testID:"buoy-storage-locked-banner",accessibilityRole:"button",children:[Re(i,{style:_.limitBannerContent,children:[Re(i,{style:_.limitBannerLeft,children:[J(xc,{size:16,color:N.color.accent}),J(l,{style:_.limitBannerText,children:a?`${T} matching ${T===1?"key":"keys"} in locked storage`:`${T} keys locked`})]}),J(Wa,{})]}),J(l,{style:_.limitBannerSubtext,children:a?"Upgrade to Pro to search your full storage":"Upgrade to Pro to unlock full storage access"})]}):null,Wi=(()=>{let c=j.some(K=>!ze(K.key)),V;return a||!c?(V=Vc({subject:"keys",verb:"registered",search:a,total:c?1:0,waiting:{otto:"empty",title:"No storage keys",message:"Nothing is registered for this tool to read."}}),a&&c&&(V={...V,message:"No keys match. Clear the search to see them."})):ce==="missing"?V={otto:"thumbsup",title:"No missing keys",message:"All required keys are present"}:ce==="issues"?V={otto:"cool",title:"No issues found",message:"All storage keys are correctly configured"}:V={otto:"broken",title:"No valid keys found",message:"All keys have issues or are missing"},J(Cc,{...V,testID:"buoy-storage-keys-empty"})})(),_i=J(kc,{visible:ve,onClose:()=>be(!1),featureName:"Storage Keys"});return Re(i,{style:_.root,children:[Ut>0?J(ka,{onDone:()=>Mo(0)},Ut):null,Re(Lt,{testID:"buoy-storage-scroll",ref:Ze,onScroll:c=>{Io.current=c.nativeEvent.contentOffset.y},scrollEventThrottle:32,style:_.scrollContainer,contentContainerStyle:_.container,showsVerticalScrollIndicator:!1,children:[J(i,{style:_.backgroundGrid}),J(ga,{stats:Xt,tabStats:bt,healthPercentage:Po,healthStatus:Bi,healthColor:Di,activeFilter:ce,onFilterChange:Xe,activeStorageType:pe,onStorageTypeChange:io,showStatus:!ne}),Pi,We.length>0?Re(i,{style:_.keysSection,children:[Re(i,{style:_.sectionHeader,children:[Re(i,{style:_.sectionHeaderLeft,children:[Re(l,{style:_.sectionTitle,children:[ce==="all"?"KEYS":ce==="missing"?"MISSING KEYS":"ISSUES TO FIX",pe!=="all"&&` (${pe.toUpperCase()})`]}),J(i,{style:_.countBadge,children:J(l,{style:_.countText,children:S.length})})]}),Oi]}),Li,J(vn,{title:"",count:-1,keys:S,emptyMessage:"",isSelectMode:jt,selectedKeys:so,onSelectionChange:at,eventCountByKey:u,onViewHistory:g,onHideKey:c=>Ao([c]),onToggleKey:an,onDeleteKey:ur,editBlockedFor:Bo,pinnedKeys:b,onTogglePin:w,onRowRef:Ne,onOpenKey:M}),Fi]}):Wi,J(l,{style:_.techFooter,children:"ASYNC STORAGE | MMKV | SECURE STORAGE BACKENDS"}),_i]})]})}var _=$.create({root:{flex:1,minHeight:0},editorOverlay:{...Oa,zIndex:10},scrollContainer:{flex:1,backgroundColor:"transparent"},container:{padding:12,paddingBottom:120},backgroundGrid:{...Oa,opacity:.006,backgroundColor:wo.info},techFooter:{fontSize:8,color:N.color.textTertiary,fontFamily:Uo,textAlign:"center",marginTop:20,letterSpacing:1,opacity:.5},keysSection:{marginTop:8,backgroundColor:N.color.bg,borderRadius:12,padding:12,borderWidth:1,borderColor:N.color.border},sectionHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:10,paddingBottom:6,borderBottomWidth:1,borderBottomColor:N.color.separator},sectionHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8},sectionTitle:{fontSize:12,fontWeight:"600",color:N.color.textSecondary,letterSpacing:.4,textTransform:"uppercase"},countBadge:{backgroundColor:N.color.surfaceElevated,paddingHorizontal:8,paddingVertical:3,borderRadius:6,borderWidth:1,borderColor:N.color.border},countText:{fontSize:11,fontWeight:"600",color:N.color.text,fontFamily:Uo},emptyState:{alignItems:"center",justifyContent:"center",paddingVertical:48},emptyTitle:{fontSize:16,fontWeight:"600",color:N.color.text,marginTop:12,marginBottom:8},emptySubtitle:{fontSize:13,color:N.color.textSecondary,textAlign:"center"},emptyMMKVState:{backgroundColor:N.color.surface,borderRadius:12,padding:20,borderWidth:1,borderColor:N.color.border,marginTop:8,alignItems:"center"},emptyMMKVTitle:{fontSize:14,fontWeight:"600",color:N.color.text,marginBottom:6},emptyMMKVSubtitle:{fontSize:12,color:N.color.textSecondary,textAlign:"center",marginBottom:12},emptyMMKVCode:{fontSize:10,fontFamily:Uo,color:N.color.accent,backgroundColor:N.color.bg,padding:12,borderRadius:8,borderWidth:1,borderColor:N.color.border,alignSelf:"stretch"},instanceNavbar:{marginTop:12,marginBottom:8,backgroundColor:N.color.surface,borderRadius:10,borderWidth:1,borderColor:N.color.border,padding:10,shadowColor:"#000",shadowOpacity:.08,shadowRadius:6,shadowOffset:{width:0,height:2}},instanceNavbarHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8,paddingLeft:2},instanceNavbarLabel:{fontSize:9,fontWeight:"700",color:N.color.textTertiary,textTransform:"uppercase",letterSpacing:1},instanceNavbarScroll:{gap:8,paddingRight:8},instanceNavbarButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8,backgroundColor:N.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:N.color.border,minWidth:90},instanceNavbarButtonActive:{borderWidth:1.5,shadowColor:"#000",shadowOpacity:.1,shadowRadius:4,shadowOffset:{width:0,height:1}},instanceNavbarButtonText:{fontSize:11,fontWeight:"600",color:N.color.textSecondary,fontFamily:Uo,flex:1},instanceNavbarButtonTextActive:{fontWeight:"700",color:N.color.text},instanceNavbarBadge:{backgroundColor:N.color.bg,paddingHorizontal:6,paddingVertical:2,borderRadius:6,minWidth:24,alignItems:"center"},instanceNavbarBadgeText:{fontSize:10,fontWeight:"700",color:N.color.textSecondary,fontFamily:Uo},clearSearchButton:{marginTop:16,paddingHorizontal:16,paddingVertical:8,backgroundColor:N.color.surfaceElevated,borderRadius:6,borderWidth:1,borderColor:N.color.border},clearSearchText:{fontSize:13,color:N.color.text,fontWeight:"500"},limitBanner:{backgroundColor:N.color.surface,borderRadius:10,borderWidth:1,borderColor:N.color.accentBorderStrong,padding:12,marginTop:12},limitBannerContent:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:4},limitBannerLeft:{flexDirection:"row",alignItems:"center",gap:8},limitBannerText:{color:N.color.text,fontSize:13,fontWeight:"600"},limitBannerSubtext:{color:N.color.textTertiary,fontSize:11}});import{jsx as Ec}from"react/jsx-runtime";function Dn({requiredStorageKeys:e=[],showFilters:t=!1,ignoredPatterns:o=new Set,onTogglePattern:r,onAddPattern:n,searchQuery:a="",storageDataRef:s,eventCountByKey:u,lastWriteByKey:d,onViewHistory:g,enabledStorageTypes:y,statusFilter:m,onStatusFilterChange:f,onStatusCountsChange:k,pinnedKeys:b,onTogglePin:w,applySafeAreaInset:h,storageTypeFilter:v,onStorageTypeFilterChange:C,detailKey:I,onOpenKey:M,onCloseDetail:P}){return Ec(Na,{requiredStorageKeys:e,showFilters:t,ignoredPatterns:o,onTogglePattern:r,onAddPattern:n,searchQuery:a,storageDataRef:s,eventCountByKey:u,lastWriteByKey:d,onViewHistory:g,enabledStorageTypes:y,statusFilter:m,onStatusFilterChange:f,onStatusCountsChange:k,pinnedKeys:b,onTogglePin:w,applySafeAreaInset:h,storageTypeFilter:v,onStorageTypeFilterChange:C,detailKey:I,onOpenKey:M,onCloseDetail:P})}import{ProFeatureBanner as xu}from"@buoy-gg/shared-ui/web";p();import{useMemo as Ac}from"react";import{useEventStoreEvents as Bc}from"@buoy-gg/shared-ui/web";p();import{BaseEventStore as Kc}from"@buoy-gg/shared-ui/web";function jo(e){return!!e&&typeof e=="object"&&e.__buoyValueOnDevice===!0}function Go(e){return e.storageType!=="async"||!e.data?{}:{pairs:e.data.pairs,prevPairs:e.data.prevPairs}}function $a(e){let t=e.data;if(!t)return!1;let{pairs:o,prevPairs:r}=Go(e);return jo(t.value)||jo(t.prevValue)||jo(o)||jo(r)}var Rc=0;function Rr(){return`se-${Date.now()}-${++Rc}`}var Pn=class extends Kc{constructor(){super({storeName:"storage",maxEvents:500});this.asyncStorageUnsubscribe=null;this.mmkvUnsubscribe=null;this.hasScannedInitialState=!1}async scanExistingState(){if(this.hasScannedInitialState)return;this.hasScannedInitialState=!0;let o=new Date,r=Ie.getAll();for(let{id:n,instance:a}of r)try{let s=a.getAllKeys();for(let u of s){let{value:d,type:g}=$e(a,u),m={string:"set.string",number:"set.number",boolean:"set.boolean",buffer:"set.buffer"}[g]??"set.string";this.addEvent({action:m,timestamp:o,instanceId:n,data:{key:u,value:d,valueType:g,initialScan:!0},storageType:"mmkv",id:Rr()})}}catch{}try{let{asyncStorage:n,readMany:a}=(Ot(),Hi(Un));if(n){let s=await n.getAllKeys();if(s.length>0){let u=await a(s);for(let[d,g]of u)this.addEvent({action:"setItem",timestamp:o,data:{key:d,value:g??void 0,initialScan:!0},storageType:"async",id:Rr()})}}}catch{}}async startCapturing(){fa()||await pa(),this.asyncStorageUnsubscribe||(this.asyncStorageUnsubscribe=xr(o=>{let r={...o,storageType:"async",id:Rr()};this.addEvent(r)})),this.mmkvUnsubscribe||(this.mmkvUnsubscribe=yr(o=>{let r={...o,storageType:"mmkv",id:Rr()};this.addEvent(r)})),await this.scanExistingState()}stopCapturing(){this.asyncStorageUnsubscribe&&(this.asyncStorageUnsubscribe(),this.asyncStorageUnsubscribe=null),this.mmkvUnsubscribe&&(this.mmkvUnsubscribe(),this.mmkvUnsubscribe=null)}isCapturing(){return this.asyncStorageUnsubscribe!==null||this.mmkvUnsubscribe!==null}getEventsByType(o){return this.events.filter(r=>r.storageType===o)}replaceEvents(o){let r=new Map;for(let a of this.events)$a(a)||r.set(a.id,a);let n=o.map(a=>{let s=r.get(a.id);return!s||!$a(a)?a:{...a,data:{...a.data,value:s.data?.value,prevValue:s.data?.prevValue,...Go(s)}}});super.replaceEvents(n)}hydrateEvent(o){let r=this.events.findIndex(s=>s.id===o.id);if(r===-1)return;let n=this.events[r],a=this.events.slice();a[r]={...n,...o,timestamp:n.timestamp,data:{...n.data,...o.data}},super.replaceEvents(a)}},wt=new Pn;function On(e={}){let{storageType:t="all",maxEvents:o=500,enabled:r=!0}=e,n=Ac(()=>t==="all"?void 0:d=>d.filter(g=>g.storageType===t),[t]),{events:a,clearEvents:s,isActive:u}=Bc(wt,{maxEvents:o,enabled:r,select:n});return{events:a,clearEvents:s,isCapturing:u}}p();import{useState as Dr,useCallback as yt,useMemo as $t,useEffect as Xa,useRef as Nc}from"react";import Qa from"@buoy-gg/shared-ui/web/asyncStorage";import{formatRelativeTime as Wr,macOSColors as Pr,night as no,parseValue as Or,devToolsStorageKeys as Za,GitBranch as $c,EventStepperFooter as Hc,EventHistoryViewer as qc,copyToClipboard as Uc,ProUpgradeModal as jc,monoFont as ei}from"@buoy-gg/shared-ui/web";import{useIsPro as Gc}from"@buoy-gg/license/web";p();import{computeLineDiff as Gp,DiffType as Jp,ABSENT_VALUE as Ha,isAbsent as Yp}from"@buoy-gg/shared-ui/web/dataViewer";p();import{ThemedSplitView as qa}from"@buoy-gg/shared-ui/web/dataViewer";p();import{diffThemes as Ua,gitClassicTheme as rf,devToolsDefaultTheme as nf}from"@buoy-gg/shared-ui/web/dataViewer";p();import{night as ja}from"@buoy-gg/shared-ui/web";import{TreeDiffViewer as Dc}from"@buoy-gg/shared-ui/web/dataViewer";import{jsx as Ja}from"react/jsx-runtime";function Ya({oldValue:e,newValue:t,scrollEnabled:o=!0}){return Ja(i,{style:o?Ga.container:Ga.containerInline,children:Ja(Dc,{oldValue:e,newValue:t,theme:"dark",scrollEnabled:o})})}var Ga=$.create({container:{flex:1,backgroundColor:ja.color.bg},containerInline:{backgroundColor:ja.color.bg}});p();function Jo(e){switch(e){case"setItem":return"SET";case"removeItem":return"REMOVE";case"mergeItem":return"MERGE";case"clear":return"CLEAR";case"multiSet":return"MULTI SET";case"multiRemove":return"MULTI REMOVE";case"multiMerge":return"MULTI MERGE";case"set.string":case"set.number":case"set.boolean":case"set.buffer":return"SET";case"delete":return"REMOVE";case"clearAll":return"CLEAR";case"get.string":case"get.number":case"get.boolean":case"get.buffer":return"GET";default:return"UNKNOWN ACTION"}}p();import{night as Ae,Lock as Pc,monoFont as Oc}from"@buoy-gg/shared-ui/web";import{jsx as Ln,jsxs as Fc}from"react/jsx-runtime";var Lc={copy:{color:Ae.color.accent,backgroundColor:Ae.color.accentSoft,borderColor:Ae.color.accentBorderStrong,textColor:Ae.color.accent},jump:{color:Ae.color.warning,backgroundColor:Ae.color.warningSoft,borderColor:Ae.color.warning+"40",textColor:Ae.color.warning},undo:{color:Ae.color.info,backgroundColor:Ae.color.infoSoft,borderColor:Ae.color.info+"40",textColor:Ae.color.info}};function Br({onPress:e,text:t,type:o,disabled:r=!1,locked:n=!1}){let a=Lc[o],s=r||n;return Fc(A,{disabled:s,onPress:e,style:[Ar.button,{backgroundColor:s?Ae.color.fill:a.backgroundColor,borderColor:s?Ae.color.fillTertiary:a.borderColor,opacity:r?.5:1}],activeOpacity:.7,testID:`buoy-storage-action-${o}`,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:s},children:[n?Ln(Pc,{size:10,color:Ae.color.textTertiary,style:Ar.lockIcon}):Ln(i,{style:[Ar.dot,{backgroundColor:s?Ae.color.textTertiary:a.color}]}),Ln(l,{style:[Ar.text,{color:s?Ae.color.textTertiary:a.textColor}],children:t})]})}var Ar=$.create({button:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:6,borderWidth:1,paddingHorizontal:12,paddingVertical:6,height:25,minWidth:70,shadowOffset:{width:0,height:1},shadowOpacity:.2,shadowRadius:2,elevation:2},dot:{width:5,height:5,borderRadius:3,marginRight:6,shadowColor:Ae.color.text,shadowOffset:{width:0,height:0},shadowOpacity:.6,shadowRadius:2},lockIcon:{marginRight:4},text:{fontSize:10,fontWeight:"600",letterSpacing:.5,textTransform:"uppercase",fontFamily:Oc,height:12}});p();Ot();import{isDevToolsStorageKey as Wc}from"@buoy-gg/shared-ui/web";import To from"@buoy-gg/shared-ui/web/asyncStorage";function Nt(e){return!!e&&typeof e=="object"&&e.__buoyValueOnDevice===!0}async function Yo(e){let{action:t,data:o}=e;if(Nt(o?.prevValue)||Nt(o?.prevPairs))throw new Error("Cannot undo: previous value is still on the device \u2014 fetch getEventDetail first");switch(t){case"setItem":case"mergeItem":o?.key&&(o.prevValue===null||o.prevValue===void 0?await To.removeItem(o.key):await To.setItem(o.key,o.prevValue));break;case"removeItem":o?.key&&o.prevValue!==null&&o.prevValue!==void 0&&await To.setItem(o.key,o.prevValue);break;case"multiSet":case"multiMerge":if(o?.prevPairs&&o.prevPairs.length>0)for(let[r,n]of o.prevPairs)n===null?await To.removeItem(r):await To.setItem(r,n);break;case"multiRemove":if(o?.prevPairs&&o.prevPairs.length>0)for(let[r,n]of o.prevPairs)n!==null&&await To.setItem(r,n);break;case"clear":if(o?.prevPairs&&o.prevPairs.length>0){let r=o.prevPairs.filter(([,n])=>n!==null);r.length>0&&await Pt(r)}break;default:throw new Error(`Cannot undo unknown action type: ${t}`)}}async function Xo(e,t){if(t<0||t>=e.length)throw new Error(`Invalid event index: ${t}`);for(let s of e){let u=s.data;if(Nt(u?.value)||Nt(u?.prevValue)||Nt(u?.pairs)||Nt(u?.prevPairs))throw new Error("Cannot jump: some event values are still on the device \u2014 fetch getEventDetail first")}let o=new Map;for(let s=0;s<=t;s++)zc(e[s],o);let r=new Set;for(let s of e)_c(s,r);let n=[],a=[];for(let s of r){if(Wc(s))continue;let u=o.get(s);u==null?a.push(s):n.push([s,u])}a.length>0&&await ut(a),n.length>0&&await Pt(n)}function _c(e,t){let{data:o}=e;if(o){if(o.key&&t.add(o.key),o.keys)for(let r of o.keys)t.add(r);if(o.pairs)for(let[r]of o.pairs)t.add(r);if(o.prevPairs)for(let[r]of o.prevPairs)t.add(r)}}function zc(e,t){let{action:o,data:r}=e;switch(o){case"setItem":r?.key&&r?.value!==void 0&&t.set(r.key,r.value);break;case"removeItem":r?.key&&t.set(r.key,null);break;case"mergeItem":if(r?.key&&r?.value!==void 0){let n=t.get(r.key);if(n)try{let a=JSON.parse(n),s=JSON.parse(r.value),u={...a,...s};t.set(r.key,JSON.stringify(u))}catch{t.set(r.key,r.value)}else t.set(r.key,r.value)}break;case"multiSet":if(r?.pairs)for(let[n,a]of r.pairs)t.set(n,a);break;case"multiRemove":if(r?.keys)for(let n of r.keys)t.set(n,null);break;case"multiMerge":if(r?.pairs)for(let[n,a]of r.pairs){let s=t.get(n);if(s)try{let u=JSON.parse(s),d=JSON.parse(a),g={...u,...d};t.set(n,JSON.stringify(g))}catch{t.set(n,a)}else t.set(n,a)}break;case"clear":t.clear();break}}function Qo(e){let{action:t,data:o}=e;switch(t){case"setItem":case"mergeItem":case"removeItem":return!!o?.key&&!Nt(o.prevValue);case"multiSet":case"multiRemove":case"multiMerge":case"clear":return!!o?.prevPairs&&o.prevPairs.length>0&&!Nt(o.prevPairs);default:return!1}}import{Fragment as Xc,jsx as Ge,jsxs as oi}from"react/jsx-runtime";var xo=-1,Lr={prior:{label:"BEFORE #1",timestamp:"value before first event",relativeTime:"not captured",badge:"PRIOR"},absent:{label:"NO PRIOR VALUE",timestamp:"key did not exist",relativeTime:"created here",badge:"ABSENT"},scanned:{label:"ALREADY PRESENT",timestamp:"value found at startup",relativeTime:"not a write",badge:"SCANNED"}};function Fr(e){switch(e){case"setItem":case"multiSet":return Pr.semantic.success;case"removeItem":case"multiRemove":case"clear":return Pr.semantic.error;case"mergeItem":case"multiMerge":return Pr.semantic.info;default:return Pr.text.muted}}function ti(e){let t=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),r=String(e.getSeconds()).padStart(2,"0"),n=String(e.getMilliseconds()).padStart(3,"0");return`${t}:${o}:${r}.${n}`}var Jc={hideLineNumbers:!1,disableWordDiff:!1,showDiffOnly:!1,compareMethod:"words",contextLines:3,lineOffset:0},Yc=[];function _r({conversation:e,selectedEventIndex:t=0,onEventIndexChange:o=()=>{},disableInternalFooter:r=!1}){let n=Gc(),[a,s]=Dr(!1),[u,d]=Dr("split"),[g,y]=Dr(Math.max(xo,t-1)),[m,f]=Dr(t),k=Nc(!1),b=$t(()=>e.events.sort((Se,Ne)=>Se.timestamp.getTime()-Ne.timestamp.getTime()),[e.events]),w=b.length;Xa(()=>{if(k.current)return;(async()=>{try{let Ne=await Qa.getItem(Za.storage.diffViewerMode());(Ne==="split"||Ne==="tree")&&d(Ne),k.current=!0}catch{}})()},[]),Xa(()=>{let Se=Math.min(w-1,Math.max(0,t)),Ne=Math.max(xo,Math.min(Se-1,t-1));y(Ne),f(Se)},[t,w]);let h=yt(async Se=>{d(Se);try{await Qa.setItem(Za.storage.diffViewerMode(),Se)}catch{}},[]),v=b[t],C=v?.action,I=g===xo,M=I?void 0:b[Math.max(0,Math.min(w-1,g))],P=b[Math.max(0,Math.min(w-1,m))],x=$t(()=>{let Se=P?.data;return Se?.initialScan?"scanned":Se?.prevValue===null||Se?.prevValue===void 0?"absent":"prior"},[P]),E=$t(()=>x==="absent"?Ha:x==="scanned"?Or(P?.data?.value):Or(P?.data?.prevValue),[x,P]),re=$t(()=>I?{index:xo,label:Lr[x].label,timestamp:Lr[x].timestamp,relativeTime:Lr[x].relativeTime,badge:Ge(i,{style:[ro.actionBadgeSmall,{backgroundColor:`${no.color.textTertiary}20`}],children:Ge(l,{style:[ro.actionTextSmall,{color:no.color.textTertiary}],children:Lr[x].badge})})}:{index:g,label:`#${g+1} / ${w}`,timestamp:M?ti(M.timestamp):"",relativeTime:M?Wr(M.timestamp):"",badge:M?Ge(i,{style:[ro.actionBadgeSmall,{backgroundColor:`${Fr(M.action)}20`}],children:Ge(l,{style:[ro.actionTextSmall,{color:Fr(M.action)}],children:Jo(M.action)})}):void 0},[g,M,w,I,x]),ve=$t(()=>({index:m,label:`#${m+1} / ${w}`,timestamp:P?ti(P.timestamp):"",relativeTime:P?Wr(P.timestamp):"",badge:P?Ge(i,{style:[ro.actionBadgeSmall,{backgroundColor:`${Fr(P.action)}20`}],children:Ge(l,{style:[ro.actionTextSmall,{color:Fr(P.action)}],children:Jo(P.action)})}):void 0}),[m,P,w]),be=$t(()=>[{key:"tree",label:"TREE VIEW"},{key:"split",label:"SPLIT VIEW"}],[]),Y=yt(()=>{g>xo&&y(g-1)},[g]),ye=yt(()=>{g<m-1&&y(g+1)},[g,m]),ne=yt(()=>{m>g+1&&f(m-1)},[m,g]),ce=yt(()=>{m<w-1&&f(m+1)},[m,w]),Xe=$t(()=>I?E:Or(M?.data?.value??null),[I,E,M]),Qe=$t(()=>Or(P?.data?.value),[P]),xt=yt(()=>u==="split"?Ge(qa,{oldValue:Xe,newValue:Qe,differences:Yc,theme:Ua.devToolsDefault,options:Jc,showThemeName:!1,scrollEnabled:!1}):Ge(Ya,{oldValue:Xe,newValue:Qe,scrollEnabled:!1}),[Xe,Qe,u]),At=yt(()=>{o(Math.max(0,t-1))},[t,o]),pe=yt(()=>{o(Math.min(w-1,t+1))},[t,w,o]),io=yt(async()=>{if(!n){s(!0);return}if(!(!v||v.storageType==="mmkv"))try{await Yo(v)}catch{}},[v,n]),ae=yt(async()=>{if(!n){s(!0);return}if(!v||v.storageType==="mmkv")return;let Se=b.filter(Ut=>Ut.storageType!=="mmkv"),Ne=Se.findIndex(Ut=>Ut.timestamp.getTime()===v.timestamp.getTime());if(Ne!==-1)try{await Xo(Se,Ne)}catch{}},[v,b,n]),qt=yt(async()=>{if(!v)return;let Se={action:v.action,timestamp:v.timestamp.toISOString(),data:v.data};await Uc(Se)},[v]),Ze=v?.storageType!=="mmkv",Io=Ze&&v&&Qo(v);return oi(Xc,{children:[Ze&&oi(i,{style:ro.actionButtonsContainer,children:[Ge(Br,{type:"undo",text:"UNDO",onPress:io,disabled:!Io,locked:!n}),Ge(Br,{type:"jump",text:"JUMP",onPress:ae,locked:!n}),Ge(Br,{type:"copy",text:"COPY",onPress:qt})]}),Ge(qc,{activeView:"diff",diffViewLabel:"DIFF VIEW",diffViewDescription:"Compare changes between versions",diffViewIcon:$c,diffModeTabs:be,activeDiffMode:u,onDiffModeChange:h,renderDiffContent:xt,scrollDiffSection:!0,leftEvent:re,rightEvent:ve,showCompareNavigation:!0,onLeftPrevious:Y,onLeftNext:ye,onRightPrevious:ne,onRightNext:ce,canLeftPrevious:g>xo,canLeftNext:g<m-1,canRightPrevious:m>g+1,canRightNext:m<w-1,disableInternalFooter:r,footerCurrentIndex:t,footerTotalItems:w,footerItemLabel:"Event",footerSubtitle:Wr(v?.timestamp),onFooterPrevious:At,onFooterNext:pe}),Ge(jc,{visible:a,onClose:()=>s(!1),featureName:"Storage Time-Travel"})]})}function zr({conversation:e,selectedEventIndex:t=0,onEventIndexChange:o=()=>{},applySafeAreaInset:r=!0}){let n=e.events.sort((s,u)=>s.timestamp.getTime()-u.timestamp.getTime()),a=n.length;return Ge(Hc,{currentIndex:t,totalItems:a,onPrevious:()=>o(Math.max(0,t-1)),onNext:()=>o(Math.min(a-1,t+1)),itemLabel:"Event",subtitle:Wr(n[t]?.timestamp),applySafeAreaInset:r})}var ro=$.create({actionButtonsContainer:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:10,backgroundColor:no.color.surface,borderBottomWidth:1,borderBottomColor:no.color.border},valueBox:{backgroundColor:no.color.bg,borderRadius:6,borderWidth:1,borderColor:no.color.border,padding:8},valueText:{fontSize:12,color:no.color.text,fontFamily:ei,lineHeight:18},actionBadgeSmall:{paddingHorizontal:6,paddingVertical:1,borderRadius:3},actionTextSmall:{fontSize:8,fontWeight:"700",fontFamily:ei}});p();import{Filter as ri,DynamicFilterView as Qc,Database as Zc,HardDrive as eu,Shield as tu,macOSColors as Mt,night as Et}from"@buoy-gg/shared-ui/web";import{jsx as Ht,jsxs as ko}from"react/jsx-runtime";function ni({ignoredPatterns:e,onTogglePattern:t,onAddPattern:o,availableKeys:r=[],enabledStorageTypes:n,onToggleStorageType:a}){let s={addFilterSection:{enabled:!0,placeholder:"Enter key pattern to hide...",title:"KEY FILTERS",icon:ri},availableItemsSection:{enabled:!0,title:"AVAILABLE EVENT KEYS",emptyMessage:"No storage event keys available. Events will appear here once captured.",items:r},howItWorksSection:{enabled:!0,title:"HOW EVENT FILTERS WORK",description:"Patterns hide matching storage keys from the event list. Storage type toggles control which storage backends are monitored.",examples:["\u2022 react_buoy \u2192 hides keys containing react_buoy","\u2022 @temp \u2192 hides @temp_user, @temp_data","\u2022 redux \u2192 hides redux-persist:root",`\u2022 ${te.asyncFull}: show or hide captured events`,`\u2022 ${te.mmkv}: show or hide captured events`],icon:ri},onPatternToggle:t,onPatternAdd:o,activePatterns:e};return ko(i,{style:rt.container,children:[ko(i,{style:rt.storageTypeSection,children:[Ht(l,{style:rt.sectionTitle,children:"STORAGE TYPES"}),ko(i,{style:rt.storageTypeButtons,children:[ko(A,{style:[rt.storageTypeButton,n.has("async")&&rt.storageTypeButtonActive,{borderColor:Mt.semantic.warning+"40"}],onPress:()=>a("async"),testID:"buoy-storage-backend-async",accessibilityRole:"button",accessibilityLabel:`Toggle ${te.asyncFull} capture`,accessibilityState:{selected:n.has("async")},children:[Ht(Zc,{size:16,color:n.has("async")?Mt.semantic.warning:Et.color.textTertiary}),Ht(l,{style:[rt.storageTypeButtonText,n.has("async")&&{color:Mt.semantic.warning}],children:te.asyncFull})]}),ko(A,{style:[rt.storageTypeButton,n.has("mmkv")&&rt.storageTypeButtonActive,{borderColor:Mt.semantic.info+"40"}],onPress:()=>a("mmkv"),testID:"buoy-storage-backend-mmkv",accessibilityRole:"button",accessibilityLabel:`Toggle ${te.mmkv} capture`,accessibilityState:{selected:n.has("mmkv")},children:[Ht(eu,{size:16,color:n.has("mmkv")?Mt.semantic.info:Et.color.textTertiary}),Ht(l,{style:[rt.storageTypeButtonText,n.has("mmkv")&&{color:Mt.semantic.info}],children:te.mmkv})]}),te.hasSecure&&ko(A,{style:[rt.storageTypeButton,n.has("secure")&&rt.storageTypeButtonActive,{borderColor:Mt.semantic.success+"40"}],onPress:()=>a("secure"),testID:"buoy-storage-backend-secure",accessibilityRole:"button",accessibilityLabel:"Toggle Secure Storage capture",accessibilityState:{selected:n.has("secure")},children:[Ht(tu,{size:16,color:n.has("secure")?Mt.semantic.success:Et.color.textTertiary}),Ht(l,{style:[rt.storageTypeButtonText,n.has("secure")&&{color:Mt.semantic.success}],children:"Secure Storage"})]})]})]}),Ht(Qc,{...s})]})}var rt=$.create({container:{flex:1},storageTypeSection:{padding:16,borderBottomWidth:1,borderBottomColor:Et.color.border},sectionTitle:{fontSize:11,fontWeight:"700",color:Et.color.textSecondary,letterSpacing:.8,marginBottom:12},storageTypeButtons:{flexDirection:"row",gap:8},storageTypeButton:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,paddingHorizontal:12,backgroundColor:Et.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:Et.color.border},storageTypeButtonActive:{backgroundColor:Et.color.surface},storageTypeButtonText:{fontSize:11,fontWeight:"600",color:Et.color.textTertiary}});p();import{memo as ou}from"react";import{RelativeTime as ru,macOSColors as Zo,parseValue as nu,CompactRow as au}from"@buoy-gg/shared-ui/web";import{jsx as ai}from"react/jsx-runtime";function iu(e){let t=nu(e);return t===null?"null":t===void 0?"undefined":Array.isArray(t)?"array":typeof t=="boolean"?"boolean":typeof t=="number"?"number":typeof t=="string"?"string":typeof t=="object"?"object":"undefined"}function su(e){switch(e){case"setItem":case"multiSet":case"set.string":case"set.number":case"set.boolean":case"set.buffer":return Zo.semantic.success;case"removeItem":case"multiRemove":case"clear":case"delete":case"clearAll":return Zo.semantic.error;case"mergeItem":case"multiMerge":return Zo.semantic.info;case"get.string":case"get.number":case"get.boolean":case"get.buffer":return Zo.semantic.warning;default:return Zo.text.muted}}function lu(e,t){return`${Array.from(e).map(r=>r==="async"?te.async:te.mmkv).join("/")} \xB7 ${t} op${t!==1?"s":""}`}var Nr=ou(function({data:t,onPress:o,isSelected:r=!1,showChevron:n=!0,testID:a}){let s=su(t.lastAction),u=Jo(t.lastAction),d=t.totalOperations??1;return ai(au,{statusDotColor:s,statusLabel:"Storage",statusSublabel:lu(t.storageTypes,d),primaryText:t.key,badgeText:u,badgeColor:s,showChevron:n,bottomRightText:ai(ru,{timestamp:t.lastEventTimestamp}),isSelected:r,onPress:o,testID:a,accessibilityLabel:`${u} ${t.key}`})});import{useIsPro as ku}from"@buoy-gg/license/web";import{Fragment as ci,jsx as O,jsxs as ft}from"react/jsx-runtime";var gm=wu["storage.events"].free,_n={getItem:e=>Wn.getItem(e),setItem:(e,t)=>Wn.setItem(e,t)},Cu={storage:_n,parse:e=>e==="browser"||e==="events"?e:void 0,serialize:e=>e},Vu={storage:_n,parse:e=>e==="true",serialize:e=>e.toString()},ui={storage:_n,parse:e=>new Set(JSON.parse(e)),serialize:e=>JSON.stringify(Array.from(e))},Iu={...ui,parse:e=>{let t=JSON.parse(e);return t.includes("@react_buoy")||t.push("@react_buoy"),new Set(t)}};function Ur({visible:e,onClose:t,onBack:o,onMinimize:r,enableSharedModalDimensions:n=!1,requiredStorageKeys:a=[],inline:s=!1,onTabChange:u,onRefresh:d,onEventSelect:g}){let y=ku(),m=vu("storage.events"),[f,k]=Hr(Co.storage.activeTab(),"browser",Cu);Fn(()=>{u?.(f)},[f,u]);let[b,w]=lt(""),[h,v]=lt(null),[C,I]=lt(!1),[M,P]=Hr(Co.storage.isMonitoring(),!0,Vu),{events:x,clearEvents:E,isCapturing:re}=On({enabled:M}),[ve,be]=lt(null),[Y,ye]=lt(null),[ne,ce]=lt(null),[Xe,Qe]=lt(0),[xt,At]=lt(!1),[pe,io]=Hr(Co.storage.eventFilters(),new Set(["@react_buoy","@RNAsyncStorage","redux-persist","persist:"]),Iu),[ae,qt]=lt("all"),[Ze,Io]=lt(new Set(["async","mmkv","secure"])),[Se,Ne]=Hr(Co.storage.pinnedKeys(),new Set,ui),Ut=ii(null),Mo=M&&re,[jt,Eo]=lt("bottomSheet"),so=Oe(S=>{Eo(S)},[]),Bt=Oe(()=>{P(S=>!S)},[]),Ee=Oe(()=>{E(),be(null),Qe(0)},[E]),nr=Oe(S=>{ye(S),ce(null)},[]),ar=Oe(()=>{ye(null),ce(null)},[]),ir=Oe(S=>{io(T=>{let F=new Set(T);return F.has(S)?F.delete(S):F.add(S),F})},[]),Gt=Oe(S=>{io(T=>new Set([...T,S]))},[]),Qr=Oe(S=>{Ne(T=>{let F=new Set(T);return F.has(S)?F.delete(S):F.add(S),F})},[]),Ko=Oe(()=>{At(!xt)},[xt]),Zr=Oe(S=>{Io(T=>{let F=new Set(T);return F.has(S)?F.delete(S):F.add(S),F})},[]),Ro=ii([]),lo=Oe(()=>{let S=Ro.current;return{timestamp:new Date().toISOString(),totalKeys:S.length,asyncStorage:S.filter(T=>T.storageType==="async").reduce((T,F)=>(T[F.key]=$r(F.value),T),{}),mmkv:S.filter(T=>T.storageType==="mmkv").reduce((T,F)=>{let fe=F.instanceId||"default";return T[fe]||(T[fe]={}),T[fe][F.key]=$r(F.value),T},{}),secure:S.filter(T=>T.storageType==="secure").reduce((T,F)=>(T[F.key]=$r(F.value),T),{})}},[]),en=Oe(async()=>{me.alert("Clear Storage","Choose what to clear:",[{text:"Cancel",style:"cancel"},{text:"Clear App Storage",onPress:async()=>{try{await Zt()}catch{me.alert("Error","Failed to clear app storage")}}},{text:"Clear All (Including Dev Tools)",style:"destructive",onPress:async()=>{try{await Gn()}catch{me.alert("Error","Failed to clear all storage")}}}])},[]),Jt=S=>{let T=du(S);return T===null?"null":T===void 0?"undefined":Array.isArray(T)?"array":typeof T=="boolean"?"boolean":typeof T=="number"?"number":typeof T=="string"?"string":typeof T=="object"?"object":"undefined"},[sr,tn]=lt([]);Fn(()=>{e&&(async()=>{try{let T=await Wn.getAllKeys();tn([...T].sort())}catch{}})()},[e]);let lr=pt(()=>{let S=new Set(sr);return x.forEach(T=>{T.data?.key&&S.add(T.data.key)}),Array.from(S).sort()},[x,sr]),j=pt(()=>{let S=new Map;return x.forEach(T=>{if(!T.data?.key)return;let F=T.data.key;if(!Ze.has(T.storageType)||Array.from(pe).some(kt=>F.includes(kt)))return;let ue=S.get(F);ue?(ue.events.push(T),ue.totalOperations++,ue.storageTypes.add(T.storageType),T.timestamp>ue.lastEvent.timestamp&&(ue.lastEvent=T,ue.currentValue=T.data.value,ue.valueType=Jt(T.data.value))):S.set(F,{key:F,lastEvent:T,events:[T],totalOperations:1,currentValue:T.data.value,valueType:Jt(T.data.value),storageTypes:new Set([T.storageType])})}),Array.from(S.values()).sort((T,F)=>F.lastEvent.timestamp.getTime()-T.lastEvent.timestamp.getTime())},[x,pe,Ze]),Ve=pt(()=>ve&&j.find(S=>S.key===ve)||null,[ve,j]),on=pt(()=>{let S={};return j.forEach(T=>{S[T.key]=T.totalOperations}),S},[j]),cr=pt(()=>{let S={};return j.forEach(T=>{S[T.key]=T.lastEvent.timestamp.getTime()}),S},[j]),Ke=pt(()=>Y&&j.find(S=>S.key===Y)||null,[Y,j]);Fn(()=>{if(!g)return;let S=Ve||(ne!==null?Ke:null),T=Ve?Xe:ne;if(!S||T==null)return;let F=[...S.events].sort((kt,Do)=>kt.timestamp.getTime()-Do.timestamp.getTime()),fe=F[T],ue=F[T-1];fe&&g(fe),ue&&g(ue)},[g,Ve,Xe,Ke,ne]);let nt=pt(()=>x.filter(S=>{if(!S.data?.key||!Ze.has(S.storageType))return!1;let T=S.data.key;return!Array.from(pe).some(F=>T.includes(F))}),[x,pe,Ze]),rn=pt(()=>xn(nt),[nt]),at=pt(()=>ae==="all"?nt:nt.filter(S=>S.storageType===ae),[nt,ae]),nn=Oe(()=>at.map(S=>({key:S.data?.key,action:S.action,value:$r(S.data?.value),storageType:S.storageType,timestamp:S.timestamp.toISOString()})),[at]),Ao=pt(()=>at.slice(0,m),[at,m]),Yt=pt(()=>Math.max(0,at.length-m),[at.length,m]),an=.8,ur=Oe(S=>S.id,[]),Bo=Oe(S=>{let T=j.find(ue=>ue.key===S.data?.key);if(!T)return;let fe=[...T.events].sort((ue,kt)=>ue.timestamp.getTime()-kt.timestamp.getTime()).findIndex(ue=>ue.timestamp.getTime()===S.timestamp.getTime());be(T.key),Qe(fe>=0?fe:0)},[j]),sn=Oe(({item:S})=>{let T={key:S.data?.key||"",lastAction:S.action,totalOperations:1,lastEventTimestamp:S.timestamp,storageTypes:new Set([S.storageType]),valueType:Jt(S.data?.value)};return O(Nr,{data:T,onPress:()=>Bo(S),testID:`buoy-storage-event-${S.id}`})},[Bo]);if(!e)return null;let Xt=n?Co.modal.root():Co.storage.modal(),bt=()=>{if(xt)return O(ni,{ignoredPatterns:pe,onTogglePattern:ir,onAddPattern:Gt,availableKeys:lr,enabledStorageTypes:Ze,onToggleStorageType:Zr});if(f==="browser"){if(Y&&Ke){if(ne!==null)return O(i,{style:ke.contentWrapper,children:O(_r,{conversation:Ke,selectedEventIndex:ne,onEventIndexChange:ce,disableInternalFooter:!0})});let T=[...Ke.events].sort((fe,ue)=>fe.timestamp.getTime()-ue.timestamp.getTime()),F=[...T].reverse();return O(fr,{testID:"buoy-storage-history-list",style:ke.flexFill,data:F,keyExtractor:fe=>fe.id,renderItem:({item:fe})=>{let ue=T.findIndex(Do=>Do.timestamp.getTime()===fe.timestamp.getTime()),kt={key:fe.data?.key||"",lastAction:fe.action,totalOperations:1,lastEventTimestamp:fe.timestamp,storageTypes:new Set([fe.storageType]),valueType:Jt(fe.data?.value)};return O(Nr,{data:kt,onPress:()=>ce(ue>=0?ue:0),testID:`buoy-storage-history-event-${fe.id}`})},contentContainerStyle:ke.listContent,ItemSeparatorComponent:()=>O(i,{style:ke.separator}),initialNumToRender:20})}return O(Dn,{requiredStorageKeys:a,ignoredPatterns:pe,onTogglePattern:ir,onAddPattern:Gt,searchQuery:b,storageDataRef:Ro,eventCountByKey:on,lastWriteByKey:cr,onViewHistory:nr,enabledStorageTypes:Ze,pinnedKeys:Se,onTogglePin:Qr,applySafeAreaInset:jt==="bottomSheet",storageTypeFilter:ae,onStorageTypeFilterChange:qt,detailKey:h,onOpenKey:v,onCloseDetail:()=>v(null)})}if(Ve)return O(i,{style:ke.contentWrapper,children:O(_r,{conversation:Ve,selectedEventIndex:Xe,onEventIndexChange:Qe,disableInternalFooter:!0})});let S=O(i,{style:ke.eventFilterBar,children:O(_o,{active:ae,onChange:qt,counts:rn})});if(at.length===0){let T=ae!=="all";return ft(i,{style:ke.flexFill,children:[S,O(yu,{testID:"buoy-storage-events-empty",...Mo?T?{otto:"filtering",title:`No ${ae} events`,message:"Other backends have events \u2014 pick All Types to see them"}:{otto:"listening",title:"No storage events yet",message:"Storage operations will appear here"}:{otto:"paused",title:"Event listener is paused",message:"Press play to start monitoring"}})]})}return ft(i,{style:ke.flexFill,children:[S,O(fr,{testID:"buoy-storage-events-list",style:ke.flexFill,data:Ao,renderItem:sn,keyExtractor:ur,onEndReachedThreshold:an,contentContainerStyle:ke.listContent,ListFooterComponent:Yt>0?O(i,{style:ke.lockedBannerContainer,children:O(xu,{featureName:`${Yt} event${Yt>1?"s":""} locked`,description:"Upgrade to Pro to unlock full event history"})}):null,initialNumToRender:10,maxToRenderPerBatch:10,windowSize:10})]})},co=Ve&&Ve.events.length>1?O(zr,{conversation:Ve,selectedEventIndex:Xe,onEventIndexChange:Qe,applySafeAreaInset:jt==="bottomSheet"}):Ke&&ne!==null&&Ke.events.length>1?O(zr,{conversation:Ke,selectedEventIndex:ne,onEventIndexChange:ce,applySafeAreaInset:jt==="bottomSheet"}):null,$n=xt?()=>At(!1):ne!==null?()=>ce(null):Y?ar:Ve?()=>{be(null),Qe(0)}:o,We=xt?ft(Le,{children:[O(Le.Navigation,{onBack:()=>At(!1)}),O(Le.Content,{title:"Filters"})]}):Y?ft(Le,{children:[O(Le.Navigation,{onBack:ne!==null?()=>ce(null):ar}),O(Le.Content,{title:`${Y} History`,centered:!0})]}):Ve?ft(Le,{children:[O(Le.Navigation,{onBack:()=>{be(null),Qe(0)}}),O(Le.Content,{title:Ve.key})]}):h?ft(Le,{children:[O(Le.Navigation,{onBack:()=>v(null)}),O(Le.Content,{title:h.key,centered:!0,testID:"buoy-storage-detail-title"})]}):ft(Le,{children:[o&&O(Le.Navigation,{onBack:o}),O(Le.Content,{title:"",children:C?O(bu,{value:b,onChange:w,onClear:()=>{w(""),I(!1)},placeholder:"Search storage keys...",testID:"buoy-storage-search",autoFocus:!0,onSubmitEditing:()=>I(!1),returnKeyType:"search",containerStyle:ke.headerSearchContainer}):O(uu,{tabs:[{key:"browser",label:"Storage"},{key:"events",label:`Events${at.length>0?` (${at.length})`:""}`}],activeTab:f,testIDPrefix:"buoy-storage-tab",onTabChange:S=>{k(S),ye(null),ce(null),be(null),Qe(0),v(null)}})}),ft(Le.Actions,{children:[d&&!C?O(A,{onPress:d,style:ke.iconButton,testID:"buoy-storage-refresh",accessibilityLabel:"Refresh storage",accessibilityRole:"button",children:O(fu,{size:14,color:Je.color.textSecondary})}):null,O(A,{onPress:Ko,testID:"buoy-storage-filters",accessibilityLabel:"Storage filters",accessibilityRole:"button",style:[ke.iconButton,(pe.size>0||Ze.size<3)&&ke.activeFilterButton],children:O(pu,{size:14,color:pe.size>0||Ze.size<3?Je.color.accent:Je.color.textSecondary})}),f==="browser"&&!C&&ft(ci,{children:[O(A,{onPress:()=>I(!0),testID:"buoy-storage-search-open",accessibilityLabel:"Open search",accessibilityRole:"button",style:ke.iconButton,children:O(mu,{size:14,color:Je.color.textSecondary})}),O(si,{value:lo,disabled:Ro.current.length===0,buttonStyle:ke.iconButton,testID:"buoy-storage-copy"})]}),f==="events"&&ft(ci,{children:[O(si,{value:nn,disabled:at.length===0,buttonStyle:ke.iconButton,testID:"buoy-storage-events-copy"}),O(Su,{isEnabled:Mo,onToggle:Bt,accessibilityLabel:"Toggle storage event monitoring",testID:"buoy-storage-power"}),O(hu,{onPress:Ee,buttonStyle:ke.iconButton,testID:"buoy-storage-clear-events"})]})]})]});return s?O(li,{children:ft(i,{style:ke.inlineRoot,children:[O(i,{style:ke.inlineHeader,...Tu,children:We}),bt(),co]})}):O(li,{children:O(cu,{visible:e,onClose:t,onBack:$n,onMinimize:r,persistenceKey:Xt,header:{showToggleButton:!0,customContent:We},onModeChange:so,enablePersistence:!0,initialMode:"bottomSheet",enableGlitchEffects:!0,styles:{},footer:co,footerHeight:co?68:0,disableScrollWrapper:!0,children:bt()})})}function Mu(e={}){return O(Ur,{...e,inline:!0,visible:!0,onClose:()=>{}})}var ke=$.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:gu.border.default,backgroundColor:"transparent"},headerSearchContainer:{flex:1},flexFill:{flex:1},iconButton:{width:32,height:32,borderRadius:8,backgroundColor:Je.color.buttonSurface,borderWidth:1,borderColor:Je.color.border,alignItems:"center",justifyContent:"center"},activeFilterButton:{backgroundColor:Je.color.accentSoft,borderColor:Je.color.accentBorderStrong},separator:{height:8},listContent:{paddingVertical:6},lockedBannerContainer:{marginTop:8,marginHorizontal:16},eventFilterBar:{paddingHorizontal:12,paddingTop:8,paddingBottom:4},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:Je.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:qr,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:Je.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:qr},eventNavigation:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:8},navButton:{padding:4,borderRadius:4},navButtonDisabled:{opacity:.3},eventCounter:{color:Je.color.text,fontSize:12,fontWeight:"600",fontFamily:qr,paddingHorizontal:8},headerTopRow:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:12},keyNameContainer:{flex:1,flexDirection:"row",alignItems:"center",gap:6,backgroundColor:Je.color.surfaceElevated,paddingHorizontal:10,paddingVertical:4,borderRadius:6,borderWidth:1,borderColor:Je.color.border,height:28},keyNameText:{flex:1,fontSize:13,fontWeight:"600",color:Je.color.accent,fontFamily:qr,letterSpacing:.5},contentWrapper:{flex:1}});p();Ot();import er from"@buoy-gg/shared-ui/web/asyncStorage";import{approxJsonSize as mi,isDevToolsStorageKey as tr,isOverWireBudget as bi,isJsonSerializable as Eu}from"@buoy-gg/shared-ui/web";var Gr=Object.freeze({__buoyValueOnDevice:!0,note:"Value stays on the device \u2014 fetched on demand via getEventDetail / mmkv.get / secure.get."}),Ku=16*1024,Nn=1.25*1024*1024,di=8*1024*1024;function zn(e){return e===void 0?e:bi(e,Ku)?Gr:e}function jr(e,t){let o=e.data;if(!o)return e;let r=t(o.value),n=t(o.prevValue),a=Go(e),s=t(a.pairs),u=t(a.prevPairs);return r===o.value&&n===o.prevValue&&s===a.pairs&&u===a.prevPairs?e:{...e,data:{...o,value:r,prevValue:n,...e.storageType==="async"?{pairs:s,prevPairs:u}:{}}}}function gi(e){return e===void 0||!bi(e,di)?e:Eu(e)?{__buoyTruncated:!0,note:`Exceeds the ${di/(1024*1024)}MB detail limit \u2014 inspect it on-device.`}:Gr}var yi=new WeakMap,pi=new WeakMap;function Ru(e){let t=yi.get(e);if(t)return t;let o;try{let r=jr(e,zn);o={event:r,bytes:mi(r,Nn).bytes}}catch{o={event:jr(e,()=>Gr),bytes:1024}}return yi.set(e,o),o}function Au(e){let t=pi.get(e);if(t)return t;let o=jr(e,n=>n===void 0?void 0:Gr),r={event:o,bytes:mi(o,Nn).bytes};return pi.set(e,r),r}function Bu(e){let t=new Array(e.length),o=0;for(let r=0;r<e.length;r++){let n=Ru(e[r]);if(o+n.bytes<=Nn)t[r]=n.event,o+=n.bytes;else{let a=Au(e[r]);t[r]=a.event,o+=a.bytes}}return t}function fi(e){let t=Ie.get(e);if(!t)throw new Error(`No MMKV instance registered as "${e}"`);if(t.instance?.isReadOnly)throw new Error(`MMKV instance "${e}" is registered read-only`);return t.instance}var Si=[];function hi(e){Si=e}var Du={version:3,getSnapshot:()=>Bu(wt.getEvents().filter(e=>{let t=e.data?.key;return!(typeof t=="string"&&tr(t))})),subscribe:e=>wt.subscribeToEvents(e),actions:{clearEvents:()=>{wt.clearEvents()},getRequiredKeys:()=>Si,getEventDetail:e=>{let{id:t}=e??{};if(!t)return{found:!1,reason:"missing id"};let o=wt.getEvents().find(n=>n.id===t);if(!o)return{found:!1,reason:"unknown id"};let r=jr(o,gi);return{found:!0,id:t,event:r}},clearAppStorage:()=>Zt(),"timeTravel.undo":async e=>{let t=e?.id;if(!t)throw new Error("timeTravel.undo requires an event `id`");let o=wt.getEvents().find(n=>n.id===t);if(!o)throw new Error(`No storage event with id "${t}"`);if(o.storageType==="mmkv")throw new Error("Time travel supports AsyncStorage events only");let r=o;if(!Qo(r))throw new Error(`Event "${t}" (${r.action}) has no previous value captured, so it cannot be undone`);return await Yo(r),{undone:!0,action:r.action,key:r.data?.key}},"timeTravel.jump":async e=>{let{id:t,scope:o="key"}=e??{};if(!t)throw new Error("timeTravel.jump requires an event `id`");let r=wt.getEvents().filter(u=>u.storageType!=="mmkv").slice().reverse(),n=r.find(u=>u.id===t);if(!n)throw new Error(`No AsyncStorage event with id "${t}"`);let a=o==="all"?r:r.filter(u=>u.data?.key===n.data?.key),s=a.findIndex(u=>u.id===t);if(s===-1)throw new Error(`Event "${t}" is not in the timeline`);return await Xo(a,s),{jumped:!0,scope:o,replayed:s+1,of:a.length,key:n.data?.key}},"async.getAllKeys":async()=>(await er.getAllKeys()).filter(e=>!tr(e)),"async.multiGet":async e=>(await Qt(e.keys)).filter(([t])=>!tr(t)),"async.getItem":e=>{let{key:t}=e;return tr(t)?Promise.resolve(null):er.getItem(t)},"async.setItem":e=>{let{key:t,value:o}=e;return er.setItem(t,o)},"async.removeItem":e=>er.removeItem(e.key),"async.multiRemove":e=>ut(e.keys),"async.multiSet":e=>Pt(e.pairs),"async.clear":()=>er.clear(),"mmkv.snapshot":()=>Ie.getAll().map(({id:e,instance:t,encrypted:o,readOnly:r})=>{let n=[];try{n=t.getAllKeys().filter(a=>!tr(a)).map(a=>{let{value:s,type:u}=$e(t,a);return{key:a,value:zn(s),valueType:u}})}catch{}return{id:e,encrypted:o,readOnly:r,entries:n}}),"mmkv.get":e=>{let{instanceId:t,key:o}=e??{};if(!t||!o)return{found:!1,reason:"missing instanceId/key"};let r=Ie.get(t);if(!r)return{found:!1,reason:"unknown instance"};let{value:n,type:a}=$e(r.instance,o);return{found:!0,instanceId:t,key:o,value:gi(n),valueType:a}},"mmkv.set":e=>{let{instanceId:t,key:o,value:r}=e;fi(t).set(o,r)},"mmkv.remove":e=>{let{instanceId:t,key:o}=e,r=fi(t);r.remove?r.remove(o):r.delete?.(o)},"secure.keys":()=>ee.getAll().map(({key:e,options:t,description:o})=>({key:e,description:o,keychainService:t.keychainService,requireAuthentication:t.requireAuthentication??!1})),"secure.snapshot":async()=>{let e=ee.getModule(),t=ee.getAll(),o=[];for(let{key:r,options:n,description:a}of t){let s=null;if(e&&!n.requireAuthentication)try{s=await e.getItemAsync(r,n)}catch{}o.push({key:r,description:a,keychainService:n.keychainService,requireAuthentication:n.requireAuthentication??!1,value:s==null?s:zn(s)})}return o},"secure.get":e=>{let{key:t}=e,o=ee.getAll().find(n=>n.key===t),r=ee.getModule();return!o||!r||o.options.requireAuthentication?Promise.resolve(null):r.getItemAsync(t,o.options)},"secure.set":e=>{let{key:t,value:o}=e;return ee.setValue(t,o)},"secure.delete":e=>ee.deleteValue(e.key)}};import{jsx as Wu}from"react/jsx-runtime";var vi=Lu({id:"storage",name:"STORAGE",description:"AsyncStorage browser",slot:"both",icon:({size:e})=>Wu(Pu,{size:e}),component:Ur,props:{requiredStorageKeys:[],enableSharedModalDimensions:!1}}),Fu=Ou(vi,e=>(hi(e.requiredStorageKeys||[]),{requiredStorageKeys:e.requiredStorageKeys||[],enableSharedModalDimensions:e.enableSharedModalDimensions??!1}));p();import{HardDrive as _u,CyberpunkSectionButton as zu}from"@buoy-gg/shared-ui/web";import{isDevToolsStorageKey as Nu}from"@buoy-gg/shared-ui/web";import{jsx as Hu}from"react/jsx-runtime";function $u({onPress:e}){let{storageKeys:t}=$o(),r=t.filter(s=>!Nu(s.key)).length,n=r;return Hu(zu,{id:"storage",title:"STORAGE",subtitle:n===0?"Empty":`${r} Async`,icon:_u,iconColor:"#00FF88",iconBackgroundColor:"rgba(0, 255, 136, 0.1)",onPress:e,index:2})}p();import{AlertCircle as ki,CheckCircle2 as qu,Eye as Ci,XCircle as wi,HardDrive as Vi,Database as Ti,Shield as Uu,gameUIColors as Jr,macOSColors as se,night as Ce,monoFont as Yr}from"@buoy-gg/shared-ui/web";import{DataViewer as ju}from"@buoy-gg/shared-ui/web/dataViewer";import{jsx as Z,jsxs as Pe}from"react/jsx-runtime";var xi=[se.semantic.info,se.semantic.success,se.semantic.warning,se.semantic.debug,"#FF6B9D","#00D9FF"];function Xr(e){let t=e.split("").reduce((o,r)=>o+r.charCodeAt(0),0);return xi[t%xi.length]}var Gu=e=>{switch(e){case"required_present":return{icon:qu,color:se.semantic.success,bgColor:se.semantic.successBackground,borderColor:se.semantic.success+"40",label:"REQUIRED",labelColor:se.semantic.success};case"required_missing":return{icon:ki,color:se.semantic.error,bgColor:se.semantic.errorBackground,borderColor:se.semantic.error+"50",label:"MISSING",labelColor:se.semantic.error};case"required_wrong_value":return{icon:wi,color:se.semantic.warning,bgColor:se.semantic.warningBackground,borderColor:se.semantic.warning+"50",label:"WRONG S",labelColor:se.semantic.warning};case"required_wrong_type":return{icon:wi,color:se.semantic.info,bgColor:se.semantic.infoBackground,borderColor:se.semantic.info+"50",label:"WRONG TYPE",labelColor:se.semantic.info};case"optional_present":return{icon:Ci,color:se.semantic.debug,bgColor:se.semantic.infoBackground,borderColor:se.semantic.debug+"40",label:"OPTIONAL",labelColor:se.semantic.debug}}},Ju=e=>{switch(e){case"mmkv":return Vi;case"async":return Ti;case"secure":return Uu;default:return Ti}};function Yu({storageKey:e,isExpanded:t,onToggle:o}){let r=Gu(e.status),n=r.icon,a=Ju(e.storageType),s=e.value!==void 0&&e.value!==null,u=e.expectedValue!==void 0,d=e.expectedType!==void 0,g=br(e.storageType),y=go(e.storageType);return Pe(i,{style:[L.storageKeyCard,{borderColor:r.borderColor}],children:[Pe(A,{accessibilityLabel:"Storage key card",accessibilityHint:"View storage key card","sentry-label":`ignore storage key card ${e.key}`,accessibilityRole:"button",style:L.cardHeader,onPress:o,children:[Pe(i,{style:L.cardHeaderLeft,children:[Z(i,{style:[L.iconContainer,{backgroundColor:r.bgColor}],children:Z(n,{size:14,color:r.color})}),Pe(i,{style:L.cardHeaderInfo,children:[Z(l,{style:L.storageKeyText,children:e.key}),e.description?Z(l,{style:L.descriptionText,children:e.description}):null,Pe(i,{style:L.cardHeaderMeta,children:[Z(i,{style:[L.statusBadge,{backgroundColor:r.bgColor}],children:Z(l,{style:[L.statusText,{color:r.labelColor}],children:r.label})}),Pe(i,{style:[L.storageBadge,{backgroundColor:`${g}15`}],children:[Z(a,{size:10,color:g}),Z(l,{style:[L.storageText,{color:g}],children:y})]}),e.storageType==="mmkv"&&e.instanceId&&Pe(i,{style:[L.instanceBadge,{backgroundColor:Xr(e.instanceId)+"20",borderColor:Xr(e.instanceId)+"40"}],children:[Z(Vi,{size:9,color:Xr(e.instanceId)}),Z(l,{style:[L.instanceText,{color:Xr(e.instanceId)}],children:e.instanceId})]}),s&&Z(i,{style:L.valueBadge,children:Z(l,{style:L.valueText,children:e.valueType?e.valueType.toUpperCase():dt(e.value)})})]})]})]}),Z(i,{style:L.cardHeaderRight,children:Z(i,{style:L.actionButton,children:Z(Ci,{size:12,color:Ce.color.textSecondary})})})]}),t&&s&&Pe(i,{style:L.cardBody,children:[Z(i,{style:L.dataViewerContainer,children:(()=>{let m=typeof e.value=="string"?(()=>{try{return JSON.parse(e.value)}catch{return e.value}})():e.value;return typeof m=="string"||typeof m=="number"||typeof m=="boolean"?Pe(i,{style:L.simpleValueContainer,children:[Z(l,{style:L.simpleValueLabel,children:"Current Value:"}),Z(i,{style:L.simpleValueBox,children:Z(l,{style:L.simpleValueContent,selectable:!0,children:String(m)})}),Pe(l,{style:L.valueTypeText,children:["Type: ",dt(e.value)]})]}):Z(ju,{title:"Current Value",data:m,showTypeFilter:!1,rawMode:!0})})()}),u&&Pe(i,{style:L.valueContainer,children:[Z(l,{style:L.valueLabel,children:"Expected Value:"}),Z(i,{style:L.expectedValueBox,children:Z(l,{style:L.expectedValueContent,selectable:!0,children:e.expectedValue})})]}),d&&e.expectedType&&Pe(i,{style:L.valueContainer,children:[Z(l,{style:L.valueLabel,children:"Expected Type:"}),Z(i,{style:L.expectedValueBox,children:Z(l,{style:L.expectedValueContent,selectable:!0,children:e.expectedType.toUpperCase()})}),Pe(l,{style:L.typeHelperText,children:["Current type: ",dt(e.value)]})]}),e.lastUpdated?Z(i,{style:L.metaInfo,children:Pe(l,{style:L.metaLabel,children:["Last updated: ",e.lastUpdated.toLocaleString()]})}):null]}),t&&!s&&Pe(i,{style:L.cardBody,children:[Pe(i,{style:L.emptyValueContainer,children:[Z(ki,{size:16,color:se.semantic.warning}),Z(l,{style:L.emptyValueText,children:"Storage key not found or empty"})]}),u&&Pe(i,{style:L.valueContainer,children:[Z(l,{style:L.valueLabel,children:"Expected Value:"}),Z(i,{style:L.expectedValueBox,children:Z(l,{style:L.expectedValueContent,selectable:!0,children:e.expectedValue})})]})]})]})}var L=$.create({storageKeyCard:{backgroundColor:Ce.color.surface,borderRadius:8,borderWidth:1,overflow:"hidden"},cardHeader:{padding:12,flexDirection:"row",alignItems:"center",justifyContent:"space-between"},cardHeaderLeft:{flexDirection:"row",alignItems:"center",flex:1,minWidth:0},iconContainer:{padding:6,borderRadius:6,marginRight:10},cardHeaderInfo:{flex:1,minWidth:0,gap:4},storageKeyText:{color:Ce.color.text,fontWeight:"500",fontSize:12,flexWrap:"wrap",flex:1},descriptionText:{color:Ce.color.textSecondary,fontSize:10,marginTop:2,flexWrap:"wrap"},cardHeaderMeta:{flexDirection:"row",alignItems:"center",gap:6,flexWrap:"wrap"},statusBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},statusText:{fontSize:9,fontWeight:"600",letterSpacing:.5},storageBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4,flexDirection:"row",alignItems:"center",gap:4},storageText:{fontSize:9,fontWeight:"600"},instanceBadge:{paddingHorizontal:6,paddingVertical:3,borderRadius:4,borderWidth:1,flexDirection:"row",alignItems:"center",gap:4},instanceText:{fontSize:9,fontWeight:"700",fontFamily:Yr,letterSpacing:.3},valueBadge:{paddingHorizontal:4,paddingVertical:2,backgroundColor:Ce.color.surfaceElevated,borderRadius:3},valueText:{fontSize:8,color:Ce.color.textSecondary,fontWeight:"500"},cardHeaderRight:{marginLeft:8},actionButton:{padding:4,borderRadius:4,backgroundColor:Ce.color.surfaceElevated},cardBody:{borderTopWidth:1,borderTopColor:Ce.color.separator,padding:12,gap:12},dataViewerContainer:{marginTop:8},simpleValueContainer:{gap:8},simpleValueLabel:{color:Ce.color.textSecondary,fontSize:10,fontWeight:"500",textTransform:"uppercase",letterSpacing:.5},simpleValueBox:{backgroundColor:Ce.color.bg,borderRadius:4,padding:10,borderWidth:1,borderColor:Ce.color.border},simpleValueContent:{color:Jr.success,fontSize:12,fontFamily:Yr,lineHeight:16},valueTypeText:{color:Ce.color.textTertiary,fontSize:9,fontStyle:"italic"},valueContainer:{gap:6},valueLabel:{color:Ce.color.textSecondary,fontSize:10,fontWeight:"500",textTransform:"uppercase",letterSpacing:.5},valueBox:{backgroundColor:Ce.color.bg,borderRadius:4,padding:8,borderWidth:1,borderColor:Ce.color.border},valueContent:{color:Ce.color.text,fontSize:10,fontFamily:Yr,lineHeight:14},expectedValueBox:{backgroundColor:Ce.color.bg,borderRadius:4,padding:8,borderWidth:1,borderColor:Ce.color.border},expectedValueContent:{color:Ce.color.text,fontSize:10,fontFamily:Yr,lineHeight:14},emptyValueContainer:{flexDirection:"row",alignItems:"center",gap:6,padding:8,backgroundColor:Jr.warning+"0D",borderRadius:4,borderWidth:1,borderColor:Jr.warning+"1A"},emptyValueText:{color:Jr.warning,fontSize:10,fontStyle:"italic"},typeHelperText:{color:Ce.color.textSecondary,fontSize:9,marginTop:4,textAlign:"center"},metaInfo:{marginTop:8},metaLabel:{color:Ce.color.textTertiary,fontSize:9,fontStyle:"italic"}});p();import{AlertCircle as Xu,CheckCircle2 as Qu,XCircle as Ii,Eye as Zu,Database as Mi,Shield as ed}from"@buoy-gg/shared-ui/web";import{night as Tt}from"@buoy-gg/shared-ui/web";import{jsx as Me,jsxs as Ye}from"react/jsx-runtime";var td=[{key:"valid",label:"Valid Keys",description:"Correctly stored and accessible",icon:Qu,color:"#10B981",textColor:"#10B981",bgColor:"rgba(16, 185, 129, 0.1)"},{key:"missing",label:"Missing Keys",description:"Required but not found",icon:Xu,color:"#EF4444",textColor:"#EF4444",bgColor:"rgba(239, 68, 68, 0.1)"},{key:"wrongValue",label:"Wrong Values",description:"Stored but incorrect value",icon:Ii,color:"#F97316",textColor:"#F97316",bgColor:"rgba(249, 115, 22, 0.1)"},{key:"wrongType",label:"Wrong Types",description:"Value has incorrect data type",icon:Ii,color:"#0891B2",textColor:"#0891B2",bgColor:"rgba(8, 145, 178, 0.1)"},{key:"optional",label:"Optional Keys",description:"Available but not required",icon:Zu,color:"#8B5CF6",textColor:"#8B5CF6",bgColor:"rgba(139, 92, 246, 0.1)"}],od=[{key:"mmkv",label:te.mmkv,description:te.hasSecure?"Synchronous key-value storage":"Storage for this browser tab",icon:Mi},{key:"async",label:te.asyncFull,description:te.hasSecure?"React Native async storage":"Persistent storage for this origin",icon:Mi},{key:"secure",label:"SecureStorage",description:"Encrypted secure storage",icon:ed}];function rd({stats:e}){let{totalCount:t,missingCount:o,wrongValueCount:r,wrongTypeCount:n,presentRequiredCount:a,optionalCount:s,mmkvCount:u,asyncCount:d,secureCount:g}=e;return t===0?Ye(i,{style:oe.statsContainer,children:[Me(l,{style:oe.sectionTitle,children:"STORAGE BREAKDOWN"}),Me(i,{style:oe.emptyState,children:Me(l,{style:oe.emptyStateText,children:"No storage keys detected"})})]}):Ye(i,{style:oe.statsContainer,children:[Ye(i,{style:oe.breakdownSection,children:[Me(l,{style:oe.sectionTitle,children:"KEY STATUS BREAKDOWN"}),Me(i,{style:oe.breakdownList,children:td.map(y=>{let m=0,f=!1;switch(y.key){case"valid":m=a,f=m>0;break;case"missing":m=o,f=m>0;break;case"wrongValue":m=r,f=m>0;break;case"wrongType":m=n,f=m>0;break;case"optional":m=s,f=m>0;break}if(!f)return null;let k=t>0?(m/t*100).toFixed(1):"0",b=y.icon;return Me(i,{style:oe.breakdownItem,children:Ye(i,{style:oe.breakdownItemRow,children:[Ye(i,{style:oe.breakdownItemLeft,children:[Me(i,{style:[oe.breakdownIcon,{backgroundColor:y.bgColor}],children:Me(b,{size:14,color:y.color})}),Ye(i,{style:oe.breakdownItemInfo,children:[Me(l,{style:oe.breakdownItemLabel,children:y.label}),Me(l,{style:oe.breakdownItemDesc,children:y.description})]})]}),Ye(i,{style:oe.breakdownItemRight,children:[Me(l,{style:[oe.breakdownCount,{color:y.textColor}],children:m}),Ye(l,{style:oe.breakdownPercentage,children:[k,"%"]})]})]})},y.key)})})]}),(u>0||d>0||g>0)&&Ye(i,{style:oe.breakdownSection,children:[Me(l,{style:oe.sectionTitle,children:"STORAGE TYPE BREAKDOWN"}),Me(i,{style:oe.breakdownList,children:od.map(y=>{let m=0,f=!1;switch(y.key){case"mmkv":m=u,f=m>0;break;case"async":m=d,f=m>0;break;case"secure":m=g,f=m>0;break}if(!f)return null;let k=t>0?(m/t*100).toFixed(1):"0",b=y.icon,w=br(y.key);return Me(i,{style:oe.breakdownItem,children:Ye(i,{style:oe.breakdownItemRow,children:[Ye(i,{style:oe.breakdownItemLeft,children:[Me(i,{style:[oe.breakdownIcon,{backgroundColor:`${w}15`}],children:Me(b,{size:14,color:w})}),Ye(i,{style:oe.breakdownItemInfo,children:[Me(l,{style:oe.breakdownItemLabel,children:y.label}),Me(l,{style:oe.breakdownItemDesc,children:y.description})]})]}),Ye(i,{style:oe.breakdownItemRight,children:[Me(l,{style:[oe.breakdownCount,{color:w}],children:m}),Ye(l,{style:oe.breakdownPercentage,children:[k,"%"]})]})]})},y.key)})})]})]})}var oe=$.create({statsContainer:{marginBottom:24,backgroundColor:Tt.color.surface,borderRadius:8,padding:16,borderWidth:1,borderColor:Tt.color.border},sectionTitle:{color:Tt.color.textSecondary,fontSize:12,fontWeight:"500",marginBottom:16,textTransform:"uppercase",letterSpacing:.5},breakdownSection:{gap:12,marginBottom:20},breakdownList:{gap:12},breakdownItem:{backgroundColor:Tt.color.surfaceElevated,padding:12,borderRadius:8,borderWidth:1,borderColor:Tt.color.border},breakdownItemRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},breakdownItemLeft:{flexDirection:"row",alignItems:"center",gap:12,flex:1,minWidth:0},breakdownIcon:{padding:8,borderRadius:8},breakdownItemInfo:{flex:1,minWidth:0},breakdownItemLabel:{color:Tt.color.text,fontSize:14,fontWeight:"500"},breakdownItemDesc:{color:Tt.color.textSecondary,fontSize:12},breakdownItemRight:{alignItems:"flex-end"},breakdownCount:{fontSize:16,fontWeight:"600"},breakdownPercentage:{color:Tt.color.textTertiary,fontSize:10},emptyState:{padding:16,backgroundColor:Tt.color.surfaceElevated,borderRadius:6,alignItems:"center"},emptyStateText:{color:Tt.color.textTertiary,fontSize:11,textAlign:"center"}});p();import{Database as nd,CyberpunkSectionButton as ad}from"@buoy-gg/shared-ui/web";import{jsx as sd}from"react/jsx-runtime";function id({onPress:e,eventCount:t=0}){let o=t>0?`${t} events`:"Monitoring";return sd(ad,{id:"storage-events",title:"EVENTS",subtitle:o,icon:nd,iconColor:"#00E5FF",iconBackgroundColor:"rgba(0, 229, 255, 0.1)",onPress:e,index:3})}p();import{macOSColors as or}from"@buoy-gg/shared-ui/web";var ld=["SET","GET","MERGE","DELETE","CLEAR"],cd={SET:or.semantic.info,GET:or.text.muted,MERGE:or.semantic.debug,DELETE:or.semantic.error,CLEAR:or.semantic.warning};function ud(e){return cd[e]}function dd(e){let t=e.action;return t==="clear"||t==="clearAll"?"CLEAR":t.startsWith("get.")?"GET":t==="removeItem"||t==="multiRemove"||t==="delete"?"DELETE":t==="mergeItem"||t==="multiMerge"?"MERGE":"SET"}function gd(e){return!!e.data?.initialScan}p();import{useState as yd}from"react";import{macOSColors as ao,night as ge,monoFont as Ei}from"@buoy-gg/shared-ui/web";import{jsx as le,jsxs as ct}from"react/jsx-runtime";function pd({selectedInstanceId:e,onSelectInstance:t,showRefreshButton:o=!0}){let[r,n]=yd(!1),{instances:a,instanceCount:s,refresh:u}=Ho(!1),d=a.find(y=>y.id===e),g=y=>{t(y),n(!1)};return zo()?s===0?le(i,{style:U.container,children:ct(i,{style:U.emptyState,children:[le(l,{style:U.emptyStateTitle,children:"No MMKV Instances Registered"}),le(l,{style:U.emptyStateDescription,children:"Register MMKV instances using registerMMKVInstance() to monitor them in dev tools."}),o&&le(A,{style:U.refreshButton,onPress:u,activeOpacity:.7,children:le(l,{style:U.refreshButtonText,children:"\u21BB Refresh"})})]})}):ct(i,{style:U.container,children:[ct(A,{style:U.selectorButton,onPress:()=>n(!0),activeOpacity:.7,children:[le(i,{style:U.selectorContent,children:d?le(Ki,{instance:d,isSelected:!0}):le(l,{style:U.placeholderText,children:"Select MMKV Instance"})}),le(l,{style:U.dropdownArrow,children:"\u25BC"})]}),le(mn,{visible:r,transparent:!0,animationType:"fade",onRequestClose:()=>n(!1),children:le(A,{style:U.modalOverlay,activeOpacity:1,onPress:()=>n(!1),children:ct(i,{style:U.dropdownContainer,children:[ct(i,{style:U.dropdownHeader,children:[ct(l,{style:U.dropdownTitle,children:["Select MMKV Instance (",s,")"]}),o&&le(A,{style:U.headerRefreshButton,onPress:u,activeOpacity:.7,children:le(l,{style:U.headerRefreshText,children:"\u21BB"})})]}),le(Lt,{style:U.dropdownList,children:a.map(y=>le(A,{style:[U.dropdownItem,y.id===e&&U.dropdownItemSelected],onPress:()=>g(y.id),activeOpacity:.7,children:le(Ki,{instance:y,isSelected:y.id===e})},y.id))})]})})})]}):le(i,{style:U.container,children:ct(i,{style:U.unavailableState,children:[ct(l,{style:U.unavailableTitle,children:[te.mmkv," Not Available"]}),le(l,{style:U.unavailableDescription,children:kn()})]})})}function Ki({instance:e,isSelected:t}){return ct(i,{style:U.instanceRow,children:[ct(i,{style:U.instanceLeft,children:[le(l,{style:[U.instanceId,t&&U.instanceIdSelected],numberOfLines:1,children:e.id}),ct(i,{style:U.instanceBadges,children:[e.encrypted&&le(i,{style:[U.badge,U.badgeEncrypted],children:le(l,{style:U.badgeText,children:"\u{1F512} Encrypted"})}),e.readOnly&&le(i,{style:[U.badge,U.badgeReadOnly],children:le(l,{style:U.badgeText,children:"\u{1F441}\uFE0F Read-only"})})]})]}),ct(i,{style:U.instanceRight,children:[le(l,{style:U.keyCount,children:e.keyCount}),le(l,{style:U.keyCountLabel,children:"keys"})]})]})}var U=$.create({container:{marginBottom:12},unavailableState:{backgroundColor:ao.semantic.warning+"15",borderRadius:12,padding:20,borderWidth:1,borderColor:ao.semantic.warning+"40",alignItems:"center",gap:12},unavailableTitle:{fontSize:14,fontWeight:"600",color:ao.semantic.warning},unavailableDescription:{fontSize:12,color:ge.color.textSecondary,textAlign:"center",lineHeight:18},emptyState:{backgroundColor:ge.color.surface,borderRadius:12,padding:20,borderWidth:1,borderColor:ge.color.border,alignItems:"center",gap:12},emptyStateTitle:{fontSize:14,fontWeight:"600",color:ge.color.text},emptyStateDescription:{fontSize:12,color:ge.color.textTertiary,textAlign:"center",lineHeight:18},refreshButton:{marginTop:8,paddingHorizontal:16,paddingVertical:8,backgroundColor:ge.color.accentSoft,borderRadius:8,borderWidth:1,borderColor:ge.color.accentBorderStrong},refreshButtonText:{fontSize:12,fontWeight:"600",color:ge.color.accent},selectorButton:{backgroundColor:ge.color.surface,borderRadius:12,borderWidth:1,borderColor:ge.color.border,padding:12,flexDirection:"row",alignItems:"center",justifyContent:"space-between",shadowColor:"#000000",shadowOpacity:.03,shadowRadius:8,shadowOffset:{width:0,height:2}},selectorContent:{flex:1},placeholderText:{fontSize:13,color:ge.color.placeholder,fontStyle:"italic"},dropdownArrow:{fontSize:10,color:ge.color.textTertiary,marginLeft:8},modalOverlay:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.5)",justifyContent:"center",alignItems:"center",padding:20},dropdownContainer:{backgroundColor:ge.color.surface,borderRadius:16,borderWidth:1,borderColor:ge.color.border,width:"100%",maxWidth:500,maxHeight:"70%",shadowColor:"#000000",shadowOpacity:.2,shadowRadius:20,shadowOffset:{width:0,height:10},overflow:"hidden"},dropdownHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16,borderBottomWidth:1,borderBottomColor:ge.color.separator},dropdownTitle:{fontSize:14,fontWeight:"600",color:ge.color.text},headerRefreshButton:{padding:4},headerRefreshText:{fontSize:18,color:ge.color.accent},dropdownList:{maxHeight:400},dropdownItem:{padding:12,borderBottomWidth:1,borderBottomColor:ge.color.separator},dropdownItemSelected:{backgroundColor:ge.color.accentSoft},instanceRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12},instanceLeft:{flex:1,gap:6},instanceId:{fontSize:13,fontWeight:"500",color:ge.color.text,fontFamily:Ei},instanceIdSelected:{fontWeight:"600",color:ge.color.accent},instanceBadges:{flexDirection:"row",flexWrap:"wrap",gap:6},badge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4,borderWidth:1},badgeEncrypted:{backgroundColor:ao.semantic.success+"15",borderColor:ao.semantic.success+"40"},badgeReadOnly:{backgroundColor:ao.semantic.warning+"15",borderColor:ao.semantic.warning+"40"},badgeText:{fontSize:9,fontWeight:"500",color:ge.color.textSecondary},instanceRight:{alignItems:"flex-end"},keyCount:{fontSize:16,fontWeight:"600",color:ge.color.text,fontFamily:Ei},keyCountLabel:{fontSize:9,color:ge.color.textTertiary,textTransform:"uppercase",letterSpacing:.5}});p();import{macOSColors as mt,night as Kt,monoFont as fd}from"@buoy-gg/shared-ui/web";import{jsx as Fe,jsxs as Vo}from"react/jsx-runtime";function md({instanceId:e}){let t=Kn(e);return t?Fe(i,{style:he.container,children:Vo(i,{style:he.panel,children:[Fe(i,{style:he.header,children:Fe(l,{style:he.headerTitle,children:"Instance Details"})}),Vo(i,{style:he.infoGrid,children:[Fe(rr,{label:"Instance ID",value:t.id,valueStyle:he.monoValue}),Fe(rr,{label:"Keys",value:`${t.keyCount} ${t.keyCount===1?"key":"keys"}`,highlight:!0}),Fe(rr,{label:"Encryption",value:t.encrypted?"\u{1F512} Encrypted":"\u{1F513} Not encrypted",valueColor:t.encrypted?mt.semantic.success:Kt.color.textTertiary}),Fe(rr,{label:"Access",value:t.readOnly?"\u{1F441}\uFE0F Read-only":"\u270F\uFE0F Read-write",valueColor:t.readOnly?mt.semantic.warning:Kt.color.textTertiary}),t.size!==void 0&&Fe(rr,{label:"Size",value:bd(t.size),valueStyle:he.monoValue})]}),t.encrypted&&Vo(i,{style:he.notice,children:[Fe(l,{style:he.noticeIcon,children:"\u{1F512}"}),Fe(l,{style:he.noticeText,children:"This instance is encrypted. Values are protected at rest."})]}),t.readOnly&&Vo(i,{style:[he.notice,he.noticeWarning],children:[Fe(l,{style:he.noticeIcon,children:"\u{1F441}\uFE0F"}),Fe(l,{style:[he.noticeText,he.noticeTextWarning],children:"Read-only mode. Cannot modify values in this instance."})]})]})}):Fe(i,{style:he.container,children:Fe(i,{style:he.errorState,children:Vo(l,{style:he.errorText,children:["Instance not found: ",e]})})})}function rr({label:e,value:t,valueStyle:o,valueColor:r,highlight:n}){return Vo(i,{style:he.infoItem,children:[Fe(l,{style:he.infoLabel,children:e}),Fe(l,{style:[he.infoValue,o,r&&{color:r},n&&he.infoValueHighlight],children:t})]})}function bd(e){if(e===0)return"0 Bytes";let t=1024,o=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(2))} ${o[r]}`}var he=$.create({container:{marginBottom:12},errorState:{backgroundColor:mt.semantic.error+"15",borderRadius:12,padding:12,borderWidth:1,borderColor:mt.semantic.error+"40"},errorText:{fontSize:12,color:mt.semantic.error,textAlign:"center"},panel:{backgroundColor:Kt.color.surface,borderRadius:12,borderWidth:1,borderColor:Kt.color.border,overflow:"hidden",shadowColor:"#000000",shadowOpacity:.03,shadowRadius:8,shadowOffset:{width:0,height:2}},header:{padding:12,borderBottomWidth:1,borderBottomColor:Kt.color.separator},headerTitle:{fontSize:11,fontWeight:"600",color:Kt.color.text,textTransform:"uppercase",letterSpacing:.5},infoGrid:{padding:12,gap:10},infoItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:4},infoLabel:{fontSize:12,color:Kt.color.textTertiary,fontWeight:"500"},infoValue:{fontSize:12,color:Kt.color.text,fontWeight:"500"},infoValueHighlight:{fontSize:14,fontWeight:"600",color:Kt.color.accent},monoValue:{fontFamily:fd},notice:{flexDirection:"row",alignItems:"center",gap:8,padding:10,margin:12,marginTop:0,backgroundColor:mt.semantic.success+"10",borderRadius:8,borderWidth:1,borderColor:mt.semantic.success+"30"},noticeWarning:{backgroundColor:mt.semantic.warning+"10",borderColor:mt.semantic.warning+"30"},noticeIcon:{fontSize:14},noticeText:{flex:1,fontSize:11,color:mt.semantic.success,lineHeight:16},noticeTextWarning:{color:mt.semantic.warning}});p();import{getBrowserStorage as Sd,subscribeToBrowserStorage as hd}from"@buoy-gg/shared-ui/web/utils";var Ri=0,Rt=()=>Sd("sessionStorage"),Ai=()=>Array.from({length:Rt().length},(e,t)=>Rt().key(t)).filter(e=>e!==null),vd={set(e,t){Rt().setItem(e,String(t))},getString(e){return Rt().getItem(e)??void 0},getNumber(){},getBoolean(){},getBuffer(){},contains(e){return Rt().getItem(e)!==null},delete(e){let t=this.contains(e);return Rt().removeItem(e),t},getAllKeys:Ai,clearAll(){Rt().clear()},get size(){return Ai().reduce((e,t)=>e+2*(t.length+(Rt().getItem(t)?.length??0)),0)},addOnValueChangedListener(e){return{remove:hd(t=>{t.area==="sessionStorage"&&(t.key!==void 0?e(t.key):t.prevPairs?.forEach(([o])=>e(o)))})}}};function wd(){if(typeof window>"u")return()=>{};try{Rt()}catch{return()=>{}}++Ri===1&&gn("sessionStorage",vd);let e=!0;return()=>{e&&(e=!1,--Ri===0&&yn("sessionStorage"))}}export{md as MMKVInstanceInfoPanel,pd as MMKVInstanceSelector,ld as STORAGE_OPS,Dn as StorageBrowserMode,Nr as StorageEventCard,_r as StorageEventDetailContent,zr as StorageEventDetailFooter,id as StorageEventsSection,Yu as StorageKeyCard,vn as StorageKeySection,rd as StorageKeyStatsSection,Ur as StorageModalWithTabs,$u as StorageSection,Mu as StorageToolView,_o as StorageTypeFilterBar,Go as batchPairsOf,Qo as canUndo,Zt as clearAllAppStorage,xn as countByStorageType,Fu as createStorageTool,$e as detectMMKVType,Ji as formatMMKVValue,Ol as getMMKVClass,kn as getMMKVUnavailableMessage,iu as getValueType,gd as isInitialScan,zo as isMMKVAvailable,dr as isTypeMatch,jo as isValueOnDevice,Xo as jumpToState,gn as registerMMKVInstance,Yi as registerSecureStoreKeys,Sc as requestStorageBrowserRefresh,An as setStorageValue,wd as startBrowserStorageCapture,Er as storageEditBlockedReason,wt as storageEventStore,ud as storageOpDot,dd as storageOpOf,Du as storageSyncAdapter,vi as storageToolPreset,vc as storageValueToEditableText,Yo as undoOperation,yn as unregisterMMKVInstance,Xi as unregisterSecureStoreKey,$o as useAsyncStorageKeys,Kn as useMMKVInstance,Jl as useMMKVInstanceExists,Ho as useMMKVInstances,ql as useMMKVKeys,Mn as useMultiMMKVKeys,On as useStorageEvents,Ba as validateStorageValue};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/storage",
3
- "version": "7.0.40",
3
+ "version": "7.0.41",
4
4
  "description": "Inspect supported AsyncStorage data, registered MMKV instances and registered SecureStore keys in a React Native app.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -10,40 +10,51 @@
10
10
  "exports": {
11
11
  ".": {
12
12
  "react-native": "./lib/module/index.js",
13
+ "browser": {
14
+ "types": "./lib/typescript/index.d.ts",
15
+ "default": "./lib/web/index.mjs"
16
+ },
13
17
  "import": {
14
- "default": "./lib/module/index.js",
15
- "types": "./lib/typescript/index.d.ts"
18
+ "types": "./lib/typescript/index.d.ts",
19
+ "default": "./lib/module/index.js"
16
20
  },
17
21
  "require": {
18
- "default": "./lib/commonjs/index.js",
19
- "types": "./lib/typescript/index.d.ts"
22
+ "types": "./lib/typescript/index.d.ts",
23
+ "default": "./lib/commonjs/index.js"
20
24
  }
21
25
  },
22
- "./package.json": "./package.json"
26
+ "./package.json": "./package.json",
27
+ "./web": {
28
+ "types": "./lib/typescript/index.d.ts",
29
+ "default": "./lib/web/index.mjs"
30
+ }
23
31
  },
24
32
  "files": [
25
33
  "lib"
26
34
  ],
27
35
  "sideEffects": [
28
36
  "**/snapshotProvider.js",
29
- "**/snapshotProvider.ts"
37
+ "**/snapshotProvider.ts",
38
+ "./lib/web/**/*.mjs"
30
39
  ],
31
40
  "dependencies": {
32
- "@buoy-gg/floating-tools-core": "^7.0.40",
33
- "@buoy-gg/shared-ui": "^7.0.40"
41
+ "@buoy-gg/shared-ui": "^7.0.41",
42
+ "@buoy-gg/floating-tools-core": "^7.0.41"
34
43
  },
35
44
  "peerDependencies": {
36
- "@buoy-gg/license": "7.0.40",
45
+ "@buoy-gg/license": "7.0.41",
37
46
  "@react-native-async-storage/async-storage": "^2.0.0 || ^3.1.0",
38
47
  "react": "*",
39
- "react-native": "*"
48
+ "react-native": "*",
49
+ "react-native-web": "^0.21.0",
50
+ "react-dom": ">=18"
40
51
  },
41
52
  "devDependencies": {
42
53
  "@react-native-async-storage/async-storage": "^2.1.0",
43
54
  "@types/react": "^19.1.0",
44
55
  "@types/react-native": "^0.73.0",
45
56
  "typescript": "~5.8.3",
46
- "@buoy-gg/license": "^7.0.40"
57
+ "@buoy-gg/license": "^7.0.41"
47
58
  },
48
59
  "react-native-builder-bob": {
49
60
  "source": "src",
@@ -93,10 +104,25 @@
93
104
  "mmkv",
94
105
  "storage-inspector"
95
106
  ],
107
+ "peerDependenciesMeta": {
108
+ "@react-native-async-storage/async-storage": {
109
+ "optional": true
110
+ },
111
+ "react-native": {
112
+ "optional": true
113
+ },
114
+ "react-native-web": {
115
+ "optional": true
116
+ },
117
+ "react-dom": {
118
+ "optional": true
119
+ }
120
+ },
96
121
  "scripts": {
97
- "build": "bob build",
122
+ "build": "bob build && pnpm run build:web",
98
123
  "typecheck": "tsc --noEmit",
99
124
  "clean": "rimraf lib",
100
- "test": "pnpm run typecheck"
125
+ "test": "pnpm run typecheck",
126
+ "build:web": "node ../../scripts/build-web.mjs storage"
101
127
  }
102
128
  }