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