@buoy-gg/network 7.0.78 → 7.0.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +68 -2
  2. package/lib/commonjs/expo-network.js +1 -0
  3. package/lib/commonjs/index.js +1 -1
  4. package/lib/commonjs/index.web.js +1 -1
  5. package/lib/commonjs/netinfo.js +1 -0
  6. package/lib/commonjs/network/components/NetworkEventDetailView.js +2 -2
  7. package/lib/commonjs/network/components/NetworkEventDetailView.web.js +1 -1
  8. package/lib/commonjs/network/components/NetworkEventItemCompact.js +2 -2
  9. package/lib/commonjs/network/components/NetworkEventItemCompact.web.js +1 -1
  10. package/lib/commonjs/network/components/NetworkModal.js +1 -1
  11. package/lib/commonjs/network/conditions/NetworkConditionsControl.js +1 -1
  12. package/lib/commonjs/network/conditions/NetworkConditionsControl.test.js +1 -1
  13. package/lib/commonjs/network/conditions/NetworkConditionsIcon.js +1 -1
  14. package/lib/commonjs/network/conditions/NetworkFloatingTool.js +1 -1
  15. package/lib/commonjs/network/conditions/NetworkFloatingTool.test.js +1 -1
  16. package/lib/commonjs/network/conditions/connectivity/netInfoFacade.js +1 -0
  17. package/lib/commonjs/network/conditions/connectivity/patchNetwork.js +1 -0
  18. package/lib/commonjs/network/conditions/pacer.js +1 -0
  19. package/lib/commonjs/network/conditions/profiles.js +1 -0
  20. package/lib/commonjs/network/conditions/remoteState.js +1 -0
  21. package/lib/commonjs/network/conditions/store.js +1 -1
  22. package/lib/commonjs/network/conditions/wait.js +1 -1
  23. package/lib/commonjs/network/conditions/xhr.js +1 -1
  24. package/lib/commonjs/network/overrides/engine.js +1 -1
  25. package/lib/commonjs/network/overrides/matchRule.js +1 -1
  26. package/lib/commonjs/network/overrides/overrideRulesStore.js +1 -1
  27. package/lib/commonjs/network/sync/networkSyncAdapter.js +1 -1
  28. package/lib/commonjs/network/utils/generateNetworkCopyText.js +1 -0
  29. package/lib/commonjs/network/utils/networkListener.js +4 -4
  30. package/lib/module/expo-network.js +1 -0
  31. package/lib/module/index.js +1 -1
  32. package/lib/module/index.web.js +1 -1
  33. package/lib/module/netinfo.js +1 -0
  34. package/lib/module/network/components/NetworkEventDetailView.js +2 -2
  35. package/lib/module/network/components/NetworkEventDetailView.web.js +2 -2
  36. package/lib/module/network/components/NetworkEventItemCompact.js +2 -2
  37. package/lib/module/network/components/NetworkEventItemCompact.web.js +1 -1
  38. package/lib/module/network/components/NetworkModal.js +1 -1
  39. package/lib/module/network/conditions/NetworkConditionsControl.js +1 -1
  40. package/lib/module/network/conditions/NetworkConditionsControl.test.js +1 -1
  41. package/lib/module/network/conditions/NetworkConditionsIcon.js +1 -1
  42. package/lib/module/network/conditions/NetworkFloatingTool.js +1 -1
  43. package/lib/module/network/conditions/NetworkFloatingTool.test.js +1 -1
  44. package/lib/module/network/conditions/connectivity/netInfoFacade.js +1 -0
  45. package/lib/module/network/conditions/connectivity/patchNetwork.js +1 -0
  46. package/lib/module/network/conditions/pacer.js +1 -0
  47. package/lib/module/network/conditions/profiles.js +1 -0
  48. package/lib/module/network/conditions/remoteState.js +1 -0
  49. package/lib/module/network/conditions/store.js +1 -1
  50. package/lib/module/network/conditions/wait.js +1 -1
  51. package/lib/module/network/conditions/xhr.js +1 -1
  52. package/lib/module/network/overrides/engine.js +1 -1
  53. package/lib/module/network/overrides/matchRule.js +1 -1
  54. package/lib/module/network/overrides/overrideRulesStore.js +1 -1
  55. package/lib/module/network/sync/networkSyncAdapter.js +1 -1
  56. package/lib/module/network/utils/generateNetworkCopyText.js +23 -22
  57. package/lib/module/network/utils/networkListener.js +4 -4
  58. package/lib/typescript/expo-network.d.ts +2 -0
  59. package/lib/typescript/index.d.ts +3 -2
  60. package/lib/typescript/index.web.d.ts +3 -2
  61. package/lib/typescript/netinfo.d.ts +3 -0
  62. package/lib/typescript/network/conditions/NetworkConditionsControl.d.ts +5 -2
  63. package/lib/typescript/network/conditions/NetworkFloatingTool.d.ts +4 -3
  64. package/lib/typescript/network/conditions/connectivity/netInfoFacade.d.ts +3 -0
  65. package/lib/typescript/network/conditions/connectivity/patchNetwork.d.ts +24 -0
  66. package/lib/typescript/network/conditions/pacer.d.ts +16 -0
  67. package/lib/typescript/network/conditions/profiles.d.ts +57 -0
  68. package/lib/typescript/network/conditions/remoteState.d.ts +4 -0
  69. package/lib/typescript/network/conditions/store.d.ts +45 -19
  70. package/lib/typescript/network/conditions/xhr.d.ts +1 -1
  71. package/lib/typescript/network/overrides/engine.d.ts +14 -0
  72. package/lib/typescript/network/overrides/matchRule.d.ts +3 -0
  73. package/lib/typescript/network/overrides/overrideRulesStore.d.ts +3 -0
  74. package/lib/typescript/network/overrides/types.d.ts +19 -0
  75. package/lib/typescript/network/sync/networkSyncAdapter.d.ts +27 -12
  76. package/lib/typescript/network/utils/networkListener.d.ts +4 -0
  77. package/lib/web/index.mjs +58 -57
  78. package/package.json +26 -3
