@buoy-gg/events 7.0.41 → 7.0.43

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 (123) hide show
  1. package/README.md +11 -64
  2. package/lib/commonjs/components/EventsCopySettingsView.js +1 -581
  3. package/lib/commonjs/components/EventsModal.js +1 -378
  4. package/lib/commonjs/components/ReactQueryEventDetail.js +1 -433
  5. package/lib/commonjs/components/UnifiedEventDetail.js +1 -565
  6. package/lib/commonjs/components/UnifiedEventFilters.js +1 -160
  7. package/lib/commonjs/components/UnifiedEventItem.js +1 -416
  8. package/lib/commonjs/components/UnifiedEventList.js +1 -187
  9. package/lib/commonjs/components/UnifiedEventViewer.js +1 -130
  10. package/lib/commonjs/hooks/useUnifiedEvents.js +1 -419
  11. package/lib/commonjs/index.js +1 -282
  12. package/lib/commonjs/preset.js +1 -60
  13. package/lib/commonjs/sources/sourceIds.js +1 -30
  14. package/lib/commonjs/stores/unifiedEventStore.js +1 -712
  15. package/lib/commonjs/sync/eventsSyncAdapter.js +1 -358
  16. package/lib/commonjs/types/copySettings.js +1 -249
  17. package/lib/commonjs/types/index.js +1 -17
  18. package/lib/commonjs/utils/autoDiscoverEventSources.js +1 -1068
  19. package/lib/commonjs/utils/badgeSelectionStorage.js +1 -126
  20. package/lib/commonjs/utils/copySettingsStorage.js +1 -43
  21. package/lib/commonjs/utils/correlationUtils.js +1 -130
  22. package/lib/commonjs/utils/eventExportFormatter.js +1 -1912
  23. package/lib/commonjs/utils/eventTransformers.js +1 -496
  24. package/lib/commonjs/utils/eventVisibility.js +1 -76
  25. package/lib/commonjs/utils/testIDs.js +1 -91
  26. package/lib/module/components/EventsCopySettingsView.js +1 -577
  27. package/lib/module/components/EventsModal.js +1 -374
  28. package/lib/module/components/ReactQueryEventDetail.js +1 -429
  29. package/lib/module/components/UnifiedEventDetail.js +1 -561
  30. package/lib/module/components/UnifiedEventFilters.js +1 -156
  31. package/lib/module/components/UnifiedEventItem.js +1 -412
  32. package/lib/module/components/UnifiedEventList.js +1 -183
  33. package/lib/module/components/UnifiedEventViewer.js +1 -126
  34. package/lib/module/hooks/useUnifiedEvents.js +1 -416
  35. package/lib/module/index.js +1 -102
  36. package/lib/module/preset.js +1 -57
  37. package/lib/module/sources/sourceIds.js +1 -26
  38. package/lib/module/stores/unifiedEventStore.js +1 -678
  39. package/lib/module/sync/eventsSyncAdapter.js +1 -354
  40. package/lib/module/types/copySettings.js +1 -244
  41. package/lib/module/types/index.js +1 -37
  42. package/lib/module/utils/autoDiscoverEventSources.js +1 -1060
  43. package/lib/module/utils/badgeSelectionStorage.js +1 -116
  44. package/lib/module/utils/copySettingsStorage.js +1 -37
  45. package/lib/module/utils/correlationUtils.js +1 -120
  46. package/lib/module/utils/eventExportFormatter.js +1 -1901
  47. package/lib/module/utils/eventTransformers.js +1 -487
  48. package/lib/module/utils/eventVisibility.js +1 -70
  49. package/lib/module/utils/testIDs.js +1 -83
  50. package/lib/web/index.mjs +9 -10
  51. package/package.json +4 -7
  52. package/lib/commonjs/components/EventsCopySettingsView.js.map +0 -1
  53. package/lib/commonjs/components/EventsModal.js.map +0 -1
  54. package/lib/commonjs/components/ReactQueryEventDetail.js.map +0 -1
  55. package/lib/commonjs/components/UnifiedEventDetail.js.map +0 -1
  56. package/lib/commonjs/components/UnifiedEventFilters.js.map +0 -1
  57. package/lib/commonjs/components/UnifiedEventItem.js.map +0 -1
  58. package/lib/commonjs/components/UnifiedEventList.js.map +0 -1
  59. package/lib/commonjs/components/UnifiedEventViewer.js.map +0 -1
  60. package/lib/commonjs/hooks/useUnifiedEvents.js.map +0 -1
  61. package/lib/commonjs/index.js.map +0 -1
  62. package/lib/commonjs/preset.js.map +0 -1
  63. package/lib/commonjs/sources/sourceIds.js.map +0 -1
  64. package/lib/commonjs/stores/unifiedEventStore.js.map +0 -1
  65. package/lib/commonjs/sync/eventsSyncAdapter.js.map +0 -1
  66. package/lib/commonjs/types/copySettings.js.map +0 -1
  67. package/lib/commonjs/types/index.js.map +0 -1
  68. package/lib/commonjs/utils/autoDiscoverEventSources.js.map +0 -1
  69. package/lib/commonjs/utils/badgeSelectionStorage.js.map +0 -1
  70. package/lib/commonjs/utils/copySettingsStorage.js.map +0 -1
  71. package/lib/commonjs/utils/correlationUtils.js.map +0 -1
  72. package/lib/commonjs/utils/eventExportFormatter.js.map +0 -1
  73. package/lib/commonjs/utils/eventTransformers.js.map +0 -1
  74. package/lib/commonjs/utils/eventVisibility.js.map +0 -1
  75. package/lib/commonjs/utils/testIDs.js.map +0 -1
  76. package/lib/module/components/EventsCopySettingsView.js.map +0 -1
  77. package/lib/module/components/EventsModal.js.map +0 -1
  78. package/lib/module/components/ReactQueryEventDetail.js.map +0 -1
  79. package/lib/module/components/UnifiedEventDetail.js.map +0 -1
  80. package/lib/module/components/UnifiedEventFilters.js.map +0 -1
  81. package/lib/module/components/UnifiedEventItem.js.map +0 -1
  82. package/lib/module/components/UnifiedEventList.js.map +0 -1
  83. package/lib/module/components/UnifiedEventViewer.js.map +0 -1
  84. package/lib/module/hooks/useUnifiedEvents.js.map +0 -1
  85. package/lib/module/index.js.map +0 -1
  86. package/lib/module/preset.js.map +0 -1
  87. package/lib/module/sources/sourceIds.js.map +0 -1
  88. package/lib/module/stores/unifiedEventStore.js.map +0 -1
  89. package/lib/module/sync/eventsSyncAdapter.js.map +0 -1
  90. package/lib/module/types/copySettings.js.map +0 -1
  91. package/lib/module/types/index.js.map +0 -1
  92. package/lib/module/utils/autoDiscoverEventSources.js.map +0 -1
  93. package/lib/module/utils/badgeSelectionStorage.js.map +0 -1
  94. package/lib/module/utils/copySettingsStorage.js.map +0 -1
  95. package/lib/module/utils/correlationUtils.js.map +0 -1
  96. package/lib/module/utils/eventExportFormatter.js.map +0 -1
  97. package/lib/module/utils/eventTransformers.js.map +0 -1
  98. package/lib/module/utils/eventVisibility.js.map +0 -1
  99. package/lib/module/utils/testIDs.js.map +0 -1
  100. package/lib/typescript/components/EventsCopySettingsView.d.ts.map +0 -1
  101. package/lib/typescript/components/EventsModal.d.ts.map +0 -1
  102. package/lib/typescript/components/ReactQueryEventDetail.d.ts.map +0 -1
  103. package/lib/typescript/components/UnifiedEventDetail.d.ts.map +0 -1
  104. package/lib/typescript/components/UnifiedEventFilters.d.ts.map +0 -1
  105. package/lib/typescript/components/UnifiedEventItem.d.ts.map +0 -1
  106. package/lib/typescript/components/UnifiedEventList.d.ts.map +0 -1
  107. package/lib/typescript/components/UnifiedEventViewer.d.ts.map +0 -1
  108. package/lib/typescript/hooks/useUnifiedEvents.d.ts.map +0 -1
  109. package/lib/typescript/index.d.ts.map +0 -1
  110. package/lib/typescript/preset.d.ts.map +0 -1
  111. package/lib/typescript/sources/sourceIds.d.ts.map +0 -1
  112. package/lib/typescript/stores/unifiedEventStore.d.ts.map +0 -1
  113. package/lib/typescript/sync/eventsSyncAdapter.d.ts.map +0 -1
  114. package/lib/typescript/types/copySettings.d.ts.map +0 -1
  115. package/lib/typescript/types/index.d.ts.map +0 -1
  116. package/lib/typescript/utils/autoDiscoverEventSources.d.ts.map +0 -1
  117. package/lib/typescript/utils/badgeSelectionStorage.d.ts.map +0 -1
  118. package/lib/typescript/utils/copySettingsStorage.d.ts.map +0 -1
  119. package/lib/typescript/utils/correlationUtils.d.ts.map +0 -1
  120. package/lib/typescript/utils/eventExportFormatter.d.ts.map +0 -1
  121. package/lib/typescript/utils/eventTransformers.d.ts.map +0 -1
  122. package/lib/typescript/utils/eventVisibility.d.ts.map +0 -1
  123. package/lib/typescript/utils/testIDs.d.ts.map +0 -1
