@buoy-gg/js-top 7.0.67 → 7.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/js-top/components/JsTopModal.js +1 -1
- package/lib/commonjs/js-top/components/TaskDetailView.js +1 -1
- package/lib/commonjs/js-top/components/TaskTable.js +1 -1
- package/lib/module/js-top/components/JsTopModal.js +1 -1
- package/lib/module/js-top/components/TaskDetailView.js +1 -1
- package/lib/module/js-top/components/TaskTable.js +1 -1
- package/lib/web/index.mjs +2 -2
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.JsTopModal=JsTopModal;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _JsTopController=require("../engine/JsTopController");var _BusySparkline=require("./BusySparkline");var _TaskTable=require("./TaskTable");var _TaskDetailView=require("./TaskDetailView");var _jsxRuntime=require("react/jsx-runtime");function busyColor(e){if(e>=80)return _sharedUi.macOSColors.semantic.error;if(e>=40)return _sharedUi.macOSColors.semantic.warning;return _sharedUi.macOSColors.semantic.success}function freezeColor(e){return e>=100?_sharedUi.macOSColors.semantic.error:_sharedUi.macOSColors.semantic.warning}function diagnose(e){const r=e.rows.find(n=>n.api!=="unattributed"&&n.api!=="other");if(r&&r.pctOfBusy>=25&&e.busyPct>=15){return{color:r.pctOfBusy>=50?_sharedUi.macOSColors.semantic.error:_sharedUi.macOSColors.semantic.warning,icon:"\u25B2",text:`${r.label} is eating ${Math.round(r.pctOfBusy)}% of thread time \u2014 start there.`}}if(e.freezeSummary.count>0){return{color:freezeColor(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.`}}if(e.busyPct>=80){return{color:_sharedUi.macOSColors.semantic.warning,icon:"\u25B2",text:"Thread saturated by UI/React work \u2014 open Highlight Updates to find re-renders."}}return{color:_sharedUi.macOSColors.semantic.success,icon:"\u25CF",text:`Thread healthy at ${Math.round(e.busyPct)}% load \u2014 nothing worth chasing.`}}function JsTopModal({visible:e,onClose:r,onBack:n,onMinimize:x,initialModalState:p,minimizeTargetPosition:f,remoteSnapshot:d,remoteActions:u,embedded:S=false}){const o=d!==void 0;const[T,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.JsTopModal=JsTopModal;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _JsTopController=require("../engine/JsTopController");var _BusySparkline=require("./BusySparkline");var _TaskTable=require("./TaskTable");var _TaskDetailView=require("./TaskDetailView");var _jsxRuntime=require("react/jsx-runtime");function busyColor(e){if(e>=80)return _sharedUi.macOSColors.semantic.error;if(e>=40)return _sharedUi.macOSColors.semantic.warning;return _sharedUi.macOSColors.semantic.success}function freezeColor(e){return e>=100?_sharedUi.macOSColors.semantic.error:_sharedUi.macOSColors.semantic.warning}function diagnose(e){const r=e.rows.find(n=>n.api!=="unattributed"&&n.api!=="other");if(r&&r.pctOfBusy>=25&&e.busyPct>=15){return{color:r.pctOfBusy>=50?_sharedUi.macOSColors.semantic.error:_sharedUi.macOSColors.semantic.warning,icon:"\u25B2",text:`${r.label} is eating ${Math.round(r.pctOfBusy)}% of thread time \u2014 start there.`}}if(e.freezeSummary.count>0){return{color:freezeColor(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.`}}if(e.busyPct>=80){return{color:_sharedUi.macOSColors.semantic.warning,icon:"\u25B2",text:"Thread saturated by UI/React work \u2014 open Highlight Updates to find re-renders."}}return{color:_sharedUi.macOSColors.semantic.success,icon:"\u25CF",text:`Thread healthy at ${Math.round(e.busyPct)}% load \u2014 nothing worth chasing.`}}function JsTopModal({visible:e,onClose:r,onBack:n,onMinimize:x,initialModalState:p,minimizeTargetPosition:f,remoteSnapshot:d,remoteActions:u,embedded:S=false}){const o=d!==void 0;const[T,j]=(0,_react.useState)(null);(0,_react.useEffect)(()=>{if(o||!e)return;return _JsTopController.JsTopController.subscribe(j)},[o,e]);const t=o?d:T;const a=(0,_react.useMemo)(()=>u??{pause:()=>_JsTopController.JsTopController.pause(),resume:()=>_JsTopController.JsTopController.resume(),clear:()=>_JsTopController.JsTopController.clear()},[u]);const s=t?.paused??false;const l=(t?.rows.length??0)>0;const[c,g]=(0,_react.useState)(null);const w=(0,_react.useCallback)(i=>g(i.key),[]);const y=!o&&c?_JsTopController.JsTopController.getOriginDetail(c):null;const h=c!==null;const b=(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[h?(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:()=>g(null)}):n?(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:n}):null,(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"",noMargin:true,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.titleRow,children:[(0,_jsxRuntime.jsx)(_sharedUi.Activity,{size:14,color:"#34D399"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.title,testID:"buoy-jstop-title",children:"JS Top"}),t&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.busyPill,{borderColor:busyColor(t.busyPct)}],children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{testID:"buoy-jstop-busy",style:[styles.busyText,{color:busyColor(t.busyPct)}],children:[t.busyPct.toFixed(0),"% BUSY"]})}),t&&t.freezeSummary.count>0&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.busyPill,{borderColor:freezeColor(t.freezeSummary.worstMs)}],children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{testID:"buoy-jstop-freezes",style:[styles.busyText,{color:freezeColor(t.freezeSummary.worstMs)}],children:["\u26A0 ",t.freezeSummary.count," \xB7"," ",t.freezeSummary.worstMs,"ms"]})})]})}),(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader.Actions,{children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:s?a.resume:a.pause,style:[styles.actionBtn,s&&styles.actionBtnActive],testID:"buoy-jstop-pause",accessibilityLabel:s?"Resume sampling":"Pause sampling",children:s?(0,_jsxRuntime.jsx)(_sharedUi.Play,{size:14,color:_sharedUi.night.color.accent}):(0,_jsxRuntime.jsx)(_sharedUi.Pause,{size:14,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:a.clear,disabled:!l,style:[styles.actionBtn,!l&&styles.actionBtnDisabled],testID:"buoy-jstop-clear",accessibilityLabel:"Clear stats",children:(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:14,color:l?_sharedUi.night.color.textTertiary:_sharedUi.night.color.textTertiary})})]})]});const m=(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.body,children:h?y?(0,_jsxRuntime.jsx)(_TaskDetailView.TaskDetailView,{detail:y}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.waiting,children:"This origin is no longer tracked (cleared or evicted)."}):t?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(()=>{const i=diagnose(t);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.diagnosis,{borderLeftColor:i.color}],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.diagnosisIcon,{color:i.color}],children:i.icon}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diagnosisText,children:i.text})]})})(),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sparklineRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sparklineCaption,children:"JS THREAD LOAD \xB7 LAST 30s"}),(0,_jsxRuntime.jsx)(_BusySparkline.BusySparkline,{history:t.busyHistory})]}),!t.tiers.bridge&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tierBanner,children:"\u201CSystem\u201D rows are UI/React/native work pure JS can\u2019t name \u2014 timers, rAF and Promise chains are fully attributed."}),(0,_jsxRuntime.jsx)(_TaskTable.TaskTable,{rows:t.rows,onSelectRow:o?void 0:w})]}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.waiting,children:o?"Waiting for device\u2026":"Starting engine\u2026"})});if(S){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.embeddedRoot,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.embeddedHeader,children:b}),m]})}return(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{visible:e,onClose:r,onMinimize:x,minimizeTargetPosition:f,initialModalState:p,header:{showToggleButton:true,customContent:b},persistenceKey:"buoy-js-top-modal",enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:m})}const styles=_reactNative.StyleSheet.create({titleRow:{flexDirection:"row",alignItems:"center",gap:8},title:{color:_sharedUi.night.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:_sharedUi.night.color.buttonSurface,borderWidth:1,borderColor:_sharedUi.night.color.border,alignItems:"center",justifyContent:"center"},actionBtnActive:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.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:_sharedUi.night.color.surface,borderRadius:6,borderLeftWidth:3},diagnosisIcon:{fontSize:11,fontWeight:"700"},diagnosisText:{flex:1,color:_sharedUi.night.color.text,fontSize:12,lineHeight:16},sparklineRow:{paddingHorizontal:10,paddingVertical:8,gap:4},sparklineCaption:{color:_sharedUi.night.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.5},tierBanner:{color:_sharedUi.night.color.textTertiary,fontSize:10,paddingHorizontal:10,paddingBottom:6},waiting:{color:_sharedUi.night.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:32},embeddedRoot:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:_sharedUi.macOSColors.background.base},embeddedHeader:{borderBottomWidth:1,borderBottomColor:_sharedUi.macOSColors.border.default}});
|
|
@@ -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,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,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,{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(
|
|
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"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 +1 @@
|
|
|
1
|
-
"use strict";import{useCallback as
|
|
1
|
+
"use strict";import{useCallback as L,useEffect as O,useMemo as V,useState as D}from"react";import{StyleSheet as J,Text as a,TouchableOpacity as P,View as l}from"react-native";import{Activity as $,JsModal as F,macOSColors as n,night as i,ModalHeader as y,Pause as U,Play as K,Trash2 as _}from"@buoy-gg/shared-ui";import{JsTopController as b}from"../engine/JsTopController";import{BusySparkline as E}from"./BusySparkline";import{TaskTable as N}from"./TaskTable";import{TaskDetailView as Y}from"./TaskDetailView";import{jsx as e,jsxs as s,Fragment as q}from"react/jsx-runtime";function R(o){if(o>=80)return n.semantic.error;if(o>=40)return n.semantic.warning;return n.semantic.success}function S(o){return o>=100?n.semantic.error:n.semantic.warning}function G(o){const c=o.rows.find(m=>m.api!=="unattributed"&&m.api!=="other");if(c&&c.pctOfBusy>=25&&o.busyPct>=15){return{color:c.pctOfBusy>=50?n.semantic.error:n.semantic.warning,icon:"\u25B2",text:`${c.label} is eating ${Math.round(c.pctOfBusy)}% of thread time \u2014 start there.`}}if(o.freezeSummary.count>0){return{color:S(o.freezeSummary.worstMs),icon:"\u25B2",text:`${o.freezeSummary.count} freeze${o.freezeSummary.count===1?"":"s"} in the last 60s (worst ${o.freezeSummary.worstMs}ms) \u2014 check rows marked \u26A0.`}}if(o.busyPct>=80){return{color:n.semantic.warning,icon:"\u25B2",text:"Thread saturated by UI/React work \u2014 open Highlight Updates to find re-renders."}}return{color:n.semantic.success,icon:"\u25CF",text:`Thread healthy at ${Math.round(o.busyPct)}% load \u2014 nothing worth chasing.`}}export function JsTopModal({visible:o,onClose:c,onBack:m,onMinimize:M,initialModalState:H,minimizeTargetPosition:I,remoteSnapshot:w,remoteActions:x,embedded:j=false}){const d=w!==void 0;const[W,A]=D(null);O(()=>{if(d||!o)return;return b.subscribe(A)},[d,o]);const r=d?w:W;const f=V(()=>x??{pause:()=>b.pause(),resume:()=>b.resume(),clear:()=>b.clear()},[x]);const g=r?.paused??false;const h=(r?.rows.length??0)>0;const[p,z]=D(null);const v=L(u=>z(u.key),[]);const T=!d&&p?b.getOriginDetail(p):null;const C=p!==null;const B=s(y,{children:[C?e(y.Navigation,{onBack:()=>z(null)}):m?e(y.Navigation,{onBack:m}):null,e(y.Content,{title:"",noMargin:true,children:s(l,{style:t.titleRow,children:[e($,{size:14,color:"#34D399"}),e(a,{style:t.title,testID:"buoy-jstop-title",children:"JS Top"}),r&&e(l,{style:[t.busyPill,{borderColor:R(r.busyPct)}],children:s(a,{testID:"buoy-jstop-busy",style:[t.busyText,{color:R(r.busyPct)}],children:[r.busyPct.toFixed(0),"% BUSY"]})}),r&&r.freezeSummary.count>0&&e(l,{style:[t.busyPill,{borderColor:S(r.freezeSummary.worstMs)}],children:s(a,{testID:"buoy-jstop-freezes",style:[t.busyText,{color:S(r.freezeSummary.worstMs)}],children:["\u26A0 ",r.freezeSummary.count," \xB7"," ",r.freezeSummary.worstMs,"ms"]})})]})}),s(y.Actions,{children:[e(P,{onPress:g?f.resume:f.pause,style:[t.actionBtn,g&&t.actionBtnActive],testID:"buoy-jstop-pause",accessibilityLabel:g?"Resume sampling":"Pause sampling",children:g?e(K,{size:14,color:i.color.accent}):e(U,{size:14,color:i.color.textSecondary})}),e(P,{onPress:f.clear,disabled:!h,style:[t.actionBtn,!h&&t.actionBtnDisabled],testID:"buoy-jstop-clear",accessibilityLabel:"Clear stats",children:e(_,{size:14,color:h?i.color.textTertiary:i.color.textTertiary})})]})]});const k=e(l,{style:t.body,children:C?T?e(Y,{detail:T}):e(a,{style:t.waiting,children:"This origin is no longer tracked (cleared or evicted)."}):r?s(q,{children:[(()=>{const u=G(r);return s(l,{style:[t.diagnosis,{borderLeftColor:u.color}],children:[e(a,{style:[t.diagnosisIcon,{color:u.color}],children:u.icon}),e(a,{style:t.diagnosisText,children:u.text})]})})(),s(l,{style:t.sparklineRow,children:[e(a,{style:t.sparklineCaption,children:"JS THREAD LOAD \xB7 LAST 30s"}),e(E,{history:r.busyHistory})]}),!r.tiers.bridge&&e(a,{style:t.tierBanner,children:"\u201CSystem\u201D rows are UI/React/native work pure JS can\u2019t name \u2014 timers, rAF and Promise chains are fully attributed."}),e(N,{rows:r.rows,onSelectRow:d?void 0:v})]}):e(a,{style:t.waiting,children:d?"Waiting for device\u2026":"Starting engine\u2026"})});if(j){return s(l,{style:t.embeddedRoot,children:[e(l,{style:t.embeddedHeader,children:B}),k]})}return e(F,{visible:o,onClose:c,onMinimize:M,minimizeTargetPosition:I,initialModalState:H,header:{showToggleButton:true,customContent:B},persistenceKey:"buoy-js-top-modal",enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:k})}const t=J.create({titleRow:{flexDirection:"row",alignItems:"center",gap:8},title:{color:i.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:i.color.buttonSurface,borderWidth:1,borderColor:i.color.border,alignItems:"center",justifyContent:"center"},actionBtnActive:{backgroundColor:i.color.accentSoft,borderColor:i.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:i.color.surface,borderRadius:6,borderLeftWidth:3},diagnosisIcon:{fontSize:11,fontWeight:"700"},diagnosisText:{flex:1,color:i.color.text,fontSize:12,lineHeight:16},sparklineRow:{paddingHorizontal:10,paddingVertical:8,gap:4},sparklineCaption:{color:i.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.5},tierBanner:{color:i.color.textTertiary,fontSize:10,paddingHorizontal:10,paddingBottom:6},waiting:{color:i.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:32},embeddedRoot:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:n.background.base},embeddedHeader:{borderBottomWidth:1,borderBottomColor:n.border.default}});
|
|
@@ -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,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,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,{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 b,useState as x}from"react";import{ScrollView as
|
|
1
|
+
"use strict";import{memo as b,useState as x}from"react";import{ScrollView as w,StyleSheet as m,Text as l,TouchableOpacity as g,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 M=[{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"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 T=b(function t({row:e,rank:i,onPress:u}){const d=badgeFor(e.api);const n=u?g: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"}),M.map(n=>a(g,{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(w,{style:c.body,children:[d.map((n,y)=>a(T,{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 Te=Object.defineProperty;var Ar=Object.getOwnPropertyDescriptor;var Er=Object.getOwnPropertyNames;var zr=Object.prototype.hasOwnProperty;var s=(e,t)=>Te(e,"name",{value:t,configurable:true});var Br=(e,t)=>{for(var r in t)Te(e,r,{get:t[r],enumerable:true})},at=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Er(t))!zr.call(e,o)&&o!==r&&Te(e,o,{get:()=>t[o],enumerable:!(n=Ar(t,o))||n.enumerable});return e},Rr=(e,t,r)=>(at(e,t,"default"),r&&at(r,t,"default"));var ee=(()=>{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 ce=typeof globalThis<"u"?globalThis:void 0,
|
|
2
|
-
`);for(let o of n){let a=/at\s+(.*?)\s+\((?:address at\s+)?(.*?):(\d+):(\d+)\)/.exec(o)??/at\s+()(.*?):(\d+):(\d+)$/.exec(o.trim())??/^([^@\s]*)@(.+?):(\d+):(\d+)$/.exec(o.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(Et,"parseStack");function zt(e,t){return t-e.lastCaptureAt<$r||(t-Ct>1e3&&(Ct=t,Re=0),Re>=Dr)?false:(Re++,e.lastCaptureAt=t,true)}s(zt,"allowCapture");function fe(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(fe,"shortFile");function Bt(e){return A.has(e)}s(Bt,"buoyJsTopOriginExists");function pe(e,t,r,n=true){let o=t,a=typeof o.displayName=="string"&&o.displayName||typeof o.name=="string"&&o.name||"anonymous",i=`${e}|${a}`,l=A.get(i);if(l||(A.size>=500&&Pe(r),l=me(i,e,a==="anonymous"?_(e):`${_(e)} ${a}`),A.set(i,l)),l.scheduleCount++,!l.promoted&&(l.scheduleCount>=25||l.totalMs>=50)&&(l.promoted=true),(l.promoted||e==="interval")&&n&&zt(l,r)){let{caller:c,frames:d}=Et(new Error().stack??""),u=d[0];if(u||c){let C=u?`${fe(u.file)??"?"}:${u.line}`:"?",p=`${i}@${c??"?"}:${C}`,y=A.get(p);if(!y){A.size>=500&&Pe(r);let S=a==="anonymous"?_(e):`${_(e)} ${a}`;y=me(p,e,c?`${S} \u2190 ${c}`:a==="anonymous"?`${S} @ ${fe(u?.file??"")??"?"}`:S),y.caller=c,y.file=u?fe(u.file):void 0,y.line=u?.line,y.frames=d,y.promoted=true,y.calls=l.calls,y.totalMs=l.totalMs,y.maxMs=l.maxMs,y.scheduleCount=l.scheduleCount,y.lastSeenAt=l.lastSeenAt,y.ring.set(l.ring),y.ringStamps.set(l.ringStamps),l.calls=0,l.totalMs=0,l.maxMs=0,l.ring.fill(0),l.ringStamps.fill(-1),A.set(p,y),kt(y,_(e))}l.activeRefinedKey=p}}return l.activeRefinedKey??i}s(pe,"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 Rt(e,t,r,n){let o=A.get(e);if(!o)return;o.calls++,o.totalMs+=t,t>o.maxMs&&(o.maxMs=t),o.lastSeenAt=n,!o.promoted&&o.totalMs>=50&&(o.promoted=true);let a=n-r,i=a>0?Math.min(1,t/a):1,l=Math.max(r,n-5e3),c=L(l),d=L(n),u=l;for(;c<=d;){let C=(c+1)*250,p=Math.min(n,C),y=p-u;if(y>0){let S=c%20;S>=0&&(o.ringStamps[S]!==c&&(o.ringStamps[S]=c,o.ring[S]=0),o.ring[S]+=a>0?y*i:t)}u=p,c++}ct(r,n,t)}s(Rt,"buoyJsTopBookExclusive");function Ot(e){return A.get(e)?.label??null}s(Ot,"labelForOrigin");function Pt(e,t,r){let n=[];for(let i of A.values()){let l=Oe(i,e);l<=0&&i.totalMs<1||n.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})}n.sort((i,l)=>l.windowMs-i.windowMs||l.totalMs-i.totalMs);let o=[],a=[];for(let i of n)(i.windowMs>=1||i.pctOfBusy>=.5||i.freezes>0?o:a).push(i);return a.length>=2?(o.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}),o.slice(0,r)):n.slice(0,r)}s(Pt,"buildRows");function Ft(e,t,r){let n=A.get(e);if(!n)return null;let o=L(t),a=[],i=0;for(let l=o-20+1;l<=o;l++){let c=l%20,d=c>=0&&n.ringStamps[c]===l?Math.round(n.ring[c]*10)/10:0;a.push(d),i+=d}return{key:n.key,label:n.label,api:n.api,caller:n.caller,file:n.file,line:n.line,frames:n.frames,promoted:n.promoted,scheduleCount:n.scheduleCount,calls:n.calls,totalMs:Math.round(n.totalMs*10)/10,avgMs:n.calls>0?Math.round(n.totalMs/n.calls*100)/100:0,maxMs:Math.round(n.maxMs*100)/100,windowMs:Math.round(i*10)/10,pctOfBusy:r>0?Math.min(100,Math.round(i/r*1e3)/10):0,lastSeenAgoMs:n.lastSeenAt>0?Math.max(0,t-n.lastSeenAt):0,buckets:a}}s(Ft,"getOriginDetailBase");function It(){A.clear()}s(It,"resetOrigins");var Wr=32,Q=[],Hr=20,Lt=64,$t=new Array(Lt).fill(null),Fe=0;function Dt(){return $t}s(Dt,"recentIntervals");function Ie(e,t){let r=I(),n=Q.length>0?Q[Q.length-1]:null,o=null;Q.length<Wr&&(o={originKey:e,start:r,childrenMs:0},Q.push(o));try{return t()}finally{try{if(o){Q.pop();let a=I(),i=a-r,l=Math.max(0,i-o.childrenMs);n&&(n.childrenMs+=i),Rt(e,l,r,a),!n&&i>=Hr&&($t[Fe]={originKey:e,start:r,end:a},Fe=(Fe+1)%Lt)}}catch{}}}s(Ie,"buoyJsTopRunFrame");function J(e,t){if(typeof e!="function"||e[st])return e;let r=V()?pe(t,e,I()):null,n=s(function(...o){return V()?((r===null||!Bt(r))&&(r=pe(t,e,I(),false)),Ie(r,()=>e.apply(this,o))):e.apply(this,o)},"buoyJsTopTaskWrapper");return n[st]=true,n}s(J,"buoyJsTopWrapTask");function Le(e,t,r){if(!V())return r();let n=pe(e,{name:t},I());return Ie(n,r)}s(Le,"buoyJsTopRunAs");function $e(){let e=de();if(typeof f.setTimeout=="function"&&!f.setTimeout[k]){let t=s(function(r,n,...o){let a=J(r,"timeout");return e.setTimeout(a,n,...o)},"buoyJsTopSetTimeout");t[k]=true,f.setTimeout=t}if(typeof f.setInterval=="function"&&!f.setInterval[k]){let t=s(function(r,n,...o){let a=J(r,"interval");return e.setInterval(a,n,...o)},"buoyJsTopSetInterval");t[k]=true,f.setInterval=t}if(typeof f.setImmediate=="function"&&!f.setImmediate[k]&&e.setImmediate){let t=s(function(r,...n){let o=J(r,"immediate");return e.setImmediate(o,...n)},"buoyJsTopSetImmediate");t[k]=true,f.setImmediate=t}if(typeof f.requestAnimationFrame=="function"&&!f.requestAnimationFrame[k]&&e.requestAnimationFrame){let t=s(function(r){let n=J(r,"raf");return e.requestAnimationFrame(n)},"buoyJsTopRequestAnimationFrame");t[k]=true,f.requestAnimationFrame=t}}s($e,"installTimerPatches");function De(){let e=de();if(typeof f.queueMicrotask=="function"&&!f.queueMicrotask[k]&&e.queueMicrotask){let t=s(function(r){let n=J(r,"microtask");return e.queueMicrotask(n)},"buoyJsTopQueueMicrotask");t[k]=true,f.queueMicrotask=t}}s(De,"installMicrotaskPatches");var We=16,Vr=100,jr=3,Nr=8,oe=null,ae=0,be=false,ie=[],G=1/0,Y=0,He=We;function Wt(){let e=I(),t=ae>0?e-ae:0;if(ae=e,be){be=false,G=1/0,Y=e;return}if(t<=0)return;t<Vr&&(t<G&&(G=t),Y===0&&(Y=e),e-Y>=1e3&&(ie.push(G),ie.length>jr&&ie.shift(),He=Math.max(Nr,Math.min(...ie)),G=1/0,Y=e));let r=t-He;r>1&&ut(e-r,e)}s(Wt,"buoyJsTopProbeTick");function Ve(){if(oe!=null)return;let e=re();ae=I(),be=false,ie=[],G=1/0,Y=0,He=We,oe=e.setInterval(Wt,We)}s(Ve,"startBusyProbe");function je(){oe!=null&&(re().clearInterval(oe),oe=null),ae=0}s(je,"stopBusyProbe");function Ht(){be=true}s(Ht,"suppressNextGap");import{definePersistedSetting as Jr}from"@buoy-gg/shared-ui/web";var Kr="@react_buoy/js-top/prefs",qr={enabled:false},Vt=Jr(Kr,qr,{sanitize:s(e=>({enabled:e.enabled===true}),"sanitize")});async function jt(){return Vt.load()}s(jt,"loadJsTopPrefs");async function Nt(e){await Vt.save(e)}s(Nt,"saveJsTopPrefs");import{subscribeRealAppState as Ur}from"@buoy-gg/shared-ui/web";var _r=250,Jt=class Lo{constructor(){this.enabled=false;this.enabledLoaded=false;this.paused=false;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=[];jt().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&&Nt({enabled:t}),this.enabledSubscribers.forEach(r=>{try{r(t)}catch(n){ee&&console.error("[Buoy]","[js-top] enabled subscriber threw",n)}}),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,te(false),je(),this.emitSnapshot())}resume(){this.paused&&(this.paused=false,this.engineRunning&&(te(true),Ve()),this.emitSnapshot())}clear(){It(),pt();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=I(),n=ze(r),o=this.freezeStatsProvider?.(Date.now())?.byOrigin[t];if(t==="unattributed"){let i=mt(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:n>0?Math.min(100,Math.round(l/n*1e3)/10):0,lastSeenAgoMs:0,buckets:i,freezes:o?.count??0,worstFreezeMs:Math.round(o?.maxMs??0)}}let a=Ft(t,r,n);return a?{...a,freezes:o?.count??0,worstFreezeMs:Math.round(o?.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 ee&&console.error("[Buoy]","[js-top] tier installer threw",r),{}}}startEngine(){this.engineRunning=true,$e(),De(),this.tiers={timers:true,promises:false,bridge:false,longtask:false};for(let t of this.tierInstallers)Object.assign(this.tiers,this.runInstaller(t));te(!this.paused),this.paused||Ve();try{this.appStateSub=Ur(()=>{Ht()})}catch{this.appStateSub=null}this.notifyHandle=re().setInterval(()=>this.emitSnapshot(),_r),this.emitSnapshot()}stopEngine(){if(this.engineRunning=false,te(false),je(),this.notifyHandle!=null&&(re().clearInterval(this.notifyHandle),this.notifyHandle=null),this.appStateSub){try{this.appStateSub.remove()}catch{}this.appStateSub=null}}buildSnapshot(){let t=I(),r=ze(t),n=ht(t),o=Math.max(0,r-n),a=Pt(t,r,30);o>=1&&(a.push({key:"unattributed",label:"unattributed (events / React / native call-ins)",api:"unattributed",windowMs:Math.round(o*10)/10,pctOfBusy:r>0?Math.min(100,Math.round(o/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:ft(t),tiers:{...this.tiers},rows:a,totals:{attributedWindowMs:Math.round(n*10)/10,unattributedWindowMs:Math.round(o*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){ee&&console.error("[Buoy]","[js-top] snapshot subscriber threw",r)}})}isEngineActive(){return V()}};s(Jt,"JsTopControllerImpl");var Qr=Jt,m=new Qr;function ge(e,t){let r=e[t];if(typeof r!="function")return false;if(r[k])return true;let n=s(function(...o){for(let a=0;a<o.length;a++)typeof o[a]=="function"&&(o[a]=J(o[a],"then"));return r.apply(this,o)},"patched");return n[k]=true,Object.defineProperty(n,"name",{value:t,configurable:true}),e[t]=n,true}s(ge,"patchMethod");function Kt(){let e=f.Promise?.prototype;if(!e)return{promises:false};let t=ge(e,"then");return ge(e,"catch"),ge(e,"finally"),{promises:t}}s(Kt,"installPromisePatches");function qt(){let e=f.__fbBatchedBridge;if(!e)return{bridge:false};let t=false;if(typeof e.callFunctionReturnFlushedQueue=="function"&&!e.callFunctionReturnFlushedQueue[k]){let n=e.callFunctionReturnFlushedQueue.bind(e),o=s(function(a,i,l){return V()?Le("bridge",`${a}.${i}`,()=>n(a,i,l)):n(a,i,l)},"buoyJsTopCallFunction");o[k]=true,e.callFunctionReturnFlushedQueue=o,t=true}if(typeof e.invokeCallbackAndReturnFlushedQueue=="function"&&!e.invokeCallbackAndReturnFlushedQueue[k]){let n=e.invokeCallbackAndReturnFlushedQueue.bind(e),o=s(function(a,i){return V()?Le("bridge","nativeModuleCallback",()=>n(a,i)):n(a,i)},"buoyJsTopInvokeCallback");o[k]=true,e.invokeCallbackAndReturnFlushedQueue=o,t=true}let r=e.callFunctionReturnFlushedQueue?.[k]===true;return{bridge:t||r}}s(qt,"installBridgePatch");var Gr=40,Yr=6e4,Zr="unattributed",Ut=false,ye=false,Z=[];function _t(e,t){let r=e+t,n=null,o=0;for(let a of Dt()){if(!a)continue;let i=Math.min(r,a.end)-Math.max(e,a.start);i>o&&(o=i,n=a.originKey)}return n}s(_t,"correlate");function Qt(){if(Ut)return{longtask:ye};Ut=true;let e=f.PerformanceObserver;if(typeof e!="function")return{longtask:false};try{new e(t=>{if(V())try{for(let r of t.getEntries()){if(r.entryType!=="longtask")continue;let n=r.startTime,o=r.duration;dt(n,n+o),Z.push({start:n,duration:o,at:Date.now(),originKey:_t(n,o)}),Z.length>Gr&&Z.shift()}}catch{}}).observe({entryTypes:["longtask"]}),ye=true}catch{ye=false}return{longtask:ye}}s(Qt,"installLongtaskObserver");function Gt(){return Z.map(e=>({start:e.start,duration:e.duration,at:e.at,originLabel:e.originKey?Ot(e.originKey):null}))}s(Gt,"getLongtasks");function Yt(e){let t={},r=0,n=0;for(let o of Z){if(o.at>0&&e-o.at>Yr)continue;r++,o.duration>n&&(n=o.duration);let a=o.originKey??Zr,i=t[a];i?(i.count++,o.duration>i.maxMs&&(i.maxMs=o.duration)):t[a]={count:1,maxMs:o.duration}}return{count:r,worstMs:n,byOrigin:t}}s(Yt,"getFreezeStats");function Zt(){Z.length=0}s(Zt,"clearLongtasks");var Xr={version:1,getSnapshot:s(()=>({live:m.getSnapshot(),enabled:m.isEnabled()||m.isRemoteSampling()}),"getSnapshot"),subscribe:s(e=>{let t=m.subscribe(()=>e()),r=m.subscribeEnabled(()=>e());return()=>{t(),r()}},"subscribe"),actions:{setEnabled:s(e=>{let t=e.enabled;m.setRemoteSampling(t)},"setEnabled"),pause:s(()=>m.pause(),"pause"),resume:s(()=>m.resume(),"resume"),clear:s(()=>m.clear(),"clear"),getOriginDetail:s(e=>m.getOriginDetail(e.key),"getOriginDetail"),sample:s(async e=>{let t=e,r=Math.min(Math.max(t?.durationMs??3e3,250),3e4),n=m.isRemoteSampling()||m.isEnabled();n||m.setRemoteSampling(true),t?.clearFirst&&m.clear();try{return await new Promise(o=>setTimeout(o,r)),m.getSnapshot()}finally{n||m.setRemoteSampling(false)}},"sample")}};import{useCallback as en,useEffect as tn,useMemo as rn,useState as Xt}from"react";var er={};Br(er,{AccessibilityInfo:()=>sn,ActivityIndicator:()=>so,Alert:()=>co,Animated:()=>ln,AppRegistry:()=>cn,AppState:()=>dn,Appearance:()=>un,BackHandler:()=>hn,Button:()=>lo,CheckBox:()=>En,Clipboard:()=>mn,DeviceEventEmitter:()=>Jn,Dimensions:()=>fn,Easing:()=>pn,FlatList:()=>zn,I18nManager:()=>bn,Image:()=>Bn,ImageBackground:()=>Rn,InteractionManager:()=>yn,Keyboard:()=>gn,KeyboardAvoidingView:()=>On,LayoutAnimation:()=>wn,Linking:()=>Mn,LogBox:()=>Nn,Modal:()=>ao,NativeEventEmitter:()=>xn,NativeModules:()=>an,PanResponder:()=>Sn,Picker:()=>Pn,PixelRatio:()=>vn,Platform:()=>kn,Pressable:()=>oo,ProgressBar:()=>Fn,RefreshControl:()=>In,SafeAreaView:()=>Ln,ScrollView:()=>Ke,SectionList:()=>$n,Share:()=>Tn,StatusBar:()=>Dn,StyleSheet:()=>j,Switch:()=>io,Text:()=>h,TextInput:()=>to,Touchable:()=>Wn,TouchableHighlight:()=>ro,TouchableNativeFeedback:()=>Hn,TouchableOpacity:()=>le,TouchableWithoutFeedback:()=>no,UIManager:()=>Cn,Vibration:()=>An,View:()=>b,VirtualizedList:()=>Vn,YellowBox:()=>jn,findNodeHandle:()=>uo,unstable_createElement:()=>on,useColorScheme:()=>Kn,useLocaleContext:()=>qn,useWindowDimensions:()=>Un});Rr(er,nn);import*as nn from"react-native-web";import{unstable_createElement as on,NativeModules as an,AccessibilityInfo as sn,Animated as ln,Appearance as un,AppRegistry as cn,AppState as dn,BackHandler as hn,Clipboard as mn,Dimensions as fn,Easing as pn,I18nManager as bn,Keyboard as gn,InteractionManager as yn,LayoutAnimation as wn,Linking as Mn,NativeEventEmitter as xn,PanResponder as Sn,PixelRatio as vn,Platform as kn,Share as Tn,StyleSheet as j,UIManager as Cn,Vibration as An,CheckBox as En,FlatList as zn,Image as Bn,ImageBackground as Rn,KeyboardAvoidingView as On,Picker as Pn,ProgressBar as Fn,RefreshControl as In,SafeAreaView as Ln,SectionList as $n,StatusBar as Dn,Touchable as Wn,TouchableNativeFeedback as Hn,VirtualizedList as Vn,YellowBox as jn,LogBox as Nn,DeviceEventEmitter as Jn,useColorScheme as Kn,useLocaleContext as qn,useWindowDimensions as Un}from"react-native-web";import*as B from"react-native-web";import{createElement as Ne,forwardRef as tr,useCallback as _n,useRef as Qn}from"react";import{useEffect as Gn,useState as Yn}from"react";import{createPortal as Zn}from"react-dom";var Xn='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';import{jsx as eo}from"react/jsx-runtime";var se=Symbol.for("@buoy-gg/portal-host"),rr=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 Je(){let e=document;if(e[se])return e[se].host;let t=document.createElement("div");t.dataset.buoyPortalHost="",Object.assign(t.style,{position:"fixed",inset:"0",zIndex:"2147483647",pointerEvents:"none",fontFamily:Xn});let r=s(()=>{let u=document.fullscreenElement,C=u&&u.tagName!=="CANVAS"?u:document.body;t.parentElement!==C&&C.appendChild(t)},"move"),n=new Map,o=s(u=>{(!t.contains(u.target)||!rr(u.target))&&n.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=>{n.delete(u.code||u.key)},"up"),i=s(()=>n.clear(),"clear"),l=s(()=>{let u=[...n.values()];n.clear();for(let C of u)document.dispatchEvent(new KeyboardEvent("keyup",{...C,bubbles:true}))},"focus"),c=s(u=>{rr(u.target)&&u.stopPropagation()},"key"),d=s(u=>u.stopPropagation(),"wheel");return r(),document.addEventListener("fullscreenchange",r),document.addEventListener("keydown",o,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[se]={host:t,users:0,dispose:s(()=>{document.removeEventListener("fullscreenchange",r),document.removeEventListener("keydown",o,true),document.removeEventListener("keyup",a,true),window.removeEventListener("blur",i),t.remove(),delete e[se]},"dispose")},t}s(Je,"getBuoyPortalHost");function nr({children:e}){let[t,r]=Yn(null);return Gn(()=>{let n=Je(),o=document[se];return o.users++,r(n),()=>{--o.users===0&&o.dispose()}},[]),t?Zn(eo("div",{"data-buoy-root":"",style:{display:"contents",pointerEvents:"auto"},children:e}),t):null}s(nr,"BuoyPortal");function R(e){let t=tr((n,o)=>{let{accessibilityState:a,accessibilityValue:i,...l}=n;for(let c of["busy","checked","disabled","expanded","selected"])a?.[c]!==void 0&&l[`aria-${c}`]===void 0&&(l[`aria-${c}`]=a[c]);for(let[c,d]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[c]!==void 0&&l[`aria-${d}`]===void 0&&(l[`aria-${d}`]=i[c]);return Ne(e,{...l,ref:o})}),r=e.State;return r&&Object.assign(t,{State:r}),t.displayName=e.displayName??e.name??"NativeWebView",t}s(R,"withAccessibility");var b=R(B.View),h=R(B.Text),to=R(B.TextInput),le=R(B.TouchableOpacity),ro=R(B.TouchableHighlight),no=R(B.TouchableWithoutFeedback),oo=R(B.Pressable),Ke=R(B.ScrollView),or=tr((e,t)=>{let r=Qn(null),n=_n(o=>{if(o){let a=o;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"}),Je().appendChild(a))}else r.current&&(document.body.appendChild(r.current),r.current=null);typeof t=="function"?t(o):t&&(t.current=o)},[t]);return Ne(nr,null,Ne(B.Modal,{...e,ref:n}))});or.displayName="Modal";var ao=R(or),io=R(B.Switch),so=R(B.ActivityIndicator),lo=R(B.Button),uo=B.findNodeHandle,co={alert(e,t,r,n){if(typeof document>"u")return;let o=document.createElement("dialog");o.dataset.buoyRoot="",o.setAttribute("aria-label",e),o.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let a=document.createElement("h2");if(a.textContent=e,a.style.cssText="font-size:18px;margin:0 0 12px",o.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",o.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(()=>{o.close?.(),o.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)}o.addEventListener("cancel",d=>{d.preventDefault(),n?.cancelable!==false&&(c(),n?.onDismiss?.())}),o.appendChild(i),document.body.appendChild(o),o.showModal?o.showModal():o.setAttribute("open","")}};import{Activity as ho,JsModal as mo,macOSColors as F,night as z,ModalHeader as ue,Pause as fo,Play as po,Trash2 as bo}from"@buoy-gg/shared-ui/web";import{memo as go}from"react";import{macOSColors as qe}from"@buoy-gg/shared-ui/web";import{jsx as ar}from"react/jsx-runtime";var yo=60;function ir(e){return e>=80?qe.semantic.error:e>=40?qe.semantic.warning:qe.semantic.success}s(ir,"barColor");var wo=go(s(function({history:e}){let t=e.slice(-yo);return ar(b,{style:sr.row,pointerEvents:"none",children:t.map((r,n)=>ar(b,{style:[sr.bar,{height:Math.max(2,r/100*28),backgroundColor:ir(r)}]},`b${n}`))})},"BusySparkline")),sr=j.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 Mo,useState as xo}from"react";import{macOSColors as we,night as v}from"@buoy-gg/shared-ui/web";import{jsx as O,jsxs as $}from"react/jsx-runtime";var So=[{key:"windowMs",title:"RECENT"},{key:"calls",title:"CALLS"},{key:"avgMs",title:"AVG"},{key:"maxMs",title:"MAX"},{key:"totalMs",title:"TOTAL"}],lr={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 Me(e){return lr[e]??lr.other}s(Me,"badgeFor");function Ue(e){if(e.api==="unattributed")return"events \xB7 React \xB7 native call-ins";if(e.api==="other")return"evicted cold origins";let t=Me(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(Ue,"displayName");function X(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(X,"fmt");function ur(e){return e.calls<=0?"measured by probe \xB7 not reachable from JS":`${X(e.calls)} calls \xB7 avg ${X(e.avgMs)} \xB7 max ${X(e.maxMs)} \xB7 total ${X(e.totalMs)} ms`}s(ur,"statsLine");var vo=Mo(s(function({row:e,rank:t,onPress:r}){let n=Me(e.api);return $(r?le:b,{style:E.row,...r?{onPress:s(()=>r(e),"onPress"),activeOpacity:.6}:{},children:[$(b,{style:E.topLine,children:[O(h,{style:E.rank,children:t}),O(b,{style:[E.badge,{borderColor:n.color,backgroundColor:`${n.color}1A`}],children:O(h,{style:[E.badgeText,{color:n.color}],children:n.text})}),O(h,{style:E.name,numberOfLines:1,children:Ue(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?we.semantic.error:we.semantic.warning}],children:[X(e.windowMs),O(h,{style:E.unit,children:" ms"})]}),$(h,{style:[E.pct,e.api==="unattributed"&&E.pctMuted],children:[Math.round(e.pctOfBusy),"%"]})]}),$(b,{style:E.subLine,children:[O(b,{style:E.barTrack,children:O(b,{style:[E.barFill,{width:`${Math.min(100,e.pctOfBusy)}%`,backgroundColor:n.color}]})}),O(h,{style:E.stats,numberOfLines:1,children:ur(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 cr({rows:e,onSelectRow:t}){let[r,n]=xo("windowMs"),o=r==="windowMs"?e:[...e].sort((a,i)=>i[r]-a[r]);return $(b,{style:D.root,children:[$(b,{style:D.sortRow,children:[O(h,{style:D.sortLabel,children:"SORT"}),So.map(a=>O(le,{onPress:()=>n(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))]}),$(Ke,{style:D.body,children:[o.map((a,i)=>O(vo,{row:a,rank:i+1,onPress:t},a.key)),o.length===0&&O(h,{style:D.empty,children:"No tasks observed yet \u2014 interact with the app."})]})]})}s(cr,"TaskTable");var D=j.create({root:{flex:1,minHeight:0},sortRow:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:6,borderBottomWidth:1,borderBottomColor:v.color.border,backgroundColor:v.color.surface},sortLabel:{color:v.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginRight:2},sortChip:{borderWidth:1,borderColor:v.color.border,borderRadius:4,paddingHorizontal:7,paddingVertical:3},sortChipOn:{borderColor:v.color.accentBorderStrong,backgroundColor:v.color.accentSoft},sortChipText:{color:v.color.textTertiary,fontSize:9,fontWeight:"600",fontVariant:["tabular-nums"]},sortChipTextOn:{color:v.color.accent},body:{flex:1},empty:{color:v.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:24}}),E=j.create({row:{paddingHorizontal:10,paddingVertical:8,borderBottomWidth:j.hairlineWidth,borderBottomColor:v.color.border,gap:5},topLine:{flexDirection:"row",alignItems:"center",gap:6},rank:{width:16,color:v.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:v.color.text,fontSize:13,fontWeight:"500"},freezeBadge:{color:we.semantic.warning,fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},freezeBadgeSevere:{color:we.semantic.error},windowMs:{color:v.color.text,fontSize:13,fontWeight:"700",fontVariant:["tabular-nums"]},unit:{color:v.color.textTertiary,fontSize:10,fontWeight:"400"},pct:{width:38,textAlign:"right",color:v.color.textSecondary,fontSize:12,fontWeight:"600",fontVariant:["tabular-nums"]},pctMuted:{color:v.color.textTertiary},subLine:{flexDirection:"row",alignItems:"center",gap:8,paddingLeft:22},barTrack:{width:72,height:4,borderRadius:2,backgroundColor:v.color.fillSecondary,overflow:"hidden"},barFill:{height:4,borderRadius:2,opacity:.85},stats:{flex:1,color:v.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]}});import{memo as ko}from"react";import{macOSColors as xe,night as T,useSafeAreaInsets as To}from"@buoy-gg/shared-ui/web";import{Fragment as dr,jsx as M,jsxs as P}from"react/jsx-runtime";var hr={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 mr(e){return hr[e]??hr.other}s(mr,"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 fr(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(fr,"agoFmt");function W({label:e,value:t,accent:r}){return P(b,{style:g.stat,children:[M(h,{style:g.statLabel,children:e}),M(h,{style:[g.statValue,r?{color:r}:null],children:t})]})}s(W,"Stat");var Co=ko(s(function({detail:e}){let t=Me(e.api),r=To({minBottom:12}),n=Math.max(1,...e.buckets);return P(Ke,{style:g.root,contentContainerStyle:{paddingBottom:r.bottom},children:[P(b,{style:g.identityRow,children:[M(b,{style:[g.badge,{borderColor:t.color,backgroundColor:`${t.color}1A`}],children:M(h,{style:[g.badgeText,{color:t.color}],children:t.text})}),M(h,{style:g.name,numberOfLines:2,children:Ue(e)})]}),M(h,{style:g.explainer,children:mr(e.api)}),M(h,{style:g.sectionTitle,children:"ACTIVITY \xB7 LAST 5S"}),M(b,{style:g.chartRow,children:e.buckets.map((o,a)=>M(b,{style:g.chartBarSlot,children:M(b,{style:[g.chartBar,{height:Math.max(2,o/n*44),backgroundColor:t.color}]})},`bk${a}`))}),P(b,{style:g.chartLegend,children:[P(h,{style:g.chartLegendText,children:[N(e.windowMs)," ms in window \xB7 ",e.pctOfBusy.toFixed(1),"% of busy time"]}),P(h,{style:g.chartLegendText,children:["peak ",N(n)," ms/250ms"]})]}),M(h,{style:g.sectionTitle,children:"STATS \xB7 SINCE START"}),P(b,{style:g.statGrid,children:[M(W,{label:"RUNS",value:e.calls>0?N(e.calls):"\u2014"}),M(W,{label:"SCHEDULED",value:e.scheduleCount>0?N(e.scheduleCount):"\u2014"}),M(W,{label:"AVG / RUN",value:e.calls>0?`${N(e.avgMs)} ms`:"\u2014"}),M(W,{label:"MAX / RUN",value:e.maxMs>0?`${N(e.maxMs)} ms`:"\u2014",accent:e.maxMs>=50?xe.semantic.warning:void 0}),M(W,{label:"TOTAL",value:e.totalMs>0?`${N(e.totalMs)} ms`:"\u2014"}),M(W,{label:"LAST RUN",value:fr(e.lastSeenAgoMs)}),M(W,{label:"FREEZES \xB7 60S",value:e.freezes>0?`${e.freezes}`:"0",accent:e.freezes>0?xe.semantic.error:void 0}),M(W,{label:"WORST FREEZE",value:e.worstFreezeMs>0?`${e.worstFreezeMs} ms`:"\u2014",accent:e.worstFreezeMs>=100?xe.semantic.error:e.worstFreezeMs>0?xe.semantic.warning:void 0})]}),(e.caller||(e.frames?.length??0)>0)&&P(dr,{children:[M(h,{style:g.sectionTitle,children:"SCHEDULED FROM"}),P(b,{style:g.siteCard,children:[e.caller&&P(h,{style:g.siteCaller,children:[e.caller,"()"]}),e.file&&P(h,{style:g.siteFile,children:[e.file,e.line!=null?`:${e.line}`:""]}),e.frames?.map((o,a)=>P(h,{style:g.siteFrame,numberOfLines:1,children:[o.file,":",o.line,":",o.col]},`fr${a}`)),M(h,{style:g.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"&&P(dr,{children:[M(h,{style:g.sectionTitle,children:"SCHEDULED FROM"}),M(h,{style:g.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")),g=j.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:T.color.text,fontSize:15,fontWeight:"600"},explainer:{color:T.color.textTertiary,fontSize:11,lineHeight:15,marginTop:6,marginBottom:4},sectionTitle:{color:T.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginTop:14,marginBottom:6},chartRow:{flexDirection:"row",alignItems:"flex-end",height:48,gap:2,backgroundColor:T.color.surface,borderRadius:6,borderWidth:1,borderColor:T.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:T.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},statGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},stat:{width:"23%",minWidth:76,flexGrow:1,backgroundColor:T.color.surface,borderWidth:1,borderColor:T.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:6},statLabel:{color:T.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.4,marginBottom:3},statValue:{color:T.color.text,fontSize:13,fontWeight:"600",fontVariant:["tabular-nums"]},siteCard:{backgroundColor:T.color.surface,borderWidth:1,borderColor:T.color.border,borderRadius:6,padding:10,gap:3},siteCaller:{color:T.color.text,fontSize:13,fontWeight:"600"},siteFile:{color:T.color.info,fontSize:11},siteFrame:{color:T.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},siteNote:{color:T.color.textTertiary,fontSize:9,opacity:.8,marginTop:4},sitePending:{color:T.color.textTertiary,fontSize:11}});import{Fragment as Ao,jsx as w,jsxs as H}from"react/jsx-runtime";function _e(e){return e>=80?F.semantic.error:e>=40?F.semantic.warning:F.semantic.success}s(_e,"busyColor");function Se(e){return e>=100?F.semantic.error:F.semantic.warning}s(Se,"freezeColor");function pr(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:Se(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(pr,"diagnose");function Qe({visible:e,onClose:t,onBack:r,onMinimize:n,initialModalState:o,minimizeTargetPosition:a,remoteSnapshot:i,remoteActions:l,embedded:c=false}){let d=i!==void 0,[u,C]=Xt(null);tn(()=>{if(!(d||!e))return m.subscribe(C)},[d,e]);let p=d?i:u,y=rn(()=>l??{pause:s(()=>m.pause(),"pause"),resume:s(()=>m.resume(),"resume"),clear:s(()=>m.clear(),"clear")},[l]),S=p?.paused??false,ve=(p?.rows.length??0)>0,[ke,et]=Xt(null),Cr=en(K=>et(K.key),[]),tt=!d&&ke?m.getOriginDetail(ke):null,rt=ke!==null,nt=H(ue,{children:[rt?w(ue.Navigation,{onBack:()=>et(null)}):r?w(ue.Navigation,{onBack:r}):null,w(ue.Content,{title:"",noMargin:true,children:H(b,{style:x.titleRow,children:[w(ho,{size:14,color:"#34D399"}),w(h,{style:x.title,children:"JS Top"}),p&&w(b,{style:[x.busyPill,{borderColor:_e(p.busyPct)}],children:H(h,{style:[x.busyText,{color:_e(p.busyPct)}],children:[p.busyPct.toFixed(0),"% BUSY"]})}),p&&p.freezeSummary.count>0&&w(b,{style:[x.busyPill,{borderColor:Se(p.freezeSummary.worstMs)}],children:H(h,{style:[x.busyText,{color:Se(p.freezeSummary.worstMs)}],children:["\u26A0 ",p.freezeSummary.count," \xB7"," ",p.freezeSummary.worstMs,"ms"]})})]})}),H(ue.Actions,{children:[w(le,{onPress:S?y.resume:y.pause,style:[x.actionBtn,S&&x.actionBtnActive],accessibilityLabel:S?"Resume sampling":"Pause sampling",children:S?w(po,{size:14,color:z.color.accent}):w(fo,{size:14,color:z.color.textSecondary})}),w(le,{onPress:y.clear,disabled:!ve,style:[x.actionBtn,!ve&&x.actionBtnDisabled],accessibilityLabel:"Clear stats",children:w(bo,{size:14,color:ve?z.color.textTertiary:z.color.textTertiary})})]})]}),ot=w(b,{style:x.body,children:rt?tt?w(Co,{detail:tt}):w(h,{style:x.waiting,children:"This origin is no longer tracked (cleared or evicted)."}):p?H(Ao,{children:[(()=>{let K=pr(p);return H(b,{style:[x.diagnosis,{borderLeftColor:K.color}],children:[w(h,{style:[x.diagnosisIcon,{color:K.color}],children:K.icon}),w(h,{style:x.diagnosisText,children:K.text})]})})(),H(b,{style:x.sparklineRow,children:[w(h,{style:x.sparklineCaption,children:"JS THREAD LOAD \xB7 LAST 30s"}),w(wo,{history:p.busyHistory})]}),!p.tiers.bridge&&w(h,{style:x.tierBanner,children:"\u201CSystem\u201D rows are UI/React/native work pure JS can\u2019t name \u2014 timers, rAF and Promise chains are fully attributed."}),w(cr,{rows:p.rows,onSelectRow:d?void 0:Cr})]}):w(h,{style:x.waiting,children:d?"Waiting for device\u2026":"Starting engine\u2026"})});return c?H(b,{style:x.embeddedRoot,children:[w(b,{style:x.embeddedHeader,children:nt}),ot]}):w(mo,{visible:e,onClose:t,onMinimize:n,minimizeTargetPosition:a,initialModalState:o,header:{showToggleButton:true,customContent:nt},persistenceKey:"buoy-js-top-modal",enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:ot})}s(Qe,"JsTopModal");var x=j.create({titleRow:{flexDirection:"row",alignItems:"center",gap:8},title:{color:z.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:z.color.buttonSurface,borderWidth:1,borderColor:z.color.border,alignItems:"center",justifyContent:"center"},actionBtnActive:{backgroundColor:z.color.accentSoft,borderColor:z.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:z.color.surface,borderRadius:6,borderLeftWidth:3},diagnosisIcon:{fontSize:11,fontWeight:"700"},diagnosisText:{flex:1,color:z.color.text,fontSize:12,lineHeight:16},sparklineRow:{paddingHorizontal:10,paddingVertical:8,gap:4},sparklineCaption:{color:z.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.5},tierBanner:{color:z.color.textTertiary,fontSize:10,paddingHorizontal:10,paddingBottom:6},waiting:{color:z.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 br,useState as gr}from"react";import{macOSColors as Ge,night as Ye}from"@buoy-gg/shared-ui/web";import{jsx as Eo,jsxs as yr}from"react/jsx-runtime";function wr(e){return e>=80?Ge.semantic.error:e>=40?Ge.semantic.warning:Ge.semantic.success}s(wr,"busyColor");function Mr(){let[e,t]=gr(()=>m.isEnabled()),[r,n]=gr(null);if(br(()=>m.subscribeEnabled(t),[]),br(()=>{if(!e){n(null);return}return m.subscribe(n)},[e]),!e||!r)return null;let o=r.rows.find(a=>a.api!=="unattributed");return yr(b,{style:Ze.pill,pointerEvents:"none",children:[yr(h,{style:[Ze.busy,{color:wr(r.busyPct)}],children:[r.busyPct.toFixed(0),"%"]}),o&&Eo(h,{style:Ze.label,numberOfLines:1,children:o.label})]})}s(Mr,"JsTopHudOverlay");var Ze=j.create({pill:{position:"absolute",top:60,left:8,flexDirection:"row",alignItems:"center",gap:6,backgroundColor:Ye.color.buttonSurface,borderWidth:1,borderColor:Ye.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:4,maxWidth:220},busy:{fontSize:11,fontWeight:"700",fontVariant:["tabular-nums"]},label:{color:Ye.color.textSecondary,fontSize:10,flexShrink:1}});import{useEffect as zo,useState as Bo}from"react";import{Activity as xr}from"@buoy-gg/shared-ui/web";import{jsx as Sr}from"react/jsx-runtime";var Xe="#34D399",vr="#6B7280";function kr({size:e}){let[t,r]=Bo(()=>m.isEnabled());return zo(()=>m.subscribeEnabled(r),[]),Sr(xr,{size:e,color:t?Xe:vr})}s(kr,"JsTopToggleIcon");function Tr(){return null}s(Tr,"EmptyComponent");var Ro={id:"js-top",name:"JS TOP",description:"Toggle the floating JS-thread busy pill",slot:"row",icon:kr,component:Tr,props:{},launchMode:"toggle-only",onPress:s(()=>{m.setEnabled(!m.isEnabled())},"onPress")},Oo={id:"js-top-modal",name:"TASKS",description:"Live Task Manager for the JS thread",slot:"both",icon:s(({size:e})=>Sr(xr,{size:e,color:Xe}),"icon"),component:Qe,props:{enableSharedModalDimensions:false}};m.registerTierInstaller(Kt);m.registerTierInstaller(qt);m.registerTierInstaller(Qt);m.registerLongtaskProvider(Gt);m.registerFreezeStatsProvider(Yt);m.registerClearHook(Zt);try{typeof window<"u"&&($e(),De())}catch{}export{vr as JS_TOP_DISABLED_COLOR,Xe as JS_TOP_ENABLED_COLOR,m as JsTopController,Mr as JsTopHudOverlay,Qe as JsTopModal,Oo as jsTopModalPreset,Ro as jsTopPreset,Xr as jsTopSyncAdapter};
|
|
1
|
+
"use client";var Te=Object.defineProperty;var Ar=Object.getOwnPropertyDescriptor;var Er=Object.getOwnPropertyNames;var zr=Object.prototype.hasOwnProperty;var s=(e,t)=>Te(e,"name",{value:t,configurable:true});var Br=(e,t)=>{for(var r in t)Te(e,r,{get:t[r],enumerable:true})},at=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Er(t))!zr.call(e,o)&&o!==r&&Te(e,o,{get:()=>t[o],enumerable:!(n=Ar(t,o))||n.enumerable});return e},Rr=(e,t,r)=>(at(e,t,"default"),r&&at(r,t,"default"));var ee=(()=>{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 ce=typeof globalThis<"u"?globalThis:void 0,Ir=(()=>{if(typeof ce?.nativePerformanceNow=="function"){let e=ce.nativePerformanceNow;return()=>e()}if(typeof ce?.performance?.now=="function"){let e=ce.performance;return()=>e.now()}return()=>Date.now()})(),Or=Ir;function F(){return Or()}s(F,"now");var f=typeof globalThis<"u"?globalThis:{},it=false;function H(){return it}s(H,"isActive");function te(e){it=e}s(te,"setActive");var Ce=null;function de(){return Ce||(Ce={setTimeout:f.setTimeout?.bind(f),setInterval:f.setInterval?.bind(f),clearInterval:f.clearInterval?.bind(f),clearTimeout:f.clearTimeout?.bind(f),setImmediate:f.setImmediate?.bind(f),requestAnimationFrame:f.requestAnimationFrame?.bind(f),queueMicrotask:f.queueMicrotask?.bind(f)}),Ce}s(de,"captureOriginals");function re(){return de()}s(re,"getOriginals");var k=Symbol.for("buoy.jsTop.patched"),st=Symbol.for("buoy.jsTop.wrapped");var q=new Float64Array(120),ne=new Float64Array(120),Ae=new Float64Array(120),U=new Float64Array(120).fill(-1);function L(e){return Math.floor(e/250)}s(L,"epochOf");function lt(e){let t=e%120;return U[t]!==e&&(U[t]=e,q[t]=0,ne[t]=0,Ae[t]=0),t}s(lt,"slotFor");function he(e,t,r){if(!(t>e))return;let n=Math.max(e,t-3e4),o=L(n),a=L(t),i=n;for(;o<=a;){let l=(o+1)*250,c=Math.min(t,l),d=c-i;d>0&&r(lt(o),d),i=c,o++}}s(he,"distribute");function ut(e,t){he(e,t,(r,n)=>{q[r]=Math.min(250,q[r]+n)})}s(ut,"bookBusyRange");function ct(e,t,r){let n=t-e;if(!(n>0)||!(r>0))return;let o=Math.min(1,r/n);he(e,t,(a,i)=>{ne[a]=Math.min(250,ne[a]+i*o)})}s(ct,"bookAttributedRange");function dt(e,t){he(e,t,(r,n)=>{Ae[r]=Math.min(250,Ae[r]+n)})}s(dt,"bookLongtaskRange");function Ee(e,t,r){let n=L(t),o=0;for(let a=n-r+1;a<=n;a++){let i=a%120;i>=0&&U[i]===a&&(o+=e[i])}return o}s(Ee,"sumWindow");function ze(e){return Ee(q,e,20)}s(ze,"windowBusyMs");function ht(e){return Ee(ne,e,20)}s(ht,"windowAttributedMs");function mt(e){let t=L(e),r=[];for(let n=t-20+1;n<=t;n++){let o=n%120;o>=0&&U[o]===n?r.push(Math.max(0,Math.round((q[o]-ne[o])*10)/10)):r.push(0)}return r}s(mt,"windowResidualBuckets");function ft(e){let t=L(e),r=[];for(let o=t-120+1;o<=t;o++){let a=o%120;a>=0&&U[a]===o?r.push(Math.round(q[a]/250*100)):r.push(0)}let n=0;for(;n<r.length&&r[n]===0;)n++;return r.slice(Math.max(0,Math.min(n,r.length-1)))}s(ft,"busyHistory");function pt(){U.fill(-1)}s(pt,"resetAggregator");import{buoyFetch as bt}from"@buoy-gg/shared-ui/web";var Pr=3,Be=0;function gt(){return typeof ee<"u"&&ee}s(gt,"isDev");var Fr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lr=new Map([...Fr].map((e,t)=>[e,t]));function yt(e){let t=[],r=0,n=0,o=0,a=0;for(let i of e.split(";")){let l=[],c=0;for(let d of i.split(",")){if(!d)continue;let u=[],C=0,p=0;for(let y of d){let S=Lr.get(y);if(S===void 0)break;C+=(S&31)<<p,S&32?p+=5:(u.push(C&1?-(C>>1):C>>1),C=0,p=0)}u.length&&(c+=u[0],u.length===1?l.push([c]):u.length>=4&&(r+=u[1],n+=u[2],o+=u[3],u.length>=5?(a+=u[4],l.push([c,r,n,o,a])):l.push([c,r,n,o])))}t.push(l)}return t}s(yt,"decodeMappings");function wt(e,t,r){let n=e.lines[t-1];if(!n?.length)return null;let o;for(let i of n)if(i[0]<=r-1)o=i;else break;if(!o||o.length<4)return null;let a=e.sources[o[1]];return a?{file:a,line:o[2]+1,name:o.length>=5?e.names[o[4]]:void 0}:null}s(wt,"lookup");var Mt=new Map;function xt(e){let t=Mt.get(e);return t||(t=(async()=>{let r=await(await bt(e)).text(),n=Math.max(r.lastIndexOf("//# sourceMappingURL="),r.lastIndexOf("//@ sourceMappingURL="));if(n<0)return null;let o=/^\/\/[#@]\s*sourceMappingURL=(\S+)/.exec(r.slice(n));if(!o)return null;let a=new URL(o[1],e).href,i=await(await bt(a)).json();return!i.mappings||!i.sources?null:{sources:i.sources,names:i.names??[],lines:yt(i.mappings)}})().catch(()=>null),Mt.set(e,t)),t}s(xt,"loadMap");function St(e){return(e.split("?")[0]??e).split("/").filter(Boolean).slice(-2).join("/")}s(St,"tailPath");function vt(e){return/^[A-Z][A-Za-z0-9]*$/.test(e)}s(vt,"looksLikeComponent");function kt(e,t){if(!gt()||e.symbolicated||!e.frames||e.frames.length===0||Be>=Pr)return;e.symbolicated=true;let r=e.frames.filter(n=>/^(https?|capacitor|file):\/\//.test(n.file));r.length&&(Be++,(async()=>{for(let n of r){let o=await xt(n.file.split("?")[0]??n.file);if(!o)continue;let a=wt(o,n.line,n.col);if(!a||a.file.includes("node_modules"))continue;let i=St(a.file);e.file=i,e.line=a.line;let l=`${i.split("/").pop()}:${a.line}`;a.name&&vt(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(()=>{Be--}))}s(kt,"buoyJsTopSymbolicateOrigin");var Dr=500,$r=20,A=new Map,Tt="other",Ct=0,Re=0;function me(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(me,"makeOrigin");function Ie(e,t){let r=L(t),n=0;for(let o=r-20+1;o<=r;o++){let a=o%20;a>=0&&e.ringStamps[a]===o&&(n+=e.ring[a])}return n}s(Ie,"windowMsOf");function Oe(e){let t=null,r=1/0;for(let o of A.values()){if(o.key===Tt)continue;let a=Ie(o,e)*1e6+o.lastSeenAt;a<r&&(r=a,t=o)}if(!t)return;let n=At(Tt,"other","other (evicted origins)");n.calls+=t.calls,n.totalMs+=t.totalMs,n.maxMs=Math.max(n.maxMs,t.maxMs),n.lastSeenAt=Math.max(n.lastSeenAt,t.lastSeenAt),A.delete(t.key)}s(Oe,"evictColdest");function At(e,t,r){let n=A.get(e);return n||(n=me(e,t,r),A.set(e,n)),n}s(At,"getOrCreate");function Et(e){let t=[],r,n=e.split(`
|
|
2
|
+
`);for(let o of n){let a=/at\s+(.*?)\s+\((?:address at\s+)?(.*?):(\d+):(\d+)\)/.exec(o)??/at\s+()(.*?):(\d+):(\d+)$/.exec(o.trim())??/^([^@\s]*)@(.+?):(\d+):(\d+)$/.exec(o.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(Et,"parseStack");function zt(e,t){return t-e.lastCaptureAt<Dr||(t-Ct>1e3&&(Ct=t,Re=0),Re>=$r)?false:(Re++,e.lastCaptureAt=t,true)}s(zt,"allowCapture");function fe(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(fe,"shortFile");function Bt(e){return A.has(e)}s(Bt,"buoyJsTopOriginExists");function pe(e,t,r,n=true){let o=t,a=typeof o.displayName=="string"&&o.displayName||typeof o.name=="string"&&o.name||"anonymous",i=`${e}|${a}`,l=A.get(i);if(l||(A.size>=500&&Oe(r),l=me(i,e,a==="anonymous"?_(e):`${_(e)} ${a}`),A.set(i,l)),l.scheduleCount++,!l.promoted&&(l.scheduleCount>=25||l.totalMs>=50)&&(l.promoted=true),(l.promoted||e==="interval")&&n&&zt(l,r)){let{caller:c,frames:d}=Et(new Error().stack??""),u=d[0];if(u||c){let C=u?`${fe(u.file)??"?"}:${u.line}`:"?",p=`${i}@${c??"?"}:${C}`,y=A.get(p);if(!y){A.size>=500&&Oe(r);let S=a==="anonymous"?_(e):`${_(e)} ${a}`;y=me(p,e,c?`${S} \u2190 ${c}`:a==="anonymous"?`${S} @ ${fe(u?.file??"")??"?"}`:S),y.caller=c,y.file=u?fe(u.file):void 0,y.line=u?.line,y.frames=d,y.promoted=true,y.calls=l.calls,y.totalMs=l.totalMs,y.maxMs=l.maxMs,y.scheduleCount=l.scheduleCount,y.lastSeenAt=l.lastSeenAt,y.ring.set(l.ring),y.ringStamps.set(l.ringStamps),l.calls=0,l.totalMs=0,l.maxMs=0,l.ring.fill(0),l.ringStamps.fill(-1),A.set(p,y),kt(y,_(e))}l.activeRefinedKey=p}}return l.activeRefinedKey??i}s(pe,"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 Rt(e,t,r,n){let o=A.get(e);if(!o)return;o.calls++,o.totalMs+=t,t>o.maxMs&&(o.maxMs=t),o.lastSeenAt=n,!o.promoted&&o.totalMs>=50&&(o.promoted=true);let a=n-r,i=a>0?Math.min(1,t/a):1,l=Math.max(r,n-5e3),c=L(l),d=L(n),u=l;for(;c<=d;){let C=(c+1)*250,p=Math.min(n,C),y=p-u;if(y>0){let S=c%20;S>=0&&(o.ringStamps[S]!==c&&(o.ringStamps[S]=c,o.ring[S]=0),o.ring[S]+=a>0?y*i:t)}u=p,c++}ct(r,n,t)}s(Rt,"buoyJsTopBookExclusive");function It(e){return A.get(e)?.label??null}s(It,"labelForOrigin");function Ot(e,t,r){let n=[];for(let i of A.values()){let l=Ie(i,e);l<=0&&i.totalMs<1||n.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})}n.sort((i,l)=>l.windowMs-i.windowMs||l.totalMs-i.totalMs);let o=[],a=[];for(let i of n)(i.windowMs>=1||i.pctOfBusy>=.5||i.freezes>0?o:a).push(i);return a.length>=2?(o.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}),o.slice(0,r)):n.slice(0,r)}s(Ot,"buildRows");function Pt(e,t,r){let n=A.get(e);if(!n)return null;let o=L(t),a=[],i=0;for(let l=o-20+1;l<=o;l++){let c=l%20,d=c>=0&&n.ringStamps[c]===l?Math.round(n.ring[c]*10)/10:0;a.push(d),i+=d}return{key:n.key,label:n.label,api:n.api,caller:n.caller,file:n.file,line:n.line,frames:n.frames,promoted:n.promoted,scheduleCount:n.scheduleCount,calls:n.calls,totalMs:Math.round(n.totalMs*10)/10,avgMs:n.calls>0?Math.round(n.totalMs/n.calls*100)/100:0,maxMs:Math.round(n.maxMs*100)/100,windowMs:Math.round(i*10)/10,pctOfBusy:r>0?Math.min(100,Math.round(i/r*1e3)/10):0,lastSeenAgoMs:n.lastSeenAt>0?Math.max(0,t-n.lastSeenAt):0,buckets:a}}s(Pt,"getOriginDetailBase");function Ft(){A.clear()}s(Ft,"resetOrigins");var jr=32,Q=[],Wr=20,Lt=64,Dt=new Array(Lt).fill(null),Pe=0;function $t(){return Dt}s($t,"recentIntervals");function Fe(e,t){let r=F(),n=Q.length>0?Q[Q.length-1]:null,o=null;Q.length<jr&&(o={originKey:e,start:r,childrenMs:0},Q.push(o));try{return t()}finally{try{if(o){Q.pop();let a=F(),i=a-r,l=Math.max(0,i-o.childrenMs);n&&(n.childrenMs+=i),Rt(e,l,r,a),!n&&i>=Wr&&(Dt[Pe]={originKey:e,start:r,end:a},Pe=(Pe+1)%Lt)}}catch{}}}s(Fe,"buoyJsTopRunFrame");function J(e,t){if(typeof e!="function"||e[st])return e;let r=H()?pe(t,e,F()):null,n=s(function(...o){return H()?((r===null||!Bt(r))&&(r=pe(t,e,F(),false)),Fe(r,()=>e.apply(this,o))):e.apply(this,o)},"buoyJsTopTaskWrapper");return n[st]=true,n}s(J,"buoyJsTopWrapTask");function Le(e,t,r){if(!H())return r();let n=pe(e,{name:t},F());return Fe(n,r)}s(Le,"buoyJsTopRunAs");function De(){let e=de();if(typeof f.setTimeout=="function"&&!f.setTimeout[k]){let t=s(function(r,n,...o){let a=J(r,"timeout");return e.setTimeout(a,n,...o)},"buoyJsTopSetTimeout");t[k]=true,f.setTimeout=t}if(typeof f.setInterval=="function"&&!f.setInterval[k]){let t=s(function(r,n,...o){let a=J(r,"interval");return e.setInterval(a,n,...o)},"buoyJsTopSetInterval");t[k]=true,f.setInterval=t}if(typeof f.setImmediate=="function"&&!f.setImmediate[k]&&e.setImmediate){let t=s(function(r,...n){let o=J(r,"immediate");return e.setImmediate(o,...n)},"buoyJsTopSetImmediate");t[k]=true,f.setImmediate=t}if(typeof f.requestAnimationFrame=="function"&&!f.requestAnimationFrame[k]&&e.requestAnimationFrame){let t=s(function(r){let n=J(r,"raf");return e.requestAnimationFrame(n)},"buoyJsTopRequestAnimationFrame");t[k]=true,f.requestAnimationFrame=t}}s(De,"installTimerPatches");function $e(){let e=de();if(typeof f.queueMicrotask=="function"&&!f.queueMicrotask[k]&&e.queueMicrotask){let t=s(function(r){let n=J(r,"microtask");return e.queueMicrotask(n)},"buoyJsTopQueueMicrotask");t[k]=true,f.queueMicrotask=t}}s($e,"installMicrotaskPatches");var je=16,Hr=100,Vr=3,Nr=8,oe=null,ae=0,be=false,ie=[],G=1/0,Y=0,We=je;function jt(){let e=F(),t=ae>0?e-ae:0;if(ae=e,be){be=false,G=1/0,Y=e;return}if(t<=0)return;t<Hr&&(t<G&&(G=t),Y===0&&(Y=e),e-Y>=1e3&&(ie.push(G),ie.length>Vr&&ie.shift(),We=Math.max(Nr,Math.min(...ie)),G=1/0,Y=e));let r=t-We;r>1&&ut(e-r,e)}s(jt,"buoyJsTopProbeTick");function He(){if(oe!=null)return;let e=re();ae=F(),be=false,ie=[],G=1/0,Y=0,We=je,oe=e.setInterval(jt,je)}s(He,"startBusyProbe");function Ve(){oe!=null&&(re().clearInterval(oe),oe=null),ae=0}s(Ve,"stopBusyProbe");function Wt(){be=true}s(Wt,"suppressNextGap");import{definePersistedSetting as Jr}from"@buoy-gg/shared-ui/web";var Kr="@react_buoy/js-top/prefs",qr={enabled:false},Ht=Jr(Kr,qr,{sanitize:s(e=>({enabled:e.enabled===true}),"sanitize")});async function Vt(){return Ht.load()}s(Vt,"loadJsTopPrefs");async function Nt(e){await Ht.save(e)}s(Nt,"saveJsTopPrefs");import{subscribeRealAppState as Ur}from"@buoy-gg/shared-ui/web";var _r=250,Jt=class Lo{constructor(){this.enabled=false;this.enabledLoaded=false;this.paused=false;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=[];Vt().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&&Nt({enabled:t}),this.enabledSubscribers.forEach(r=>{try{r(t)}catch(n){ee&&console.error("[Buoy]","[js-top] enabled subscriber threw",n)}}),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,te(false),Ve(),this.emitSnapshot())}resume(){this.paused&&(this.paused=false,this.engineRunning&&(te(true),He()),this.emitSnapshot())}clear(){Ft(),pt();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=F(),n=ze(r),o=this.freezeStatsProvider?.(Date.now())?.byOrigin[t];if(t==="unattributed"){let i=mt(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:n>0?Math.min(100,Math.round(l/n*1e3)/10):0,lastSeenAgoMs:0,buckets:i,freezes:o?.count??0,worstFreezeMs:Math.round(o?.maxMs??0)}}let a=Pt(t,r,n);return a?{...a,freezes:o?.count??0,worstFreezeMs:Math.round(o?.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 ee&&console.error("[Buoy]","[js-top] tier installer threw",r),{}}}startEngine(){this.engineRunning=true,De(),$e(),this.tiers={timers:true,promises:false,bridge:false,longtask:false};for(let t of this.tierInstallers)Object.assign(this.tiers,this.runInstaller(t));te(!this.paused),this.paused||He();try{this.appStateSub=Ur(()=>{Wt()})}catch{this.appStateSub=null}this.notifyHandle=re().setInterval(()=>this.emitSnapshot(),_r),this.emitSnapshot()}stopEngine(){if(this.engineRunning=false,te(false),Ve(),this.notifyHandle!=null&&(re().clearInterval(this.notifyHandle),this.notifyHandle=null),this.appStateSub){try{this.appStateSub.remove()}catch{}this.appStateSub=null}}buildSnapshot(){let t=F(),r=ze(t),n=ht(t),o=Math.max(0,r-n),a=Ot(t,r,30);o>=1&&(a.push({key:"unattributed",label:"unattributed (events / React / native call-ins)",api:"unattributed",windowMs:Math.round(o*10)/10,pctOfBusy:r>0?Math.min(100,Math.round(o/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:ft(t),tiers:{...this.tiers},rows:a,totals:{attributedWindowMs:Math.round(n*10)/10,unattributedWindowMs:Math.round(o*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){ee&&console.error("[Buoy]","[js-top] snapshot subscriber threw",r)}})}isEngineActive(){return H()}};s(Jt,"JsTopControllerImpl");var Qr=Jt,m=new Qr;function ge(e,t){let r=e[t];if(typeof r!="function")return false;if(r[k])return true;let n=s(function(...o){for(let a=0;a<o.length;a++)typeof o[a]=="function"&&(o[a]=J(o[a],"then"));return r.apply(this,o)},"patched");return n[k]=true,Object.defineProperty(n,"name",{value:t,configurable:true}),e[t]=n,true}s(ge,"patchMethod");function Kt(){let e=f.Promise?.prototype;if(!e)return{promises:false};let t=ge(e,"then");return ge(e,"catch"),ge(e,"finally"),{promises:t}}s(Kt,"installPromisePatches");function qt(){let e=f.__fbBatchedBridge;if(!e)return{bridge:false};let t=false;if(typeof e.callFunctionReturnFlushedQueue=="function"&&!e.callFunctionReturnFlushedQueue[k]){let n=e.callFunctionReturnFlushedQueue.bind(e),o=s(function(a,i,l){return H()?Le("bridge",`${a}.${i}`,()=>n(a,i,l)):n(a,i,l)},"buoyJsTopCallFunction");o[k]=true,e.callFunctionReturnFlushedQueue=o,t=true}if(typeof e.invokeCallbackAndReturnFlushedQueue=="function"&&!e.invokeCallbackAndReturnFlushedQueue[k]){let n=e.invokeCallbackAndReturnFlushedQueue.bind(e),o=s(function(a,i){return H()?Le("bridge","nativeModuleCallback",()=>n(a,i)):n(a,i)},"buoyJsTopInvokeCallback");o[k]=true,e.invokeCallbackAndReturnFlushedQueue=o,t=true}let r=e.callFunctionReturnFlushedQueue?.[k]===true;return{bridge:t||r}}s(qt,"installBridgePatch");var Gr=40,Yr=6e4,Zr="unattributed",Ut=false,ye=false,Z=[];function _t(e,t){let r=e+t,n=null,o=0;for(let a of $t()){if(!a)continue;let i=Math.min(r,a.end)-Math.max(e,a.start);i>o&&(o=i,n=a.originKey)}return n}s(_t,"correlate");function Qt(){if(Ut)return{longtask:ye};Ut=true;let e=f.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 n=r.startTime,o=r.duration;dt(n,n+o),Z.push({start:n,duration:o,at:Date.now(),originKey:_t(n,o)}),Z.length>Gr&&Z.shift()}}catch{}}).observe({entryTypes:["longtask"]}),ye=true}catch{ye=false}return{longtask:ye}}s(Qt,"installLongtaskObserver");function Gt(){return Z.map(e=>({start:e.start,duration:e.duration,at:e.at,originLabel:e.originKey?It(e.originKey):null}))}s(Gt,"getLongtasks");function Yt(e){let t={},r=0,n=0;for(let o of Z){if(o.at>0&&e-o.at>Yr)continue;r++,o.duration>n&&(n=o.duration);let a=o.originKey??Zr,i=t[a];i?(i.count++,o.duration>i.maxMs&&(i.maxMs=o.duration)):t[a]={count:1,maxMs:o.duration}}return{count:r,worstMs:n,byOrigin:t}}s(Yt,"getFreezeStats");function Zt(){Z.length=0}s(Zt,"clearLongtasks");var Xr={version:1,getSnapshot:s(()=>({live:m.getSnapshot(),enabled:m.isEnabled()||m.isRemoteSampling()}),"getSnapshot"),subscribe:s(e=>{let t=m.subscribe(()=>e()),r=m.subscribeEnabled(()=>e());return()=>{t(),r()}},"subscribe"),actions:{setEnabled:s(e=>{let t=e.enabled;m.setRemoteSampling(t)},"setEnabled"),pause:s(()=>m.pause(),"pause"),resume:s(()=>m.resume(),"resume"),clear:s(()=>m.clear(),"clear"),getOriginDetail:s(e=>m.getOriginDetail(e.key),"getOriginDetail"),sample:s(async e=>{let t=e,r=Math.min(Math.max(t?.durationMs??3e3,250),3e4),n=m.isRemoteSampling()||m.isEnabled();n||m.setRemoteSampling(true),t?.clearFirst&&m.clear();try{return await new Promise(o=>setTimeout(o,r)),m.getSnapshot()}finally{n||m.setRemoteSampling(false)}},"sample")}};import{useCallback as en,useEffect as tn,useMemo as rn,useState as Xt}from"react";var er={};Br(er,{AccessibilityInfo:()=>sn,ActivityIndicator:()=>so,Alert:()=>co,Animated:()=>ln,AppRegistry:()=>cn,AppState:()=>dn,Appearance:()=>un,BackHandler:()=>hn,Button:()=>lo,CheckBox:()=>En,Clipboard:()=>mn,DeviceEventEmitter:()=>Jn,Dimensions:()=>fn,Easing:()=>pn,FlatList:()=>zn,I18nManager:()=>bn,Image:()=>Bn,ImageBackground:()=>Rn,InteractionManager:()=>yn,Keyboard:()=>gn,KeyboardAvoidingView:()=>In,LayoutAnimation:()=>wn,Linking:()=>Mn,LogBox:()=>Nn,Modal:()=>ao,NativeEventEmitter:()=>xn,NativeModules:()=>an,PanResponder:()=>Sn,Picker:()=>On,PixelRatio:()=>vn,Platform:()=>kn,Pressable:()=>oo,ProgressBar:()=>Pn,RefreshControl:()=>Fn,SafeAreaView:()=>Ln,ScrollView:()=>Ke,SectionList:()=>Dn,Share:()=>Tn,StatusBar:()=>$n,StyleSheet:()=>V,Switch:()=>io,Text:()=>h,TextInput:()=>to,Touchable:()=>jn,TouchableHighlight:()=>ro,TouchableNativeFeedback:()=>Wn,TouchableOpacity:()=>le,TouchableWithoutFeedback:()=>no,UIManager:()=>Cn,Vibration:()=>An,View:()=>b,VirtualizedList:()=>Hn,YellowBox:()=>Vn,findNodeHandle:()=>uo,unstable_createElement:()=>on,useColorScheme:()=>Kn,useLocaleContext:()=>qn,useWindowDimensions:()=>Un});Rr(er,nn);import*as nn from"react-native-web";import{unstable_createElement as on,NativeModules as an,AccessibilityInfo as sn,Animated as ln,Appearance as un,AppRegistry as cn,AppState as dn,BackHandler as hn,Clipboard as mn,Dimensions as fn,Easing as pn,I18nManager as bn,Keyboard as gn,InteractionManager as yn,LayoutAnimation as wn,Linking as Mn,NativeEventEmitter as xn,PanResponder as Sn,PixelRatio as vn,Platform as kn,Share as Tn,StyleSheet as V,UIManager as Cn,Vibration as An,CheckBox as En,FlatList as zn,Image as Bn,ImageBackground as Rn,KeyboardAvoidingView as In,Picker as On,ProgressBar as Pn,RefreshControl as Fn,SafeAreaView as Ln,SectionList as Dn,StatusBar as $n,Touchable as jn,TouchableNativeFeedback as Wn,VirtualizedList as Hn,YellowBox as Vn,LogBox as Nn,DeviceEventEmitter as Jn,useColorScheme as Kn,useLocaleContext as qn,useWindowDimensions as Un}from"react-native-web";import*as B from"react-native-web";import{createElement as Ne,forwardRef as tr,useCallback as _n,useRef as Qn}from"react";import{useEffect as Gn,useState as Yn}from"react";import{createPortal as Zn}from"react-dom";var Xn='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';import{jsx as eo}from"react/jsx-runtime";var se=Symbol.for("@buoy-gg/portal-host"),rr=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 Je(){let e=document;if(e[se])return e[se].host;let t=document.createElement("div");t.dataset.buoyPortalHost="",Object.assign(t.style,{position:"fixed",inset:"0",zIndex:"2147483647",pointerEvents:"none",fontFamily:Xn});let r=s(()=>{let u=document.fullscreenElement,C=u&&u.tagName!=="CANVAS"?u:document.body;t.parentElement!==C&&C.appendChild(t)},"move"),n=new Map,o=s(u=>{(!t.contains(u.target)||!rr(u.target))&&n.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=>{n.delete(u.code||u.key)},"up"),i=s(()=>n.clear(),"clear"),l=s(()=>{let u=[...n.values()];n.clear();for(let C of u)document.dispatchEvent(new KeyboardEvent("keyup",{...C,bubbles:true}))},"focus"),c=s(u=>{rr(u.target)&&u.stopPropagation()},"key"),d=s(u=>u.stopPropagation(),"wheel");return r(),document.addEventListener("fullscreenchange",r),document.addEventListener("keydown",o,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[se]={host:t,users:0,dispose:s(()=>{document.removeEventListener("fullscreenchange",r),document.removeEventListener("keydown",o,true),document.removeEventListener("keyup",a,true),window.removeEventListener("blur",i),t.remove(),delete e[se]},"dispose")},t}s(Je,"getBuoyPortalHost");function nr({children:e}){let[t,r]=Yn(null);return Gn(()=>{let n=Je(),o=document[se];return o.users++,r(n),()=>{--o.users===0&&o.dispose()}},[]),t?Zn(eo("div",{"data-buoy-root":"",style:{display:"contents",pointerEvents:"auto"},children:e}),t):null}s(nr,"BuoyPortal");function R(e){let t=tr((n,o)=>{let{accessibilityState:a,accessibilityValue:i,...l}=n;for(let c of["busy","checked","disabled","expanded","selected"])a?.[c]!==void 0&&l[`aria-${c}`]===void 0&&(l[`aria-${c}`]=a[c]);for(let[c,d]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[c]!==void 0&&l[`aria-${d}`]===void 0&&(l[`aria-${d}`]=i[c]);return Ne(e,{...l,ref:o})}),r=e.State;return r&&Object.assign(t,{State:r}),t.displayName=e.displayName??e.name??"NativeWebView",t}s(R,"withAccessibility");var b=R(B.View),h=R(B.Text),to=R(B.TextInput),le=R(B.TouchableOpacity),ro=R(B.TouchableHighlight),no=R(B.TouchableWithoutFeedback),oo=R(B.Pressable),Ke=R(B.ScrollView),or=tr((e,t)=>{let r=Qn(null),n=_n(o=>{if(o){let a=o;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"}),Je().appendChild(a))}else r.current&&(document.body.appendChild(r.current),r.current=null);typeof t=="function"?t(o):t&&(t.current=o)},[t]);return Ne(nr,null,Ne(B.Modal,{...e,ref:n}))});or.displayName="Modal";var ao=R(or),io=R(B.Switch),so=R(B.ActivityIndicator),lo=R(B.Button),uo=B.findNodeHandle,co={alert(e,t,r,n){if(typeof document>"u")return;let o=document.createElement("dialog");o.dataset.buoyRoot="",o.setAttribute("aria-label",e),o.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let a=document.createElement("h2");if(a.textContent=e,a.style.cssText="font-size:18px;margin:0 0 12px",o.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",o.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(()=>{o.close?.(),o.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)}o.addEventListener("cancel",d=>{d.preventDefault(),n?.cancelable!==false&&(c(),n?.onDismiss?.())}),o.appendChild(i),document.body.appendChild(o),o.showModal?o.showModal():o.setAttribute("open","")}};import{Activity as ho,JsModal as mo,macOSColors as P,night as z,ModalHeader as ue,Pause as fo,Play as po,Trash2 as bo}from"@buoy-gg/shared-ui/web";import{memo as go}from"react";import{macOSColors as qe}from"@buoy-gg/shared-ui/web";import{jsx as ar}from"react/jsx-runtime";var yo=60;function ir(e){return e>=80?qe.semantic.error:e>=40?qe.semantic.warning:qe.semantic.success}s(ir,"barColor");var wo=go(s(function({history:e}){let t=e.slice(-yo);return ar(b,{style:sr.row,pointerEvents:"none",children:t.map((r,n)=>ar(b,{style:[sr.bar,{height:Math.max(2,r/100*28),backgroundColor:ir(r)}]},`b${n}`))})},"BusySparkline")),sr=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 Mo,useState as xo}from"react";import{macOSColors as we,night as v}from"@buoy-gg/shared-ui/web";import{jsx as I,jsxs as D}from"react/jsx-runtime";var So=[{key:"windowMs",title:"RECENT"},{key:"calls",title:"CALLS"},{key:"avgMs",title:"AVG"},{key:"maxMs",title:"MAX"},{key:"totalMs",title:"TOTAL"}],lr={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 Me(e){return lr[e]??lr.other}s(Me,"badgeFor");function Ue(e){if(e.api==="unattributed")return"events \xB7 React \xB7 native call-ins";if(e.api==="other")return"evicted cold origins";let t=Me(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(Ue,"displayName");function X(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(X,"fmt");function ur(e){return e.calls<=0?"measured by probe \xB7 not reachable from JS":`${X(e.calls)} calls \xB7 avg ${X(e.avgMs)} \xB7 max ${X(e.maxMs)} \xB7 total ${X(e.totalMs)} ms`}s(ur,"statsLine");var vo=Mo(s(function({row:e,rank:t,onPress:r}){let n=Me(e.api);return D(r?le:b,{style:E.row,testID:"buoy-jstop-row",...r?{onPress:s(()=>r(e),"onPress"),activeOpacity:.6}:{},children:[D(b,{style:E.topLine,children:[I(h,{style:E.rank,children:t}),I(b,{style:[E.badge,{borderColor:n.color,backgroundColor:`${n.color}1A`}],children:I(h,{style:[E.badgeText,{color:n.color}],children:n.text})}),I(h,{style:E.name,numberOfLines:1,testID:"buoy-jstop-row-name",children:Ue(e)}),e.freezes>0&&D(h,{style:[E.freezeBadge,e.worstFreezeMs>=100&&E.freezeBadgeSevere],children:["\u26A0 \xD7",e.freezes]}),D(h,{style:[E.windowMs,e.api!=="unattributed"&&e.pctOfBusy>=25&&{color:e.pctOfBusy>=50?we.semantic.error:we.semantic.warning}],children:[X(e.windowMs),I(h,{style:E.unit,children:" ms"})]}),D(h,{style:[E.pct,e.api==="unattributed"&&E.pctMuted],children:[Math.round(e.pctOfBusy),"%"]})]}),D(b,{style:E.subLine,children:[I(b,{style:E.barTrack,children:I(b,{style:[E.barFill,{width:`${Math.min(100,e.pctOfBusy)}%`,backgroundColor:n.color}]})}),I(h,{style:E.stats,numberOfLines:1,testID:"buoy-jstop-row-stats",children:ur(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 cr({rows:e,onSelectRow:t}){let[r,n]=xo("windowMs"),o=r==="windowMs"?e:[...e].sort((a,i)=>i[r]-a[r]);return D(b,{style:$.root,children:[D(b,{style:$.sortRow,children:[I(h,{style:$.sortLabel,children:"SORT"}),So.map(a=>I(le,{onPress:()=>n(a.key),style:[$.sortChip,r===a.key&&$.sortChipOn],children:I(h,{style:[$.sortChipText,r===a.key&&$.sortChipTextOn],children:a.title})},a.key))]}),D(Ke,{style:$.body,children:[o.map((a,i)=>I(vo,{row:a,rank:i+1,onPress:t},a.key)),o.length===0&&I(h,{style:$.empty,testID:"buoy-jstop-empty",children:"No tasks observed yet \u2014 interact with the app."})]})]})}s(cr,"TaskTable");var $=V.create({root:{flex:1,minHeight:0},sortRow:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:6,borderBottomWidth:1,borderBottomColor:v.color.border,backgroundColor:v.color.surface},sortLabel:{color:v.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginRight:2},sortChip:{borderWidth:1,borderColor:v.color.border,borderRadius:4,paddingHorizontal:7,paddingVertical:3},sortChipOn:{borderColor:v.color.accentBorderStrong,backgroundColor:v.color.accentSoft},sortChipText:{color:v.color.textTertiary,fontSize:9,fontWeight:"600",fontVariant:["tabular-nums"]},sortChipTextOn:{color:v.color.accent},body:{flex:1},empty:{color:v.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:24}}),E=V.create({row:{paddingHorizontal:10,paddingVertical:8,borderBottomWidth:V.hairlineWidth,borderBottomColor:v.color.border,gap:5},topLine:{flexDirection:"row",alignItems:"center",gap:6},rank:{width:16,color:v.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:v.color.text,fontSize:13,fontWeight:"500"},freezeBadge:{color:we.semantic.warning,fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},freezeBadgeSevere:{color:we.semantic.error},windowMs:{color:v.color.text,fontSize:13,fontWeight:"700",fontVariant:["tabular-nums"]},unit:{color:v.color.textTertiary,fontSize:10,fontWeight:"400"},pct:{width:38,textAlign:"right",color:v.color.textSecondary,fontSize:12,fontWeight:"600",fontVariant:["tabular-nums"]},pctMuted:{color:v.color.textTertiary},subLine:{flexDirection:"row",alignItems:"center",gap:8,paddingLeft:22},barTrack:{width:72,height:4,borderRadius:2,backgroundColor:v.color.fillSecondary,overflow:"hidden"},barFill:{height:4,borderRadius:2,opacity:.85},stats:{flex:1,color:v.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]}});import{memo as ko}from"react";import{macOSColors as xe,night as T,useSafeAreaInsets as To}from"@buoy-gg/shared-ui/web";import{Fragment as dr,jsx as M,jsxs as O}from"react/jsx-runtime";var hr={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 mr(e){return hr[e]??hr.other}s(mr,"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 fr(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(fr,"agoFmt");function j({label:e,value:t,accent:r}){return O(b,{style:g.stat,children:[M(h,{style:g.statLabel,children:e}),M(h,{style:[g.statValue,r?{color:r}:null],children:t})]})}s(j,"Stat");var Co=ko(s(function({detail:e}){let t=Me(e.api),r=To({minBottom:12}),n=Math.max(1,...e.buckets);return O(Ke,{style:g.root,testID:"buoy-jstop-detail",contentContainerStyle:{paddingBottom:r.bottom},children:[O(b,{style:g.identityRow,children:[M(b,{style:[g.badge,{borderColor:t.color,backgroundColor:`${t.color}1A`}],children:M(h,{style:[g.badgeText,{color:t.color}],children:t.text})}),M(h,{style:g.name,numberOfLines:2,testID:"buoy-jstop-detail-name",children:Ue(e)})]}),M(h,{style:g.explainer,children:mr(e.api)}),M(h,{style:g.sectionTitle,children:"ACTIVITY \xB7 LAST 5S"}),M(b,{style:g.chartRow,children:e.buckets.map((o,a)=>M(b,{style:g.chartBarSlot,children:M(b,{style:[g.chartBar,{height:Math.max(2,o/n*44),backgroundColor:t.color}]})},`bk${a}`))}),O(b,{style:g.chartLegend,children:[O(h,{style:g.chartLegendText,children:[N(e.windowMs)," ms in window \xB7 ",e.pctOfBusy.toFixed(1),"% of busy time"]}),O(h,{style:g.chartLegendText,children:["peak ",N(n)," ms/250ms"]})]}),M(h,{style:g.sectionTitle,children:"STATS \xB7 SINCE START"}),O(b,{style:g.statGrid,children:[M(j,{label:"RUNS",value:e.calls>0?N(e.calls):"\u2014"}),M(j,{label:"SCHEDULED",value:e.scheduleCount>0?N(e.scheduleCount):"\u2014"}),M(j,{label:"AVG / RUN",value:e.calls>0?`${N(e.avgMs)} ms`:"\u2014"}),M(j,{label:"MAX / RUN",value:e.maxMs>0?`${N(e.maxMs)} ms`:"\u2014",accent:e.maxMs>=50?xe.semantic.warning:void 0}),M(j,{label:"TOTAL",value:e.totalMs>0?`${N(e.totalMs)} ms`:"\u2014"}),M(j,{label:"LAST RUN",value:fr(e.lastSeenAgoMs)}),M(j,{label:"FREEZES \xB7 60S",value:e.freezes>0?`${e.freezes}`:"0",accent:e.freezes>0?xe.semantic.error:void 0}),M(j,{label:"WORST FREEZE",value:e.worstFreezeMs>0?`${e.worstFreezeMs} ms`:"\u2014",accent:e.worstFreezeMs>=100?xe.semantic.error:e.worstFreezeMs>0?xe.semantic.warning:void 0})]}),(e.caller||(e.frames?.length??0)>0)&&O(dr,{children:[M(h,{style:g.sectionTitle,children:"SCHEDULED FROM"}),O(b,{style:g.siteCard,children:[e.caller&&O(h,{style:g.siteCaller,children:[e.caller,"()"]}),e.file&&O(h,{style:g.siteFile,children:[e.file,e.line!=null?`:${e.line}`:""]}),e.frames?.map((o,a)=>O(h,{style:g.siteFrame,numberOfLines:1,children:[o.file,":",o.line,":",o.col]},`fr${a}`)),M(h,{style:g.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"&&O(dr,{children:[M(h,{style:g.sectionTitle,children:"SCHEDULED FROM"}),M(h,{style:g.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")),g=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:T.color.text,fontSize:15,fontWeight:"600"},explainer:{color:T.color.textTertiary,fontSize:11,lineHeight:15,marginTop:6,marginBottom:4},sectionTitle:{color:T.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginTop:14,marginBottom:6},chartRow:{flexDirection:"row",alignItems:"flex-end",height:48,gap:2,backgroundColor:T.color.surface,borderRadius:6,borderWidth:1,borderColor:T.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:T.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},statGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},stat:{width:"23%",minWidth:76,flexGrow:1,backgroundColor:T.color.surface,borderWidth:1,borderColor:T.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:6},statLabel:{color:T.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.4,marginBottom:3},statValue:{color:T.color.text,fontSize:13,fontWeight:"600",fontVariant:["tabular-nums"]},siteCard:{backgroundColor:T.color.surface,borderWidth:1,borderColor:T.color.border,borderRadius:6,padding:10,gap:3},siteCaller:{color:T.color.text,fontSize:13,fontWeight:"600"},siteFile:{color:T.color.info,fontSize:11},siteFrame:{color:T.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},siteNote:{color:T.color.textTertiary,fontSize:9,opacity:.8,marginTop:4},sitePending:{color:T.color.textTertiary,fontSize:11}});import{Fragment as Ao,jsx as w,jsxs as W}from"react/jsx-runtime";function _e(e){return e>=80?P.semantic.error:e>=40?P.semantic.warning:P.semantic.success}s(_e,"busyColor");function Se(e){return e>=100?P.semantic.error:P.semantic.warning}s(Se,"freezeColor");function pr(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?P.semantic.error:P.semantic.warning,icon:"\u25B2",text:`${t.label} is eating ${Math.round(t.pctOfBusy)}% of thread time \u2014 start there.`}:e.freezeSummary.count>0?{color:Se(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:P.semantic.warning,icon:"\u25B2",text:"Thread saturated by UI/React work \u2014 open Highlight Updates to find re-renders."}:{color:P.semantic.success,icon:"\u25CF",text:`Thread healthy at ${Math.round(e.busyPct)}% load \u2014 nothing worth chasing.`}}s(pr,"diagnose");function Qe({visible:e,onClose:t,onBack:r,onMinimize:n,initialModalState:o,minimizeTargetPosition:a,remoteSnapshot:i,remoteActions:l,embedded:c=false}){let d=i!==void 0,[u,C]=Xt(null);tn(()=>{if(!(d||!e))return m.subscribe(C)},[d,e]);let p=d?i:u,y=rn(()=>l??{pause:s(()=>m.pause(),"pause"),resume:s(()=>m.resume(),"resume"),clear:s(()=>m.clear(),"clear")},[l]),S=p?.paused??false,ve=(p?.rows.length??0)>0,[ke,et]=Xt(null),Cr=en(K=>et(K.key),[]),tt=!d&&ke?m.getOriginDetail(ke):null,rt=ke!==null,nt=W(ue,{children:[rt?w(ue.Navigation,{onBack:()=>et(null)}):r?w(ue.Navigation,{onBack:r}):null,w(ue.Content,{title:"",noMargin:true,children:W(b,{style:x.titleRow,children:[w(ho,{size:14,color:"#34D399"}),w(h,{style:x.title,testID:"buoy-jstop-title",children:"JS Top"}),p&&w(b,{style:[x.busyPill,{borderColor:_e(p.busyPct)}],children:W(h,{testID:"buoy-jstop-busy",style:[x.busyText,{color:_e(p.busyPct)}],children:[p.busyPct.toFixed(0),"% BUSY"]})}),p&&p.freezeSummary.count>0&&w(b,{style:[x.busyPill,{borderColor:Se(p.freezeSummary.worstMs)}],children:W(h,{testID:"buoy-jstop-freezes",style:[x.busyText,{color:Se(p.freezeSummary.worstMs)}],children:["\u26A0 ",p.freezeSummary.count," \xB7"," ",p.freezeSummary.worstMs,"ms"]})})]})}),W(ue.Actions,{children:[w(le,{onPress:S?y.resume:y.pause,style:[x.actionBtn,S&&x.actionBtnActive],testID:"buoy-jstop-pause",accessibilityLabel:S?"Resume sampling":"Pause sampling",children:S?w(po,{size:14,color:z.color.accent}):w(fo,{size:14,color:z.color.textSecondary})}),w(le,{onPress:y.clear,disabled:!ve,style:[x.actionBtn,!ve&&x.actionBtnDisabled],testID:"buoy-jstop-clear",accessibilityLabel:"Clear stats",children:w(bo,{size:14,color:ve?z.color.textTertiary:z.color.textTertiary})})]})]}),ot=w(b,{style:x.body,children:rt?tt?w(Co,{detail:tt}):w(h,{style:x.waiting,children:"This origin is no longer tracked (cleared or evicted)."}):p?W(Ao,{children:[(()=>{let K=pr(p);return W(b,{style:[x.diagnosis,{borderLeftColor:K.color}],children:[w(h,{style:[x.diagnosisIcon,{color:K.color}],children:K.icon}),w(h,{style:x.diagnosisText,children:K.text})]})})(),W(b,{style:x.sparklineRow,children:[w(h,{style:x.sparklineCaption,children:"JS THREAD LOAD \xB7 LAST 30s"}),w(wo,{history:p.busyHistory})]}),!p.tiers.bridge&&w(h,{style:x.tierBanner,children:"\u201CSystem\u201D rows are UI/React/native work pure JS can\u2019t name \u2014 timers, rAF and Promise chains are fully attributed."}),w(cr,{rows:p.rows,onSelectRow:d?void 0:Cr})]}):w(h,{style:x.waiting,children:d?"Waiting for device\u2026":"Starting engine\u2026"})});return c?W(b,{style:x.embeddedRoot,children:[w(b,{style:x.embeddedHeader,children:nt}),ot]}):w(mo,{visible:e,onClose:t,onMinimize:n,minimizeTargetPosition:a,initialModalState:o,header:{showToggleButton:true,customContent:nt},persistenceKey:"buoy-js-top-modal",enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:ot})}s(Qe,"JsTopModal");var x=V.create({titleRow:{flexDirection:"row",alignItems:"center",gap:8},title:{color:z.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:z.color.buttonSurface,borderWidth:1,borderColor:z.color.border,alignItems:"center",justifyContent:"center"},actionBtnActive:{backgroundColor:z.color.accentSoft,borderColor:z.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:z.color.surface,borderRadius:6,borderLeftWidth:3},diagnosisIcon:{fontSize:11,fontWeight:"700"},diagnosisText:{flex:1,color:z.color.text,fontSize:12,lineHeight:16},sparklineRow:{paddingHorizontal:10,paddingVertical:8,gap:4},sparklineCaption:{color:z.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.5},tierBanner:{color:z.color.textTertiary,fontSize:10,paddingHorizontal:10,paddingBottom:6},waiting:{color:z.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:32},embeddedRoot:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:P.background.base},embeddedHeader:{borderBottomWidth:1,borderBottomColor:P.border.default}});import{useEffect as br,useState as gr}from"react";import{macOSColors as Ge,night as Ye}from"@buoy-gg/shared-ui/web";import{jsx as Eo,jsxs as yr}from"react/jsx-runtime";function wr(e){return e>=80?Ge.semantic.error:e>=40?Ge.semantic.warning:Ge.semantic.success}s(wr,"busyColor");function Mr(){let[e,t]=gr(()=>m.isEnabled()),[r,n]=gr(null);if(br(()=>m.subscribeEnabled(t),[]),br(()=>{if(!e){n(null);return}return m.subscribe(n)},[e]),!e||!r)return null;let o=r.rows.find(a=>a.api!=="unattributed");return yr(b,{style:Ze.pill,pointerEvents:"none",children:[yr(h,{style:[Ze.busy,{color:wr(r.busyPct)}],children:[r.busyPct.toFixed(0),"%"]}),o&&Eo(h,{style:Ze.label,numberOfLines:1,children:o.label})]})}s(Mr,"JsTopHudOverlay");var Ze=V.create({pill:{position:"absolute",top:60,left:8,flexDirection:"row",alignItems:"center",gap:6,backgroundColor:Ye.color.buttonSurface,borderWidth:1,borderColor:Ye.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:4,maxWidth:220},busy:{fontSize:11,fontWeight:"700",fontVariant:["tabular-nums"]},label:{color:Ye.color.textSecondary,fontSize:10,flexShrink:1}});import{useEffect as zo,useState as Bo}from"react";import{Activity as xr}from"@buoy-gg/shared-ui/web";import{jsx as Sr}from"react/jsx-runtime";var Xe="#34D399",vr="#6B7280";function kr({size:e}){let[t,r]=Bo(()=>m.isEnabled());return zo(()=>m.subscribeEnabled(r),[]),Sr(xr,{size:e,color:t?Xe:vr})}s(kr,"JsTopToggleIcon");function Tr(){return null}s(Tr,"EmptyComponent");var Ro={id:"js-top",name:"JS TOP",description:"Toggle the floating JS-thread busy pill",slot:"row",icon:kr,component:Tr,props:{},launchMode:"toggle-only",onPress:s(()=>{m.setEnabled(!m.isEnabled())},"onPress")},Io={id:"js-top-modal",name:"TASKS",description:"Live Task Manager for the JS thread",slot:"both",icon:s(({size:e})=>Sr(xr,{size:e,color:Xe}),"icon"),component:Qe,props:{enableSharedModalDimensions:false}};m.registerTierInstaller(Kt);m.registerTierInstaller(qt);m.registerTierInstaller(Qt);m.registerLongtaskProvider(Gt);m.registerFreezeStatsProvider(Yt);m.registerClearHook(Zt);try{typeof window<"u"&&(De(),$e())}catch{}export{vr as JS_TOP_DISABLED_COLOR,Xe as JS_TOP_ENABLED_COLOR,m as JsTopController,Mr as JsTopHudOverlay,Qe as JsTopModal,Io as jsTopModalPreset,Ro as jsTopPreset,Xr as jsTopSyncAdapter};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/js-top",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.69",
|
|
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.
|
|
15
|
+
"@buoy-gg/shared-ui": "^7.0.69"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": "*"
|