@@ -1 +1 @@
1
- "use strict";export{networkToolPreset,createNetworkTool}from"./preset";export{startNetworkCapture}from"./network/utils/startNetworkCapture";export{NetworkModal,NetworkToolView}from"./network/components/NetworkModal";export{NetworkEventDetailView}from"./network/components/NetworkEventDetailView";export{NetworkEventItemCompact}from"./network/components/NetworkEventItemCompact";export{NetworkSavedScreen}from"./network/components/NetworkSavedScreen";export{NetworkSavedButton,NetworkDetailPinActions,NetworkHeaderBadgesView}from"./network/components/NetworkHeaderLive";export{useNetworkEvents}from"./network/hooks/useNetworkEvents";export{useNetworkEventList}from"./network/hooks/useNetworkEventList";export{useLiveNetworkEvent}from"./network/hooks/useLiveNetworkEvent";export{useNetworkBadgeCounts}from"./network/hooks/useNetworkBadgeCounts";export{useNetworkSaved}from"./network/hooks/useNetworkSaved";export{splitPinned}from"./network/utils/withPinnedFirst";export{networkSelectionStore,DEFAULT_SETTLE_MS}from"./network/utils/networkSelectionStore";export{TickProvider,useTickEveryMinute}from"./network/hooks/useTickEveryMinute";export{formatBytes,formatDuration,formatHttpStatus}from"./network/utils/formatting";export{overrideRulesStore}from"./network/overrides/overrideRulesStore";export{draftFromEvent}from"./network/overrides/presets";export{MAX_RULES as MAX_OVERRIDE_RULES,FREE_TIER_RULE_LIMIT as FREE_TIER_OVERRIDE_LIMIT,STATUS_MIN as OVERRIDE_STATUS_MIN,STATUS_MAX as OVERRIDE_STATUS_MAX}from"./network/overrides/types";export{useIgnoredPatterns,ignoredPatternsStore,urlMatchesIgnoredPattern,isUrlIgnored}from"@buoy-gg/shared-ui";export{networkSyncAdapter}from"./network/sync/networkSyncAdapter";export{NetworkBodyResolverProvider}from"./network/sync/networkBodyResolver";export{networkEventStore}from"./network/utils/networkEventStore";export{networkSavedStore,flagsForEventId,FREE_TIER_SAVED_LIMIT,MAX_PINNED,MAX_SAVED}from"./network/utils/networkSavedStore";export{generateCurl}from"./network/utils/generateCurl";export{networkListener,addNetworkListener,removeAllNetworkListeners}from"./network/utils/networkListener";export{NETWORK_CONDITIONS,getNetworkCondition,setNetworkCondition,subscribeNetworkConditions}from"./network/conditions/store";
1
+ "use strict";export{networkToolPreset,createNetworkTool}from"./preset";export{startNetworkCapture}from"./network/utils/startNetworkCapture";export{NetworkModal,NetworkToolView}from"./network/components/NetworkModal";export{NetworkEventDetailView}from"./network/components/NetworkEventDetailView";export{NetworkEventItemCompact}from"./network/components/NetworkEventItemCompact";export{NetworkSavedScreen}from"./network/components/NetworkSavedScreen";export{NetworkSavedButton,NetworkDetailPinActions,NetworkHeaderBadgesView}from"./network/components/NetworkHeaderLive";export{useNetworkEvents}from"./network/hooks/useNetworkEvents";export{useNetworkEventList}from"./network/hooks/useNetworkEventList";export{useLiveNetworkEvent}from"./network/hooks/useLiveNetworkEvent";export{useNetworkBadgeCounts}from"./network/hooks/useNetworkBadgeCounts";export{useNetworkSaved}from"./network/hooks/useNetworkSaved";export{splitPinned}from"./network/utils/withPinnedFirst";export{networkSelectionStore,DEFAULT_SETTLE_MS}from"./network/utils/networkSelectionStore";export{TickProvider,useTickEveryMinute}from"./network/hooks/useTickEveryMinute";export{formatBytes,formatDuration,formatHttpStatus}from"./network/utils/formatting";export{overrideRulesStore}from"./network/overrides/overrideRulesStore";export{draftFromEvent}from"./network/overrides/presets";export{MAX_RULES as MAX_OVERRIDE_RULES,FREE_TIER_RULE_LIMIT as FREE_TIER_OVERRIDE_LIMIT,STATUS_MIN as OVERRIDE_STATUS_MIN,STATUS_MAX as OVERRIDE_STATUS_MAX}from"./network/overrides/types";export{useIgnoredPatterns,ignoredPatternsStore,urlMatchesIgnoredPattern,isUrlIgnored}from"@buoy-gg/shared-ui";export{networkSyncAdapter}from"./network/sync/networkSyncAdapter";export{NetworkBodyResolverProvider}from"./network/sync/networkBodyResolver";export{networkEventStore}from"./network/utils/networkEventStore";export{networkSavedStore,flagsForEventId,FREE_TIER_SAVED_LIMIT,MAX_PINNED,MAX_SAVED}from"./network/utils/networkSavedStore";export{generateCurl}from"./network/utils/generateCurl";export{networkListener,addNetworkListener,removeAllNetworkListeners}from"./network/utils/networkListener";export{NETWORK_CONDITIONS,getNetworkCondition,setNetworkCondition,subscribeNetworkConditions,getNetworkConditions,setNetworkConditions,getNetworkConnection,getConditionsRevision,networkConditionsActive}from"./network/conditions/store";export{chooseConditionsSnapshot}from"./network/conditions/remoteState";
@@ -1 +1 @@
1
- "use strict";export{networkListener,startNetworkListener,stopNetworkListener,addNetworkListener,removeAllNetworkListeners,isNetworkListening}from"./network/utils/networkListener";export{networkEventStore}from"./network/utils/networkEventStore";export{networkSavedStore,flagsForEventId}from"./network/utils/networkSavedStore";export{useNetworkEvents,FREE_TIER_REQUEST_LIMIT}from"./network/hooks/useNetworkEvents";export{useNetworkEventList}from"./network/hooks/useNetworkEventList";export{useLiveNetworkEvent}from"./network/hooks/useLiveNetworkEvent";export{useNetworkBadgeCounts}from"./network/hooks/useNetworkBadgeCounts";export{useHasNetworkSelection,useSelectedNetworkEventId,useNetworkBodyEventId,useNetworkCursor}from"./network/hooks/useNetworkSelection";export{networkSelectionStore,toSelectionIds}from"./network/utils/networkSelectionStore";export{NetworkListScreen}from"./network/components/NetworkListScreen.web";export{NetworkEventItemCompact}from"./network/components/NetworkEventItemCompact.web";export{NetworkHeaderBadges,NetworkClearButton,NetworkSavedButton,NetworkDetailPinActions,NetworkHeaderCopyButton}from"./network/components/NetworkHeaderLive.web";export{NetworkEventDetailView}from"./network/components/NetworkEventDetailView.web";export{NetworkDetailStepper}from"./network/components/NetworkDetailStepper.web";export{NetworkDetailScreen}from"./network/components/NetworkDetailScreen.web";export{NetworkFilterViewV3}from"./network/components/NetworkFilterViewV3.web";export{NetworkFilterScreen}from"./network/components/NetworkFilterScreen.web";export{NetworkSavedScreen}from"./network/components/NetworkSavedScreen.web";export{NetworkCopySettingsView,DEFAULT_COPY_SETTINGS}from"./network/components/NetworkCopySettingsView.web";export{NetworkCopyScreen}from"./network/components/NetworkCopyScreen.web";export{generateNetworkCopyText}from"./network/utils/generateNetworkCopyText";export{selectSavedEvents}from"./network/utils/selectSavedEvents";export{FREE_TIER_SAVED_LIMIT,MAX_SAVED}from"./network/utils/networkSavedStore";export{NetworkOverridesScreen}from"./network/components/NetworkOverridesScreen.web";export{NetworkOverrideEditor}from"./network/components/NetworkOverrideEditor.web";export{NetworkNumberPrompt}from"./network/components/NetworkNumberPrompt.web";export{NetworkOverridesButton}from"./network/components/NetworkOverridesButton.web";export{NetworkOverrideHeaderButton}from"./network/components/NetworkOverrideHeaderButton.web";export{useOverrideRules}from"./network/hooks/useOverrideRules";export{overrideRulesStore}from"./network/overrides/overrideRulesStore";export{draftFromEvent,patternForUrl}from"./network/overrides/presets";export{FREE_TIER_RULE_LIMIT,MAX_RULES,STATUS_MAX,STATUS_MIN}from"./network/overrides/types";export{ruleMatches}from"./network/overrides/matchRule";export{filterNetworkEvents,applyIgnoredPatterns}from"./network/utils/filterNetworkEvents";export{splitPinned}from"./network/utils/withPinnedFirst";export{extractOperationName}from"./network/utils/extractOperationName";export{generateCurl}from"./network/utils/generateCurl";export{NETWORK_CONDITIONS,getNetworkCondition,setNetworkCondition,subscribeNetworkConditions}from"./network/conditions/store";
1
+ "use strict";export{networkListener,startNetworkListener,stopNetworkListener,addNetworkListener,removeAllNetworkListeners,isNetworkListening}from"./network/utils/networkListener";export{networkEventStore}from"./network/utils/networkEventStore";export{networkSavedStore,flagsForEventId}from"./network/utils/networkSavedStore";export{useNetworkEvents,FREE_TIER_REQUEST_LIMIT}from"./network/hooks/useNetworkEvents";export{useNetworkEventList}from"./network/hooks/useNetworkEventList";export{useLiveNetworkEvent}from"./network/hooks/useLiveNetworkEvent";export{useNetworkBadgeCounts}from"./network/hooks/useNetworkBadgeCounts";export{useHasNetworkSelection,useSelectedNetworkEventId,useNetworkBodyEventId,useNetworkCursor}from"./network/hooks/useNetworkSelection";export{networkSelectionStore,toSelectionIds}from"./network/utils/networkSelectionStore";export{NetworkListScreen}from"./network/components/NetworkListScreen.web";export{NetworkEventItemCompact}from"./network/components/NetworkEventItemCompact.web";export{NetworkHeaderBadges,NetworkClearButton,NetworkSavedButton,NetworkDetailPinActions,NetworkHeaderCopyButton}from"./network/components/NetworkHeaderLive.web";export{NetworkEventDetailView}from"./network/components/NetworkEventDetailView.web";export{NetworkDetailStepper}from"./network/components/NetworkDetailStepper.web";export{NetworkDetailScreen}from"./network/components/NetworkDetailScreen.web";export{NetworkFilterViewV3}from"./network/components/NetworkFilterViewV3.web";export{NetworkFilterScreen}from"./network/components/NetworkFilterScreen.web";export{NetworkSavedScreen}from"./network/components/NetworkSavedScreen.web";export{NetworkCopySettingsView,DEFAULT_COPY_SETTINGS}from"./network/components/NetworkCopySettingsView.web";export{NetworkCopyScreen}from"./network/components/NetworkCopyScreen.web";export{generateNetworkCopyText}from"./network/utils/generateNetworkCopyText";export{selectSavedEvents}from"./network/utils/selectSavedEvents";export{FREE_TIER_SAVED_LIMIT,MAX_SAVED}from"./network/utils/networkSavedStore";export{NetworkOverridesScreen}from"./network/components/NetworkOverridesScreen.web";export{NetworkOverrideEditor}from"./network/components/NetworkOverrideEditor.web";export{NetworkNumberPrompt}from"./network/components/NetworkNumberPrompt.web";export{NetworkOverridesButton}from"./network/components/NetworkOverridesButton.web";export{NetworkOverrideHeaderButton}from"./network/components/NetworkOverrideHeaderButton.web";export{useOverrideRules}from"./network/hooks/useOverrideRules";export{overrideRulesStore}from"./network/overrides/overrideRulesStore";export{draftFromEvent,patternForUrl}from"./network/overrides/presets";export{FREE_TIER_RULE_LIMIT,MAX_RULES,STATUS_MAX,STATUS_MIN}from"./network/overrides/types";export{ruleMatches}from"./network/overrides/matchRule";export{filterNetworkEvents,applyIgnoredPatterns}from"./network/utils/filterNetworkEvents";export{splitPinned}from"./network/utils/withPinnedFirst";export{extractOperationName}from"./network/utils/extractOperationName";export{generateCurl}from"./network/utils/generateCurl";export{NETWORK_CONDITIONS,getNetworkCondition,setNetworkCondition,subscribeNetworkConditions,getNetworkConditions,setNetworkConditions,getNetworkConnection,getConditionsRevision,networkConditionsActive}from"./network/conditions/store";export{chooseConditionsSnapshot}from"./network/conditions/remoteState";
@@ -0,0 +1 @@
1
+ "use strict";import{wrapNetInfoApi as r}from"./network/conditions/connectivity/netInfoFacade";import{getEffectiveNetworkConnection as i,setConnectionSupport as n,subscribeNetworkConditions as a}from"./network/conditions/store";import{patchConnectionState as f}from"./network/conditions/connectivity/patchNetwork";let o=false;export function installNetInfoConditions(){if(o||typeof __DEV__==="undefined"||!__DEV__)return;let e;try{const t=require("@react-native-community/netinfo/src/internal/nativeInterface").default;e=f(t,i,a);r(require("@react-native-community/netinfo"));o=true;n("netInfo",{supported:true})}catch(t){e?.();n("netInfo",{supported:false,reason:t instanceof Error?t.message:"NetInfo hook could not load."})}}installNetInfoConditions();
@@ -1,4 +1,4 @@
1
- "use strict";import{useState as H,useEffect as U,useMemo as ee,memo as oe}from"react";import{View as l,Text as i,StyleSheet as te,ScrollView as re,TouchableOpacity as O}from"react-native";import{Clock as M,Upload as G,Download as J,AlertCircle as le,ChevronDown as _,ChevronUp as Q,Lock as ie,Unlock as ne,FileJson as E,Filter as ae,Globe as se,Link as ce,Copy as Y,FlaskConical as de,InlineCopyButton as K,macOSColors as N,night as t,useFeatureGate as ue,UpgradeModal as pe,monoFont as R}from"@buoy-gg/shared-ui";import{formatBytes as q,formatDuration as X,formatHttpStatus as ge}from"../utils/formatting";import{formatRelativeTime as he}from"@buoy-gg/shared-ui";import{DataViewer as F}from"@buoy-gg/shared-ui/dataViewer";import{formatGraphQLDisplay as fe}from"../utils/formatGraphQLVariables";import{useNetworkBodyResolver as ye}from"../sync/networkBodyResolver";import{jsx as e,jsxs as n,Fragment as W}from"react/jsx-runtime";const A=t.color.accent;const me=new Set;const be=()=>{};const Se=({timings:d,total:r})=>{const u=Math.max(1,r);const h=[{label:"Waiting (TTFB)",hint:"incl. queue, DNS, TLS",value:d.ttfb,color:N.semantic.warning},{label:"Content download",hint:void 0,value:d.download,color:N.semantic.success}];return e(l,{style:o.phaseList,children:h.map(s=>n(l,{style:o.phaseRow,children:[n(l,{style:o.phaseLabelGroup,children:[e(i,{style:o.phaseLabel,children:s.label}),s.hint?e(i,{style:o.phaseHint,children:s.hint}):null]}),e(l,{style:o.phaseTrack,children:e(l,{style:[o.phaseBar,{backgroundColor:s.color,width:`${Math.min(100,Math.max(1,s.value/u*100))}%`}]})}),e(i,{style:o.phaseValue,children:X(s.value)})]},s.label))})};const Z=()=>e(l,{style:o.bodyDeferred});const T=({title:d,icon:r,children:u,defaultOpen:h=false,count:s})=>{const[p,B]=H(h);return n(l,{style:o.collapsibleSection,children:[n(O,{style:o.collapsibleHeader,onPress:()=>B(!p),testID:`buoy-network-section-${d.toLowerCase().replace(/\s+/g,"-")}`,accessibilityRole:"button",accessibilityLabel:d,children:[n(l,{style:o.collapsibleTitle,children:[r,e(i,{style:o.collapsibleTitleText,children:d}),s!==void 0?e(i,{style:o.collapsibleCount,children:s}):null]}),p?e(Q,{size:16,color:t.color.textSecondary}):e(_,{size:16,color:t.color.textSecondary})]}),p?e(l,{style:o.collapsibleContent,children:u}):null]})};const xe=({url:d,requestData:r,operationName:u,graphqlVariables:h,requestClient:s,isPro:p=false,onUpgradePress:B})=>{const g=L=>{try{const y=new URL(L);const x=String(y.protocol||"");const C=String(y.host||"");const V=x==="https:";let m=String(y.pathname||"");if(s==="graphql"&&u){const z=fe(u,h);m=`${m} (${z})`}else if(u){m=`${m} (${u})`}const w={};const b=y.searchParams;if(b&&typeof b.forEach==="function"){b.forEach((z,D)=>{w[D]=z})}return{protocol:x.replace(":",""),host:C,pathname:m,params:Object.keys(w).length>0?w:null,isSecure:V}}catch{return{protocol:"",host:d,pathname:"",params:null,isSecure:false}}};const c=ee(()=>g(d),[d,s,u,h]);const[f,k]=H(false);return n(l,{style:o.urlBreakdown,children:[n(l,{style:o.urlRow,children:[c.isSecure?e(ie,{size:12,color:N.semantic.success}):e(ne,{size:12,color:N.semantic.warning}),e(i,{style:o.urlDomain,children:c.host}),n(i,{style:o.urlProtocol,children:["(",c.protocol.toUpperCase(),")"]}),p?e(K,{value:d,buttonStyle:o.copyButton}):e(O,{style:o.copyButton,onPress:B,activeOpacity:.7,children:e(Y,{size:14,color:t.color.textSecondary})})]}),e(l,{style:o.urlPathRow,children:n(i,{style:o.urlPath,numberOfLines:2,children:[c.pathname,c.params?n(i,{style:o.urlQueryString,children:["?",new URLSearchParams(c.params).toString()]}):null]})}),c.params?n(l,{style:o.queryParamsCollapsible,children:[n(O,{style:o.queryParamsToggle,onPress:()=>k(!f),activeOpacity:.7,children:[e(i,{style:o.queryParamsToggleText,children:"Query Parameters"}),e(i,{style:o.collapsibleCount,children:Object.keys(c.params).length}),f?e(Q,{size:14,color:t.color.textSecondary}):e(_,{size:14,color:t.color.textSecondary})]}),f?e(F,{title:"",data:c.params,showTypeFilter:true,rawMode:true,initialExpanded:true}):null]}):null]})};export const NetworkEventDetailView=oe(function d({event:r,ignoredPatterns:u=me,onTogglePattern:h=be,showBodies:s=true}){const p=r.status?ge(r.status):null;const B=!r.status&&!r.error;const{isPro:g}=ue();const[c,f]=H(false);U(()=>{if(c&&g){f(false)}},[c,g]);const k=ye();const L=r.requestData===void 0&&(r.requestBodyOmitted===true||(r.requestSize??0)>0);const y=r.responseData===void 0&&(r.responseBodyOmitted===true||(r.responseSize??0)>0);const x=r.headersOmitted===true;const[C,V]=H(null);const[m,w]=H(false);U(()=>{V(null);if(!k||!L&&!y&&!x){w(false);return}let a=false;w(true);k(r.id).then(S=>{if(!a)V(S)}).catch(()=>{}).finally(()=>{if(!a)w(false)});return()=>{a=true}},[r.id,k,L,y,x]);const b=r.requestData??C?.requestData??void 0;const z=r.responseData??C?.responseData??void 0;const D=(x?C?.requestHeaders:void 0)??r.requestHeaders;const $=(x?C?.responseHeaders:void 0)??r.responseHeaders;const v=()=>{const a={method:r.method,url:r.url,status:r.status,statusText:r.statusText,timestamp:new Date(r.timestamp).toISOString(),duration:r.duration?`${r.duration}ms`:"N/A",requestHeaders:D,requestData:b,responseHeaders:$,responseData:z,requestSize:r.requestSize?q(r.requestSize):"N/A",responseSize:r.responseSize?q(r.responseSize):"N/A",error:r.error,client:r.requestClient};return`# Network Request Details
1
+ "use strict";import{useState as F,useEffect as U,useMemo as ee,memo as oe}from"react";import{View as l,Text as i,StyleSheet as te,ScrollView as re,TouchableOpacity as O}from"react-native";import{Clock as M,Upload as G,Download as J,AlertCircle as le,ChevronDown as _,ChevronUp as Q,Lock as ie,Unlock as ne,FileJson as E,Filter as ae,Globe as se,Link as ce,Copy as Y,FlaskConical as de,InlineCopyButton as K,macOSColors as N,night as t,useFeatureGate as ue,UpgradeModal as pe,monoFont as R}from"@buoy-gg/shared-ui";import{formatBytes as q,formatDuration as X,formatHttpStatus as ge}from"../utils/formatting";import{formatRelativeTime as he}from"@buoy-gg/shared-ui";import{DataViewer as H}from"@buoy-gg/shared-ui/dataViewer";import{formatGraphQLDisplay as fe}from"../utils/formatGraphQLVariables";import{useNetworkBodyResolver as ye}from"../sync/networkBodyResolver";import{jsx as e,jsxs as n,Fragment as W}from"react/jsx-runtime";const A=t.color.accent;const me=new Set;const be=()=>{};const Se=({timings:d,total:r})=>{const u=Math.max(1,r);const h=[{label:"Waiting (TTFB)",hint:"incl. queue, DNS, TLS",value:d.ttfb,color:N.semantic.warning},{label:"Content download",hint:void 0,value:d.download,color:N.semantic.success}];return e(l,{style:o.phaseList,children:h.map(s=>n(l,{style:o.phaseRow,children:[n(l,{style:o.phaseLabelGroup,children:[e(i,{style:o.phaseLabel,children:s.label}),s.hint?e(i,{style:o.phaseHint,children:s.hint}):null]}),e(l,{style:o.phaseTrack,children:e(l,{style:[o.phaseBar,{backgroundColor:s.color,width:`${Math.min(100,Math.max(1,s.value/u*100))}%`}]})}),e(i,{style:o.phaseValue,children:X(s.value)})]},s.label))})};const Z=()=>e(l,{style:o.bodyDeferred});const T=({title:d,icon:r,children:u,defaultOpen:h=false,count:s})=>{const[p,B]=F(h);return n(l,{style:o.collapsibleSection,children:[n(O,{style:o.collapsibleHeader,onPress:()=>B(!p),testID:`buoy-network-section-${d.toLowerCase().replace(/\s+/g,"-")}`,accessibilityRole:"button",accessibilityLabel:d,children:[n(l,{style:o.collapsibleTitle,children:[r,e(i,{style:o.collapsibleTitleText,children:d}),s!==void 0?e(i,{style:o.collapsibleCount,children:s}):null]}),p?e(Q,{size:16,color:t.color.textSecondary}):e(_,{size:16,color:t.color.textSecondary})]}),p?e(l,{style:o.collapsibleContent,children:u}):null]})};const xe=({url:d,requestData:r,operationName:u,graphqlVariables:h,requestClient:s,isPro:p=false,onUpgradePress:B})=>{const g=I=>{try{const y=new URL(I);const x=String(y.protocol||"");const C=String(y.host||"");const V=x==="https:";let m=String(y.pathname||"");if(s==="graphql"&&u){const z=fe(u,h);m=`${m} (${z})`}else if(u){m=`${m} (${u})`}const w={};const b=y.searchParams;if(b&&typeof b.forEach==="function"){b.forEach((z,D)=>{w[D]=z})}return{protocol:x.replace(":",""),host:C,pathname:m,params:Object.keys(w).length>0?w:null,isSecure:V}}catch{return{protocol:"",host:d,pathname:"",params:null,isSecure:false}}};const c=ee(()=>g(d),[d,s,u,h]);const[f,k]=F(false);return n(l,{style:o.urlBreakdown,children:[n(l,{style:o.urlRow,children:[c.isSecure?e(ie,{size:12,color:N.semantic.success}):e(ne,{size:12,color:N.semantic.warning}),e(i,{style:o.urlDomain,children:c.host}),n(i,{style:o.urlProtocol,children:["(",c.protocol.toUpperCase(),")"]}),p?e(K,{value:d,buttonStyle:o.copyButton}):e(O,{style:o.copyButton,onPress:B,activeOpacity:.7,children:e(Y,{size:14,color:t.color.textSecondary})})]}),e(l,{style:o.urlPathRow,children:n(i,{style:o.urlPath,numberOfLines:2,children:[c.pathname,c.params?n(i,{style:o.urlQueryString,children:["?",new URLSearchParams(c.params).toString()]}):null]})}),c.params?n(l,{style:o.queryParamsCollapsible,children:[n(O,{style:o.queryParamsToggle,onPress:()=>k(!f),activeOpacity:.7,children:[e(i,{style:o.queryParamsToggleText,children:"Query Parameters"}),e(i,{style:o.collapsibleCount,children:Object.keys(c.params).length}),f?e(Q,{size:14,color:t.color.textSecondary}):e(_,{size:14,color:t.color.textSecondary})]}),f?e(H,{title:"",data:c.params,showTypeFilter:true,rawMode:true,initialExpanded:true}):null]}):null]})};export const NetworkEventDetailView=oe(function d({event:r,ignoredPatterns:u=me,onTogglePattern:h=be,showBodies:s=true}){const p=r.status?ge(r.status):null;const B=!r.status&&!r.error;const{isPro:g}=ue();const[c,f]=F(false);U(()=>{if(c&&g){f(false)}},[c,g]);const k=ye();const I=r.requestData===void 0&&(r.requestBodyOmitted===true||(r.requestSize??0)>0);const y=r.responseData===void 0&&(r.responseBodyOmitted===true||(r.responseSize??0)>0);const x=r.headersOmitted===true;const[C,V]=F(null);const[m,w]=F(false);U(()=>{V(null);if(!k||!I&&!y&&!x){w(false);return}let a=false;w(true);k(r.id).then(S=>{if(!a)V(S)}).catch(()=>{}).finally(()=>{if(!a)w(false)});return()=>{a=true}},[r.id,k,I,y,x]);const b=r.requestData??C?.requestData??void 0;const z=r.responseData??C?.responseData??void 0;const D=(x?C?.requestHeaders:void 0)??r.requestHeaders;const $=(x?C?.responseHeaders:void 0)??r.responseHeaders;const v=()=>{const a={method:r.method,url:r.url,status:r.status,statusText:r.statusText,timestamp:new Date(r.timestamp).toISOString(),duration:r.duration?`${r.duration}ms`:"N/A",requestHeaders:D,requestData:b,responseHeaders:$,responseData:z,requestSize:r.requestSize?q(r.requestSize):"N/A",responseSize:r.responseSize?q(r.responseSize):"N/A",error:r.error,client:r.requestClient};return`# Network Request Details
2
2
 
3
3
  ## Request
4
4
  - **Method:** ${a.method}
@@ -32,4 +32,4 @@ ${JSON.stringify(a.responseHeaders,null,2)}
32
32
  \`\`\`json
33
33
  ${JSON.stringify(a.responseData,null,2)}
34
34
  \`\`\`
35
- `};return n(W,{children:[n(re,{keyboardShouldPersistTaps:"handled",testID:"buoy-network-detail-scroll",style:o.container,children:[n(l,{style:o.requestDetailsSection,children:[n(l,{style:o.httpHeader,children:[e(l,{style:o.httpMethodBadge,children:e(i,{style:o.httpMethod,children:r.method})}),r.status?e(l,{style:[o.httpStatusBadge,{backgroundColor:`${p?.color}20`}],children:n(i,{style:[o.httpStatusText,{color:p?.color}],children:[p?.text," ",p?.meaning]})}):B?n(l,{style:o.pendingBadge,children:[e(M,{size:10,color:t.color.warning}),e(i,{style:o.pendingBadgeText,children:"Pending"})]}):null,r.condition&&n(i,{style:{color:"#FFCC66"},children:["Conditions: ",r.condition.profile," (+",r.condition.delayMs," ms)"]}),r.duration?n(l,{style:o.httpDuration,children:[e(M,{size:10,color:t.color.textTertiary}),e(i,{style:o.httpDurationText,children:X(r.duration)})]}):null,r.override?n(l,{style:o.overrideBadge,children:[e(de,{size:10,color:t.color.warning}),e(i,{style:o.overrideBadgeText,children:r.override.ruleName||"Overridden"})]}):null,g?e(K,{value:v,buttonStyle:o.copyFullButton}):e(O,{style:o.copyFullButton,onPress:()=>f(true),activeOpacity:.7,children:e(Y,{size:14,color:t.color.textSecondary})})]}),e(xe,{url:r.url,requestData:b,operationName:r.operationName,graphqlVariables:r.graphqlVariables,requestClient:r.requestClient,isPro:g,onUpgradePress:()=>f(true)}),r.error?n(l,{style:o.errorBox,children:[e(le,{size:12,color:t.color.danger}),e(i,{style:o.errorText,children:r.error})]}):null]}),n(l,{style:o.timingSection,children:[n(l,{style:o.timingRow,children:[e(M,{size:12,color:t.color.textSecondary}),e(i,{style:o.timingLabel,children:"Started:"}),e(i,{style:o.timingValue,children:he(r.timestamp)}),n(i,{style:o.timingExact,children:["(",new Date(r.timestamp).toLocaleTimeString(),")"]}),r.requestSize||r.responseSize?n(l,{style:o.sizeRow,children:[r.requestSize!==void 0?n(l,{style:o.sizeItem,children:[e(G,{size:10,color:t.color.info}),e(i,{style:o.sizeLabel,children:"Sent:"}),e(i,{style:o.sizeValue,children:q(r.requestSize)})]}):null,r.responseSize!==void 0?n(l,{style:o.sizeItem,children:[e(J,{size:10,color:A}),e(i,{style:o.sizeLabel,children:"Received:"}),e(i,{style:o.sizeValue,children:q(r.responseSize)})]}):null]}):null]}),r.timings?n(W,{children:[e(l,{style:o.phaseDivider}),e(Se,{timings:r.timings,total:r.duration??r.timings.ttfb+r.timings.download})]}):null]}),e(T,{title:"Request Headers",icon:e(G,{size:14,color:t.color.info}),defaultOpen:false,count:Object.keys(D).length,children:Object.keys(D).length>0?e(l,{style:o.dataViewerContainer,children:e(F,{title:"",data:D,showTypeFilter:true,rawMode:true,initialExpanded:true,disableCopy:!g})}):e(i,{style:o.emptyText,children:"No request headers"})}),e(T,{title:"Response Headers",icon:e(J,{size:14,color:A}),defaultOpen:false,count:Object.keys($).length,children:Object.keys($).length>0?e(l,{style:o.dataViewerContainer,children:e(F,{title:"",data:$,showTypeFilter:true,rawMode:true,initialExpanded:true,disableCopy:!g})}):e(i,{style:o.emptyText,children:"No response headers yet"})}),b!==void 0?e(T,{title:"Request Body",icon:e(E,{size:14,color:t.color.accent}),defaultOpen:false,children:e(l,{style:o.dataViewerContainer,children:s?e(F,{title:"",data:b,showTypeFilter:true,rawMode:true,initialExpanded:true,disableCopy:!g}):e(Z,{})})}):L?e(T,{title:"Request Body",icon:e(E,{size:14,color:t.color.accent}),defaultOpen:true,children:e(i,{style:o.emptyText,children:m?`Loading request body (${q(r.requestSize??0)})\u2026`:"Request body unavailable"})}):null,z!==void 0?e(T,{title:"Response Body",icon:e(E,{size:14,color:A}),defaultOpen:true,children:e(l,{style:o.dataViewerContainer,children:s?e(F,{title:"",data:z,showTypeFilter:true,rawMode:true,initialExpanded:true,disableCopy:!g}):e(Z,{})})}):y?e(T,{title:"Response Body",icon:e(E,{size:14,color:A}),defaultOpen:true,children:e(i,{style:o.emptyText,children:m?`Loading response body (${q(r.responseSize??0)})\u2026`:"Response body unavailable"})}):null,e(T,{title:"Filter Options",icon:e(ae,{size:14,color:t.color.warning}),defaultOpen:false,children:e(l,{style:o.filterOptionsContainer,children:(()=>{let a="";let S="";try{const j=new URL(r.url);a=j.hostname;S=j.pathname}catch{S=r.url}const I=u.has(a);const P=u.has(S);return n(W,{children:[n(O,{style:[o.filterOption,I&&o.filterOptionActive],onPress:()=>a&&h(a),children:[n(l,{style:o.filterOptionLeft,children:[e(se,{size:16,color:I?t.color.warning:t.color.textTertiary}),n(l,{style:o.filterOptionContent,children:[e(i,{style:o.filterOptionLabel,children:"Ignore Domain"}),e(i,{style:o.filterOptionValue,children:a||"N/A"})]})]}),e(l,{style:[o.filterToggle,I&&o.filterToggleActive],children:e(i,{style:[o.filterToggleText,I&&o.filterToggleTextActive],children:I?"IGNORED":"IGNORE"})})]}),n(O,{style:[o.filterOption,P&&o.filterOptionActive],onPress:()=>S&&h(S),children:[n(l,{style:o.filterOptionLeft,children:[e(ce,{size:16,color:P?t.color.warning:t.color.textTertiary}),n(l,{style:o.filterOptionContent,children:[e(i,{style:o.filterOptionLabel,children:"Ignore URL Pattern"}),e(i,{style:o.filterOptionValue,numberOfLines:1,children:S||"N/A"})]})]}),e(l,{style:[o.filterToggle,P&&o.filterToggleActive],children:e(i,{style:[o.filterToggleText,P&&o.filterToggleTextActive],children:P?"IGNORED":"IGNORE"})})]}),e(l,{style:o.filterInfoBox,children:e(i,{style:o.filterInfoText,children:"Ignored requests will be hidden from the network list. You can manage filters in the Filters tab."})})]})})()})})]}),e(pe,{visible:c,onClose:()=>f(false),featureName:"Copy Request Details",description:"Copy network request details to share or debug issues.",benefits:["Copy full request details including headers and body","Export to JSON, Markdown, or plain text","Share request data with teammates","Feed data to AI assistants for debugging"]})]})});const o=te.create({container:{flex:1,backgroundColor:"transparent"},requestDetailsSection:{marginHorizontal:12,marginTop:12,backgroundColor:t.color.surface,borderRadius:8,borderWidth:1,borderColor:t.color.border,padding:12},httpHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:12,flexWrap:"nowrap"},httpMethodBadge:{backgroundColor:t.color.infoSoft,paddingHorizontal:8,paddingVertical:4,borderRadius:4},httpMethod:{color:t.color.info,fontSize:11,fontWeight:"700",letterSpacing:.5},httpStatusBadge:{paddingHorizontal:8,paddingVertical:4,borderRadius:4},httpStatusText:{fontSize:11,fontWeight:"600"},pendingBadge:{flexDirection:"row",alignItems:"center",gap:4,backgroundColor:t.color.warningSoft,paddingHorizontal:8,paddingVertical:4,borderRadius:4},pendingBadgeText:{color:t.color.warning,fontSize:11,fontWeight:"600"},httpDuration:{flexDirection:"row",alignItems:"center",gap:4},httpDurationText:{color:t.color.textSecondary,fontSize:11},overrideBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:6,paddingVertical:3,borderRadius:4,backgroundColor:t.color.warningSoft},overrideBadgeText:{color:t.color.warning,fontSize:10,fontWeight:"700"},copyFullButton:{marginLeft:"auto",flexShrink:0,padding:4},urlBreakdown:{backgroundColor:t.color.bg,borderRadius:4,padding:8},urlRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},urlDomain:{color:t.color.text,fontSize:12,fontWeight:"600",flex:1},urlProtocol:{color:t.color.textTertiary,fontSize:10},copyButton:{padding:4},urlPathRow:{paddingLeft:18},urlPath:{color:t.color.textSecondary,fontSize:11,fontFamily:R},urlQueryString:{color:t.color.info,fontSize:11,fontFamily:R},queryParamsCollapsible:{marginTop:8},queryParamsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:10,backgroundColor:t.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:t.color.border,marginBottom:8},queryParamsToggleText:{flexGrow:0,color:t.color.text,fontSize:12,fontWeight:"600",letterSpacing:.3},timingSection:{marginHorizontal:12,marginTop:8,backgroundColor:t.color.surface,borderRadius:8,borderWidth:1,borderColor:t.color.border,padding:12},timingRow:{flexDirection:"row",alignItems:"center",gap:6,flexWrap:"wrap"},timingLabel:{color:t.color.textSecondary,fontSize:11},timingValue:{color:t.color.text,fontSize:11,fontWeight:"600"},timingExact:{color:t.color.textTertiary,fontSize:10,marginLeft:4},sizeRow:{flexDirection:"row",alignItems:"center",gap:16,marginLeft:"auto"},sizeItem:{flexDirection:"row",alignItems:"center",gap:4},sizeLabel:{color:t.color.textTertiary,fontSize:10},sizeValue:{color:t.color.info,fontSize:10,fontFamily:R,fontWeight:"600"},phaseDivider:{height:1,backgroundColor:t.color.border,marginTop:12,marginBottom:12},phaseList:{gap:8},phaseRow:{flexDirection:"row",alignItems:"center",gap:14},phaseLabelGroup:{width:150},phaseLabel:{fontSize:12,color:t.color.textSecondary},phaseHint:{fontSize:10,color:t.color.textTertiary},phaseTrack:{flex:1,height:7,borderRadius:4,backgroundColor:t.color.surfaceElevated,justifyContent:"center",overflow:"hidden"},phaseBar:{height:7,borderRadius:4},phaseValue:{width:72,textAlign:"right",fontSize:12,fontFamily:R,color:t.color.text},collapsibleSection:{marginHorizontal:12,marginTop:8,backgroundColor:t.color.surface,borderRadius:8,borderWidth:1,borderColor:t.color.border,overflow:"hidden"},collapsibleHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,backgroundColor:t.color.surfaceElevated},collapsibleTitle:{flexDirection:"row",alignItems:"center",gap:8},collapsibleTitleText:{color:t.color.text,fontSize:13,fontWeight:"600"},collapsibleCount:{color:t.color.textTertiary,fontSize:11.5,fontFamily:R},collapsibleContent:{padding:12},dataViewerContainer:{marginTop:-12,marginHorizontal:-12,marginBottom:-12},bodyDeferred:{height:120},errorBox:{flexDirection:"row",alignItems:"center",gap:6,backgroundColor:t.color.dangerSoft,padding:8,borderRadius:4,marginTop:8},errorText:{color:t.color.danger,fontSize:11,flex:1},emptyText:{color:t.color.textTertiary,fontSize:12,fontStyle:"italic",textAlign:"center"},filterOptionsContainer:{gap:12},filterOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",backgroundColor:t.color.surfaceElevated,borderRadius:8,padding:12,borderWidth:1,borderColor:t.color.border},filterOptionActive:{backgroundColor:t.color.warningSoft,borderColor:t.color.warning+"33"},filterOptionLeft:{flexDirection:"row",alignItems:"center",gap:12,flex:1},filterOptionContent:{flex:1},filterOptionLabel:{color:t.color.textSecondary,fontSize:11,marginBottom:2,textTransform:"uppercase",letterSpacing:.5},filterOptionValue:{color:t.color.text,fontSize:13,fontFamily:R},filterToggle:{paddingHorizontal:10,paddingVertical:6,borderRadius:4,backgroundColor:t.color.bg,borderWidth:1,borderColor:t.color.border},filterToggleActive:{backgroundColor:t.color.warningSoft,borderColor:t.color.warning+"4D"},filterToggleText:{fontSize:10,fontWeight:"600",color:t.color.textTertiary,letterSpacing:.5},filterToggleTextActive:{color:t.color.warning},filterInfoBox:{backgroundColor:t.color.infoSoft,borderRadius:6,padding:10,borderWidth:1,borderColor:t.color.info+"33"},filterInfoText:{color:t.color.textSecondary,fontSize:11,lineHeight:16}});
35
+ `};return n(W,{children:[n(re,{keyboardShouldPersistTaps:"handled",testID:"buoy-network-detail-scroll",style:o.container,children:[n(l,{style:o.requestDetailsSection,children:[n(l,{style:o.httpHeader,children:[e(l,{style:o.httpMethodBadge,children:e(i,{style:o.httpMethod,children:r.method})}),r.status?e(l,{style:[o.httpStatusBadge,{backgroundColor:`${p?.color}20`}],children:n(i,{style:[o.httpStatusText,{color:p?.color}],children:[p?.text," ",p?.meaning]})}):B?n(l,{style:o.pendingBadge,children:[e(M,{size:10,color:t.color.warning}),e(i,{style:o.pendingBadgeText,children:"Pending"})]}):null,r.condition&&n(i,{style:{color:"#FFCC66"},children:["Conditions: ",r.condition.profile," (+",r.condition.delayMs," ms)"]}),r.condition?.uploadCap?.note&&e(i,{testID:"buoy-network-upload-cap-detail",style:{color:"#FFCC66"},children:r.condition.uploadCap.note}),r.duration?n(l,{style:o.httpDuration,children:[e(M,{size:10,color:t.color.textTertiary}),e(i,{style:o.httpDurationText,children:X(r.duration)})]}):null,r.override?n(l,{style:o.overrideBadge,children:[e(de,{size:10,color:t.color.warning}),e(i,{style:o.overrideBadgeText,children:r.override.ruleName||"Overridden"})]}):null,g?e(K,{value:v,buttonStyle:o.copyFullButton}):e(O,{style:o.copyFullButton,onPress:()=>f(true),activeOpacity:.7,children:e(Y,{size:14,color:t.color.textSecondary})})]}),e(xe,{url:r.url,requestData:b,operationName:r.operationName,graphqlVariables:r.graphqlVariables,requestClient:r.requestClient,isPro:g,onUpgradePress:()=>f(true)}),r.error?n(l,{style:o.errorBox,children:[e(le,{size:12,color:t.color.danger}),e(i,{style:o.errorText,children:r.error})]}):null]}),n(l,{style:o.timingSection,children:[n(l,{style:o.timingRow,children:[e(M,{size:12,color:t.color.textSecondary}),e(i,{style:o.timingLabel,children:"Started:"}),e(i,{style:o.timingValue,children:he(r.timestamp)}),n(i,{style:o.timingExact,children:["(",new Date(r.timestamp).toLocaleTimeString(),")"]}),r.requestSize||r.responseSize?n(l,{style:o.sizeRow,children:[r.requestSize!==void 0?n(l,{style:o.sizeItem,children:[e(G,{size:10,color:t.color.info}),e(i,{style:o.sizeLabel,children:"Sent:"}),e(i,{style:o.sizeValue,children:q(r.requestSize)})]}):null,r.responseSize!==void 0?n(l,{style:o.sizeItem,children:[e(J,{size:10,color:A}),e(i,{style:o.sizeLabel,children:"Received:"}),e(i,{style:o.sizeValue,children:q(r.responseSize)})]}):null]}):null]}),r.timings?n(W,{children:[e(l,{style:o.phaseDivider}),e(Se,{timings:r.timings,total:r.duration??r.timings.ttfb+r.timings.download})]}):null]}),e(T,{title:"Request Headers",icon:e(G,{size:14,color:t.color.info}),defaultOpen:false,count:Object.keys(D).length,children:Object.keys(D).length>0?e(l,{style:o.dataViewerContainer,children:e(H,{title:"",data:D,showTypeFilter:true,rawMode:true,initialExpanded:true,disableCopy:!g})}):e(i,{style:o.emptyText,children:"No request headers"})}),e(T,{title:"Response Headers",icon:e(J,{size:14,color:A}),defaultOpen:false,count:Object.keys($).length,children:Object.keys($).length>0?e(l,{style:o.dataViewerContainer,children:e(H,{title:"",data:$,showTypeFilter:true,rawMode:true,initialExpanded:true,disableCopy:!g})}):e(i,{style:o.emptyText,children:"No response headers yet"})}),b!==void 0?e(T,{title:"Request Body",icon:e(E,{size:14,color:t.color.accent}),defaultOpen:false,children:e(l,{style:o.dataViewerContainer,children:s?e(H,{title:"",data:b,showTypeFilter:true,rawMode:true,initialExpanded:true,disableCopy:!g}):e(Z,{})})}):I?e(T,{title:"Request Body",icon:e(E,{size:14,color:t.color.accent}),defaultOpen:true,children:e(i,{style:o.emptyText,children:m?`Loading request body (${q(r.requestSize??0)})\u2026`:"Request body unavailable"})}):null,z!==void 0?e(T,{title:"Response Body",icon:e(E,{size:14,color:A}),defaultOpen:true,children:e(l,{style:o.dataViewerContainer,children:s?e(H,{title:"",data:z,showTypeFilter:true,rawMode:true,initialExpanded:true,disableCopy:!g}):e(Z,{})})}):y?e(T,{title:"Response Body",icon:e(E,{size:14,color:A}),defaultOpen:true,children:e(i,{style:o.emptyText,children:m?`Loading response body (${q(r.responseSize??0)})\u2026`:"Response body unavailable"})}):null,e(T,{title:"Filter Options",icon:e(ae,{size:14,color:t.color.warning}),defaultOpen:false,children:e(l,{style:o.filterOptionsContainer,children:(()=>{let a="";let S="";try{const j=new URL(r.url);a=j.hostname;S=j.pathname}catch{S=r.url}const L=u.has(a);const P=u.has(S);return n(W,{children:[n(O,{style:[o.filterOption,L&&o.filterOptionActive],onPress:()=>a&&h(a),children:[n(l,{style:o.filterOptionLeft,children:[e(se,{size:16,color:L?t.color.warning:t.color.textTertiary}),n(l,{style:o.filterOptionContent,children:[e(i,{style:o.filterOptionLabel,children:"Ignore Domain"}),e(i,{style:o.filterOptionValue,children:a||"N/A"})]})]}),e(l,{style:[o.filterToggle,L&&o.filterToggleActive],children:e(i,{style:[o.filterToggleText,L&&o.filterToggleTextActive],children:L?"IGNORED":"IGNORE"})})]}),n(O,{style:[o.filterOption,P&&o.filterOptionActive],onPress:()=>S&&h(S),children:[n(l,{style:o.filterOptionLeft,children:[e(ce,{size:16,color:P?t.color.warning:t.color.textTertiary}),n(l,{style:o.filterOptionContent,children:[e(i,{style:o.filterOptionLabel,children:"Ignore URL Pattern"}),e(i,{style:o.filterOptionValue,numberOfLines:1,children:S||"N/A"})]})]}),e(l,{style:[o.filterToggle,P&&o.filterToggleActive],children:e(i,{style:[o.filterToggleText,P&&o.filterToggleTextActive],children:P?"IGNORED":"IGNORE"})})]}),e(l,{style:o.filterInfoBox,children:e(i,{style:o.filterInfoText,children:"Ignored requests will be hidden from the network list. You can manage filters in the Filters tab."})})]})})()})})]}),e(pe,{visible:c,onClose:()=>f(false),featureName:"Copy Request Details",description:"Copy network request details to share or debug issues.",benefits:["Copy full request details including headers and body","Export to JSON, Markdown, or plain text","Share request data with teammates","Feed data to AI assistants for debugging"]})]})});const o=te.create({container:{flex:1,backgroundColor:"transparent"},requestDetailsSection:{marginHorizontal:12,marginTop:12,backgroundColor:t.color.surface,borderRadius:8,borderWidth:1,borderColor:t.color.border,padding:12},httpHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:12,flexWrap:"nowrap"},httpMethodBadge:{backgroundColor:t.color.infoSoft,paddingHorizontal:8,paddingVertical:4,borderRadius:4},httpMethod:{color:t.color.info,fontSize:11,fontWeight:"700",letterSpacing:.5},httpStatusBadge:{paddingHorizontal:8,paddingVertical:4,borderRadius:4},httpStatusText:{fontSize:11,fontWeight:"600"},pendingBadge:{flexDirection:"row",alignItems:"center",gap:4,backgroundColor:t.color.warningSoft,paddingHorizontal:8,paddingVertical:4,borderRadius:4},pendingBadgeText:{color:t.color.warning,fontSize:11,fontWeight:"600"},httpDuration:{flexDirection:"row",alignItems:"center",gap:4},httpDurationText:{color:t.color.textSecondary,fontSize:11},overrideBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:6,paddingVertical:3,borderRadius:4,backgroundColor:t.color.warningSoft},overrideBadgeText:{color:t.color.warning,fontSize:10,fontWeight:"700"},copyFullButton:{marginLeft:"auto",flexShrink:0,padding:4},urlBreakdown:{backgroundColor:t.color.bg,borderRadius:4,padding:8},urlRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},urlDomain:{color:t.color.text,fontSize:12,fontWeight:"600",flex:1},urlProtocol:{color:t.color.textTertiary,fontSize:10},copyButton:{padding:4},urlPathRow:{paddingLeft:18},urlPath:{color:t.color.textSecondary,fontSize:11,fontFamily:R},urlQueryString:{color:t.color.info,fontSize:11,fontFamily:R},queryParamsCollapsible:{marginTop:8},queryParamsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:10,backgroundColor:t.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:t.color.border,marginBottom:8},queryParamsToggleText:{flexGrow:0,color:t.color.text,fontSize:12,fontWeight:"600",letterSpacing:.3},timingSection:{marginHorizontal:12,marginTop:8,backgroundColor:t.color.surface,borderRadius:8,borderWidth:1,borderColor:t.color.border,padding:12},timingRow:{flexDirection:"row",alignItems:"center",gap:6,flexWrap:"wrap"},timingLabel:{color:t.color.textSecondary,fontSize:11},timingValue:{color:t.color.text,fontSize:11,fontWeight:"600"},timingExact:{color:t.color.textTertiary,fontSize:10,marginLeft:4},sizeRow:{flexDirection:"row",alignItems:"center",gap:16,marginLeft:"auto"},sizeItem:{flexDirection:"row",alignItems:"center",gap:4},sizeLabel:{color:t.color.textTertiary,fontSize:10},sizeValue:{color:t.color.info,fontSize:10,fontFamily:R,fontWeight:"600"},phaseDivider:{height:1,backgroundColor:t.color.border,marginTop:12,marginBottom:12},phaseList:{gap:8},phaseRow:{flexDirection:"row",alignItems:"center",gap:14},phaseLabelGroup:{width:150},phaseLabel:{fontSize:12,color:t.color.textSecondary},phaseHint:{fontSize:10,color:t.color.textTertiary},phaseTrack:{flex:1,height:7,borderRadius:4,backgroundColor:t.color.surfaceElevated,justifyContent:"center",overflow:"hidden"},phaseBar:{height:7,borderRadius:4},phaseValue:{width:72,textAlign:"right",fontSize:12,fontFamily:R,color:t.color.text},collapsibleSection:{marginHorizontal:12,marginTop:8,backgroundColor:t.color.surface,borderRadius:8,borderWidth:1,borderColor:t.color.border,overflow:"hidden"},collapsibleHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,backgroundColor:t.color.surfaceElevated},collapsibleTitle:{flexDirection:"row",alignItems:"center",gap:8},collapsibleTitleText:{color:t.color.text,fontSize:13,fontWeight:"600"},collapsibleCount:{color:t.color.textTertiary,fontSize:11.5,fontFamily:R},collapsibleContent:{padding:12},dataViewerContainer:{marginTop:-12,marginHorizontal:-12,marginBottom:-12},bodyDeferred:{height:120},errorBox:{flexDirection:"row",alignItems:"center",gap:6,backgroundColor:t.color.dangerSoft,padding:8,borderRadius:4,marginTop:8},errorText:{color:t.color.danger,fontSize:11,flex:1},emptyText:{color:t.color.textTertiary,fontSize:12,fontStyle:"italic",textAlign:"center"},filterOptionsContainer:{gap:12},filterOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",backgroundColor:t.color.surfaceElevated,borderRadius:8,padding:12,borderWidth:1,borderColor:t.color.border},filterOptionActive:{backgroundColor:t.color.warningSoft,borderColor:t.color.warning+"33"},filterOptionLeft:{flexDirection:"row",alignItems:"center",gap:12,flex:1},filterOptionContent:{flex:1},filterOptionLabel:{color:t.color.textSecondary,fontSize:11,marginBottom:2,textTransform:"uppercase",letterSpacing:.5},filterOptionValue:{color:t.color.text,fontSize:13,fontFamily:R},filterToggle:{paddingHorizontal:10,paddingVertical:6,borderRadius:4,backgroundColor:t.color.bg,borderWidth:1,borderColor:t.color.border},filterToggleActive:{backgroundColor:t.color.warningSoft,borderColor:t.color.warning+"4D"},filterToggleText:{fontSize:10,fontWeight:"600",color:t.color.textTertiary,letterSpacing:.5},filterToggleTextActive:{color:t.color.warning},filterInfoBox:{backgroundColor:t.color.infoSoft,borderRadius:6,padding:10,borderWidth:1,borderColor:t.color.info+"33"},filterInfoText:{color:t.color.textSecondary,fontSize:11,lineHeight:16}});
@@ -1,4 +1,4 @@
1
- "use strict";import{memo as U,useEffect as G,useMemo as J,useState as q}from"react";import{formatGraphQLDisplay as _}from"../utils/formatGraphQLVariables";import{useNetworkBodyResolver as Q}from"../sync/networkBodyResolver";import{DataViewer as R,InlineCopyButton as A}from"./DataViewer.web";import{jsx as e,jsxs as o,Fragment as F}from"react/jsx-runtime";const r={background:{base:"#0A0A0C",card:"#1A1A1C",hover:"#1D1D1F",input:"#26262A"},border:{default:"#2D2D2F"},text:{primary:"#F5F5F7",secondary:"#A1A1A6",muted:"#8E8E93"},semantic:{success:"#34C759",error:"#FF453A",errorBackground:"rgba(255, 69, 58, 0.15)",warning:"#FFEB3B",warningBackground:"rgba(255, 235, 59, 0.15)",info:"#00B8E6",infoBackground:"rgba(0, 184, 230, 0.1)"}};const $=r.semantic.success;function k(i){if(i===void 0||i===null)return"N/A";if(i===0)return"0 B";const n=1024;const c=["B","KB","MB","GB","TB"];const d=Math.floor(Math.log(i)/Math.log(n));return`${(i/Math.pow(n,d)).toFixed(1)} ${c[d]}`}function N(i){if(i===void 0||i===null)return"N/A";if(i<1e3)return`${i}ms`;if(i<6e4)return`${(i/1e3).toFixed(1)}s`;if(i<36e5){const d=Math.floor(i/6e4);const s=Math.floor(i%6e4/1e3);return s>0?`${d}m ${s}s`:`${d}m`}const n=Math.floor(i/36e5);const c=Math.floor(i%36e5/6e4);return c>0?`${n}h ${c}m`:`${n}h`}function Y(i,n=Date.now()){const c=i instanceof Date?i.getTime():i;const d=Math.floor((n-c)/1e3);if(d<0)return"just now";if(d<60)return d===0?"just now":`${d}s ago`;const s=Math.floor(d/60);if(s<60)return`${s}m ago`;const a=Math.floor(s/60);if(a<24)return`${a}h ago`;const u=Math.floor(a/24);return`${u}d ago`}function K(i){if(i>=100&&i<200){return{text:String(i),color:r.semantic.info,meaning:"Informational"}}if(i>=200&&i<300){const n={200:"OK",201:"Created",202:"Accepted",204:"No Content",206:"Partial Content"};return{text:String(i),color:r.semantic.success,meaning:n[i]||"Success"}}if(i>=300&&i<400){const n={301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect"};return{text:String(i),color:r.semantic.warning,meaning:n[i]||"Redirect"}}if(i>=400&&i<500){const n={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",408:"Request Timeout",409:"Conflict",410:"Gone",422:"Unprocessable Entity",429:"Too Many Requests"};return{text:String(i),color:r.semantic.error,meaning:n[i]||"Client Error"}}if(i>=500){const n={500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported"};return{text:String(i),color:r.semantic.error,meaning:n[i]||"Server Error"}}return{text:String(i),color:r.text.muted,meaning:"Unknown"}}function p({size:i=14,color:n="currentColor",children:c}){return e("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,display:"block"},children:c})}const L=i=>o(p,{...i,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("polyline",{points:"12 6 12 12 16 14"})]});const P=i=>o(p,{...i,children:[e("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e("polyline",{points:"17 8 12 3 7 8"}),e("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]});const E=i=>o(p,{...i,children:[e("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e("polyline",{points:"7 10 12 15 17 10"}),e("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]});const Z=i=>o(p,{...i,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),e("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]});const H=i=>e(p,{...i,children:e("path",{d:"m6 9 6 6 6-6"})});const W=i=>e(p,{...i,children:e("path",{d:"m18 15-6-6-6 6"})});const X=i=>o(p,{...i,children:[e("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]});const ee=i=>o(p,{...i,children:[e("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e("path",{d:"M7 11V7a5 5 0 0 1 9.9-1"})]});const v=i=>o(p,{...i,children:[e("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),e("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),e("path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"}),e("path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"})]});const te=i=>e(p,{...i,children:e("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})});const ne=i=>o(p,{...i,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),e("path",{d:"M2 12h20"})]});const re=i=>o(p,{...i,children:[e("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]});const ie=i=>o(p,{...i,children:[e("path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2"}),e("path",{d:"M8.5 2h7"}),e("path",{d:"M7 16h10"})]});const oe=new Set;const le=()=>{};const ae=({timings:i,total:n})=>{const c=Math.max(1,n);const d=[{label:"Waiting (TTFB)",hint:"incl. queue, DNS, TLS",value:i.ttfb,color:r.semantic.warning},{label:"Content download",hint:void 0,value:i.download,color:r.semantic.success}];return e("div",{style:t.phaseList,children:d.map(s=>o("div",{style:t.phaseRow,children:[o("div",{style:t.phaseLabelGroup,children:[e("div",{style:t.phaseLabel,children:s.label}),s.hint?e("div",{style:t.phaseHint,children:s.hint}):null]}),e("div",{style:t.phaseTrack,children:e("div",{style:{...t.phaseBar,backgroundColor:s.color,width:`${Math.min(100,Math.max(1,s.value/c*100))}%`}})}),e("span",{style:t.phaseValue,children:N(s.value)})]},s.label))})};const V=()=>e("div",{style:t.bodyDeferred});const w=({title:i,icon:n,children:c,defaultOpen:d=false,count:s})=>{const[a,u]=q(d);return o("div",{style:t.collapsibleSection,children:[o("button",{type:"button",style:t.collapsibleHeader,onClick:()=>u(!a),"aria-expanded":a,children:[o("span",{style:t.collapsibleTitle,children:[n,e("span",{style:t.collapsibleTitleText,children:i}),s!==void 0?e("span",{style:t.collapsibleCount,children:s}):null]}),a?e(W,{size:16,color:r.text.secondary}):e(H,{size:16,color:r.text.secondary})]}),a?e("div",{style:t.collapsibleContent,children:c}):null]})};const se=({url:i,operationName:n,graphqlVariables:c,requestClient:d})=>{const s=D=>{try{const h=new URL(D);const y=String(h.protocol||"");const S=String(h.host||"");const O=y==="https:";let f=String(h.pathname||"");if(d==="graphql"&&n){const b=_(n,c);f=`${f} (${b})`}else if(n){f=`${f} (${n})`}const x={};const g=h.searchParams;if(g&&typeof g.forEach==="function"){g.forEach((b,z)=>{x[z]=b})}return{protocol:y.replace(":",""),host:S,pathname:f,params:Object.keys(x).length>0?x:null,isSecure:O}}catch{return{protocol:"",host:i,pathname:"",params:null,isSecure:false}}};const a=J(()=>s(i),[i,d,n,c]);const[u,T]=q(false);return o("div",{style:t.urlBreakdown,children:[o("div",{style:t.urlRow,children:[a.isSecure?e(X,{size:12,color:r.semantic.success}):e(ee,{size:12,color:r.semantic.warning}),e("span",{style:t.urlDomain,children:a.host}),o("span",{style:t.urlProtocol,children:["(",a.protocol.toUpperCase(),")"]}),e(A,{value:i,buttonStyle:t.copyButton})]}),e("div",{style:t.urlPathRow,children:o("span",{style:t.urlPath,children:[a.pathname,a.params?o("span",{style:t.urlQueryString,children:["?",new URLSearchParams(a.params).toString()]}):null]})}),a.params?o("div",{style:t.queryParamsCollapsible,children:[o("button",{type:"button",style:t.queryParamsToggle,onClick:()=>T(!u),"aria-expanded":u,children:[e("span",{style:t.queryParamsToggleText,children:"Query Parameters"}),e("span",{style:{...t.collapsibleCount,flex:1,textAlign:"left"},children:Object.keys(a.params).length}),u?e(W,{size:14,color:r.text.secondary}):e(H,{size:14,color:r.text.secondary})]}),u?e(R,{title:"",data:a.params,showTypeFilter:true,rawMode:true,initialExpanded:true}):null]}):null]})};export const NetworkEventDetailView=U(function i({event:n,ignoredPatterns:c=oe,onTogglePattern:d=le,showBodies:s=true}){const a=n.status?K(n.status):null;const u=!n.status&&!n.error;const T=Q();const D=n.requestData===void 0&&(n.requestBodyOmitted===true||(n.requestSize??0)>0);const h=n.responseData===void 0&&(n.responseBodyOmitted===true||(n.responseSize??0)>0);const y=n.headersOmitted===true;const[S,O]=q(null);const[f,x]=q(false);G(()=>{O(null);if(!T||!D&&!h&&!y){x(false);return}let l=false;x(true);T(n.id).then(m=>{if(!l)O(m)}).catch(()=>{}).finally(()=>{if(!l)x(false)});return()=>{l=true}},[n.id,T,D,h,y]);const g=n.requestData??S?.requestData??void 0;const b=n.responseData??S?.responseData??void 0;const z=(y?S?.requestHeaders:void 0)??n.requestHeaders;const M=(y?S?.responseHeaders:void 0)??n.responseHeaders;const j=()=>{const l={method:n.method,url:n.url,status:n.status,statusText:n.statusText,timestamp:new Date(n.timestamp).toISOString(),duration:n.duration?`${n.duration}ms`:"N/A",requestHeaders:z,requestData:g,responseHeaders:M,responseData:b,requestSize:n.requestSize?k(n.requestSize):"N/A",responseSize:n.responseSize?k(n.responseSize):"N/A",error:n.error,client:n.requestClient};return`# Network Request Details
1
+ "use strict";import{memo as U,useEffect as G,useMemo as J,useState as q}from"react";import{formatGraphQLDisplay as _}from"../utils/formatGraphQLVariables";import{useNetworkBodyResolver as Q}from"../sync/networkBodyResolver";import{DataViewer as R,InlineCopyButton as F}from"./DataViewer.web";import{jsx as e,jsxs as o,Fragment as A}from"react/jsx-runtime";const r={background:{base:"#0A0A0C",card:"#1A1A1C",hover:"#1D1D1F",input:"#26262A"},border:{default:"#2D2D2F"},text:{primary:"#F5F5F7",secondary:"#A1A1A6",muted:"#8E8E93"},semantic:{success:"#34C759",error:"#FF453A",errorBackground:"rgba(255, 69, 58, 0.15)",warning:"#FFEB3B",warningBackground:"rgba(255, 235, 59, 0.15)",info:"#00B8E6",infoBackground:"rgba(0, 184, 230, 0.1)"}};const $=r.semantic.success;function k(i){if(i===void 0||i===null)return"N/A";if(i===0)return"0 B";const t=1024;const c=["B","KB","MB","GB","TB"];const d=Math.floor(Math.log(i)/Math.log(t));return`${(i/Math.pow(t,d)).toFixed(1)} ${c[d]}`}function N(i){if(i===void 0||i===null)return"N/A";if(i<1e3)return`${i}ms`;if(i<6e4)return`${(i/1e3).toFixed(1)}s`;if(i<36e5){const d=Math.floor(i/6e4);const s=Math.floor(i%6e4/1e3);return s>0?`${d}m ${s}s`:`${d}m`}const t=Math.floor(i/36e5);const c=Math.floor(i%36e5/6e4);return c>0?`${t}h ${c}m`:`${t}h`}function Y(i,t=Date.now()){const c=i instanceof Date?i.getTime():i;const d=Math.floor((t-c)/1e3);if(d<0)return"just now";if(d<60)return d===0?"just now":`${d}s ago`;const s=Math.floor(d/60);if(s<60)return`${s}m ago`;const a=Math.floor(s/60);if(a<24)return`${a}h ago`;const u=Math.floor(a/24);return`${u}d ago`}function K(i){if(i>=100&&i<200){return{text:String(i),color:r.semantic.info,meaning:"Informational"}}if(i>=200&&i<300){const t={200:"OK",201:"Created",202:"Accepted",204:"No Content",206:"Partial Content"};return{text:String(i),color:r.semantic.success,meaning:t[i]||"Success"}}if(i>=300&&i<400){const t={301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect"};return{text:String(i),color:r.semantic.warning,meaning:t[i]||"Redirect"}}if(i>=400&&i<500){const t={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",408:"Request Timeout",409:"Conflict",410:"Gone",422:"Unprocessable Entity",429:"Too Many Requests"};return{text:String(i),color:r.semantic.error,meaning:t[i]||"Client Error"}}if(i>=500){const t={500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported"};return{text:String(i),color:r.semantic.error,meaning:t[i]||"Server Error"}}return{text:String(i),color:r.text.muted,meaning:"Unknown"}}function p({size:i=14,color:t="currentColor",children:c}){return e("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,display:"block"},children:c})}const L=i=>o(p,{...i,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("polyline",{points:"12 6 12 12 16 14"})]});const P=i=>o(p,{...i,children:[e("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e("polyline",{points:"17 8 12 3 7 8"}),e("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]});const E=i=>o(p,{...i,children:[e("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e("polyline",{points:"7 10 12 15 17 10"}),e("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]});const Z=i=>o(p,{...i,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),e("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]});const H=i=>e(p,{...i,children:e("path",{d:"m6 9 6 6 6-6"})});const W=i=>e(p,{...i,children:e("path",{d:"m18 15-6-6-6 6"})});const X=i=>o(p,{...i,children:[e("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]});const ee=i=>o(p,{...i,children:[e("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e("path",{d:"M7 11V7a5 5 0 0 1 9.9-1"})]});const v=i=>o(p,{...i,children:[e("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),e("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),e("path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"}),e("path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"})]});const te=i=>e(p,{...i,children:e("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})});const ne=i=>o(p,{...i,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),e("path",{d:"M2 12h20"})]});const re=i=>o(p,{...i,children:[e("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]});const ie=i=>o(p,{...i,children:[e("path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2"}),e("path",{d:"M8.5 2h7"}),e("path",{d:"M7 16h10"})]});const oe=new Set;const le=()=>{};const ae=({timings:i,total:t})=>{const c=Math.max(1,t);const d=[{label:"Waiting (TTFB)",hint:"incl. queue, DNS, TLS",value:i.ttfb,color:r.semantic.warning},{label:"Content download",hint:void 0,value:i.download,color:r.semantic.success}];return e("div",{style:n.phaseList,children:d.map(s=>o("div",{style:n.phaseRow,children:[o("div",{style:n.phaseLabelGroup,children:[e("div",{style:n.phaseLabel,children:s.label}),s.hint?e("div",{style:n.phaseHint,children:s.hint}):null]}),e("div",{style:n.phaseTrack,children:e("div",{style:{...n.phaseBar,backgroundColor:s.color,width:`${Math.min(100,Math.max(1,s.value/c*100))}%`}})}),e("span",{style:n.phaseValue,children:N(s.value)})]},s.label))})};const V=()=>e("div",{style:n.bodyDeferred});const w=({title:i,icon:t,children:c,defaultOpen:d=false,count:s})=>{const[a,u]=q(d);return o("div",{style:n.collapsibleSection,children:[o("button",{type:"button",style:n.collapsibleHeader,onClick:()=>u(!a),"aria-expanded":a,children:[o("span",{style:n.collapsibleTitle,children:[t,e("span",{style:n.collapsibleTitleText,children:i}),s!==void 0?e("span",{style:n.collapsibleCount,children:s}):null]}),a?e(W,{size:16,color:r.text.secondary}):e(H,{size:16,color:r.text.secondary})]}),a?e("div",{style:n.collapsibleContent,children:c}):null]})};const se=({url:i,operationName:t,graphqlVariables:c,requestClient:d})=>{const s=C=>{try{const h=new URL(C);const y=String(h.protocol||"");const S=String(h.host||"");const O=y==="https:";let f=String(h.pathname||"");if(d==="graphql"&&t){const b=_(t,c);f=`${f} (${b})`}else if(t){f=`${f} (${t})`}const x={};const g=h.searchParams;if(g&&typeof g.forEach==="function"){g.forEach((b,z)=>{x[z]=b})}return{protocol:y.replace(":",""),host:S,pathname:f,params:Object.keys(x).length>0?x:null,isSecure:O}}catch{return{protocol:"",host:i,pathname:"",params:null,isSecure:false}}};const a=J(()=>s(i),[i,d,t,c]);const[u,T]=q(false);return o("div",{style:n.urlBreakdown,children:[o("div",{style:n.urlRow,children:[a.isSecure?e(X,{size:12,color:r.semantic.success}):e(ee,{size:12,color:r.semantic.warning}),e("span",{style:n.urlDomain,children:a.host}),o("span",{style:n.urlProtocol,children:["(",a.protocol.toUpperCase(),")"]}),e(F,{value:i,buttonStyle:n.copyButton})]}),e("div",{style:n.urlPathRow,children:o("span",{style:n.urlPath,children:[a.pathname,a.params?o("span",{style:n.urlQueryString,children:["?",new URLSearchParams(a.params).toString()]}):null]})}),a.params?o("div",{style:n.queryParamsCollapsible,children:[o("button",{type:"button",style:n.queryParamsToggle,onClick:()=>T(!u),"aria-expanded":u,children:[e("span",{style:n.queryParamsToggleText,children:"Query Parameters"}),e("span",{style:{...n.collapsibleCount,flex:1,textAlign:"left"},children:Object.keys(a.params).length}),u?e(W,{size:14,color:r.text.secondary}):e(H,{size:14,color:r.text.secondary})]}),u?e(R,{title:"",data:a.params,showTypeFilter:true,rawMode:true,initialExpanded:true}):null]}):null]})};export const NetworkEventDetailView=U(function i({event:t,ignoredPatterns:c=oe,onTogglePattern:d=le,showBodies:s=true}){const a=t.status?K(t.status):null;const u=!t.status&&!t.error;const T=Q();const C=t.requestData===void 0&&(t.requestBodyOmitted===true||(t.requestSize??0)>0);const h=t.responseData===void 0&&(t.responseBodyOmitted===true||(t.responseSize??0)>0);const y=t.headersOmitted===true;const[S,O]=q(null);const[f,x]=q(false);G(()=>{O(null);if(!T||!C&&!h&&!y){x(false);return}let l=false;x(true);T(t.id).then(m=>{if(!l)O(m)}).catch(()=>{}).finally(()=>{if(!l)x(false)});return()=>{l=true}},[t.id,T,C,h,y]);const g=t.requestData??S?.requestData??void 0;const b=t.responseData??S?.responseData??void 0;const z=(y?S?.requestHeaders:void 0)??t.requestHeaders;const M=(y?S?.responseHeaders:void 0)??t.responseHeaders;const j=()=>{const l={method:t.method,url:t.url,status:t.status,statusText:t.statusText,timestamp:new Date(t.timestamp).toISOString(),duration:t.duration?`${t.duration}ms`:"N/A",requestHeaders:z,requestData:g,responseHeaders:M,responseData:b,requestSize:t.requestSize?k(t.requestSize):"N/A",responseSize:t.responseSize?k(t.responseSize):"N/A",error:t.error,client:t.requestClient};return`# Network Request Details
2
2
 
3
3
  ## Request
4
4
  - **Method:** ${l.method}
@@ -32,4 +32,4 @@ ${JSON.stringify(l.responseHeaders,null,2)}
32
32
  \`\`\`json
33
33
  ${JSON.stringify(l.responseData,null,2)}
34
34
  \`\`\`
35
- `};return o("div",{style:t.container,children:[o("div",{style:t.requestDetailsSection,children:[o("div",{style:t.httpHeader,children:[e("span",{style:t.httpMethodBadge,children:e("span",{style:t.httpMethod,children:n.method})}),n.status?e("span",{style:{...t.httpStatusBadge,backgroundColor:`${a?.color}20`},children:o("span",{style:{...t.httpStatusText,color:a?.color},children:[a?.text," ",a?.meaning]})}):u?o("span",{style:t.pendingBadge,children:[e(L,{size:10,color:r.semantic.warning}),e("span",{style:t.pendingBadgeText,children:"Pending"})]}):null,n.duration?o("span",{style:t.httpDuration,children:[e(L,{size:10,color:r.text.muted}),e("span",{style:t.httpDurationText,children:N(n.duration)})]}):null,n.override?o("span",{style:t.overrideBadge,children:[e(ie,{size:10,color:r.semantic.warning}),e("span",{style:t.overrideBadgeText,children:n.override.ruleName||"Overridden"})]}):null,e(A,{value:j,buttonStyle:t.copyFullButton})]}),e(se,{url:n.url,requestData:g,operationName:n.operationName,graphqlVariables:n.graphqlVariables,requestClient:n.requestClient}),n.error?o("div",{style:t.errorBox,children:[e(Z,{size:12,color:r.semantic.error}),e("span",{style:t.errorText,children:n.error})]}):null]}),o("div",{style:t.timingSection,children:[o("div",{style:t.timingRow,children:[e(L,{size:12,color:r.text.secondary}),e("span",{style:t.timingLabel,children:"Started:"}),e("span",{style:t.timingValue,children:Y(n.timestamp)}),o("span",{style:t.timingExact,children:["(",new Date(n.timestamp).toLocaleTimeString(),")"]}),n.requestSize||n.responseSize?o("span",{style:t.sizeRow,children:[n.requestSize!==void 0?o("span",{style:t.sizeItem,children:[e(P,{size:10,color:r.semantic.info}),e("span",{style:t.sizeLabel,children:"Sent:"}),e("span",{style:t.sizeValue,children:k(n.requestSize)})]}):null,n.responseSize!==void 0?o("span",{style:t.sizeItem,children:[e(E,{size:10,color:$}),e("span",{style:t.sizeLabel,children:"Received:"}),e("span",{style:t.sizeValue,children:k(n.responseSize)})]}):null]}):null]}),n.timings?o(F,{children:[e("div",{style:t.phaseDivider}),e(ae,{timings:n.timings,total:n.duration??n.timings.ttfb+n.timings.download})]}):null]}),e(w,{title:"Request Headers",icon:e(P,{size:14,color:r.semantic.info}),defaultOpen:false,count:Object.keys(z).length,children:Object.keys(z).length>0?e("div",{style:t.dataViewerContainer,children:e(R,{title:"",data:z,showTypeFilter:true,rawMode:true,initialExpanded:true})}):e("div",{style:t.emptyText,children:"No request headers"})}),e(w,{title:"Response Headers",icon:e(E,{size:14,color:$}),defaultOpen:false,count:Object.keys(M).length,children:Object.keys(M).length>0?e("div",{style:t.dataViewerContainer,children:e(R,{title:"",data:M,showTypeFilter:true,rawMode:true,initialExpanded:true})}):e("div",{style:t.emptyText,children:"No response headers yet"})}),g!==void 0?e(w,{title:"Request Body",icon:e(v,{size:14,color:r.semantic.info}),defaultOpen:false,children:e("div",{style:t.dataViewerContainer,children:s?e(R,{title:"",data:g,showTypeFilter:true,rawMode:true,initialExpanded:true}):e(V,{})})}):D?e(w,{title:"Request Body",icon:e(v,{size:14,color:r.semantic.info}),defaultOpen:true,children:e("div",{style:t.emptyText,children:f?`Loading request body (${k(n.requestSize??0)})\u2026`:"Request body unavailable"})}):null,b!==void 0?e(w,{title:"Response Body",icon:e(v,{size:14,color:$}),defaultOpen:true,children:e("div",{style:t.dataViewerContainer,children:s?e(R,{title:"",data:b,showTypeFilter:true,rawMode:true,initialExpanded:true}):e(V,{})})}):h?e(w,{title:"Response Body",icon:e(v,{size:14,color:$}),defaultOpen:true,children:e("div",{style:t.emptyText,children:f?`Loading response body (${k(n.responseSize??0)})\u2026`:"Response body unavailable"})}):null,e(w,{title:"Filter Options",icon:e(te,{size:14,color:r.semantic.warning}),defaultOpen:false,children:e("div",{style:t.filterOptionsContainer,children:(()=>{let l="";let m="";try{const I=new URL(n.url);l=I.hostname;m=I.pathname}catch{m=n.url}const B=c.has(l);const C=c.has(m);return o(F,{children:[o("button",{type:"button",style:{...t.filterOption,...B?t.filterOptionActive:null},onClick:()=>l&&d(l),children:[o("span",{style:t.filterOptionLeft,children:[e(ne,{size:16,color:B?r.semantic.warning:r.text.muted}),o("span",{style:t.filterOptionContent,children:[e("span",{style:t.filterOptionLabel,children:"Ignore Domain"}),e("span",{style:t.filterOptionValue,children:l||"N/A"})]})]}),e("span",{style:{...t.filterToggle,...B?t.filterToggleActive:null},children:e("span",{style:{...t.filterToggleText,...B?t.filterToggleTextActive:null},children:B?"IGNORED":"IGNORE"})})]}),o("button",{type:"button",style:{...t.filterOption,...C?t.filterOptionActive:null},onClick:()=>m&&d(m),children:[o("span",{style:t.filterOptionLeft,children:[e(re,{size:16,color:C?r.semantic.warning:r.text.muted}),o("span",{style:t.filterOptionContent,children:[e("span",{style:t.filterOptionLabel,children:"Ignore URL Pattern"}),e("span",{style:{...t.filterOptionValue,...t.singleLine},children:m||"N/A"})]})]}),e("span",{style:{...t.filterToggle,...C?t.filterToggleActive:null},children:e("span",{style:{...t.filterToggleText,...C?t.filterToggleTextActive:null},children:C?"IGNORED":"IGNORE"})})]}),e("div",{style:t.filterInfoBox,children:e("span",{style:t.filterInfoText,children:"Ignored requests will be hidden from the network list. You can manage filters in the Filters tab."})})]})})()})})]})});const t={container:{flex:1,minHeight:0,overflowY:"auto",backgroundColor:r.background.base},requestDetailsSection:{margin:"12px 12px 0",backgroundColor:r.background.card,borderRadius:8,border:`1px solid ${r.border.default}`,padding:12},httpHeader:{display:"flex",flexDirection:"row",alignItems:"center",gap:8,marginBottom:12,flexWrap:"nowrap"},httpMethodBadge:{display:"inline-flex",backgroundColor:r.semantic.infoBackground,padding:"4px 8px",borderRadius:4},httpMethod:{color:r.semantic.info,fontSize:11,fontWeight:700,letterSpacing:.5},httpStatusBadge:{display:"inline-flex",padding:"4px 8px",borderRadius:4,whiteSpace:"nowrap"},httpStatusText:{fontSize:11,fontWeight:600},pendingBadge:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:4,backgroundColor:r.semantic.warningBackground,padding:"4px 8px",borderRadius:4},pendingBadgeText:{color:r.semantic.warning,fontSize:11,fontWeight:600},httpDuration:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:4},httpDurationText:{color:r.text.secondary,fontSize:11},overrideBadge:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:4,padding:"3px 6px",borderRadius:4,backgroundColor:r.semantic.warningBackground},overrideBadgeText:{color:r.semantic.warning,fontSize:10,fontWeight:700},copyFullButton:{marginLeft:"auto",flexShrink:0,padding:4},urlBreakdown:{backgroundColor:r.background.input,borderRadius:4,padding:8},urlRow:{display:"flex",flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},urlDomain:{color:r.text.primary,fontSize:12,fontWeight:600,flex:1,minWidth:0,overflowWrap:"anywhere"},urlProtocol:{color:r.text.muted,fontSize:10},copyButton:{padding:4},urlPathRow:{paddingLeft:18},urlPath:{color:r.text.secondary,fontSize:11,fontFamily:"ui-monospace, Menlo, monospace",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",overflowWrap:"anywhere"},urlQueryString:{color:r.semantic.info,fontSize:11,fontFamily:"ui-monospace, Menlo, monospace"},queryParamsCollapsible:{marginTop:8},queryParamsToggle:{display:"flex",width:"100%",boxSizing:"border-box",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,padding:"10px 12px",backgroundColor:r.background.hover,borderRadius:8,border:`1px solid ${r.border.default}`,marginBottom:8,cursor:"pointer",margin:"0 0 8px",font:"inherit"},queryParamsToggleText:{flexGrow:0,color:r.text.primary,fontSize:12,fontWeight:600,letterSpacing:.3,whiteSpace:"nowrap"},timingSection:{margin:"8px 12px 0",backgroundColor:r.background.card,borderRadius:8,border:`1px solid ${r.border.default}`,padding:12},timingRow:{display:"flex",flexDirection:"row",alignItems:"center",gap:6,flexWrap:"wrap"},timingLabel:{color:r.text.secondary,fontSize:11},timingValue:{color:r.text.primary,fontSize:11,fontWeight:600},timingExact:{color:r.text.muted,fontSize:10,marginLeft:4},sizeRow:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:16,marginLeft:"auto"},sizeItem:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:4},sizeLabel:{color:r.text.muted,fontSize:10},sizeValue:{color:r.semantic.info,fontSize:10,fontFamily:"ui-monospace, Menlo, monospace",fontWeight:600},phaseDivider:{height:1,backgroundColor:r.border.default,marginTop:12,marginBottom:12},phaseList:{display:"flex",flexDirection:"column",gap:8},phaseRow:{display:"flex",flexDirection:"row",alignItems:"center",gap:14},phaseLabelGroup:{width:150,flexShrink:0},phaseLabel:{fontSize:12,color:r.text.secondary},phaseHint:{fontSize:10,color:r.text.muted},phaseTrack:{flex:1,minWidth:0,height:7,borderRadius:4,backgroundColor:r.background.hover,display:"flex",justifyContent:"center",flexDirection:"column",overflow:"hidden"},phaseBar:{height:7,borderRadius:4},phaseValue:{width:72,flexShrink:0,textAlign:"right",fontSize:12,fontFamily:"ui-monospace, Menlo, monospace",color:r.text.primary},collapsibleSection:{margin:"8px 12px 0",backgroundColor:r.background.card,borderRadius:8,border:`1px solid ${r.border.default}`,overflow:"hidden"},collapsibleHeader:{display:"flex",width:"100%",boxSizing:"border-box",flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,backgroundColor:r.background.hover,border:"none",cursor:"pointer",margin:0,font:"inherit",textAlign:"left"},collapsibleTitle:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:8},collapsibleTitleText:{color:r.text.primary,fontSize:13,fontWeight:600},collapsibleCount:{color:r.text.muted,fontSize:11.5,fontFamily:"ui-monospace, Menlo, monospace"},collapsibleContent:{padding:12},dataViewerContainer:{margin:-12},bodyDeferred:{height:120},errorBox:{display:"flex",flexDirection:"row",alignItems:"center",gap:6,backgroundColor:r.semantic.errorBackground,padding:8,borderRadius:4,marginTop:8},errorText:{color:r.semantic.error,fontSize:11,flex:1,minWidth:0,overflowWrap:"anywhere"},emptyText:{color:r.text.muted,fontSize:12,fontStyle:"italic",textAlign:"center"},filterOptionsContainer:{display:"flex",flexDirection:"column",gap:12},filterOption:{display:"flex",width:"100%",boxSizing:"border-box",flexDirection:"row",alignItems:"center",justifyContent:"space-between",backgroundColor:r.background.hover,borderRadius:8,padding:12,border:`1px solid ${r.border.default}`,cursor:"pointer",margin:0,font:"inherit",textAlign:"left"},filterOptionActive:{backgroundColor:r.semantic.warningBackground,border:`1px solid ${r.semantic.warning}33`},filterOptionLeft:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:12,flex:1,minWidth:0},filterOptionContent:{display:"inline-flex",flexDirection:"column",flex:1,minWidth:0},filterOptionLabel:{color:r.text.secondary,fontSize:11,marginBottom:2,textTransform:"uppercase",letterSpacing:.5},filterOptionValue:{color:r.text.primary,fontSize:13,fontFamily:"ui-monospace, Menlo, monospace",overflowWrap:"anywhere"},singleLine:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},filterToggle:{display:"inline-flex",padding:"6px 10px",borderRadius:4,backgroundColor:r.background.input,border:`1px solid ${r.border.default}`,flexShrink:0},filterToggleActive:{backgroundColor:`${r.semantic.warning}26`,border:`1px solid ${r.semantic.warning}4D`},filterToggleText:{fontSize:10,fontWeight:600,color:r.text.muted,letterSpacing:.5},filterToggleTextActive:{color:r.semantic.warning},filterInfoBox:{backgroundColor:r.semantic.infoBackground,borderRadius:6,padding:10,border:`1px solid ${r.semantic.info}33`},filterInfoText:{color:r.text.secondary,fontSize:11,lineHeight:"16px"}};
35
+ `};return o("div",{style:n.container,children:[o("div",{style:n.requestDetailsSection,children:[o("div",{style:n.httpHeader,children:[e("span",{style:n.httpMethodBadge,children:e("span",{style:n.httpMethod,children:t.method})}),t.status?e("span",{style:{...n.httpStatusBadge,backgroundColor:`${a?.color}20`},children:o("span",{style:{...n.httpStatusText,color:a?.color},children:[a?.text," ",a?.meaning]})}):u?o("span",{style:n.pendingBadge,children:[e(L,{size:10,color:r.semantic.warning}),e("span",{style:n.pendingBadgeText,children:"Pending"})]}):null,t.condition?.uploadCap?.note&&e("span",{style:{color:"#FFCC66"},children:t.condition.uploadCap.note}),t.duration?o("span",{style:n.httpDuration,children:[e(L,{size:10,color:r.text.muted}),e("span",{style:n.httpDurationText,children:N(t.duration)})]}):null,t.override?o("span",{style:n.overrideBadge,children:[e(ie,{size:10,color:r.semantic.warning}),e("span",{style:n.overrideBadgeText,children:t.override.ruleName||"Overridden"})]}):null,e(F,{value:j,buttonStyle:n.copyFullButton})]}),e(se,{url:t.url,requestData:g,operationName:t.operationName,graphqlVariables:t.graphqlVariables,requestClient:t.requestClient}),t.error?o("div",{style:n.errorBox,children:[e(Z,{size:12,color:r.semantic.error}),e("span",{style:n.errorText,children:t.error})]}):null]}),o("div",{style:n.timingSection,children:[o("div",{style:n.timingRow,children:[e(L,{size:12,color:r.text.secondary}),e("span",{style:n.timingLabel,children:"Started:"}),e("span",{style:n.timingValue,children:Y(t.timestamp)}),o("span",{style:n.timingExact,children:["(",new Date(t.timestamp).toLocaleTimeString(),")"]}),t.requestSize||t.responseSize?o("span",{style:n.sizeRow,children:[t.requestSize!==void 0?o("span",{style:n.sizeItem,children:[e(P,{size:10,color:r.semantic.info}),e("span",{style:n.sizeLabel,children:"Sent:"}),e("span",{style:n.sizeValue,children:k(t.requestSize)})]}):null,t.responseSize!==void 0?o("span",{style:n.sizeItem,children:[e(E,{size:10,color:$}),e("span",{style:n.sizeLabel,children:"Received:"}),e("span",{style:n.sizeValue,children:k(t.responseSize)})]}):null]}):null]}),t.timings?o(A,{children:[e("div",{style:n.phaseDivider}),e(ae,{timings:t.timings,total:t.duration??t.timings.ttfb+t.timings.download})]}):null]}),e(w,{title:"Request Headers",icon:e(P,{size:14,color:r.semantic.info}),defaultOpen:false,count:Object.keys(z).length,children:Object.keys(z).length>0?e("div",{style:n.dataViewerContainer,children:e(R,{title:"",data:z,showTypeFilter:true,rawMode:true,initialExpanded:true})}):e("div",{style:n.emptyText,children:"No request headers"})}),e(w,{title:"Response Headers",icon:e(E,{size:14,color:$}),defaultOpen:false,count:Object.keys(M).length,children:Object.keys(M).length>0?e("div",{style:n.dataViewerContainer,children:e(R,{title:"",data:M,showTypeFilter:true,rawMode:true,initialExpanded:true})}):e("div",{style:n.emptyText,children:"No response headers yet"})}),g!==void 0?e(w,{title:"Request Body",icon:e(v,{size:14,color:r.semantic.info}),defaultOpen:false,children:e("div",{style:n.dataViewerContainer,children:s?e(R,{title:"",data:g,showTypeFilter:true,rawMode:true,initialExpanded:true}):e(V,{})})}):C?e(w,{title:"Request Body",icon:e(v,{size:14,color:r.semantic.info}),defaultOpen:true,children:e("div",{style:n.emptyText,children:f?`Loading request body (${k(t.requestSize??0)})\u2026`:"Request body unavailable"})}):null,b!==void 0?e(w,{title:"Response Body",icon:e(v,{size:14,color:$}),defaultOpen:true,children:e("div",{style:n.dataViewerContainer,children:s?e(R,{title:"",data:b,showTypeFilter:true,rawMode:true,initialExpanded:true}):e(V,{})})}):h?e(w,{title:"Response Body",icon:e(v,{size:14,color:$}),defaultOpen:true,children:e("div",{style:n.emptyText,children:f?`Loading response body (${k(t.responseSize??0)})\u2026`:"Response body unavailable"})}):null,e(w,{title:"Filter Options",icon:e(te,{size:14,color:r.semantic.warning}),defaultOpen:false,children:e("div",{style:n.filterOptionsContainer,children:(()=>{let l="";let m="";try{const I=new URL(t.url);l=I.hostname;m=I.pathname}catch{m=t.url}const D=c.has(l);const B=c.has(m);return o(A,{children:[o("button",{type:"button",style:{...n.filterOption,...D?n.filterOptionActive:null},onClick:()=>l&&d(l),children:[o("span",{style:n.filterOptionLeft,children:[e(ne,{size:16,color:D?r.semantic.warning:r.text.muted}),o("span",{style:n.filterOptionContent,children:[e("span",{style:n.filterOptionLabel,children:"Ignore Domain"}),e("span",{style:n.filterOptionValue,children:l||"N/A"})]})]}),e("span",{style:{...n.filterToggle,...D?n.filterToggleActive:null},children:e("span",{style:{...n.filterToggleText,...D?n.filterToggleTextActive:null},children:D?"IGNORED":"IGNORE"})})]}),o("button",{type:"button",style:{...n.filterOption,...B?n.filterOptionActive:null},onClick:()=>m&&d(m),children:[o("span",{style:n.filterOptionLeft,children:[e(re,{size:16,color:B?r.semantic.warning:r.text.muted}),o("span",{style:n.filterOptionContent,children:[e("span",{style:n.filterOptionLabel,children:"Ignore URL Pattern"}),e("span",{style:{...n.filterOptionValue,...n.singleLine},children:m||"N/A"})]})]}),e("span",{style:{...n.filterToggle,...B?n.filterToggleActive:null},children:e("span",{style:{...n.filterToggleText,...B?n.filterToggleTextActive:null},children:B?"IGNORED":"IGNORE"})})]}),e("div",{style:n.filterInfoBox,children:e("span",{style:n.filterInfoText,children:"Ignored requests will be hidden from the network list. You can manage filters in the Filters tab."})})]})})()})})]})});const n={container:{flex:1,minHeight:0,overflowY:"auto",backgroundColor:r.background.base},requestDetailsSection:{margin:"12px 12px 0",backgroundColor:r.background.card,borderRadius:8,border:`1px solid ${r.border.default}`,padding:12},httpHeader:{display:"flex",flexDirection:"row",alignItems:"center",gap:8,marginBottom:12,flexWrap:"nowrap"},httpMethodBadge:{display:"inline-flex",backgroundColor:r.semantic.infoBackground,padding:"4px 8px",borderRadius:4},httpMethod:{color:r.semantic.info,fontSize:11,fontWeight:700,letterSpacing:.5},httpStatusBadge:{display:"inline-flex",padding:"4px 8px",borderRadius:4,whiteSpace:"nowrap"},httpStatusText:{fontSize:11,fontWeight:600},pendingBadge:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:4,backgroundColor:r.semantic.warningBackground,padding:"4px 8px",borderRadius:4},pendingBadgeText:{color:r.semantic.warning,fontSize:11,fontWeight:600},httpDuration:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:4},httpDurationText:{color:r.text.secondary,fontSize:11},overrideBadge:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:4,padding:"3px 6px",borderRadius:4,backgroundColor:r.semantic.warningBackground},overrideBadgeText:{color:r.semantic.warning,fontSize:10,fontWeight:700},copyFullButton:{marginLeft:"auto",flexShrink:0,padding:4},urlBreakdown:{backgroundColor:r.background.input,borderRadius:4,padding:8},urlRow:{display:"flex",flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},urlDomain:{color:r.text.primary,fontSize:12,fontWeight:600,flex:1,minWidth:0,overflowWrap:"anywhere"},urlProtocol:{color:r.text.muted,fontSize:10},copyButton:{padding:4},urlPathRow:{paddingLeft:18},urlPath:{color:r.text.secondary,fontSize:11,fontFamily:"ui-monospace, Menlo, monospace",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",overflowWrap:"anywhere"},urlQueryString:{color:r.semantic.info,fontSize:11,fontFamily:"ui-monospace, Menlo, monospace"},queryParamsCollapsible:{marginTop:8},queryParamsToggle:{display:"flex",width:"100%",boxSizing:"border-box",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,padding:"10px 12px",backgroundColor:r.background.hover,borderRadius:8,border:`1px solid ${r.border.default}`,marginBottom:8,cursor:"pointer",margin:"0 0 8px",font:"inherit"},queryParamsToggleText:{flexGrow:0,color:r.text.primary,fontSize:12,fontWeight:600,letterSpacing:.3,whiteSpace:"nowrap"},timingSection:{margin:"8px 12px 0",backgroundColor:r.background.card,borderRadius:8,border:`1px solid ${r.border.default}`,padding:12},timingRow:{display:"flex",flexDirection:"row",alignItems:"center",gap:6,flexWrap:"wrap"},timingLabel:{color:r.text.secondary,fontSize:11},timingValue:{color:r.text.primary,fontSize:11,fontWeight:600},timingExact:{color:r.text.muted,fontSize:10,marginLeft:4},sizeRow:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:16,marginLeft:"auto"},sizeItem:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:4},sizeLabel:{color:r.text.muted,fontSize:10},sizeValue:{color:r.semantic.info,fontSize:10,fontFamily:"ui-monospace, Menlo, monospace",fontWeight:600},phaseDivider:{height:1,backgroundColor:r.border.default,marginTop:12,marginBottom:12},phaseList:{display:"flex",flexDirection:"column",gap:8},phaseRow:{display:"flex",flexDirection:"row",alignItems:"center",gap:14},phaseLabelGroup:{width:150,flexShrink:0},phaseLabel:{fontSize:12,color:r.text.secondary},phaseHint:{fontSize:10,color:r.text.muted},phaseTrack:{flex:1,minWidth:0,height:7,borderRadius:4,backgroundColor:r.background.hover,display:"flex",justifyContent:"center",flexDirection:"column",overflow:"hidden"},phaseBar:{height:7,borderRadius:4},phaseValue:{width:72,flexShrink:0,textAlign:"right",fontSize:12,fontFamily:"ui-monospace, Menlo, monospace",color:r.text.primary},collapsibleSection:{margin:"8px 12px 0",backgroundColor:r.background.card,borderRadius:8,border:`1px solid ${r.border.default}`,overflow:"hidden"},collapsibleHeader:{display:"flex",width:"100%",boxSizing:"border-box",flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,backgroundColor:r.background.hover,border:"none",cursor:"pointer",margin:0,font:"inherit",textAlign:"left"},collapsibleTitle:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:8},collapsibleTitleText:{color:r.text.primary,fontSize:13,fontWeight:600},collapsibleCount:{color:r.text.muted,fontSize:11.5,fontFamily:"ui-monospace, Menlo, monospace"},collapsibleContent:{padding:12},dataViewerContainer:{margin:-12},bodyDeferred:{height:120},errorBox:{display:"flex",flexDirection:"row",alignItems:"center",gap:6,backgroundColor:r.semantic.errorBackground,padding:8,borderRadius:4,marginTop:8},errorText:{color:r.semantic.error,fontSize:11,flex:1,minWidth:0,overflowWrap:"anywhere"},emptyText:{color:r.text.muted,fontSize:12,fontStyle:"italic",textAlign:"center"},filterOptionsContainer:{display:"flex",flexDirection:"column",gap:12},filterOption:{display:"flex",width:"100%",boxSizing:"border-box",flexDirection:"row",alignItems:"center",justifyContent:"space-between",backgroundColor:r.background.hover,borderRadius:8,padding:12,border:`1px solid ${r.border.default}`,cursor:"pointer",margin:0,font:"inherit",textAlign:"left"},filterOptionActive:{backgroundColor:r.semantic.warningBackground,border:`1px solid ${r.semantic.warning}33`},filterOptionLeft:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:12,flex:1,minWidth:0},filterOptionContent:{display:"inline-flex",flexDirection:"column",flex:1,minWidth:0},filterOptionLabel:{color:r.text.secondary,fontSize:11,marginBottom:2,textTransform:"uppercase",letterSpacing:.5},filterOptionValue:{color:r.text.primary,fontSize:13,fontFamily:"ui-monospace, Menlo, monospace",overflowWrap:"anywhere"},singleLine:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},filterToggle:{display:"inline-flex",padding:"6px 10px",borderRadius:4,backgroundColor:r.background.input,border:`1px solid ${r.border.default}`,flexShrink:0},filterToggleActive:{backgroundColor:`${r.semantic.warning}26`,border:`1px solid ${r.semantic.warning}4D`},filterToggleText:{fontSize:10,fontWeight:600,color:r.text.muted,letterSpacing:.5},filterToggleTextActive:{color:r.semantic.warning},filterInfoBox:{backgroundColor:r.semantic.infoBackground,borderRadius:6,padding:10,border:`1px solid ${r.semantic.info}33`},filterInfoText:{color:r.text.secondary,fontSize:11,lineHeight:"16px"}};
@@ -1,2 +1,2 @@
1
- "use strict";import{memo as T}from"react";import{StyleSheet as z,View as n,Text as a}from"react-native";import{ChevronRight as S,Upload as R,Download as w,Clock as k,AlertCircle as I,Bookmark as B,FlaskConical as q,Pin as D,DevToolsCard as E,MethodBadge as H,TypeBadge as L,night as i,macOSColors as s,monoFont as u}from"@buoy-gg/shared-ui";import{formatBytes as h,formatDuration as N}from"../utils/formatting";import{formatRelativeTime as W}from"@buoy-gg/shared-ui";import{useTickEveryMinute as F}from"../hooks/useTickEveryMinute";import{formatGraphQLDisplay as V}from"../utils/formatGraphQLVariables";import{jsx as e,jsxs as l}from"react/jsx-runtime";function j(o,r){if(r)return s.semantic.error;if(!o)return s.semantic.warning;if(o>=200&&o<300)return s.semantic.success;if(o>=300&&o<400)return s.semantic.info;if(o>=400)return s.semantic.error;return s.text.muted}function M(o){const r=o?.["content-type"]||o?.["Content-Type"]||"";if(r.includes("json"))return"JSON";if(r.includes("xml"))return"XML";if(r.includes("html"))return"HTML";if(r.includes("text"))return"TEXT";if(r.includes("image"))return"IMG";if(r.includes("video"))return"VIDEO";if(r.includes("audio"))return"AUDIO";if(r.includes("form"))return"FORM";return null}function y(o){switch(o){case"fetch":return{backgroundColor:"rgba(74, 144, 226, 0.15)",color:"#4A90E2"};case"graphql":return{backgroundColor:"rgba(229, 53, 171, 0.15)",color:"#E535AB"};case"grpc-web":return{backgroundColor:"rgba(16, 185, 129, 0.15)",color:"#10B981"};case"xhr":return{backgroundColor:"rgba(245, 158, 11, 0.15)",color:"#F59E0B"};default:return{backgroundColor:"rgba(147, 51, 234, 0.15)",color:"#9333EA"}}}function O({event:o,isPending:r,statusColor:d}){if(r){return l(n,{style:t.pendingBadge,children:[e(k,{size:10,color:i.color.warning}),e(a,{style:t.pendingText,children:"..."})]})}if(o.error){return l(n,{style:t.errorBadge,children:[e(I,{size:10,color:i.color.danger}),e(a,{style:t.errorText,children:"ERR"})]})}return e(n,{style:t.statusBadge,children:e(a,{style:[t.statusText,{color:d}],children:String(o.status)})})}function A({requestSize:o,responseSize:r}){if(!o&&!r)return null;return l(n,{style:t.sizeRow,children:[o?l(n,{style:t.sizeItem,children:[e(R,{size:8,color:i.color.info}),e(a,{style:t.sizeText,children:h(o)})]}):null,r?l(n,{style:t.sizeItem,children:[e(w,{size:8,color:i.color.accent}),e(a,{style:t.sizeText,children:h(r)})]}):null]})}function P({timestamp:o,duration:r}){const d=F();const g=W(o,d);return r?l(a,{style:t.bottomRightText,children:[N(r)," ",g]}):e(a,{style:t.bottomRightText,children:g})}export const NetworkEventItemCompact=T(function o({event:r,onPress:d,pinned:g=false,saved:x=false,overridden:C=false,onLongPress:m}){const f=j(r.status,r.error);const b=!r.status&&!r.error;const p=M(r.responseHeaders);let c=r.path||r.url.replace(/^https?:\/\/[^/]+/,"");if(r.requestClient==="graphql"){if(r.operationName){c=V(r.operationName,r.graphqlVariables)}else{c=c.replace(/\/graphql[^?]*/,"/graphql")}}else if(r.operationName){c=`${c}
2
- (${r.operationName})`}return l(E,{onPress:()=>d(r),onLongPress:m?()=>m(r):void 0,style:t.cardWrapper,contentStyle:[t.container,{borderLeftColor:f}],testID:`buoy-network-row-${r.id}`,accessibilityLabel:`${r.method} ${r.path||r.url}`,children:[l(n,{style:t.topRightContainer,children:[g?e(D,{size:10,active:true,color:i.color.info}):null,x?e(B,{size:10,color:i.color.accent}):null,C||r.override?e(q,{size:10,color:i.color.warning}):null,e(O,{event:r,isPending:b,statusColor:f}),r.requestClient?e(n,{style:[t.topRightBadge,{backgroundColor:y(r.requestClient).backgroundColor}],children:e(a,{style:[t.clientText,{color:y(r.requestClient).color}],children:r.requestClient==="graphql"?"GQL":r.requestClient==="grpc-web"?"gRPC":r.requestClient==="xhr"?"XHR":r.requestClient})}):null]}),l(n,{style:t.leftSection,children:[e(H,{method:r.method,size:"small"}),e(A,{requestSize:r.requestSize,responseSize:r.responseSize})]}),e(n,{style:t.middleSection,children:e(a,{style:t.urlText,numberOfLines:2,children:c})}),l(n,{style:t.rightSection,children:[p?e(L,{type:p,size:"small"}):null,e(S,{size:14,color:i.color.textTertiary})]}),e(n,{style:t.bottomRightContainer,children:e(P,{timestamp:r.timestamp,duration:r.duration})})]})});NetworkEventItemCompact.displayName="NetworkEventItemCompact";const t=z.create({cardWrapper:{marginHorizontal:8},container:{flexDirection:"row",alignItems:"center",backgroundColor:"rgba(12, 12, 12, 0.9)",borderLeftWidth:3,borderLeftColor:"transparent",borderBottomWidth:1},leftSection:{marginRight:8,alignItems:"flex-start"},topRightContainer:{position:"absolute",top:1,right:1,flexDirection:"row",alignItems:"center",gap:4},topRightBadge:{paddingHorizontal:4,paddingVertical:2,borderRadius:4},middleSection:{flex:1,justifyContent:"center",paddingRight:8},urlText:{fontSize:12,color:i.color.text,lineHeight:16,fontFamily:u},rightSection:{flexDirection:"row",alignItems:"center",gap:6},bottomRightContainer:{position:"absolute",bottom:4,right:8},bottomRightText:{fontSize:9,color:i.color.textTertiary,fontFamily:u},statusBadge:{paddingHorizontal:4,paddingVertical:1,borderRadius:3},statusText:{fontSize:10,fontWeight:"600"},pendingBadge:{flexDirection:"row",alignItems:"center",gap:2,paddingHorizontal:4,paddingVertical:1,backgroundColor:i.color.warningSoft,borderRadius:3},pendingText:{fontSize:10,color:i.color.warning,fontWeight:"600"},errorBadge:{flexDirection:"row",alignItems:"center",gap:2,paddingHorizontal:4,paddingVertical:1,backgroundColor:i.color.dangerSoft,borderRadius:3},errorText:{fontSize:10,color:i.color.danger,fontWeight:"600"},durationText:{fontSize:9,color:i.color.textSecondary},sizeRow:{flexDirection:"row",gap:4,marginTop:4},sizeItem:{flexDirection:"row",alignItems:"center",gap:2},sizeText:{fontSize:8,color:i.color.textSecondary,fontFamily:u},clientText:{fontSize:8,fontWeight:"700",letterSpacing:.3,textTransform:"uppercase"}});
1
+ "use strict";import{memo as T}from"react";import{StyleSheet as z,View as n,Text as a}from"react-native";import{ChevronRight as S,Upload as w,Download as R,Clock as k,AlertCircle as I,Bookmark as B,FlaskConical as D,Pin as q,DevToolsCard as E,MethodBadge as H,TypeBadge as L,night as i,macOSColors as s,monoFont as u}from"@buoy-gg/shared-ui";import{formatBytes as h,formatDuration as N}from"../utils/formatting";import{formatRelativeTime as W}from"@buoy-gg/shared-ui";import{useTickEveryMinute as F}from"../hooks/useTickEveryMinute";import{formatGraphQLDisplay as V}from"../utils/formatGraphQLVariables";import{jsx as o,jsxs as l}from"react/jsx-runtime";function j(t,r){if(r)return s.semantic.error;if(!t)return s.semantic.warning;if(t>=200&&t<300)return s.semantic.success;if(t>=300&&t<400)return s.semantic.info;if(t>=400)return s.semantic.error;return s.text.muted}function M(t){const r=t?.["content-type"]||t?.["Content-Type"]||"";if(r.includes("json"))return"JSON";if(r.includes("xml"))return"XML";if(r.includes("html"))return"HTML";if(r.includes("text"))return"TEXT";if(r.includes("image"))return"IMG";if(r.includes("video"))return"VIDEO";if(r.includes("audio"))return"AUDIO";if(r.includes("form"))return"FORM";return null}function y(t){switch(t){case"fetch":return{backgroundColor:"rgba(74, 144, 226, 0.15)",color:"#4A90E2"};case"graphql":return{backgroundColor:"rgba(229, 53, 171, 0.15)",color:"#E535AB"};case"grpc-web":return{backgroundColor:"rgba(16, 185, 129, 0.15)",color:"#10B981"};case"xhr":return{backgroundColor:"rgba(245, 158, 11, 0.15)",color:"#F59E0B"};default:return{backgroundColor:"rgba(147, 51, 234, 0.15)",color:"#9333EA"}}}function O({event:t,isPending:r,statusColor:d}){if(r){return l(n,{style:e.pendingBadge,children:[o(k,{size:10,color:i.color.warning}),o(a,{style:e.pendingText,children:"..."})]})}if(t.error){return l(n,{style:e.errorBadge,children:[o(I,{size:10,color:i.color.danger}),o(a,{style:e.errorText,children:"ERR"})]})}return o(n,{style:e.statusBadge,children:o(a,{style:[e.statusText,{color:d}],children:String(t.status)})})}function $({requestSize:t,responseSize:r}){if(!t&&!r)return null;return l(n,{style:e.sizeRow,children:[t?l(n,{style:e.sizeItem,children:[o(w,{size:8,color:i.color.info}),o(a,{style:e.sizeText,children:h(t)})]}):null,r?l(n,{style:e.sizeItem,children:[o(R,{size:8,color:i.color.accent}),o(a,{style:e.sizeText,children:h(r)})]}):null]})}function A({timestamp:t,duration:r}){const d=F();const g=W(t,d);return r?l(a,{style:e.bottomRightText,children:[N(r)," ",g]}):o(a,{style:e.bottomRightText,children:g})}export const NetworkEventItemCompact=T(function t({event:r,onPress:d,pinned:g=false,saved:C=false,overridden:x=false,onLongPress:m}){const p=j(r.status,r.error);const b=!r.status&&!r.error;const f=M(r.responseHeaders);let c=r.path||r.url.replace(/^https?:\/\/[^/]+/,"");if(r.requestClient==="graphql"){if(r.operationName){c=V(r.operationName,r.graphqlVariables)}else{c=c.replace(/\/graphql[^?]*/,"/graphql")}}else if(r.operationName){c=`${c}
2
+ (${r.operationName})`}return l(E,{onPress:()=>d(r),onLongPress:m?()=>m(r):void 0,style:e.cardWrapper,contentStyle:[e.container,{borderLeftColor:p}],testID:`buoy-network-row-${r.id}`,accessibilityLabel:`${r.method} ${r.path||r.url}`,children:[l(n,{style:e.topRightContainer,children:[g?o(q,{size:10,active:true,color:i.color.info}):null,C?o(B,{size:10,color:i.color.accent}):null,x||r.override?o(D,{size:10,color:i.color.warning}):null,o(O,{event:r,isPending:b,statusColor:p}),r.requestClient?o(n,{style:[e.topRightBadge,{backgroundColor:y(r.requestClient).backgroundColor}],children:o(a,{style:[e.clientText,{color:y(r.requestClient).color}],children:r.requestClient==="graphql"?"GQL":r.requestClient==="grpc-web"?"gRPC":r.requestClient==="xhr"?"XHR":r.requestClient})}):null]}),l(n,{style:e.leftSection,children:[o(H,{method:r.method,size:"small"}),o($,{requestSize:r.requestSize,responseSize:r.responseSize})]}),l(n,{style:e.middleSection,children:[o(a,{style:e.urlText,numberOfLines:2,children:c}),r.condition?.uploadCap?.note&&o(a,{testID:`buoy-network-upload-cap-${r.id}`,style:{color:i.color.warning,fontSize:10},children:r.condition.uploadCap.note})]}),l(n,{style:e.rightSection,children:[f?o(L,{type:f,size:"small"}):null,o(S,{size:14,color:i.color.textTertiary})]}),o(n,{style:e.bottomRightContainer,children:o(A,{timestamp:r.timestamp,duration:r.duration})})]})});NetworkEventItemCompact.displayName="NetworkEventItemCompact";const e=z.create({cardWrapper:{marginHorizontal:8},container:{flexDirection:"row",alignItems:"center",backgroundColor:"rgba(12, 12, 12, 0.9)",borderLeftWidth:3,borderLeftColor:"transparent",borderBottomWidth:1},leftSection:{marginRight:8,alignItems:"flex-start"},topRightContainer:{position:"absolute",top:1,right:1,flexDirection:"row",alignItems:"center",gap:4},topRightBadge:{paddingHorizontal:4,paddingVertical:2,borderRadius:4},middleSection:{flex:1,justifyContent:"center",paddingRight:8},urlText:{fontSize:12,color:i.color.text,lineHeight:16,fontFamily:u},rightSection:{flexDirection:"row",alignItems:"center",gap:6},bottomRightContainer:{position:"absolute",bottom:4,right:8},bottomRightText:{fontSize:9,color:i.color.textTertiary,fontFamily:u},statusBadge:{paddingHorizontal:4,paddingVertical:1,borderRadius:3},statusText:{fontSize:10,fontWeight:"600"},pendingBadge:{flexDirection:"row",alignItems:"center",gap:2,paddingHorizontal:4,paddingVertical:1,backgroundColor:i.color.warningSoft,borderRadius:3},pendingText:{fontSize:10,color:i.color.warning,fontWeight:"600"},errorBadge:{flexDirection:"row",alignItems:"center",gap:2,paddingHorizontal:4,paddingVertical:1,backgroundColor:i.color.dangerSoft,borderRadius:3},errorText:{fontSize:10,color:i.color.danger,fontWeight:"600"},durationText:{fontSize:9,color:i.color.textSecondary},sizeRow:{flexDirection:"row",gap:4,marginTop:4},sizeItem:{flexDirection:"row",alignItems:"center",gap:2},sizeText:{fontSize:8,color:i.color.textSecondary,fontFamily:u},clientText:{fontSize:8,fontWeight:"700",letterSpacing:.3,textTransform:"uppercase"}});
@@ -1,2 +1,2 @@
1
1
  "use strict";import{memo as k,useEffect as B,useState as C,useRef as T}from"react";import{formatGraphQLDisplay as M}from"../utils/formatGraphQLVariables";import{jsx as r,jsxs as a}from"react/jsx-runtime";const h={text:{muted:"#8E8E93"},semantic:{success:"#34C759",error:"#FF453A",warning:"#FFEB3B",info:"#00B8E6"}};const x={primary:"#20C997",success:"#20C997",warning:"#FFA94D",error:"#EF4444"};const n={cardScrim:"rgba(12, 12, 12, 0.9)",border:"#1A1A1C",separator:"rgba(255, 255, 255, 0.08)",text:"#ECEDEE",textSecondary:"#9BA1A6",textTertiary:"#636366",accent:"#20C997",danger:"#FF3B30",dangerSoft:"rgba(255, 59, 48, 0.10)",warning:"#FF8329",warningSoft:"rgba(255, 131, 41, 0.12)",info:"#1E6DFF"};function u({size:t=14,color:e="currentColor",children:i}){return r("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,display:"block"},children:i})}const z=t=>r(u,{...t,children:r("path",{d:"m9 18 6-6-6-6"})});const R=t=>a(u,{...t,children:[r("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),r("polyline",{points:"17 8 12 3 7 8"}),r("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]});const E=t=>a(u,{...t,children:[r("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),r("polyline",{points:"7 10 12 15 17 10"}),r("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]});const D=t=>a(u,{...t,children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("polyline",{points:"12 6 12 12 16 14"})]});const I=t=>a(u,{...t,children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),r("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]});const F=t=>r(u,{...t,children:r("path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"})});const $=t=>a(u,{...t,children:[r("path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2"}),r("path",{d:"M8.5 2h7"}),r("path",{d:"M7 16h10"})]});const A=({active:t,...e})=>r(u,{...e,children:a("g",{transform:t?"rotate(-45 12 12) translate(12 12) scale(0.92) translate(-12 -12)":void 0,children:[r("path",{d:"M2.97 21.03 8.18 15.82"}),r("path",{d:"M4.4 10.81 13.19 19.6"}),r("path",{d:"M5.17 10.54 11.43 8.83"}),r("path",{d:"M13.46 18.83 15.17 12.57"}),r("rect",{x:"12.15",y:"5.4",width:"9.38",height:"3.52",rx:"1.07",transform:"rotate(-45 16.84 7.16)"})]})});function S(t){if(t===void 0||t===null)return"N/A";if(t===0)return"0 B";const e=1024;const i=["B","KB","MB","GB","TB"];const l=Math.floor(Math.log(t)/Math.log(e));return`${(t/Math.pow(e,l)).toFixed(1)} ${i[l]}`}function P(t){if(t===void 0||t===null)return"N/A";if(t<1e3){return`${t}ms`}if(t<6e4){return`${(t/1e3).toFixed(1)}s`}if(t<36e5){const l=Math.floor(t/6e4);const s=Math.floor(t%6e4/1e3);return s>0?`${l}m ${s}s`:`${l}m`}const e=Math.floor(t/36e5);const i=Math.floor(t%36e5/6e4);return i>0?`${e}h ${i}m`:`${e}h`}function W(t,e=Date.now()){const i=t instanceof Date?t.getTime():t;const l=Math.floor((e-i)/1e3);if(l<0){return"just now"}if(l<60){return l===0?"just now":`${l}s ago`}const s=Math.floor(l/60);if(s<60){return`${s}m ago`}const c=Math.floor(s/60);if(c<24){return`${c}h ago`}const d=Math.floor(c/24);return`${d}d ago`}const y=new Set;let m=null;function q(t){y.add(t);if(m==null){m=setInterval(()=>{const e=Date.now();y.forEach(i=>i(e))},5e3)}return()=>{y.delete(t);if(y.size===0&&m!=null){clearInterval(m);m=null}}}function L(){const[t,e]=C(()=>Date.now());B(()=>q(e),[]);return t}function N(t,e){if(e)return h.semantic.error;if(!t)return h.semantic.warning;if(t>=200&&t<300)return h.semantic.success;if(t>=300&&t<400)return h.semantic.info;if(t>=400)return h.semantic.error;return h.text.muted}function O(t){const e=t?.["content-type"]||t?.["Content-Type"]||"";if(e.includes("json"))return"JSON";if(e.includes("xml"))return"XML";if(e.includes("html"))return"HTML";if(e.includes("text"))return"TEXT";if(e.includes("image"))return"IMG";if(e.includes("video"))return"VIDEO";if(e.includes("audio"))return"AUDIO";if(e.includes("form"))return"FORM";return null}function w(t){switch(t){case"fetch":return{backgroundColor:"rgba(74, 144, 226, 0.15)",color:"#4A90E2"};case"graphql":return{backgroundColor:"rgba(229, 53, 171, 0.15)",color:"#E535AB"};case"grpc-web":return{backgroundColor:"rgba(16, 185, 129, 0.15)",color:"#10B981"};case"xhr":return{backgroundColor:"rgba(245, 158, 11, 0.15)",color:"#F59E0B"};default:return{backgroundColor:"rgba(147, 51, 234, 0.15)",color:"#9333EA"}}}const j={GET:x.success,POST:x.primary,PUT:x.warning,PATCH:n.textSecondary,DELETE:x.error,HEAD:n.textTertiary,OPTIONS:x.primary};function H({method:t}){const e=j[t.toUpperCase()]||"#6B7280";return r("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:45,boxSizing:"border-box",padding:"2px 6px",fontSize:11,fontWeight:700,color:e,backgroundColor:`${e}15`,border:`1px solid ${e}40`,borderRadius:4},children:t.toUpperCase()})}function U({type:t}){const e=n.textTertiary;return r("span",{style:{display:"inline-flex",alignItems:"center",padding:"2px 6px",fontSize:11,fontWeight:600,color:e,backgroundColor:`${e}15`,border:`1px solid ${e}40`,borderRadius:4},children:t})}function G({onPress:t,onLongPress:e,children:i,contentStyle:l}){const[s,c]=C(false);const d=T(null);const p=T(false);const f=()=>{if(d.current!=null){clearTimeout(d.current);d.current=null}};return r("div",{style:{margin:"4px 8px"},children:r("button",{type:"button",onPointerDown:()=>{c(true);if(e){p.current=false;f();d.current=setTimeout(()=>{p.current=true;e()},500)}},onPointerUp:()=>{c(false);f()},onPointerLeave:()=>{c(false);f()},onPointerCancel:()=>{c(false);f()},onClick:()=>{if(p.current){p.current=false;return}t()},style:{position:"relative",display:"flex",width:"100%",boxSizing:"border-box",backgroundColor:n.cardScrim,borderRadius:8,border:`1px solid ${n.border}`,borderBottom:`1px solid ${n.separator}`,padding:12,minHeight:44,margin:0,textAlign:"left",cursor:"pointer",fontFamily:"inherit",color:"inherit",userSelect:"none",WebkitUserSelect:"none",opacity:s?.8:1,...l},children:i})})}function V({event:t,isPending:e,statusColor:i}){if(e){return a("span",{style:o.pendingBadge,children:[r(D,{size:10,color:n.warning}),r("span",{style:o.pendingText,children:"..."})]})}if(t.error){return a("span",{style:o.errorBadge,children:[r(I,{size:10,color:n.danger}),r("span",{style:o.errorText,children:"ERR"})]})}return r("span",{style:o.statusBadge,children:r("span",{style:{...o.statusText,color:i},children:String(t.status)})})}function _({requestSize:t,responseSize:e}){if(!t&&!e)return null;return a("span",{style:o.sizeRow,children:[t?a("span",{style:o.sizeItem,children:[r(R,{size:8,color:n.info}),r("span",{style:o.sizeText,children:S(t)})]}):null,e?a("span",{style:o.sizeItem,children:[r(E,{size:8,color:n.accent}),r("span",{style:o.sizeText,children:S(e)})]}):null]})}function X({timestamp:t,duration:e}){const i=L();const l=W(t,i);return e?a("span",{style:o.bottomRightText,children:[P(e)," ",l]}):r("span",{style:o.bottomRightText,children:l})}export const NetworkEventItemCompact=k(function t({event:e,onPress:i,pinned:l=false,saved:s=false,overridden:c=false,onLongPress:d}){const p=N(e.status,e.error);const f=!e.status&&!e.error;const b=O(e.responseHeaders);let g=e.path||e.url.replace(/^https?:\/\/[^/]+/,"");if(e.requestClient==="graphql"){if(e.operationName){g=M(e.operationName,e.graphqlVariables)}else{g=g.replace(/\/graphql[^?]*/,"/graphql")}}else if(e.operationName){g=`${g}
2
- (${e.operationName})`}return a(G,{onPress:()=>i(e),onLongPress:d?()=>d(e):void 0,contentStyle:{flexDirection:"row",alignItems:"center",borderLeft:`3px solid ${p}`},children:[a("span",{style:o.topRightContainer,children:[l?r(A,{size:10,active:true,color:n.info}):null,s?r(F,{size:10,color:n.accent}):null,c||e.override?r($,{size:10,color:n.warning}):null,r(V,{event:e,isPending:f,statusColor:p}),e.requestClient?r("span",{style:{...o.topRightBadge,backgroundColor:w(e.requestClient).backgroundColor},children:r("span",{style:{...o.clientText,color:w(e.requestClient).color},children:e.requestClient==="graphql"?"GQL":e.requestClient==="grpc-web"?"gRPC":e.requestClient==="xhr"?"XHR":e.requestClient})}):null]}),a("span",{style:o.leftSection,children:[r(H,{method:e.method}),r(_,{requestSize:e.requestSize,responseSize:e.responseSize})]}),r("span",{style:o.middleSection,children:r("span",{style:o.urlText,children:g})}),a("span",{style:o.rightSection,children:[b?r(U,{type:b}):null,r(z,{size:14,color:n.textTertiary})]}),r("span",{style:o.bottomRightContainer,children:r(X,{timestamp:e.timestamp,duration:e.duration})})]})});NetworkEventItemCompact.displayName="NetworkEventItemCompact";const o={leftSection:{display:"flex",flexDirection:"column",marginRight:8,alignItems:"flex-start"},topRightContainer:{position:"absolute",top:1,right:1,display:"flex",flexDirection:"row",alignItems:"center",gap:4},topRightBadge:{display:"inline-flex",padding:"2px 4px",borderRadius:4},middleSection:{flex:1,minWidth:0,display:"flex",flexDirection:"column",justifyContent:"center",paddingRight:8},urlText:{fontSize:12,color:n.text,lineHeight:"16px",fontFamily:"ui-monospace, Menlo, monospace",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"pre-wrap",wordBreak:"break-all"},rightSection:{display:"flex",flexDirection:"row",alignItems:"center",gap:6},bottomRightContainer:{position:"absolute",bottom:4,right:8},bottomRightText:{fontSize:9,color:n.textTertiary,fontFamily:"ui-monospace, Menlo, monospace",whiteSpace:"pre"},statusBadge:{display:"inline-flex",padding:"1px 4px",borderRadius:3},statusText:{fontSize:10,fontWeight:600},pendingBadge:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:2,padding:"1px 4px",backgroundColor:n.warningSoft,borderRadius:3},pendingText:{fontSize:10,color:n.warning,fontWeight:600},errorBadge:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:2,padding:"1px 4px",backgroundColor:n.dangerSoft,borderRadius:3},errorText:{fontSize:10,color:n.danger,fontWeight:600},sizeRow:{display:"flex",flexDirection:"row",gap:4,marginTop:4},sizeItem:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:2},sizeText:{fontSize:8,color:n.textSecondary,fontFamily:"ui-monospace, Menlo, monospace"},clientText:{fontSize:8,fontWeight:700,letterSpacing:.3,textTransform:"uppercase"}};
2
+ (${e.operationName})`}return a(G,{onPress:()=>i(e),onLongPress:d?()=>d(e):void 0,contentStyle:{flexDirection:"row",alignItems:"center",borderLeft:`3px solid ${p}`},children:[a("span",{style:o.topRightContainer,children:[l?r(A,{size:10,active:true,color:n.info}):null,s?r(F,{size:10,color:n.accent}):null,c||e.override?r($,{size:10,color:n.warning}):null,r(V,{event:e,isPending:f,statusColor:p}),e.requestClient?r("span",{style:{...o.topRightBadge,backgroundColor:w(e.requestClient).backgroundColor},children:r("span",{style:{...o.clientText,color:w(e.requestClient).color},children:e.requestClient==="graphql"?"GQL":e.requestClient==="grpc-web"?"gRPC":e.requestClient==="xhr"?"XHR":e.requestClient})}):null]}),a("span",{style:o.leftSection,children:[r(H,{method:e.method}),r(_,{requestSize:e.requestSize,responseSize:e.responseSize})]}),a("span",{style:o.middleSection,children:[r("span",{style:o.urlText,children:g}),e.condition?.uploadCap?.note&&r("span",{style:{color:n.warning,fontSize:10},children:e.condition.uploadCap.note})]}),a("span",{style:o.rightSection,children:[b?r(U,{type:b}):null,r(z,{size:14,color:n.textTertiary})]}),r("span",{style:o.bottomRightContainer,children:r(X,{timestamp:e.timestamp,duration:e.duration})})]})});NetworkEventItemCompact.displayName="NetworkEventItemCompact";const o={leftSection:{display:"flex",flexDirection:"column",marginRight:8,alignItems:"flex-start"},topRightContainer:{position:"absolute",top:1,right:1,display:"flex",flexDirection:"row",alignItems:"center",gap:4},topRightBadge:{display:"inline-flex",padding:"2px 4px",borderRadius:4},middleSection:{flex:1,minWidth:0,display:"flex",flexDirection:"column",justifyContent:"center",paddingRight:8},urlText:{fontSize:12,color:n.text,lineHeight:"16px",fontFamily:"ui-monospace, Menlo, monospace",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"pre-wrap",wordBreak:"break-all"},rightSection:{display:"flex",flexDirection:"row",alignItems:"center",gap:6},bottomRightContainer:{position:"absolute",bottom:4,right:8},bottomRightText:{fontSize:9,color:n.textTertiary,fontFamily:"ui-monospace, Menlo, monospace",whiteSpace:"pre"},statusBadge:{display:"inline-flex",padding:"1px 4px",borderRadius:3},statusText:{fontSize:10,fontWeight:600},pendingBadge:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:2,padding:"1px 4px",backgroundColor:n.warningSoft,borderRadius:3},pendingText:{fontSize:10,color:n.warning,fontWeight:600},errorBadge:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:2,padding:"1px 4px",backgroundColor:n.dangerSoft,borderRadius:3},errorText:{fontSize:10,color:n.danger,fontWeight:600},sizeRow:{display:"flex",flexDirection:"row",gap:4,marginTop:4},sizeItem:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:2},sizeText:{fontSize:8,color:n.textSecondary,fontFamily:"ui-monospace, Menlo, monospace"},clientText:{fontSize:8,fontWeight:700,letterSpacing:.3,textTransform:"uppercase"}};
@@ -1 +1 @@
1
- "use strict";import{createRemoteConditionsSource as _e,openNetworkFloatingTool as Ve}from"../conditions/NetworkFloatingTool";import{useState as n,useRef as x,useEffect as P,useCallback as G}from"react";import{View as E,StyleSheet as qe,TouchableOpacity as He}from"react-native";import{Search as Le,Wifi as Ue,Filter as ze,Bookmark as je,JsModal as Ke,ModalHeader as o,devToolsStorageKeys as D,macOSColors as We,night as u,persistentStorage as de,NightSegmented as Je,useFeatureGate as $e,UpgradeModal as Ge,PowerToggleButton as Xe,useIgnoredPatterns as Ye,windowDragProps as Qe}from"@buoy-gg/shared-ui";import{NetworkFilterViewV3 as Ze}from"./NetworkFilterViewV3";import{TickProvider as ue}from"../hooks/useTickEveryMinute";import{NetworkEventDetailView as et}from"./NetworkEventDetailView";import{NetworkCopySettingsView as tt,DEFAULT_COPY_SETTINGS as rt}from"./NetworkCopySettingsView";import{NetworkHeaderBadges as ot,NetworkClearButton as nt,NetworkDetailPinActions as st,NetworkHeaderCopyButton as at}from"./NetworkHeaderLive";import{NetworkListScreen as it}from"./NetworkListScreen";import{NetworkSavedScreen as lt}from"./NetworkSavedScreen";import{NetworkOverridesScreen as ct}from"./NetworkOverridesScreen";import{NetworkOverridesButton as dt}from"./NetworkOverridesButton";import{NetworkOverrideHeaderButton as ut}from"./NetworkOverrideHeaderButton";import{NetworkHeaderMenu as pt,NetworkHeaderMenuButton as ft,NetworkHeaderMenuItem as X}from"./NetworkHeaderMenu";import{NetworkDetailStepper as gt}from"./NetworkDetailStepper";import{useNetworkEventList as pe}from"../hooks/useNetworkEventList";import{useLiveNetworkEvent as ht}from"../hooks/useLiveNetworkEvent";import{useHasNetworkSelection as mt,useNetworkBodyEventId as St,useSelectedNetworkEventId as vt}from"../hooks/useNetworkSelection";import{networkSelectionStore as _}from"../utils/networkSelectionStore";import{FREE_TIER_SAVED_LIMIT as wt,MAX_SAVED as yt}from"../utils/networkSavedStore";import{FREE_TIER_RULE_LIMIT as kt,MAX_RULES as Pt}from"../overrides/types";import{jsx as e,jsxs as l,Fragment as bt}from"react/jsx-runtime";function Ct({visible:r,paused:p,ignoredPatternValues:f,onTogglePattern:g,isPro:v,filter:c,ignoredPatterns:h,fromSaved:m,savedSearch:w,applySafeAreaInset:i}){const y=vt();const V=St();const C=y!=null&&y===V;const s=ht(y,{paused:p||!r});P(()=>{if(r&&s&&C){_.reportRendered(s.id)}},[r,s,C]);if(!r)return null;return l(E,{style:b.detailRoot,children:[s?e(et,{event:s,ignoredPatterns:f,onTogglePattern:g,showBodies:C}):e(E,{style:b.detailBodyFallback}),e(gt,{paused:p,filter:c,ignoredPatterns:h,isPro:v,fromSaved:m,savedSearch:w,applySafeAreaInset:i})]})}function Rt({visible:r,paused:p,isPro:f,filter:g,onFilterChange:v,ignoredPatterns:c,onRemovePattern:h,onAddPattern:m,onTogglePatternMode:w,isTeamPattern:i}){const{events:y}=pe({filter:g,ignoredPatterns:c,paused:p,visible:r,isPro:f});if(!r)return null;return e(Ze,{events:y,filter:g,onFilterChange:v,ignoredPatterns:c,onRemovePattern:h,onAddPattern:m,onTogglePatternMode:w,isTeamPattern:i})}function It({visible:r,paused:p,isPro:f,filter:g,ignoredPatterns:v,settings:c,onSettingsChange:h}){const{events:m}=pe({filter:g,ignoredPatterns:v,paused:p,visible:r,isPro:f});if(!r)return null;return e(tt,{settings:c,onSettingsChange:h,events:m})}function fe({visible:r,onClose:p,onBack:f,onMinimize:g,enableSharedModalDimensions:v=false,inline:c=false,paused:h,onPausedChange:m,remoteConditions:w}){const{isPro:i}=$e();const[y,V]=n(false);const C=h!=null&&m!=null;const s=C?h:y;const ge=t=>{const a=typeof t==="function"?t(s):t;if(C)m(a);else V(a)};const[d,q]=n({});const S=mt();const[k,Y]=n(false);const[A,Q]=n(false);const[B,H]=n(false);const[Z,R]=n(false);const[he,me]=n(0);const[M]=n(_e);P(()=>{M.update(w)},[M,w]);P(()=>()=>M.update(void 0),[M]);const I=true;const[Se,L]=n(null);const[U,ee]=n("filters");const[te,ve]=n("");const[z,j]=n(false);const Tt=x(false);const[re,we]=n("");const ye=x(null);const{patterns:N,values:ke,add:Pe,remove:be,toggle:Ce,toggleMode:Re,isTeamOnly:Ie}=Ye();const[F,oe]=n(rt);const K=x(false);const[W,J]=n(false);const[T,Ne]=n("export");const O=t=>{Ne(t);J(true)};P(()=>{if(W&&i){J(false)}},[W,i]);P(()=>{if(!r||K.current)return;const t=async()=>{try{const a=await de.getItem(D.network.copyOptions());if(a){const De=JSON.parse(a);oe(De)}}catch(a){}finally{K.current=true}};t()},[r]);P(()=>{if(!K.current)return;const t=async()=>{try{await de.setItem(D.network.copyOptions(),JSON.stringify(F))}catch(a){}};t()},[F]);const Te=()=>{_.clear()};const ne=G(t=>{_.select(t.id)},[]);const Ee=G((t,a)=>{L(a?{...t,id:a}:t);H(true);_.clear()},[]);const Me=G(()=>L(null),[]);const se=x(null);const ae=t=>{ve(t);q(a=>({...a,searchText:t}))};const Fe=t=>{q(a=>({...a,status:a.status===t?void 0:t}))};const[ie,Oe]=n("bottomSheet");const Ae=t=>{Oe(t)};P(()=>{if(z){requestAnimationFrame(()=>{ye.current?.focus()})}},[z]);const le=()=>{if(k){return l(o,{children:[e(o.Navigation,{onBack:()=>Y(false)}),e(o.Content,{title:"",noMargin:true,children:e(Je,{size:"sm",tabs:[{key:"filters",label:"Filters"},{key:"copy",label:"Copy"}],activeKey:U,onChange:t=>ee(t)})})]})}if(S){return l(o,{children:[e(o.Navigation,{onBack:Te}),e(o.Content,{title:"Request Details",centered:true}),l(o.Actions,{children:[I?e(ut,{onOpen:Ee}):null,e(st,{isPro:i,onUpgradePress:()=>O("saved")})]})]})}if(B&&I){return l(o,{children:[e(o.Navigation,{onBack:()=>{if(se.current?.())return;H(false);L(null)}}),e(o.Content,{title:"Response Overrides",centered:true})]})}if(A){return l(o,{children:[e(o.Navigation,{onBack:()=>Q(false)}),e(o.Content,{title:"Saved Requests",centered:true})]})}return l(o,{children:[f&&e(o.Navigation,{onBack:f}),e(o.Content,{title:"",children:z?e(o.Search,{value:te,onChangeText:ae,onCancel:()=>{ae("");j(false)},onDismiss:()=>j(false),dismissOnBlur:true,clearOnlyWhenText:true,placeholder:"Search URL, method, operation, error...",accessibilityLabel:"Search network requests",iconSize:14,testID:"buoy-network-search-input",clearTestID:"buoy-network-search-clear",inputProps:{"sentry-label":"ignore network search header"}}):e(ot,{activeStatus:d.status,onToggleStatus:Fe,ignoredPatterns:N,paused:s})}),l(o.Actions,{children:[e(He,{"sentry-label":"ignore open search",testID:"buoy-network-search-open",accessibilityLabel:"Open search",accessibilityRole:"button",onPress:()=>j(true),style:b.headerActionButton,children:e(Le,{size:14,color:u.color.textSecondary})}),I?e(dt,{onPress:()=>H(true)}):null,e(Xe,{isEnabled:!s,onToggle:()=>ge(t=>!t),accessibilityLabel:s?"Resume network capture":"Pause network capture",testID:"buoy-network-power"}),e(nt,{paused:s}),e(ft,{onPress:()=>R(t=>!t),isOpen:Z,hasIndicator:$})]})]})};const $=!!(d.status||d.method||d.contentType);const Be=v?D.modal.root():D.network.modal();if(!r)return null;const xe=S||!k;const ce=l(bt,{children:[l(E,{style:b.container,children:[e(Ct,{visible:S,paused:s,ignoredPatternValues:ke,onTogglePattern:Ce,isPro:i,filter:d,ignoredPatterns:N,fromSaved:A,savedSearch:re,applySafeAreaInset:!c&&ie==="bottomSheet"}),e(Rt,{visible:k&&U==="filters"&&!S,paused:s,isPro:i,filter:d,onFilterChange:q,ignoredPatterns:N,onRemovePattern:be,onAddPattern:Pe,onTogglePatternMode:Re,isTeamPattern:Ie}),e(It,{visible:k&&U==="copy"&&!S,paused:s,isPro:i,filter:d,ignoredPatterns:N,settings:F,onSettingsChange:oe}),e(ct,{visible:I&&B&&!S&&!k,isPro:i,onUpgradePress:()=>O("overrides"),pendingDraft:Se,onPendingConsumed:Me,backHandlerRef:se,applySafeAreaInset:!c&&ie==="bottomSheet"}),e(lt,{visible:A&&!S&&!k&&!(B&&I),isPro:i,copySettings:F,search:re,onSearchChange:we,onEventPress:ne,onUpgradePress:()=>O("saved")}),e(it,{visible:!S&&!k&&!A&&!(B&&I),paused:s,filter:d,ignoredPatterns:N,isPro:i,searchText:te,onEventPress:ne,onUpgradePress:()=>O("export")})]}),Z?l(pt,{onClose:()=>R(false),children:[e(X,{icon:e(Ue,{size:14,color:u.color.textSecondary}),label:"Network throttling",testID:"buoy-network-menu-throttling",onPress:()=>{R(false);Ve(w?M:void 0);if(!c)me(t=>t+1)}}),e(X,{icon:e(ze,{size:14,color:$?u.color.accent:u.color.textSecondary}),label:"Filters",detail:$?"Active":void 0,onPress:()=>{R(false);ee("filters");Y(true)}}),e(X,{icon:e(je,{size:14,color:u.color.textSecondary}),label:"Saved requests",onPress:()=>{R(false);Q(true)}}),e(E,{style:b.menuCopyRow,children:e(at,{isPro:i,filter:d,ignoredPatterns:N,copySettings:F,paused:s,onUpgradePress:()=>{R(false);O("export")},label:"Copy requests"})})]}):null,e(Ge,{visible:W,onClose:()=>J(false),featureName:T==="saved"?"Saved Requests":T==="overrides"?"Response Overrides":"Network Export",description:T==="saved"?"Keep the requests that matter. Saved requests survive Clear, app restarts, and the 500-request history cap.":T==="overrides"?"Force any endpoint to fail, stall or return something else \u2014 no backend changes, no code changes. Free keeps one active rule.":"Export network requests to share with your team, debug APIs, or feed into AI tools.",benefits:T==="overrides"?[`Run ${Pt} rules at once (free keeps ${kt})`,"Force a 500, a 401 or an empty list in one tap","Simulate offline, timeouts and slow connections","Rules survive an app reload, so you can test the boot path"]:T==="saved"?[`Save up to ${yt} requests (free keeps ${wt})`,"Failed requests stay put through a Clear","Snapshots survive an app restart","Export saved requests to teammates or AI assistants"]:["Export to JSON, Markdown, or plain text","Customizable copy presets (URLs only, LLM-ready, full data)","Share request details with teammates","Feed network data directly to AI assistants"]})]});if(c){return l(E,{style:b.inlineRoot,children:[e(E,{style:b.inlineHeader,...Qe,children:le()}),ce]})}return e(Ke,{visible:r,onClose:p,onMinimize:g,minimizeRequest:he,persistenceKey:Be,variant:"night",header:{showToggleButton:true,customContent:le()},onModeChange:Ae,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,disableScrollWrapper:xe,styles:{},children:ce})}const b=qe.create({container:{flex:1,backgroundColor:"transparent"},detailRoot:{flex:1,minHeight:0},detailBodyFallback:{flex:1},inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:We.border.default,backgroundColor:"transparent"},menuCopyRow:{paddingHorizontal:6},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:u.color.buttonSurface,borderWidth:1,borderColor:u.color.border,alignItems:"center",justifyContent:"center"},activeFilterButton:{backgroundColor:u.color.accentSoft,borderColor:u.color.accentBorderStrong}});export function NetworkModal(r){return e(ue,{children:e(fe,{...r})})}export function NetworkToolView(r={}){return e(ue,{children:e(fe,{...r,inline:true,visible:true,onClose:Nt})})}const Nt=()=>{};
1
+ "use strict";import{createRemoteConditionsSource as qe,openNetworkFloatingTool as ue}from"../conditions/NetworkFloatingTool";import{useState as n,useRef as B,useEffect as b,useCallback as X}from"react";import{View as M,StyleSheet as He,TouchableOpacity as Le}from"react-native";import{Search as Ue,Wifi as pe,Filter as ze,Bookmark as je,JsModal as Ke,ModalHeader as o,devToolsStorageKeys as D,macOSColors as We,night as d,persistentStorage as fe,NightSegmented as Je,useFeatureGate as $e,UpgradeModal as Ge,PowerToggleButton as Xe,useIgnoredPatterns as Ye,windowDragProps as Qe}from"@buoy-gg/shared-ui";import{NetworkFilterViewV3 as Ze}from"./NetworkFilterViewV3";import{TickProvider as ge}from"../hooks/useTickEveryMinute";import{NetworkEventDetailView as et}from"./NetworkEventDetailView";import{NetworkCopySettingsView as tt,DEFAULT_COPY_SETTINGS as rt}from"./NetworkCopySettingsView";import{NetworkHeaderBadges as ot,NetworkClearButton as nt,NetworkDetailPinActions as st,NetworkHeaderCopyButton as at}from"./NetworkHeaderLive";import{NetworkListScreen as it}from"./NetworkListScreen";import{NetworkSavedScreen as lt}from"./NetworkSavedScreen";import{NetworkOverridesScreen as ct}from"./NetworkOverridesScreen";import{NetworkOverridesButton as dt}from"./NetworkOverridesButton";import{NetworkOverrideHeaderButton as ut}from"./NetworkOverrideHeaderButton";import{NetworkHeaderMenu as pt,NetworkHeaderMenuButton as ft,NetworkHeaderMenuItem as _}from"./NetworkHeaderMenu";import{NetworkDetailStepper as gt}from"./NetworkDetailStepper";import{useNetworkEventList as he}from"../hooks/useNetworkEventList";import{useLiveNetworkEvent as ht}from"../hooks/useLiveNetworkEvent";import{useHasNetworkSelection as mt,useNetworkBodyEventId as St,useSelectedNetworkEventId as vt}from"../hooks/useNetworkSelection";import{networkSelectionStore as V}from"../utils/networkSelectionStore";import{FREE_TIER_SAVED_LIMIT as wt,MAX_SAVED as yt}from"../utils/networkSavedStore";import{FREE_TIER_RULE_LIMIT as kt,MAX_RULES as Pt}from"../overrides/types";import{jsx as e,jsxs as c,Fragment as bt}from"react/jsx-runtime";function Ct({visible:r,paused:p,ignoredPatternValues:f,onTogglePattern:g,isPro:w,filter:l,ignoredPatterns:h,fromSaved:m,savedSearch:S,applySafeAreaInset:i}){const y=vt();const q=St();const R=y!=null&&y===q;const s=ht(y,{paused:p||!r});b(()=>{if(r&&s&&R){V.reportRendered(s.id)}},[r,s,R]);if(!r)return null;return c(M,{style:C.detailRoot,children:[s?e(et,{event:s,ignoredPatterns:f,onTogglePattern:g,showBodies:R}):e(M,{style:C.detailBodyFallback}),e(gt,{paused:p,filter:l,ignoredPatterns:h,isPro:w,fromSaved:m,savedSearch:S,applySafeAreaInset:i})]})}function Rt({visible:r,paused:p,isPro:f,filter:g,onFilterChange:w,ignoredPatterns:l,onRemovePattern:h,onAddPattern:m,onTogglePatternMode:S,isTeamPattern:i}){const{events:y}=he({filter:g,ignoredPatterns:l,paused:p,visible:r,isPro:f});if(!r)return null;return e(Ze,{events:y,filter:g,onFilterChange:w,ignoredPatterns:l,onRemovePattern:h,onAddPattern:m,onTogglePatternMode:S,isTeamPattern:i})}function It({visible:r,paused:p,isPro:f,filter:g,ignoredPatterns:w,settings:l,onSettingsChange:h}){const{events:m}=he({filter:g,ignoredPatterns:w,paused:p,visible:r,isPro:f});if(!r)return null;return e(tt,{settings:l,onSettingsChange:h,events:m})}function me({visible:r,onClose:p,onBack:f,onMinimize:g,enableSharedModalDimensions:w=false,inline:l=false,paused:h,onPausedChange:m,remoteConditions:S}){const{isPro:i}=$e();const[y,q]=n(false);const R=h!=null&&m!=null;const s=R?h:y;const Se=t=>{const a=typeof t==="function"?t(s):t;if(R)m(a);else q(a)};const[u,H]=n({});const v=mt();const[k,Y]=n(false);const[A,Q]=n(false);const[x,L]=n(false);const[Z,P]=n(false);const[ve,ee]=n(0);const[I]=n(qe);b(()=>{I.update(S)},[I,S]);b(()=>()=>I.update(void 0),[I]);const N=true;const[we,U]=n(null);const[z,te]=n("filters");const[re,ye]=n("");const[j,K]=n(false);const Tt=B(false);const[oe,ke]=n("");const Pe=B(null);const{patterns:T,values:be,add:Ce,remove:Re,toggle:Ie,toggleMode:Ne,isTeamOnly:Te}=Ye();const[F,ne]=n(rt);const W=B(false);const[J,$]=n(false);const[E,Ee]=n("export");const O=t=>{Ee(t);$(true)};b(()=>{if(J&&i){$(false)}},[J,i]);b(()=>{if(!r||W.current)return;const t=async()=>{try{const a=await fe.getItem(D.network.copyOptions());if(a){const Ve=JSON.parse(a);ne(Ve)}}catch(a){}finally{W.current=true}};t()},[r]);b(()=>{if(!W.current)return;const t=async()=>{try{await fe.setItem(D.network.copyOptions(),JSON.stringify(F))}catch(a){}};t()},[F]);const Me=()=>{V.clear()};const se=X(t=>{V.select(t.id)},[]);const Fe=X((t,a)=>{U(a?{...t,id:a}:t);L(true);V.clear()},[]);const Oe=X(()=>U(null),[]);const ae=B(null);const ie=t=>{ye(t);H(a=>({...a,searchText:t}))};const Ae=t=>{H(a=>({...a,status:a.status===t?void 0:t}))};const[le,xe]=n("bottomSheet");const Be=t=>{xe(t)};b(()=>{if(j){requestAnimationFrame(()=>{Pe.current?.focus()})}},[j]);const ce=()=>{if(k){return c(o,{children:[e(o.Navigation,{onBack:()=>Y(false)}),e(o.Content,{title:"",noMargin:true,children:e(Je,{size:"sm",tabs:[{key:"filters",label:"Filters"},{key:"copy",label:"Copy"}],activeKey:z,onChange:t=>te(t)})})]})}if(v){return c(o,{children:[e(o.Navigation,{onBack:Me}),e(o.Content,{title:"Request Details",centered:true}),c(o.Actions,{children:[N?e(ut,{onOpen:Fe}):null,e(st,{isPro:i,onUpgradePress:()=>O("saved")})]})]})}if(x&&N){return c(o,{children:[e(o.Navigation,{onBack:()=>{if(ae.current?.())return;L(false);U(null)}}),e(o.Content,{title:"Response Overrides",centered:true})]})}if(A){return c(o,{children:[e(o.Navigation,{onBack:()=>Q(false)}),e(o.Content,{title:"Saved Requests",centered:true})]})}return c(o,{children:[f&&e(o.Navigation,{onBack:f}),e(o.Content,{title:"",children:j?e(o.Search,{value:re,onChangeText:ie,onCancel:()=>{ie("");K(false)},onDismiss:()=>K(false),dismissOnBlur:true,clearOnlyWhenText:true,placeholder:"Search URL, method, operation, error...",accessibilityLabel:"Search network requests",iconSize:14,testID:"buoy-network-search-input",clearTestID:"buoy-network-search-clear",inputProps:{"sentry-label":"ignore network search header"}}):e(ot,{activeStatus:u.status,onToggleStatus:Ae,ignoredPatterns:T,paused:s})}),c(o.Actions,{children:[e(Le,{"sentry-label":"ignore open search",testID:"buoy-network-search-open",accessibilityLabel:"Open search",accessibilityRole:"button",onPress:()=>K(true),style:C.headerActionButton,children:e(Ue,{size:14,color:d.color.textSecondary})}),N?e(dt,{onPress:()=>L(true)}):null,e(Xe,{isEnabled:!s,onToggle:()=>Se(t=>!t),accessibilityLabel:s?"Resume network capture":"Pause network capture",testID:"buoy-network-power"}),e(nt,{paused:s}),e(ft,{onPress:()=>P(t=>!t),isOpen:Z,hasIndicator:G})]})]})};const G=!!(u.status||u.method||u.contentType);const De=w?D.modal.root():D.network.modal();if(!r)return null;const _e=v||!k;const de=c(bt,{children:[c(M,{style:C.container,children:[e(Ct,{visible:v,paused:s,ignoredPatternValues:be,onTogglePattern:Ie,isPro:i,filter:u,ignoredPatterns:T,fromSaved:A,savedSearch:oe,applySafeAreaInset:!l&&le==="bottomSheet"}),e(Rt,{visible:k&&z==="filters"&&!v,paused:s,isPro:i,filter:u,onFilterChange:H,ignoredPatterns:T,onRemovePattern:Re,onAddPattern:Ce,onTogglePatternMode:Ne,isTeamPattern:Te}),e(It,{visible:k&&z==="copy"&&!v,paused:s,isPro:i,filter:u,ignoredPatterns:T,settings:F,onSettingsChange:ne}),e(ct,{visible:N&&x&&!v&&!k,isPro:i,onUpgradePress:()=>O("overrides"),pendingDraft:we,onPendingConsumed:Oe,backHandlerRef:ae,applySafeAreaInset:!l&&le==="bottomSheet"}),e(lt,{visible:A&&!v&&!k&&!(x&&N),isPro:i,copySettings:F,search:oe,onSearchChange:ke,onEventPress:se,onUpgradePress:()=>O("saved")}),e(it,{visible:!v&&!k&&!A&&!(x&&N),paused:s,filter:u,ignoredPatterns:T,isPro:i,searchText:re,onEventPress:se,onUpgradePress:()=>O("export")})]}),Z?c(pt,{onClose:()=>P(false),children:[e(_,{icon:e(pe,{size:14,color:d.color.textSecondary}),label:"Network throttling",testID:"buoy-network-menu-throttling",onPress:()=>{P(false);ue(S?I:void 0);if(!l)ee(t=>t+1)}}),e(_,{icon:e(pe,{size:14,color:d.color.textSecondary}),label:"Speed and link state",testID:"buoy-network-menu-conditions",onPress:()=>{P(false);ue(S?I:void 0,true);if(!l)ee(t=>t+1)}}),e(_,{icon:e(ze,{size:14,color:G?d.color.accent:d.color.textSecondary}),label:"Filters",detail:G?"Active":void 0,onPress:()=>{P(false);te("filters");Y(true)}}),e(_,{icon:e(je,{size:14,color:d.color.textSecondary}),label:"Saved requests",onPress:()=>{P(false);Q(true)}}),e(M,{style:C.menuCopyRow,children:e(at,{isPro:i,filter:u,ignoredPatterns:T,copySettings:F,paused:s,onUpgradePress:()=>{P(false);O("export")},label:"Copy requests"})})]}):null,e(Ge,{visible:J,onClose:()=>$(false),featureName:E==="saved"?"Saved Requests":E==="overrides"?"Response Overrides":"Network Export",description:E==="saved"?"Keep the requests that matter. Saved requests survive Clear, app restarts, and the 500-request history cap.":E==="overrides"?"Force any endpoint to fail, stall or return something else \u2014 no backend changes, no code changes. Free keeps one active rule.":"Export network requests to share with your team, debug APIs, or feed into AI tools.",benefits:E==="overrides"?[`Run ${Pt} rules at once (free keeps ${kt})`,"Force a 500, a 401 or an empty list in one tap","Simulate offline, timeouts and slow connections","Rules survive an app reload, so you can test the boot path"]:E==="saved"?[`Save up to ${yt} requests (free keeps ${wt})`,"Failed requests stay put through a Clear","Snapshots survive an app restart","Export saved requests to teammates or AI assistants"]:["Export to JSON, Markdown, or plain text","Customizable copy presets (URLs only, LLM-ready, full data)","Share request details with teammates","Feed network data directly to AI assistants"]})]});if(l){return c(M,{style:C.inlineRoot,children:[e(M,{style:C.inlineHeader,...Qe,children:ce()}),de]})}return e(Ke,{visible:r,onClose:p,onMinimize:g,minimizeRequest:ve,persistenceKey:De,variant:"night",header:{showToggleButton:true,customContent:ce()},onModeChange:Be,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,disableScrollWrapper:_e,styles:{},children:de})}const C=He.create({container:{flex:1,backgroundColor:"transparent"},detailRoot:{flex:1,minHeight:0},detailBodyFallback:{flex:1},inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:We.border.default,backgroundColor:"transparent"},menuCopyRow:{paddingHorizontal:6},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:d.color.buttonSurface,borderWidth:1,borderColor:d.color.border,alignItems:"center",justifyContent:"center"},activeFilterButton:{backgroundColor:d.color.accentSoft,borderColor:d.color.accentBorderStrong}});export function NetworkModal(r){return e(ge,{children:e(me,{...r})})}export function NetworkToolView(r={}){return e(ge,{children:e(me,{...r,inline:true,visible:true,onClose:Nt})})}const Nt=()=>{};
@@ -1 +1 @@
1
- "use strict";import{useEffect as j,useRef as x,useState as h,useSyncExternalStore as k}from"react";import{ActivityIndicator as q,StyleSheet as A,Text as i,TouchableOpacity as R,View as p}from"react-native";import{ChevronDown as L,Check as O,night as e}from"@buoy-gg/shared-ui";import{conditionsCanApply as T,getNetworkCondition as z,setNetworkCondition as P,subscribeNetworkConditions as N}from"./store";import{jsx as r,jsxs as f}from"react/jsx-runtime";const H=[{profile:"normal",label:"No throttling"},{profile:"slow",label:"Slow"},{profile:"verySlow",label:"Very slow"},{profile:"offline",label:"Offline"}];const E={normal:"No added delay",slow:"+500 ms before each new request",verySlow:"+2 seconds before each new request",offline:"New requests fail before sending"};export function NetworkConditionsControl({remote:s}){const D=k(N,z,z);const I=k(N,T,T);const[u,b]=h(false);const[w,S]=h();const[c,m]=h(false);const g=x(false);const d=x(true);j(()=>{d.current=true;return()=>{d.current=false}},[]);const n=s?s.profile:D;const a=s?s.available:I;const C=n!==null&&n!=="normal";const y=n==="offline"?e.color.danger:C?e.color.warning:e.color.accent;async function W(t){if(!a||g.current)return;if(t===n){b(false);return}g.current=true;m(true);S(void 0);try{if(s)await s.onChange(t);else P(t);if(d.current)b(false)}catch(l){if(d.current)S(l instanceof Error?l.message:String(l))}finally{g.current=false;if(d.current)m(false)}}const v=H.find(t=>t.profile===n)?.label??"Unavailable";return f(p,{style:o.container,testID:"buoy-network-throttling-screen",children:[r(i,{style:o.heading,children:"Connection profile"}),f(R,{testID:"buoy-network-conditions",accessibilityRole:"button",accessibilityLabel:`Network throttling: ${v}`,accessibilityState:{expanded:u,disabled:!a||c},disabled:!a||c,onPress:()=>b(t=>!t),style:[o.dropdown,u&&o.dropdownOpen,!a&&o.disabled],children:[r(i,{style:[o.value,C&&{color:y}],children:v}),c?r(q,{size:"small",color:e.color.textSecondary}):r(L,{size:16,color:e.color.textSecondary})]}),u&&r(p,{accessibilityRole:"radiogroup",accessibilityLabel:"Connection profile",style:o.options,children:H.map(t=>{const l=n===t.profile;return f(R,{testID:`buoy-network-condition-${t.profile}`,accessibilityRole:"radio",accessibilityLabel:t.label,accessibilityState:{checked:l,disabled:!a||c},disabled:!a||c,onPress:()=>void W(t.profile),style:[o.option,l&&o.selected],children:[f(p,{style:o.optionBody,children:[r(i,{style:[o.optionTitle,l&&{color:y}],children:t.label}),r(i,{style:o.caption,children:E[t.profile]})]}),l&&r(O,{size:16,color:y})]},t.profile)})}),r(i,{style:o.caption,accessibilityLiveRegion:"polite",children:c?"Applying to device\u2026":!a?s?"Conditions unavailable on this device":"Requires a signed-in account and a development build":n?E[n]:"Waiting for device status"}),!!w&&r(i,{accessibilityRole:"alert",style:o.error,children:w}),f(p,{style:o.help,children:[r(i,{style:o.heading,children:"How it works"}),r(i,{style:o.caption,children:"Affects new HTTP requests through global fetch and XHR. Slow adds a wait before sending; download speed stays unchanged."}),r(i,{style:o.caption,children:"Stays active when you close this tool or pause capture. Choose No throttling to stop. Reloading the app resets it."})]})]})}const o=A.create({container:{padding:e.gutter,gap:10},heading:{fontSize:e.font.caption,fontWeight:"600",color:e.color.textSecondary},dropdown:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:44,paddingHorizontal:12,paddingVertical:10,borderRadius:e.radius.segment,borderWidth:1,borderColor:e.color.separator,backgroundColor:e.color.surfaceElevated},dropdownOpen:{borderColor:e.color.accentBorderStrong},value:{flex:1,fontSize:e.font.body,color:e.color.text},options:{padding:4,borderRadius:e.radius.row,borderWidth:1,borderColor:e.color.border,backgroundColor:e.color.surface},option:{flexDirection:"row",alignItems:"center",gap:12,minHeight:54,padding:10,borderRadius:e.radius.segment},optionBody:{flex:1,gap:4},optionTitle:{fontSize:e.font.caption,fontWeight:"600",color:e.color.text},selected:{backgroundColor:e.color.surfaceElevated},disabled:{opacity:.45},caption:{fontSize:e.font.caption,lineHeight:19,color:e.color.textSecondary},help:{marginTop:14,paddingTop:16,gap:10,borderTopWidth:1,borderTopColor:e.color.separator},error:{fontSize:e.font.caption,lineHeight:18,color:e.color.danger}});
1
+ "use strict";import{useEffect as O,useRef as N,useState as w,useSyncExternalStore as I}from"react";import{ActivityIndicator as V,StyleSheet as $,Text as i,TouchableOpacity as k,View as S}from"react-native";import{ChevronDown as _,Check as J,night as t}from"@buoy-gg/shared-ui";import{conditionsCanApply as W,getNetworkCondition as A,setNetworkCondition as X,subscribeNetworkConditions as R,getNetworkConditions as M,getConditionsRevision as K,setNetworkConditions as Q}from"./store";import{jsx as n,jsxs as h}from"react/jsx-runtime";const L=[{profile:"normal",label:"No throttling"},{profile:"slow",label:"Slow"},{profile:"verySlow",label:"Very slow"},{profile:"offline",label:"Offline"},{profile:"slow3g",label:"Slow 3G"},{profile:"slow4g",label:"Slow 4G"},{profile:"fast4g",label:"Fast 4G"}];const j={normal:"No added delay",slow:"+500 ms before each new request",verySlow:"+2 seconds before each new request",offline:"New requests fail before sending",slow3g:"50 KB/s down, 50 KB/s up; +2000 ms",slow4g:"180 KB/s down, 84.375 KB/s up; +562.5 ms",fast4g:"1012.5 KB/s down, 168.75 KB/s up; +165 ms"};export function NetworkConditionsControl({remote:r,compact:P=false}){I(R,K,K);const l=r?r.state:M();const[U,T]=w(false);const q=I(R,A,A);const F=I(R,W,W);const[C,m]=w(false);const[E,y]=w();const[c,g]=w(false);const u=N(false);const p=N(true);const d=N(0);O(()=>{d.current++;u.current=false;g(false);y(void 0)},[r?.targetId]);O(()=>{p.current=true;return()=>{p.current=false}},[]);const f=r?r.profile:q;const s=r?r.available:F;const z=l?.active??(f!==null&&f!=="normal");const v=f==="offline"?t.color.danger:z?t.color.warning:t.color.accent;async function G(o){if(!s||u.current)return;if(o===f&&(o!=="normal"||!l?.active)){m(false);return}const a=++d.current;u.current=true;g(true);y(void 0);try{if(r)await r.onChange(o);else X(o);if(p.current&&d.current===a)m(false)}catch(b){if(p.current&&d.current===a)y(b instanceof Error?b.message:String(b))}finally{if(d.current===a){u.current=false;if(p.current)g(false)}}}const D=[["auto","Follow speed"],["real","Real link"],["offline","Offline"],["wifi","Wi-Fi"],["cellular","Cellular"],["noInternet","No internet"]];const B=(!r||!!r.onConnectionChange)&&(l?.capabilities.netInfo.supported||l?.capabilities.expoNetwork.supported);const H=L.find(o=>o.profile===f)?.label??"Unavailable";return h(S,{style:e.container,testID:"buoy-network-throttling-screen",children:[n(i,{style:e.heading,children:"Connection profile"}),h(k,{testID:"buoy-network-conditions",accessibilityRole:"button",accessibilityLabel:`Network throttling: ${H}`,accessibilityState:{expanded:C,disabled:!s||c},disabled:!s||c,onPress:()=>m(o=>!o),style:[e.dropdown,C&&e.dropdownOpen,!s&&e.disabled],children:[n(i,{style:[e.value,z&&{color:v}],children:H}),c?n(V,{size:"small",color:t.color.textSecondary}):n(_,{size:16,color:t.color.textSecondary})]}),C&&n(S,{accessibilityRole:"radiogroup",accessibilityLabel:"Connection profile",style:e.options,children:L.map(o=>{const a=f===o.profile;return h(k,{testID:`buoy-network-condition-${o.profile}`,accessibilityRole:"radio",accessibilityLabel:o.label,accessibilityState:{checked:a,disabled:!s||c},disabled:!s||c,onPress:()=>void G(o.profile),style:[e.option,a&&e.selected],children:[h(S,{style:e.optionBody,children:[n(i,{style:[e.optionTitle,a&&{color:v}],children:o.label}),n(i,{style:e.caption,children:j[o.profile]})]}),a&&n(J,{size:16,color:v})]},o.profile)})}),n(i,{style:e.caption,accessibilityLiveRegion:"polite",children:c?"Applying to device\u2026":!s?r?"Conditions unavailable on this device":"Requires a signed-in account and a development build":f?j[f]:"Waiting for device status"}),!!E&&n(i,{accessibilityRole:"alert",style:e.error,children:E}),n(k,{testID:"buoy-network-link-state",accessibilityRole:"button",accessibilityLabel:"App link state",disabled:!s||c||!B,onPress:()=>T(o=>!o),style:e.dropdown,children:h(i,{style:e.value,children:["App link: ",D.find(([o])=>o===l?.connection)?.[1]??"Unavailable"]})}),U&&D.map(([o,a])=>n(k,{testID:`buoy-network-link-${o}`,accessibilityRole:"radio",accessibilityState:{checked:l?.connection===o,disabled:c||!s},disabled:c||!s,style:e.option,onPress:async()=>{if(u.current)return;const b=++d.current;u.current=true;g(true);y(void 0);try{if(r)await r.onConnectionChange?.(o);else Q({connection:o});if(p.current&&d.current===b)T(false)}catch(x){if(p.current&&d.current===b)y(x instanceof Error?x.message:String(x))}finally{if(d.current===b){u.current=false;if(p.current)g(false)}}},children:n(i,{style:e.optionTitle,children:a})},o)),!B&&n(i,{style:e.caption,children:l?.capabilities.netInfo.reason??"This device has no link hook."}),!P&&h(S,{style:e.help,children:[n(i,{style:e.heading,children:"How it works"}),l&&h(i,{style:e.caption,children:["NetInfo: ",l.capabilities.netInfo.supported?"Hook on":l.capabilities.netInfo.reason??"No hook",". Expo Network: ",l.capabilities.expoNetwork.supported?"Hook on":l.capabilities.expoNetwork.reason??"No hook","."]}),n(i,{style:e.caption,children:"Down caps pace bytes to the app in JS. The socket stays at its real speed."}),n(i,{style:e.caption,children:"Up caps wait before send for known bytes. Upload time is simulated. The socket is not paced. Unknown sizes pass through with latency only. Each call shows any cap gap."}),n(i,{style:e.caption,children:"Caps apply per call through global fetch and RN XHR. WebSocket, native images, native SDKs and file transfers are not affected."}),n(i,{style:e.caption,children:"Link state changes what NetInfo and Expo Network report. It does not change the radio or web calls."}),n(i,{style:e.caption,children:"Stays on when this tool closes or capture pauses. No throttling clears both controls. App reload clears them too."})]})]})}const e=$.create({container:{padding:t.gutter,gap:10},heading:{fontSize:t.font.caption,fontWeight:"600",color:t.color.textSecondary},dropdown:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:44,paddingHorizontal:12,paddingVertical:10,borderRadius:t.radius.segment,borderWidth:1,borderColor:t.color.separator,backgroundColor:t.color.surfaceElevated},dropdownOpen:{borderColor:t.color.accentBorderStrong},value:{flex:1,fontSize:t.font.body,color:t.color.text},options:{padding:4,borderRadius:t.radius.row,borderWidth:1,borderColor:t.color.border,backgroundColor:t.color.surface},option:{flexDirection:"row",alignItems:"center",gap:12,minHeight:54,padding:10,borderRadius:t.radius.segment},optionBody:{flex:1,gap:4},optionTitle:{fontSize:t.font.caption,fontWeight:"600",color:t.color.text},selected:{backgroundColor:t.color.surfaceElevated},disabled:{opacity:.45},caption:{fontSize:t.font.caption,lineHeight:19,color:t.color.textSecondary},help:{marginTop:14,paddingTop:16,gap:10,borderTopWidth:1,borderTopColor:t.color.separator},error:{fontSize:t.font.caption,lineHeight:18,color:t.color.danger}});
@@ -1 +1 @@
1
- "use strict";import{act as n,createElement as r}from"react";import{createRoot as p}from"react-dom/client";import{afterEach as C,beforeEach as v,expect as t,it as u,vi as l}from"vitest";import{NetworkConditionsControl as k}from"./NetworkConditionsControl";l.mock("@buoy-gg/shared-ui",async()=>({ChevronDown:()=>null,Check:()=>null,night:(await l.importActual("../../../../shared/src/ui/night/nightTheme")).night}));l.mock("react-native",()=>({StyleSheet:{create:e=>e},View:({children:e})=>r("div",null,e),Text:({children:e})=>r("span",null,e),ActivityIndicator:()=>r("span",null,"pending"),TouchableOpacity:({children:e,onPress:a,disabled:d,accessibilityLabel:h,accessibilityState:b,testID:w})=>r("button",{onClick:a,disabled:d,"aria-label":h,"aria-checked":b?.checked,"data-testid":w},e)}));l.mock("./store",()=>({NETWORK_CONDITIONS:{normal:{label:"Normal"},slow:{label:"Slow"},verySlow:{label:"Very slow"},offline:{label:"Offline"}},getNetworkCondition:()=>"normal",conditionsCanApply:()=>true,subscribeNetworkConditions:()=>()=>{},setNetworkCondition:l.fn()}));let f;let i;v(()=>{globalThis.IS_REACT_ACT_ENVIRONMENT=true;i=document.createElement("div");f=p(i)});C(()=>n(()=>f.unmount()));const o=e=>i.querySelector(`[data-testid="buoy-network-condition-${e}"]`);function c(e){n(()=>f.render(r(k,{remote:e})))}const m=()=>i.querySelector('[data-testid="buoy-network-conditions"]');const s=()=>n(()=>m().click());u("defaults to a closed No throttling dropdown and closes when the current option is chosen",()=>{const e=l.fn();c({profile:"normal",available:true,onChange:e});t(m().textContent).toBe("No throttling");t(o("normal")).toBeNull();s();t(["normal","slow","verySlow","offline"].every(a=>!!o(a))).toBe(true);n(()=>o("normal").click());t(o("normal")).toBeNull();t(e).not.toHaveBeenCalled()});u("blocks duplicate remote changes and waits for the device profile before selecting it",async()=>{let e;const a=l.fn(()=>new Promise(d=>{e=d}));c({profile:"normal",available:true,onChange:a});s();n(()=>o("slow").click());t(o("offline").disabled).toBe(true);t(o("normal").getAttribute("aria-checked")).toBe("true");n(()=>o("offline").click());t(a).toHaveBeenCalledExactlyOnceWith("slow");await n(async()=>e());c({profile:"slow",available:true,onChange:a});t(m().textContent).toBe("Slow");t(o("slow")).toBeNull();s();t(o("slow").getAttribute("aria-checked")).toBe("true")});u("reports a remote error, permits retry, and disables unavailable devices",async()=>{const e=l.fn().mockRejectedValue(new Error("Device disconnected"));c({profile:"normal",available:true,onChange:e});s();await n(async()=>o("offline").click());t(i.textContent).toContain("Device disconnected");t(o("offline").disabled).toBe(false);c({profile:null,available:false,onChange:e});t(o("normal").disabled).toBe(true);t(i.textContent).toContain("Conditions unavailable on this device")});
1
+ "use strict";import{act as a,createElement as f}from"react";import{createRoot as C}from"react-dom/client";import{afterEach as m,beforeEach as b,expect as t,it as c,vi as n}from"vitest";import{NetworkConditionsControl as v}from"./NetworkConditionsControl";n.mock("@buoy-gg/shared-ui",async()=>({ChevronDown:()=>null,Check:()=>null,night:(await n.importActual("../../../../shared/src/ui/night/nightTheme")).night}));n.mock("react-native",()=>({StyleSheet:{create:e=>e},View:({children:e})=>f("div",null,e),Text:({children:e})=>f("span",null,e),ActivityIndicator:()=>f("span",null,"pending"),TouchableOpacity:({children:e,onPress:i,disabled:d,accessibilityLabel:w,accessibilityState:h,testID:k})=>f("button",{onClick:i,disabled:d,"aria-label":w,"aria-checked":h?.checked,"data-testid":k},e)}));n.mock("./store",()=>({NETWORK_CONDITIONS:{normal:{label:"Normal"},slow:{label:"Slow"},verySlow:{label:"Very slow"},offline:{label:"Offline"}},getConditionsRevision:()=>0,getNetworkConditions:()=>({capabilities:{netInfo:{supported:false},expoNetwork:{supported:false}}}),setNetworkConditions:n.fn(),getNetworkCondition:()=>"normal",conditionsCanApply:()=>true,subscribeNetworkConditions:()=>()=>{},setNetworkCondition:n.fn()}));let p;let l;b(()=>{globalThis.IS_REACT_ACT_ENVIRONMENT=true;l=document.createElement("div");p=C(l)});m(()=>a(()=>p.unmount()));const o=e=>l.querySelector(`[data-testid="buoy-network-condition-${e}"]`);function r(e){a(()=>p.render(f(v,{remote:e})))}const u=()=>l.querySelector('[data-testid="buoy-network-conditions"]');const s=()=>a(()=>u().click());c("defaults to a closed No throttling dropdown and closes when the current option is chosen",()=>{const e=n.fn();r({profile:"normal",available:true,onChange:e});t(u().textContent).toBe("No throttling");t(o("normal")).toBeNull();s();t(["normal","slow","verySlow","offline"].every(i=>!!o(i))).toBe(true);a(()=>o("normal").click());t(o("normal")).toBeNull();t(e).not.toHaveBeenCalled()});c("blocks duplicate remote changes and waits for the device profile before selecting it",async()=>{let e;const i=n.fn(()=>new Promise(d=>{e=d}));r({profile:"normal",available:true,onChange:i});s();a(()=>o("slow").click());t(o("offline").disabled).toBe(true);t(o("normal").getAttribute("aria-checked")).toBe("true");a(()=>o("offline").click());t(i).toHaveBeenCalledExactlyOnceWith("slow");await a(async()=>e());r({profile:"slow",available:true,onChange:i});t(u().textContent).toBe("Slow");t(o("slow")).toBeNull();s();t(o("slow").getAttribute("aria-checked")).toBe("true")});c("reports a remote error, permits retry, and disables unavailable devices",async()=>{const e=n.fn().mockRejectedValue(new Error("Device disconnected"));r({profile:"normal",available:true,onChange:e});s();await a(async()=>o("offline").click());t(l.textContent).toContain("Device disconnected");t(o("offline").disabled).toBe(false);r({profile:null,available:false,onChange:e});t(o("normal").disabled).toBe(true);t(l.textContent).toContain("Conditions unavailable on this device")});c("offers all v2 speed profiles on the remote control",async()=>{const e=n.fn().mockResolvedValue(void 0);r({profile:"normal",available:true,onChange:e});s();for(const i of["slow3g","slow4g","fast4g"])t(o(i)).not.toBeNull();await a(async()=>o("slow4g").click());t(e).toHaveBeenCalledExactlyOnceWith("slow4g");t(l.textContent).toContain("socket is not paced")});c("forwards a link change and keeps device readback as the selected state",async()=>{const e=n.fn().mockResolvedValue(void 0);const i={version:2,connection:"real",capabilities:{netInfo:{supported:true},expoNetwork:{supported:false}}};r({profile:"normal",available:true,onChange:n.fn(),state:i,onConnectionChange:e});a(()=>l.querySelector('[data-testid="buoy-network-link-state"]').click());await a(async()=>l.querySelector('[data-testid="buoy-network-link-cellular"]').click());t(e).toHaveBeenCalledExactlyOnceWith("cellular");t(l.textContent).toContain("App link: Real link")});c("shows a late peer gap even when the other hook works",()=>{const e={version:2,connection:"real",capabilities:{netInfo:{supported:false,reason:"Link hook loaded too late."},expoNetwork:{supported:true}}};r({profile:"normal",available:true,onChange:n.fn(),state:e,onConnectionChange:n.fn()});t(l.textContent).toContain("NetInfo: Link hook loaded too late.");t(l.textContent).toContain("Expo Network: Hook on")});c("ignores an old device action result after switching devices",async()=>{let e;r({targetId:"first",profile:"normal",available:true,onChange:()=>new Promise((i,d)=>{e=d})});s();a(()=>o("slow3g").click());r({targetId:"second",profile:"fast4g",available:true,onChange:n.fn()});await a(async()=>e(new Error("Old device failed")));t(l.textContent).not.toContain("Old device failed");t(u().textContent).toBe("Fast 4G");t(u().disabled).toBe(false)});
@@ -1 +1 @@
1
- "use strict";import{useSyncExternalStore as s}from"react";import{Text as l,View as e}from"react-native";import{NetworkIcon as c}from"@buoy-gg/shared-ui";import{getNetworkCondition as i,subscribeNetworkConditions as m,NETWORK_CONDITIONS as n}from"./store";import{jsx as t,jsxs as f}from"react/jsx-runtime";export function NetworkConditionsIcon({size:r}){const o=s(m,i,i);return f(e,{accessibilityLabel:o==="normal"?"Network":`Network: ${n[o].label}`,children:[t(c,{size:r}),o!=="normal"&&t(e,{pointerEvents:"none",style:{position:"absolute",top:-6,right:-8,width:48,alignItems:"flex-end"},children:t(l,{testID:"buoy-network-condition-indicator",numberOfLines:1,style:{color:"#FFCC66",fontSize:10,fontWeight:"700"},children:o==="offline"?"OFF":`+${n[o].delayMs}`})})]})}
1
+ "use strict";import{useSyncExternalStore as e}from"react";import{Text as a,View as i}from"react-native";import{NetworkIcon as d}from"@buoy-gg/shared-ui";import{getNetworkCondition as n,subscribeNetworkConditions as r,NETWORK_CONDITIONS as s,getConditionsRevision as l,networkConditionsActive as f}from"./store";import{jsx as t,jsxs as p}from"react/jsx-runtime";export function NetworkConditionsIcon({size:c}){e(r,l,l);const m=f();const o=e(r,n,n);return p(i,{accessibilityLabel:o==="normal"?"Network":`Network: ${s[o].label}`,children:[t(d,{size:c}),m&&t(i,{pointerEvents:"none",style:{position:"absolute",top:-6,right:-8,width:48,alignItems:"flex-end"},children:t(a,{testID:"buoy-network-condition-indicator",numberOfLines:1,style:{color:"#FFCC66",fontSize:10,fontWeight:"700"},children:o==="normal"?"LINK":o==="offline"?"OFF":`+${s[o].delayMs}`})})]})}
@@ -1 +1 @@
1
- "use strict";import{useEffect as L,useRef as _,useState as E,useSyncExternalStore as R}from"react";import{ActivityIndicator as U,StyleSheet as G,Text as p,TouchableOpacity as O,View as d,useWindowDimensions as J}from"react-native";import{FloatingTool as K,night as e,openFloatingTool as Q,persistentStorage as X,registerPersistentFloatingTool as Y}from"@buoy-gg/shared-ui";import{conditionsCanApply as H,getNetworkCondition as V,setNetworkCondition as Z,subscribeNetworkConditions as z}from"./store";import{jsx as t,jsxs as F}from"react/jsx-runtime";export function createRemoteConditionsSource(){let l;const a=new Set;return{getSnapshot:()=>l,subscribe:s=>{a.add(s);return()=>{a.delete(s)}},update(s){l=s;a.forEach(r=>r())}}}const ee=()=>()=>{};const j=()=>void 0;const y=[{id:"normal",label:"No throttling",detail:"No added delay"},{id:"slow",label:"Slow",detail:"+500 ms before sending"},{id:"verySlow",label:"Very slow",detail:"+2 seconds before sending"},{id:"offline",label:"Offline",detail:"New requests fail"}];const te={id:"network-throttling",render:l=>t(NetworkFloatingTool,{...l})};export function registerLocalNetworkFloatingTool(){if(typeof __DEV__==="undefined"||!__DEV__)return()=>{};return Y(te,X)}if(typeof __DEV__!=="undefined"&&__DEV__&&typeof navigator!=="undefined"&&navigator.product==="ReactNative"){registerLocalNetworkFloatingTool()}export function openNetworkFloatingTool(l){Q({id:"network-throttling",render:a=>t(NetworkFloatingTool,{...a,source:l})})}export function NetworkFloatingTool({id:l,revealToken:a,dismiss:s,source:r}){const W=R(z,V,V);const A=R(z,H,H);const m=R(r?.subscribe??ee,r?.getSnapshot??j,j);const g=r?m?.profile??null:W;const h=r?m?.available===true:A;const[c,w]=E(false);const[D,S]=E();const b=_(false);const f=_(0);const u=_(true);const{width:$}=J();L(()=>{u.current=true;return()=>{u.current=false}},[]);L(()=>{f.current+=1;b.current=false;w(false);S(void 0)},[r,m?.targetId]);const B=g!==null&&g!=="normal";const i=g??"normal";const v=y.find(n=>n.id===i);const I=y[(y.findIndex(n=>n.id===i)+1)%y.length];const P=!h||i==="offline"?0:i==="verySlow"?1:i==="slow"?2:4;const M=c?"Applying\u2026":!h?"Unavailable":i==="normal"?"0 ms":i==="slow"?"+500 ms":i==="verySlow"?"+2000 ms":"Blocked";async function N(n,x=false){if(b.current)return;const k=++f.current;b.current=true;w(true);S(void 0);const T=r?.getSnapshot();try{if(r){if(!T?.available)throw new Error("Device unavailable. Open Network again to reconnect these controls.");await T.onChange(n)}else Z(n);if(u.current&&f.current===k){if(x)s()}}catch(C){if(u.current&&f.current===k)S(C instanceof Error?C.message:String(C))}finally{if(f.current===k){b.current=false;if(u.current)w(false)}}}const q=D?t(d,{style:o.menu,children:t(p,{accessibilityRole:"alert",style:o.error,children:D})}):void 0;return t(K,{id:l,revealToken:a,variant:"strip",dragFromSurface:true,accessibilityLabel:`Move or hide network throttling. ${B?"Active":"Off"}`,accessory:q,children:F(d,{style:[o.row,{width:Math.max(220,Math.min(292,$-64))}],children:[t(O,{testID:"throttling-cycle",accessibilityRole:"button",accessibilityLabel:`Network: ${v.label}. Switch to ${I.label}`,accessibilityState:{disabled:c||!h},disabled:c||!h,onPress:()=>void N(I.id),style:o.signalButton,children:c?t(U,{size:"small",color:e.color.accent}):F(d,{testID:`throttling-signal-${i}`,style:o.signal,children:[[7,12,18,24].map((n,x)=>t(d,{style:{width:4,height:n,borderRadius:2,backgroundColor:x<P?i==="offline"?e.color.danger:e.color.accent:e.color.fillTertiary}},n)),i==="offline"&&t(d,{style:o.slash})]})}),t(d,{style:o.profile,children:t(p,{testID:"throttling-profile",accessibilityLabel:`Connection profile: ${v.label}`,accessibilityLiveRegion:"polite",numberOfLines:1,style:o.profileLabel,children:v.label})}),t(p,{testID:"throttling-status",numberOfLines:1,accessibilityLiveRegion:"polite",style:o.status,children:M}),t(d,{style:o.separator}),t(O,{testID:"throttling-close",accessibilityRole:"button",accessibilityLabel:"Close and turn off throttling",disabled:c,accessibilityState:{disabled:c},onPress:()=>{if(g==="normal")s();else void N("normal",true)},style:[o.action,c&&o.disabled],children:t(p,{style:o.actionText,children:"Close"})})]})})}const o=G.create({row:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:4,minHeight:48},signalButton:{width:36,minHeight:44,alignItems:"center",justifyContent:"center"},signal:{flexDirection:"row",alignItems:"flex-end",gap:3,height:24},slash:{position:"absolute",width:30,height:2,backgroundColor:e.color.danger,top:11,left:-2,transform:[{rotate:"-45deg"}]},separator:{height:20,width:1,backgroundColor:e.color.separator,marginHorizontal:2},status:{color:e.color.textSecondary,fontSize:10,lineHeight:15,flexShrink:1},profile:{flex:1,flexDirection:"row",alignItems:"center",gap:6,minHeight:44},profileLabel:{color:e.color.text,fontSize:13,fontWeight:"500",flexShrink:1},action:{minHeight:36,minWidth:52,borderRadius:e.radius.input,borderWidth:1,borderColor:e.color.accentBorderStrong,alignItems:"center",justifyContent:"center",paddingHorizontal:10},actionText:{color:e.color.accent,fontSize:12,fontWeight:"600"},disabled:{opacity:.4},menu:{marginVertical:8,padding:6,borderRadius:e.radius.card,borderWidth:1,borderColor:e.color.separator,backgroundColor:e.color.surface,shadowColor:"#000",shadowOffset:{width:0,height:6},shadowOpacity:.25,shadowRadius:16,elevation:8},error:{color:e.color.danger,fontSize:12,lineHeight:18,padding:10}});
1
+ "use strict";import{useEffect as O,useRef as T,useState as L,useSyncExternalStore as m}from"react";import{ActivityIndicator as ee,StyleSheet as te,Text as b,TouchableOpacity as H,View as c,ScrollView as oe,useWindowDimensions as ie,Platform as V}from"react-native";import{FloatingTool as ne,night as t,openFloatingTool as re,persistentStorage as le,registerPersistentFloatingTool as ae}from"@buoy-gg/shared-ui";import{conditionsCanApply as $,getNetworkCondition as A,setNetworkCondition as se,subscribeNetworkConditions as z,getConditionsRevision as q,getNetworkConditions as ce,NETWORK_CONDITIONS as K}from"./store";import{NetworkConditionsControl as de}from"./NetworkConditionsControl";import{jsx as e,jsxs as w}from"react/jsx-runtime";export function createRemoteConditionsSource(){let a;const s=new Set;return{getSnapshot:()=>a,subscribe:l=>{s.add(l);return()=>{s.delete(l)}},update(l){a=l;s.forEach(n=>n())}}}const fe=()=>()=>{};const U=()=>void 0;const S=[{id:"normal",label:"No throttling",detail:"No added delay"},{id:"slow",label:"Slow",detail:"+500 ms before sending"},{id:"verySlow",label:"Very slow",detail:"+2 seconds before sending"},{id:"offline",label:"Offline",detail:"New requests fail"}];const ge={id:"network-throttling",render:a=>e(NetworkFloatingTool,{...a})};export function registerLocalNetworkFloatingTool(){if(typeof __DEV__==="undefined"||!__DEV__)return()=>{};return ae(ge,le)}if(typeof __DEV__!=="undefined"&&__DEV__&&typeof navigator!=="undefined"&&navigator.product==="ReactNative"){registerLocalNetworkFloatingTool()}export function openNetworkFloatingTool(a,s=false){re({id:"network-throttling",render:l=>e(NetworkFloatingTool,{...l,source:a,showControls:s})})}export function NetworkFloatingTool({id:a,revealToken:s,dismiss:l,source:n,showControls:v=false}){m(z,q,q);const G=ce();const J=m(z,A,A);const Q=m(z,$,$);const f=m(n?.subscribe??fe,n?.getSnapshot??U,U);const x=n?f?.profile??null:J;const p=n?f?.available===true:Q;const[g,F]=L(v);O(()=>{F(v)},[v,s]);const[d,k]=L(false);const[C,D]=L();const y=T(false);const u=T(0);const h=T(true);const{width:M,height:X}=ie();O(()=>{h.current=true;return()=>{h.current=false}},[]);O(()=>{u.current+=1;y.current=false;k(false);D(void 0)},[n,f?.targetId]);const _=n?f?.state?.active??(x!==null&&x!=="normal"):G.active;const i=x??"normal";const R=S.find(r=>r.id===i)??{label:K[i].label};const P=S[(S.findIndex(r=>r.id===i)+1)%S.length];const Y=!p||i==="offline"?0:i==="verySlow"?1:i==="slow"?2:4;const Z=d?"Applying\u2026":!p?"Unavailable":i==="normal"?_?"Link set":"0 ms":i==="slow"?"+500 ms":i==="verySlow"?"+2000 ms":i==="offline"?"Blocked":`${Math.round((K[i].downloadBytesPerSecond??0)/1e3)} kB/s`;async function W(r,I=false){if(y.current)return;const N=++u.current;y.current=true;k(true);D(void 0);const B=n?.getSnapshot();try{if(n){if(!B?.available)throw new Error("Device unavailable. Open Network again to reconnect these controls.");await B.onChange(r)}else se(r);if(h.current&&u.current===N){if(I)l()}}catch(E){if(h.current&&u.current===N)D(E instanceof Error?E.message:String(E))}finally{if(u.current===N){y.current=false;if(h.current)k(false)}}}const j=C||g?w(c,{style:o.menu,children:[!!C&&e(b,{accessibilityRole:"alert",style:o.error,children:C}),g&&e(oe,{testID:"throttling-controls-scroll",style:{maxHeight:Math.min(420,X-180)},children:e(de,{remote:n?f??{profile:null,available:false,onChange:async()=>{throw new Error("Device unavailable.")}}:void 0})})]}):void 0;return e(ne,{id:a,revealToken:s,variant:"strip",dragFromSurface:V.OS!=="android"||!g,accessibilityLabel:`Move or hide network throttling. ${_?"Active":"Off"}`,accessory:V.OS==="android"?void 0:j,children:w(c,{style:{width:Math.max(220,Math.min(336,M-64))},children:[w(c,{style:[o.row,{width:Math.max(220,Math.min(336,M-64))}],children:[e(H,{testID:"throttling-cycle",accessibilityRole:"button",accessibilityLabel:`Network: ${R.label}. Switch to ${P.label}`,accessibilityState:{disabled:d||!p},disabled:d||!p,onPress:()=>void W(P.id),style:o.signalButton,children:d?e(ee,{size:"small",color:t.color.accent}):w(c,{testID:`throttling-signal-${i}`,style:o.signal,children:[[7,12,18,24].map((r,I)=>e(c,{style:{width:4,height:r,borderRadius:2,backgroundColor:I<Y?i==="offline"?t.color.danger:t.color.accent:t.color.fillTertiary}},r)),i==="offline"&&e(c,{style:o.slash})]})}),e(c,{style:o.profile,children:e(b,{testID:"throttling-profile",accessibilityLabel:`Connection profile: ${R.label}`,accessibilityLiveRegion:"polite",numberOfLines:1,style:o.profileLabel,children:R.label})}),e(b,{testID:"throttling-status",numberOfLines:1,accessibilityLiveRegion:"polite",style:o.status,children:Z}),e(H,{testID:"throttling-edit",accessibilityRole:"button",accessibilityLabel:g?"Hide speed and link controls":"Edit speed and link state",onPress:()=>F(r=>!r),style:o.action,children:e(b,{style:o.actionText,children:g?"Done":"Edit"})}),e(c,{style:o.separator}),e(H,{testID:"throttling-close",accessibilityRole:"button",accessibilityLabel:"Close and turn off throttling",disabled:d,accessibilityState:{disabled:d},onPress:()=>{if(!_)l();else void W("normal",true)},style:[o.action,d&&o.disabled],children:e(b,{style:o.actionText,children:"Close"})})]}),V.OS==="android"&&j]})})}const o=te.create({row:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:4,minHeight:48},signalButton:{width:36,minHeight:44,alignItems:"center",justifyContent:"center"},signal:{flexDirection:"row",alignItems:"flex-end",gap:3,height:24},slash:{position:"absolute",width:30,height:2,backgroundColor:t.color.danger,top:11,left:-2,transform:[{rotate:"-45deg"}]},separator:{height:20,width:1,backgroundColor:t.color.separator,marginHorizontal:2},status:{color:t.color.textSecondary,fontSize:10,lineHeight:15,flexShrink:1},profile:{flex:1,flexDirection:"row",alignItems:"center",gap:6,minHeight:44},profileLabel:{color:t.color.text,fontSize:13,fontWeight:"500",flexShrink:1},action:{minHeight:36,minWidth:52,borderRadius:t.radius.input,borderWidth:1,borderColor:t.color.accentBorderStrong,alignItems:"center",justifyContent:"center",paddingHorizontal:10},actionText:{color:t.color.accent,fontSize:12,fontWeight:"600"},disabled:{opacity:.4},menu:{marginVertical:8,padding:6,borderRadius:t.radius.card,borderWidth:1,borderColor:t.color.separator,backgroundColor:t.color.surface,shadowColor:"#000",shadowOffset:{width:0,height:6},shadowOpacity:.25,shadowRadius:16,elevation:8},error:{color:t.color.danger,fontSize:12,lineHeight:18,padding:10}});
@@ -1 +1 @@
1
- "use strict";import{act as l,createElement as u}from"react";import{createRoot as y}from"react-dom/client";import{afterEach as b,beforeEach as B,expect as t,it as c,vi as a}from"vitest";import{NetworkFloatingTool as k,createRemoteConditionsSource as m}from"./NetworkFloatingTool";const n=a.hoisted(()=>({profile:"normal",available:true,listeners:new Set,set:a.fn()}));a.mock("./store",()=>({getNetworkCondition:()=>n.profile,conditionsCanApply:()=>n.available,subscribeNetworkConditions:e=>{n.listeners.add(e);return()=>n.listeners.delete(e)},setNetworkCondition:e=>{n.set(e);n.profile=e;n.listeners.forEach(o=>o())}}));a.mock("@buoy-gg/shared-ui",async()=>({night:(await a.importActual("../../../../shared/src/ui/night/nightTheme")).night,ChevronDown:()=>null,Check:()=>null,openFloatingTool:a.fn(),FloatingTool:({children:e,accessory:o})=>u("div",null,e,o)}));a.mock("react-native",()=>({StyleSheet:{create:e=>e},useWindowDimensions:()=>({width:390,height:844}),View:({children:e,testID:o})=>u("div",{"data-testid":o},e),Text:({children:e,testID:o})=>u("span",{"data-testid":o},e),ActivityIndicator:()=>null,TouchableOpacity:({children:e,onPress:o,disabled:r,testID:s,accessibilityLabel:C})=>u("button",{onClick:o,disabled:r,"data-testid":s,"aria-label":C},e)}));let w;let d;const h=a.fn();B(()=>{globalThis.IS_REACT_ACT_ENVIRONMENT=true;n.profile="normal";n.available=true;n.set.mockClear();h.mockClear();d=document.createElement("div");w=y(d)});b(()=>l(()=>w.unmount()));const g=e=>d.querySelector(`[data-testid="${e}"]`);const p=async e=>l(async()=>g(e).click());const i=()=>d.querySelector('[data-testid="throttling-status"]')?.textContent;function f(e){l(()=>w.render(u(k,{id:"network-throttling",revealToken:1,dismiss:h,source:e})))}async function v(e){const o=["normal","slow","verySlow","offline"];const r=(o.indexOf(e)-o.indexOf(n.profile)+o.length)%o.length;for(let s=0;s<r;s++)await p("throttling-cycle")}c("cycles and applies every profile immediately, including wrapping to normal",async()=>{f();for(const[e,o]of[["slow","+500 ms"],["verySlow","+2000 ms"],["offline","Blocked"],["normal","0 ms"]]){await p("throttling-cycle");t(n.profile).toBe(e);t(d.querySelector(`[data-testid="throttling-signal-${e}"]`)).not.toBeNull();t(i()).toBe(o)}t(n.set).toHaveBeenCalledTimes(4)});c("keeps the profile label informational when tapped",async()=>{f();await p("throttling-profile");t(n.set).not.toHaveBeenCalled();t(n.profile).toBe("normal");t(g("throttling-profile").closest("button")).toBeNull()});c("changes active profiles and stops before dismissal",async()=>{n.profile="slow";f();await v("offline");t(n.profile).toBe("offline");await p("throttling-close");t(n.profile).toBe("normal");t(h).toHaveBeenCalledOnce()});c("reflects external changes and disables cycling when account admission is revoked",()=>{f();l(()=>{n.profile="offline";n.listeners.forEach(e=>e())});t(i()).toBe("Blocked");l(()=>{n.profile="normal";n.available=false;n.listeners.forEach(e=>e())});t(i()).toBe("Unavailable");t(g("throttling-cycle").disabled).toBe(true)});c("keeps remote failures visible and does not claim a profile was applied",async()=>{const e=m();const o=a.fn().mockRejectedValue(new Error("Connection lost"));e.update({profile:"normal",available:true,onChange:o});f(e);await v("slow");t(d.textContent).toContain("Connection lost");t(i()).toBe("0 ms");t(n.set).not.toHaveBeenCalled()});c("prevents duplicate remote operations and follows confirmed snapshots",async()=>{const e=m();let o;const r=a.fn(()=>new Promise(s=>{o=s}));e.update({profile:"normal",available:true,onChange:r});f(e);await p("throttling-cycle");await p("throttling-cycle");t(r).toHaveBeenCalledOnce();t(i()).toBe("Applying\u2026");await l(async()=>o());t(i()).toBe("0 ms");l(()=>e.update({profile:"slow",available:true,onChange:r}));t(i()).toBe("+500 ms");l(()=>e.update(void 0));t(i()).toBe("Unavailable")});c("ignores a previous device's completion after switching devices",async()=>{const e=m();let o;e.update({targetId:"first",profile:"normal",available:true,onChange:()=>new Promise((r,s)=>{o=s})});f(e);await v("slow");l(()=>e.update({targetId:"second",profile:"normal",available:true,onChange:a.fn()}));await l(async()=>o(new Error("Old device failed")));t(d.textContent).not.toContain("Old device failed");t(i()).toBe("0 ms");t(g("throttling-profile").textContent).toBe("No throttling")});c("keeps the strip open when stopping a remote device fails",async()=>{const e=m();e.update({profile:"offline",available:true,onChange:a.fn().mockRejectedValue(new Error("Could not stop"))});f(e);await p("throttling-close");t(h).not.toHaveBeenCalled();t(i()).toBe("Blocked");t(d.textContent).toContain("Could not stop")});
1
+ "use strict";import{act as c,createElement as u}from"react";import{createRoot as y}from"react-dom/client";import{afterEach as b,beforeEach as k,expect as t,it as d,vi as a}from"vitest";import{NetworkFloatingTool as B,createRemoteConditionsSource as m}from"./NetworkFloatingTool";const n=a.hoisted(()=>({platform:"web",profile:"normal",available:true,listeners:new Set,set:a.fn()}));a.mock("./store",()=>({getConditionsRevision:()=>0,getNetworkConditions:()=>({active:n.profile!=="normal",capabilities:{netInfo:{supported:false},expoNetwork:{supported:false}}}),NETWORK_CONDITIONS:{fast4g:{label:"Fast 4G",downloadBytesPerSecond:1012500}},getNetworkCondition:()=>n.profile,conditionsCanApply:()=>n.available,subscribeNetworkConditions:e=>{n.listeners.add(e);return()=>n.listeners.delete(e)},setNetworkCondition:e=>{n.set(e);n.profile=e;n.listeners.forEach(o=>o())}}));a.mock("@buoy-gg/shared-ui",async()=>({night:(await a.importActual("../../../../shared/src/ui/night/nightTheme")).night,ChevronDown:()=>null,Check:()=>null,openFloatingTool:a.fn(),FloatingTool:({children:e,accessory:o})=>u("div",null,e,o)}));a.mock("react-native",()=>({Platform:{get OS(){return n.platform}},StyleSheet:{create:e=>e},useWindowDimensions:()=>({width:390,height:844}),View:({children:e,testID:o})=>u("div",{"data-testid":o},e),Text:({children:e,testID:o})=>u("span",{"data-testid":o},e),ScrollView:({children:e})=>u("div",null,e),ActivityIndicator:()=>null,TouchableOpacity:({children:e,onPress:o,disabled:r,testID:s,accessibilityLabel:h})=>u("button",{onClick:o,disabled:r,"data-testid":s,"aria-label":h},e)}));let v;let p;const g=a.fn();k(()=>{globalThis.IS_REACT_ACT_ENVIRONMENT=true;n.platform="web";n.profile="normal";n.available=true;n.set.mockClear();g.mockClear();p=document.createElement("div");v=y(p)});b(()=>c(()=>v.unmount()));const w=e=>p.querySelector(`[data-testid="${e}"]`);const l=async e=>c(async()=>w(e).click());const i=()=>p.querySelector('[data-testid="throttling-status"]')?.textContent;function f(e){c(()=>v.render(u(B,{id:"network-throttling",revealToken:1,dismiss:g,source:e})))}async function C(e){const o=["normal","slow","verySlow","offline"];const r=(o.indexOf(e)-o.indexOf(n.profile)+o.length)%o.length;for(let s=0;s<r;s++)await l("throttling-cycle")}d("cycles and applies every profile immediately, including wrapping to normal",async()=>{f();for(const[e,o]of[["slow","+500 ms"],["verySlow","+2000 ms"],["offline","Blocked"],["normal","0 ms"]]){await l("throttling-cycle");t(n.profile).toBe(e);t(p.querySelector(`[data-testid="throttling-signal-${e}"]`)).not.toBeNull();t(i()).toBe(o)}t(n.set).toHaveBeenCalledTimes(4)});d("keeps the profile label informational when tapped",async()=>{f();await l("throttling-profile");t(n.set).not.toHaveBeenCalled();t(n.profile).toBe("normal");t(w("throttling-profile").closest("button")).toBeNull()});d("changes active profiles and stops before dismissal",async()=>{n.profile="slow";f();await C("offline");t(n.profile).toBe("offline");await l("throttling-close");t(n.profile).toBe("normal");t(g).toHaveBeenCalledOnce()});d("reflects external changes and disables cycling when account admission is revoked",()=>{f();c(()=>{n.profile="offline";n.listeners.forEach(e=>e())});t(i()).toBe("Blocked");c(()=>{n.profile="normal";n.available=false;n.listeners.forEach(e=>e())});t(i()).toBe("Unavailable");t(w("throttling-cycle").disabled).toBe(true)});d("keeps remote failures visible and does not claim a profile was applied",async()=>{const e=m();const o=a.fn().mockRejectedValue(new Error("Connection lost"));e.update({profile:"normal",available:true,onChange:o});f(e);await C("slow");t(p.textContent).toContain("Connection lost");t(i()).toBe("0 ms");t(n.set).not.toHaveBeenCalled()});d("prevents duplicate remote operations and follows confirmed snapshots",async()=>{const e=m();let o;const r=a.fn(()=>new Promise(s=>{o=s}));e.update({profile:"normal",available:true,onChange:r});f(e);await l("throttling-cycle");await l("throttling-cycle");t(r).toHaveBeenCalledOnce();t(i()).toBe("Applying\u2026");await c(async()=>o());t(i()).toBe("0 ms");c(()=>e.update({profile:"slow",available:true,onChange:r}));t(i()).toBe("+500 ms");c(()=>e.update(void 0));t(i()).toBe("Unavailable")});d("ignores a previous device's completion after switching devices",async()=>{const e=m();let o;e.update({targetId:"first",profile:"normal",available:true,onChange:()=>new Promise((r,s)=>{o=s})});f(e);await C("slow");c(()=>e.update({targetId:"second",profile:"normal",available:true,onChange:a.fn()}));await c(async()=>o(new Error("Old device failed")));t(p.textContent).not.toContain("Old device failed");t(i()).toBe("0 ms");t(w("throttling-profile").textContent).toBe("No throttling")});d("keeps the strip open when stopping a remote device fails",async()=>{const e=m();e.update({profile:"offline",available:true,onChange:a.fn().mockRejectedValue(new Error("Could not stop"))});f(e);await l("throttling-close");t(g).not.toHaveBeenCalled();t(i()).toBe("Blocked");t(p.textContent).toContain("Could not stop")});d.each(["web","android"])("opens the full remote control on %s and forwards v2 changes",async e=>{n.platform=e;const o=m();const r=a.fn().mockResolvedValue(void 0);const s=a.fn().mockResolvedValue(void 0);const h={version:2,active:false,connection:"real",capabilities:{netInfo:{supported:true},expoNetwork:{supported:false}}};o.update({profile:"normal",available:true,onChange:r,onConnectionChange:s,state:h});f(o);await l("throttling-edit");await l("buoy-network-conditions");await l("buoy-network-condition-fast4g");t(r).toHaveBeenCalledExactlyOnceWith("fast4g");t(i()).toBe("0 ms");c(()=>o.update({profile:"fast4g",available:true,onChange:r,onConnectionChange:s,state:{...h,active:true}}));t(i()).toBe("1013 kB/s");await l("buoy-network-link-state");await l("buoy-network-link-cellular");t(s).toHaveBeenCalledExactlyOnceWith("cellular");await l("throttling-edit");t(w("buoy-network-conditions")).toBeNull();t(i()).toBe("1013 kB/s")});
@@ -0,0 +1 @@
1
+ "use strict";import{useSyncExternalStore as l}from"react";import{getEffectiveNetworkConnection as d,getConditionsRevision as i,subscribeNetworkConditions as m}from"../store";import{maskConnection as b}from"./patchNetwork";export function wrapNetInfoApi(o){const s=e=>b(e,d());const n={};for(const e of["fetch","refresh"]){const t=o[e];n[e]=(...r)=>Promise.resolve(t(...r)).then(s)}const u=o.addEventListener;n.addEventListener=e=>u(t=>e(s(t)));const a=o.useNetInfo;n.useNetInfo=(...e)=>{const t=a(...e);l(m,i,i);return s(t)};const c=[];try{for(const[e,t]of Object.entries(n)){for(const r of new Set([o,o.default].filter(Boolean))){const f=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(r,e,{configurable:true,writable:true,enumerable:true,value:t});c.push(()=>{if(f)Object.defineProperty(r,e,f);else delete r[e]})}}}catch(e){c.reverse().forEach(t=>t());throw e}}