package/lib/web/index.mjs CHANGED
@@ -1,13 +1,12 @@
1
- "use client";
2
- var bn=Object.defineProperty;var dr=Object.getOwnPropertyDescriptor;var pr=Object.getOwnPropertyNames;var mr=Object.prototype.hasOwnProperty;var fr=(t,e)=>{for(var n in e)bn(t,n,{get:e[n],enumerable:!0})},yn=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of pr(e))!mr.call(t,o)&&o!==n&&bn(t,o,{get:()=>e[o],enumerable:!(r=dr(e,o))||r.enumerable});return t},O=(t,e,n)=>(yn(t,e,"default"),n&&yn(n,e,"default"));typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{EventsIcon as Ds,EVENTS_ICON_COLOR as Is}from"@buoy-gg/floating-tools-core/web";var I={};fr(I,{AccessibilityInfo:()=>Ir,ActivityIndicator:()=>Cr,Alert:()=>It,Animated:()=>Rr,AppRegistry:()=>$r,AppState:()=>Ur,Appearance:()=>Ar,BackHandler:()=>Pr,Button:()=>xr,CheckBox:()=>Qr,Clipboard:()=>Vr,DeviceEventEmitter:()=>lo,Dimensions:()=>qr,Easing:()=>Nr,FlatList:()=>Rt,I18nManager:()=>Fr,Image:()=>Gr,ImageBackground:()=>Zr,InteractionManager:()=>Or,Keyboard:()=>Mr,KeyboardAvoidingView:()=>Yr,LayoutAnimation:()=>Br,Linking:()=>Lr,LogBox:()=>co,Modal:()=>Er,NativeEventEmitter:()=>zr,NativeModules:()=>Dr,PanResponder:()=>_r,Picker:()=>Xr,PixelRatio:()=>jr,Platform:()=>Hr,Pressable:()=>Sr,ProgressBar:()=>eo,RefreshControl:()=>to,SafeAreaView:()=>no,ScrollView:()=>Y,SectionList:()=>ro,Share:()=>Wr,StatusBar:()=>oo,StyleSheet:()=>H,Switch:()=>wr,Text:()=>E,TextInput:()=>br,Touchable:()=>io,TouchableHighlight:()=>hr,TouchableNativeFeedback:()=>so,TouchableOpacity:()=>ae,TouchableWithoutFeedback:()=>vr,UIManager:()=>Jr,Vibration:()=>Kr,View:()=>p,VirtualizedList:()=>ao,YellowBox:()=>uo,findNodeHandle:()=>kr,unstable_createElement:()=>Tr,useColorScheme:()=>po,useLocaleContext:()=>mo,useWindowDimensions:()=>fo});O(I,Qs);import*as Qs from"react-native-web";import{unstable_createElement as Tr,NativeModules as Dr,AccessibilityInfo as Ir,Animated as Rr,Appearance as Ar,AppRegistry as $r,AppState as Ur,BackHandler as Pr,Clipboard as Vr,Dimensions as qr,Easing as Nr,I18nManager as Fr,Keyboard as Mr,InteractionManager as Or,LayoutAnimation as Br,Linking as Lr,NativeEventEmitter as zr,PanResponder as _r,PixelRatio as jr,Platform as Hr,Share as Wr,StyleSheet as H,UIManager as Jr,Vibration as Kr,CheckBox as Qr,FlatList as Rt,Image as Gr,ImageBackground as Zr,KeyboardAvoidingView as Yr,Picker as Xr,ProgressBar as eo,RefreshControl as to,SafeAreaView as no,SectionList as ro,StatusBar as oo,Touchable as io,TouchableNativeFeedback as so,VirtualizedList as ao,YellowBox as uo,LogBox as co,DeviceEventEmitter as lo,useColorScheme as po,useLocaleContext as mo,useWindowDimensions as fo}from"react-native-web";import*as V from"react-native-web";import{createElement as gr,forwardRef as yr}from"react";function ne(t){let e=yr((r,o)=>{let{accessibilityState:s,accessibilityValue:i,...u}=r;for(let a of["busy","checked","disabled","expanded","selected"])s?.[a]!==void 0&&u[`aria-${a}`]===void 0&&(u[`aria-${a}`]=s[a]);for(let[a,c]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[a]!==void 0&&u[`aria-${c}`]===void 0&&(u[`aria-${c}`]=i[a]);return gr(t,{...u,ref:o})}),n=t.State;return n&&Object.assign(e,{State:n}),e.displayName=t.displayName??t.name??"NativeWebView",e}var p=ne(V.View),E=ne(V.Text),br=ne(V.TextInput),ae=ne(V.TouchableOpacity),hr=ne(V.TouchableHighlight),vr=ne(V.TouchableWithoutFeedback),Sr=ne(V.Pressable),Y=ne(V.ScrollView),Er=ne(V.Modal),wr=ne(V.Switch),Cr=ne(V.ActivityIndicator),xr=ne(V.Button),kr=V.findNodeHandle,It={alert(t,e,n,r){if(typeof document>"u")return;let o=document.createElement("dialog");o.dataset.buoyRoot="",o.setAttribute("aria-label",t),o.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 s=document.createElement("h2");if(s.textContent=t,s.style.cssText="font-size:18px;margin:0 0 12px",o.appendChild(s),e){let c=document.createElement("p");c.textContent=e,c.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",o.appendChild(c)}let i=document.createElement("div");i.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let u=n?.length?n:[{text:"OK"}],a=()=>{o.close?.(),o.remove()};for(let c of u){let l=document.createElement("button");l.type="button",l.textContent=c.text??"OK",l.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${c.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,l.onclick=()=>{a(),c.onPress?.()},i.appendChild(l)}o.addEventListener("cancel",c=>{c.preventDefault(),r?.cancelable!==!1&&(a(),r?.onDismiss?.())}),o.appendChild(i),document.body.appendChild(o),o.showModal?o.showModal():o.setAttribute("open","")}};import{useState as vt,useCallback as ze,useEffect as ms,useRef as fs}from"react";import{JsModal as gs,ModalHeader as oe,buoyColors as ys,night as se,Trash2 as bs,Copy as hs,Search as vs,devToolsStorageKeys as Ss,ToolbarCopyButton as Es,UpgradeModal as ws,PowerToggleButton as Cs,useSafeRouter as xs,windowDragProps as ks}from"@buoy-gg/shared-ui/web";import{useState as we,useEffect as Ce,useCallback as xe,useMemo as ke,useRef as Ft}from"react";import{useFeatureGate as Fo,subscribeToSubscriberCountChanges as Mo,useIgnoredPatterns as Oo,useLimit as Bo}from"@buoy-gg/shared-ui/web";import{loadToolModule as re,getToolModuleVersion as hn}from"@buoy-gg/shared-ui/web/utils";var go=0;function he(t){return`${t}-${Date.now()}-${++go}`}function yo(){try{let{storageEventStore:t}=re("@buoy-gg/storage");return{id:"storage",name:"Storage",eventSources:["storage-async","storage-mmkv"],available:!0,subscribe:e=>t.onEvent(n=>{if(n?.data?.initialScan)return;let o=bo(n);e(o)})}}catch{return null}}function bo(t){let e=t,n=e.storageType==="async"?"storage-async":"storage-mmkv",r=e.action;e.storageType==="async"&&(r={setItem:"Set Item",removeItem:"Remove Item",mergeItem:"Merge Item",clear:"Clear All",multiSet:"Multi Set",multiRemove:"Multi Remove",multiMerge:"Multi Merge"}[e.action]||e.action);let o="";if(e.storageType==="async")switch(e.action){case"setItem":case"removeItem":case"mergeItem":o=e.data?.key||"unknown key";break;case"multiSet":case"multiMerge":{let i=e.data?.pairs?.length||0;o=`${i} key${i!==1?"s":""}`;break}case"multiRemove":{let i=e.data?.keys?.length||0;o=`${i} key${i!==1?"s":""}`;break}case"clear":o="all keys";break}else o=e.data?.key||e.data?.instanceId||"unknown";let s="neutral";return(e.action.includes("set")||e.action.includes("Set")||e.action.includes("merge")||e.action.includes("Merge"))&&(s="success"),{id:he(n),source:n,timestamp:e.timestamp.getTime(),title:r,subtitle:o,status:s,originalEvent:t}}function ho(){try{let{reduxActionStore:t}=re("@buoy-gg/redux"),e=null;return{id:"redux",name:"Redux",eventSources:["redux"],available:!0,subscribe:n=>t.subscribe(r=>{if(r.length>0){let o=r[0];if(o.id!==e){e=o.id;let s=vo(o);n(s)}}})}}catch{return null}}function vo(t){let e=t,n="neutral";switch(e.category){case"fulfilled":n="success";break;case"rejected":n="error";break;case"pending":n="pending";break;default:n=e.hasStateChange?"success":"neutral"}let r="";return e.payloadPreview?r=e.payloadPreview:e.hasStateChange&&e.diffSummary?r=e.diffSummary:e.duration!==void 0?r=`${e.duration.toFixed(1)}ms`:r=e.sliceName||"",{id:he("redux"),source:"redux",timestamp:e.timestamp,title:e.type,subtitle:r,status:n,originalEvent:t}}function So(){try{let{networkEventStore:t,networkListener:e,addNetworkListener:n}=re("@buoy-gg/network"),r=new Map;return{id:"network",name:"Network",eventSources:["network"],available:!0,setup:()=>{let o=e();o.isActive||o.startListening(),o.listenerCount===0&&n(s=>{t.processNetworkEvent(s)})},subscribe:o=>{let s=Date.now();return t.onEvent(i=>{let u=i,a=r.get(u.id);if(a){let c=vn(i);c.id=a,o(c)}else{if(typeof u.timestamp=="number"&&u.timestamp<s)return;let c=vn(i);r.set(u.id,c.id),o(c)}},!1)}}}catch{return null}}function vn(t){let e=t,n="neutral";e.status===void 0?n="pending":e.error||e.status>=400?n="error":e.status>=200&&e.status<400&&(n="success");let r=e.operationName||`${e.method} ${e.path||e.url}`,o=[];return e.status!==void 0?o.push(`${e.status}`):e.error?o.push("Error"):o.push("Pending"),e.duration!==void 0&&o.push(`${e.duration.toFixed(0)}ms`),e.host&&o.push(e.host),{id:he("network"),source:"network",timestamp:e.timestamp,title:r,subtitle:o.join(" \xB7 "),status:n,originalEvent:t}}function Eo(){try{let{reactQueryEventStore:t}=re("@buoy-gg/react-query"),e=null;return{id:"react-query",name:"React Query",eventSources:["react-query","react-query-query","react-query-mutation"],available:!0,subscribe:n=>{let r=!0,o=new Set,s=i=>i.queryHash??(i.mutationId!==void 0?`m-${i.mutationId}`:null);return t.subscribe(i=>{if(r){r=!1,i.length>0&&(e=i[0].id);return}if(i.length>0){let u=i[0];if(u.id!==e){e=u.id;let a=u.type??"",c=s(u);if(a==="query-fetch-start"||a==="mutation-start")c&&o.add(c);else if((a==="query-fetch-success"||a==="query-fetch-error"||a==="mutation-success"||a==="mutation-error")&&c&&!o.has(c))return;let l=wo(u);n(l)}}})}}}catch{return null}}function Sn(t){return!t||t.length===0?"unknown":t.map(e=>{if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(typeof e=="object"&&e!==null){let r=Object.values(e)[0];return typeof r=="string"||typeof r=="number"?String(r):JSON.stringify(e).slice(0,20)}return String(e)}).join(" \u203A ")}function wo(t){let e=t,r=e.type.startsWith("mutation-")?"react-query-mutation":"react-query-query",o="neutral";switch(e.type){case"query-fetch-start":case"mutation-start":o="pending";break;case"query-fetch-success":case"mutation-success":o="success";break;case"query-fetch-error":case"mutation-error":o="error";break}let s="";e.queryKey?s=Sn(e.queryKey):e.mutationKey?s=Sn(e.mutationKey):e.mutationId!==void 0?s=`Mutation #${e.mutationId}`:s=e.type.replace(/-/g," ");let i=[];switch(e.type){case"query-fetch-start":i.push("Fetching");break;case"query-fetch-success":i.push("Success");break;case"query-fetch-error":i.push("Error");break;case"query-invalidated":i.push("Invalidated");break;case"mutation-start":i.push("Mutating");break;case"mutation-success":i.push("Success");break;case"mutation-error":i.push("Error");break}e.duration!==void 0&&i.push(`${e.duration.toFixed(0)}ms`);let u;e.queryHash?u=`rq-query-${e.queryHash}`:e.mutationId!==void 0&&(u=`rq-mutation-${e.mutationId}`);let a=1;switch(e.type){case"query-fetch-start":case"mutation-start":a=1;break;case"query-fetch-success":case"query-fetch-error":case"mutation-success":case"mutation-error":a=2;break;case"query-invalidated":a=3;break}return{id:he(r),source:r,timestamp:e.timestamp,title:s,subtitle:i.join(" \xB7 "),status:o,originalEvent:t,correlationId:u,sequenceInGroup:a}}function Co(){try{let{routeEventStore:t}=re("@buoy-gg/route-events");return{id:"route-events",name:"Routes",eventSources:["route"],available:!0,subscribe:e=>t.onEvent(n=>{let r=xo(n);e(r)})}}catch{return null}}function xo(t){let e=t,n="neutral";(e.pathname==="/"||Object.keys(e.params).length>0)&&(n="success");let r=[],o=Object.keys(e.params).length;return o>0&&r.push(`${o} param${o!==1?"s":""}`),e.timeSincePrevious!==void 0&&e.timeSincePrevious>0&&(e.timeSincePrevious<1e3?r.push(`${e.timeSincePrevious}ms`):r.push(`${(e.timeSincePrevious/1e3).toFixed(1)}s`)),e.previousPathname&&e.previousPathname!==e.pathname&&r.push(`from ${e.previousPathname}`),{id:he("route"),source:"route",timestamp:e.timestamp,title:e.pathname||"/",subtitle:r.join(" \xB7 ")||"navigation",status:n,originalEvent:t}}function ko(){try{let{zustandStateStore:t}=re("@buoy-gg/zustand"),e=null;return{id:"zustand",name:"Zustand",eventSources:["zustand"],available:!0,subscribe:n=>t.subscribe(r=>{if(r.length>0){let o=r[0];if(o.id!==e){e=o.id;let s=To(o);n(s)}}})}}catch{return null}}function To(t){let e=t,n="neutral";e.isSlowUpdate?n="pending":e.hasStateChange&&(n="success");let r=[];if(e.changedKeys&&e.changedKeys.length>0){let o=e.changedKeys.slice(0,3).join(", "),s=e.changedKeys.length>3?` +${e.changedKeys.length-3}`:"";r.push(`${o}${s}`)}else e.diffSummary&&r.push(e.diffSummary);return e.duration!==void 0&&r.push(`${e.duration.toFixed(1)}ms`),e.category==="replace"&&r.push("replace"),{id:he("zustand"),source:"zustand",timestamp:e.timestamp,title:e.storeName,subtitle:r.join(" \xB7 ")||(e.hasStateChange?"state changed":"no change"),status:n,originalEvent:t}}function Do(){try{let{jotaiStateStore:t}=re("@buoy-gg/jotai"),e=null;return{id:"jotai",name:"Jotai",eventSources:["jotai"],available:!0,subscribe:n=>t.subscribe(r=>{if(r.length>0){let o=r[0];if(o.id!==e){e=o.id;let s=Io(o);n(s)}}})}}catch{return null}}function Io(t){let e=t,n="neutral";e.category==="write"&&e.hasValueChange?n="success":e.category==="read"&&(n="neutral");let r=[];return e.valuePreview?r.push(e.valuePreview):e.diffSummary&&r.push(e.diffSummary),e.category&&r.push(e.category),{id:he("jotai"),source:"jotai",timestamp:e.timestamp,title:e.atomLabel,subtitle:r.join(" \xB7 ")||(e.hasValueChange?"value changed":"no change"),status:n,originalEvent:t}}function Ro(){let t;try{t=re("@buoy-gg/highlight-updates")}catch{return null}try{if(!t.RenderTracker||!t.HighlightUpdatesController)return null;let{RenderTracker:e,HighlightUpdatesController:n}=t;return{id:"render",name:"Render",eventSources:["render"],available:!0,setup:()=>{n&&n.enableBackgroundTracking()},subscribe:r=>{n&&!n.isBackgroundTrackingEnabled()&&n.enableBackgroundTracking();let o=e.onRenderEvent((s,i)=>{let u=Ao(s,i);r(u)});return()=>{o(),n.disableBackgroundTracking()}}}}catch{return null}}function Ao(t,e){let n=t,r=e,o=r.componentName||r.displayName||r.viewType,s=[],i={mount:"mounted",props:"props changed",state:"state changed",hooks:"hooks changed",context:"context changed",parent:"parent re-rendered",unknown:"re-rendered"};if(s.push(i[n.cause.type]||n.cause.type),n.cause.type==="props"&&n.cause.changedKeys?.length){let a=n.cause.changedKeys.slice(0,3).join(", "),c=n.cause.changedKeys.length>3?` +${n.cause.changedKeys.length-3}`:"";s.push(`[${a}${c}]`)}if(n.cause.hookChanges?.length){let a=n.cause.hookChanges[0];a.description&&s.push(a.description)}s.push(`#${n.renderNumber}`);let u="neutral";switch(n.cause.type){case"mount":u="neutral";break;case"props":case"state":case"hooks":case"context":u="success";break;case"parent":u="pending";break;default:u="neutral"}return{id:he("render"),source:"render",timestamp:n.timestamp,title:o,subtitle:s.join(" \xB7 "),status:u,originalEvent:{event:n,render:r}}}function $o(){let t=[],e=new Set,n=[yo,ho,So,Eo,Co,ko,Do,Ro];for(let r of n){let o=r();o&&o.available&&(t.push(o),o.eventSources.forEach(s=>e.add(s)))}return{sources:t,availableEventSources:e}}function wn(t){return{"storage-async":{label:"Storage",color:"#8B5CF6",icon:"server-outline"},"storage-mmkv":{label:"MMKV",color:"#F59E0B",icon:"flash-outline"},redux:{label:"Redux",color:"#3B82F6",icon:"git-branch-outline"},network:{label:"Network",color:"#10B981",icon:"globe-outline"},"react-query":{label:"Query",color:"#EC4899",icon:"sync-outline"},"react-query-query":{label:"Query",color:"#EC4899",icon:"sync-outline"},"react-query-mutation":{label:"Mutation",color:"#F97316",icon:"flash-outline"},route:{label:"Route",color:"#06B6D4",icon:"navigate-outline"},zustand:{label:"Zustand",color:"#764ABC",icon:"cube-outline"},jotai:{label:"Jotai",color:"#14B8A6",icon:"ellipse-outline"},render:{label:"Render",color:"#F472B6",icon:"layers-outline"}}[t]||{label:t,color:"#6B7280",icon:"help-outline"}}var At=null,En=-1;function G(){return(!At||En!==hn())&&(En=hn(),At=$o()),At}function Cn(){let t=[],e=0;try{let{storageEventStore:n}=re("@buoy-gg/storage"),r=n.getSubscriberCounts();t.push({sourceId:"storage",counts:r}),e+=r.total}catch{}try{let{networkEventStore:n}=re("@buoy-gg/network"),r=n.getSubscriberCounts();t.push({sourceId:"network",counts:r}),e+=r.total}catch{}try{let{routeEventStore:n}=re("@buoy-gg/route-events"),r=n.getSubscriberCounts();t.push({sourceId:"route-events",counts:r}),e+=r.total}catch{}try{let{RenderTracker:n,HighlightUpdatesController:r}=re("@buoy-gg/highlight-updates"),o=n.getRenderEventCallbackCount(),s=r?.isEnabled?.()?1:0,i={eventCallbacks:o,arrayListeners:s,total:o+s};t.push({sourceId:"render",counts:i}),e+=i.total}catch{}return{sources:t,totalSubscribers:e}}import{ChangeLog as Uo}from"@buoy-gg/shared-ui/web";var $t={"storage-async":"storage","storage-mmkv":"storage",redux:"redux",network:"network","react-query":"react-query","react-query-query":"react-query","react-query-mutation":"react-query",route:"route-events",zustand:"zustand",jotai:"jotai",render:"render"};var Po=200,xn=new Set(["render"]),Ut=class extends Uo{constructor(){super({max:Po});this.activeSources=new Set;this.remoteAvailableSources=null;this.sourceUnsubscribers=new Map;this.remoteDiscoveryIds=new Set;this.localDiscoveryIds=new Set;this.localSyncChain=Promise.resolve();this.networkEventIdMap=new Map}getDiscoveredSources(){return G().sources}getAvailableEventSources(){return this.remoteAvailableSources?this.remoteAvailableSources:G().availableEventSources}setRemoteAvailableSources(n){let r=n?new Set(n):null,o=this.remoteAvailableSources,s=o===null&&r===null||!!o&&!!r&&o.size===r.size&&[...r].every(i=>o.has(i));this.remoteAvailableSources=r,s||this.notifyListeners()}replaceEvents(n){this.activeSources=new Set(n.map(r=>r.source)),this.setItems(n)}async subscribeToAll(){let{sources:n}=G();for(let r of n)xn.has(r.id)||await this.subscribeToSource(r)}async subscribeToSource(n){let r=this.sourceUnsubscribers.get(n.id);if(r){r.refCount++;return}let o={unsubscribe:()=>{},refCount:1};this.sourceUnsubscribers.set(n.id,o);try{n.setup&&await n.setup();let s=await n.subscribe(i=>{this.addEvent(i)});s&&(o.unsubscribe=s)}catch{this.sourceUnsubscribers.get(n.id)===o&&o.refCount<=1&&this.sourceUnsubscribers.delete(n.id)}}unsubscribeFromSource(n){let r=this.sourceUnsubscribers.get(n);r&&(r.refCount--,r.refCount<=0&&(r.unsubscribe(),this.sourceUnsubscribers.delete(n)))}async subscribeToStorage(){let{sources:n}=G(),r=n.find(o=>o.id==="storage");r&&await this.subscribeToSource(r)}unsubscribeFromStorage(){this.unsubscribeFromSource("storage"),this.activeSources.delete("storage-async"),this.activeSources.delete("storage-mmkv")}subscribeToRedux(){let{sources:n}=G(),r=n.find(o=>o.id==="redux");r&&this.subscribeToSource(r)}unsubscribeFromRedux(){this.unsubscribeFromSource("redux"),this.activeSources.delete("redux")}subscribeToNetwork(){let{sources:n}=G(),r=n.find(o=>o.id==="network");r&&this.subscribeToSource(r)}unsubscribeFromNetwork(){this.unsubscribeFromSource("network"),this.activeSources.delete("network")}subscribeToReactQuery(){let{sources:n}=G(),r=n.find(o=>o.id==="react-query");r&&this.subscribeToSource(r)}unsubscribeFromReactQuery(){this.unsubscribeFromSource("react-query"),this.activeSources.delete("react-query"),this.activeSources.delete("react-query-query"),this.activeSources.delete("react-query-mutation")}subscribeToRoutes(){let{sources:n}=G(),r=n.find(o=>o.id==="route-events");r&&this.subscribeToSource(r)}unsubscribeFromRoutes(){this.unsubscribeFromSource("route-events"),this.activeSources.delete("route")}subscribeToZustand(){let{sources:n}=G(),r=n.find(o=>o.id==="zustand");r&&this.subscribeToSource(r)}unsubscribeFromZustand(){this.unsubscribeFromSource("zustand"),this.activeSources.delete("zustand")}subscribeToJotai(){let{sources:n}=G(),r=n.find(o=>o.id==="jotai");r&&this.subscribeToSource(r)}unsubscribeFromJotai(){this.unsubscribeFromSource("jotai"),this.activeSources.delete("jotai")}subscribeToRender(){let{sources:n}=G(),r=n.find(o=>o.id==="render");r&&this.subscribeToSource(r)}unsubscribeFromRender(){this.unsubscribeFromSource("render"),this.activeSources.delete("render")}addEvent(n){if(n.source==="network"){let r=n.originalEvent;if(r?.id){let o=this.networkEventIdMap.get(r.id);if(o){let s=this.items.findIndex(i=>i.id===o);if(s>=0){n.id=o,this.items=[...this.items.slice(0,s),n,...this.items.slice(s+1)],this.notifyListeners();return}}this.networkEventIdMap.set(r.id,n.id)}}this.push(n),this.activeSources.add(n.source),this.notifyListeners()}getEvents(n){return!n||n.size===0?this.items:this.items.filter(r=>n.has(r.source))}getActiveSources(){return Array.from(this.activeSources)}getSourceCounts(){let n={"storage-async":0,"storage-mmkv":0,redux:0,network:0,"react-query":0,"react-query-query":0,"react-query-mutation":0,route:0,zustand:0,jotai:0,render:0};for(let r of this.items)n[r.source]++;return n}clearEvents(){this.activeSources.clear(),this.networkEventIdMap.clear(),this.clear()}subscribe(n){let r=super.subscribe(n);return n(this.items),r}getEventCount(){return this.items.length}unsubscribeAll(){for(let[,n]of this.sourceUnsubscribers)n.unsubscribe();this.sourceUnsubscribers.clear(),this.activeSources.clear(),this.remoteDiscoveryIds.clear(),this.localDiscoveryIds.clear()}setLocalEnabledSources(n){let r=async()=>{let o=new Set;for(let u of n){let a=$t[u];a&&o.add(a)}let s=this.localDiscoveryIds;this.localDiscoveryIds=o;let{sources:i}=G();for(let u of o)if(!s.has(u)){let a=i.find(c=>c.id===u);a&&await this.subscribeToSource(a)}for(let u of s)o.has(u)||this.unsubscribeFromSource(u)};return this.localSyncChain=this.localSyncChain.then(r,r),this.localSyncChain}async setRemoteEnabledSources(n){let{sources:r}=G(),o;if(n==="all")o=new Set(r.map(i=>i.id).filter(i=>!xn.has(i)));else{o=new Set;for(let i of n){let u=$t[i];u&&o.add(u)}}let s=this.remoteDiscoveryIds;this.remoteDiscoveryIds=o;for(let i of o)if(!s.has(i)){let u=r.find(a=>a.id===i);u&&await this.subscribeToSource(u)}for(let i of s)o.has(i)||this.unsubscribeFromSource(i)}ensureRemoteSourcesDefault(){this.remoteDiscoveryIds.size===0&&this.setRemoteEnabledSources("all")}clearRemoteSources(){for(let n of this.remoteDiscoveryIds)this.unsubscribeFromSource(n);this.remoteDiscoveryIds.clear()}isSourceSubscribed(n){switch(n){case"storage-async":case"storage-mmkv":return this.sourceUnsubscribers.has("storage");case"redux":return this.sourceUnsubscribers.has("redux");case"network":return this.sourceUnsubscribers.has("network");case"react-query":case"react-query-query":case"react-query-mutation":return this.sourceUnsubscribers.has("react-query");case"route":return this.sourceUnsubscribers.has("route-events");case"zustand":return this.sourceUnsubscribers.has("zustand");case"jotai":return this.sourceUnsubscribers.has("jotai");case"render":return this.sourceUnsubscribers.has("render");default:return!1}}getSubscriptionStatus(){return{"storage-async":this.sourceUnsubscribers.has("storage"),"storage-mmkv":this.sourceUnsubscribers.has("storage"),redux:this.sourceUnsubscribers.has("redux"),network:this.sourceUnsubscribers.has("network"),"react-query":this.sourceUnsubscribers.has("react-query"),"react-query-query":this.sourceUnsubscribers.has("react-query"),"react-query-mutation":this.sourceUnsubscribers.has("react-query"),route:this.sourceUnsubscribers.has("route-events"),zustand:this.sourceUnsubscribers.has("zustand"),jotai:this.sourceUnsubscribers.has("jotai"),render:this.sourceUnsubscribers.has("render")}}getSubscriberCounts(){return Cn()}},J=new Ut;var kn=t=>J.getEvents(t);var Tn=()=>J.clearEvents(),Dn=t=>J.subscribe(t);var Pt=t=>J.setLocalEnabledSources(t);var Vt=()=>J.getAvailableEventSources();var qt=()=>J.getSubscriberCounts();import{persistentStorage as Ee,devToolsStorageKeys as qe}from"@buoy-gg/shared-ui/web";async function In(t){try{let e=qe.events.enabledSources();await Ee.setItem(e,JSON.stringify(t))}catch{}}async function Rn(){try{let t=qe.events.enabledSources(),e=await Ee.getItem(t);return e&&e!==""?JSON.parse(e):null}catch{return null}}async function An(t){try{let e=qe.events.isCapturing();await Ee.setItem(e,JSON.stringify(t))}catch{}}async function $n(){try{let t=qe.events.isCapturing(),e=await Ee.getItem(t);return e!==null&&e!==""?JSON.parse(e):null}catch{return null}}async function Nt(t){try{let e=qe.events.pausedAt();t===null?await Ee.removeItem(e):await Ee.setItem(e,JSON.stringify(t))}catch{}}async function Un(){try{let t=qe.events.pausedAt(),e=await Ee.getItem(t);if(e!==null&&e!==""){let n=JSON.parse(e);return typeof n=="number"?n:null}return null}catch{return null}}import{isDevToolsStorageKey as Pn,isUrlIgnored as Vo}from"@buoy-gg/shared-ui/web";var qo=["api.keygen.sh","buoy.gg/api/license"];function dt(t){let e=t.originalEvent;if(!e)return!1;if(t.source==="storage-async"||t.source==="storage-mmkv"){let n=e.data?.key||e.key;if(n&&Pn(n))return!0;let r=e.data?.keys||e.data?.pairs?.map(o=>o[0]);if(r&&r.length>0&&r.every(o=>Pn(o)))return!0}if(t.source==="network"){let n=e.host||"",r=e.url||"";for(let o of qo)if(n.includes(o)||r.includes(o))return!0}return!1}function pt(t,e){if(t.source!=="network"||e.length===0)return!1;let n=t.originalEvent?.url??"";return Vo(n,e)}function No(t,e){return dt(t)||pt(t,e)}function Lo(t,e){if(t.title.toLowerCase().includes(e)||t.subtitle.toLowerCase().includes(e))return!0;let n=t.originalEvent?.url;return typeof n=="string"&&n.toLowerCase().includes(e)}var qn=["storage-async","redux","network","react-query-query","react-query-mutation","route","zustand","jotai","render"],Vn=qn.filter(t=>t!=="render"),Mt={"storage-async":["storage-async","storage-mmkv"],"storage-mmkv":["storage-mmkv"],redux:["redux"],network:["network"],"react-query":["react-query","react-query-query"],"react-query-query":["react-query","react-query-query"],"react-query-mutation":["react-query-mutation"],route:["route"],zustand:["zustand"],jotai:["jotai"],render:["render"]};function Je(t){let{isPro:e}=Fo(),n=Bo("events.entries"),{patterns:r}=Oo(),[o,s]=we([]),[i,u]=we(()=>new Set(Vn)),[a,c]=we(!0),[l,d]=we(""),f=Ft(!1),b=t?.capturingOverride??a,v=Ft(null),m=Ft([]),[w,y]=we(0);Ce(()=>{b?v.current!==null&&(m.current=[...m.current,[v.current,Date.now()]],v.current=null,y(k=>k+1),Nt(null)):v.current===null&&(v.current=Date.now(),y(k=>k+1),Nt(v.current))},[b]);let g=xe(k=>{let z=v.current;if(z!==null&&k>z)return!0;for(let[N,te]of m.current)if(k>N&&k<=te)return!0;return!1},[]),[S,$]=we(()=>Vt()),[C,U]=we(0);Ce(()=>Mo(()=>{U(k=>k+1)}),[]);let T=ke(()=>qn.filter(k=>(Mt[k]||[k]).some(N=>S.has(N))),[S]);Ce(()=>{let k=null,z=Dn(()=>{k==null&&(k=requestAnimationFrame(()=>{k=null,N()}))}),N=()=>{let te=kn();s(te),$(me=>{let P=Vt();return me.size===P.size&&[...P].every(j=>me.has(j))?me:new Set(P)})};return()=>{z(),k!=null&&cancelAnimationFrame(k)}},[]),Ce(()=>{(async()=>{let z=await Rn(),N,te=T.filter(j=>Vn.includes(j));if(z&&z.length>0){let j=z.filter(be=>T.includes(be));j.length>0?N=new Set(j):N=new Set(te)}else N=new Set(te);u(N);let me=await $n(),P=me!==null?me:!0;if(!P&&v.current===null){let j=await Un();v.current=j??Date.now(),y(be=>be+1)}c(P),f.current=!0,Pt(P?Array.from(N):[])})()},[T]),Ce(()=>{f.current&&Pt(a?Array.from(i):[])},[i,a]),Ce(()=>{f.current&&In(Array.from(i))},[i]),Ce(()=>{f.current&&An(a)},[a]);let F=ke(()=>{let k=new Set;return i.forEach(z=>{let N=Mt[z];N&&N.forEach(te=>k.add(te))}),k},[i]),B=l.trim().toLowerCase(),ye=ke(()=>o.filter(k=>!g(k.timestamp)&&!dt(k)&&!pt(k,r)),[o,r,g,w]),X=ke(()=>F.size===0?[]:ye.filter(k=>F.has(k.source)&&(B===""||Lo(k,B))),[ye,F,B]),Se=ke(()=>X.slice(0,n),[X,n]),ee=ke(()=>Math.max(0,X.length-n),[X,n]),at=ke(()=>{let k=ye.reduce((P,j)=>(P[j.source]=(P[j.source]??0)+1,P),{}),z=qt(),N={};for(let P of z.sources)N[P.sourceId]=P.counts.total;let te={"storage-async":"storage","storage-mmkv":"storage",redux:"redux",network:"network","react-query":"react-query","react-query-query":"react-query","react-query-mutation":"react-query",route:"route-events",zustand:"zustand",jotai:"jotai",render:"render"};return T.map(P=>{let be=(Mt[P]||[P]).reduce((cr,lr)=>cr+(k[lr]||0),0),lt=wn(P),Q=te[P],Dt=Q&&Q in N?N[Q]:void 0;return{source:P,...lt,count:be,enabled:i.has(P),subscriberCount:Dt}}).sort((P,j)=>P.enabled&&!j.enabled?-1:!P.enabled&&j.enabled?1:0)},[ye,i,T,C]),xt=xe(k=>{u(z=>{let N=new Set(z);return N.has(k)?N.delete(k):N.add(k),N})},[]),ut=xe(()=>{u(new Set(T))},[T]),Ve=xe(()=>{Tn()},[]),We=xe(()=>{c(!0)},[]),kt=xe(()=>{c(!1)},[]),Tt=xe(()=>{c(k=>!k)},[]),ct=qt().totalSubscribers;return{events:o,filteredEvents:Se,availableSources:at,enabledSources:i,searchText:l,setSearchText:d,toggleSource:xt,enableAllSources:ut,clearEvents:Ve,totalCount:ye.length,filteredCount:Se.length,isCapturing:a,startCapturing:We,stopCapturing:kt,toggleCapturing:Tt,discoveredSources:S,hiddenEventsCount:ee,isPro:e,totalSubscriberCount:ct}}import{memo as _o}from"react";import{night as K}from"@buoy-gg/shared-ui/web";var h="buoy-events";function zo(t){return String(t??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"unknown"}function Nn(t){let e=t.originalEvent??{};switch(t.source){case"storage-async":case"storage-mmkv":{let n=e.data??{},r=n.key??(Array.isArray(n.keys)?n.keys.join("+"):void 0)??(Array.isArray(n.pairs)?n.pairs.map(o=>o[0]).join("+"):void 0);return`${t.title} ${r??""}`}case"network":{let n=String(e.url??""),r=n.split("?")[0]??n;return`${e.method??""} ${r}`}case"react-query":case"react-query-query":case"react-query-mutation":return`${t.title} ${e.type??""}`;default:return t.title}}function Ot(t){return`${h}-row-${t.source}-${zo(Nn(t))}`}function Bt(t){return`${h}-filter-${t}`}import{jsx as Te,jsxs as Lt}from"react/jsx-runtime";var Ke=_o(function({availableSources:e,onToggleSource:n,totalCount:r,filteredCount:o}){return e.length===0?null:Lt(p,{style:ue.container,testID:`${h}-filter-bar`,children:[Te(Y,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:ue.badgesRow,testID:`${h}-filter-scroll`,children:e.map(s=>{let i=s.enabled!==!1,u=s.subscriberCount,a=u!==void 0,c=s.count||0,l=Bt(s.source);return Lt(ae,{testID:l,accessibilityRole:"button",accessibilityLabel:`${s.label} filter, ${i?"on":"off"}, ${c} event${c===1?"":"s"}`,style:[ue.badge,i?{backgroundColor:K.color.surface,borderColor:s.color+"50"}:ue.badgeDisabled],onPress:()=>n(s.source),activeOpacity:.7,children:[a&&Te(p,{style:[ue.countBadge,{backgroundColor:i?u>0?s.color+"25":K.color.fillSecondary:K.color.fill}],children:Te(E,{style:[ue.countText,{color:i?u>0?s.color:K.color.textTertiary:K.color.textTertiary}],testID:`${l}-subscribers`,children:u})}),Te(p,{style:[ue.dot,{backgroundColor:i?s.color:K.color.fillTertiary}]}),Te(E,{style:[ue.badgeLabel,{color:i?K.color.text:K.color.textTertiary}],numberOfLines:1,testID:`${l}-label`,children:s.label}),Te(p,{style:[ue.countBadge,{backgroundColor:i?c>0?s.color+"20":K.color.fill:K.color.fill}],children:Te(E,{style:[ue.countText,{color:i?c>0?s.color:K.color.textTertiary:K.color.textTertiary}],testID:`${l}-count`,children:c})})]},s.source)})}),o<r&&Lt(E,{style:ue.filterInfo,testID:`${h}-showing`,children:["Showing ",o," of ",r]})]})}),ue=H.create({container:{paddingVertical:8,backgroundColor:"transparent",borderBottomWidth:1,borderBottomColor:K.color.border},badgesRow:{flexDirection:"row",gap:8,paddingHorizontal:12},badge:{flexDirection:"row",alignItems:"center",paddingVertical:5,paddingHorizontal:6,borderRadius:20,borderWidth:1,gap:6,flexShrink:0},badgeDisabled:{backgroundColor:K.color.surface,borderColor:K.color.border,opacity:.5},dot:{width:7,height:7,borderRadius:4},badgeLabel:{fontSize:12,fontWeight:"500"},countBadge:{minWidth:18,height:18,borderRadius:9,alignItems:"center",justifyContent:"center",paddingHorizontal:5},countText:{fontSize:10,fontWeight:"600",fontVariant:["tabular-nums"]},filterInfo:{marginTop:6,fontSize:11,color:K.color.textTertiary,textAlign:"center"}});import{memo as oi,useCallback as Kt,useMemo as ii}from"react";import{night as mt,Zap as si,ProBadge as ai,ToolEmptyState as ui,resolveListEmptyState as ci}from"@buoy-gg/shared-ui/web";import{loadToolModule as Ne,getToolModuleVersion as Fn}from"@buoy-gg/shared-ui/web/utils";import{memo as jo}from"react";import{CompactRow as Ho,formatRelativeTime as Wo,Pill as Jo}from"@buoy-gg/shared-ui/web";import{jsx as W,jsxs as ei}from"react/jsx-runtime";function Ko(){let t={StorageEventCard:null,getValueType:null,ReduxActionItem:null,NetworkEventItemCompact:null,RouteEventItemCompact:null,ZustandStateChangeItem:null,JotaiAtomChangeItem:null};try{let e=Ne("@buoy-gg/storage");t.StorageEventCard=e.StorageEventCard,t.getValueType=e.getValueType}catch{}try{let e=Ne("@buoy-gg/redux");t.ReduxActionItem=e.ReduxActionItem}catch{}try{let e=Ne("@buoy-gg/network");t.NetworkEventItemCompact=e.NetworkEventItemCompact}catch{}try{let e=Ne("@buoy-gg/route-events");t.RouteEventItemCompact=e.RouteEventItemCompact}catch{}try{let e=Ne("@buoy-gg/zustand");t.ZustandStateChangeItem=e.ZustandStateChangeItem}catch{}try{let e=Ne("@buoy-gg/jotai");t.JotaiAtomChangeItem=e.JotaiAtomChangeItem}catch{}return t}var zt,Mn=-1;function Qo(){return(!zt||Mn!==Fn())&&(zt=Ko(),Mn=Fn()),zt}var On={"storage-async":{label:"Storage",color:"#8B5CF6"},"storage-mmkv":{label:"MMKV",color:"#F59E0B"},redux:{label:"Redux",color:"#3B82F6"},network:{label:"Network",color:"#10B981"},"react-query":{label:"Query",color:"#EC4899"},"react-query-query":{label:"Query",color:"#EC4899"},"react-query-mutation":{label:"Mutation",color:"#F97316"},route:{label:"Route",color:"#06B6D4"},zustand:{label:"Zustand",color:"#764ABC"},jotai:{label:"Jotai",color:"#14B8A6"},render:{label:"Render",color:"#F472B6"}};function Go(t){switch(t){case"success":return"#10B981";case"error":return"#EF4444";case"pending":return"#F59E0B";case"neutral":default:return"#6B7280"}}function Zo(t){return t==="storage-async"||t==="storage-mmkv"}function Yo({label:t,color:e,testID:n}){return W(Jo,{label:t,color:e,variant:"soft",size:"sm",style:{marginLeft:6},testID:n})}var Xo={"storage-async":"STORAGE","storage-mmkv":"MMKV",redux:"REDUX",network:"NET","react-query":"QUERY","react-query-query":"QUERY","react-query-mutation":"MUTATION",route:"ROUTE",zustand:"ZUSTAND",jotai:"JOTAI",render:"RENDER"};function Qe({source:t,testID:e,children:n}){let r=On[t].color,o=Xo[t];return ei(p,{style:_t.badgeWrapper,testID:e,children:[n,W(p,{style:[_t.sourceBadge,{backgroundColor:`${r}20`}],children:W(E,{style:[_t.sourceBadgeText,{color:r}],testID:e?`${e}-badge`:void 0,children:o})})]})}var jt=jo(function({event:e,onPress:n,isSelected:r=!1,isExpanded:o=!1,onNavigate:s,correlationCount:i=1,correlationLabel:u,correlationColor:a}){let{StorageEventCard:c,getValueType:l,ReduxActionItem:d,NetworkEventItemCompact:f,RouteEventItemCompact:b,ZustandStateChangeItem:v,JotaiAtomChangeItem:m}=Qo(),w=On[e.source],y=Go(e.status),g=Ot(e);if(Zo(e.source)&&c&&l){let $=e.originalEvent,C={key:$.data?.key||"unknown",lastAction:$.action,totalOperations:1,lastEventTimestamp:new Date(e.timestamp),storageTypes:new Set([$.storageType||"async"]),valueType:$.data?.value!==void 0?l($.data.value):void 0};return W(Qe,{source:e.source,testID:g,children:W(c,{data:C,onPress:n,isSelected:r})})}if(e.source==="redux"&&d){let $=e.originalEvent;return W(Qe,{source:e.source,testID:g,children:W(d,{action:$,onPress:()=>n()})})}if(e.source==="network"&&f){let $=e.originalEvent;return W(p,{testID:g,children:W(f,{event:$,onPress:()=>n()})})}if(e.source==="route"&&b){let $=e.originalEvent;return W(Qe,{source:e.source,testID:g,children:W(b,{event:$,visitNumber:0,isExpanded:o,onPress:()=>n(),onNavigate:s})})}if(e.source==="zustand"&&v)return W(Qe,{source:e.source,testID:g,children:W(v,{change:e.originalEvent,onPress:()=>n()})});if(e.source==="jotai"&&m)return W(Qe,{source:e.source,testID:g,children:W(m,{change:e.originalEvent,onPress:()=>n()})});let S=u&&a?W(Yo,{label:u,color:a,testID:`${g}-correlation`}):null;return W(Ho,{statusDotColor:w.color,statusLabel:w.label,primaryText:e.title,secondaryText:e.subtitle,badgeText:i>1&&!u?`${i}`:"",badgeColor:a||y,customBadge:S,bottomRightText:Wo(new Date(e.timestamp)),showChevron:!0,isSelected:r,onPress:n,testID:g})}),_t=H.create({badgeWrapper:{position:"relative"},sourceBadge:{position:"absolute",top:4,right:12,paddingHorizontal:6,paddingVertical:2,borderRadius:4,zIndex:10},sourceBadgeText:{fontSize:8,fontWeight:"700",letterSpacing:.5}});function ti(t,e){return t.correlationId?e.filter(n=>n.correlationId===t.correlationId&&n.id!==t.id).sort((n,r)=>n.timestamp-r.timestamp):[]}function ni(t,e){return t.correlationId?e.some(n=>n.correlationId===t.correlationId&&n.id!==t.id):!1}function ri(t,e){return t.correlationId?e.filter(n=>n.correlationId===t.correlationId).length:1}function Ht(t){let e=new Map;for(let n of t)if(n.correlationId){let r=e.get(n.correlationId)||0;e.set(n.correlationId,r+1)}return e}function Ln(t,e){return e.filter(n=>n.correlationId===t).sort((n,r)=>{let o=n.sequenceInGroup??0,s=r.sequenceInGroup??0;return o!==s?o-s:n.timestamp-r.timestamp})}function Wt(t,e){if(!t.correlationId)return null;let n=Ln(t.correlationId,e);if(n.length<=1)return null;let r=n.findIndex(o=>o.id===t.id);return r===-1?null:`${r+1}/${n.length}`}var Bn=["#EC4899","#8B5CF6","#3B82F6","#10B981","#F59E0B","#EF4444","#06B6D4","#84CC16"];function Jt(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;let n=Math.abs(e)%Bn.length;return Bn[n]}import{jsx as Fe,jsxs as Qt}from"react/jsx-runtime";var Ge=oi(function({events:e,selectedEventId:n,expandedEventId:r,onEventPress:o,onNavigate:s,isCapturing:i,hiddenEventsCount:u=0,onUpgradePress:a,searchText:c="",totalCount:l=0,sourceCount:d,enabledSourceCount:f}){let b=ii(()=>Ht(e),[e]),v=Kt(({item:y})=>{let g=y.correlationId&&b.get(y.correlationId)||1,S=Wt(y,e),$=y.correlationId?Jt(y.correlationId):void 0;return Fe(jt,{event:y,isSelected:y.id===n,isExpanded:y.id===r,onPress:()=>o(y),onNavigate:s,correlationCount:g,correlationLabel:S,correlationColor:$})},[n,r,o,s,b,e]),m=Kt(y=>y.id,[]),w=Kt(()=>u<=0?null:Qt(ae,{style:De.hiddenBanner,onPress:a,activeOpacity:.8,testID:`${h}-hidden-banner`,accessibilityRole:"button",accessibilityLabel:`${u} hidden event${u!==1?"s":""}, upgrade for the full history`,children:[Qt(p,{style:De.hiddenBannerLeft,children:[Fe(si,{size:16,color:mt.color.accent}),Qt(E,{style:De.hiddenBannerText,testID:`${h}-hidden-count`,children:[u," hidden event",u!==1?"s":""]})]}),Fe(ai,{})]}),[u,a]);if(e.length===0){let y=d===0,g=f===0,S=y?{otto:"scanning",title:"No Event Sources",message:`This tool reports on the other Buoy tools.
3
- Install one \u2014 network, storage, redux, routes \u2014 and its events land here.`}:g&&!c.trim()&&l>0?{otto:"filtering",title:"Every Source Is Off",message:`${l} event${l===1?" is":"s are"} captured. Turn a source chip back on to see them.`}:ci({subject:"events",search:c,total:l,capturing:i,blocked:g?"Every source chip is off, so there is nothing to search. Turn one back on.":void 0,waiting:{otto:"listening",title:"No Events Yet",message:`Events will appear here as they occur.
4
- Try interacting with your app.`},paused:{title:"Not Capturing",message:"Event capture is paused. Resume to see events."}});return Fe(ui,{...S,testID:`${h}-empty`,style:De.emptyContainer})}return Fe(Rt,{data:e,renderItem:v,keyExtractor:m,testID:`${h}-list`,style:De.list,contentContainerStyle:De.listContent,ItemSeparatorComponent:()=>Fe(p,{style:De.separator}),ListFooterComponent:w,showsVerticalScrollIndicator:!0,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,removeClippedSubviews:!(typeof process<"u"&&process.env?.EXPO_PUBLIC_E2E)})}),De=H.create({list:{flex:1,backgroundColor:"transparent"},listContent:{paddingVertical:16},separator:{height:8},emptyContainer:{flex:1,justifyContent:"center",backgroundColor:"transparent"},hiddenBanner:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginHorizontal:16,marginTop:8,marginBottom:16,paddingVertical:12,paddingHorizontal:16,backgroundColor:mt.color.surface,borderRadius:8,borderWidth:1,borderColor:mt.color.border},hiddenBannerLeft:{flexDirection:"row",alignItems:"center",gap:8},hiddenBannerText:{fontSize:13,fontWeight:"500",color:mt.color.text}});import{loadToolModule as Ie,getToolModuleVersion as Yt}from"@buoy-gg/shared-ui/web/utils";import{memo as gi,useMemo as zn}from"react";import{night as fe,formatRelativeTime as yi,copyToClipboard as bi,parseValue as hi,useIgnoredPatterns as vi,monoFont as Si}from"@buoy-gg/shared-ui/web";import{DataViewer as Ei}from"@buoy-gg/shared-ui/web/dataViewer";import{memo as li,useMemo as di}from"react";import{buoyColors as ce,night as _,displayValue as pi,monoFont as Me}from"@buoy-gg/shared-ui/web";import{DataViewer as ft}from"@buoy-gg/shared-ui/web/dataViewer";import{jsx as R,jsxs as Z}from"react/jsx-runtime";var mi={"query-fetch-start":{label:"Query Fetching",color:_.color.accent,icon:"hourglass"},"query-fetch-success":{label:"Query Success",color:ce.success,icon:"checkmark"},"query-fetch-error":{label:"Query Error",color:ce.error,icon:"close"},"query-invalidated":{label:"Query Invalidated",color:ce.warning,icon:"refresh"},"mutation-start":{label:"Mutation Started",color:_.color.accent,icon:"hourglass"},"mutation-success":{label:"Mutation Success",color:ce.success,icon:"checkmark"},"mutation-error":{label:"Mutation Error",color:ce.error,icon:"close"}},Gt=li(function({event:e}){let n=e.originalEvent,r=mi[n.type]||{label:n.type,color:_.color.textTertiary,icon:"help"},o=n.type.startsWith("query-"),s=n.type.startsWith("mutation-"),i=di(()=>{let f=o?n.queryKey:n.mutationKey;return f?pi(f,!0):s&&n.mutationId!==void 0?`Mutation #${n.mutationId}`:"No key"},[n,o,s]),a=new Date(n.timestamp).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}),c=o?!!n.queryData:!!n.mutationData,l=o?!!n.queryError:!!n.mutationError,d=s&&!!n.mutationVariables;return Z(Y,{style:x.container,contentContainerStyle:x.contentContainer,children:[R(p,{style:x.section,children:Z(p,{style:[x.eventTypeContainer,{borderColor:r.color+"4D"}],children:[R(E,{style:[x.eventTypeHeader,{backgroundColor:r.color+"15",color:r.color}],children:r.label}),Z(p,{style:x.eventTypeContent,children:[Z(p,{style:x.keyRow,children:[R(Y,{horizontal:!0,style:x.keyScrollView,children:R(E,{style:x.keyText,children:i})}),R(fi,{type:n.type,color:r.color})]}),n.duration!==void 0&&Z(p,{style:x.row,children:[R(E,{style:x.labelText,children:"Duration:"}),Z(E,{style:x.valueText,children:[n.duration.toFixed(0),"ms"]})]}),Z(p,{style:x.row,children:[R(E,{style:x.labelText,children:"Timestamp:"}),R(E,{style:x.valueText,children:a})]}),o&&n.queryHash&&Z(p,{style:x.row,children:[R(E,{style:x.labelText,children:"Query Hash:"}),R(E,{style:[x.valueText,x.hashText],numberOfLines:1,children:n.queryHash})]}),s&&n.mutationId!==void 0&&Z(p,{style:x.row,children:[R(E,{style:x.labelText,children:"Mutation ID:"}),Z(E,{style:x.valueText,children:["#",n.mutationId]})]})]})]})}),d&&R(p,{style:x.section,children:Z(p,{style:x.dataContainer,children:[R(E,{style:[x.dataHeader,{color:ce.warning}],children:"Variables"}),R(p,{style:x.dataContent,children:R(ft,{title:"",data:n.mutationVariables,showTypeFilter:!0,rawMode:!0,initialExpanded:!0})})]})}),c&&R(p,{style:x.section,children:Z(p,{style:x.dataContainer,children:[R(E,{style:[x.dataHeader,{color:ce.success}],children:o?"Query Data":"Mutation Result"}),R(p,{style:x.dataContent,children:R(ft,{title:"",data:o?n.queryData:n.mutationData,showTypeFilter:!0,rawMode:!0,initialExpanded:!0})})]})}),l&&R(p,{style:x.section,children:Z(p,{style:[x.dataContainer,x.errorContainer],children:[R(E,{style:[x.dataHeader,x.errorHeader],children:"Error"}),R(p,{style:x.dataContent,children:R(ft,{title:"",data:o?n.queryError:n.mutationError,showTypeFilter:!0,rawMode:!0,initialExpanded:!0})})]})}),R(p,{style:x.section,children:Z(p,{style:x.dataContainer,children:[R(E,{style:x.dataHeader,children:"Event Details"}),R(p,{style:x.dataContent,children:R(ft,{title:"",data:n,showTypeFilter:!0,rawMode:!0,initialExpanded:!1})})]})})]})});function fi({type:t,color:e}){let n=()=>t.includes("start")?"PENDING":t.includes("success")?"SUCCESS":t.includes("error")?"ERROR":t.includes("invalidated")?"INVALIDATED":t.toUpperCase();return R(p,{style:[x.statusChip,{backgroundColor:e+"15",borderColor:e+"33"}],children:R(E,{style:[x.statusChipText,{color:e}],children:n()})})}var x=H.create({container:{flex:1,backgroundColor:"transparent"},contentContainer:{padding:8,paddingBottom:24},section:{marginBottom:12},eventTypeContainer:{minWidth:200,backgroundColor:_.color.surface,borderRadius:6,borderWidth:1,overflow:"hidden",shadowColor:_.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},eventTypeHeader:{paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,borderBottomWidth:1,borderBottomColor:_.color.accentBorder,letterSpacing:.5,textTransform:"uppercase",fontFamily:Me},eventTypeContent:{padding:0},keyRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:_.color.separator},keyScrollView:{flex:1,marginRight:8},keyText:{fontSize:12,color:_.color.text,fontFamily:Me,lineHeight:18,backgroundColor:_.color.accentSoft,paddingHorizontal:8,paddingVertical:4,borderRadius:4,borderWidth:1,borderColor:_.color.accentBorderStrong},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:_.color.separator},labelText:{fontSize:10,color:_.color.textSecondary,fontWeight:"600",letterSpacing:.5,textTransform:"uppercase",fontFamily:Me},valueText:{fontSize:12,color:_.color.text,fontWeight:"500",fontVariant:["tabular-nums"],fontFamily:Me},hashText:{flex:1,textAlign:"right",marginLeft:8},statusChip:{paddingHorizontal:8,paddingVertical:4,borderWidth:1,borderRadius:6,alignSelf:"flex-start"},statusChipText:{fontSize:11,fontWeight:"600",textTransform:"uppercase",letterSpacing:.5,fontFamily:Me},dataContainer:{minWidth:200,backgroundColor:_.color.surface,borderRadius:6,borderWidth:1,borderColor:_.color.accentBorderStrong,overflow:"hidden",shadowColor:_.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},dataHeader:{backgroundColor:_.color.accentSoft,paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,color:_.color.accent,borderBottomWidth:1,borderBottomColor:_.color.accentBorder,letterSpacing:.5,textTransform:"uppercase",fontFamily:Me},dataContent:{padding:8},errorContainer:{borderColor:ce.error+"4D"},errorHeader:{backgroundColor:ce.error+"1A",color:ce.error,borderBottomColor:ce.error+"33"}});import{Fragment as Ii,jsx as D,jsxs as Ze}from"react/jsx-runtime";function wi(){let t={StorageEventDetailContent:null,ReduxActionDetailContent:null,NetworkEventDetailView:null,RenderDetailView:null,ZustandStateDetailContent:null,JotaiAtomDetailContent:null,RouteEventDetail:null};try{let e=Ie("@buoy-gg/storage");t.StorageEventDetailContent=e.StorageEventDetailContent}catch{}try{let e=Ie("@buoy-gg/redux");t.ReduxActionDetailContent=e.ReduxActionDetailContent}catch{}try{let e=Ie("@buoy-gg/network");t.NetworkEventDetailView=e.NetworkEventDetailView}catch{}try{let e=Ie("@buoy-gg/highlight-updates");t.RenderDetailView=e.RenderDetailView}catch{}try{let e=Ie("@buoy-gg/zustand");t.ZustandStateDetailContent=e.ZustandStateDetailContent}catch{}try{let e=Ie("@buoy-gg/jotai");t.JotaiAtomDetailContent=e.JotaiAtomDetailContent}catch{}try{let e=Ie("@buoy-gg/route-events");t.RouteEventDetail=e.RouteEventDetail}catch{}return t}var Zt,_n=-1;function Ci(){return(!Zt||_n!==Yt())&&(Zt=wi(),_n=Yt()),Zt}var xi={"storage-async":{label:"AsyncStorage",color:"#8B5CF6"},"storage-mmkv":{label:"MMKV",color:"#F59E0B"},redux:{label:"Redux",color:"#3B82F6"},network:{label:"Network",color:"#10B981"},"react-query":{label:"React Query",color:"#EC4899"},"react-query-query":{label:"Query",color:"#EC4899"},"react-query-mutation":{label:"Mutation",color:"#F97316"},route:{label:"Route",color:"#06B6D4"},zustand:{label:"Zustand",color:"#764ABC"},jotai:{label:"Jotai",color:"#14B8A6"},render:{label:"Render",color:"#F472B6"}};function ki(t){return t==="storage-async"||t==="storage-mmkv"}function Ti(t){let e=hi(t);return e===null?"null":e===void 0?"undefined":Array.isArray(e)?"array":typeof e=="boolean"?"boolean":typeof e=="number"?"number":typeof e=="string"?"string":typeof e=="object"?"object":"undefined"}function Di({children:t}){return D(Ii,{children:t})}var Ye=gi(function({event:e,onBack:n,NetworkEventDetailViewComponent:r,networkDetailWrapper:o,RouteEventDetailComponent:s,detailComponents:i,onNavigate:u}){let a=zn(()=>({...Ci(),...i}),[i,Yt()]),c=xi[e.source],l=new Date(e.timestamp),{values:d,toggle:f}=vi(),b=zn(()=>{if(!ki(e.source)||!a.StorageEventDetailContent)return null;let g=e.originalEvent,S={...g,timestamp:new Date(g.timestamp)};return{key:S.data?.key||"unknown",lastEvent:S,events:[S],totalOperations:1,currentValue:S.data?.value,valueType:Ti(S.data?.value),storageTypes:new Set([S.storageType||"async"])}},[e,a]);if(b&&a.StorageEventDetailContent){let{StorageEventDetailContent:g}=a;return D(p,{style:q.container,testID:`${h}-detail-storage`,children:D(g,{conversation:b,selectedEventIndex:0,onEventIndexChange:()=>{},disableInternalFooter:!0})})}if(e.source==="redux"&&a.ReduxActionDetailContent){let{ReduxActionDetailContent:g}=a,S=e.originalEvent;return D(p,{style:q.container,testID:`${h}-detail-redux`,children:D(g,{action:S,actions:[S],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:!0})})}let v=r??a.NetworkEventDetailView;if(e.source==="network"&&v){let g=e.originalEvent,S=o??Di;return D(p,{style:q.container,children:D(S,{children:D(Y,{style:q.content,testID:`${h}-detail-network`,children:D(v,{event:g,ignoredPatterns:d,onTogglePattern:f})})})})}if(e.source==="react-query"||e.source==="react-query-query"||e.source==="react-query-mutation")return D(p,{style:q.container,testID:`${h}-detail-react-query`,children:D(Gt,{event:e})});if(e.source==="zustand"&&a.ZustandStateDetailContent){let{ZustandStateDetailContent:g}=a,S=e.originalEvent;return D(p,{style:q.container,testID:`${h}-detail-zustand`,children:D(g,{change:S,changes:[S],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:!0})})}if(e.source==="jotai"&&a.JotaiAtomDetailContent){let{JotaiAtomDetailContent:g}=a,S=e.originalEvent;return D(p,{style:q.container,testID:`${h}-detail-jotai`,children:D(g,{change:S,changes:[S],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:!0})})}if(e.source==="render"&&a.RenderDetailView){let{RenderDetailView:g}=a,S=e.originalEvent;return D(p,{style:q.container,children:D(Y,{style:q.content,testID:`${h}-detail-render`,children:D(g,{render:S.render})})})}let m=s??a.RouteEventDetail;if(e.source==="route"&&m)return D(p,{style:q.container,children:D(p,{style:q.container,testID:`${h}-detail-route`,children:D(m,{event:e.originalEvent,onNavigate:u})})});let w=()=>e.originalEvent,y=async()=>{await bi({source:e.source,timestamp:l.toISOString(),title:e.title,subtitle:e.subtitle,data:w()})};return D(p,{style:q.container,testID:`${h}-detail`,children:Ze(Y,{style:q.content,contentContainerStyle:q.contentContainer,testID:`${h}-detail-scroll`,children:[D(p,{style:q.sourceBadgeRow,children:Ze(p,{style:[q.sourceBadge,{backgroundColor:c.color+"20"}],children:[D(p,{style:[q.sourceDot,{backgroundColor:c.color}]}),D(E,{style:[q.sourceLabel,{color:c.color}],testID:`${h}-detail-source`,children:c.label})]})}),D(E,{style:q.title,testID:`${h}-detail-title`,children:e.title}),D(E,{style:q.subtitle,testID:`${h}-detail-subtitle`,children:e.subtitle}),Ze(p,{style:q.timestampRow,children:[D(E,{style:q.timestampLabel,children:"Timestamp"}),Ze(E,{style:q.timestampValue,testID:`${h}-detail-timestamp`,children:[l.toLocaleTimeString()," (",yi(l),")"]})]}),Ze(p,{style:q.dataSection,children:[D(E,{style:q.sectionLabel,children:"Event Data"}),D(p,{style:q.dataContainer,testID:`${h}-detail-data`,children:D(Ei,{testIDPrefix:`${h}-detail-data`,data:w(),title:"",showTypeFilter:!0,rawMode:!0,initialExpanded:!0})})]})]})})}),q=H.create({container:{flex:1,backgroundColor:"transparent"},content:{flex:1},contentContainer:{padding:16},sourceBadgeRow:{flexDirection:"row",marginBottom:12},sourceBadge:{flexDirection:"row",alignItems:"center",paddingHorizontal:10,paddingVertical:6,borderRadius:12,gap:6},sourceDot:{width:6,height:6,borderRadius:3},sourceLabel:{fontSize:12,fontWeight:"600"},title:{fontSize:24,fontWeight:"700",color:fe.color.text,marginBottom:4},subtitle:{fontSize:16,color:fe.color.textTertiary,marginBottom:16},timestampRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,borderTopWidth:1,borderTopColor:fe.color.border,borderBottomWidth:1,borderBottomColor:fe.color.border,marginBottom:16},timestampLabel:{fontSize:14,color:fe.color.textTertiary},timestampValue:{fontSize:14,color:fe.color.text,fontFamily:Si},dataSection:{marginTop:8},sectionLabel:{fontSize:12,fontWeight:"600",color:fe.color.textTertiary,textTransform:"uppercase",letterSpacing:.5,marginBottom:8},dataContainer:{backgroundColor:fe.color.surface,borderRadius:8,borderWidth:1,borderColor:fe.color.border,overflow:"hidden"}});import{useCallback as Le,useEffect as Gi,useMemo as ht,useState as pn}from"react";import{DynamicFilterView as Zn,macOSColors as rt,night as ot,FileText as Yn,FileCode as Xn,Hash as Zi,Zap as Yi,AlertTriangle as Xi,Settings as es,Eye as ts,XCircle as er,GitBranch as tr,ToolbarCopyButton as ns,useFeatureGate as rs,ProFeatureBanner as os,ExportPreview as is,monoFont as ss}from"@buoy-gg/shared-ui/web";import{DataViewer as as}from"@buoy-gg/shared-ui/web/dataViewer";var ve={timestampFormat:"relative",includeSource:!0,includeStatus:!0,includeTitle:!0,includeSubtitle:!0,includeCorrelation:!0,includeDuration:!0,includeSummaryHeader:!0,includeTotalDuration:!0,includeEventData:!1,dataSizeThreshold:5,format:"markdown",filterMode:"all",filterSources:[],compactMode:!1,smartJsonParsing:!0,reduxChangedOnly:!0,showStorageDiff:!0,stripVerboseFields:!0},Re={llm:{timestampFormat:"relative",includeSource:!0,includeStatus:!0,includeTitle:!0,includeSubtitle:!0,includeCorrelation:!0,includeDuration:!0,includeSummaryHeader:!0,includeTotalDuration:!0,includeEventData:!1,dataSizeThreshold:5,format:"markdown",filterMode:"all",filterSources:[],compactMode:!1,smartJsonParsing:!0,reduxChangedOnly:!0,showStorageDiff:!0,stripVerboseFields:!0},bugReport:{timestampFormat:"both",includeSource:!0,includeStatus:!0,includeTitle:!0,includeSubtitle:!0,includeCorrelation:!0,includeDuration:!0,includeSummaryHeader:!0,includeTotalDuration:!0,includeEventData:!0,dataSizeThreshold:10,format:"markdown",filterMode:"all",filterSources:[],compactMode:!1,smartJsonParsing:!0,reduxChangedOnly:!0,showStorageDiff:!0,stripVerboseFields:!0},json:{timestampFormat:"absolute",includeSource:!0,includeStatus:!0,includeTitle:!0,includeSubtitle:!0,includeCorrelation:!0,includeDuration:!0,includeSummaryHeader:!1,includeTotalDuration:!1,includeEventData:!0,dataSizeThreshold:-1,format:"json",filterMode:"all",filterSources:[],compactMode:!1,smartJsonParsing:!0,reduxChangedOnly:!1,showStorageDiff:!1,stripVerboseFields:!1},errors:{timestampFormat:"relative",includeSource:!0,includeStatus:!0,includeTitle:!0,includeSubtitle:!0,includeCorrelation:!0,includeDuration:!0,includeSummaryHeader:!0,includeTotalDuration:!1,includeEventData:!0,dataSizeThreshold:10,format:"markdown",filterMode:"errors",filterSources:[],compactMode:!1,smartJsonParsing:!0,reduxChangedOnly:!0,showStorageDiff:!0,stripVerboseFields:!0},minimal:{timestampFormat:"relative",includeSource:!1,includeStatus:!0,includeTitle:!0,includeSubtitle:!1,includeCorrelation:!1,includeDuration:!1,includeSummaryHeader:!1,includeTotalDuration:!1,includeEventData:!1,dataSizeThreshold:1,format:"plaintext",filterMode:"all",filterSources:[],compactMode:!0,smartJsonParsing:!0,reduxChangedOnly:!0,showStorageDiff:!1,stripVerboseFields:!0},mermaid:{timestampFormat:"relative",includeSource:!0,includeStatus:!0,includeTitle:!0,includeSubtitle:!1,includeCorrelation:!0,includeDuration:!0,includeSummaryHeader:!1,includeTotalDuration:!1,includeEventData:!1,dataSizeThreshold:1,format:"mermaid",filterMode:"all",filterSources:[],compactMode:!1,smartJsonParsing:!0,reduxChangedOnly:!0,showStorageDiff:!0,stripVerboseFields:!0}};function Xt(t){for(let[e,n]of Object.entries(Re))if(Object.keys(n).every(o=>{let s=t[o],i=n[o];return Array.isArray(s)&&Array.isArray(i)?s.length===i.length&&s.every((u,a)=>u===i[a]):s===i}))return e;return null}var L={llm:{label:"LLM",description:"AI-ready format",color:"#10B981"},bugReport:{label:"Bug Report",description:"Full context",color:"#EF4444"},json:{label:"JSON",description:"Machine-readable",color:"#F59E0B"},errors:{label:"Errors",description:"Failed only",color:"#EF4444"},minimal:{label:"Minimal",description:"Quick reference",color:"#6B7280"},mermaid:{label:"Diagram",description:"Visual flow",color:"#A855F7"}};var Oe={success:"\u2705",pending:"\u23F3",error:"\u274C",neutral:"\u2796"},Ri={success:"[OK]",pending:"[...]",error:"[ERR]",neutral:"[-]"},on={"storage-async":"Storage","storage-mmkv":"MMKV",redux:"Redux",network:"Network","react-query":"Query","react-query-query":"Query","react-query-mutation":"Mutation",route:"Route",zustand:"Zustand",jotai:"Jotai",render:"Render"};function $e(t){if(typeof t!="string")return t;let e=t.trim();if(!e.startsWith("{")&&!e.startsWith("["))return t;try{return JSON.parse(t)}catch{return t}}function Ue(t){if(t==null)return t;if(typeof t=="string")return $e(t);if(Array.isArray(t))return t.map(Ue);if(typeof t=="object"){let e={};for(let[n,r]of Object.entries(t))e[n]=Ue(r);return e}return t}var Ai=new Set(["image","imageUrl","imageURL","image_url","thumbnail","thumbnailUrl","thumbnail_url","icon","iconUrl","avatar","avatarUrl","photo","photoUrl","picture","pictureUrl","description","desc","longDescription","shortDescription","meta_description"]);function tn(t){if(t==null)return t;if(Array.isArray(t))return t.map(tn);if(typeof t=="object"){let e={};for(let[n,r]of Object.entries(t))Ai.has(n)||typeof r=="string"&&$i(r)||(e[n]=tn(r));return e}return t}function $i(t){if(!t.startsWith("http"))return!1;let e=t.toLowerCase();return e.includes("/photo")||e.includes("/image")||e.includes("unsplash.com")||e.includes("cloudinary.com")||e.includes("imgur.com")||/\.(jpg|jpeg|png|gif|webp|svg|bmp)(\?|$)/i.test(t)}function Ui(t){if(t instanceof Date)return t.toISOString();if(!(t&&typeof t=="object"&&Object.keys(t).length===0))return t}function Pi(t,e){let n=a=>{if(typeof a!="object"||a===null)return null;let c=a;return typeof c.id=="string"?c.id:typeof c.orderId=="string"?c.orderId:typeof c.key=="string"?c.key:null},r=new Set(t.map(n).filter(Boolean)),o=new Set(e.map(n).filter(Boolean));if(r.size===0&&o.size===0)return null;let s=e.filter(a=>{let c=n(a);return c&&!r.has(c)}),i=t.filter(a=>{let c=n(a);return c&&!o.has(c)}),u=e.length-s.length;return s.length+i.length<t.length&&s.length+i.length<e.length?{added:s,removed:i,unchanged:u}:null}function Vi(t,e){let n={};if(t.action&&(n.action=t.action),t.storageType&&(n.storageType=t.storageType),t.timestamp!==void 0){let r=Ui(t.timestamp);r!==void 0&&(n.timestamp=r)}if(t.data){let r={...t.data};if(e.smartJsonParsing&&(r.value!==void 0&&(r.value=$e(r.value)),r.prevValue!==void 0&&(r.prevValue=$e(r.prevValue))),e.showStorageDiff&&Array.isArray(r.value)&&Array.isArray(r.prevValue)){let o=Pi(r.prevValue,r.value);if(o){let s={key:r.key};return o.added.length>0&&(s.added=o.added),o.removed.length>0&&(s.removed=o.removed),o.unchanged>0&&(s.unchangedCount=o.unchanged),n.data=s,n}}n.data=r}return n}function qi(t,e){if(!e.reduxChangedOnly)return e.smartJsonParsing?Ue(t):t;let n={};if(t.type&&(n.type=t.type),t.payload&&(n.payload=e.smartJsonParsing?Ue(t.payload):t.payload),t.sliceName&&(n.sliceName=t.sliceName),t.actionName&&(n.actionName=t.actionName),t.duration&&(n.duration=t.duration),t.hasStateChange!==void 0&&(n.hasStateChange=t.hasStateChange),t.diffSummary&&(n.diffSummary=t.diffSummary),t.changedKeysCount!==void 0&&(n.changedKeysCount=t.changedKeysCount),t.hasStateChange===!0){let r=t.sliceName;if(r&&t.prevState&&t.nextState){let o=t.prevState,s=t.nextState;(o[r]!==void 0||s[r]!==void 0)&&(n.stateChange={slice:r,before:o[r],after:s[r]})}}return n}function jn(t){if(typeof t!="object"||t===null)return null;let e=t;return typeof e.name=="string"?e.name:typeof e.id=="string"?e.id:typeof e.key=="string"?e.key:null}function et(t,e){let n=typeof t=="string"?$e(t):t,r=typeof e=="string"?$e(e):e;if(n==null&&r!==null&&r!==void 0)return"Created";if(n!=null&&r==null)return"Deleted";if(Array.isArray(n)&&Array.isArray(r)){let o=n.length,s=r.length,i=n.map(jn).filter(Boolean),u=r.map(jn).filter(Boolean);if(o===s&&o>0){let a=new Set(i),c=new Set(u),l=i.filter(d=>c.has(d));if(l.length===0&&i.length>0&&u.length>0)return`\u26A0\uFE0F Replaced: [${i.join(", ")}] \u2192 [${u.join(", ")}]`;if(l.length<o){let d=i.filter(b=>!c.has(b)),f=u.filter(b=>!a.has(b));return`Changed: -${d.join(", ")} +${f.join(", ")}`}}if(o===0&&s>0)return u.length>0?`Added: [${u.join(", ")}]`:`Added ${s} item${s>1?"s":""}`;if(o>0&&s===0)return i.length>0?`Removed all: [${i.join(", ")}]`:`Removed all ${o} item${o>1?"s":""}`;if(s>o){let a=new Set(i),c=u.filter(l=>!a.has(l));return c.length>0?`Added: [${c.join(", ")}] (${o} \u2192 ${s})`:`Added ${s-o} item${s-o>1?"s":""} (${o} \u2192 ${s})`}if(s<o){let a=new Set(u),c=i.filter(l=>!a.has(l));return c.length>0?`Removed: [${c.join(", ")}] (${o} \u2192 ${s})`:`Removed ${o-s} item${o-s>1?"s":""} (${o} \u2192 ${s})`}return`Updated (${s} item${s>1?"s":""})`}if(typeof n=="object"&&typeof r=="object"&&n&&r){let o=Object.keys(n),s=Object.keys(r),i=s.filter(a=>!o.includes(a)),u=o.filter(a=>!s.includes(a));return i.length>0&&u.length>0?`+${i.length} -${u.length} keys`:i.length>0?`Added: ${i.join(", ")}`:u.length>0?`Removed: ${u.join(", ")}`:"Updated"}return null}function Ni(t,e){let n={};if(t.id&&(n.id=t.id),t.type&&(n.type=t.type),t.timestamp&&(n.timestamp=t.timestamp),t.queryKey&&(n.queryKey=t.queryKey),t.mutationKey&&(n.mutationKey=t.mutationKey),t.mutationId&&(n.mutationId=t.mutationId),t.duration&&(n.duration=t.duration),t.queryData!==void 0&&(n.data=e.smartJsonParsing?Ue(t.queryData):t.queryData),t.variables!==void 0&&(n.variables=e.smartJsonParsing?Ue(t.variables):t.variables),t.queryError!==void 0){let r=t.queryError;r&&typeof r=="object"?n.error=r.message||r.name||r:n.error=t.queryError}if(t.mutationError!==void 0){let r=t.mutationError;r&&typeof r=="object"?n.error=r.message||r.name||r:n.error=t.mutationError}if(t.query&&typeof t.query=="object"){let r=t.query;if(r.state&&typeof r.state=="object"){let o=r.state;if(o.status&&(n.status=o.status),o.fetchStatus&&(n.fetchStatus=o.fetchStatus),o.error){let s=o.error;s&&typeof s=="object"&&(n.error=s.message||s.name||s)}}}if(t.mutation&&typeof t.mutation=="object"){let r=t.mutation;if(r.state&&typeof r.state=="object"){let o=r.state;if(o.status&&(n.status=o.status),o.failureCount&&(n.failureCount=o.failureCount),o.error){let s=o.error;s&&typeof s=="object"&&(n.error=s.message||s.name||s)}if(o.failureReason){let s=o.failureReason;s&&typeof s=="object"&&(n.failureReason=s.message||s.name||s)}}}return n}function gt(t,e){let n=t.originalEvent;if(!n)return null;let r;return t.source==="storage-async"||t.source==="storage-mmkv"?r=Vi(n,e):t.source==="redux"?r=qi(n,e):t.source==="react-query"||t.source==="react-query-query"||t.source==="react-query-mutation"?r=Ni(n,e):e.smartJsonParsing?r=Ue(n):r=n,e.stripVerboseFields&&r&&(r=tn(r)),r}function Be(t){let e={totalEvents:t.length,success:0,pending:0,error:0,neutral:0,durationMs:0,sources:new Set};if(t.length===0)return e;let n=1/0,r=-1/0;for(let o of t)e[o.status]++,e.sources.add(o.source),o.timestamp<n&&(n=o.timestamp),o.timestamp>r&&(r=o.timestamp);return e.durationMs=r-n,e}function tt(t,e){let n=[...t];if(e.filterMode!=="all"&&(n=n.filter(r=>{switch(e.filterMode){case"errors":return r.status==="error";case"success":return r.status==="success";case"pending":return r.status==="pending";default:return!0}})),e.filterSources.length>0){let r=new Set(e.filterSources);n=n.filter(o=>r.has(o.source))}return n}function sn(t){return t<1e3?`+${t}ms`:t<6e4?`+${(t/1e3).toFixed(1)}s`:`+${(t/6e4).toFixed(1)}m`}function Wn(t){return new Date(t).toISOString()}function yt(t,e,n){let r=sn(t-e),o=Wn(t);switch(n){case"relative":return r;case"absolute":return o;case"both":return`${r} (${o})`}}function an(t,e){let n=0,r=[t],o=new Set;for(;r.length>0;){if(n>e)return{over:!0,approxBytes:n};let s=r.pop();if(s==null)n+=4;else if(typeof s=="string")n+=s.length+2;else if(typeof s=="number")n+=8;else if(typeof s=="boolean")n+=5;else if(typeof s=="object"){if(o.has(s))continue;if(o.add(s),Array.isArray(s)){n+=2+s.length;for(let i=0;i<s.length;i++)r.push(s[i])}else{n+=2;for(let i in s)n+=i.length+4,r.push(s[i])}}else n+=4}return{over:n>e,approxBytes:n}}function bt(t,e){if(e===-1)return{data:t,truncated:!1};let{over:n,approxBytes:r}=an(t,e*1024);if(n)return{data:`[Data truncated - \u2265${(r/1024).toFixed(1)}KB exceeds ${e}KB limit]`,truncated:!0};try{return JSON.stringify(t),{data:t,truncated:!1}}catch{return{data:"[Unable to serialize data]",truncated:!0}}}function un(t,e){let n=0;for(let r of t)if(e.includeSource&&(n+=20),e.includeStatus&&(n+=10),e.includeTitle&&(n+=(r.title?.length||0)+10),e.includeSubtitle&&(n+=(r.subtitle?.length||0)+10),e.includeCorrelation&&(n+=20),e.includeDuration&&(n+=15),n+=30,e.includeEventData&&r.originalEvent){let o=e.dataSizeThreshold===-1?1048576:e.dataSizeThreshold*1024,{approxBytes:s}=an(r.originalEvent,o);n+=Math.min(s,o)}return e.includeSummaryHeader&&(n+=100),e.includeTotalDuration&&(n+=50),e.format==="markdown"&&(n*=1.2),e.format==="json"&&(n*=1.3),Math.round(n)}function Fi(t,e,n){let r=[],o=yt(t.timestamp,e,n.timestampFormat);if(r.push(`\`${o}\``),n.includeStatus&&r.push(Oe[t.status]),n.includeSource&&r.push(`**${on[t.source]}**`),n.includeTitle&&r.push(t.title),n.showStorageDiff&&(t.source==="storage-async"||t.source==="storage-mmkv")){let s=t.originalEvent;if(s?.data){let i=s.data,u=et(i.prevValue,i.value);u&&r.push(`\u2192 ${u}`)}}return t.source==="redux"&&t.originalEvent?.hasStateChange===!1&&r.push("(no state change)"),n.includeSubtitle&&t.subtitle&&r.push(`- ${t.subtitle}`),r.join(" ")}function Mi(t,e){let n=[],r=t.originalEvent;if(!r?.data)return n;let o=r.data,s=e.smartJsonParsing?$e(o.prevValue):o.prevValue,i=e.smartJsonParsing?$e(o.value):o.value,u=et(o.prevValue,o.value);if(u&&n.push(` **Change:** ${u}`),Array.isArray(s)&&Array.isArray(i)){let a=s.map(l=>typeof l=="object"&&l&&"name"in l?l.name:null).filter(Boolean),c=i.map(l=>typeof l=="object"&&l&&"name"in l?l.name:null).filter(Boolean);(a.length>0||c.length>0)&&(a.length>0&&n.push(` Before: [${a.join(", ")}]`),n.push(` After: [${c.join(", ")}]`))}return n}function nn(t,e){let n=tt(t,e);if(n.length===0)return"No events to export.";let r=[...n].sort((a,c)=>a.timestamp-c.timestamp),o=r[0].timestamp,s=Be(r),i=[];if(i.push("## Event Flow"),e.includeSummaryHeader||e.includeTotalDuration){let a=[];if(e.includeTotalDuration&&a.push(`**Duration:** ${sn(s.durationMs).replace("+","")}`),a.push(`**Events:** ${s.totalEvents}`),e.includeSummaryHeader){let c=[];s.success>0&&c.push(`${s.success} ${Oe.success}`),s.pending>0&&c.push(`${s.pending} ${Oe.pending}`),s.error>0&&c.push(`${s.error} ${Oe.error}`),s.neutral>0&&c.push(`${s.neutral} ${Oe.neutral}`),c.length>0&&a.push(`**Status:** ${c.join(" ")}`)}i.push(a.join(" | "))}if(i.push(""),i.push("### Timeline"),i.push(""),e.compactMode)return r.forEach((a,c)=>{i.push(`${c+1}. ${Fi(a,o,e)}`)}),i.join(`
5
- `);r.forEach((a,c)=>{let l=[],d=yt(a.timestamp,o,e.timestampFormat);if(l.push(`${c+1}. \`${d}\``),e.includeStatus&&l.push(Oe[a.status]),e.includeSource&&l.push(`**${on[a.source]}**`),e.includeTitle&&l.push(a.title),e.includeCorrelation&&a.correlationId&&a.sequenceInGroup&&l.push(`(${a.sequenceInGroup})`),i.push(l.join(" ")),e.includeSubtitle&&a.subtitle&&i.push(` \u2514\u2500 ${a.subtitle}`),e.showStorageDiff&&!e.includeEventData&&(a.source==="storage-async"||a.source==="storage-mmkv")){let f=Mi(a,e);i.push(...f)}if(e.includeEventData&&a.originalEvent){let f=gt(a,e),{data:b,truncated:v}=bt(f,e.dataSizeThreshold);if(v)i.push(` \u2514\u2500 ${b}`);else{if(e.showStorageDiff&&(a.source==="storage-async"||a.source==="storage-mmkv")){let m=a.originalEvent;if(m?.data){let w=m.data,y=et(w.prevValue,w.value);y&&i.push(` **Change:** ${y}`)}}i.push(" ```json"),i.push(` ${JSON.stringify(b,null,2).split(`
1
+ "use client";var Wt=Object.defineProperty;var Qr=Object.getOwnPropertyDescriptor;var Gr=Object.getOwnPropertyNames;var Zr=Object.prototype.hasOwnProperty;var Yr=(e,t)=>{for(var r in t)Wt(e,r,{get:t[r],enumerable:true})},Kt=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Gr(t))!Zr.call(e,o)&&o!==r&&Wt(e,o,{get:()=>t[o],enumerable:!(a=Qr(t,o))||a.enumerable});return e},Xr=(e,t,r)=>(Kt(e,t,"default"),r&&Kt(r,t,"default"));typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{EventsIcon as eo,EVENTS_ICON_COLOR as to}from"@buoy-gg/floating-tools-core/web";var _t={};Yr(_t,{AccessibilityInfo:()=>no,ActivityIndicator:()=>ea,Alert:()=>Gt,Animated:()=>io,AppRegistry:()=>lo,AppState:()=>uo,Appearance:()=>so,BackHandler:()=>co,Button:()=>ta,CheckBox:()=>Do,Clipboard:()=>mo,DeviceEventEmitter:()=>Uo,Dimensions:()=>po,Easing:()=>ho,FlatList:()=>Qt,I18nManager:()=>go,Image:()=>To,ImageBackground:()=>Io,InteractionManager:()=>yo,Keyboard:()=>fo,KeyboardAvoidingView:()=>Ao,LayoutAnimation:()=>bo,Linking:()=>vo,LogBox:()=>Oo,Modal:()=>Yo,NativeEventEmitter:()=>So,NativeModules:()=>ao,PanResponder:()=>Co,Picker:()=>qo,PixelRatio:()=>wo,Platform:()=>Eo,Pressable:()=>Zo,ProgressBar:()=>Bo,RefreshControl:()=>Fo,SafeAreaView:()=>Ro,ScrollView:()=>ue,SectionList:()=>jo,Share:()=>xo,StatusBar:()=>zo,StyleSheet:()=>le,Switch:()=>Xo,Text:()=>k,TextInput:()=>_o,Touchable:()=>Mo,TouchableHighlight:()=>Qo,TouchableNativeFeedback:()=>Po,TouchableOpacity:()=>ge,TouchableWithoutFeedback:()=>Go,UIManager:()=>$o,Vibration:()=>ko,View:()=>f,VirtualizedList:()=>No,YellowBox:()=>Vo,findNodeHandle:()=>ra,unstable_createElement:()=>oo,useColorScheme:()=>Lo,useLocaleContext:()=>Ho,useWindowDimensions:()=>Jo});Xr(_t,ro);import*as ro from"react-native-web";import{unstable_createElement as oo,NativeModules as ao,AccessibilityInfo as no,Animated as io,Appearance as so,AppRegistry as lo,AppState as uo,BackHandler as co,Clipboard as mo,Dimensions as po,Easing as ho,I18nManager as go,Keyboard as fo,InteractionManager as yo,LayoutAnimation as bo,Linking as vo,NativeEventEmitter as So,PanResponder as Co,PixelRatio as wo,Platform as Eo,Share as xo,StyleSheet as le,UIManager as $o,Vibration as ko,CheckBox as Do,FlatList as Qt,Image as To,ImageBackground as Io,KeyboardAvoidingView as Ao,Picker as qo,ProgressBar as Bo,RefreshControl as Fo,SafeAreaView as Ro,SectionList as jo,StatusBar as zo,Touchable as Mo,TouchableNativeFeedback as Po,VirtualizedList as No,YellowBox as Vo,LogBox as Oo,DeviceEventEmitter as Uo,useColorScheme as Lo,useLocaleContext as Ho,useWindowDimensions as Jo}from"react-native-web";import*as J from"react-native-web";import{createElement as Wo,forwardRef as Ko}from"react";function Z(e){let t=Ko((a,o)=>{let{accessibilityState:n,accessibilityValue:i,...l}=a;for(let s of["busy","checked","disabled","expanded","selected"])n?.[s]!==void 0&&l[`aria-${s}`]===void 0&&(l[`aria-${s}`]=n[s]);for(let[s,u]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[s]!==void 0&&l[`aria-${u}`]===void 0&&(l[`aria-${u}`]=i[s]);return Wo(e,{...l,ref:o})}),r=e.State;return r&&Object.assign(t,{State:r}),t.displayName=e.displayName??e.name??"NativeWebView",t}var f=Z(J.View),k=Z(J.Text),_o=Z(J.TextInput),ge=Z(J.TouchableOpacity),Qo=Z(J.TouchableHighlight),Go=Z(J.TouchableWithoutFeedback),Zo=Z(J.Pressable),ue=Z(J.ScrollView),Yo=Z(J.Modal),Xo=Z(J.Switch),ea=Z(J.ActivityIndicator),ta=Z(J.Button),ra=J.findNodeHandle,Gt={alert(e,t,r,a){if(typeof document>"u")return;let o=document.createElement("dialog");o.dataset.buoyRoot="",o.setAttribute("aria-label",e),o.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 n=document.createElement("h2");if(n.textContent=e,n.style.cssText="font-size:18px;margin:0 0 12px",o.appendChild(n),t){let u=document.createElement("p");u.textContent=t,u.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",o.appendChild(u)}let i=document.createElement("div");i.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let l=r?.length?r:[{text:"OK"}],s=()=>{o.close?.(),o.remove()};for(let u of l){let c=document.createElement("button");c.type="button",c.textContent=u.text??"OK",c.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${u.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,c.onclick=()=>{s(),u.onPress?.()},i.appendChild(c)}o.addEventListener("cancel",u=>{u.preventDefault(),a?.cancelable!==false&&(s(),a?.onDismiss?.())}),o.appendChild(i),document.body.appendChild(o),o.showModal?o.showModal():o.setAttribute("open","")}};import{useState as ot,useCallback as Ae,useEffect as oa,useRef as aa}from"react";import{JsModal as na,ModalHeader as Y,buoyColors as ia,night as X,Trash2 as sa,Copy as la,Search as ua,devToolsStorageKeys as ca,ToolbarCopyButton as da,UpgradeModal as ma,PowerToggleButton as pa,useSafeRouter as ha,windowDragProps as ga}from"@buoy-gg/shared-ui/web";import{useState as fe,useEffect as ye,useCallback as be,useMemo as ve,useRef as yt}from"react";import{useFeatureGate as fa,subscribeToSubscriberCountChanges as ya,useIgnoredPatterns as ba,useLimit as va}from"@buoy-gg/shared-ui/web";import{loadToolModule as ee,getToolModuleVersion as Zt}from"@buoy-gg/shared-ui/web/utils";var Sa=0;function me(e){return`${e}-${Date.now()}-${++Sa}`}function Ca(){try{let{storageEventStore:e}=ee("@buoy-gg/storage");return{id:"storage",name:"Storage",eventSources:["storage-async","storage-mmkv"],available:true,subscribe:t=>e.onEvent(r=>{if(r?.data?.initialScan)return;let a=wa(r);t(a)})}}catch{return null}}function wa(e){let t=e,r=t.storageType==="async"?"storage-async":"storage-mmkv",a=t.action;t.storageType==="async"&&(a={setItem:"Set Item",removeItem:"Remove Item",mergeItem:"Merge Item",clear:"Clear All",multiSet:"Multi Set",multiRemove:"Multi Remove",multiMerge:"Multi Merge"}[t.action]||t.action);let o="";if(t.storageType==="async")switch(t.action){case"setItem":case"removeItem":case"mergeItem":o=t.data?.key||"unknown key";break;case"multiSet":case"multiMerge":{let i=t.data?.pairs?.length||0;o=`${i} key${i!==1?"s":""}`;break}case"multiRemove":{let i=t.data?.keys?.length||0;o=`${i} key${i!==1?"s":""}`;break}case"clear":o="all keys";break}else o=t.data?.key||t.data?.instanceId||"unknown";let n="neutral";return(t.action.includes("set")||t.action.includes("Set")||t.action.includes("merge")||t.action.includes("Merge"))&&(n="success"),{id:me(r),source:r,timestamp:t.timestamp.getTime(),title:a,subtitle:o,status:n,originalEvent:e}}function Ea(){try{let{reduxActionStore:e}=ee("@buoy-gg/redux"),t=null;return{id:"redux",name:"Redux",eventSources:["redux"],available:true,subscribe:r=>e.subscribe(a=>{if(a.length>0){let o=a[0];if(o.id!==t){t=o.id;let n=xa(o);r(n)}}})}}catch{return null}}function xa(e){let t=e,r="neutral";switch(t.category){case"fulfilled":r="success";break;case"rejected":r="error";break;case"pending":r="pending";break;default:r=t.hasStateChange?"success":"neutral"}let a="";return t.payloadPreview?a=t.payloadPreview:t.hasStateChange&&t.diffSummary?a=t.diffSummary:t.duration!==void 0?a=`${t.duration.toFixed(1)}ms`:a=t.sliceName||"",{id:me("redux"),source:"redux",timestamp:t.timestamp,title:t.type,subtitle:a,status:r,originalEvent:e}}function $a(){try{let{networkEventStore:e,networkListener:t,addNetworkListener:r}=ee("@buoy-gg/network"),a=new Map;return{id:"network",name:"Network",eventSources:["network"],available:true,setup:()=>{let o=t();o.isActive||o.startListening(),o.listenerCount===0&&r(n=>{e.processNetworkEvent(n)})},subscribe:o=>{let n=Date.now();return e.onEvent(i=>{let l=i,s=a.get(l.id);if(s){let u=Yt(i);u.id=s,o(u)}else{if(typeof l.timestamp=="number"&&l.timestamp<n)return;let u=Yt(i);a.set(l.id,u.id),o(u)}},false)}}}catch{return null}}function Yt(e){let t=e,r="neutral";t.status===void 0?r="pending":t.error||t.status>=400?r="error":t.status>=200&&t.status<400&&(r="success");let a=t.operationName||`${t.method} ${t.path||t.url}`,o=[];return t.status!==void 0?o.push(`${t.status}`):t.error?o.push("Error"):o.push("Pending"),t.duration!==void 0&&o.push(`${t.duration.toFixed(0)}ms`),t.host&&o.push(t.host),{id:me("network"),source:"network",timestamp:t.timestamp,title:a,subtitle:o.join(" \xB7 "),status:r,originalEvent:e}}function ka(){try{let{reactQueryEventStore:e}=ee("@buoy-gg/react-query"),t=null;return{id:"react-query",name:"React Query",eventSources:["react-query","react-query-query","react-query-mutation"],available:true,subscribe:r=>{let a=true,o=new Set,n=i=>i.queryHash??(i.mutationId!==void 0?`m-${i.mutationId}`:null);return e.subscribe(i=>{if(a){a=false,i.length>0&&(t=i[0].id);return}if(i.length>0){let l=i[0];if(l.id!==t){t=l.id;let s=l.type??"",u=n(l);if(s==="query-fetch-start"||s==="mutation-start")u&&o.add(u);else if((s==="query-fetch-success"||s==="query-fetch-error"||s==="mutation-success"||s==="mutation-error")&&u&&!o.has(u))return;let c=Da(l);r(c)}}})}}}catch{return null}}function Xt(e){return!e||e.length===0?"unknown":e.map(t=>{if(typeof t=="string")return t;if(typeof t=="number")return String(t);if(typeof t=="object"&&t!==null){let r=Object.values(t)[0];return typeof r=="string"||typeof r=="number"?String(r):JSON.stringify(t).slice(0,20)}return String(t)}).join(" \u203A ")}function Da(e){let t=e,r=t.type.startsWith("mutation-")?"react-query-mutation":"react-query-query",a="neutral";switch(t.type){case"query-fetch-start":case"mutation-start":a="pending";break;case"query-fetch-success":case"mutation-success":a="success";break;case"query-fetch-error":case"mutation-error":a="error";break}let o="";t.queryKey?o=Xt(t.queryKey):t.mutationKey?o=Xt(t.mutationKey):t.mutationId!==void 0?o=`Mutation #${t.mutationId}`:o=t.type.replace(/-/g," ");let n=[];switch(t.type){case"query-fetch-start":n.push("Fetching");break;case"query-fetch-success":n.push("Success");break;case"query-fetch-error":n.push("Error");break;case"query-invalidated":n.push("Invalidated");break;case"mutation-start":n.push("Mutating");break;case"mutation-success":n.push("Success");break;case"mutation-error":n.push("Error");break}t.duration!==void 0&&n.push(`${t.duration.toFixed(0)}ms`);let i;t.queryHash?i=`rq-query-${t.queryHash}`:t.mutationId!==void 0&&(i=`rq-mutation-${t.mutationId}`);let l=1;switch(t.type){case"query-fetch-start":case"mutation-start":l=1;break;case"query-fetch-success":case"query-fetch-error":case"mutation-success":case"mutation-error":l=2;break;case"query-invalidated":l=3;break}return{id:me(r),source:r,timestamp:t.timestamp,title:o,subtitle:n.join(" \xB7 "),status:a,originalEvent:e,correlationId:i,sequenceInGroup:l}}function Ta(){try{let{routeEventStore:e}=ee("@buoy-gg/route-events");return{id:"route-events",name:"Routes",eventSources:["route"],available:true,subscribe:t=>e.onEvent(r=>{let a=Ia(r);t(a)})}}catch{return null}}function Ia(e){let t=e,r="neutral";(t.pathname==="/"||Object.keys(t.params).length>0)&&(r="success");let a=[],o=Object.keys(t.params).length;return o>0&&a.push(`${o} param${o!==1?"s":""}`),t.timeSincePrevious!==void 0&&t.timeSincePrevious>0&&(t.timeSincePrevious<1e3?a.push(`${t.timeSincePrevious}ms`):a.push(`${(t.timeSincePrevious/1e3).toFixed(1)}s`)),t.previousPathname&&t.previousPathname!==t.pathname&&a.push(`from ${t.previousPathname}`),{id:me("route"),source:"route",timestamp:t.timestamp,title:t.pathname||"/",subtitle:a.join(" \xB7 ")||"navigation",status:r,originalEvent:e}}function Aa(){try{let{zustandStateStore:e}=ee("@buoy-gg/zustand"),t=null;return{id:"zustand",name:"Zustand",eventSources:["zustand"],available:true,subscribe:r=>e.subscribe(a=>{if(a.length>0){let o=a[0];if(o.id!==t){t=o.id;let n=qa(o);r(n)}}})}}catch{return null}}function qa(e){let t=e,r="neutral";t.isSlowUpdate?r="pending":t.hasStateChange&&(r="success");let a=[];if(t.changedKeys&&t.changedKeys.length>0){let o=t.changedKeys.slice(0,3).join(", "),n=t.changedKeys.length>3?` +${t.changedKeys.length-3}`:"";a.push(`${o}${n}`)}else t.diffSummary&&a.push(t.diffSummary);return t.duration!==void 0&&a.push(`${t.duration.toFixed(1)}ms`),t.category==="replace"&&a.push("replace"),{id:me("zustand"),source:"zustand",timestamp:t.timestamp,title:t.storeName,subtitle:a.join(" \xB7 ")||(t.hasStateChange?"state changed":"no change"),status:r,originalEvent:e}}function Ba(){try{let{jotaiStateStore:e}=ee("@buoy-gg/jotai"),t=null;return{id:"jotai",name:"Jotai",eventSources:["jotai"],available:true,subscribe:r=>e.subscribe(a=>{if(a.length>0){let o=a[0];if(o.id!==t){t=o.id;let n=Fa(o);r(n)}}})}}catch{return null}}function Fa(e){let t=e,r="neutral";t.category==="write"&&t.hasValueChange?r="success":t.category==="read"&&(r="neutral");let a=[];return t.valuePreview?a.push(t.valuePreview):t.diffSummary&&a.push(t.diffSummary),t.category&&a.push(t.category),{id:me("jotai"),source:"jotai",timestamp:t.timestamp,title:t.atomLabel,subtitle:a.join(" \xB7 ")||(t.hasValueChange?"value changed":"no change"),status:r,originalEvent:e}}function Ra(){let e;try{e=ee("@buoy-gg/highlight-updates")}catch{return null}try{if(!e.RenderTracker||!e.HighlightUpdatesController)return null;let{RenderTracker:t,HighlightUpdatesController:r}=e;return{id:"render",name:"Render",eventSources:["render"],available:true,setup:()=>{r&&r.enableBackgroundTracking()},subscribe:a=>{r&&!r.isBackgroundTrackingEnabled()&&r.enableBackgroundTracking();let o=t.onRenderEvent((n,i)=>{let l=ja(n,i);a(l)});return()=>{o(),r.disableBackgroundTracking()}}}}catch{return null}}function ja(e,t){let r=e,a=t,o=a.componentName||a.displayName||a.viewType,n=[],i={mount:"mounted",props:"props changed",state:"state changed",hooks:"hooks changed",context:"context changed",parent:"parent re-rendered",unknown:"re-rendered"};if(n.push(i[r.cause.type]||r.cause.type),r.cause.type==="props"&&r.cause.changedKeys?.length){let s=r.cause.changedKeys.slice(0,3).join(", "),u=r.cause.changedKeys.length>3?` +${r.cause.changedKeys.length-3}`:"";n.push(`[${s}${u}]`)}if(r.cause.hookChanges?.length){let s=r.cause.hookChanges[0];s.description&&n.push(s.description)}n.push(`#${r.renderNumber}`);let l="neutral";switch(r.cause.type){case"mount":l="neutral";break;case"props":case"state":case"hooks":case"context":l="success";break;case"parent":l="pending";break;default:l="neutral"}return{id:me("render"),source:"render",timestamp:r.timestamp,title:o,subtitle:n.join(" \xB7 "),status:l,originalEvent:{event:r,render:a}}}function za(){let e=[],t=new Set,r=[Ca,Ea,$a,ka,Ta,Aa,Ba,Ra];for(let a of r){let o=a();o&&o.available&&(e.push(o),o.eventSources.forEach(n=>t.add(n)))}return{sources:e,availableEventSources:t}}function Ma(e){return{"storage-async":{label:"Storage",color:"#8B5CF6",icon:"server-outline"},"storage-mmkv":{label:"MMKV",color:"#F59E0B",icon:"flash-outline"},redux:{label:"Redux",color:"#3B82F6",icon:"git-branch-outline"},network:{label:"Network",color:"#10B981",icon:"globe-outline"},"react-query":{label:"Query",color:"#EC4899",icon:"sync-outline"},"react-query-query":{label:"Query",color:"#EC4899",icon:"sync-outline"},"react-query-mutation":{label:"Mutation",color:"#F97316",icon:"flash-outline"},route:{label:"Route",color:"#06B6D4",icon:"navigate-outline"},zustand:{label:"Zustand",color:"#764ABC",icon:"cube-outline"},jotai:{label:"Jotai",color:"#14B8A6",icon:"ellipse-outline"},render:{label:"Render",color:"#F472B6",icon:"layers-outline"}}[e]||{label:e,color:"#6B7280",icon:"help-outline"}}var bt=null,er=-1;function W(){return(!bt||er!==Zt())&&(er=Zt(),bt=za()),bt}function Pa(){let e=[],t=0;try{let{storageEventStore:r}=ee("@buoy-gg/storage"),a=r.getSubscriberCounts();e.push({sourceId:"storage",counts:a}),t+=a.total}catch{}try{let{networkEventStore:r}=ee("@buoy-gg/network"),a=r.getSubscriberCounts();e.push({sourceId:"network",counts:a}),t+=a.total}catch{}try{let{routeEventStore:r}=ee("@buoy-gg/route-events"),a=r.getSubscriberCounts();e.push({sourceId:"route-events",counts:a}),t+=a.total}catch{}try{let{RenderTracker:r,HighlightUpdatesController:a}=ee("@buoy-gg/highlight-updates"),o=r.getRenderEventCallbackCount(),n=a?.isEnabled?.()?1:0,i={eventCallbacks:o,arrayListeners:n,total:o+n};e.push({sourceId:"render",counts:i}),t+=i.total}catch{}return{sources:e,totalSubscribers:t}}import{ChangeLog as Na}from"@buoy-gg/shared-ui/web";var tr={"storage-async":"storage","storage-mmkv":"storage",redux:"redux",network:"network","react-query":"react-query","react-query-query":"react-query","react-query-mutation":"react-query",route:"route-events",zustand:"zustand",jotai:"jotai",render:"render"};var Va=200,rr=new Set(["render"]),Oa=class extends Na{constructor(){super({max:Va});this.activeSources=new Set;this.remoteAvailableSources=null;this.sourceUnsubscribers=new Map;this.remoteDiscoveryIds=new Set;this.localDiscoveryIds=new Set;this.localSyncChain=Promise.resolve();this.networkEventIdMap=new Map}getDiscoveredSources(){return W().sources}getAvailableEventSources(){return this.remoteAvailableSources?this.remoteAvailableSources:W().availableEventSources}setRemoteAvailableSources(e){let t=e?new Set(e):null,r=this.remoteAvailableSources,a=r===null&&t===null||!!r&&!!t&&r.size===t.size&&[...t].every(o=>r.has(o));this.remoteAvailableSources=t,a||this.notifyListeners()}replaceEvents(e){this.activeSources=new Set(e.map(t=>t.source)),this.setItems(e)}async subscribeToAll(){let{sources:e}=W();for(let t of e)rr.has(t.id)||await this.subscribeToSource(t)}async subscribeToSource(e){let t=this.sourceUnsubscribers.get(e.id);if(t){t.refCount++;return}let r={unsubscribe:()=>{},refCount:1};this.sourceUnsubscribers.set(e.id,r);try{e.setup&&await e.setup();let a=await e.subscribe(o=>{this.addEvent(o)});a&&(r.unsubscribe=a)}catch{this.sourceUnsubscribers.get(e.id)===r&&r.refCount<=1&&this.sourceUnsubscribers.delete(e.id)}}unsubscribeFromSource(e){let t=this.sourceUnsubscribers.get(e);t&&(t.refCount--,t.refCount<=0&&(t.unsubscribe(),this.sourceUnsubscribers.delete(e)))}async subscribeToStorage(){let{sources:e}=W(),t=e.find(r=>r.id==="storage");t&&await this.subscribeToSource(t)}unsubscribeFromStorage(){this.unsubscribeFromSource("storage"),this.activeSources.delete("storage-async"),this.activeSources.delete("storage-mmkv")}subscribeToRedux(){let{sources:e}=W(),t=e.find(r=>r.id==="redux");t&&this.subscribeToSource(t)}unsubscribeFromRedux(){this.unsubscribeFromSource("redux"),this.activeSources.delete("redux")}subscribeToNetwork(){let{sources:e}=W(),t=e.find(r=>r.id==="network");t&&this.subscribeToSource(t)}unsubscribeFromNetwork(){this.unsubscribeFromSource("network"),this.activeSources.delete("network")}subscribeToReactQuery(){let{sources:e}=W(),t=e.find(r=>r.id==="react-query");t&&this.subscribeToSource(t)}unsubscribeFromReactQuery(){this.unsubscribeFromSource("react-query"),this.activeSources.delete("react-query"),this.activeSources.delete("react-query-query"),this.activeSources.delete("react-query-mutation")}subscribeToRoutes(){let{sources:e}=W(),t=e.find(r=>r.id==="route-events");t&&this.subscribeToSource(t)}unsubscribeFromRoutes(){this.unsubscribeFromSource("route-events"),this.activeSources.delete("route")}subscribeToZustand(){let{sources:e}=W(),t=e.find(r=>r.id==="zustand");t&&this.subscribeToSource(t)}unsubscribeFromZustand(){this.unsubscribeFromSource("zustand"),this.activeSources.delete("zustand")}subscribeToJotai(){let{sources:e}=W(),t=e.find(r=>r.id==="jotai");t&&this.subscribeToSource(t)}unsubscribeFromJotai(){this.unsubscribeFromSource("jotai"),this.activeSources.delete("jotai")}subscribeToRender(){let{sources:e}=W(),t=e.find(r=>r.id==="render");t&&this.subscribeToSource(t)}unsubscribeFromRender(){this.unsubscribeFromSource("render"),this.activeSources.delete("render")}addEvent(e){if(e.source==="network"){let t=e.originalEvent;if(t?.id){let r=this.networkEventIdMap.get(t.id);if(r){let a=this.items.findIndex(o=>o.id===r);if(a>=0){e.id=r,this.items=[...this.items.slice(0,a),e,...this.items.slice(a+1)],this.notifyListeners();return}}this.networkEventIdMap.set(t.id,e.id)}}this.push(e),this.activeSources.add(e.source),this.notifyListeners()}getEvents(e){return!e||e.size===0?this.items:this.items.filter(t=>e.has(t.source))}getActiveSources(){return Array.from(this.activeSources)}getSourceCounts(){let e={"storage-async":0,"storage-mmkv":0,redux:0,network:0,"react-query":0,"react-query-query":0,"react-query-mutation":0,route:0,zustand:0,jotai:0,render:0};for(let t of this.items)e[t.source]++;return e}clearEvents(){this.activeSources.clear(),this.networkEventIdMap.clear(),this.clear()}subscribe(e){let t=super.subscribe(e);return e(this.items),t}getEventCount(){return this.items.length}unsubscribeAll(){for(let[,e]of this.sourceUnsubscribers)e.unsubscribe();this.sourceUnsubscribers.clear(),this.activeSources.clear(),this.remoteDiscoveryIds.clear(),this.localDiscoveryIds.clear()}setLocalEnabledSources(e){let t=async()=>{let r=new Set;for(let n of e){let i=tr[n];i&&r.add(i)}let a=this.localDiscoveryIds;this.localDiscoveryIds=r;let{sources:o}=W();for(let n of r)if(!a.has(n)){let i=o.find(l=>l.id===n);i&&await this.subscribeToSource(i)}for(let n of a)r.has(n)||this.unsubscribeFromSource(n)};return this.localSyncChain=this.localSyncChain.then(t,t),this.localSyncChain}async setRemoteEnabledSources(e){let{sources:t}=W(),r;if(e==="all")r=new Set(t.map(o=>o.id).filter(o=>!rr.has(o)));else{r=new Set;for(let o of e){let n=tr[o];n&&r.add(n)}}let a=this.remoteDiscoveryIds;this.remoteDiscoveryIds=r;for(let o of r)if(!a.has(o)){let n=t.find(i=>i.id===o);n&&await this.subscribeToSource(n)}for(let o of a)r.has(o)||this.unsubscribeFromSource(o)}ensureRemoteSourcesDefault(){this.remoteDiscoveryIds.size===0&&this.setRemoteEnabledSources("all")}clearRemoteSources(){for(let e of this.remoteDiscoveryIds)this.unsubscribeFromSource(e);this.remoteDiscoveryIds.clear()}isSourceSubscribed(e){switch(e){case"storage-async":case"storage-mmkv":return this.sourceUnsubscribers.has("storage");case"redux":return this.sourceUnsubscribers.has("redux");case"network":return this.sourceUnsubscribers.has("network");case"react-query":case"react-query-query":case"react-query-mutation":return this.sourceUnsubscribers.has("react-query");case"route":return this.sourceUnsubscribers.has("route-events");case"zustand":return this.sourceUnsubscribers.has("zustand");case"jotai":return this.sourceUnsubscribers.has("jotai");case"render":return this.sourceUnsubscribers.has("render");default:return false}}getSubscriptionStatus(){return{"storage-async":this.sourceUnsubscribers.has("storage"),"storage-mmkv":this.sourceUnsubscribers.has("storage"),redux:this.sourceUnsubscribers.has("redux"),network:this.sourceUnsubscribers.has("network"),"react-query":this.sourceUnsubscribers.has("react-query"),"react-query-query":this.sourceUnsubscribers.has("react-query"),"react-query-mutation":this.sourceUnsubscribers.has("react-query"),route:this.sourceUnsubscribers.has("route-events"),zustand:this.sourceUnsubscribers.has("zustand"),jotai:this.sourceUnsubscribers.has("jotai"),render:this.sourceUnsubscribers.has("render")}}getSubscriberCounts(){return Pa()}},L=new Oa;var Ua=e=>L.getEvents(e);var La=()=>L.clearEvents(),Ha=e=>L.subscribe(e);var or=e=>L.setLocalEnabledSources(e);var ar=()=>L.getAvailableEventSources();var nr=()=>L.getSubscriberCounts();import{persistentStorage as Se,devToolsStorageKeys as qe}from"@buoy-gg/shared-ui/web";async function Ja(e){try{let t=qe.events.enabledSources();await Se.setItem(t,JSON.stringify(e))}catch{}}async function Wa(){try{let e=qe.events.enabledSources(),t=await Se.getItem(e);return t&&t!==""?JSON.parse(t):null}catch{return null}}async function Ka(e){try{let t=qe.events.isCapturing();await Se.setItem(t,JSON.stringify(e))}catch{}}async function _a(){try{let e=qe.events.isCapturing(),t=await Se.getItem(e);return t!==null&&t!==""?JSON.parse(t):null}catch{return null}}async function ir(e){try{let t=qe.events.pausedAt();e===null?await Se.removeItem(t):await Se.setItem(t,JSON.stringify(e))}catch{}}async function Qa(){try{let e=qe.events.pausedAt(),t=await Se.getItem(e);if(t!==null&&t!==""){let r=JSON.parse(t);return typeof r=="number"?r:null}return null}catch{return null}}import{isDevToolsStorageKey as sr,isUrlIgnored as Ga}from"@buoy-gg/shared-ui/web";var Za=["api.keygen.sh","buoy.gg/api/license"];function vt(e){let t=e.originalEvent;if(!t)return false;if(e.source==="storage-async"||e.source==="storage-mmkv"){let r=t.data?.key||t.key;if(r&&sr(r))return true;let a=t.data?.keys||t.data?.pairs?.map(o=>o[0]);if(a&&a.length>0&&a.every(o=>sr(o)))return true}if(e.source==="network"){let r=t.host||"",a=t.url||"";for(let o of Za)if(r.includes(o)||a.includes(o))return true}return false}function St(e,t){if(e.source!=="network"||t.length===0)return false;let r=e.originalEvent?.url??"";return Ga(r,t)}function Ya(e,t){return vt(e)||St(e,t)}function Xa(e,t){if(e.title.toLowerCase().includes(t)||e.subtitle.toLowerCase().includes(t))return true;let r=e.originalEvent?.url;return typeof r=="string"&&r.toLowerCase().includes(t)}var lr=["storage-async","redux","network","react-query-query","react-query-mutation","route","zustand","jotai","render"],ur=lr.filter(e=>e!=="render"),Ct={"storage-async":["storage-async","storage-mmkv"],"storage-mmkv":["storage-mmkv"],redux:["redux"],network:["network"],"react-query":["react-query","react-query-query"],"react-query-query":["react-query","react-query-query"],"react-query-mutation":["react-query-mutation"],route:["route"],zustand:["zustand"],jotai:["jotai"],render:["render"]};function wt(e){let{isPro:t}=fa(),r=va("events.entries"),{patterns:a}=ba(),[o,n]=fe([]),[i,l]=fe(()=>new Set(ur)),[s,u]=fe(true),[c,d]=fe(""),h=yt(false),b=e?.capturingOverride??s,v=yt(null),p=yt([]),[y,m]=fe(0);ye(()=>{b?v.current!==null&&(p.current=[...p.current,[v.current,Date.now()]],v.current=null,m(w=>w+1),ir(null)):v.current===null&&(v.current=Date.now(),m(w=>w+1),ir(v.current))},[b]);let g=be(w=>{let F=v.current;if(F!==null&&w>F)return true;for(let[z,Q]of p.current)if(w>z&&w<=Q)return true;return false},[]),[$,U]=fe(()=>ar()),[C,I]=fe(0);ye(()=>ya(()=>{I(w=>w+1)}),[]);let x=ve(()=>lr.filter(w=>(Ct[w]||[w]).some(F=>$.has(F))),[$]);ye(()=>{let w=null,F=Ha(()=>{w==null&&(w=requestAnimationFrame(()=>{w=null,z()}))}),z=()=>{let Q=Ua();n(Q),U(q=>{let R=ar();return q.size===R.size&&[...R].every(ne=>q.has(ne))?q:new Set(R)})};return()=>{F(),w!=null&&cancelAnimationFrame(w)}},[]),ye(()=>{(async()=>{let w=await Wa(),F,z=x.filter(R=>ur.includes(R));if(w&&w.length>0){let R=w.filter(ne=>x.includes(ne));R.length>0?F=new Set(R):F=new Set(z)}else F=new Set(z);l(F);let Q=await _a(),q=Q!==null?Q:true;if(!q&&v.current===null){let R=await Qa();v.current=R??Date.now(),m(ne=>ne+1)}u(q),h.current=true,or(q?Array.from(F):[])})()},[x]),ye(()=>{h.current&&or(s?Array.from(i):[])},[i,s]),ye(()=>{h.current&&Ja(Array.from(i))},[i]),ye(()=>{h.current&&Ka(s)},[s]);let j=ve(()=>{let w=new Set;return i.forEach(F=>{let z=Ct[F];z&&z.forEach(Q=>w.add(Q))}),w},[i]),N=c.trim().toLowerCase(),pe=ve(()=>o.filter(w=>!g(w.timestamp)&&!vt(w)&&!St(w,a)),[o,a,g,y]),K=ve(()=>j.size===0?[]:pe.filter(w=>j.has(w.source)&&(N===""||Xa(w,N))),[pe,j,N]),he=ve(()=>K.slice(0,r),[K,r]),_=ve(()=>Math.max(0,K.length-r),[K,r]),Xe=ve(()=>{let w=pe.reduce((q,R)=>(q[R.source]=(q[R.source]??0)+1,q),{}),F=nr(),z={};for(let q of F.sources)z[q.sourceId]=q.counts.total;let Q={"storage-async":"storage","storage-mmkv":"storage",redux:"redux",network:"network","react-query":"react-query","react-query-query":"react-query","react-query-mutation":"react-query",route:"route-events",zustand:"zustand",jotai:"jotai",render:"render"};return x.map(q=>{let R=(Ct[q]||[q]).reduce((G,ft)=>G+(w[ft]||0),0),ne=Ma(q),Ie=Q[q],rt=Ie&&Ie in z?z[Ie]:void 0;return{source:q,...ne,count:R,enabled:i.has(q),subscriberCount:rt}}).sort((q,R)=>q.enabled&&!R.enabled?-1:!q.enabled&&R.enabled?1:0)},[pe,i,x,C]),pt=be(w=>{l(F=>{let z=new Set(F);return z.has(w)?z.delete(w):z.add(w),z})},[]),et=be(()=>{l(new Set(x))},[x]),Te=be(()=>{La()},[]),Ve=be(()=>{u(true)},[]),ht=be(()=>{u(false)},[]),gt=be(()=>{u(w=>!w)},[]),tt=nr().totalSubscribers;return{events:o,filteredEvents:he,availableSources:Xe,enabledSources:i,searchText:c,setSearchText:d,toggleSource:pt,enableAllSources:et,clearEvents:Te,totalCount:pe.length,filteredCount:he.length,isCapturing:s,startCapturing:Ve,stopCapturing:ht,toggleCapturing:gt,discoveredSources:$,hiddenEventsCount:_,isPro:t,totalSubscriberCount:tt}}import{memo as en}from"react";import{night as O}from"@buoy-gg/shared-ui/web";var S="buoy-events";function tn(e){return String(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"unknown"}function cr(e){let t=e.originalEvent??{};switch(e.source){case"storage-async":case"storage-mmkv":{let r=t.data??{},a=r.key??(Array.isArray(r.keys)?r.keys.join("+"):void 0)??(Array.isArray(r.pairs)?r.pairs.map(o=>o[0]).join("+"):void 0);return`${e.title} ${a??""}`}case"network":{let r=String(t.url??""),a=r.split("?")[0]??r;return`${t.method??""} ${a}`}case"react-query":case"react-query-query":case"react-query-mutation":return`${e.title} ${t.type??""}`;default:return e.title}}function dr(e){return`${S}-row-${e.source}-${tn(cr(e))}`}function mr(e){return`${S}-filter-${e}`}import{jsx as Ce,jsxs as Et}from"react/jsx-runtime";var xt=en(function({availableSources:e,onToggleSource:t,totalCount:r,filteredCount:a}){return e.length===0?null:Et(f,{style:re.container,testID:`${S}-filter-bar`,children:[Ce(ue,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:re.badgesRow,testID:`${S}-filter-scroll`,children:e.map(o=>{let n=o.enabled!==false,i=o.subscriberCount,l=i!==void 0,s=o.count||0,u=mr(o.source);return Et(ge,{testID:u,accessibilityRole:"button",accessibilityLabel:`${o.label} filter, ${n?"on":"off"}, ${s} event${s===1?"":"s"}`,style:[re.badge,n?{backgroundColor:O.color.surface,borderColor:o.color+"50"}:re.badgeDisabled],onPress:()=>t(o.source),activeOpacity:.7,children:[l&&Ce(f,{style:[re.countBadge,{backgroundColor:n?i>0?o.color+"25":O.color.fillSecondary:O.color.fill}],children:Ce(k,{style:[re.countText,{color:n?i>0?o.color:O.color.textTertiary:O.color.textTertiary}],testID:`${u}-subscribers`,children:i})}),Ce(f,{style:[re.dot,{backgroundColor:n?o.color:O.color.fillTertiary}]}),Ce(k,{style:[re.badgeLabel,{color:n?O.color.text:O.color.textTertiary}],numberOfLines:1,testID:`${u}-label`,children:o.label}),Ce(f,{style:[re.countBadge,{backgroundColor:n?s>0?o.color+"20":O.color.fill:O.color.fill}],children:Ce(k,{style:[re.countText,{color:n?s>0?o.color:O.color.textTertiary:O.color.textTertiary}],testID:`${u}-count`,children:s})})]},o.source)})}),a<r&&Et(k,{style:re.filterInfo,testID:`${S}-showing`,children:["Showing ",a," of ",r]})]})}),re=le.create({container:{paddingVertical:8,backgroundColor:"transparent",borderBottomWidth:1,borderBottomColor:O.color.border},badgesRow:{flexDirection:"row",gap:8,paddingHorizontal:12},badge:{flexDirection:"row",alignItems:"center",paddingVertical:5,paddingHorizontal:6,borderRadius:20,borderWidth:1,gap:6,flexShrink:0},badgeDisabled:{backgroundColor:O.color.surface,borderColor:O.color.border,opacity:.5},dot:{width:7,height:7,borderRadius:4},badgeLabel:{fontSize:12,fontWeight:"500"},countBadge:{minWidth:18,height:18,borderRadius:9,alignItems:"center",justifyContent:"center",paddingHorizontal:5},countText:{fontSize:10,fontWeight:"600",fontVariant:["tabular-nums"]},filterInfo:{marginTop:6,fontSize:11,color:O.color.textTertiary,textAlign:"center"}});import{memo as rn,useCallback as $t,useMemo as on}from"react";import{night as at,Zap as an,ProBadge as nn,ToolEmptyState as sn,resolveListEmptyState as ln}from"@buoy-gg/shared-ui/web";import{loadToolModule as Be,getToolModuleVersion as pr}from"@buoy-gg/shared-ui/web/utils";import{memo as un}from"react";import{CompactRow as cn,formatRelativeTime as dn,Pill as mn}from"@buoy-gg/shared-ui/web";import{jsx as V,jsxs as pn}from"react/jsx-runtime";function hn(){let e={StorageEventCard:null,getValueType:null,ReduxActionItem:null,NetworkEventItemCompact:null,RouteEventItemCompact:null,ZustandStateChangeItem:null,JotaiAtomChangeItem:null};try{let t=Be("@buoy-gg/storage");e.StorageEventCard=t.StorageEventCard,e.getValueType=t.getValueType}catch{}try{let t=Be("@buoy-gg/redux");e.ReduxActionItem=t.ReduxActionItem}catch{}try{let t=Be("@buoy-gg/network");e.NetworkEventItemCompact=t.NetworkEventItemCompact}catch{}try{let t=Be("@buoy-gg/route-events");e.RouteEventItemCompact=t.RouteEventItemCompact}catch{}try{let t=Be("@buoy-gg/zustand");e.ZustandStateChangeItem=t.ZustandStateChangeItem}catch{}try{let t=Be("@buoy-gg/jotai");e.JotaiAtomChangeItem=t.JotaiAtomChangeItem}catch{}return e}var kt,hr=-1;function gn(){return(!kt||hr!==pr())&&(kt=hn(),hr=pr()),kt}var gr={"storage-async":{label:"Storage",color:"#8B5CF6"},"storage-mmkv":{label:"MMKV",color:"#F59E0B"},redux:{label:"Redux",color:"#3B82F6"},network:{label:"Network",color:"#10B981"},"react-query":{label:"Query",color:"#EC4899"},"react-query-query":{label:"Query",color:"#EC4899"},"react-query-mutation":{label:"Mutation",color:"#F97316"},route:{label:"Route",color:"#06B6D4"},zustand:{label:"Zustand",color:"#764ABC"},jotai:{label:"Jotai",color:"#14B8A6"},render:{label:"Render",color:"#F472B6"}};function fn(e){switch(e){case"success":return"#10B981";case"error":return"#EF4444";case"pending":return"#F59E0B";case"neutral":default:return"#6B7280"}}function yn(e){return e==="storage-async"||e==="storage-mmkv"}function bn({label:e,color:t,testID:r}){return V(mn,{label:e,color:t,variant:"soft",size:"sm",style:{marginLeft:6},testID:r})}var vn={"storage-async":"STORAGE","storage-mmkv":"MMKV",redux:"REDUX",network:"NET","react-query":"QUERY","react-query-query":"QUERY","react-query-mutation":"MUTATION",route:"ROUTE",zustand:"ZUSTAND",jotai:"JOTAI",render:"RENDER"};function Oe({source:e,testID:t,children:r}){let a=gr[e].color,o=vn[e];return pn(f,{style:Dt.badgeWrapper,testID:t,children:[r,V(f,{style:[Dt.sourceBadge,{backgroundColor:`${a}20`}],children:V(k,{style:[Dt.sourceBadgeText,{color:a}],testID:t?`${t}-badge`:void 0,children:o})})]})}var fr=un(function({event:e,onPress:t,isSelected:r=false,isExpanded:a=false,onNavigate:o,correlationCount:n=1,correlationLabel:i,correlationColor:l}){let{StorageEventCard:s,getValueType:u,ReduxActionItem:c,NetworkEventItemCompact:d,RouteEventItemCompact:h,ZustandStateChangeItem:b,JotaiAtomChangeItem:v}=gn(),p=gr[e.source],y=fn(e.status),m=dr(e);if(yn(e.source)&&s&&u){let $=e.originalEvent,U={key:$.data?.key||"unknown",lastAction:$.action,totalOperations:1,lastEventTimestamp:new Date(e.timestamp),storageTypes:new Set([$.storageType||"async"]),valueType:$.data?.value!==void 0?u($.data.value):void 0};return V(Oe,{source:e.source,testID:m,children:V(s,{data:U,onPress:t,isSelected:r})})}if(e.source==="redux"&&c){let $=e.originalEvent;return V(Oe,{source:e.source,testID:m,children:V(c,{action:$,onPress:()=>t()})})}if(e.source==="network"&&d){let $=e.originalEvent;return V(f,{testID:m,children:V(d,{event:$,onPress:()=>t()})})}if(e.source==="route"&&h){let $=e.originalEvent;return V(Oe,{source:e.source,testID:m,children:V(h,{event:$,visitNumber:0,isExpanded:a,onPress:()=>t(),onNavigate:o})})}if(e.source==="zustand"&&b)return V(Oe,{source:e.source,testID:m,children:V(b,{change:e.originalEvent,onPress:()=>t()})});if(e.source==="jotai"&&v)return V(Oe,{source:e.source,testID:m,children:V(v,{change:e.originalEvent,onPress:()=>t()})});let g=i&&l?V(bn,{label:i,color:l,testID:`${m}-correlation`}):null;return V(cn,{statusDotColor:p.color,statusLabel:p.label,primaryText:e.title,secondaryText:e.subtitle,badgeText:n>1&&!i?`${n}`:"",badgeColor:l||y,customBadge:g,bottomRightText:dn(new Date(e.timestamp)),showChevron:true,isSelected:r,onPress:t,testID:m})}),Dt=le.create({badgeWrapper:{position:"relative"},sourceBadge:{position:"absolute",top:4,right:12,paddingHorizontal:6,paddingVertical:2,borderRadius:4,zIndex:10},sourceBadgeText:{fontSize:8,fontWeight:"700",letterSpacing:.5}});function Sn(e,t){return e.correlationId?t.filter(r=>r.correlationId===e.correlationId&&r.id!==e.id).sort((r,a)=>r.timestamp-a.timestamp):[]}function Cn(e,t){return e.correlationId?t.some(r=>r.correlationId===e.correlationId&&r.id!==e.id):false}function wn(e,t){return e.correlationId?t.filter(r=>r.correlationId===e.correlationId).length:1}function yr(e){let t=new Map;for(let r of e)if(r.correlationId){let a=t.get(r.correlationId)||0;t.set(r.correlationId,a+1)}return t}function br(e,t){return t.filter(r=>r.correlationId===e).sort((r,a)=>{let o=r.sequenceInGroup??0,n=a.sequenceInGroup??0;return o!==n?o-n:r.timestamp-a.timestamp})}function vr(e,t){if(!e.correlationId)return null;let r=br(e.correlationId,t);if(r.length<=1)return null;let a=r.findIndex(o=>o.id===e.id);return a===-1?null:`${a+1}/${r.length}`}var Sr=["#EC4899","#8B5CF6","#3B82F6","#10B981","#F59E0B","#EF4444","#06B6D4","#84CC16"];function Cr(e){let t=0;for(let a=0;a<e.length;a++)t=(t<<5)-t+e.charCodeAt(a),t|=0;let r=Math.abs(t)%Sr.length;return Sr[r]}import{jsx as Fe,jsxs as Tt}from"react/jsx-runtime";var It=rn(function({events:e,selectedEventId:t,expandedEventId:r,onEventPress:a,onNavigate:o,isCapturing:n,hiddenEventsCount:i=0,onUpgradePress:l,searchText:s="",totalCount:u=0,sourceCount:c,enabledSourceCount:d}){let h=on(()=>yr(e),[e]),b=$t(({item:y})=>{let m=y.correlationId&&h.get(y.correlationId)||1,g=vr(y,e),$=y.correlationId?Cr(y.correlationId):void 0;return Fe(fr,{event:y,isSelected:y.id===t,isExpanded:y.id===r,onPress:()=>a(y),onNavigate:o,correlationCount:m,correlationLabel:g,correlationColor:$})},[t,r,a,o,h,e]),v=$t(y=>y.id,[]),p=$t(()=>i<=0?null:Tt(ge,{style:we.hiddenBanner,onPress:l,activeOpacity:.8,testID:`${S}-hidden-banner`,accessibilityRole:"button",accessibilityLabel:`${i} hidden event${i!==1?"s":""}, upgrade for the full history`,children:[Tt(f,{style:we.hiddenBannerLeft,children:[Fe(an,{size:16,color:at.color.accent}),Tt(k,{style:we.hiddenBannerText,testID:`${S}-hidden-count`,children:[i," hidden event",i!==1?"s":""]})]}),Fe(nn,{})]}),[i,l]);if(e.length===0){let y=c===0,m=d===0,g=y?{otto:"scanning",title:"No Event Sources",message:`This tool reports on the other Buoy tools.
2
+ Install one \u2014 network, storage, redux, routes \u2014 and its events land here.`}:m&&!s.trim()&&u>0?{otto:"filtering",title:"Every Source Is Off",message:`${u} event${u===1?" is":"s are"} captured. Turn a source chip back on to see them.`}:ln({subject:"events",search:s,total:u,capturing:n,blocked:m?"Every source chip is off, so there is nothing to search. Turn one back on.":void 0,waiting:{otto:"listening",title:"No Events Yet",message:`Events will appear here as they occur.
3
+ Try interacting with your app.`},paused:{title:"Not Capturing",message:"Event capture is paused. Resume to see events."}});return Fe(sn,{...g,testID:`${S}-empty`,style:we.emptyContainer})}return Fe(Qt,{data:e,renderItem:b,keyExtractor:v,testID:`${S}-list`,style:we.list,contentContainerStyle:we.listContent,ItemSeparatorComponent:()=>Fe(f,{style:we.separator}),ListFooterComponent:p,showsVerticalScrollIndicator:true,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,removeClippedSubviews:!(typeof process<"u"&&process.env?.EXPO_PUBLIC_E2E)})}),we=le.create({list:{flex:1,backgroundColor:"transparent"},listContent:{paddingVertical:16},separator:{height:8},emptyContainer:{flex:1,justifyContent:"center",backgroundColor:"transparent"},hiddenBanner:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginHorizontal:16,marginTop:8,marginBottom:16,paddingVertical:12,paddingHorizontal:16,backgroundColor:at.color.surface,borderRadius:8,borderWidth:1,borderColor:at.color.border},hiddenBannerLeft:{flexDirection:"row",alignItems:"center",gap:8},hiddenBannerText:{fontSize:13,fontWeight:"500",color:at.color.text}});import{loadToolModule as Ee,getToolModuleVersion as At}from"@buoy-gg/shared-ui/web/utils";import{memo as En,useMemo as wr}from"react";import{night as ce,formatRelativeTime as xn,copyToClipboard as $n,parseValue as kn,useIgnoredPatterns as Dn,monoFont as Tn}from"@buoy-gg/shared-ui/web";import{DataViewer as In}from"@buoy-gg/shared-ui/web/dataViewer";import{memo as An,useMemo as qn}from"react";import{buoyColors as oe,night as M,displayValue as Bn,monoFont as Re}from"@buoy-gg/shared-ui/web";import{DataViewer as nt}from"@buoy-gg/shared-ui/web/dataViewer";import{jsx as T,jsxs as H}from"react/jsx-runtime";var Fn={"query-fetch-start":{label:"Query Fetching",color:M.color.accent,icon:"hourglass"},"query-fetch-success":{label:"Query Success",color:oe.success,icon:"checkmark"},"query-fetch-error":{label:"Query Error",color:oe.error,icon:"close"},"query-invalidated":{label:"Query Invalidated",color:oe.warning,icon:"refresh"},"mutation-start":{label:"Mutation Started",color:M.color.accent,icon:"hourglass"},"mutation-success":{label:"Mutation Success",color:oe.success,icon:"checkmark"},"mutation-error":{label:"Mutation Error",color:oe.error,icon:"close"}},Er=An(function({event:e}){let t=e.originalEvent,r=Fn[t.type]||{label:t.type,color:M.color.textTertiary,icon:"help"},a=t.type.startsWith("query-"),o=t.type.startsWith("mutation-"),n=qn(()=>{let c=a?t.queryKey:t.mutationKey;return c?Bn(c,true):o&&t.mutationId!==void 0?`Mutation #${t.mutationId}`:"No key"},[t,a,o]),i=new Date(t.timestamp).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:true}),l=a?!!t.queryData:!!t.mutationData,s=a?!!t.queryError:!!t.mutationError,u=o&&!!t.mutationVariables;return H(ue,{style:E.container,contentContainerStyle:E.contentContainer,children:[T(f,{style:E.section,children:H(f,{style:[E.eventTypeContainer,{borderColor:r.color+"4D"}],children:[T(k,{style:[E.eventTypeHeader,{backgroundColor:r.color+"15",color:r.color}],children:r.label}),H(f,{style:E.eventTypeContent,children:[H(f,{style:E.keyRow,children:[T(ue,{horizontal:true,style:E.keyScrollView,children:T(k,{style:E.keyText,children:n})}),T(Rn,{type:t.type,color:r.color})]}),t.duration!==void 0&&H(f,{style:E.row,children:[T(k,{style:E.labelText,children:"Duration:"}),H(k,{style:E.valueText,children:[t.duration.toFixed(0),"ms"]})]}),H(f,{style:E.row,children:[T(k,{style:E.labelText,children:"Timestamp:"}),T(k,{style:E.valueText,children:i})]}),a&&t.queryHash&&H(f,{style:E.row,children:[T(k,{style:E.labelText,children:"Query Hash:"}),T(k,{style:[E.valueText,E.hashText],numberOfLines:1,children:t.queryHash})]}),o&&t.mutationId!==void 0&&H(f,{style:E.row,children:[T(k,{style:E.labelText,children:"Mutation ID:"}),H(k,{style:E.valueText,children:["#",t.mutationId]})]})]})]})}),u&&T(f,{style:E.section,children:H(f,{style:E.dataContainer,children:[T(k,{style:[E.dataHeader,{color:oe.warning}],children:"Variables"}),T(f,{style:E.dataContent,children:T(nt,{title:"",data:t.mutationVariables,showTypeFilter:true,rawMode:true,initialExpanded:true})})]})}),l&&T(f,{style:E.section,children:H(f,{style:E.dataContainer,children:[T(k,{style:[E.dataHeader,{color:oe.success}],children:a?"Query Data":"Mutation Result"}),T(f,{style:E.dataContent,children:T(nt,{title:"",data:a?t.queryData:t.mutationData,showTypeFilter:true,rawMode:true,initialExpanded:true})})]})}),s&&T(f,{style:E.section,children:H(f,{style:[E.dataContainer,E.errorContainer],children:[T(k,{style:[E.dataHeader,E.errorHeader],children:"Error"}),T(f,{style:E.dataContent,children:T(nt,{title:"",data:a?t.queryError:t.mutationError,showTypeFilter:true,rawMode:true,initialExpanded:true})})]})}),T(f,{style:E.section,children:H(f,{style:E.dataContainer,children:[T(k,{style:E.dataHeader,children:"Event Details"}),T(f,{style:E.dataContent,children:T(nt,{title:"",data:t,showTypeFilter:true,rawMode:true,initialExpanded:false})})]})})]})});function Rn({type:e,color:t}){let r=()=>e.includes("start")?"PENDING":e.includes("success")?"SUCCESS":e.includes("error")?"ERROR":e.includes("invalidated")?"INVALIDATED":e.toUpperCase();return T(f,{style:[E.statusChip,{backgroundColor:t+"15",borderColor:t+"33"}],children:T(k,{style:[E.statusChipText,{color:t}],children:r()})})}var E=le.create({container:{flex:1,backgroundColor:"transparent"},contentContainer:{padding:8,paddingBottom:24},section:{marginBottom:12},eventTypeContainer:{minWidth:200,backgroundColor:M.color.surface,borderRadius:6,borderWidth:1,overflow:"hidden",shadowColor:M.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},eventTypeHeader:{paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,borderBottomWidth:1,borderBottomColor:M.color.accentBorder,letterSpacing:.5,textTransform:"uppercase",fontFamily:Re},eventTypeContent:{padding:0},keyRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:M.color.separator},keyScrollView:{flex:1,marginRight:8},keyText:{fontSize:12,color:M.color.text,fontFamily:Re,lineHeight:18,backgroundColor:M.color.accentSoft,paddingHorizontal:8,paddingVertical:4,borderRadius:4,borderWidth:1,borderColor:M.color.accentBorderStrong},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:M.color.separator},labelText:{fontSize:10,color:M.color.textSecondary,fontWeight:"600",letterSpacing:.5,textTransform:"uppercase",fontFamily:Re},valueText:{fontSize:12,color:M.color.text,fontWeight:"500",fontVariant:["tabular-nums"],fontFamily:Re},hashText:{flex:1,textAlign:"right",marginLeft:8},statusChip:{paddingHorizontal:8,paddingVertical:4,borderWidth:1,borderRadius:6,alignSelf:"flex-start"},statusChipText:{fontSize:11,fontWeight:"600",textTransform:"uppercase",letterSpacing:.5,fontFamily:Re},dataContainer:{minWidth:200,backgroundColor:M.color.surface,borderRadius:6,borderWidth:1,borderColor:M.color.accentBorderStrong,overflow:"hidden",shadowColor:M.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},dataHeader:{backgroundColor:M.color.accentSoft,paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,color:M.color.accent,borderBottomWidth:1,borderBottomColor:M.color.accentBorder,letterSpacing:.5,textTransform:"uppercase",fontFamily:Re},dataContent:{padding:8},errorContainer:{borderColor:oe.error+"4D"},errorHeader:{backgroundColor:oe.error+"1A",color:oe.error,borderBottomColor:oe.error+"33"}});import{Fragment as jn,jsx as D,jsxs as Ue}from"react/jsx-runtime";function zn(){let e={StorageEventDetailContent:null,ReduxActionDetailContent:null,NetworkEventDetailView:null,RenderDetailView:null,ZustandStateDetailContent:null,JotaiAtomDetailContent:null,RouteEventDetail:null};try{let t=Ee("@buoy-gg/storage");e.StorageEventDetailContent=t.StorageEventDetailContent}catch{}try{let t=Ee("@buoy-gg/redux");e.ReduxActionDetailContent=t.ReduxActionDetailContent}catch{}try{let t=Ee("@buoy-gg/network");e.NetworkEventDetailView=t.NetworkEventDetailView}catch{}try{let t=Ee("@buoy-gg/highlight-updates");e.RenderDetailView=t.RenderDetailView}catch{}try{let t=Ee("@buoy-gg/zustand");e.ZustandStateDetailContent=t.ZustandStateDetailContent}catch{}try{let t=Ee("@buoy-gg/jotai");e.JotaiAtomDetailContent=t.JotaiAtomDetailContent}catch{}try{let t=Ee("@buoy-gg/route-events");e.RouteEventDetail=t.RouteEventDetail}catch{}return e}var qt,xr=-1;function Mn(){return(!qt||xr!==At())&&(qt=zn(),xr=At()),qt}var Pn={"storage-async":{label:"AsyncStorage",color:"#8B5CF6"},"storage-mmkv":{label:"MMKV",color:"#F59E0B"},redux:{label:"Redux",color:"#3B82F6"},network:{label:"Network",color:"#10B981"},"react-query":{label:"React Query",color:"#EC4899"},"react-query-query":{label:"Query",color:"#EC4899"},"react-query-mutation":{label:"Mutation",color:"#F97316"},route:{label:"Route",color:"#06B6D4"},zustand:{label:"Zustand",color:"#764ABC"},jotai:{label:"Jotai",color:"#14B8A6"},render:{label:"Render",color:"#F472B6"}};function Nn(e){return e==="storage-async"||e==="storage-mmkv"}function Vn(e){let t=kn(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 On({children:e}){return D(jn,{children:e})}var Bt=En(function({event:e,onBack:t,NetworkEventDetailViewComponent:r,networkDetailWrapper:a,RouteEventDetailComponent:o,detailComponents:n,onNavigate:i}){let l=wr(()=>({...Mn(),...n}),[n,At()]),s=Pn[e.source],u=new Date(e.timestamp),{values:c,toggle:d}=Dn(),h=wr(()=>{if(!Nn(e.source)||!l.StorageEventDetailContent)return null;let m=e.originalEvent,g={...m,timestamp:new Date(m.timestamp)};return{key:g.data?.key||"unknown",lastEvent:g,events:[g],totalOperations:1,currentValue:g.data?.value,valueType:Vn(g.data?.value),storageTypes:new Set([g.storageType||"async"])}},[e,l]);if(h&&l.StorageEventDetailContent){let{StorageEventDetailContent:m}=l;return D(f,{style:B.container,testID:`${S}-detail-storage`,children:D(m,{conversation:h,selectedEventIndex:0,onEventIndexChange:()=>{},disableInternalFooter:true})})}if(e.source==="redux"&&l.ReduxActionDetailContent){let{ReduxActionDetailContent:m}=l,g=e.originalEvent;return D(f,{style:B.container,testID:`${S}-detail-redux`,children:D(m,{action:g,actions:[g],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:true})})}let b=r??l.NetworkEventDetailView;if(e.source==="network"&&b){let m=e.originalEvent,g=a??On;return D(f,{style:B.container,children:D(g,{children:D(ue,{style:B.content,testID:`${S}-detail-network`,children:D(b,{event:m,ignoredPatterns:c,onTogglePattern:d})})})})}if(e.source==="react-query"||e.source==="react-query-query"||e.source==="react-query-mutation")return D(f,{style:B.container,testID:`${S}-detail-react-query`,children:D(Er,{event:e})});if(e.source==="zustand"&&l.ZustandStateDetailContent){let{ZustandStateDetailContent:m}=l,g=e.originalEvent;return D(f,{style:B.container,testID:`${S}-detail-zustand`,children:D(m,{change:g,changes:[g],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:true})})}if(e.source==="jotai"&&l.JotaiAtomDetailContent){let{JotaiAtomDetailContent:m}=l,g=e.originalEvent;return D(f,{style:B.container,testID:`${S}-detail-jotai`,children:D(m,{change:g,changes:[g],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:true})})}if(e.source==="render"&&l.RenderDetailView){let{RenderDetailView:m}=l,g=e.originalEvent;return D(f,{style:B.container,children:D(ue,{style:B.content,testID:`${S}-detail-render`,children:D(m,{render:g.render})})})}let v=o??l.RouteEventDetail;if(e.source==="route"&&v)return D(f,{style:B.container,children:D(f,{style:B.container,testID:`${S}-detail-route`,children:D(v,{event:e.originalEvent,onNavigate:i})})});let p=()=>e.originalEvent,y=async()=>{await $n({source:e.source,timestamp:u.toISOString(),title:e.title,subtitle:e.subtitle,data:p()})};return D(f,{style:B.container,testID:`${S}-detail`,children:Ue(ue,{style:B.content,contentContainerStyle:B.contentContainer,testID:`${S}-detail-scroll`,children:[D(f,{style:B.sourceBadgeRow,children:Ue(f,{style:[B.sourceBadge,{backgroundColor:s.color+"20"}],children:[D(f,{style:[B.sourceDot,{backgroundColor:s.color}]}),D(k,{style:[B.sourceLabel,{color:s.color}],testID:`${S}-detail-source`,children:s.label})]})}),D(k,{style:B.title,testID:`${S}-detail-title`,children:e.title}),D(k,{style:B.subtitle,testID:`${S}-detail-subtitle`,children:e.subtitle}),Ue(f,{style:B.timestampRow,children:[D(k,{style:B.timestampLabel,children:"Timestamp"}),Ue(k,{style:B.timestampValue,testID:`${S}-detail-timestamp`,children:[u.toLocaleTimeString()," (",xn(u),")"]})]}),Ue(f,{style:B.dataSection,children:[D(k,{style:B.sectionLabel,children:"Event Data"}),D(f,{style:B.dataContainer,testID:`${S}-detail-data`,children:D(In,{testIDPrefix:`${S}-detail-data`,data:p(),title:"",showTypeFilter:true,rawMode:true,initialExpanded:true})})]})]})})}),B=le.create({container:{flex:1,backgroundColor:"transparent"},content:{flex:1},contentContainer:{padding:16},sourceBadgeRow:{flexDirection:"row",marginBottom:12},sourceBadge:{flexDirection:"row",alignItems:"center",paddingHorizontal:10,paddingVertical:6,borderRadius:12,gap:6},sourceDot:{width:6,height:6,borderRadius:3},sourceLabel:{fontSize:12,fontWeight:"600"},title:{fontSize:24,fontWeight:"700",color:ce.color.text,marginBottom:4},subtitle:{fontSize:16,color:ce.color.textTertiary,marginBottom:16},timestampRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,borderTopWidth:1,borderTopColor:ce.color.border,borderBottomWidth:1,borderBottomColor:ce.color.border,marginBottom:16},timestampLabel:{fontSize:14,color:ce.color.textTertiary},timestampValue:{fontSize:14,color:ce.color.text,fontFamily:Tn},dataSection:{marginTop:8},sectionLabel:{fontSize:12,fontWeight:"600",color:ce.color.textTertiary,textTransform:"uppercase",letterSpacing:.5,marginBottom:8},dataContainer:{backgroundColor:ce.color.surface,borderRadius:8,borderWidth:1,borderColor:ce.color.border,overflow:"hidden"}});import{useCallback as je,useEffect as Un,useMemo as it,useState as Ft}from"react";import{DynamicFilterView as $r,macOSColors as Le,night as He,FileText as kr,FileCode as Dr,Hash as Ln,Zap as Hn,AlertTriangle as Jn,Settings as Wn,Eye as Kn,XCircle as Tr,GitBranch as Ir,ToolbarCopyButton as _n,useFeatureGate as Qn,ProFeatureBanner as Gn,ExportPreview as Zn,monoFont as Yn}from"@buoy-gg/shared-ui/web";import{DataViewer as Xn}from"@buoy-gg/shared-ui/web/dataViewer";var Je={timestampFormat:"relative",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:true,includeTotalDuration:true,includeEventData:false,dataSizeThreshold:5,format:"markdown",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true},We={llm:{timestampFormat:"relative",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:true,includeTotalDuration:true,includeEventData:false,dataSizeThreshold:5,format:"markdown",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true},bugReport:{timestampFormat:"both",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:true,includeTotalDuration:true,includeEventData:true,dataSizeThreshold:10,format:"markdown",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true},json:{timestampFormat:"absolute",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:false,includeTotalDuration:false,includeEventData:true,dataSizeThreshold:-1,format:"json",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:false,showStorageDiff:false,stripVerboseFields:false},errors:{timestampFormat:"relative",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:true,includeTotalDuration:false,includeEventData:true,dataSizeThreshold:10,format:"markdown",filterMode:"errors",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true},minimal:{timestampFormat:"relative",includeSource:false,includeStatus:true,includeTitle:true,includeSubtitle:false,includeCorrelation:false,includeDuration:false,includeSummaryHeader:false,includeTotalDuration:false,includeEventData:false,dataSizeThreshold:1,format:"plaintext",filterMode:"all",filterSources:[],compactMode:true,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:false,stripVerboseFields:true},mermaid:{timestampFormat:"relative",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:false,includeCorrelation:true,includeDuration:true,includeSummaryHeader:false,includeTotalDuration:false,includeEventData:false,dataSizeThreshold:1,format:"mermaid",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true}};function Ar(e){for(let[t,r]of Object.entries(We))if(Object.keys(r).every(a=>{let o=e[a],n=r[a];return Array.isArray(o)&&Array.isArray(n)?o.length===n.length&&o.every((i,l)=>i===n[l]):o===n}))return t;return null}var P={llm:{label:"LLM",description:"AI-ready format",color:"#10B981"},bugReport:{label:"Bug Report",description:"Full context",color:"#EF4444"},json:{label:"JSON",description:"Machine-readable",color:"#F59E0B"},errors:{label:"Errors",description:"Failed only",color:"#EF4444"},minimal:{label:"Minimal",description:"Quick reference",color:"#6B7280"},mermaid:{label:"Diagram",description:"Visual flow",color:"#A855F7"}};var ze={success:"\u2705",pending:"\u23F3",error:"\u274C",neutral:"\u2796"},ei={success:"[OK]",pending:"[...]",error:"[ERR]",neutral:"[-]"},Rt={"storage-async":"Storage","storage-mmkv":"MMKV",redux:"Redux",network:"Network","react-query":"Query","react-query-query":"Query","react-query-mutation":"Mutation",route:"Route",zustand:"Zustand",jotai:"Jotai",render:"Render"};function xe(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}}function $e(e){if(e==null)return e;if(typeof e=="string")return xe(e);if(Array.isArray(e))return e.map($e);if(typeof e=="object"){let t={};for(let[r,a]of Object.entries(e))t[r]=$e(a);return t}return e}var ti=new Set(["image","imageUrl","imageURL","image_url","thumbnail","thumbnailUrl","thumbnail_url","icon","iconUrl","avatar","avatarUrl","photo","photoUrl","picture","pictureUrl","description","desc","longDescription","shortDescription","meta_description"]);function jt(e){if(e==null)return e;if(Array.isArray(e))return e.map(jt);if(typeof e=="object"){let t={};for(let[r,a]of Object.entries(e))ti.has(r)||typeof a=="string"&&ri(a)||(t[r]=jt(a));return t}return e}function ri(e){if(!e.startsWith("http"))return false;let t=e.toLowerCase();return t.includes("/photo")||t.includes("/image")||t.includes("unsplash.com")||t.includes("cloudinary.com")||t.includes("imgur.com")||/\.(jpg|jpeg|png|gif|webp|svg|bmp)(\?|$)/i.test(e)}function oi(e){if(e instanceof Date)return e.toISOString();if(!(e&&typeof e=="object"&&Object.keys(e).length===0))return e}function ai(e,t){let r=s=>{if(typeof s!="object"||s===null)return null;let u=s;return typeof u.id=="string"?u.id:typeof u.orderId=="string"?u.orderId:typeof u.key=="string"?u.key:null},a=new Set(e.map(r).filter(Boolean)),o=new Set(t.map(r).filter(Boolean));if(a.size===0&&o.size===0)return null;let n=t.filter(s=>{let u=r(s);return u&&!a.has(u)}),i=e.filter(s=>{let u=r(s);return u&&!o.has(u)}),l=t.length-n.length;return n.length+i.length<e.length&&n.length+i.length<t.length?{added:n,removed:i,unchanged:l}:null}function ni(e,t){let r={};if(e.action&&(r.action=e.action),e.storageType&&(r.storageType=e.storageType),e.timestamp!==void 0){let a=oi(e.timestamp);a!==void 0&&(r.timestamp=a)}if(e.data){let a={...e.data};if(t.smartJsonParsing&&(a.value!==void 0&&(a.value=xe(a.value)),a.prevValue!==void 0&&(a.prevValue=xe(a.prevValue))),t.showStorageDiff&&Array.isArray(a.value)&&Array.isArray(a.prevValue)){let o=ai(a.prevValue,a.value);if(o){let n={key:a.key};return o.added.length>0&&(n.added=o.added),o.removed.length>0&&(n.removed=o.removed),o.unchanged>0&&(n.unchangedCount=o.unchanged),r.data=n,r}}r.data=a}return r}function ii(e,t){if(!t.reduxChangedOnly)return t.smartJsonParsing?$e(e):e;let r={};if(e.type&&(r.type=e.type),e.payload&&(r.payload=t.smartJsonParsing?$e(e.payload):e.payload),e.sliceName&&(r.sliceName=e.sliceName),e.actionName&&(r.actionName=e.actionName),e.duration&&(r.duration=e.duration),e.hasStateChange!==void 0&&(r.hasStateChange=e.hasStateChange),e.diffSummary&&(r.diffSummary=e.diffSummary),e.changedKeysCount!==void 0&&(r.changedKeysCount=e.changedKeysCount),e.hasStateChange===true){let a=e.sliceName;if(a&&e.prevState&&e.nextState){let o=e.prevState,n=e.nextState;(o[a]!==void 0||n[a]!==void 0)&&(r.stateChange={slice:a,before:o[a],after:n[a]})}}return r}function qr(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.name=="string"?t.name:typeof t.id=="string"?t.id:typeof t.key=="string"?t.key:null}function Ke(e,t){let r=typeof e=="string"?xe(e):e,a=typeof t=="string"?xe(t):t;if(r==null&&a!==null&&a!==void 0)return"Created";if(r!=null&&a==null)return"Deleted";if(Array.isArray(r)&&Array.isArray(a)){let o=r.length,n=a.length,i=r.map(qr).filter(Boolean),l=a.map(qr).filter(Boolean);if(o===n&&o>0){let s=new Set(i),u=new Set(l),c=i.filter(d=>u.has(d));if(c.length===0&&i.length>0&&l.length>0)return`\u26A0\uFE0F Replaced: [${i.join(", ")}] \u2192 [${l.join(", ")}]`;if(c.length<o){let d=i.filter(b=>!u.has(b)),h=l.filter(b=>!s.has(b));return`Changed: -${d.join(", ")} +${h.join(", ")}`}}if(o===0&&n>0)return l.length>0?`Added: [${l.join(", ")}]`:`Added ${n} item${n>1?"s":""}`;if(o>0&&n===0)return i.length>0?`Removed all: [${i.join(", ")}]`:`Removed all ${o} item${o>1?"s":""}`;if(n>o){let s=new Set(i),u=l.filter(c=>!s.has(c));return u.length>0?`Added: [${u.join(", ")}] (${o} \u2192 ${n})`:`Added ${n-o} item${n-o>1?"s":""} (${o} \u2192 ${n})`}if(n<o){let s=new Set(l),u=i.filter(c=>!s.has(c));return u.length>0?`Removed: [${u.join(", ")}] (${o} \u2192 ${n})`:`Removed ${o-n} item${o-n>1?"s":""} (${o} \u2192 ${n})`}return`Updated (${n} item${n>1?"s":""})`}if(typeof r=="object"&&typeof a=="object"&&r&&a){let o=Object.keys(r),n=Object.keys(a),i=n.filter(s=>!o.includes(s)),l=o.filter(s=>!n.includes(s));return i.length>0&&l.length>0?`+${i.length} -${l.length} keys`:i.length>0?`Added: ${i.join(", ")}`:l.length>0?`Removed: ${l.join(", ")}`:"Updated"}return null}function si(e,t){let r={};if(e.id&&(r.id=e.id),e.type&&(r.type=e.type),e.timestamp&&(r.timestamp=e.timestamp),e.queryKey&&(r.queryKey=e.queryKey),e.mutationKey&&(r.mutationKey=e.mutationKey),e.mutationId&&(r.mutationId=e.mutationId),e.duration&&(r.duration=e.duration),e.queryData!==void 0&&(r.data=t.smartJsonParsing?$e(e.queryData):e.queryData),e.variables!==void 0&&(r.variables=t.smartJsonParsing?$e(e.variables):e.variables),e.queryError!==void 0){let a=e.queryError;a&&typeof a=="object"?r.error=a.message||a.name||a:r.error=e.queryError}if(e.mutationError!==void 0){let a=e.mutationError;a&&typeof a=="object"?r.error=a.message||a.name||a:r.error=e.mutationError}if(e.query&&typeof e.query=="object"){let a=e.query;if(a.state&&typeof a.state=="object"){let o=a.state;if(o.status&&(r.status=o.status),o.fetchStatus&&(r.fetchStatus=o.fetchStatus),o.error){let n=o.error;n&&typeof n=="object"&&(r.error=n.message||n.name||n)}}}if(e.mutation&&typeof e.mutation=="object"){let a=e.mutation;if(a.state&&typeof a.state=="object"){let o=a.state;if(o.status&&(r.status=o.status),o.failureCount&&(r.failureCount=o.failureCount),o.error){let n=o.error;n&&typeof n=="object"&&(r.error=n.message||n.name||n)}if(o.failureReason){let n=o.failureReason;n&&typeof n=="object"&&(r.failureReason=n.message||n.name||n)}}}return r}function st(e,t){let r=e.originalEvent;if(!r)return null;let a;return e.source==="storage-async"||e.source==="storage-mmkv"?a=ni(r,t):e.source==="redux"?a=ii(r,t):e.source==="react-query"||e.source==="react-query-query"||e.source==="react-query-mutation"?a=si(r,t):t.smartJsonParsing?a=$e(r):a=r,t.stripVerboseFields&&a&&(a=jt(a)),a}function _e(e){let t={totalEvents:e.length,success:0,pending:0,error:0,neutral:0,durationMs:0,sources:new Set};if(e.length===0)return t;let r=1/0,a=-1/0;for(let o of e)t[o.status]++,t.sources.add(o.source),o.timestamp<r&&(r=o.timestamp),o.timestamp>a&&(a=o.timestamp);return t.durationMs=a-r,t}function Qe(e,t){let r=[...e];if(t.filterMode!=="all"&&(r=r.filter(a=>{switch(t.filterMode){case"errors":return a.status==="error";case"success":return a.status==="success";case"pending":return a.status==="pending";default:return true}})),t.filterSources.length>0){let a=new Set(t.filterSources);r=r.filter(o=>a.has(o.source))}return r}function zt(e){return e<1e3?`+${e}ms`:e<6e4?`+${(e/1e3).toFixed(1)}s`:`+${(e/6e4).toFixed(1)}m`}function Br(e){return new Date(e).toISOString()}function lt(e,t,r){let a=zt(e-t),o=Br(e);switch(r){case"relative":return a;case"absolute":return o;case"both":return`${a} (${o})`}}function Mt(e,t){let r=0,a=[e],o=new Set;for(;a.length>0;){if(r>t)return{over:true,approxBytes:r};let n=a.pop();if(n==null)r+=4;else if(typeof n=="string")r+=n.length+2;else if(typeof n=="number")r+=8;else if(typeof n=="boolean")r+=5;else if(typeof n=="object"){if(o.has(n))continue;if(o.add(n),Array.isArray(n)){r+=2+n.length;for(let i=0;i<n.length;i++)a.push(n[i])}else{r+=2;for(let i in n)r+=i.length+4,a.push(n[i])}}else r+=4}return{over:r>t,approxBytes:r}}function ut(e,t){if(t===-1)return{data:e,truncated:false};let{over:r,approxBytes:a}=Mt(e,t*1024);if(r)return{data:`[Data truncated - \u2265${(a/1024).toFixed(1)}KB exceeds ${t}KB limit]`,truncated:true};try{return JSON.stringify(e),{data:e,truncated:false}}catch{return{data:"[Unable to serialize data]",truncated:true}}}function Fr(e,t){let r=0;for(let a of e)if(t.includeSource&&(r+=20),t.includeStatus&&(r+=10),t.includeTitle&&(r+=(a.title?.length||0)+10),t.includeSubtitle&&(r+=(a.subtitle?.length||0)+10),t.includeCorrelation&&(r+=20),t.includeDuration&&(r+=15),r+=30,t.includeEventData&&a.originalEvent){let o=t.dataSizeThreshold===-1?1048576:t.dataSizeThreshold*1024,{approxBytes:n}=Mt(a.originalEvent,o);r+=Math.min(n,o)}return t.includeSummaryHeader&&(r+=100),t.includeTotalDuration&&(r+=50),t.format==="markdown"&&(r*=1.2),t.format==="json"&&(r*=1.3),Math.round(r)}function li(e,t,r){let a=[],o=lt(e.timestamp,t,r.timestampFormat);if(a.push(`\`${o}\``),r.includeStatus&&a.push(ze[e.status]),r.includeSource&&a.push(`**${Rt[e.source]}**`),r.includeTitle&&a.push(e.title),r.showStorageDiff&&(e.source==="storage-async"||e.source==="storage-mmkv")){let n=e.originalEvent;if(n?.data){let i=n.data,l=Ke(i.prevValue,i.value);l&&a.push(`\u2192 ${l}`)}}return e.source==="redux"&&e.originalEvent?.hasStateChange===false&&a.push("(no state change)"),r.includeSubtitle&&e.subtitle&&a.push(`- ${e.subtitle}`),a.join(" ")}function ui(e,t){let r=[],a=e.originalEvent;if(!a?.data)return r;let o=a.data,n=t.smartJsonParsing?xe(o.prevValue):o.prevValue,i=t.smartJsonParsing?xe(o.value):o.value,l=Ke(o.prevValue,o.value);if(l&&r.push(` **Change:** ${l}`),Array.isArray(n)&&Array.isArray(i)){let s=n.map(c=>typeof c=="object"&&c&&"name"in c?c.name:null).filter(Boolean),u=i.map(c=>typeof c=="object"&&c&&"name"in c?c.name:null).filter(Boolean);(s.length>0||u.length>0)&&(s.length>0&&r.push(` Before: [${s.join(", ")}]`),r.push(` After: [${u.join(", ")}]`))}return r}function Pt(e,t){let r=Qe(e,t);if(r.length===0)return"No events to export.";let a=[...r].sort((s,u)=>s.timestamp-u.timestamp),o=a[0].timestamp,n=_e(a),i=[];if(i.push("## Event Flow"),t.includeSummaryHeader||t.includeTotalDuration){let s=[];if(t.includeTotalDuration&&s.push(`**Duration:** ${zt(n.durationMs).replace("+","")}`),s.push(`**Events:** ${n.totalEvents}`),t.includeSummaryHeader){let u=[];n.success>0&&u.push(`${n.success} ${ze.success}`),n.pending>0&&u.push(`${n.pending} ${ze.pending}`),n.error>0&&u.push(`${n.error} ${ze.error}`),n.neutral>0&&u.push(`${n.neutral} ${ze.neutral}`),u.length>0&&s.push(`**Status:** ${u.join(" ")}`)}i.push(s.join(" | "))}if(i.push(""),i.push("### Timeline"),i.push(""),t.compactMode)return a.forEach((s,u)=>{i.push(`${u+1}. ${li(s,o,t)}`)}),i.join(`
4
+ `);a.forEach((s,u)=>{let c=[],d=lt(s.timestamp,o,t.timestampFormat);if(c.push(`${u+1}. \`${d}\``),t.includeStatus&&c.push(ze[s.status]),t.includeSource&&c.push(`**${Rt[s.source]}**`),t.includeTitle&&c.push(s.title),t.includeCorrelation&&s.correlationId&&s.sequenceInGroup&&c.push(`(${s.sequenceInGroup})`),i.push(c.join(" ")),t.includeSubtitle&&s.subtitle&&i.push(` \u2514\u2500 ${s.subtitle}`),t.showStorageDiff&&!t.includeEventData&&(s.source==="storage-async"||s.source==="storage-mmkv")){let h=ui(s,t);i.push(...h)}if(t.includeEventData&&s.originalEvent){let h=st(s,t),{data:b,truncated:v}=ut(h,t.dataSizeThreshold);if(v)i.push(` \u2514\u2500 ${b}`);else{if(t.showStorageDiff&&(s.source==="storage-async"||s.source==="storage-mmkv")){let p=s.originalEvent;if(p?.data){let y=p.data,m=Ke(y.prevValue,y.value);m&&i.push(` **Change:** ${m}`)}}i.push(" ```json"),i.push(` ${JSON.stringify(b,null,2).split(`
6
5
  `).join(`
7
- `)}`),i.push(" ```")}}i.push("")});let u=r.filter(a=>a.status==="error");if(u.length>0&&e.includeEventData){i.push("---"),i.push(""),i.push("### Errors"),i.push("");for(let a of u){let c=yt(a.timestamp,o,e.timestampFormat);if(i.push(`**${a.title}** (${c})`),a.originalEvent){let l=gt(a,e),{data:d,truncated:f}=bt(l,e.dataSizeThreshold);f||(i.push("```json"),i.push(JSON.stringify(d,null,2)),i.push("```"))}i.push("")}}return i.join(`
8
- `)}function Jn(t,e){let n=tt(t,e);if(n.length===0)return"[]";let r=[...n].sort((u,a)=>u.timestamp-a.timestamp),o=r[0].timestamp,s=Be(r),i={exportedAt:new Date().toISOString()};return e.includeSummaryHeader&&(i.summary={totalEvents:s.totalEvents,success:s.success,pending:s.pending,error:s.error,neutral:s.neutral,durationMs:s.durationMs,sources:Array.from(s.sources)}),i.events=r.map(u=>{let a={};if(a.timestamp=Wn(u.timestamp),(e.timestampFormat==="relative"||e.timestampFormat==="both")&&(a.relativeMs=u.timestamp-o),e.includeSource&&(a.source=u.source),e.includeStatus&&(a.status=u.status),e.includeTitle&&(a.title=u.title),e.includeSubtitle&&(a.subtitle=u.subtitle),e.includeCorrelation&&u.correlationId&&(a.correlationId=u.correlationId,a.sequenceInGroup=u.sequenceInGroup),e.includeEventData&&u.originalEvent){let c=gt(u,e),{data:l,truncated:d}=bt(c,e.dataSizeThreshold);if(a.data=l,d&&(a.dataTruncated=!0),e.showStorageDiff&&(u.source==="storage-async"||u.source==="storage-mmkv")){let f=u.originalEvent;if(f?.data){let b=f.data,v=et(b.prevValue,b.value);v&&(a.changeSummary=v)}}}return a}),JSON.stringify(i,null,2)}function Kn(t,e){let n=tt(t,e);if(n.length===0)return"No events to export.";let r=[...n].sort((u,a)=>u.timestamp-a.timestamp),o=r[0].timestamp,s=Be(r),i=[];if(e.includeSummaryHeader||e.includeTotalDuration){let u=[`Event Flow (${s.totalEvents} events`];if(e.includeTotalDuration&&(u[0]+=`, ${sn(s.durationMs).replace("+","")}`),u[0]+=")",i.push(u[0]),e.includeSummaryHeader){let a=[];s.success>0&&a.push(`${s.success} success`),s.pending>0&&a.push(`${s.pending} pending`),s.error>0&&a.push(`${s.error} error`),s.neutral>0&&a.push(`${s.neutral} neutral`),a.length>0&&i.push(a.join(", "))}i.push("")}for(let u of r){let a=[],c=yt(u.timestamp,o,e.timestampFormat);if(a.push(c.padEnd(12)),e.includeStatus&&a.push(Ri[u.status]),e.includeSource&&a.push(`${on[u.source]}:`),e.includeTitle&&a.push(u.title),e.showStorageDiff&&(u.source==="storage-async"||u.source==="storage-mmkv")){let l=u.originalEvent;if(l?.data){let d=l.data,f=et(d.prevValue,d.value);f&&a.push(`-> ${f}`)}}if(u.source==="redux"&&u.originalEvent?.hasStateChange===!1&&a.push("(no change)"),e.includeSubtitle&&u.subtitle&&a.push(`- ${u.subtitle}`),i.push(a.join(" ")),e.includeEventData&&u.originalEvent){let l=gt(u,e),{data:d,truncated:f}=bt(l,e.dataSizeThreshold);f?i.push(` ${d}`):i.push(` Data: ${JSON.stringify(d)}`)}}return i.join(`
9
- `)}var en=[{id:"U",icon:"\u{1F464}",label:"User",sources:[],group:"client"},{id:"App",icon:"\u{1F4F1}",label:"App",sources:["route","render"],group:"client"},{id:"Async",icon:"\u{1F4BE}",label:"AsyncStorage",sources:["storage-async"],group:"client"},{id:"MMKV",icon:"\u26A1",label:"MMKV",sources:["storage-mmkv"],group:"client"},{id:"Redux",icon:"\u{1F504}",label:"Redux",sources:["redux"],group:"client"},{id:"API",icon:"\u{1F310}",label:"API",sources:["network"],group:"server"},{id:"Cache",icon:"\u{1F4E6}",label:"QueryCache",sources:["react-query","react-query-query","react-query-mutation"],group:"server"}];function Oi(t){let e=new Set;for(let r of t)e.add(r.source);let n=[];n.push(en[0]),n.push(en[1]);for(let r of en.slice(2))r.sources.some(o=>e.has(o))&&n.push(r);return n}function Bi(t){let e=t.some(r=>r.group==="client"),n=t.some(r=>r.group==="server");return e&&n&&t.length>=3}function Ae(t){return t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(1)}s`:`${(t/6e4).toFixed(1)}m`}function Xe(t){return t.replace(/[#;:]/g," ").replace(/[\n\r]/g," ").replace(/"/g,"'").replace(/\s+/g," ").trim()}function Li(t){let e=["last-route","@dev/last","__debug","_persist","devtools/internal"],n=t.toLowerCase();return e.some(r=>n.includes(r))}function rn(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}function zi(t){return an(t,1024*1024).approxBytes}function _i(t){try{let e=new URL(t,"http://localhost");return["timestamp","t","_t","debug","client","version","cache","_"].forEach(r=>e.searchParams.delete(r)),e.pathname+(e.searchParams.toString()?"?"+e.searchParams.toString():"")}catch{return t}}function ji(t){let e=t.replace(/^@[\w-]+\//,"").replace(/^devtools\//,"").replace(/^dev\//,"").replace(/^buoy\//,"").replace(/^pokemon\//,""),n=e.split("/").filter(Boolean);return n.length>1&&(e=n.slice(-1).join("/")),e=e.replace(/-/g," ").replace(/_/g," "),e=e.split(" ").map(r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(" "),e.toLowerCase()==="saved"&&(e="Favorites"),e.substring(0,20)}function Qn(t){let e=t;try{e=new URL(t,"http://localhost").pathname}catch{let r=e.indexOf("?");r>0&&(e=e.substring(0,r))}let n=e.split("/").filter(Boolean);if(n.length>=2){let r=n[n.length-1];return/^\d+$/.test(r)||/^[a-f0-9-]{36}$/i.test(r)?null:r.charAt(0).toUpperCase()+r.slice(1)}return n.length===1?n[0].charAt(0).toUpperCase()+n[0].slice(1):null}function Hi(t,e){try{let n=new URL(e,"http://localhost"),r=n.pathname;if(r.includes("graphql"))return"GraphQL Request";r=r.replace(/^\/api\/v\d+/,"").replace(/^\/api/,"");let o=Qn(r),s=r.split("/").filter(Boolean),i=s[0]?s[0].charAt(0).toUpperCase()+s[0].slice(1):"Data",u=n.searchParams.has("q")||n.searchParams.has("query")||n.searchParams.has("search");switch(t.toUpperCase()){case"GET":if(u){let a=n.searchParams.get("q")||n.searchParams.get("query")||n.searchParams.get("search");return a?`Search "${a}"`:`Search ${i}`}return o?`Fetch ${o}`:`Fetch ${i}`;case"POST":return r.includes("search")?`Search ${i}`:o?`Create ${o}`:`Create ${i}`;case"PUT":case"PATCH":return o?`Update ${o}`:`Update ${i}`;case"DELETE":return o?`Delete ${o}`:`Delete ${i}`;default:return`${t} ${i}`}}catch{return`${t} request`}}function Hn(t){if(t==="/"||t==="")return"Home";let e=t.split("/").filter(Boolean);if(e.length===0)return"Home";if(e.length===1)return`${e[0].charAt(0).toUpperCase()+e[0].slice(1)} List`;if(e.length>=2){let n=e[e.length-1];return/^\d+$/.test(n)?`${e[0].charAt(0).toUpperCase()+e[0].slice(1)} #${n}`:`${n.charAt(0).toUpperCase()+n.slice(1)} Details`}return t}function Wi(t,e,n){let r=[],o=[],s=Ae(t.timestamp-n);switch(t.source){case"route":{let i=t.originalEvent,u=String(i?.pathname||t.title),a=i?.previousPathname,c=i?.timeSincePrevious,l=Hn(u),d=a?Hn(a):null;d?(r.push(`U->>App: ${d} \u2192 ${l}`),c&&c>0&&o.push(`Note right of App: ${Ae(c)} on ${d}`)):r.push(`U->>App: Open ${l}`);break}case"network":{let i=t.originalEvent,u=i?.method||"GET",a=i?.url||"",c=i?.status,l=i?.duration,d=i?.response||i?.data||i?.body,f=i?.responseSize||i?.size||i?.contentLength,b=Hi(u,a),v=Qn(a);if(r.push(`App->>+API: ${b}`),t.status==="error"){let w=c?`${c} Error`:"Failed";r.push(`API--x-App: ${w}`)}else{let w=v?`\u2713 ${v}`:"\u2713 Success";r.push(`API-->>-App: ${w}`)}let m=[];if(l&&m.push(Ae(l)),f&&f>0)m.push(rn(f));else if(d){let w=zi(d);w>1024&&m.push(rn(w))}m.length>0&&o.push(`Note right of API: ${m.join(" \xB7 ")}`);break}case"storage-async":case"storage-mmkv":{let i=t.originalEvent,u=i?.data,a=i?.action||"access",c=u?.key||"data";if(Li(c))return{messages:[],notes:[],skip:!0};let l=ji(c),d=t.source==="storage-mmkv"?"MMKV":"Async",f=C=>{if(typeof C=="string")return C;if(typeof C=="number")return String(C);if(typeof C=="object"&&C){if("name"in C)return String(C.name);if("id"in C)return String(C.id)}return null},b=C=>C.charAt(0).toUpperCase()+C.slice(1),v="",m="",w="",y="",g=u?.prevValue,S=u?.value;if(Array.isArray(g)&&Array.isArray(S)){let C=g.length,U=S.length;if(y=`${C} \u2192 ${U} items`,U>C){v="\u2795",m="Add";let T=new Set(g.map(f).filter(Boolean));for(let F of S){let B=f(F);if(B&&!T.has(B)){w=b(B);break}}}else if(U<C){v="\u2796",m="Remove";let T=new Set(S.map(f).filter(Boolean));for(let F of g){let B=f(F);if(B&&!T.has(B)){w=b(B);break}}}else v="\u{1F4DD}",m="Update"}else if(Array.isArray(S)&&(!g||Array.isArray(g)&&g.length===0)){if(v="\u2795",m="Add",y=`\u2192 ${S.length} items`,S.length>0){let C=f(S[0]);C&&(w=b(C))}}else Array.isArray(g)&&(!S||Array.isArray(S)&&S.length===0)?(v="\u2796",m="Clear",y=`${g.length} \u2192 0 items`):a==="getItem"?(v="\u{1F4D6}",m="Load"):a==="removeItem"?(v="\u2796",m="Remove"):a==="clear"?(v="\u{1F5D1}\uFE0F",m="Clear"):(v="\u{1F4BE}",m="Save");let $;w?$=`App->>${d}: ${v} ${m} ${w} \u2192 ${l}`:$=`App->>${d}: ${v} ${m} ${l}`,r.push($),y&&o.push(`Note right of ${d}: ${y}`);break}case"react-query":case"react-query-query":{let i=t.originalEvent,u=i?.type||"",a=i?.queryKey,c=i?.duration,l="data";if(Array.isArray(a)&&a.length>0){let d=a[a.length-1];typeof d=="string"&&!/^\d+$/.test(d)?l=d.charAt(0).toUpperCase()+d.slice(1):a.length>1&&typeof a[0]=="string"&&(l=a[0].charAt(0).toUpperCase()+a[0].slice(1))}if(u.includes("start")||u.includes("fetch")||t.status==="pending")r.push(`App->>+Cache: Fetch ${l}`);else if(t.status==="error")r.push("Cache--x-App: Failed to load");else if(t.status==="success"){let d=`\u2713 ${l} ready`;c&&(d+=` (${Ae(c)})`),r.push(`Cache-->>-App: ${d}`)}else u.includes("invalidate")?r.push(`App->>Cache: Refresh ${l}`):r.push(`Cache-->>App: ${Xe(u)}`);break}case"react-query-mutation":{let i=t.originalEvent,u=i?.type||"",a=i?.mutationKey,c=i?.duration,l="Update";if(Array.isArray(a)&&a.length>0){let d=String(a[0]);d.includes("add")||d.includes("create")?l="Add":d.includes("delete")||d.includes("remove")?l="Delete":d.includes("update")||d.includes("edit")?l="Update":l=d.charAt(0).toUpperCase()+d.slice(1)}if(u.includes("start")||u.includes("loading")||t.status==="pending")r.push(`App->>+Cache: ${l}`);else if(t.status==="error")r.push(`Cache--x-App: ${l} failed`);else if(t.status==="success"){let d=`\u2713 ${l} complete`;c&&(d+=` (${Ae(c)})`),r.push(`Cache-->>-App: ${d}`)}break}case"redux":{let i=t.originalEvent,u=i?.type||t.title,a=i?.hasStateChange,c=i?.diffSummary,l=u.split("/"),d;if(l.length>=2){let f=l[0].charAt(0).toUpperCase()+l[0].slice(1),b=l[1].replace(/([A-Z])/g," $1").replace(/(pending|fulfilled|rejected)$/i,"").trim();b=b.charAt(0).toUpperCase()+b.slice(1),d=`${b} (${f})`}else d=Xe(u).substring(0,25);r.push(`App->>Redux: ${d}`),a===!1?o.push("Note right of Redux: No change"):c&&o.push(`Note right of Redux: ${Xe(c).substring(0,35)}`);break}case"render":{let u=t.originalEvent?.renderData,a=Xe(t.title).substring(0,20),c=u?.cause||"update",l=c==="mount"?"mounted":c==="props"?"props changed":c==="state"?"state changed":c==="context"?"context changed":c==="parent"?"parent re-rendered":c==="hooks"?"hook changed":c;r.push(`App->>App: Render ${a}`),o.push(`Note right of App: ${l}`);break}default:r.push(`App->>App: ${Xe(t.title).substring(0,30)}`)}return{messages:r,notes:o}}function Gn(t,e){let n=tt(t,e);if(n.length===0)return`sequenceDiagram
6
+ `)}`),i.push(" ```")}}i.push("")});let l=a.filter(s=>s.status==="error");if(l.length>0&&t.includeEventData){i.push("---"),i.push(""),i.push("### Errors"),i.push("");for(let s of l){let u=lt(s.timestamp,o,t.timestampFormat);if(i.push(`**${s.title}** (${u})`),s.originalEvent){let c=st(s,t),{data:d,truncated:h}=ut(c,t.dataSizeThreshold);h||(i.push("```json"),i.push(JSON.stringify(d,null,2)),i.push("```"))}i.push("")}}return i.join(`
7
+ `)}function Rr(e,t){let r=Qe(e,t);if(r.length===0)return"[]";let a=[...r].sort((l,s)=>l.timestamp-s.timestamp),o=a[0].timestamp,n=_e(a),i={exportedAt:new Date().toISOString()};return t.includeSummaryHeader&&(i.summary={totalEvents:n.totalEvents,success:n.success,pending:n.pending,error:n.error,neutral:n.neutral,durationMs:n.durationMs,sources:Array.from(n.sources)}),i.events=a.map(l=>{let s={};if(s.timestamp=Br(l.timestamp),(t.timestampFormat==="relative"||t.timestampFormat==="both")&&(s.relativeMs=l.timestamp-o),t.includeSource&&(s.source=l.source),t.includeStatus&&(s.status=l.status),t.includeTitle&&(s.title=l.title),t.includeSubtitle&&(s.subtitle=l.subtitle),t.includeCorrelation&&l.correlationId&&(s.correlationId=l.correlationId,s.sequenceInGroup=l.sequenceInGroup),t.includeEventData&&l.originalEvent){let u=st(l,t),{data:c,truncated:d}=ut(u,t.dataSizeThreshold);if(s.data=c,d&&(s.dataTruncated=true),t.showStorageDiff&&(l.source==="storage-async"||l.source==="storage-mmkv")){let h=l.originalEvent;if(h?.data){let b=h.data,v=Ke(b.prevValue,b.value);v&&(s.changeSummary=v)}}}return s}),JSON.stringify(i,null,2)}function jr(e,t){let r=Qe(e,t);if(r.length===0)return"No events to export.";let a=[...r].sort((l,s)=>l.timestamp-s.timestamp),o=a[0].timestamp,n=_e(a),i=[];if(t.includeSummaryHeader||t.includeTotalDuration){let l=[`Event Flow (${n.totalEvents} events`];if(t.includeTotalDuration&&(l[0]+=`, ${zt(n.durationMs).replace("+","")}`),l[0]+=")",i.push(l[0]),t.includeSummaryHeader){let s=[];n.success>0&&s.push(`${n.success} success`),n.pending>0&&s.push(`${n.pending} pending`),n.error>0&&s.push(`${n.error} error`),n.neutral>0&&s.push(`${n.neutral} neutral`),s.length>0&&i.push(s.join(", "))}i.push("")}for(let l of a){let s=[],u=lt(l.timestamp,o,t.timestampFormat);if(s.push(u.padEnd(12)),t.includeStatus&&s.push(ei[l.status]),t.includeSource&&s.push(`${Rt[l.source]}:`),t.includeTitle&&s.push(l.title),t.showStorageDiff&&(l.source==="storage-async"||l.source==="storage-mmkv")){let c=l.originalEvent;if(c?.data){let d=c.data,h=Ke(d.prevValue,d.value);h&&s.push(`-> ${h}`)}}if(l.source==="redux"&&l.originalEvent?.hasStateChange===false&&s.push("(no change)"),t.includeSubtitle&&l.subtitle&&s.push(`- ${l.subtitle}`),i.push(s.join(" ")),t.includeEventData&&l.originalEvent){let c=st(l,t),{data:d,truncated:h}=ut(c,t.dataSizeThreshold);h?i.push(` ${d}`):i.push(` Data: ${JSON.stringify(d)}`)}}return i.join(`
8
+ `)}var Nt=[{id:"U",icon:"\u{1F464}",label:"User",sources:[],group:"client"},{id:"App",icon:"\u{1F4F1}",label:"App",sources:["route","render"],group:"client"},{id:"Async",icon:"\u{1F4BE}",label:"AsyncStorage",sources:["storage-async"],group:"client"},{id:"MMKV",icon:"\u26A1",label:"MMKV",sources:["storage-mmkv"],group:"client"},{id:"Redux",icon:"\u{1F504}",label:"Redux",sources:["redux"],group:"client"},{id:"API",icon:"\u{1F310}",label:"API",sources:["network"],group:"server"},{id:"Cache",icon:"\u{1F4E6}",label:"QueryCache",sources:["react-query","react-query-query","react-query-mutation"],group:"server"}];function ci(e){let t=new Set;for(let a of e)t.add(a.source);let r=[];r.push(Nt[0]),r.push(Nt[1]);for(let a of Nt.slice(2))a.sources.some(o=>t.has(o))&&r.push(a);return r}function di(e){let t=e.some(a=>a.group==="client"),r=e.some(a=>a.group==="server");return t&&r&&e.length>=3}function ke(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${(e/6e4).toFixed(1)}m`}function Ge(e){return e.replace(/[#;:]/g," ").replace(/[\n\r]/g," ").replace(/"/g,"'").replace(/\s+/g," ").trim()}function mi(e){let t=["last-route","@dev/last","__debug","_persist","devtools/internal"],r=e.toLowerCase();return t.some(a=>r.includes(a))}function Vt(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function pi(e){return Mt(e,1024*1024).approxBytes}function hi(e){try{let t=new URL(e,"http://localhost");return["timestamp","t","_t","debug","client","version","cache","_"].forEach(r=>t.searchParams.delete(r)),t.pathname+(t.searchParams.toString()?"?"+t.searchParams.toString():"")}catch{return e}}function gi(e){let t=e.replace(/^@[\w-]+\//,"").replace(/^devtools\//,"").replace(/^dev\//,"").replace(/^buoy\//,"").replace(/^pokemon\//,""),r=t.split("/").filter(Boolean);return r.length>1&&(t=r.slice(-1).join("/")),t=t.replace(/-/g," ").replace(/_/g," "),t=t.split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1).toLowerCase()).join(" "),t.toLowerCase()==="saved"&&(t="Favorites"),t.substring(0,20)}function zr(e){let t=e;try{t=new URL(e,"http://localhost").pathname}catch{let a=t.indexOf("?");a>0&&(t=t.substring(0,a))}let r=t.split("/").filter(Boolean);if(r.length>=2){let a=r[r.length-1];return/^\d+$/.test(a)||/^[a-f0-9-]{36}$/i.test(a)?null:a.charAt(0).toUpperCase()+a.slice(1)}return r.length===1?r[0].charAt(0).toUpperCase()+r[0].slice(1):null}function fi(e,t){try{let r=new URL(t,"http://localhost"),a=r.pathname;if(a.includes("graphql"))return"GraphQL Request";a=a.replace(/^\/api\/v\d+/,"").replace(/^\/api/,"");let o=zr(a),n=a.split("/").filter(Boolean),i=n[0]?n[0].charAt(0).toUpperCase()+n[0].slice(1):"Data",l=r.searchParams.has("q")||r.searchParams.has("query")||r.searchParams.has("search");switch(e.toUpperCase()){case"GET":if(l){let s=r.searchParams.get("q")||r.searchParams.get("query")||r.searchParams.get("search");return s?`Search "${s}"`:`Search ${i}`}return o?`Fetch ${o}`:`Fetch ${i}`;case"POST":return a.includes("search")?`Search ${i}`:o?`Create ${o}`:`Create ${i}`;case"PUT":case"PATCH":return o?`Update ${o}`:`Update ${i}`;case"DELETE":return o?`Delete ${o}`:`Delete ${i}`;default:return`${e} ${i}`}}catch{return`${e} request`}}function Mr(e){if(e==="/"||e==="")return"Home";let t=e.split("/").filter(Boolean);if(t.length===0)return"Home";if(t.length===1)return`${t[0].charAt(0).toUpperCase()+t[0].slice(1)} List`;if(t.length>=2){let r=t[t.length-1];return/^\d+$/.test(r)?`${t[0].charAt(0).toUpperCase()+t[0].slice(1)} #${r}`:`${r.charAt(0).toUpperCase()+r.slice(1)} Details`}return e}function yi(e,t,r){let a=[],o=[],n=ke(e.timestamp-r);switch(e.source){case"route":{let i=e.originalEvent,l=String(i?.pathname||e.title),s=i?.previousPathname,u=i?.timeSincePrevious,c=Mr(l),d=s?Mr(s):null;d?(a.push(`U->>App: ${d} \u2192 ${c}`),u&&u>0&&o.push(`Note right of App: ${ke(u)} on ${d}`)):a.push(`U->>App: Open ${c}`);break}case"network":{let i=e.originalEvent,l=i?.method||"GET",s=i?.url||"",u=i?.status,c=i?.duration,d=i?.response||i?.data||i?.body,h=i?.responseSize||i?.size||i?.contentLength,b=fi(l,s),v=zr(s);if(a.push(`App->>+API: ${b}`),e.status==="error"){let y=u?`${u} Error`:"Failed";a.push(`API--x-App: ${y}`)}else{let y=v?`\u2713 ${v}`:"\u2713 Success";a.push(`API-->>-App: ${y}`)}let p=[];if(c&&p.push(ke(c)),h&&h>0)p.push(Vt(h));else if(d){let y=pi(d);y>1024&&p.push(Vt(y))}p.length>0&&o.push(`Note right of API: ${p.join(" \xB7 ")}`);break}case"storage-async":case"storage-mmkv":{let i=e.originalEvent,l=i?.data,s=i?.action||"access",u=l?.key||"data";if(mi(u))return{messages:[],notes:[],skip:true};let c=gi(u),d=e.source==="storage-mmkv"?"MMKV":"Async",h=C=>{if(typeof C=="string")return C;if(typeof C=="number")return String(C);if(typeof C=="object"&&C){if("name"in C)return String(C.name);if("id"in C)return String(C.id)}return null},b=C=>C.charAt(0).toUpperCase()+C.slice(1),v="",p="",y="",m="",g=l?.prevValue,$=l?.value;if(Array.isArray(g)&&Array.isArray($)){let C=g.length,I=$.length;if(m=`${C} \u2192 ${I} items`,I>C){v="\u2795",p="Add";let x=new Set(g.map(h).filter(Boolean));for(let j of $){let N=h(j);if(N&&!x.has(N)){y=b(N);break}}}else if(I<C){v="\u2796",p="Remove";let x=new Set($.map(h).filter(Boolean));for(let j of g){let N=h(j);if(N&&!x.has(N)){y=b(N);break}}}else v="\u{1F4DD}",p="Update"}else if(Array.isArray($)&&(!g||Array.isArray(g)&&g.length===0)){if(v="\u2795",p="Add",m=`\u2192 ${$.length} items`,$.length>0){let C=h($[0]);C&&(y=b(C))}}else Array.isArray(g)&&(!$||Array.isArray($)&&$.length===0)?(v="\u2796",p="Clear",m=`${g.length} \u2192 0 items`):s==="getItem"?(v="\u{1F4D6}",p="Load"):s==="removeItem"?(v="\u2796",p="Remove"):s==="clear"?(v="\u{1F5D1}\uFE0F",p="Clear"):(v="\u{1F4BE}",p="Save");let U;y?U=`App->>${d}: ${v} ${p} ${y} \u2192 ${c}`:U=`App->>${d}: ${v} ${p} ${c}`,a.push(U),m&&o.push(`Note right of ${d}: ${m}`);break}case"react-query":case"react-query-query":{let i=e.originalEvent,l=i?.type||"",s=i?.queryKey,u=i?.duration,c="data";if(Array.isArray(s)&&s.length>0){let d=s[s.length-1];typeof d=="string"&&!/^\d+$/.test(d)?c=d.charAt(0).toUpperCase()+d.slice(1):s.length>1&&typeof s[0]=="string"&&(c=s[0].charAt(0).toUpperCase()+s[0].slice(1))}if(l.includes("start")||l.includes("fetch")||e.status==="pending")a.push(`App->>+Cache: Fetch ${c}`);else if(e.status==="error")a.push("Cache--x-App: Failed to load");else if(e.status==="success"){let d=`\u2713 ${c} ready`;u&&(d+=` (${ke(u)})`),a.push(`Cache-->>-App: ${d}`)}else l.includes("invalidate")?a.push(`App->>Cache: Refresh ${c}`):a.push(`Cache-->>App: ${Ge(l)}`);break}case"react-query-mutation":{let i=e.originalEvent,l=i?.type||"",s=i?.mutationKey,u=i?.duration,c="Update";if(Array.isArray(s)&&s.length>0){let d=String(s[0]);d.includes("add")||d.includes("create")?c="Add":d.includes("delete")||d.includes("remove")?c="Delete":d.includes("update")||d.includes("edit")?c="Update":c=d.charAt(0).toUpperCase()+d.slice(1)}if(l.includes("start")||l.includes("loading")||e.status==="pending")a.push(`App->>+Cache: ${c}`);else if(e.status==="error")a.push(`Cache--x-App: ${c} failed`);else if(e.status==="success"){let d=`\u2713 ${c} complete`;u&&(d+=` (${ke(u)})`),a.push(`Cache-->>-App: ${d}`)}break}case"redux":{let i=e.originalEvent,l=i?.type||e.title,s=i?.hasStateChange,u=i?.diffSummary,c=l.split("/"),d;if(c.length>=2){let h=c[0].charAt(0).toUpperCase()+c[0].slice(1),b=c[1].replace(/([A-Z])/g," $1").replace(/(pending|fulfilled|rejected)$/i,"").trim();b=b.charAt(0).toUpperCase()+b.slice(1),d=`${b} (${h})`}else d=Ge(l).substring(0,25);a.push(`App->>Redux: ${d}`),s===false?o.push("Note right of Redux: No change"):u&&o.push(`Note right of Redux: ${Ge(u).substring(0,35)}`);break}case"render":{let i=e.originalEvent?.renderData,l=Ge(e.title).substring(0,20),s=i?.cause||"update",u=s==="mount"?"mounted":s==="props"?"props changed":s==="state"?"state changed":s==="context"?"context changed":s==="parent"?"parent re-rendered":s==="hooks"?"hook changed":s;a.push(`App->>App: Render ${l}`),o.push(`Note right of App: ${u}`);break}default:a.push(`App->>App: ${Ge(e.title).substring(0,30)}`)}return{messages:a,notes:o}}function Pr(e,t){let r=Qe(e,t);if(r.length===0)return`sequenceDiagram
10
9
  participant U as \u{1F464} User
11
10
  participant App as \u{1F4F1} App
12
- Note over U,App: No events captured`;let r=[...n].sort((m,w)=>m.timestamp-w.timestamp),o=r[0].timestamp,s=Oi(r),i=Bi(s),u=["sequenceDiagram"];if(u.push(" autonumber"),u.push(""),i){let m=s.filter(y=>y.group==="client"),w=s.filter(y=>y.group==="server");if(m.length>0){u.push(" box rgb(240, 248, 255) Client");for(let y of m)u.push(` participant ${y.id} as ${y.icon} ${y.label}`);u.push(" end")}if(w.length>0){u.push(" box rgb(255, 248, 240) External");for(let y of w)u.push(` participant ${y.id} as ${y.icon} ${y.label}`);u.push(" end")}}else for(let m of s)u.push(` participant ${m.id} as ${m.icon} ${m.label}`);u.push("");let a=r[r.length-1].timestamp-o,c=r.filter(m=>m.source==="network"),l=c.reduce((m,w)=>{let y=w.originalEvent,g=y?.responseSize||y?.size||0;return m+g},0),d=r.filter(m=>m.status==="error").length,f=[];f.push(`\u23F1\uFE0F ${Ae(a)}`),f.push(`\u{1F4CA} ${r.length} events`),c.length>0&&f.push(`\u{1F310} ${c.length} API calls`),l>0&&f.push(`\u{1F4E6} ${rn(l)}`),d>0&&f.push(`\u274C ${d} errors`),u.push(` Note over U,API: ${f.join(" \xB7 ")}`),u.push("");let b=new Map,v=0;for(let m of r){let w=Wi(m,e,o);if(w.skip){v++;continue}let{messages:y,notes:g}=w,S=!1,$="";if(m.source==="network"){let U=m.originalEvent?.url;if(U){let T=_i(U),F=b.get(T);if(F&&m.timestamp-F.timestamp<3e4){S=!0;let B=m.timestamp-F.timestamp;$=`\u26A0\uFE0F Already fetched ${Ae(B)} ago`,b.set(T,{timestamp:m.timestamp,count:F.count+1})}else b.set(T,{timestamp:m.timestamp,count:1})}}if(S){u.push(" rect rgb(255, 245, 230)"),u.push(` Note over App,API: ${$}`);for(let C of y)u.push(` ${C}`);for(let C of g)u.push(` ${C}`);u.push(" end")}else if(m.status==="error"){u.push(" rect rgb(255, 235, 235)");for(let C of y)u.push(` ${C}`);for(let C of g)u.push(` ${C}`);u.push(" end")}else{for(let C of y)u.push(` ${C}`);for(let C of g)u.push(` ${C}`)}}return v>0&&(u.push(""),u.push(` Note over App: ${v} internal events hidden`)),u.join(`
13
- `)}function nt(t,e){switch(e.format){case"markdown":return nn(t,e);case"json":return Jn(t,e);case"plaintext":return Kn(t,e);case"mermaid":return Gn(t,e);default:return nn(t,e)}}import{definePersistedSetting as Ji,devToolsStorageKeys as Ki}from"@buoy-gg/shared-ui/web";var cn=Ji(Ki.events.copySettings(),ve,{sanitize:(t,e)=>({...t,filterSources:e?.filterSources??ve.filterSources})});async function ln(t){await cn.save(t)}async function dn(){return cn.loadOrNull()}async function Qi(){await cn.clear()}import{Fragment as ps,jsx as le,jsxs as mn}from"react/jsx-runtime";var us=50*1024,cs=200*1024;function ls(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function ds(){let t=Date.now();return[{id:"mock-1",source:"storage-async",timestamp:t-2e3,title:"Set Item",subtitle:"user_cart",status:"success",originalEvent:{action:"setItem",key:"user_cart",value:{items:2}}},{id:"mock-2",source:"react-query-query",timestamp:t-1500,title:"cart \u203A items",subtitle:"Fetching...",status:"pending",originalEvent:{type:"query-fetch-start",queryKey:["cart","items"]},correlationId:"rq-query-cart",sequenceInGroup:1},{id:"mock-3",source:"react-query-query",timestamp:t-1e3,title:"cart \u203A items",subtitle:"Success \xB7 500ms",status:"success",originalEvent:{type:"query-fetch-success",queryKey:["cart","items"],data:{items:[]}},correlationId:"rq-query-cart",sequenceInGroup:2},{id:"mock-4",source:"network",timestamp:t-500,title:"POST /api/checkout",subtitle:"402 \xB7 450ms",status:"error",originalEvent:{method:"POST",url:"/api/checkout",status:402,error:"Payment required"}}]}function fn({events:t=[],initialSettings:e=ve,onSettingsChange:n}){let{isPro:r}=rs(),[o,s]=pn(e),[i,u]=pn(!1),[a,c]=pn(!1);Gi(()=>{let U=!0;return dn().then(T=>{U&&T&&(s(T),n?.(T)),U&&c(!0)}),()=>{U=!1}},[n]);let l=Le(U=>{s(U),n?.(U),ln(U)},[n]),d=t.length>0,f=d?t:ds(),b=ht(()=>Xt(o),[o]),v=ht(()=>un(f,o),[f,o]),m=ht(()=>v>=cs?"danger":v>=us?"warning":"none",[v]),w=Le(()=>nt(f,o),[f,o]),y=Le(U=>{let T=Re[U];l({...T,filterSources:[...T.filterSources]})},[l]),g=Le((U,T)=>{let[F,B]=U.split("::");if(F==="preset"){y(B);return}if(F==="include"){l({...o,[B]:!o[B]});return}if(F==="format"){l({...o,format:T});return}if(F==="timestamp"){l({...o,timestampFormat:T});return}if(F==="filter"){l({...o,filterMode:T});return}if(F==="threshold"){l({...o,dataSizeThreshold:T});return}},[o,l,y]),S=Le(()=>{let U=f.length;return le(is,{expanded:i,onExpandedChange:u,summary:`${U} event${U!==1?"s":""} \xB7 ~${ls(v)}${d?"":" (mock data)"}`,warningLevel:m,warningText:{warning:"Large payload - preview may be slow",danger:"Very large payload - may cause performance issues"},testIDs:{expand:`${h}-preview-expand`,collapse:`${h}-preview-collapse`,summary:`${h}-preview-summary`,warning:`${h}-preview-size-warning`},renderBody:()=>{let T=w();return o.format==="json"?le(as,{testIDPrefix:`${h}-preview-json`,data:JSON.parse(T),title:"",showTypeFilter:!0,rawMode:!0,initialExpanded:!0}):mn(p,{children:[o.format==="mermaid"&&le(E,{style:Pe.mermaidHint,children:"\u{1F4A1} Paste into mermaid.live to visualize"}),le(Y,{style:Pe.previewScroll,nestedScrollEnabled:!0,testID:`${h}-preview-scroll`,children:le(E,{style:Pe.previewText,selectable:r,testID:`${h}-preview-text`,children:T})})]})}})},[i,f,o,v,m,d,w,r]),$=Le(()=>{let U=Be(f),T=d?`${U.totalEvents} events`:"Mock data (no events captured)";return mn(ps,{children:[le(E,{style:Pe.statusLabel,testID:`${h}-export-status`,children:T}),le(ns,{value:w()})]})},[d,f,w]),C=ht(()=>({sections:[{id:"presets",title:"Presets",type:"custom",data:[{id:"preset::llm",label:L.llm.label,icon:Yi,color:L.llm.color,value:"llm",isActive:b==="llm",description:L.llm.description},{id:"preset::bugReport",label:L.bugReport.label,icon:Xi,color:L.bugReport.color,value:"bugReport",isActive:b==="bugReport",description:L.bugReport.description},{id:"preset::json",label:L.json.label,icon:Xn,color:L.json.color,value:"json",isActive:b==="json",description:L.json.description},{id:"preset::errors",label:L.errors.label,icon:er,color:L.errors.color,value:"errors",isActive:b==="errors",description:L.errors.description},{id:"preset::minimal",label:L.minimal.label,icon:Yn,color:L.minimal.color,value:"minimal",isActive:b==="minimal",description:L.minimal.description},{id:"preset::mermaid",label:L.mermaid.label,icon:tr,color:L.mermaid.color,value:"mermaid",isActive:b==="mermaid",description:L.mermaid.description},{id:"preset::custom",label:"Custom",icon:es,color:ot.color.textSecondary,value:"custom",isActive:b===null,description:"User-configured"}]},{id:"include",title:"Include",type:"custom",data:[{id:"include::includeSource",label:"Source",value:"includeSource",isActive:o.includeSource},{id:"include::includeStatus",label:"Status",value:"includeStatus",isActive:o.includeStatus},{id:"include::includeTitle",label:"Title",value:"includeTitle",isActive:o.includeTitle},{id:"include::includeSubtitle",label:"Subtitle",value:"includeSubtitle",isActive:o.includeSubtitle},{id:"include::includeCorrelation",label:"Correlation",value:"includeCorrelation",isActive:o.includeCorrelation},{id:"include::includeDuration",label:"Duration",value:"includeDuration",isActive:o.includeDuration},{id:"include::includeSummaryHeader",label:"Summary",value:"includeSummaryHeader",isActive:o.includeSummaryHeader},{id:"include::includeEventData",label:"Data",value:"includeEventData",isActive:o.includeEventData}]},{id:"format",title:"Format",type:"custom",data:[{id:"format::markdown",label:"Markdown",icon:Yn,color:rt.semantic.info,value:"markdown",isActive:o.format==="markdown"},{id:"format::json",label:"JSON",icon:Xn,color:rt.semantic.warning,value:"json",isActive:o.format==="json"},{id:"format::plaintext",label:"Text",icon:Zi,color:ot.color.textSecondary,value:"plaintext",isActive:o.format==="plaintext"},{id:"format::mermaid",label:"Diagram",icon:tr,color:"#A855F7",value:"mermaid",isActive:o.format==="mermaid",description:"Mermaid sequence diagram"}]},{id:"timestamp",title:"Timestamps",type:"custom",data:[{id:"timestamp::relative",label:"Relative",value:"relative",isActive:o.timestampFormat==="relative",description:"+0ms, +150ms"},{id:"timestamp::absolute",label:"Absolute",value:"absolute",isActive:o.timestampFormat==="absolute",description:"ISO format"},{id:"timestamp::both",label:"Both",value:"both",isActive:o.timestampFormat==="both",description:"Both formats"}]},{id:"filter",title:"Filter Events",type:"custom",data:[{id:"filter::all",label:"All",value:"all",isActive:o.filterMode==="all"},{id:"filter::errors",label:"Errors",icon:er,color:rt.semantic.error,value:"errors",isActive:o.filterMode==="errors"},{id:"filter::success",label:"Success",color:rt.semantic.success,value:"success",isActive:o.filterMode==="success"},{id:"filter::pending",label:"Pending",color:rt.semantic.warning,value:"pending",isActive:o.filterMode==="pending"}]},{id:"llmOptimization",title:"LLM Optimization",type:"custom",data:[{id:"include::compactMode",label:"Compact",value:"compactMode",isActive:o.compactMode,description:"One line per event"},{id:"include::smartJsonParsing",label:"Smart JSON",value:"smartJsonParsing",isActive:o.smartJsonParsing,description:"Parse nested JSON"},{id:"include::reduxChangedOnly",label:"Redux Diff",value:"reduxChangedOnly",isActive:o.reduxChangedOnly,description:"Only show changes"},{id:"include::showStorageDiff",label:"Storage Diff",value:"showStorageDiff",isActive:o.showStorageDiff,description:"Show what changed"},{id:"include::stripVerboseFields",label:"Strip Noise",value:"stripVerboseFields",isActive:o.stripVerboseFields,description:"Remove images/descriptions"}]}],previewSection:{enabled:!0,title:"PREVIEW",icon:ts,content:S,headerActions:$},onFilterChange:g}),[o,b,g,S,$]);return r?le(Zn,{...C}):mn(Y,{style:Pe.gatedContainer,contentContainerStyle:Pe.gatedContent,testID:`${h}-copy-settings-gated`,children:[le(os,{featureName:"Events Export",description:"Export event flows to share with your team, debug issues, or feed into AI tools.",benefits:["Export to Markdown, JSON, or plain text","Customizable presets (LLM-ready, Bug Report, JSON)","Share event flows with teammates","Feed event context directly to AI assistants"]}),le(p,{style:Pe.gatedPreview,children:le(Zn,{...C})})]})}var Pe=H.create({previewScroll:{maxHeight:300},previewText:{fontFamily:ss,fontSize:11,color:ot.color.text,lineHeight:18},mermaidHint:{fontSize:11,color:ot.color.textSecondary,marginBottom:8,paddingHorizontal:8,paddingVertical:6,backgroundColor:"#A855F715",borderRadius:6,overflow:"hidden"},statusLabel:{fontSize:11,fontWeight:"600",color:ot.color.textTertiary,marginRight:8},gatedContainer:{flex:1},gatedContent:{padding:12,gap:12},gatedPreview:{}});import{TickProvider as nr}from"@buoy-gg/shared-ui/web";import{Fragment as St,jsx as A,jsxs as de}from"react/jsx-runtime";function Et({visible:t,onClose:e,onBack:n,onMinimize:r,enableSharedModalDimensions:o=!1,inline:s=!1,capturing:i,onCapturingChange:u,networkDetailWrapper:a,NetworkEventDetailViewComponent:c,RouteEventDetailComponent:l,detailComponents:d}){let f=xs(),b=i!=null&&u!=null,{filteredEvents:v,availableSources:m,toggleSource:w,clearEvents:y,totalCount:g,filteredCount:S,isCapturing:$,toggleCapturing:C,hiddenEventsCount:U,searchText:T,setSearchText:F}=Je(b?{capturingOverride:i}:void 0),B=b?i:$,ye=b?()=>u(!i):C,[X,Se]=vt("list"),[ee,at]=vt(null),[xt,ut]=vt(!1),[Ve,We]=vt(!1),kt=fs(null);ms(()=>{if(!Ve)return;let Q=requestAnimationFrame(()=>{kt.current?.focus()});return()=>cancelAnimationFrame(Q)},[Ve]);let Tt=ze(()=>{We(!1),F("")},[F]),ct=ze(Q=>{try{f.push(Q)}catch(Dt){It.alert("Navigation Error",String(Dt))}},[f]),k=ze(Q=>{at(Q),Se("detail")},[]),z=ze(()=>{X==="detail"?(at(null),Se("list")):X==="copySettings"&&Se("list")},[X]),N=ze(()=>{Se("copySettings")},[]),te=ze(Q=>{},[]),me=o?Ss.modal.root():"buoy-events-modal";if(!t)return null;let P=()=>{if(X==="detail"&&ee){let Q={source:ee.source,title:ee.title,subtitle:ee.subtitle,status:ee.status,timestamp:new Date(ee.timestamp).toISOString(),data:ee.originalEvent};return de(oe,{children:[A(oe.Navigation,{onBack:z}),A(oe.Content,{title:ee.title,testID:`${h}-detail-heading`}),A(oe.Actions,{children:A(Es,{value:Q})})]})}return X==="copySettings"?de(oe,{children:[A(oe.Navigation,{onBack:z}),A(oe.Content,{title:"Copy Settings",testID:`${h}-copy-settings-heading`})]}):de(oe,{children:[n&&A(oe.Navigation,{onBack:n}),A(oe.Content,{title:"",children:Ve?A(oe.Search,{value:T,onChangeText:F,onCancel:Tt,placeholder:"Search events...",accessibilityLabel:"Search events",iconSize:14,testID:`${h}-search-field`,containerTestID:`${h}-search`,clearTestID:`${h}-search-clear`,onBlur:()=>{T.length===0&&We(!1)}}):de(p,{style:ie.headerTitleContainer,children:[A(E,{style:ie.headerTitle,testID:`${h}-title`,children:"Events"}),de(E,{style:ie.headerSubtitle,testID:`${h}-count`,children:[g," captured"]})]})}),de(oe.Actions,{children:[!Ve&&A(ae,{onPress:()=>We(!0),style:[ie.headerActionButton,T.length>0&&ie.headerActionButtonActive],testID:`${h}-search-open`,accessibilityRole:"button",accessibilityLabel:"Search events",children:A(vs,{size:14,color:T.length>0?se.color.accent:se.color.textSecondary})}),A(ae,{onPress:N,style:[ie.headerActionButton,g===0&&ie.headerActionButtonDisabled],disabled:g===0,testID:`${h}-copy`,accessibilityRole:"button",accessibilityLabel:"Copy events",children:A(hs,{size:14,color:g>0?se.color.textSecondary:se.color.textTertiary})}),A(Cs,{isEnabled:B,onToggle:ye,testID:`${h}-power`,accessibilityLabel:"Toggle event capture"}),A(ae,{onPress:y,style:[ie.headerActionButton,g===0&&ie.headerActionButtonDisabled],disabled:g===0,testID:`${h}-clear`,accessibilityRole:"button",accessibilityLabel:"Clear events",children:A(bs,{size:14,color:g>0?se.color.textSecondary:se.color.textTertiary})})]})]})},j=A(p,{style:ie.container,children:X==="copySettings"?A(fn,{events:v}):X==="detail"&&ee?A(Ye,{event:ee,onBack:z,onNavigate:ct,networkDetailWrapper:a,NetworkEventDetailViewComponent:c,RouteEventDetailComponent:l,detailComponents:d}):de(St,{children:[A(Ke,{availableSources:m,onToggleSource:w,totalCount:g,filteredCount:S}),A(Ge,{events:v,selectedEventId:void 0,expandedEventId:void 0,onEventPress:k,onNavigate:ct,isCapturing:B,hiddenEventsCount:U,searchText:T,totalCount:g,sourceCount:m.length,enabledSourceCount:m.filter(Q=>Q.enabled!==!1).length,onUpgradePress:()=>ut(!0)})]})}),be=nr?A(nr,{children:j}):j,lt=A(St,{children:A(ws,{visible:xt,onClose:()=>ut(!1),featureName:"Unlimited Events",description:"View your complete event history to debug complex flows and track down issues.",benefits:["Unlimited event history (vs 25 events)","Export events to Markdown, JSON, or plain text","Share event flows with teammates","Feed event context directly to AI assistants"]})});return s?de(St,{children:[de(p,{style:ie.inlineRoot,children:[A(p,{style:ie.inlineHeader,...ks,children:P()}),be]}),lt]}):de(St,{children:[A(gs,{visible:t,onClose:e,onMinimize:r,persistenceKey:me,header:{showToggleButton:!0,customContent:P()},onModeChange:te,enablePersistence:!0,initialMode:"bottomSheet",enableGlitchEffects:!0,styles:{},disableScrollWrapper:!0,children:be}),lt]})}var ie=H.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:ys.border,backgroundColor:"transparent"},container:{flex:1,backgroundColor:"transparent"},headerTitleContainer:{flexDirection:"row",alignItems:"baseline",gap:8},headerTitle:{fontSize:16,fontWeight:"600",color:se.color.text},headerSubtitle:{fontSize:12,color:se.color.textTertiary},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:se.color.buttonSurface,borderWidth:1,borderColor:se.color.border,alignItems:"center",justifyContent:"center"},headerActionButtonDisabled:{opacity:.55},headerActionButtonActive:{backgroundColor:se.color.accentSoft,borderColor:se.color.accentBorderStrong}});function Ts(t={}){return A(Et,{...t,inline:!0,visible:!0,onClose:()=>{}})}import{createToolFactory as Rs,defineToolPreset as As}from"@buoy-gg/shared-ui/web";import{jsx as Us}from"react/jsx-runtime";var rr=As({id:"events",name:"EVENTS",description:"Unified event timeline",slot:"both",icon:({size:t,color:e})=>Us(Ds,{size:t,color:e||Is}),component:Et,props:{enableSharedModalDimensions:!1}}),$s=Rs(rr);import{useState as Ps,useCallback as or}from"react";import{night as ge,Trash2 as Vs}from"@buoy-gg/shared-ui/web";import{jsx as je,jsxs as it}from"react/jsx-runtime";function qs(){let{filteredEvents:t,availableSources:e,toggleSource:n,clearEvents:r,totalCount:o,filteredCount:s,isCapturing:i}=Je(),[u,a]=Ps(null),c=or(d=>{a(d)},[]),l=or(()=>{a(null)},[]);return u?je(Ye,{event:u,onBack:l}):it(p,{style:_e.container,children:[it(p,{style:_e.header,children:[it(p,{children:[je(E,{style:_e.title,children:"Events"}),it(E,{style:_e.subtitle,children:[o," event",o!==1?"s":""," captured"]})]}),it(ae,{style:_e.clearButton,onPress:r,activeOpacity:.7,disabled:o===0,children:[je(Vs,{size:16,color:o===0?ge.color.textTertiary:ge.color.danger}),je(E,{style:[_e.clearText,{color:o===0?ge.color.textTertiary:ge.color.danger}],children:"Clear"})]})]}),je(Ke,{availableSources:e,onToggleSource:n,totalCount:o,filteredCount:s}),je(Ge,{events:t,selectedEventId:void 0,onEventPress:c,isCapturing:i,totalCount:o,sourceCount:e.length,enabledSourceCount:e.filter(d=>d.enabled!==!1).length})]})}var _e=H.create({container:{flex:1,backgroundColor:"transparent"},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:16,paddingVertical:12,backgroundColor:ge.color.surface,borderBottomWidth:1,borderBottomColor:ge.color.border},title:{fontSize:20,fontWeight:"700",color:ge.color.text},subtitle:{fontSize:12,color:ge.color.textTertiary,marginTop:2},clearButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8,borderRadius:6,backgroundColor:ge.color.dangerSoft},clearText:{fontSize:14,fontWeight:"600"}});import{approxJsonSize as Ns,isJsonSerializable as Fs,isOverWireBudget as Ms}from"@buoy-gg/shared-ui/web";var He=16*1024;function ir(t,e){return{__buoyTruncated:!0,approxBytes:t,note:e??`Payload (\u2265${(t/1024).toFixed(0)}KB approx) exceeds the ${He/1024}KB sync limit and stayed on the device. Open the tool on-device (or use the source tool's detail action) for the full payload.`}}var st={__buoyOmitted:"state-tree",note:"prevState/nextState stay on the device (use get_redux_state / the on-device tool)."},Os={__buoyOmitted:"query-payload",note:"Query/mutation data stays on the device (open the Query tool or the on-device Events detail)."},wt={__buoyOmitted:"network-body",note:"Request/response body stays on the device (open the Network tool or the on-device Events detail)."},sr={__buoyOmitted:"network-headers",note:"Request/response headers stay on the device (open the Network tool or the on-device Events detail)."},Bs={__buoyOmitted:"graphql-variables",note:"GraphQL variables stay on the device (open the Network tool or the on-device Events detail)."},gn={__buoyOmitted:"storage-value",note:"Storage value stays on the device (open the Storage tool or the on-device Events detail)."},Ls={__buoyOmitted:"route-params",note:"Navigation params stay on the device (open the Routes tool or the on-device Events detail)."};function zs(t){return t==="react-query"||t==="react-query-query"||t==="react-query-mutation"}function pe(t,e){if(t!==void 0)return Ms(t,He)?{...e}:t}function Ct(t){return pe(t,Os)}function ar(t){return t==null?t:t instanceof Error?{name:t.name,message:t.message}:Ct(t)}var ur=new WeakMap;function _s(t){let e=t.originalEvent;if(typeof e!="object"||e===null)return t;let n=ur.get(t);if(n!==void 0)return n;let r=t,o=e;if((t.source==="redux"||t.source==="zustand")&&("prevState"in o||"nextState"in o))o={...o,prevState:{...st},nextState:{...st},...t.source==="zustand"&&"partial"in o?{partial:{...st}}:{}},r={...t,originalEvent:o};else if(t.source==="jotai"&&("prevValue"in o||"nextValue"in o))o={...o,prevValue:{...st},nextValue:{...st}},r={...t,originalEvent:o};else if(t.source==="render"){let a=o.render,c=o.event,l=d=>{if(!d||typeof d!="object")return d;let{hookChanges:f,...b}=d;return b};o={...o,render:a&&{...a,renderHistory:void 0,lastRenderCause:l(a.lastRenderCause)},event:c&&{...c,capturedProps:void 0,capturedState:void 0,cause:l(c.cause)}},r={...t,originalEvent:o}}else if(zs(t.source)){let{query:a,mutation:c,...l}=o;o={...l,queryData:Ct(l.queryData),mutationData:Ct(l.mutationData),mutationVariables:Ct(l.mutationVariables),queryError:ar(l.queryError),mutationError:ar(l.mutationError)},r={...t,originalEvent:o}}else if(t.source==="network"){let a=typeof o.requestSize=="number"?o.requestSize:void 0,c=typeof o.responseSize=="number"?o.responseSize:void 0;o={...o,requestData:a!==void 0&&a>He?{...wt}:pe(o.requestData,wt),responseData:c!==void 0&&c>He?{...wt}:pe(o.responseData,wt),graphqlVariables:pe(o.graphqlVariables,Bs),requestHeaders:pe(o.requestHeaders,sr),responseHeaders:pe(o.responseHeaders,sr)},r={...t,originalEvent:o}}else if(t.source==="storage-async"||t.source==="storage-mmkv"){let a=o.data;a&&(o={...o,data:{...a,value:pe(a.value,gn),prevValue:pe(a.prevValue,gn),pairs:pe(a.pairs,gn)}},r={...t,originalEvent:o})}else t.source==="route"&&(o={...o,params:pe(o.params,Ls)},r={...t,originalEvent:o});let{bytes:s,sawRepeat:i,sawBigInt:u}=Ns(o,He);return s>He?r={...t,originalEvent:ir(s)}:(i||u)&&!Fs(o)&&(r={...t,originalEvent:ir(-1,"Payload is not JSON-serializable (cyclic or bigint) and stayed on the device.")}),ur.set(t,r),r}var js={version:2,getSnapshot:()=>({events:J.getEvents().map(_s),availableSources:Array.from(J.getAvailableEventSources())}),subscribe:t=>{J.ensureRemoteSourcesDefault();let e=J.subscribe(()=>t());return()=>{e(),J.clearRemoteSources()}},actions:{clearEvents:()=>{J.clearEvents()},setEnabledSources:t=>{let e=t?.sources??[];return J.setRemoteEnabledSources(e),{enabledSources:e}},exportEvents:t=>{let e=t??{},r={...e.preset&&Re[e.preset]?Re[e.preset]:ve,...e.settings??{}},o=J.getEvents(),s=typeof e.limit=="number"&&e.limit>0?e.limit:o.length,i=o.slice(0,s);return{output:nt(i,r),returned:i.length,totalAvailable:o.length,includedData:r.includeEventData,format:r.format}}}};export{Re as COPY_PRESETS,ve as DEFAULT_COPY_SETTINGS,h as EVENTS_TEST_ID,fn as EventsCopySettingsView,Et as EventsModal,Ts as EventsToolView,L as PRESET_METADATA,Gt as ReactQueryEventDetail,Ye as UnifiedEventDetail,Ke as UnifiedEventFilters,jt as UnifiedEventItem,Ge as UnifiedEventList,qs as UnifiedEventViewer,Ht as buildCorrelationCountMap,Qi as clearCopySettings,$s as createEventsTool,Xt as detectActivePreset,un as estimateExportSize,Bt as eventFilterTestID,Nn as eventIdentity,Ot as eventRowTestID,js as eventsSyncAdapter,rr as eventsToolPreset,tt as filterEvents,ti as findRelatedEvents,nt as generateExport,Jn as generateJsonExport,nn as generateMarkdownExport,Gn as generateMermaidExport,Kn as generatePlaintextExport,Jt as getCorrelationColor,Ln as getCorrelationGroup,Wt as getCorrelationLabel,Be as getExportSummary,ri as getRelatedEventsCount,ni as hasRelatedEvents,dt as isBuoyInternalEvent,No as isEventHiddenFromTool,pt as isNetworkEventIgnored,dn as loadCopySettings,ln as saveCopySettings,J as unifiedEventStore,Je as useUnifiedEvents};
11
+ Note over U,App: No events captured`;let a=[...r].sort((p,y)=>p.timestamp-y.timestamp),o=a[0].timestamp,n=ci(a),i=di(n),l=["sequenceDiagram"];if(l.push(" autonumber"),l.push(""),i){let p=n.filter(m=>m.group==="client"),y=n.filter(m=>m.group==="server");if(p.length>0){l.push(" box rgb(240, 248, 255) Client");for(let m of p)l.push(` participant ${m.id} as ${m.icon} ${m.label}`);l.push(" end")}if(y.length>0){l.push(" box rgb(255, 248, 240) External");for(let m of y)l.push(` participant ${m.id} as ${m.icon} ${m.label}`);l.push(" end")}}else for(let p of n)l.push(` participant ${p.id} as ${p.icon} ${p.label}`);l.push("");let s=a[a.length-1].timestamp-o,u=a.filter(p=>p.source==="network"),c=u.reduce((p,y)=>{let m=y.originalEvent,g=m?.responseSize||m?.size||0;return p+g},0),d=a.filter(p=>p.status==="error").length,h=[];h.push(`\u23F1\uFE0F ${ke(s)}`),h.push(`\u{1F4CA} ${a.length} events`),u.length>0&&h.push(`\u{1F310} ${u.length} API calls`),c>0&&h.push(`\u{1F4E6} ${Vt(c)}`),d>0&&h.push(`\u274C ${d} errors`),l.push(` Note over U,API: ${h.join(" \xB7 ")}`),l.push("");let b=new Map,v=0;for(let p of a){let y=yi(p,t,o);if(y.skip){v++;continue}let{messages:m,notes:g}=y,$=false,U="";if(p.source==="network"){let C=p.originalEvent?.url;if(C){let I=hi(C),x=b.get(I);if(x&&p.timestamp-x.timestamp<3e4){$=true;let j=p.timestamp-x.timestamp;U=`\u26A0\uFE0F Already fetched ${ke(j)} ago`,b.set(I,{timestamp:p.timestamp,count:x.count+1})}else b.set(I,{timestamp:p.timestamp,count:1})}}if($){l.push(" rect rgb(255, 245, 230)"),l.push(` Note over App,API: ${U}`);for(let C of m)l.push(` ${C}`);for(let C of g)l.push(` ${C}`);l.push(" end")}else if(p.status==="error"){l.push(" rect rgb(255, 235, 235)");for(let C of m)l.push(` ${C}`);for(let C of g)l.push(` ${C}`);l.push(" end")}else{for(let C of m)l.push(` ${C}`);for(let C of g)l.push(` ${C}`)}}return v>0&&(l.push(""),l.push(` Note over App: ${v} internal events hidden`)),l.join(`
12
+ `)}function Ot(e,t){switch(t.format){case"markdown":return Pt(e,t);case"json":return Rr(e,t);case"plaintext":return jr(e,t);case"mermaid":return Pr(e,t);default:return Pt(e,t)}}import{definePersistedSetting as bi,devToolsStorageKeys as vi}from"@buoy-gg/shared-ui/web";var Ut=bi(vi.events.copySettings(),Je,{sanitize:(e,t)=>({...e,filterSources:t?.filterSources??Je.filterSources})});async function Nr(e){await Ut.save(e)}async function Vr(){return Ut.loadOrNull()}async function Si(){await Ut.clear()}import{Fragment as Ci,jsx as ae,jsxs as Lt}from"react/jsx-runtime";var wi=50*1024,Ei=200*1024;function xi(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function $i(){let e=Date.now();return[{id:"mock-1",source:"storage-async",timestamp:e-2e3,title:"Set Item",subtitle:"user_cart",status:"success",originalEvent:{action:"setItem",key:"user_cart",value:{items:2}}},{id:"mock-2",source:"react-query-query",timestamp:e-1500,title:"cart \u203A items",subtitle:"Fetching...",status:"pending",originalEvent:{type:"query-fetch-start",queryKey:["cart","items"]},correlationId:"rq-query-cart",sequenceInGroup:1},{id:"mock-3",source:"react-query-query",timestamp:e-1e3,title:"cart \u203A items",subtitle:"Success \xB7 500ms",status:"success",originalEvent:{type:"query-fetch-success",queryKey:["cart","items"],data:{items:[]}},correlationId:"rq-query-cart",sequenceInGroup:2},{id:"mock-4",source:"network",timestamp:e-500,title:"POST /api/checkout",subtitle:"402 \xB7 450ms",status:"error",originalEvent:{method:"POST",url:"/api/checkout",status:402,error:"Payment required"}}]}function Or({events:e=[],initialSettings:t=Je,onSettingsChange:r}){let{isPro:a}=Qn(),[o,n]=Ft(t),[i,l]=Ft(false),[s,u]=Ft(false);Un(()=>{let I=true;return Vr().then(x=>{I&&x&&(n(x),r?.(x)),I&&u(true)}),()=>{I=false}},[r]);let c=je(I=>{n(I),r?.(I),Nr(I)},[r]),d=e.length>0,h=d?e:$i(),b=it(()=>Ar(o),[o]),v=it(()=>Fr(h,o),[h,o]),p=it(()=>v>=Ei?"danger":v>=wi?"warning":"none",[v]),y=je(()=>Ot(h,o),[h,o]),m=je(I=>{let x=We[I];c({...x,filterSources:[...x.filterSources]})},[c]),g=je((I,x)=>{let[j,N]=I.split("::");if(j==="preset"){m(N);return}if(j==="include"){c({...o,[N]:!o[N]});return}if(j==="format"){c({...o,format:x});return}if(j==="timestamp"){c({...o,timestampFormat:x});return}if(j==="filter"){c({...o,filterMode:x});return}if(j==="threshold"){c({...o,dataSizeThreshold:x});return}},[o,c,m]),$=je(()=>{let I=h.length;return ae(Zn,{expanded:i,onExpandedChange:l,summary:`${I} event${I!==1?"s":""} \xB7 ~${xi(v)}${d?"":" (mock data)"}`,warningLevel:p,warningText:{warning:"Large payload - preview may be slow",danger:"Very large payload - may cause performance issues"},testIDs:{expand:`${S}-preview-expand`,collapse:`${S}-preview-collapse`,summary:`${S}-preview-summary`,warning:`${S}-preview-size-warning`},renderBody:()=>{let x=y();return o.format==="json"?ae(Xn,{testIDPrefix:`${S}-preview-json`,data:JSON.parse(x),title:"",showTypeFilter:true,rawMode:true,initialExpanded:true}):Lt(f,{children:[o.format==="mermaid"&&ae(k,{style:De.mermaidHint,children:"\u{1F4A1} Paste into mermaid.live to visualize"}),ae(ue,{style:De.previewScroll,nestedScrollEnabled:true,testID:`${S}-preview-scroll`,children:ae(k,{style:De.previewText,selectable:a,testID:`${S}-preview-text`,children:x})})]})}})},[i,h,o,v,p,d,y,a]),U=je(()=>{let I=_e(h),x=d?`${I.totalEvents} events`:"Mock data (no events captured)";return Lt(Ci,{children:[ae(k,{style:De.statusLabel,testID:`${S}-export-status`,children:x}),ae(_n,{value:y()})]})},[d,h,y]),C=it(()=>({sections:[{id:"presets",title:"Presets",type:"custom",data:[{id:"preset::llm",label:P.llm.label,icon:Hn,color:P.llm.color,value:"llm",isActive:b==="llm",description:P.llm.description},{id:"preset::bugReport",label:P.bugReport.label,icon:Jn,color:P.bugReport.color,value:"bugReport",isActive:b==="bugReport",description:P.bugReport.description},{id:"preset::json",label:P.json.label,icon:Dr,color:P.json.color,value:"json",isActive:b==="json",description:P.json.description},{id:"preset::errors",label:P.errors.label,icon:Tr,color:P.errors.color,value:"errors",isActive:b==="errors",description:P.errors.description},{id:"preset::minimal",label:P.minimal.label,icon:kr,color:P.minimal.color,value:"minimal",isActive:b==="minimal",description:P.minimal.description},{id:"preset::mermaid",label:P.mermaid.label,icon:Ir,color:P.mermaid.color,value:"mermaid",isActive:b==="mermaid",description:P.mermaid.description},{id:"preset::custom",label:"Custom",icon:Wn,color:He.color.textSecondary,value:"custom",isActive:b===null,description:"User-configured"}]},{id:"include",title:"Include",type:"custom",data:[{id:"include::includeSource",label:"Source",value:"includeSource",isActive:o.includeSource},{id:"include::includeStatus",label:"Status",value:"includeStatus",isActive:o.includeStatus},{id:"include::includeTitle",label:"Title",value:"includeTitle",isActive:o.includeTitle},{id:"include::includeSubtitle",label:"Subtitle",value:"includeSubtitle",isActive:o.includeSubtitle},{id:"include::includeCorrelation",label:"Correlation",value:"includeCorrelation",isActive:o.includeCorrelation},{id:"include::includeDuration",label:"Duration",value:"includeDuration",isActive:o.includeDuration},{id:"include::includeSummaryHeader",label:"Summary",value:"includeSummaryHeader",isActive:o.includeSummaryHeader},{id:"include::includeEventData",label:"Data",value:"includeEventData",isActive:o.includeEventData}]},{id:"format",title:"Format",type:"custom",data:[{id:"format::markdown",label:"Markdown",icon:kr,color:Le.semantic.info,value:"markdown",isActive:o.format==="markdown"},{id:"format::json",label:"JSON",icon:Dr,color:Le.semantic.warning,value:"json",isActive:o.format==="json"},{id:"format::plaintext",label:"Text",icon:Ln,color:He.color.textSecondary,value:"plaintext",isActive:o.format==="plaintext"},{id:"format::mermaid",label:"Diagram",icon:Ir,color:"#A855F7",value:"mermaid",isActive:o.format==="mermaid",description:"Mermaid sequence diagram"}]},{id:"timestamp",title:"Timestamps",type:"custom",data:[{id:"timestamp::relative",label:"Relative",value:"relative",isActive:o.timestampFormat==="relative",description:"+0ms, +150ms"},{id:"timestamp::absolute",label:"Absolute",value:"absolute",isActive:o.timestampFormat==="absolute",description:"ISO format"},{id:"timestamp::both",label:"Both",value:"both",isActive:o.timestampFormat==="both",description:"Both formats"}]},{id:"filter",title:"Filter Events",type:"custom",data:[{id:"filter::all",label:"All",value:"all",isActive:o.filterMode==="all"},{id:"filter::errors",label:"Errors",icon:Tr,color:Le.semantic.error,value:"errors",isActive:o.filterMode==="errors"},{id:"filter::success",label:"Success",color:Le.semantic.success,value:"success",isActive:o.filterMode==="success"},{id:"filter::pending",label:"Pending",color:Le.semantic.warning,value:"pending",isActive:o.filterMode==="pending"}]},{id:"llmOptimization",title:"LLM Optimization",type:"custom",data:[{id:"include::compactMode",label:"Compact",value:"compactMode",isActive:o.compactMode,description:"One line per event"},{id:"include::smartJsonParsing",label:"Smart JSON",value:"smartJsonParsing",isActive:o.smartJsonParsing,description:"Parse nested JSON"},{id:"include::reduxChangedOnly",label:"Redux Diff",value:"reduxChangedOnly",isActive:o.reduxChangedOnly,description:"Only show changes"},{id:"include::showStorageDiff",label:"Storage Diff",value:"showStorageDiff",isActive:o.showStorageDiff,description:"Show what changed"},{id:"include::stripVerboseFields",label:"Strip Noise",value:"stripVerboseFields",isActive:o.stripVerboseFields,description:"Remove images/descriptions"}]}],previewSection:{enabled:true,title:"PREVIEW",icon:Kn,content:$,headerActions:U},onFilterChange:g}),[o,b,g,$,U]);return a?ae($r,{...C}):Lt(ue,{style:De.gatedContainer,contentContainerStyle:De.gatedContent,testID:`${S}-copy-settings-gated`,children:[ae(Gn,{featureName:"Events Export",description:"Export event flows to share with your team, debug issues, or feed into AI tools.",benefits:["Export to Markdown, JSON, or plain text","Customizable presets (LLM-ready, Bug Report, JSON)","Share event flows with teammates","Feed event context directly to AI assistants"]}),ae(f,{style:De.gatedPreview,children:ae($r,{...C})})]})}var De=le.create({previewScroll:{maxHeight:300},previewText:{fontFamily:Yn,fontSize:11,color:He.color.text,lineHeight:18},mermaidHint:{fontSize:11,color:He.color.textSecondary,marginBottom:8,paddingHorizontal:8,paddingVertical:6,backgroundColor:"#A855F715",borderRadius:6,overflow:"hidden"},statusLabel:{fontSize:11,fontWeight:"600",color:He.color.textTertiary,marginRight:8},gatedContainer:{flex:1},gatedContent:{padding:12,gap:12},gatedPreview:{}});import{TickProvider as Ur}from"@buoy-gg/shared-ui/web";import{Fragment as ct,jsx as A,jsxs as ie}from"react/jsx-runtime";function Ht({visible:e,onClose:t,onBack:r,onMinimize:a,enableSharedModalDimensions:o=false,inline:n=false,capturing:i,onCapturingChange:l,networkDetailWrapper:s,NetworkEventDetailViewComponent:u,RouteEventDetailComponent:c,detailComponents:d}){let h=ha(),b=i!=null&&l!=null,{filteredEvents:v,availableSources:p,toggleSource:y,clearEvents:m,totalCount:g,filteredCount:$,isCapturing:U,toggleCapturing:C,hiddenEventsCount:I,searchText:x,setSearchText:j}=wt(b?{capturingOverride:i}:void 0),N=b?i:U,pe=b?()=>l(!i):C,[K,he]=ot("list"),[_,Xe]=ot(null),[pt,et]=ot(false),[Te,Ve]=ot(false),ht=aa(null);oa(()=>{if(!Te)return;let G=requestAnimationFrame(()=>{ht.current?.focus()});return()=>cancelAnimationFrame(G)},[Te]);let gt=Ae(()=>{Ve(false),j("")},[j]),tt=Ae(G=>{try{h.push(G)}catch(ft){Gt.alert("Navigation Error",String(ft))}},[h]),w=Ae(G=>{Xe(G),he("detail")},[]),F=Ae(()=>{K==="detail"?(Xe(null),he("list")):K==="copySettings"&&he("list")},[K]),z=Ae(()=>{he("copySettings")},[]),Q=Ae(G=>{},[]),q=o?ca.modal.root():"buoy-events-modal";if(!e)return null;let R=()=>{if(K==="detail"&&_){let G={source:_.source,title:_.title,subtitle:_.subtitle,status:_.status,timestamp:new Date(_.timestamp).toISOString(),data:_.originalEvent};return ie(Y,{children:[A(Y.Navigation,{onBack:F}),A(Y.Content,{title:_.title,testID:`${S}-detail-heading`}),A(Y.Actions,{children:A(da,{value:G})})]})}return K==="copySettings"?ie(Y,{children:[A(Y.Navigation,{onBack:F}),A(Y.Content,{title:"Copy Settings",testID:`${S}-copy-settings-heading`})]}):ie(Y,{children:[r&&A(Y.Navigation,{onBack:r}),A(Y.Content,{title:"",children:Te?A(Y.Search,{value:x,onChangeText:j,onCancel:gt,placeholder:"Search events...",accessibilityLabel:"Search events",iconSize:14,testID:`${S}-search-field`,containerTestID:`${S}-search`,clearTestID:`${S}-search-clear`,onBlur:()=>{x.length===0&&Ve(false)}}):ie(f,{style:te.headerTitleContainer,children:[A(k,{style:te.headerTitle,testID:`${S}-title`,children:"Events"}),ie(k,{style:te.headerSubtitle,testID:`${S}-count`,children:[g," captured"]})]})}),ie(Y.Actions,{children:[!Te&&A(ge,{onPress:()=>Ve(true),style:[te.headerActionButton,x.length>0&&te.headerActionButtonActive],testID:`${S}-search-open`,accessibilityRole:"button",accessibilityLabel:"Search events",children:A(ua,{size:14,color:x.length>0?X.color.accent:X.color.textSecondary})}),A(ge,{onPress:z,style:[te.headerActionButton,g===0&&te.headerActionButtonDisabled],disabled:g===0,testID:`${S}-copy`,accessibilityRole:"button",accessibilityLabel:"Copy events",children:A(la,{size:14,color:g>0?X.color.textSecondary:X.color.textTertiary})}),A(pa,{isEnabled:N,onToggle:pe,testID:`${S}-power`,accessibilityLabel:"Toggle event capture"}),A(ge,{onPress:m,style:[te.headerActionButton,g===0&&te.headerActionButtonDisabled],disabled:g===0,testID:`${S}-clear`,accessibilityRole:"button",accessibilityLabel:"Clear events",children:A(sa,{size:14,color:g>0?X.color.textSecondary:X.color.textTertiary})})]})]})},ne=A(f,{style:te.container,children:K==="copySettings"?A(Or,{events:v}):K==="detail"&&_?A(Bt,{event:_,onBack:F,onNavigate:tt,networkDetailWrapper:s,NetworkEventDetailViewComponent:u,RouteEventDetailComponent:c,detailComponents:d}):ie(ct,{children:[A(xt,{availableSources:p,onToggleSource:y,totalCount:g,filteredCount:$}),A(It,{events:v,selectedEventId:void 0,expandedEventId:void 0,onEventPress:w,onNavigate:tt,isCapturing:N,hiddenEventsCount:I,searchText:x,totalCount:g,sourceCount:p.length,enabledSourceCount:p.filter(G=>G.enabled!==false).length,onUpgradePress:()=>et(true)})]})}),Ie=Ur?A(Ur,{children:ne}):ne,rt=A(ct,{children:A(ma,{visible:pt,onClose:()=>et(false),featureName:"Unlimited Events",description:"View your complete event history to debug complex flows and track down issues.",benefits:["Unlimited event history (vs 25 events)","Export events to Markdown, JSON, or plain text","Share event flows with teammates","Feed event context directly to AI assistants"]})});return n?ie(ct,{children:[ie(f,{style:te.inlineRoot,children:[A(f,{style:te.inlineHeader,...ga,children:R()}),Ie]}),rt]}):ie(ct,{children:[A(na,{visible:e,onClose:t,onMinimize:a,persistenceKey:q,header:{showToggleButton:true,customContent:R()},onModeChange:Q,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,styles:{},disableScrollWrapper:true,children:Ie}),rt]})}var te=le.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:ia.border,backgroundColor:"transparent"},container:{flex:1,backgroundColor:"transparent"},headerTitleContainer:{flexDirection:"row",alignItems:"baseline",gap:8},headerTitle:{fontSize:16,fontWeight:"600",color:X.color.text},headerSubtitle:{fontSize:12,color:X.color.textTertiary},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:X.color.buttonSurface,borderWidth:1,borderColor:X.color.border,alignItems:"center",justifyContent:"center"},headerActionButtonDisabled:{opacity:.55},headerActionButtonActive:{backgroundColor:X.color.accentSoft,borderColor:X.color.accentBorderStrong}});function ki(e={}){return A(Ht,{...e,inline:true,visible:true,onClose:()=>{}})}import{createToolFactory as Di,defineToolPreset as Ti}from"@buoy-gg/shared-ui/web";import{jsx as Ii}from"react/jsx-runtime";var Lr=Ti({id:"events",name:"EVENTS",description:"Unified event timeline",slot:"both",icon:({size:e,color:t})=>Ii(eo,{size:e,color:t||to}),component:Ht,props:{enableSharedModalDimensions:false}}),Ai=Di(Lr);import{useState as qi,useCallback as Hr}from"react";import{night as de,Trash2 as Bi}from"@buoy-gg/shared-ui/web";import{jsx as Me,jsxs as Ze}from"react/jsx-runtime";function Fi(){let{filteredEvents:e,availableSources:t,toggleSource:r,clearEvents:a,totalCount:o,filteredCount:n,isCapturing:i}=wt(),[l,s]=qi(null),u=Hr(d=>{s(d)},[]),c=Hr(()=>{s(null)},[]);return l?Me(Bt,{event:l,onBack:c}):Ze(f,{style:Pe.container,children:[Ze(f,{style:Pe.header,children:[Ze(f,{children:[Me(k,{style:Pe.title,children:"Events"}),Ze(k,{style:Pe.subtitle,children:[o," event",o!==1?"s":""," captured"]})]}),Ze(ge,{style:Pe.clearButton,onPress:a,activeOpacity:.7,disabled:o===0,children:[Me(Bi,{size:16,color:o===0?de.color.textTertiary:de.color.danger}),Me(k,{style:[Pe.clearText,{color:o===0?de.color.textTertiary:de.color.danger}],children:"Clear"})]})]}),Me(xt,{availableSources:t,onToggleSource:r,totalCount:o,filteredCount:n}),Me(It,{events:e,selectedEventId:void 0,onEventPress:u,isCapturing:i,totalCount:o,sourceCount:t.length,enabledSourceCount:t.filter(d=>d.enabled!==false).length})]})}var Pe=le.create({container:{flex:1,backgroundColor:"transparent"},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:16,paddingVertical:12,backgroundColor:de.color.surface,borderBottomWidth:1,borderBottomColor:de.color.border},title:{fontSize:20,fontWeight:"700",color:de.color.text},subtitle:{fontSize:12,color:de.color.textTertiary,marginTop:2},clearButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8,borderRadius:6,backgroundColor:de.color.dangerSoft},clearText:{fontSize:14,fontWeight:"600"}});import{approxJsonSize as Ri,isJsonSerializable as ji,isOverWireBudget as zi}from"@buoy-gg/shared-ui/web";var Ne=16*1024;function Jr(e,t){return{__buoyTruncated:true,approxBytes:e,note:t??`Payload (\u2265${(e/1024).toFixed(0)}KB approx) exceeds the ${Ne/1024}KB sync limit and stayed on the device. Open the tool on-device (or use the source tool's detail action) for the full payload.`}}var Ye={__buoyOmitted:"state-tree",note:"prevState/nextState stay on the device (use get_redux_state / the on-device tool)."},Mi={__buoyOmitted:"query-payload",note:"Query/mutation data stays on the device (open the Query tool or the on-device Events detail)."},dt={__buoyOmitted:"network-body",note:"Request/response body stays on the device (open the Network tool or the on-device Events detail)."},Wr={__buoyOmitted:"network-headers",note:"Request/response headers stay on the device (open the Network tool or the on-device Events detail)."},Pi={__buoyOmitted:"graphql-variables",note:"GraphQL variables stay on the device (open the Network tool or the on-device Events detail)."},Jt={__buoyOmitted:"storage-value",note:"Storage value stays on the device (open the Storage tool or the on-device Events detail)."},Ni={__buoyOmitted:"route-params",note:"Navigation params stay on the device (open the Routes tool or the on-device Events detail)."};function Vi(e){return e==="react-query"||e==="react-query-query"||e==="react-query-mutation"}function se(e,t){if(e!==void 0)return zi(e,Ne)?{...t}:e}function mt(e){return se(e,Mi)}function Kr(e){return e==null?e:e instanceof Error?{name:e.name,message:e.message}:mt(e)}var _r=new WeakMap;function Oi(e){let t=e.originalEvent;if(typeof t!="object"||t===null)return e;let r=_r.get(e);if(r!==void 0)return r;let a=e,o=t;if((e.source==="redux"||e.source==="zustand")&&("prevState"in o||"nextState"in o))o={...o,prevState:{...Ye},nextState:{...Ye},...e.source==="zustand"&&"partial"in o?{partial:{...Ye}}:{}},a={...e,originalEvent:o};else if(e.source==="jotai"&&("prevValue"in o||"nextValue"in o))o={...o,prevValue:{...Ye},nextValue:{...Ye}},a={...e,originalEvent:o};else if(e.source==="render"){let s=o.render,u=o.event,c=d=>{if(!d||typeof d!="object")return d;let{hookChanges:h,...b}=d;return b};o={...o,render:s&&{...s,renderHistory:void 0,lastRenderCause:c(s.lastRenderCause)},event:u&&{...u,capturedProps:void 0,capturedState:void 0,cause:c(u.cause)}},a={...e,originalEvent:o}}else if(Vi(e.source)){let{query:s,mutation:u,...c}=o;o={...c,queryData:mt(c.queryData),mutationData:mt(c.mutationData),mutationVariables:mt(c.mutationVariables),queryError:Kr(c.queryError),mutationError:Kr(c.mutationError)},a={...e,originalEvent:o}}else if(e.source==="network"){let s=typeof o.requestSize=="number"?o.requestSize:void 0,u=typeof o.responseSize=="number"?o.responseSize:void 0;o={...o,requestData:s!==void 0&&s>Ne?{...dt}:se(o.requestData,dt),responseData:u!==void 0&&u>Ne?{...dt}:se(o.responseData,dt),graphqlVariables:se(o.graphqlVariables,Pi),requestHeaders:se(o.requestHeaders,Wr),responseHeaders:se(o.responseHeaders,Wr)},a={...e,originalEvent:o}}else if(e.source==="storage-async"||e.source==="storage-mmkv"){let s=o.data;s&&(o={...o,data:{...s,value:se(s.value,Jt),prevValue:se(s.prevValue,Jt),pairs:se(s.pairs,Jt)}},a={...e,originalEvent:o})}else e.source==="route"&&(o={...o,params:se(o.params,Ni)},a={...e,originalEvent:o});let{bytes:n,sawRepeat:i,sawBigInt:l}=Ri(o,Ne);return n>Ne?a={...e,originalEvent:Jr(n)}:(i||l)&&!ji(o)&&(a={...e,originalEvent:Jr(-1,"Payload is not JSON-serializable (cyclic or bigint) and stayed on the device.")}),_r.set(e,a),a}var Ui={version:2,getSnapshot:()=>({events:L.getEvents().map(Oi),availableSources:Array.from(L.getAvailableEventSources())}),subscribe:e=>{L.ensureRemoteSourcesDefault();let t=L.subscribe(()=>e());return()=>{t(),L.clearRemoteSources()}},actions:{clearEvents:()=>{L.clearEvents()},setEnabledSources:e=>{let t=e?.sources??[];return L.setRemoteEnabledSources(t),{enabledSources:t}},exportEvents:e=>{let t=e??{},r={...t.preset&&We[t.preset]?We[t.preset]:Je,...t.settings??{}},a=L.getEvents(),o=typeof t.limit=="number"&&t.limit>0?t.limit:a.length,n=a.slice(0,o);return{output:Ot(n,r),returned:n.length,totalAvailable:a.length,includedData:r.includeEventData,format:r.format}}}};export{We as COPY_PRESETS,Je as DEFAULT_COPY_SETTINGS,S as EVENTS_TEST_ID,Or as EventsCopySettingsView,Ht as EventsModal,ki as EventsToolView,P as PRESET_METADATA,Er as ReactQueryEventDetail,Bt as UnifiedEventDetail,xt as UnifiedEventFilters,fr as UnifiedEventItem,It as UnifiedEventList,Fi as UnifiedEventViewer,yr as buildCorrelationCountMap,Si as clearCopySettings,Ai as createEventsTool,Ar as detectActivePreset,Fr as estimateExportSize,mr as eventFilterTestID,cr as eventIdentity,dr as eventRowTestID,Ui as eventsSyncAdapter,Lr as eventsToolPreset,Qe as filterEvents,Sn as findRelatedEvents,Ot as generateExport,Rr as generateJsonExport,Pt as generateMarkdownExport,Pr as generateMermaidExport,jr as generatePlaintextExport,Cr as getCorrelationColor,br as getCorrelationGroup,vr as getCorrelationLabel,_e as getExportSummary,wn as getRelatedEventsCount,Cn as hasRelatedEvents,vt as isBuoyInternalEvent,Ya as isEventHiddenFromTool,St as isNetworkEventIgnored,Vr as loadCopySettings,Nr as saveCopySettings,L as unifiedEventStore,wt as useUnifiedEvents};