@buoy-gg/events 7.0.40 → 7.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/lib/commonjs/components/EventsModal.js +1 -10
- package/lib/commonjs/components/EventsModal.js.map +1 -1
- package/lib/commonjs/components/UnifiedEventDetail.js +19 -10
- package/lib/commonjs/components/UnifiedEventDetail.js.map +1 -1
- package/lib/commonjs/components/UnifiedEventItem.js +31 -32
- package/lib/commonjs/components/UnifiedEventItem.js.map +1 -1
- package/lib/commonjs/utils/autoDiscoverEventSources.js +16 -13
- package/lib/commonjs/utils/autoDiscoverEventSources.js.map +1 -1
- package/lib/module/components/EventsModal.js +1 -10
- package/lib/module/components/EventsModal.js.map +1 -1
- package/lib/module/components/UnifiedEventDetail.js +19 -10
- package/lib/module/components/UnifiedEventDetail.js.map +1 -1
- package/lib/module/components/UnifiedEventItem.js +31 -32
- package/lib/module/components/UnifiedEventItem.js.map +1 -1
- package/lib/module/utils/autoDiscoverEventSources.js +16 -13
- package/lib/module/utils/autoDiscoverEventSources.js.map +1 -1
- package/lib/typescript/components/EventsModal.d.ts +1 -7
- package/lib/typescript/components/EventsModal.d.ts.map +1 -1
- package/lib/typescript/components/UnifiedEventDetail.d.ts +2 -9
- package/lib/typescript/components/UnifiedEventDetail.d.ts.map +1 -1
- package/lib/typescript/components/UnifiedEventItem.d.ts +0 -7
- package/lib/typescript/components/UnifiedEventItem.d.ts.map +1 -1
- package/lib/typescript/utils/autoDiscoverEventSources.d.ts.map +1 -1
- package/lib/web/index.mjs +13 -0
- package/package.json +31 -11
|
@@ -0,0 +1,13 @@
|
|
|
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(`
|
|
6
|
+
`).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
|
|
10
|
+
participant U as \u{1F464} User
|
|
11
|
+
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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/events",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.41",
|
|
4
4
|
"description": "Review retained events from connected Buoy tools and export timeline data for investigation.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -10,28 +10,38 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"react-native": "./lib/module/index.js",
|
|
13
|
+
"browser": {
|
|
14
|
+
"types": "./lib/typescript/index.d.ts",
|
|
15
|
+
"default": "./lib/web/index.mjs"
|
|
16
|
+
},
|
|
13
17
|
"import": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
18
|
+
"types": "./lib/typescript/index.d.ts",
|
|
19
|
+
"default": "./lib/module/index.js"
|
|
16
20
|
},
|
|
17
21
|
"require": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
22
|
+
"types": "./lib/typescript/index.d.ts",
|
|
23
|
+
"default": "./lib/commonjs/index.js"
|
|
20
24
|
}
|
|
21
25
|
},
|
|
22
|
-
"./package.json": "./package.json"
|
|
26
|
+
"./package.json": "./package.json",
|
|
27
|
+
"./web": {
|
|
28
|
+
"types": "./lib/typescript/index.d.ts",
|
|
29
|
+
"default": "./lib/web/index.mjs"
|
|
30
|
+
}
|
|
23
31
|
},
|
|
24
32
|
"files": [
|
|
25
33
|
"lib"
|
|
26
34
|
],
|
|
27
35
|
"sideEffects": false,
|
|
28
36
|
"dependencies": {
|
|
29
|
-
"@buoy-gg/floating-tools-core": "^7.0.
|
|
30
|
-
"@buoy-gg/shared-ui": "^7.0.
|
|
37
|
+
"@buoy-gg/floating-tools-core": "^7.0.41",
|
|
38
|
+
"@buoy-gg/shared-ui": "^7.0.41"
|
|
31
39
|
},
|
|
32
40
|
"peerDependencies": {
|
|
33
41
|
"react": "*",
|
|
34
|
-
"react-native": "*"
|
|
42
|
+
"react-native": "*",
|
|
43
|
+
"react-native-web": "^0.21.0",
|
|
44
|
+
"react-dom": ">=18"
|
|
35
45
|
},
|
|
36
46
|
"peerDependenciesMeta": {
|
|
37
47
|
"@buoy-gg/storage": {
|
|
@@ -60,6 +70,15 @@
|
|
|
60
70
|
},
|
|
61
71
|
"@buoy-gg/highlight-updates": {
|
|
62
72
|
"optional": true
|
|
73
|
+
},
|
|
74
|
+
"react-native": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
77
|
+
"react-native-web": {
|
|
78
|
+
"optional": true
|
|
79
|
+
},
|
|
80
|
+
"react-dom": {
|
|
81
|
+
"optional": true
|
|
63
82
|
}
|
|
64
83
|
},
|
|
65
84
|
"devDependencies": {
|
|
@@ -106,10 +125,11 @@
|
|
|
106
125
|
"app-events"
|
|
107
126
|
],
|
|
108
127
|
"scripts": {
|
|
109
|
-
"build": "bob build",
|
|
128
|
+
"build": "bob build && pnpm run build:web",
|
|
110
129
|
"typecheck": "tsc --noEmit",
|
|
111
130
|
"clean": "rimraf lib",
|
|
112
131
|
"test": "pnpm run typecheck",
|
|
113
|
-
"postinstall": "echo \"Run pnpm build to compile this package\""
|
|
132
|
+
"postinstall": "echo \"Run pnpm build to compile this package\"",
|
|
133
|
+
"build:web": "node ../../scripts/build-web.mjs events"
|
|
114
134
|
}
|
|
115
135
|
}
|