@buoy-gg/js-top 7.0.77 → 7.0.78

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.TaskDetailView=void 0;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _TaskTable=require("./TaskTable");var _jsxRuntime=require("react/jsx-runtime");const API_EXPLAINER={timeout:"Work scheduled with setTimeout. Time shown is the callback's exclusive run time on the JS thread.",interval:"A repeating setInterval. One scheduling site, many runs \u2014 a hot interval is the classic silent JS-FPS killer.",immediate:"Work scheduled with setImmediate \u2014 runs at the end of the current event-loop turn.",raf:"requestAnimationFrame work \u2014 runs once per frame while scheduled. Cost here directly trades against 60fps.",microtask:"queueMicrotask work \u2014 runs after the current task, before the thread yields.",then:"Promise reaction (.then/.catch/.finally). Named by the function that attached the reaction. Note: async/await bodies bypass .then and land in the System row instead.",bridge:"A native\u2192JS call-in over the legacy bridge (events, module callbacks), measured as its un-nested remainder.",unattributed:"Thread time the probe measured but no JS wrapper could claim: touch handlers, React commits, native call-ins, and async/await bodies. High here on New Architecture is normal \u2014 it's where UI work lives.",other:"Origins evicted from the table when the registry hit its cap \u2014 their totals are preserved here."};function explainerFor(t){return API_EXPLAINER[t]??API_EXPLAINER.other}function fmt(t){if(t>=1e4)return`${Math.round(t/1e3)}k`;if(t>=1e3)return`${(t/1e3).toFixed(1)}k`;if(t>=100)return`${Math.round(t)}`;return`${Math.round(t*100)/100}`}function agoFmt(t){if(t<=0)return"\u2014";const e=t/1e3;if(e<1)return"just now";if(e<60)return`${Math.round(e)}s ago`;return`${Math.floor(e/60)}m ago`}function Stat({label:t,value:e,accent:r}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.stat,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statLabel,children:t}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.statValue,r?{color:r}:null],children:e})]})}const TaskDetailView=exports.TaskDetailView=(0,_react.memo)(function t({detail:e}){const r=(0,_TaskTable.badgeFor)(e.api);const s=(0,_sharedUi.useSafeAreaInsets)({minBottom:12});const i=Math.max(1,...e.buckets);return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.root,testID:"buoy-jstop-detail",contentContainerStyle:{paddingBottom:s.bottom},children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.identityRow,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.badge,{borderColor:r.color,backgroundColor:`${r.color}1A`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.badgeText,{color:r.color}],children:r.text})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.name,numberOfLines:2,testID:"buoy-jstop-detail-name",children:(0,_TaskTable.displayName)(e)})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.explainer,children:explainerFor(e.api)}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"ACTIVITY \xB7 LAST 5S"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chartRow,children:e.buckets.map((o,n)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chartBarSlot,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.chartBar,{height:Math.max(2,o/i*44),backgroundColor:r.color}]})},`bk${n}`))}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.chartLegend,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.chartLegendText,children:[fmt(e.windowMs)," ms in window \xB7 ",e.pctOfBusy.toFixed(1),"% of busy time"]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.chartLegendText,children:["peak ",fmt(i)," ms/250ms"]})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"STATS \xB7 SINCE START"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statGrid,children:[(0,_jsxRuntime.jsx)(Stat,{label:"RUNS",value:e.calls>0?fmt(e.calls):"\u2014"}),(0,_jsxRuntime.jsx)(Stat,{label:"SCHEDULED",value:e.scheduleCount>0?fmt(e.scheduleCount):"\u2014"}),(0,_jsxRuntime.jsx)(Stat,{label:"AVG / RUN",value:e.calls>0?`${fmt(e.avgMs)} ms`:"\u2014"}),(0,_jsxRuntime.jsx)(Stat,{label:"MAX / RUN",value:e.maxMs>0?`${fmt(e.maxMs)} ms`:"\u2014",accent:e.maxMs>=50?_sharedUi.macOSColors.semantic.warning:void 0}),(0,_jsxRuntime.jsx)(Stat,{label:"TOTAL",value:e.totalMs>0?`${fmt(e.totalMs)} ms`:"\u2014"}),(0,_jsxRuntime.jsx)(Stat,{label:"LAST RUN",value:agoFmt(e.lastSeenAgoMs)}),(0,_jsxRuntime.jsx)(Stat,{label:"FREEZES \xB7 60S",value:e.freezes>0?`${e.freezes}`:"0",accent:e.freezes>0?_sharedUi.macOSColors.semantic.error:void 0}),(0,_jsxRuntime.jsx)(Stat,{label:"WORST FREEZE",value:e.worstFreezeMs>0?`${e.worstFreezeMs} ms`:"\u2014",accent:e.worstFreezeMs>=100?_sharedUi.macOSColors.semantic.error:e.worstFreezeMs>0?_sharedUi.macOSColors.semantic.warning:void 0})]}),(e.caller||(e.frames?.length??0)>0)&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"SCHEDULED FROM"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.siteCard,children:[e.caller&&(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.siteCaller,children:[e.caller,"()"]}),e.file&&(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.siteFile,children:[e.file,e.line!=null?`:${e.line}`:""]}),e.frames?.map((o,n)=>(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.siteFrame,numberOfLines:1,children:[o.file,":",o.line,":",o.col]},`fr${n}`)),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.siteNote,children:"Frames are bundle offsets (Hermes) \u2014 the caller name above is the readable part. Captured once when this origin got hot."})]})]}),!e.caller&&(e.frames?.length??0)===0&&e.api!=="unattributed"&&e.api!=="other"&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"SCHEDULED FROM"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sitePending,children:e.promoted?"Stack capture pending \u2014 next schedule from this site will record it.":"Not hot enough yet \u2014 the scheduling stack is captured once an origin passes 25 schedules or 50ms total."})]})]})});const styles=_reactNative.StyleSheet.create({root:{flex:1,backgroundColor:"transparent",paddingHorizontal:12},identityRow:{flexDirection:"row",alignItems:"center",gap:8,paddingTop:12},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:5,paddingVertical:2},badgeText:{fontSize:9,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:_sharedUi.night.color.text,fontSize:15,fontWeight:"600"},explainer:{color:_sharedUi.night.color.textTertiary,fontSize:11,lineHeight:15,marginTop:6,marginBottom:4},sectionTitle:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginTop:14,marginBottom:6},chartRow:{flexDirection:"row",alignItems:"flex-end",height:48,gap:2,backgroundColor:_sharedUi.night.color.surface,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.border,paddingHorizontal:6,paddingTop:2},chartBarSlot:{flex:1,alignItems:"center",justifyContent:"flex-end"},chartBar:{width:"70%",borderTopLeftRadius:2,borderTopRightRadius:2,opacity:.9},chartLegend:{flexDirection:"row",justifyContent:"space-between",marginTop:4},chartLegendText:{color:_sharedUi.night.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},statGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},stat:{width:"23%",minWidth:76,flexGrow:1,backgroundColor:_sharedUi.night.color.surface,borderWidth:1,borderColor:_sharedUi.night.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:6},statLabel:{color:_sharedUi.night.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.4,marginBottom:3},statValue:{color:_sharedUi.night.color.text,fontSize:13,fontWeight:"600",fontVariant:["tabular-nums"]},siteCard:{backgroundColor:_sharedUi.night.color.surface,borderWidth:1,borderColor:_sharedUi.night.color.border,borderRadius:6,padding:10,gap:3},siteCaller:{color:_sharedUi.night.color.text,fontSize:13,fontWeight:"600"},siteFile:{color:_sharedUi.night.color.info,fontSize:11},siteFrame:{color:_sharedUi.night.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},siteNote:{color:_sharedUi.night.color.textTertiary,fontSize:9,opacity:.8,marginTop:4},sitePending:{color:_sharedUi.night.color.textTertiary,fontSize:11}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.TaskDetailView=void 0;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _TaskTable=require("./TaskTable");var _jsxRuntime=require("react/jsx-runtime");const API_EXPLAINER={timeout:"Work scheduled with setTimeout. Time shown is the callback's exclusive run time on the JS thread.",interval:"A repeating setInterval. One scheduling site, many runs \u2014 a hot interval is the classic silent JS-FPS killer.",immediate:"Work scheduled with setImmediate \u2014 runs at the end of the current event-loop turn.",raf:"requestAnimationFrame work \u2014 runs once per frame while scheduled. Cost here directly trades against 60fps.",microtask:"queueMicrotask work \u2014 runs after the current task, before the thread yields.",then:"Promise reaction (.then/.catch/.finally). Named by the function that attached the reaction. Note: async/await bodies bypass .then and land in the System row instead.",bridge:"A native\u2192JS call-in over the legacy bridge (events, module callbacks), measured as its un-nested remainder.",unattributed:"Thread time the probe measured but no JS wrapper could claim: touch handlers, React commits, native call-ins, and async/await bodies. High here on New Architecture is normal \u2014 it's where UI work lives.",other:"Origins evicted from the table when the registry hit its cap \u2014 their totals are preserved here."};function explainerFor(t){return API_EXPLAINER[t]??API_EXPLAINER.other}function fmt(t){if(t>=1e4)return`${Math.round(t/1e3)}k`;if(t>=1e3)return`${(t/1e3).toFixed(1)}k`;if(t>=100)return`${Math.round(t)}`;return`${Math.round(t*100)/100}`}function agoFmt(t){if(t<=0)return"\u2014";const e=t/1e3;if(e<1)return"just now";if(e<60)return`${Math.round(e)}s ago`;return`${Math.floor(e/60)}m ago`}function Stat({label:t,value:e,accent:r}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.stat,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statLabel,children:t}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.statValue,r?{color:r}:null],children:e})]})}const TaskDetailView=exports.TaskDetailView=(0,_react.memo)(function t({detail:e}){const r=(0,_TaskTable.badgeFor)(e.api);const s=(0,_sharedUi.useSafeAreaInsets)({minBottom:12});const i=Math.max(1,...e.buckets);return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",style:styles.root,testID:"buoy-jstop-detail",contentContainerStyle:{paddingBottom:s.bottom},children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.identityRow,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.badge,{borderColor:r.color,backgroundColor:`${r.color}1A`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.badgeText,{color:r.color}],children:r.text})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.name,numberOfLines:2,testID:"buoy-jstop-detail-name",children:(0,_TaskTable.displayName)(e)})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.explainer,children:explainerFor(e.api)}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"ACTIVITY \xB7 LAST 5S"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chartRow,children:e.buckets.map((o,n)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chartBarSlot,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.chartBar,{height:Math.max(2,o/i*44),backgroundColor:r.color}]})},`bk${n}`))}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.chartLegend,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.chartLegendText,children:[fmt(e.windowMs)," ms in window \xB7 ",e.pctOfBusy.toFixed(1),"% of busy time"]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.chartLegendText,children:["peak ",fmt(i)," ms/250ms"]})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"STATS \xB7 SINCE START"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statGrid,children:[(0,_jsxRuntime.jsx)(Stat,{label:"RUNS",value:e.calls>0?fmt(e.calls):"\u2014"}),(0,_jsxRuntime.jsx)(Stat,{label:"SCHEDULED",value:e.scheduleCount>0?fmt(e.scheduleCount):"\u2014"}),(0,_jsxRuntime.jsx)(Stat,{label:"AVG / RUN",value:e.calls>0?`${fmt(e.avgMs)} ms`:"\u2014"}),(0,_jsxRuntime.jsx)(Stat,{label:"MAX / RUN",value:e.maxMs>0?`${fmt(e.maxMs)} ms`:"\u2014",accent:e.maxMs>=50?_sharedUi.macOSColors.semantic.warning:void 0}),(0,_jsxRuntime.jsx)(Stat,{label:"TOTAL",value:e.totalMs>0?`${fmt(e.totalMs)} ms`:"\u2014"}),(0,_jsxRuntime.jsx)(Stat,{label:"LAST RUN",value:agoFmt(e.lastSeenAgoMs)}),(0,_jsxRuntime.jsx)(Stat,{label:"FREEZES \xB7 60S",value:e.freezes>0?`${e.freezes}`:"0",accent:e.freezes>0?_sharedUi.macOSColors.semantic.error:void 0}),(0,_jsxRuntime.jsx)(Stat,{label:"WORST FREEZE",value:e.worstFreezeMs>0?`${e.worstFreezeMs} ms`:"\u2014",accent:e.worstFreezeMs>=100?_sharedUi.macOSColors.semantic.error:e.worstFreezeMs>0?_sharedUi.macOSColors.semantic.warning:void 0})]}),(e.caller||(e.frames?.length??0)>0)&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"SCHEDULED FROM"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.siteCard,children:[e.caller&&(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.siteCaller,children:[e.caller,"()"]}),e.file&&(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.siteFile,children:[e.file,e.line!=null?`:${e.line}`:""]}),e.frames?.map((o,n)=>(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.siteFrame,numberOfLines:1,children:[o.file,":",o.line,":",o.col]},`fr${n}`)),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.siteNote,children:"Frames are bundle offsets (Hermes) \u2014 the caller name above is the readable part. Captured once when this origin got hot."})]})]}),!e.caller&&(e.frames?.length??0)===0&&e.api!=="unattributed"&&e.api!=="other"&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"SCHEDULED FROM"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sitePending,children:e.promoted?"Stack capture pending \u2014 next schedule from this site will record it.":"Not hot enough yet \u2014 the scheduling stack is captured once an origin passes 25 schedules or 50ms total."})]})]})});const styles=_reactNative.StyleSheet.create({root:{flex:1,backgroundColor:"transparent",paddingHorizontal:12},identityRow:{flexDirection:"row",alignItems:"center",gap:8,paddingTop:12},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:5,paddingVertical:2},badgeText:{fontSize:9,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:_sharedUi.night.color.text,fontSize:15,fontWeight:"600"},explainer:{color:_sharedUi.night.color.textTertiary,fontSize:11,lineHeight:15,marginTop:6,marginBottom:4},sectionTitle:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginTop:14,marginBottom:6},chartRow:{flexDirection:"row",alignItems:"flex-end",height:48,gap:2,backgroundColor:_sharedUi.night.color.surface,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.border,paddingHorizontal:6,paddingTop:2},chartBarSlot:{flex:1,alignItems:"center",justifyContent:"flex-end"},chartBar:{width:"70%",borderTopLeftRadius:2,borderTopRightRadius:2,opacity:.9},chartLegend:{flexDirection:"row",justifyContent:"space-between",marginTop:4},chartLegendText:{color:_sharedUi.night.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},statGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},stat:{width:"23%",minWidth:76,flexGrow:1,backgroundColor:_sharedUi.night.color.surface,borderWidth:1,borderColor:_sharedUi.night.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:6},statLabel:{color:_sharedUi.night.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.4,marginBottom:3},statValue:{color:_sharedUi.night.color.text,fontSize:13,fontWeight:"600",fontVariant:["tabular-nums"]},siteCard:{backgroundColor:_sharedUi.night.color.surface,borderWidth:1,borderColor:_sharedUi.night.color.border,borderRadius:6,padding:10,gap:3},siteCaller:{color:_sharedUi.night.color.text,fontSize:13,fontWeight:"600"},siteFile:{color:_sharedUi.night.color.info,fontSize:11},siteFrame:{color:_sharedUi.night.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},siteNote:{color:_sharedUi.night.color.textTertiary,fontSize:9,opacity:.8,marginTop:4},sitePending:{color:_sharedUi.night.color.textTertiary,fontSize:11}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.API_BADGE=void 0;exports.TaskTable=TaskTable;exports.badgeFor=badgeFor;exports.displayName=displayName;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");const SORT_OPTIONS=[{key:"windowMs",title:"RECENT"},{key:"calls",title:"CALLS"},{key:"avgMs",title:"AVG"},{key:"maxMs",title:"MAX"},{key:"totalMs",title:"TOTAL"}];const API_BADGE=exports.API_BADGE={timeout:{text:"TIMEOUT",color:"#38BDF8",prefix:"setTimeout"},interval:{text:"INTERVAL",color:"#22D3EE",prefix:"setInterval"},immediate:{text:"IMMED",color:"#60A5FA",prefix:"setImmediate"},raf:{text:"RAF",color:"#34D399",prefix:"requestAnimationFrame"},microtask:{text:"MICRO",color:"#A78BFA",prefix:"queueMicrotask"},then:{text:"PROMISE",color:"#BF5AF2",prefix:"Promise.then"},bridge:{text:"BRIDGE",color:"#FBBF24",prefix:"bridge"},unattributed:{text:"SYSTEM",color:"#8E8E93"},other:{text:"OTHER",color:"#8E8E93",prefix:"other"}};function badgeFor(t){return API_BADGE[t]??API_BADGE.other}function displayName(t){if(t.api==="unattributed")return"events \xB7 React \xB7 native call-ins";if(t.api==="other")return t.key==="minor"?t.label:"evicted cold origins";const e=badgeFor(t.api).prefix;let r=t.label;if(e&&r.startsWith(e))r=r.slice(e.length);r=r.replace(/^[\s←@]+/,"").trim();return r.length>0?r:"anonymous"}function fmt(t){if(t>=1e4)return`${Math.round(t/1e3)}k`;if(t>=1e3)return`${(t/1e3).toFixed(1)}k`;if(t>=100)return`${Math.round(t)}`;return`${Math.round(t*10)/10}`}function statsLine(t){if(t.calls<=0)return"measured by probe \xB7 not reachable from JS";return`${fmt(t.calls)} calls \xB7 avg ${fmt(t.avgMs)} \xB7 max ${fmt(t.maxMs)} \xB7 total ${fmt(t.totalMs)} ms`}const TaskRow=(0,_react.memo)(function t({row:e,rank:r,onPress:a}){const i=badgeFor(e.api);const o=a?_reactNative.TouchableOpacity:_reactNative.View;return(0,_jsxRuntime.jsxs)(o,{style:rowStyles.row,testID:"buoy-jstop-row",...a?{onPress:()=>a(e),activeOpacity:.6}:{},children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:rowStyles.topLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:rowStyles.rank,children:r}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[rowStyles.badge,{borderColor:i.color,backgroundColor:`${i.color}1A`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[rowStyles.badgeText,{color:i.color}],children:i.text})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:rowStyles.name,numberOfLines:1,testID:"buoy-jstop-row-name",children:displayName(e)}),e.freezes>0&&(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[rowStyles.freezeBadge,e.worstFreezeMs>=100&&rowStyles.freezeBadgeSevere],children:["\u26A0 \xD7",e.freezes]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[rowStyles.windowMs,e.api!=="unattributed"&&e.pctOfBusy>=25&&{color:e.pctOfBusy>=50?_sharedUi.macOSColors.semantic.error:_sharedUi.macOSColors.semantic.warning}],children:[fmt(e.windowMs),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:rowStyles.unit,children:" ms"})]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[rowStyles.pct,e.api==="unattributed"&&rowStyles.pctMuted],children:[Math.round(e.pctOfBusy),"%"]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:rowStyles.subLine,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:rowStyles.barTrack,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[rowStyles.barFill,{width:`${Math.min(100,e.pctOfBusy)}%`,backgroundColor:i.color}]})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:rowStyles.stats,numberOfLines:1,testID:"buoy-jstop-row-stats",children:statsLine(e)})]})]})},(t,e)=>t.rank===e.rank&&t.onPress===e.onPress&&t.row.key===e.row.key&&t.row.windowMs===e.row.windowMs&&t.row.calls===e.row.calls&&t.row.maxMs===e.row.maxMs&&t.row.totalMs===e.row.totalMs&&t.row.pctOfBusy===e.row.pctOfBusy&&t.row.freezes===e.row.freezes&&t.row.worstFreezeMs===e.row.worstFreezeMs);function TaskTable({rows:t,onSelectRow:e}){const[r,a]=(0,_react.useState)("windowMs");const i=r==="windowMs"?t:[...t].sort((o,n)=>n[r]-o[r]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.root,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sortRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sortLabel,children:"SORT"}),SORT_OPTIONS.map(o=>(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>a(o.key),style:[styles.sortChip,r===o.key&&styles.sortChipOn],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.sortChipText,r===o.key&&styles.sortChipTextOn],children:o.title})},o.key))]}),(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.body,children:[i.map((o,n)=>(0,_jsxRuntime.jsx)(TaskRow,{row:o,rank:n+1,onPress:e},o.key)),i.length===0&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.empty,testID:"buoy-jstop-empty",children:"No tasks observed yet \u2014 interact with the app."})]})]})}const styles=_reactNative.StyleSheet.create({root:{flex:1,minHeight:0},sortRow:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:6,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface},sortLabel:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginRight:2},sortChip:{borderWidth:1,borderColor:_sharedUi.night.color.border,borderRadius:4,paddingHorizontal:7,paddingVertical:3},sortChipOn:{borderColor:_sharedUi.night.color.accentBorderStrong,backgroundColor:_sharedUi.night.color.accentSoft},sortChipText:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"600",fontVariant:["tabular-nums"]},sortChipTextOn:{color:_sharedUi.night.color.accent},body:{flex:1},empty:{color:_sharedUi.night.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:24}});const rowStyles=_reactNative.StyleSheet.create({row:{paddingHorizontal:10,paddingVertical:8,borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomColor:_sharedUi.night.color.border,gap:5},topLine:{flexDirection:"row",alignItems:"center",gap:6},rank:{width:16,color:_sharedUi.night.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:4,paddingVertical:1},badgeText:{fontSize:8,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:_sharedUi.night.color.text,fontSize:13,fontWeight:"500"},freezeBadge:{color:_sharedUi.macOSColors.semantic.warning,fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},freezeBadgeSevere:{color:_sharedUi.macOSColors.semantic.error},windowMs:{color:_sharedUi.night.color.text,fontSize:13,fontWeight:"700",fontVariant:["tabular-nums"]},unit:{color:_sharedUi.night.color.textTertiary,fontSize:10,fontWeight:"400"},pct:{width:38,textAlign:"right",color:_sharedUi.night.color.textSecondary,fontSize:12,fontWeight:"600",fontVariant:["tabular-nums"]},pctMuted:{color:_sharedUi.night.color.textTertiary},subLine:{flexDirection:"row",alignItems:"center",gap:8,paddingLeft:22},barTrack:{width:72,height:4,borderRadius:2,backgroundColor:_sharedUi.night.color.fillSecondary,overflow:"hidden"},barFill:{height:4,borderRadius:2,opacity:.85},stats:{flex:1,color:_sharedUi.night.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.API_BADGE=void 0;exports.TaskTable=TaskTable;exports.badgeFor=badgeFor;exports.displayName=displayName;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");const SORT_OPTIONS=[{key:"windowMs",title:"RECENT"},{key:"calls",title:"CALLS"},{key:"avgMs",title:"AVG"},{key:"maxMs",title:"MAX"},{key:"totalMs",title:"TOTAL"}];const API_BADGE=exports.API_BADGE={timeout:{text:"TIMEOUT",color:"#38BDF8",prefix:"setTimeout"},interval:{text:"INTERVAL",color:"#22D3EE",prefix:"setInterval"},immediate:{text:"IMMED",color:"#60A5FA",prefix:"setImmediate"},raf:{text:"RAF",color:"#34D399",prefix:"requestAnimationFrame"},microtask:{text:"MICRO",color:"#A78BFA",prefix:"queueMicrotask"},then:{text:"PROMISE",color:"#BF5AF2",prefix:"Promise.then"},bridge:{text:"BRIDGE",color:"#FBBF24",prefix:"bridge"},unattributed:{text:"SYSTEM",color:"#8E8E93"},other:{text:"OTHER",color:"#8E8E93",prefix:"other"}};function badgeFor(t){return API_BADGE[t]??API_BADGE.other}function displayName(t){if(t.api==="unattributed")return"events \xB7 React \xB7 native call-ins";if(t.api==="other")return t.key==="minor"?t.label:"evicted cold origins";const e=badgeFor(t.api).prefix;let r=t.label;if(e&&r.startsWith(e))r=r.slice(e.length);r=r.replace(/^[\s←@]+/,"").trim();return r.length>0?r:"anonymous"}function fmt(t){if(t>=1e4)return`${Math.round(t/1e3)}k`;if(t>=1e3)return`${(t/1e3).toFixed(1)}k`;if(t>=100)return`${Math.round(t)}`;return`${Math.round(t*10)/10}`}function statsLine(t){if(t.calls<=0)return"measured by probe \xB7 not reachable from JS";return`${fmt(t.calls)} calls \xB7 avg ${fmt(t.avgMs)} \xB7 max ${fmt(t.maxMs)} \xB7 total ${fmt(t.totalMs)} ms`}const TaskRow=(0,_react.memo)(function t({row:e,rank:r,onPress:a}){const i=badgeFor(e.api);const o=a?_reactNative.TouchableOpacity:_reactNative.View;return(0,_jsxRuntime.jsxs)(o,{style:rowStyles.row,testID:"buoy-jstop-row",...a?{onPress:()=>a(e),activeOpacity:.6}:{},children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:rowStyles.topLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:rowStyles.rank,children:r}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[rowStyles.badge,{borderColor:i.color,backgroundColor:`${i.color}1A`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[rowStyles.badgeText,{color:i.color}],children:i.text})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:rowStyles.name,numberOfLines:1,testID:"buoy-jstop-row-name",children:displayName(e)}),e.freezes>0&&(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[rowStyles.freezeBadge,e.worstFreezeMs>=100&&rowStyles.freezeBadgeSevere],children:["\u26A0 \xD7",e.freezes]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[rowStyles.windowMs,e.api!=="unattributed"&&e.pctOfBusy>=25&&{color:e.pctOfBusy>=50?_sharedUi.macOSColors.semantic.error:_sharedUi.macOSColors.semantic.warning}],children:[fmt(e.windowMs),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:rowStyles.unit,children:" ms"})]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[rowStyles.pct,e.api==="unattributed"&&rowStyles.pctMuted],children:[Math.round(e.pctOfBusy),"%"]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:rowStyles.subLine,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:rowStyles.barTrack,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[rowStyles.barFill,{width:`${Math.min(100,e.pctOfBusy)}%`,backgroundColor:i.color}]})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:rowStyles.stats,numberOfLines:1,testID:"buoy-jstop-row-stats",children:statsLine(e)})]})]})},(t,e)=>t.rank===e.rank&&t.onPress===e.onPress&&t.row.key===e.row.key&&t.row.windowMs===e.row.windowMs&&t.row.calls===e.row.calls&&t.row.maxMs===e.row.maxMs&&t.row.totalMs===e.row.totalMs&&t.row.pctOfBusy===e.row.pctOfBusy&&t.row.freezes===e.row.freezes&&t.row.worstFreezeMs===e.row.worstFreezeMs);function TaskTable({rows:t,onSelectRow:e}){const[r,a]=(0,_react.useState)("windowMs");const i=r==="windowMs"?t:[...t].sort((o,n)=>n[r]-o[r]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.root,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sortRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sortLabel,children:"SORT"}),SORT_OPTIONS.map(o=>(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>a(o.key),style:[styles.sortChip,r===o.key&&styles.sortChipOn],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.sortChipText,r===o.key&&styles.sortChipTextOn],children:o.title})},o.key))]}),(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",style:styles.body,children:[i.map((o,n)=>(0,_jsxRuntime.jsx)(TaskRow,{row:o,rank:n+1,onPress:e},o.key)),i.length===0&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.empty,testID:"buoy-jstop-empty",children:"No tasks observed yet \u2014 interact with the app."})]})]})}const styles=_reactNative.StyleSheet.create({root:{flex:1,minHeight:0},sortRow:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:6,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface},sortLabel:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginRight:2},sortChip:{borderWidth:1,borderColor:_sharedUi.night.color.border,borderRadius:4,paddingHorizontal:7,paddingVertical:3},sortChipOn:{borderColor:_sharedUi.night.color.accentBorderStrong,backgroundColor:_sharedUi.night.color.accentSoft},sortChipText:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"600",fontVariant:["tabular-nums"]},sortChipTextOn:{color:_sharedUi.night.color.accent},body:{flex:1},empty:{color:_sharedUi.night.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:24}});const rowStyles=_reactNative.StyleSheet.create({row:{paddingHorizontal:10,paddingVertical:8,borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomColor:_sharedUi.night.color.border,gap:5},topLine:{flexDirection:"row",alignItems:"center",gap:6},rank:{width:16,color:_sharedUi.night.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:4,paddingVertical:1},badgeText:{fontSize:8,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:_sharedUi.night.color.text,fontSize:13,fontWeight:"500"},freezeBadge:{color:_sharedUi.macOSColors.semantic.warning,fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},freezeBadgeSevere:{color:_sharedUi.macOSColors.semantic.error},windowMs:{color:_sharedUi.night.color.text,fontSize:13,fontWeight:"700",fontVariant:["tabular-nums"]},unit:{color:_sharedUi.night.color.textTertiary,fontSize:10,fontWeight:"400"},pct:{width:38,textAlign:"right",color:_sharedUi.night.color.textSecondary,fontSize:12,fontWeight:"600",fontVariant:["tabular-nums"]},pctMuted:{color:_sharedUi.night.color.textTertiary},subLine:{flexDirection:"row",alignItems:"center",gap:8,paddingLeft:22},barTrack:{width:72,height:4,borderRadius:2,backgroundColor:_sharedUi.night.color.fillSecondary,overflow:"hidden"},barFill:{height:4,borderRadius:2,opacity:.85},stats:{flex:1,color:_sharedUi.night.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]}});
@@ -1 +1 @@
1
- "use strict";import{memo as y}from"react";import{ScrollView as x,StyleSheet as S,Text as n,View as s}from"react-native";import{macOSColors as u,night as o,useSafeAreaInsets as w}from"@buoy-gg/shared-ui";import{badgeFor as T,displayName as k}from"./TaskTable";import{jsx as r,jsxs as a,Fragment as g}from"react/jsx-runtime";const b={timeout:"Work scheduled with setTimeout. Time shown is the callback's exclusive run time on the JS thread.",interval:"A repeating setInterval. One scheduling site, many runs \u2014 a hot interval is the classic silent JS-FPS killer.",immediate:"Work scheduled with setImmediate \u2014 runs at the end of the current event-loop turn.",raf:"requestAnimationFrame work \u2014 runs once per frame while scheduled. Cost here directly trades against 60fps.",microtask:"queueMicrotask work \u2014 runs after the current task, before the thread yields.",then:"Promise reaction (.then/.catch/.finally). Named by the function that attached the reaction. Note: async/await bodies bypass .then and land in the System row instead.",bridge:"A native\u2192JS call-in over the legacy bridge (events, module callbacks), measured as its un-nested remainder.",unattributed:"Thread time the probe measured but no JS wrapper could claim: touch handlers, React commits, native call-ins, and async/await bodies. High here on New Architecture is normal \u2014 it's where UI work lives.",other:"Origins evicted from the table when the registry hit its cap \u2014 their totals are preserved here."};function C(i){return b[i]??b.other}function d(i){if(i>=1e4)return`${Math.round(i/1e3)}k`;if(i>=1e3)return`${(i/1e3).toFixed(1)}k`;if(i>=100)return`${Math.round(i)}`;return`${Math.round(i*100)/100}`}function z(i){if(i<=0)return"\u2014";const e=i/1e3;if(e<1)return"just now";if(e<60)return`${Math.round(e)}s ago`;return`${Math.floor(e/60)}m ago`}function c({label:i,value:e,accent:l}){return a(s,{style:t.stat,children:[r(n,{style:t.statLabel,children:i}),r(n,{style:[t.statValue,l?{color:l}:null],children:e})]})}export const TaskDetailView=y(function i({detail:e}){const l=T(e.api);const p=w({minBottom:12});const f=Math.max(1,...e.buckets);return a(x,{style:t.root,testID:"buoy-jstop-detail",contentContainerStyle:{paddingBottom:p.bottom},children:[a(s,{style:t.identityRow,children:[r(s,{style:[t.badge,{borderColor:l.color,backgroundColor:`${l.color}1A`}],children:r(n,{style:[t.badgeText,{color:l.color}],children:l.text})}),r(n,{style:t.name,numberOfLines:2,testID:"buoy-jstop-detail-name",children:k(e)})]}),r(n,{style:t.explainer,children:C(e.api)}),r(n,{style:t.sectionTitle,children:"ACTIVITY \xB7 LAST 5S"}),r(s,{style:t.chartRow,children:e.buckets.map((h,m)=>r(s,{style:t.chartBarSlot,children:r(s,{style:[t.chartBar,{height:Math.max(2,h/f*44),backgroundColor:l.color}]})},`bk${m}`))}),a(s,{style:t.chartLegend,children:[a(n,{style:t.chartLegendText,children:[d(e.windowMs)," ms in window \xB7 ",e.pctOfBusy.toFixed(1),"% of busy time"]}),a(n,{style:t.chartLegendText,children:["peak ",d(f)," ms/250ms"]})]}),r(n,{style:t.sectionTitle,children:"STATS \xB7 SINCE START"}),a(s,{style:t.statGrid,children:[r(c,{label:"RUNS",value:e.calls>0?d(e.calls):"\u2014"}),r(c,{label:"SCHEDULED",value:e.scheduleCount>0?d(e.scheduleCount):"\u2014"}),r(c,{label:"AVG / RUN",value:e.calls>0?`${d(e.avgMs)} ms`:"\u2014"}),r(c,{label:"MAX / RUN",value:e.maxMs>0?`${d(e.maxMs)} ms`:"\u2014",accent:e.maxMs>=50?u.semantic.warning:void 0}),r(c,{label:"TOTAL",value:e.totalMs>0?`${d(e.totalMs)} ms`:"\u2014"}),r(c,{label:"LAST RUN",value:z(e.lastSeenAgoMs)}),r(c,{label:"FREEZES \xB7 60S",value:e.freezes>0?`${e.freezes}`:"0",accent:e.freezes>0?u.semantic.error:void 0}),r(c,{label:"WORST FREEZE",value:e.worstFreezeMs>0?`${e.worstFreezeMs} ms`:"\u2014",accent:e.worstFreezeMs>=100?u.semantic.error:e.worstFreezeMs>0?u.semantic.warning:void 0})]}),(e.caller||(e.frames?.length??0)>0)&&a(g,{children:[r(n,{style:t.sectionTitle,children:"SCHEDULED FROM"}),a(s,{style:t.siteCard,children:[e.caller&&a(n,{style:t.siteCaller,children:[e.caller,"()"]}),e.file&&a(n,{style:t.siteFile,children:[e.file,e.line!=null?`:${e.line}`:""]}),e.frames?.map((h,m)=>a(n,{style:t.siteFrame,numberOfLines:1,children:[h.file,":",h.line,":",h.col]},`fr${m}`)),r(n,{style:t.siteNote,children:"Frames are bundle offsets (Hermes) \u2014 the caller name above is the readable part. Captured once when this origin got hot."})]})]}),!e.caller&&(e.frames?.length??0)===0&&e.api!=="unattributed"&&e.api!=="other"&&a(g,{children:[r(n,{style:t.sectionTitle,children:"SCHEDULED FROM"}),r(n,{style:t.sitePending,children:e.promoted?"Stack capture pending \u2014 next schedule from this site will record it.":"Not hot enough yet \u2014 the scheduling stack is captured once an origin passes 25 schedules or 50ms total."})]})]})});const t=S.create({root:{flex:1,backgroundColor:"transparent",paddingHorizontal:12},identityRow:{flexDirection:"row",alignItems:"center",gap:8,paddingTop:12},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:5,paddingVertical:2},badgeText:{fontSize:9,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:o.color.text,fontSize:15,fontWeight:"600"},explainer:{color:o.color.textTertiary,fontSize:11,lineHeight:15,marginTop:6,marginBottom:4},sectionTitle:{color:o.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginTop:14,marginBottom:6},chartRow:{flexDirection:"row",alignItems:"flex-end",height:48,gap:2,backgroundColor:o.color.surface,borderRadius:6,borderWidth:1,borderColor:o.color.border,paddingHorizontal:6,paddingTop:2},chartBarSlot:{flex:1,alignItems:"center",justifyContent:"flex-end"},chartBar:{width:"70%",borderTopLeftRadius:2,borderTopRightRadius:2,opacity:.9},chartLegend:{flexDirection:"row",justifyContent:"space-between",marginTop:4},chartLegendText:{color:o.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},statGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},stat:{width:"23%",minWidth:76,flexGrow:1,backgroundColor:o.color.surface,borderWidth:1,borderColor:o.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:6},statLabel:{color:o.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.4,marginBottom:3},statValue:{color:o.color.text,fontSize:13,fontWeight:"600",fontVariant:["tabular-nums"]},siteCard:{backgroundColor:o.color.surface,borderWidth:1,borderColor:o.color.border,borderRadius:6,padding:10,gap:3},siteCaller:{color:o.color.text,fontSize:13,fontWeight:"600"},siteFile:{color:o.color.info,fontSize:11},siteFrame:{color:o.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},siteNote:{color:o.color.textTertiary,fontSize:9,opacity:.8,marginTop:4},sitePending:{color:o.color.textTertiary,fontSize:11}});
1
+ "use strict";import{memo as y}from"react";import{ScrollView as x,StyleSheet as S,Text as n,View as s}from"react-native";import{macOSColors as u,night as o,useSafeAreaInsets as w}from"@buoy-gg/shared-ui";import{badgeFor as T,displayName as k}from"./TaskTable";import{jsx as r,jsxs as a,Fragment as g}from"react/jsx-runtime";const b={timeout:"Work scheduled with setTimeout. Time shown is the callback's exclusive run time on the JS thread.",interval:"A repeating setInterval. One scheduling site, many runs \u2014 a hot interval is the classic silent JS-FPS killer.",immediate:"Work scheduled with setImmediate \u2014 runs at the end of the current event-loop turn.",raf:"requestAnimationFrame work \u2014 runs once per frame while scheduled. Cost here directly trades against 60fps.",microtask:"queueMicrotask work \u2014 runs after the current task, before the thread yields.",then:"Promise reaction (.then/.catch/.finally). Named by the function that attached the reaction. Note: async/await bodies bypass .then and land in the System row instead.",bridge:"A native\u2192JS call-in over the legacy bridge (events, module callbacks), measured as its un-nested remainder.",unattributed:"Thread time the probe measured but no JS wrapper could claim: touch handlers, React commits, native call-ins, and async/await bodies. High here on New Architecture is normal \u2014 it's where UI work lives.",other:"Origins evicted from the table when the registry hit its cap \u2014 their totals are preserved here."};function C(i){return b[i]??b.other}function d(i){if(i>=1e4)return`${Math.round(i/1e3)}k`;if(i>=1e3)return`${(i/1e3).toFixed(1)}k`;if(i>=100)return`${Math.round(i)}`;return`${Math.round(i*100)/100}`}function z(i){if(i<=0)return"\u2014";const e=i/1e3;if(e<1)return"just now";if(e<60)return`${Math.round(e)}s ago`;return`${Math.floor(e/60)}m ago`}function c({label:i,value:e,accent:l}){return a(s,{style:t.stat,children:[r(n,{style:t.statLabel,children:i}),r(n,{style:[t.statValue,l?{color:l}:null],children:e})]})}export const TaskDetailView=y(function i({detail:e}){const l=T(e.api);const p=w({minBottom:12});const f=Math.max(1,...e.buckets);return a(x,{keyboardShouldPersistTaps:"handled",style:t.root,testID:"buoy-jstop-detail",contentContainerStyle:{paddingBottom:p.bottom},children:[a(s,{style:t.identityRow,children:[r(s,{style:[t.badge,{borderColor:l.color,backgroundColor:`${l.color}1A`}],children:r(n,{style:[t.badgeText,{color:l.color}],children:l.text})}),r(n,{style:t.name,numberOfLines:2,testID:"buoy-jstop-detail-name",children:k(e)})]}),r(n,{style:t.explainer,children:C(e.api)}),r(n,{style:t.sectionTitle,children:"ACTIVITY \xB7 LAST 5S"}),r(s,{style:t.chartRow,children:e.buckets.map((h,m)=>r(s,{style:t.chartBarSlot,children:r(s,{style:[t.chartBar,{height:Math.max(2,h/f*44),backgroundColor:l.color}]})},`bk${m}`))}),a(s,{style:t.chartLegend,children:[a(n,{style:t.chartLegendText,children:[d(e.windowMs)," ms in window \xB7 ",e.pctOfBusy.toFixed(1),"% of busy time"]}),a(n,{style:t.chartLegendText,children:["peak ",d(f)," ms/250ms"]})]}),r(n,{style:t.sectionTitle,children:"STATS \xB7 SINCE START"}),a(s,{style:t.statGrid,children:[r(c,{label:"RUNS",value:e.calls>0?d(e.calls):"\u2014"}),r(c,{label:"SCHEDULED",value:e.scheduleCount>0?d(e.scheduleCount):"\u2014"}),r(c,{label:"AVG / RUN",value:e.calls>0?`${d(e.avgMs)} ms`:"\u2014"}),r(c,{label:"MAX / RUN",value:e.maxMs>0?`${d(e.maxMs)} ms`:"\u2014",accent:e.maxMs>=50?u.semantic.warning:void 0}),r(c,{label:"TOTAL",value:e.totalMs>0?`${d(e.totalMs)} ms`:"\u2014"}),r(c,{label:"LAST RUN",value:z(e.lastSeenAgoMs)}),r(c,{label:"FREEZES \xB7 60S",value:e.freezes>0?`${e.freezes}`:"0",accent:e.freezes>0?u.semantic.error:void 0}),r(c,{label:"WORST FREEZE",value:e.worstFreezeMs>0?`${e.worstFreezeMs} ms`:"\u2014",accent:e.worstFreezeMs>=100?u.semantic.error:e.worstFreezeMs>0?u.semantic.warning:void 0})]}),(e.caller||(e.frames?.length??0)>0)&&a(g,{children:[r(n,{style:t.sectionTitle,children:"SCHEDULED FROM"}),a(s,{style:t.siteCard,children:[e.caller&&a(n,{style:t.siteCaller,children:[e.caller,"()"]}),e.file&&a(n,{style:t.siteFile,children:[e.file,e.line!=null?`:${e.line}`:""]}),e.frames?.map((h,m)=>a(n,{style:t.siteFrame,numberOfLines:1,children:[h.file,":",h.line,":",h.col]},`fr${m}`)),r(n,{style:t.siteNote,children:"Frames are bundle offsets (Hermes) \u2014 the caller name above is the readable part. Captured once when this origin got hot."})]})]}),!e.caller&&(e.frames?.length??0)===0&&e.api!=="unattributed"&&e.api!=="other"&&a(g,{children:[r(n,{style:t.sectionTitle,children:"SCHEDULED FROM"}),r(n,{style:t.sitePending,children:e.promoted?"Stack capture pending \u2014 next schedule from this site will record it.":"Not hot enough yet \u2014 the scheduling stack is captured once an origin passes 25 schedules or 50ms total."})]})]})});const t=S.create({root:{flex:1,backgroundColor:"transparent",paddingHorizontal:12},identityRow:{flexDirection:"row",alignItems:"center",gap:8,paddingTop:12},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:5,paddingVertical:2},badgeText:{fontSize:9,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:o.color.text,fontSize:15,fontWeight:"600"},explainer:{color:o.color.textTertiary,fontSize:11,lineHeight:15,marginTop:6,marginBottom:4},sectionTitle:{color:o.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginTop:14,marginBottom:6},chartRow:{flexDirection:"row",alignItems:"flex-end",height:48,gap:2,backgroundColor:o.color.surface,borderRadius:6,borderWidth:1,borderColor:o.color.border,paddingHorizontal:6,paddingTop:2},chartBarSlot:{flex:1,alignItems:"center",justifyContent:"flex-end"},chartBar:{width:"70%",borderTopLeftRadius:2,borderTopRightRadius:2,opacity:.9},chartLegend:{flexDirection:"row",justifyContent:"space-between",marginTop:4},chartLegendText:{color:o.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},statGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},stat:{width:"23%",minWidth:76,flexGrow:1,backgroundColor:o.color.surface,borderWidth:1,borderColor:o.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:6},statLabel:{color:o.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.4,marginBottom:3},statValue:{color:o.color.text,fontSize:13,fontWeight:"600",fontVariant:["tabular-nums"]},siteCard:{backgroundColor:o.color.surface,borderWidth:1,borderColor:o.color.border,borderRadius:6,padding:10,gap:3},siteCaller:{color:o.color.text,fontSize:13,fontWeight:"600"},siteFile:{color:o.color.info,fontSize:11},siteFrame:{color:o.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},siteNote:{color:o.color.textTertiary,fontSize:9,opacity:.8,marginTop:4},sitePending:{color:o.color.textTertiary,fontSize:11}});
@@ -1 +1 @@
1
- "use strict";import{memo as g,useState as x}from"react";import{ScrollView as M,StyleSheet as m,Text as l,TouchableOpacity as b,View as f}from"react-native";import{macOSColors as p,night as r}from"@buoy-gg/shared-ui";import{jsx as a,jsxs as s}from"react/jsx-runtime";const w=[{key:"windowMs",title:"RECENT"},{key:"calls",title:"CALLS"},{key:"avgMs",title:"AVG"},{key:"maxMs",title:"MAX"},{key:"totalMs",title:"TOTAL"}];export const API_BADGE={timeout:{text:"TIMEOUT",color:"#38BDF8",prefix:"setTimeout"},interval:{text:"INTERVAL",color:"#22D3EE",prefix:"setInterval"},immediate:{text:"IMMED",color:"#60A5FA",prefix:"setImmediate"},raf:{text:"RAF",color:"#34D399",prefix:"requestAnimationFrame"},microtask:{text:"MICRO",color:"#A78BFA",prefix:"queueMicrotask"},then:{text:"PROMISE",color:"#BF5AF2",prefix:"Promise.then"},bridge:{text:"BRIDGE",color:"#FBBF24",prefix:"bridge"},unattributed:{text:"SYSTEM",color:"#8E8E93"},other:{text:"OTHER",color:"#8E8E93",prefix:"other"}};export function badgeFor(t){return API_BADGE[t]??API_BADGE.other}export function displayName(t){if(t.api==="unattributed")return"events \xB7 React \xB7 native call-ins";if(t.api==="other")return t.key==="minor"?t.label:"evicted cold origins";const e=badgeFor(t.api).prefix;let i=t.label;if(e&&i.startsWith(e))i=i.slice(e.length);i=i.replace(/^[\s←@]+/,"").trim();return i.length>0?i:"anonymous"}function h(t){if(t>=1e4)return`${Math.round(t/1e3)}k`;if(t>=1e3)return`${(t/1e3).toFixed(1)}k`;if(t>=100)return`${Math.round(t)}`;return`${Math.round(t*10)/10}`}function S(t){if(t.calls<=0)return"measured by probe \xB7 not reachable from JS";return`${h(t.calls)} calls \xB7 avg ${h(t.avgMs)} \xB7 max ${h(t.maxMs)} \xB7 total ${h(t.totalMs)} ms`}const k=g(function t({row:e,rank:i,onPress:u}){const d=badgeFor(e.api);const n=u?b:f;return s(n,{style:o.row,testID:"buoy-jstop-row",...u?{onPress:()=>u(e),activeOpacity:.6}:{},children:[s(f,{style:o.topLine,children:[a(l,{style:o.rank,children:i}),a(f,{style:[o.badge,{borderColor:d.color,backgroundColor:`${d.color}1A`}],children:a(l,{style:[o.badgeText,{color:d.color}],children:d.text})}),a(l,{style:o.name,numberOfLines:1,testID:"buoy-jstop-row-name",children:displayName(e)}),e.freezes>0&&s(l,{style:[o.freezeBadge,e.worstFreezeMs>=100&&o.freezeBadgeSevere],children:["\u26A0 \xD7",e.freezes]}),s(l,{style:[o.windowMs,e.api!=="unattributed"&&e.pctOfBusy>=25&&{color:e.pctOfBusy>=50?p.semantic.error:p.semantic.warning}],children:[h(e.windowMs),a(l,{style:o.unit,children:" ms"})]}),s(l,{style:[o.pct,e.api==="unattributed"&&o.pctMuted],children:[Math.round(e.pctOfBusy),"%"]})]}),s(f,{style:o.subLine,children:[a(f,{style:o.barTrack,children:a(f,{style:[o.barFill,{width:`${Math.min(100,e.pctOfBusy)}%`,backgroundColor:d.color}]})}),a(l,{style:o.stats,numberOfLines:1,testID:"buoy-jstop-row-stats",children:S(e)})]})]})},(t,e)=>t.rank===e.rank&&t.onPress===e.onPress&&t.row.key===e.row.key&&t.row.windowMs===e.row.windowMs&&t.row.calls===e.row.calls&&t.row.maxMs===e.row.maxMs&&t.row.totalMs===e.row.totalMs&&t.row.pctOfBusy===e.row.pctOfBusy&&t.row.freezes===e.row.freezes&&t.row.worstFreezeMs===e.row.worstFreezeMs);export function TaskTable({rows:t,onSelectRow:e}){const[i,u]=x("windowMs");const d=i==="windowMs"?t:[...t].sort((n,y)=>y[i]-n[i]);return s(f,{style:c.root,children:[s(f,{style:c.sortRow,children:[a(l,{style:c.sortLabel,children:"SORT"}),w.map(n=>a(b,{onPress:()=>u(n.key),style:[c.sortChip,i===n.key&&c.sortChipOn],children:a(l,{style:[c.sortChipText,i===n.key&&c.sortChipTextOn],children:n.title})},n.key))]}),s(M,{style:c.body,children:[d.map((n,y)=>a(k,{row:n,rank:y+1,onPress:e},n.key)),d.length===0&&a(l,{style:c.empty,testID:"buoy-jstop-empty",children:"No tasks observed yet \u2014 interact with the app."})]})]})}const c=m.create({root:{flex:1,minHeight:0},sortRow:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:6,borderBottomWidth:1,borderBottomColor:r.color.border,backgroundColor:r.color.surface},sortLabel:{color:r.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginRight:2},sortChip:{borderWidth:1,borderColor:r.color.border,borderRadius:4,paddingHorizontal:7,paddingVertical:3},sortChipOn:{borderColor:r.color.accentBorderStrong,backgroundColor:r.color.accentSoft},sortChipText:{color:r.color.textTertiary,fontSize:9,fontWeight:"600",fontVariant:["tabular-nums"]},sortChipTextOn:{color:r.color.accent},body:{flex:1},empty:{color:r.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:24}});const o=m.create({row:{paddingHorizontal:10,paddingVertical:8,borderBottomWidth:m.hairlineWidth,borderBottomColor:r.color.border,gap:5},topLine:{flexDirection:"row",alignItems:"center",gap:6},rank:{width:16,color:r.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:4,paddingVertical:1},badgeText:{fontSize:8,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:r.color.text,fontSize:13,fontWeight:"500"},freezeBadge:{color:p.semantic.warning,fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},freezeBadgeSevere:{color:p.semantic.error},windowMs:{color:r.color.text,fontSize:13,fontWeight:"700",fontVariant:["tabular-nums"]},unit:{color:r.color.textTertiary,fontSize:10,fontWeight:"400"},pct:{width:38,textAlign:"right",color:r.color.textSecondary,fontSize:12,fontWeight:"600",fontVariant:["tabular-nums"]},pctMuted:{color:r.color.textTertiary},subLine:{flexDirection:"row",alignItems:"center",gap:8,paddingLeft:22},barTrack:{width:72,height:4,borderRadius:2,backgroundColor:r.color.fillSecondary,overflow:"hidden"},barFill:{height:4,borderRadius:2,opacity:.85},stats:{flex:1,color:r.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]}});
1
+ "use strict";import{memo as g,useState as x}from"react";import{ScrollView as M,StyleSheet as m,Text as l,TouchableOpacity as b,View as f}from"react-native";import{macOSColors as p,night as r}from"@buoy-gg/shared-ui";import{jsx as a,jsxs as s}from"react/jsx-runtime";const w=[{key:"windowMs",title:"RECENT"},{key:"calls",title:"CALLS"},{key:"avgMs",title:"AVG"},{key:"maxMs",title:"MAX"},{key:"totalMs",title:"TOTAL"}];export const API_BADGE={timeout:{text:"TIMEOUT",color:"#38BDF8",prefix:"setTimeout"},interval:{text:"INTERVAL",color:"#22D3EE",prefix:"setInterval"},immediate:{text:"IMMED",color:"#60A5FA",prefix:"setImmediate"},raf:{text:"RAF",color:"#34D399",prefix:"requestAnimationFrame"},microtask:{text:"MICRO",color:"#A78BFA",prefix:"queueMicrotask"},then:{text:"PROMISE",color:"#BF5AF2",prefix:"Promise.then"},bridge:{text:"BRIDGE",color:"#FBBF24",prefix:"bridge"},unattributed:{text:"SYSTEM",color:"#8E8E93"},other:{text:"OTHER",color:"#8E8E93",prefix:"other"}};export function badgeFor(t){return API_BADGE[t]??API_BADGE.other}export function displayName(t){if(t.api==="unattributed")return"events \xB7 React \xB7 native call-ins";if(t.api==="other")return t.key==="minor"?t.label:"evicted cold origins";const e=badgeFor(t.api).prefix;let i=t.label;if(e&&i.startsWith(e))i=i.slice(e.length);i=i.replace(/^[\s←@]+/,"").trim();return i.length>0?i:"anonymous"}function h(t){if(t>=1e4)return`${Math.round(t/1e3)}k`;if(t>=1e3)return`${(t/1e3).toFixed(1)}k`;if(t>=100)return`${Math.round(t)}`;return`${Math.round(t*10)/10}`}function S(t){if(t.calls<=0)return"measured by probe \xB7 not reachable from JS";return`${h(t.calls)} calls \xB7 avg ${h(t.avgMs)} \xB7 max ${h(t.maxMs)} \xB7 total ${h(t.totalMs)} ms`}const k=g(function t({row:e,rank:i,onPress:u}){const d=badgeFor(e.api);const n=u?b:f;return s(n,{style:o.row,testID:"buoy-jstop-row",...u?{onPress:()=>u(e),activeOpacity:.6}:{},children:[s(f,{style:o.topLine,children:[a(l,{style:o.rank,children:i}),a(f,{style:[o.badge,{borderColor:d.color,backgroundColor:`${d.color}1A`}],children:a(l,{style:[o.badgeText,{color:d.color}],children:d.text})}),a(l,{style:o.name,numberOfLines:1,testID:"buoy-jstop-row-name",children:displayName(e)}),e.freezes>0&&s(l,{style:[o.freezeBadge,e.worstFreezeMs>=100&&o.freezeBadgeSevere],children:["\u26A0 \xD7",e.freezes]}),s(l,{style:[o.windowMs,e.api!=="unattributed"&&e.pctOfBusy>=25&&{color:e.pctOfBusy>=50?p.semantic.error:p.semantic.warning}],children:[h(e.windowMs),a(l,{style:o.unit,children:" ms"})]}),s(l,{style:[o.pct,e.api==="unattributed"&&o.pctMuted],children:[Math.round(e.pctOfBusy),"%"]})]}),s(f,{style:o.subLine,children:[a(f,{style:o.barTrack,children:a(f,{style:[o.barFill,{width:`${Math.min(100,e.pctOfBusy)}%`,backgroundColor:d.color}]})}),a(l,{style:o.stats,numberOfLines:1,testID:"buoy-jstop-row-stats",children:S(e)})]})]})},(t,e)=>t.rank===e.rank&&t.onPress===e.onPress&&t.row.key===e.row.key&&t.row.windowMs===e.row.windowMs&&t.row.calls===e.row.calls&&t.row.maxMs===e.row.maxMs&&t.row.totalMs===e.row.totalMs&&t.row.pctOfBusy===e.row.pctOfBusy&&t.row.freezes===e.row.freezes&&t.row.worstFreezeMs===e.row.worstFreezeMs);export function TaskTable({rows:t,onSelectRow:e}){const[i,u]=x("windowMs");const d=i==="windowMs"?t:[...t].sort((n,y)=>y[i]-n[i]);return s(f,{style:c.root,children:[s(f,{style:c.sortRow,children:[a(l,{style:c.sortLabel,children:"SORT"}),w.map(n=>a(b,{onPress:()=>u(n.key),style:[c.sortChip,i===n.key&&c.sortChipOn],children:a(l,{style:[c.sortChipText,i===n.key&&c.sortChipTextOn],children:n.title})},n.key))]}),s(M,{keyboardShouldPersistTaps:"handled",style:c.body,children:[d.map((n,y)=>a(k,{row:n,rank:y+1,onPress:e},n.key)),d.length===0&&a(l,{style:c.empty,testID:"buoy-jstop-empty",children:"No tasks observed yet \u2014 interact with the app."})]})]})}const c=m.create({root:{flex:1,minHeight:0},sortRow:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:6,borderBottomWidth:1,borderBottomColor:r.color.border,backgroundColor:r.color.surface},sortLabel:{color:r.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginRight:2},sortChip:{borderWidth:1,borderColor:r.color.border,borderRadius:4,paddingHorizontal:7,paddingVertical:3},sortChipOn:{borderColor:r.color.accentBorderStrong,backgroundColor:r.color.accentSoft},sortChipText:{color:r.color.textTertiary,fontSize:9,fontWeight:"600",fontVariant:["tabular-nums"]},sortChipTextOn:{color:r.color.accent},body:{flex:1},empty:{color:r.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:24}});const o=m.create({row:{paddingHorizontal:10,paddingVertical:8,borderBottomWidth:m.hairlineWidth,borderBottomColor:r.color.border,gap:5},topLine:{flexDirection:"row",alignItems:"center",gap:6},rank:{width:16,color:r.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:4,paddingVertical:1},badgeText:{fontSize:8,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:r.color.text,fontSize:13,fontWeight:"500"},freezeBadge:{color:p.semantic.warning,fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},freezeBadgeSevere:{color:p.semantic.error},windowMs:{color:r.color.text,fontSize:13,fontWeight:"700",fontVariant:["tabular-nums"]},unit:{color:r.color.textTertiary,fontSize:10,fontWeight:"400"},pct:{width:38,textAlign:"right",color:r.color.textSecondary,fontSize:12,fontWeight:"600",fontVariant:["tabular-nums"]},pctMuted:{color:r.color.textTertiary},subLine:{flexDirection:"row",alignItems:"center",gap:8,paddingLeft:22},barTrack:{width:72,height:4,borderRadius:2,backgroundColor:r.color.fillSecondary,overflow:"hidden"},barFill:{height:4,borderRadius:2,opacity:.85},stats:{flex:1,color:r.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]}});
package/lib/web/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- "use client";var Ee=Object.defineProperty;var Br=Object.getOwnPropertyDescriptor;var Or=Object.getOwnPropertyNames;var Ir=Object.prototype.hasOwnProperty;var s=(e,t)=>Ee(e,"name",{value:t,configurable:true});var Pr=(e,t)=>{for(var r in t)Ee(e,r,{get:t[r],enumerable:true})},ut=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Or(t))!Ir.call(e,n)&&n!==r&&Ee(e,n,{get:()=>t[n],enumerable:!(o=Br(t,n))||o.enumerable});return e},Fr=(e,t,r)=>(ut(e,t,"default"),r&&ut(r,t,"default"));var re=(()=>{try{let e=globalThis.Capacitor;if(e&&typeof e.isNativePlatform=="function"&&e.isNativePlatform())return e.DEBUG===true}catch{}return process.env.NODE_ENV!=="production"})();typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);var he=typeof globalThis<"u"?globalThis:void 0,Lr=(()=>{if(typeof he?.nativePerformanceNow=="function"){let e=he.nativePerformanceNow;return()=>e()}if(typeof he?.performance?.now=="function"){let e=he.performance;return()=>e.now()}return()=>Date.now()})(),$r=Lr;function P(){return $r()}s(P,"now");var p=typeof globalThis<"u"?globalThis:{},ct=false;function H(){return ct}s(H,"isActive");function oe(e){ct=e}s(oe,"setActive");var ze=null;function fe(){return ze||(ze={setTimeout:p.setTimeout?.bind(p),setInterval:p.setInterval?.bind(p),clearInterval:p.clearInterval?.bind(p),clearTimeout:p.clearTimeout?.bind(p),setImmediate:p.setImmediate?.bind(p),requestAnimationFrame:p.requestAnimationFrame?.bind(p),queueMicrotask:p.queueMicrotask?.bind(p)}),ze}s(fe,"captureOriginals");function ne(){return fe()}s(ne,"getOriginals");var T=Symbol.for("buoy.jsTop.patched"),dt=Symbol.for("buoy.jsTop.wrapped");var U=new Float64Array(120),ae=new Float64Array(120),Re=new Float64Array(120),q=new Float64Array(120).fill(-1);function L(e){return Math.floor(e/250)}s(L,"epochOf");function ht(e){let t=e%120;return q[t]!==e&&(q[t]=e,U[t]=0,ae[t]=0,Re[t]=0),t}s(ht,"slotFor");function me(e,t,r){if(!(t>e))return;let o=Math.max(e,t-3e4),n=L(o),a=L(t),i=o;for(;n<=a;){let l=(n+1)*250,c=Math.min(t,l),d=c-i;d>0&&r(ht(n),d),i=c,n++}}s(me,"distribute");function ft(e,t){me(e,t,(r,o)=>{U[r]=Math.min(250,U[r]+o)})}s(ft,"bookBusyRange");function mt(e,t,r){let o=t-e;if(!(o>0)||!(r>0))return;let n=Math.min(1,r/o);me(e,t,(a,i)=>{ae[a]=Math.min(250,ae[a]+i*n)})}s(mt,"bookAttributedRange");function pt(e,t){me(e,t,(r,o)=>{Re[r]=Math.min(250,Re[r]+o)})}s(pt,"bookLongtaskRange");function Be(e,t,r){let o=L(t),n=0;for(let a=o-r+1;a<=o;a++){let i=a%120;i>=0&&q[i]===a&&(n+=e[i])}return n}s(Be,"sumWindow");function Oe(e){return Be(U,e,20)}s(Oe,"windowBusyMs");function bt(e){return Be(ae,e,20)}s(bt,"windowAttributedMs");function gt(e){let t=L(e),r=[];for(let o=t-20+1;o<=t;o++){let n=o%120;n>=0&&q[n]===o?r.push(Math.max(0,Math.round((U[n]-ae[n])*10)/10)):r.push(0)}return r}s(gt,"windowResidualBuckets");function yt(e){let t=L(e),r=[];for(let n=t-120+1;n<=t;n++){let a=n%120;a>=0&&q[a]===n?r.push(Math.round(U[a]/250*100)):r.push(0)}let o=0;for(;o<r.length&&r[o]===0;)o++;return r.slice(Math.max(0,Math.min(o,r.length-1)))}s(yt,"busyHistory");function wt(){q.fill(-1)}s(wt,"resetAggregator");import{buoyFetch as xt}from"@buoy-gg/shared-ui/web";var Dr=3,Ie=0;function St(){return typeof re<"u"&&re}s(St,"isDev");var jr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wr=new Map([...jr].map((e,t)=>[e,t]));function Mt(e){let t=[],r=0,o=0,n=0,a=0;for(let i of e.split(";")){let l=[],c=0;for(let d of i.split(",")){if(!d)continue;let u=[],b=0,m=0;for(let g of d){let v=Wr.get(g);if(v===void 0)break;b+=(v&31)<<m,v&32?m+=5:(u.push(b&1?-(b>>1):b>>1),b=0,m=0)}u.length&&(c+=u[0],u.length===1?l.push([c]):u.length>=4&&(r+=u[1],o+=u[2],n+=u[3],u.length>=5?(a+=u[4],l.push([c,r,o,n,a])):l.push([c,r,o,n])))}t.push(l)}return t}s(Mt,"decodeMappings");function vt(e,t,r){let o=e.lines[t-1];if(!o?.length)return null;let n;for(let i of o)if(i[0]<=r-1)n=i;else break;if(!n||n.length<4)return null;let a=e.sources[n[1]];return a?{file:a,line:n[2]+1,name:n.length>=5?e.names[n[4]]:void 0}:null}s(vt,"lookup");var kt=new Map;function Tt(e){let t=kt.get(e);return t||(t=(async()=>{let r=await(await xt(e)).text(),o=Math.max(r.lastIndexOf("//# sourceMappingURL="),r.lastIndexOf("//@ sourceMappingURL="));if(o<0)return null;let n=/^\/\/[#@]\s*sourceMappingURL=(\S+)/.exec(r.slice(o));if(!n)return null;let a=new URL(n[1],e).href,i=await(await xt(a)).json();return!i.mappings||!i.sources?null:{sources:i.sources,names:i.names??[],lines:Mt(i.mappings)}})().catch(()=>null),kt.set(e,t)),t}s(Tt,"loadMap");function Ct(e){return(e.split("?")[0]??e).split("/").filter(Boolean).slice(-2).join("/")}s(Ct,"tailPath");function At(e){return/^[A-Z][A-Za-z0-9]*$/.test(e)}s(At,"looksLikeComponent");function Et(e,t){if(!St()||e.symbolicated||!e.frames||e.frames.length===0||Ie>=Dr)return;e.symbolicated=true;let r=e.frames.filter(o=>/^(https?|capacitor|file):\/\//.test(o.file));r.length&&(Ie++,(async()=>{for(let o of r){let n=await Tt(o.file.split("?")[0]??o.file);if(!n)continue;let a=vt(n,o.line,o.col);if(!a||a.file.includes("node_modules"))continue;let i=Ct(a.file);e.file=i,e.line=a.line;let l=`${i.split("/").pop()}:${a.line}`;a.name&&At(a.name)&&!e.caller?(e.caller=a.name,e.label=`${e.label} \u2190 <${a.name}> \xB7 ${l}`):e.label=`${e.label} \xB7 ${l}`;return}})().catch(()=>{}).finally(()=>{Ie--}))}s(Et,"buoyJsTopSymbolicateOrigin");var Hr=500,Vr=20,C=new Map,zt="other",Rt=0,Pe=0;function pe(e,t,r){return{key:e,api:t,label:r,calls:0,totalMs:0,maxMs:0,scheduleCount:0,lastSeenAt:0,promoted:false,lastCaptureAt:0,ring:new Float64Array(20),ringStamps:new Float64Array(20).fill(-1)}}s(pe,"makeOrigin");function Fe(e,t){let r=L(t),o=0;for(let n=r-20+1;n<=r;n++){let a=n%20;a>=0&&e.ringStamps[a]===n&&(o+=e.ring[a])}return o}s(Fe,"windowMsOf");function Le(e){let t=null,r=1/0;for(let n of C.values()){if(n.key===zt)continue;let a=Fe(n,e)*1e6+n.lastSeenAt;a<r&&(r=a,t=n)}if(!t)return false;let o=Bt(zt,"other","other (evicted origins)");return o.calls+=t.calls,o.totalMs+=t.totalMs,o.maxMs=Math.max(o.maxMs,t.maxMs),o.lastSeenAt=Math.max(o.lastSeenAt,t.lastSeenAt),C.delete(t.key),true}s(Le,"evictColdest");function Bt(e,t,r){let o=C.get(e);return o||(o=pe(e,t,r),C.set(e,o)),o}s(Bt,"getOrCreate");function Ot(e){let t=[],r,o=e.split(`
2
- `);for(let n of o){let a=/at\s+(.*?)\s+\((?:address at\s+)?(.*?):(\d+):(\d+)\)/.exec(n)??/at\s+()(.*?):(\d+):(\d+)$/.exec(n.trim())??/^([^@\s]*)@(.+?):(\d+):(\d+)$/.exec(n.trim());if(!a)continue;let i=a[1]??"";if(i.includes("buoyJsTop")||i==="Error"||a[2]?.includes("/js-top/"))continue;t.push({file:a[2]??"",line:Number(a[3]),col:Number(a[4])});let l=/^(react_stack_bottom_frame|runWithFiberInDEV|commitHookEffectList|flushPassive|performWork|renderWithHooks|safelyCall)/.test(i)||/^(then|catch|finally|resolve|reject|fulfilled|rejected|step|tryCallOne|tryCallTwo|tryCatch|invokeCallback|notify)$/.test(i);if(!r&&i&&i!=="anonymous"&&!l&&(r=i),t.length>=3)break}return{caller:r,frames:t}}s(Ot,"parseStack");function It(e,t){return t-e.lastCaptureAt<Hr||(t-Rt>1e3&&(Rt=t,Pe=0),Pe>=Vr)?false:(Pe++,e.lastCaptureAt=t,true)}s(It,"allowCapture");function be(e){if(!e)return;let t=(e.split("?")[0]??e).replace(/\/\/&.*$/,""),r=/^[a-z]+:\/\/[^/]+\/(.*)$/.exec(t);return(r?r[1]:t).split("/").slice(-2).join("/")}s(be,"shortFile");function Pt(e){return C.has(e)}s(Pt,"buoyJsTopOriginExists");function ge(e,t,r,o=true){let n=t,a=typeof n.displayName=="string"&&n.displayName||typeof n.name=="string"&&n.name||"anonymous",i=`${e}|${a}`,l=C.get(i);if(l?.activeRefinedKey&&!C.has(l.activeRefinedKey)&&(l.activeRefinedKey=void 0),!l){for(;C.size>=500&&Le(r););l=pe(i,e,a==="anonymous"?_(e):`${_(e)} ${a}`),C.set(i,l)}if(l.scheduleCount++,!l.promoted&&(l.scheduleCount>=25||l.totalMs>=50)&&(l.promoted=true),(l.promoted||e==="interval")&&o&&It(l,r)){let{caller:c,frames:d}=Ot(new Error().stack??""),u=d[0];if(u||c){let b=u?`${be(u.file)??"?"}:${u.line}`:"?",m=`${i}@${c??"?"}:${b}`,g=C.get(m);if(!g){for(;C.size>=500&&Le(r););let v=a==="anonymous"?_(e):`${_(e)} ${a}`;g=pe(m,e,c?`${v} \u2190 ${c}`:a==="anonymous"?`${v} @ ${be(u?.file??"")??"?"}`:v),g.caller=c,g.file=u?be(u.file):void 0,g.line=u?.line,g.frames=d,g.promoted=true,g.calls=l.calls,g.totalMs=l.totalMs,g.maxMs=l.maxMs,g.scheduleCount=l.scheduleCount,g.lastSeenAt=l.lastSeenAt,g.ring.set(l.ring),g.ringStamps.set(l.ringStamps),l.calls=0,l.totalMs=0,l.maxMs=0,l.ring.fill(0),l.ringStamps.fill(-1),C.set(m,g),Et(g,_(e))}l.activeRefinedKey=m}}return l.activeRefinedKey??i}s(ge,"buoyJsTopScheduleOrigin");function _(e){switch(e){case"timeout":return"setTimeout";case"interval":return"setInterval";case"immediate":return"setImmediate";case"raf":return"requestAnimationFrame";case"microtask":return"queueMicrotask";case"then":return"Promise.then";case"bridge":return"bridge";default:return e}}s(_,"apiLabel");function Ft(e,t,r,o){let n=C.get(e);if(!n)return;n.calls++,n.totalMs+=t,t>n.maxMs&&(n.maxMs=t),n.lastSeenAt=o,!n.promoted&&n.totalMs>=50&&(n.promoted=true);let a=o-r,i=a>0?Math.min(1,t/a):1,l=Math.max(r,o-5e3),c=L(l),d=L(o),u=l;for(;c<=d;){let b=(c+1)*250,m=Math.min(o,b),g=m-u;if(g>0){let v=c%20;v>=0&&(n.ringStamps[v]!==c&&(n.ringStamps[v]=c,n.ring[v]=0),n.ring[v]+=a>0?g*i:t)}u=m,c++}mt(r,o,t)}s(Ft,"buoyJsTopBookExclusive");function Lt(e){return C.get(e)?.label??null}s(Lt,"labelForOrigin");function $t(e,t,r){let o=[];for(let i of C.values()){let l=Fe(i,e);l<=0&&i.totalMs<1||o.push({key:i.key,label:i.label,api:i.api,file:i.file,line:i.line,windowMs:Math.round(l*10)/10,pctOfBusy:t>0?Math.min(100,Math.round(l/t*1e3)/10):0,totalMs:Math.round(i.totalMs*10)/10,calls:i.calls,avgMs:i.calls>0?Math.round(i.totalMs/i.calls*100)/100:0,maxMs:Math.round(i.maxMs*100)/100,lastSeenAgoMs:i.lastSeenAt>0?Math.max(0,e-i.lastSeenAt):0,freezes:0,worstFreezeMs:0})}o.sort((i,l)=>l.windowMs-i.windowMs||l.totalMs-i.totalMs);let n=[],a=[];for(let i of o)(i.windowMs>=1||i.pctOfBusy>=.5||i.freezes>0?n:a).push(i);return a.length>=2?(n.push({key:"minor",label:`${a.length} minor origins (\u22641ms each)`,api:"other",windowMs:Math.round(a.reduce((i,l)=>i+l.windowMs,0)*10)/10,pctOfBusy:Math.round(a.reduce((i,l)=>i+l.pctOfBusy,0)*10)/10,totalMs:Math.round(a.reduce((i,l)=>i+l.totalMs,0)*10)/10,calls:a.reduce((i,l)=>i+l.calls,0),avgMs:0,maxMs:Math.max(0,...a.map(i=>i.maxMs)),lastSeenAgoMs:Math.min(...a.map(i=>i.lastSeenAgoMs)),freezes:0,worstFreezeMs:0}),n.slice(0,r)):o.slice(0,r)}s($t,"buildRows");function Dt(e,t,r){let o=C.get(e);if(!o)return null;let n=L(t),a=[],i=0;for(let l=n-20+1;l<=n;l++){let c=l%20,d=c>=0&&o.ringStamps[c]===l?Math.round(o.ring[c]*10)/10:0;a.push(d),i+=d}return{key:o.key,label:o.label,api:o.api,caller:o.caller,file:o.file,line:o.line,frames:o.frames,promoted:o.promoted,scheduleCount:o.scheduleCount,calls:o.calls,totalMs:Math.round(o.totalMs*10)/10,avgMs:o.calls>0?Math.round(o.totalMs/o.calls*100)/100:0,maxMs:Math.round(o.maxMs*100)/100,windowMs:Math.round(i*10)/10,pctOfBusy:r>0?Math.min(100,Math.round(i/r*1e3)/10):0,lastSeenAgoMs:o.lastSeenAt>0?Math.max(0,t-o.lastSeenAt):0,buckets:a}}s(Dt,"getOriginDetailBase");function jt(){C.clear()}s(jt,"resetOrigins");var Nr=32,Q=[],Jr=20,Wt=64,Ht=new Array(Wt).fill(null),$e=0;function Vt(){return Ht}s(Vt,"recentIntervals");function De(e,t){let r=P(),o=Q.length>0?Q[Q.length-1]:null,n=null;Q.length<Nr&&(n={originKey:e,start:r,childrenMs:0},Q.push(n));try{return t()}finally{try{if(n){Q.pop();let a=P(),i=a-r,l=Math.max(0,i-n.childrenMs);o&&(o.childrenMs+=i),Ft(e,l,r,a),!o&&i>=Jr&&(Ht[$e]={originKey:e,start:r,end:a},$e=($e+1)%Wt)}}catch{}}}s(De,"buoyJsTopRunFrame");function J(e,t){if(typeof e!="function"||e[dt])return e;let r=H()?ge(t,e,P()):null,o=s(function(...n){return H()?((r===null||!Pt(r))&&(r=ge(t,e,P(),false)),De(r,()=>e.apply(this,n))):e.apply(this,n)},"buoyJsTopTaskWrapper");return o[dt]=true,o}s(J,"buoyJsTopWrapTask");function je(e,t,r){if(!H())return r();let o=ge(e,{name:t},P());return De(o,r)}s(je,"buoyJsTopRunAs");function We(){let e=fe();if(typeof p.setTimeout=="function"&&!p.setTimeout[T]){let t=s(function(r,o,...n){let a=J(r,"timeout");return e.setTimeout(a,o,...n)},"buoyJsTopSetTimeout");t[T]=true,p.setTimeout=t}if(typeof p.setInterval=="function"&&!p.setInterval[T]){let t=s(function(r,o,...n){let a=J(r,"interval");return e.setInterval(a,o,...n)},"buoyJsTopSetInterval");t[T]=true,p.setInterval=t}if(typeof p.setImmediate=="function"&&!p.setImmediate[T]&&e.setImmediate){let t=s(function(r,...o){let n=J(r,"immediate");return e.setImmediate(n,...o)},"buoyJsTopSetImmediate");t[T]=true,p.setImmediate=t}if(typeof p.requestAnimationFrame=="function"&&!p.requestAnimationFrame[T]&&e.requestAnimationFrame){let t=s(function(r){let o=J(r,"raf");return e.requestAnimationFrame(o)},"buoyJsTopRequestAnimationFrame");t[T]=true,p.requestAnimationFrame=t}}s(We,"installTimerPatches");function He(){let e=fe();if(typeof p.queueMicrotask=="function"&&!p.queueMicrotask[T]&&e.queueMicrotask){let t=s(function(r){let o=J(r,"microtask");return e.queueMicrotask(o)},"buoyJsTopQueueMicrotask");t[T]=true,p.queueMicrotask=t}}s(He,"installMicrotaskPatches");var Ve=16,Kr=100,Ur=3,qr=8,ie=null,se=0,ye=false,le=[],G=1/0,Y=0,Ne=Ve;function Nt(){let e=P(),t=se>0?e-se:0;if(se=e,ye){ye=false,G=1/0,Y=e;return}if(t<=0)return;t<Kr&&(t<G&&(G=t),Y===0&&(Y=e),e-Y>=1e3&&(le.push(G),le.length>Ur&&le.shift(),Ne=Math.max(qr,Math.min(...le)),G=1/0,Y=e));let r=t-Ne;r>1&&ft(e-r,e)}s(Nt,"buoyJsTopProbeTick");function Je(){if(ie!=null)return;let e=ne();se=P(),ye=false,le=[],G=1/0,Y=0,Ne=Ve,ie=e.setInterval(Nt,Ve)}s(Je,"startBusyProbe");function Ke(){ie!=null&&(ne().clearInterval(ie),ie=null),se=0}s(Ke,"stopBusyProbe");function Jt(){ye=true}s(Jt,"suppressNextGap");import{definePersistedSetting as _r}from"@buoy-gg/shared-ui/web";var Qr="@react_buoy/js-top/prefs",Gr={enabled:false},Kt=_r(Qr,Gr,{sanitize:s(e=>({enabled:e.enabled===true}),"sanitize")});async function Ut(){return Kt.load()}s(Ut,"loadJsTopPrefs");async function qt(e){await Kt.save(e)}s(qt,"saveJsTopPrefs");import{subscribeRealAppState as Yr}from"@buoy-gg/shared-ui/web";var Zr=250,_t=class Vn{constructor(){this.enabled=false;this.enabledLoaded=false;this.paused=false;this.pausedAt=0;this.remoteSampling=false;this.engineRunning=false;this.tiers={timers:false,promises:false,bridge:false,longtask:false};this.notifyHandle=null;this.appStateSub=null;this.snapshot=this.buildSnapshot();this.subscribers=new Set;this.enabledSubscribers=new Set;this.tierInstallers=[];this.longtaskProvider=null;this.freezeStatsProvider=null;this.clearHooks=[];Ut().then(t=>{this.enabledLoaded=true,t.enabled&&!this.enabled&&this.setEnabled(true)})}subscribe(t){return this.subscribers.add(t),this.syncEngineState(),t(this.snapshot),()=>{this.subscribers.delete(t),this.syncEngineState()}}subscribeEnabled(t){return this.enabledSubscribers.add(t),t(this.enabled),()=>{this.enabledSubscribers.delete(t)}}setEnabled(t){this.enabled!==t&&(this.enabled=t,this.enabledLoaded&&qt({enabled:t}),this.enabledSubscribers.forEach(r=>{try{r(t)}catch(o){re&&console.error("[Buoy]","[js-top] enabled subscriber threw",o)}}),this.syncEngineState())}isEnabled(){return this.enabled}setRemoteSampling(t){this.remoteSampling!==t&&(this.remoteSampling=t,this.syncEngineState())}isRemoteSampling(){return this.remoteSampling}getStatus(){return this.engineRunning?this.paused?"paused":"running":"disabled"}pause(){this.paused||(this.paused=true,this.pausedAt=P(),oe(false),Ke(),this.emitSnapshot())}resume(){this.paused&&(this.paused=false,this.engineRunning&&(oe(true),Je()),this.emitSnapshot())}clear(){jt(),wt();for(let t of this.clearHooks)try{t()}catch{}this.emitSnapshot()}registerClearHook(t){this.clearHooks.push(t)}getSnapshot(){return this.snapshot}getOriginDetail(t){let r=P(),o=Oe(r),n=this.freezeStatsProvider?.(Date.now())?.byOrigin[t];if(t==="unattributed"){let i=gt(r),l=Math.round(i.reduce((c,d)=>c+d,0)*10)/10;return{key:t,label:"unattributed (events / React / native call-ins)",api:"unattributed",promoted:false,scheduleCount:0,calls:0,totalMs:0,avgMs:0,maxMs:0,windowMs:l,pctOfBusy:o>0?Math.min(100,Math.round(l/o*1e3)/10):0,lastSeenAgoMs:0,buckets:i,freezes:n?.count??0,worstFreezeMs:Math.round(n?.maxMs??0)}}let a=Dt(t,r,o);return a?{...a,freezes:n?.count??0,worstFreezeMs:Math.round(n?.maxMs??0)}:null}registerTierInstaller(t){this.tierInstallers.push(t),this.engineRunning&&Object.assign(this.tiers,this.runInstaller(t))}registerLongtaskProvider(t){this.longtaskProvider=t}registerFreezeStatsProvider(t){this.freezeStatsProvider=t}shouldRun(){return this.subscribers.size>0||this.remoteSampling}syncEngineState(){let t=this.shouldRun();t&&!this.engineRunning?this.startEngine():!t&&this.engineRunning&&this.stopEngine()}runInstaller(t){try{return t()}catch(r){return re&&console.error("[Buoy]","[js-top] tier installer threw",r),{}}}startEngine(){this.engineRunning=true,We(),He(),this.tiers={timers:true,promises:false,bridge:false,longtask:false};for(let t of this.tierInstallers)Object.assign(this.tiers,this.runInstaller(t));oe(!this.paused),this.paused||Je();try{this.appStateSub=Yr(()=>{Jt()})}catch{this.appStateSub=null}this.notifyHandle=ne().setInterval(()=>this.emitSnapshot(),Zr),this.emitSnapshot()}stopEngine(){if(this.engineRunning=false,oe(false),Ke(),this.notifyHandle!=null&&(ne().clearInterval(this.notifyHandle),this.notifyHandle=null),this.appStateSub){try{this.appStateSub.remove()}catch{}this.appStateSub=null}}buildSnapshot(){let t=this.paused?this.pausedAt:P(),r=Oe(t),o=bt(t),n=Math.max(0,r-o),a=$t(t,r,30);n>=1&&(a.push({key:"unattributed",label:"unattributed (events / React / native call-ins)",api:"unattributed",windowMs:Math.round(n*10)/10,pctOfBusy:r>0?Math.min(100,Math.round(n/r*1e3)/10):0,totalMs:0,calls:0,avgMs:0,maxMs:0,lastSeenAgoMs:0,freezes:0,worstFreezeMs:0}),a.sort((c,d)=>d.windowMs-c.windowMs||d.totalMs-c.totalMs));let i=this.freezeStatsProvider?.(Date.now())??{count:0,worstMs:0,byOrigin:{}};for(let c of a){let d=i.byOrigin[c.key];d&&(c.freezes=d.count,c.worstFreezeMs=Math.round(d.maxMs))}let l=5e3;return{ts:Date.now(),paused:this.paused,busyPct:Math.min(100,Math.round(r/l*1e3)/10),busyHistory:yt(t),tiers:{...this.tiers},rows:a,totals:{attributedWindowMs:Math.round(o*10)/10,unattributedWindowMs:Math.round(n*10)/10,windowMs:l},freezeSummary:{count:i.count,worstMs:Math.round(i.worstMs)},longtasks:this.longtaskProvider?this.longtaskProvider():[]}}emitSnapshot(){this.snapshot=this.buildSnapshot(),this.subscribers.forEach(t=>{try{t(this.snapshot)}catch(r){re&&console.error("[Buoy]","[js-top] snapshot subscriber threw",r)}})}isEngineActive(){return H()}};s(_t,"JsTopControllerImpl");var Xr=_t,f=new Xr;function we(e,t){let r=e[t];if(typeof r!="function")return false;if(r[T])return true;let o=s(function(...n){for(let a=0;a<n.length;a++)typeof n[a]=="function"&&(n[a]=J(n[a],"then"));return r.apply(this,n)},"patched");return o[T]=true,Object.defineProperty(o,"name",{value:t,configurable:true}),e[t]=o,true}s(we,"patchMethod");function Qt(){let e=p.Promise?.prototype;if(!e)return{promises:false};let t=we(e,"then");return we(e,"catch"),we(e,"finally"),{promises:t}}s(Qt,"installPromisePatches");function Gt(){let e=p.__fbBatchedBridge;if(!e)return{bridge:false};let t=false;if(typeof e.callFunctionReturnFlushedQueue=="function"&&!e.callFunctionReturnFlushedQueue[T]){let o=e.callFunctionReturnFlushedQueue.bind(e),n=s(function(a,i,l){return H()?je("bridge",`${a}.${i}`,()=>o(a,i,l)):o(a,i,l)},"buoyJsTopCallFunction");n[T]=true,e.callFunctionReturnFlushedQueue=n,t=true}if(typeof e.invokeCallbackAndReturnFlushedQueue=="function"&&!e.invokeCallbackAndReturnFlushedQueue[T]){let o=e.invokeCallbackAndReturnFlushedQueue.bind(e),n=s(function(a,i){return H()?je("bridge","nativeModuleCallback",()=>o(a,i)):o(a,i)},"buoyJsTopInvokeCallback");n[T]=true,e.invokeCallbackAndReturnFlushedQueue=n,t=true}let r=e.callFunctionReturnFlushedQueue?.[T]===true;return{bridge:t||r}}s(Gt,"installBridgePatch");var eo=40,to=6e4,ro="unattributed",Yt=false,xe=false,Z=[];function Zt(e,t){let r=e+t,o=null,n=0;for(let a of Vt()){if(!a)continue;let i=Math.min(r,a.end)-Math.max(e,a.start);i>n&&(n=i,o=a.originKey)}return o}s(Zt,"correlate");function Xt(){if(Yt)return{longtask:xe};Yt=true;let e=p.PerformanceObserver;if(typeof e!="function")return{longtask:false};try{new e(t=>{if(H())try{for(let r of t.getEntries()){if(r.entryType!=="longtask")continue;let o=r.startTime,n=r.duration;pt(o,o+n),Z.push({start:o,duration:n,at:Date.now(),originKey:Zt(o,n)}),Z.length>eo&&Z.shift()}}catch{}}).observe({entryTypes:["longtask"]}),xe=true}catch{xe=false}return{longtask:xe}}s(Xt,"installLongtaskObserver");function er(){return Z.map(e=>({start:e.start,duration:e.duration,at:e.at,originLabel:e.originKey?Lt(e.originKey):null}))}s(er,"getLongtasks");function tr(e){let t={},r=0,o=0;for(let n of Z){if(n.at>0&&e-n.at>to)continue;r++,n.duration>o&&(o=n.duration);let a=n.originKey??ro,i=t[a];i?(i.count++,n.duration>i.maxMs&&(i.maxMs=n.duration)):t[a]={count:1,maxMs:n.duration}}return{count:r,worstMs:o,byOrigin:t}}s(tr,"getFreezeStats");function rr(){Z.length=0}s(rr,"clearLongtasks");var oo={version:1,getSnapshot:s(()=>({live:f.getSnapshot(),enabled:f.isEnabled()||f.isRemoteSampling()}),"getSnapshot"),subscribe:s(e=>{let t=f.subscribe(()=>e()),r=f.subscribeEnabled(()=>e());return()=>{t(),r()}},"subscribe"),actions:{setEnabled:s(e=>{let t=e.enabled;f.setRemoteSampling(t)},"setEnabled"),pause:s(()=>f.pause(),"pause"),resume:s(()=>f.resume(),"resume"),clear:s(()=>f.clear(),"clear"),getOriginDetail:s(e=>f.getOriginDetail(e.key),"getOriginDetail"),sample:s(async e=>{let t=e,r=Math.min(Math.max(t?.durationMs??3e3,250),3e4),o=f.isRemoteSampling()||f.isEnabled();o||f.setRemoteSampling(true),t?.clearFirst&&f.clear();try{return await new Promise(n=>setTimeout(n,r)),f.getSnapshot()}finally{o||f.setRemoteSampling(false)}},"sample")}};import{useCallback as no,useEffect as ao,useMemo as io,useState as or}from"react";var nr={};Pr(nr,{AccessibilityInfo:()=>co,ActivityIndicator:()=>mn,Alert:()=>gn,Animated:()=>sn,AppRegistry:()=>fo,AppState:()=>mo,Appearance:()=>ho,BackHandler:()=>po,Button:()=>pn,CheckBox:()=>Bo,Clipboard:()=>bo,DeviceEventEmitter:()=>qo,Dimensions:()=>go,Easing:()=>yo,FlatList:()=>Oo,I18nManager:()=>wo,Image:()=>Io,ImageBackground:()=>Po,InteractionManager:()=>So,Keyboard:()=>xo,KeyboardAvoidingView:()=>Fo,LayoutAnimation:()=>Mo,Linking:()=>vo,LogBox:()=>Uo,Modal:()=>hn,NativeEventEmitter:()=>ko,NativeModules:()=>uo,PanResponder:()=>To,Picker:()=>Lo,PixelRatio:()=>Co,Platform:()=>Ao,Pressable:()=>dn,ProgressBar:()=>$o,RefreshControl:()=>Do,SafeAreaView:()=>jo,ScrollView:()=>Qe,SectionList:()=>Wo,Share:()=>Eo,StatusBar:()=>Ho,StyleSheet:()=>V,Switch:()=>fn,Text:()=>h,TextInput:()=>ln,Touchable:()=>Vo,TouchableHighlight:()=>un,TouchableNativeFeedback:()=>No,TouchableOpacity:()=>ce,TouchableWithoutFeedback:()=>cn,UIManager:()=>zo,Vibration:()=>Ro,View:()=>y,VirtualizedList:()=>Jo,YellowBox:()=>Ko,findNodeHandle:()=>bn,unstable_createElement:()=>lo,useColorScheme:()=>_o,useLocaleContext:()=>Qo,useWindowDimensions:()=>Go});Fr(nr,so);import*as so from"react-native-web";import{unstable_createElement as lo,NativeModules as uo,AccessibilityInfo as co,Appearance as ho,AppRegistry as fo,AppState as mo,BackHandler as po,Clipboard as bo,Dimensions as go,Easing as yo,I18nManager as wo,Keyboard as xo,InteractionManager as So,LayoutAnimation as Mo,Linking as vo,NativeEventEmitter as ko,PanResponder as To,PixelRatio as Co,Platform as Ao,Share as Eo,UIManager as zo,Vibration as Ro,CheckBox as Bo,FlatList as Oo,Image as Io,ImageBackground as Po,KeyboardAvoidingView as Fo,Picker as Lo,ProgressBar as $o,RefreshControl as Do,SafeAreaView as jo,SectionList as Wo,StatusBar as Ho,Touchable as Vo,TouchableNativeFeedback as No,VirtualizedList as Jo,YellowBox as Ko,LogBox as Uo,DeviceEventEmitter as qo,useColorScheme as _o,useLocaleContext as Qo,useWindowDimensions as Go}from"react-native-web";import*as z from"react-native-web";import{createElement as Ue,forwardRef as ar,useCallback as Yo,useRef as Zo}from"react";import{useEffect as Xo,useState as en}from"react";import{createPortal as tn}from"react-dom";var rn='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';import{jsx as on}from"react/jsx-runtime";var ue=Symbol.for("@buoy-gg/portal-host"),ir=s(e=>{if(!(e instanceof Element))return false;if(e.closest("input, textarea, select"))return true;let t=e.closest("[contenteditable]")?.getAttribute("contenteditable")?.toLowerCase();return t===""||t==="true"||t==="plaintext-only"},"isTextField");function qe(){let e=document;if(e[ue])return e[ue].host;let t=document.createElement("div");t.dataset.buoyPortalHost="",Object.assign(t.style,{position:"fixed",inset:"0",zIndex:"2147483647",pointerEvents:"none",fontFamily:rn});let r=s(()=>{let u=document.fullscreenElement,b=u&&u.tagName!=="CANVAS"?u:document.body;t.parentElement!==b&&b.appendChild(t)},"move"),o=new Map,n=s(u=>{(!t.contains(u.target)||!ir(u.target))&&o.set(u.code||u.key,{key:u.key,code:u.code,location:u.location,keyCode:u.keyCode,which:u.which,altKey:u.altKey,ctrlKey:u.ctrlKey,metaKey:u.metaKey,shiftKey:u.shiftKey})},"down"),a=s(u=>{o.delete(u.code||u.key)},"up"),i=s(()=>o.clear(),"clear"),l=s(()=>{let u=[...o.values()];o.clear();for(let b of u)document.dispatchEvent(new KeyboardEvent("keyup",{...b,bubbles:true}))},"focus"),c=s(u=>{ir(u.target)&&u.stopPropagation()},"key"),d=s(u=>u.stopPropagation(),"wheel");return r(),document.addEventListener("fullscreenchange",r),document.addEventListener("keydown",n,true),document.addEventListener("keyup",a,true),window.addEventListener("blur",i),t.addEventListener("focusin",l),t.addEventListener("keydown",c),t.addEventListener("keyup",c),t.addEventListener("keypress",c),t.addEventListener("wheel",d,{passive:true}),e[ue]={host:t,users:0,dispose:s(()=>{document.removeEventListener("fullscreenchange",r),document.removeEventListener("keydown",n,true),document.removeEventListener("keyup",a,true),window.removeEventListener("blur",i),t.remove(),delete e[ue]},"dispose")},t}s(qe,"getBuoyPortalHost");function sr({children:e}){let[t,r]=en(null);return Xo(()=>{let o=qe(),n=document[ue];return n.users++,r(o),()=>{--n.users===0&&n.dispose()}},[]),t?tn(on("div",{"data-buoy-root":"",style:{display:"contents",pointerEvents:"auto"},children:e}),t):null}s(sr,"BuoyPortal");var X=z,nn=["shadowColor","shadowOffset","shadowOpacity","shadowRadius","textShadowColor","textShadowOffset","textShadowRadius"],ee=s(e=>typeof e=="number"?`${e}px`:e,"px");function Se(e){if(Array.isArray(e)){let b=e.map(Se);return b.some((m,g)=>m!==e[g])?b:e}if(!e||typeof e!="object"||!nn.some(b=>e[b]!=null))return e;let{shadowColor:t,shadowOffset:r,shadowOpacity:o,shadowRadius:n,textShadowColor:a,textShadowOffset:i,textShadowRadius:l,...c}=e;if(t!=null||r!=null||o!=null||n!=null){let b=t??"black",m=o==null?b:`color-mix(in srgb, ${b} ${Math.min(o,1)*100}%, transparent)`,g=`${ee(r?.width??0)} ${ee(r?.height??0)} ${ee(n??0)} ${m}`;c.boxShadow=typeof c.boxShadow=="string"?`${c.boxShadow}, ${g}`:c.boxShadow??g}let{width:d=0,height:u=0}=i??{};if(a&&(d||u||l)){let b=`${ee(d)} ${ee(u)} ${ee(l??0)} ${a}`;c.textShadow=c.textShadow?`${c.textShadow}, ${b}`:b}return c}s(Se,"webShadows");var an=X.StyleSheet.create({auto:{pointerEvents:"auto"},none:{pointerEvents:"none"},"box-none":{pointerEvents:"box-none"},"box-only":{pointerEvents:"box-only"}});function _e(e,t){if(typeof e=="function")return o=>_e(e(o),t);let r=Se(e);return t?[r,an[t]]:r}s(_e,"webStyle");var V={...X.StyleSheet,create:s(e=>X.StyleSheet.create(Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Se(r)]))),"create")};function B(e){let t=ar((o,n)=>{let{accessibilityState:a,accessibilityValue:i,pointerEvents:l,...c}=o;for(let u of["busy","checked","disabled","expanded","selected"])a?.[u]!==void 0&&c[`aria-${u}`]===void 0&&(c[`aria-${u}`]=a[u]);for(let[u,b]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[u]!==void 0&&c[`aria-${b}`]===void 0&&(c[`aria-${b}`]=i[u]);let d=_e(c.style,l);return d!==c.style&&(c.style=d),Ue(e,{...c,ref:n})}),r=e.State;return r&&Object.assign(t,{State:r}),t.displayName=e.displayName??e.name??"NativeWebView",t}s(B,"withAccessibility");var y=B(z.View),h=B(z.Text),sn={...X.Animated,View:X.Animated.createAnimatedComponent(y),Text:X.Animated.createAnimatedComponent(h)},ln=B(z.TextInput),ce=B(z.TouchableOpacity),un=B(z.TouchableHighlight),cn=B(z.TouchableWithoutFeedback),dn=B(z.Pressable),Qe=B(z.ScrollView),lr=ar((e,t)=>{let r=Zo(null),o=Yo(n=>{if(n){let a=n;for(;a.parentElement&&a.parentElement!==document.body;)a=a.parentElement;a.parentElement===document.body&&(r.current=a,Object.assign(a.style,{position:"relative",zIndex:"2147483647",pointerEvents:"auto"}),qe().appendChild(a))}else r.current&&(document.body.appendChild(r.current),r.current=null);typeof t=="function"?t(n):t&&(t.current=n)},[t]);return Ue(sr,null,Ue(z.Modal,{...e,ref:o}))});lr.displayName="Modal";var hn=B(lr),fn=B(z.Switch),mn=B(z.ActivityIndicator),pn=B(z.Button),bn=z.findNodeHandle,gn={alert(e,t,r,o){if(typeof document>"u")return;let n=document.createElement("dialog");n.dataset.buoyRoot="",n.setAttribute("aria-label",e),n.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let a=document.createElement("h2");if(a.textContent=e,a.style.cssText="font-size:18px;margin:0 0 12px",n.appendChild(a),t){let d=document.createElement("p");d.textContent=t,d.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",n.appendChild(d)}let i=document.createElement("div");i.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let l=r?.length?r:[{text:"OK"}],c=s(()=>{n.close?.(),n.remove()},"close");for(let d of l){let u=document.createElement("button");u.type="button",u.textContent=d.text??"OK",u.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${d.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,u.onclick=()=>{c(),d.onPress?.()},i.appendChild(u)}n.addEventListener("cancel",d=>{d.preventDefault(),o?.cancelable!==false&&(c(),o?.onDismiss?.())}),n.appendChild(i),document.body.appendChild(n),n.showModal?n.showModal():n.setAttribute("open","")}};import{Activity as yn,JsModal as wn,macOSColors as F,night as R,ModalHeader as de,Pause as xn,Play as Sn,Trash2 as Mn}from"@buoy-gg/shared-ui/web";import{memo as vn}from"react";import{macOSColors as Ge}from"@buoy-gg/shared-ui/web";import{jsx as ur}from"react/jsx-runtime";var kn=60;function cr(e){return e>=80?Ge.semantic.error:e>=40?Ge.semantic.warning:Ge.semantic.success}s(cr,"barColor");var Tn=vn(s(function({history:e}){let t=e.slice(-kn);return ur(y,{style:dr.row,pointerEvents:"none",children:t.map((r,o)=>ur(y,{style:[dr.bar,{height:Math.max(2,r/100*28),backgroundColor:cr(r)}]},`b${o}`))})},"BusySparkline")),dr=V.create({row:{flexDirection:"row",alignItems:"flex-end",gap:1,height:28,alignSelf:"stretch"},bar:{flex:1,maxWidth:6,borderRadius:1,opacity:.9}});import{memo as Cn,useState as An}from"react";import{macOSColors as Me,night as k}from"@buoy-gg/shared-ui/web";import{jsx as O,jsxs as $}from"react/jsx-runtime";var En=[{key:"windowMs",title:"RECENT"},{key:"calls",title:"CALLS"},{key:"avgMs",title:"AVG"},{key:"maxMs",title:"MAX"},{key:"totalMs",title:"TOTAL"}],hr={timeout:{text:"TIMEOUT",color:"#38BDF8",prefix:"setTimeout"},interval:{text:"INTERVAL",color:"#22D3EE",prefix:"setInterval"},immediate:{text:"IMMED",color:"#60A5FA",prefix:"setImmediate"},raf:{text:"RAF",color:"#34D399",prefix:"requestAnimationFrame"},microtask:{text:"MICRO",color:"#A78BFA",prefix:"queueMicrotask"},then:{text:"PROMISE",color:"#BF5AF2",prefix:"Promise.then"},bridge:{text:"BRIDGE",color:"#FBBF24",prefix:"bridge"},unattributed:{text:"SYSTEM",color:"#8E8E93"},other:{text:"OTHER",color:"#8E8E93",prefix:"other"}};function ve(e){return hr[e]??hr.other}s(ve,"badgeFor");function Ye(e){if(e.api==="unattributed")return"events \xB7 React \xB7 native call-ins";if(e.api==="other")return e.key==="minor"?e.label:"evicted cold origins";let t=ve(e.api).prefix,r=e.label;return t&&r.startsWith(t)&&(r=r.slice(t.length)),r=r.replace(/^[\s←@]+/,"").trim(),r.length>0?r:"anonymous"}s(Ye,"displayName");function te(e){return e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e>=100?`${Math.round(e)}`:`${Math.round(e*10)/10}`}s(te,"fmt");function fr(e){return e.calls<=0?"measured by probe \xB7 not reachable from JS":`${te(e.calls)} calls \xB7 avg ${te(e.avgMs)} \xB7 max ${te(e.maxMs)} \xB7 total ${te(e.totalMs)} ms`}s(fr,"statsLine");var zn=Cn(s(function({row:e,rank:t,onPress:r}){let o=ve(e.api);return $(r?ce:y,{style:E.row,testID:"buoy-jstop-row",...r?{onPress:s(()=>r(e),"onPress"),activeOpacity:.6}:{},children:[$(y,{style:E.topLine,children:[O(h,{style:E.rank,children:t}),O(y,{style:[E.badge,{borderColor:o.color,backgroundColor:`${o.color}1A`}],children:O(h,{style:[E.badgeText,{color:o.color}],children:o.text})}),O(h,{style:E.name,numberOfLines:1,testID:"buoy-jstop-row-name",children:Ye(e)}),e.freezes>0&&$(h,{style:[E.freezeBadge,e.worstFreezeMs>=100&&E.freezeBadgeSevere],children:["\u26A0 \xD7",e.freezes]}),$(h,{style:[E.windowMs,e.api!=="unattributed"&&e.pctOfBusy>=25&&{color:e.pctOfBusy>=50?Me.semantic.error:Me.semantic.warning}],children:[te(e.windowMs),O(h,{style:E.unit,children:" ms"})]}),$(h,{style:[E.pct,e.api==="unattributed"&&E.pctMuted],children:[Math.round(e.pctOfBusy),"%"]})]}),$(y,{style:E.subLine,children:[O(y,{style:E.barTrack,children:O(y,{style:[E.barFill,{width:`${Math.min(100,e.pctOfBusy)}%`,backgroundColor:o.color}]})}),O(h,{style:E.stats,numberOfLines:1,testID:"buoy-jstop-row-stats",children:fr(e)})]})]})},"TaskRow"),(e,t)=>e.rank===t.rank&&e.onPress===t.onPress&&e.row.key===t.row.key&&e.row.windowMs===t.row.windowMs&&e.row.calls===t.row.calls&&e.row.maxMs===t.row.maxMs&&e.row.totalMs===t.row.totalMs&&e.row.pctOfBusy===t.row.pctOfBusy&&e.row.freezes===t.row.freezes&&e.row.worstFreezeMs===t.row.worstFreezeMs);function mr({rows:e,onSelectRow:t}){let[r,o]=An("windowMs"),n=r==="windowMs"?e:[...e].sort((a,i)=>i[r]-a[r]);return $(y,{style:D.root,children:[$(y,{style:D.sortRow,children:[O(h,{style:D.sortLabel,children:"SORT"}),En.map(a=>O(ce,{onPress:()=>o(a.key),style:[D.sortChip,r===a.key&&D.sortChipOn],children:O(h,{style:[D.sortChipText,r===a.key&&D.sortChipTextOn],children:a.title})},a.key))]}),$(Qe,{style:D.body,children:[n.map((a,i)=>O(zn,{row:a,rank:i+1,onPress:t},a.key)),n.length===0&&O(h,{style:D.empty,testID:"buoy-jstop-empty",children:"No tasks observed yet \u2014 interact with the app."})]})]})}s(mr,"TaskTable");var D=V.create({root:{flex:1,minHeight:0},sortRow:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:6,borderBottomWidth:1,borderBottomColor:k.color.border,backgroundColor:k.color.surface},sortLabel:{color:k.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginRight:2},sortChip:{borderWidth:1,borderColor:k.color.border,borderRadius:4,paddingHorizontal:7,paddingVertical:3},sortChipOn:{borderColor:k.color.accentBorderStrong,backgroundColor:k.color.accentSoft},sortChipText:{color:k.color.textTertiary,fontSize:9,fontWeight:"600",fontVariant:["tabular-nums"]},sortChipTextOn:{color:k.color.accent},body:{flex:1},empty:{color:k.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:24}}),E=V.create({row:{paddingHorizontal:10,paddingVertical:8,borderBottomWidth:V.hairlineWidth,borderBottomColor:k.color.border,gap:5},topLine:{flexDirection:"row",alignItems:"center",gap:6},rank:{width:16,color:k.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:4,paddingVertical:1},badgeText:{fontSize:8,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:k.color.text,fontSize:13,fontWeight:"500"},freezeBadge:{color:Me.semantic.warning,fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},freezeBadgeSevere:{color:Me.semantic.error},windowMs:{color:k.color.text,fontSize:13,fontWeight:"700",fontVariant:["tabular-nums"]},unit:{color:k.color.textTertiary,fontSize:10,fontWeight:"400"},pct:{width:38,textAlign:"right",color:k.color.textSecondary,fontSize:12,fontWeight:"600",fontVariant:["tabular-nums"]},pctMuted:{color:k.color.textTertiary},subLine:{flexDirection:"row",alignItems:"center",gap:8,paddingLeft:22},barTrack:{width:72,height:4,borderRadius:2,backgroundColor:k.color.fillSecondary,overflow:"hidden"},barFill:{height:4,borderRadius:2,opacity:.85},stats:{flex:1,color:k.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]}});import{memo as Rn}from"react";import{macOSColors as ke,night as A,useSafeAreaInsets as Bn}from"@buoy-gg/shared-ui/web";import{Fragment as pr,jsx as S,jsxs as I}from"react/jsx-runtime";var br={timeout:"Work scheduled with setTimeout. Time shown is the callback's exclusive run time on the JS thread.",interval:"A repeating setInterval. One scheduling site, many runs \u2014 a hot interval is the classic silent JS-FPS killer.",immediate:"Work scheduled with setImmediate \u2014 runs at the end of the current event-loop turn.",raf:"requestAnimationFrame work \u2014 runs once per frame while scheduled. Cost here directly trades against 60fps.",microtask:"queueMicrotask work \u2014 runs after the current task, before the thread yields.",then:"Promise reaction (.then/.catch/.finally). Named by the function that attached the reaction. Note: async/await bodies bypass .then and land in the System row instead.",bridge:"A native\u2192JS call-in over the legacy bridge (events, module callbacks), measured as its un-nested remainder.",unattributed:"Thread time the probe measured but no JS wrapper could claim: touch handlers, React commits, native call-ins, and async/await bodies. High here on New Architecture is normal \u2014 it's where UI work lives.",other:"Origins evicted from the table when the registry hit its cap \u2014 their totals are preserved here."};function gr(e){return br[e]??br.other}s(gr,"explainerFor");function N(e){return e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e>=100?`${Math.round(e)}`:`${Math.round(e*100)/100}`}s(N,"fmt");function yr(e){if(e<=0)return"\u2014";let t=e/1e3;return t<1?"just now":t<60?`${Math.round(t)}s ago`:`${Math.floor(t/60)}m ago`}s(yr,"agoFmt");function j({label:e,value:t,accent:r}){return I(y,{style:w.stat,children:[S(h,{style:w.statLabel,children:e}),S(h,{style:[w.statValue,r?{color:r}:null],children:t})]})}s(j,"Stat");var On=Rn(s(function({detail:e}){let t=ve(e.api),r=Bn({minBottom:12}),o=Math.max(1,...e.buckets);return I(Qe,{style:w.root,testID:"buoy-jstop-detail",contentContainerStyle:{paddingBottom:r.bottom},children:[I(y,{style:w.identityRow,children:[S(y,{style:[w.badge,{borderColor:t.color,backgroundColor:`${t.color}1A`}],children:S(h,{style:[w.badgeText,{color:t.color}],children:t.text})}),S(h,{style:w.name,numberOfLines:2,testID:"buoy-jstop-detail-name",children:Ye(e)})]}),S(h,{style:w.explainer,children:gr(e.api)}),S(h,{style:w.sectionTitle,children:"ACTIVITY \xB7 LAST 5S"}),S(y,{style:w.chartRow,children:e.buckets.map((n,a)=>S(y,{style:w.chartBarSlot,children:S(y,{style:[w.chartBar,{height:Math.max(2,n/o*44),backgroundColor:t.color}]})},`bk${a}`))}),I(y,{style:w.chartLegend,children:[I(h,{style:w.chartLegendText,children:[N(e.windowMs)," ms in window \xB7 ",e.pctOfBusy.toFixed(1),"% of busy time"]}),I(h,{style:w.chartLegendText,children:["peak ",N(o)," ms/250ms"]})]}),S(h,{style:w.sectionTitle,children:"STATS \xB7 SINCE START"}),I(y,{style:w.statGrid,children:[S(j,{label:"RUNS",value:e.calls>0?N(e.calls):"\u2014"}),S(j,{label:"SCHEDULED",value:e.scheduleCount>0?N(e.scheduleCount):"\u2014"}),S(j,{label:"AVG / RUN",value:e.calls>0?`${N(e.avgMs)} ms`:"\u2014"}),S(j,{label:"MAX / RUN",value:e.maxMs>0?`${N(e.maxMs)} ms`:"\u2014",accent:e.maxMs>=50?ke.semantic.warning:void 0}),S(j,{label:"TOTAL",value:e.totalMs>0?`${N(e.totalMs)} ms`:"\u2014"}),S(j,{label:"LAST RUN",value:yr(e.lastSeenAgoMs)}),S(j,{label:"FREEZES \xB7 60S",value:e.freezes>0?`${e.freezes}`:"0",accent:e.freezes>0?ke.semantic.error:void 0}),S(j,{label:"WORST FREEZE",value:e.worstFreezeMs>0?`${e.worstFreezeMs} ms`:"\u2014",accent:e.worstFreezeMs>=100?ke.semantic.error:e.worstFreezeMs>0?ke.semantic.warning:void 0})]}),(e.caller||(e.frames?.length??0)>0)&&I(pr,{children:[S(h,{style:w.sectionTitle,children:"SCHEDULED FROM"}),I(y,{style:w.siteCard,children:[e.caller&&I(h,{style:w.siteCaller,children:[e.caller,"()"]}),e.file&&I(h,{style:w.siteFile,children:[e.file,e.line!=null?`:${e.line}`:""]}),e.frames?.map((n,a)=>I(h,{style:w.siteFrame,numberOfLines:1,children:[n.file,":",n.line,":",n.col]},`fr${a}`)),S(h,{style:w.siteNote,children:"Frames are bundle offsets (Hermes) \u2014 the caller name above is the readable part. Captured once when this origin got hot."})]})]}),!e.caller&&(e.frames?.length??0)===0&&e.api!=="unattributed"&&e.api!=="other"&&I(pr,{children:[S(h,{style:w.sectionTitle,children:"SCHEDULED FROM"}),S(h,{style:w.sitePending,children:e.promoted?"Stack capture pending \u2014 next schedule from this site will record it.":"Not hot enough yet \u2014 the scheduling stack is captured once an origin passes 25 schedules or 50ms total."})]})]})},"TaskDetailView")),w=V.create({root:{flex:1,backgroundColor:"transparent",paddingHorizontal:12},identityRow:{flexDirection:"row",alignItems:"center",gap:8,paddingTop:12},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:5,paddingVertical:2},badgeText:{fontSize:9,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:A.color.text,fontSize:15,fontWeight:"600"},explainer:{color:A.color.textTertiary,fontSize:11,lineHeight:15,marginTop:6,marginBottom:4},sectionTitle:{color:A.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginTop:14,marginBottom:6},chartRow:{flexDirection:"row",alignItems:"flex-end",height:48,gap:2,backgroundColor:A.color.surface,borderRadius:6,borderWidth:1,borderColor:A.color.border,paddingHorizontal:6,paddingTop:2},chartBarSlot:{flex:1,alignItems:"center",justifyContent:"flex-end"},chartBar:{width:"70%",borderTopLeftRadius:2,borderTopRightRadius:2,opacity:.9},chartLegend:{flexDirection:"row",justifyContent:"space-between",marginTop:4},chartLegendText:{color:A.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},statGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},stat:{width:"23%",minWidth:76,flexGrow:1,backgroundColor:A.color.surface,borderWidth:1,borderColor:A.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:6},statLabel:{color:A.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.4,marginBottom:3},statValue:{color:A.color.text,fontSize:13,fontWeight:"600",fontVariant:["tabular-nums"]},siteCard:{backgroundColor:A.color.surface,borderWidth:1,borderColor:A.color.border,borderRadius:6,padding:10,gap:3},siteCaller:{color:A.color.text,fontSize:13,fontWeight:"600"},siteFile:{color:A.color.info,fontSize:11},siteFrame:{color:A.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},siteNote:{color:A.color.textTertiary,fontSize:9,opacity:.8,marginTop:4},sitePending:{color:A.color.textTertiary,fontSize:11}});import{Fragment as In,jsx as x,jsxs as W}from"react/jsx-runtime";function Ze(e){return e>=80?F.semantic.error:e>=40?F.semantic.warning:F.semantic.success}s(Ze,"busyColor");function Te(e){return e>=100?F.semantic.error:F.semantic.warning}s(Te,"freezeColor");function wr(e){let t=e.rows.find(r=>r.api!=="unattributed"&&r.api!=="other");return t&&t.pctOfBusy>=25&&e.busyPct>=15?{color:t.pctOfBusy>=50?F.semantic.error:F.semantic.warning,icon:"\u25B2",text:`${t.label} is eating ${Math.round(t.pctOfBusy)}% of thread time \u2014 start there.`}:e.freezeSummary.count>0?{color:Te(e.freezeSummary.worstMs),icon:"\u25B2",text:`${e.freezeSummary.count} freeze${e.freezeSummary.count===1?"":"s"} in the last 60s (worst ${e.freezeSummary.worstMs}ms) \u2014 check rows marked \u26A0.`}:e.busyPct>=80?{color:F.semantic.warning,icon:"\u25B2",text:"Thread saturated by UI/React work \u2014 open Highlight Updates to find re-renders."}:{color:F.semantic.success,icon:"\u25CF",text:`Thread healthy at ${Math.round(e.busyPct)}% load \u2014 nothing worth chasing.`}}s(wr,"diagnose");function Xe({visible:e,onClose:t,onBack:r,onMinimize:o,initialModalState:n,minimizeTargetPosition:a,remoteSnapshot:i,remoteActions:l,embedded:c=false}){let d=i!==void 0,[u,b]=or(null);ao(()=>{if(!(d||!e))return f.subscribe(b)},[d,e]);let m=d?i:u,g=io(()=>l??{pause:s(()=>f.pause(),"pause"),resume:s(()=>f.resume(),"resume"),clear:s(()=>f.clear(),"clear")},[l]),v=m?.paused??false,Ce=(m?.rows.length??0)>0,[Ae,nt]=or(null),Rr=no(K=>nt(K.key),[]),at=!d&&Ae?f.getOriginDetail(Ae):null,it=Ae!==null,st=W(de,{children:[it?x(de.Navigation,{onBack:()=>nt(null)}):r?x(de.Navigation,{onBack:r}):null,x(de.Content,{title:"",noMargin:true,children:W(y,{style:M.titleRow,children:[x(yn,{size:14,color:"#34D399"}),x(h,{style:M.title,testID:"buoy-jstop-title",children:"JS Top"}),m&&x(y,{style:[M.busyPill,{borderColor:Ze(m.busyPct)}],children:W(h,{testID:"buoy-jstop-busy",style:[M.busyText,{color:Ze(m.busyPct)}],children:[m.busyPct.toFixed(0),"% BUSY"]})}),m&&m.freezeSummary.count>0&&x(y,{style:[M.busyPill,{borderColor:Te(m.freezeSummary.worstMs)}],children:W(h,{testID:"buoy-jstop-freezes",style:[M.busyText,{color:Te(m.freezeSummary.worstMs)}],children:["\u26A0 ",m.freezeSummary.count," \xB7"," ",m.freezeSummary.worstMs,"ms"]})})]})}),W(de.Actions,{children:[x(ce,{onPress:v?g.resume:g.pause,style:[M.actionBtn,v&&M.actionBtnActive],testID:"buoy-jstop-pause",accessibilityLabel:v?"Resume sampling":"Pause sampling",children:v?x(Sn,{size:14,color:R.color.accent}):x(xn,{size:14,color:R.color.textSecondary})}),x(ce,{onPress:g.clear,disabled:!Ce,style:[M.actionBtn,!Ce&&M.actionBtnDisabled],testID:"buoy-jstop-clear",accessibilityLabel:"Clear stats",children:x(Mn,{size:14,color:Ce?R.color.textTertiary:R.color.textTertiary})})]})]}),lt=x(y,{style:M.body,children:it?at?x(On,{detail:at}):x(h,{style:M.waiting,children:"This origin is no longer tracked (cleared or evicted)."}):m?W(In,{children:[(()=>{let K=wr(m);return W(y,{style:[M.diagnosis,{borderLeftColor:K.color}],children:[x(h,{style:[M.diagnosisIcon,{color:K.color}],children:K.icon}),x(h,{style:M.diagnosisText,children:K.text})]})})(),W(y,{style:M.sparklineRow,children:[x(h,{style:M.sparklineCaption,children:"JS THREAD LOAD \xB7 LAST 30s"}),x(Tn,{history:m.busyHistory})]}),!m.tiers.bridge&&x(h,{style:M.tierBanner,children:"\u201CSystem\u201D rows are UI/React/native work pure JS can\u2019t name \u2014 timers, rAF and Promise chains are fully attributed."}),x(mr,{rows:m.rows,onSelectRow:d?void 0:Rr})]}):x(h,{style:M.waiting,children:d?"Waiting for device\u2026":"Starting engine\u2026"})});return c?W(y,{style:M.embeddedRoot,children:[x(y,{style:M.embeddedHeader,children:st}),lt]}):x(wn,{visible:e,onClose:t,onMinimize:o,minimizeTargetPosition:a,initialModalState:n,header:{showToggleButton:true,customContent:st},persistenceKey:"buoy-js-top-modal",enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:lt})}s(Xe,"JsTopModal");var M=V.create({titleRow:{flexDirection:"row",alignItems:"center",gap:8},title:{color:R.color.text,fontSize:14,fontWeight:"500"},busyPill:{borderWidth:1,borderRadius:4,paddingHorizontal:6,paddingVertical:2},busyText:{fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},actionBtn:{width:32,height:32,borderRadius:8,backgroundColor:R.color.buttonSurface,borderWidth:1,borderColor:R.color.border,alignItems:"center",justifyContent:"center"},actionBtnActive:{backgroundColor:R.color.accentSoft,borderColor:R.color.accentBorderStrong},actionBtnDisabled:{opacity:.55},body:{flex:1,minHeight:0,backgroundColor:"transparent"},diagnosis:{flexDirection:"row",alignItems:"center",gap:8,marginHorizontal:10,marginTop:8,paddingHorizontal:10,paddingVertical:8,backgroundColor:R.color.surface,borderRadius:6,borderLeftWidth:3},diagnosisIcon:{fontSize:11,fontWeight:"700"},diagnosisText:{flex:1,color:R.color.text,fontSize:12,lineHeight:16},sparklineRow:{paddingHorizontal:10,paddingVertical:8,gap:4},sparklineCaption:{color:R.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.5},tierBanner:{color:R.color.textTertiary,fontSize:10,paddingHorizontal:10,paddingBottom:6},waiting:{color:R.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:32},embeddedRoot:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:F.background.base},embeddedHeader:{borderBottomWidth:1,borderBottomColor:F.border.default}});import{useEffect as xr,useState as Sr}from"react";import{macOSColors as et,night as tt}from"@buoy-gg/shared-ui/web";import{jsx as Pn,jsxs as Mr}from"react/jsx-runtime";function vr(e){return e>=80?et.semantic.error:e>=40?et.semantic.warning:et.semantic.success}s(vr,"busyColor");function kr(){let[e,t]=Sr(()=>f.isEnabled()),[r,o]=Sr(null);if(xr(()=>f.subscribeEnabled(t),[]),xr(()=>{if(!e){o(null);return}return f.subscribe(o)},[e]),!e||!r)return null;let n=r.rows.find(a=>a.api!=="unattributed");return Mr(y,{style:rt.pill,pointerEvents:"none",children:[Mr(h,{style:[rt.busy,{color:vr(r.busyPct)}],children:[r.busyPct.toFixed(0),"%"]}),n&&Pn(h,{style:rt.label,numberOfLines:1,children:n.label})]})}s(kr,"JsTopHudOverlay");var rt=V.create({pill:{position:"absolute",top:60,left:8,flexDirection:"row",alignItems:"center",gap:6,backgroundColor:tt.color.buttonSurface,borderWidth:1,borderColor:tt.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:4,maxWidth:220},busy:{fontSize:11,fontWeight:"700",fontVariant:["tabular-nums"]},label:{color:tt.color.textSecondary,fontSize:10,flexShrink:1}});import{useEffect as Fn,useState as Ln}from"react";import{Activity as Tr}from"@buoy-gg/shared-ui/web";import{jsx as Cr}from"react/jsx-runtime";var ot="#34D399",Ar="#6B7280";function Er({size:e}){let[t,r]=Ln(()=>f.isEnabled());return Fn(()=>f.subscribeEnabled(r),[]),Cr(Tr,{size:e,color:t?ot:Ar})}s(Er,"JsTopToggleIcon");function zr(){return null}s(zr,"EmptyComponent");var $n={id:"js-top",name:"JS TOP",description:"Toggle the floating JS-thread busy pill",slot:"row",icon:Er,component:zr,props:{},launchMode:"toggle-only",onPress:s(()=>{f.setEnabled(!f.isEnabled())},"onPress")},Dn={id:"js-top-modal",name:"TASKS",description:"Live Task Manager for the JS thread",slot:"both",icon:s(({size:e})=>Cr(Tr,{size:e,color:ot}),"icon"),component:Xe,props:{enableSharedModalDimensions:false}};f.registerTierInstaller(Qt);f.registerTierInstaller(Gt);f.registerTierInstaller(Xt);f.registerLongtaskProvider(er);f.registerFreezeStatsProvider(tr);f.registerClearHook(rr);try{typeof window<"u"&&(We(),He())}catch{}export{Ar as JS_TOP_DISABLED_COLOR,ot as JS_TOP_ENABLED_COLOR,f as JsTopController,kr as JsTopHudOverlay,Xe as JsTopModal,Dn as jsTopModalPreset,$n as jsTopPreset,oo as jsTopSyncAdapter};
1
+ "use client";var Ee=Object.defineProperty;var Br=Object.getOwnPropertyDescriptor;var Or=Object.getOwnPropertyNames;var Ir=Object.prototype.hasOwnProperty;var s=(e,t)=>Ee(e,"name",{value:t,configurable:true});var Pr=(e,t)=>{for(var r in t)Ee(e,r,{get:t[r],enumerable:true})},ut=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Or(t))!Ir.call(e,n)&&n!==r&&Ee(e,n,{get:()=>t[n],enumerable:!(o=Br(t,n))||o.enumerable});return e},Fr=(e,t,r)=>(ut(e,t,"default"),r&&ut(r,t,"default"));var re=(()=>{try{let e=globalThis.Capacitor;if(e&&typeof e.isNativePlatform=="function"&&e.isNativePlatform())return e.DEBUG===true}catch{}return process.env.NODE_ENV!=="production"})();typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);var he=typeof globalThis<"u"?globalThis:void 0,Lr=(()=>{if(typeof he?.nativePerformanceNow=="function"){let e=he.nativePerformanceNow;return()=>e()}if(typeof he?.performance?.now=="function"){let e=he.performance;return()=>e.now()}return()=>Date.now()})(),$r=Lr;function P(){return $r()}s(P,"now");var p=typeof globalThis<"u"?globalThis:{},ct=false;function H(){return ct}s(H,"isActive");function oe(e){ct=e}s(oe,"setActive");var ze=null;function fe(){return ze||(ze={setTimeout:p.setTimeout?.bind(p),setInterval:p.setInterval?.bind(p),clearInterval:p.clearInterval?.bind(p),clearTimeout:p.clearTimeout?.bind(p),setImmediate:p.setImmediate?.bind(p),requestAnimationFrame:p.requestAnimationFrame?.bind(p),queueMicrotask:p.queueMicrotask?.bind(p)}),ze}s(fe,"captureOriginals");function ne(){return fe()}s(ne,"getOriginals");var T=Symbol.for("buoy.jsTop.patched"),dt=Symbol.for("buoy.jsTop.wrapped");var U=new Float64Array(120),ae=new Float64Array(120),Re=new Float64Array(120),q=new Float64Array(120).fill(-1);function L(e){return Math.floor(e/250)}s(L,"epochOf");function ht(e){let t=e%120;return q[t]!==e&&(q[t]=e,U[t]=0,ae[t]=0,Re[t]=0),t}s(ht,"slotFor");function me(e,t,r){if(!(t>e))return;let o=Math.max(e,t-3e4),n=L(o),a=L(t),i=o;for(;n<=a;){let l=(n+1)*250,c=Math.min(t,l),d=c-i;d>0&&r(ht(n),d),i=c,n++}}s(me,"distribute");function ft(e,t){me(e,t,(r,o)=>{U[r]=Math.min(250,U[r]+o)})}s(ft,"bookBusyRange");function mt(e,t,r){let o=t-e;if(!(o>0)||!(r>0))return;let n=Math.min(1,r/o);me(e,t,(a,i)=>{ae[a]=Math.min(250,ae[a]+i*n)})}s(mt,"bookAttributedRange");function pt(e,t){me(e,t,(r,o)=>{Re[r]=Math.min(250,Re[r]+o)})}s(pt,"bookLongtaskRange");function Be(e,t,r){let o=L(t),n=0;for(let a=o-r+1;a<=o;a++){let i=a%120;i>=0&&q[i]===a&&(n+=e[i])}return n}s(Be,"sumWindow");function Oe(e){return Be(U,e,20)}s(Oe,"windowBusyMs");function bt(e){return Be(ae,e,20)}s(bt,"windowAttributedMs");function gt(e){let t=L(e),r=[];for(let o=t-20+1;o<=t;o++){let n=o%120;n>=0&&q[n]===o?r.push(Math.max(0,Math.round((U[n]-ae[n])*10)/10)):r.push(0)}return r}s(gt,"windowResidualBuckets");function yt(e){let t=L(e),r=[];for(let n=t-120+1;n<=t;n++){let a=n%120;a>=0&&q[a]===n?r.push(Math.round(U[a]/250*100)):r.push(0)}let o=0;for(;o<r.length&&r[o]===0;)o++;return r.slice(Math.max(0,Math.min(o,r.length-1)))}s(yt,"busyHistory");function wt(){q.fill(-1)}s(wt,"resetAggregator");import{buoyFetch as St}from"@buoy-gg/shared-ui/web";var Dr=3,Ie=0;function xt(){return typeof re<"u"&&re}s(xt,"isDev");var jr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wr=new Map([...jr].map((e,t)=>[e,t]));function Mt(e){let t=[],r=0,o=0,n=0,a=0;for(let i of e.split(";")){let l=[],c=0;for(let d of i.split(",")){if(!d)continue;let u=[],b=0,m=0;for(let g of d){let v=Wr.get(g);if(v===void 0)break;b+=(v&31)<<m,v&32?m+=5:(u.push(b&1?-(b>>1):b>>1),b=0,m=0)}u.length&&(c+=u[0],u.length===1?l.push([c]):u.length>=4&&(r+=u[1],o+=u[2],n+=u[3],u.length>=5?(a+=u[4],l.push([c,r,o,n,a])):l.push([c,r,o,n])))}t.push(l)}return t}s(Mt,"decodeMappings");function vt(e,t,r){let o=e.lines[t-1];if(!o?.length)return null;let n;for(let i of o)if(i[0]<=r-1)n=i;else break;if(!n||n.length<4)return null;let a=e.sources[n[1]];return a?{file:a,line:n[2]+1,name:n.length>=5?e.names[n[4]]:void 0}:null}s(vt,"lookup");var kt=new Map;function Tt(e){let t=kt.get(e);return t||(t=(async()=>{let r=await(await St(e)).text(),o=Math.max(r.lastIndexOf("//# sourceMappingURL="),r.lastIndexOf("//@ sourceMappingURL="));if(o<0)return null;let n=/^\/\/[#@]\s*sourceMappingURL=(\S+)/.exec(r.slice(o));if(!n)return null;let a=new URL(n[1],e).href,i=await(await St(a)).json();return!i.mappings||!i.sources?null:{sources:i.sources,names:i.names??[],lines:Mt(i.mappings)}})().catch(()=>null),kt.set(e,t)),t}s(Tt,"loadMap");function Ct(e){return(e.split("?")[0]??e).split("/").filter(Boolean).slice(-2).join("/")}s(Ct,"tailPath");function At(e){return/^[A-Z][A-Za-z0-9]*$/.test(e)}s(At,"looksLikeComponent");function Et(e,t){if(!xt()||e.symbolicated||!e.frames||e.frames.length===0||Ie>=Dr)return;e.symbolicated=true;let r=e.frames.filter(o=>/^(https?|capacitor|file):\/\//.test(o.file));r.length&&(Ie++,(async()=>{for(let o of r){let n=await Tt(o.file.split("?")[0]??o.file);if(!n)continue;let a=vt(n,o.line,o.col);if(!a||a.file.includes("node_modules"))continue;let i=Ct(a.file);e.file=i,e.line=a.line;let l=`${i.split("/").pop()}:${a.line}`;a.name&&At(a.name)&&!e.caller?(e.caller=a.name,e.label=`${e.label} \u2190 <${a.name}> \xB7 ${l}`):e.label=`${e.label} \xB7 ${l}`;return}})().catch(()=>{}).finally(()=>{Ie--}))}s(Et,"buoyJsTopSymbolicateOrigin");var Hr=500,Vr=20,C=new Map,zt="other",Rt=0,Pe=0;function pe(e,t,r){return{key:e,api:t,label:r,calls:0,totalMs:0,maxMs:0,scheduleCount:0,lastSeenAt:0,promoted:false,lastCaptureAt:0,ring:new Float64Array(20),ringStamps:new Float64Array(20).fill(-1)}}s(pe,"makeOrigin");function Fe(e,t){let r=L(t),o=0;for(let n=r-20+1;n<=r;n++){let a=n%20;a>=0&&e.ringStamps[a]===n&&(o+=e.ring[a])}return o}s(Fe,"windowMsOf");function Le(e){let t=null,r=1/0;for(let n of C.values()){if(n.key===zt)continue;let a=Fe(n,e)*1e6+n.lastSeenAt;a<r&&(r=a,t=n)}if(!t)return false;let o=Bt(zt,"other","other (evicted origins)");return o.calls+=t.calls,o.totalMs+=t.totalMs,o.maxMs=Math.max(o.maxMs,t.maxMs),o.lastSeenAt=Math.max(o.lastSeenAt,t.lastSeenAt),C.delete(t.key),true}s(Le,"evictColdest");function Bt(e,t,r){let o=C.get(e);return o||(o=pe(e,t,r),C.set(e,o)),o}s(Bt,"getOrCreate");function Ot(e){let t=[],r,o=e.split(`
2
+ `);for(let n of o){let a=/at\s+(.*?)\s+\((?:address at\s+)?(.*?):(\d+):(\d+)\)/.exec(n)??/at\s+()(.*?):(\d+):(\d+)$/.exec(n.trim())??/^([^@\s]*)@(.+?):(\d+):(\d+)$/.exec(n.trim());if(!a)continue;let i=a[1]??"";if(i.includes("buoyJsTop")||i==="Error"||a[2]?.includes("/js-top/"))continue;t.push({file:a[2]??"",line:Number(a[3]),col:Number(a[4])});let l=/^(react_stack_bottom_frame|runWithFiberInDEV|commitHookEffectList|flushPassive|performWork|renderWithHooks|safelyCall)/.test(i)||/^(then|catch|finally|resolve|reject|fulfilled|rejected|step|tryCallOne|tryCallTwo|tryCatch|invokeCallback|notify)$/.test(i);if(!r&&i&&i!=="anonymous"&&!l&&(r=i),t.length>=3)break}return{caller:r,frames:t}}s(Ot,"parseStack");function It(e,t){return t-e.lastCaptureAt<Hr||(t-Rt>1e3&&(Rt=t,Pe=0),Pe>=Vr)?false:(Pe++,e.lastCaptureAt=t,true)}s(It,"allowCapture");function be(e){if(!e)return;let t=(e.split("?")[0]??e).replace(/\/\/&.*$/,""),r=/^[a-z]+:\/\/[^/]+\/(.*)$/.exec(t);return(r?r[1]:t).split("/").slice(-2).join("/")}s(be,"shortFile");function Pt(e){return C.has(e)}s(Pt,"buoyJsTopOriginExists");function ge(e,t,r,o=true){let n=t,a=typeof n.displayName=="string"&&n.displayName||typeof n.name=="string"&&n.name||"anonymous",i=`${e}|${a}`,l=C.get(i);if(l?.activeRefinedKey&&!C.has(l.activeRefinedKey)&&(l.activeRefinedKey=void 0),!l){for(;C.size>=500&&Le(r););l=pe(i,e,a==="anonymous"?_(e):`${_(e)} ${a}`),C.set(i,l)}if(l.scheduleCount++,!l.promoted&&(l.scheduleCount>=25||l.totalMs>=50)&&(l.promoted=true),(l.promoted||e==="interval")&&o&&It(l,r)){let{caller:c,frames:d}=Ot(new Error().stack??""),u=d[0];if(u||c){let b=u?`${be(u.file)??"?"}:${u.line}`:"?",m=`${i}@${c??"?"}:${b}`,g=C.get(m);if(!g){for(;C.size>=500&&Le(r););let v=a==="anonymous"?_(e):`${_(e)} ${a}`;g=pe(m,e,c?`${v} \u2190 ${c}`:a==="anonymous"?`${v} @ ${be(u?.file??"")??"?"}`:v),g.caller=c,g.file=u?be(u.file):void 0,g.line=u?.line,g.frames=d,g.promoted=true,g.calls=l.calls,g.totalMs=l.totalMs,g.maxMs=l.maxMs,g.scheduleCount=l.scheduleCount,g.lastSeenAt=l.lastSeenAt,g.ring.set(l.ring),g.ringStamps.set(l.ringStamps),l.calls=0,l.totalMs=0,l.maxMs=0,l.ring.fill(0),l.ringStamps.fill(-1),C.set(m,g),Et(g,_(e))}l.activeRefinedKey=m}}return l.activeRefinedKey??i}s(ge,"buoyJsTopScheduleOrigin");function _(e){switch(e){case"timeout":return"setTimeout";case"interval":return"setInterval";case"immediate":return"setImmediate";case"raf":return"requestAnimationFrame";case"microtask":return"queueMicrotask";case"then":return"Promise.then";case"bridge":return"bridge";default:return e}}s(_,"apiLabel");function Ft(e,t,r,o){let n=C.get(e);if(!n)return;n.calls++,n.totalMs+=t,t>n.maxMs&&(n.maxMs=t),n.lastSeenAt=o,!n.promoted&&n.totalMs>=50&&(n.promoted=true);let a=o-r,i=a>0?Math.min(1,t/a):1,l=Math.max(r,o-5e3),c=L(l),d=L(o),u=l;for(;c<=d;){let b=(c+1)*250,m=Math.min(o,b),g=m-u;if(g>0){let v=c%20;v>=0&&(n.ringStamps[v]!==c&&(n.ringStamps[v]=c,n.ring[v]=0),n.ring[v]+=a>0?g*i:t)}u=m,c++}mt(r,o,t)}s(Ft,"buoyJsTopBookExclusive");function Lt(e){return C.get(e)?.label??null}s(Lt,"labelForOrigin");function $t(e,t,r){let o=[];for(let i of C.values()){let l=Fe(i,e);l<=0&&i.totalMs<1||o.push({key:i.key,label:i.label,api:i.api,file:i.file,line:i.line,windowMs:Math.round(l*10)/10,pctOfBusy:t>0?Math.min(100,Math.round(l/t*1e3)/10):0,totalMs:Math.round(i.totalMs*10)/10,calls:i.calls,avgMs:i.calls>0?Math.round(i.totalMs/i.calls*100)/100:0,maxMs:Math.round(i.maxMs*100)/100,lastSeenAgoMs:i.lastSeenAt>0?Math.max(0,e-i.lastSeenAt):0,freezes:0,worstFreezeMs:0})}o.sort((i,l)=>l.windowMs-i.windowMs||l.totalMs-i.totalMs);let n=[],a=[];for(let i of o)(i.windowMs>=1||i.pctOfBusy>=.5||i.freezes>0?n:a).push(i);return a.length>=2?(n.push({key:"minor",label:`${a.length} minor origins (\u22641ms each)`,api:"other",windowMs:Math.round(a.reduce((i,l)=>i+l.windowMs,0)*10)/10,pctOfBusy:Math.round(a.reduce((i,l)=>i+l.pctOfBusy,0)*10)/10,totalMs:Math.round(a.reduce((i,l)=>i+l.totalMs,0)*10)/10,calls:a.reduce((i,l)=>i+l.calls,0),avgMs:0,maxMs:Math.max(0,...a.map(i=>i.maxMs)),lastSeenAgoMs:Math.min(...a.map(i=>i.lastSeenAgoMs)),freezes:0,worstFreezeMs:0}),n.slice(0,r)):o.slice(0,r)}s($t,"buildRows");function Dt(e,t,r){let o=C.get(e);if(!o)return null;let n=L(t),a=[],i=0;for(let l=n-20+1;l<=n;l++){let c=l%20,d=c>=0&&o.ringStamps[c]===l?Math.round(o.ring[c]*10)/10:0;a.push(d),i+=d}return{key:o.key,label:o.label,api:o.api,caller:o.caller,file:o.file,line:o.line,frames:o.frames,promoted:o.promoted,scheduleCount:o.scheduleCount,calls:o.calls,totalMs:Math.round(o.totalMs*10)/10,avgMs:o.calls>0?Math.round(o.totalMs/o.calls*100)/100:0,maxMs:Math.round(o.maxMs*100)/100,windowMs:Math.round(i*10)/10,pctOfBusy:r>0?Math.min(100,Math.round(i/r*1e3)/10):0,lastSeenAgoMs:o.lastSeenAt>0?Math.max(0,t-o.lastSeenAt):0,buckets:a}}s(Dt,"getOriginDetailBase");function jt(){C.clear()}s(jt,"resetOrigins");var Nr=32,Q=[],Jr=20,Wt=64,Ht=new Array(Wt).fill(null),$e=0;function Vt(){return Ht}s(Vt,"recentIntervals");function De(e,t){let r=P(),o=Q.length>0?Q[Q.length-1]:null,n=null;Q.length<Nr&&(n={originKey:e,start:r,childrenMs:0},Q.push(n));try{return t()}finally{try{if(n){Q.pop();let a=P(),i=a-r,l=Math.max(0,i-n.childrenMs);o&&(o.childrenMs+=i),Ft(e,l,r,a),!o&&i>=Jr&&(Ht[$e]={originKey:e,start:r,end:a},$e=($e+1)%Wt)}}catch{}}}s(De,"buoyJsTopRunFrame");function J(e,t){if(typeof e!="function"||e[dt])return e;let r=H()?ge(t,e,P()):null,o=s(function(...n){return H()?((r===null||!Pt(r))&&(r=ge(t,e,P(),false)),De(r,()=>e.apply(this,n))):e.apply(this,n)},"buoyJsTopTaskWrapper");return o[dt]=true,o}s(J,"buoyJsTopWrapTask");function je(e,t,r){if(!H())return r();let o=ge(e,{name:t},P());return De(o,r)}s(je,"buoyJsTopRunAs");function We(){let e=fe();if(typeof p.setTimeout=="function"&&!p.setTimeout[T]){let t=s(function(r,o,...n){let a=J(r,"timeout");return e.setTimeout(a,o,...n)},"buoyJsTopSetTimeout");t[T]=true,p.setTimeout=t}if(typeof p.setInterval=="function"&&!p.setInterval[T]){let t=s(function(r,o,...n){let a=J(r,"interval");return e.setInterval(a,o,...n)},"buoyJsTopSetInterval");t[T]=true,p.setInterval=t}if(typeof p.setImmediate=="function"&&!p.setImmediate[T]&&e.setImmediate){let t=s(function(r,...o){let n=J(r,"immediate");return e.setImmediate(n,...o)},"buoyJsTopSetImmediate");t[T]=true,p.setImmediate=t}if(typeof p.requestAnimationFrame=="function"&&!p.requestAnimationFrame[T]&&e.requestAnimationFrame){let t=s(function(r){let o=J(r,"raf");return e.requestAnimationFrame(o)},"buoyJsTopRequestAnimationFrame");t[T]=true,p.requestAnimationFrame=t}}s(We,"installTimerPatches");function He(){let e=fe();if(typeof p.queueMicrotask=="function"&&!p.queueMicrotask[T]&&e.queueMicrotask){let t=s(function(r){let o=J(r,"microtask");return e.queueMicrotask(o)},"buoyJsTopQueueMicrotask");t[T]=true,p.queueMicrotask=t}}s(He,"installMicrotaskPatches");var Ve=16,Kr=100,Ur=3,qr=8,ie=null,se=0,ye=false,le=[],G=1/0,Y=0,Ne=Ve;function Nt(){let e=P(),t=se>0?e-se:0;if(se=e,ye){ye=false,G=1/0,Y=e;return}if(t<=0)return;t<Kr&&(t<G&&(G=t),Y===0&&(Y=e),e-Y>=1e3&&(le.push(G),le.length>Ur&&le.shift(),Ne=Math.max(qr,Math.min(...le)),G=1/0,Y=e));let r=t-Ne;r>1&&ft(e-r,e)}s(Nt,"buoyJsTopProbeTick");function Je(){if(ie!=null)return;let e=ne();se=P(),ye=false,le=[],G=1/0,Y=0,Ne=Ve,ie=e.setInterval(Nt,Ve)}s(Je,"startBusyProbe");function Ke(){ie!=null&&(ne().clearInterval(ie),ie=null),se=0}s(Ke,"stopBusyProbe");function Jt(){ye=true}s(Jt,"suppressNextGap");import{definePersistedSetting as _r}from"@buoy-gg/shared-ui/web";var Qr="@react_buoy/js-top/prefs",Gr={enabled:false},Kt=_r(Qr,Gr,{sanitize:s(e=>({enabled:e.enabled===true}),"sanitize")});async function Ut(){return Kt.load()}s(Ut,"loadJsTopPrefs");async function qt(e){await Kt.save(e)}s(qt,"saveJsTopPrefs");import{subscribeRealAppState as Yr}from"@buoy-gg/shared-ui/web";var Zr=250,_t=class Vn{constructor(){this.enabled=false;this.enabledLoaded=false;this.paused=false;this.pausedAt=0;this.remoteSampling=false;this.engineRunning=false;this.tiers={timers:false,promises:false,bridge:false,longtask:false};this.notifyHandle=null;this.appStateSub=null;this.snapshot=this.buildSnapshot();this.subscribers=new Set;this.enabledSubscribers=new Set;this.tierInstallers=[];this.longtaskProvider=null;this.freezeStatsProvider=null;this.clearHooks=[];Ut().then(t=>{this.enabledLoaded=true,t.enabled&&!this.enabled&&this.setEnabled(true)})}subscribe(t){return this.subscribers.add(t),this.syncEngineState(),t(this.snapshot),()=>{this.subscribers.delete(t),this.syncEngineState()}}subscribeEnabled(t){return this.enabledSubscribers.add(t),t(this.enabled),()=>{this.enabledSubscribers.delete(t)}}setEnabled(t){this.enabled!==t&&(this.enabled=t,this.enabledLoaded&&qt({enabled:t}),this.enabledSubscribers.forEach(r=>{try{r(t)}catch(o){re&&console.error("[Buoy]","[js-top] enabled subscriber threw",o)}}),this.syncEngineState())}isEnabled(){return this.enabled}setRemoteSampling(t){this.remoteSampling!==t&&(this.remoteSampling=t,this.syncEngineState())}isRemoteSampling(){return this.remoteSampling}getStatus(){return this.engineRunning?this.paused?"paused":"running":"disabled"}pause(){this.paused||(this.paused=true,this.pausedAt=P(),oe(false),Ke(),this.emitSnapshot())}resume(){this.paused&&(this.paused=false,this.engineRunning&&(oe(true),Je()),this.emitSnapshot())}clear(){jt(),wt();for(let t of this.clearHooks)try{t()}catch{}this.emitSnapshot()}registerClearHook(t){this.clearHooks.push(t)}getSnapshot(){return this.snapshot}getOriginDetail(t){let r=P(),o=Oe(r),n=this.freezeStatsProvider?.(Date.now())?.byOrigin[t];if(t==="unattributed"){let i=gt(r),l=Math.round(i.reduce((c,d)=>c+d,0)*10)/10;return{key:t,label:"unattributed (events / React / native call-ins)",api:"unattributed",promoted:false,scheduleCount:0,calls:0,totalMs:0,avgMs:0,maxMs:0,windowMs:l,pctOfBusy:o>0?Math.min(100,Math.round(l/o*1e3)/10):0,lastSeenAgoMs:0,buckets:i,freezes:n?.count??0,worstFreezeMs:Math.round(n?.maxMs??0)}}let a=Dt(t,r,o);return a?{...a,freezes:n?.count??0,worstFreezeMs:Math.round(n?.maxMs??0)}:null}registerTierInstaller(t){this.tierInstallers.push(t),this.engineRunning&&Object.assign(this.tiers,this.runInstaller(t))}registerLongtaskProvider(t){this.longtaskProvider=t}registerFreezeStatsProvider(t){this.freezeStatsProvider=t}shouldRun(){return this.subscribers.size>0||this.remoteSampling}syncEngineState(){let t=this.shouldRun();t&&!this.engineRunning?this.startEngine():!t&&this.engineRunning&&this.stopEngine()}runInstaller(t){try{return t()}catch(r){return re&&console.error("[Buoy]","[js-top] tier installer threw",r),{}}}startEngine(){this.engineRunning=true,We(),He(),this.tiers={timers:true,promises:false,bridge:false,longtask:false};for(let t of this.tierInstallers)Object.assign(this.tiers,this.runInstaller(t));oe(!this.paused),this.paused||Je();try{this.appStateSub=Yr(()=>{Jt()})}catch{this.appStateSub=null}this.notifyHandle=ne().setInterval(()=>this.emitSnapshot(),Zr),this.emitSnapshot()}stopEngine(){if(this.engineRunning=false,oe(false),Ke(),this.notifyHandle!=null&&(ne().clearInterval(this.notifyHandle),this.notifyHandle=null),this.appStateSub){try{this.appStateSub.remove()}catch{}this.appStateSub=null}}buildSnapshot(){let t=this.paused?this.pausedAt:P(),r=Oe(t),o=bt(t),n=Math.max(0,r-o),a=$t(t,r,30);n>=1&&(a.push({key:"unattributed",label:"unattributed (events / React / native call-ins)",api:"unattributed",windowMs:Math.round(n*10)/10,pctOfBusy:r>0?Math.min(100,Math.round(n/r*1e3)/10):0,totalMs:0,calls:0,avgMs:0,maxMs:0,lastSeenAgoMs:0,freezes:0,worstFreezeMs:0}),a.sort((c,d)=>d.windowMs-c.windowMs||d.totalMs-c.totalMs));let i=this.freezeStatsProvider?.(Date.now())??{count:0,worstMs:0,byOrigin:{}};for(let c of a){let d=i.byOrigin[c.key];d&&(c.freezes=d.count,c.worstFreezeMs=Math.round(d.maxMs))}let l=5e3;return{ts:Date.now(),paused:this.paused,busyPct:Math.min(100,Math.round(r/l*1e3)/10),busyHistory:yt(t),tiers:{...this.tiers},rows:a,totals:{attributedWindowMs:Math.round(o*10)/10,unattributedWindowMs:Math.round(n*10)/10,windowMs:l},freezeSummary:{count:i.count,worstMs:Math.round(i.worstMs)},longtasks:this.longtaskProvider?this.longtaskProvider():[]}}emitSnapshot(){this.snapshot=this.buildSnapshot(),this.subscribers.forEach(t=>{try{t(this.snapshot)}catch(r){re&&console.error("[Buoy]","[js-top] snapshot subscriber threw",r)}})}isEngineActive(){return H()}};s(_t,"JsTopControllerImpl");var Xr=_t,f=new Xr;function we(e,t){let r=e[t];if(typeof r!="function")return false;if(r[T])return true;let o=s(function(...n){for(let a=0;a<n.length;a++)typeof n[a]=="function"&&(n[a]=J(n[a],"then"));return r.apply(this,n)},"patched");return o[T]=true,Object.defineProperty(o,"name",{value:t,configurable:true}),e[t]=o,true}s(we,"patchMethod");function Qt(){let e=p.Promise?.prototype;if(!e)return{promises:false};let t=we(e,"then");return we(e,"catch"),we(e,"finally"),{promises:t}}s(Qt,"installPromisePatches");function Gt(){let e=p.__fbBatchedBridge;if(!e)return{bridge:false};let t=false;if(typeof e.callFunctionReturnFlushedQueue=="function"&&!e.callFunctionReturnFlushedQueue[T]){let o=e.callFunctionReturnFlushedQueue.bind(e),n=s(function(a,i,l){return H()?je("bridge",`${a}.${i}`,()=>o(a,i,l)):o(a,i,l)},"buoyJsTopCallFunction");n[T]=true,e.callFunctionReturnFlushedQueue=n,t=true}if(typeof e.invokeCallbackAndReturnFlushedQueue=="function"&&!e.invokeCallbackAndReturnFlushedQueue[T]){let o=e.invokeCallbackAndReturnFlushedQueue.bind(e),n=s(function(a,i){return H()?je("bridge","nativeModuleCallback",()=>o(a,i)):o(a,i)},"buoyJsTopInvokeCallback");n[T]=true,e.invokeCallbackAndReturnFlushedQueue=n,t=true}let r=e.callFunctionReturnFlushedQueue?.[T]===true;return{bridge:t||r}}s(Gt,"installBridgePatch");var eo=40,to=6e4,ro="unattributed",Yt=false,Se=false,Z=[];function Zt(e,t){let r=e+t,o=null,n=0;for(let a of Vt()){if(!a)continue;let i=Math.min(r,a.end)-Math.max(e,a.start);i>n&&(n=i,o=a.originKey)}return o}s(Zt,"correlate");function Xt(){if(Yt)return{longtask:Se};Yt=true;let e=p.PerformanceObserver;if(typeof e!="function")return{longtask:false};try{new e(t=>{if(H())try{for(let r of t.getEntries()){if(r.entryType!=="longtask")continue;let o=r.startTime,n=r.duration;pt(o,o+n),Z.push({start:o,duration:n,at:Date.now(),originKey:Zt(o,n)}),Z.length>eo&&Z.shift()}}catch{}}).observe({entryTypes:["longtask"]}),Se=true}catch{Se=false}return{longtask:Se}}s(Xt,"installLongtaskObserver");function er(){return Z.map(e=>({start:e.start,duration:e.duration,at:e.at,originLabel:e.originKey?Lt(e.originKey):null}))}s(er,"getLongtasks");function tr(e){let t={},r=0,o=0;for(let n of Z){if(n.at>0&&e-n.at>to)continue;r++,n.duration>o&&(o=n.duration);let a=n.originKey??ro,i=t[a];i?(i.count++,n.duration>i.maxMs&&(i.maxMs=n.duration)):t[a]={count:1,maxMs:n.duration}}return{count:r,worstMs:o,byOrigin:t}}s(tr,"getFreezeStats");function rr(){Z.length=0}s(rr,"clearLongtasks");var oo={version:1,getSnapshot:s(()=>({live:f.getSnapshot(),enabled:f.isEnabled()||f.isRemoteSampling()}),"getSnapshot"),subscribe:s(e=>{let t=f.subscribe(()=>e()),r=f.subscribeEnabled(()=>e());return()=>{t(),r()}},"subscribe"),actions:{setEnabled:s(e=>{let t=e.enabled;f.setRemoteSampling(t)},"setEnabled"),pause:s(()=>f.pause(),"pause"),resume:s(()=>f.resume(),"resume"),clear:s(()=>f.clear(),"clear"),getOriginDetail:s(e=>f.getOriginDetail(e.key),"getOriginDetail"),sample:s(async e=>{let t=e,r=Math.min(Math.max(t?.durationMs??3e3,250),3e4),o=f.isRemoteSampling()||f.isEnabled();o||f.setRemoteSampling(true),t?.clearFirst&&f.clear();try{return await new Promise(n=>setTimeout(n,r)),f.getSnapshot()}finally{o||f.setRemoteSampling(false)}},"sample")}};import{useCallback as no,useEffect as ao,useMemo as io,useState as or}from"react";var nr={};Pr(nr,{AccessibilityInfo:()=>co,ActivityIndicator:()=>mn,Alert:()=>gn,Animated:()=>sn,AppRegistry:()=>fo,AppState:()=>mo,Appearance:()=>ho,BackHandler:()=>po,Button:()=>pn,CheckBox:()=>Bo,Clipboard:()=>bo,DeviceEventEmitter:()=>qo,Dimensions:()=>go,Easing:()=>yo,FlatList:()=>Oo,I18nManager:()=>wo,Image:()=>Io,ImageBackground:()=>Po,InteractionManager:()=>xo,Keyboard:()=>So,KeyboardAvoidingView:()=>Fo,LayoutAnimation:()=>Mo,Linking:()=>vo,LogBox:()=>Uo,Modal:()=>hn,NativeEventEmitter:()=>ko,NativeModules:()=>uo,PanResponder:()=>To,Picker:()=>Lo,PixelRatio:()=>Co,Platform:()=>Ao,Pressable:()=>dn,ProgressBar:()=>$o,RefreshControl:()=>Do,SafeAreaView:()=>jo,ScrollView:()=>Qe,SectionList:()=>Wo,Share:()=>Eo,StatusBar:()=>Ho,StyleSheet:()=>V,Switch:()=>fn,Text:()=>h,TextInput:()=>ln,Touchable:()=>Vo,TouchableHighlight:()=>un,TouchableNativeFeedback:()=>No,TouchableOpacity:()=>ce,TouchableWithoutFeedback:()=>cn,UIManager:()=>zo,Vibration:()=>Ro,View:()=>y,VirtualizedList:()=>Jo,YellowBox:()=>Ko,findNodeHandle:()=>bn,unstable_createElement:()=>lo,useColorScheme:()=>_o,useLocaleContext:()=>Qo,useWindowDimensions:()=>Go});Fr(nr,so);import*as so from"react-native-web";import{unstable_createElement as lo,NativeModules as uo,AccessibilityInfo as co,Appearance as ho,AppRegistry as fo,AppState as mo,BackHandler as po,Clipboard as bo,Dimensions as go,Easing as yo,I18nManager as wo,Keyboard as So,InteractionManager as xo,LayoutAnimation as Mo,Linking as vo,NativeEventEmitter as ko,PanResponder as To,PixelRatio as Co,Platform as Ao,Share as Eo,UIManager as zo,Vibration as Ro,CheckBox as Bo,FlatList as Oo,Image as Io,ImageBackground as Po,KeyboardAvoidingView as Fo,Picker as Lo,ProgressBar as $o,RefreshControl as Do,SafeAreaView as jo,SectionList as Wo,StatusBar as Ho,Touchable as Vo,TouchableNativeFeedback as No,VirtualizedList as Jo,YellowBox as Ko,LogBox as Uo,DeviceEventEmitter as qo,useColorScheme as _o,useLocaleContext as Qo,useWindowDimensions as Go}from"react-native-web";import*as z from"react-native-web";import{createElement as Ue,forwardRef as ar,useCallback as Yo,useRef as Zo}from"react";import{useEffect as Xo,useState as en}from"react";import{createPortal as tn}from"react-dom";var rn='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';import{jsx as on}from"react/jsx-runtime";var ue=Symbol.for("@buoy-gg/portal-host"),ir=s(e=>{if(!(e instanceof Element))return false;if(e.closest("input, textarea, select"))return true;let t=e.closest("[contenteditable]")?.getAttribute("contenteditable")?.toLowerCase();return t===""||t==="true"||t==="plaintext-only"},"isTextField");function qe(){let e=document;if(e[ue])return e[ue].host;let t=document.createElement("div");t.dataset.buoyPortalHost="",Object.assign(t.style,{position:"fixed",inset:"0",zIndex:"2147483647",pointerEvents:"none",fontFamily:rn});let r=s(()=>{let u=document.fullscreenElement,b=u&&u.tagName!=="CANVAS"?u:document.body;t.parentElement!==b&&b.appendChild(t)},"move"),o=new Map,n=s(u=>{(!t.contains(u.target)||!ir(u.target))&&o.set(u.code||u.key,{key:u.key,code:u.code,location:u.location,keyCode:u.keyCode,which:u.which,altKey:u.altKey,ctrlKey:u.ctrlKey,metaKey:u.metaKey,shiftKey:u.shiftKey})},"down"),a=s(u=>{o.delete(u.code||u.key)},"up"),i=s(()=>o.clear(),"clear"),l=s(()=>{let u=[...o.values()];o.clear();for(let b of u)document.dispatchEvent(new KeyboardEvent("keyup",{...b,bubbles:true}))},"focus"),c=s(u=>{ir(u.target)&&u.stopPropagation()},"key"),d=s(u=>u.stopPropagation(),"wheel");return r(),document.addEventListener("fullscreenchange",r),document.addEventListener("keydown",n,true),document.addEventListener("keyup",a,true),window.addEventListener("blur",i),t.addEventListener("focusin",l),t.addEventListener("keydown",c),t.addEventListener("keyup",c),t.addEventListener("keypress",c),t.addEventListener("wheel",d,{passive:true}),e[ue]={host:t,users:0,dispose:s(()=>{document.removeEventListener("fullscreenchange",r),document.removeEventListener("keydown",n,true),document.removeEventListener("keyup",a,true),window.removeEventListener("blur",i),t.remove(),delete e[ue]},"dispose")},t}s(qe,"getBuoyPortalHost");function sr({children:e}){let[t,r]=en(null);return Xo(()=>{let o=qe(),n=document[ue];return n.users++,r(o),()=>{--n.users===0&&n.dispose()}},[]),t?tn(on("div",{"data-buoy-root":"",style:{display:"contents",pointerEvents:"auto"},children:e}),t):null}s(sr,"BuoyPortal");var X=z,nn=["shadowColor","shadowOffset","shadowOpacity","shadowRadius","textShadowColor","textShadowOffset","textShadowRadius"],ee=s(e=>typeof e=="number"?`${e}px`:e,"px");function xe(e){if(Array.isArray(e)){let b=e.map(xe);return b.some((m,g)=>m!==e[g])?b:e}if(!e||typeof e!="object"||!nn.some(b=>e[b]!=null))return e;let{shadowColor:t,shadowOffset:r,shadowOpacity:o,shadowRadius:n,textShadowColor:a,textShadowOffset:i,textShadowRadius:l,...c}=e;if(t!=null||r!=null||o!=null||n!=null){let b=t??"black",m=o==null?b:`color-mix(in srgb, ${b} ${Math.min(o,1)*100}%, transparent)`,g=`${ee(r?.width??0)} ${ee(r?.height??0)} ${ee(n??0)} ${m}`;c.boxShadow=typeof c.boxShadow=="string"?`${c.boxShadow}, ${g}`:c.boxShadow??g}let{width:d=0,height:u=0}=i??{};if(a&&(d||u||l)){let b=`${ee(d)} ${ee(u)} ${ee(l??0)} ${a}`;c.textShadow=c.textShadow?`${c.textShadow}, ${b}`:b}return c}s(xe,"webShadows");var an=X.StyleSheet.create({auto:{pointerEvents:"auto"},none:{pointerEvents:"none"},"box-none":{pointerEvents:"box-none"},"box-only":{pointerEvents:"box-only"}});function _e(e,t){if(typeof e=="function")return o=>_e(e(o),t);let r=xe(e);return t?[r,an[t]]:r}s(_e,"webStyle");var V={...X.StyleSheet,create:s(e=>X.StyleSheet.create(Object.fromEntries(Object.entries(e).map(([t,r])=>[t,xe(r)]))),"create")};function B(e){let t=ar((o,n)=>{let{accessibilityState:a,accessibilityValue:i,pointerEvents:l,...c}=o;for(let u of["busy","checked","disabled","expanded","selected"])a?.[u]!==void 0&&c[`aria-${u}`]===void 0&&(c[`aria-${u}`]=a[u]);for(let[u,b]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[u]!==void 0&&c[`aria-${b}`]===void 0&&(c[`aria-${b}`]=i[u]);let d=_e(c.style,l);return d!==c.style&&(c.style=d),Ue(e,{...c,ref:n})}),r=e.State;return r&&Object.assign(t,{State:r}),t.displayName=e.displayName??e.name??"NativeWebView",t}s(B,"withAccessibility");var y=B(z.View),h=B(z.Text),sn={...X.Animated,View:X.Animated.createAnimatedComponent(y),Text:X.Animated.createAnimatedComponent(h)},ln=B(z.TextInput),ce=B(z.TouchableOpacity),un=B(z.TouchableHighlight),cn=B(z.TouchableWithoutFeedback),dn=B(z.Pressable),Qe=B(z.ScrollView),lr=ar((e,t)=>{let r=Zo(null),o=Yo(n=>{if(n){let a=n;for(;a.parentElement&&a.parentElement!==document.body;)a=a.parentElement;a.parentElement===document.body&&(r.current=a,Object.assign(a.style,{position:"relative",zIndex:"2147483647",pointerEvents:"auto"}),qe().appendChild(a))}else r.current&&(document.body.appendChild(r.current),r.current=null);typeof t=="function"?t(n):t&&(t.current=n)},[t]);return Ue(sr,null,Ue(z.Modal,{...e,ref:o}))});lr.displayName="Modal";var hn=B(lr),fn=B(z.Switch),mn=B(z.ActivityIndicator),pn=B(z.Button),bn=z.findNodeHandle,gn={alert(e,t,r,o){if(typeof document>"u")return;let n=document.createElement("dialog");n.dataset.buoyRoot="",n.setAttribute("aria-label",e),n.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let a=document.createElement("h2");if(a.textContent=e,a.style.cssText="font-size:18px;margin:0 0 12px",n.appendChild(a),t){let d=document.createElement("p");d.textContent=t,d.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",n.appendChild(d)}let i=document.createElement("div");i.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let l=r?.length?r:[{text:"OK"}],c=s(()=>{n.close?.(),n.remove()},"close");for(let d of l){let u=document.createElement("button");u.type="button",u.textContent=d.text??"OK",u.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${d.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,u.onclick=()=>{c(),d.onPress?.()},i.appendChild(u)}n.addEventListener("cancel",d=>{d.preventDefault(),o?.cancelable!==false&&(c(),o?.onDismiss?.())}),n.appendChild(i),document.body.appendChild(n),n.showModal?n.showModal():n.setAttribute("open","")}};import{Activity as yn,JsModal as wn,macOSColors as F,night as R,ModalHeader as de,Pause as Sn,Play as xn,Trash2 as Mn}from"@buoy-gg/shared-ui/web";import{memo as vn}from"react";import{macOSColors as Ge}from"@buoy-gg/shared-ui/web";import{jsx as ur}from"react/jsx-runtime";var kn=60;function cr(e){return e>=80?Ge.semantic.error:e>=40?Ge.semantic.warning:Ge.semantic.success}s(cr,"barColor");var Tn=vn(s(function({history:e}){let t=e.slice(-kn);return ur(y,{style:dr.row,pointerEvents:"none",children:t.map((r,o)=>ur(y,{style:[dr.bar,{height:Math.max(2,r/100*28),backgroundColor:cr(r)}]},`b${o}`))})},"BusySparkline")),dr=V.create({row:{flexDirection:"row",alignItems:"flex-end",gap:1,height:28,alignSelf:"stretch"},bar:{flex:1,maxWidth:6,borderRadius:1,opacity:.9}});import{memo as Cn,useState as An}from"react";import{macOSColors as Me,night as k}from"@buoy-gg/shared-ui/web";import{jsx as O,jsxs as $}from"react/jsx-runtime";var En=[{key:"windowMs",title:"RECENT"},{key:"calls",title:"CALLS"},{key:"avgMs",title:"AVG"},{key:"maxMs",title:"MAX"},{key:"totalMs",title:"TOTAL"}],hr={timeout:{text:"TIMEOUT",color:"#38BDF8",prefix:"setTimeout"},interval:{text:"INTERVAL",color:"#22D3EE",prefix:"setInterval"},immediate:{text:"IMMED",color:"#60A5FA",prefix:"setImmediate"},raf:{text:"RAF",color:"#34D399",prefix:"requestAnimationFrame"},microtask:{text:"MICRO",color:"#A78BFA",prefix:"queueMicrotask"},then:{text:"PROMISE",color:"#BF5AF2",prefix:"Promise.then"},bridge:{text:"BRIDGE",color:"#FBBF24",prefix:"bridge"},unattributed:{text:"SYSTEM",color:"#8E8E93"},other:{text:"OTHER",color:"#8E8E93",prefix:"other"}};function ve(e){return hr[e]??hr.other}s(ve,"badgeFor");function Ye(e){if(e.api==="unattributed")return"events \xB7 React \xB7 native call-ins";if(e.api==="other")return e.key==="minor"?e.label:"evicted cold origins";let t=ve(e.api).prefix,r=e.label;return t&&r.startsWith(t)&&(r=r.slice(t.length)),r=r.replace(/^[\s←@]+/,"").trim(),r.length>0?r:"anonymous"}s(Ye,"displayName");function te(e){return e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e>=100?`${Math.round(e)}`:`${Math.round(e*10)/10}`}s(te,"fmt");function fr(e){return e.calls<=0?"measured by probe \xB7 not reachable from JS":`${te(e.calls)} calls \xB7 avg ${te(e.avgMs)} \xB7 max ${te(e.maxMs)} \xB7 total ${te(e.totalMs)} ms`}s(fr,"statsLine");var zn=Cn(s(function({row:e,rank:t,onPress:r}){let o=ve(e.api);return $(r?ce:y,{style:E.row,testID:"buoy-jstop-row",...r?{onPress:s(()=>r(e),"onPress"),activeOpacity:.6}:{},children:[$(y,{style:E.topLine,children:[O(h,{style:E.rank,children:t}),O(y,{style:[E.badge,{borderColor:o.color,backgroundColor:`${o.color}1A`}],children:O(h,{style:[E.badgeText,{color:o.color}],children:o.text})}),O(h,{style:E.name,numberOfLines:1,testID:"buoy-jstop-row-name",children:Ye(e)}),e.freezes>0&&$(h,{style:[E.freezeBadge,e.worstFreezeMs>=100&&E.freezeBadgeSevere],children:["\u26A0 \xD7",e.freezes]}),$(h,{style:[E.windowMs,e.api!=="unattributed"&&e.pctOfBusy>=25&&{color:e.pctOfBusy>=50?Me.semantic.error:Me.semantic.warning}],children:[te(e.windowMs),O(h,{style:E.unit,children:" ms"})]}),$(h,{style:[E.pct,e.api==="unattributed"&&E.pctMuted],children:[Math.round(e.pctOfBusy),"%"]})]}),$(y,{style:E.subLine,children:[O(y,{style:E.barTrack,children:O(y,{style:[E.barFill,{width:`${Math.min(100,e.pctOfBusy)}%`,backgroundColor:o.color}]})}),O(h,{style:E.stats,numberOfLines:1,testID:"buoy-jstop-row-stats",children:fr(e)})]})]})},"TaskRow"),(e,t)=>e.rank===t.rank&&e.onPress===t.onPress&&e.row.key===t.row.key&&e.row.windowMs===t.row.windowMs&&e.row.calls===t.row.calls&&e.row.maxMs===t.row.maxMs&&e.row.totalMs===t.row.totalMs&&e.row.pctOfBusy===t.row.pctOfBusy&&e.row.freezes===t.row.freezes&&e.row.worstFreezeMs===t.row.worstFreezeMs);function mr({rows:e,onSelectRow:t}){let[r,o]=An("windowMs"),n=r==="windowMs"?e:[...e].sort((a,i)=>i[r]-a[r]);return $(y,{style:D.root,children:[$(y,{style:D.sortRow,children:[O(h,{style:D.sortLabel,children:"SORT"}),En.map(a=>O(ce,{onPress:()=>o(a.key),style:[D.sortChip,r===a.key&&D.sortChipOn],children:O(h,{style:[D.sortChipText,r===a.key&&D.sortChipTextOn],children:a.title})},a.key))]}),$(Qe,{keyboardShouldPersistTaps:"handled",style:D.body,children:[n.map((a,i)=>O(zn,{row:a,rank:i+1,onPress:t},a.key)),n.length===0&&O(h,{style:D.empty,testID:"buoy-jstop-empty",children:"No tasks observed yet \u2014 interact with the app."})]})]})}s(mr,"TaskTable");var D=V.create({root:{flex:1,minHeight:0},sortRow:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:6,borderBottomWidth:1,borderBottomColor:k.color.border,backgroundColor:k.color.surface},sortLabel:{color:k.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginRight:2},sortChip:{borderWidth:1,borderColor:k.color.border,borderRadius:4,paddingHorizontal:7,paddingVertical:3},sortChipOn:{borderColor:k.color.accentBorderStrong,backgroundColor:k.color.accentSoft},sortChipText:{color:k.color.textTertiary,fontSize:9,fontWeight:"600",fontVariant:["tabular-nums"]},sortChipTextOn:{color:k.color.accent},body:{flex:1},empty:{color:k.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:24}}),E=V.create({row:{paddingHorizontal:10,paddingVertical:8,borderBottomWidth:V.hairlineWidth,borderBottomColor:k.color.border,gap:5},topLine:{flexDirection:"row",alignItems:"center",gap:6},rank:{width:16,color:k.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:4,paddingVertical:1},badgeText:{fontSize:8,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:k.color.text,fontSize:13,fontWeight:"500"},freezeBadge:{color:Me.semantic.warning,fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},freezeBadgeSevere:{color:Me.semantic.error},windowMs:{color:k.color.text,fontSize:13,fontWeight:"700",fontVariant:["tabular-nums"]},unit:{color:k.color.textTertiary,fontSize:10,fontWeight:"400"},pct:{width:38,textAlign:"right",color:k.color.textSecondary,fontSize:12,fontWeight:"600",fontVariant:["tabular-nums"]},pctMuted:{color:k.color.textTertiary},subLine:{flexDirection:"row",alignItems:"center",gap:8,paddingLeft:22},barTrack:{width:72,height:4,borderRadius:2,backgroundColor:k.color.fillSecondary,overflow:"hidden"},barFill:{height:4,borderRadius:2,opacity:.85},stats:{flex:1,color:k.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]}});import{memo as Rn}from"react";import{macOSColors as ke,night as A,useSafeAreaInsets as Bn}from"@buoy-gg/shared-ui/web";import{Fragment as pr,jsx as x,jsxs as I}from"react/jsx-runtime";var br={timeout:"Work scheduled with setTimeout. Time shown is the callback's exclusive run time on the JS thread.",interval:"A repeating setInterval. One scheduling site, many runs \u2014 a hot interval is the classic silent JS-FPS killer.",immediate:"Work scheduled with setImmediate \u2014 runs at the end of the current event-loop turn.",raf:"requestAnimationFrame work \u2014 runs once per frame while scheduled. Cost here directly trades against 60fps.",microtask:"queueMicrotask work \u2014 runs after the current task, before the thread yields.",then:"Promise reaction (.then/.catch/.finally). Named by the function that attached the reaction. Note: async/await bodies bypass .then and land in the System row instead.",bridge:"A native\u2192JS call-in over the legacy bridge (events, module callbacks), measured as its un-nested remainder.",unattributed:"Thread time the probe measured but no JS wrapper could claim: touch handlers, React commits, native call-ins, and async/await bodies. High here on New Architecture is normal \u2014 it's where UI work lives.",other:"Origins evicted from the table when the registry hit its cap \u2014 their totals are preserved here."};function gr(e){return br[e]??br.other}s(gr,"explainerFor");function N(e){return e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e>=100?`${Math.round(e)}`:`${Math.round(e*100)/100}`}s(N,"fmt");function yr(e){if(e<=0)return"\u2014";let t=e/1e3;return t<1?"just now":t<60?`${Math.round(t)}s ago`:`${Math.floor(t/60)}m ago`}s(yr,"agoFmt");function j({label:e,value:t,accent:r}){return I(y,{style:w.stat,children:[x(h,{style:w.statLabel,children:e}),x(h,{style:[w.statValue,r?{color:r}:null],children:t})]})}s(j,"Stat");var On=Rn(s(function({detail:e}){let t=ve(e.api),r=Bn({minBottom:12}),o=Math.max(1,...e.buckets);return I(Qe,{keyboardShouldPersistTaps:"handled",style:w.root,testID:"buoy-jstop-detail",contentContainerStyle:{paddingBottom:r.bottom},children:[I(y,{style:w.identityRow,children:[x(y,{style:[w.badge,{borderColor:t.color,backgroundColor:`${t.color}1A`}],children:x(h,{style:[w.badgeText,{color:t.color}],children:t.text})}),x(h,{style:w.name,numberOfLines:2,testID:"buoy-jstop-detail-name",children:Ye(e)})]}),x(h,{style:w.explainer,children:gr(e.api)}),x(h,{style:w.sectionTitle,children:"ACTIVITY \xB7 LAST 5S"}),x(y,{style:w.chartRow,children:e.buckets.map((n,a)=>x(y,{style:w.chartBarSlot,children:x(y,{style:[w.chartBar,{height:Math.max(2,n/o*44),backgroundColor:t.color}]})},`bk${a}`))}),I(y,{style:w.chartLegend,children:[I(h,{style:w.chartLegendText,children:[N(e.windowMs)," ms in window \xB7 ",e.pctOfBusy.toFixed(1),"% of busy time"]}),I(h,{style:w.chartLegendText,children:["peak ",N(o)," ms/250ms"]})]}),x(h,{style:w.sectionTitle,children:"STATS \xB7 SINCE START"}),I(y,{style:w.statGrid,children:[x(j,{label:"RUNS",value:e.calls>0?N(e.calls):"\u2014"}),x(j,{label:"SCHEDULED",value:e.scheduleCount>0?N(e.scheduleCount):"\u2014"}),x(j,{label:"AVG / RUN",value:e.calls>0?`${N(e.avgMs)} ms`:"\u2014"}),x(j,{label:"MAX / RUN",value:e.maxMs>0?`${N(e.maxMs)} ms`:"\u2014",accent:e.maxMs>=50?ke.semantic.warning:void 0}),x(j,{label:"TOTAL",value:e.totalMs>0?`${N(e.totalMs)} ms`:"\u2014"}),x(j,{label:"LAST RUN",value:yr(e.lastSeenAgoMs)}),x(j,{label:"FREEZES \xB7 60S",value:e.freezes>0?`${e.freezes}`:"0",accent:e.freezes>0?ke.semantic.error:void 0}),x(j,{label:"WORST FREEZE",value:e.worstFreezeMs>0?`${e.worstFreezeMs} ms`:"\u2014",accent:e.worstFreezeMs>=100?ke.semantic.error:e.worstFreezeMs>0?ke.semantic.warning:void 0})]}),(e.caller||(e.frames?.length??0)>0)&&I(pr,{children:[x(h,{style:w.sectionTitle,children:"SCHEDULED FROM"}),I(y,{style:w.siteCard,children:[e.caller&&I(h,{style:w.siteCaller,children:[e.caller,"()"]}),e.file&&I(h,{style:w.siteFile,children:[e.file,e.line!=null?`:${e.line}`:""]}),e.frames?.map((n,a)=>I(h,{style:w.siteFrame,numberOfLines:1,children:[n.file,":",n.line,":",n.col]},`fr${a}`)),x(h,{style:w.siteNote,children:"Frames are bundle offsets (Hermes) \u2014 the caller name above is the readable part. Captured once when this origin got hot."})]})]}),!e.caller&&(e.frames?.length??0)===0&&e.api!=="unattributed"&&e.api!=="other"&&I(pr,{children:[x(h,{style:w.sectionTitle,children:"SCHEDULED FROM"}),x(h,{style:w.sitePending,children:e.promoted?"Stack capture pending \u2014 next schedule from this site will record it.":"Not hot enough yet \u2014 the scheduling stack is captured once an origin passes 25 schedules or 50ms total."})]})]})},"TaskDetailView")),w=V.create({root:{flex:1,backgroundColor:"transparent",paddingHorizontal:12},identityRow:{flexDirection:"row",alignItems:"center",gap:8,paddingTop:12},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:5,paddingVertical:2},badgeText:{fontSize:9,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:A.color.text,fontSize:15,fontWeight:"600"},explainer:{color:A.color.textTertiary,fontSize:11,lineHeight:15,marginTop:6,marginBottom:4},sectionTitle:{color:A.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginTop:14,marginBottom:6},chartRow:{flexDirection:"row",alignItems:"flex-end",height:48,gap:2,backgroundColor:A.color.surface,borderRadius:6,borderWidth:1,borderColor:A.color.border,paddingHorizontal:6,paddingTop:2},chartBarSlot:{flex:1,alignItems:"center",justifyContent:"flex-end"},chartBar:{width:"70%",borderTopLeftRadius:2,borderTopRightRadius:2,opacity:.9},chartLegend:{flexDirection:"row",justifyContent:"space-between",marginTop:4},chartLegendText:{color:A.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},statGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},stat:{width:"23%",minWidth:76,flexGrow:1,backgroundColor:A.color.surface,borderWidth:1,borderColor:A.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:6},statLabel:{color:A.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.4,marginBottom:3},statValue:{color:A.color.text,fontSize:13,fontWeight:"600",fontVariant:["tabular-nums"]},siteCard:{backgroundColor:A.color.surface,borderWidth:1,borderColor:A.color.border,borderRadius:6,padding:10,gap:3},siteCaller:{color:A.color.text,fontSize:13,fontWeight:"600"},siteFile:{color:A.color.info,fontSize:11},siteFrame:{color:A.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},siteNote:{color:A.color.textTertiary,fontSize:9,opacity:.8,marginTop:4},sitePending:{color:A.color.textTertiary,fontSize:11}});import{Fragment as In,jsx as S,jsxs as W}from"react/jsx-runtime";function Ze(e){return e>=80?F.semantic.error:e>=40?F.semantic.warning:F.semantic.success}s(Ze,"busyColor");function Te(e){return e>=100?F.semantic.error:F.semantic.warning}s(Te,"freezeColor");function wr(e){let t=e.rows.find(r=>r.api!=="unattributed"&&r.api!=="other");return t&&t.pctOfBusy>=25&&e.busyPct>=15?{color:t.pctOfBusy>=50?F.semantic.error:F.semantic.warning,icon:"\u25B2",text:`${t.label} is eating ${Math.round(t.pctOfBusy)}% of thread time \u2014 start there.`}:e.freezeSummary.count>0?{color:Te(e.freezeSummary.worstMs),icon:"\u25B2",text:`${e.freezeSummary.count} freeze${e.freezeSummary.count===1?"":"s"} in the last 60s (worst ${e.freezeSummary.worstMs}ms) \u2014 check rows marked \u26A0.`}:e.busyPct>=80?{color:F.semantic.warning,icon:"\u25B2",text:"Thread saturated by UI/React work \u2014 open Highlight Updates to find re-renders."}:{color:F.semantic.success,icon:"\u25CF",text:`Thread healthy at ${Math.round(e.busyPct)}% load \u2014 nothing worth chasing.`}}s(wr,"diagnose");function Xe({visible:e,onClose:t,onBack:r,onMinimize:o,initialModalState:n,minimizeTargetPosition:a,remoteSnapshot:i,remoteActions:l,embedded:c=false}){let d=i!==void 0,[u,b]=or(null);ao(()=>{if(!(d||!e))return f.subscribe(b)},[d,e]);let m=d?i:u,g=io(()=>l??{pause:s(()=>f.pause(),"pause"),resume:s(()=>f.resume(),"resume"),clear:s(()=>f.clear(),"clear")},[l]),v=m?.paused??false,Ce=(m?.rows.length??0)>0,[Ae,nt]=or(null),Rr=no(K=>nt(K.key),[]),at=!d&&Ae?f.getOriginDetail(Ae):null,it=Ae!==null,st=W(de,{children:[it?S(de.Navigation,{onBack:()=>nt(null)}):r?S(de.Navigation,{onBack:r}):null,S(de.Content,{title:"",noMargin:true,children:W(y,{style:M.titleRow,children:[S(yn,{size:14,color:"#34D399"}),S(h,{style:M.title,testID:"buoy-jstop-title",children:"JS Top"}),m&&S(y,{style:[M.busyPill,{borderColor:Ze(m.busyPct)}],children:W(h,{testID:"buoy-jstop-busy",style:[M.busyText,{color:Ze(m.busyPct)}],children:[m.busyPct.toFixed(0),"% BUSY"]})}),m&&m.freezeSummary.count>0&&S(y,{style:[M.busyPill,{borderColor:Te(m.freezeSummary.worstMs)}],children:W(h,{testID:"buoy-jstop-freezes",style:[M.busyText,{color:Te(m.freezeSummary.worstMs)}],children:["\u26A0 ",m.freezeSummary.count," \xB7"," ",m.freezeSummary.worstMs,"ms"]})})]})}),W(de.Actions,{children:[S(ce,{onPress:v?g.resume:g.pause,style:[M.actionBtn,v&&M.actionBtnActive],testID:"buoy-jstop-pause",accessibilityLabel:v?"Resume sampling":"Pause sampling",children:v?S(xn,{size:14,color:R.color.accent}):S(Sn,{size:14,color:R.color.textSecondary})}),S(ce,{onPress:g.clear,disabled:!Ce,style:[M.actionBtn,!Ce&&M.actionBtnDisabled],testID:"buoy-jstop-clear",accessibilityLabel:"Clear stats",children:S(Mn,{size:14,color:Ce?R.color.textTertiary:R.color.textTertiary})})]})]}),lt=S(y,{style:M.body,children:it?at?S(On,{detail:at}):S(h,{style:M.waiting,children:"This origin is no longer tracked (cleared or evicted)."}):m?W(In,{children:[(()=>{let K=wr(m);return W(y,{style:[M.diagnosis,{borderLeftColor:K.color}],children:[S(h,{style:[M.diagnosisIcon,{color:K.color}],children:K.icon}),S(h,{style:M.diagnosisText,children:K.text})]})})(),W(y,{style:M.sparklineRow,children:[S(h,{style:M.sparklineCaption,children:"JS THREAD LOAD \xB7 LAST 30s"}),S(Tn,{history:m.busyHistory})]}),!m.tiers.bridge&&S(h,{style:M.tierBanner,children:"\u201CSystem\u201D rows are UI/React/native work pure JS can\u2019t name \u2014 timers, rAF and Promise chains are fully attributed."}),S(mr,{rows:m.rows,onSelectRow:d?void 0:Rr})]}):S(h,{style:M.waiting,children:d?"Waiting for device\u2026":"Starting engine\u2026"})});return c?W(y,{style:M.embeddedRoot,children:[S(y,{style:M.embeddedHeader,children:st}),lt]}):S(wn,{visible:e,onClose:t,onMinimize:o,minimizeTargetPosition:a,initialModalState:n,header:{showToggleButton:true,customContent:st},persistenceKey:"buoy-js-top-modal",enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:lt})}s(Xe,"JsTopModal");var M=V.create({titleRow:{flexDirection:"row",alignItems:"center",gap:8},title:{color:R.color.text,fontSize:14,fontWeight:"500"},busyPill:{borderWidth:1,borderRadius:4,paddingHorizontal:6,paddingVertical:2},busyText:{fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},actionBtn:{width:32,height:32,borderRadius:8,backgroundColor:R.color.buttonSurface,borderWidth:1,borderColor:R.color.border,alignItems:"center",justifyContent:"center"},actionBtnActive:{backgroundColor:R.color.accentSoft,borderColor:R.color.accentBorderStrong},actionBtnDisabled:{opacity:.55},body:{flex:1,minHeight:0,backgroundColor:"transparent"},diagnosis:{flexDirection:"row",alignItems:"center",gap:8,marginHorizontal:10,marginTop:8,paddingHorizontal:10,paddingVertical:8,backgroundColor:R.color.surface,borderRadius:6,borderLeftWidth:3},diagnosisIcon:{fontSize:11,fontWeight:"700"},diagnosisText:{flex:1,color:R.color.text,fontSize:12,lineHeight:16},sparklineRow:{paddingHorizontal:10,paddingVertical:8,gap:4},sparklineCaption:{color:R.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.5},tierBanner:{color:R.color.textTertiary,fontSize:10,paddingHorizontal:10,paddingBottom:6},waiting:{color:R.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:32},embeddedRoot:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:F.background.base},embeddedHeader:{borderBottomWidth:1,borderBottomColor:F.border.default}});import{useEffect as Sr,useState as xr}from"react";import{macOSColors as et,night as tt}from"@buoy-gg/shared-ui/web";import{jsx as Pn,jsxs as Mr}from"react/jsx-runtime";function vr(e){return e>=80?et.semantic.error:e>=40?et.semantic.warning:et.semantic.success}s(vr,"busyColor");function kr(){let[e,t]=xr(()=>f.isEnabled()),[r,o]=xr(null);if(Sr(()=>f.subscribeEnabled(t),[]),Sr(()=>{if(!e){o(null);return}return f.subscribe(o)},[e]),!e||!r)return null;let n=r.rows.find(a=>a.api!=="unattributed");return Mr(y,{style:rt.pill,pointerEvents:"none",children:[Mr(h,{style:[rt.busy,{color:vr(r.busyPct)}],children:[r.busyPct.toFixed(0),"%"]}),n&&Pn(h,{style:rt.label,numberOfLines:1,children:n.label})]})}s(kr,"JsTopHudOverlay");var rt=V.create({pill:{position:"absolute",top:60,left:8,flexDirection:"row",alignItems:"center",gap:6,backgroundColor:tt.color.buttonSurface,borderWidth:1,borderColor:tt.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:4,maxWidth:220},busy:{fontSize:11,fontWeight:"700",fontVariant:["tabular-nums"]},label:{color:tt.color.textSecondary,fontSize:10,flexShrink:1}});import{useEffect as Fn,useState as Ln}from"react";import{Activity as Tr}from"@buoy-gg/shared-ui/web";import{jsx as Cr}from"react/jsx-runtime";var ot="#34D399",Ar="#6B7280";function Er({size:e}){let[t,r]=Ln(()=>f.isEnabled());return Fn(()=>f.subscribeEnabled(r),[]),Cr(Tr,{size:e,color:t?ot:Ar})}s(Er,"JsTopToggleIcon");function zr(){return null}s(zr,"EmptyComponent");var $n={id:"js-top",name:"JS TOP",description:"Toggle the floating JS-thread busy pill",slot:"row",icon:Er,component:zr,props:{},launchMode:"toggle-only",onPress:s(()=>{f.setEnabled(!f.isEnabled())},"onPress")},Dn={id:"js-top-modal",name:"TASKS",description:"Live Task Manager for the JS thread",slot:"both",icon:s(({size:e})=>Cr(Tr,{size:e,color:ot}),"icon"),component:Xe,props:{enableSharedModalDimensions:false}};f.registerTierInstaller(Qt);f.registerTierInstaller(Gt);f.registerTierInstaller(Xt);f.registerLongtaskProvider(er);f.registerFreezeStatsProvider(tr);f.registerClearHook(rr);try{typeof window<"u"&&(We(),He())}catch{}export{Ar as JS_TOP_DISABLED_COLOR,ot as JS_TOP_ENABLED_COLOR,f as JsTopController,kr as JsTopHudOverlay,Xe as JsTopModal,Dn as jsTopModalPreset,$n as jsTopPreset,oo as jsTopSyncAdapter};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/js-top",
3
- "version": "7.0.77",
3
+ "version": "7.0.78",
4
4
  "description": "Inspect instrumented JavaScript timers, promises and callbacks to investigate work on the React Native JS thread.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "sideEffects": false,
14
14
  "dependencies": {
15
- "@buoy-gg/shared-ui": "^7.0.77"
15
+ "@buoy-gg/shared-ui": "^7.0.78"
16
16
  },
17
17
  "peerDependencies": {
18
18
  "react": "*"