@buoy-gg/console 7.0.62 → 7.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,3 +25,5 @@ The [Console guide](https://buoy.gg/buoy/latest/docs/tools/console) covers setup
25
25
  ---
26
26
 
27
27
  <sub>Part of <a href="https://buoy.gg">Buoy</a>, developer tools that live inside your app. Proprietary software. © Buoy LLC. <a href="https://buoy.gg/terms">Terms</a></sub>
28
+
29
+ Buoy keeps its own logs out of this view. The browser console still gets those logs.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleModal=ConsoleModal;var _sharedUi=require("@buoy-gg/shared-ui");var _useConsoleController=require("../devtools/useConsoleController");var _ConsoleHeader=require("../devtools/ConsoleHeader");var _ConsoleBody=require("../devtools/ConsoleBody");var _jsxRuntime=require("react/jsx-runtime");function ConsoleModal({visible:o,onClose:r,onBack:s,onMinimize:l,persistenceKey:n}){const e=(0,_useConsoleController.useConsoleController)();return(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{visible:o,onClose:r,onMinimize:l,persistenceKey:n,header:{showToggleButton:true,customContent:(0,_jsxRuntime.jsx)(_ConsoleHeader.ConsoleHeader,{c:e,onBack:s})},enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:(0,_jsxRuntime.jsx)(_ConsoleBody.ConsoleBody,{c:e})})}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleModal=ConsoleModal;var _sharedUi=require("@buoy-gg/shared-ui");var _useConsoleController=require("../devtools/useConsoleController");var _ConsoleHeader=require("../devtools/ConsoleHeader");var _ConsoleBody=require("../devtools/ConsoleBody");var _jsxRuntime=require("react/jsx-runtime");function ConsoleModal({visible:o,onClose:r,onBack:s,onMinimize:l,persistenceKey:n="@react_buoy_console_modal"}){const e=(0,_useConsoleController.useConsoleController)();return(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{visible:o,onClose:r,onMinimize:l,persistenceKey:n,header:{showToggleButton:true,customContent:(0,_jsxRuntime.jsx)(_ConsoleHeader.ConsoleHeader,{c:e,onBack:s})},enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:(0,_jsxRuntime.jsx)(_ConsoleBody.ConsoleBody,{c:e})})}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleBody=ConsoleBody;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _ConsoleMessageRow=require("./ConsoleMessageRow");var _consoleFilter=require("./consoleFilter");var _consoleLogStore=require("../store/consoleLogStore");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,r){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(_interopRequireWildcard=function(t,c){if(!c&&t&&t.__esModule)return t;var s,i,l={__proto__:null,default:t};if(null===t||"object"!=typeof t&&"function"!=typeof t)return l;if(s=c?o:n){if(s.has(t))return s.get(t);s.set(t,l)}for(const a in t)"default"!==a&&{}.hasOwnProperty.call(t,a)&&((i=(s=Object.defineProperty)&&Object.getOwnPropertyDescriptor(t,a))&&(i.get||i.set)?s(l,a,i):l[a]=t[a]);return l})(e,r)}function ConsoleBody({c:e}){if(e.view==="filters")return(0,_jsxRuntime.jsx)(FiltersView,{c:e});return(0,_jsxRuntime.jsx)(ConsoleList,{c:e})}function ConsoleList({c:e}){const r=(0,_react.useRef)(null);const n=(0,_react.useRef)(true);const o=(0,_react.useCallback)(({item:t})=>(0,_jsxRuntime.jsx)(_ConsoleMessageRow.ConsoleMessageRow,{row:t,showTimestamps:e.showTimestamps,onToggleGroup:e.onToggleGroup,onToggleCluster:e.onToggleCluster}),[e.showTimestamps,e.onToggleGroup,e.onToggleCluster]);return(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:r,data:e.rows,keyExtractor:t=>t.key,renderItem:o,style:styles.list,..._sharedUi.LOG_LIST_PRESET,onContentSizeChange:()=>{if(n.current)r.current?.scrollToEnd({animated:false})},onScroll:t=>{const{contentOffset:c,contentSize:s,layoutMeasurement:i}=t.nativeEvent;const l=s.height-(c.y+i.height);n.current=l<40},scrollEventThrottle:100})}function CheckRow({on:e,label:r,subtext:n,onPress:o}){return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.row,onPress:o,activeOpacity:.7,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.checkbox,e&&styles.checkboxOn],children:e?(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:12,color:_sharedUi.night.color.onAccent,strokeWidth:3}):null}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowTextCol,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:r}),n?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowSubtext,children:n}):null]})]})}function SectionLabel({text:e}){return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionLabel,children:e})}function FiltersView({c:e}){const r=(0,_react.useSyncExternalStore)(_consoleLogStore.subscribePreserveLog,_consoleLogStore.getPreserveLog,_consoleLogStore.getPreserveLog);const n=o=>e.setLevelsMask({...e.levelsMask,[o]:!e.levelsMask[o]});return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.subView,contentContainerStyle:styles.subViewContent,children:[(0,_jsxRuntime.jsx)(SectionLabel,{text:"Log levels"}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.presetRow,onPress:()=>e.setLevelsMask({..._consoleFilter.DEFAULT_LEVELS}),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.presetText,children:"Default (hide verbose)"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.presetRow,onPress:()=>e.setLevelsMask({..._consoleFilter.ALL_LEVELS}),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.presetText,children:"All levels"})}),_consoleFilter.LEVEL_ORDER.map(o=>(0,_jsxRuntime.jsx)(CheckRow,{on:e.levelsMask[o],label:_consoleFilter.LEVEL_LABEL[o],onPress:()=>n(o)},o)),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.divider}),(0,_jsxRuntime.jsx)(SectionLabel,{text:"Settings"}),(0,_jsxRuntime.jsx)(CheckRow,{on:e.showTimestamps,label:"Show timestamps",onPress:()=>e.setShowTimestamps(o=>!o)}),(0,_jsxRuntime.jsx)(CheckRow,{on:r,label:"Preserve log",subtext:"Do not clear log on reload",onPress:()=>(0,_consoleLogStore.setPreserveLog)(!r)})]})}const styles=_reactNative.StyleSheet.create({list:{flex:1,backgroundColor:"transparent"},subView:{flex:1,backgroundColor:"transparent"},subViewContent:{padding:12},sectionLabel:{color:_sharedUi.night.color.textTertiary,fontSize:11,textTransform:"uppercase",letterSpacing:.5,marginTop:4,marginBottom:4,paddingHorizontal:8},presetRow:{paddingVertical:10,paddingHorizontal:8},presetText:{color:_sharedUi.night.color.accent,fontSize:14,fontWeight:"600"},divider:{height:_reactNative.StyleSheet.hairlineWidth,backgroundColor:_sharedUi.night.color.border,marginVertical:6},row:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:8,gap:12},rowTextCol:{flexDirection:"column",flex:1},rowLabel:{color:_sharedUi.night.color.text,fontSize:14},rowSubtext:{color:_sharedUi.night.color.textTertiary,fontSize:12,marginTop:1},checkbox:{width:18,height:18,borderRadius:4,borderWidth:1,borderColor:_sharedUi.night.color.fillTertiary,alignItems:"center",justifyContent:"center"},checkboxOn:{backgroundColor:_sharedUi.night.color.accent,borderColor:_sharedUi.night.color.accent}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleBody=ConsoleBody;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _ConsoleMessageRow=require("./ConsoleMessageRow");var _consoleFilter=require("./consoleFilter");var _consoleLogStore=require("../store/consoleLogStore");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,r){if("function"==typeof WeakMap)var s=new WeakMap,o=new WeakMap;return(_interopRequireWildcard=function(t,c){if(!c&&t&&t.__esModule)return t;var n,i,l={__proto__:null,default:t};if(null===t||"object"!=typeof t&&"function"!=typeof t)return l;if(n=c?o:s){if(n.has(t))return n.get(t);n.set(t,l)}for(const a in t)"default"!==a&&{}.hasOwnProperty.call(t,a)&&((i=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(t,a))&&(i.get||i.set)?n(l,a,i):l[a]=t[a]);return l})(e,r)}function ConsoleBody({c:e}){if(e.view==="filters")return(0,_jsxRuntime.jsx)(FiltersView,{c:e});return(0,_jsxRuntime.jsx)(ConsoleList,{c:e})}function ConsoleList({c:e}){const r=(0,_react.useRef)(null);const s=(0,_react.useRef)(true);const o=(0,_react.useCallback)(({item:t})=>(0,_jsxRuntime.jsx)(_ConsoleMessageRow.ConsoleMessageRow,{row:t,showTimestamps:e.showTimestamps,onToggleGroup:e.onToggleGroup,onToggleCluster:e.onToggleCluster}),[e.showTimestamps,e.onToggleGroup,e.onToggleCluster]);return(0,_jsxRuntime.jsx)(_reactNative.FlatList,{testID:"buoy-console-list",ref:r,data:e.rows,keyExtractor:t=>t.key,renderItem:o,style:styles.list,..._sharedUi.LOG_LIST_PRESET,onContentSizeChange:()=>{if(s.current)r.current?.scrollToEnd({animated:false})},onScroll:t=>{const{contentOffset:c,contentSize:n,layoutMeasurement:i}=t.nativeEvent;const l=n.height-(c.y+i.height);s.current=l<40},scrollEventThrottle:100})}function CheckRow({testID:e,on:r,label:s,subtext:o,onPress:t}){return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{testID:e,style:styles.row,onPress:t,activeOpacity:.7,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.checkbox,r&&styles.checkboxOn],children:r?(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:12,color:_sharedUi.night.color.onAccent,strokeWidth:3}):null}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowTextCol,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:s}),o?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowSubtext,children:o}):null]})]})}function SectionLabel({text:e}){return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionLabel,children:e})}function FiltersView({c:e}){const r=(0,_react.useSyncExternalStore)(_consoleLogStore.subscribePreserveLog,_consoleLogStore.getPreserveLog,_consoleLogStore.getPreserveLog);const s=o=>e.setLevelsMask({...e.levelsMask,[o]:!e.levelsMask[o]});return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{testID:"buoy-console-filters",style:styles.subView,contentContainerStyle:styles.subViewContent,children:[(0,_jsxRuntime.jsx)(SectionLabel,{text:"Log levels"}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{testID:"buoy-console-levels-default",style:styles.presetRow,onPress:()=>e.setLevelsMask({..._consoleFilter.DEFAULT_LEVELS}),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.presetText,children:"Default (hide verbose)"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{testID:"buoy-console-levels-all",style:styles.presetRow,onPress:()=>e.setLevelsMask({..._consoleFilter.ALL_LEVELS}),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.presetText,children:"All levels"})}),_consoleFilter.LEVEL_ORDER.map(o=>(0,_jsxRuntime.jsx)(CheckRow,{testID:`buoy-console-level-${o}`,on:e.levelsMask[o],label:_consoleFilter.LEVEL_LABEL[o],onPress:()=>s(o)},o)),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.divider}),(0,_jsxRuntime.jsx)(SectionLabel,{text:"Settings"}),(0,_jsxRuntime.jsx)(CheckRow,{testID:"buoy-console-timestamps",on:e.showTimestamps,label:"Show timestamps",onPress:()=>e.setShowTimestamps(o=>!o)}),(0,_jsxRuntime.jsx)(CheckRow,{testID:"buoy-console-preserve",on:r,label:"Preserve log",subtext:"Do not clear log on reload",onPress:()=>(0,_consoleLogStore.setPreserveLog)(!r)})]})}const styles=_reactNative.StyleSheet.create({list:{flex:1,backgroundColor:"transparent"},subView:{flex:1,backgroundColor:"transparent"},subViewContent:{padding:12},sectionLabel:{color:_sharedUi.night.color.textTertiary,fontSize:11,textTransform:"uppercase",letterSpacing:.5,marginTop:4,marginBottom:4,paddingHorizontal:8},presetRow:{paddingVertical:10,paddingHorizontal:8},presetText:{color:_sharedUi.night.color.accent,fontSize:14,fontWeight:"600"},divider:{height:_reactNative.StyleSheet.hairlineWidth,backgroundColor:_sharedUi.night.color.border,marginVertical:6},row:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:8,gap:12},rowTextCol:{flexDirection:"column",flex:1},rowLabel:{color:_sharedUi.night.color.text,fontSize:14},rowSubtext:{color:_sharedUi.night.color.textTertiary,fontSize:12,marginTop:1},checkbox:{width:18,height:18,borderRadius:4,borderWidth:1,borderColor:_sharedUi.night.color.fillTertiary,alignItems:"center",justifyContent:"center"},checkboxOn:{backgroundColor:_sharedUi.night.color.accent,borderColor:_sharedUi.night.color.accent}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleHeader=ConsoleHeader;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const LAYOUT_TABS=[{key:"chrono",label:"Timeline"},{key:"cluster",label:"Grouped"}];function ConsoleHeader({c:e,onBack:o}){if(e.view==="filters"){return(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:()=>e.setView("list")}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"Filters"})]})}const t=e.rows.length>0;return(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[o?(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:o}):null,(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"",noMargin:true,children:e.searchActive?(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Search,{value:e.query,onChangeText:e.setQuery,onCancel:()=>e.setQuery(""),clearOnlyWhenText:true,placeholder:"Filter logs\u2026 /regex/ -exclude",iconSize:14,inputProps:{onSubmitEditing:()=>e.setSearchActive(false)}}):(0,_jsxRuntime.jsx)(_sharedUi.TabSelector,{tabs:LAYOUT_TABS,activeTab:e.layoutMode,onTabChange:r=>e.setLayoutMode(r)})}),(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader.Actions,{children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>e.setSearchActive(r=>!r),style:[styles.actionBtn,e.searchActive&&styles.actionBtnActive],accessibilityLabel:"Search logs",children:(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:14,color:e.searchActive?_sharedUi.night.color.accent:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>e.setView("filters"),style:[styles.actionBtn,e.isLevelCustom&&styles.actionBtnActive],accessibilityLabel:"Filters",children:(0,_jsxRuntime.jsx)(_sharedUi.Filter,{size:14,color:e.isLevelCustom?_sharedUi.night.color.accent:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:e.clear,disabled:!t,style:[styles.actionBtn,!t&&styles.actionBtnDisabled],accessibilityLabel:"Clear console",children:(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:14,color:t?_sharedUi.night.color.textSecondary:_sharedUi.night.color.textTertiary})})]})]})}const styles=_reactNative.StyleSheet.create({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}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleHeader=ConsoleHeader;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const LAYOUT_TABS=[{key:"chrono",label:"Timeline"},{key:"cluster",label:"Grouped"}];function ConsoleHeader({c:e,onBack:r}){if(e.view==="filters"){return(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:()=>e.setView("list")}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"Filters"})]})}const t=e.rows.length>0;return(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[r?(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:r}):null,(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"",noMargin:true,children:e.searchActive?(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Search,{testID:"buoy-console-search",value:e.query,onChangeText:e.setQuery,onCancel:()=>e.setQuery(""),clearOnlyWhenText:true,placeholder:"Filter logs\u2026 /regex/ -exclude",iconSize:14,inputProps:{onSubmitEditing:()=>e.setSearchActive(false)}}):(0,_jsxRuntime.jsx)(_sharedUi.TabSelector,{testIDPrefix:"buoy-console-tab",tabs:LAYOUT_TABS,activeTab:e.layoutMode,onTabChange:o=>e.setLayoutMode(o)})}),(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader.Actions,{children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>e.setSearchActive(o=>!o),style:[styles.actionBtn,e.searchActive&&styles.actionBtnActive],testID:"buoy-console-search-open",accessibilityLabel:"Search logs",children:(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:14,color:e.searchActive?_sharedUi.night.color.accent:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>e.setView("filters"),style:[styles.actionBtn,e.isLevelCustom&&styles.actionBtnActive],testID:"buoy-console-filters-open",accessibilityLabel:"Filters",children:(0,_jsxRuntime.jsx)(_sharedUi.Filter,{size:14,color:e.isLevelCustom?_sharedUi.night.color.accent:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:e.clear,disabled:!t,style:[styles.actionBtn,!t&&styles.actionBtnDisabled],testID:"buoy-console-clear",accessibilityLabel:"Clear console",children:(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:14,color:t?_sharedUi.night.color.textSecondary:_sharedUi.night.color.textTertiary})})]})]})}const styles=_reactNative.StyleSheet.create({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}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleMessageRow=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _theme=require("./theme");var _consoleFormat=require("./consoleFormat");var _ConsoleValue=require("./ConsoleValue");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(o,e){if("function"==typeof WeakMap)var a=new WeakMap,g=new WeakMap;return(_interopRequireWildcard=function(r,n){if(!n&&r&&r.__esModule)return r;var i,d,l={__proto__:null,default:r};if(null===r||"object"!=typeof r&&"function"!=typeof r)return l;if(i=n?g:a){if(i.has(r))return i.get(r);i.set(r,l)}for(const s in r)"default"!==s&&{}.hasOwnProperty.call(r,s)&&((d=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(r,s))&&(d.get||d.set)?i(l,s,d):l[s]=r[s]);return l})(o,e)}function formatTimestamp(o){const e=new Date(o);const a=(g,r=2)=>String(g).padStart(r,"0");return`${a(e.getHours())}:${a(e.getMinutes())}:${a(e.getSeconds())}.${a(e.getMilliseconds(),3)}`}function LevelIcon({icon:o,color:e}){return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.levelIcon,{color:e}],children:o==="warning"?"\u26A0":"\u2298"})}function RepeatBadge({count:o,color:e}){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.repeatBadge,{borderColor:e}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.repeatBadgeText,{color:e}],children:o})})}const ConsoleMessageRow=exports.ConsoleMessageRow=(0,_react.memo)(function o({row:e,showTimestamps:a,onToggleGroup:g,onToggleCluster:r}){const{entry:n}=e;const i=_theme.levelStyles[n.level];const d=n.level==="error"||n.level==="warning";const l=i.text;const[s,x]=(0,_react.useState)(n.method==="trace");if(e.clusterHeader){const t=e.clusterHeader;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.wrapper,styles.dividerTop],activeOpacity:.7,onPress:()=>r(t.key),children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.originGutter,{color:e.originColor}],children:t.expanded?"\u25BC":"\u25B6"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.messageColumn,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.messageLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.text,styles.clusterTitle,{color:e.originColor}],children:e.originLabel}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.clusterCount,children:[" \xB7 ",t.count," logs"]})]})})]})})}const u=(0,_consoleFormat.formatConsoleMessage)(n.args);const p=Boolean(n.stack)&&(d||n.method==="trace");const T=(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.contentWrap,!s&&styles.contentWrapClamped],children:u.map((t,c)=>t.type==="string"?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.text,{color:l},e.isGroupHeader&&styles.groupTitle,t.style],children:t.value},c):(0,_jsxRuntime.jsx)(_ConsoleValue.ConsoleValue,{value:t.value,generic:t.mode==="generic"},c))});const b=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.messageColumn,children:[e.originLabel?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.originLabel,{color:e.originColor}],numberOfLines:1,children:e.originLabel}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.messageLine,children:[e.isGroupHeader?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.groupTriangle,{color:l}],children:e.groupCollapsed?"\u25B6":"\u25BC"}):null,i.icon?(0,_jsxRuntime.jsx)(LevelIcon,{icon:i.icon,color:l}):null,a?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.timestamp,children:formatTimestamp(n.timestamp)}):null,p?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.stackTriangle,{color:l}],children:s?"\u25BC":"\u25B6"}):null,T,e.repeatCount>1?(0,_jsxRuntime.jsx)(RepeatBadge,{count:e.repeatCount,color:l}):null]}),p&&s?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.stackTrace,children:(n.stack??"").split("\n").filter(t=>t.trim()).map((t,c)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.stackFrame,children:t.trim()},c))}):null]});const h=[styles.wrapper,i.background?{backgroundColor:i.background}:styles.dividerTop];const w=Array.from({length:e.depth},(t,c)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.nestingMarker},c));const C=e.lanes?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.laneGutter,children:e.lanes.map((t,c)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.laneCell,t.color?{color:t.color}:null],children:t.glyph},c))}):e.bracketGlyph?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.originGutter,{color:e.originColor}],children:e.bracketGlyph}):null;const m=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowWrapper,children:[C,w,b]});const f=`buoy-console-row-${n.id}`;const y=[e.originLabel,u.find(t=>t.type==="string")?.value].filter(Boolean).join(" \u2014 ").slice(0,80);if(e.isGroupHeader&&e.groupId!==void 0){const t=e.groupId;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:h,activeOpacity:.7,onPress:()=>g(t,Boolean(e.groupCollapsed)),testID:f,accessibilityLabel:y||"Console group",children:m})}return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:h,activeOpacity:.7,onPress:()=>x(t=>!t),testID:f,accessibilityLabel:y||"Console message",children:m})},(o,e)=>o.row.key===e.row.key&&o.row.lanes===e.row.lanes&&o.row.repeatCount===e.row.repeatCount&&o.row.groupCollapsed===e.row.groupCollapsed&&o.row.depth===e.row.depth&&o.row.bracketGlyph===e.row.bracketGlyph&&o.row.originLabel===e.row.originLabel&&o.row.clusterHeader?.count===e.row.clusterHeader?.count&&o.row.clusterHeader?.expanded===e.row.clusterHeader?.expanded&&o.showTimestamps===e.showTimestamps&&o.onToggleGroup===e.onToggleGroup&&o.onToggleCluster===e.onToggleCluster);const styles=_reactNative.StyleSheet.create({wrapper:{paddingVertical:2,paddingRight:8,minHeight:18},dividerTop:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_theme.consoleTheme.divider},rowWrapper:{flexDirection:"row",alignItems:"flex-start"},originGutter:{width:11,fontFamily:_theme.monoFont,fontSize:13,lineHeight:18,textAlign:"center"},laneGutter:{flexDirection:"row"},laneCell:{width:9,fontFamily:_theme.monoFont,fontSize:13,lineHeight:18,textAlign:"center"},originLabel:{fontFamily:_theme.monoFont,fontSize:10,lineHeight:16,marginBottom:1,opacity:.9},nestingMarker:{width:14,alignSelf:"stretch",borderRightWidth:_reactNative.StyleSheet.hairlineWidth,borderRightColor:_theme.consoleTheme.divider,marginLeft:2},messageColumn:{flex:1,flexDirection:"column",paddingLeft:6},messageLine:{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-start"},contentWrap:{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-start",flexShrink:1},contentWrapClamped:{flexWrap:"nowrap",overflow:"hidden",maxHeight:16},text:{fontFamily:_theme.monoFont,fontSize:12,lineHeight:16},groupTitle:{fontWeight:"bold"},clusterTitle:{fontWeight:"600"},clusterCount:{color:_theme.consoleTheme.tokenSubtle,fontFamily:_theme.monoFont,fontSize:12,lineHeight:16},groupTriangle:{fontSize:9,lineHeight:16,marginRight:4},stackTriangle:{fontSize:8,lineHeight:16,marginRight:4},levelIcon:{fontSize:12,lineHeight:16,marginRight:5},timestamp:{color:_theme.consoleTheme.tokenSubtle,fontFamily:_theme.monoFont,fontSize:11,lineHeight:16,marginRight:6},repeatBadge:{borderWidth:1,borderRadius:9,paddingHorizontal:5,minWidth:16,alignItems:"center",justifyContent:"center",marginLeft:6,marginTop:1},repeatBadgeText:{fontSize:10,fontWeight:"700",lineHeight:14},stackTrace:{marginTop:2,marginLeft:12},stackFrame:{color:_theme.consoleTheme.tokenSubtle,fontFamily:_theme.monoFont,fontSize:11,lineHeight:15}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleMessageRow=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _theme=require("./theme");var _consoleFormat=require("./consoleFormat");var _ConsoleValue=require("./ConsoleValue");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(o,e){if("function"==typeof WeakMap)var c=new WeakMap,g=new WeakMap;return(_interopRequireWildcard=function(n,r){if(!r&&n&&n.__esModule)return n;var l,u,i={__proto__:null,default:n};if(null===n||"object"!=typeof n&&"function"!=typeof n)return i;if(l=r?g:c){if(l.has(n))return l.get(n);l.set(n,i)}for(const s in n)"default"!==s&&{}.hasOwnProperty.call(n,s)&&((u=(l=Object.defineProperty)&&Object.getOwnPropertyDescriptor(n,s))&&(u.get||u.set)?l(i,s,u):i[s]=n[s]);return i})(o,e)}function formatTimestamp(o){const e=new Date(o);const c=(g,n=2)=>String(g).padStart(n,"0");return`${c(e.getHours())}:${c(e.getMinutes())}:${c(e.getSeconds())}.${c(e.getMilliseconds(),3)}`}function LevelIcon({icon:o,color:e}){return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.levelIcon,{color:e}],children:o==="warning"?"\u26A0":"\u2298"})}function RepeatBadge({count:o,color:e}){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.repeatBadge,{borderColor:e}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{testID:"buoy-console-repeat-count",style:[styles.repeatBadgeText,{color:e}],children:o})})}const ConsoleMessageRow=exports.ConsoleMessageRow=(0,_react.memo)(function o({row:e,showTimestamps:c,onToggleGroup:g,onToggleCluster:n}){const{entry:r}=e;const l=_theme.levelStyles[r.level];const u=r.level==="error"||r.level==="warning";const i=l.text;const[s,x]=(0,_react.useState)(r.method==="trace");if(e.clusterHeader){const t=e.clusterHeader;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{testID:`buoy-console-cluster-${e.originLabel}`,style:[styles.wrapper,styles.dividerTop],activeOpacity:.7,onPress:()=>n(t.key),children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.originGutter,{color:e.originColor}],children:t.expanded?"\u25BC":"\u25B6"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.messageColumn,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.messageLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.text,styles.clusterTitle,{color:e.originColor}],children:e.originLabel}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{testID:"buoy-console-cluster-count",style:styles.clusterCount,children:[" \xB7 ",t.count," logs"]})]})})]})})}const d=(0,_consoleFormat.formatConsoleMessage)(r.args);const p=Boolean(r.stack)&&(u||r.method==="trace");const b=(0,_jsxRuntime.jsx)(_reactNative.View,{testID:s?"buoy-console-content-expanded":"buoy-console-content-collapsed",style:[styles.contentWrap,!s&&styles.contentWrapClamped],children:d.map((t,a)=>t.type==="string"?(0,_jsxRuntime.jsx)(_reactNative.Text,{testID:`buoy-console-text-${a}`,style:[styles.text,{color:i},e.isGroupHeader&&styles.groupTitle,t.style],children:t.value},a):(0,_jsxRuntime.jsx)(_ConsoleValue.ConsoleValue,{testID:`buoy-console-value-${a}`,value:t.value,generic:t.mode==="generic"},a))});const T=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.messageColumn,children:[e.originLabel?(0,_jsxRuntime.jsx)(_reactNative.Text,{testID:"buoy-console-origin",style:[styles.originLabel,{color:e.originColor}],numberOfLines:1,children:e.originLabel}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.messageLine,children:[e.isGroupHeader?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.groupTriangle,{color:i}],children:e.groupCollapsed?"\u25B6":"\u25BC"}):null,l.icon?(0,_jsxRuntime.jsx)(LevelIcon,{icon:l.icon,color:i}):null,c?(0,_jsxRuntime.jsx)(_reactNative.Text,{testID:"buoy-console-timestamp",style:styles.timestamp,children:formatTimestamp(r.timestamp)}):null,p?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.stackTriangle,{color:i}],children:s?"\u25BC":"\u25B6"}):null,b,e.repeatCount>1?(0,_jsxRuntime.jsx)(RepeatBadge,{count:e.repeatCount,color:i}):null]}),p&&s?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:"buoy-console-stack",style:styles.stackTrace,children:(r.stack??"").split("\n").filter(t=>t.trim()).map((t,a)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.stackFrame,children:t.trim()},a))}):null]});const h=[styles.wrapper,l.background?{backgroundColor:l.background}:styles.dividerTop];const C=Array.from({length:e.depth},(t,a)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.nestingMarker},a));const j=e.lanes?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.laneGutter,children:e.lanes.map((t,a)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.laneCell,t.color?{color:t.color}:null],children:t.glyph},a))}):e.bracketGlyph?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.originGutter,{color:e.originColor}],children:e.bracketGlyph}):null;const m=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowWrapper,children:[j,C,T]});const y=`buoy-console-row-${String(r.args[0])}`;const f=[e.originLabel,d.find(t=>t.type==="string")?.value].filter(Boolean).join(" \u2014 ").slice(0,80);if(e.isGroupHeader&&e.groupId!==void 0){const t=e.groupId;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:h,activeOpacity:.7,onPress:()=>g(t,Boolean(e.groupCollapsed)),testID:y,accessibilityLabel:f||"Console group",children:m})}return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:h,activeOpacity:.7,onPress:()=>x(t=>!t),testID:y,accessibilityLabel:f||"Console message",children:m})},(o,e)=>o.row.key===e.row.key&&o.row.lanes===e.row.lanes&&o.row.repeatCount===e.row.repeatCount&&o.row.groupCollapsed===e.row.groupCollapsed&&o.row.depth===e.row.depth&&o.row.bracketGlyph===e.row.bracketGlyph&&o.row.originLabel===e.row.originLabel&&o.row.clusterHeader?.count===e.row.clusterHeader?.count&&o.row.clusterHeader?.expanded===e.row.clusterHeader?.expanded&&o.showTimestamps===e.showTimestamps&&o.onToggleGroup===e.onToggleGroup&&o.onToggleCluster===e.onToggleCluster);const styles=_reactNative.StyleSheet.create({wrapper:{paddingVertical:2,paddingRight:8,minHeight:18},dividerTop:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_theme.consoleTheme.divider},rowWrapper:{flexDirection:"row",alignItems:"flex-start"},originGutter:{width:11,fontFamily:_theme.monoFont,fontSize:13,lineHeight:18,textAlign:"center"},laneGutter:{flexDirection:"row"},laneCell:{width:9,fontFamily:_theme.monoFont,fontSize:13,lineHeight:18,textAlign:"center"},originLabel:{fontFamily:_theme.monoFont,fontSize:10,lineHeight:16,marginBottom:1,opacity:.9},nestingMarker:{width:14,alignSelf:"stretch",borderRightWidth:_reactNative.StyleSheet.hairlineWidth,borderRightColor:_theme.consoleTheme.divider,marginLeft:2},messageColumn:{flex:1,flexDirection:"column",paddingLeft:6},messageLine:{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-start"},contentWrap:{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-start",flexShrink:1},contentWrapClamped:{flexWrap:"nowrap",overflow:"hidden",maxHeight:16},text:{fontFamily:_theme.monoFont,fontSize:12,lineHeight:16},groupTitle:{fontWeight:"bold"},clusterTitle:{fontWeight:"600"},clusterCount:{color:_theme.consoleTheme.tokenSubtle,fontFamily:_theme.monoFont,fontSize:12,lineHeight:16},groupTriangle:{fontSize:9,lineHeight:16,marginRight:4},stackTriangle:{fontSize:8,lineHeight:16,marginRight:4},levelIcon:{fontSize:12,lineHeight:16,marginRight:5},timestamp:{color:_theme.consoleTheme.tokenSubtle,fontFamily:_theme.monoFont,fontSize:11,lineHeight:16,marginRight:6},repeatBadge:{borderWidth:1,borderRadius:9,paddingHorizontal:5,minWidth:16,alignItems:"center",justifyContent:"center",marginLeft:6,marginTop:1},repeatBadgeText:{fontSize:10,fontWeight:"700",lineHeight:14},stackTrace:{marginTop:2,marginLeft:12},stackFrame:{color:_theme.consoleTheme.tokenSubtle,fontFamily:_theme.monoFont,fontSize:11,lineHeight:15}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleValue=ConsoleValue;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _theme=require("./theme");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,r){if("function"==typeof WeakMap)var o=new WeakMap,a=new WeakMap;return(_interopRequireWildcard=function(t,c){if(!c&&t&&t.__esModule)return t;var s,n,i={__proto__:null,default:t};if(null===t||"object"!=typeof t&&"function"!=typeof t)return i;if(s=c?a:o){if(s.has(t))return s.get(t);s.set(t,i)}for(const l in t)"default"!==l&&{}.hasOwnProperty.call(t,l)&&((n=(s=Object.defineProperty)&&Object.getOwnPropertyDescriptor(t,l))&&(n.get||n.set)?s(i,l,n):i[l]=t[l]);return i})(e,r)}const MAX_PREVIEW_PROPERTIES=5;const MAX_PREVIEW_ARRAY=6;function kindOf(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(e instanceof Error)return"error";const r=typeof e;if(r==="number")return"number";if(r==="bigint")return"bigint";if(r==="boolean")return"boolean";if(r==="string")return"string";if(r==="function")return"function";if(r==="symbol")return"symbol";return"object"}const KIND_COLOR={number:_theme.consoleTheme.valueNumber,bigint:_theme.consoleTheme.valueBigint,boolean:_theme.consoleTheme.valueNumber,string:_theme.consoleTheme.valueString,null:_theme.consoleTheme.valueNullish,undefined:_theme.consoleTheme.valueNullish,symbol:_theme.consoleTheme.valueString,function:_theme.consoleTheme.valueNode};function constructorName(e){if(Array.isArray(e))return"";const r=Object.getPrototypeOf(e);if(!r)return"Object";const o=r.constructor?.name;return!o||o==="Object"?"":o}function scalarText(e){const r=kindOf(e);switch(r){case"string":return`'${e}'`;case"function":{const o=e.name;return`\u0192 ${o||""}`.trimEnd()}case"symbol":return e.toString();case"bigint":return`${String(e)}n`;case"array":return`Array(${e.length})`;case"error":return e.name;case"object":{const o=constructorName(e);return o?`${o} {\u2026}`:"{\u2026}"}default:return String(e)}}function buildPreview(e){if(Array.isArray(e)){const s=e.slice(0,MAX_PREVIEW_ARRAY).map(i=>scalarText(i)).join(", ");const n=e.length>MAX_PREVIEW_ARRAY?", \u2026":"";return`(${e.length}) [${s}${n}]`}const r=Object.entries(e);const o=r.slice(0,MAX_PREVIEW_PROPERTIES).map(([s,n])=>`${s}: ${scalarText(n)}`).join(", ");const a=r.length>MAX_PREVIEW_PROPERTIES?", \u2026":"";const t=constructorName(e);const c=t?`${t} `:"";return`${c}{${o}${a}}`}function isExpandable(e){const r=kindOf(e);if(r==="array")return e.length>0;if(r==="object")return Object.keys(e).length>0;if(r==="error")return true;return false}const Triangle=({open:e})=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.triangle,e&&styles.triangleOpen],children:"\u25B6"});function ConsoleValue({value:e,depth:r=0}){const[o,a]=(0,_react.useState)(false);const t=kindOf(e);if(t==="error"){const n=e;const i=`${n.name}: ${n.message}`.split("\n")[0];const l=n.stack&&n.stack.trim()!==i.trim()?n.stack:void 0;if(!l){return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.mono,{color:_theme.consoleTheme.onErrorContainer}],numberOfLines:1,children:i})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.objectContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.objectHeader,activeOpacity:.6,onPress:()=>a(u=>!u),children:[(0,_jsxRuntime.jsx)(Triangle,{open:o}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.mono,styles.errorHead],numberOfLines:o?void 0:1,children:i})]}),o?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.mono,styles.errorStack],children:l}):null]})}if(!isExpandable(e)){const n=KIND_COLOR[t]??_theme.consoleTheme.onSurface;return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.mono,{color:n}],children:scalarText(e)})}const c=e;const s=Array.isArray(c)?c.map((n,i)=>[String(i),n]):Object.entries(c);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.objectContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{onPress:()=>a(n=>!n),activeOpacity:.6,style:styles.objectHeader,children:[(0,_jsxRuntime.jsx)(Triangle,{open:o}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.mono,styles.preview],numberOfLines:o?void 0:1,children:buildPreview(c)})]}),o&&r<6?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.children,children:s.map(([n,i])=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.propertyRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[styles.mono,styles.propertyKey],children:[n,":"]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.propertyValue,children:(0,_jsxRuntime.jsx)(ConsoleValue,{value:i,depth:r+1})})]},n))}):null]})}const monoStyle={fontFamily:_theme.monoFont,fontSize:12,lineHeight:16};const styles=_reactNative.StyleSheet.create({mono:monoStyle,objectContainer:{flexDirection:"column"},objectHeader:{flexDirection:"row",alignItems:"flex-start"},triangle:{color:_theme.consoleTheme.tokenSubtle,fontSize:8,lineHeight:16,width:12},triangleOpen:{transform:[{rotate:"90deg"}]},preview:{color:_theme.consoleTheme.valuePreview,fontStyle:"italic",flexShrink:1},errorHead:{color:_theme.consoleTheme.onErrorContainer,flexShrink:1},errorStack:{color:_theme.consoleTheme.tokenSubtle,marginLeft:14,marginTop:1},children:{marginLeft:14,flexDirection:"column"},propertyRow:{flexDirection:"row",alignItems:"flex-start"},propertyKey:{color:_theme.consoleTheme.valueNode,marginRight:6},propertyValue:{flexShrink:1}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleValue=ConsoleValue;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _theme=require("./theme");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,r){if("function"==typeof WeakMap)var t=new WeakMap,c=new WeakMap;return(_interopRequireWildcard=function(o,a){if(!a&&o&&o.__esModule)return o;var i,l,n={__proto__:null,default:o};if(null===o||"object"!=typeof o&&"function"!=typeof o)return n;if(i=a?c:t){if(i.has(o))return i.get(o);i.set(o,n)}for(const s in o)"default"!==s&&{}.hasOwnProperty.call(o,s)&&((l=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(o,s))&&(l.get||l.set)?i(n,s,l):n[s]=o[s]);return n})(e,r)}const MAX_PREVIEW_PROPERTIES=5;const MAX_PREVIEW_ARRAY=6;function kindOf(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(e instanceof Error)return"error";const r=typeof e;if(r==="number")return"number";if(r==="bigint")return"bigint";if(r==="boolean")return"boolean";if(r==="string")return"string";if(r==="function")return"function";if(r==="symbol")return"symbol";return"object"}const KIND_COLOR={number:_theme.consoleTheme.valueNumber,bigint:_theme.consoleTheme.valueBigint,boolean:_theme.consoleTheme.valueNumber,string:_theme.consoleTheme.valueString,null:_theme.consoleTheme.valueNullish,undefined:_theme.consoleTheme.valueNullish,symbol:_theme.consoleTheme.valueString,function:_theme.consoleTheme.valueNode};function constructorName(e){if(Array.isArray(e))return"";const r=Object.getPrototypeOf(e);if(!r)return"Object";const t=r.constructor?.name;return!t||t==="Object"?"":t}function scalarText(e){const r=kindOf(e);switch(r){case"string":return`'${e}'`;case"function":{const t=e.name;return`\u0192 ${t||""}`.trimEnd()}case"symbol":return e.toString();case"bigint":return`${String(e)}n`;case"array":return`Array(${e.length})`;case"error":return e.name;case"object":{const t=constructorName(e);return t?`${t} {\u2026}`:"{\u2026}"}default:return String(e)}}function buildPreview(e){if(Array.isArray(e)){const i=e.slice(0,MAX_PREVIEW_ARRAY).map(n=>scalarText(n)).join(", ");const l=e.length>MAX_PREVIEW_ARRAY?", \u2026":"";return`(${e.length}) [${i}${l}]`}const r=Object.entries(e);const t=r.slice(0,MAX_PREVIEW_PROPERTIES).map(([i,l])=>`${i}: ${scalarText(l)}`).join(", ");const c=r.length>MAX_PREVIEW_PROPERTIES?", \u2026":"";const o=constructorName(e);const a=o?`${o} `:"";return`${a}{${t}${c}}`}function isExpandable(e){const r=kindOf(e);if(r==="array")return e.length>0;if(r==="object")return Object.keys(e).length>0;if(r==="error")return true;return false}const Triangle=({open:e})=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.triangle,e&&styles.triangleOpen],children:"\u25B6"});function ConsoleValue({value:e,depth:r=0,testID:t}){const[c,o]=(0,_react.useState)(false);const a=kindOf(e);if(a==="error"){const n=e;const s=`${n.name}: ${n.message}`.split("\n")[0];const u=n.stack&&n.stack.trim()!==s.trim()?n.stack:void 0;if(!u){return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.mono,{color:_theme.consoleTheme.onErrorContainer}],numberOfLines:1,children:s})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.objectContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{testID:t,style:styles.objectHeader,activeOpacity:.6,onPress:()=>o(f=>!f),children:[(0,_jsxRuntime.jsx)(Triangle,{open:c}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.mono,styles.errorHead],numberOfLines:c?void 0:1,children:s})]}),c?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.mono,styles.errorStack],children:u}):null]})}if(!isExpandable(e)){const n=KIND_COLOR[a]??_theme.consoleTheme.onSurface;return(0,_jsxRuntime.jsx)(_reactNative.Text,{testID:t,style:[styles.mono,{color:n}],children:scalarText(e)})}const i=e;const l=Array.isArray(i)?i.map((n,s)=>[String(s),n]):Object.entries(i);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.objectContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{testID:t,onPress:()=>o(n=>!n),activeOpacity:.6,style:styles.objectHeader,children:[(0,_jsxRuntime.jsx)(Triangle,{open:c}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.mono,styles.preview],numberOfLines:c?void 0:1,children:buildPreview(i)})]}),c&&r<6?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:t?`${t}-children`:void 0,style:styles.children,children:l.map(([n,s])=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.propertyRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[styles.mono,styles.propertyKey],children:[n,":"]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.propertyValue,children:(0,_jsxRuntime.jsx)(ConsoleValue,{testID:t?`${t}-${n}`:void 0,value:s,depth:r+1})})]},n))}):null]})}const monoStyle={fontFamily:_theme.monoFont,fontSize:12,lineHeight:16};const styles=_reactNative.StyleSheet.create({mono:monoStyle,objectContainer:{flexDirection:"column"},objectHeader:{flexDirection:"row",alignItems:"flex-start"},triangle:{color:_theme.consoleTheme.tokenSubtle,fontSize:8,lineHeight:16,width:12},triangleOpen:{transform:[{rotate:"90deg"}]},preview:{color:_theme.consoleTheme.valuePreview,fontStyle:"italic",flexShrink:1},errorHead:{color:_theme.consoleTheme.onErrorContainer,flexShrink:1},errorStack:{color:_theme.consoleTheme.tokenSubtle,marginLeft:14,marginTop:1},children:{marginLeft:14,flexDirection:"column"},propertyRow:{flexDirection:"row",alignItems:"flex-start"},propertyKey:{color:_theme.consoleTheme.valueNode,marginRight:6},propertyValue:{flexShrink:1}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.bracketGlyph=bracketGlyph;exports.colorForKey=colorForKey;exports.parseOrigin=parseOrigin;exports.sourceKey=sourceKey;exports.sourceLabel=sourceLabel;const INTERNAL_FUNC=/^(buoyConsoleProxy|record|cleanStack|captureOwnerStack|formatArgs|formatArg)$/;const INTERNAL_FILE=/consoleLogStore/;function bareName(n){return n.replace(/\s+\[as [^\]]+\]$/,"").replace(/^(?:async\s+)?(?:new\s+)?(?:Object|console)\./,"").trim()}function isInternalFrame(n){if(n.func&&INTERNAL_FUNC.test(bareName(n.func))){return true}return Boolean(n.file&&INTERNAL_FILE.test(n.file))}function parseFrames(n){const e=[];for(const u of n.split("\n")){const r=u.trim();if(!r||r==="Error")continue;let t=r.match(/^at\s+(.+?)\s+\((.+?):(\d+):(\d+)\)$/);if(t){e.push({func:t[1],file:t[2],line:Number(t[3])});continue}t=r.match(/^at\s+(.+?):(\d+):(\d+)$/);if(t){e.push({file:t[1],line:Number(t[2])});continue}t=r.match(/^(.*?)@(.+?):(\d+):(\d+)$/);if(t){e.push({func:t[1]||void 0,file:t[2],line:Number(t[3])});continue}}return e}function basename(n){if(!n)return void 0;const e=n.split("?")[0];return e.split("/").pop()||e}function cleanFunctionName(n){if(!n)return void 0;const e=bareName(n);if(!e||e==="<anonymous>"||e==="anonymous")return void 0;return e}function firstComponent(n){if(!n)return void 0;for(const e of n.split("\n")){const u=e.trim().match(/^at\s+([A-Za-z_$][\w$]*)/);if(u)return u[1]}return void 0}function parseOrigin(n,e){const u=firstComponent(e);let r;if(n){const a=parseFrames(n);r=a.find(s=>!isInternalFrame(s))}const t=cleanFunctionName(r?.func);const o=basename(r?.file);const c=r?.line;const f=o&&c!=null?`${o}:${c}`:void 0;if(!u&&!t&&!f)return void 0;return{component:u,functionName:t,callSite:f,file:o,line:c}}function sourceKey(n,e){if(e==="off"||!n)return e==="off"?null:"\u2014unknown\u2014";if(e==="component"){return n.component??n.functionName??n.callSite??"\u2014unknown\u2014"}if(e==="function"){return n.functionName??n.callSite??n.component??"\u2014anonymous\u2014"}return n.callSite??n.functionName??"\u2014unknown\u2014"}function sourceLabel(n,e){if(!n)return"(unknown)";if(e==="component"){if(n.component)return n.component;if(n.functionName)return`\u0192 ${n.functionName}`;return n.callSite??"(unknown)"}if(e==="function"){if(n.functionName)return n.functionName;return n.callSite??"(anonymous)"}if(e==="callsite"){if(n.functionName&&n.callSite)return`${n.functionName} \xB7 ${n.callSite}`;return n.callSite??(n.functionName?`\u0192 ${n.functionName}`:"(unknown)")}return""}function hashString(n){let e=0;for(let u=0;u<n.length;u++)e=e*31+n.charCodeAt(u)|0;return Math.abs(e)}function colorForKey(n){const e=hashString(n)%360;return`hsl(${e}, 70%, 66%)`}function bracketGlyph(n){switch(n){case"top":return"\u250C";case"bottom":return"\u2514";case"single":return"\u2500";default:return"\u2502"}}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.bracketGlyph=bracketGlyph;exports.colorForKey=colorForKey;exports.consoleWrapperDepth=consoleWrapperDepth;exports.parseOrigin=parseOrigin;exports.sourceKey=sourceKey;exports.sourceLabel=sourceLabel;const INTERNAL_FUNC=/^(buoyConsoleProxy|record|cleanStack|captureOwnerStack|formatArgs|formatArg)$/;const INTERNAL_FILE=/consoleLogStore/;function bareName(n){return n.replace(/\s+\[as [^\]]+\]$/,"").replace(/^(?:async\s+)?(?:new\s+)?(?:Object|console)\./,"").trim()}function isInternalFrame(n){if(n.func&&INTERNAL_FUNC.test(bareName(n.func))){return true}return Boolean(n.file&&INTERNAL_FILE.test(n.file))}function parseFrames(n){const e=[];for(const o of n.split("\n")){const u=o.trim();if(!u||u==="Error")continue;let t=u.match(/^at\s+(.+?)\s+\((.+?):(\d+):(\d+)\)$/);if(t){e.push({func:t[1],file:t[2],line:Number(t[3])});continue}t=u.match(/^at\s+(.+?):(\d+):(\d+)$/);if(t){e.push({file:t[1],line:Number(t[2])});continue}t=u.match(/^(.*?)@(.+?):(\d+):(\d+)$/);if(t){e.push({func:t[1]||void 0,file:t[2],line:Number(t[3])});continue}}return e}function basename(n){if(!n)return void 0;const e=n.split(/\?|\/\/&/)[0];return e.split("/").pop()||e}function cleanFunctionName(n){if(!n)return void 0;const e=bareName(n);if(!e||e==="<anonymous>"||e==="anonymous")return void 0;return e}function firstComponent(n){if(!n)return void 0;for(const e of n.split("\n")){const o=e.trim().match(/^at\s+([A-Za-z_$][\w$]*)/);if(o)return o[1]}return void 0}function consoleWrapperDepth(n,e){const o=new Set;let u=0;while(typeof n==="function"&&n!==e&&!o.has(n)){o.add(n);try{n=Reflect.get(n,"__sentry_original__")}catch{return 0}u+=1}return n===e?u:0}function parseOrigin(n,e,o=0){const u=firstComponent(e);let t;if(n){const a=parseFrames(n);const l=a.filter(i=>!isInternalFrame(i));t=l[o]}const f=cleanFunctionName(t?.func);const r=basename(t?.file);const c=t?.line;const s=r&&c!=null?`${r}:${c}`:void 0;if(!u&&!f&&!s)return void 0;return{component:u,functionName:f,callSite:s,file:r,line:c}}function sourceKey(n,e){if(e==="off"||!n)return e==="off"?null:"\u2014unknown\u2014";if(e==="component"){return n.component??n.functionName??n.callSite??"\u2014unknown\u2014"}if(e==="function"){return n.functionName??n.callSite??n.component??"\u2014anonymous\u2014"}return n.callSite??n.functionName??"\u2014unknown\u2014"}function sourceLabel(n,e){if(!n)return"(unknown)";if(e==="component"){if(n.component)return n.component;if(n.functionName)return`\u0192 ${n.functionName}`;return n.callSite??"(unknown)"}if(e==="function"){if(n.functionName)return n.functionName;return n.callSite??"(anonymous)"}if(e==="callsite"){if(n.functionName&&n.callSite)return`${n.functionName} \xB7 ${n.callSite}`;return n.callSite??(n.functionName?`\u0192 ${n.functionName}`:"(unknown)")}return""}function hashString(n){let e=0;for(let o=0;o<n.length;o++)e=e*31+n.charCodeAt(o)|0;return Math.abs(e)}function colorForKey(n){const e=hashString(n)%360;return`hsl(${e}, 70%, 66%)`}function bracketGlyph(n){switch(n){case"top":return"\u250C";case"bottom":return"\u2514";case"single":return"\u2500";default:return"\u2502"}}
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.clearEntries=clearEntries;exports.getEntries=getEntries;exports.getPreserveLog=getPreserveLog;exports.initConsolePersistence=initConsolePersistence;exports.installConsoleCapture=installConsoleCapture;exports.installFatalErrorCapture=installFatalErrorCapture;exports.onClear=onClear;exports.replaceEntries=replaceEntries;exports.setPreserveLog=setPreserveLog;exports.subscribe=subscribe;exports.subscribePreserveLog=subscribePreserveLog;exports.uninstallConsoleCapture=uninstallConsoleCapture;var _sharedUi=require("@buoy-gg/shared-ui");var React=_interopRequireWildcard(require("react"));var _sanitize=require("./sanitize");var _origin=require("../devtools/origin");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(_interopRequireWildcard=function(r,s){if(!s&&r&&r.__esModule)return r;var i,a,l={__proto__:null,default:r};if(null===r||"object"!=typeof r&&"function"!=typeof r)return l;if(i=s?o:n){if(i.has(r))return i.get(r);i.set(r,l)}for(const c in r)"default"!==c&&{}.hasOwnProperty.call(r,c)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(r,c))&&(a.get||a.set)?i(l,c,a):l[c]=r[c]);return l})(e,t)}const METHODS=["log","info","warn","error","debug","trace","dir","table","assert","group","groupCollapsed","groupEnd"];const STACK_METHODS=new Set(["error","warn","trace","assert"]);const METHOD_LEVEL={error:"error",assert:"error",warn:"warning",debug:"verbose",log:"info",info:"info",trace:"info",dir:"info",table:"info",group:"info",groupCollapsed:"info",groupEnd:"info"};const MAX_ENTRIES=1e3;const store=(0,_sharedUi.createToolStore)({id:"console",max:MAX_ENTRIES,order:"append",coalesce:"frame"});let installed=false;let fatalInstalled=false;let captureDisabledByUser=false;const originals={};function formatArg(e){if(typeof e==="string")return e;if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e==="function")return`\u0192 ${e.name||"(anonymous)"}`;try{return JSON.stringify(e)}catch{return String(e)}}function formatArgs(e){return e.map(formatArg).join(" ")}function cleanStack(e){if(!e)return void 0;return e.split("\n").slice(3).join("\n")||void 0}function captureOwnerStack(){try{const e=Reflect.get(React,"captureOwnerStack");return typeof e==="function"?e()??void 0:void 0}catch{return void 0}}const COMPONENT_STACK_FRAMES=8;function compactComponentStack(e){const t=e.split("\n").map(r=>r.trim()).filter(Boolean).map(r=>r.replace(/\s*\((?:https?:|\/).*$/,""));const n=t.slice(0,COMPONENT_STACK_FRAMES);const o=t.length-n.length;return n.map(r=>` ${r}`).join("\n")+(o>0?`
2
- \u2026+${o} more frames`:"")}function asComponentError(e){if(!(e instanceof Error))return null;const t=e;return t.isComponentError||typeof t.componentStack==="string"?t:null}function record(e,t){const n=new Error().stack;const o=(0,_origin.parseOrigin)(n,captureOwnerStack());const r=e==="error"?asComponentError(t[0]):null;if(r){const i=fatalKey(r.name,r.message);const a=r.componentStack?`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.clearEntries=clearEntries;exports.getEntries=getEntries;exports.getPreserveLog=getPreserveLog;exports.initConsolePersistence=initConsolePersistence;exports.installConsoleCapture=installConsoleCapture;exports.installFatalErrorCapture=installFatalErrorCapture;exports.onClear=onClear;exports.replaceEntries=replaceEntries;exports.setPreserveLog=setPreserveLog;exports.subscribe=subscribe;exports.subscribePreserveLog=subscribePreserveLog;exports.uninstallConsoleCapture=uninstallConsoleCapture;var _sharedUi=require("@buoy-gg/shared-ui");var React=_interopRequireWildcard(require("react"));var _sanitize=require("./sanitize");var _origin=require("../devtools/origin");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(_interopRequireWildcard=function(r,s){if(!s&&r&&r.__esModule)return r;var i,a,c={__proto__:null,default:r};if(null===r||"object"!=typeof r&&"function"!=typeof r)return c;if(i=s?o:n){if(i.has(r))return i.get(r);i.set(r,c)}for(const l in r)"default"!==l&&{}.hasOwnProperty.call(r,l)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(r,l))&&(a.get||a.set)?i(c,l,a):c[l]=r[l]);return c})(e,t)}const METHODS=["log","info","warn","error","debug","trace","dir","table","assert","group","groupCollapsed","groupEnd"];const STACK_METHODS=new Set(["error","warn","trace","assert"]);const METHOD_LEVEL={error:"error",assert:"error",warn:"warning",debug:"verbose",log:"info",info:"info",trace:"info",dir:"info",table:"info",group:"info",groupCollapsed:"info",groupEnd:"info"};const MAX_ENTRIES=1e3;const store=(0,_sharedUi.createToolStore)({id:"console",max:MAX_ENTRIES,order:"append",coalesce:"frame"});let installed=false;let fatalInstalled=false;let captureDisabledByUser=false;const originals={};function formatArg(e){if(typeof e==="string")return e;if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e==="function")return`\u0192 ${e.name||"(anonymous)"}`;try{return JSON.stringify(e)}catch{return String(e)}}function formatArgs(e){return e.map(formatArg).join(" ")}function cleanStack(e){if(!e)return void 0;return e.split("\n").slice(3).join("\n")||void 0}function captureOwnerStack(){try{const e=Reflect.get(React,"captureOwnerStack");return typeof e==="function"?e()??void 0:void 0}catch{return void 0}}const COMPONENT_STACK_FRAMES=8;function compactComponentStack(e){const t=e.split("\n").map(r=>r.trim()).filter(Boolean).map(r=>r.replace(/\s*\((?:https?:|\/).*$/,""));const n=t.slice(0,COMPONENT_STACK_FRAMES);const o=t.length-n.length;return n.map(r=>` ${r}`).join("\n")+(o>0?`
2
+ \u2026+${o} more frames`:"")}function asComponentError(e){if(!(e instanceof Error))return null;const t=e;return t.isComponentError||typeof t.componentStack==="string"?t:null}function record(e,t,n){if((0,_sharedUi.isBuoyLog)(t))return;const o=new Error().stack;const r=(0,_origin.parseOrigin)(o,captureOwnerStack(),(0,_origin.consoleWrapperDepth)(console[e],n));const s=e==="error"?asComponentError(t[0]):null;if(s){const a=fatalKey(s.name,s.message);const c=s.componentStack?`
3
3
 
4
4
  This error is located at:
5
- ${compactComponentStack(r.componentStack)}`:"";pushFatal({id:store.allocId(),method:"error",level:"error",args:["[RENDER ERROR]",r],message:`[RENDER ERROR] ${i}${a}`,timestamp:Date.now(),stack:r.stack,origin:o},isDuplicateFatal(`[RENDER ERROR] ${i}`));return}const s={id:store.allocId(),method:e,level:METHOD_LEVEL[e],args:t,message:formatArgs(t),timestamp:Date.now(),stack:STACK_METHODS.has(e)?cleanStack(n):void 0,origin:o};store.add(s);scheduleSave();if(s.level==="error")store.flushSync()}const FATAL_DEDUPE_MS=2e3;let lastFatalKey="";let lastFatalAt=0;function fatalKey(e,t){const n=t.trim();if(e&&n.startsWith(`${e}: `))return n;return e?`${e}: ${n}`:n}function isDuplicateFatal(e){const t=Date.now();if(e===lastFatalKey&&t-lastFatalAt<FATAL_DEDUPE_MS)return true;lastFatalKey=e;lastFatalAt=t;return false}function pushFatal(e,t=false){store.add(e);scheduleSave();if(!t)store.flushSync(true)}function recordFatalError(e,t){const n=e instanceof Error?e:void 0;const o=t===false?"[UNCAUGHT]":"[FATAL]";const r=n?fatalKey(n.name,n.message):formatArg(e);const s=isDuplicateFatal(`${o} ${r}`);pushFatal({id:store.allocId(),method:"error",level:"error",args:[o,e],message:`${o} ${r}`,timestamp:Date.now(),stack:n?.stack,fatal:true},s)}function formatNativeStack(e){const t=e.extraData?.rawStack;if(typeof t==="string"&&t.length>0)return t;if(!Array.isArray(e.stack)||e.stack.length===0)return void 0;return e.stack.map(n=>{const o=n.lineNumber!=null?`${n.file??"?"}:${n.lineNumber}:${n.column??0}`:n.file??"?";return` at ${n.methodName||"<anonymous>"} (${o})`}).join("\n")}function recordNativeException(e){const t=e.isFatal===false?"[UNCAUGHT]":"[FATAL]";const n=fatalKey(e.name??void 0,e.originalMessage??e.message??"Unknown error");const o=isDuplicateFatal(`${t} ${n}`);const r=typeof e.componentStack==="string"&&e.componentStack.trim()?`
5
+ ${compactComponentStack(s.componentStack)}`:"";pushFatal({id:store.allocId(),method:"error",level:"error",args:["[RENDER ERROR]",s],message:`[RENDER ERROR] ${a}${c}`,timestamp:Date.now(),stack:s.stack,origin:r},isDuplicateFatal(`[RENDER ERROR] ${a}`));return}const i={id:store.allocId(),method:e,level:METHOD_LEVEL[e],args:t,message:formatArgs(t),timestamp:Date.now(),stack:STACK_METHODS.has(e)?cleanStack(o):void 0,origin:r};store.add(i);scheduleSave();if(i.level==="error")store.flushSync()}const FATAL_DEDUPE_MS=2e3;let lastFatalKey="";let lastFatalAt=0;function fatalKey(e,t){const n=t.trim();if(e&&n.startsWith(`${e}: `))return n;return e?`${e}: ${n}`:n}function isDuplicateFatal(e){const t=Date.now();if(e===lastFatalKey&&t-lastFatalAt<FATAL_DEDUPE_MS)return true;lastFatalKey=e;lastFatalAt=t;return false}function pushFatal(e,t=false){store.add(e);scheduleSave();if(!t)store.flushSync(true)}function recordFatalError(e,t){const n=e instanceof Error?e:void 0;const o=t===false?"[UNCAUGHT]":"[FATAL]";const r=n?fatalKey(n.name,n.message):formatArg(e);const s=isDuplicateFatal(`${o} ${r}`);pushFatal({id:store.allocId(),method:"error",level:"error",args:[o,e],message:`${o} ${r}`,timestamp:Date.now(),stack:n?.stack,fatal:true},s)}function formatNativeStack(e){const t=e.extraData?.rawStack;if(typeof t==="string"&&t.length>0)return t;if(!Array.isArray(e.stack)||e.stack.length===0)return void 0;return e.stack.map(n=>{const o=n.lineNumber!=null?`${n.file??"?"}:${n.lineNumber}:${n.column??0}`:n.file??"?";return` at ${n.methodName||"<anonymous>"} (${o})`}).join("\n")}function recordNativeException(e){const t=e.isFatal===false?"[UNCAUGHT]":"[FATAL]";const n=fatalKey(e.name??void 0,e.originalMessage??e.message??"Unknown error");const o=isDuplicateFatal(`${t} ${n}`);const r=typeof e.componentStack==="string"&&e.componentStack.trim()?`
6
6
 
7
7
  This error is located at:
8
- ${compactComponentStack(e.componentStack)}`:"";const s=`${t} ${n}${r}`;pushFatal({id:store.allocId(),method:"error",level:"error",args:[t,n,...r?[r.trim()]:[]],message:s,timestamp:Date.now(),stack:formatNativeStack(e),fatal:true},o)}function installNativeExceptionCapture(){const e=globalThis.RN$registerExceptionListener;if(typeof e!=="function")return false;e(t=>{try{if(!captureDisabledByUser)recordNativeException(t)}catch{}});return true}function installFatalErrorCapture(){if(fatalInstalled)return;const e=installNativeExceptionCapture();const t=globalThis.ErrorUtils;if(typeof t?.setGlobalHandler!=="function"){fatalInstalled=e;return}fatalInstalled=true;const n=typeof t.getGlobalHandler==="function"?t.getGlobalHandler():void 0;t.setGlobalHandler((o,r)=>{try{if(!captureDisabledByUser)recordFatalError(o,r)}catch{}if(typeof n==="function")n(o,r)})}function installConsoleCapture(){if((0,_sharedUi.getAccountAccess)().status==="locked")return;captureDisabledByUser=false;installFatalErrorCapture();if(installed)return;installed=true;for(const e of METHODS){const t=console[e];if(typeof t!=="function")continue;originals[e]=t;console[e]=function n(...o){record(e,o);t.apply(console,o)}}}function uninstallConsoleCapture(){captureDisabledByUser=true;if(!installed)return;installed=false;for(const e of METHODS){const t=originals[e];if(t)console[e]=t;delete originals[e]}}function subscribe(e){return store.subscribe(e)}function getEntries(){return store.getSnapshot()}function clearEntries(){void clearSavedBuffer();store.clear()}function replaceEntries(e){store.set(e)}function onClear(e){return store.onClear(e)}const PRESERVE_KEY="@react_buoy_console_preserve";const BUFFER_KEY="@react_buoy_console_buffer";const SAVE_DEBOUNCE_MS=600;let preserveLog=false;let persistenceReady=false;let persistenceGeneration=0;let bufferWrites=Promise.resolve();const preserveListeners=new Set;let saveTimer=null;function emitPreserve(){for(const e of preserveListeners)e()}function scheduleSave(){if(!preserveLog||!(0,_sharedUi.hasAccountAccess)())return;if(saveTimer)clearTimeout(saveTimer);saveTimer=setTimeout(saveBuffer,SAVE_DEBOUNCE_MS)}async function saveBuffer(){saveTimer=null;if(!preserveLog||!(0,_sharedUi.hasAccountAccess)())return;try{const e=store.getSnapshot().map(n=>({...n,args:(0,_sanitize.sanitizeArgs)(n.args)}));const t=persistenceGeneration;bufferWrites=bufferWrites.then(async()=>{if(t!==persistenceGeneration||!preserveLog||!(0,_sharedUi.hasAccountAccess)())return;await _sharedUi.persistentStorage.setItem(BUFFER_KEY,JSON.stringify(e))}).catch(()=>{});await bufferWrites}catch{}}async function clearSavedBuffer(){persistenceGeneration++;persistenceReady=false;try{bufferWrites=bufferWrites.then(()=>_sharedUi.persistentStorage.removeItem(BUFFER_KEY)).catch(()=>{});await bufferWrites}catch{}}async function initConsolePersistence(){if(persistenceReady||!(0,_sharedUi.hasAccountAccess)())return;persistenceReady=true;const e=persistenceGeneration;try{preserveLog=await _sharedUi.persistentStorage.getItem(PRESERVE_KEY)==="true"}catch{preserveLog=false}if(e!==persistenceGeneration||!(0,_sharedUi.hasAccountAccess)()){persistenceReady=false;return}emitPreserve();if(!preserveLog){await clearSavedBuffer();return}try{const t=await _sharedUi.persistentStorage.getItem(BUFFER_KEY);if(e!==persistenceGeneration||!(0,_sharedUi.hasAccountAccess)()){persistenceReady=false;return}if(t){const n=JSON.parse(t);if(Array.isArray(n)&&n.length){store.update(o=>[...n,...o]);store.bumpIdAbove(Math.max(...n.map(o=>o.id)))}}}catch{}}function getPreserveLog(){return preserveLog}function setPreserveLog(e){if(preserveLog===e)return;preserveLog=e;emitPreserve();_sharedUi.persistentStorage.setItem(PRESERVE_KEY,String(e)).catch(()=>{});if(e)saveBuffer();else clearSavedBuffer()}function subscribePreserveLog(e){preserveListeners.add(e);return()=>{preserveListeners.delete(e)}}
8
+ ${compactComponentStack(e.componentStack)}`:"";const s=`${t} ${n}${r}`;pushFatal({id:store.allocId(),method:"error",level:"error",args:[t,n,...r?[r.trim()]:[]],message:s,timestamp:Date.now(),stack:formatNativeStack(e),fatal:true},o)}function installNativeExceptionCapture(){const e=globalThis.RN$registerExceptionListener;if(typeof e!=="function")return false;e(t=>{try{if(!captureDisabledByUser)recordNativeException(t)}catch{}});return true}function installFatalErrorCapture(){if(fatalInstalled)return;const e=installNativeExceptionCapture();const t=globalThis.ErrorUtils;if(typeof t?.setGlobalHandler!=="function"){fatalInstalled=e;return}fatalInstalled=true;const n=typeof t.getGlobalHandler==="function"?t.getGlobalHandler():void 0;t.setGlobalHandler((o,r)=>{try{if(!captureDisabledByUser)recordFatalError(o,r)}catch{}if(typeof n==="function")n(o,r)})}function installConsoleCapture(){if((0,_sharedUi.getAccountAccess)().status==="locked")return;captureDisabledByUser=false;installFatalErrorCapture();if(installed)return;installed=true;for(const e of METHODS){const t=console[e];if(typeof t!=="function")continue;originals[e]=t;console[e]=function n(...o){record(e,o,n);t.apply(console,o)}}}function uninstallConsoleCapture(){captureDisabledByUser=true;if(!installed)return;installed=false;for(const e of METHODS){const t=originals[e];if(t)console[e]=t;delete originals[e]}}function subscribe(e){return store.subscribe(e)}function getEntries(){return store.getSnapshot()}function clearEntries(){void clearSavedBuffer();store.clear()}function replaceEntries(e){store.set(e.filter(t=>!(0,_sharedUi.isBuoyLog)(t.args??[t.message])))}function onClear(e){return store.onClear(e)}const PRESERVE_KEY="@react_buoy_console_preserve";const BUFFER_KEY="@react_buoy_console_buffer";const SAVE_DEBOUNCE_MS=600;let preserveLog=false;let persistenceReady=false;let persistenceGeneration=0;let bufferWrites=Promise.resolve();const preserveListeners=new Set;let saveTimer=null;function emitPreserve(){for(const e of preserveListeners)e()}function scheduleSave(){if(!preserveLog||!(0,_sharedUi.hasAccountAccess)())return;if(saveTimer)clearTimeout(saveTimer);saveTimer=setTimeout(saveBuffer,SAVE_DEBOUNCE_MS)}async function saveBuffer(){saveTimer=null;if(!preserveLog||!(0,_sharedUi.hasAccountAccess)())return;try{const e=store.getSnapshot().map(n=>({...n,args:(0,_sanitize.sanitizeArgs)(n.args)}));const t=persistenceGeneration;bufferWrites=bufferWrites.then(async()=>{if(t!==persistenceGeneration||!preserveLog||!(0,_sharedUi.hasAccountAccess)())return;await _sharedUi.persistentStorage.setItem(BUFFER_KEY,JSON.stringify(e))}).catch(()=>{});await bufferWrites}catch{}}async function clearSavedBuffer(){persistenceGeneration++;persistenceReady=false;try{bufferWrites=bufferWrites.then(()=>_sharedUi.persistentStorage.removeItem(BUFFER_KEY)).catch(()=>{});await bufferWrites}catch{}}async function initConsolePersistence(){if(persistenceReady||!(0,_sharedUi.hasAccountAccess)())return;persistenceReady=true;const e=persistenceGeneration;try{preserveLog=await _sharedUi.persistentStorage.getItem(PRESERVE_KEY)==="true"}catch{preserveLog=false}if(e!==persistenceGeneration||!(0,_sharedUi.hasAccountAccess)()){persistenceReady=false;return}emitPreserve();if(!preserveLog){await clearSavedBuffer();return}try{const t=await _sharedUi.persistentStorage.getItem(BUFFER_KEY);if(e!==persistenceGeneration||!(0,_sharedUi.hasAccountAccess)()){persistenceReady=false;return}if(t){const n=JSON.parse(t);if(Array.isArray(n)&&n.length){store.update(o=>[...n,...o].filter(r=>!(0,_sharedUi.isBuoyLog)(r.args??[r.message])));store.bumpIdAbove(Math.max(...n.map(o=>o.id)))}}}catch{}}function getPreserveLog(){return preserveLog}function setPreserveLog(e){if(preserveLog===e)return;preserveLog=e;emitPreserve();_sharedUi.persistentStorage.setItem(PRESERVE_KEY,String(e)).catch(()=>{});if(e)saveBuffer();else clearSavedBuffer()}function subscribePreserveLog(e){preserveListeners.add(e);return()=>{preserveListeners.delete(e)}}
@@ -1 +1 @@
1
- "use strict";import{JsModal as l}from"@buoy-gg/shared-ui";import{useConsoleController as m}from"../devtools/useConsoleController";import{ConsoleHeader as c}from"../devtools/ConsoleHeader";import{ConsoleBody as a}from"../devtools/ConsoleBody";import{jsx as o}from"react/jsx-runtime";export function ConsoleModal({visible:r,onClose:t,onBack:n,onMinimize:s,persistenceKey:i}){const e=m();return o(l,{visible:r,onClose:t,onMinimize:s,persistenceKey:i,header:{showToggleButton:true,customContent:o(c,{c:e,onBack:n})},enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:o(a,{c:e})})}
1
+ "use strict";import{JsModal as l}from"@buoy-gg/shared-ui";import{useConsoleController as c}from"../devtools/useConsoleController";import{ConsoleHeader as m}from"../devtools/ConsoleHeader";import{ConsoleBody as a}from"../devtools/ConsoleBody";import{jsx as o}from"react/jsx-runtime";export function ConsoleModal({visible:r,onClose:t,onBack:n,onMinimize:s,persistenceKey:i="@react_buoy_console_modal"}){const e=c();return o(l,{visible:r,onClose:t,onMinimize:s,persistenceKey:i,header:{showToggleButton:true,customContent:o(m,{c:e,onBack:n})},enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:o(a,{c:e})})}
@@ -1 +1 @@
1
- "use strict";import A,{useCallback as T,useRef as h,useSyncExternalStore as y}from"react";import{View as c,Text as a,FlatList as S,TouchableOpacity as d,ScrollView as C,StyleSheet as m}from"react-native";import{night as n,Check as k,LOG_LIST_PRESET as E}from"@buoy-gg/shared-ui";import{ConsoleMessageRow as v}from"./ConsoleMessageRow";import{ALL_LEVELS as V,DEFAULT_LEVELS as R,LEVEL_LABEL as P,LEVEL_ORDER as z}from"./consoleFilter";import{getPreserveLog as p,setPreserveLog as M,subscribePreserveLog as _}from"../store/consoleLogStore";import{jsx as o,jsxs as g}from"react/jsx-runtime";export function ConsoleBody({c:e}){if(e.view==="filters")return o(D,{c:e});return o(O,{c:e})}function O({c:e}){const s=h(null);const l=h(true);const r=T(({item:i})=>o(v,{row:i,showTimestamps:e.showTimestamps,onToggleGroup:e.onToggleGroup,onToggleCluster:e.onToggleCluster}),[e.showTimestamps,e.onToggleGroup,e.onToggleCluster]);return o(S,{ref:s,data:e.rows,keyExtractor:i=>i.key,renderItem:r,style:t.list,...E,onContentSizeChange:()=>{if(l.current)s.current?.scrollToEnd({animated:false})},onScroll:i=>{const{contentOffset:b,contentSize:w,layoutMeasurement:x}=i.nativeEvent;const L=w.height-(b.y+x.height);l.current=L<40},scrollEventThrottle:100})}function u({on:e,label:s,subtext:l,onPress:r}){return g(d,{style:t.row,onPress:r,activeOpacity:.7,children:[o(c,{style:[t.checkbox,e&&t.checkboxOn],children:e?o(k,{size:12,color:n.color.onAccent,strokeWidth:3}):null}),g(c,{style:t.rowTextCol,children:[o(a,{style:t.rowLabel,children:s}),l?o(a,{style:t.rowSubtext,children:l}):null]})]})}function f({text:e}){return o(a,{style:t.sectionLabel,children:e})}function D({c:e}){const s=y(_,p,p);const l=r=>e.setLevelsMask({...e.levelsMask,[r]:!e.levelsMask[r]});return g(C,{style:t.subView,contentContainerStyle:t.subViewContent,children:[o(f,{text:"Log levels"}),o(d,{style:t.presetRow,onPress:()=>e.setLevelsMask({...R}),children:o(a,{style:t.presetText,children:"Default (hide verbose)"})}),o(d,{style:t.presetRow,onPress:()=>e.setLevelsMask({...V}),children:o(a,{style:t.presetText,children:"All levels"})}),z.map(r=>o(u,{on:e.levelsMask[r],label:P[r],onPress:()=>l(r)},r)),o(c,{style:t.divider}),o(f,{text:"Settings"}),o(u,{on:e.showTimestamps,label:"Show timestamps",onPress:()=>e.setShowTimestamps(r=>!r)}),o(u,{on:s,label:"Preserve log",subtext:"Do not clear log on reload",onPress:()=>M(!s)})]})}const t=m.create({list:{flex:1,backgroundColor:"transparent"},subView:{flex:1,backgroundColor:"transparent"},subViewContent:{padding:12},sectionLabel:{color:n.color.textTertiary,fontSize:11,textTransform:"uppercase",letterSpacing:.5,marginTop:4,marginBottom:4,paddingHorizontal:8},presetRow:{paddingVertical:10,paddingHorizontal:8},presetText:{color:n.color.accent,fontSize:14,fontWeight:"600"},divider:{height:m.hairlineWidth,backgroundColor:n.color.border,marginVertical:6},row:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:8,gap:12},rowTextCol:{flexDirection:"column",flex:1},rowLabel:{color:n.color.text,fontSize:14},rowSubtext:{color:n.color.textTertiary,fontSize:12,marginTop:1},checkbox:{width:18,height:18,borderRadius:4,borderWidth:1,borderColor:n.color.fillTertiary,alignItems:"center",justifyContent:"center"},checkboxOn:{backgroundColor:n.color.accent,borderColor:n.color.accent}});
1
+ "use strict";import j,{useCallback as L,useRef as m,useSyncExternalStore as T}from"react";import{View as a,Text as c,FlatList as S,TouchableOpacity as u,ScrollView as C,StyleSheet as h}from"react-native";import{night as s,Check as k,LOG_LIST_PRESET as v}from"@buoy-gg/shared-ui";import{ConsoleMessageRow as E}from"./ConsoleMessageRow";import{ALL_LEVELS as D,DEFAULT_LEVELS as V,LEVEL_LABEL as I,LEVEL_ORDER as R}from"./consoleFilter";import{getPreserveLog as p,setPreserveLog as P,subscribePreserveLog as z}from"../store/consoleLogStore";import{jsx as o,jsxs as d}from"react/jsx-runtime";export function ConsoleBody({c:e}){if(e.view==="filters")return o(_,{c:e});return o(M,{c:e})}function M({c:e}){const l=m(null);const i=m(true);const t=L(({item:n})=>o(E,{row:n,showTimestamps:e.showTimestamps,onToggleGroup:e.onToggleGroup,onToggleCluster:e.onToggleCluster}),[e.showTimestamps,e.onToggleGroup,e.onToggleCluster]);return o(S,{testID:"buoy-console-list",ref:l,data:e.rows,keyExtractor:n=>n.key,renderItem:t,style:r.list,...v,onContentSizeChange:()=>{if(i.current)l.current?.scrollToEnd({animated:false})},onScroll:n=>{const{contentOffset:f,contentSize:y,layoutMeasurement:w}=n.nativeEvent;const x=y.height-(f.y+w.height);i.current=x<40},scrollEventThrottle:100})}function g({testID:e,on:l,label:i,subtext:t,onPress:n}){return d(u,{testID:e,style:r.row,onPress:n,activeOpacity:.7,children:[o(a,{style:[r.checkbox,l&&r.checkboxOn],children:l?o(k,{size:12,color:s.color.onAccent,strokeWidth:3}):null}),d(a,{style:r.rowTextCol,children:[o(c,{style:r.rowLabel,children:i}),t?o(c,{style:r.rowSubtext,children:t}):null]})]})}function b({text:e}){return o(c,{style:r.sectionLabel,children:e})}function _({c:e}){const l=T(z,p,p);const i=t=>e.setLevelsMask({...e.levelsMask,[t]:!e.levelsMask[t]});return d(C,{testID:"buoy-console-filters",style:r.subView,contentContainerStyle:r.subViewContent,children:[o(b,{text:"Log levels"}),o(u,{testID:"buoy-console-levels-default",style:r.presetRow,onPress:()=>e.setLevelsMask({...V}),children:o(c,{style:r.presetText,children:"Default (hide verbose)"})}),o(u,{testID:"buoy-console-levels-all",style:r.presetRow,onPress:()=>e.setLevelsMask({...D}),children:o(c,{style:r.presetText,children:"All levels"})}),R.map(t=>o(g,{testID:`buoy-console-level-${t}`,on:e.levelsMask[t],label:I[t],onPress:()=>i(t)},t)),o(a,{style:r.divider}),o(b,{text:"Settings"}),o(g,{testID:"buoy-console-timestamps",on:e.showTimestamps,label:"Show timestamps",onPress:()=>e.setShowTimestamps(t=>!t)}),o(g,{testID:"buoy-console-preserve",on:l,label:"Preserve log",subtext:"Do not clear log on reload",onPress:()=>P(!l)})]})}const r=h.create({list:{flex:1,backgroundColor:"transparent"},subView:{flex:1,backgroundColor:"transparent"},subViewContent:{padding:12},sectionLabel:{color:s.color.textTertiary,fontSize:11,textTransform:"uppercase",letterSpacing:.5,marginTop:4,marginBottom:4,paddingHorizontal:8},presetRow:{paddingVertical:10,paddingHorizontal:8},presetText:{color:s.color.accent,fontSize:14,fontWeight:"600"},divider:{height:h.hairlineWidth,backgroundColor:s.color.border,marginVertical:6},row:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:8,gap:12},rowTextCol:{flexDirection:"column",flex:1},rowLabel:{color:s.color.text,fontSize:14},rowSubtext:{color:s.color.textTertiary,fontSize:12,marginTop:1},checkbox:{width:18,height:18,borderRadius:4,borderWidth:1,borderColor:s.color.fillTertiary,alignItems:"center",justifyContent:"center"},checkboxOn:{backgroundColor:s.color.accent,borderColor:s.color.accent}});
@@ -1 +1 @@
1
- "use strict";import v from"react";import{TouchableOpacity as a,StyleSheet as d}from"react-native";import{ModalHeader as r,TabSelector as h,night as o,Search as u,Filter as b,Trash2 as y}from"@buoy-gg/shared-ui";import{jsx as t,jsxs as c}from"react/jsx-runtime";const S=[{key:"chrono",label:"Timeline"},{key:"cluster",label:"Grouped"}];export function ConsoleHeader({c:e,onBack:s}){if(e.view==="filters"){return c(r,{children:[t(r.Navigation,{onBack:()=>e.setView("list")}),t(r.Content,{title:"Filters"})]})}const n=e.rows.length>0;return c(r,{children:[s?t(r.Navigation,{onBack:s}):null,t(r.Content,{title:"",noMargin:true,children:e.searchActive?t(r.Search,{value:e.query,onChangeText:e.setQuery,onCancel:()=>e.setQuery(""),clearOnlyWhenText:true,placeholder:"Filter logs\u2026 /regex/ -exclude",iconSize:14,inputProps:{onSubmitEditing:()=>e.setSearchActive(false)}}):t(h,{tabs:S,activeTab:e.layoutMode,onTabChange:l=>e.setLayoutMode(l)})}),c(r.Actions,{children:[t(a,{onPress:()=>e.setSearchActive(l=>!l),style:[i.actionBtn,e.searchActive&&i.actionBtnActive],accessibilityLabel:"Search logs",children:t(u,{size:14,color:e.searchActive?o.color.accent:o.color.textSecondary})}),t(a,{onPress:()=>e.setView("filters"),style:[i.actionBtn,e.isLevelCustom&&i.actionBtnActive],accessibilityLabel:"Filters",children:t(b,{size:14,color:e.isLevelCustom?o.color.accent:o.color.textSecondary})}),t(a,{onPress:e.clear,disabled:!n,style:[i.actionBtn,!n&&i.actionBtnDisabled],accessibilityLabel:"Clear console",children:t(y,{size:14,color:n?o.color.textSecondary:o.color.textTertiary})})]})]})}const i=d.create({actionBtn:{width:32,height:32,borderRadius:8,backgroundColor:o.color.buttonSurface,borderWidth:1,borderColor:o.color.border,alignItems:"center",justifyContent:"center"},actionBtnActive:{backgroundColor:o.color.accentSoft,borderColor:o.color.accentBorderStrong},actionBtnDisabled:{opacity:.55}});
1
+ "use strict";import v from"react";import{TouchableOpacity as s,StyleSheet as d}from"react-native";import{ModalHeader as r,TabSelector as u,night as o,Search as h,Filter as b,Trash2 as y}from"@buoy-gg/shared-ui";import{jsx as t,jsxs as c}from"react/jsx-runtime";const S=[{key:"chrono",label:"Timeline"},{key:"cluster",label:"Grouped"}];export function ConsoleHeader({c:e,onBack:a}){if(e.view==="filters"){return c(r,{children:[t(r.Navigation,{onBack:()=>e.setView("list")}),t(r.Content,{title:"Filters"})]})}const n=e.rows.length>0;return c(r,{children:[a?t(r.Navigation,{onBack:a}):null,t(r.Content,{title:"",noMargin:true,children:e.searchActive?t(r.Search,{testID:"buoy-console-search",value:e.query,onChangeText:e.setQuery,onCancel:()=>e.setQuery(""),clearOnlyWhenText:true,placeholder:"Filter logs\u2026 /regex/ -exclude",iconSize:14,inputProps:{onSubmitEditing:()=>e.setSearchActive(false)}}):t(u,{testIDPrefix:"buoy-console-tab",tabs:S,activeTab:e.layoutMode,onTabChange:l=>e.setLayoutMode(l)})}),c(r.Actions,{children:[t(s,{onPress:()=>e.setSearchActive(l=>!l),style:[i.actionBtn,e.searchActive&&i.actionBtnActive],testID:"buoy-console-search-open",accessibilityLabel:"Search logs",children:t(h,{size:14,color:e.searchActive?o.color.accent:o.color.textSecondary})}),t(s,{onPress:()=>e.setView("filters"),style:[i.actionBtn,e.isLevelCustom&&i.actionBtnActive],testID:"buoy-console-filters-open",accessibilityLabel:"Filters",children:t(b,{size:14,color:e.isLevelCustom?o.color.accent:o.color.textSecondary})}),t(s,{onPress:e.clear,disabled:!n,style:[i.actionBtn,!n&&i.actionBtnDisabled],testID:"buoy-console-clear",accessibilityLabel:"Clear console",children:t(y,{size:14,color:n?o.color.textSecondary:o.color.textTertiary})})]})]})}const i=d.create({actionBtn:{width:32,height:32,borderRadius:8,backgroundColor:o.color.buttonSurface,borderWidth:1,borderColor:o.color.border,alignItems:"center",justifyContent:"center"},actionBtnActive:{backgroundColor:o.color.accentSoft,borderColor:o.color.accentBorderStrong},actionBtnDisabled:{opacity:.55}});
@@ -1 +1 @@
1
- "use strict";import{memo as v}from"react";import V,{useState as B}from"react";import{View as i,Text as n,TouchableOpacity as b,StyleSheet as C}from"react-native";import{consoleTheme as m,levelStyles as F,monoFont as c}from"./theme";import{formatConsoleMessage as D}from"./consoleFormat";import{ConsoleValue as M}from"./ConsoleValue";import{jsx as o,jsxs as d}from"react/jsx-runtime";function j(l){const e=new Date(l);const g=(h,f=2)=>String(h).padStart(f,"0");return`${g(e.getHours())}:${g(e.getMinutes())}:${g(e.getSeconds())}.${g(e.getMilliseconds(),3)}`}function O({icon:l,color:e}){return o(n,{style:[t.levelIcon,{color:e}],children:l==="warning"?"\u26A0":"\u2298"})}function $({count:l,color:e}){return o(i,{style:[t.repeatBadge,{borderColor:e}],children:o(n,{style:[t.repeatBadgeText,{color:e}],children:l})})}export const ConsoleMessageRow=v(function l({row:e,showTimestamps:g,onToggleGroup:h,onToggleCluster:f}){const{entry:a}=e;const p=F[a.level];const L=a.level==="error"||a.level==="warning";const u=p.text;const[y,W]=B(a.method==="trace");if(e.clusterHeader){const r=e.clusterHeader;return o(b,{style:[t.wrapper,t.dividerTop],activeOpacity:.7,onPress:()=>f(r.key),children:d(i,{style:t.rowWrapper,children:[o(n,{style:[t.originGutter,{color:e.originColor}],children:r.expanded?"\u25BC":"\u25B6"}),o(i,{style:t.messageColumn,children:d(i,{style:t.messageLine,children:[o(n,{style:[t.text,t.clusterTitle,{color:e.originColor}],children:e.originLabel}),d(n,{style:t.clusterCount,children:[" \xB7 ",r.count," logs"]})]})})]})})}const T=D(a.args);const S=Boolean(a.stack)&&(L||a.method==="trace");const G=o(i,{style:[t.contentWrap,!y&&t.contentWrapClamped],children:T.map((r,s)=>r.type==="string"?o(n,{style:[t.text,{color:u},e.isGroupHeader&&t.groupTitle,r.style],children:r.value},s):o(M,{value:r.value,generic:r.mode==="generic"},s))});const z=d(i,{style:t.messageColumn,children:[e.originLabel?o(n,{style:[t.originLabel,{color:e.originColor}],numberOfLines:1,children:e.originLabel}):null,d(i,{style:t.messageLine,children:[e.isGroupHeader?o(n,{style:[t.groupTriangle,{color:u}],children:e.groupCollapsed?"\u25B6":"\u25BC"}):null,p.icon?o(O,{icon:p.icon,color:u}):null,g?o(n,{style:t.timestamp,children:j(a.timestamp)}):null,S?o(n,{style:[t.stackTriangle,{color:u}],children:y?"\u25BC":"\u25B6"}):null,G,e.repeatCount>1?o($,{count:e.repeatCount,color:u}):null]}),S&&y?o(i,{style:t.stackTrace,children:(a.stack??"").split("\n").filter(r=>r.trim()).map((r,s)=>o(n,{style:t.stackFrame,children:r.trim()},s))}):null]});const x=[t.wrapper,p.background?{backgroundColor:p.background}:t.dividerTop];const I=Array.from({length:e.depth},(r,s)=>o(i,{style:t.nestingMarker},s));const R=e.lanes?o(i,{style:t.laneGutter,children:e.lanes.map((r,s)=>o(n,{style:[t.laneCell,r.color?{color:r.color}:null],children:r.glyph},s))}):e.bracketGlyph?o(n,{style:[t.originGutter,{color:e.originColor}],children:e.bracketGlyph}):null;const H=d(i,{style:t.rowWrapper,children:[R,I,z]});const k=`buoy-console-row-${a.id}`;const w=[e.originLabel,T.find(r=>r.type==="string")?.value].filter(Boolean).join(" \u2014 ").slice(0,80);if(e.isGroupHeader&&e.groupId!==void 0){const r=e.groupId;return o(b,{style:x,activeOpacity:.7,onPress:()=>h(r,Boolean(e.groupCollapsed)),testID:k,accessibilityLabel:w||"Console group",children:H})}return o(b,{style:x,activeOpacity:.7,onPress:()=>W(r=>!r),testID:k,accessibilityLabel:w||"Console message",children:H})},(l,e)=>l.row.key===e.row.key&&l.row.lanes===e.row.lanes&&l.row.repeatCount===e.row.repeatCount&&l.row.groupCollapsed===e.row.groupCollapsed&&l.row.depth===e.row.depth&&l.row.bracketGlyph===e.row.bracketGlyph&&l.row.originLabel===e.row.originLabel&&l.row.clusterHeader?.count===e.row.clusterHeader?.count&&l.row.clusterHeader?.expanded===e.row.clusterHeader?.expanded&&l.showTimestamps===e.showTimestamps&&l.onToggleGroup===e.onToggleGroup&&l.onToggleCluster===e.onToggleCluster);const t=C.create({wrapper:{paddingVertical:2,paddingRight:8,minHeight:18},dividerTop:{borderTopWidth:C.hairlineWidth,borderTopColor:m.divider},rowWrapper:{flexDirection:"row",alignItems:"flex-start"},originGutter:{width:11,fontFamily:c,fontSize:13,lineHeight:18,textAlign:"center"},laneGutter:{flexDirection:"row"},laneCell:{width:9,fontFamily:c,fontSize:13,lineHeight:18,textAlign:"center"},originLabel:{fontFamily:c,fontSize:10,lineHeight:16,marginBottom:1,opacity:.9},nestingMarker:{width:14,alignSelf:"stretch",borderRightWidth:C.hairlineWidth,borderRightColor:m.divider,marginLeft:2},messageColumn:{flex:1,flexDirection:"column",paddingLeft:6},messageLine:{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-start"},contentWrap:{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-start",flexShrink:1},contentWrapClamped:{flexWrap:"nowrap",overflow:"hidden",maxHeight:16},text:{fontFamily:c,fontSize:12,lineHeight:16},groupTitle:{fontWeight:"bold"},clusterTitle:{fontWeight:"600"},clusterCount:{color:m.tokenSubtle,fontFamily:c,fontSize:12,lineHeight:16},groupTriangle:{fontSize:9,lineHeight:16,marginRight:4},stackTriangle:{fontSize:8,lineHeight:16,marginRight:4},levelIcon:{fontSize:12,lineHeight:16,marginRight:5},timestamp:{color:m.tokenSubtle,fontFamily:c,fontSize:11,lineHeight:16,marginRight:6},repeatBadge:{borderWidth:1,borderRadius:9,paddingHorizontal:5,minWidth:16,alignItems:"center",justifyContent:"center",marginLeft:6,marginTop:1},repeatBadgeText:{fontSize:10,fontWeight:"700",lineHeight:14},stackTrace:{marginTop:2,marginLeft:12},stackFrame:{color:m.tokenSubtle,fontFamily:c,fontSize:11,lineHeight:15}});
1
+ "use strict";import{memo as R}from"react";import V,{useState as v}from"react";import{View as i,Text as l,TouchableOpacity as b,StyleSheet as C}from"react-native";import{consoleTheme as m,levelStyles as B,monoFont as c}from"./theme";import{formatConsoleMessage as F}from"./consoleFormat";import{ConsoleValue as $}from"./ConsoleValue";import{jsx as r,jsxs as d}from"react/jsx-runtime";function M(n){const e=new Date(n);const g=(y,f=2)=>String(y).padStart(f,"0");return`${g(e.getHours())}:${g(e.getMinutes())}:${g(e.getSeconds())}.${g(e.getMilliseconds(),3)}`}function j({icon:n,color:e}){return r(l,{style:[t.levelIcon,{color:e}],children:n==="warning"?"\u26A0":"\u2298"})}function O({count:n,color:e}){return r(i,{style:[t.repeatBadge,{borderColor:e}],children:r(l,{testID:"buoy-console-repeat-count",style:[t.repeatBadgeText,{color:e}],children:n})})}export const ConsoleMessageRow=R(function n({row:e,showTimestamps:g,onToggleGroup:y,onToggleCluster:f}){const{entry:s}=e;const u=B[s.level];const I=s.level==="error"||s.level==="warning";const p=u.text;const[h,L]=v(s.method==="trace");if(e.clusterHeader){const o=e.clusterHeader;return r(b,{testID:`buoy-console-cluster-${e.originLabel}`,style:[t.wrapper,t.dividerTop],activeOpacity:.7,onPress:()=>f(o.key),children:d(i,{style:t.rowWrapper,children:[r(l,{style:[t.originGutter,{color:e.originColor}],children:o.expanded?"\u25BC":"\u25B6"}),r(i,{style:t.messageColumn,children:d(i,{style:t.messageLine,children:[r(l,{style:[t.text,t.clusterTitle,{color:e.originColor}],children:e.originLabel}),d(l,{testID:"buoy-console-cluster-count",style:t.clusterCount,children:[" \xB7 ",o.count," logs"]})]})})]})})}const T=F(s.args);const x=Boolean(s.stack)&&(I||s.method==="trace");const W=r(i,{testID:h?"buoy-console-content-expanded":"buoy-console-content-collapsed",style:[t.contentWrap,!h&&t.contentWrapClamped],children:T.map((o,a)=>o.type==="string"?r(l,{testID:`buoy-console-text-${a}`,style:[t.text,{color:p},e.isGroupHeader&&t.groupTitle,o.style],children:o.value},a):r($,{testID:`buoy-console-value-${a}`,value:o.value,generic:o.mode==="generic"},a))});const D=d(i,{style:t.messageColumn,children:[e.originLabel?r(l,{testID:"buoy-console-origin",style:[t.originLabel,{color:e.originColor}],numberOfLines:1,children:e.originLabel}):null,d(i,{style:t.messageLine,children:[e.isGroupHeader?r(l,{style:[t.groupTriangle,{color:p}],children:e.groupCollapsed?"\u25B6":"\u25BC"}):null,u.icon?r(j,{icon:u.icon,color:p}):null,g?r(l,{testID:"buoy-console-timestamp",style:t.timestamp,children:M(s.timestamp)}):null,x?r(l,{style:[t.stackTriangle,{color:p}],children:h?"\u25BC":"\u25B6"}):null,W,e.repeatCount>1?r(O,{count:e.repeatCount,color:p}):null]}),x&&h?r(i,{testID:"buoy-console-stack",style:t.stackTrace,children:(s.stack??"").split("\n").filter(o=>o.trim()).map((o,a)=>r(l,{style:t.stackFrame,children:o.trim()},a))}):null]});const S=[t.wrapper,u.background?{backgroundColor:u.background}:t.dividerTop];const G=Array.from({length:e.depth},(o,a)=>r(i,{style:t.nestingMarker},a));const z=e.lanes?r(i,{style:t.laneGutter,children:e.lanes.map((o,a)=>r(l,{style:[t.laneCell,o.color?{color:o.color}:null],children:o.glyph},a))}):e.bracketGlyph?r(l,{style:[t.originGutter,{color:e.originColor}],children:e.bracketGlyph}):null;const k=d(i,{style:t.rowWrapper,children:[z,G,D]});const H=`buoy-console-row-${String(s.args[0])}`;const w=[e.originLabel,T.find(o=>o.type==="string")?.value].filter(Boolean).join(" \u2014 ").slice(0,80);if(e.isGroupHeader&&e.groupId!==void 0){const o=e.groupId;return r(b,{style:S,activeOpacity:.7,onPress:()=>y(o,Boolean(e.groupCollapsed)),testID:H,accessibilityLabel:w||"Console group",children:k})}return r(b,{style:S,activeOpacity:.7,onPress:()=>L(o=>!o),testID:H,accessibilityLabel:w||"Console message",children:k})},(n,e)=>n.row.key===e.row.key&&n.row.lanes===e.row.lanes&&n.row.repeatCount===e.row.repeatCount&&n.row.groupCollapsed===e.row.groupCollapsed&&n.row.depth===e.row.depth&&n.row.bracketGlyph===e.row.bracketGlyph&&n.row.originLabel===e.row.originLabel&&n.row.clusterHeader?.count===e.row.clusterHeader?.count&&n.row.clusterHeader?.expanded===e.row.clusterHeader?.expanded&&n.showTimestamps===e.showTimestamps&&n.onToggleGroup===e.onToggleGroup&&n.onToggleCluster===e.onToggleCluster);const t=C.create({wrapper:{paddingVertical:2,paddingRight:8,minHeight:18},dividerTop:{borderTopWidth:C.hairlineWidth,borderTopColor:m.divider},rowWrapper:{flexDirection:"row",alignItems:"flex-start"},originGutter:{width:11,fontFamily:c,fontSize:13,lineHeight:18,textAlign:"center"},laneGutter:{flexDirection:"row"},laneCell:{width:9,fontFamily:c,fontSize:13,lineHeight:18,textAlign:"center"},originLabel:{fontFamily:c,fontSize:10,lineHeight:16,marginBottom:1,opacity:.9},nestingMarker:{width:14,alignSelf:"stretch",borderRightWidth:C.hairlineWidth,borderRightColor:m.divider,marginLeft:2},messageColumn:{flex:1,flexDirection:"column",paddingLeft:6},messageLine:{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-start"},contentWrap:{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-start",flexShrink:1},contentWrapClamped:{flexWrap:"nowrap",overflow:"hidden",maxHeight:16},text:{fontFamily:c,fontSize:12,lineHeight:16},groupTitle:{fontWeight:"bold"},clusterTitle:{fontWeight:"600"},clusterCount:{color:m.tokenSubtle,fontFamily:c,fontSize:12,lineHeight:16},groupTriangle:{fontSize:9,lineHeight:16,marginRight:4},stackTriangle:{fontSize:8,lineHeight:16,marginRight:4},levelIcon:{fontSize:12,lineHeight:16,marginRight:5},timestamp:{color:m.tokenSubtle,fontFamily:c,fontSize:11,lineHeight:16,marginRight:6},repeatBadge:{borderWidth:1,borderRadius:9,paddingHorizontal:5,minWidth:16,alignItems:"center",justifyContent:"center",marginLeft:6,marginTop:1},repeatBadgeText:{fontSize:10,fontWeight:"700",lineHeight:14},stackTrace:{marginTop:2,marginLeft:12},stackFrame:{color:m.tokenSubtle,fontFamily:c,fontSize:11,lineHeight:15}});
@@ -1 +1 @@
1
- "use strict";import H,{useState as k}from"react";import{Text as l,View as d,TouchableOpacity as h,StyleSheet as A}from"react-native";import{consoleTheme as i,monoFont as E}from"./theme";import{jsx as c,jsxs as f}from"react/jsx-runtime";const j=5;const S=6;function b(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(e instanceof Error)return"error";const r=typeof e;if(r==="number")return"number";if(r==="bigint")return"bigint";if(r==="boolean")return"boolean";if(r==="string")return"string";if(r==="function")return"function";if(r==="symbol")return"symbol";return"object"}const w={number:i.valueNumber,bigint:i.valueBigint,boolean:i.valueNumber,string:i.valueString,null:i.valueNullish,undefined:i.valueNullish,symbol:i.valueString,function:i.valueNode};function x(e){if(Array.isArray(e))return"";const r=Object.getPrototypeOf(e);if(!r)return"Object";const o=r.constructor?.name;return!o||o==="Object"?"":o}function p(e){const r=b(e);switch(r){case"string":return`'${e}'`;case"function":{const o=e.name;return`\u0192 ${o||""}`.trimEnd()}case"symbol":return e.toString();case"bigint":return`${String(e)}n`;case"array":return`Array(${e.length})`;case"error":return e.name;case"object":{const o=x(e);return o?`${o} {\u2026}`:"{\u2026}"}default:return String(e)}}function R(e){if(Array.isArray(e)){const m=e.slice(0,S).map(s=>p(s)).join(", ");const t=e.length>S?", \u2026":"";return`(${e.length}) [${m}${t}]`}const r=Object.entries(e);const o=r.slice(0,j).map(([m,t])=>`${m}: ${p(t)}`).join(", ");const y=r.length>j?", \u2026":"";const u=x(e);const a=u?`${u} `:"";return`${a}{${o}${y}}`}function P(e){const r=b(e);if(r==="array")return e.length>0;if(r==="object")return Object.keys(e).length>0;if(r==="error")return true;return false}const O=({open:e})=>c(l,{style:[n.triangle,e&&n.triangleOpen],children:"\u25B6"});export function ConsoleValue({value:e,depth:r=0}){const[o,y]=k(false);const u=b(e);if(u==="error"){const t=e;const s=`${t.name}: ${t.message}`.split("\n")[0];const g=t.stack&&t.stack.trim()!==s.trim()?t.stack:void 0;if(!g){return c(l,{style:[n.mono,{color:i.onErrorContainer}],numberOfLines:1,children:s})}return f(d,{style:n.objectContainer,children:[f(h,{style:n.objectHeader,activeOpacity:.6,onPress:()=>y($=>!$),children:[c(O,{open:o}),c(l,{style:[n.mono,n.errorHead],numberOfLines:o?void 0:1,children:s})]}),o?c(l,{style:[n.mono,n.errorStack],children:g}):null]})}if(!P(e)){const t=w[u]??i.onSurface;return c(l,{style:[n.mono,{color:t}],children:p(e)})}const a=e;const m=Array.isArray(a)?a.map((t,s)=>[String(s),t]):Object.entries(a);return f(d,{style:n.objectContainer,children:[f(h,{onPress:()=>y(t=>!t),activeOpacity:.6,style:n.objectHeader,children:[c(O,{open:o}),c(l,{style:[n.mono,n.preview],numberOfLines:o?void 0:1,children:R(a)})]}),o&&r<6?c(d,{style:n.children,children:m.map(([t,s])=>f(d,{style:n.propertyRow,children:[f(l,{style:[n.mono,n.propertyKey],children:[t,":"]}),c(d,{style:n.propertyValue,children:c(ConsoleValue,{value:s,depth:r+1})})]},t))}):null]})}const N={fontFamily:E,fontSize:12,lineHeight:16};const n=A.create({mono:N,objectContainer:{flexDirection:"column"},objectHeader:{flexDirection:"row",alignItems:"flex-start"},triangle:{color:i.tokenSubtle,fontSize:8,lineHeight:16,width:12},triangleOpen:{transform:[{rotate:"90deg"}]},preview:{color:i.valuePreview,fontStyle:"italic",flexShrink:1},errorHead:{color:i.onErrorContainer,flexShrink:1},errorStack:{color:i.tokenSubtle,marginLeft:14,marginTop:1},children:{marginLeft:14,flexDirection:"column"},propertyRow:{flexDirection:"row",alignItems:"flex-start"},propertyKey:{color:i.valueNode,marginRight:6},propertyValue:{flexShrink:1}});
1
+ "use strict";import T,{useState as A}from"react";import{Text as f,View as y,TouchableOpacity as j,StyleSheet as E}from"react-native";import{consoleTheme as i,monoFont as w}from"./theme";import{jsx as c,jsxs as u}from"react/jsx-runtime";const S=5;const x=6;function h(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(e instanceof Error)return"error";const r=typeof e;if(r==="number")return"number";if(r==="bigint")return"bigint";if(r==="boolean")return"boolean";if(r==="string")return"string";if(r==="function")return"function";if(r==="symbol")return"symbol";return"object"}const R={number:i.valueNumber,bigint:i.valueBigint,boolean:i.valueNumber,string:i.valueString,null:i.valueNullish,undefined:i.valueNullish,symbol:i.valueString,function:i.valueNode};function O(e){if(Array.isArray(e))return"";const r=Object.getPrototypeOf(e);if(!r)return"Object";const t=r.constructor?.name;return!t||t==="Object"?"":t}function p(e){const r=h(e);switch(r){case"string":return`'${e}'`;case"function":{const t=e.name;return`\u0192 ${t||""}`.trimEnd()}case"symbol":return e.toString();case"bigint":return`${String(e)}n`;case"array":return`Array(${e.length})`;case"error":return e.name;case"object":{const t=O(e);return t?`${t} {\u2026}`:"{\u2026}"}default:return String(e)}}function P(e){if(Array.isArray(e)){const l=e.slice(0,x).map(o=>p(o)).join(", ");const d=e.length>x?", \u2026":"";return`(${e.length}) [${l}${d}]`}const r=Object.entries(e);const t=r.slice(0,S).map(([l,d])=>`${l}: ${p(d)}`).join(", ");const s=r.length>S?", \u2026":"";const m=O(e);const b=m?`${m} `:"";return`${b}{${t}${s}}`}function N(e){const r=h(e);if(r==="array")return e.length>0;if(r==="object")return Object.keys(e).length>0;if(r==="error")return true;return false}const $=({open:e})=>c(f,{style:[n.triangle,e&&n.triangleOpen],children:"\u25B6"});export function ConsoleValue({value:e,depth:r=0,testID:t}){const[s,m]=A(false);const b=h(e);if(b==="error"){const o=e;const a=`${o.name}: ${o.message}`.split("\n")[0];const g=o.stack&&o.stack.trim()!==a.trim()?o.stack:void 0;if(!g){return c(f,{style:[n.mono,{color:i.onErrorContainer}],numberOfLines:1,children:a})}return u(y,{style:n.objectContainer,children:[u(j,{testID:t,style:n.objectHeader,activeOpacity:.6,onPress:()=>m(k=>!k),children:[c($,{open:s}),c(f,{style:[n.mono,n.errorHead],numberOfLines:s?void 0:1,children:a})]}),s?c(f,{style:[n.mono,n.errorStack],children:g}):null]})}if(!N(e)){const o=R[b]??i.onSurface;return c(f,{testID:t,style:[n.mono,{color:o}],children:p(e)})}const l=e;const d=Array.isArray(l)?l.map((o,a)=>[String(a),o]):Object.entries(l);return u(y,{style:n.objectContainer,children:[u(j,{testID:t,onPress:()=>m(o=>!o),activeOpacity:.6,style:n.objectHeader,children:[c($,{open:s}),c(f,{style:[n.mono,n.preview],numberOfLines:s?void 0:1,children:P(l)})]}),s&&r<6?c(y,{testID:t?`${t}-children`:void 0,style:n.children,children:d.map(([o,a])=>u(y,{style:n.propertyRow,children:[u(f,{style:[n.mono,n.propertyKey],children:[o,":"]}),c(y,{style:n.propertyValue,children:c(ConsoleValue,{testID:t?`${t}-${o}`:void 0,value:a,depth:r+1})})]},o))}):null]})}const C={fontFamily:w,fontSize:12,lineHeight:16};const n=E.create({mono:C,objectContainer:{flexDirection:"column"},objectHeader:{flexDirection:"row",alignItems:"flex-start"},triangle:{color:i.tokenSubtle,fontSize:8,lineHeight:16,width:12},triangleOpen:{transform:[{rotate:"90deg"}]},preview:{color:i.valuePreview,fontStyle:"italic",flexShrink:1},errorHead:{color:i.onErrorContainer,flexShrink:1},errorStack:{color:i.tokenSubtle,marginLeft:14,marginTop:1},children:{marginLeft:14,flexDirection:"column"},propertyRow:{flexDirection:"row",alignItems:"flex-start"},propertyKey:{color:i.valueNode,marginRight:6},propertyValue:{flexShrink:1}});
@@ -1 +1 @@
1
- "use strict";const i=/^(buoyConsoleProxy|record|cleanStack|captureOwnerStack|formatArgs|formatArg)$/;const m=/consoleLogStore/;function a(n){return n.replace(/\s+\[as [^\]]+\]$/,"").replace(/^(?:async\s+)?(?:new\s+)?(?:Object|console)\./,"").trim()}function p(n){if(n.func&&i.test(a(n.func))){return true}return Boolean(n.file&&m.test(n.file))}function N(n){const e=[];for(const u of n.split("\n")){const c=u.trim();if(!c||c==="Error")continue;let t=c.match(/^at\s+(.+?)\s+\((.+?):(\d+):(\d+)\)$/);if(t){e.push({func:t[1],file:t[2],line:Number(t[3])});continue}t=c.match(/^at\s+(.+?):(\d+):(\d+)$/);if(t){e.push({file:t[1],line:Number(t[2])});continue}t=c.match(/^(.*?)@(.+?):(\d+):(\d+)$/);if(t){e.push({func:t[1]||void 0,file:t[2],line:Number(t[3])});continue}}return e}function d(n){if(!n)return void 0;const e=n.split("?")[0];return e.split("/").pop()||e}function h(n){if(!n)return void 0;const e=a(n);if(!e||e==="<anonymous>"||e==="anonymous")return void 0;return e}function $(n){if(!n)return void 0;for(const e of n.split("\n")){const u=e.trim().match(/^at\s+([A-Za-z_$][\w$]*)/);if(u)return u[1]}return void 0}export function parseOrigin(n,e){const u=$(e);let c;if(n){const s=N(n);c=s.find(l=>!p(l))}const t=h(c?.func);const o=d(c?.file);const r=c?.line;const f=o&&r!=null?`${o}:${r}`:void 0;if(!u&&!t&&!f)return void 0;return{component:u,functionName:t,callSite:f,file:o,line:r}}export function sourceKey(n,e){if(e==="off"||!n)return e==="off"?null:"\u2014unknown\u2014";if(e==="component"){return n.component??n.functionName??n.callSite??"\u2014unknown\u2014"}if(e==="function"){return n.functionName??n.callSite??n.component??"\u2014anonymous\u2014"}return n.callSite??n.functionName??"\u2014unknown\u2014"}export function sourceLabel(n,e){if(!n)return"(unknown)";if(e==="component"){if(n.component)return n.component;if(n.functionName)return`\u0192 ${n.functionName}`;return n.callSite??"(unknown)"}if(e==="function"){if(n.functionName)return n.functionName;return n.callSite??"(anonymous)"}if(e==="callsite"){if(n.functionName&&n.callSite)return`${n.functionName} \xB7 ${n.callSite}`;return n.callSite??(n.functionName?`\u0192 ${n.functionName}`:"(unknown)")}return""}function S(n){let e=0;for(let u=0;u<n.length;u++)e=e*31+n.charCodeAt(u)|0;return Math.abs(e)}export function colorForKey(n){const e=S(n)%360;return`hsl(${e}, 70%, 66%)`}export function bracketGlyph(n){switch(n){case"top":return"\u250C";case"bottom":return"\u2514";case"single":return"\u2500";default:return"\u2502"}}
1
+ "use strict";const p=/^(buoyConsoleProxy|record|cleanStack|captureOwnerStack|formatArgs|formatArg)$/;const d=/consoleLogStore/;function l(n){return n.replace(/\s+\[as [^\]]+\]$/,"").replace(/^(?:async\s+)?(?:new\s+)?(?:Object|console)\./,"").trim()}function h(n){if(n.func&&p.test(l(n.func))){return true}return Boolean(n.file&&d.test(n.file))}function N(n){const e=[];for(const o of n.split("\n")){const u=o.trim();if(!u||u==="Error")continue;let t=u.match(/^at\s+(.+?)\s+\((.+?):(\d+):(\d+)\)$/);if(t){e.push({func:t[1],file:t[2],line:Number(t[3])});continue}t=u.match(/^at\s+(.+?):(\d+):(\d+)$/);if(t){e.push({file:t[1],line:Number(t[2])});continue}t=u.match(/^(.*?)@(.+?):(\d+):(\d+)$/);if(t){e.push({func:t[1]||void 0,file:t[2],line:Number(t[3])});continue}}return e}function y(n){if(!n)return void 0;const e=n.split(/\?|\/\/&/)[0];return e.split("/").pop()||e}function $(n){if(!n)return void 0;const e=l(n);if(!e||e==="<anonymous>"||e==="anonymous")return void 0;return e}function w(n){if(!n)return void 0;for(const e of n.split("\n")){const o=e.trim().match(/^at\s+([A-Za-z_$][\w$]*)/);if(o)return o[1]}return void 0}export function consoleWrapperDepth(n,e){const o=new Set;let u=0;while(typeof n==="function"&&n!==e&&!o.has(n)){o.add(n);try{n=Reflect.get(n,"__sentry_original__")}catch{return 0}u+=1}return n===e?u:0}export function parseOrigin(n,e,o=0){const u=w(e);let t;if(n){const s=N(n);const i=s.filter(m=>!h(m));t=i[o]}const f=$(t?.func);const c=y(t?.file);const r=t?.line;const a=c&&r!=null?`${c}:${r}`:void 0;if(!u&&!f&&!a)return void 0;return{component:u,functionName:f,callSite:a,file:c,line:r}}export function sourceKey(n,e){if(e==="off"||!n)return e==="off"?null:"\u2014unknown\u2014";if(e==="component"){return n.component??n.functionName??n.callSite??"\u2014unknown\u2014"}if(e==="function"){return n.functionName??n.callSite??n.component??"\u2014anonymous\u2014"}return n.callSite??n.functionName??"\u2014unknown\u2014"}export function sourceLabel(n,e){if(!n)return"(unknown)";if(e==="component"){if(n.component)return n.component;if(n.functionName)return`\u0192 ${n.functionName}`;return n.callSite??"(unknown)"}if(e==="function"){if(n.functionName)return n.functionName;return n.callSite??"(anonymous)"}if(e==="callsite"){if(n.functionName&&n.callSite)return`${n.functionName} \xB7 ${n.callSite}`;return n.callSite??(n.functionName?`\u0192 ${n.functionName}`:"(unknown)")}return""}function S(n){let e=0;for(let o=0;o<n.length;o++)e=e*31+n.charCodeAt(o)|0;return Math.abs(e)}export function colorForKey(n){const e=S(n)%360;return`hsl(${e}, 70%, 66%)`}export function bracketGlyph(n){switch(n){case"top":return"\u250C";case"bottom":return"\u2514";case"single":return"\u2500";default:return"\u2502"}}
@@ -1,8 +1,8 @@
1
- "use strict";import{getAccountAccess as F,hasAccountAccess as c}from"@buoy-gg/shared-ui";import*as L from"react";import{createToolStore as U,persistentStorage as u}from"@buoy-gg/shared-ui";import{sanitizeArgs as M}from"./sanitize";import{parseOrigin as P}from"../devtools/origin";const A=["log","info","warn","error","debug","trace","dir","table","assert","group","groupCollapsed","groupEnd"];const H=new Set(["error","warn","trace","assert"]);const G={error:"error",assert:"error",warn:"warning",debug:"verbose",log:"info",info:"info",trace:"info",dir:"info",table:"info",group:"info",groupCollapsed:"info",groupEnd:"info"};const B=1e3;const s=U({id:"console",max:B,order:"append",coalesce:"frame"});let m=false;let E=false;let d=false;const h={};function R(e){if(typeof e==="string")return e;if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e==="function")return`\u0192 ${e.name||"(anonymous)"}`;try{return JSON.stringify(e)}catch{return String(e)}}function K(e){return e.map(R).join(" ")}function j(e){if(!e)return void 0;return e.split("\n").slice(3).join("\n")||void 0}function J(){try{const e=Reflect.get(L,"captureOwnerStack");return typeof e==="function"?e()??void 0:void 0}catch{return void 0}}const V=8;function C(e){const t=e.split("\n").map(o=>o.trim()).filter(Boolean).map(o=>o.replace(/\s*\((?:https?:|\/).*$/,""));const n=t.slice(0,V);const r=t.length-n.length;return n.map(o=>` ${o}`).join("\n")+(r>0?`
2
- \u2026+${r} more frames`:"")}function z(e){if(!(e instanceof Error))return null;const t=e;return t.isComponentError||typeof t.componentStack==="string"?t:null}function W(e,t){const n=new Error().stack;const r=P(n,J());const o=e==="error"?z(t[0]):null;if(o){const k=y(o.name,o.message);const I=o.componentStack?`
1
+ "use strict";import{isBuoyLog as E,getAccountAccess as U,hasAccountAccess as c}from"@buoy-gg/shared-ui";import*as M from"react";import{createToolStore as P,persistentStorage as u}from"@buoy-gg/shared-ui";import{sanitizeArgs as H}from"./sanitize";import{consoleWrapperDepth as B,parseOrigin as G}from"../devtools/origin";const C=["log","info","warn","error","debug","trace","dir","table","assert","group","groupCollapsed","groupEnd"];const K=new Set(["error","warn","trace","assert"]);const j={error:"error",assert:"error",warn:"warning",debug:"verbose",log:"info",info:"info",trace:"info",dir:"info",table:"info",group:"info",groupCollapsed:"info",groupEnd:"info"};const J=1e3;const s=P({id:"console",max:J,order:"append",coalesce:"frame"});let m=false;let h=false;let d=false;const y={};function T(e){if(typeof e==="string")return e;if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e==="function")return`\u0192 ${e.name||"(anonymous)"}`;try{return JSON.stringify(e)}catch{return String(e)}}function V(e){return e.map(T).join(" ")}function W(e){if(!e)return void 0;return e.split("\n").slice(3).join("\n")||void 0}function z(){try{const e=Reflect.get(M,"captureOwnerStack");return typeof e==="function"?e()??void 0:void 0}catch{return void 0}}const Y=8;function N(e){const t=e.split("\n").map(o=>o.trim()).filter(Boolean).map(o=>o.replace(/\s*\((?:https?:|\/).*$/,""));const n=t.slice(0,Y);const r=t.length-n.length;return n.map(o=>` ${o}`).join("\n")+(r>0?`
2
+ \u2026+${r} more frames`:"")}function X(e){if(!(e instanceof Error))return null;const t=e;return t.isComponentError||typeof t.componentStack==="string"?t:null}function q(e,t,n){if(E(t))return;const r=new Error().stack;const o=G(r,z(),B(console[e],n));const i=e==="error"?X(t[0]):null;if(i){const R=S(i.name,i.message);const L=i.componentStack?`
3
3
 
4
4
  This error is located at:
5
- ${C(o.componentStack)}`:"";b({id:s.allocId(),method:"error",level:"error",args:["[RENDER ERROR]",o],message:`[RENDER ERROR] ${k}${I}`,timestamp:Date.now(),stack:o.stack,origin:r},S(`[RENDER ERROR] ${k}`));return}const a={id:s.allocId(),method:e,level:G[e],args:t,message:K(t),timestamp:Date.now(),stack:H.has(e)?j(n):void 0,origin:r};s.add(a);x();if(a.level==="error")s.flushSync()}const Y=2e3;let T="";let N=0;function y(e,t){const n=t.trim();if(e&&n.startsWith(`${e}: `))return n;return e?`${e}: ${n}`:n}function S(e){const t=Date.now();if(e===T&&t-N<Y)return true;T=e;N=t;return false}function b(e,t=false){s.add(e);x();if(!t)s.flushSync(true)}function X(e,t){const n=e instanceof Error?e:void 0;const r=t===false?"[UNCAUGHT]":"[FATAL]";const o=n?y(n.name,n.message):R(e);const a=S(`${r} ${o}`);b({id:s.allocId(),method:"error",level:"error",args:[r,e],message:`${r} ${o}`,timestamp:Date.now(),stack:n?.stack,fatal:true},a)}function q(e){const t=e.extraData?.rawStack;if(typeof t==="string"&&t.length>0)return t;if(!Array.isArray(e.stack)||e.stack.length===0)return void 0;return e.stack.map(n=>{const r=n.lineNumber!=null?`${n.file??"?"}:${n.lineNumber}:${n.column??0}`:n.file??"?";return` at ${n.methodName||"<anonymous>"} (${r})`}).join("\n")}function Q(e){const t=e.isFatal===false?"[UNCAUGHT]":"[FATAL]";const n=y(e.name??void 0,e.originalMessage??e.message??"Unknown error");const r=S(`${t} ${n}`);const o=typeof e.componentStack==="string"&&e.componentStack.trim()?`
5
+ ${N(i.componentStack)}`:"";$({id:s.allocId(),method:"error",level:"error",args:["[RENDER ERROR]",i],message:`[RENDER ERROR] ${R}${L}`,timestamp:Date.now(),stack:i.stack,origin:o},b(`[RENDER ERROR] ${R}`));return}const A={id:s.allocId(),method:e,level:j[e],args:t,message:V(t),timestamp:Date.now(),stack:K.has(e)?W(r):void 0,origin:o};s.add(A);I();if(A.level==="error")s.flushSync()}const Q=2e3;let D="";let _=0;function S(e,t){const n=t.trim();if(e&&n.startsWith(`${e}: `))return n;return e?`${e}: ${n}`:n}function b(e){const t=Date.now();if(e===D&&t-_<Q)return true;D=e;_=t;return false}function $(e,t=false){s.add(e);I();if(!t)s.flushSync(true)}function Z(e,t){const n=e instanceof Error?e:void 0;const r=t===false?"[UNCAUGHT]":"[FATAL]";const o=n?S(n.name,n.message):T(e);const i=b(`${r} ${o}`);$({id:s.allocId(),method:"error",level:"error",args:[r,e],message:`${r} ${o}`,timestamp:Date.now(),stack:n?.stack,fatal:true},i)}function ee(e){const t=e.extraData?.rawStack;if(typeof t==="string"&&t.length>0)return t;if(!Array.isArray(e.stack)||e.stack.length===0)return void 0;return e.stack.map(n=>{const r=n.lineNumber!=null?`${n.file??"?"}:${n.lineNumber}:${n.column??0}`:n.file??"?";return` at ${n.methodName||"<anonymous>"} (${r})`}).join("\n")}function te(e){const t=e.isFatal===false?"[UNCAUGHT]":"[FATAL]";const n=S(e.name??void 0,e.originalMessage??e.message??"Unknown error");const r=b(`${t} ${n}`);const o=typeof e.componentStack==="string"&&e.componentStack.trim()?`
6
6
 
7
7
  This error is located at:
8
- ${C(e.componentStack)}`:"";const a=`${t} ${n}${o}`;b({id:s.allocId(),method:"error",level:"error",args:[t,n,...o?[o.trim()]:[]],message:a,timestamp:Date.now(),stack:q(e),fatal:true},r)}function Z(){const e=globalThis.RN$registerExceptionListener;if(typeof e!=="function")return false;e(t=>{try{if(!d)Q(t)}catch{}});return true}export function installFatalErrorCapture(){if(E)return;const e=Z();const t=globalThis.ErrorUtils;if(typeof t?.setGlobalHandler!=="function"){E=e;return}E=true;const n=typeof t.getGlobalHandler==="function"?t.getGlobalHandler():void 0;t.setGlobalHandler((r,o)=>{try{if(!d)X(r,o)}catch{}if(typeof n==="function")n(r,o)})}export function installConsoleCapture(){if(F().status==="locked")return;d=false;installFatalErrorCapture();if(m)return;m=true;for(const e of A){const t=console[e];if(typeof t!=="function")continue;h[e]=t;console[e]=function n(...r){W(e,r);t.apply(console,r)}}}export function uninstallConsoleCapture(){d=true;if(!m)return;m=false;for(const e of A){const t=h[e];if(t)console[e]=t;delete h[e]}}export function subscribe(e){return s.subscribe(e)}export function getEntries(){return s.getSnapshot()}export function clearEntries(){void w();s.clear()}export function replaceEntries(e){s.set(e)}export function onClear(e){return s.onClear(e)}const D="@react_buoy_console_preserve";const $="@react_buoy_console_buffer";const ee=600;let i=false;let p=false;let l=0;let f=Promise.resolve();const v=new Set;let g=null;function _(){for(const e of v)e()}function x(){if(!i||!c())return;if(g)clearTimeout(g);g=setTimeout(O,ee)}async function O(){g=null;if(!i||!c())return;try{const e=s.getSnapshot().map(n=>({...n,args:M(n.args)}));const t=l;f=f.then(async()=>{if(t!==l||!i||!c())return;await u.setItem($,JSON.stringify(e))}).catch(()=>{});await f}catch{}}async function w(){l++;p=false;try{f=f.then(()=>u.removeItem($)).catch(()=>{});await f}catch{}}export async function initConsolePersistence(){if(p||!c())return;p=true;const e=l;try{i=await u.getItem(D)==="true"}catch{i=false}if(e!==l||!c()){p=false;return}_();if(!i){await w();return}try{const t=await u.getItem($);if(e!==l||!c()){p=false;return}if(t){const n=JSON.parse(t);if(Array.isArray(n)&&n.length){s.update(r=>[...n,...r]);s.bumpIdAbove(Math.max(...n.map(r=>r.id)))}}}catch{}}export function getPreserveLog(){return i}export function setPreserveLog(e){if(i===e)return;i=e;_();u.setItem(D,String(e)).catch(()=>{});if(e)O();else w()}export function subscribePreserveLog(e){v.add(e);return()=>{v.delete(e)}}
8
+ ${N(e.componentStack)}`:"";const i=`${t} ${n}${o}`;$({id:s.allocId(),method:"error",level:"error",args:[t,n,...o?[o.trim()]:[]],message:i,timestamp:Date.now(),stack:ee(e),fatal:true},r)}function ne(){const e=globalThis.RN$registerExceptionListener;if(typeof e!=="function")return false;e(t=>{try{if(!d)te(t)}catch{}});return true}export function installFatalErrorCapture(){if(h)return;const e=ne();const t=globalThis.ErrorUtils;if(typeof t?.setGlobalHandler!=="function"){h=e;return}h=true;const n=typeof t.getGlobalHandler==="function"?t.getGlobalHandler():void 0;t.setGlobalHandler((r,o)=>{try{if(!d)Z(r,o)}catch{}if(typeof n==="function")n(r,o)})}export function installConsoleCapture(){if(U().status==="locked")return;d=false;installFatalErrorCapture();if(m)return;m=true;for(const e of C){const t=console[e];if(typeof t!=="function")continue;y[e]=t;console[e]=function n(...r){q(e,r,n);t.apply(console,r)}}}export function uninstallConsoleCapture(){d=true;if(!m)return;m=false;for(const e of C){const t=y[e];if(t)console[e]=t;delete y[e]}}export function subscribe(e){return s.subscribe(e)}export function getEntries(){return s.getSnapshot()}export function clearEntries(){void k();s.clear()}export function replaceEntries(e){s.set(e.filter(t=>!E(t.args??[t.message])))}export function onClear(e){return s.onClear(e)}const x="@react_buoy_console_preserve";const v="@react_buoy_console_buffer";const re=600;let a=false;let p=false;let l=0;let f=Promise.resolve();const w=new Set;let g=null;function O(){for(const e of w)e()}function I(){if(!a||!c())return;if(g)clearTimeout(g);g=setTimeout(F,re)}async function F(){g=null;if(!a||!c())return;try{const e=s.getSnapshot().map(n=>({...n,args:H(n.args)}));const t=l;f=f.then(async()=>{if(t!==l||!a||!c())return;await u.setItem(v,JSON.stringify(e))}).catch(()=>{});await f}catch{}}async function k(){l++;p=false;try{f=f.then(()=>u.removeItem(v)).catch(()=>{});await f}catch{}}export async function initConsolePersistence(){if(p||!c())return;p=true;const e=l;try{a=await u.getItem(x)==="true"}catch{a=false}if(e!==l||!c()){p=false;return}O();if(!a){await k();return}try{const t=await u.getItem(v);if(e!==l||!c()){p=false;return}if(t){const n=JSON.parse(t);if(Array.isArray(n)&&n.length){s.update(r=>[...n,...r].filter(o=>!E(o.args??[o.message])));s.bumpIdAbove(Math.max(...n.map(r=>r.id)))}}}catch{}}export function getPreserveLog(){return a}export function setPreserveLog(e){if(a===e)return;a=e;O();u.setItem(x,String(e)).catch(()=>{});if(e)F();else k()}export function subscribePreserveLog(e){w.add(e);return()=>{w.delete(e)}}
@@ -9,6 +9,7 @@
9
9
  */
10
10
  import React from "react";
11
11
  interface ConsoleValueProps {
12
+ testID?: string;
12
13
  value: unknown;
13
14
  /** Force the generic (non-preview) object tree, like %O. */
14
15
  generic?: boolean;
@@ -16,6 +17,6 @@ interface ConsoleValueProps {
16
17
  depth?: number;
17
18
  }
18
19
  /** Render a single console argument / property value. */
19
- export declare function ConsoleValue({ value, depth }: ConsoleValueProps): React.JSX.Element;
20
+ export declare function ConsoleValue({ value, depth, testID }: ConsoleValueProps): React.JSX.Element;
20
21
  export {};
21
22
  //# sourceMappingURL=ConsoleValue.d.ts.map
@@ -19,8 +19,10 @@ export interface LogOrigin {
19
19
  file?: string;
20
20
  line?: number;
21
21
  }
22
+ /** Count Sentry forwarding wrappers outside our console capture function. */
23
+ export declare function consoleWrapperDepth(current: unknown, capture: unknown): number;
22
24
  /** Derive the origin of a log from its captured JS stack + React owner stack. */
23
- export declare function parseOrigin(stack?: string, ownerStack?: string): LogOrigin | undefined;
25
+ export declare function parseOrigin(stack?: string, ownerStack?: string, wrapperFrames?: number): LogOrigin | undefined;
24
26
  /**
25
27
  * Stable key used to group consecutive rows (null = ungrouped).
26
28
  *
package/lib/web/index.mjs CHANGED
@@ -1,17 +1,17 @@
1
- "use client";var ze=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var It=Object.prototype.hasOwnProperty;var jt=(e,t)=>{for(var r in t)ze(e,r,{get:t[r],enumerable:true})},De=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Rt(t))!It.call(e,o)&&o!==r&&ze(e,o,{get:()=>t[o],enumerable:!(n=Ht(t,o))||n.enumerable});return e},zt=(e,t,r)=>(De(e,t,"default"),r&&De(r,t,"default"));var Pe=(()=>{try{let e=globalThis.Capacitor;if(e&&typeof e.isNativePlatform=="function"&&e.isNativePlatform())return e.DEBUG===true}catch{}return process.env.NODE_ENV!=="production"})();typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{ConsoleIcon as We,CONSOLE_ICON_COLOR as Fe}from"@buoy-gg/shared-ui/web";import{JsModal as Dt}from"@buoy-gg/shared-ui/web";import{useCallback as fe,useState as z}from"react";import{useMemo as Pt,useSyncExternalStore as Wt}from"react";import{getAccountAccess as Ft,hasAccountAccess as _}from"@buoy-gg/shared-ui/web";import*as Vt from"react";import{createToolStore as Gt,persistentStorage as Z}from"@buoy-gg/shared-ui/web";function X(e,t=2048){return e.length<=t?e:`${e.slice(0,t)}\u2026 [${e.length-t} more]`}function ge(e,t,r){if(e===null)return null;if(typeof e=="string")return X(e);if(typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:String(e);if(typeof e>"u")return"undefined";if(typeof e=="bigint")return`${String(e)}n`;if(typeof e=="function")return`\u0192 ${e.name||"(anonymous)"}`;if(typeof e=="symbol")return e.toString();if(e instanceof Error)return{name:e.name,message:X(e.message),stack:e.stack?X(e.stack,4*1024):e.stack};if(t>=6)return Array.isArray(e)?"[Array]":"{\u2026}";let n=e;if(r.has(n))return"[Circular]";r.add(n);try{if(Array.isArray(e)){let i=e.slice(0,100).map(a=>ge(a,t+1,r));return e.length>100&&i.push(`\u2026 ${e.length-100} more`),i}let o={};for(let i of Object.keys(n).slice(0,100))try{o[i]=ge(n[i],t+1,r)}catch{o[i]="[Unserializable]"}return o}finally{r.delete(n)}}function Ve(e){let t=new WeakSet;return e.map(r=>ge(r,0,t))}var _t=/^(buoyConsoleProxy|record|cleanStack|captureOwnerStack|formatArgs|formatArg)$/,Kt=/consoleLogStore/;function Ge(e){return e.replace(/\s+\[as [^\]]+\]$/,"").replace(/^(?:async\s+)?(?:new\s+)?(?:Object|console)\./,"").trim()}function Ut(e){return e.func&&_t.test(Ge(e.func))?true:!!(e.file&&Kt.test(e.file))}function Yt(e){let t=[];for(let r of e.split(`
2
- `)){let n=r.trim();if(!n||n==="Error")continue;let o=n.match(/^at\s+(.+?)\s+\((.+?):(\d+):(\d+)\)$/);if(o){t.push({func:o[1],file:o[2],line:Number(o[3])});continue}if(o=n.match(/^at\s+(.+?):(\d+):(\d+)$/),o){t.push({file:o[1],line:Number(o[2])});continue}if(o=n.match(/^(.*?)@(.+?):(\d+):(\d+)$/),o){t.push({func:o[1]||void 0,file:o[2],line:Number(o[3])});continue}}return t}function Jt(e){if(!e)return;let t=e.split("?")[0];return t.split("/").pop()||t}function qt(e){if(!e)return;let t=Ge(e);if(!(!t||t==="<anonymous>"||t==="anonymous"))return t}function Qt(e){if(e)for(let t of e.split(`
3
- `)){let r=t.trim().match(/^at\s+([A-Za-z_$][\w$]*)/);if(r)return r[1]}}function Zt(e,t){let r=Qt(t),n;e&&(n=Yt(e).find(s=>!Ut(s)));let o=qt(n?.func),i=Jt(n?.file),a=n?.line,l=i&&a!=null?`${i}:${a}`:void 0;if(!(!r&&!o&&!l))return{component:r,functionName:o,callSite:l,file:i,line:a}}function Xt(e,t){return t==="off"||!e?t==="off"?null:"\u2014unknown\u2014":t==="component"?e.component??e.functionName??e.callSite??"\u2014unknown\u2014":t==="function"?e.functionName??e.callSite??e.component??"\u2014anonymous\u2014":e.callSite??e.functionName??"\u2014unknown\u2014"}function er(e,t){return e?t==="component"?e.component?e.component:e.functionName?`\u0192 ${e.functionName}`:e.callSite??"(unknown)":t==="function"?e.functionName?e.functionName:e.callSite??"(anonymous)":t==="callsite"?e.functionName&&e.callSite?`${e.functionName} \xB7 ${e.callSite}`:e.callSite??(e.functionName?`\u0192 ${e.functionName}`:"(unknown)"):"":"(unknown)"}function tr(e){let t=0;for(let r=0;r<e.length;r++)t=t*31+e.charCodeAt(r)|0;return Math.abs(t)}function _e(e){return`hsl(${tr(e)%360}, 70%, 66%)`}function Ke(e){switch(e){case"top":return"\u250C";case"bottom":return"\u2514";case"single":return"\u2500";default:return"\u2502"}}var Ue=["log","info","warn","error","debug","trace","dir","table","assert","group","groupCollapsed","groupEnd"],rr=new Set(["error","warn","trace","assert"]),or={error:"error",assert:"error",warn:"warning",debug:"verbose",log:"info",info:"info",trace:"info",dir:"info",table:"info",group:"info",groupCollapsed:"info",groupEnd:"info"},nr=1e3,x=Gt({id:"console",max:nr,order:"append",coalesce:"frame"}),le=false,pe=false,ae=false,me={};function Ye(e){if(typeof e=="string")return e;if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="function")return`\u0192 ${e.name||"(anonymous)"}`;try{return JSON.stringify(e)}catch{return String(e)}}function ir(e){return e.map(Ye).join(" ")}function lr(e){if(e)return e.split(`
1
+ "use client";var Fe=Object.defineProperty;var Ft=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var Gt=Object.prototype.hasOwnProperty;var Vt=(e,t)=>{for(var r in t)Fe(e,r,{get:t[r],enumerable:true})},We=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wt(t))!Gt.call(e,o)&&o!==r&&Fe(e,o,{get:()=>t[o],enumerable:!(n=Ft(t,o))||n.enumerable});return e},_t=(e,t,r)=>(We(e,t,"default"),r&&We(r,t,"default"));var Ge=(()=>{try{let e=globalThis.Capacitor;if(e&&typeof e.isNativePlatform=="function"&&e.isNativePlatform())return e.DEBUG===true}catch{}return process.env.NODE_ENV!=="production"})();typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{ConsoleIcon as Ve,CONSOLE_ICON_COLOR as _e}from"@buoy-gg/shared-ui/web";import{JsModal as Kt}from"@buoy-gg/shared-ui/web";import{useCallback as ge,useState as j}from"react";import{useMemo as Ut,useSyncExternalStore as Yt}from"react";import{isBuoyLog as pe,getAccountAccess as Jt,hasAccountAccess as _}from"@buoy-gg/shared-ui/web";import*as qt from"react";import{createToolStore as Qt,persistentStorage as X}from"@buoy-gg/shared-ui/web";function Z(e,t=2048){return e.length<=t?e:`${e.slice(0,t)}\u2026 [${e.length-t} more]`}function me(e,t,r){if(e===null)return null;if(typeof e=="string")return Z(e);if(typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:String(e);if(typeof e>"u")return"undefined";if(typeof e=="bigint")return`${String(e)}n`;if(typeof e=="function")return`\u0192 ${e.name||"(anonymous)"}`;if(typeof e=="symbol")return e.toString();if(e instanceof Error)return{name:e.name,message:Z(e.message),stack:e.stack?Z(e.stack,4*1024):e.stack};if(t>=6)return Array.isArray(e)?"[Array]":"{\u2026}";let n=e;if(r.has(n))return"[Circular]";r.add(n);try{if(Array.isArray(e)){let l=e.slice(0,100).map(a=>me(a,t+1,r));return e.length>100&&l.push(`\u2026 ${e.length-100} more`),l}let o={};for(let l of Object.keys(n).slice(0,100))try{o[l]=me(n[l],t+1,r)}catch{o[l]="[Unserializable]"}return o}finally{r.delete(n)}}function Ke(e){let t=new WeakSet;return e.map(r=>me(r,0,t))}var Xt=/^(buoyConsoleProxy|record|cleanStack|captureOwnerStack|formatArgs|formatArg)$/,Zt=/consoleLogStore/;function Ue(e){return e.replace(/\s+\[as [^\]]+\]$/,"").replace(/^(?:async\s+)?(?:new\s+)?(?:Object|console)\./,"").trim()}function er(e){return e.func&&Xt.test(Ue(e.func))?true:!!(e.file&&Zt.test(e.file))}function tr(e){let t=[];for(let r of e.split(`
2
+ `)){let n=r.trim();if(!n||n==="Error")continue;let o=n.match(/^at\s+(.+?)\s+\((.+?):(\d+):(\d+)\)$/);if(o){t.push({func:o[1],file:o[2],line:Number(o[3])});continue}if(o=n.match(/^at\s+(.+?):(\d+):(\d+)$/),o){t.push({file:o[1],line:Number(o[2])});continue}if(o=n.match(/^(.*?)@(.+?):(\d+):(\d+)$/),o){t.push({func:o[1]||void 0,file:o[2],line:Number(o[3])});continue}}return t}function rr(e){if(!e)return;let t=e.split(/\?|\/\/&/)[0];return t.split("/").pop()||t}function or(e){if(!e)return;let t=Ue(e);if(!(!t||t==="<anonymous>"||t==="anonymous"))return t}function nr(e){if(e)for(let t of e.split(`
3
+ `)){let r=t.trim().match(/^at\s+([A-Za-z_$][\w$]*)/);if(r)return r[1]}}function lr(e,t){let r=new Set,n=0;for(;typeof e=="function"&&e!==t&&!r.has(e);){r.add(e);try{e=Reflect.get(e,"__sentry_original__")}catch{return 0}n+=1}return e===t?n:0}function ir(e,t,r=0){let n=nr(t),o;e&&(o=tr(e).filter(c=>!er(c))[r]);let l=or(o?.func),a=rr(o?.file),s=o?.line,i=a&&s!=null?`${a}:${s}`:void 0;if(!(!n&&!l&&!i))return{component:n,functionName:l,callSite:i,file:a,line:s}}function ar(e,t){return t==="off"||!e?t==="off"?null:"\u2014unknown\u2014":t==="component"?e.component??e.functionName??e.callSite??"\u2014unknown\u2014":t==="function"?e.functionName??e.callSite??e.component??"\u2014anonymous\u2014":e.callSite??e.functionName??"\u2014unknown\u2014"}function sr(e,t){return e?t==="component"?e.component?e.component:e.functionName?`\u0192 ${e.functionName}`:e.callSite??"(unknown)":t==="function"?e.functionName?e.functionName:e.callSite??"(anonymous)":t==="callsite"?e.functionName&&e.callSite?`${e.functionName} \xB7 ${e.callSite}`:e.callSite??(e.functionName?`\u0192 ${e.functionName}`:"(unknown)"):"":"(unknown)"}function cr(e){let t=0;for(let r=0;r<e.length;r++)t=t*31+e.charCodeAt(r)|0;return Math.abs(t)}function Ye(e){return`hsl(${cr(e)%360}, 70%, 66%)`}function Je(e){switch(e){case"top":return"\u250C";case"bottom":return"\u2514";case"single":return"\u2500";default:return"\u2502"}}var qe=["log","info","warn","error","debug","trace","dir","table","assert","group","groupCollapsed","groupEnd"],ur=new Set(["error","warn","trace","assert"]),dr={error:"error",assert:"error",warn:"warning",debug:"verbose",log:"info",info:"info",trace:"info",dir:"info",table:"info",group:"info",groupCollapsed:"info",groupEnd:"info"},fr=1e3,x=Qt({id:"console",max:fr,order:"append",coalesce:"frame"}),ae=false,he=false,se=false,ye={};function Qe(e){if(typeof e=="string")return e;if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="function")return`\u0192 ${e.name||"(anonymous)"}`;try{return JSON.stringify(e)}catch{return String(e)}}function gr(e){return e.map(Qe).join(" ")}function pr(e){if(e)return e.split(`
4
4
  `).slice(3).join(`
5
- `)||void 0}function ar(){try{let e=Reflect.get(Vt,"captureOwnerStack");return typeof e=="function"?e()??void 0:void 0}catch{return}}var sr=8;function Je(e){let t=e.split(`
6
- `).map(o=>o.trim()).filter(Boolean).map(o=>o.replace(/\s*\((?:https?:|\/).*$/,"")),r=t.slice(0,sr),n=t.length-r.length;return r.map(o=>` ${o}`).join(`
5
+ `)||void 0}function mr(){try{let e=Reflect.get(qt,"captureOwnerStack");return typeof e=="function"?e()??void 0:void 0}catch{return}}var hr=8;function Xe(e){let t=e.split(`
6
+ `).map(o=>o.trim()).filter(Boolean).map(o=>o.replace(/\s*\((?:https?:|\/).*$/,"")),r=t.slice(0,hr),n=t.length-r.length;return r.map(o=>` ${o}`).join(`
7
7
  `)+(n>0?`
8
- \u2026+${n} more frames`:"")}function cr(e){if(!(e instanceof Error))return null;let t=e;return t.isComponentError||typeof t.componentStack=="string"?t:null}function ur(e,t){let r=new Error().stack,n=Zt(r,ar()),o=e==="error"?cr(t[0]):null;if(o){let a=he(o.name,o.message),l=o.componentStack?`
8
+ \u2026+${n} more frames`:"")}function yr(e){if(!(e instanceof Error))return null;let t=e;return t.isComponentError||typeof t.componentStack=="string"?t:null}function br(e,t,r){if(pe(t))return;let n=new Error().stack,o=ir(n,mr(),lr(console[e],r)),l=e==="error"?yr(t[0]):null;if(l){let s=be(l.name,l.message),i=l.componentStack?`
9
9
 
10
10
  This error is located at:
11
- ${Je(o.componentStack)}`:"";be({id:x.allocId(),method:"error",level:"error",args:["[RENDER ERROR]",o],message:`[RENDER ERROR] ${a}${l}`,timestamp:Date.now(),stack:o.stack,origin:n},ye(`[RENDER ERROR] ${a}`));return}let i={id:x.allocId(),method:e,level:or[e],args:t,message:ir(t),timestamp:Date.now(),stack:rr.has(e)?lr(r):void 0,origin:n};x.add(i),tt(),i.level==="error"&&x.flushSync()}var dr=2e3,qe="",Qe=0;function he(e,t){let r=t.trim();return e&&r.startsWith(`${e}: `)?r:e?`${e}: ${r}`:r}function ye(e){let t=Date.now();return e===qe&&t-Qe<dr?true:(qe=e,Qe=t,false)}function be(e,t=false){x.add(e),tt(),t||x.flushSync(true)}function fr(e,t){let r=e instanceof Error?e:void 0,n=t===false?"[UNCAUGHT]":"[FATAL]",o=r?he(r.name,r.message):Ye(e),i=ye(`${n} ${o}`);be({id:x.allocId(),method:"error",level:"error",args:[n,e],message:`${n} ${o}`,timestamp:Date.now(),stack:r?.stack,fatal:true},i)}function gr(e){let t=e.extraData?.rawStack;if(typeof t=="string"&&t.length>0)return t;if(!(!Array.isArray(e.stack)||e.stack.length===0))return e.stack.map(r=>{let n=r.lineNumber!=null?`${r.file??"?"}:${r.lineNumber}:${r.column??0}`:r.file??"?";return` at ${r.methodName||"<anonymous>"} (${n})`}).join(`
12
- `)}function pr(e){let t=e.isFatal===false?"[UNCAUGHT]":"[FATAL]",r=he(e.name??void 0,e.originalMessage??e.message??"Unknown error"),n=ye(`${t} ${r}`),o=typeof e.componentStack=="string"&&e.componentStack.trim()?`
11
+ ${Xe(l.componentStack)}`:"";we({id:x.allocId(),method:"error",level:"error",args:["[RENDER ERROR]",l],message:`[RENDER ERROR] ${s}${i}`,timestamp:Date.now(),stack:l.stack,origin:o},ve(`[RENDER ERROR] ${s}`));return}let a={id:x.allocId(),method:e,level:dr[e],args:t,message:gr(t),timestamp:Date.now(),stack:ur.has(e)?pr(n):void 0,origin:o};x.add(a),nt(),a.level==="error"&&x.flushSync()}var vr=2e3,Ze="",et=0;function be(e,t){let r=t.trim();return e&&r.startsWith(`${e}: `)?r:e?`${e}: ${r}`:r}function ve(e){let t=Date.now();return e===Ze&&t-et<vr?true:(Ze=e,et=t,false)}function we(e,t=false){x.add(e),nt(),t||x.flushSync(true)}function wr(e,t){let r=e instanceof Error?e:void 0,n=t===false?"[UNCAUGHT]":"[FATAL]",o=r?be(r.name,r.message):Qe(e),l=ve(`${n} ${o}`);we({id:x.allocId(),method:"error",level:"error",args:[n,e],message:`${n} ${o}`,timestamp:Date.now(),stack:r?.stack,fatal:true},l)}function xr(e){let t=e.extraData?.rawStack;if(typeof t=="string"&&t.length>0)return t;if(!(!Array.isArray(e.stack)||e.stack.length===0))return e.stack.map(r=>{let n=r.lineNumber!=null?`${r.file??"?"}:${r.lineNumber}:${r.column??0}`:r.file??"?";return` at ${r.methodName||"<anonymous>"} (${n})`}).join(`
12
+ `)}function kr(e){let t=e.isFatal===false?"[UNCAUGHT]":"[FATAL]",r=be(e.name??void 0,e.originalMessage??e.message??"Unknown error"),n=ve(`${t} ${r}`),o=typeof e.componentStack=="string"&&e.componentStack.trim()?`
13
13
 
14
14
  This error is located at:
15
- ${Je(e.componentStack)}`:"",i=`${t} ${r}${o}`;be({id:x.allocId(),method:"error",level:"error",args:[t,r,...o?[o.trim()]:[]],message:i,timestamp:Date.now(),stack:gr(e),fatal:true},n)}function mr(){let e=globalThis.RN$registerExceptionListener;return typeof e!="function"?false:(e(t=>{try{ae||pr(t)}catch{}}),true)}function Ze(){if(pe)return;let e=mr(),t=globalThis.ErrorUtils;if(typeof t?.setGlobalHandler!="function"){pe=e;return}pe=true;let r=typeof t.getGlobalHandler=="function"?t.getGlobalHandler():void 0;t.setGlobalHandler((n,o)=>{try{ae||fr(n,o)}catch{}typeof r=="function"&&r(n,o)})}function se(){if(Ft().status!=="locked"&&(ae=false,Ze(),!le)){le=true;for(let e of Ue){let t=console[e];typeof t=="function"&&(me[e]=t,console[e]=function(...r){ur(e,r),t.apply(console,r)})}}}function ve(){if(ae=true,!!le){le=false;for(let e of Ue){let t=me[e];t&&(console[e]=t),delete me[e]}}}function ce(e){return x.subscribe(e)}function K(){return x.getSnapshot()}function ee(){ke(),x.clear()}function hr(e){x.set(e)}function yr(e){return x.onClear(e)}var Xe="@react_buoy_console_preserve",we="@react_buoy_console_buffer",br=600,R=false,te=false,U=0,Y=Promise.resolve(),xe=new Set,ue=null;function et(){for(let e of xe)e()}function tt(){!R||!_()||(ue&&clearTimeout(ue),ue=setTimeout(rt,br))}async function rt(){if(ue=null,!(!R||!_()))try{let e=x.getSnapshot().map(r=>({...r,args:Ve(r.args)})),t=U;Y=Y.then(async()=>{t!==U||!R||!_()||await Z.setItem(we,JSON.stringify(e))}).catch(()=>{}),await Y}catch{}}async function ke(){U++,te=false;try{Y=Y.then(()=>Z.removeItem(we)).catch(()=>{}),await Y}catch{}}async function ot(){if(te||!_())return;te=true;let e=U;try{R=await Z.getItem(Xe)==="true"}catch{R=false}if(e!==U||!_()){te=false;return}if(et(),!R){await ke();return}try{let t=await Z.getItem(we);if(e!==U||!_()){te=false;return}if(t){let r=JSON.parse(t);Array.isArray(r)&&r.length&&(x.update(n=>[...r,...n]),x.bumpIdAbove(Math.max(...r.map(n=>n.id))))}}catch{}}function Se(){return R}function nt(e){R!==e&&(R=e,et(),Z.setItem(Xe,String(e)).catch(()=>{}),e?rt():ke())}function it(e){return xe.add(e),()=>{xe.delete(e)}}var Ce={verbose:true,info:true,warning:true,error:true},Te={...Ce,verbose:false},vr=/^([\w-]+):(.+)$/,wr=/^\/(.+)\/$/;function xr(e){let t=[];for(let r of e.split(/\s+/)){if(!r)continue;let n=r,o=false;n.startsWith("-")&&n.length>1&&(o=true,n=n.slice(1));let i=n.match(vr);if(i){t.push({key:i[1].toLowerCase(),text:i[2],negative:o});continue}let a=n.match(wr);if(a)try{t.push({regex:new RegExp(a[1],"im"),negative:o});continue}catch{}t.push({text:n,negative:o})}return t}function kr(e,t){return e.message.toLowerCase().includes(t.toLowerCase())}function Sr(e,t){for(let r of t)if(r.regex){if(r.regex.test(e.message)===r.negative)return false}else if(r.text&&kr(e,r.text)===r.negative)return false;return true}function Cr(e,t,r){return e.method==="groupEnd"?true:t[e.level]?Sr(e,r):false}var lt={verbose:"Verbose",info:"Info",warning:"Warnings",error:"Errors"},Ee=["verbose","info","warning","error"];function at(e,t){return Ee.every(r=>e[r]===t[r])}function Tr(e){if(at(e,Ce))return"All levels";if(at(e,Te))return"Default levels";let t=Ee.filter(r=>e[r]);return t.length===0?"Hide all":t.length===1?`${lt[t[0]]} only`:"Custom levels"}var $e=5,Er=5;function $r(e,t){for(let r of e){let n=Xt(r.entry.origin,t);r.sourceKey=n,r.originColor=n?_e(n):void 0,r.originLabel=t==="off"?void 0:er(r.entry.origin,t)}}function Ar(e){for(let t=0;t<e.length;t++){let r=e[t].sourceKey;if(r==null){e[t].bracketGlyph=void 0;continue}let n=t>0&&e[t-1].sourceKey===r,o=t<e.length-1&&e[t+1].sourceKey===r,i=!n&&!o?"single":n?o?"mid":"bottom":"top";e[t].bracketGlyph=Ke(i)}}function Lr(e,t){let r=[],n=new Map;for(let i of e){let a=i.sourceKey??"\u2014",l=n.get(a);l||(l=[],n.set(a,l),r.push(a)),l.push(i)}let o=[];for(let i of r){let a=n.get(i);for(let c of a)c.depth=0;let l=a.length>Er,s=t[i]??false;l&&(o.push({key:`cluster:${i}`,entry:a[0].entry,depth:0,repeatCount:1,isGroupHeader:false,sourceKey:i,originColor:a[0].originColor,originLabel:a[0].originLabel,clusterHeader:{key:i,count:a.length,expanded:s}}),!s)||a.forEach((c,u)=>{let w=a.length===1?"single":u===0?"top":u===a.length-1?"bottom":"mid";c.bracketGlyph=Ke(w),o.push(c)})}return o}function Or(e){let t=new Map,r=new Map;e.forEach((l,s)=>{let c=l.sourceKey;c!=null&&(t.has(c)||t.set(c,s),r.set(c,s))});let n=[...t.keys()].sort((l,s)=>t.get(l)-t.get(s)),o=new Map,i=[];for(let l of n){let s=i.findIndex(c=>c<t.get(l));s===-1&&(s=i.length<$e?i.length:$e-1,s>=i.length&&i.push(0)),o.set(l,s),i[s]=Math.max(i[s]??0,r.get(l))}let a=Math.max(1,Math.min(i.length,$e));e.forEach((l,s)=>{let c=Array.from({length:a},()=>({glyph:" "}));for(let u of n){let w=o.get(u);w>=a||s>=t.get(u)&&s<=r.get(u)&&(c[w]={glyph:l.sourceKey===u?"\u25CF":"\u2502",color:_e(u)})}l.lanes=c})}var Nr=new Set(["group","groupCollapsed"]);function Br(e,t){let{levelsMask:r,query:n,showTimestamps:o,collapsedOverrides:i}=t,a=xr(n.trim()),l=[],s={verbose:0,info:0,warning:0,error:0},c=0,u=[],w=()=>u.some(h=>h.collapsed);for(let h of e){if(s[h.level]++,h.method==="groupEnd"){u.pop();continue}let N=Nr.has(h.method),G=w();if(!Cr(h,r,a))c++;else if(!G){let $=l[l.length-1];!o&&!N&&$&&!$.isGroupHeader&&$.depth===u.length&&$.entry.method===h.method&&$.entry.message===h.message?$.repeatCount++:l.push({key:String(h.id),entry:h,depth:u.length,repeatCount:1,isGroupHeader:N,groupId:N?h.id:void 0,groupCollapsed:void 0})}if(N){let $=h.method==="groupCollapsed",F=i[h.id]??$,j=l[l.length-1];j&&j.groupId===h.id&&(j.groupCollapsed=F),u.push({id:h.id,collapsed:F||G})}}$r(l,t.groupDimension);let E=l;return t.groupDimension!=="off"&&(t.layoutMode==="cluster"?E=Lr(l,t.clusterExpanded):t.layoutMode==="swimlane"?Or(l):Ar(l)),{rows:E,hiddenCount:c,levelCounts:s,totalCount:e.length}}function st(e){let t=Wt(ce,K,K);return Pt(()=>Br(t,e),[t,e.levelsMask,e.query,e.showTimestamps,e.collapsedOverrides,e.groupDimension,e.layoutMode,e.clusterExpanded])}function ct(){let[e,t]=z(""),[r,n]=z(false),[o,i]=z({...Te}),[a,l]=z(false),[s,c]=z({}),[u,w]=z("chrono"),[E,h]=z("list"),[N,G]=z({}),{rows:$,hiddenCount:F}=st({levelsMask:o,query:e,showTimestamps:a,collapsedOverrides:s,groupDimension:"function",layoutMode:u,clusterExpanded:N}),j=fe((ne,ie)=>{c(Mt=>({...Mt,[ne]:!ie}))},[]),oe=fe(ne=>{G(ie=>({...ie,[ne]:!(ie[ne]??false)}))},[]),p=fe(()=>{ee(),c({})},[]),A=Tr(o);return{query:e,setQuery:t,searchActive:r,setSearchActive:n,levelsMask:o,setLevelsMask:i,showTimestamps:a,setShowTimestamps:l,layoutMode:u,setLayoutMode:w,view:E,setView:h,rows:$,hiddenCount:F,onToggleGroup:j,onToggleCluster:oe,clear:p,levelSummary:A,isLevelCustom:A!=="All levels"&&A!=="Default levels"}}var ut={};jt(ut,{AccessibilityInfo:()=>Ir,ActivityIndicator:()=>No,Alert:()=>Ho,Animated:()=>jr,AppRegistry:()=>Dr,AppState:()=>Pr,Appearance:()=>zr,BackHandler:()=>Wr,Button:()=>Bo,CheckBox:()=>oo,Clipboard:()=>Fr,DeviceEventEmitter:()=>vo,Dimensions:()=>Vr,Easing:()=>Gr,FlatList:()=>Ae,I18nManager:()=>_r,Image:()=>no,ImageBackground:()=>io,InteractionManager:()=>Ur,Keyboard:()=>Kr,KeyboardAvoidingView:()=>lo,LayoutAnimation:()=>Yr,Linking:()=>Jr,LogBox:()=>bo,Modal:()=>Lo,NativeEventEmitter:()=>qr,NativeModules:()=>Rr,PanResponder:()=>Qr,Picker:()=>ao,PixelRatio:()=>Zr,Platform:()=>Xr,Pressable:()=>Ao,ProgressBar:()=>so,RefreshControl:()=>co,SafeAreaView:()=>uo,ScrollView:()=>dt,SectionList:()=>fo,Share:()=>eo,StatusBar:()=>go,StyleSheet:()=>S,Switch:()=>Oo,Text:()=>d,TextInput:()=>To,Touchable:()=>po,TouchableHighlight:()=>Eo,TouchableNativeFeedback:()=>mo,TouchableOpacity:()=>T,TouchableWithoutFeedback:()=>$o,UIManager:()=>to,Vibration:()=>ro,View:()=>m,VirtualizedList:()=>ho,YellowBox:()=>yo,findNodeHandle:()=>Mo,unstable_createElement:()=>Hr,useColorScheme:()=>wo,useLocaleContext:()=>xo,useWindowDimensions:()=>ko});zt(ut,Mr);import*as Mr from"react-native-web";import{unstable_createElement as Hr,NativeModules as Rr,AccessibilityInfo as Ir,Animated as jr,Appearance as zr,AppRegistry as Dr,AppState as Pr,BackHandler as Wr,Clipboard as Fr,Dimensions as Vr,Easing as Gr,I18nManager as _r,Keyboard as Kr,InteractionManager as Ur,LayoutAnimation as Yr,Linking as Jr,NativeEventEmitter as qr,PanResponder as Qr,PixelRatio as Zr,Platform as Xr,Share as eo,StyleSheet as S,UIManager as to,Vibration as ro,CheckBox as oo,FlatList as Ae,Image as no,ImageBackground as io,KeyboardAvoidingView as lo,Picker as ao,ProgressBar as so,RefreshControl as co,SafeAreaView as uo,SectionList as fo,StatusBar as go,Touchable as po,TouchableNativeFeedback as mo,VirtualizedList as ho,YellowBox as yo,LogBox as bo,DeviceEventEmitter as vo,useColorScheme as wo,useLocaleContext as xo,useWindowDimensions as ko}from"react-native-web";import*as C from"react-native-web";import{createElement as So,forwardRef as Co}from"react";function L(e){let t=Co((n,o)=>{let{accessibilityState:i,accessibilityValue:a,...l}=n;for(let s of["busy","checked","disabled","expanded","selected"])i?.[s]!==void 0&&l[`aria-${s}`]===void 0&&(l[`aria-${s}`]=i[s]);for(let[s,c]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))a?.[s]!==void 0&&l[`aria-${c}`]===void 0&&(l[`aria-${c}`]=a[s]);return So(e,{...l,ref:o})}),r=e.State;return r&&Object.assign(t,{State:r}),t.displayName=e.displayName??e.name??"NativeWebView",t}var m=L(C.View),d=L(C.Text),To=L(C.TextInput),T=L(C.TouchableOpacity),Eo=L(C.TouchableHighlight),$o=L(C.TouchableWithoutFeedback),Ao=L(C.Pressable),dt=L(C.ScrollView),Lo=L(C.Modal),Oo=L(C.Switch),No=L(C.ActivityIndicator),Bo=L(C.Button),Mo=C.findNodeHandle,Ho={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 i=document.createElement("h2");if(i.textContent=e,i.style.cssText="font-size:18px;margin:0 0 12px",o.appendChild(i),t){let c=document.createElement("p");c.textContent=t,c.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",o.appendChild(c)}let a=document.createElement("div");a.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let l=r?.length?r:[{text:"OK"}],s=()=>{o.close?.(),o.remove()};for(let c of l){let u=document.createElement("button");u.type="button",u.textContent=c.text??"OK",u.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${c.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,u.onclick=()=>{s(),c.onPress?.()},a.appendChild(u)}o.addEventListener("cancel",c=>{c.preventDefault(),n?.cancelable!==false&&(s(),n?.onDismiss?.())}),o.appendChild(a),document.body.appendChild(o),o.showModal?o.showModal():o.setAttribute("open","")}};import{ModalHeader as D,TabSelector as Ro,night as M,Search as Io,Filter as jo,Trash2 as zo}from"@buoy-gg/shared-ui/web";import{jsx as O,jsxs as Le}from"react/jsx-runtime";var Do=[{key:"chrono",label:"Timeline"},{key:"cluster",label:"Grouped"}];function ft({c:e,onBack:t}){if(e.view==="filters")return Le(D,{children:[O(D.Navigation,{onBack:()=>e.setView("list")}),O(D.Content,{title:"Filters"})]});let r=e.rows.length>0;return Le(D,{children:[t?O(D.Navigation,{onBack:t}):null,O(D.Content,{title:"",noMargin:true,children:e.searchActive?O(D.Search,{value:e.query,onChangeText:e.setQuery,onCancel:()=>e.setQuery(""),clearOnlyWhenText:true,placeholder:"Filter logs\u2026 /regex/ -exclude",iconSize:14,inputProps:{onSubmitEditing:()=>e.setSearchActive(false)}}):O(Ro,{tabs:Do,activeTab:e.layoutMode,onTabChange:n=>e.setLayoutMode(n)})}),Le(D.Actions,{children:[O(T,{onPress:()=>e.setSearchActive(n=>!n),style:[J.actionBtn,e.searchActive&&J.actionBtnActive],accessibilityLabel:"Search logs",children:O(Io,{size:14,color:e.searchActive?M.color.accent:M.color.textSecondary})}),O(T,{onPress:()=>e.setView("filters"),style:[J.actionBtn,e.isLevelCustom&&J.actionBtnActive],accessibilityLabel:"Filters",children:O(jo,{size:14,color:e.isLevelCustom?M.color.accent:M.color.textSecondary})}),O(T,{onPress:e.clear,disabled:!r,style:[J.actionBtn,!r&&J.actionBtnDisabled],accessibilityLabel:"Clear console",children:O(zo,{size:14,color:r?M.color.textSecondary:M.color.textTertiary})})]})]})}var J=S.create({actionBtn:{width:32,height:32,borderRadius:8,backgroundColor:M.color.buttonSurface,borderWidth:1,borderColor:M.color.border,alignItems:"center",justifyContent:"center"},actionBtnActive:{backgroundColor:M.color.accentSoft,borderColor:M.color.accentBorderStrong},actionBtnDisabled:{opacity:.55}});import{useCallback as Po,useRef as gt,useSyncExternalStore as Wo}from"react";import{night as I,Check as Fo,LOG_LIST_PRESET as Vo}from"@buoy-gg/shared-ui/web";import{memo as Go}from"react";import{useState as _o}from"react";import{monoFont as P,night as re}from"@buoy-gg/shared-ui/web";var Ko={baseContainer:"#0A0A0C",surfaceError:"rgba(255,69,58,0.15)",surfaceYellow:"rgba(255,235,59,0.13)",divider:re.color.fillTertiary,inputBackground:re.color.surfaceElevated,menuBackground:re.color.surface,onSurface:re.color.text,onSurfaceYellow:"#FFE9A3",onErrorContainer:"#FFB4AB",tokenSubtle:re.color.textSecondary,primary:"#40CCFF",valueNumber:"#FF9F1C",valueString:"#7EE787",valueBigint:"#A1A1A6",valueNode:"#F5F5F7",valueNullish:"#8E8E93",valuePreview:"#A1A1A6"},g=Ko,Uo={black:"#000",red:"rgb(237 78 76)",green:"rgb(1 200 1)",yellow:"rgb(210 192 87)",blue:"rgb(39 116 240)",magenta:"rgb(161 66 244)",cyan:"rgb(18 181 203)",gray:"rgb(207 208 208)",darkgray:"rgb(137 137 137)",lightred:"rgb(242 139 130)",lightgreen:"rgb(161 247 181)",lightyellow:"rgb(221 251 85)",lightblue:"rgb(102 157 246)",lightmagenta:"rgb(214 112 214)",lightcyan:"rgb(132 240 255)",white:"#fff"},pt={verbose:{text:g.tokenSubtle},info:{text:g.onSurface},warning:{background:g.surfaceYellow,text:g.onSurfaceYellow,icon:"warning"},error:{background:g.surfaceError,text:g.onErrorContainer,icon:"error"}};var mt=["black","red","green","yellow","blue","magenta","cyan","gray"],ht=["darkgray","lightred","lightgreen","lightyellow","lightblue","lightmagenta","lightcyan","white"];function yt(e){if(typeof e=="string")return e;if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(typeof e=="function")return`\u0192 ${e.name||"(anonymous)"}`;try{return JSON.stringify(e)}catch{return String(e)}}var Oe=/%([%_Oocsdfi])|\x1B\[([\d;]*)m/;function Yo(e){return Oe.test(e)}function bt(e){let t={},r=false;for(let n of e.split(";")){let o=n.indexOf(":");if(o===-1)continue;let i=n.slice(0,o).trim().toLowerCase(),a=n.slice(o+1).trim();if(!a)continue;let l=a.match(/var\(--console-color-([a-z]+)\)/);switch(l&&(a=Uo[l[1]]??a),i){case"color":t.color=a,r=true;break;case"background-color":case"background":t.backgroundColor=a,r=true;break;case"font-weight":t.fontWeight=a==="lighter"?"300":a,r=true;break;case"font-style":a==="italic"&&(t.fontStyle="italic",r=true);break;case"font-size":{let s=parseFloat(a);Number.isNaN(s)||(t.fontSize=s,r=true);break}case"text-decoration":case"text-decoration-line":a.includes("underline")&&a.includes("line-through")?t.textDecorationLine="underline line-through":a.includes("underline")?t.textDecorationLine="underline":a.includes("line-through")&&(t.textDecorationLine="line-through"),r=true;break;default:break}}return r?t:void 0}function Jo(e,t){let r=o=>{let i=t.get("text-decoration")??"";i.includes(o)||t.set("text-decoration",`${i} ${o}`)},n=o=>{let i=t.get("text-decoration")?.replace(` ${o}`,"");i?t.set("text-decoration",i):t.delete("text-decoration")};for(;e.length;){let o=e.shift();switch(o){case 0:t.clear();break;case 1:t.set("font-weight","bold");break;case 2:t.set("font-weight","lighter");break;case 3:t.set("font-style","italic");break;case 4:r("underline");break;case 9:r("line-through");break;case 22:t.delete("font-weight");break;case 23:t.delete("font-style");break;case 24:n("underline");break;case 29:n("line-through");break;case 38:case 48:if(e.shift()===2){let i=e.shift()??0,a=e.shift()??0,l=e.shift()??0;t.set(o===38?"color":"background-color",`rgb(${i},${a},${l})`)}break;case 39:case 49:t.delete(o===39?"color":"background-color");break;default:{let i=mt[o-30]??ht[o-90];if(i!==void 0)t.set("color",`var(--console-color-${i})`);else{let a=mt[o-40]??ht[o-100];a!==void 0&&t.set("background-color",`var(--console-color-${a})`)}break}}}}function qo(e,t){let r=e,n=[],o=new Map,i,a=s=>{if(!s)return;let c=n[n.length-1];if(c&&c.type==="string"&&Qo(c.style,i)){c.value+=s;return}n.push({type:"string",value:s,style:i})},l=0;for(let s=Oe.exec(r);s!==null;s=Oe.exec(r)){a(s.input.substring(0,s.index));let c,u=s[1];switch(u){case"%":a("%"),c="";break;case"s":l<t.length&&(c=yt(t[l++]));break;case"c":l<t.length&&(i=bt(yt(t[l++])),c="");break;case"o":case"O":l<t.length&&(n.push({type:"value",value:t[l++],mode:u==="O"?"generic":"optimal"}),c="");break;case"_":l<t.length&&(l++,c="");break;case"d":case"f":case"i":{if(l<t.length){let w=t[l++],E=typeof w!="number"?NaN:w;u!=="f"&&(E=Math.floor(E)),c=E}break}case void 0:{let w=(s[2]||"0").split(";").map(h=>h?parseInt(h,10):0);Jo(w,o);let E=[...o.entries()].map(([h,N])=>`${h}:${N.trimStart()}`).join(";");i=bt(E),c="";break}}c===void 0&&(a(s[0]),c=""),r=c+s.input.substring(s.index+s[0].length)}return a(r),{tokens:n,rest:t.slice(l)}}function Qo(e,t){return e===t?true:!e||!t?false:JSON.stringify(e)===JSON.stringify(t)}function Zo(e){if(e.length===0)return[];let t=[],r=e;if(typeof e[0]=="string"&&Yo(e[0])){let n=qo(e[0],e.slice(1));t=n.tokens,r=n.rest}for(let n of r)t.length>0&&t.push({type:"string",value:" "}),typeof n=="string"?t.push({type:"string",value:n}):t.push({type:"value",value:n,mode:"optimal"});return t}import{useState as Xo}from"react";import{jsx as B,jsxs as q}from"react/jsx-runtime";var vt=5,wt=6;function Ne(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(e instanceof Error)return"error";let t=typeof e;return t==="number"?"number":t==="bigint"?"bigint":t==="boolean"?"boolean":t==="string"?"string":t==="function"?"function":t==="symbol"?"symbol":"object"}var en={number:g.valueNumber,bigint:g.valueBigint,boolean:g.valueNumber,string:g.valueString,null:g.valueNullish,undefined:g.valueNullish,symbol:g.valueString,function:g.valueNode};function xt(e){if(Array.isArray(e))return"";let t=Object.getPrototypeOf(e);if(!t)return"Object";let r=t.constructor?.name;return!r||r==="Object"?"":r}function Be(e){switch(Ne(e)){case"string":return`'${e}'`;case"function":return`\u0192 ${e.name||""}`.trimEnd();case"symbol":return e.toString();case"bigint":return`${String(e)}n`;case"array":return`Array(${e.length})`;case"error":return e.name;case"object":{let t=xt(e);return t?`${t} {\u2026}`:"{\u2026}"}default:return String(e)}}function tn(e){if(Array.isArray(e)){let i=e.slice(0,wt).map(l=>Be(l)).join(", "),a=e.length>wt?", \u2026":"";return`(${e.length}) [${i}${a}]`}let t=Object.entries(e),r=t.slice(0,vt).map(([i,a])=>`${i}: ${Be(a)}`).join(", "),n=t.length>vt?", \u2026":"",o=xt(e);return`${o?`${o} `:""}{${r}${n}}`}function rn(e){let t=Ne(e);return t==="array"?e.length>0:t==="object"?Object.keys(e).length>0:t==="error"}var kt=({open:e})=>B(d,{style:[b.triangle,e&&b.triangleOpen],children:"\u25B6"});function Me({value:e,depth:t=0}){let[r,n]=Xo(false),o=Ne(e);if(o==="error"){let l=e,s=`${l.name}: ${l.message}`.split(`
16
- `)[0],c=l.stack&&l.stack.trim()!==s.trim()?l.stack:void 0;return c?q(m,{style:b.objectContainer,children:[q(T,{style:b.objectHeader,activeOpacity:.6,onPress:()=>n(u=>!u),children:[B(kt,{open:r}),B(d,{style:[b.mono,b.errorHead],numberOfLines:r?void 0:1,children:s})]}),r?B(d,{style:[b.mono,b.errorStack],children:c}):null]}):B(d,{style:[b.mono,{color:g.onErrorContainer}],numberOfLines:1,children:s})}if(!rn(e)){let l=en[o]??g.onSurface;return B(d,{style:[b.mono,{color:l}],children:Be(e)})}let i=e,a=Array.isArray(i)?i.map((l,s)=>[String(s),l]):Object.entries(i);return q(m,{style:b.objectContainer,children:[q(T,{onPress:()=>n(l=>!l),activeOpacity:.6,style:b.objectHeader,children:[B(kt,{open:r}),B(d,{style:[b.mono,b.preview],numberOfLines:r?void 0:1,children:tn(i)})]}),r&&t<6?B(m,{style:b.children,children:a.map(([l,s])=>q(m,{style:b.propertyRow,children:[q(d,{style:[b.mono,b.propertyKey],children:[l,":"]}),B(m,{style:b.propertyValue,children:B(Me,{value:s,depth:t+1})})]},l))}):null]})}var on={fontFamily:P,fontSize:12,lineHeight:16},b=S.create({mono:on,objectContainer:{flexDirection:"column"},objectHeader:{flexDirection:"row",alignItems:"flex-start"},triangle:{color:g.tokenSubtle,fontSize:8,lineHeight:16,width:12},triangleOpen:{transform:[{rotate:"90deg"}]},preview:{color:g.valuePreview,fontStyle:"italic",flexShrink:1},errorHead:{color:g.onErrorContainer,flexShrink:1},errorStack:{color:g.tokenSubtle,marginLeft:14,marginTop:1},children:{marginLeft:14,flexDirection:"column"},propertyRow:{flexDirection:"row",alignItems:"flex-start"},propertyKey:{color:g.valueNode,marginRight:6},propertyValue:{flexShrink:1}});import{jsx as y,jsxs as Q}from"react/jsx-runtime";function nn(e){let t=new Date(e),r=(n,o=2)=>String(n).padStart(o,"0");return`${r(t.getHours())}:${r(t.getMinutes())}:${r(t.getSeconds())}.${r(t.getMilliseconds(),3)}`}function ln({icon:e,color:t}){return y(d,{style:[f.levelIcon,{color:t}],children:e==="warning"?"\u26A0":"\u2298"})}function an({count:e,color:t}){return y(m,{style:[f.repeatBadge,{borderColor:t}],children:y(d,{style:[f.repeatBadgeText,{color:t}],children:e})})}var St=Go(function({row:e,showTimestamps:t,onToggleGroup:r,onToggleCluster:n}){let{entry:o}=e,i=pt[o.level],a=o.level==="error"||o.level==="warning",l=i.text,[s,c]=_o(o.method==="trace");if(e.clusterHeader){let p=e.clusterHeader;return y(T,{style:[f.wrapper,f.dividerTop],activeOpacity:.7,onPress:()=>n(p.key),children:Q(m,{style:f.rowWrapper,children:[y(d,{style:[f.originGutter,{color:e.originColor}],children:p.expanded?"\u25BC":"\u25B6"}),y(m,{style:f.messageColumn,children:Q(m,{style:f.messageLine,children:[y(d,{style:[f.text,f.clusterTitle,{color:e.originColor}],children:e.originLabel}),Q(d,{style:f.clusterCount,children:[" \xB7 ",p.count," logs"]})]})})]})})}let u=Zo(o.args),w=!!o.stack&&(a||o.method==="trace"),E=y(m,{style:[f.contentWrap,!s&&f.contentWrapClamped],children:u.map((p,A)=>p.type==="string"?y(d,{style:[f.text,{color:l},e.isGroupHeader&&f.groupTitle,p.style],children:p.value},A):y(Me,{value:p.value,generic:p.mode==="generic"},A))}),h=Q(m,{style:f.messageColumn,children:[e.originLabel?y(d,{style:[f.originLabel,{color:e.originColor}],numberOfLines:1,children:e.originLabel}):null,Q(m,{style:f.messageLine,children:[e.isGroupHeader?y(d,{style:[f.groupTriangle,{color:l}],children:e.groupCollapsed?"\u25B6":"\u25BC"}):null,i.icon?y(ln,{icon:i.icon,color:l}):null,t?y(d,{style:f.timestamp,children:nn(o.timestamp)}):null,w?y(d,{style:[f.stackTriangle,{color:l}],children:s?"\u25BC":"\u25B6"}):null,E,e.repeatCount>1?y(an,{count:e.repeatCount,color:l}):null]}),w&&s?y(m,{style:f.stackTrace,children:(o.stack??"").split(`
17
- `).filter(p=>p.trim()).map((p,A)=>y(d,{style:f.stackFrame,children:p.trim()},A))}):null]}),N=[f.wrapper,i.background?{backgroundColor:i.background}:f.dividerTop],G=Array.from({length:e.depth},(p,A)=>y(m,{style:f.nestingMarker},A)),$=e.lanes?y(m,{style:f.laneGutter,children:e.lanes.map((p,A)=>y(d,{style:[f.laneCell,p.color?{color:p.color}:null],children:p.glyph},A))}):e.bracketGlyph?y(d,{style:[f.originGutter,{color:e.originColor}],children:e.bracketGlyph}):null,F=Q(m,{style:f.rowWrapper,children:[$,G,h]}),j=`buoy-console-row-${o.id}`,oe=[e.originLabel,u.find(p=>p.type==="string")?.value].filter(Boolean).join(" \u2014 ").slice(0,80);if(e.isGroupHeader&&e.groupId!==void 0){let p=e.groupId;return y(T,{style:N,activeOpacity:.7,onPress:()=>r(p,!!e.groupCollapsed),testID:j,accessibilityLabel:oe||"Console group",children:F})}return y(T,{style:N,activeOpacity:.7,onPress:()=>c(p=>!p),testID:j,accessibilityLabel:oe||"Console message",children:F})},(e,t)=>e.row.key===t.row.key&&e.row.lanes===t.row.lanes&&e.row.repeatCount===t.row.repeatCount&&e.row.groupCollapsed===t.row.groupCollapsed&&e.row.depth===t.row.depth&&e.row.bracketGlyph===t.row.bracketGlyph&&e.row.originLabel===t.row.originLabel&&e.row.clusterHeader?.count===t.row.clusterHeader?.count&&e.row.clusterHeader?.expanded===t.row.clusterHeader?.expanded&&e.showTimestamps===t.showTimestamps&&e.onToggleGroup===t.onToggleGroup&&e.onToggleCluster===t.onToggleCluster),f=S.create({wrapper:{paddingVertical:2,paddingRight:8,minHeight:18},dividerTop:{borderTopWidth:S.hairlineWidth,borderTopColor:g.divider},rowWrapper:{flexDirection:"row",alignItems:"flex-start"},originGutter:{width:11,fontFamily:P,fontSize:13,lineHeight:18,textAlign:"center"},laneGutter:{flexDirection:"row"},laneCell:{width:9,fontFamily:P,fontSize:13,lineHeight:18,textAlign:"center"},originLabel:{fontFamily:P,fontSize:10,lineHeight:16,marginBottom:1,opacity:.9},nestingMarker:{width:14,alignSelf:"stretch",borderRightWidth:S.hairlineWidth,borderRightColor:g.divider,marginLeft:2},messageColumn:{flex:1,flexDirection:"column",paddingLeft:6},messageLine:{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-start"},contentWrap:{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-start",flexShrink:1},contentWrapClamped:{flexWrap:"nowrap",overflow:"hidden",maxHeight:16},text:{fontFamily:P,fontSize:12,lineHeight:16},groupTitle:{fontWeight:"bold"},clusterTitle:{fontWeight:"600"},clusterCount:{color:g.tokenSubtle,fontFamily:P,fontSize:12,lineHeight:16},groupTriangle:{fontSize:9,lineHeight:16,marginRight:4},stackTriangle:{fontSize:8,lineHeight:16,marginRight:4},levelIcon:{fontSize:12,lineHeight:16,marginRight:5},timestamp:{color:g.tokenSubtle,fontFamily:P,fontSize:11,lineHeight:16,marginRight:6},repeatBadge:{borderWidth:1,borderRadius:9,paddingHorizontal:5,minWidth:16,alignItems:"center",justifyContent:"center",marginLeft:6,marginTop:1},repeatBadgeText:{fontSize:10,fontWeight:"700",lineHeight:14},stackTrace:{marginTop:2,marginLeft:12},stackFrame:{color:g.tokenSubtle,fontFamily:P,fontSize:11,lineHeight:15}});import{jsx as v,jsxs as He}from"react/jsx-runtime";function Ct({c:e}){return e.view==="filters"?v(cn,{c:e}):v(sn,{c:e})}function sn({c:e}){let t=gt(null),r=gt(true),n=Po(({item:o})=>v(St,{row:o,showTimestamps:e.showTimestamps,onToggleGroup:e.onToggleGroup,onToggleCluster:e.onToggleCluster}),[e.showTimestamps,e.onToggleGroup,e.onToggleCluster]);return v(Ae,{ref:t,data:e.rows,keyExtractor:o=>o.key,renderItem:n,style:k.list,...Vo,onContentSizeChange:()=>{r.current&&t.current?.scrollToEnd({animated:false})},onScroll:o=>{let{contentOffset:i,contentSize:a,layoutMeasurement:l}=o.nativeEvent,s=a.height-(i.y+l.height);r.current=s<40},scrollEventThrottle:100})}function Re({on:e,label:t,subtext:r,onPress:n}){return He(T,{style:k.row,onPress:n,activeOpacity:.7,children:[v(m,{style:[k.checkbox,e&&k.checkboxOn],children:e?v(Fo,{size:12,color:I.color.onAccent,strokeWidth:3}):null}),He(m,{style:k.rowTextCol,children:[v(d,{style:k.rowLabel,children:t}),r?v(d,{style:k.rowSubtext,children:r}):null]})]})}function Tt({text:e}){return v(d,{style:k.sectionLabel,children:e})}function cn({c:e}){let t=Wo(it,Se,Se),r=n=>e.setLevelsMask({...e.levelsMask,[n]:!e.levelsMask[n]});return He(dt,{style:k.subView,contentContainerStyle:k.subViewContent,children:[v(Tt,{text:"Log levels"}),v(T,{style:k.presetRow,onPress:()=>e.setLevelsMask({...Te}),children:v(d,{style:k.presetText,children:"Default (hide verbose)"})}),v(T,{style:k.presetRow,onPress:()=>e.setLevelsMask({...Ce}),children:v(d,{style:k.presetText,children:"All levels"})}),Ee.map(n=>v(Re,{on:e.levelsMask[n],label:lt[n],onPress:()=>r(n)},n)),v(m,{style:k.divider}),v(Tt,{text:"Settings"}),v(Re,{on:e.showTimestamps,label:"Show timestamps",onPress:()=>e.setShowTimestamps(n=>!n)}),v(Re,{on:t,label:"Preserve log",subtext:"Do not clear log on reload",onPress:()=>nt(!t)})]})}var k=S.create({list:{flex:1,backgroundColor:"transparent"},subView:{flex:1,backgroundColor:"transparent"},subViewContent:{padding:12},sectionLabel:{color:I.color.textTertiary,fontSize:11,textTransform:"uppercase",letterSpacing:.5,marginTop:4,marginBottom:4,paddingHorizontal:8},presetRow:{paddingVertical:10,paddingHorizontal:8},presetText:{color:I.color.accent,fontSize:14,fontWeight:"600"},divider:{height:S.hairlineWidth,backgroundColor:I.color.border,marginVertical:6},row:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:8,gap:12},rowTextCol:{flexDirection:"column",flex:1},rowLabel:{color:I.color.text,fontSize:14},rowSubtext:{color:I.color.textTertiary,fontSize:12,marginTop:1},checkbox:{width:18,height:18,borderRadius:4,borderWidth:1,borderColor:I.color.fillTertiary,alignItems:"center",justifyContent:"center"},checkboxOn:{backgroundColor:I.color.accent,borderColor:I.color.accent}});import{jsx as Ie}from"react/jsx-runtime";function Et({visible:e,onClose:t,onBack:r,onMinimize:n,persistenceKey:o}){let i=ct();return Ie(Dt,{visible:e,onClose:t,onMinimize:n,persistenceKey:o,header:{showToggleButton:true,customContent:Ie(ft,{c:i,onBack:r})},enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:Ie(Ct,{c:i})})}import{createToolFactory as un,defineToolPreset as dn}from"@buoy-gg/shared-ui/web";import{jsx as fn}from"react/jsx-runtime";var $t=globalThis,gn=typeof $t.ErrorUtils?.setGlobalHandler=="function"||typeof $t.RN$registerExceptionListener=="function";gn&&typeof Pe<"u"&&Pe&&se();var At=dn({id:"console",name:"CONSOLE",description:"Captured console.* output",slot:"both",color:Fe,icon:({size:e})=>fn(We,{size:e}),component:Et}),pn=un(At);import{useEffect as mn}from"react";import{getAccountAccess as hn,subscribeAccountAccess as yn}from"@buoy-gg/shared-ui/web";var Lt=0;function bn(){return mn(()=>{++Lt;let e=true,t=()=>{if(!e)return;let n=hn();if(n.status==="locked"){ve(),ee();return}se(),n.status==="admitted"&&ot()},r=yn(t);return t(),()=>{e=false,r(),--Lt===0&&ve()}},[]),null}import{macOSColors as vn,windowDragProps as wn}from"@buoy-gg/shared-ui/web";import{jsx as je,jsxs as xn}from"react/jsx-runtime";function kn(){let e=ct();return xn(m,{style:Ot.container,children:[je(m,{style:Ot.headerBar,...wn,children:je(ft,{c:e})}),je(Ct,{c:e})]})}var Ot=S.create({container:{flex:1,backgroundColor:"transparent"},headerBar:{paddingHorizontal:12,paddingVertical:8,backgroundColor:"transparent",borderBottomWidth:S.hairlineWidth,borderBottomColor:vn.border.default}});import{useSyncExternalStore as Sn,useEffect as Cn}from"react";function Nt(){return Cn(()=>{se()},[]),{logs:Sn(ce,K,K)}}import{night as W,ToolEmptyState as Tn,monoFont as En}from"@buoy-gg/shared-ui/web";import{jsx as V,jsxs as de}from"react/jsx-runtime";var Bt={verbose:"#9b9b9b",info:W.color.text,warning:"#e2c08d",error:"#f48771"};function $n(e){let t=new Date(e),r=(n,o=2)=>String(n).padStart(o,"0");return`${r(t.getHours())}:${r(t.getMinutes())}:${r(t.getSeconds())}.${r(t.getMilliseconds(),3)}`}function An(){let{logs:e}=Nt(),t=({item:r})=>de(m,{style:H.row,children:[V(d,{style:H.time,children:$n(r.timestamp)}),V(d,{style:[H.level,{color:Bt[r.level]}],children:r.level.toUpperCase()}),V(d,{style:[H.message,{color:Bt[r.level]}],numberOfLines:3,children:r.message})]});return de(m,{style:H.container,children:[de(m,{style:H.header,children:[de(d,{style:H.headerTitle,children:["Console (",e.length,")"]}),V(T,{onPress:()=>ee(),style:H.clearButton,children:V(d,{style:H.clearText,children:"Clear"})})]}),V(Ae,{data:e,keyExtractor:r=>String(r.id),renderItem:t,ListEmptyComponent:V(Tn,{testID:"buoy-console-empty",otto:"printing",title:"No console logs captured yet",message:"console.log, .warn and .error from your app land here as they run."}),contentContainerStyle:e.length===0?H.emptyContainer:void 0})]})}var H=S.create({container:{flex:1,backgroundColor:"transparent"},header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:8,borderBottomWidth:S.hairlineWidth,borderBottomColor:W.color.border},headerTitle:{color:W.color.text,fontSize:13,fontWeight:"600"},clearButton:{paddingHorizontal:10,paddingVertical:4,borderRadius:4,backgroundColor:W.color.surfaceElevated},clearText:{color:W.color.text,fontSize:12},row:{flexDirection:"row",paddingHorizontal:12,paddingVertical:4,borderBottomWidth:S.hairlineWidth,borderBottomColor:W.color.separator,gap:8},time:{color:W.color.textTertiary,fontSize:11,fontVariant:["tabular-nums"],minWidth:86},level:{fontSize:11,fontWeight:"700",minWidth:44},message:{flex:1,fontSize:12,fontFamily:En},empty:{color:W.color.textTertiary,fontSize:13,textAlign:"center"},emptyContainer:{flexGrow:1,alignItems:"center",justifyContent:"center"}});import{createSyncAdapter as Ln,memoByIdentity as On,newestFitting as Nn,sizeOrStub as Bn}from"@buoy-gg/shared-ui/web";var Mn=1.5*1024*1024,Hn=16*1024,Rn=Object.freeze({__buoyTruncated:true,note:"Log payload omitted \u2014 inspect it on-device."}),In=On(e=>{let t={...e,args:Ve(e.args),message:X(e.message),stack:e.stack?X(e.stack,4096):e.stack};return Bn(t,Hn,()=>({...t,args:[Rn]}))});function jn(e){return Nn(e,{toWire:In,budget:Mn,baseBytes:16})}var zn=Ln({version:1,getSnapshot(){return{entries:jn(K())}},subscribe(e){return ce(e)},actions:{clearEntries(){return ee(),{cleared:true}}}});export{Fe as CONSOLE_ICON_COLOR,We as ConsoleIcon,An as ConsoleLogList,St as ConsoleMessageRow,Et as ConsoleModal,bn as ConsoleRoot,Me as ConsoleValue,kn as ConsoleView,ee as clearEntries,zn as consoleSyncAdapter,g as consoleTheme,At as consoleToolPreset,pn as createConsoleTool,K as getEntries,Se as getPreserveLog,ot as initConsolePersistence,se as installConsoleCapture,Ze as installFatalErrorCapture,pt as levelStyles,yr as onClear,hr as replaceEntries,nt as setPreserveLog,ce as subscribe,it as subscribePreserveLog,ve as uninstallConsoleCapture,Nt as useConsoleLogs,st as useConsoleMessages};
15
+ ${Xe(e.componentStack)}`:"",l=`${t} ${r}${o}`;we({id:x.allocId(),method:"error",level:"error",args:[t,r,...o?[o.trim()]:[]],message:l,timestamp:Date.now(),stack:xr(e),fatal:true},n)}function Cr(){let e=globalThis.RN$registerExceptionListener;return typeof e!="function"?false:(e(t=>{try{se||kr(t)}catch{}}),true)}function tt(){if(he)return;let e=Cr(),t=globalThis.ErrorUtils;if(typeof t?.setGlobalHandler!="function"){he=e;return}he=true;let r=typeof t.getGlobalHandler=="function"?t.getGlobalHandler():void 0;t.setGlobalHandler((n,o)=>{try{se||wr(n,o)}catch{}typeof r=="function"&&r(n,o)})}function ce(){if(Jt().status!=="locked"&&(se=false,tt(),!ae)){ae=true;for(let e of qe){let t=console[e];typeof t=="function"&&(ye[e]=t,console[e]=function r(...n){br(e,n,r),t.apply(console,n)})}}}function xe(){if(se=true,!!ae){ae=false;for(let e of qe){let t=ye[e];t&&(console[e]=t),delete ye[e]}}}function ue(e){return x.subscribe(e)}function K(){return x.getSnapshot()}function ee(){Se(),x.clear()}function Sr(e){x.set(e.filter(t=>!pe(t.args??[t.message])))}function Er(e){return x.onClear(e)}var rt="@react_buoy_console_preserve",ke="@react_buoy_console_buffer",Tr=600,M=false,te=false,U=0,Y=Promise.resolve(),Ce=new Set,de=null;function ot(){for(let e of Ce)e()}function nt(){!M||!_()||(de&&clearTimeout(de),de=setTimeout(lt,Tr))}async function lt(){if(de=null,!(!M||!_()))try{let e=x.getSnapshot().map(r=>({...r,args:Ke(r.args)})),t=U;Y=Y.then(async()=>{t!==U||!M||!_()||await X.setItem(ke,JSON.stringify(e))}).catch(()=>{}),await Y}catch{}}async function Se(){U++,te=false;try{Y=Y.then(()=>X.removeItem(ke)).catch(()=>{}),await Y}catch{}}async function it(){if(te||!_())return;te=true;let e=U;try{M=await X.getItem(rt)==="true"}catch{M=false}if(e!==U||!_()){te=false;return}if(ot(),!M){await Se();return}try{let t=await X.getItem(ke);if(e!==U||!_()){te=false;return}if(t){let r=JSON.parse(t);Array.isArray(r)&&r.length&&(x.update(n=>[...r,...n].filter(o=>!pe(o.args??[o.message]))),x.bumpIdAbove(Math.max(...r.map(n=>n.id))))}}catch{}}function Ee(){return M}function at(e){M!==e&&(M=e,ot(),X.setItem(rt,String(e)).catch(()=>{}),e?lt():Se())}function st(e){return Ce.add(e),()=>{Ce.delete(e)}}var Te={verbose:true,info:true,warning:true,error:true},$e={...Te,verbose:false},$r=/^([\w-]+):(.+)$/,Lr=/^\/(.+)\/$/;function Ar(e){let t=[];for(let r of e.split(/\s+/)){if(!r)continue;let n=r,o=false;n.startsWith("-")&&n.length>1&&(o=true,n=n.slice(1));let l=n.match($r);if(l){t.push({key:l[1].toLowerCase(),text:l[2],negative:o});continue}let a=n.match(Lr);if(a)try{t.push({regex:new RegExp(a[1],"im"),negative:o});continue}catch{}t.push({text:n,negative:o})}return t}function Ir(e,t){return e.message.toLowerCase().includes(t.toLowerCase())}function Dr(e,t){for(let r of t)if(r.regex){if(r.regex.test(e.message)===r.negative)return false}else if(r.text&&Ir(e,r.text)===r.negative)return false;return true}function Or(e,t,r){return e.method==="groupEnd"?true:t[e.level]?Dr(e,r):false}var ct={verbose:"Verbose",info:"Info",warning:"Warnings",error:"Errors"},Le=["verbose","info","warning","error"];function ut(e,t){return Le.every(r=>e[r]===t[r])}function Br(e){if(ut(e,Te))return"All levels";if(ut(e,$e))return"Default levels";let t=Le.filter(r=>e[r]);return t.length===0?"Hide all":t.length===1?`${ct[t[0]]} only`:"Custom levels"}var Ae=5,Nr=5;function Mr(e,t){for(let r of e){let n=ar(r.entry.origin,t);r.sourceKey=n,r.originColor=n?Ye(n):void 0,r.originLabel=t==="off"?void 0:sr(r.entry.origin,t)}}function Hr(e){for(let t=0;t<e.length;t++){let r=e[t].sourceKey;if(r==null){e[t].bracketGlyph=void 0;continue}let n=t>0&&e[t-1].sourceKey===r,o=t<e.length-1&&e[t+1].sourceKey===r,l=!n&&!o?"single":n?o?"mid":"bottom":"top";e[t].bracketGlyph=Je(l)}}function Rr(e,t){let r=[],n=new Map;for(let l of e){let a=l.sourceKey??"\u2014",s=n.get(a);s||(s=[],n.set(a,s),r.push(a)),s.push(l)}let o=[];for(let l of r){let a=n.get(l);for(let c of a)c.depth=0;let s=a.length>Nr,i=t[l]??false;s&&(o.push({key:`cluster:${l}`,entry:a[0].entry,depth:0,repeatCount:1,isGroupHeader:false,sourceKey:l,originColor:a[0].originColor,originLabel:a[0].originLabel,clusterHeader:{key:l,count:a.length,expanded:i}}),!i)||a.forEach((c,u)=>{let b=a.length===1?"single":u===0?"top":u===a.length-1?"bottom":"mid";c.bracketGlyph=Je(b),o.push(c)})}return o}function jr(e){let t=new Map,r=new Map;e.forEach((s,i)=>{let c=s.sourceKey;c!=null&&(t.has(c)||t.set(c,i),r.set(c,i))});let n=[...t.keys()].sort((s,i)=>t.get(s)-t.get(i)),o=new Map,l=[];for(let s of n){let i=l.findIndex(c=>c<t.get(s));i===-1&&(i=l.length<Ae?l.length:Ae-1,i>=l.length&&l.push(0)),o.set(s,i),l[i]=Math.max(l[i]??0,r.get(s))}let a=Math.max(1,Math.min(l.length,Ae));e.forEach((s,i)=>{let c=Array.from({length:a},()=>({glyph:" "}));for(let u of n){let b=o.get(u);b>=a||i>=t.get(u)&&i<=r.get(u)&&(c[b]={glyph:s.sourceKey===u?"\u25CF":"\u2502",color:Ye(u)})}s.lanes=c})}var Pr=new Set(["group","groupCollapsed"]);function zr(e,t){let{levelsMask:r,query:n,showTimestamps:o,collapsedOverrides:l}=t,a=Ar(n.trim()),s=[],i={verbose:0,info:0,warning:0,error:0},c=0,u=[],b=()=>u.some(h=>h.collapsed);for(let h of e){if(i[h.level]++,h.method==="groupEnd"){u.pop();continue}let D=Pr.has(h.method),V=b();if(!Or(h,r,a))c++;else if(!V){let L=s[s.length-1];!o&&!D&&L&&!L.isGroupHeader&&L.depth===u.length&&L.entry.method===h.method&&L.entry.message===h.message?L.repeatCount++:s.push({key:String(h.id),entry:h,depth:u.length,repeatCount:1,isGroupHeader:D,groupId:D?h.id:void 0,groupCollapsed:void 0})}if(D){let L=h.method==="groupCollapsed",W=l[h.id]??L,R=s[s.length-1];R&&R.groupId===h.id&&(R.groupCollapsed=W),u.push({id:h.id,collapsed:W||V})}}Mr(s,t.groupDimension);let $=s;return t.groupDimension!=="off"&&(t.layoutMode==="cluster"?$=Rr(s,t.clusterExpanded):t.layoutMode==="swimlane"?jr(s):Hr(s)),{rows:$,hiddenCount:c,levelCounts:i,totalCount:e.length}}function dt(e){let t=Yt(ue,K,K);return Ut(()=>zr(t,e),[t,e.levelsMask,e.query,e.showTimestamps,e.collapsedOverrides,e.groupDimension,e.layoutMode,e.clusterExpanded])}function ft(){let[e,t]=j(""),[r,n]=j(false),[o,l]=j({...$e}),[a,s]=j(false),[i,c]=j({}),[u,b]=j("chrono"),[$,h]=j("list"),[D,V]=j({}),{rows:L,hiddenCount:W}=dt({levelsMask:o,query:e,showTimestamps:a,collapsedOverrides:i,groupDimension:"function",layoutMode:u,clusterExpanded:D}),R=ge((le,ie)=>{c(zt=>({...zt,[le]:!ie}))},[]),ne=ge(le=>{V(ie=>({...ie,[le]:!(ie[le]??false)}))},[]),p=ge(()=>{ee(),c({})},[]),C=Br(o);return{query:e,setQuery:t,searchActive:r,setSearchActive:n,levelsMask:o,setLevelsMask:l,showTimestamps:a,setShowTimestamps:s,layoutMode:u,setLayoutMode:b,view:$,setView:h,rows:L,hiddenCount:W,onToggleGroup:R,onToggleCluster:ne,clear:p,levelSummary:C,isLevelCustom:C!=="All levels"&&C!=="Default levels"}}var gt={};Vt(gt,{AccessibilityInfo:()=>Vr,ActivityIndicator:()=>_o,Alert:()=>Yo,Animated:()=>_r,AppRegistry:()=>Ur,AppState:()=>Yr,Appearance:()=>Kr,BackHandler:()=>Jr,Button:()=>Ko,CheckBox:()=>fo,Clipboard:()=>qr,DeviceEventEmitter:()=>$o,Dimensions:()=>Qr,Easing:()=>Xr,FlatList:()=>Ie,I18nManager:()=>Zr,Image:()=>go,ImageBackground:()=>po,InteractionManager:()=>to,Keyboard:()=>eo,KeyboardAvoidingView:()=>mo,LayoutAnimation:()=>ro,Linking:()=>oo,LogBox:()=>To,Modal:()=>Go,NativeEventEmitter:()=>no,NativeModules:()=>Gr,PanResponder:()=>lo,Picker:()=>ho,PixelRatio:()=>io,Platform:()=>ao,Pressable:()=>Wo,ProgressBar:()=>yo,RefreshControl:()=>bo,SafeAreaView:()=>vo,ScrollView:()=>yt,SectionList:()=>wo,Share:()=>so,StatusBar:()=>xo,StyleSheet:()=>S,Switch:()=>Vo,Text:()=>d,TextInput:()=>Po,Touchable:()=>ko,TouchableHighlight:()=>zo,TouchableNativeFeedback:()=>Co,TouchableOpacity:()=>T,TouchableWithoutFeedback:()=>Fo,UIManager:()=>co,Vibration:()=>uo,View:()=>m,VirtualizedList:()=>So,YellowBox:()=>Eo,findNodeHandle:()=>Uo,unstable_createElement:()=>Wr,useColorScheme:()=>Lo,useLocaleContext:()=>Ao,useWindowDimensions:()=>Io});_t(gt,Fr);import*as Fr from"react-native-web";import{unstable_createElement as Wr,NativeModules as Gr,AccessibilityInfo as Vr,Animated as _r,Appearance as Kr,AppRegistry as Ur,AppState as Yr,BackHandler as Jr,Clipboard as qr,Dimensions as Qr,Easing as Xr,I18nManager as Zr,Keyboard as eo,InteractionManager as to,LayoutAnimation as ro,Linking as oo,NativeEventEmitter as no,PanResponder as lo,PixelRatio as io,Platform as ao,Share as so,StyleSheet as S,UIManager as co,Vibration as uo,CheckBox as fo,FlatList as Ie,Image as go,ImageBackground as po,KeyboardAvoidingView as mo,Picker as ho,ProgressBar as yo,RefreshControl as bo,SafeAreaView as vo,SectionList as wo,StatusBar as xo,Touchable as ko,TouchableNativeFeedback as Co,VirtualizedList as So,YellowBox as Eo,LogBox as To,DeviceEventEmitter as $o,useColorScheme as Lo,useLocaleContext as Ao,useWindowDimensions as Io}from"react-native-web";import*as E from"react-native-web";import{createElement as De,forwardRef as pt,useCallback as Do,useRef as Oo}from"react";import{useEffect as Bo,useState as No}from"react";import{createPortal as Mo}from"react-dom";var Ho='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';import{jsx as Ro}from"react/jsx-runtime";var re=Symbol.for("@buoy-gg/portal-host"),mt=e=>{if(!(e instanceof Element))return false;if(e.closest("input, textarea, select"))return true;let t=e.closest("[contenteditable]")?.getAttribute("contenteditable")?.toLowerCase();return t===""||t==="true"||t==="plaintext-only"};function ht(){let e=document;if(e[re])return e[re].host;let t=document.createElement("div");t.dataset.buoyPortalHost="",Object.assign(t.style,{position:"fixed",inset:"0",zIndex:"2147483647",pointerEvents:"none",fontFamily:Ho});let r=()=>{let u=document.fullscreenElement,b=u&&u.tagName!=="CANVAS"?u:document.body;t.parentElement!==b&&b.appendChild(t)},n=new Map,o=u=>{(!t.contains(u.target)||!mt(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})},l=u=>{n.delete(u.code||u.key)},a=()=>n.clear(),s=()=>{let u=[...n.values()];n.clear();for(let b of u)document.dispatchEvent(new KeyboardEvent("keyup",{...b,bubbles:true}))},i=u=>{mt(u.target)&&u.stopPropagation()},c=u=>u.stopPropagation();return r(),document.addEventListener("fullscreenchange",r),document.addEventListener("keydown",o,true),document.addEventListener("keyup",l,true),window.addEventListener("blur",a),t.addEventListener("focusin",s),t.addEventListener("keydown",i),t.addEventListener("keyup",i),t.addEventListener("keypress",i),t.addEventListener("wheel",c,{passive:true}),e[re]={host:t,users:0,dispose:()=>{document.removeEventListener("fullscreenchange",r),document.removeEventListener("keydown",o,true),document.removeEventListener("keyup",l,true),window.removeEventListener("blur",a),t.remove(),delete e[re]}},t}function jo({children:e}){let[t,r]=No(null);return Bo(()=>{let n=ht(),o=document[re];return o.users++,r(n),()=>{--o.users===0&&o.dispose()}},[]),t?Mo(Ro("div",{"data-buoy-root":"",style:{display:"contents",pointerEvents:"auto"},children:e}),t):null}function A(e){let t=pt((n,o)=>{let{accessibilityState:l,accessibilityValue:a,...s}=n;for(let i of["busy","checked","disabled","expanded","selected"])l?.[i]!==void 0&&s[`aria-${i}`]===void 0&&(s[`aria-${i}`]=l[i]);for(let[i,c]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))a?.[i]!==void 0&&s[`aria-${c}`]===void 0&&(s[`aria-${c}`]=a[i]);return De(e,{...s,ref:o})}),r=e.State;return r&&Object.assign(t,{State:r}),t.displayName=e.displayName??e.name??"NativeWebView",t}var m=A(E.View),d=A(E.Text),Po=A(E.TextInput),T=A(E.TouchableOpacity),zo=A(E.TouchableHighlight),Fo=A(E.TouchableWithoutFeedback),Wo=A(E.Pressable),yt=A(E.ScrollView),bt=pt((e,t)=>{let r=Oo(null),n=Do(o=>{if(o){let l=o;for(;l.parentElement&&l.parentElement!==document.body;)l=l.parentElement;l.parentElement===document.body&&(r.current=l,Object.assign(l.style,{position:"relative",zIndex:"2147483647",pointerEvents:"auto"}),ht().appendChild(l))}else r.current&&(document.body.appendChild(r.current),r.current=null);typeof t=="function"?t(o):t&&(t.current=o)},[t]);return De(jo,null,De(E.Modal,{...e,ref:n}))});bt.displayName="Modal";var Go=A(bt),Vo=A(E.Switch),_o=A(E.ActivityIndicator),Ko=A(E.Button),Uo=E.findNodeHandle,Yo={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 l=document.createElement("h2");if(l.textContent=e,l.style.cssText="font-size:18px;margin:0 0 12px",o.appendChild(l),t){let c=document.createElement("p");c.textContent=t,c.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",o.appendChild(c)}let a=document.createElement("div");a.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let s=r?.length?r:[{text:"OK"}],i=()=>{o.close?.(),o.remove()};for(let c of s){let u=document.createElement("button");u.type="button",u.textContent=c.text??"OK",u.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${c.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,u.onclick=()=>{i(),c.onPress?.()},a.appendChild(u)}o.addEventListener("cancel",c=>{c.preventDefault(),n?.cancelable!==false&&(i(),n?.onDismiss?.())}),o.appendChild(a),document.body.appendChild(o),o.showModal?o.showModal():o.setAttribute("open","")}};import{ModalHeader as P,TabSelector as Jo,night as B,Search as qo,Filter as Qo,Trash2 as Xo}from"@buoy-gg/shared-ui/web";import{jsx as I,jsxs as Oe}from"react/jsx-runtime";var Zo=[{key:"chrono",label:"Timeline"},{key:"cluster",label:"Grouped"}];function vt({c:e,onBack:t}){if(e.view==="filters")return Oe(P,{children:[I(P.Navigation,{onBack:()=>e.setView("list")}),I(P.Content,{title:"Filters"})]});let r=e.rows.length>0;return Oe(P,{children:[t?I(P.Navigation,{onBack:t}):null,I(P.Content,{title:"",noMargin:true,children:e.searchActive?I(P.Search,{testID:"buoy-console-search",value:e.query,onChangeText:e.setQuery,onCancel:()=>e.setQuery(""),clearOnlyWhenText:true,placeholder:"Filter logs\u2026 /regex/ -exclude",iconSize:14,inputProps:{onSubmitEditing:()=>e.setSearchActive(false)}}):I(Jo,{testIDPrefix:"buoy-console-tab",tabs:Zo,activeTab:e.layoutMode,onTabChange:n=>e.setLayoutMode(n)})}),Oe(P.Actions,{children:[I(T,{onPress:()=>e.setSearchActive(n=>!n),style:[J.actionBtn,e.searchActive&&J.actionBtnActive],testID:"buoy-console-search-open",accessibilityLabel:"Search logs",children:I(qo,{size:14,color:e.searchActive?B.color.accent:B.color.textSecondary})}),I(T,{onPress:()=>e.setView("filters"),style:[J.actionBtn,e.isLevelCustom&&J.actionBtnActive],testID:"buoy-console-filters-open",accessibilityLabel:"Filters",children:I(Qo,{size:14,color:e.isLevelCustom?B.color.accent:B.color.textSecondary})}),I(T,{onPress:e.clear,disabled:!r,style:[J.actionBtn,!r&&J.actionBtnDisabled],testID:"buoy-console-clear",accessibilityLabel:"Clear console",children:I(Xo,{size:14,color:r?B.color.textSecondary:B.color.textTertiary})})]})]})}var J=S.create({actionBtn:{width:32,height:32,borderRadius:8,backgroundColor:B.color.buttonSurface,borderWidth:1,borderColor:B.color.border,alignItems:"center",justifyContent:"center"},actionBtnActive:{backgroundColor:B.color.accentSoft,borderColor:B.color.accentBorderStrong},actionBtnDisabled:{opacity:.55}});import{useCallback as en,useRef as wt,useSyncExternalStore as tn}from"react";import{night as H,Check as rn,LOG_LIST_PRESET as on}from"@buoy-gg/shared-ui/web";import{memo as nn}from"react";import{useState as ln}from"react";import{monoFont as z,night as oe}from"@buoy-gg/shared-ui/web";var an={baseContainer:"#0A0A0C",surfaceError:"rgba(255,69,58,0.15)",surfaceYellow:"rgba(255,235,59,0.13)",divider:oe.color.fillTertiary,inputBackground:oe.color.surfaceElevated,menuBackground:oe.color.surface,onSurface:oe.color.text,onSurfaceYellow:"#FFE9A3",onErrorContainer:"#FFB4AB",tokenSubtle:oe.color.textSecondary,primary:"#40CCFF",valueNumber:"#FF9F1C",valueString:"#7EE787",valueBigint:"#A1A1A6",valueNode:"#F5F5F7",valueNullish:"#8E8E93",valuePreview:"#A1A1A6"},g=an,sn={black:"#000",red:"rgb(237 78 76)",green:"rgb(1 200 1)",yellow:"rgb(210 192 87)",blue:"rgb(39 116 240)",magenta:"rgb(161 66 244)",cyan:"rgb(18 181 203)",gray:"rgb(207 208 208)",darkgray:"rgb(137 137 137)",lightred:"rgb(242 139 130)",lightgreen:"rgb(161 247 181)",lightyellow:"rgb(221 251 85)",lightblue:"rgb(102 157 246)",lightmagenta:"rgb(214 112 214)",lightcyan:"rgb(132 240 255)",white:"#fff"},xt={verbose:{text:g.tokenSubtle},info:{text:g.onSurface},warning:{background:g.surfaceYellow,text:g.onSurfaceYellow,icon:"warning"},error:{background:g.surfaceError,text:g.onErrorContainer,icon:"error"}};var kt=["black","red","green","yellow","blue","magenta","cyan","gray"],Ct=["darkgray","lightred","lightgreen","lightyellow","lightblue","lightmagenta","lightcyan","white"];function St(e){if(typeof e=="string")return e;if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(typeof e=="function")return`\u0192 ${e.name||"(anonymous)"}`;try{return JSON.stringify(e)}catch{return String(e)}}var Be=/%([%_Oocsdfi])|\x1B\[([\d;]*)m/;function cn(e){return Be.test(e)}function Et(e){let t={},r=false;for(let n of e.split(";")){let o=n.indexOf(":");if(o===-1)continue;let l=n.slice(0,o).trim().toLowerCase(),a=n.slice(o+1).trim();if(!a)continue;let s=a.match(/var\(--console-color-([a-z]+)\)/);switch(s&&(a=sn[s[1]]??a),l){case"color":t.color=a,r=true;break;case"background-color":case"background":t.backgroundColor=a,r=true;break;case"font-weight":t.fontWeight=a==="lighter"?"300":a,r=true;break;case"font-style":a==="italic"&&(t.fontStyle="italic",r=true);break;case"font-size":{let i=parseFloat(a);Number.isNaN(i)||(t.fontSize=i,r=true);break}case"text-decoration":case"text-decoration-line":a.includes("underline")&&a.includes("line-through")?t.textDecorationLine="underline line-through":a.includes("underline")?t.textDecorationLine="underline":a.includes("line-through")&&(t.textDecorationLine="line-through"),r=true;break;default:break}}return r?t:void 0}function un(e,t){let r=o=>{let l=t.get("text-decoration")??"";l.includes(o)||t.set("text-decoration",`${l} ${o}`)},n=o=>{let l=t.get("text-decoration")?.replace(` ${o}`,"");l?t.set("text-decoration",l):t.delete("text-decoration")};for(;e.length;){let o=e.shift();switch(o){case 0:t.clear();break;case 1:t.set("font-weight","bold");break;case 2:t.set("font-weight","lighter");break;case 3:t.set("font-style","italic");break;case 4:r("underline");break;case 9:r("line-through");break;case 22:t.delete("font-weight");break;case 23:t.delete("font-style");break;case 24:n("underline");break;case 29:n("line-through");break;case 38:case 48:if(e.shift()===2){let l=e.shift()??0,a=e.shift()??0,s=e.shift()??0;t.set(o===38?"color":"background-color",`rgb(${l},${a},${s})`)}break;case 39:case 49:t.delete(o===39?"color":"background-color");break;default:{let l=kt[o-30]??Ct[o-90];if(l!==void 0)t.set("color",`var(--console-color-${l})`);else{let a=kt[o-40]??Ct[o-100];a!==void 0&&t.set("background-color",`var(--console-color-${a})`)}break}}}}function dn(e,t){let r=e,n=[],o=new Map,l,a=i=>{if(!i)return;let c=n[n.length-1];if(c&&c.type==="string"&&fn(c.style,l)){c.value+=i;return}n.push({type:"string",value:i,style:l})},s=0;for(let i=Be.exec(r);i!==null;i=Be.exec(r)){a(i.input.substring(0,i.index));let c,u=i[1];switch(u){case"%":a("%"),c="";break;case"s":s<t.length&&(c=St(t[s++]));break;case"c":s<t.length&&(l=Et(St(t[s++])),c="");break;case"o":case"O":s<t.length&&(n.push({type:"value",value:t[s++],mode:u==="O"?"generic":"optimal"}),c="");break;case"_":s<t.length&&(s++,c="");break;case"d":case"f":case"i":{if(s<t.length){let b=t[s++],$=typeof b!="number"?NaN:b;u!=="f"&&($=Math.floor($)),c=$}break}case void 0:{let b=(i[2]||"0").split(";").map(h=>h?parseInt(h,10):0);un(b,o);let $=[...o.entries()].map(([h,D])=>`${h}:${D.trimStart()}`).join(";");l=Et($),c="";break}}c===void 0&&(a(i[0]),c=""),r=c+i.input.substring(i.index+i[0].length)}return a(r),{tokens:n,rest:t.slice(s)}}function fn(e,t){return e===t?true:!e||!t?false:JSON.stringify(e)===JSON.stringify(t)}function gn(e){if(e.length===0)return[];let t=[],r=e;if(typeof e[0]=="string"&&cn(e[0])){let n=dn(e[0],e.slice(1));t=n.tokens,r=n.rest}for(let n of r)t.length>0&&t.push({type:"string",value:" "}),typeof n=="string"?t.push({type:"string",value:n}):t.push({type:"value",value:n,mode:"optimal"});return t}import{useState as pn}from"react";import{jsx as O,jsxs as q}from"react/jsx-runtime";var Tt=5,$t=6;function Ne(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(e instanceof Error)return"error";let t=typeof e;return t==="number"?"number":t==="bigint"?"bigint":t==="boolean"?"boolean":t==="string"?"string":t==="function"?"function":t==="symbol"?"symbol":"object"}var mn={number:g.valueNumber,bigint:g.valueBigint,boolean:g.valueNumber,string:g.valueString,null:g.valueNullish,undefined:g.valueNullish,symbol:g.valueString,function:g.valueNode};function Lt(e){if(Array.isArray(e))return"";let t=Object.getPrototypeOf(e);if(!t)return"Object";let r=t.constructor?.name;return!r||r==="Object"?"":r}function Me(e){switch(Ne(e)){case"string":return`'${e}'`;case"function":return`\u0192 ${e.name||""}`.trimEnd();case"symbol":return e.toString();case"bigint":return`${String(e)}n`;case"array":return`Array(${e.length})`;case"error":return e.name;case"object":{let t=Lt(e);return t?`${t} {\u2026}`:"{\u2026}"}default:return String(e)}}function hn(e){if(Array.isArray(e)){let l=e.slice(0,$t).map(s=>Me(s)).join(", "),a=e.length>$t?", \u2026":"";return`(${e.length}) [${l}${a}]`}let t=Object.entries(e),r=t.slice(0,Tt).map(([l,a])=>`${l}: ${Me(a)}`).join(", "),n=t.length>Tt?", \u2026":"",o=Lt(e);return`${o?`${o} `:""}{${r}${n}}`}function yn(e){let t=Ne(e);return t==="array"?e.length>0:t==="object"?Object.keys(e).length>0:t==="error"}var At=({open:e})=>O(d,{style:[v.triangle,e&&v.triangleOpen],children:"\u25B6"});function He({value:e,depth:t=0,testID:r}){let[n,o]=pn(false),l=Ne(e);if(l==="error"){let i=e,c=`${i.name}: ${i.message}`.split(`
16
+ `)[0],u=i.stack&&i.stack.trim()!==c.trim()?i.stack:void 0;return u?q(m,{style:v.objectContainer,children:[q(T,{testID:r,style:v.objectHeader,activeOpacity:.6,onPress:()=>o(b=>!b),children:[O(At,{open:n}),O(d,{style:[v.mono,v.errorHead],numberOfLines:n?void 0:1,children:c})]}),n?O(d,{style:[v.mono,v.errorStack],children:u}):null]}):O(d,{style:[v.mono,{color:g.onErrorContainer}],numberOfLines:1,children:c})}if(!yn(e)){let i=mn[l]??g.onSurface;return O(d,{testID:r,style:[v.mono,{color:i}],children:Me(e)})}let a=e,s=Array.isArray(a)?a.map((i,c)=>[String(c),i]):Object.entries(a);return q(m,{style:v.objectContainer,children:[q(T,{testID:r,onPress:()=>o(i=>!i),activeOpacity:.6,style:v.objectHeader,children:[O(At,{open:n}),O(d,{style:[v.mono,v.preview],numberOfLines:n?void 0:1,children:hn(a)})]}),n&&t<6?O(m,{testID:r?`${r}-children`:void 0,style:v.children,children:s.map(([i,c])=>q(m,{style:v.propertyRow,children:[q(d,{style:[v.mono,v.propertyKey],children:[i,":"]}),O(m,{style:v.propertyValue,children:O(He,{testID:r?`${r}-${i}`:void 0,value:c,depth:t+1})})]},i))}):null]})}var bn={fontFamily:z,fontSize:12,lineHeight:16},v=S.create({mono:bn,objectContainer:{flexDirection:"column"},objectHeader:{flexDirection:"row",alignItems:"flex-start"},triangle:{color:g.tokenSubtle,fontSize:8,lineHeight:16,width:12},triangleOpen:{transform:[{rotate:"90deg"}]},preview:{color:g.valuePreview,fontStyle:"italic",flexShrink:1},errorHead:{color:g.onErrorContainer,flexShrink:1},errorStack:{color:g.tokenSubtle,marginLeft:14,marginTop:1},children:{marginLeft:14,flexDirection:"column"},propertyRow:{flexDirection:"row",alignItems:"flex-start"},propertyKey:{color:g.valueNode,marginRight:6},propertyValue:{flexShrink:1}});import{jsx as y,jsxs as Q}from"react/jsx-runtime";function vn(e){let t=new Date(e),r=(n,o=2)=>String(n).padStart(o,"0");return`${r(t.getHours())}:${r(t.getMinutes())}:${r(t.getSeconds())}.${r(t.getMilliseconds(),3)}`}function wn({icon:e,color:t}){return y(d,{style:[f.levelIcon,{color:t}],children:e==="warning"?"\u26A0":"\u2298"})}function xn({count:e,color:t}){return y(m,{style:[f.repeatBadge,{borderColor:t}],children:y(d,{testID:"buoy-console-repeat-count",style:[f.repeatBadgeText,{color:t}],children:e})})}var It=nn(function({row:e,showTimestamps:t,onToggleGroup:r,onToggleCluster:n}){let{entry:o}=e,l=xt[o.level],a=o.level==="error"||o.level==="warning",s=l.text,[i,c]=ln(o.method==="trace");if(e.clusterHeader){let p=e.clusterHeader;return y(T,{testID:`buoy-console-cluster-${e.originLabel}`,style:[f.wrapper,f.dividerTop],activeOpacity:.7,onPress:()=>n(p.key),children:Q(m,{style:f.rowWrapper,children:[y(d,{style:[f.originGutter,{color:e.originColor}],children:p.expanded?"\u25BC":"\u25B6"}),y(m,{style:f.messageColumn,children:Q(m,{style:f.messageLine,children:[y(d,{style:[f.text,f.clusterTitle,{color:e.originColor}],children:e.originLabel}),Q(d,{testID:"buoy-console-cluster-count",style:f.clusterCount,children:[" \xB7 ",p.count," logs"]})]})})]})})}let u=gn(o.args),b=!!o.stack&&(a||o.method==="trace"),$=y(m,{testID:i?"buoy-console-content-expanded":"buoy-console-content-collapsed",style:[f.contentWrap,!i&&f.contentWrapClamped],children:u.map((p,C)=>p.type==="string"?y(d,{testID:`buoy-console-text-${C}`,style:[f.text,{color:s},e.isGroupHeader&&f.groupTitle,p.style],children:p.value},C):y(He,{testID:`buoy-console-value-${C}`,value:p.value,generic:p.mode==="generic"},C))}),h=Q(m,{style:f.messageColumn,children:[e.originLabel?y(d,{testID:"buoy-console-origin",style:[f.originLabel,{color:e.originColor}],numberOfLines:1,children:e.originLabel}):null,Q(m,{style:f.messageLine,children:[e.isGroupHeader?y(d,{style:[f.groupTriangle,{color:s}],children:e.groupCollapsed?"\u25B6":"\u25BC"}):null,l.icon?y(wn,{icon:l.icon,color:s}):null,t?y(d,{testID:"buoy-console-timestamp",style:f.timestamp,children:vn(o.timestamp)}):null,b?y(d,{style:[f.stackTriangle,{color:s}],children:i?"\u25BC":"\u25B6"}):null,$,e.repeatCount>1?y(xn,{count:e.repeatCount,color:s}):null]}),b&&i?y(m,{testID:"buoy-console-stack",style:f.stackTrace,children:(o.stack??"").split(`
17
+ `).filter(p=>p.trim()).map((p,C)=>y(d,{style:f.stackFrame,children:p.trim()},C))}):null]}),D=[f.wrapper,l.background?{backgroundColor:l.background}:f.dividerTop],V=Array.from({length:e.depth},(p,C)=>y(m,{style:f.nestingMarker},C)),L=e.lanes?y(m,{style:f.laneGutter,children:e.lanes.map((p,C)=>y(d,{style:[f.laneCell,p.color?{color:p.color}:null],children:p.glyph},C))}):e.bracketGlyph?y(d,{style:[f.originGutter,{color:e.originColor}],children:e.bracketGlyph}):null,W=Q(m,{style:f.rowWrapper,children:[L,V,h]}),R=`buoy-console-row-${String(o.args[0])}`,ne=[e.originLabel,u.find(p=>p.type==="string")?.value].filter(Boolean).join(" \u2014 ").slice(0,80);if(e.isGroupHeader&&e.groupId!==void 0){let p=e.groupId;return y(T,{style:D,activeOpacity:.7,onPress:()=>r(p,!!e.groupCollapsed),testID:R,accessibilityLabel:ne||"Console group",children:W})}return y(T,{style:D,activeOpacity:.7,onPress:()=>c(p=>!p),testID:R,accessibilityLabel:ne||"Console message",children:W})},(e,t)=>e.row.key===t.row.key&&e.row.lanes===t.row.lanes&&e.row.repeatCount===t.row.repeatCount&&e.row.groupCollapsed===t.row.groupCollapsed&&e.row.depth===t.row.depth&&e.row.bracketGlyph===t.row.bracketGlyph&&e.row.originLabel===t.row.originLabel&&e.row.clusterHeader?.count===t.row.clusterHeader?.count&&e.row.clusterHeader?.expanded===t.row.clusterHeader?.expanded&&e.showTimestamps===t.showTimestamps&&e.onToggleGroup===t.onToggleGroup&&e.onToggleCluster===t.onToggleCluster),f=S.create({wrapper:{paddingVertical:2,paddingRight:8,minHeight:18},dividerTop:{borderTopWidth:S.hairlineWidth,borderTopColor:g.divider},rowWrapper:{flexDirection:"row",alignItems:"flex-start"},originGutter:{width:11,fontFamily:z,fontSize:13,lineHeight:18,textAlign:"center"},laneGutter:{flexDirection:"row"},laneCell:{width:9,fontFamily:z,fontSize:13,lineHeight:18,textAlign:"center"},originLabel:{fontFamily:z,fontSize:10,lineHeight:16,marginBottom:1,opacity:.9},nestingMarker:{width:14,alignSelf:"stretch",borderRightWidth:S.hairlineWidth,borderRightColor:g.divider,marginLeft:2},messageColumn:{flex:1,flexDirection:"column",paddingLeft:6},messageLine:{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-start"},contentWrap:{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-start",flexShrink:1},contentWrapClamped:{flexWrap:"nowrap",overflow:"hidden",maxHeight:16},text:{fontFamily:z,fontSize:12,lineHeight:16},groupTitle:{fontWeight:"bold"},clusterTitle:{fontWeight:"600"},clusterCount:{color:g.tokenSubtle,fontFamily:z,fontSize:12,lineHeight:16},groupTriangle:{fontSize:9,lineHeight:16,marginRight:4},stackTriangle:{fontSize:8,lineHeight:16,marginRight:4},levelIcon:{fontSize:12,lineHeight:16,marginRight:5},timestamp:{color:g.tokenSubtle,fontFamily:z,fontSize:11,lineHeight:16,marginRight:6},repeatBadge:{borderWidth:1,borderRadius:9,paddingHorizontal:5,minWidth:16,alignItems:"center",justifyContent:"center",marginLeft:6,marginTop:1},repeatBadgeText:{fontSize:10,fontWeight:"700",lineHeight:14},stackTrace:{marginTop:2,marginLeft:12},stackFrame:{color:g.tokenSubtle,fontFamily:z,fontSize:11,lineHeight:15}});import{jsx as w,jsxs as Re}from"react/jsx-runtime";function Dt({c:e}){return e.view==="filters"?w(Cn,{c:e}):w(kn,{c:e})}function kn({c:e}){let t=wt(null),r=wt(true),n=en(({item:o})=>w(It,{row:o,showTimestamps:e.showTimestamps,onToggleGroup:e.onToggleGroup,onToggleCluster:e.onToggleCluster}),[e.showTimestamps,e.onToggleGroup,e.onToggleCluster]);return w(Ie,{testID:"buoy-console-list",ref:t,data:e.rows,keyExtractor:o=>o.key,renderItem:n,style:k.list,...on,onContentSizeChange:()=>{r.current&&t.current?.scrollToEnd({animated:false})},onScroll:o=>{let{contentOffset:l,contentSize:a,layoutMeasurement:s}=o.nativeEvent,i=a.height-(l.y+s.height);r.current=i<40},scrollEventThrottle:100})}function je({testID:e,on:t,label:r,subtext:n,onPress:o}){return Re(T,{testID:e,style:k.row,onPress:o,activeOpacity:.7,children:[w(m,{style:[k.checkbox,t&&k.checkboxOn],children:t?w(rn,{size:12,color:H.color.onAccent,strokeWidth:3}):null}),Re(m,{style:k.rowTextCol,children:[w(d,{style:k.rowLabel,children:r}),n?w(d,{style:k.rowSubtext,children:n}):null]})]})}function Ot({text:e}){return w(d,{style:k.sectionLabel,children:e})}function Cn({c:e}){let t=tn(st,Ee,Ee),r=n=>e.setLevelsMask({...e.levelsMask,[n]:!e.levelsMask[n]});return Re(yt,{testID:"buoy-console-filters",style:k.subView,contentContainerStyle:k.subViewContent,children:[w(Ot,{text:"Log levels"}),w(T,{testID:"buoy-console-levels-default",style:k.presetRow,onPress:()=>e.setLevelsMask({...$e}),children:w(d,{style:k.presetText,children:"Default (hide verbose)"})}),w(T,{testID:"buoy-console-levels-all",style:k.presetRow,onPress:()=>e.setLevelsMask({...Te}),children:w(d,{style:k.presetText,children:"All levels"})}),Le.map(n=>w(je,{testID:`buoy-console-level-${n}`,on:e.levelsMask[n],label:ct[n],onPress:()=>r(n)},n)),w(m,{style:k.divider}),w(Ot,{text:"Settings"}),w(je,{testID:"buoy-console-timestamps",on:e.showTimestamps,label:"Show timestamps",onPress:()=>e.setShowTimestamps(n=>!n)}),w(je,{testID:"buoy-console-preserve",on:t,label:"Preserve log",subtext:"Do not clear log on reload",onPress:()=>at(!t)})]})}var k=S.create({list:{flex:1,backgroundColor:"transparent"},subView:{flex:1,backgroundColor:"transparent"},subViewContent:{padding:12},sectionLabel:{color:H.color.textTertiary,fontSize:11,textTransform:"uppercase",letterSpacing:.5,marginTop:4,marginBottom:4,paddingHorizontal:8},presetRow:{paddingVertical:10,paddingHorizontal:8},presetText:{color:H.color.accent,fontSize:14,fontWeight:"600"},divider:{height:S.hairlineWidth,backgroundColor:H.color.border,marginVertical:6},row:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:8,gap:12},rowTextCol:{flexDirection:"column",flex:1},rowLabel:{color:H.color.text,fontSize:14},rowSubtext:{color:H.color.textTertiary,fontSize:12,marginTop:1},checkbox:{width:18,height:18,borderRadius:4,borderWidth:1,borderColor:H.color.fillTertiary,alignItems:"center",justifyContent:"center"},checkboxOn:{backgroundColor:H.color.accent,borderColor:H.color.accent}});import{jsx as Pe}from"react/jsx-runtime";function Bt({visible:e,onClose:t,onBack:r,onMinimize:n,persistenceKey:o="@react_buoy_console_modal"}){let l=ft();return Pe(Kt,{visible:e,onClose:t,onMinimize:n,persistenceKey:o,header:{showToggleButton:true,customContent:Pe(vt,{c:l,onBack:r})},enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:Pe(Dt,{c:l})})}import{createToolFactory as Sn,defineToolPreset as En}from"@buoy-gg/shared-ui/web";import{jsx as Tn}from"react/jsx-runtime";var Nt=globalThis,$n=typeof Nt.ErrorUtils?.setGlobalHandler=="function"||typeof Nt.RN$registerExceptionListener=="function";$n&&typeof Ge<"u"&&Ge&&ce();var Mt=En({id:"console",name:"CONSOLE",description:"Captured console.* output",slot:"both",color:_e,icon:({size:e})=>Tn(Ve,{size:e}),component:Bt}),Ln=Sn(Mt);import{useEffect as An}from"react";import{getAccountAccess as In,subscribeAccountAccess as Dn}from"@buoy-gg/shared-ui/web";var Ht=0;function On(){return An(()=>{++Ht;let e=true,t=()=>{if(!e)return;let n=In();if(n.status==="locked"){xe(),ee();return}ce(),n.status==="admitted"&&it()},r=Dn(t);return t(),()=>{e=false,r(),--Ht===0&&xe()}},[]),null}import{macOSColors as Bn,windowDragProps as Nn}from"@buoy-gg/shared-ui/web";import{jsx as ze,jsxs as Mn}from"react/jsx-runtime";function Hn(){let e=ft();return Mn(m,{style:Rt.container,children:[ze(m,{style:Rt.headerBar,...Nn,children:ze(vt,{c:e})}),ze(Dt,{c:e})]})}var Rt=S.create({container:{flex:1,backgroundColor:"transparent"},headerBar:{paddingHorizontal:12,paddingVertical:8,backgroundColor:"transparent",borderBottomWidth:S.hairlineWidth,borderBottomColor:Bn.border.default}});import{useSyncExternalStore as Rn,useEffect as jn}from"react";function jt(){return jn(()=>{ce()},[]),{logs:Rn(ue,K,K)}}import{night as F,ToolEmptyState as Pn,monoFont as zn}from"@buoy-gg/shared-ui/web";import{jsx as G,jsxs as fe}from"react/jsx-runtime";var Pt={verbose:"#9b9b9b",info:F.color.text,warning:"#e2c08d",error:"#f48771"};function Fn(e){let t=new Date(e),r=(n,o=2)=>String(n).padStart(o,"0");return`${r(t.getHours())}:${r(t.getMinutes())}:${r(t.getSeconds())}.${r(t.getMilliseconds(),3)}`}function Wn(){let{logs:e}=jt(),t=({item:r})=>fe(m,{style:N.row,children:[G(d,{style:N.time,children:Fn(r.timestamp)}),G(d,{style:[N.level,{color:Pt[r.level]}],children:r.level.toUpperCase()}),G(d,{style:[N.message,{color:Pt[r.level]}],numberOfLines:3,children:r.message})]});return fe(m,{style:N.container,children:[fe(m,{style:N.header,children:[fe(d,{style:N.headerTitle,children:["Console (",e.length,")"]}),G(T,{onPress:()=>ee(),style:N.clearButton,children:G(d,{style:N.clearText,children:"Clear"})})]}),G(Ie,{data:e,keyExtractor:r=>String(r.id),renderItem:t,ListEmptyComponent:G(Pn,{testID:"buoy-console-empty",otto:"printing",title:"No console logs captured yet",message:"console.log, .warn and .error from your app land here as they run."}),contentContainerStyle:e.length===0?N.emptyContainer:void 0})]})}var N=S.create({container:{flex:1,backgroundColor:"transparent"},header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:8,borderBottomWidth:S.hairlineWidth,borderBottomColor:F.color.border},headerTitle:{color:F.color.text,fontSize:13,fontWeight:"600"},clearButton:{paddingHorizontal:10,paddingVertical:4,borderRadius:4,backgroundColor:F.color.surfaceElevated},clearText:{color:F.color.text,fontSize:12},row:{flexDirection:"row",paddingHorizontal:12,paddingVertical:4,borderBottomWidth:S.hairlineWidth,borderBottomColor:F.color.separator,gap:8},time:{color:F.color.textTertiary,fontSize:11,fontVariant:["tabular-nums"],minWidth:86},level:{fontSize:11,fontWeight:"700",minWidth:44},message:{flex:1,fontSize:12,fontFamily:zn},empty:{color:F.color.textTertiary,fontSize:13,textAlign:"center"},emptyContainer:{flexGrow:1,alignItems:"center",justifyContent:"center"}});import{createSyncAdapter as Gn,memoByIdentity as Vn,newestFitting as _n,sizeOrStub as Kn}from"@buoy-gg/shared-ui/web";var Un=1.5*1024*1024,Yn=16*1024,Jn=Object.freeze({__buoyTruncated:true,note:"Log payload omitted \u2014 inspect it on-device."}),qn=Vn(e=>{let t={...e,args:Ke(e.args),message:Z(e.message),stack:e.stack?Z(e.stack,4096):e.stack};return Kn(t,Yn,()=>({...t,args:[Jn]}))});function Qn(e){return _n(e,{toWire:qn,budget:Un,baseBytes:16})}var Xn=Gn({version:1,getSnapshot(){return{entries:Qn(K())}},subscribe(e){return ue(e)},actions:{clearEntries(){return ee(),{cleared:true}}}});export{_e as CONSOLE_ICON_COLOR,Ve as ConsoleIcon,Wn as ConsoleLogList,It as ConsoleMessageRow,Bt as ConsoleModal,On as ConsoleRoot,He as ConsoleValue,Hn as ConsoleView,ee as clearEntries,Xn as consoleSyncAdapter,g as consoleTheme,Mt as consoleToolPreset,Ln as createConsoleTool,K as getEntries,Ee as getPreserveLog,it as initConsolePersistence,ce as installConsoleCapture,tt as installFatalErrorCapture,xt as levelStyles,Er as onClear,Sr as replaceEntries,at as setPreserveLog,ue as subscribe,st as subscribePreserveLog,xe as uninstallConsoleCapture,jt as useConsoleLogs,dt as useConsoleMessages};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/console",
3
- "version": "7.0.62",
3
+ "version": "7.0.64",
4
4
  "description": "Inspect captured JavaScript console messages in React Native. Capture and release-build support depend on setup and plan.",
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.62"
15
+ "@buoy-gg/shared-ui": "^7.0.64"
16
16
  },
17
17
  "peerDependencies": {
18
18
  "react": "*"
@@ -62,6 +62,10 @@
62
62
  ],
63
63
  "exports": {
64
64
  ".": {
65
+ "react-native": {
66
+ "types": "./lib/typescript/index.d.ts",
67
+ "default": "./lib/module/index.js"
68
+ },
65
69
  "browser": {
66
70
  "types": "./lib/typescript/index.d.ts",
67
71
  "default": "./lib/web/index.mjs"