@buoy-gg/route-events 7.0.77 → 7.0.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/NavigationStack.js +1 -1
- package/lib/commonjs/components/ReactNavigationRoutes.js +1 -1
- package/lib/commonjs/components/RouteEventDetail.js +1 -1
- package/lib/commonjs/components/RouteEventsTimeline.js +1 -1
- package/lib/commonjs/components/RoutesSitemap.js +2 -2
- package/lib/module/components/NavigationStack.js +2 -2
- package/lib/module/components/ReactNavigationRoutes.js +1 -1
- package/lib/module/components/RouteEventDetail.js +1 -1
- package/lib/module/components/RouteEventsTimeline.js +1 -1
- package/lib/module/components/RoutesSitemap.js +1 -1
- package/lib/web/index.mjs +4 -4
- package/package.json +5 -5
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.NavigationStack=NavigationStack;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _license=require("@buoy-gg/license");var _dataViewer=require("@buoy-gg/shared-ui/dataViewer");var _useNavigationStack=require("../useNavigationStack");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");function NavigationStack({style:g,injectedStack:f,onAction:r,onCopyValueChange:b}){const c=(0,_useNavigationStack.useNavigationStack)();const y=f!=null;const F=(0,_sharedUi.useSafeAreaInsets)({minBottom:8});const t=y?f:c.stack;const S=y?true:c.isLoaded;const T=y?null:c.error;const k=(0,_react.useMemo)(()=>t.find(e=>e.isFocused)??null,[t]);const l=t.length;const p=l<=1;const w=e=>r?r("navigateToIndex",{index:e}):c.navigateToIndex(e);const B=e=>r?r("popToIndex",{index:e}):c.popToIndex(e);const D=()=>r?r("goBack"):c.goBack();const C=()=>r?r("popToTop"):c.popToTop();const[a,V]=(0,_react.useState)(null);const[m,d]=(0,_react.useState)(false);const u=(0,_license.useIsPro)();(0,_react.useEffect)(()=>{if(m&&u){d(false)}},[m,u]);const I=(0,_react.useMemo)(()=>{const e=t.map(n=>({pathname:n.pathname,name:n.name,params:n.params,isFocused:n.isFocused}));return JSON.stringify(e,null,2)},[t]);(0,_react.useEffect)(()=>{b?.(I)},[I,b]);const i=(0,_react.useMemo)(()=>{if(a!==null&&t[a]){return t[a]}return k},[a,t,k]);const z=(0,_react.useMemo)(()=>{return a!==null&&t[a]&&!t[a].isFocused},[a,t]);if(!S){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.container,g],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.loadingContainer,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.loadingText,testID:"buoy-routes-stack-loading",children:"Loading navigation stack..."})})})}if(T){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.container,g],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.errorContainer,testID:"buoy-routes-stack-error",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.errorText,children:"Error loading stack"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.errorDetail,testID:"buoy-routes-stack-error-detail",children:T.message})]})})}if(t.length===0){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.container,g],children:(0,_jsxRuntime.jsx)(_sharedUi.ToolEmptyState,{testID:"buoy-routes-stack-empty",otto:"walking",title:"No navigation stack",message:"Navigate to a route to see the stack"})})}const j=(e,n,o,x)=>{if(r){const h=globalThis.window?.confirm;if(!h||h(`${e}
|
|
2
2
|
|
|
3
|
-
${n}`)){x()}return}_reactNative.Alert.alert(e,n,[{text:"Cancel",style:"cancel"},{text:o,style:"destructive",onPress:x}])};const R=()=>{if(!u){d(true);return}if(p){_reactNative.Alert.alert("Cannot Go Back","Already at the root of the stack");return}D()};const N=()=>{if(!u){d(true);return}if(p){_reactNative.Alert.alert("Already at Top","Stack only has one screen");return}j("Pop to Top","This will remove all screens except the root screen.","Pop to Top",C)};const v=e=>{V(a===e?null:e)};const P=()=>{if(!u){d(true);return}if(!i)return;if(i.isFocused){_reactNative.Alert.alert("Already There","This route is already visible");return}w(i.index)};const $=()=>{if(!u){d(true);return}if(!i)return;if(i.isFocused){_reactNative.Alert.alert("Cannot Pop","Selected route is already visible");return}if(i.index===l-1){_reactNative.Alert.alert("Cannot Pop","No screens above selected route");return}const e=l-1-i.index;const n=i.index;j("Pop to Route",`Remove ${e} screen${e!==1?"s":""} above ${i.pathname}?`,"Pop",()=>B(n))};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,g],children:[(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{testID:"buoy-routes-stack-scroll",style:styles.stackScroll,contentContainerStyle:[styles.stackContent,{paddingBottom:styles.stackContent.padding+F.bottom}],children:[...t].reverse().map((e,n)=>{const o=t.length-1-n;const x=a===o;const h=Object.keys(e.params).length>0;const s=(0,_testIDs.stackItemTestID)(o);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.stackItemWrapper,testID:s,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.stackItem,x&&styles.stackItemSelected],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.stackItemHeader,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.stackItemToggle,onPress:()=>v(o),activeOpacity:.7,testID:`${s}-toggle`,accessibilityRole:"button",accessibilityLabel:`${e.pathname}, ${e.isFocused?"focused":"mounted"}, position ${o} of ${l-1}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expandIndicator,children:x?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.stackItemPath,numberOfLines:1,testID:`${s}-path`,children:e.pathname})]}),(0,_jsxRuntime.jsx)(_sharedUi.InlineCopyButton,{value:e.pathname,buttonStyle:styles.copyRouteButton,testID:`${s}-copy`}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>v(o),activeOpacity:.7,accessible:false,style:[styles.statusBadge,{backgroundColor:e.isFocused?`${_sharedUi.buoyColors.success}15`:"#3B82F615",borderColor:e.isFocused?`${_sharedUi.buoyColors.success}40`:"#3B82F640"}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.statusBadgeText,{color:e.isFocused?_sharedUi.buoyColors.success:"#3B82F6"}],testID:`${s}-status`,children:e.isFocused?"FOCUSED":"MOUNTED"})})]}),x&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedContent,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.detailRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.detailLabel,children:"Route Name:"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.detailValue,testID:`${s}-name`,children:e.name})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.detailRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.detailLabel,children:"Position:"}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.detailValue,testID:`${s}-position`,children:[o," / ",l-1]})]}),h&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dataViewerContainer,children:(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"Parameters",data:e.params,showTypeFilter:false})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionsRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.actionButton,p&&styles.actionButtonDisabled],onPress:R,disabled:p,testID:`${s}-back`,accessibilityRole:"button",accessibilityLabel:"Go back one screen",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionButtonText,p&&styles.actionButtonTextDisabled],children:"Back"})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.helpText,children:"Go back one screen"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.actionButton,e.isFocused&&styles.actionButtonDisabled],onPress:P,disabled:e.isFocused,testID:`${s}-go`,accessibilityRole:"button",accessibilityLabel:`Navigate to ${e.pathname}`,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionButtonText,e.isFocused&&styles.actionButtonTextDisabled],children:"Go"})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.helpText,children:"Navigate to this route"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.actionButton,(e.isFocused||o===l-1)&&styles.actionButtonDisabled],onPress:$,disabled:e.isFocused||o===l-1,testID:`${s}-pop-to`,accessibilityRole:"button",accessibilityLabel:`Remove screens above ${e.pathname}`,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionButtonText,(e.isFocused||o===l-1)&&styles.actionButtonTextDisabled],children:"Pop To"})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.helpText,children:"Remove screens above this"})]})]})]})]})},`stack-${o}-${e.key}`)})}),(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:m,onClose:()=>d(false),featureName:"Stack Navigation"})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},loadingText:{color:_sharedUi.night.color.textSecondary,fontSize:14,fontFamily:_sharedUi.monoFont},errorContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},errorText:{color:_sharedUi.buoyColors.error,fontSize:16,fontWeight:"600",fontFamily:_sharedUi.monoFont,marginBottom:8},errorDetail:{color:_sharedUi.night.color.textSecondary,fontSize:12,fontFamily:_sharedUi.monoFont,textAlign:"center"},emptyContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyText:{color:_sharedUi.night.color.text,fontSize:16,fontWeight:"600",fontFamily:_sharedUi.monoFont,marginBottom:8},emptySubtext:{color:_sharedUi.night.color.textSecondary,fontSize:14,fontFamily:_sharedUi.monoFont,textAlign:"center"},stackScroll:{flex:1},stackContent:{padding:8},stackItemWrapper:{marginBottom:6},stackItem:{backgroundColor:_sharedUi.night.color.surface,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.border,overflow:"hidden"},stackItemSelected:{borderColor:_sharedUi.night.color.accent,borderWidth:2},stackItemHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:12,gap:8},stackItemToggle:{flex:1,flexDirection:"row",alignItems:"center",gap:8},expandIndicator:{width:20,alignItems:"center"},stackItemPath:{fontSize:13,fontWeight:"600",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,flex:1},copyRouteButton:{padding:4,marginLeft:4},statusBadge:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},statusBadgeText:{fontSize:10,fontWeight:"600",fontFamily:_sharedUi.monoFont},expandedContent:{paddingHorizontal:12,paddingTop:8,paddingBottom:12,borderTopWidth:1,borderTopColor:_sharedUi.night.color.border},detailRow:{marginBottom:8},detailLabel:{fontSize:10,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,marginBottom:2},detailValue:{fontSize:12,color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont},dataViewerContainer:{marginTop:4,marginHorizontal:-12,marginBottom:8},actionsRow:{flexDirection:"row",gap:6,marginTop:12},actionWrapper:{flex:1},actionButton:{backgroundColor:_sharedUi.night.color.surfaceElevated,paddingVertical:8,paddingHorizontal:8,borderRadius:6,alignItems:"center"},actionButtonDisabled:{opacity:.5},actionButtonText:{fontSize:12,fontWeight:"600",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont},actionButtonTextDisabled:{color:_sharedUi.night.color.textTertiary},helpText:{fontSize:9,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,textAlign:"center",marginTop:4,lineHeight:12}});
|
|
3
|
+
${n}`)){x()}return}_reactNative.Alert.alert(e,n,[{text:"Cancel",style:"cancel"},{text:o,style:"destructive",onPress:x}])};const R=()=>{if(!u){d(true);return}if(p){_reactNative.Alert.alert("Cannot Go Back","Already at the root of the stack");return}D()};const N=()=>{if(!u){d(true);return}if(p){_reactNative.Alert.alert("Already at Top","Stack only has one screen");return}j("Pop to Top","This will remove all screens except the root screen.","Pop to Top",C)};const v=e=>{V(a===e?null:e)};const P=()=>{if(!u){d(true);return}if(!i)return;if(i.isFocused){_reactNative.Alert.alert("Already There","This route is already visible");return}w(i.index)};const $=()=>{if(!u){d(true);return}if(!i)return;if(i.isFocused){_reactNative.Alert.alert("Cannot Pop","Selected route is already visible");return}if(i.index===l-1){_reactNative.Alert.alert("Cannot Pop","No screens above selected route");return}const e=l-1-i.index;const n=i.index;j("Pop to Route",`Remove ${e} screen${e!==1?"s":""} above ${i.pathname}?`,"Pop",()=>B(n))};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,g],children:[(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",testID:"buoy-routes-stack-scroll",style:styles.stackScroll,contentContainerStyle:[styles.stackContent,{paddingBottom:styles.stackContent.padding+F.bottom}],children:[...t].reverse().map((e,n)=>{const o=t.length-1-n;const x=a===o;const h=Object.keys(e.params).length>0;const s=(0,_testIDs.stackItemTestID)(o);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.stackItemWrapper,testID:s,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.stackItem,x&&styles.stackItemSelected],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.stackItemHeader,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.stackItemToggle,onPress:()=>v(o),activeOpacity:.7,testID:`${s}-toggle`,accessibilityRole:"button",accessibilityLabel:`${e.pathname}, ${e.isFocused?"focused":"mounted"}, position ${o} of ${l-1}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expandIndicator,children:x?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.stackItemPath,numberOfLines:1,testID:`${s}-path`,children:e.pathname})]}),(0,_jsxRuntime.jsx)(_sharedUi.InlineCopyButton,{value:e.pathname,buttonStyle:styles.copyRouteButton,testID:`${s}-copy`}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>v(o),activeOpacity:.7,accessible:false,style:[styles.statusBadge,{backgroundColor:e.isFocused?`${_sharedUi.buoyColors.success}15`:"#3B82F615",borderColor:e.isFocused?`${_sharedUi.buoyColors.success}40`:"#3B82F640"}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.statusBadgeText,{color:e.isFocused?_sharedUi.buoyColors.success:"#3B82F6"}],testID:`${s}-status`,children:e.isFocused?"FOCUSED":"MOUNTED"})})]}),x&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedContent,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.detailRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.detailLabel,children:"Route Name:"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.detailValue,testID:`${s}-name`,children:e.name})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.detailRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.detailLabel,children:"Position:"}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.detailValue,testID:`${s}-position`,children:[o," / ",l-1]})]}),h&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dataViewerContainer,children:(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"Parameters",data:e.params,showTypeFilter:false})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionsRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.actionButton,p&&styles.actionButtonDisabled],onPress:R,disabled:p,testID:`${s}-back`,accessibilityRole:"button",accessibilityLabel:"Go back one screen",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionButtonText,p&&styles.actionButtonTextDisabled],children:"Back"})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.helpText,children:"Go back one screen"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.actionButton,e.isFocused&&styles.actionButtonDisabled],onPress:P,disabled:e.isFocused,testID:`${s}-go`,accessibilityRole:"button",accessibilityLabel:`Navigate to ${e.pathname}`,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionButtonText,e.isFocused&&styles.actionButtonTextDisabled],children:"Go"})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.helpText,children:"Navigate to this route"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.actionButton,(e.isFocused||o===l-1)&&styles.actionButtonDisabled],onPress:$,disabled:e.isFocused||o===l-1,testID:`${s}-pop-to`,accessibilityRole:"button",accessibilityLabel:`Remove screens above ${e.pathname}`,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionButtonText,(e.isFocused||o===l-1)&&styles.actionButtonTextDisabled],children:"Pop To"})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.helpText,children:"Remove screens above this"})]})]})]})]})},`stack-${o}-${e.key}`)})}),(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:m,onClose:()=>d(false),featureName:"Stack Navigation"})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},loadingText:{color:_sharedUi.night.color.textSecondary,fontSize:14,fontFamily:_sharedUi.monoFont},errorContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},errorText:{color:_sharedUi.buoyColors.error,fontSize:16,fontWeight:"600",fontFamily:_sharedUi.monoFont,marginBottom:8},errorDetail:{color:_sharedUi.night.color.textSecondary,fontSize:12,fontFamily:_sharedUi.monoFont,textAlign:"center"},emptyContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyText:{color:_sharedUi.night.color.text,fontSize:16,fontWeight:"600",fontFamily:_sharedUi.monoFont,marginBottom:8},emptySubtext:{color:_sharedUi.night.color.textSecondary,fontSize:14,fontFamily:_sharedUi.monoFont,textAlign:"center"},stackScroll:{flex:1},stackContent:{padding:8},stackItemWrapper:{marginBottom:6},stackItem:{backgroundColor:_sharedUi.night.color.surface,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.border,overflow:"hidden"},stackItemSelected:{borderColor:_sharedUi.night.color.accent,borderWidth:2},stackItemHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:12,gap:8},stackItemToggle:{flex:1,flexDirection:"row",alignItems:"center",gap:8},expandIndicator:{width:20,alignItems:"center"},stackItemPath:{fontSize:13,fontWeight:"600",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,flex:1},copyRouteButton:{padding:4,marginLeft:4},statusBadge:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},statusBadgeText:{fontSize:10,fontWeight:"600",fontFamily:_sharedUi.monoFont},expandedContent:{paddingHorizontal:12,paddingTop:8,paddingBottom:12,borderTopWidth:1,borderTopColor:_sharedUi.night.color.border},detailRow:{marginBottom:8},detailLabel:{fontSize:10,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,marginBottom:2},detailValue:{fontSize:12,color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont},dataViewerContainer:{marginTop:4,marginHorizontal:-12,marginBottom:8},actionsRow:{flexDirection:"row",gap:6,marginTop:12},actionWrapper:{flex:1},actionButton:{backgroundColor:_sharedUi.night.color.surfaceElevated,paddingVertical:8,paddingHorizontal:8,borderRadius:6,alignItems:"center"},actionButtonDisabled:{opacity:.5},actionButtonText:{fontSize:12,fontWeight:"600",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont},actionButtonTextDisabled:{color:_sharedUi.night.color.textTertiary},helpText:{fontSize:9,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,textAlign:"center",marginTop:4,lineHeight:12}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ReactNavigationRoutes=ReactNavigationRoutes;var _react=require("react");var _reactNative=require("react-native");var _safeReactNavigation=require("../utils/safeReactNavigation");var _sharedUi=require("@buoy-gg/shared-ui");var _license=require("@buoy-gg/license");var _jsxRuntime=require("react/jsx-runtime");const CommonActions=(0,_safeReactNavigation.getCommonActions)();function collectNavigatorGroups(e,t="Root"){if(!e)return[];const r=[];const s=e.routeNames||[];const i=new Set((e.routes||[]).map(a=>a.name));const u=e.index??0;const h=e.routes?.[u]?.name;if(s.length>0){const a=s.map(d=>({name:d,isMounted:i.has(d),isFocused:d===h}));r.push({name:t==="Root"?"Root":t.split(" > ").pop(),path:t,screens:a,totalScreens:a.length})}for(const a of e.routes||[]){if(a.state){const d=`${t} > ${a.name}`;const f=collectNavigatorGroups(a.state,d);r.push(...f)}}return r}function findScreenPath(e,t){if(!e||!e.routes)return null;const r=e.routeNames||[];if(r.includes(t)){return[t]}for(const s of e.routes){if(s.state){const i=findScreenPath(s.state,t);if(i){return[s.name,...i]}}}return null}function buildNestedNavigateAction(e){if(e.length===0)return null;if(e.length===1){return CommonActions.navigate({name:e[0]})}let t={screen:e[e.length-1]};for(let r=e.length-2;r>=1;r--){t={screen:e[r],params:t}}return CommonActions.navigate({name:e[0],params:t})}function ReactNavigationRoutes({style:e}){const t=(0,_safeReactNavigation.useSafeNavigationContainerRef)();const[r,s]=(0,_react.useState)(()=>t?.getRootState?.()??null);const[i,u]=(0,_react.useState)("");const[h,a]=(0,_react.useState)(false);const[d,f]=(0,_react.useState)(null);const[x,S]=(0,_react.useState)(false);const[m,y]=(0,_react.useState)(false);const p=(0,_license.useIsPro)();(0,_react.useEffect)(()=>{if(m&&p){y(false)}},[m,p]);(0,_react.useEffect)(()=>{if(!t)return;const o=t.getRootState?.();if(o){s(o)}const n=t.addListener?.("state",()=>{const l=t.getRootState?.();if(l){s(l)}});return()=>{n?.()}},[t]);const c=(0,_react.useMemo)(()=>collectNavigatorGroups(r),[r]);(0,_react.useEffect)(()=>{if(c.length>0&&d===null){f(c[0].path)}},[c.length]);const b=(0,_react.useMemo)(()=>{const o=[];for(const n of c){for(const l of n.screens){o.push({name:l.name,navigatorPath:n.path,isMounted:l.isMounted,isFocused:l.isFocused})}}return o},[c]);const j=(0,_react.useMemo)(()=>{if(!i.trim())return c;const o=i.toLowerCase();return c.map(n=>({...n,screens:n.screens.filter(l=>l.name.toLowerCase().includes(o))})).filter(n=>n.screens.length>0)},[c,i]);const g=(0,_react.useMemo)(()=>{const o=b.length;const n=b.filter(B=>B.isMounted).length;const l=o-n;const F=c.length;return{total:o,mounted:n,available:l,navigators:F}},[b,c]);const T=(0,_react.useMemo)(()=>{return{summary:{totalScreens:g.total,mounted:g.mounted,available:g.available,navigators:g.navigators,timestamp:new Date().toISOString()},navigators:c.map(o=>({path:o.path,screens:o.screens.map(n=>({name:n.name,isMounted:n.isMounted,isFocused:n.isFocused}))}))}},[c,g]);const C=(0,_react.useCallback)(o=>{f(n=>n===o?null:o)},[]);const v=(0,_react.useCallback)(o=>{if(!p){y(true);return}if(!t||!r)return;try{const n=findScreenPath(r,o);if(n){const l=buildNestedNavigateAction(n);if(l){t.dispatch(l);return}}t.dispatch(CommonActions.navigate({name:o}))}catch(n){_reactNative.Alert.alert("Navigation Error",String(n))}},[t,r,p]);const w=(0,_react.useCallback)(()=>{if(x||!t)return;S(true);const o=t.getRootState?.();if(o){s(o)}setTimeout(()=>S(false),400)},[x,t]);if(!r){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.container,e],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyState,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyText,children:"No navigation state available"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptySubtext,children:"Ensure you are inside a NavigationContainer"})]})})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,e],children:[h&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.searchContainer,children:[(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:16,color:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.searchInput,placeholder:"Search screens...",placeholderTextColor:_sharedUi.night.color.placeholder,value:i,onChangeText:u,autoCapitalize:"none",autoCorrect:false,autoFocus:true}),i.length>0&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>u(""),style:styles.clearButton,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.clearButtonText,children:"\u2715"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.closeSearchButton,onPress:()=>{a(false);u("")},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.closeSearchText,children:"Done"})})]}),(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.scrollView,contentContainerStyle:styles.scrollContent,children:[!h&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.header,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionsRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionWrapper,children:[(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{value:T,buttonStyle:styles.actionButtonHeader}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionLabel,children:"Copy"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.iconButton,x&&styles.refreshButtonDisabled],onPress:w,disabled:x,children:(0,_jsxRuntime.jsx)(_sharedUi.RefreshCw,{size:16,color:x?_sharedUi.night.color.textTertiary:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionLabel,children:"Refresh"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.iconButton,onPress:()=>a(true),children:(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:16,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionLabel,children:"Search"})]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statsGrid,children:[(0,_jsxRuntime.jsx)(StatItem,{value:g.total,label:"Screens"}),(0,_jsxRuntime.jsx)(StatItem,{value:g.mounted,label:"Mounted"}),(0,_jsxRuntime.jsx)(StatItem,{value:g.available,label:"Available"}),(0,_jsxRuntime.jsx)(StatItem,{value:g.navigators,label:"Navigators"})]})]}),j.length===0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.emptyState,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyText,children:i?"No matching screens":"No screens found"})}):j.map(o=>(0,_jsxRuntime.jsx)(NavigatorGroupView,{group:o,isExpanded:i.length>0||d===o.path,onToggleExpand:()=>C(o.path),onNavigate:v},o.path)),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.metaFooter,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.metaText,children:"Source: navigation state"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.sourceBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sourceText,children:"React Navigation"})})]})]}),(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:m,onClose:()=>y(false),featureName:"Route Navigation"})]})}function StatItem({value:e,label:t}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statItem,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statValue,children:e}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statLabel,children:t})]})}function NavigatorGroupView({group:e,isExpanded:t,onToggleExpand:r,onNavigate:s}){const[i,u]=(0,_react.useState)(null);const h=(0,_react.useCallback)(a=>{u(d=>d===a?null:a)},[]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.groupContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.groupHeader,onPress:r,activeOpacity:.7,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.groupHeaderLeft,children:[t?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textSecondary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupTitle,numberOfLines:1,children:e.name})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.groupBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupCount,children:e.screens.length})})]}),t&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.screensList,children:[e.path!=="Root"&&e.path.includes(" > ")&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.groupDescription,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupDescriptionText,children:e.path})}),e.screens.map(a=>(0,_jsxRuntime.jsx)(ScreenItemView,{screen:a,isExpanded:i===a.name,onToggleExpand:()=>h(a.name),onNavigate:s},a.name))]})]})}function ScreenItemView({screen:e,isExpanded:t,onToggleExpand:r,onNavigate:s}){const i=e.isFocused?_sharedUi.buoyColors.success:e.isMounted?"#3B82F6":_sharedUi.night.color.textTertiary;const u=e.isFocused?"FOCUSED":e.isMounted?"MOUNTED":"AVAILABLE";return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.screenItem,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.screenCard,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.screenHeaderLeft,onPress:r,activeOpacity:.7,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expandIndicator,children:t?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.screenName,numberOfLines:1,children:e.name})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.screenHeaderActions,children:[(0,_jsxRuntime.jsx)(_sharedUi.InlineCopyButton,{value:e.name,buttonStyle:styles.headerActionButton}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.headerActionButton,styles.navigateButton],onPress:()=>s(e.name),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.navigateButtonText,children:"Go"})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.statusBadge,{backgroundColor:`${i}15`,borderColor:`${i}40`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.statusText,{color:i}],children:u})})]})]})})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},emptyState:{padding:32,alignItems:"center"},emptyText:{color:_sharedUi.night.color.textSecondary,fontSize:14,fontFamily:_sharedUi.monoFont},emptySubtext:{color:_sharedUi.night.color.textTertiary,fontSize:12,fontFamily:_sharedUi.monoFont,marginTop:8},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:12,paddingBottom:4},actionWrapper:{alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},actionLabel:{fontSize:8,color:_sharedUi.night.color.textTertiary,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.5},refreshButtonDisabled:{opacity:.5},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"20%",minWidth:70,backgroundColor:_sharedUi.night.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont},statLabel:{fontSize:10,color:_sharedUi.night.color.textTertiary,marginTop:4,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.5},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border},searchInput:{flex:1,color:_sharedUi.night.color.text,fontSize:14,fontFamily:_sharedUi.monoFont},clearButton:{padding:4},clearButtonText:{color:_sharedUi.night.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:_sharedUi.night.color.accent,fontSize:14,fontWeight:"600",fontFamily:_sharedUi.monoFont},scrollView:{flex:1},scrollContent:{paddingBottom:8},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:_sharedUi.night.color.border},metaText:{fontSize:12,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface},sourceText:{fontSize:11,color:_sharedUi.night.color.textSecondary,textTransform:"capitalize",fontFamily:_sharedUi.monoFont},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:_sharedUi.night.color.surface,borderLeftWidth:3,borderLeftColor:_sharedUi.night.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:_sharedUi.monoFont},screensList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:_sharedUi.night.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:_sharedUi.night.color.fillTertiary},groupDescriptionText:{fontSize:11,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,lineHeight:16},screenItem:{marginBottom:6},screenCard:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,paddingHorizontal:12,backgroundColor:_sharedUi.night.color.surface,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.border,shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},screenHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},expandIndicator:{width:20,alignItems:"center"},screenName:{fontSize:13,fontWeight:"600",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,flex:1},screenHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},statusBadge:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},statusText:{fontSize:10,fontWeight:"600",fontFamily:_sharedUi.monoFont},headerActionButton:{padding:6,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated,borderWidth:1,borderColor:_sharedUi.night.color.border,alignItems:"center",justifyContent:"center"},navigateButton:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorder},navigateButtonText:{fontSize:12,color:_sharedUi.night.color.accent,fontFamily:_sharedUi.monoFont,fontWeight:"600"}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ReactNavigationRoutes=ReactNavigationRoutes;var _react=require("react");var _reactNative=require("react-native");var _safeReactNavigation=require("../utils/safeReactNavigation");var _sharedUi=require("@buoy-gg/shared-ui");var _license=require("@buoy-gg/license");var _jsxRuntime=require("react/jsx-runtime");const CommonActions=(0,_safeReactNavigation.getCommonActions)();function collectNavigatorGroups(e,t="Root"){if(!e)return[];const r=[];const s=e.routeNames||[];const i=new Set((e.routes||[]).map(a=>a.name));const u=e.index??0;const h=e.routes?.[u]?.name;if(s.length>0){const a=s.map(d=>({name:d,isMounted:i.has(d),isFocused:d===h}));r.push({name:t==="Root"?"Root":t.split(" > ").pop(),path:t,screens:a,totalScreens:a.length})}for(const a of e.routes||[]){if(a.state){const d=`${t} > ${a.name}`;const f=collectNavigatorGroups(a.state,d);r.push(...f)}}return r}function findScreenPath(e,t){if(!e||!e.routes)return null;const r=e.routeNames||[];if(r.includes(t)){return[t]}for(const s of e.routes){if(s.state){const i=findScreenPath(s.state,t);if(i){return[s.name,...i]}}}return null}function buildNestedNavigateAction(e){if(e.length===0)return null;if(e.length===1){return CommonActions.navigate({name:e[0]})}let t={screen:e[e.length-1]};for(let r=e.length-2;r>=1;r--){t={screen:e[r],params:t}}return CommonActions.navigate({name:e[0],params:t})}function ReactNavigationRoutes({style:e}){const t=(0,_safeReactNavigation.useSafeNavigationContainerRef)();const[r,s]=(0,_react.useState)(()=>t?.getRootState?.()??null);const[i,u]=(0,_react.useState)("");const[h,a]=(0,_react.useState)(false);const[d,f]=(0,_react.useState)(null);const[x,S]=(0,_react.useState)(false);const[m,y]=(0,_react.useState)(false);const p=(0,_license.useIsPro)();(0,_react.useEffect)(()=>{if(m&&p){y(false)}},[m,p]);(0,_react.useEffect)(()=>{if(!t)return;const o=t.getRootState?.();if(o){s(o)}const n=t.addListener?.("state",()=>{const l=t.getRootState?.();if(l){s(l)}});return()=>{n?.()}},[t]);const c=(0,_react.useMemo)(()=>collectNavigatorGroups(r),[r]);(0,_react.useEffect)(()=>{if(c.length>0&&d===null){f(c[0].path)}},[c.length]);const b=(0,_react.useMemo)(()=>{const o=[];for(const n of c){for(const l of n.screens){o.push({name:l.name,navigatorPath:n.path,isMounted:l.isMounted,isFocused:l.isFocused})}}return o},[c]);const j=(0,_react.useMemo)(()=>{if(!i.trim())return c;const o=i.toLowerCase();return c.map(n=>({...n,screens:n.screens.filter(l=>l.name.toLowerCase().includes(o))})).filter(n=>n.screens.length>0)},[c,i]);const g=(0,_react.useMemo)(()=>{const o=b.length;const n=b.filter(B=>B.isMounted).length;const l=o-n;const F=c.length;return{total:o,mounted:n,available:l,navigators:F}},[b,c]);const T=(0,_react.useMemo)(()=>{return{summary:{totalScreens:g.total,mounted:g.mounted,available:g.available,navigators:g.navigators,timestamp:new Date().toISOString()},navigators:c.map(o=>({path:o.path,screens:o.screens.map(n=>({name:n.name,isMounted:n.isMounted,isFocused:n.isFocused}))}))}},[c,g]);const C=(0,_react.useCallback)(o=>{f(n=>n===o?null:o)},[]);const v=(0,_react.useCallback)(o=>{if(!p){y(true);return}if(!t||!r)return;try{const n=findScreenPath(r,o);if(n){const l=buildNestedNavigateAction(n);if(l){t.dispatch(l);return}}t.dispatch(CommonActions.navigate({name:o}))}catch(n){_reactNative.Alert.alert("Navigation Error",String(n))}},[t,r,p]);const w=(0,_react.useCallback)(()=>{if(x||!t)return;S(true);const o=t.getRootState?.();if(o){s(o)}setTimeout(()=>S(false),400)},[x,t]);if(!r){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.container,e],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyState,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyText,children:"No navigation state available"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptySubtext,children:"Ensure you are inside a NavigationContainer"})]})})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,e],children:[h&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.searchContainer,children:[(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:16,color:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.searchInput,placeholder:"Search screens...",placeholderTextColor:_sharedUi.night.color.placeholder,value:i,onChangeText:u,autoCapitalize:"none",autoCorrect:false,autoFocus:true}),i.length>0&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>u(""),style:styles.clearButton,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.clearButtonText,children:"\u2715"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.closeSearchButton,onPress:()=>{a(false);u("")},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.closeSearchText,children:"Done"})})]}),(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",style:styles.scrollView,contentContainerStyle:styles.scrollContent,children:[!h&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.header,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionsRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionWrapper,children:[(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{value:T,buttonStyle:styles.actionButtonHeader}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionLabel,children:"Copy"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.iconButton,x&&styles.refreshButtonDisabled],onPress:w,disabled:x,children:(0,_jsxRuntime.jsx)(_sharedUi.RefreshCw,{size:16,color:x?_sharedUi.night.color.textTertiary:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionLabel,children:"Refresh"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.iconButton,onPress:()=>a(true),children:(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:16,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionLabel,children:"Search"})]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statsGrid,children:[(0,_jsxRuntime.jsx)(StatItem,{value:g.total,label:"Screens"}),(0,_jsxRuntime.jsx)(StatItem,{value:g.mounted,label:"Mounted"}),(0,_jsxRuntime.jsx)(StatItem,{value:g.available,label:"Available"}),(0,_jsxRuntime.jsx)(StatItem,{value:g.navigators,label:"Navigators"})]})]}),j.length===0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.emptyState,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyText,children:i?"No matching screens":"No screens found"})}):j.map(o=>(0,_jsxRuntime.jsx)(NavigatorGroupView,{group:o,isExpanded:i.length>0||d===o.path,onToggleExpand:()=>C(o.path),onNavigate:v},o.path)),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.metaFooter,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.metaText,children:"Source: navigation state"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.sourceBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sourceText,children:"React Navigation"})})]})]}),(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:m,onClose:()=>y(false),featureName:"Route Navigation"})]})}function StatItem({value:e,label:t}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statItem,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statValue,children:e}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statLabel,children:t})]})}function NavigatorGroupView({group:e,isExpanded:t,onToggleExpand:r,onNavigate:s}){const[i,u]=(0,_react.useState)(null);const h=(0,_react.useCallback)(a=>{u(d=>d===a?null:a)},[]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.groupContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.groupHeader,onPress:r,activeOpacity:.7,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.groupHeaderLeft,children:[t?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textSecondary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupTitle,numberOfLines:1,children:e.name})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.groupBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupCount,children:e.screens.length})})]}),t&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.screensList,children:[e.path!=="Root"&&e.path.includes(" > ")&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.groupDescription,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupDescriptionText,children:e.path})}),e.screens.map(a=>(0,_jsxRuntime.jsx)(ScreenItemView,{screen:a,isExpanded:i===a.name,onToggleExpand:()=>h(a.name),onNavigate:s},a.name))]})]})}function ScreenItemView({screen:e,isExpanded:t,onToggleExpand:r,onNavigate:s}){const i=e.isFocused?_sharedUi.buoyColors.success:e.isMounted?"#3B82F6":_sharedUi.night.color.textTertiary;const u=e.isFocused?"FOCUSED":e.isMounted?"MOUNTED":"AVAILABLE";return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.screenItem,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.screenCard,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.screenHeaderLeft,onPress:r,activeOpacity:.7,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expandIndicator,children:t?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.screenName,numberOfLines:1,children:e.name})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.screenHeaderActions,children:[(0,_jsxRuntime.jsx)(_sharedUi.InlineCopyButton,{value:e.name,buttonStyle:styles.headerActionButton}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.headerActionButton,styles.navigateButton],onPress:()=>s(e.name),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.navigateButtonText,children:"Go"})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.statusBadge,{backgroundColor:`${i}15`,borderColor:`${i}40`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.statusText,{color:i}],children:u})})]})]})})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},emptyState:{padding:32,alignItems:"center"},emptyText:{color:_sharedUi.night.color.textSecondary,fontSize:14,fontFamily:_sharedUi.monoFont},emptySubtext:{color:_sharedUi.night.color.textTertiary,fontSize:12,fontFamily:_sharedUi.monoFont,marginTop:8},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:12,paddingBottom:4},actionWrapper:{alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},actionLabel:{fontSize:8,color:_sharedUi.night.color.textTertiary,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.5},refreshButtonDisabled:{opacity:.5},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"20%",minWidth:70,backgroundColor:_sharedUi.night.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont},statLabel:{fontSize:10,color:_sharedUi.night.color.textTertiary,marginTop:4,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.5},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border},searchInput:{flex:1,color:_sharedUi.night.color.text,fontSize:14,fontFamily:_sharedUi.monoFont},clearButton:{padding:4},clearButtonText:{color:_sharedUi.night.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:_sharedUi.night.color.accent,fontSize:14,fontWeight:"600",fontFamily:_sharedUi.monoFont},scrollView:{flex:1},scrollContent:{paddingBottom:8},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:_sharedUi.night.color.border},metaText:{fontSize:12,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface},sourceText:{fontSize:11,color:_sharedUi.night.color.textSecondary,textTransform:"capitalize",fontFamily:_sharedUi.monoFont},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:_sharedUi.night.color.surface,borderLeftWidth:3,borderLeftColor:_sharedUi.night.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:_sharedUi.monoFont},screensList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:_sharedUi.night.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:_sharedUi.night.color.fillTertiary},groupDescriptionText:{fontSize:11,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,lineHeight:16},screenItem:{marginBottom:6},screenCard:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,paddingHorizontal:12,backgroundColor:_sharedUi.night.color.surface,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.border,shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},screenHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},expandIndicator:{width:20,alignItems:"center"},screenName:{fontSize:13,fontWeight:"600",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,flex:1},screenHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},statusBadge:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},statusText:{fontSize:10,fontWeight:"600",fontFamily:_sharedUi.monoFont},headerActionButton:{padding:6,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated,borderWidth:1,borderColor:_sharedUi.night.color.border,alignItems:"center",justifyContent:"center"},navigateButton:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorder},navigateButtonText:{fontSize:12,color:_sharedUi.night.color.accent,fontFamily:_sharedUi.monoFont,fontWeight:"600"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.RouteEventDetail=RouteEventDetail;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _RouteEventExpandedContent=require("./RouteEventExpandedContent");var _routeTemplate=require("../utils/routeTemplate");var _jsxRuntime=require("react/jsx-runtime");function RouteEventDetail({event:e,visitNumber:o=1,onNavigate:t}){const r=(0,_routeTemplate.getRouteTemplate)(e.pathname,e.segments);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{testID:"buoy-routes-detail-scroll",style:styles.scroll,contentContainerStyle:styles.scrollContent,showsVerticalScrollIndicator:true,children:(0,_jsxRuntime.jsx)(_RouteEventExpandedContent.RouteEventExpandedContent,{event:e,visitNumber:o,routeTemplate:r})}),t&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.footer,children:(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.goButton,onPress:()=>t((0,_routeTemplate.routeHref)(e.pathname,e.params)),activeOpacity:.8,testID:"buoy-routes-detail-go",accessibilityRole:"button",accessibilityLabel:`Go to route ${e.pathname}`,children:[(0,_jsxRuntime.jsx)(_sharedUi.Navigation,{size:16,color:_sharedUi.night.color.onAccent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.goButtonText,children:"Go to route"})]})})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},scroll:{flex:1},scrollContent:{padding:14},footer:{paddingHorizontal:16,paddingVertical:12,backgroundColor:"transparent",borderTopWidth:1,borderTopColor:_sharedUi.night.color.border},goButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,backgroundColor:_sharedUi.night.color.accent,paddingVertical:12,borderRadius:8},goButtonText:{fontSize:13,fontWeight:"600",color:_sharedUi.night.color.onAccent,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.5}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.RouteEventDetail=RouteEventDetail;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _RouteEventExpandedContent=require("./RouteEventExpandedContent");var _routeTemplate=require("../utils/routeTemplate");var _jsxRuntime=require("react/jsx-runtime");function RouteEventDetail({event:e,visitNumber:o=1,onNavigate:t}){const r=(0,_routeTemplate.getRouteTemplate)(e.pathname,e.segments);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",testID:"buoy-routes-detail-scroll",style:styles.scroll,contentContainerStyle:styles.scrollContent,showsVerticalScrollIndicator:true,children:(0,_jsxRuntime.jsx)(_RouteEventExpandedContent.RouteEventExpandedContent,{event:e,visitNumber:o,routeTemplate:r})}),t&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.footer,children:(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.goButton,onPress:()=>t((0,_routeTemplate.routeHref)(e.pathname,e.params)),activeOpacity:.8,testID:"buoy-routes-detail-go",accessibilityRole:"button",accessibilityLabel:`Go to route ${e.pathname}`,children:[(0,_jsxRuntime.jsx)(_sharedUi.Navigation,{size:16,color:_sharedUi.night.color.onAccent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.goButtonText,children:"Go to route"})]})})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},scroll:{flex:1},scrollContent:{padding:14},footer:{paddingHorizontal:16,paddingVertical:12,backgroundColor:"transparent",borderTopWidth:1,borderTopColor:_sharedUi.night.color.border},goButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,backgroundColor:_sharedUi.night.color.accent,paddingVertical:12,borderRadius:8},goButtonText:{fontSize:13,fontWeight:"600",color:_sharedUi.night.color.onAccent,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.5}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.RouteEventsTimeline=RouteEventsTimeline;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _RouteEventItemCompact=require("./RouteEventItemCompact");var _jsxRuntime=require("react/jsx-runtime");function RouteEventsTimeline({events:r,visitCounts:i,onNavigate:n,onSelectEvent:o}){const a=(0,_react.useCallback)(e=>{const t=r[e];if(!t)return;o(t,i.get(t)||1)},[r,i,o]);if(r.length===0){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyState,testID:"buoy-routes-empty",children:[(0,_jsxRuntime.jsx)(_sharedUi.Navigation,{size:48,color:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyTitle,testID:"buoy-routes-empty-title",children:"No events yet"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptySubtitle,testID:"buoy-routes-empty-subtitle",children:"Navigation events will appear here"})]})}return(0,_jsxRuntime.jsx)(_reactNative.FlatList,{testID:"buoy-routes-timeline",contentContainerStyle:styles.listContent,data:r,keyExtractor:e=>`${e.timestamp}-${e.pathname}`,renderItem:({item:e,index:t})=>(0,_jsxRuntime.jsx)(_RouteEventItemCompact.RouteEventItemCompact,{event:e,visitNumber:i.get(e)||1,isExpanded:false,index:t,onPress:a,onNavigate:n}),showsVerticalScrollIndicator:true,..._sharedUi.EVENT_LIST_PRESET})}const styles=_reactNative.StyleSheet.create({listContent:{paddingVertical:8},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:_sharedUi.night.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:_sharedUi.monoFont,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:_sharedUi.night.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:_sharedUi.monoFont}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.RouteEventsTimeline=RouteEventsTimeline;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _RouteEventItemCompact=require("./RouteEventItemCompact");var _jsxRuntime=require("react/jsx-runtime");function RouteEventsTimeline({events:r,visitCounts:i,onNavigate:n,onSelectEvent:o}){const a=(0,_react.useCallback)(e=>{const t=r[e];if(!t)return;o(t,i.get(t)||1)},[r,i,o]);if(r.length===0){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyState,testID:"buoy-routes-empty",children:[(0,_jsxRuntime.jsx)(_sharedUi.Navigation,{size:48,color:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyTitle,testID:"buoy-routes-empty-title",children:"No events yet"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptySubtitle,testID:"buoy-routes-empty-subtitle",children:"Navigation events will appear here"})]})}return(0,_jsxRuntime.jsx)(_reactNative.FlatList,{keyboardShouldPersistTaps:"handled",testID:"buoy-routes-timeline",contentContainerStyle:styles.listContent,data:r,keyExtractor:e=>`${e.timestamp}-${e.pathname}`,renderItem:({item:e,index:t})=>(0,_jsxRuntime.jsx)(_RouteEventItemCompact.RouteEventItemCompact,{event:e,visitNumber:i.get(e)||1,isExpanded:false,index:t,onPress:a,onNavigate:n}),showsVerticalScrollIndicator:true,..._sharedUi.EVENT_LIST_PRESET})}const styles=_reactNative.StyleSheet.create({listContent:{paddingVertical:8},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:_sharedUi.night.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:_sharedUi.monoFont,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:_sharedUi.night.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:_sharedUi.monoFont}});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.RoutesSitemap=RoutesSitemap;var _react=require("react");var _sharedUi=require("@buoy-gg/shared-ui");var _reactNative=require("react-native");var _license=require("@buoy-gg/license");var _useRouteSitemap=require("../useRouteSitemap");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");const IS_DESKTOP=_reactNative.Platform.OS==="web"&&!(0,_license.isCapacitorNative)();const ACTION_ICON_SIZE=IS_DESKTOP?22:16;const HOME_ROUTE={path:"/",name:"index",type:"index",params:[],nodeType:"route",contextKey:"/",isInternal:false,children:[],depth:0};function RoutesSitemap({style:e,injectedRoutes:l,injectedSource:c,injectedLastUpdatedAt:u,onNavigateRoute:d}){const[n,p]=(0,_react.useState)("");const[x,s]=(0,_react.useState)(false);const[m,T]=(0,_react.useState)(new Set(["Static Routes","Dynamic Routes"]));const[h,f]=(0,_react.useState)(false);const[w,D]=(0,_react.useState)(false);const b=(0,_license.useIsPro)();(0,_react.useEffect)(()=>{if(w&&b){D(false)}},[w,b]);const y=(0,_sharedUi.useSafeRouter)();const{groups:j,stats:a,isLoaded:E,isSupported:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.RoutesSitemap=RoutesSitemap;var _react=require("react");var _sharedUi=require("@buoy-gg/shared-ui");var _reactNative=require("react-native");var _license=require("@buoy-gg/license");var _useRouteSitemap=require("../useRouteSitemap");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");const IS_DESKTOP=_reactNative.Platform.OS==="web"&&!(0,_license.isCapacitorNative)();const ACTION_ICON_SIZE=IS_DESKTOP?22:16;const HOME_ROUTE={path:"/",name:"index",type:"index",params:[],nodeType:"route",contextKey:"/",isInternal:false,children:[],depth:0};function RoutesSitemap({style:e,injectedRoutes:l,injectedSource:c,injectedLastUpdatedAt:u,onNavigateRoute:d}){const[n,p]=(0,_react.useState)("");const[x,s]=(0,_react.useState)(false);const[m,T]=(0,_react.useState)(new Set(["Static Routes","Dynamic Routes"]));const[h,f]=(0,_react.useState)(false);const[w,D]=(0,_react.useState)(false);const b=(0,_license.useIsPro)();(0,_react.useEffect)(()=>{if(w&&b){D(false)}},[w,b]);const y=(0,_sharedUi.useSafeRouter)();const{groups:j,stats:a,isLoaded:E,isSupported:P,filteredRoutes:I,routes:F,refresh:z,lastUpdatedAt:B,source:R}=(0,_useRouteSitemap.useRouteSitemap)({searchQuery:n,sortBy:"path",injectedRoutes:l,injectedSource:c,injectedLastUpdatedAt:u});const O=(0,_react.useMemo)(()=>{return{summary:{total:a.total,static:a.static,dynamic:a.dynamic,layouts:a.layouts,groups:a.groups,timestamp:new Date().toISOString()},groups:j.map(t=>({title:t.title,description:t.description,count:t.routes.length,routes:t.routes.map(o=>({path:o.path,name:o.name,type:o.type,params:o.params,depth:o.depth,hasChildren:o.children.length>0,childrenCount:o.children.length}))})),allRoutes:F.map(t=>t.path)}},[j,a,F]);const A=(0,_react.useCallback)(t=>{T(o=>{const i=new Set(o);if(i.has(t)){i.delete(t)}else{i.add(t)}return i})},[]);const C=(0,_react.useCallback)((t,o=0,i={})=>{const V=t.params;if(o>=V.length){let r=t.path;Object.entries(i).forEach(([g,H])=>{if(t.type==="catch-all"){r=r.replace(`[...${g}]`,H)}else{r=r.replace(`[${g}]`,H)}});try{y.push(r)}catch(g){_reactNative.Alert.alert("Navigation Error",String(g))}return}const S=V[o];const $=t.type==="catch-all"?`[...${S}]`:`[${S}]`;const L="Enter Parameter Value";const W=`Enter value for ${$}:
|
|
2
2
|
|
|
3
3
|
Route: ${t.path}`;const U=r=>{if(r&&r.trim()){C(t,o+1,{...i,[S]:r.trim()})}};if(typeof _reactNative.Alert.prompt!=="function"){const r=globalThis.prompt;if(r)U(r(`${L}
|
|
4
4
|
|
|
5
|
-
${W}`));else _reactNative.Alert.alert(L,`${t.path} needs a value for ${$}, and this platform can't ask for one here.`);return}_reactNative.Alert.prompt(L,W,[{text:"Cancel",style:"cancel"},{text:o<V.length-1?"Next":"Navigate",onPress:r=>{if(r&&r.trim()){const g={...i,[S]:r.trim()};C(t,o+1,g)}else{_reactNative.Alert.alert("Invalid Value","Please enter a value for the parameter")}}}],"plain-text")},[y]);const v=(0,_react.useCallback)((t,o)=>{if(d){d(t);return}if(!b&&!o?.bypassPro){D(true);return}if(t.type==="layout"||t.type==="group"){_reactNative.Alert.alert("Cannot Navigate",`${t.type==="layout"?"Layouts":"Route groups"} are not navigable routes`);return}if(t.type==="dynamic"||t.type==="catch-all"){if(t.params.length===0){try{y.push(t.path)}catch(i){_reactNative.Alert.alert("Navigation Error",String(i))}return}C(t);return}try{y.push(t.path)}catch(i){_reactNative.Alert.alert("Navigation Error",String(i))}},[y,C,b,d]);const N=(0,_react.useCallback)(()=>{v(HOME_ROUTE,{bypassPro:true})},[v]);const G=(0,_react.useCallback)(()=>{if(h)return;f(true);z();setTimeout(()=>f(false),400)},[h,z]);const _=(0,_react.useMemo)(()=>{if(!B)return"Awaiting route data";return`Updated ${(0,_sharedUi.formatRelativeTime)(B)}`},[B]);const M=(0,_react.useMemo)(()=>{if(!R)return"Source: unknown";return`Source: ${R}`},[R]);const k=(0,_react.useMemo)(()=>{if(n&&I.length>0){return[{title:"Search Results",icon:"",routes:I}]}return j},[n,I,j]);if(!E){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.container,e],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.loadingContainer,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.loadingText,testID:"buoy-routes-sitemap-loading",children:O?"Loading routes...":"Route sitemap isn't available on the dashboard \u2014 the route tree lives on the device. Use the Events tab to see navigation here."})})})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,e],children:[x&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.searchContainer,testID:"buoy-routes-sitemap-search-field",children:[(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:16,color:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.searchInput,placeholder:"Search routes...",placeholderTextColor:_sharedUi.night.color.placeholder,value:n,onChangeText:p,autoCapitalize:"none",autoCorrect:false,autoFocus:true,testID:"buoy-routes-sitemap-search",accessibilityLabel:"Search routes"}),n.length>0&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>p(""),style:styles.clearButton,testID:"buoy-routes-sitemap-search-clear",accessibilityRole:"button",accessibilityLabel:"Clear route search",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.clearButtonText,children:"\u2715"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.closeSearchButton,onPress:()=>{s(false);p("")},testID:"buoy-routes-sitemap-search-done",accessibilityRole:"button",accessibilityLabel:"Done searching routes",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.closeSearchText,children:"Done"})})]}),(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{testID:"buoy-routes-sitemap-scroll",style:styles.scrollView,contentContainerStyle:styles.scrollContent,children:[!x&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.header,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionsRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.iconButton,IS_DESKTOP&&styles.iconButtonDesktop],onPress:N,accessibilityLabel:"Go to home route",accessibilityRole:"button",testID:"buoy-routes-sitemap-home",children:(0,_jsxRuntime.jsx)(_sharedUi.Home,{size:ACTION_ICON_SIZE,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Home"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_sharedUi.CopyButton,{value:P,testID:"buoy-routes-sitemap-copy",size:IS_DESKTOP?ACTION_ICON_SIZE:14,buttonStyle:IS_DESKTOP?styles.actionButtonHeaderDesktop:styles.actionButtonHeader}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Copy"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.iconButton,IS_DESKTOP&&styles.iconButtonDesktop,h&&styles.refreshButtonDisabled],onPress:G,disabled:h,testID:"buoy-routes-sitemap-refresh",accessibilityRole:"button",accessibilityLabel:"Refresh route tree",children:(0,_jsxRuntime.jsx)(_sharedUi.RefreshCw,{size:ACTION_ICON_SIZE,color:h?_sharedUi.night.color.textTertiary:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Refresh"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.iconButton,IS_DESKTOP&&styles.iconButtonDesktop],onPress:()=>s(true),testID:"buoy-routes-sitemap-search-open",accessibilityRole:"button",accessibilityLabel:"Search routes",children:(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:ACTION_ICON_SIZE,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Search"})]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statsGrid,children:[(0,_jsxRuntime.jsx)(StatItem,{value:a.total,label:"Total",id:"total"}),(0,_jsxRuntime.jsx)(StatItem,{value:a.static,label:"Static",id:"static"}),(0,_jsxRuntime.jsx)(StatItem,{value:a.dynamic,label:"Dynamic",id:"dynamic"}),(0,_jsxRuntime.jsx)(StatItem,{value:a.catchAll,label:"Catch-All",id:"catch-all"}),(0,_jsxRuntime.jsx)(StatItem,{value:a.layouts,label:"Layouts",id:"layouts"}),(0,_jsxRuntime.jsx)(StatItem,{value:a.groups,label:"Groups",id:"groups"})]})]}),k.length===0?(0,_jsxRuntime.jsx)(_sharedUi.ToolEmptyState,{testID:"buoy-routes-sitemap-empty",otto:"map",title:"No routes found",message:"Nothing in the router matches. Clear the search to see the whole tree."}):k.map(t=>(0,_jsxRuntime.jsx)(RouteGroupView,{group:t,isExpanded:n.length>0||m.has(t.title),onToggleExpand:()=>A(t.title),onNavigate:v},t.title)),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.metaFooter,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.metaText,testID:"buoy-routes-sitemap-updated",children:_}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.sourceBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sourceText,testID:"buoy-routes-sitemap-source",children:M})})]})]}),(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:w,onClose:()=>D(false),featureName:"Route Navigation"})]})}function StatItem({value:e,label:l,id:c}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statItem,testID:`buoy-routes-stat-${c}`,accessibilityLabel:`${l}, ${e}`,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statValue,testID:`buoy-routes-stat-${c}-value`,children:e}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statLabel,children:l})]})}function RouteGroupView({group:e,isExpanded:l,onToggleExpand:c,onNavigate:u}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.groupContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.groupHeader,onPress:c,activeOpacity:.7,testID:(0,_testIDs.sitemapGroupTestID)(e.title),accessibilityRole:"button",accessibilityLabel:`${e.title}, ${e.routes.length} routes`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.groupHeaderLeft,children:[l?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textSecondary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupTitle,children:e.title})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.groupBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupCount,testID:`${(0,_testIDs.sitemapGroupTestID)(e.title)}-count`,children:e.routes.length})})]}),e.description&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.groupDescription,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupDescriptionText,children:e.description})}),l&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.routesList,children:e.routes.map((d,n)=>(0,_jsxRuntime.jsx)(RouteItemView,{route:d,onNavigate:u},`${d.path}-${n}`))})]})}function RouteItemView({route:e,depth:l=0,onNavigate:c}){const[u,d]=(0,_react.useState)(false);const n=e.children.length>0;const p=getRouteTypeColor(e.type);const x=e.type!=="layout"&&e.type!=="group";const s=(0,_testIDs.sitemapRouteTestID)(e.path);const m=n;const T=m?u:true;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.routeItem,{marginLeft:l*12}],testID:s,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeCard,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeHeader,children:[m?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.routeHeaderLeft,onPress:()=>d(!u),activeOpacity:.7,testID:`${s}-toggle`,accessibilityRole:"button",accessibilityLabel:`${e.path}, ${e.type}, ${e.children.length} nested`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expandIndicator,children:u?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.routePath,numberOfLines:3,testID:`${s}-path`,children:e.path})]}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeHeaderLeft,accessible:true,accessibilityLabel:`${e.path}, ${e.type}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expandIndicator}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.routePath,numberOfLines:3,testID:`${s}-path`,children:e.path})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeHeaderActions,children:[n&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.childCountBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.childCountText,testID:`${s}-children-count`,children:e.children.length})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.typeTag,{backgroundColor:`${p}15`,borderColor:`${p}40`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.typeText,{color:p}],testID:`${s}-type`,children:e.type.toUpperCase()})}),(0,_jsxRuntime.jsx)(_sharedUi.InlineCopyButton,{value:e.path,buttonStyle:styles.iconAction,testID:`${s}-copy`}),x&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.goButton,onPress:()=>c(e),activeOpacity:.7,testID:`${s}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${e.path}`,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.goButtonText,children:"Go"})})]})]}),T&&n&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.childrenContainer,children:e.children.map((h,f)=>(0,_jsxRuntime.jsx)(RouteItemView,{route:h,depth:l+1,onNavigate:c},`${h.path}-${f}`))})]})})}function getRouteTypeColor(e){switch(e){case"static":return"#3B82F6";case"dynamic":return"#F59E0B";case"catch-all":return"#EC4899";case"index":return"#10B981";case"layout":return"#8B5CF6";case"group":return"#6366F1";case"not-found":return"#EF4444";default:return"#6B7280"}}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"},loadingText:{color:_sharedUi.night.color.textSecondary,fontSize:14,fontFamily:_sharedUi.monoFont,textAlign:"center",lineHeight:20,paddingHorizontal:32,maxWidth:420},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,paddingBottom:4},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"30%",minWidth:90,backgroundColor:_sharedUi.night.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont},statLabel:{fontSize:10,color:_sharedUi.night.color.textTertiary,marginTop:4,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.5},actionWrapper:{flex:1,alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionWrapperDesktop:{gap:8,minWidth:72},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated},actionButtonHeaderDesktop:{padding:12,borderRadius:8,backgroundColor:_sharedUi.night.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},iconButtonDesktop:{padding:12,borderRadius:8,backgroundColor:_sharedUi.night.color.surfaceElevated},actionLabel:{fontSize:8,color:_sharedUi.night.color.textTertiary,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.5},actionLabelDesktop:{fontSize:12},refreshButtonDisabled:{opacity:.5},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:_sharedUi.night.color.border},metaText:{fontSize:12,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface},sourceText:{fontSize:11,color:_sharedUi.night.color.textSecondary,textTransform:"capitalize",fontFamily:_sharedUi.monoFont},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border},searchInput:{flex:1,color:_sharedUi.night.color.text,fontSize:14,fontFamily:_sharedUi.monoFont},clearButton:{padding:4},clearButtonText:{color:_sharedUi.night.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:_sharedUi.night.color.accent,fontSize:14,fontWeight:"600",fontFamily:_sharedUi.monoFont},scrollView:{flex:1},scrollContent:{paddingBottom:8},emptyState:{padding:32,alignItems:"center"},emptyText:{color:_sharedUi.night.color.textSecondary,fontSize:14,fontFamily:_sharedUi.monoFont},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:_sharedUi.night.color.surface,borderLeftWidth:3,borderLeftColor:_sharedUi.night.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:_sharedUi.monoFont},routesList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:_sharedUi.night.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:_sharedUi.night.color.fillTertiary},groupDescriptionText:{fontSize:11,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,lineHeight:16},routeItem:{marginBottom:6},routeCard:{backgroundColor:_sharedUi.night.color.surface,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.border,overflow:"hidden",shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},routeHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:7,paddingHorizontal:10,gap:8},expandIndicator:{width:18,alignItems:"center"},routeHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},routePath:{fontSize:13,fontWeight:"600",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,flex:1},routeHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},childCountBadge:{backgroundColor:"#6B728015",borderColor:"#6B728040",borderWidth:1,borderRadius:12,paddingHorizontal:7,paddingVertical:2,minWidth:22,alignItems:"center",justifyContent:"center"},childCountText:{fontSize:11,fontWeight:"600",color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont},typeTag:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},typeText:{fontSize:10,fontWeight:"600",fontFamily:_sharedUi.monoFont},iconAction:{width:28,height:24,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated,borderWidth:1,borderColor:_sharedUi.night.color.border,alignItems:"center",justifyContent:"center"},goButton:{height:24,paddingHorizontal:10,borderRadius:4,alignItems:"center",justifyContent:"center",backgroundColor:_sharedUi.night.color.accentSoft,borderWidth:1,borderColor:_sharedUi.night.color.accentBorder},goButtonText:{fontSize:12,color:_sharedUi.night.color.accent,fontFamily:_sharedUi.monoFont,fontWeight:"600"},childrenContainer:{borderLeftWidth:2,borderLeftColor:_sharedUi.night.color.border,marginLeft:16,marginRight:8,marginTop:2,marginBottom:8}});
|
|
5
|
+
${W}`));else _reactNative.Alert.alert(L,`${t.path} needs a value for ${$}, and this platform can't ask for one here.`);return}_reactNative.Alert.prompt(L,W,[{text:"Cancel",style:"cancel"},{text:o<V.length-1?"Next":"Navigate",onPress:r=>{if(r&&r.trim()){const g={...i,[S]:r.trim()};C(t,o+1,g)}else{_reactNative.Alert.alert("Invalid Value","Please enter a value for the parameter")}}}],"plain-text")},[y]);const v=(0,_react.useCallback)((t,o)=>{if(d){d(t);return}if(!b&&!o?.bypassPro){D(true);return}if(t.type==="layout"||t.type==="group"){_reactNative.Alert.alert("Cannot Navigate",`${t.type==="layout"?"Layouts":"Route groups"} are not navigable routes`);return}if(t.type==="dynamic"||t.type==="catch-all"){if(t.params.length===0){try{y.push(t.path)}catch(i){_reactNative.Alert.alert("Navigation Error",String(i))}return}C(t);return}try{y.push(t.path)}catch(i){_reactNative.Alert.alert("Navigation Error",String(i))}},[y,C,b,d]);const N=(0,_react.useCallback)(()=>{v(HOME_ROUTE,{bypassPro:true})},[v]);const G=(0,_react.useCallback)(()=>{if(h)return;f(true);z();setTimeout(()=>f(false),400)},[h,z]);const _=(0,_react.useMemo)(()=>{if(!B)return"Awaiting route data";return`Updated ${(0,_sharedUi.formatRelativeTime)(B)}`},[B]);const M=(0,_react.useMemo)(()=>{if(!R)return"Source: unknown";return`Source: ${R}`},[R]);const k=(0,_react.useMemo)(()=>{if(n&&I.length>0){return[{title:"Search Results",icon:"",routes:I}]}return j},[n,I,j]);if(!E){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.container,e],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.loadingContainer,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.loadingText,testID:"buoy-routes-sitemap-loading",children:P?"Loading routes...":"Route sitemap isn't available on the dashboard \u2014 the route tree lives on the device. Use the Events tab to see navigation here."})})})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,e],children:[x&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.searchContainer,testID:"buoy-routes-sitemap-search-field",children:[(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:16,color:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.searchInput,placeholder:"Search routes...",placeholderTextColor:_sharedUi.night.color.placeholder,value:n,onChangeText:p,autoCapitalize:"none",autoCorrect:false,autoFocus:true,testID:"buoy-routes-sitemap-search",accessibilityLabel:"Search routes"}),n.length>0&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>p(""),style:styles.clearButton,testID:"buoy-routes-sitemap-search-clear",accessibilityRole:"button",accessibilityLabel:"Clear route search",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.clearButtonText,children:"\u2715"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.closeSearchButton,onPress:()=>{s(false);p("")},testID:"buoy-routes-sitemap-search-done",accessibilityRole:"button",accessibilityLabel:"Done searching routes",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.closeSearchText,children:"Done"})})]}),(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",testID:"buoy-routes-sitemap-scroll",style:styles.scrollView,contentContainerStyle:styles.scrollContent,children:[!x&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.header,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionsRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.iconButton,IS_DESKTOP&&styles.iconButtonDesktop],onPress:N,accessibilityLabel:"Go to home route",accessibilityRole:"button",testID:"buoy-routes-sitemap-home",children:(0,_jsxRuntime.jsx)(_sharedUi.Home,{size:ACTION_ICON_SIZE,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Home"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_sharedUi.CopyButton,{value:O,testID:"buoy-routes-sitemap-copy",size:IS_DESKTOP?ACTION_ICON_SIZE:14,buttonStyle:IS_DESKTOP?styles.actionButtonHeaderDesktop:styles.actionButtonHeader}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Copy"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.iconButton,IS_DESKTOP&&styles.iconButtonDesktop,h&&styles.refreshButtonDisabled],onPress:G,disabled:h,testID:"buoy-routes-sitemap-refresh",accessibilityRole:"button",accessibilityLabel:"Refresh route tree",children:(0,_jsxRuntime.jsx)(_sharedUi.RefreshCw,{size:ACTION_ICON_SIZE,color:h?_sharedUi.night.color.textTertiary:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Refresh"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.iconButton,IS_DESKTOP&&styles.iconButtonDesktop],onPress:()=>s(true),testID:"buoy-routes-sitemap-search-open",accessibilityRole:"button",accessibilityLabel:"Search routes",children:(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:ACTION_ICON_SIZE,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Search"})]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statsGrid,children:[(0,_jsxRuntime.jsx)(StatItem,{value:a.total,label:"Total",id:"total"}),(0,_jsxRuntime.jsx)(StatItem,{value:a.static,label:"Static",id:"static"}),(0,_jsxRuntime.jsx)(StatItem,{value:a.dynamic,label:"Dynamic",id:"dynamic"}),(0,_jsxRuntime.jsx)(StatItem,{value:a.catchAll,label:"Catch-All",id:"catch-all"}),(0,_jsxRuntime.jsx)(StatItem,{value:a.layouts,label:"Layouts",id:"layouts"}),(0,_jsxRuntime.jsx)(StatItem,{value:a.groups,label:"Groups",id:"groups"})]})]}),k.length===0?(0,_jsxRuntime.jsx)(_sharedUi.ToolEmptyState,{testID:"buoy-routes-sitemap-empty",otto:"map",title:"No routes found",message:"Nothing in the router matches. Clear the search to see the whole tree."}):k.map(t=>(0,_jsxRuntime.jsx)(RouteGroupView,{group:t,isExpanded:n.length>0||m.has(t.title),onToggleExpand:()=>A(t.title),onNavigate:v},t.title)),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.metaFooter,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.metaText,testID:"buoy-routes-sitemap-updated",children:_}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.sourceBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sourceText,testID:"buoy-routes-sitemap-source",children:M})})]})]}),(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:w,onClose:()=>D(false),featureName:"Route Navigation"})]})}function StatItem({value:e,label:l,id:c}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statItem,testID:`buoy-routes-stat-${c}`,accessibilityLabel:`${l}, ${e}`,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statValue,testID:`buoy-routes-stat-${c}-value`,children:e}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statLabel,children:l})]})}function RouteGroupView({group:e,isExpanded:l,onToggleExpand:c,onNavigate:u}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.groupContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.groupHeader,onPress:c,activeOpacity:.7,testID:(0,_testIDs.sitemapGroupTestID)(e.title),accessibilityRole:"button",accessibilityLabel:`${e.title}, ${e.routes.length} routes`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.groupHeaderLeft,children:[l?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textSecondary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupTitle,children:e.title})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.groupBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupCount,testID:`${(0,_testIDs.sitemapGroupTestID)(e.title)}-count`,children:e.routes.length})})]}),e.description&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.groupDescription,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupDescriptionText,children:e.description})}),l&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.routesList,children:e.routes.map((d,n)=>(0,_jsxRuntime.jsx)(RouteItemView,{route:d,onNavigate:u},`${d.path}-${n}`))})]})}function RouteItemView({route:e,depth:l=0,onNavigate:c}){const[u,d]=(0,_react.useState)(false);const n=e.children.length>0;const p=getRouteTypeColor(e.type);const x=e.type!=="layout"&&e.type!=="group";const s=(0,_testIDs.sitemapRouteTestID)(e.path);const m=n;const T=m?u:true;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.routeItem,{marginLeft:l*12}],testID:s,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeCard,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeHeader,children:[m?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.routeHeaderLeft,onPress:()=>d(!u),activeOpacity:.7,testID:`${s}-toggle`,accessibilityRole:"button",accessibilityLabel:`${e.path}, ${e.type}, ${e.children.length} nested`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expandIndicator,children:u?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.routePath,numberOfLines:3,testID:`${s}-path`,children:e.path})]}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeHeaderLeft,accessible:true,accessibilityLabel:`${e.path}, ${e.type}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expandIndicator}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.routePath,numberOfLines:3,testID:`${s}-path`,children:e.path})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeHeaderActions,children:[n&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.childCountBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.childCountText,testID:`${s}-children-count`,children:e.children.length})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.typeTag,{backgroundColor:`${p}15`,borderColor:`${p}40`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.typeText,{color:p}],testID:`${s}-type`,children:e.type.toUpperCase()})}),(0,_jsxRuntime.jsx)(_sharedUi.InlineCopyButton,{value:e.path,buttonStyle:styles.iconAction,testID:`${s}-copy`}),x&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.goButton,onPress:()=>c(e),activeOpacity:.7,testID:`${s}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${e.path}`,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.goButtonText,children:"Go"})})]})]}),T&&n&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.childrenContainer,children:e.children.map((h,f)=>(0,_jsxRuntime.jsx)(RouteItemView,{route:h,depth:l+1,onNavigate:c},`${h.path}-${f}`))})]})})}function getRouteTypeColor(e){switch(e){case"static":return"#3B82F6";case"dynamic":return"#F59E0B";case"catch-all":return"#EC4899";case"index":return"#10B981";case"layout":return"#8B5CF6";case"group":return"#6366F1";case"not-found":return"#EF4444";default:return"#6B7280"}}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"},loadingText:{color:_sharedUi.night.color.textSecondary,fontSize:14,fontFamily:_sharedUi.monoFont,textAlign:"center",lineHeight:20,paddingHorizontal:32,maxWidth:420},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,paddingBottom:4},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"30%",minWidth:90,backgroundColor:_sharedUi.night.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont},statLabel:{fontSize:10,color:_sharedUi.night.color.textTertiary,marginTop:4,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.5},actionWrapper:{flex:1,alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionWrapperDesktop:{gap:8,minWidth:72},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated},actionButtonHeaderDesktop:{padding:12,borderRadius:8,backgroundColor:_sharedUi.night.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},iconButtonDesktop:{padding:12,borderRadius:8,backgroundColor:_sharedUi.night.color.surfaceElevated},actionLabel:{fontSize:8,color:_sharedUi.night.color.textTertiary,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.5},actionLabelDesktop:{fontSize:12},refreshButtonDisabled:{opacity:.5},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:_sharedUi.night.color.border},metaText:{fontSize:12,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface},sourceText:{fontSize:11,color:_sharedUi.night.color.textSecondary,textTransform:"capitalize",fontFamily:_sharedUi.monoFont},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border},searchInput:{flex:1,color:_sharedUi.night.color.text,fontSize:14,fontFamily:_sharedUi.monoFont},clearButton:{padding:4},clearButtonText:{color:_sharedUi.night.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:_sharedUi.night.color.accent,fontSize:14,fontWeight:"600",fontFamily:_sharedUi.monoFont},scrollView:{flex:1},scrollContent:{paddingBottom:8},emptyState:{padding:32,alignItems:"center"},emptyText:{color:_sharedUi.night.color.textSecondary,fontSize:14,fontFamily:_sharedUi.monoFont},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:_sharedUi.night.color.surface,borderLeftWidth:3,borderLeftColor:_sharedUi.night.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:_sharedUi.monoFont},routesList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:_sharedUi.night.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:_sharedUi.night.color.fillTertiary},groupDescriptionText:{fontSize:11,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,lineHeight:16},routeItem:{marginBottom:6},routeCard:{backgroundColor:_sharedUi.night.color.surface,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.border,overflow:"hidden",shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},routeHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:7,paddingHorizontal:10,gap:8},expandIndicator:{width:18,alignItems:"center"},routeHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},routePath:{fontSize:13,fontWeight:"600",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,flex:1},routeHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},childCountBadge:{backgroundColor:"#6B728015",borderColor:"#6B728040",borderWidth:1,borderRadius:12,paddingHorizontal:7,paddingVertical:2,minWidth:22,alignItems:"center",justifyContent:"center"},childCountText:{fontSize:11,fontWeight:"600",color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont},typeTag:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},typeText:{fontSize:10,fontWeight:"600",fontFamily:_sharedUi.monoFont},iconAction:{width:28,height:24,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated,borderWidth:1,borderColor:_sharedUi.night.color.border,alignItems:"center",justifyContent:"center"},goButton:{height:24,paddingHorizontal:10,borderRadius:4,alignItems:"center",justifyContent:"center",backgroundColor:_sharedUi.night.color.accentSoft,borderWidth:1,borderColor:_sharedUi.night.color.accentBorder},goButtonText:{fontSize:12,color:_sharedUi.night.color.accent,fontFamily:_sharedUi.monoFont,fontWeight:"600"},childrenContainer:{borderLeftWidth:2,borderLeftColor:_sharedUi.night.color.border,marginLeft:16,marginRight:8,marginTop:2,marginBottom:8}});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";import{useState as L,useMemo as D,useEffect as V}from"react";import{View as n,Text as r,ScrollView as q,TouchableOpacity as I,StyleSheet as K,Alert as T}from"react-native";import{ChevronDown as Q,ChevronRight as X,InlineCopyButton as Y,ProUpgradeModal as Z,buoyColors as F,night as a,useSafeAreaInsets as ee,ToolEmptyState as te,monoFont as d}from"@buoy-gg/shared-ui";import{useIsPro as oe}from"@buoy-gg/license";import{DataViewer as ne}from"@buoy-gg/shared-ui/dataViewer";import{useNavigationStack as ae}from"../useNavigationStack";import{stackItemTestID as re}from"../utils/testIDs";import{jsx as o,jsxs as i}from"react/jsx-runtime";export function NavigationStack({style:B,injectedStack:R,onAction:y,onCopyValueChange
|
|
1
|
+
"use strict";import{useState as L,useMemo as D,useEffect as V}from"react";import{View as n,Text as r,ScrollView as q,TouchableOpacity as I,StyleSheet as K,Alert as T}from"react-native";import{ChevronDown as Q,ChevronRight as X,InlineCopyButton as Y,ProUpgradeModal as Z,buoyColors as F,night as a,useSafeAreaInsets as ee,ToolEmptyState as te,monoFont as d}from"@buoy-gg/shared-ui";import{useIsPro as oe}from"@buoy-gg/license";import{DataViewer as ne}from"@buoy-gg/shared-ui/dataViewer";import{useNavigationStack as ae}from"../useNavigationStack";import{stackItemTestID as re}from"../utils/testIDs";import{jsx as o,jsxs as i}from"react/jsx-runtime";export function NavigationStack({style:B,injectedStack:R,onAction:y,onCopyValueChange:P}){const f=ae();const v=R!=null;const E=ee({minBottom:8});const s=v?R:f.stack;const j=v?true:f.isLoaded;const $=v?null:f.error;const w=D(()=>s.find(t=>t.isFocused)??null,[s]);const g=s.length;const k=g<=1;const H=t=>y?y("navigateToIndex",{index:t}):f.navigateToIndex(t);const O=t=>y?y("popToIndex",{index:t}):f.popToIndex(t);const G=()=>y?y("goBack"):f.goBack();const M=()=>y?y("popToTop"):f.popToTop();const[u,U]=L(null);const[C,m]=L(false);const x=oe();V(()=>{if(C&&x){m(false)}},[C,x]);const z=D(()=>{const t=s.map(c=>({pathname:c.pathname,name:c.name,params:c.params,isFocused:c.isFocused}));return JSON.stringify(t,null,2)},[s]);V(()=>{P?.(z)},[z,P]);const h=D(()=>{if(u!==null&&s[u]){return s[u]}return w},[u,s,w]);const se=D(()=>{return u!==null&&s[u]&&!s[u].isFocused},[u,s]);if(!j){return o(n,{style:[e.container,B],children:o(n,{style:e.loadingContainer,children:o(r,{style:e.loadingText,testID:"buoy-routes-stack-loading",children:"Loading navigation stack..."})})})}if($){return o(n,{style:[e.container,B],children:i(n,{style:e.errorContainer,testID:"buoy-routes-stack-error",children:[o(r,{style:e.errorText,children:"Error loading stack"}),o(r,{style:e.errorDetail,testID:"buoy-routes-stack-error-detail",children:$.message})]})})}if(s.length===0){return o(n,{style:[e.container,B],children:o(te,{testID:"buoy-routes-stack-empty",otto:"walking",title:"No navigation stack",message:"Navigate to a route to see the stack"})})}const W=(t,c,l,b)=>{if(y){const S=globalThis.window?.confirm;if(!S||S(`${t}
|
|
2
2
|
|
|
3
|
-
${c}`)){b()}return}T.alert(t,c,[{text:"Cancel",style:"cancel"},{text:l,style:"destructive",onPress:b}])};const _=()=>{if(!x){m(true);return}if(k){T.alert("Cannot Go Back","Already at the root of the stack");return}G()};const ie=()=>{if(!x){m(true);return}if(k){T.alert("Already at Top","Stack only has one screen");return}W("Pop to Top","This will remove all screens except the root screen.","Pop to Top",M)};const N=t=>{U(u===t?null:t)};const A=()=>{if(!x){m(true);return}if(!
|
|
3
|
+
${c}`)){b()}return}T.alert(t,c,[{text:"Cancel",style:"cancel"},{text:l,style:"destructive",onPress:b}])};const _=()=>{if(!x){m(true);return}if(k){T.alert("Cannot Go Back","Already at the root of the stack");return}G()};const ie=()=>{if(!x){m(true);return}if(k){T.alert("Already at Top","Stack only has one screen");return}W("Pop to Top","This will remove all screens except the root screen.","Pop to Top",M)};const N=t=>{U(u===t?null:t)};const A=()=>{if(!x){m(true);return}if(!h)return;if(h.isFocused){T.alert("Already There","This route is already visible");return}H(h.index)};const J=()=>{if(!x){m(true);return}if(!h)return;if(h.isFocused){T.alert("Cannot Pop","Selected route is already visible");return}if(h.index===g-1){T.alert("Cannot Pop","No screens above selected route");return}const t=g-1-h.index;const c=h.index;W("Pop to Route",`Remove ${t} screen${t!==1?"s":""} above ${h.pathname}?`,"Pop",()=>O(c))};return i(n,{style:[e.container,B],children:[o(q,{keyboardShouldPersistTaps:"handled",testID:"buoy-routes-stack-scroll",style:e.stackScroll,contentContainerStyle:[e.stackContent,{paddingBottom:e.stackContent.padding+E.bottom}],children:[...s].reverse().map((t,c)=>{const l=s.length-1-c;const b=u===l;const S=Object.keys(t.params).length>0;const p=re(l);return o(n,{style:e.stackItemWrapper,testID:p,children:i(n,{style:[e.stackItem,b&&e.stackItemSelected],children:[i(n,{style:e.stackItemHeader,children:[i(I,{style:e.stackItemToggle,onPress:()=>N(l),activeOpacity:.7,testID:`${p}-toggle`,accessibilityRole:"button",accessibilityLabel:`${t.pathname}, ${t.isFocused?"focused":"mounted"}, position ${l} of ${g-1}`,children:[o(n,{style:e.expandIndicator,children:b?o(Q,{size:14,color:a.color.textSecondary}):o(X,{size:14,color:a.color.textSecondary})}),o(r,{style:e.stackItemPath,numberOfLines:1,testID:`${p}-path`,children:t.pathname})]}),o(Y,{value:t.pathname,buttonStyle:e.copyRouteButton,testID:`${p}-copy`}),o(I,{onPress:()=>N(l),activeOpacity:.7,accessible:false,style:[e.statusBadge,{backgroundColor:t.isFocused?`${F.success}15`:"#3B82F615",borderColor:t.isFocused?`${F.success}40`:"#3B82F640"}],children:o(r,{style:[e.statusBadgeText,{color:t.isFocused?F.success:"#3B82F6"}],testID:`${p}-status`,children:t.isFocused?"FOCUSED":"MOUNTED"})})]}),b&&i(n,{style:e.expandedContent,children:[i(n,{style:e.detailRow,children:[o(r,{style:e.detailLabel,children:"Route Name:"}),o(r,{style:e.detailValue,testID:`${p}-name`,children:t.name})]}),i(n,{style:e.detailRow,children:[o(r,{style:e.detailLabel,children:"Position:"}),i(r,{style:e.detailValue,testID:`${p}-position`,children:[l," / ",g-1]})]}),S&&o(n,{style:e.dataViewerContainer,children:o(ne,{title:"Parameters",data:t.params,showTypeFilter:false})}),i(n,{style:e.actionsRow,children:[i(n,{style:e.actionWrapper,children:[o(I,{style:[e.actionButton,k&&e.actionButtonDisabled],onPress:_,disabled:k,testID:`${p}-back`,accessibilityRole:"button",accessibilityLabel:"Go back one screen",children:o(r,{style:[e.actionButtonText,k&&e.actionButtonTextDisabled],children:"Back"})}),o(r,{style:e.helpText,children:"Go back one screen"})]}),i(n,{style:e.actionWrapper,children:[o(I,{style:[e.actionButton,t.isFocused&&e.actionButtonDisabled],onPress:A,disabled:t.isFocused,testID:`${p}-go`,accessibilityRole:"button",accessibilityLabel:`Navigate to ${t.pathname}`,children:o(r,{style:[e.actionButtonText,t.isFocused&&e.actionButtonTextDisabled],children:"Go"})}),o(r,{style:e.helpText,children:"Navigate to this route"})]}),i(n,{style:e.actionWrapper,children:[o(I,{style:[e.actionButton,(t.isFocused||l===g-1)&&e.actionButtonDisabled],onPress:J,disabled:t.isFocused||l===g-1,testID:`${p}-pop-to`,accessibilityRole:"button",accessibilityLabel:`Remove screens above ${t.pathname}`,children:o(r,{style:[e.actionButtonText,(t.isFocused||l===g-1)&&e.actionButtonTextDisabled],children:"Pop To"})}),o(r,{style:e.helpText,children:"Remove screens above this"})]})]})]})]})},`stack-${l}-${t.key}`)})}),o(Z,{visible:C,onClose:()=>m(false),featureName:"Stack Navigation"})]})}const e=K.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},loadingText:{color:a.color.textSecondary,fontSize:14,fontFamily:d},errorContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},errorText:{color:F.error,fontSize:16,fontWeight:"600",fontFamily:d,marginBottom:8},errorDetail:{color:a.color.textSecondary,fontSize:12,fontFamily:d,textAlign:"center"},emptyContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyText:{color:a.color.text,fontSize:16,fontWeight:"600",fontFamily:d,marginBottom:8},emptySubtext:{color:a.color.textSecondary,fontSize:14,fontFamily:d,textAlign:"center"},stackScroll:{flex:1},stackContent:{padding:8},stackItemWrapper:{marginBottom:6},stackItem:{backgroundColor:a.color.surface,borderRadius:6,borderWidth:1,borderColor:a.color.border,overflow:"hidden"},stackItemSelected:{borderColor:a.color.accent,borderWidth:2},stackItemHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:12,gap:8},stackItemToggle:{flex:1,flexDirection:"row",alignItems:"center",gap:8},expandIndicator:{width:20,alignItems:"center"},stackItemPath:{fontSize:13,fontWeight:"600",color:a.color.text,fontFamily:d,flex:1},copyRouteButton:{padding:4,marginLeft:4},statusBadge:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},statusBadgeText:{fontSize:10,fontWeight:"600",fontFamily:d},expandedContent:{paddingHorizontal:12,paddingTop:8,paddingBottom:12,borderTopWidth:1,borderTopColor:a.color.border},detailRow:{marginBottom:8},detailLabel:{fontSize:10,color:a.color.textSecondary,fontFamily:d,marginBottom:2},detailValue:{fontSize:12,color:a.color.text,fontFamily:d},dataViewerContainer:{marginTop:4,marginHorizontal:-12,marginBottom:8},actionsRow:{flexDirection:"row",gap:6,marginTop:12},actionWrapper:{flex:1},actionButton:{backgroundColor:a.color.surfaceElevated,paddingVertical:8,paddingHorizontal:8,borderRadius:6,alignItems:"center"},actionButtonDisabled:{opacity:.5},actionButtonText:{fontSize:12,fontWeight:"600",color:a.color.text,fontFamily:d},actionButtonTextDisabled:{color:a.color.textTertiary},helpText:{fontSize:9,color:a.color.textSecondary,fontFamily:d,textAlign:"center",marginTop:4,lineHeight:12}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useState as S,useCallback as I,useMemo as B,useEffect as N}from"react";import{View as i,Text as g,TextInput as _,TouchableOpacity as C,ScrollView as q,StyleSheet as J,Alert as K}from"react-native";import{getCommonActions as X,useSafeNavigationContainerRef as Y}from"../utils/safeReactNavigation";const D=X();import{Search as k,ChevronDown as A,ChevronRight as E,InlineCopyButton as Z,ToolbarCopyButton as ee,RefreshCw as te,ProUpgradeModal as oe,buoyColors as re,night as o,monoFont as f}from"@buoy-gg/shared-ui";import{useIsPro as ne}from"@buoy-gg/license";import{jsx as t,jsxs as d}from"react/jsx-runtime";function M(r,n="Root"){if(!r)return[];const s=[];const h=r.routeNames||[];const u=new Set((r.routes||[]).map(c=>c.name));const x=r.index??0;const v=r.routes?.[x]?.name;if(h.length>0){const c=h.map(y=>({name:y,isMounted:u.has(y),isFocused:y===v}));s.push({name:n==="Root"?"Root":n.split(" > ").pop(),path:n,screens:c,totalScreens:c.length})}for(const c of r.routes||[]){if(c.state){const y=`${n} > ${c.name}`;const w=M(c.state,y);s.push(...w)}}return s}function j(r,n){if(!r||!r.routes)return null;const s=r.routeNames||[];if(s.includes(n)){return[n]}for(const h of r.routes){if(h.state){const u=j(h.state,n);if(u){return[h.name,...u]}}}return null}function ae(r){if(r.length===0)return null;if(r.length===1){return D.navigate({name:r[0]})}let n={screen:r[r.length-1]};for(let s=r.length-2;s>=1;s--){n={screen:r[s],params:n}}return D.navigate({name:r[0],params:n})}export function ReactNavigationRoutes({style:r}){const n=Y();const[s,h]=S(()=>n?.getRootState?.()??null);const[u,x]=S("");const[v,c]=S(false);const[y,w]=S(null);const[T,H]=S(false);const[F,W]=S(false);const z=ne();N(()=>{if(F&&z){W(false)}},[F,z]);N(()=>{if(!n)return;const a=n.getRootState?.();if(a){h(a)}const l=n.addListener?.("state",()=>{const p=n.getRootState?.();if(p){h(p)}});return()=>{l?.()}},[n]);const m=B(()=>M(s),[s]);N(()=>{if(m.length>0&&y===null){w(m[0].path)}},[m.length]);const L=B(()=>{const a=[];for(const l of m){for(const p of l.screens){a.push({name:p.name,navigatorPath:l.path,isMounted:p.isMounted,isFocused:p.isFocused})}}return a},[m]);const V=B(()=>{if(!u.trim())return m;const a=u.toLowerCase();return m.map(l=>({...l,screens:l.screens.filter(p=>p.name.toLowerCase().includes(a))})).filter(l=>l.screens.length>0)},[m,u]);const b=B(()=>{const a=L.length;const l=L.filter(Q=>Q.isMounted).length;const p=a-l;const $=m.length;return{total:a,mounted:l,available:p,navigators:$}},[L,m]);const G=B(()=>{return{summary:{totalScreens:b.total,mounted:b.mounted,available:b.available,navigators:b.navigators,timestamp:new Date().toISOString()},navigators:m.map(a=>({path:a.path,screens:a.screens.map(l=>({name:l.name,isMounted:l.isMounted,isFocused:l.isFocused}))}))}},[m,b]);const O=I(a=>{w(l=>l===a?null:a)},[]);const P=I(a=>{if(!z){W(true);return}if(!n||!s)return;try{const l=j(s,a);if(l){const p=ae(l);if(p){n.dispatch(p);return}}n.dispatch(D.navigate({name:a}))}catch(l){K.alert("Navigation Error",String(l))}},[n,s,z]);const U=I(()=>{if(T||!n)return;H(true);const a=n.getRootState?.();if(a){h(a)}setTimeout(()=>H(false),400)},[T,n]);if(!s){return t(i,{style:[e.container,r],children:d(i,{style:e.emptyState,children:[t(g,{style:e.emptyText,children:"No navigation state available"}),t(g,{style:e.emptySubtext,children:"Ensure you are inside a NavigationContainer"})]})})}return d(i,{style:[e.container,r],children:[v&&d(i,{style:e.searchContainer,children:[t(k,{size:16,color:o.color.textTertiary}),t(_,{style:e.searchInput,placeholder:"Search screens...",placeholderTextColor:o.color.placeholder,value:u,onChangeText:x,autoCapitalize:"none",autoCorrect:false,autoFocus:true}),u.length>0&&t(C,{onPress:()=>x(""),style:e.clearButton,children:t(g,{style:e.clearButtonText,children:"\u2715"})}),t(C,{style:e.closeSearchButton,onPress:()=>{c(false);x("")},children:t(g,{style:e.closeSearchText,children:"Done"})})]}),d(q,{style:e.scrollView,contentContainerStyle:e.scrollContent,children:[!v&&d(i,{style:e.header,children:[d(i,{style:e.actionsRow,children:[d(i,{style:e.actionWrapper,children:[t(ee,{value:G,buttonStyle:e.actionButtonHeader}),t(g,{style:e.actionLabel,children:"Copy"})]}),d(i,{style:e.actionWrapper,children:[t(C,{style:[e.iconButton,T&&e.refreshButtonDisabled],onPress:U,disabled:T,children:t(te,{size:16,color:T?o.color.textTertiary:o.color.textSecondary})}),t(g,{style:e.actionLabel,children:"Refresh"})]}),d(i,{style:e.actionWrapper,children:[t(C,{style:e.iconButton,onPress:()=>c(true),children:t(k,{size:16,color:o.color.textSecondary})}),t(g,{style:e.actionLabel,children:"Search"})]})]}),d(i,{style:e.statsGrid,children:[t(R,{value:b.total,label:"Screens"}),t(R,{value:b.mounted,label:"Mounted"}),t(R,{value:b.available,label:"Available"}),t(R,{value:b.navigators,label:"Navigators"})]})]}),V.length===0?t(i,{style:e.emptyState,children:t(g,{style:e.emptyText,children:u?"No matching screens":"No screens found"})}):V.map(a=>t(ie,{group:a,isExpanded:u.length>0||y===a.path,onToggleExpand:()=>O(a.path),onNavigate:P},a.path)),d(i,{style:e.metaFooter,children:[t(g,{style:e.metaText,children:"Source: navigation state"}),t(i,{style:e.sourceBadge,children:t(g,{style:e.sourceText,children:"React Navigation"})})]})]}),t(oe,{visible:F,onClose:()=>W(false),featureName:"Route Navigation"})]})}function R({value:r,label:n}){return d(i,{style:e.statItem,children:[t(g,{style:e.statValue,children:r}),t(g,{style:e.statLabel,children:n})]})}function ie({group:r,isExpanded:n,onToggleExpand:s,onNavigate:h}){const[u,x]=S(null);const v=I(c=>{x(y=>y===c?null:c)},[]);return d(i,{style:e.groupContainer,children:[d(C,{style:e.groupHeader,onPress:s,activeOpacity:.7,children:[d(i,{style:e.groupHeaderLeft,children:[n?t(A,{size:14,color:o.color.textSecondary}):t(E,{size:14,color:o.color.textSecondary}),t(g,{style:e.groupTitle,numberOfLines:1,children:r.name})]}),t(i,{style:e.groupBadge,children:t(g,{style:e.groupCount,children:r.screens.length})})]}),n&&d(i,{style:e.screensList,children:[r.path!=="Root"&&r.path.includes(" > ")&&t(i,{style:e.groupDescription,children:t(g,{style:e.groupDescriptionText,children:r.path})}),r.screens.map(c=>t(le,{screen:c,isExpanded:u===c.name,onToggleExpand:()=>v(c.name),onNavigate:h},c.name))]})]})}function le({screen:r,isExpanded:n,onToggleExpand:s,onNavigate:h}){const u=r.isFocused?re.success:r.isMounted?"#3B82F6":o.color.textTertiary;const x=r.isFocused?"FOCUSED":r.isMounted?"MOUNTED":"AVAILABLE";return t(i,{style:e.screenItem,children:d(i,{style:e.screenCard,children:[d(C,{style:e.screenHeaderLeft,onPress:s,activeOpacity:.7,children:[t(i,{style:e.expandIndicator,children:n?t(A,{size:14,color:o.color.textSecondary}):t(E,{size:14,color:o.color.textSecondary})}),t(g,{style:e.screenName,numberOfLines:1,children:r.name})]}),d(i,{style:e.screenHeaderActions,children:[t(Z,{value:r.name,buttonStyle:e.headerActionButton}),t(C,{style:[e.headerActionButton,e.navigateButton],onPress:()=>h(r.name),children:t(g,{style:e.navigateButtonText,children:"Go"})}),t(i,{style:[e.statusBadge,{backgroundColor:`${u}15`,borderColor:`${u}40`}],children:t(g,{style:[e.statusText,{color:u}],children:x})})]})]})})}const e=J.create({container:{flex:1,backgroundColor:"transparent"},emptyState:{padding:32,alignItems:"center"},emptyText:{color:o.color.textSecondary,fontSize:14,fontFamily:f},emptySubtext:{color:o.color.textTertiary,fontSize:12,fontFamily:f,marginTop:8},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:o.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:12,paddingBottom:4},actionWrapper:{alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:o.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},actionLabel:{fontSize:8,color:o.color.textTertiary,fontFamily:f,textTransform:"uppercase",letterSpacing:.5},refreshButtonDisabled:{opacity:.5},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"20%",minWidth:70,backgroundColor:o.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:o.color.text,fontFamily:f},statLabel:{fontSize:10,color:o.color.textTertiary,marginTop:4,fontFamily:f,textTransform:"uppercase",letterSpacing:.5},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:o.color.border},searchInput:{flex:1,color:o.color.text,fontSize:14,fontFamily:f},clearButton:{padding:4},clearButtonText:{color:o.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:o.color.accent,fontSize:14,fontWeight:"600",fontFamily:f},scrollView:{flex:1},scrollContent:{paddingBottom:8},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:o.color.border},metaText:{fontSize:12,color:o.color.textSecondary,fontFamily:f},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:o.color.border,backgroundColor:o.color.surface},sourceText:{fontSize:11,color:o.color.textSecondary,textTransform:"capitalize",fontFamily:f},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:o.color.surface,borderLeftWidth:3,borderLeftColor:o.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:o.color.text,fontFamily:f,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:f},screensList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:o.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:o.color.fillTertiary},groupDescriptionText:{fontSize:11,color:o.color.textSecondary,fontFamily:f,lineHeight:16},screenItem:{marginBottom:6},screenCard:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,paddingHorizontal:12,backgroundColor:o.color.surface,borderRadius:6,borderWidth:1,borderColor:o.color.border,shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},screenHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},expandIndicator:{width:20,alignItems:"center"},screenName:{fontSize:13,fontWeight:"600",color:o.color.text,fontFamily:f,flex:1},screenHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},statusBadge:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},statusText:{fontSize:10,fontWeight:"600",fontFamily:f},headerActionButton:{padding:6,borderRadius:4,backgroundColor:o.color.surfaceElevated,borderWidth:1,borderColor:o.color.border,alignItems:"center",justifyContent:"center"},navigateButton:{backgroundColor:o.color.accentSoft,borderColor:o.color.accentBorder},navigateButtonText:{fontSize:12,color:o.color.accent,fontFamily:f,fontWeight:"600"}});
|
|
1
|
+
"use strict";import{useState as S,useCallback as I,useMemo as B,useEffect as N}from"react";import{View as i,Text as g,TextInput as _,TouchableOpacity as C,ScrollView as q,StyleSheet as J,Alert as K}from"react-native";import{getCommonActions as X,useSafeNavigationContainerRef as Y}from"../utils/safeReactNavigation";const D=X();import{Search as k,ChevronDown as A,ChevronRight as E,InlineCopyButton as Z,ToolbarCopyButton as ee,RefreshCw as te,ProUpgradeModal as oe,buoyColors as re,night as o,monoFont as f}from"@buoy-gg/shared-ui";import{useIsPro as ne}from"@buoy-gg/license";import{jsx as t,jsxs as d}from"react/jsx-runtime";function M(r,n="Root"){if(!r)return[];const s=[];const h=r.routeNames||[];const u=new Set((r.routes||[]).map(c=>c.name));const b=r.index??0;const v=r.routes?.[b]?.name;if(h.length>0){const c=h.map(y=>({name:y,isMounted:u.has(y),isFocused:y===v}));s.push({name:n==="Root"?"Root":n.split(" > ").pop(),path:n,screens:c,totalScreens:c.length})}for(const c of r.routes||[]){if(c.state){const y=`${n} > ${c.name}`;const w=M(c.state,y);s.push(...w)}}return s}function j(r,n){if(!r||!r.routes)return null;const s=r.routeNames||[];if(s.includes(n)){return[n]}for(const h of r.routes){if(h.state){const u=j(h.state,n);if(u){return[h.name,...u]}}}return null}function ae(r){if(r.length===0)return null;if(r.length===1){return D.navigate({name:r[0]})}let n={screen:r[r.length-1]};for(let s=r.length-2;s>=1;s--){n={screen:r[s],params:n}}return D.navigate({name:r[0],params:n})}export function ReactNavigationRoutes({style:r}){const n=Y();const[s,h]=S(()=>n?.getRootState?.()??null);const[u,b]=S("");const[v,c]=S(false);const[y,w]=S(null);const[T,H]=S(false);const[F,W]=S(false);const z=ne();N(()=>{if(F&&z){W(false)}},[F,z]);N(()=>{if(!n)return;const a=n.getRootState?.();if(a){h(a)}const l=n.addListener?.("state",()=>{const p=n.getRootState?.();if(p){h(p)}});return()=>{l?.()}},[n]);const m=B(()=>M(s),[s]);N(()=>{if(m.length>0&&y===null){w(m[0].path)}},[m.length]);const L=B(()=>{const a=[];for(const l of m){for(const p of l.screens){a.push({name:p.name,navigatorPath:l.path,isMounted:p.isMounted,isFocused:p.isFocused})}}return a},[m]);const V=B(()=>{if(!u.trim())return m;const a=u.toLowerCase();return m.map(l=>({...l,screens:l.screens.filter(p=>p.name.toLowerCase().includes(a))})).filter(l=>l.screens.length>0)},[m,u]);const x=B(()=>{const a=L.length;const l=L.filter(Q=>Q.isMounted).length;const p=a-l;const $=m.length;return{total:a,mounted:l,available:p,navigators:$}},[L,m]);const G=B(()=>{return{summary:{totalScreens:x.total,mounted:x.mounted,available:x.available,navigators:x.navigators,timestamp:new Date().toISOString()},navigators:m.map(a=>({path:a.path,screens:a.screens.map(l=>({name:l.name,isMounted:l.isMounted,isFocused:l.isFocused}))}))}},[m,x]);const O=I(a=>{w(l=>l===a?null:a)},[]);const P=I(a=>{if(!z){W(true);return}if(!n||!s)return;try{const l=j(s,a);if(l){const p=ae(l);if(p){n.dispatch(p);return}}n.dispatch(D.navigate({name:a}))}catch(l){K.alert("Navigation Error",String(l))}},[n,s,z]);const U=I(()=>{if(T||!n)return;H(true);const a=n.getRootState?.();if(a){h(a)}setTimeout(()=>H(false),400)},[T,n]);if(!s){return t(i,{style:[e.container,r],children:d(i,{style:e.emptyState,children:[t(g,{style:e.emptyText,children:"No navigation state available"}),t(g,{style:e.emptySubtext,children:"Ensure you are inside a NavigationContainer"})]})})}return d(i,{style:[e.container,r],children:[v&&d(i,{style:e.searchContainer,children:[t(k,{size:16,color:o.color.textTertiary}),t(_,{style:e.searchInput,placeholder:"Search screens...",placeholderTextColor:o.color.placeholder,value:u,onChangeText:b,autoCapitalize:"none",autoCorrect:false,autoFocus:true}),u.length>0&&t(C,{onPress:()=>b(""),style:e.clearButton,children:t(g,{style:e.clearButtonText,children:"\u2715"})}),t(C,{style:e.closeSearchButton,onPress:()=>{c(false);b("")},children:t(g,{style:e.closeSearchText,children:"Done"})})]}),d(q,{keyboardShouldPersistTaps:"handled",style:e.scrollView,contentContainerStyle:e.scrollContent,children:[!v&&d(i,{style:e.header,children:[d(i,{style:e.actionsRow,children:[d(i,{style:e.actionWrapper,children:[t(ee,{value:G,buttonStyle:e.actionButtonHeader}),t(g,{style:e.actionLabel,children:"Copy"})]}),d(i,{style:e.actionWrapper,children:[t(C,{style:[e.iconButton,T&&e.refreshButtonDisabled],onPress:U,disabled:T,children:t(te,{size:16,color:T?o.color.textTertiary:o.color.textSecondary})}),t(g,{style:e.actionLabel,children:"Refresh"})]}),d(i,{style:e.actionWrapper,children:[t(C,{style:e.iconButton,onPress:()=>c(true),children:t(k,{size:16,color:o.color.textSecondary})}),t(g,{style:e.actionLabel,children:"Search"})]})]}),d(i,{style:e.statsGrid,children:[t(R,{value:x.total,label:"Screens"}),t(R,{value:x.mounted,label:"Mounted"}),t(R,{value:x.available,label:"Available"}),t(R,{value:x.navigators,label:"Navigators"})]})]}),V.length===0?t(i,{style:e.emptyState,children:t(g,{style:e.emptyText,children:u?"No matching screens":"No screens found"})}):V.map(a=>t(ie,{group:a,isExpanded:u.length>0||y===a.path,onToggleExpand:()=>O(a.path),onNavigate:P},a.path)),d(i,{style:e.metaFooter,children:[t(g,{style:e.metaText,children:"Source: navigation state"}),t(i,{style:e.sourceBadge,children:t(g,{style:e.sourceText,children:"React Navigation"})})]})]}),t(oe,{visible:F,onClose:()=>W(false),featureName:"Route Navigation"})]})}function R({value:r,label:n}){return d(i,{style:e.statItem,children:[t(g,{style:e.statValue,children:r}),t(g,{style:e.statLabel,children:n})]})}function ie({group:r,isExpanded:n,onToggleExpand:s,onNavigate:h}){const[u,b]=S(null);const v=I(c=>{b(y=>y===c?null:c)},[]);return d(i,{style:e.groupContainer,children:[d(C,{style:e.groupHeader,onPress:s,activeOpacity:.7,children:[d(i,{style:e.groupHeaderLeft,children:[n?t(A,{size:14,color:o.color.textSecondary}):t(E,{size:14,color:o.color.textSecondary}),t(g,{style:e.groupTitle,numberOfLines:1,children:r.name})]}),t(i,{style:e.groupBadge,children:t(g,{style:e.groupCount,children:r.screens.length})})]}),n&&d(i,{style:e.screensList,children:[r.path!=="Root"&&r.path.includes(" > ")&&t(i,{style:e.groupDescription,children:t(g,{style:e.groupDescriptionText,children:r.path})}),r.screens.map(c=>t(le,{screen:c,isExpanded:u===c.name,onToggleExpand:()=>v(c.name),onNavigate:h},c.name))]})]})}function le({screen:r,isExpanded:n,onToggleExpand:s,onNavigate:h}){const u=r.isFocused?re.success:r.isMounted?"#3B82F6":o.color.textTertiary;const b=r.isFocused?"FOCUSED":r.isMounted?"MOUNTED":"AVAILABLE";return t(i,{style:e.screenItem,children:d(i,{style:e.screenCard,children:[d(C,{style:e.screenHeaderLeft,onPress:s,activeOpacity:.7,children:[t(i,{style:e.expandIndicator,children:n?t(A,{size:14,color:o.color.textSecondary}):t(E,{size:14,color:o.color.textSecondary})}),t(g,{style:e.screenName,numberOfLines:1,children:r.name})]}),d(i,{style:e.screenHeaderActions,children:[t(Z,{value:r.name,buttonStyle:e.headerActionButton}),t(C,{style:[e.headerActionButton,e.navigateButton],onPress:()=>h(r.name),children:t(g,{style:e.navigateButtonText,children:"Go"})}),t(i,{style:[e.statusBadge,{backgroundColor:`${u}15`,borderColor:`${u}40`}],children:t(g,{style:[e.statusText,{color:u}],children:b})})]})]})})}const e=J.create({container:{flex:1,backgroundColor:"transparent"},emptyState:{padding:32,alignItems:"center"},emptyText:{color:o.color.textSecondary,fontSize:14,fontFamily:f},emptySubtext:{color:o.color.textTertiary,fontSize:12,fontFamily:f,marginTop:8},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:o.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:12,paddingBottom:4},actionWrapper:{alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:o.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},actionLabel:{fontSize:8,color:o.color.textTertiary,fontFamily:f,textTransform:"uppercase",letterSpacing:.5},refreshButtonDisabled:{opacity:.5},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"20%",minWidth:70,backgroundColor:o.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:o.color.text,fontFamily:f},statLabel:{fontSize:10,color:o.color.textTertiary,marginTop:4,fontFamily:f,textTransform:"uppercase",letterSpacing:.5},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:o.color.border},searchInput:{flex:1,color:o.color.text,fontSize:14,fontFamily:f},clearButton:{padding:4},clearButtonText:{color:o.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:o.color.accent,fontSize:14,fontWeight:"600",fontFamily:f},scrollView:{flex:1},scrollContent:{paddingBottom:8},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:o.color.border},metaText:{fontSize:12,color:o.color.textSecondary,fontFamily:f},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:o.color.border,backgroundColor:o.color.surface},sourceText:{fontSize:11,color:o.color.textSecondary,textTransform:"capitalize",fontFamily:f},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:o.color.surface,borderLeftWidth:3,borderLeftColor:o.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:o.color.text,fontFamily:f,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:f},screensList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:o.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:o.color.fillTertiary},groupDescriptionText:{fontSize:11,color:o.color.textSecondary,fontFamily:f,lineHeight:16},screenItem:{marginBottom:6},screenCard:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,paddingHorizontal:12,backgroundColor:o.color.surface,borderRadius:6,borderWidth:1,borderColor:o.color.border,shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},screenHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},expandIndicator:{width:20,alignItems:"center"},screenName:{fontSize:13,fontWeight:"600",color:o.color.text,fontFamily:f,flex:1},screenHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},statusBadge:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},statusText:{fontSize:10,fontWeight:"600",fontFamily:f},headerActionButton:{padding:6,borderRadius:4,backgroundColor:o.color.surfaceElevated,borderWidth:1,borderColor:o.color.border,alignItems:"center",justifyContent:"center"},navigateButton:{backgroundColor:o.color.accentSoft,borderColor:o.color.accentBorder},navigateButtonText:{fontSize:12,color:o.color.accent,fontFamily:f,fontWeight:"600"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{View as l,Text as s,StyleSheet as
|
|
1
|
+
"use strict";import{View as l,Text as s,StyleSheet as d,TouchableOpacity as u,ScrollView as p}from"react-native";import{Navigation as m,night as r,monoFont as g}from"@buoy-gg/shared-ui";import{RouteEventExpandedContent as f}from"./RouteEventExpandedContent";import{getRouteTemplate as y,routeHref as b}from"../utils/routeTemplate";import{jsx as e,jsxs as a}from"react/jsx-runtime";export function RouteEventDetail({event:t,visitNumber:i=1,onNavigate:n}){const c=y(t.pathname,t.segments);return a(l,{style:o.container,children:[e(p,{keyboardShouldPersistTaps:"handled",testID:"buoy-routes-detail-scroll",style:o.scroll,contentContainerStyle:o.scrollContent,showsVerticalScrollIndicator:true,children:e(f,{event:t,visitNumber:i,routeTemplate:c})}),n&&e(l,{style:o.footer,children:a(u,{style:o.goButton,onPress:()=>n(b(t.pathname,t.params)),activeOpacity:.8,testID:"buoy-routes-detail-go",accessibilityRole:"button",accessibilityLabel:`Go to route ${t.pathname}`,children:[e(m,{size:16,color:r.color.onAccent}),e(s,{style:o.goButtonText,children:"Go to route"})]})})]})}const o=d.create({container:{flex:1,backgroundColor:"transparent"},scroll:{flex:1},scrollContent:{padding:14},footer:{paddingHorizontal:16,paddingVertical:12,backgroundColor:"transparent",borderTopWidth:1,borderTopColor:r.color.border},goButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,backgroundColor:r.color.accent,paddingVertical:12,borderRadius:8},goButtonText:{fontSize:13,fontWeight:"600",color:r.color.onAccent,fontFamily:g,textTransform:"uppercase",letterSpacing:.5}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useCallback as y}from"react";import{View as u,Text as
|
|
1
|
+
"use strict";import{useCallback as y}from"react";import{View as u,Text as l,FlatList as d,StyleSheet as f}from"react-native";import{Navigation as g,night as a,EVENT_LIST_PRESET as x,monoFont as m}from"@buoy-gg/shared-ui";import{RouteEventItemCompact as S}from"./RouteEventItemCompact";import{jsx as o,jsxs as h}from"react/jsx-runtime";export function RouteEventsTimeline({events:r,visitCounts:n,onNavigate:c,onSelectEvent:s}){const p=y(t=>{const e=r[t];if(!e)return;s(e,n.get(e)||1)},[r,n,s]);if(r.length===0){return h(u,{style:i.emptyState,testID:"buoy-routes-empty",children:[o(g,{size:48,color:a.color.textTertiary}),o(l,{style:i.emptyTitle,testID:"buoy-routes-empty-title",children:"No events yet"}),o(l,{style:i.emptySubtitle,testID:"buoy-routes-empty-subtitle",children:"Navigation events will appear here"})]})}return o(d,{keyboardShouldPersistTaps:"handled",testID:"buoy-routes-timeline",contentContainerStyle:i.listContent,data:r,keyExtractor:t=>`${t.timestamp}-${t.pathname}`,renderItem:({item:t,index:e})=>o(S,{event:t,visitNumber:n.get(t)||1,isExpanded:false,index:e,onPress:p,onNavigate:c}),showsVerticalScrollIndicator:true,...x})}const i=f.create({listContent:{paddingVertical:8},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:a.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:m,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:a.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:m}});
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
Route: ${a.path}`;const ue=c=>{if(c&&c.trim()){H(a,s+1,{...y,[F]:c.trim()})}};if(typeof S.prompt!=="function"){const c=globalThis.prompt;if(c)ue(c(`${_}
|
|
4
4
|
|
|
5
|
-
${J}`));else S.alert(_,`${a.path} needs a value for ${q}, and this platform can't ask for one here.`);return}S.prompt(_,J,[{text:"Cancel",style:"cancel"},{text:s<M.length-1?"Next":"Navigate",onPress:c=>{if(c&&c.trim()){const T={...y,[F]:c.trim()};H(a,s+1,T)}else{S.alert("Invalid Value","Please enter a value for the parameter")}}}],"plain-text")},[L]);const U=w((a,s)=>{if(b){b(a);return}if(!v&&!s?.bypassPro){O(true);return}if(a.type==="layout"||a.type==="group"){S.alert("Cannot Navigate",`${a.type==="layout"?"Layouts":"Route groups"} are not navigable routes`);return}if(a.type==="dynamic"||a.type==="catch-all"){if(a.params.length===0){try{L.push(a.path)}catch(y){S.alert("Navigation Error",String(y))}return}H(a);return}try{L.push(a.path)}catch(y){S.alert("Navigation Error",String(y))}},[L,H,v,b]);const se=w(()=>{U($e,{bypassPro:true})},[U]);const ce=w(()=>{if(x)return;W(true);Q();setTimeout(()=>W(false),400)},[x,Q]);const de=E(()=>{if(!G)return"Awaiting route data";return`Updated ${Be(G)}`},[G]);const pe=E(()=>{if(!A)return"Source: unknown";return`Source: ${A}`},[A]);const Z=E(()=>{if(u&&N.length>0){return[{title:"Search Results",icon:"",routes:N}]}return k},[u,N,k]);if(!ae){return t(n,{style:[e.container,r],children:t(n,{style:e.loadingContainer,children:t(l,{style:e.loadingText,testID:"buoy-routes-sitemap-loading",children:ne?"Loading routes...":"Route sitemap isn't available on the dashboard \u2014 the route tree lives on the device. Use the Events tab to see navigation here."})})})}return i(n,{style:[e.container,r],children:[z&&i(n,{style:e.searchContainer,testID:"buoy-routes-sitemap-search-field",children:[t(Y,{size:16,color:o.color.textTertiary}),t(ge,{style:e.searchInput,placeholder:"Search routes...",placeholderTextColor:o.color.placeholder,value:u,onChangeText:I,autoCapitalize:"none",autoCorrect:false,autoFocus:true,testID:"buoy-routes-sitemap-search",accessibilityLabel:"Search routes"}),u.length>0&&t(C,{onPress:()=>I(""),style:e.clearButton,testID:"buoy-routes-sitemap-search-clear",accessibilityRole:"button",accessibilityLabel:"Clear route search",children:t(l,{style:e.clearButtonText,children:"\u2715"})}),t(C,{style:e.closeSearchButton,onPress:()=>{g(false);I("")},testID:"buoy-routes-sitemap-search-done",accessibilityRole:"button",accessibilityLabel:"Done searching routes",children:t(l,{style:e.closeSearchText,children:"Done"})})]}),i(fe,{testID:"buoy-routes-sitemap-scroll",style:e.scrollView,contentContainerStyle:e.scrollContent,children:[!z&&i(n,{style:e.header,children:[i(n,{style:e.actionsRow,children:[i(n,{style:[e.actionWrapper,p&&e.actionWrapperDesktop],children:[t(C,{style:[e.iconButton,p&&e.iconButtonDesktop],onPress:se,accessibilityLabel:"Go to home route",accessibilityRole:"button",testID:"buoy-routes-sitemap-home",children:t(Se,{size:P,color:o.color.textSecondary})}),t(l,{style:[e.actionLabel,p&&e.actionLabelDesktop],children:"Home"})]}),i(n,{style:[e.actionWrapper,p&&e.actionWrapperDesktop],children:[t(Ie,{value:ie,testID:"buoy-routes-sitemap-copy",size:p?P:14,buttonStyle:p?e.actionButtonHeaderDesktop:e.actionButtonHeader}),t(l,{style:[e.actionLabel,p&&e.actionLabelDesktop],children:"Copy"})]}),i(n,{style:[e.actionWrapper,p&&e.actionWrapperDesktop],children:[t(C,{style:[e.iconButton,p&&e.iconButtonDesktop,x&&e.refreshButtonDisabled],onPress:ce,disabled:x,testID:"buoy-routes-sitemap-refresh",accessibilityRole:"button",accessibilityLabel:"Refresh route tree",children:t(Te,{size:P,color:x?o.color.textTertiary:o.color.textSecondary})}),t(l,{style:[e.actionLabel,p&&e.actionLabelDesktop],children:"Refresh"})]}),i(n,{style:[e.actionWrapper,p&&e.actionWrapperDesktop],children:[t(C,{style:[e.iconButton,p&&e.iconButtonDesktop],onPress:()=>g(true),testID:"buoy-routes-sitemap-search-open",accessibilityRole:"button",accessibilityLabel:"Search routes",children:t(Y,{size:P,color:o.color.textSecondary})}),t(l,{style:[e.actionLabel,p&&e.actionLabelDesktop],children:"Search"})]})]}),i(n,{style:e.statsGrid,children:[t(R,{value:h.total,label:"Total",id:"total"}),t(R,{value:h.static,label:"Static",id:"static"}),t(R,{value:h.dynamic,label:"Dynamic",id:"dynamic"}),t(R,{value:h.catchAll,label:"Catch-All",id:"catch-all"}),t(R,{value:h.layouts,label:"Layouts",id:"layouts"}),t(R,{value:h.groups,label:"Groups",id:"groups"})]})]}),Z.length===0?t(ye,{testID:"buoy-routes-sitemap-empty",otto:"map",title:"No routes found",message:"Nothing in the router matches. Clear the search to see the whole tree."}):Z.map(a=>t(We,{group:a,isExpanded:u.length>0||$.has(a.title),onToggleExpand:()=>le(a.title),onNavigate:U},a.title)),i(n,{style:e.metaFooter,children:[t(l,{style:e.metaText,testID:"buoy-routes-sitemap-updated",children:de}),t(n,{style:e.sourceBadge,children:t(l,{style:e.sourceText,testID:"buoy-routes-sitemap-source",children:pe})})]})]}),t(Re,{visible:j,onClose:()=>O(false),featureName:"Route Navigation"})]})}function R({value:r,label:f,id:m}){return i(n,{style:e.statItem,testID:`buoy-routes-stat-${m}`,accessibilityLabel:`${f}, ${r}`,children:[t(l,{style:e.statValue,testID:`buoy-routes-stat-${m}-value`,children:r}),t(l,{style:e.statLabel,children:f})]})}function We({group:r,isExpanded:f,onToggleExpand:m,onNavigate:D}){return i(n,{style:e.groupContainer,children:[i(C,{style:e.groupHeader,onPress:m,activeOpacity:.7,testID:oe(r.title),accessibilityRole:"button",accessibilityLabel:`${r.title}, ${r.routes.length} routes`,children:[i(n,{style:e.groupHeaderLeft,children:[f?t(ee,{size:14,color:o.color.textSecondary}):t(te,{size:14,color:o.color.textSecondary}),t(l,{style:e.groupTitle,children:r.title})]}),t(n,{style:e.groupBadge,children:t(l,{style:e.groupCount,testID:`${oe(r.title)}-count`,children:r.routes.length})})]}),r.description&&t(n,{style:e.groupDescription,children:t(l,{style:e.groupDescriptionText,children:r.description})}),f&&t(n,{style:e.routesList,children:r.routes.map((b,u)=>t(re,{route:b,onNavigate:D},`${b.path}-${u}`))})]})}function re({route:r,depth:f=0,onNavigate:m}){const[D,b]=B(false);const u=r.children.length>0;const I=ve(r.type);const z=r.type!=="layout"&&r.type!=="group";const g=ze(r.path);const $=u;const V=$?D:true;return t(n,{style:[e.routeItem,{marginLeft:f*12}],testID:g,children:i(n,{style:e.routeCard,children:[i(n,{style:e.routeHeader,children:[$?i(C,{style:e.routeHeaderLeft,onPress:()=>b(!D),activeOpacity:.7,testID:`${g}-toggle`,accessibilityRole:"button",accessibilityLabel:`${r.path}, ${r.type}, ${r.children.length} nested`,children:[t(n,{style:e.expandIndicator,children:D?t(ee,{size:14,color:o.color.textSecondary}):t(te,{size:14,color:o.color.textSecondary})}),t(l,{style:e.routePath,numberOfLines:3,testID:`${g}-path`,children:r.path})]}):i(n,{style:e.routeHeaderLeft,accessible:true,accessibilityLabel:`${r.path}, ${r.type}`,children:[t(n,{style:e.expandIndicator}),t(l,{style:e.routePath,numberOfLines:3,testID:`${g}-path`,children:r.path})]}),i(n,{style:e.routeHeaderActions,children:[u&&t(n,{style:e.childCountBadge,children:t(l,{style:e.childCountText,testID:`${g}-children-count`,children:r.children.length})}),t(n,{style:[e.typeTag,{backgroundColor:`${I}15`,borderColor:`${I}40`}],children:t(l,{style:[e.typeText,{color:I}],testID:`${g}-type`,children:r.type.toUpperCase()})}),t(De,{value:r.path,buttonStyle:e.iconAction,testID:`${g}-copy`}),z&&t(C,{style:e.goButton,onPress:()=>m(r),activeOpacity:.7,testID:`${g}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${r.path}`,children:t(l,{style:e.goButtonText,children:"Go"})})]})]}),V&&u&&t(n,{style:e.childrenContainer,children:r.children.map((x,W)=>t(re,{route:x,depth:f+1,onNavigate:m},`${x.path}-${W}`))})]})})}function ve(r){switch(r){case"static":return"#3B82F6";case"dynamic":return"#F59E0B";case"catch-all":return"#EC4899";case"index":return"#10B981";case"layout":return"#8B5CF6";case"group":return"#6366F1";case"not-found":return"#EF4444";default:return"#6B7280"}}const e=me.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"},loadingText:{color:o.color.textSecondary,fontSize:14,fontFamily:d,textAlign:"center",lineHeight:20,paddingHorizontal:32,maxWidth:420},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:o.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,paddingBottom:4},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"30%",minWidth:90,backgroundColor:o.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:o.color.text,fontFamily:d},statLabel:{fontSize:10,color:o.color.textTertiary,marginTop:4,fontFamily:d,textTransform:"uppercase",letterSpacing:.5},actionWrapper:{flex:1,alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionWrapperDesktop:{gap:8,minWidth:72},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:o.color.surfaceElevated},actionButtonHeaderDesktop:{padding:12,borderRadius:8,backgroundColor:o.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},iconButtonDesktop:{padding:12,borderRadius:8,backgroundColor:o.color.surfaceElevated},actionLabel:{fontSize:8,color:o.color.textTertiary,fontFamily:d,textTransform:"uppercase",letterSpacing:.5},actionLabelDesktop:{fontSize:12},refreshButtonDisabled:{opacity:.5},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:o.color.border},metaText:{fontSize:12,color:o.color.textSecondary,fontFamily:d},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:o.color.border,backgroundColor:o.color.surface},sourceText:{fontSize:11,color:o.color.textSecondary,textTransform:"capitalize",fontFamily:d},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:o.color.border},searchInput:{flex:1,color:o.color.text,fontSize:14,fontFamily:d},clearButton:{padding:4},clearButtonText:{color:o.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:o.color.accent,fontSize:14,fontWeight:"600",fontFamily:d},scrollView:{flex:1},scrollContent:{paddingBottom:8},emptyState:{padding:32,alignItems:"center"},emptyText:{color:o.color.textSecondary,fontSize:14,fontFamily:d},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:o.color.surface,borderLeftWidth:3,borderLeftColor:o.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:o.color.text,fontFamily:d,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:d},routesList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:o.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:o.color.fillTertiary},groupDescriptionText:{fontSize:11,color:o.color.textSecondary,fontFamily:d,lineHeight:16},routeItem:{marginBottom:6},routeCard:{backgroundColor:o.color.surface,borderRadius:6,borderWidth:1,borderColor:o.color.border,overflow:"hidden",shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},routeHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:7,paddingHorizontal:10,gap:8},expandIndicator:{width:18,alignItems:"center"},routeHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},routePath:{fontSize:13,fontWeight:"600",color:o.color.text,fontFamily:d,flex:1},routeHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},childCountBadge:{backgroundColor:"#6B728015",borderColor:"#6B728040",borderWidth:1,borderRadius:12,paddingHorizontal:7,paddingVertical:2,minWidth:22,alignItems:"center",justifyContent:"center"},childCountText:{fontSize:11,fontWeight:"600",color:o.color.textSecondary,fontFamily:d},typeTag:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},typeText:{fontSize:10,fontWeight:"600",fontFamily:d},iconAction:{width:28,height:24,borderRadius:4,backgroundColor:o.color.surfaceElevated,borderWidth:1,borderColor:o.color.border,alignItems:"center",justifyContent:"center"},goButton:{height:24,paddingHorizontal:10,borderRadius:4,alignItems:"center",justifyContent:"center",backgroundColor:o.color.accentSoft,borderWidth:1,borderColor:o.color.accentBorder},goButtonText:{fontSize:12,color:o.color.accent,fontFamily:d,fontWeight:"600"},childrenContainer:{borderLeftWidth:2,borderLeftColor:o.color.border,marginLeft:16,marginRight:8,marginTop:2,marginBottom:8}});
|
|
5
|
+
${J}`));else S.alert(_,`${a.path} needs a value for ${q}, and this platform can't ask for one here.`);return}S.prompt(_,J,[{text:"Cancel",style:"cancel"},{text:s<M.length-1?"Next":"Navigate",onPress:c=>{if(c&&c.trim()){const T={...y,[F]:c.trim()};H(a,s+1,T)}else{S.alert("Invalid Value","Please enter a value for the parameter")}}}],"plain-text")},[L]);const U=w((a,s)=>{if(b){b(a);return}if(!v&&!s?.bypassPro){O(true);return}if(a.type==="layout"||a.type==="group"){S.alert("Cannot Navigate",`${a.type==="layout"?"Layouts":"Route groups"} are not navigable routes`);return}if(a.type==="dynamic"||a.type==="catch-all"){if(a.params.length===0){try{L.push(a.path)}catch(y){S.alert("Navigation Error",String(y))}return}H(a);return}try{L.push(a.path)}catch(y){S.alert("Navigation Error",String(y))}},[L,H,v,b]);const se=w(()=>{U($e,{bypassPro:true})},[U]);const ce=w(()=>{if(x)return;W(true);Q();setTimeout(()=>W(false),400)},[x,Q]);const de=E(()=>{if(!G)return"Awaiting route data";return`Updated ${Be(G)}`},[G]);const pe=E(()=>{if(!A)return"Source: unknown";return`Source: ${A}`},[A]);const Z=E(()=>{if(u&&N.length>0){return[{title:"Search Results",icon:"",routes:N}]}return k},[u,N,k]);if(!ae){return t(n,{style:[e.container,r],children:t(n,{style:e.loadingContainer,children:t(l,{style:e.loadingText,testID:"buoy-routes-sitemap-loading",children:ne?"Loading routes...":"Route sitemap isn't available on the dashboard \u2014 the route tree lives on the device. Use the Events tab to see navigation here."})})})}return i(n,{style:[e.container,r],children:[z&&i(n,{style:e.searchContainer,testID:"buoy-routes-sitemap-search-field",children:[t(Y,{size:16,color:o.color.textTertiary}),t(ge,{style:e.searchInput,placeholder:"Search routes...",placeholderTextColor:o.color.placeholder,value:u,onChangeText:I,autoCapitalize:"none",autoCorrect:false,autoFocus:true,testID:"buoy-routes-sitemap-search",accessibilityLabel:"Search routes"}),u.length>0&&t(C,{onPress:()=>I(""),style:e.clearButton,testID:"buoy-routes-sitemap-search-clear",accessibilityRole:"button",accessibilityLabel:"Clear route search",children:t(l,{style:e.clearButtonText,children:"\u2715"})}),t(C,{style:e.closeSearchButton,onPress:()=>{g(false);I("")},testID:"buoy-routes-sitemap-search-done",accessibilityRole:"button",accessibilityLabel:"Done searching routes",children:t(l,{style:e.closeSearchText,children:"Done"})})]}),i(fe,{keyboardShouldPersistTaps:"handled",testID:"buoy-routes-sitemap-scroll",style:e.scrollView,contentContainerStyle:e.scrollContent,children:[!z&&i(n,{style:e.header,children:[i(n,{style:e.actionsRow,children:[i(n,{style:[e.actionWrapper,p&&e.actionWrapperDesktop],children:[t(C,{style:[e.iconButton,p&&e.iconButtonDesktop],onPress:se,accessibilityLabel:"Go to home route",accessibilityRole:"button",testID:"buoy-routes-sitemap-home",children:t(Se,{size:P,color:o.color.textSecondary})}),t(l,{style:[e.actionLabel,p&&e.actionLabelDesktop],children:"Home"})]}),i(n,{style:[e.actionWrapper,p&&e.actionWrapperDesktop],children:[t(Ie,{value:ie,testID:"buoy-routes-sitemap-copy",size:p?P:14,buttonStyle:p?e.actionButtonHeaderDesktop:e.actionButtonHeader}),t(l,{style:[e.actionLabel,p&&e.actionLabelDesktop],children:"Copy"})]}),i(n,{style:[e.actionWrapper,p&&e.actionWrapperDesktop],children:[t(C,{style:[e.iconButton,p&&e.iconButtonDesktop,x&&e.refreshButtonDisabled],onPress:ce,disabled:x,testID:"buoy-routes-sitemap-refresh",accessibilityRole:"button",accessibilityLabel:"Refresh route tree",children:t(Te,{size:P,color:x?o.color.textTertiary:o.color.textSecondary})}),t(l,{style:[e.actionLabel,p&&e.actionLabelDesktop],children:"Refresh"})]}),i(n,{style:[e.actionWrapper,p&&e.actionWrapperDesktop],children:[t(C,{style:[e.iconButton,p&&e.iconButtonDesktop],onPress:()=>g(true),testID:"buoy-routes-sitemap-search-open",accessibilityRole:"button",accessibilityLabel:"Search routes",children:t(Y,{size:P,color:o.color.textSecondary})}),t(l,{style:[e.actionLabel,p&&e.actionLabelDesktop],children:"Search"})]})]}),i(n,{style:e.statsGrid,children:[t(R,{value:h.total,label:"Total",id:"total"}),t(R,{value:h.static,label:"Static",id:"static"}),t(R,{value:h.dynamic,label:"Dynamic",id:"dynamic"}),t(R,{value:h.catchAll,label:"Catch-All",id:"catch-all"}),t(R,{value:h.layouts,label:"Layouts",id:"layouts"}),t(R,{value:h.groups,label:"Groups",id:"groups"})]})]}),Z.length===0?t(ye,{testID:"buoy-routes-sitemap-empty",otto:"map",title:"No routes found",message:"Nothing in the router matches. Clear the search to see the whole tree."}):Z.map(a=>t(We,{group:a,isExpanded:u.length>0||$.has(a.title),onToggleExpand:()=>le(a.title),onNavigate:U},a.title)),i(n,{style:e.metaFooter,children:[t(l,{style:e.metaText,testID:"buoy-routes-sitemap-updated",children:de}),t(n,{style:e.sourceBadge,children:t(l,{style:e.sourceText,testID:"buoy-routes-sitemap-source",children:pe})})]})]}),t(Re,{visible:j,onClose:()=>O(false),featureName:"Route Navigation"})]})}function R({value:r,label:f,id:m}){return i(n,{style:e.statItem,testID:`buoy-routes-stat-${m}`,accessibilityLabel:`${f}, ${r}`,children:[t(l,{style:e.statValue,testID:`buoy-routes-stat-${m}-value`,children:r}),t(l,{style:e.statLabel,children:f})]})}function We({group:r,isExpanded:f,onToggleExpand:m,onNavigate:D}){return i(n,{style:e.groupContainer,children:[i(C,{style:e.groupHeader,onPress:m,activeOpacity:.7,testID:oe(r.title),accessibilityRole:"button",accessibilityLabel:`${r.title}, ${r.routes.length} routes`,children:[i(n,{style:e.groupHeaderLeft,children:[f?t(ee,{size:14,color:o.color.textSecondary}):t(te,{size:14,color:o.color.textSecondary}),t(l,{style:e.groupTitle,children:r.title})]}),t(n,{style:e.groupBadge,children:t(l,{style:e.groupCount,testID:`${oe(r.title)}-count`,children:r.routes.length})})]}),r.description&&t(n,{style:e.groupDescription,children:t(l,{style:e.groupDescriptionText,children:r.description})}),f&&t(n,{style:e.routesList,children:r.routes.map((b,u)=>t(re,{route:b,onNavigate:D},`${b.path}-${u}`))})]})}function re({route:r,depth:f=0,onNavigate:m}){const[D,b]=B(false);const u=r.children.length>0;const I=ve(r.type);const z=r.type!=="layout"&&r.type!=="group";const g=ze(r.path);const $=u;const V=$?D:true;return t(n,{style:[e.routeItem,{marginLeft:f*12}],testID:g,children:i(n,{style:e.routeCard,children:[i(n,{style:e.routeHeader,children:[$?i(C,{style:e.routeHeaderLeft,onPress:()=>b(!D),activeOpacity:.7,testID:`${g}-toggle`,accessibilityRole:"button",accessibilityLabel:`${r.path}, ${r.type}, ${r.children.length} nested`,children:[t(n,{style:e.expandIndicator,children:D?t(ee,{size:14,color:o.color.textSecondary}):t(te,{size:14,color:o.color.textSecondary})}),t(l,{style:e.routePath,numberOfLines:3,testID:`${g}-path`,children:r.path})]}):i(n,{style:e.routeHeaderLeft,accessible:true,accessibilityLabel:`${r.path}, ${r.type}`,children:[t(n,{style:e.expandIndicator}),t(l,{style:e.routePath,numberOfLines:3,testID:`${g}-path`,children:r.path})]}),i(n,{style:e.routeHeaderActions,children:[u&&t(n,{style:e.childCountBadge,children:t(l,{style:e.childCountText,testID:`${g}-children-count`,children:r.children.length})}),t(n,{style:[e.typeTag,{backgroundColor:`${I}15`,borderColor:`${I}40`}],children:t(l,{style:[e.typeText,{color:I}],testID:`${g}-type`,children:r.type.toUpperCase()})}),t(De,{value:r.path,buttonStyle:e.iconAction,testID:`${g}-copy`}),z&&t(C,{style:e.goButton,onPress:()=>m(r),activeOpacity:.7,testID:`${g}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${r.path}`,children:t(l,{style:e.goButtonText,children:"Go"})})]})]}),V&&u&&t(n,{style:e.childrenContainer,children:r.children.map((x,W)=>t(re,{route:x,depth:f+1,onNavigate:m},`${x.path}-${W}`))})]})})}function ve(r){switch(r){case"static":return"#3B82F6";case"dynamic":return"#F59E0B";case"catch-all":return"#EC4899";case"index":return"#10B981";case"layout":return"#8B5CF6";case"group":return"#6366F1";case"not-found":return"#EF4444";default:return"#6B7280"}}const e=me.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"},loadingText:{color:o.color.textSecondary,fontSize:14,fontFamily:d,textAlign:"center",lineHeight:20,paddingHorizontal:32,maxWidth:420},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:o.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,paddingBottom:4},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"30%",minWidth:90,backgroundColor:o.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:o.color.text,fontFamily:d},statLabel:{fontSize:10,color:o.color.textTertiary,marginTop:4,fontFamily:d,textTransform:"uppercase",letterSpacing:.5},actionWrapper:{flex:1,alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionWrapperDesktop:{gap:8,minWidth:72},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:o.color.surfaceElevated},actionButtonHeaderDesktop:{padding:12,borderRadius:8,backgroundColor:o.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},iconButtonDesktop:{padding:12,borderRadius:8,backgroundColor:o.color.surfaceElevated},actionLabel:{fontSize:8,color:o.color.textTertiary,fontFamily:d,textTransform:"uppercase",letterSpacing:.5},actionLabelDesktop:{fontSize:12},refreshButtonDisabled:{opacity:.5},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:o.color.border},metaText:{fontSize:12,color:o.color.textSecondary,fontFamily:d},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:o.color.border,backgroundColor:o.color.surface},sourceText:{fontSize:11,color:o.color.textSecondary,textTransform:"capitalize",fontFamily:d},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:o.color.border},searchInput:{flex:1,color:o.color.text,fontSize:14,fontFamily:d},clearButton:{padding:4},clearButtonText:{color:o.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:o.color.accent,fontSize:14,fontWeight:"600",fontFamily:d},scrollView:{flex:1},scrollContent:{paddingBottom:8},emptyState:{padding:32,alignItems:"center"},emptyText:{color:o.color.textSecondary,fontSize:14,fontFamily:d},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:o.color.surface,borderLeftWidth:3,borderLeftColor:o.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:o.color.text,fontFamily:d,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:d},routesList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:o.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:o.color.fillTertiary},groupDescriptionText:{fontSize:11,color:o.color.textSecondary,fontFamily:d,lineHeight:16},routeItem:{marginBottom:6},routeCard:{backgroundColor:o.color.surface,borderRadius:6,borderWidth:1,borderColor:o.color.border,overflow:"hidden",shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},routeHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:7,paddingHorizontal:10,gap:8},expandIndicator:{width:18,alignItems:"center"},routeHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},routePath:{fontSize:13,fontWeight:"600",color:o.color.text,fontFamily:d,flex:1},routeHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},childCountBadge:{backgroundColor:"#6B728015",borderColor:"#6B728040",borderWidth:1,borderRadius:12,paddingHorizontal:7,paddingVertical:2,minWidth:22,alignItems:"center",justifyContent:"center"},childCountText:{fontSize:11,fontWeight:"600",color:o.color.textSecondary,fontFamily:d},typeTag:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},typeText:{fontSize:10,fontWeight:"600",fontFamily:d},iconAction:{width:28,height:24,borderRadius:4,backgroundColor:o.color.surfaceElevated,borderWidth:1,borderColor:o.color.border,alignItems:"center",justifyContent:"center"},goButton:{height:24,paddingHorizontal:10,borderRadius:4,alignItems:"center",justifyContent:"center",backgroundColor:o.color.accentSoft,borderWidth:1,borderColor:o.color.accentBorder},goButtonText:{fontSize:12,color:o.color.accent,fontFamily:d,fontWeight:"600"},childrenContainer:{borderLeftWidth:2,borderLeftColor:o.color.border,marginLeft:16,marginRight:8,marginTop:2,marginBottom:8}});
|
package/lib/web/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use client";var Nt=Object.defineProperty;var $o=Object.getOwnPropertyDescriptor;var Ao=Object.getOwnPropertyNames;var Fo=Object.prototype.hasOwnProperty;var No=(e,t)=>{for(var o in t)Nt(e,o,{get:t[o],enumerable:true})},zt=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ao(t))!Fo.call(e,a)&&a!==o&&Nt(e,a,{get:()=>t[a],enumerable:!(r=$o(t,a))||r.enumerable});return e},zo=(e,t,o)=>(zt(e,t,"default"),o&&zt(o,t,"default"));var qn=(()=>{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{RoutesIcon as Wo}from"@buoy-gg/floating-tools-core/web";import{useState as Ie,useCallback as me,useEffect as Wt,useRef as Oo,useMemo as ke}from"react";var Ot={};No(Ot,{AccessibilityInfo:()=>Mo,ActivityIndicator:()=>Mr,Alert:()=>_,Animated:()=>zr,AppRegistry:()=>Ko,AppState:()=>_o,Appearance:()=>Uo,BackHandler:()=>Go,Button:()=>Ur,CheckBox:()=>lr,Clipboard:()=>Jo,DeviceEventEmitter:()=>Cr,Dimensions:()=>qo,Easing:()=>Yo,FlatList:()=>jt,I18nManager:()=>Zo,Image:()=>cr,ImageBackground:()=>ur,InteractionManager:()=>Xo,Keyboard:()=>Qo,KeyboardAvoidingView:()=>dr,LayoutAnimation:()=>er,Linking:()=>tr,LogBox:()=>wr,Modal:()=>Hr,NativeEventEmitter:()=>or,NativeModules:()=>Vo,PanResponder:()=>rr,Picker:()=>pr,PixelRatio:()=>ar,Platform:()=>ct,Pressable:()=>jr,ProgressBar:()=>mr,RefreshControl:()=>hr,SafeAreaView:()=>fr,ScrollView:()=>qe,SectionList:()=>gr,Share:()=>nr,StatusBar:()=>yr,StyleSheet:()=>ve,Switch:()=>Vr,Text:()=>p,TextInput:()=>Kt,Touchable:()=>br,TouchableHighlight:()=>Wr,TouchableNativeFeedback:()=>vr,TouchableOpacity:()=>V,TouchableWithoutFeedback:()=>Or,UIManager:()=>ir,Vibration:()=>sr,View:()=>c,VirtualizedList:()=>xr,YellowBox:()=>Sr,findNodeHandle:()=>Kr,unstable_createElement:()=>Ho,useColorScheme:()=>Tr,useLocaleContext:()=>Rr,useWindowDimensions:()=>Ir});zo(Ot,jo);import*as jo from"react-native-web";import{unstable_createElement as Ho,NativeModules as Vo,AccessibilityInfo as Mo,Appearance as Uo,AppRegistry as Ko,AppState as _o,BackHandler as Go,Clipboard as Jo,Dimensions as qo,Easing as Yo,I18nManager as Zo,Keyboard as Qo,InteractionManager as Xo,LayoutAnimation as er,Linking as tr,NativeEventEmitter as or,PanResponder as rr,PixelRatio as ar,Platform as ct,Share as nr,UIManager as ir,Vibration as sr,CheckBox as lr,FlatList as jt,Image as cr,ImageBackground as ur,KeyboardAvoidingView as dr,Picker as pr,ProgressBar as mr,RefreshControl as hr,SafeAreaView as fr,SectionList as gr,StatusBar as yr,Touchable as br,TouchableNativeFeedback as vr,VirtualizedList as xr,YellowBox as Sr,LogBox as wr,DeviceEventEmitter as Cr,useColorScheme as Tr,useLocaleContext as Rr,useWindowDimensions as Ir}from"react-native-web";import*as oe from"react-native-web";import{createElement as ut,forwardRef as Ht,useCallback as kr,useRef as Br}from"react";import{useEffect as Er,useState as Dr}from"react";import{createPortal as Lr}from"react-dom";var Pr='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';import{jsx as $r}from"react/jsx-runtime";var ze=Symbol.for("@buoy-gg/portal-host"),Vt=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 Mt(){let e=document;if(e[ze])return e[ze].host;let t=document.createElement("div");t.dataset.buoyPortalHost="",Object.assign(t.style,{position:"fixed",inset:"0",zIndex:"2147483647",pointerEvents:"none",fontFamily:Pr});let o=()=>{let l=document.fullscreenElement,h=l&&l.tagName!=="CANVAS"?l:document.body;t.parentElement!==h&&h.appendChild(t)},r=new Map,a=l=>{(!t.contains(l.target)||!Vt(l.target))&&r.set(l.code||l.key,{key:l.key,code:l.code,location:l.location,keyCode:l.keyCode,which:l.which,altKey:l.altKey,ctrlKey:l.ctrlKey,metaKey:l.metaKey,shiftKey:l.shiftKey})},n=l=>{r.delete(l.code||l.key)},i=()=>r.clear(),d=()=>{let l=[...r.values()];r.clear();for(let h of l)document.dispatchEvent(new KeyboardEvent("keyup",{...h,bubbles:true}))},s=l=>{Vt(l.target)&&l.stopPropagation()},f=l=>l.stopPropagation();return o(),document.addEventListener("fullscreenchange",o),document.addEventListener("keydown",a,true),document.addEventListener("keyup",n,true),window.addEventListener("blur",i),t.addEventListener("focusin",d),t.addEventListener("keydown",s),t.addEventListener("keyup",s),t.addEventListener("keypress",s),t.addEventListener("wheel",f,{passive:true}),e[ze]={host:t,users:0,dispose:()=>{document.removeEventListener("fullscreenchange",o),document.removeEventListener("keydown",a,true),document.removeEventListener("keyup",n,true),window.removeEventListener("blur",i),t.remove(),delete e[ze]}},t}function Ar({children:e}){let[t,o]=Dr(null);return Er(()=>{let r=Mt(),a=document[ze];return a.users++,o(r),()=>{--a.users===0&&a.dispose()}},[]),t?Lr($r("div",{"data-buoy-root":"",style:{display:"contents",pointerEvents:"auto"},children:e}),t):null}var Be=oe,Fr=["shadowColor","shadowOffset","shadowOpacity","shadowRadius","textShadowColor","textShadowOffset","textShadowRadius"],Ee=e=>typeof e=="number"?`${e}px`:e;function dt(e){if(Array.isArray(e)){let h=e.map(dt);return h.some((R,F)=>R!==e[F])?h:e}if(!e||typeof e!="object"||!Fr.some(h=>e[h]!=null))return e;let{shadowColor:t,shadowOffset:o,shadowOpacity:r,shadowRadius:a,textShadowColor:n,textShadowOffset:i,textShadowRadius:d,...s}=e;if(t!=null||o!=null||r!=null||a!=null){let h=t??"black",R=r==null?h:`color-mix(in srgb, ${h} ${Math.min(r,1)*100}%, transparent)`,F=`${Ee(o?.width??0)} ${Ee(o?.height??0)} ${Ee(a??0)} ${R}`;s.boxShadow=typeof s.boxShadow=="string"?`${s.boxShadow}, ${F}`:s.boxShadow??F}let{width:f=0,height:l=0}=i??{};if(n&&(f||l||d)){let h=`${Ee(f)} ${Ee(l)} ${Ee(d??0)} ${n}`;s.textShadow=s.textShadow?`${s.textShadow}, ${h}`:h}return s}var Nr=Be.StyleSheet.create({auto:{pointerEvents:"auto"},none:{pointerEvents:"none"},"box-none":{pointerEvents:"box-none"},"box-only":{pointerEvents:"box-only"}});function Ut(e,t){if(typeof e=="function")return r=>Ut(e(r),t);let o=dt(e);return t?[o,Nr[t]]:o}var ve={...Be.StyleSheet,create:e=>Be.StyleSheet.create(Object.fromEntries(Object.entries(e).map(([t,o])=>[t,dt(o)])))};function ne(e){let t=Ht((r,a)=>{let{accessibilityState:n,accessibilityValue:i,pointerEvents:d,...s}=r;for(let l of["busy","checked","disabled","expanded","selected"])n?.[l]!==void 0&&s[`aria-${l}`]===void 0&&(s[`aria-${l}`]=n[l]);for(let[l,h]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[l]!==void 0&&s[`aria-${h}`]===void 0&&(s[`aria-${h}`]=i[l]);let f=Ut(s.style,d);return f!==s.style&&(s.style=f),ut(e,{...s,ref:a})}),o=e.State;return o&&Object.assign(t,{State:o}),t.displayName=e.displayName??e.name??"NativeWebView",t}var c=ne(oe.View),p=ne(oe.Text),zr={...Be.Animated,View:Be.Animated.createAnimatedComponent(c),Text:Be.Animated.createAnimatedComponent(p)},Kt=ne(oe.TextInput),V=ne(oe.TouchableOpacity),Wr=ne(oe.TouchableHighlight),Or=ne(oe.TouchableWithoutFeedback),jr=ne(oe.Pressable),qe=ne(oe.ScrollView),_t=Ht((e,t)=>{let o=Br(null),r=kr(a=>{if(a){let n=a;for(;n.parentElement&&n.parentElement!==document.body;)n=n.parentElement;n.parentElement===document.body&&(o.current=n,Object.assign(n.style,{position:"relative",zIndex:"2147483647",pointerEvents:"auto"}),Mt().appendChild(n))}else o.current&&(document.body.appendChild(o.current),o.current=null);typeof t=="function"?t(a):t&&(t.current=a)},[t]);return ut(Ar,null,ut(oe.Modal,{...e,ref:r}))});_t.displayName="Modal";var Hr=ne(_t),Vr=ne(oe.Switch),Mr=ne(oe.ActivityIndicator),Ur=ne(oe.Button),Kr=oe.findNodeHandle,_={alert(e,t,o,r){if(typeof document>"u")return;let a=document.createElement("dialog");a.dataset.buoyRoot="",a.setAttribute("aria-label",e),a.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let n=document.createElement("h2");if(n.textContent=e,n.style.cssText="font-size:18px;margin:0 0 12px",a.appendChild(n),t){let f=document.createElement("p");f.textContent=t,f.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",a.appendChild(f)}let i=document.createElement("div");i.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let d=o?.length?o:[{text:"OK"}],s=()=>{a.close?.(),a.remove()};for(let f of d){let l=document.createElement("button");l.type="button",l.textContent=f.text??"OK",l.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${f.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,l.onclick=()=>{s(),f.onPress?.()},i.appendChild(l)}a.addEventListener("cancel",f=>{f.preventDefault(),r?.cancelable!==false&&(s(),r?.onDismiss?.())}),a.appendChild(i),document.body.appendChild(a),a.showModal?a.showModal():a.setAttribute("open","")}};import{browserRouter as ai}from"@buoy-gg/shared-ui/web/utils";function _r(){return null}import{useSafeRouter as Gr,isExpoRouterAvailable as Jr,windowDragProps as qr,ToolEmptyState as Yr,resolveListEmptyState as Zr,usePersistedState as pt,monoFont as Ye}from"@buoy-gg/shared-ui/web";import{JsModal as Qr,ModalHeader as le,TabSelector as Xr,formatRelativeTime as ea,devToolsStorageKeys as We,Trash2 as ta,Filter as oa,SearchBar as Gt,ToolbarCopyButton as mt,Lock as ra,ProUpgradeModal as aa,PowerToggleButton as na,buoyColors as ia,night as Z,TickProvider as Jt,useLimit as sa}from"@buoy-gg/shared-ui/web";import{useIsPro as la}from"@buoy-gg/license/web";import{useEventStoreEvents as ca}from"@buoy-gg/shared-ui/web";import{BaseEventStore as ua,devToolsStorageKeys as da,persistentStorage as pa}from"@buoy-gg/shared-ui/web";var qt=class{constructor(){this.listeners=new Set}emit(e){this.listeners.forEach(t=>{try{t(e)}catch(o){console.error("[Buoy]","[RouteObserver] Error in listener:",o)}})}addListener(e){return this.listeners.add(e),()=>this.listeners.delete(e)}removeListener(e){this.listeners.delete(e)}},De=new qt;var ma=class extends ua{constructor(){super({storeName:"route-events",maxEvents:500});this.routeObserverUnsubscribe=null;this.bootCaptureRelease=null;this.bootCaptureHydrated=false;this.lastUnrecorded=null;this.everCaptured=false;let e=De.addListener(t=>{if(this.everCaptured){e();return}this.lastUnrecorded=t})}setBootCapture(e){e&&!this.bootCaptureRelease?this.bootCaptureRelease=this.subscribeToEvents(()=>{}):!e&&this.bootCaptureRelease&&(this.bootCaptureRelease(),this.bootCaptureRelease=null)}hydrateBootCapture(){if(this.bootCaptureHydrated)return;this.bootCaptureHydrated=true;let e=this.bootCaptureRelease!==null,t=this.getEventCount();e||this.setBootCapture(true);let o=this.bootCaptureRelease;pa.getItem(da.routeEvents.isMonitoring()).then(r=>{if(e||this.bootCaptureRelease!==o||r!=="false")return;this.setBootCapture(false);let a=this.getEventCount()-t;a>0&&this.replaceEvents(this.getEvents().slice(a))}).catch(()=>{})}startCapturing(){if(!this.routeObserverUnsubscribe){this.routeObserverUnsubscribe=De.addListener(t=>{this.addEvent(t)});let e=this.everCaptured?null:this.lastUnrecorded;this.everCaptured=true,this.lastUnrecorded=null,e&&this.getEventCount()===0&&this.addEvent(e)}}stopCapturing(){this.routeObserverUnsubscribe&&(this.routeObserverUnsubscribe(),this.routeObserverUnsubscribe=null)}isCapturing(){return this.routeObserverUnsubscribe!==null}isListening(){return this.isCapturing()}},he=new ma;function Yt(e={}){let{maxEvents:t=500,enabled:o=true}=e,{events:r,clearEvents:a,isActive:n}=ca(he,{maxEvents:t,enabled:o});return{events:r,clearEvents:a,isListening:n}}import{Navigation as ha,night as Ze,monoFont as fa}from"@buoy-gg/shared-ui/web";import{InlineCopyButton as Oe,night as ht,monoFont as ft}from"@buoy-gg/shared-ui/web";import{DataViewer as ga}from"@buoy-gg/shared-ui/web/dataViewer";import{jsx as z,jsxs as G}from"react/jsx-runtime";function ya(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.floor(e/6e4),o=(e%6e4/1e3).toFixed(0);return`${t}m ${o}s`}function gt({event:e,visitNumber:t,routeTemplate:o}){let r=e.params&&Object.keys(e.params).length>0;return G(c,{style:T.container,children:[G(c,{style:T.section,children:[e.routeName&&G(c,{style:T.detailRow,children:[z(p,{style:T.detailLabel,children:"Name:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-name",children:e.routeName})]}),e.matchedPath&&G(c,{style:T.detailRow,children:[z(p,{style:T.detailLabel,children:"Match:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-match",children:e.matchedPath})]}),o&&G(c,{style:T.detailRow,testID:"buoy-routes-detail-template",children:[z(p,{style:T.detailLabel,children:"Template:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-template-value",children:o}),z(Oe,{value:o,buttonStyle:T.copyButton})]}),e.previousPathname&&G(c,{style:T.detailRow,testID:"buoy-routes-detail-from",children:[z(p,{style:T.detailLabel,children:"From:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-from-value",children:e.previousPathname}),z(Oe,{value:e.previousPathname,buttonStyle:T.copyButton})]}),G(c,{style:T.detailRow,testID:"buoy-routes-detail-to",children:[z(p,{style:T.detailLabel,children:"To:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-to-value",children:e.pathname}),z(Oe,{value:e.pathname,buttonStyle:T.copyButton})]})]}),G(c,{style:T.section,children:[e.timeSincePrevious!==void 0&&G(c,{style:T.detailRow,testID:"buoy-routes-detail-duration",children:[z(p,{style:T.detailLabel,children:"Duration:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-duration-value",children:ya(e.timeSincePrevious)})]}),G(c,{style:T.detailRow,testID:"buoy-routes-detail-time",children:[z(p,{style:T.detailLabel,children:"Time:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-time-value",children:new Date(e.timestamp).toLocaleString()})]})]}),G(c,{style:T.section,children:[e.segments&&e.segments.length>0&&G(c,{style:T.detailRow,testID:"buoy-routes-detail-segments",children:[z(p,{style:T.detailLabel,children:"Segments:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-segments-value",children:e.segments.join(" \u2192 ")}),z(Oe,{value:JSON.stringify(e.segments),buttonStyle:T.copyButton})]}),r&&G(c,{style:T.dataViewerContainer,children:[G(c,{style:T.dataViewerHeader,children:[G(p,{style:T.dataViewerTitle,testID:"buoy-routes-detail-params-title",children:["Parameters (",Object.keys(e.params).length,")"]}),z(Oe,{value:JSON.stringify(e.params,null,2),buttonStyle:T.copyButton})]}),z(ga,{data:e.params,title:"",showTypeFilter:true,rawMode:true,initialExpanded:true})]}),t>1&&G(c,{style:T.detailRow,testID:"buoy-routes-detail-visited",children:[z(p,{style:T.detailLabel,children:"Visited:"}),G(p,{style:T.detailValue,testID:"buoy-routes-detail-visited-value",children:[t," time",t!==1?"s":""]})]})]})]})}var T=ve.create({container:{gap:12},section:{gap:8},detailRow:{flexDirection:"row",alignItems:"center",gap:8},detailLabel:{fontSize:10,color:ht.color.textSecondary,fontFamily:ft,fontWeight:"600",minWidth:70},detailValue:{fontSize:11,color:ht.color.text,fontFamily:ft,flex:1},copyButton:{padding:4,borderRadius:4},dataViewerContainer:{marginTop:4},dataViewerHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},dataViewerTitle:{fontSize:11,color:ht.color.textSecondary,fontFamily:ft,fontWeight:"600"}});function yt(e,t){if(!t||t.length===0)return null;let o="/"+t.map(r=>/^\d+$/.test(r)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(r)?"[id]":r).join("/");return o!==e?o:null}function Zt(e,t){if(!t)return e;let o=new Set(e.split("/").filter(Boolean).map(a=>{try{return decodeURIComponent(a)}catch{return a}})),r=[];for(let[a,n]of Object.entries(t)){let i=Array.isArray(n)?n:[n];if(!(i.length>0&&i.every(d=>o.has(String(d)))))for(let d of i)r.push(`${encodeURIComponent(a)}=${encodeURIComponent(String(d))}`)}return r.length?`${e}?${r.join("&")}`:e}function ba(e){let t=e.indexOf("?");if(t<0)return{pathname:e,params:{}};let o={};for(let r of e.slice(t+1).split("&")){if(!r)continue;let[a,n=""]=r.split("=");try{o[decodeURIComponent(a)]=decodeURIComponent(n)}catch{o[a]=n}}return{pathname:e.slice(0,t),params:o}}import{jsx as je,jsxs as Qt}from"react/jsx-runtime";function Xt({event:e,visitNumber:t=1,onNavigate:o}){let r=yt(e.pathname,e.segments);return Qt(c,{style:Le.container,children:[je(qe,{testID:"buoy-routes-detail-scroll",style:Le.scroll,contentContainerStyle:Le.scrollContent,showsVerticalScrollIndicator:true,children:je(gt,{event:e,visitNumber:t,routeTemplate:r})}),o&&je(c,{style:Le.footer,children:Qt(V,{style:Le.goButton,onPress:()=>o(Zt(e.pathname,e.params)),activeOpacity:.8,testID:"buoy-routes-detail-go",accessibilityRole:"button",accessibilityLabel:`Go to route ${e.pathname}`,children:[je(ha,{size:16,color:Ze.color.onAccent}),je(p,{style:Le.goButtonText,children:"Go to route"})]})})]})}var Le=ve.create({container:{flex:1,backgroundColor:"transparent"},scroll:{flex:1},scrollContent:{padding:14},footer:{paddingHorizontal:16,paddingVertical:12,backgroundColor:"transparent",borderTopWidth:1,borderTopColor:Ze.color.border},goButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,backgroundColor:Ze.color.accent,paddingVertical:12,borderRadius:8},goButtonText:{fontSize:13,fontWeight:"600",color:Ze.color.onAccent,fontFamily:fa,textTransform:"uppercase",letterSpacing:.5}});import{Filter as eo,DynamicFilterView as va}from"@buoy-gg/shared-ui/web";import{jsx as xa}from"react/jsx-runtime";function Sa({ignoredPatterns:e,onTogglePattern:t,onAddPattern:o,availablePathnames:r=[]}){return xa(va,{...{addFilterSection:{enabled:true,placeholder:"Enter pattern (e.g., /_sitemap)",title:"ACTIVE FILTERS",icon:eo},availableItemsSection:{enabled:true,title:"AVAILABLE ROUTES FROM EVENTS",emptyMessage:"No routes available. Routes from navigation events will appear here.",items:r},howItWorksSection:{enabled:true,title:"HOW FILTERS WORK",description:"Filtered routes will not appear in the route events list. Patterns match if the route contains the specified text.",examples:["\u2022 /_sitemap \u2192 filters /_sitemap routes","\u2022 /api \u2192 filters /api/users, /api/posts","\u2022 [id] \u2192 filters all routes with [id] param"],icon:eo},onPatternToggle:t,onPatternAdd:o,activePatterns:e}})}import{useState as Pe,useCallback as He,useMemo as Qe,useEffect as wa}from"react";import{night as v,ToolEmptyState as Ca,monoFont as Q}from"@buoy-gg/shared-ui/web";import{isCapacitorNative as Ta}from"@buoy-gg/license/web";import{useSafeRouter as Ra}from"@buoy-gg/shared-ui/web";import{Search as to,ChevronDown as oo,ChevronRight as ro,Home as Ia,InlineCopyButton as ka,CopyButton as Ba,RefreshCw as Ea,formatRelativeTime as Da,ProUpgradeModal as La}from"@buoy-gg/shared-ui/web";import{useIsPro as Pa}from"@buoy-gg/license/web";import{useState as $a,useEffect as ao,useMemo as Se,useCallback as Aa}from"react";var ye=class{static parseRouteTree(e){if(!e)return[];let t=[];return this.traverseNode(e,"",t,0),t}static traverseNode(e,t,o,r){let a=this.buildPath(e,t),n=this.detectRouteType(e),i=this.shouldIncludeRoute(e),d={path:a,name:e.route,type:n,params:this.extractParams(e),nodeType:e.type,contextKey:e.contextKey,isInternal:e.internal??false,children:[],depth:r};i&&o.push(d);for(let s of e.children)this.traverseNode(s,a,i?d.children:o,r+1)}static buildPath(e,t){if(e.type==="layout"&&e.route==="_layout"||e.route.startsWith("(")&&e.route.endsWith(")"))return t;if(e.route==="index")return t||"/";let o=e.route;return!t||t==="/"?`/${o}`:`${t}/${o}`}static detectRouteType(e){let t=e.route;return e.dynamic?.some(o=>o.notFound)?"not-found":e.dynamic?.some(o=>o.deep)?"catch-all":e.dynamic&&e.dynamic.length>0?"dynamic":e.type==="layout"?"layout":t.startsWith("(")&&t.endsWith(")")?"group":t==="index"?"index":"static"}static extractParams(e){return!e.dynamic||e.dynamic.length===0?[]:e.dynamic.map(t=>t.name)}static shouldIncludeRoute(e){return!(e.internal||e.generated||e.type==="api")}static organizeRoutes(e){let t=[],o=this.flattenRoutes(e).filter(i=>i.type==="static"||i.type==="index"),r=this.flattenRoutes(e).filter(i=>i.type==="dynamic"||i.type==="catch-all"),a=this.flattenRoutes(e).filter(i=>i.type==="layout"),n=this.flattenRoutes(e).filter(i=>i.type==="group");return o.length>0&&t.push({title:"Static Routes",icon:"",routes:o}),r.length>0&&t.push({title:"Dynamic Routes",icon:"",description:"Routes that accept parameters",routes:r}),a.length>0&&t.push({title:"Layouts",icon:"",description:"Shared UI for nested screens",routes:a}),n.length>0&&t.push({title:"Route Groups",icon:"",routes:n}),t}static flattenRoutes(e){let t=[];function o(r){t.push(r),r.children.forEach(o)}return e.forEach(o),t}static getRouteStats(e){let t=this.flattenRoutes(e);return{total:t.length,static:t.filter(o=>o.type==="static").length,dynamic:t.filter(o=>o.type==="dynamic").length,catchAll:t.filter(o=>o.type==="catch-all").length,layouts:t.filter(o=>o.type==="layout").length,groups:t.filter(o=>o.type==="group").length}}static filterRoutes(e,t){if(!t)return e;let o=t.toLowerCase();return this.flattenRoutes(e).filter(r=>r.path.toLowerCase().includes(o)||r.name.toLowerCase().includes(o)||r.type.toLowerCase().includes(o)||r.params.some(a=>a.toLowerCase().includes(o)))}static buildTreeString(e,t=0){let o="";return e.forEach((r,a)=>{let n=a===e.length-1,i=`${this.buildTreePrefix(t,n)}${r.path}`;r.params.length>0&&(i+=` { ${r.params.join(", ")} }`),o+=i+`
|
|
2
|
-
`,r.children.length>0&&(o+=this.buildTreeString(r.children,t+1))}),o}static buildTreePrefix(e,t){return e===0?"":" ".repeat(e-1)+(t?"\u2514\u2500 ":"\u251C\u2500 ")}static sortRoutes(e,t="path"){let o=[...e];return o.sort((r,a)=>{switch(t){case"path":return r.path.localeCompare(a.path);case"type":return r.type.localeCompare(a.type);case"name":return r.name.localeCompare(a.name);default:return 0}}),o}static findRouteByPath(e,t){return this.flattenRoutes(e).find(o=>o.path===t)||null}static getParentRoutes(e,t){let o=[],r=this.flattenRoutes(e);if(!r.find(i=>i.path===t))return o;let a=t.split("/").filter(Boolean),n="";for(let i=0;i<a.length-1;i++){n+="/"+a[i];let d=r.find(s=>s.path===n);d&&o.push(d)}return o}};import{getBrowserHref as Fa}from"@buoy-gg/shared-ui/web/utils";var $e=new Map,bt=null;function Na(e){for(let o of e)$e.set(o,($e.get(o)??0)+1);bt=Date.now();let t=true;return()=>{if(t){t=false;for(let o of e){let r=($e.get(o)??1)-1;r?$e.set(o,r):$e.delete(o)}bt=Date.now()}}}function vt(){return[...$e.keys()]}function za(){return bt}function no(e){let t={segments:e.split("/").filter(Boolean),params:{}},o=vt();if(o.includes(e))return t;for(let r of o){let a=r.split("/").filter(Boolean),n=[],i=a.map(l=>{let
|
|
1
|
+
"use client";var Nt=Object.defineProperty;var $o=Object.getOwnPropertyDescriptor;var Ao=Object.getOwnPropertyNames;var Fo=Object.prototype.hasOwnProperty;var No=(e,t)=>{for(var o in t)Nt(e,o,{get:t[o],enumerable:true})},zt=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ao(t))!Fo.call(e,a)&&a!==o&&Nt(e,a,{get:()=>t[a],enumerable:!(r=$o(t,a))||r.enumerable});return e},zo=(e,t,o)=>(zt(e,t,"default"),o&&zt(o,t,"default"));var qn=(()=>{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{RoutesIcon as Wo}from"@buoy-gg/floating-tools-core/web";import{useState as ke,useCallback as he,useEffect as Wt,useRef as Oo,useMemo as Ie}from"react";var Ot={};No(Ot,{AccessibilityInfo:()=>Mo,ActivityIndicator:()=>Mr,Alert:()=>_,Animated:()=>zr,AppRegistry:()=>Ko,AppState:()=>_o,Appearance:()=>Uo,BackHandler:()=>Go,Button:()=>Ur,CheckBox:()=>lr,Clipboard:()=>Jo,DeviceEventEmitter:()=>Cr,Dimensions:()=>qo,Easing:()=>Yo,FlatList:()=>jt,I18nManager:()=>Zo,Image:()=>cr,ImageBackground:()=>ur,InteractionManager:()=>Xo,Keyboard:()=>Qo,KeyboardAvoidingView:()=>dr,LayoutAnimation:()=>er,Linking:()=>tr,LogBox:()=>wr,Modal:()=>Hr,NativeEventEmitter:()=>or,NativeModules:()=>Vo,PanResponder:()=>rr,Picker:()=>pr,PixelRatio:()=>ar,Platform:()=>ct,Pressable:()=>jr,ProgressBar:()=>hr,RefreshControl:()=>mr,SafeAreaView:()=>fr,ScrollView:()=>qe,SectionList:()=>gr,Share:()=>nr,StatusBar:()=>yr,StyleSheet:()=>ve,Switch:()=>Vr,Text:()=>p,TextInput:()=>Kt,Touchable:()=>br,TouchableHighlight:()=>Wr,TouchableNativeFeedback:()=>vr,TouchableOpacity:()=>V,TouchableWithoutFeedback:()=>Or,UIManager:()=>ir,Vibration:()=>sr,View:()=>c,VirtualizedList:()=>xr,YellowBox:()=>Sr,findNodeHandle:()=>Kr,unstable_createElement:()=>Ho,useColorScheme:()=>Tr,useLocaleContext:()=>Rr,useWindowDimensions:()=>kr});zo(Ot,jo);import*as jo from"react-native-web";import{unstable_createElement as Ho,NativeModules as Vo,AccessibilityInfo as Mo,Appearance as Uo,AppRegistry as Ko,AppState as _o,BackHandler as Go,Clipboard as Jo,Dimensions as qo,Easing as Yo,I18nManager as Zo,Keyboard as Qo,InteractionManager as Xo,LayoutAnimation as er,Linking as tr,NativeEventEmitter as or,PanResponder as rr,PixelRatio as ar,Platform as ct,Share as nr,UIManager as ir,Vibration as sr,CheckBox as lr,FlatList as jt,Image as cr,ImageBackground as ur,KeyboardAvoidingView as dr,Picker as pr,ProgressBar as hr,RefreshControl as mr,SafeAreaView as fr,SectionList as gr,StatusBar as yr,Touchable as br,TouchableNativeFeedback as vr,VirtualizedList as xr,YellowBox as Sr,LogBox as wr,DeviceEventEmitter as Cr,useColorScheme as Tr,useLocaleContext as Rr,useWindowDimensions as kr}from"react-native-web";import*as oe from"react-native-web";import{createElement as ut,forwardRef as Ht,useCallback as Ir,useRef as Br}from"react";import{useEffect as Er,useState as Dr}from"react";import{createPortal as Pr}from"react-dom";var Lr='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';import{jsx as $r}from"react/jsx-runtime";var ze=Symbol.for("@buoy-gg/portal-host"),Vt=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 Mt(){let e=document;if(e[ze])return e[ze].host;let t=document.createElement("div");t.dataset.buoyPortalHost="",Object.assign(t.style,{position:"fixed",inset:"0",zIndex:"2147483647",pointerEvents:"none",fontFamily:Lr});let o=()=>{let l=document.fullscreenElement,m=l&&l.tagName!=="CANVAS"?l:document.body;t.parentElement!==m&&m.appendChild(t)},r=new Map,a=l=>{(!t.contains(l.target)||!Vt(l.target))&&r.set(l.code||l.key,{key:l.key,code:l.code,location:l.location,keyCode:l.keyCode,which:l.which,altKey:l.altKey,ctrlKey:l.ctrlKey,metaKey:l.metaKey,shiftKey:l.shiftKey})},n=l=>{r.delete(l.code||l.key)},i=()=>r.clear(),d=()=>{let l=[...r.values()];r.clear();for(let m of l)document.dispatchEvent(new KeyboardEvent("keyup",{...m,bubbles:true}))},s=l=>{Vt(l.target)&&l.stopPropagation()},f=l=>l.stopPropagation();return o(),document.addEventListener("fullscreenchange",o),document.addEventListener("keydown",a,true),document.addEventListener("keyup",n,true),window.addEventListener("blur",i),t.addEventListener("focusin",d),t.addEventListener("keydown",s),t.addEventListener("keyup",s),t.addEventListener("keypress",s),t.addEventListener("wheel",f,{passive:true}),e[ze]={host:t,users:0,dispose:()=>{document.removeEventListener("fullscreenchange",o),document.removeEventListener("keydown",a,true),document.removeEventListener("keyup",n,true),window.removeEventListener("blur",i),t.remove(),delete e[ze]}},t}function Ar({children:e}){let[t,o]=Dr(null);return Er(()=>{let r=Mt(),a=document[ze];return a.users++,o(r),()=>{--a.users===0&&a.dispose()}},[]),t?Pr($r("div",{"data-buoy-root":"",style:{display:"contents",pointerEvents:"auto"},children:e}),t):null}var Be=oe,Fr=["shadowColor","shadowOffset","shadowOpacity","shadowRadius","textShadowColor","textShadowOffset","textShadowRadius"],Ee=e=>typeof e=="number"?`${e}px`:e;function dt(e){if(Array.isArray(e)){let m=e.map(dt);return m.some((R,F)=>R!==e[F])?m:e}if(!e||typeof e!="object"||!Fr.some(m=>e[m]!=null))return e;let{shadowColor:t,shadowOffset:o,shadowOpacity:r,shadowRadius:a,textShadowColor:n,textShadowOffset:i,textShadowRadius:d,...s}=e;if(t!=null||o!=null||r!=null||a!=null){let m=t??"black",R=r==null?m:`color-mix(in srgb, ${m} ${Math.min(r,1)*100}%, transparent)`,F=`${Ee(o?.width??0)} ${Ee(o?.height??0)} ${Ee(a??0)} ${R}`;s.boxShadow=typeof s.boxShadow=="string"?`${s.boxShadow}, ${F}`:s.boxShadow??F}let{width:f=0,height:l=0}=i??{};if(n&&(f||l||d)){let m=`${Ee(f)} ${Ee(l)} ${Ee(d??0)} ${n}`;s.textShadow=s.textShadow?`${s.textShadow}, ${m}`:m}return s}var Nr=Be.StyleSheet.create({auto:{pointerEvents:"auto"},none:{pointerEvents:"none"},"box-none":{pointerEvents:"box-none"},"box-only":{pointerEvents:"box-only"}});function Ut(e,t){if(typeof e=="function")return r=>Ut(e(r),t);let o=dt(e);return t?[o,Nr[t]]:o}var ve={...Be.StyleSheet,create:e=>Be.StyleSheet.create(Object.fromEntries(Object.entries(e).map(([t,o])=>[t,dt(o)])))};function ne(e){let t=Ht((r,a)=>{let{accessibilityState:n,accessibilityValue:i,pointerEvents:d,...s}=r;for(let l of["busy","checked","disabled","expanded","selected"])n?.[l]!==void 0&&s[`aria-${l}`]===void 0&&(s[`aria-${l}`]=n[l]);for(let[l,m]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[l]!==void 0&&s[`aria-${m}`]===void 0&&(s[`aria-${m}`]=i[l]);let f=Ut(s.style,d);return f!==s.style&&(s.style=f),ut(e,{...s,ref:a})}),o=e.State;return o&&Object.assign(t,{State:o}),t.displayName=e.displayName??e.name??"NativeWebView",t}var c=ne(oe.View),p=ne(oe.Text),zr={...Be.Animated,View:Be.Animated.createAnimatedComponent(c),Text:Be.Animated.createAnimatedComponent(p)},Kt=ne(oe.TextInput),V=ne(oe.TouchableOpacity),Wr=ne(oe.TouchableHighlight),Or=ne(oe.TouchableWithoutFeedback),jr=ne(oe.Pressable),qe=ne(oe.ScrollView),_t=Ht((e,t)=>{let o=Br(null),r=Ir(a=>{if(a){let n=a;for(;n.parentElement&&n.parentElement!==document.body;)n=n.parentElement;n.parentElement===document.body&&(o.current=n,Object.assign(n.style,{position:"relative",zIndex:"2147483647",pointerEvents:"auto"}),Mt().appendChild(n))}else o.current&&(document.body.appendChild(o.current),o.current=null);typeof t=="function"?t(a):t&&(t.current=a)},[t]);return ut(Ar,null,ut(oe.Modal,{...e,ref:r}))});_t.displayName="Modal";var Hr=ne(_t),Vr=ne(oe.Switch),Mr=ne(oe.ActivityIndicator),Ur=ne(oe.Button),Kr=oe.findNodeHandle,_={alert(e,t,o,r){if(typeof document>"u")return;let a=document.createElement("dialog");a.dataset.buoyRoot="",a.setAttribute("aria-label",e),a.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let n=document.createElement("h2");if(n.textContent=e,n.style.cssText="font-size:18px;margin:0 0 12px",a.appendChild(n),t){let f=document.createElement("p");f.textContent=t,f.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",a.appendChild(f)}let i=document.createElement("div");i.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let d=o?.length?o:[{text:"OK"}],s=()=>{a.close?.(),a.remove()};for(let f of d){let l=document.createElement("button");l.type="button",l.textContent=f.text??"OK",l.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${f.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,l.onclick=()=>{s(),f.onPress?.()},i.appendChild(l)}a.addEventListener("cancel",f=>{f.preventDefault(),r?.cancelable!==false&&(s(),r?.onDismiss?.())}),a.appendChild(i),document.body.appendChild(a),a.showModal?a.showModal():a.setAttribute("open","")}};import{browserRouter as ai}from"@buoy-gg/shared-ui/web/utils";function _r(){return null}import{useSafeRouter as Gr,isExpoRouterAvailable as Jr,windowDragProps as qr,ToolEmptyState as Yr,resolveListEmptyState as Zr,usePersistedState as pt,monoFont as Ye}from"@buoy-gg/shared-ui/web";import{JsModal as Qr,ModalHeader as le,TabSelector as Xr,formatRelativeTime as ea,devToolsStorageKeys as We,Trash2 as ta,Filter as oa,SearchBar as Gt,ToolbarCopyButton as ht,Lock as ra,ProUpgradeModal as aa,PowerToggleButton as na,buoyColors as ia,night as Z,TickProvider as Jt,useLimit as sa}from"@buoy-gg/shared-ui/web";import{useIsPro as la}from"@buoy-gg/license/web";import{useEventStoreEvents as ca}from"@buoy-gg/shared-ui/web";import{BaseEventStore as ua,devToolsStorageKeys as da,persistentStorage as pa}from"@buoy-gg/shared-ui/web";var qt=class{constructor(){this.listeners=new Set}emit(e){this.listeners.forEach(t=>{try{t(e)}catch(o){console.error("[Buoy]","[RouteObserver] Error in listener:",o)}})}addListener(e){return this.listeners.add(e),()=>this.listeners.delete(e)}removeListener(e){this.listeners.delete(e)}},De=new qt;var ha=class extends ua{constructor(){super({storeName:"route-events",maxEvents:500});this.routeObserverUnsubscribe=null;this.bootCaptureRelease=null;this.bootCaptureHydrated=false;this.lastUnrecorded=null;this.everCaptured=false;let e=De.addListener(t=>{if(this.everCaptured){e();return}this.lastUnrecorded=t})}setBootCapture(e){e&&!this.bootCaptureRelease?this.bootCaptureRelease=this.subscribeToEvents(()=>{}):!e&&this.bootCaptureRelease&&(this.bootCaptureRelease(),this.bootCaptureRelease=null)}hydrateBootCapture(){if(this.bootCaptureHydrated)return;this.bootCaptureHydrated=true;let e=this.bootCaptureRelease!==null,t=this.getEventCount();e||this.setBootCapture(true);let o=this.bootCaptureRelease;pa.getItem(da.routeEvents.isMonitoring()).then(r=>{if(e||this.bootCaptureRelease!==o||r!=="false")return;this.setBootCapture(false);let a=this.getEventCount()-t;a>0&&this.replaceEvents(this.getEvents().slice(a))}).catch(()=>{})}startCapturing(){if(!this.routeObserverUnsubscribe){this.routeObserverUnsubscribe=De.addListener(t=>{this.addEvent(t)});let e=this.everCaptured?null:this.lastUnrecorded;this.everCaptured=true,this.lastUnrecorded=null,e&&this.getEventCount()===0&&this.addEvent(e)}}stopCapturing(){this.routeObserverUnsubscribe&&(this.routeObserverUnsubscribe(),this.routeObserverUnsubscribe=null)}isCapturing(){return this.routeObserverUnsubscribe!==null}isListening(){return this.isCapturing()}},me=new ha;function Yt(e={}){let{maxEvents:t=500,enabled:o=true}=e,{events:r,clearEvents:a,isActive:n}=ca(me,{maxEvents:t,enabled:o});return{events:r,clearEvents:a,isListening:n}}import{Navigation as ma,night as Ze,monoFont as fa}from"@buoy-gg/shared-ui/web";import{InlineCopyButton as Oe,night as mt,monoFont as ft}from"@buoy-gg/shared-ui/web";import{DataViewer as ga}from"@buoy-gg/shared-ui/web/dataViewer";import{jsx as z,jsxs as G}from"react/jsx-runtime";function ya(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.floor(e/6e4),o=(e%6e4/1e3).toFixed(0);return`${t}m ${o}s`}function gt({event:e,visitNumber:t,routeTemplate:o}){let r=e.params&&Object.keys(e.params).length>0;return G(c,{style:T.container,children:[G(c,{style:T.section,children:[e.routeName&&G(c,{style:T.detailRow,children:[z(p,{style:T.detailLabel,children:"Name:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-name",children:e.routeName})]}),e.matchedPath&&G(c,{style:T.detailRow,children:[z(p,{style:T.detailLabel,children:"Match:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-match",children:e.matchedPath})]}),o&&G(c,{style:T.detailRow,testID:"buoy-routes-detail-template",children:[z(p,{style:T.detailLabel,children:"Template:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-template-value",children:o}),z(Oe,{value:o,buttonStyle:T.copyButton})]}),e.previousPathname&&G(c,{style:T.detailRow,testID:"buoy-routes-detail-from",children:[z(p,{style:T.detailLabel,children:"From:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-from-value",children:e.previousPathname}),z(Oe,{value:e.previousPathname,buttonStyle:T.copyButton})]}),G(c,{style:T.detailRow,testID:"buoy-routes-detail-to",children:[z(p,{style:T.detailLabel,children:"To:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-to-value",children:e.pathname}),z(Oe,{value:e.pathname,buttonStyle:T.copyButton})]})]}),G(c,{style:T.section,children:[e.timeSincePrevious!==void 0&&G(c,{style:T.detailRow,testID:"buoy-routes-detail-duration",children:[z(p,{style:T.detailLabel,children:"Duration:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-duration-value",children:ya(e.timeSincePrevious)})]}),G(c,{style:T.detailRow,testID:"buoy-routes-detail-time",children:[z(p,{style:T.detailLabel,children:"Time:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-time-value",children:new Date(e.timestamp).toLocaleString()})]})]}),G(c,{style:T.section,children:[e.segments&&e.segments.length>0&&G(c,{style:T.detailRow,testID:"buoy-routes-detail-segments",children:[z(p,{style:T.detailLabel,children:"Segments:"}),z(p,{style:T.detailValue,testID:"buoy-routes-detail-segments-value",children:e.segments.join(" \u2192 ")}),z(Oe,{value:JSON.stringify(e.segments),buttonStyle:T.copyButton})]}),r&&G(c,{style:T.dataViewerContainer,children:[G(c,{style:T.dataViewerHeader,children:[G(p,{style:T.dataViewerTitle,testID:"buoy-routes-detail-params-title",children:["Parameters (",Object.keys(e.params).length,")"]}),z(Oe,{value:JSON.stringify(e.params,null,2),buttonStyle:T.copyButton})]}),z(ga,{data:e.params,title:"",showTypeFilter:true,rawMode:true,initialExpanded:true})]}),t>1&&G(c,{style:T.detailRow,testID:"buoy-routes-detail-visited",children:[z(p,{style:T.detailLabel,children:"Visited:"}),G(p,{style:T.detailValue,testID:"buoy-routes-detail-visited-value",children:[t," time",t!==1?"s":""]})]})]})]})}var T=ve.create({container:{gap:12},section:{gap:8},detailRow:{flexDirection:"row",alignItems:"center",gap:8},detailLabel:{fontSize:10,color:mt.color.textSecondary,fontFamily:ft,fontWeight:"600",minWidth:70},detailValue:{fontSize:11,color:mt.color.text,fontFamily:ft,flex:1},copyButton:{padding:4,borderRadius:4},dataViewerContainer:{marginTop:4},dataViewerHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},dataViewerTitle:{fontSize:11,color:mt.color.textSecondary,fontFamily:ft,fontWeight:"600"}});function yt(e,t){if(!t||t.length===0)return null;let o="/"+t.map(r=>/^\d+$/.test(r)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(r)?"[id]":r).join("/");return o!==e?o:null}function Zt(e,t){if(!t)return e;let o=new Set(e.split("/").filter(Boolean).map(a=>{try{return decodeURIComponent(a)}catch{return a}})),r=[];for(let[a,n]of Object.entries(t)){let i=Array.isArray(n)?n:[n];if(!(i.length>0&&i.every(d=>o.has(String(d)))))for(let d of i)r.push(`${encodeURIComponent(a)}=${encodeURIComponent(String(d))}`)}return r.length?`${e}?${r.join("&")}`:e}function ba(e){let t=e.indexOf("?");if(t<0)return{pathname:e,params:{}};let o={};for(let r of e.slice(t+1).split("&")){if(!r)continue;let[a,n=""]=r.split("=");try{o[decodeURIComponent(a)]=decodeURIComponent(n)}catch{o[a]=n}}return{pathname:e.slice(0,t),params:o}}import{jsx as je,jsxs as Qt}from"react/jsx-runtime";function Xt({event:e,visitNumber:t=1,onNavigate:o}){let r=yt(e.pathname,e.segments);return Qt(c,{style:Pe.container,children:[je(qe,{keyboardShouldPersistTaps:"handled",testID:"buoy-routes-detail-scroll",style:Pe.scroll,contentContainerStyle:Pe.scrollContent,showsVerticalScrollIndicator:true,children:je(gt,{event:e,visitNumber:t,routeTemplate:r})}),o&&je(c,{style:Pe.footer,children:Qt(V,{style:Pe.goButton,onPress:()=>o(Zt(e.pathname,e.params)),activeOpacity:.8,testID:"buoy-routes-detail-go",accessibilityRole:"button",accessibilityLabel:`Go to route ${e.pathname}`,children:[je(ma,{size:16,color:Ze.color.onAccent}),je(p,{style:Pe.goButtonText,children:"Go to route"})]})})]})}var Pe=ve.create({container:{flex:1,backgroundColor:"transparent"},scroll:{flex:1},scrollContent:{padding:14},footer:{paddingHorizontal:16,paddingVertical:12,backgroundColor:"transparent",borderTopWidth:1,borderTopColor:Ze.color.border},goButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,backgroundColor:Ze.color.accent,paddingVertical:12,borderRadius:8},goButtonText:{fontSize:13,fontWeight:"600",color:Ze.color.onAccent,fontFamily:fa,textTransform:"uppercase",letterSpacing:.5}});import{Filter as eo,DynamicFilterView as va}from"@buoy-gg/shared-ui/web";import{jsx as xa}from"react/jsx-runtime";function Sa({ignoredPatterns:e,onTogglePattern:t,onAddPattern:o,availablePathnames:r=[]}){return xa(va,{...{addFilterSection:{enabled:true,placeholder:"Enter pattern (e.g., /_sitemap)",title:"ACTIVE FILTERS",icon:eo},availableItemsSection:{enabled:true,title:"AVAILABLE ROUTES FROM EVENTS",emptyMessage:"No routes available. Routes from navigation events will appear here.",items:r},howItWorksSection:{enabled:true,title:"HOW FILTERS WORK",description:"Filtered routes will not appear in the route events list. Patterns match if the route contains the specified text.",examples:["\u2022 /_sitemap \u2192 filters /_sitemap routes","\u2022 /api \u2192 filters /api/users, /api/posts","\u2022 [id] \u2192 filters all routes with [id] param"],icon:eo},onPatternToggle:t,onPatternAdd:o,activePatterns:e}})}import{useState as Le,useCallback as He,useMemo as Qe,useEffect as wa}from"react";import{night as v,ToolEmptyState as Ca,monoFont as Q}from"@buoy-gg/shared-ui/web";import{isCapacitorNative as Ta}from"@buoy-gg/license/web";import{useSafeRouter as Ra}from"@buoy-gg/shared-ui/web";import{Search as to,ChevronDown as oo,ChevronRight as ro,Home as ka,InlineCopyButton as Ia,CopyButton as Ba,RefreshCw as Ea,formatRelativeTime as Da,ProUpgradeModal as Pa}from"@buoy-gg/shared-ui/web";import{useIsPro as La}from"@buoy-gg/license/web";import{useState as $a,useEffect as ao,useMemo as Se,useCallback as Aa}from"react";var ye=class{static parseRouteTree(e){if(!e)return[];let t=[];return this.traverseNode(e,"",t,0),t}static traverseNode(e,t,o,r){let a=this.buildPath(e,t),n=this.detectRouteType(e),i=this.shouldIncludeRoute(e),d={path:a,name:e.route,type:n,params:this.extractParams(e),nodeType:e.type,contextKey:e.contextKey,isInternal:e.internal??false,children:[],depth:r};i&&o.push(d);for(let s of e.children)this.traverseNode(s,a,i?d.children:o,r+1)}static buildPath(e,t){if(e.type==="layout"&&e.route==="_layout"||e.route.startsWith("(")&&e.route.endsWith(")"))return t;if(e.route==="index")return t||"/";let o=e.route;return!t||t==="/"?`/${o}`:`${t}/${o}`}static detectRouteType(e){let t=e.route;return e.dynamic?.some(o=>o.notFound)?"not-found":e.dynamic?.some(o=>o.deep)?"catch-all":e.dynamic&&e.dynamic.length>0?"dynamic":e.type==="layout"?"layout":t.startsWith("(")&&t.endsWith(")")?"group":t==="index"?"index":"static"}static extractParams(e){return!e.dynamic||e.dynamic.length===0?[]:e.dynamic.map(t=>t.name)}static shouldIncludeRoute(e){return!(e.internal||e.generated||e.type==="api")}static organizeRoutes(e){let t=[],o=this.flattenRoutes(e).filter(i=>i.type==="static"||i.type==="index"),r=this.flattenRoutes(e).filter(i=>i.type==="dynamic"||i.type==="catch-all"),a=this.flattenRoutes(e).filter(i=>i.type==="layout"),n=this.flattenRoutes(e).filter(i=>i.type==="group");return o.length>0&&t.push({title:"Static Routes",icon:"",routes:o}),r.length>0&&t.push({title:"Dynamic Routes",icon:"",description:"Routes that accept parameters",routes:r}),a.length>0&&t.push({title:"Layouts",icon:"",description:"Shared UI for nested screens",routes:a}),n.length>0&&t.push({title:"Route Groups",icon:"",routes:n}),t}static flattenRoutes(e){let t=[];function o(r){t.push(r),r.children.forEach(o)}return e.forEach(o),t}static getRouteStats(e){let t=this.flattenRoutes(e);return{total:t.length,static:t.filter(o=>o.type==="static").length,dynamic:t.filter(o=>o.type==="dynamic").length,catchAll:t.filter(o=>o.type==="catch-all").length,layouts:t.filter(o=>o.type==="layout").length,groups:t.filter(o=>o.type==="group").length}}static filterRoutes(e,t){if(!t)return e;let o=t.toLowerCase();return this.flattenRoutes(e).filter(r=>r.path.toLowerCase().includes(o)||r.name.toLowerCase().includes(o)||r.type.toLowerCase().includes(o)||r.params.some(a=>a.toLowerCase().includes(o)))}static buildTreeString(e,t=0){let o="";return e.forEach((r,a)=>{let n=a===e.length-1,i=`${this.buildTreePrefix(t,n)}${r.path}`;r.params.length>0&&(i+=` { ${r.params.join(", ")} }`),o+=i+`
|
|
2
|
+
`,r.children.length>0&&(o+=this.buildTreeString(r.children,t+1))}),o}static buildTreePrefix(e,t){return e===0?"":" ".repeat(e-1)+(t?"\u2514\u2500 ":"\u251C\u2500 ")}static sortRoutes(e,t="path"){let o=[...e];return o.sort((r,a)=>{switch(t){case"path":return r.path.localeCompare(a.path);case"type":return r.type.localeCompare(a.type);case"name":return r.name.localeCompare(a.name);default:return 0}}),o}static findRouteByPath(e,t){return this.flattenRoutes(e).find(o=>o.path===t)||null}static getParentRoutes(e,t){let o=[],r=this.flattenRoutes(e);if(!r.find(i=>i.path===t))return o;let a=t.split("/").filter(Boolean),n="";for(let i=0;i<a.length-1;i++){n+="/"+a[i];let d=r.find(s=>s.path===n);d&&o.push(d)}return o}};import{getBrowserHref as Fa}from"@buoy-gg/shared-ui/web/utils";var $e=new Map,bt=null;function Na(e){for(let o of e)$e.set(o,($e.get(o)??0)+1);bt=Date.now();let t=true;return()=>{if(t){t=false;for(let o of e){let r=($e.get(o)??1)-1;r?$e.set(o,r):$e.delete(o)}bt=Date.now()}}}function vt(){return[...$e.keys()]}function za(){return bt}function no(e){let t={segments:e.split("/").filter(Boolean),params:{}},o=vt();if(o.includes(e))return t;for(let r of o){let a=r.split("/").filter(Boolean),n=[],i=a.map(l=>{let m=/^\[(\.\.\.)?([^\]]+)\]$/.exec(l);return m?(n.push({name:m[2],deep:!!m[1]}),m[1]?"(.+)":"([^/]+)"):l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}),d=new RegExp("^/"+i.join("/")+"/?$").exec(e);if(!d)continue;let s=l=>{try{return decodeURIComponent(l)}catch{return l}},f={};return n.forEach(({name:l,deep:m},R)=>{let F=d[R+1];f[l]=m?F.split("/").map(s):s(F)}),{segments:a,params:f}}return t}var xt=0;function Wa(){xt++,me.hydrateBootCapture();let e=true;return()=>{e&&(e=false,xt--)}}function Oa(){return xt>0}function St(){return typeof window<"u"}function Ve(){return St()?{route:"",type:"layout",contextKey:"browser",children:[...new Set([...vt(),new URL(Fa()).pathname])].map(e=>({route:e.replace(/^\//,"")||"index",type:"route",contextKey:e,children:[],dynamic:e.split("/").flatMap(t=>{let o=/^\[(\.\.\.)?([^\]]+)\]$/.exec(t);return o?[{name:o[2],deep:!!o[1]}]:[]})}))}:null}function wt(){return{source:vt().length>0?"registered":null,lastLoadedAt:za()}}function io(){return false}function Xe(e={}){let{searchQuery:t="",sortBy:o="path",autoRefresh:r=false,refreshInterval:a=1e3,injectedRoutes:n,injectedSource:i=null,injectedLastUpdatedAt:d=null}=e,s=n!=null,[f,l]=$a(()=>{let P=Ve(),Y=wt();return{node:P,version:0,lastUpdatedAt:Y.lastLoadedAt,source:Y.source}}),m=f.node,R=f.version,F=f.lastUpdatedAt,g=f.source,x=Aa(()=>{l(P=>{let Y=Ve(),X=wt();return{node:Y,version:P.version+1,lastUpdatedAt:X.lastLoadedAt,source:X.source}})},[]);ao(()=>{if(m||s||!St())return;let P=0,Y=100,X=()=>{P++,x(),P<Y&&(j=setTimeout(X,100))},j=setTimeout(X,100);return()=>clearTimeout(j)},[m,x,s]),ao(()=>{if(!r)return;let P=setInterval(x,a);return()=>clearInterval(P)},[r,a,x]);let L=s?n.length>0:!!m,I=s?true:St(),E=Se(()=>s?n:m?ye.parseRouteTree(m):[],[m,R,s,n]),W=Se(()=>ye.sortRoutes(E,o),[E,o]),C=Se(()=>t?ye.filterRoutes(W,t):W,[W,t]),A=Se(()=>ye.organizeRoutes(C),[C]),q=Se(()=>ye.getRouteStats(E),[E]);return{routes:W,groups:A,stats:q,filteredRoutes:C,isLoaded:L,isSupported:I,refresh:x,findRoute:P=>ye.findRouteByPath(E,P),getParents:P=>ye.getParentRoutes(E,P),lastUpdatedAt:s?d:F,source:s?i:g}}function ja(e){let{findRoute:t}=Xe();return Se(()=>t(e),[t,e])}function Ha(e){let{getParents:t}=Xe();return Se(()=>t(e),[t,e])}function Ct(e){return String(e).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"root"}function Va(e,t){return`buoy-routes-event-row-${Ct(e)}-${t}`}function Ma(e){return`buoy-routes-route-${Ct(e)}`}function so(e){return`buoy-routes-group-${Ct(e)}`}function Ua(e){return`buoy-routes-stack-item-${e}`}import{jsx as h,jsxs as O}from"react/jsx-runtime";var re=ct.OS==="web"&&!Ta(),et=re?22:16,Ka={path:"/",name:"index",type:"index",params:[],nodeType:"route",contextKey:"/",isInternal:false,children:[],depth:0};function Tt({style:e,injectedRoutes:t,injectedSource:o,injectedLastUpdatedAt:r,onNavigateRoute:a}){let[n,i]=Le(""),[d,s]=Le(false),[f,l]=Le(new Set(["Static Routes","Dynamic Routes"])),[m,R]=Le(false),[F,g]=Le(false),x=La();wa(()=>{F&&x&&g(false)},[F,x]);let L=Ra(),{groups:I,stats:E,isLoaded:W,isSupported:C,filteredRoutes:A,routes:q,refresh:P,lastUpdatedAt:Y,source:X}=Xe({searchQuery:n,sortBy:"path",injectedRoutes:t,injectedSource:o,injectedLastUpdatedAt:r}),j=Qe(()=>({summary:{total:E.total,static:E.static,dynamic:E.dynamic,layouts:E.layouts,groups:E.groups,timestamp:new Date().toISOString()},groups:I.map(w=>({title:w.title,description:w.description,count:w.routes.length,routes:w.routes.map(D=>({path:D.path,name:D.name,type:D.type,params:D.params,depth:D.depth,hasChildren:D.children.length>0,childrenCount:D.children.length}))})),allRoutes:q.map(w=>w.path)}),[I,E,q]),we=He(w=>{l(D=>{let ee=new Set(D);return ee.has(w)?ee.delete(w):ee.add(w),ee})},[]),ue=He((w,D=0,ee={})=>{let Fe=w.params;if(D>=Fe.length){let H=w.path;Object.entries(ee).forEach(([be,se])=>{w.type==="catch-all"?H=H.replace(`[...${be}]`,se):H=H.replace(`[${be}]`,se)});try{L.push(H)}catch(be){_.alert("Navigation Error",String(be))}return}let Ce=Fe[D],_e=w.type==="catch-all"?`[...${Ce}]`:`[${Ce}]`,Ne="Enter Parameter Value",Ge=`Enter value for ${_e}:
|
|
3
3
|
|
|
4
4
|
Route: ${w.path}`,nt=H=>{H&&H.trim()&&ue(w,D+1,{...ee,[Ce]:H.trim()})};if(typeof _.prompt!="function"){let H=globalThis.prompt;H?nt(H(`${Ne}
|
|
5
5
|
|
|
6
|
-
${Ge}`)):_.alert(Ne,`${w.path} needs a value for ${_e}, and this platform can't ask for one here.`);return}_.prompt(Ne,Ge,[{text:"Cancel",style:"cancel"},{text:D<Fe.length-1?"Next":"Navigate",onPress:H=>{if(H&&H.trim()){let be={...ee,[Ce]:H.trim()};ue(w,D+1,be)}else _.alert("Invalid Value","Please enter a value for the parameter")}}],"plain-text")},[P]),xe=He((w,D)=>{if(a){a(w);return}if(!x&&!D?.bypassPro){g(true);return}if(w.type==="layout"||w.type==="group"){_.alert("Cannot Navigate",`${w.type==="layout"?"Layouts":"Route groups"} are not navigable routes`);return}if(w.type==="dynamic"||w.type==="catch-all"){if(w.params.length===0){try{P.push(w.path)}catch(ee){_.alert("Navigation Error",String(ee))}return}ue(w);return}try{P.push(w.path)}catch(ee){_.alert("Navigation Error",String(ee))}},[P,ue,x,a]),de=He(()=>{xe(Ka,{bypassPro:true})},[xe]),S=He(()=>{h||(R(true),L(),setTimeout(()=>R(false),400))},[h,L]),N=Qe(()=>Y?`Updated ${Da(Y)}`:"Awaiting route data",[Y]),K=Qe(()=>X?`Source: ${X}`:"Source: unknown",[X]),pe=Qe(()=>n&&A.length>0?[{title:"Search Results",icon:"",routes:A}]:k,[n,A,k]);return W?O(c,{style:[u.container,e],children:[d&&O(c,{style:u.searchContainer,testID:"buoy-routes-sitemap-search-field",children:[m(to,{size:16,color:v.color.textTertiary}),m(Kt,{style:u.searchInput,placeholder:"Search routes...",placeholderTextColor:v.color.placeholder,value:n,onChangeText:i,autoCapitalize:"none",autoCorrect:false,autoFocus:true,testID:"buoy-routes-sitemap-search",accessibilityLabel:"Search routes"}),n.length>0&&m(V,{onPress:()=>i(""),style:u.clearButton,testID:"buoy-routes-sitemap-search-clear",accessibilityRole:"button",accessibilityLabel:"Clear route search",children:m(p,{style:u.clearButtonText,children:"\u2715"})}),m(V,{style:u.closeSearchButton,onPress:()=>{s(false),i("")},testID:"buoy-routes-sitemap-search-done",accessibilityRole:"button",accessibilityLabel:"Done searching routes",children:m(p,{style:u.closeSearchText,children:"Done"})})]}),O(qe,{testID:"buoy-routes-sitemap-scroll",style:u.scrollView,contentContainerStyle:u.scrollContent,children:[!d&&O(c,{style:u.header,children:[O(c,{style:u.actionsRow,children:[O(c,{style:[u.actionWrapper,re&&u.actionWrapperDesktop],children:[m(V,{style:[u.iconButton,re&&u.iconButtonDesktop],onPress:de,accessibilityLabel:"Go to home route",accessibilityRole:"button",testID:"buoy-routes-sitemap-home",children:m(Ia,{size:et,color:v.color.textSecondary})}),m(p,{style:[u.actionLabel,re&&u.actionLabelDesktop],children:"Home"})]}),O(c,{style:[u.actionWrapper,re&&u.actionWrapperDesktop],children:[m(Ba,{value:j,testID:"buoy-routes-sitemap-copy",size:re?et:14,buttonStyle:re?u.actionButtonHeaderDesktop:u.actionButtonHeader}),m(p,{style:[u.actionLabel,re&&u.actionLabelDesktop],children:"Copy"})]}),O(c,{style:[u.actionWrapper,re&&u.actionWrapperDesktop],children:[m(V,{style:[u.iconButton,re&&u.iconButtonDesktop,h&&u.refreshButtonDisabled],onPress:S,disabled:h,testID:"buoy-routes-sitemap-refresh",accessibilityRole:"button",accessibilityLabel:"Refresh route tree",children:m(Ea,{size:et,color:h?v.color.textTertiary:v.color.textSecondary})}),m(p,{style:[u.actionLabel,re&&u.actionLabelDesktop],children:"Refresh"})]}),O(c,{style:[u.actionWrapper,re&&u.actionWrapperDesktop],children:[m(V,{style:[u.iconButton,re&&u.iconButtonDesktop],onPress:()=>s(true),testID:"buoy-routes-sitemap-search-open",accessibilityRole:"button",accessibilityLabel:"Search routes",children:m(to,{size:et,color:v.color.textSecondary})}),m(p,{style:[u.actionLabel,re&&u.actionLabelDesktop],children:"Search"})]})]}),O(c,{style:u.statsGrid,children:[m(Ae,{value:E.total,label:"Total",id:"total"}),m(Ae,{value:E.static,label:"Static",id:"static"}),m(Ae,{value:E.dynamic,label:"Dynamic",id:"dynamic"}),m(Ae,{value:E.catchAll,label:"Catch-All",id:"catch-all"}),m(Ae,{value:E.layouts,label:"Layouts",id:"layouts"}),m(Ae,{value:E.groups,label:"Groups",id:"groups"})]})]}),pe.length===0?m(Ca,{testID:"buoy-routes-sitemap-empty",otto:"map",title:"No routes found",message:"Nothing in the router matches. Clear the search to see the whole tree."}):pe.map(w=>m(_a,{group:w,isExpanded:n.length>0||f.has(w.title),onToggleExpand:()=>we(w.title),onNavigate:xe},w.title)),O(c,{style:u.metaFooter,children:[m(p,{style:u.metaText,testID:"buoy-routes-sitemap-updated",children:N}),m(c,{style:u.sourceBadge,children:m(p,{style:u.sourceText,testID:"buoy-routes-sitemap-source",children:K})})]})]}),m(La,{visible:F,onClose:()=>g(false),featureName:"Route Navigation"})]}):m(c,{style:[u.container,e],children:m(c,{style:u.loadingContainer,children:m(p,{style:u.loadingText,testID:"buoy-routes-sitemap-loading",children:C?"Loading routes...":"Route sitemap isn't available on the dashboard \u2014 the route tree lives on the device. Use the Events tab to see navigation here."})})})}function Ae({value:e,label:t,id:o}){return O(c,{style:u.statItem,testID:`buoy-routes-stat-${o}`,accessibilityLabel:`${t}, ${e}`,children:[m(p,{style:u.statValue,testID:`buoy-routes-stat-${o}-value`,children:e}),m(p,{style:u.statLabel,children:t})]})}function _a({group:e,isExpanded:t,onToggleExpand:o,onNavigate:r}){return O(c,{style:u.groupContainer,children:[O(V,{style:u.groupHeader,onPress:o,activeOpacity:.7,testID:so(e.title),accessibilityRole:"button",accessibilityLabel:`${e.title}, ${e.routes.length} routes`,children:[O(c,{style:u.groupHeaderLeft,children:[t?m(oo,{size:14,color:v.color.textSecondary}):m(ro,{size:14,color:v.color.textSecondary}),m(p,{style:u.groupTitle,children:e.title})]}),m(c,{style:u.groupBadge,children:m(p,{style:u.groupCount,testID:`${so(e.title)}-count`,children:e.routes.length})})]}),e.description&&m(c,{style:u.groupDescription,children:m(p,{style:u.groupDescriptionText,children:e.description})}),t&&m(c,{style:u.routesList,children:e.routes.map((a,n)=>m(lo,{route:a,onNavigate:r},`${a.path}-${n}`))})]})}function lo({route:e,depth:t=0,onNavigate:o}){let[r,a]=Pe(false),n=e.children.length>0,i=Ga(e.type),d=e.type!=="layout"&&e.type!=="group",s=Ma(e.path),f=n,l=f?r:true;return m(c,{style:[u.routeItem,{marginLeft:t*12}],testID:s,children:O(c,{style:u.routeCard,children:[O(c,{style:u.routeHeader,children:[f?O(V,{style:u.routeHeaderLeft,onPress:()=>a(!r),activeOpacity:.7,testID:`${s}-toggle`,accessibilityRole:"button",accessibilityLabel:`${e.path}, ${e.type}, ${e.children.length} nested`,children:[m(c,{style:u.expandIndicator,children:r?m(oo,{size:14,color:v.color.textSecondary}):m(ro,{size:14,color:v.color.textSecondary})}),m(p,{style:u.routePath,numberOfLines:3,testID:`${s}-path`,children:e.path})]}):O(c,{style:u.routeHeaderLeft,accessible:true,accessibilityLabel:`${e.path}, ${e.type}`,children:[m(c,{style:u.expandIndicator}),m(p,{style:u.routePath,numberOfLines:3,testID:`${s}-path`,children:e.path})]}),O(c,{style:u.routeHeaderActions,children:[n&&m(c,{style:u.childCountBadge,children:m(p,{style:u.childCountText,testID:`${s}-children-count`,children:e.children.length})}),m(c,{style:[u.typeTag,{backgroundColor:`${i}15`,borderColor:`${i}40`}],children:m(p,{style:[u.typeText,{color:i}],testID:`${s}-type`,children:e.type.toUpperCase()})}),m(ka,{value:e.path,buttonStyle:u.iconAction,testID:`${s}-copy`}),d&&m(V,{style:u.goButton,onPress:()=>o(e),activeOpacity:.7,testID:`${s}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${e.path}`,children:m(p,{style:u.goButtonText,children:"Go"})})]})]}),l&&n&&m(c,{style:u.childrenContainer,children:e.children.map((h,R)=>m(lo,{route:h,depth:t+1,onNavigate:o},`${h.path}-${R}`))})]})})}function Ga(e){switch(e){case"static":return"#3B82F6";case"dynamic":return"#F59E0B";case"catch-all":return"#EC4899";case"index":return"#10B981";case"layout":return"#8B5CF6";case"group":return"#6366F1";case"not-found":return"#EF4444";default:return"#6B7280"}}var u=ve.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"},loadingText:{color:v.color.textSecondary,fontSize:14,fontFamily:Q,textAlign:"center",lineHeight:20,paddingHorizontal:32,maxWidth:420},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:v.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,paddingBottom:4},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"30%",minWidth:90,backgroundColor:v.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:v.color.text,fontFamily:Q},statLabel:{fontSize:10,color:v.color.textTertiary,marginTop:4,fontFamily:Q,textTransform:"uppercase",letterSpacing:.5},actionWrapper:{flex:1,alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionWrapperDesktop:{gap:8,minWidth:72},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:v.color.surfaceElevated},actionButtonHeaderDesktop:{padding:12,borderRadius:8,backgroundColor:v.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},iconButtonDesktop:{padding:12,borderRadius:8,backgroundColor:v.color.surfaceElevated},actionLabel:{fontSize:8,color:v.color.textTertiary,fontFamily:Q,textTransform:"uppercase",letterSpacing:.5},actionLabelDesktop:{fontSize:12},refreshButtonDisabled:{opacity:.5},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:v.color.border},metaText:{fontSize:12,color:v.color.textSecondary,fontFamily:Q},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:v.color.border,backgroundColor:v.color.surface},sourceText:{fontSize:11,color:v.color.textSecondary,textTransform:"capitalize",fontFamily:Q},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:v.color.border},searchInput:{flex:1,color:v.color.text,fontSize:14,fontFamily:Q},clearButton:{padding:4},clearButtonText:{color:v.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:v.color.accent,fontSize:14,fontWeight:"600",fontFamily:Q},scrollView:{flex:1},scrollContent:{paddingBottom:8},emptyState:{padding:32,alignItems:"center"},emptyText:{color:v.color.textSecondary,fontSize:14,fontFamily:Q},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:v.color.surface,borderLeftWidth:3,borderLeftColor:v.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:v.color.text,fontFamily:Q,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:Q},routesList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:v.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:v.color.fillTertiary},groupDescriptionText:{fontSize:11,color:v.color.textSecondary,fontFamily:Q,lineHeight:16},routeItem:{marginBottom:6},routeCard:{backgroundColor:v.color.surface,borderRadius:6,borderWidth:1,borderColor:v.color.border,overflow:"hidden",shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},routeHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:7,paddingHorizontal:10,gap:8},expandIndicator:{width:18,alignItems:"center"},routeHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},routePath:{fontSize:13,fontWeight:"600",color:v.color.text,fontFamily:Q,flex:1},routeHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},childCountBadge:{backgroundColor:"#6B728015",borderColor:"#6B728040",borderWidth:1,borderRadius:12,paddingHorizontal:7,paddingVertical:2,minWidth:22,alignItems:"center",justifyContent:"center"},childCountText:{fontSize:11,fontWeight:"600",color:v.color.textSecondary,fontFamily:Q},typeTag:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},typeText:{fontSize:10,fontWeight:"600",fontFamily:Q},iconAction:{width:28,height:24,borderRadius:4,backgroundColor:v.color.surfaceElevated,borderWidth:1,borderColor:v.color.border,alignItems:"center",justifyContent:"center"},goButton:{height:24,paddingHorizontal:10,borderRadius:4,alignItems:"center",justifyContent:"center",backgroundColor:v.color.accentSoft,borderWidth:1,borderColor:v.color.accentBorder},goButtonText:{fontSize:12,color:v.color.accent,fontFamily:Q,fontWeight:"600"},childrenContainer:{borderLeftWidth:2,borderLeftColor:v.color.border,marginLeft:16,marginRight:8,marginTop:2,marginBottom:8}});import{useState as co,useMemo as tt,useEffect as uo}from"react";import{ChevronDown as Ja,ChevronRight as qa,InlineCopyButton as Ya,ProUpgradeModal as Za,buoyColors as ot,night as J,useSafeAreaInsets as Qa,ToolEmptyState as Xa,monoFont as ce}from"@buoy-gg/shared-ui/web";import{useIsPro as en}from"@buoy-gg/license/web";import{DataViewer as tn}from"@buoy-gg/shared-ui/web/dataViewer";import{useSyncExternalStore as on}from"react";var rn=class{constructor(){this.stack=[];this.actions=null;this.listeners=new Set}getStack(){return this.stack}setStack(e){this.stack=e,this.listeners.forEach(t=>t())}getActions(){return this.actions}setActions(e){this.actions=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}},M=new rn;var an=[];function po(){let e=on(r=>M.subscribe(r),()=>M.getStack(),()=>an),t=e.find(r=>r.isFocused)??null,o=()=>{let r=M.getActions();if(!r)throw new Error("Mount RouteTracker to capture browser navigation.");return r};return{stack:e,focusedRoute:t,stackDepth:e.length,isAtRoot:!t||t.index===0,isLoaded:e.length>0,error:null,refresh:()=>{},navigateToIndex:r=>o().navigateToIndex(r),navigateToRoute:(r,a)=>o().navigateToRoute?.(r,a)??false,popToIndex:r=>o().popToIndex(r),goBack:()=>o().goBack(),popToTop:()=>o().popToTop()}}import{jsx as B,jsxs as ae}from"react/jsx-runtime";function mo({style:e,injectedStack:t,onAction:o,onCopyValueChange:r}){let a=po(),n=t!=null,i=Qa({minBottom:8}),d=n?t:a.stack,s=n?true:a.isLoaded,f=n?null:a.error,l=tt(()=>d.find(S=>S.isFocused)??null,[d]),h=d.length,R=h<=1,F=S=>o?o("navigateToIndex",{index:S}):a.navigateToIndex(S),g=S=>o?o("popToIndex",{index:S}):a.popToIndex(S),x=()=>o?o("goBack"):a.goBack(),P=()=>o?o("popToTop"):a.popToTop(),[k,E]=co(null),[W,C]=co(false),A=en();uo(()=>{W&&A&&C(false)},[W,A]);let q=tt(()=>{let S=d.map(N=>({pathname:N.pathname,name:N.name,params:N.params,isFocused:N.isFocused}));return JSON.stringify(S,null,2)},[d]);uo(()=>{r?.(q)},[q,r]);let L=tt(()=>k!==null&&d[k]?d[k]:l,[k,d,l]),Y=tt(()=>k!==null&&d[k]&&!d[k].isFocused,[k,d]);if(!s)return B(c,{style:[y.container,e],children:B(c,{style:y.loadingContainer,children:B(p,{style:y.loadingText,testID:"buoy-routes-stack-loading",children:"Loading navigation stack..."})})});if(f)return B(c,{style:[y.container,e],children:ae(c,{style:y.errorContainer,testID:"buoy-routes-stack-error",children:[B(p,{style:y.errorText,children:"Error loading stack"}),B(p,{style:y.errorDetail,testID:"buoy-routes-stack-error-detail",children:f.message})]})});if(d.length===0)return B(c,{style:[y.container,e],children:B(Xa,{testID:"buoy-routes-stack-empty",otto:"walking",title:"No navigation stack",message:"Navigate to a route to see the stack"})});let X=(S,N,K,pe)=>{if(o){let w=globalThis.window?.confirm;(!w||w(`${S}
|
|
6
|
+
${Ge}`)):_.alert(Ne,`${w.path} needs a value for ${_e}, and this platform can't ask for one here.`);return}_.prompt(Ne,Ge,[{text:"Cancel",style:"cancel"},{text:D<Fe.length-1?"Next":"Navigate",onPress:H=>{if(H&&H.trim()){let be={...ee,[Ce]:H.trim()};ue(w,D+1,be)}else _.alert("Invalid Value","Please enter a value for the parameter")}}],"plain-text")},[L]),xe=He((w,D)=>{if(a){a(w);return}if(!x&&!D?.bypassPro){g(true);return}if(w.type==="layout"||w.type==="group"){_.alert("Cannot Navigate",`${w.type==="layout"?"Layouts":"Route groups"} are not navigable routes`);return}if(w.type==="dynamic"||w.type==="catch-all"){if(w.params.length===0){try{L.push(w.path)}catch(ee){_.alert("Navigation Error",String(ee))}return}ue(w);return}try{L.push(w.path)}catch(ee){_.alert("Navigation Error",String(ee))}},[L,ue,x,a]),de=He(()=>{xe(Ka,{bypassPro:true})},[xe]),S=He(()=>{m||(R(true),P(),setTimeout(()=>R(false),400))},[m,P]),N=Qe(()=>Y?`Updated ${Da(Y)}`:"Awaiting route data",[Y]),K=Qe(()=>X?`Source: ${X}`:"Source: unknown",[X]),pe=Qe(()=>n&&A.length>0?[{title:"Search Results",icon:"",routes:A}]:I,[n,A,I]);return W?O(c,{style:[u.container,e],children:[d&&O(c,{style:u.searchContainer,testID:"buoy-routes-sitemap-search-field",children:[h(to,{size:16,color:v.color.textTertiary}),h(Kt,{style:u.searchInput,placeholder:"Search routes...",placeholderTextColor:v.color.placeholder,value:n,onChangeText:i,autoCapitalize:"none",autoCorrect:false,autoFocus:true,testID:"buoy-routes-sitemap-search",accessibilityLabel:"Search routes"}),n.length>0&&h(V,{onPress:()=>i(""),style:u.clearButton,testID:"buoy-routes-sitemap-search-clear",accessibilityRole:"button",accessibilityLabel:"Clear route search",children:h(p,{style:u.clearButtonText,children:"\u2715"})}),h(V,{style:u.closeSearchButton,onPress:()=>{s(false),i("")},testID:"buoy-routes-sitemap-search-done",accessibilityRole:"button",accessibilityLabel:"Done searching routes",children:h(p,{style:u.closeSearchText,children:"Done"})})]}),O(qe,{keyboardShouldPersistTaps:"handled",testID:"buoy-routes-sitemap-scroll",style:u.scrollView,contentContainerStyle:u.scrollContent,children:[!d&&O(c,{style:u.header,children:[O(c,{style:u.actionsRow,children:[O(c,{style:[u.actionWrapper,re&&u.actionWrapperDesktop],children:[h(V,{style:[u.iconButton,re&&u.iconButtonDesktop],onPress:de,accessibilityLabel:"Go to home route",accessibilityRole:"button",testID:"buoy-routes-sitemap-home",children:h(ka,{size:et,color:v.color.textSecondary})}),h(p,{style:[u.actionLabel,re&&u.actionLabelDesktop],children:"Home"})]}),O(c,{style:[u.actionWrapper,re&&u.actionWrapperDesktop],children:[h(Ba,{value:j,testID:"buoy-routes-sitemap-copy",size:re?et:14,buttonStyle:re?u.actionButtonHeaderDesktop:u.actionButtonHeader}),h(p,{style:[u.actionLabel,re&&u.actionLabelDesktop],children:"Copy"})]}),O(c,{style:[u.actionWrapper,re&&u.actionWrapperDesktop],children:[h(V,{style:[u.iconButton,re&&u.iconButtonDesktop,m&&u.refreshButtonDisabled],onPress:S,disabled:m,testID:"buoy-routes-sitemap-refresh",accessibilityRole:"button",accessibilityLabel:"Refresh route tree",children:h(Ea,{size:et,color:m?v.color.textTertiary:v.color.textSecondary})}),h(p,{style:[u.actionLabel,re&&u.actionLabelDesktop],children:"Refresh"})]}),O(c,{style:[u.actionWrapper,re&&u.actionWrapperDesktop],children:[h(V,{style:[u.iconButton,re&&u.iconButtonDesktop],onPress:()=>s(true),testID:"buoy-routes-sitemap-search-open",accessibilityRole:"button",accessibilityLabel:"Search routes",children:h(to,{size:et,color:v.color.textSecondary})}),h(p,{style:[u.actionLabel,re&&u.actionLabelDesktop],children:"Search"})]})]}),O(c,{style:u.statsGrid,children:[h(Ae,{value:E.total,label:"Total",id:"total"}),h(Ae,{value:E.static,label:"Static",id:"static"}),h(Ae,{value:E.dynamic,label:"Dynamic",id:"dynamic"}),h(Ae,{value:E.catchAll,label:"Catch-All",id:"catch-all"}),h(Ae,{value:E.layouts,label:"Layouts",id:"layouts"}),h(Ae,{value:E.groups,label:"Groups",id:"groups"})]})]}),pe.length===0?h(Ca,{testID:"buoy-routes-sitemap-empty",otto:"map",title:"No routes found",message:"Nothing in the router matches. Clear the search to see the whole tree."}):pe.map(w=>h(_a,{group:w,isExpanded:n.length>0||f.has(w.title),onToggleExpand:()=>we(w.title),onNavigate:xe},w.title)),O(c,{style:u.metaFooter,children:[h(p,{style:u.metaText,testID:"buoy-routes-sitemap-updated",children:N}),h(c,{style:u.sourceBadge,children:h(p,{style:u.sourceText,testID:"buoy-routes-sitemap-source",children:K})})]})]}),h(Pa,{visible:F,onClose:()=>g(false),featureName:"Route Navigation"})]}):h(c,{style:[u.container,e],children:h(c,{style:u.loadingContainer,children:h(p,{style:u.loadingText,testID:"buoy-routes-sitemap-loading",children:C?"Loading routes...":"Route sitemap isn't available on the dashboard \u2014 the route tree lives on the device. Use the Events tab to see navigation here."})})})}function Ae({value:e,label:t,id:o}){return O(c,{style:u.statItem,testID:`buoy-routes-stat-${o}`,accessibilityLabel:`${t}, ${e}`,children:[h(p,{style:u.statValue,testID:`buoy-routes-stat-${o}-value`,children:e}),h(p,{style:u.statLabel,children:t})]})}function _a({group:e,isExpanded:t,onToggleExpand:o,onNavigate:r}){return O(c,{style:u.groupContainer,children:[O(V,{style:u.groupHeader,onPress:o,activeOpacity:.7,testID:so(e.title),accessibilityRole:"button",accessibilityLabel:`${e.title}, ${e.routes.length} routes`,children:[O(c,{style:u.groupHeaderLeft,children:[t?h(oo,{size:14,color:v.color.textSecondary}):h(ro,{size:14,color:v.color.textSecondary}),h(p,{style:u.groupTitle,children:e.title})]}),h(c,{style:u.groupBadge,children:h(p,{style:u.groupCount,testID:`${so(e.title)}-count`,children:e.routes.length})})]}),e.description&&h(c,{style:u.groupDescription,children:h(p,{style:u.groupDescriptionText,children:e.description})}),t&&h(c,{style:u.routesList,children:e.routes.map((a,n)=>h(lo,{route:a,onNavigate:r},`${a.path}-${n}`))})]})}function lo({route:e,depth:t=0,onNavigate:o}){let[r,a]=Le(false),n=e.children.length>0,i=Ga(e.type),d=e.type!=="layout"&&e.type!=="group",s=Ma(e.path),f=n,l=f?r:true;return h(c,{style:[u.routeItem,{marginLeft:t*12}],testID:s,children:O(c,{style:u.routeCard,children:[O(c,{style:u.routeHeader,children:[f?O(V,{style:u.routeHeaderLeft,onPress:()=>a(!r),activeOpacity:.7,testID:`${s}-toggle`,accessibilityRole:"button",accessibilityLabel:`${e.path}, ${e.type}, ${e.children.length} nested`,children:[h(c,{style:u.expandIndicator,children:r?h(oo,{size:14,color:v.color.textSecondary}):h(ro,{size:14,color:v.color.textSecondary})}),h(p,{style:u.routePath,numberOfLines:3,testID:`${s}-path`,children:e.path})]}):O(c,{style:u.routeHeaderLeft,accessible:true,accessibilityLabel:`${e.path}, ${e.type}`,children:[h(c,{style:u.expandIndicator}),h(p,{style:u.routePath,numberOfLines:3,testID:`${s}-path`,children:e.path})]}),O(c,{style:u.routeHeaderActions,children:[n&&h(c,{style:u.childCountBadge,children:h(p,{style:u.childCountText,testID:`${s}-children-count`,children:e.children.length})}),h(c,{style:[u.typeTag,{backgroundColor:`${i}15`,borderColor:`${i}40`}],children:h(p,{style:[u.typeText,{color:i}],testID:`${s}-type`,children:e.type.toUpperCase()})}),h(Ia,{value:e.path,buttonStyle:u.iconAction,testID:`${s}-copy`}),d&&h(V,{style:u.goButton,onPress:()=>o(e),activeOpacity:.7,testID:`${s}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${e.path}`,children:h(p,{style:u.goButtonText,children:"Go"})})]})]}),l&&n&&h(c,{style:u.childrenContainer,children:e.children.map((m,R)=>h(lo,{route:m,depth:t+1,onNavigate:o},`${m.path}-${R}`))})]})})}function Ga(e){switch(e){case"static":return"#3B82F6";case"dynamic":return"#F59E0B";case"catch-all":return"#EC4899";case"index":return"#10B981";case"layout":return"#8B5CF6";case"group":return"#6366F1";case"not-found":return"#EF4444";default:return"#6B7280"}}var u=ve.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"},loadingText:{color:v.color.textSecondary,fontSize:14,fontFamily:Q,textAlign:"center",lineHeight:20,paddingHorizontal:32,maxWidth:420},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:v.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,paddingBottom:4},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"30%",minWidth:90,backgroundColor:v.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:v.color.text,fontFamily:Q},statLabel:{fontSize:10,color:v.color.textTertiary,marginTop:4,fontFamily:Q,textTransform:"uppercase",letterSpacing:.5},actionWrapper:{flex:1,alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionWrapperDesktop:{gap:8,minWidth:72},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:v.color.surfaceElevated},actionButtonHeaderDesktop:{padding:12,borderRadius:8,backgroundColor:v.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},iconButtonDesktop:{padding:12,borderRadius:8,backgroundColor:v.color.surfaceElevated},actionLabel:{fontSize:8,color:v.color.textTertiary,fontFamily:Q,textTransform:"uppercase",letterSpacing:.5},actionLabelDesktop:{fontSize:12},refreshButtonDisabled:{opacity:.5},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:v.color.border},metaText:{fontSize:12,color:v.color.textSecondary,fontFamily:Q},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:v.color.border,backgroundColor:v.color.surface},sourceText:{fontSize:11,color:v.color.textSecondary,textTransform:"capitalize",fontFamily:Q},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:v.color.border},searchInput:{flex:1,color:v.color.text,fontSize:14,fontFamily:Q},clearButton:{padding:4},clearButtonText:{color:v.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:v.color.accent,fontSize:14,fontWeight:"600",fontFamily:Q},scrollView:{flex:1},scrollContent:{paddingBottom:8},emptyState:{padding:32,alignItems:"center"},emptyText:{color:v.color.textSecondary,fontSize:14,fontFamily:Q},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:v.color.surface,borderLeftWidth:3,borderLeftColor:v.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:v.color.text,fontFamily:Q,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:Q},routesList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:v.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:v.color.fillTertiary},groupDescriptionText:{fontSize:11,color:v.color.textSecondary,fontFamily:Q,lineHeight:16},routeItem:{marginBottom:6},routeCard:{backgroundColor:v.color.surface,borderRadius:6,borderWidth:1,borderColor:v.color.border,overflow:"hidden",shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},routeHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:7,paddingHorizontal:10,gap:8},expandIndicator:{width:18,alignItems:"center"},routeHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},routePath:{fontSize:13,fontWeight:"600",color:v.color.text,fontFamily:Q,flex:1},routeHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},childCountBadge:{backgroundColor:"#6B728015",borderColor:"#6B728040",borderWidth:1,borderRadius:12,paddingHorizontal:7,paddingVertical:2,minWidth:22,alignItems:"center",justifyContent:"center"},childCountText:{fontSize:11,fontWeight:"600",color:v.color.textSecondary,fontFamily:Q},typeTag:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},typeText:{fontSize:10,fontWeight:"600",fontFamily:Q},iconAction:{width:28,height:24,borderRadius:4,backgroundColor:v.color.surfaceElevated,borderWidth:1,borderColor:v.color.border,alignItems:"center",justifyContent:"center"},goButton:{height:24,paddingHorizontal:10,borderRadius:4,alignItems:"center",justifyContent:"center",backgroundColor:v.color.accentSoft,borderWidth:1,borderColor:v.color.accentBorder},goButtonText:{fontSize:12,color:v.color.accent,fontFamily:Q,fontWeight:"600"},childrenContainer:{borderLeftWidth:2,borderLeftColor:v.color.border,marginLeft:16,marginRight:8,marginTop:2,marginBottom:8}});import{useState as co,useMemo as tt,useEffect as uo}from"react";import{ChevronDown as Ja,ChevronRight as qa,InlineCopyButton as Ya,ProUpgradeModal as Za,buoyColors as ot,night as J,useSafeAreaInsets as Qa,ToolEmptyState as Xa,monoFont as ce}from"@buoy-gg/shared-ui/web";import{useIsPro as en}from"@buoy-gg/license/web";import{DataViewer as tn}from"@buoy-gg/shared-ui/web/dataViewer";import{useSyncExternalStore as on}from"react";var rn=class{constructor(){this.stack=[];this.actions=null;this.listeners=new Set}getStack(){return this.stack}setStack(e){this.stack=e,this.listeners.forEach(t=>t())}getActions(){return this.actions}setActions(e){this.actions=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}},M=new rn;var an=[];function po(){let e=on(r=>M.subscribe(r),()=>M.getStack(),()=>an),t=e.find(r=>r.isFocused)??null,o=()=>{let r=M.getActions();if(!r)throw new Error("Mount RouteTracker to capture browser navigation.");return r};return{stack:e,focusedRoute:t,stackDepth:e.length,isAtRoot:!t||t.index===0,isLoaded:e.length>0,error:null,refresh:()=>{},navigateToIndex:r=>o().navigateToIndex(r),navigateToRoute:(r,a)=>o().navigateToRoute?.(r,a)??false,popToIndex:r=>o().popToIndex(r),goBack:()=>o().goBack(),popToTop:()=>o().popToTop()}}import{jsx as B,jsxs as ae}from"react/jsx-runtime";function ho({style:e,injectedStack:t,onAction:o,onCopyValueChange:r}){let a=po(),n=t!=null,i=Qa({minBottom:8}),d=n?t:a.stack,s=n?true:a.isLoaded,f=n?null:a.error,l=tt(()=>d.find(S=>S.isFocused)??null,[d]),m=d.length,R=m<=1,F=S=>o?o("navigateToIndex",{index:S}):a.navigateToIndex(S),g=S=>o?o("popToIndex",{index:S}):a.popToIndex(S),x=()=>o?o("goBack"):a.goBack(),L=()=>o?o("popToTop"):a.popToTop(),[I,E]=co(null),[W,C]=co(false),A=en();uo(()=>{W&&A&&C(false)},[W,A]);let q=tt(()=>{let S=d.map(N=>({pathname:N.pathname,name:N.name,params:N.params,isFocused:N.isFocused}));return JSON.stringify(S,null,2)},[d]);uo(()=>{r?.(q)},[q,r]);let P=tt(()=>I!==null&&d[I]?d[I]:l,[I,d,l]),Y=tt(()=>I!==null&&d[I]&&!d[I].isFocused,[I,d]);if(!s)return B(c,{style:[y.container,e],children:B(c,{style:y.loadingContainer,children:B(p,{style:y.loadingText,testID:"buoy-routes-stack-loading",children:"Loading navigation stack..."})})});if(f)return B(c,{style:[y.container,e],children:ae(c,{style:y.errorContainer,testID:"buoy-routes-stack-error",children:[B(p,{style:y.errorText,children:"Error loading stack"}),B(p,{style:y.errorDetail,testID:"buoy-routes-stack-error-detail",children:f.message})]})});if(d.length===0)return B(c,{style:[y.container,e],children:B(Xa,{testID:"buoy-routes-stack-empty",otto:"walking",title:"No navigation stack",message:"Navigate to a route to see the stack"})});let X=(S,N,K,pe)=>{if(o){let w=globalThis.window?.confirm;(!w||w(`${S}
|
|
7
7
|
|
|
8
|
-
${N}`))&&pe();return}_.alert(S,N,[{text:"Cancel",style:"cancel"},{text:K,style:"destructive",onPress:pe}])},j=()=>{if(!A){C(true);return}if(R){_.alert("Cannot Go Back","Already at the root of the stack");return}x()},we=()=>{if(!A){C(true);return}if(R){_.alert("Already at Top","Stack only has one screen");return}X("Pop to Top","This will remove all screens except the root screen.","Pop to Top",P)},ue=S=>{E(k===S?null:S)},xe=()=>{if(!A){C(true);return}if(L){if(L.isFocused){_.alert("Already There","This route is already visible");return}F(L.index)}},de=()=>{if(!A){C(true);return}if(!L)return;if(L.isFocused){_.alert("Cannot Pop","Selected route is already visible");return}if(L.index===h-1){_.alert("Cannot Pop","No screens above selected route");return}let S=h-1-L.index,N=L.index;X("Pop to Route",`Remove ${S} screen${S!==1?"s":""} above ${L.pathname}?`,"Pop",()=>g(N))};return ae(c,{style:[y.container,e],children:[B(qe,{testID:"buoy-routes-stack-scroll",style:y.stackScroll,contentContainerStyle:[y.stackContent,{paddingBottom:y.stackContent.padding+i.bottom}],children:[...d].reverse().map((S,N)=>{let K=d.length-1-N,pe=k===K,w=Object.keys(S.params).length>0,D=Ua(K);return B(c,{style:y.stackItemWrapper,testID:D,children:ae(c,{style:[y.stackItem,pe&&y.stackItemSelected],children:[ae(c,{style:y.stackItemHeader,children:[ae(V,{style:y.stackItemToggle,onPress:()=>ue(K),activeOpacity:.7,testID:`${D}-toggle`,accessibilityRole:"button",accessibilityLabel:`${S.pathname}, ${S.isFocused?"focused":"mounted"}, position ${K} of ${h-1}`,children:[B(c,{style:y.expandIndicator,children:pe?B(Ja,{size:14,color:J.color.textSecondary}):B(qa,{size:14,color:J.color.textSecondary})}),B(p,{style:y.stackItemPath,numberOfLines:1,testID:`${D}-path`,children:S.pathname})]}),B(Ya,{value:S.pathname,buttonStyle:y.copyRouteButton,testID:`${D}-copy`}),B(V,{onPress:()=>ue(K),activeOpacity:.7,accessible:false,style:[y.statusBadge,{backgroundColor:S.isFocused?`${ot.success}15`:"#3B82F615",borderColor:S.isFocused?`${ot.success}40`:"#3B82F640"}],children:B(p,{style:[y.statusBadgeText,{color:S.isFocused?ot.success:"#3B82F6"}],testID:`${D}-status`,children:S.isFocused?"FOCUSED":"MOUNTED"})})]}),pe&&ae(c,{style:y.expandedContent,children:[ae(c,{style:y.detailRow,children:[B(p,{style:y.detailLabel,children:"Route Name:"}),B(p,{style:y.detailValue,testID:`${D}-name`,children:S.name})]}),ae(c,{style:y.detailRow,children:[B(p,{style:y.detailLabel,children:"Position:"}),ae(p,{style:y.detailValue,testID:`${D}-position`,children:[K," / ",h-1]})]}),w&&B(c,{style:y.dataViewerContainer,children:B(tn,{title:"Parameters",data:S.params,showTypeFilter:false})}),ae(c,{style:y.actionsRow,children:[ae(c,{style:y.actionWrapper,children:[B(V,{style:[y.actionButton,R&&y.actionButtonDisabled],onPress:j,disabled:R,testID:`${D}-back`,accessibilityRole:"button",accessibilityLabel:"Go back one screen",children:B(p,{style:[y.actionButtonText,R&&y.actionButtonTextDisabled],children:"Back"})}),B(p,{style:y.helpText,children:"Go back one screen"})]}),ae(c,{style:y.actionWrapper,children:[B(V,{style:[y.actionButton,S.isFocused&&y.actionButtonDisabled],onPress:xe,disabled:S.isFocused,testID:`${D}-go`,accessibilityRole:"button",accessibilityLabel:`Navigate to ${S.pathname}`,children:B(p,{style:[y.actionButtonText,S.isFocused&&y.actionButtonTextDisabled],children:"Go"})}),B(p,{style:y.helpText,children:"Navigate to this route"})]}),ae(c,{style:y.actionWrapper,children:[B(V,{style:[y.actionButton,(S.isFocused||K===h-1)&&y.actionButtonDisabled],onPress:de,disabled:S.isFocused||K===h-1,testID:`${D}-pop-to`,accessibilityRole:"button",accessibilityLabel:`Remove screens above ${S.pathname}`,children:B(p,{style:[y.actionButtonText,(S.isFocused||K===h-1)&&y.actionButtonTextDisabled],children:"Pop To"})}),B(p,{style:y.helpText,children:"Remove screens above this"})]})]})]})]})},`stack-${K}-${S.key}`)})}),B(Za,{visible:W,onClose:()=>C(false),featureName:"Stack Navigation"})]})}var y=ve.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},loadingText:{color:J.color.textSecondary,fontSize:14,fontFamily:ce},errorContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},errorText:{color:ot.error,fontSize:16,fontWeight:"600",fontFamily:ce,marginBottom:8},errorDetail:{color:J.color.textSecondary,fontSize:12,fontFamily:ce,textAlign:"center"},emptyContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyText:{color:J.color.text,fontSize:16,fontWeight:"600",fontFamily:ce,marginBottom:8},emptySubtext:{color:J.color.textSecondary,fontSize:14,fontFamily:ce,textAlign:"center"},stackScroll:{flex:1},stackContent:{padding:8},stackItemWrapper:{marginBottom:6},stackItem:{backgroundColor:J.color.surface,borderRadius:6,borderWidth:1,borderColor:J.color.border,overflow:"hidden"},stackItemSelected:{borderColor:J.color.accent,borderWidth:2},stackItemHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:12,gap:8},stackItemToggle:{flex:1,flexDirection:"row",alignItems:"center",gap:8},expandIndicator:{width:20,alignItems:"center"},stackItemPath:{fontSize:13,fontWeight:"600",color:J.color.text,fontFamily:ce,flex:1},copyRouteButton:{padding:4,marginLeft:4},statusBadge:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},statusBadgeText:{fontSize:10,fontWeight:"600",fontFamily:ce},expandedContent:{paddingHorizontal:12,paddingTop:8,paddingBottom:12,borderTopWidth:1,borderTopColor:J.color.border},detailRow:{marginBottom:8},detailLabel:{fontSize:10,color:J.color.textSecondary,fontFamily:ce,marginBottom:2},detailValue:{fontSize:12,color:J.color.text,fontFamily:ce},dataViewerContainer:{marginTop:4,marginHorizontal:-12,marginBottom:8},actionsRow:{flexDirection:"row",gap:6,marginTop:12},actionWrapper:{flex:1},actionButton:{backgroundColor:J.color.surfaceElevated,paddingVertical:8,paddingHorizontal:8,borderRadius:6,alignItems:"center"},actionButtonDisabled:{opacity:.5},actionButtonText:{fontSize:12,fontWeight:"600",color:J.color.text,fontFamily:ce},actionButtonTextDisabled:{color:J.color.textTertiary},helpText:{fontSize:9,color:J.color.textSecondary,fontFamily:ce,textAlign:"center",marginTop:4,lineHeight:12}});import{useCallback as nn}from"react";import{Navigation as sn,night as Rt,EVENT_LIST_PRESET as ln,monoFont as ho}from"@buoy-gg/shared-ui/web";import{memo as cn,useMemo as fe}from"react";import{CompactRow as un,RelativeTime as dn,buoyColors as fo,night as rt,monoFont as go}from"@buoy-gg/shared-ui/web";import{jsx as Me}from"react/jsx-runtime";function pn(e){return e.pathname==="/"?"home":yt(e.pathname,e.segments)?"dynamic":e.params&&Object.keys(e.params).length>0?"with-params":"default"}function mn(e){switch(e){case"home":return fo.success;case"dynamic":return rt.color.accent;case"with-params":return fo.warning;default:return rt.color.textSecondary}}function hn(e){switch(e){case"home":return"Home";case"dynamic":return"Dynamic";case"with-params":return"Params";default:return"Static"}}function fn(e){if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.floor(e/6e4),o=Math.floor(e%6e4/1e3);return o>0?`${t}m ${o}s`:`${t}m`}function gn(e){let t=[];e.timeSincePrevious!==void 0&&e.timeSincePrevious>0&&t.push(fn(e.timeSincePrevious));let o=e.segments?.length||0;return o>0&&t.push(`depth ${o}`),t.join(" \xB7 ")||"root"}function yn(e){if(e.params&&Object.keys(e.params).length>0){let t=Object.keys(e.params).length;return`${t} PARAM${t!==1?"S":""}`}}var yo=cn(function({event:e,visitNumber:t,isExpanded:o,onPress:r,onNavigate:a,index:n}){let i=fe(()=>pn(e),[e]),d=fe(()=>yt(e.pathname,e.segments),[e.pathname,e.segments]),s=fe(()=>mn(i),[i]),f=fe(()=>hn(i),[i]),l=fe(()=>gn(e),[e]),h=fe(()=>yn(e),[e]),R=fe(()=>Va(e.pathname,t),[e.pathname,t]),F=fe(()=>`${e.pathname}, ${f}, ${l}`,[e.pathname,f,l]),g=fe(()=>{if(o)return Me(gt,{event:e,visitNumber:t,routeTemplate:d})},[o,e,t,d]),x=fe(()=>{if(a)return Me(V,{style:bo.goButton,onPress:()=>a(Zt(e.pathname,e.params)),testID:`${R}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${e.pathname}`,children:Me(p,{style:bo.goButtonText,children:"Go"})})},[a,e.pathname,R]);return Me(un,{statusDotColor:s,statusLabel:f,statusSublabel:l,primaryText:e.pathname,badgeText:h,badgeColor:s,trailingAction:x,bottomRightText:Me(dn,{timestamp:e.timestamp}),showChevron:true,expandedContent:g,isExpanded:o,expandedGlowColor:s,onPress:()=>r(n),testID:R,statusTestID:`${R}-status`,statusSublabelTestID:`${R}-sublabel`,accessibilityLabel:F})}),bo=ve.create({badgeText:{fontSize:11,fontWeight:"600",fontFamily:go},goButton:{backgroundColor:rt.color.accent,paddingHorizontal:8,paddingVertical:4,borderRadius:4},goButtonText:{fontSize:10,fontWeight:"600",color:rt.color.onAccent,fontFamily:go}});import{jsx as Ue,jsxs as bn}from"react/jsx-runtime";function vn({events:e,visitCounts:t,onNavigate:o,onSelectEvent:r}){let a=nn(n=>{let i=e[n];i&&r(i,t.get(i)||1)},[e,t,r]);return e.length===0?bn(c,{style:at.emptyState,testID:"buoy-routes-empty",children:[Ue(sn,{size:48,color:Rt.color.textTertiary}),Ue(p,{style:at.emptyTitle,testID:"buoy-routes-empty-title",children:"No events yet"}),Ue(p,{style:at.emptySubtitle,testID:"buoy-routes-empty-subtitle",children:"Navigation events will appear here"})]}):Ue(jt,{testID:"buoy-routes-timeline",contentContainerStyle:at.listContent,data:e,keyExtractor:n=>`${n.timestamp}-${n.pathname}`,renderItem:({item:n,index:i})=>Ue(yo,{event:n,visitNumber:t.get(n)||1,isExpanded:false,index:i,onPress:a,onNavigate:o}),showsVerticalScrollIndicator:true,...ln})}var at=ve.create({listContent:{paddingVertical:8},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:Rt.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:ho,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:Rt.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:ho}});import{Fragment as xn,jsx as I,jsxs as ie}from"react/jsx-runtime";var It=_r(),Sn={parse:e=>e==="routes"||e==="events"||e==="stack"?e:void 0,serialize:e=>e},wn={parse:e=>e==="true",serialize:e=>e.toString()},Cn={parse:e=>new Set(JSON.parse(e)),serialize:e=>JSON.stringify(Array.from(e))};function vo(e,t){if(!e||!e.routes)return null;for(let o of e.routes){if(o.name===t)return[o.name];if(o.state){let r=vo(o.state,t);if(r)return[o.name,...r]}}return null}function Tn(e,t){if(e.length===0)return null;let o=t&&Object.keys(t).length>0?t:void 0;if(e.length===1)return It.navigate(o?{name:e[0],params:o}:{name:e[0]});let r=o?{screen:e[e.length-1],params:o}:{screen:e[e.length-1]};for(let a=e.length-2;a>=1;a--)r={screen:e[a],params:r};return It.navigate({name:e[0],params:r})}function kt({visible:e,onClose:t,onBack:o,onMinimize:r,enableSharedModalDimensions:a=false,inline:n=false,remote:i}){let d=Gr(),s=void 0,f=ct.OS==="web"||Jr(),[l,h]=pt(We.routeEvents.activeTab(),"events",Sn),[R,F]=Ie(false),[g,x]=Ie(""),P=la(),k=sa("routeEvents.entries");Wt(()=>{R&&P&&F(false)},[R,P]);let[E,W]=pt(We.routeEvents.isMonitoring(),true,wn),{events:C,clearEvents:A,isListening:q}=Yt({enabled:E}),L=E&&q;Wt(()=>{he.setBootCapture(E)},[E]);let[Y,X]=Ie(false),[j,we]=Ie(null),[ue,xe]=Ie(1),[de,S]=Ie(""),[N,K]=pt(We.routeEvents.eventFilters(),new Set(["/_sitemap","/api","/__dev"]),Cn),pe=Oo(null),w=me(b=>{},[]),D=me(b=>{try{if(i){if(!i.onNavigatePath)return;if(!P&&b!=="/"){F(true);return}i.onNavigatePath(b);return}if(f)d.push(b);else if(s){let{pathname:$,params:te}=ba(b),ge=$.startsWith("/")?$.slice(1):$,Te=Object.keys(te).length>0,Re=s.getRootState?.();if(Re){let Je=vo(Re,ge);if(Je){let Ft=Tn(Je,te);if(Ft){s.dispatch(Ft);return}}}s.dispatch(It.navigate(Te?{name:ge,params:te}:{name:ge}))}else _.alert("Navigation Unavailable","No Expo Router or React Navigation container was found in this app.")}catch($){_.alert("Navigation Error",String($))}},[d,s,f,i,P]),ee=me(()=>{W(b=>!b)},[]),Fe=me(()=>{if(C.length!==0){if(!P){F(true);return}A()}},[C.length,P,A]),Ce=me(b=>{K($=>{let te=new Set($);return te.has(b)?te.delete(b):te.add(b),te})},[]),_e=me(b=>{K($=>new Set([...$,b]))},[]),Ne=me(()=>{X(!Y)},[Y]),Ge=me((b,$)=>{we(b),xe($)},[]),nt=me(()=>{we(null)},[]),H=me(b=>{we(null),h(b)},[]),be=ke(()=>{let b=new Set;return C.forEach($=>{$.pathname&&b.add($.pathname)}),Array.from(b).sort()},[C]),se=ke(()=>C.filter(b=>{if(!b.pathname||Array.from(N).some($=>b.pathname.includes($)))return false;if(de.trim()){let $=de.toLowerCase(),te=b.pathname.toLowerCase().includes($),ge=Object.entries(b.params||{}).some(([Te,Re])=>{let Je=Array.isArray(Re)?Re.join(" "):Re;return Te.toLowerCase().includes($)||Je.toLowerCase().includes($)});return te||ge}return true}),[C,N,de]),Eo=ke(()=>se.slice(0,k),[se,k]),it=ke(()=>Math.max(0,se.length-k),[se.length,k]),st=ke(()=>{let b=new Map,$=new Map;for(let te=C.length-1;te>=0;te--){let ge=C[te],Te=(b.get(ge.pathname)||0)+1;b.set(ge.pathname,Te),$.set(ge,Te)}return $},[C]),Do=ke(()=>({summary:{total:C.length,filtered:se.length,listening:L,ignoredPatterns:Array.from(N),timestamp:new Date().toISOString()},events:se.map((b,$)=>({index:$,visitNumber:st.get(b)||1,pathname:b.pathname,timestamp:b.timestamp,timestampRelative:ea(b.timestamp),params:b.params,segments:b.segments,previousPathname:b.previousPathname,timeSincePrevious:b.timeSincePrevious}))}),[C.length,se,L,N,st]);if(!e)return null;let Lo=a?We.modal.root():We.routeEvents.modal(),lt=null,Pt=()=>{if(j)return I(Xt,{event:j,visitNumber:ue,onNavigate:D});if(l==="routes")return f||i?.sitemap?I(Tt,{style:U.contentWrapper,injectedRoutes:i?.sitemap?.routes,injectedSource:i?.sitemap?.source??null,injectedLastUpdatedAt:i?.sitemap?.lastUpdatedAt??null,onNavigateRoute:i?Po:void 0}):I(Tt,{style:U.contentWrapper});if(l==="stack")return I(mo,{style:U.contentWrapper,injectedStack:i?i.stack??[]:void 0,onAction:i?.onStackAction,onCopyValueChange:x});if(Y)return I(Sa,{ignoredPatterns:N,onTogglePattern:Ce,onAddPattern:_e,availablePathnames:be});let b=C.length>0;return se.length===0?ie(c,{style:U.contentWrapper,testID:"buoy-routes-events",children:[b&&I(c,{style:U.searchContainer,testID:"buoy-routes-search-field",children:I(Gt,{value:de,onChange:S,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),I(Yr,{testID:"buoy-routes-empty",...Zr({subject:"route events",search:de,total:C.length,capturing:L,waiting:{otto:"walking",title:"No route events yet",message:"Navigation events will appear here"},paused:{title:"Event listener is paused",message:"Press play to start monitoring"}})})]}):ie(c,{style:U.contentWrapper,testID:"buoy-routes-events",children:[I(c,{style:U.searchContainer,testID:"buoy-routes-search-field",children:I(Gt,{value:de,onChange:S,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),it>0&&ie(c,{style:U.lockedEventsBanner,testID:"buoy-routes-locked-banner",children:[I(ra,{size:14,color:Z.color.warning}),ie(p,{style:U.lockedEventsBannerText,testID:"buoy-routes-locked-banner-text",children:[it," older ",it===1?"event":"events"," locked"]}),I(p,{style:U.lockedEventsBannerSubtext,children:"Upgrade to Pro for full history"})]}),I(vn,{events:Eo,visitCounts:st,onNavigate:D,onSelectEvent:Ge})]})},$t=j?ie(le,{children:[I(le.Navigation,{onBack:nt}),I(le.Content,{title:j.pathname,testID:"buoy-routes-detail-title"}),I(le.Actions,{children:I(mt,{testID:"buoy-routes-detail-copy",value:{pathname:j.pathname,previousPathname:j.previousPathname,params:j.params,segments:j.segments,timestamp:j.timestamp,timestampISO:new Date(j.timestamp).toISOString(),timeSincePrevious:j.timeSincePrevious,visitNumber:ue},buttonStyle:U.iconButton})})]}):Y?ie(le,{children:[I(le.Navigation,{onBack:()=>X(false)}),I(le.Content,{title:"Filters",testID:"buoy-routes-filters-title"})]}):ie(le,{children:[o&&I(le.Navigation,{onBack:o}),I(le.Content,{title:"",noMargin:true,children:I(Xr,{tabs:[{key:"routes",label:f?"Routes":"Screens"},{key:"events",label:`Events${C.length>0&&l!=="events"?` (${C.length})`:""}`},{key:"stack",label:"Stack"}],activeTab:l,onTabChange:b=>H(b),testIDPrefix:"buoy-routes-tab"})}),ie(le.Actions,{children:[l==="stack"&&I(mt,{value:g,buttonStyle:U.iconButton,testID:"buoy-routes-stack-copy"}),l==="events"&&ie(xn,{children:[I(mt,{value:Do,buttonStyle:U.iconButton,testID:"buoy-routes-copy"}),I(V,{onPress:Ne,style:[U.iconButton,N.size>0&&U.activeFilterButton],testID:"buoy-routes-filters",accessibilityRole:"button",accessibilityLabel:N.size>0?`Route filters, ${N.size} active`:"Route filters",children:I(oa,{size:14,color:N.size>0?Z.color.accent:Z.color.textSecondary})}),I(na,{isEnabled:L,onToggle:ee,accessibilityLabel:"Toggle route event monitoring",testID:"buoy-routes-power"}),I(V,{onPress:Fe,style:U.iconButton,testID:"buoy-routes-clear",accessibilityRole:"button",accessibilityLabel:"Clear route events",children:I(ta,{size:14,color:Z.color.danger})})]})]})]}),Po=b=>{if(b.type==="layout"||b.type==="group")return;let $=b.type==="index"||b.path==="/";if(!P&&!$){F(true);return}i?.onNavigateRoute?.(b)},At=I(aa,{visible:R,onClose:()=>F(false),featureName:"Route Event Management"});return n?ie(Jt,{children:[ie(c,{style:U.inlineRoot,children:[I(c,{style:U.inlineHeader,...qr,children:$t}),Pt(),lt]}),At]}):I(Jt,{children:ie(Qr,{visible:e,onClose:t,onMinimize:r,persistenceKey:Lo,header:{showToggleButton:true,customContent:$t},onModeChange:w,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,disableScrollWrapper:true,styles:{},footer:lt,footerHeight:lt?68:0,children:[Pt(),At]})})}function Rn(e={}){return I(kt,{...e,inline:true,visible:true,onClose:()=>{}})}var U=ve.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:ia.border,backgroundColor:"transparent"},iconButton:{padding:6,borderRadius:6,backgroundColor:Z.color.buttonSurface},activeFilterButton:{backgroundColor:Z.color.accentSoft},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:Z.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:Ye,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:Z.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:Ye},contentWrapper:{flex:1},statsContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:Z.color.surface,borderBottomWidth:1,borderBottomColor:Z.color.border},statsText:{fontSize:11,color:Z.color.textSecondary,fontFamily:Ye,textAlign:"center"},statsWarning:{color:Z.color.warning,fontWeight:"600"},searchContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:"transparent"},lockedEventsBanner:{flexDirection:"row",alignItems:"center",gap:8,backgroundColor:Z.color.warningSoft,borderWidth:1,borderColor:Z.color.warning+"30",borderRadius:8,paddingVertical:10,paddingHorizontal:14,marginHorizontal:16,marginBottom:8},lockedEventsBannerText:{fontSize:12,fontWeight:"600",color:Z.color.warning,fontFamily:Ye},lockedEventsBannerSubtext:{fontSize:11,color:Z.color.textSecondary,marginLeft:"auto"}});import{createToolFactory as In,defineToolPreset as kn}from"@buoy-gg/shared-ui/web";import{jsx as Bn}from"react/jsx-runtime";var xo=kn({id:"route-events",name:"ROUTES",description:"Route tracking & navigation inspector",slot:"both",icon:({size:e})=>Bn(Wo,{size:e}),component:kt,props:{enableSharedModalDimensions:false}}),En=In(xo,e=>({enableSharedModalDimensions:e.enableSharedModalDimensions??false}));import{useEffect as Dn}from"react";import{browserRouter as So,getBrowserHref as Ln,getBrowserRouteURL as wo,subscribeBrowserNavigation as Pn}from"@buoy-gg/shared-ui/web/utils";var Co=0,Bt;function $n(){if(typeof window>"u")return()=>{};if(Co++===0){he.hydrateBootCapture();let t,o,r="",a=[],n=-1,i,d,s=()=>{i=void 0,clearTimeout(d)},f=()=>{let g=window.history.state;if(!g||typeof g!="object")return;let x=g.key??g.__TSR_key;if(typeof x=="string"||typeof x=="number")return String(x);for(let[P,k]of[["depth",g._depth],["position",g.position],["nav",g.navigationId]])if(typeof k=="number")return`${P}:${k}`},l=g=>{for(let x=n-1;x>=0;x--)if(a[x].href===g)return x;for(let x=n+1;x<a.length;x++)if(a[x].href===g)return x;return-1},h=g=>{let x=f();if(g.href===r&&g.kind==="pop"&&(x===void 0||a[n]?.key===x))return;if(g.kind==="replace"&&g.href===r&&n>=0){a[n]={href:g.href,key:x};return}if(g.kind!=="pop"&&s(),g.kind==="replace"&&n>=0)a[n]={href:g.href,key:x};else if(g.kind==="pop"){let W=x===void 0?-1:a.findIndex(q=>q.key===x),C=W<0&&i!==void 0&&a[i]?.href===g.href?i:-1,A=W>=0?W:C>=0?C:l(g.href);A>=0?n=A:(a.splice(n+1),a.push({href:g.href,key:x}),n++),n===i&&s()}else a.splice(n+1),a.push({href:g.href,key:x}),n++;r=g.href;let P=wo(g.href),k=Date.now(),E=no(P.pathname);Oa()||De.emit({pathname:P.pathname,params:{...E.params,...Object.fromEntries(P.searchParams)},segments:E.segments,previousPathname:t,timestamp:k,timeSincePrevious:o===void 0?void 0:k-o}),t=P.pathname,o=k,M.setStack(a.slice(0,n+1).map(({href:W},C)=>{let A=wo(W),q=no(A.pathname);return{key:`browser:${C}`,name:q.segments.join("/")||"index",pathname:A.pathname,params:{...q.params,...Object.fromEntries(A.searchParams)},index:C,isFocused:C===n,canPop:C>0}}))},R=g=>{if(!Number.isInteger(g)||g<0||g>=a.length)throw new Error("That browser history entry is unavailable.");let x=i??n;g!==x&&(i=g,clearTimeout(d),d=setTimeout(s,1500),window.history.go(g-x))},F=()=>{let g=i??n;g>0?R(g-1):i===void 0&&So.back()};M.setActions({navigateToIndex:R,popToIndex:R,goBack:F,popToTop:()=>R(0),navigateToRoute:(g,x)=>{let P={...x},k=`/${g.replace(/^\//,"")}`.replace(/\[(\.\.\.)?([^\]]+)\]/g,(E,W,C)=>{if(!(C in P))return E;let A=P[C];return delete P[C],W&&Array.isArray(A)?A.map(q=>encodeURIComponent(String(q))).join("/"):encodeURIComponent(String(A))});return So.push({pathname:k==="/index"?"/":k,params:P}),true}}),Bt=Pn(h),h({href:Ln(),kind:"initial"})}let e=false;return()=>{e||(e=true,--Co===0&&(Bt?.(),Bt=void 0,M.setActions(null)))}}function An(){return Dn($n,[]),null}import{useEffect as To,useRef as Et}from"react";import{useSafePathname as Fn,useSafeSegments as Nn,useSafeGlobalSearchParams as zn}from"@buoy-gg/shared-ui/web";function Wn(e){let t=Fn(),o=Nn(),r=zn(),a=Et(e),n=Et(void 0),i=Et(void 0);To(()=>{a.current=e},[e]),To(()=>{let d=Date.now(),s=i.current?d-i.current:void 0,f={pathname:t,params:r,segments:o,timestamp:d,previousPathname:n.current,timeSincePrevious:s};n.current=t,i.current=d,De.emit(f),a.current&&a.current(f)},[t,o,r])}import{useEffect as Ro,useRef as Dt}from"react";function Io(e){if(!e||!e.routes||e.routes.length===0)return{route:null,segments:[]};let t=e.routes[e.index??0],o=[t.name];if(t.state){let r=Io(t.state);if(r.route)return{route:r.route,segments:[...o,...r.segments]}}return{route:t,segments:o}}function ko(e,t,o,r){if(!e)return;let{route:a,segments:n}=Io(e);if(!a)return;let i=`/${a.name}`;if(i===t.current)return;let d=Date.now(),s=o.current?d-o.current:void 0,f={pathname:i,params:a.params||{},segments:n,timestamp:d,previousPathname:t.current,timeSincePrevious:s};t.current=i,o.current=d,De.emit(f),r.current&&r.current(f)}function On(e){let t=void 0,o=Dt(e),r=Dt(void 0),a=Dt(void 0);Ro(()=>{o.current=e},[e]),Ro(()=>{if(!t)return;let n=t.getRootState?.();n&&ko(n,r,a,o);let i=t.addListener?.("state",()=>{let d=t.getRootState?.();ko(d,r,a,o)});return()=>{i?.()}},[t])}import{getSafeRouter as jn}from"@buoy-gg/shared-ui/web";function Hn(e,t){let o=[],r=false,a=d=>{for(let s of d??[])(s.name?.includes("+not-found")||s.path?.includes("+not-found"))&&(r=true),typeof s.path=="string"&&o.push(s.path),a(s.children)};if(a(t),r||o.length===0)return;let n=d=>"/"+d.split("?")[0].split("#")[0].split("/").filter(s=>s&&!/^\(.*\)$/.test(s)).join("/"),i=n(e);return o.some(d=>{let s=n(d);return s===i?true:new RegExp("^"+s.split("/").map(f=>/^\[\.\.\..+\]$/.test(f)?".+":/^\[.+\]$/.test(f)?"[^/]+":f.replace(/[.*+?^${}()|\\]/g,"\\$&")).join("/")+"$").test(i)})}import{isOverWireBudget as Vn}from"@buoy-gg/shared-ui/web";async function Mn(e,t){let o=M.getStack().findIndex(a=>a.isFocused),r=M.getActions();if(o<0||!r||typeof e.replace!="function")throw new Error("This app's history isn't captured yet, so Buoy can't start over. Open the Routes tool once, or navigate without reset.");if(o>0){let a=globalThis;await new Promise((n,i)=>{let d=l=>{clearTimeout(f),a.removeEventListener?.("popstate",s),l?n():i(new Error("The app didn't go back to its first page, so nothing was reset. Try again, or navigate without reset."))},s=()=>setTimeout(()=>d(true),0),f=setTimeout(()=>d(false),1500);a.addEventListener?.("popstate",s),r.popToTop()})}if(M.getStack().findIndex(a=>a.isFocused)!==0)throw new Error("The app isn't on its first page, so nothing was reset. Try again, or navigate without reset.");return e.replace(t),{navigated:t,replaced:true,reset:true}}var Un=16*1024,Kn=Object.freeze({__buoyOmitted:"route-params",note:"Navigation params stay on the device."});function Lt(e){return e==null?false:Vn(e,Un)}function Ke(e){return Lt(e)?Kn:e}function _n(e){return Lt(e.params)?{...e,params:Ke(e.params)}:e}function Gn(e){return Lt(e.params)?{...e,params:Ke(e.params)}:e}function Bo(){let e=wt();return{routes:ye.parseRouteTree(Ve()),source:e.source,lastUpdatedAt:e.lastLoadedAt,complete:io()}}var Jn={version:3,getSnapshot:()=>({events:he.getEvents().map(_n),sitemap:Bo(),stack:M.getStack().map(Gn)}),subscribe:e=>{let t=he.subscribeToEvents(e),o=M.subscribe(e),r=null;if(!Ve()){let a=0,n=100,i=()=>{if(a+=1,Ve()){r=null,e();return}r=a<n?setTimeout(i,100):null};r=setTimeout(i,100)}return()=>{t(),o(),r&&clearTimeout(r)}},actions:{clearEvents:()=>{he.clearEvents()},getCurrentRoute:()=>{let e=he.getEvents()[0];if(e&&he.isCapturing())return{path:e.pathname,params:Ke(e.params),at:e.timestamp,source:"event"};let t=M.getStack(),o=t.find(r=>r.isFocused)??t[t.length-1];return o?.pathname?{path:o.pathname,params:Ke(o.params??{}),at:null,source:"stack"}:e?{path:e.pathname,params:Ke(e.params),at:e.timestamp,source:"event",stale:true}:{path:null,params:{},at:null,source:null}},navigate:e=>{let t=e,o=t?.path;if(!o)throw new Error("navigate requires a 'path' param");let r=jn();if(!r){let n=M.getActions(),i=o.replace(/^\//,"");if(!n?.navigateToRoute||!i)throw new Error("expo-router is not available here and no navigation container was captured \u2014 is <RouteTracker /> mounted inside your NavigationContainer?");if(!n.navigateToRoute(i,t?.params))throw new Error(`Could not navigate to "${i}" \u2014 no navigation container is live.`);return{navigated:o,replaced:false,via:"react-navigation"}}let a=[];try{a=Bo().routes}catch{a=[]}if(io()&&Hn(o,a)===false)throw new Error(`No screen matches "${o}". Navigating there would open expo-router's "Unmatched Route" page, which replaces the app's layout (and disconnects Buoy). Read the sitemap for the paths this app has.`);if(t?.reset===true){if(typeof r.canDismiss!="function")return Mn(r,o);try{r.canDismiss()&&r.dismissAll?.()}catch{}return r.navigate(o),{navigated:o,replaced:false,reset:true}}return(t?.replace===true&&typeof r.replace=="function"?r.replace:r.navigate)(o),{navigated:o,replaced:t?.replace===true}},stackNavigateToIndex:e=>{let t=e?.index;if(typeof t!="number")throw new Error("stackNavigateToIndex requires a numeric 'index'");let o=M.getActions();if(!o)throw new Error("navigation stack is not available");return o.navigateToIndex(t),{navigatedToIndex:t}},stackPopToIndex:e=>{let t=e?.index;if(typeof t!="number")throw new Error("stackPopToIndex requires a numeric 'index'");let o=M.getActions();if(!o)throw new Error("navigation stack is not available");return o.popToIndex(t),{poppedToIndex:t}},stackGoBack:()=>{let e=M.getActions();if(!e)throw new Error("navigation stack is not available");return e.goBack(),{wentBack:true}},stackPopToTop:()=>{let e=M.getActions();if(!e)throw new Error("navigation stack is not available");return e.popToTop(),{poppedToTop:true}}}};export{mo as NavigationStack,Xt as RouteEventDetail,gt as RouteEventExpandedContent,yo as RouteEventItemCompact,kt as RouteEventsModalWithTabs,qt as RouteObserver,ye as RouteParser,An as RouteTracker,Tt as RoutesSitemap,Rn as RoutesToolView,Wa as claimBrowserRouteEvents,En as createRouteEventsTool,M as navigationStackStore,Na as registerBrowserRoutes,he as routeEventStore,Jn as routeEventsSyncAdapter,xo as routeEventsToolPreset,De as routeObserver,po as useNavigationStack,Ha as useParentRoutes,ja as useRoute,Yt as useRouteEvents,Wn as useRouteObserver,On as useRouteObserverReactNavigation,Xe as useRouteSitemap};
|
|
8
|
+
${N}`))&&pe();return}_.alert(S,N,[{text:"Cancel",style:"cancel"},{text:K,style:"destructive",onPress:pe}])},j=()=>{if(!A){C(true);return}if(R){_.alert("Cannot Go Back","Already at the root of the stack");return}x()},we=()=>{if(!A){C(true);return}if(R){_.alert("Already at Top","Stack only has one screen");return}X("Pop to Top","This will remove all screens except the root screen.","Pop to Top",L)},ue=S=>{E(I===S?null:S)},xe=()=>{if(!A){C(true);return}if(P){if(P.isFocused){_.alert("Already There","This route is already visible");return}F(P.index)}},de=()=>{if(!A){C(true);return}if(!P)return;if(P.isFocused){_.alert("Cannot Pop","Selected route is already visible");return}if(P.index===m-1){_.alert("Cannot Pop","No screens above selected route");return}let S=m-1-P.index,N=P.index;X("Pop to Route",`Remove ${S} screen${S!==1?"s":""} above ${P.pathname}?`,"Pop",()=>g(N))};return ae(c,{style:[y.container,e],children:[B(qe,{keyboardShouldPersistTaps:"handled",testID:"buoy-routes-stack-scroll",style:y.stackScroll,contentContainerStyle:[y.stackContent,{paddingBottom:y.stackContent.padding+i.bottom}],children:[...d].reverse().map((S,N)=>{let K=d.length-1-N,pe=I===K,w=Object.keys(S.params).length>0,D=Ua(K);return B(c,{style:y.stackItemWrapper,testID:D,children:ae(c,{style:[y.stackItem,pe&&y.stackItemSelected],children:[ae(c,{style:y.stackItemHeader,children:[ae(V,{style:y.stackItemToggle,onPress:()=>ue(K),activeOpacity:.7,testID:`${D}-toggle`,accessibilityRole:"button",accessibilityLabel:`${S.pathname}, ${S.isFocused?"focused":"mounted"}, position ${K} of ${m-1}`,children:[B(c,{style:y.expandIndicator,children:pe?B(Ja,{size:14,color:J.color.textSecondary}):B(qa,{size:14,color:J.color.textSecondary})}),B(p,{style:y.stackItemPath,numberOfLines:1,testID:`${D}-path`,children:S.pathname})]}),B(Ya,{value:S.pathname,buttonStyle:y.copyRouteButton,testID:`${D}-copy`}),B(V,{onPress:()=>ue(K),activeOpacity:.7,accessible:false,style:[y.statusBadge,{backgroundColor:S.isFocused?`${ot.success}15`:"#3B82F615",borderColor:S.isFocused?`${ot.success}40`:"#3B82F640"}],children:B(p,{style:[y.statusBadgeText,{color:S.isFocused?ot.success:"#3B82F6"}],testID:`${D}-status`,children:S.isFocused?"FOCUSED":"MOUNTED"})})]}),pe&&ae(c,{style:y.expandedContent,children:[ae(c,{style:y.detailRow,children:[B(p,{style:y.detailLabel,children:"Route Name:"}),B(p,{style:y.detailValue,testID:`${D}-name`,children:S.name})]}),ae(c,{style:y.detailRow,children:[B(p,{style:y.detailLabel,children:"Position:"}),ae(p,{style:y.detailValue,testID:`${D}-position`,children:[K," / ",m-1]})]}),w&&B(c,{style:y.dataViewerContainer,children:B(tn,{title:"Parameters",data:S.params,showTypeFilter:false})}),ae(c,{style:y.actionsRow,children:[ae(c,{style:y.actionWrapper,children:[B(V,{style:[y.actionButton,R&&y.actionButtonDisabled],onPress:j,disabled:R,testID:`${D}-back`,accessibilityRole:"button",accessibilityLabel:"Go back one screen",children:B(p,{style:[y.actionButtonText,R&&y.actionButtonTextDisabled],children:"Back"})}),B(p,{style:y.helpText,children:"Go back one screen"})]}),ae(c,{style:y.actionWrapper,children:[B(V,{style:[y.actionButton,S.isFocused&&y.actionButtonDisabled],onPress:xe,disabled:S.isFocused,testID:`${D}-go`,accessibilityRole:"button",accessibilityLabel:`Navigate to ${S.pathname}`,children:B(p,{style:[y.actionButtonText,S.isFocused&&y.actionButtonTextDisabled],children:"Go"})}),B(p,{style:y.helpText,children:"Navigate to this route"})]}),ae(c,{style:y.actionWrapper,children:[B(V,{style:[y.actionButton,(S.isFocused||K===m-1)&&y.actionButtonDisabled],onPress:de,disabled:S.isFocused||K===m-1,testID:`${D}-pop-to`,accessibilityRole:"button",accessibilityLabel:`Remove screens above ${S.pathname}`,children:B(p,{style:[y.actionButtonText,(S.isFocused||K===m-1)&&y.actionButtonTextDisabled],children:"Pop To"})}),B(p,{style:y.helpText,children:"Remove screens above this"})]})]})]})]})},`stack-${K}-${S.key}`)})}),B(Za,{visible:W,onClose:()=>C(false),featureName:"Stack Navigation"})]})}var y=ve.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},loadingText:{color:J.color.textSecondary,fontSize:14,fontFamily:ce},errorContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},errorText:{color:ot.error,fontSize:16,fontWeight:"600",fontFamily:ce,marginBottom:8},errorDetail:{color:J.color.textSecondary,fontSize:12,fontFamily:ce,textAlign:"center"},emptyContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyText:{color:J.color.text,fontSize:16,fontWeight:"600",fontFamily:ce,marginBottom:8},emptySubtext:{color:J.color.textSecondary,fontSize:14,fontFamily:ce,textAlign:"center"},stackScroll:{flex:1},stackContent:{padding:8},stackItemWrapper:{marginBottom:6},stackItem:{backgroundColor:J.color.surface,borderRadius:6,borderWidth:1,borderColor:J.color.border,overflow:"hidden"},stackItemSelected:{borderColor:J.color.accent,borderWidth:2},stackItemHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:12,gap:8},stackItemToggle:{flex:1,flexDirection:"row",alignItems:"center",gap:8},expandIndicator:{width:20,alignItems:"center"},stackItemPath:{fontSize:13,fontWeight:"600",color:J.color.text,fontFamily:ce,flex:1},copyRouteButton:{padding:4,marginLeft:4},statusBadge:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},statusBadgeText:{fontSize:10,fontWeight:"600",fontFamily:ce},expandedContent:{paddingHorizontal:12,paddingTop:8,paddingBottom:12,borderTopWidth:1,borderTopColor:J.color.border},detailRow:{marginBottom:8},detailLabel:{fontSize:10,color:J.color.textSecondary,fontFamily:ce,marginBottom:2},detailValue:{fontSize:12,color:J.color.text,fontFamily:ce},dataViewerContainer:{marginTop:4,marginHorizontal:-12,marginBottom:8},actionsRow:{flexDirection:"row",gap:6,marginTop:12},actionWrapper:{flex:1},actionButton:{backgroundColor:J.color.surfaceElevated,paddingVertical:8,paddingHorizontal:8,borderRadius:6,alignItems:"center"},actionButtonDisabled:{opacity:.5},actionButtonText:{fontSize:12,fontWeight:"600",color:J.color.text,fontFamily:ce},actionButtonTextDisabled:{color:J.color.textTertiary},helpText:{fontSize:9,color:J.color.textSecondary,fontFamily:ce,textAlign:"center",marginTop:4,lineHeight:12}});import{useCallback as nn}from"react";import{Navigation as sn,night as Rt,EVENT_LIST_PRESET as ln,monoFont as mo}from"@buoy-gg/shared-ui/web";import{memo as cn,useMemo as fe}from"react";import{CompactRow as un,RelativeTime as dn,buoyColors as fo,night as rt,monoFont as go}from"@buoy-gg/shared-ui/web";import{jsx as Me}from"react/jsx-runtime";function pn(e){return e.pathname==="/"?"home":yt(e.pathname,e.segments)?"dynamic":e.params&&Object.keys(e.params).length>0?"with-params":"default"}function hn(e){switch(e){case"home":return fo.success;case"dynamic":return rt.color.accent;case"with-params":return fo.warning;default:return rt.color.textSecondary}}function mn(e){switch(e){case"home":return"Home";case"dynamic":return"Dynamic";case"with-params":return"Params";default:return"Static"}}function fn(e){if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.floor(e/6e4),o=Math.floor(e%6e4/1e3);return o>0?`${t}m ${o}s`:`${t}m`}function gn(e){let t=[];e.timeSincePrevious!==void 0&&e.timeSincePrevious>0&&t.push(fn(e.timeSincePrevious));let o=e.segments?.length||0;return o>0&&t.push(`depth ${o}`),t.join(" \xB7 ")||"root"}function yn(e){if(e.params&&Object.keys(e.params).length>0){let t=Object.keys(e.params).length;return`${t} PARAM${t!==1?"S":""}`}}var yo=cn(function({event:e,visitNumber:t,isExpanded:o,onPress:r,onNavigate:a,index:n}){let i=fe(()=>pn(e),[e]),d=fe(()=>yt(e.pathname,e.segments),[e.pathname,e.segments]),s=fe(()=>hn(i),[i]),f=fe(()=>mn(i),[i]),l=fe(()=>gn(e),[e]),m=fe(()=>yn(e),[e]),R=fe(()=>Va(e.pathname,t),[e.pathname,t]),F=fe(()=>`${e.pathname}, ${f}, ${l}`,[e.pathname,f,l]),g=fe(()=>{if(o)return Me(gt,{event:e,visitNumber:t,routeTemplate:d})},[o,e,t,d]),x=fe(()=>{if(a)return Me(V,{style:bo.goButton,onPress:()=>a(Zt(e.pathname,e.params)),testID:`${R}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${e.pathname}`,children:Me(p,{style:bo.goButtonText,children:"Go"})})},[a,e.pathname,R]);return Me(un,{statusDotColor:s,statusLabel:f,statusSublabel:l,primaryText:e.pathname,badgeText:m,badgeColor:s,trailingAction:x,bottomRightText:Me(dn,{timestamp:e.timestamp}),showChevron:true,expandedContent:g,isExpanded:o,expandedGlowColor:s,onPress:()=>r(n),testID:R,statusTestID:`${R}-status`,statusSublabelTestID:`${R}-sublabel`,accessibilityLabel:F})}),bo=ve.create({badgeText:{fontSize:11,fontWeight:"600",fontFamily:go},goButton:{backgroundColor:rt.color.accent,paddingHorizontal:8,paddingVertical:4,borderRadius:4},goButtonText:{fontSize:10,fontWeight:"600",color:rt.color.onAccent,fontFamily:go}});import{jsx as Ue,jsxs as bn}from"react/jsx-runtime";function vn({events:e,visitCounts:t,onNavigate:o,onSelectEvent:r}){let a=nn(n=>{let i=e[n];i&&r(i,t.get(i)||1)},[e,t,r]);return e.length===0?bn(c,{style:at.emptyState,testID:"buoy-routes-empty",children:[Ue(sn,{size:48,color:Rt.color.textTertiary}),Ue(p,{style:at.emptyTitle,testID:"buoy-routes-empty-title",children:"No events yet"}),Ue(p,{style:at.emptySubtitle,testID:"buoy-routes-empty-subtitle",children:"Navigation events will appear here"})]}):Ue(jt,{keyboardShouldPersistTaps:"handled",testID:"buoy-routes-timeline",contentContainerStyle:at.listContent,data:e,keyExtractor:n=>`${n.timestamp}-${n.pathname}`,renderItem:({item:n,index:i})=>Ue(yo,{event:n,visitNumber:t.get(n)||1,isExpanded:false,index:i,onPress:a,onNavigate:o}),showsVerticalScrollIndicator:true,...ln})}var at=ve.create({listContent:{paddingVertical:8},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:Rt.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:mo,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:Rt.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:mo}});import{Fragment as xn,jsx as k,jsxs as ie}from"react/jsx-runtime";var kt=_r(),Sn={parse:e=>e==="routes"||e==="events"||e==="stack"?e:void 0,serialize:e=>e},wn={parse:e=>e==="true",serialize:e=>e.toString()},Cn={parse:e=>new Set(JSON.parse(e)),serialize:e=>JSON.stringify(Array.from(e))};function vo(e,t){if(!e||!e.routes)return null;for(let o of e.routes){if(o.name===t)return[o.name];if(o.state){let r=vo(o.state,t);if(r)return[o.name,...r]}}return null}function Tn(e,t){if(e.length===0)return null;let o=t&&Object.keys(t).length>0?t:void 0;if(e.length===1)return kt.navigate(o?{name:e[0],params:o}:{name:e[0]});let r=o?{screen:e[e.length-1],params:o}:{screen:e[e.length-1]};for(let a=e.length-2;a>=1;a--)r={screen:e[a],params:r};return kt.navigate({name:e[0],params:r})}function It({visible:e,onClose:t,onBack:o,onMinimize:r,enableSharedModalDimensions:a=false,inline:n=false,remote:i}){let d=Gr(),s=void 0,f=ct.OS==="web"||Jr(),[l,m]=pt(We.routeEvents.activeTab(),"events",Sn),[R,F]=ke(false),[g,x]=ke(""),L=la(),I=sa("routeEvents.entries");Wt(()=>{R&&L&&F(false)},[R,L]);let[E,W]=pt(We.routeEvents.isMonitoring(),true,wn),{events:C,clearEvents:A,isListening:q}=Yt({enabled:E}),P=E&&q;Wt(()=>{me.setBootCapture(E)},[E]);let[Y,X]=ke(false),[j,we]=ke(null),[ue,xe]=ke(1),[de,S]=ke(""),[N,K]=pt(We.routeEvents.eventFilters(),new Set(["/_sitemap","/api","/__dev"]),Cn),pe=Oo(null),w=he(b=>{},[]),D=he(b=>{try{if(i){if(!i.onNavigatePath)return;if(!L&&b!=="/"){F(true);return}i.onNavigatePath(b);return}if(f)d.push(b);else if(s){let{pathname:$,params:te}=ba(b),ge=$.startsWith("/")?$.slice(1):$,Te=Object.keys(te).length>0,Re=s.getRootState?.();if(Re){let Je=vo(Re,ge);if(Je){let Ft=Tn(Je,te);if(Ft){s.dispatch(Ft);return}}}s.dispatch(kt.navigate(Te?{name:ge,params:te}:{name:ge}))}else _.alert("Navigation Unavailable","No Expo Router or React Navigation container was found in this app.")}catch($){_.alert("Navigation Error",String($))}},[d,s,f,i,L]),ee=he(()=>{W(b=>!b)},[]),Fe=he(()=>{if(C.length!==0){if(!L){F(true);return}A()}},[C.length,L,A]),Ce=he(b=>{K($=>{let te=new Set($);return te.has(b)?te.delete(b):te.add(b),te})},[]),_e=he(b=>{K($=>new Set([...$,b]))},[]),Ne=he(()=>{X(!Y)},[Y]),Ge=he((b,$)=>{we(b),xe($)},[]),nt=he(()=>{we(null)},[]),H=he(b=>{we(null),m(b)},[]),be=Ie(()=>{let b=new Set;return C.forEach($=>{$.pathname&&b.add($.pathname)}),Array.from(b).sort()},[C]),se=Ie(()=>C.filter(b=>{if(!b.pathname||Array.from(N).some($=>b.pathname.includes($)))return false;if(de.trim()){let $=de.toLowerCase(),te=b.pathname.toLowerCase().includes($),ge=Object.entries(b.params||{}).some(([Te,Re])=>{let Je=Array.isArray(Re)?Re.join(" "):Re;return Te.toLowerCase().includes($)||Je.toLowerCase().includes($)});return te||ge}return true}),[C,N,de]),Eo=Ie(()=>se.slice(0,I),[se,I]),it=Ie(()=>Math.max(0,se.length-I),[se.length,I]),st=Ie(()=>{let b=new Map,$=new Map;for(let te=C.length-1;te>=0;te--){let ge=C[te],Te=(b.get(ge.pathname)||0)+1;b.set(ge.pathname,Te),$.set(ge,Te)}return $},[C]),Do=Ie(()=>({summary:{total:C.length,filtered:se.length,listening:P,ignoredPatterns:Array.from(N),timestamp:new Date().toISOString()},events:se.map((b,$)=>({index:$,visitNumber:st.get(b)||1,pathname:b.pathname,timestamp:b.timestamp,timestampRelative:ea(b.timestamp),params:b.params,segments:b.segments,previousPathname:b.previousPathname,timeSincePrevious:b.timeSincePrevious}))}),[C.length,se,P,N,st]);if(!e)return null;let Po=a?We.modal.root():We.routeEvents.modal(),lt=null,Lt=()=>{if(j)return k(Xt,{event:j,visitNumber:ue,onNavigate:D});if(l==="routes")return f||i?.sitemap?k(Tt,{style:U.contentWrapper,injectedRoutes:i?.sitemap?.routes,injectedSource:i?.sitemap?.source??null,injectedLastUpdatedAt:i?.sitemap?.lastUpdatedAt??null,onNavigateRoute:i?Lo:void 0}):k(Tt,{style:U.contentWrapper});if(l==="stack")return k(ho,{style:U.contentWrapper,injectedStack:i?i.stack??[]:void 0,onAction:i?.onStackAction,onCopyValueChange:x});if(Y)return k(Sa,{ignoredPatterns:N,onTogglePattern:Ce,onAddPattern:_e,availablePathnames:be});let b=C.length>0;return se.length===0?ie(c,{style:U.contentWrapper,testID:"buoy-routes-events",children:[b&&k(c,{style:U.searchContainer,testID:"buoy-routes-search-field",children:k(Gt,{value:de,onChange:S,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),k(Yr,{testID:"buoy-routes-empty",...Zr({subject:"route events",search:de,total:C.length,capturing:P,waiting:{otto:"walking",title:"No route events yet",message:"Navigation events will appear here"},paused:{title:"Event listener is paused",message:"Press play to start monitoring"}})})]}):ie(c,{style:U.contentWrapper,testID:"buoy-routes-events",children:[k(c,{style:U.searchContainer,testID:"buoy-routes-search-field",children:k(Gt,{value:de,onChange:S,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),it>0&&ie(c,{style:U.lockedEventsBanner,testID:"buoy-routes-locked-banner",children:[k(ra,{size:14,color:Z.color.warning}),ie(p,{style:U.lockedEventsBannerText,testID:"buoy-routes-locked-banner-text",children:[it," older ",it===1?"event":"events"," locked"]}),k(p,{style:U.lockedEventsBannerSubtext,children:"Upgrade to Pro for full history"})]}),k(vn,{events:Eo,visitCounts:st,onNavigate:D,onSelectEvent:Ge})]})},$t=j?ie(le,{children:[k(le.Navigation,{onBack:nt}),k(le.Content,{title:j.pathname,testID:"buoy-routes-detail-title"}),k(le.Actions,{children:k(ht,{testID:"buoy-routes-detail-copy",value:{pathname:j.pathname,previousPathname:j.previousPathname,params:j.params,segments:j.segments,timestamp:j.timestamp,timestampISO:new Date(j.timestamp).toISOString(),timeSincePrevious:j.timeSincePrevious,visitNumber:ue},buttonStyle:U.iconButton})})]}):Y?ie(le,{children:[k(le.Navigation,{onBack:()=>X(false)}),k(le.Content,{title:"Filters",testID:"buoy-routes-filters-title"})]}):ie(le,{children:[o&&k(le.Navigation,{onBack:o}),k(le.Content,{title:"",noMargin:true,children:k(Xr,{tabs:[{key:"routes",label:f?"Routes":"Screens"},{key:"events",label:`Events${C.length>0&&l!=="events"?` (${C.length})`:""}`},{key:"stack",label:"Stack"}],activeTab:l,onTabChange:b=>H(b),testIDPrefix:"buoy-routes-tab"})}),ie(le.Actions,{children:[l==="stack"&&k(ht,{value:g,buttonStyle:U.iconButton,testID:"buoy-routes-stack-copy"}),l==="events"&&ie(xn,{children:[k(ht,{value:Do,buttonStyle:U.iconButton,testID:"buoy-routes-copy"}),k(V,{onPress:Ne,style:[U.iconButton,N.size>0&&U.activeFilterButton],testID:"buoy-routes-filters",accessibilityRole:"button",accessibilityLabel:N.size>0?`Route filters, ${N.size} active`:"Route filters",children:k(oa,{size:14,color:N.size>0?Z.color.accent:Z.color.textSecondary})}),k(na,{isEnabled:P,onToggle:ee,accessibilityLabel:"Toggle route event monitoring",testID:"buoy-routes-power"}),k(V,{onPress:Fe,style:U.iconButton,testID:"buoy-routes-clear",accessibilityRole:"button",accessibilityLabel:"Clear route events",children:k(ta,{size:14,color:Z.color.danger})})]})]})]}),Lo=b=>{if(b.type==="layout"||b.type==="group")return;let $=b.type==="index"||b.path==="/";if(!L&&!$){F(true);return}i?.onNavigateRoute?.(b)},At=k(aa,{visible:R,onClose:()=>F(false),featureName:"Route Event Management"});return n?ie(Jt,{children:[ie(c,{style:U.inlineRoot,children:[k(c,{style:U.inlineHeader,...qr,children:$t}),Lt(),lt]}),At]}):k(Jt,{children:ie(Qr,{visible:e,onClose:t,onMinimize:r,persistenceKey:Po,header:{showToggleButton:true,customContent:$t},onModeChange:w,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,disableScrollWrapper:true,styles:{},footer:lt,footerHeight:lt?68:0,children:[Lt(),At]})})}function Rn(e={}){return k(It,{...e,inline:true,visible:true,onClose:()=>{}})}var U=ve.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:ia.border,backgroundColor:"transparent"},iconButton:{padding:6,borderRadius:6,backgroundColor:Z.color.buttonSurface},activeFilterButton:{backgroundColor:Z.color.accentSoft},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:Z.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:Ye,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:Z.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:Ye},contentWrapper:{flex:1},statsContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:Z.color.surface,borderBottomWidth:1,borderBottomColor:Z.color.border},statsText:{fontSize:11,color:Z.color.textSecondary,fontFamily:Ye,textAlign:"center"},statsWarning:{color:Z.color.warning,fontWeight:"600"},searchContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:"transparent"},lockedEventsBanner:{flexDirection:"row",alignItems:"center",gap:8,backgroundColor:Z.color.warningSoft,borderWidth:1,borderColor:Z.color.warning+"30",borderRadius:8,paddingVertical:10,paddingHorizontal:14,marginHorizontal:16,marginBottom:8},lockedEventsBannerText:{fontSize:12,fontWeight:"600",color:Z.color.warning,fontFamily:Ye},lockedEventsBannerSubtext:{fontSize:11,color:Z.color.textSecondary,marginLeft:"auto"}});import{createToolFactory as kn,defineToolPreset as In}from"@buoy-gg/shared-ui/web";import{jsx as Bn}from"react/jsx-runtime";var xo=In({id:"route-events",name:"ROUTES",description:"Route tracking & navigation inspector",slot:"both",icon:({size:e})=>Bn(Wo,{size:e}),component:It,props:{enableSharedModalDimensions:false}}),En=kn(xo,e=>({enableSharedModalDimensions:e.enableSharedModalDimensions??false}));import{useEffect as Dn}from"react";import{browserRouter as So,getBrowserHref as Pn,getBrowserRouteURL as wo,subscribeBrowserNavigation as Ln}from"@buoy-gg/shared-ui/web/utils";var Co=0,Bt;function $n(){if(typeof window>"u")return()=>{};if(Co++===0){me.hydrateBootCapture();let t,o,r="",a=[],n=-1,i,d,s=()=>{i=void 0,clearTimeout(d)},f=()=>{let g=window.history.state;if(!g||typeof g!="object")return;let x=g.key??g.__TSR_key;if(typeof x=="string"||typeof x=="number")return String(x);for(let[L,I]of[["depth",g._depth],["position",g.position],["nav",g.navigationId]])if(typeof I=="number")return`${L}:${I}`},l=g=>{for(let x=n-1;x>=0;x--)if(a[x].href===g)return x;for(let x=n+1;x<a.length;x++)if(a[x].href===g)return x;return-1},m=g=>{let x=f();if(g.href===r&&g.kind==="pop"&&(x===void 0||a[n]?.key===x))return;if(g.kind==="replace"&&g.href===r&&n>=0){a[n]={href:g.href,key:x};return}if(g.kind!=="pop"&&s(),g.kind==="replace"&&n>=0)a[n]={href:g.href,key:x};else if(g.kind==="pop"){let W=x===void 0?-1:a.findIndex(q=>q.key===x),C=W<0&&i!==void 0&&a[i]?.href===g.href?i:-1,A=W>=0?W:C>=0?C:l(g.href);A>=0?n=A:(a.splice(n+1),a.push({href:g.href,key:x}),n++),n===i&&s()}else a.splice(n+1),a.push({href:g.href,key:x}),n++;r=g.href;let L=wo(g.href),I=Date.now(),E=no(L.pathname);Oa()||De.emit({pathname:L.pathname,params:{...E.params,...Object.fromEntries(L.searchParams)},segments:E.segments,previousPathname:t,timestamp:I,timeSincePrevious:o===void 0?void 0:I-o}),t=L.pathname,o=I,M.setStack(a.slice(0,n+1).map(({href:W},C)=>{let A=wo(W),q=no(A.pathname);return{key:`browser:${C}`,name:q.segments.join("/")||"index",pathname:A.pathname,params:{...q.params,...Object.fromEntries(A.searchParams)},index:C,isFocused:C===n,canPop:C>0}}))},R=g=>{if(!Number.isInteger(g)||g<0||g>=a.length)throw new Error("That browser history entry is unavailable.");let x=i??n;g!==x&&(i=g,clearTimeout(d),d=setTimeout(s,1500),window.history.go(g-x))},F=()=>{let g=i??n;g>0?R(g-1):i===void 0&&So.back()};M.setActions({navigateToIndex:R,popToIndex:R,goBack:F,popToTop:()=>R(0),navigateToRoute:(g,x)=>{let L={...x},I=`/${g.replace(/^\//,"")}`.replace(/\[(\.\.\.)?([^\]]+)\]/g,(E,W,C)=>{if(!(C in L))return E;let A=L[C];return delete L[C],W&&Array.isArray(A)?A.map(q=>encodeURIComponent(String(q))).join("/"):encodeURIComponent(String(A))});return So.push({pathname:I==="/index"?"/":I,params:L}),true}}),Bt=Ln(m),m({href:Pn(),kind:"initial"})}let e=false;return()=>{e||(e=true,--Co===0&&(Bt?.(),Bt=void 0,M.setActions(null)))}}function An(){return Dn($n,[]),null}import{useEffect as To,useRef as Et}from"react";import{useSafePathname as Fn,useSafeSegments as Nn,useSafeGlobalSearchParams as zn}from"@buoy-gg/shared-ui/web";function Wn(e){let t=Fn(),o=Nn(),r=zn(),a=Et(e),n=Et(void 0),i=Et(void 0);To(()=>{a.current=e},[e]),To(()=>{let d=Date.now(),s=i.current?d-i.current:void 0,f={pathname:t,params:r,segments:o,timestamp:d,previousPathname:n.current,timeSincePrevious:s};n.current=t,i.current=d,De.emit(f),a.current&&a.current(f)},[t,o,r])}import{useEffect as Ro,useRef as Dt}from"react";function ko(e){if(!e||!e.routes||e.routes.length===0)return{route:null,segments:[]};let t=e.routes[e.index??0],o=[t.name];if(t.state){let r=ko(t.state);if(r.route)return{route:r.route,segments:[...o,...r.segments]}}return{route:t,segments:o}}function Io(e,t,o,r){if(!e)return;let{route:a,segments:n}=ko(e);if(!a)return;let i=`/${a.name}`;if(i===t.current)return;let d=Date.now(),s=o.current?d-o.current:void 0,f={pathname:i,params:a.params||{},segments:n,timestamp:d,previousPathname:t.current,timeSincePrevious:s};t.current=i,o.current=d,De.emit(f),r.current&&r.current(f)}function On(e){let t=void 0,o=Dt(e),r=Dt(void 0),a=Dt(void 0);Ro(()=>{o.current=e},[e]),Ro(()=>{if(!t)return;let n=t.getRootState?.();n&&Io(n,r,a,o);let i=t.addListener?.("state",()=>{let d=t.getRootState?.();Io(d,r,a,o)});return()=>{i?.()}},[t])}import{getSafeRouter as jn}from"@buoy-gg/shared-ui/web";function Hn(e,t){let o=[],r=false,a=d=>{for(let s of d??[])(s.name?.includes("+not-found")||s.path?.includes("+not-found"))&&(r=true),typeof s.path=="string"&&o.push(s.path),a(s.children)};if(a(t),r||o.length===0)return;let n=d=>"/"+d.split("?")[0].split("#")[0].split("/").filter(s=>s&&!/^\(.*\)$/.test(s)).join("/"),i=n(e);return o.some(d=>{let s=n(d);return s===i?true:new RegExp("^"+s.split("/").map(f=>/^\[\.\.\..+\]$/.test(f)?".+":/^\[.+\]$/.test(f)?"[^/]+":f.replace(/[.*+?^${}()|\\]/g,"\\$&")).join("/")+"$").test(i)})}import{isOverWireBudget as Vn}from"@buoy-gg/shared-ui/web";async function Mn(e,t){let o=M.getStack().findIndex(a=>a.isFocused),r=M.getActions();if(o<0||!r||typeof e.replace!="function")throw new Error("This app's history isn't captured yet, so Buoy can't start over. Open the Routes tool once, or navigate without reset.");if(o>0){let a=globalThis;await new Promise((n,i)=>{let d=l=>{clearTimeout(f),a.removeEventListener?.("popstate",s),l?n():i(new Error("The app didn't go back to its first page, so nothing was reset. Try again, or navigate without reset."))},s=()=>setTimeout(()=>d(true),0),f=setTimeout(()=>d(false),1500);a.addEventListener?.("popstate",s),r.popToTop()})}if(M.getStack().findIndex(a=>a.isFocused)!==0)throw new Error("The app isn't on its first page, so nothing was reset. Try again, or navigate without reset.");return e.replace(t),{navigated:t,replaced:true,reset:true}}var Un=16*1024,Kn=Object.freeze({__buoyOmitted:"route-params",note:"Navigation params stay on the device."});function Pt(e){return e==null?false:Vn(e,Un)}function Ke(e){return Pt(e)?Kn:e}function _n(e){return Pt(e.params)?{...e,params:Ke(e.params)}:e}function Gn(e){return Pt(e.params)?{...e,params:Ke(e.params)}:e}function Bo(){let e=wt();return{routes:ye.parseRouteTree(Ve()),source:e.source,lastUpdatedAt:e.lastLoadedAt,complete:io()}}var Jn={version:3,getSnapshot:()=>({events:me.getEvents().map(_n),sitemap:Bo(),stack:M.getStack().map(Gn)}),subscribe:e=>{let t=me.subscribeToEvents(e),o=M.subscribe(e),r=null;if(!Ve()){let a=0,n=100,i=()=>{if(a+=1,Ve()){r=null,e();return}r=a<n?setTimeout(i,100):null};r=setTimeout(i,100)}return()=>{t(),o(),r&&clearTimeout(r)}},actions:{clearEvents:()=>{me.clearEvents()},getCurrentRoute:()=>{let e=me.getEvents()[0];if(e&&me.isCapturing())return{path:e.pathname,params:Ke(e.params),at:e.timestamp,source:"event"};let t=M.getStack(),o=t.find(r=>r.isFocused)??t[t.length-1];return o?.pathname?{path:o.pathname,params:Ke(o.params??{}),at:null,source:"stack"}:e?{path:e.pathname,params:Ke(e.params),at:e.timestamp,source:"event",stale:true}:{path:null,params:{},at:null,source:null}},navigate:e=>{let t=e,o=t?.path;if(!o)throw new Error("navigate requires a 'path' param");let r=jn();if(!r){let n=M.getActions(),i=o.replace(/^\//,"");if(!n?.navigateToRoute||!i)throw new Error("expo-router is not available here and no navigation container was captured \u2014 is <RouteTracker /> mounted inside your NavigationContainer?");if(!n.navigateToRoute(i,t?.params))throw new Error(`Could not navigate to "${i}" \u2014 no navigation container is live.`);return{navigated:o,replaced:false,via:"react-navigation"}}let a=[];try{a=Bo().routes}catch{a=[]}if(io()&&Hn(o,a)===false)throw new Error(`No screen matches "${o}". Navigating there would open expo-router's "Unmatched Route" page, which replaces the app's layout (and disconnects Buoy). Read the sitemap for the paths this app has.`);if(t?.reset===true){if(typeof r.canDismiss!="function")return Mn(r,o);try{r.canDismiss()&&r.dismissAll?.()}catch{}return r.navigate(o),{navigated:o,replaced:false,reset:true}}return(t?.replace===true&&typeof r.replace=="function"?r.replace:r.navigate)(o),{navigated:o,replaced:t?.replace===true}},stackNavigateToIndex:e=>{let t=e?.index;if(typeof t!="number")throw new Error("stackNavigateToIndex requires a numeric 'index'");let o=M.getActions();if(!o)throw new Error("navigation stack is not available");return o.navigateToIndex(t),{navigatedToIndex:t}},stackPopToIndex:e=>{let t=e?.index;if(typeof t!="number")throw new Error("stackPopToIndex requires a numeric 'index'");let o=M.getActions();if(!o)throw new Error("navigation stack is not available");return o.popToIndex(t),{poppedToIndex:t}},stackGoBack:()=>{let e=M.getActions();if(!e)throw new Error("navigation stack is not available");return e.goBack(),{wentBack:true}},stackPopToTop:()=>{let e=M.getActions();if(!e)throw new Error("navigation stack is not available");return e.popToTop(),{poppedToTop:true}}}};export{ho as NavigationStack,Xt as RouteEventDetail,gt as RouteEventExpandedContent,yo as RouteEventItemCompact,It as RouteEventsModalWithTabs,qt as RouteObserver,ye as RouteParser,An as RouteTracker,Tt as RoutesSitemap,Rn as RoutesToolView,Wa as claimBrowserRouteEvents,En as createRouteEventsTool,M as navigationStackStore,Na as registerBrowserRoutes,me as routeEventStore,Jn as routeEventsSyncAdapter,xo as routeEventsToolPreset,De as routeObserver,po as useNavigationStack,Ha as useParentRoutes,ja as useRoute,Yt as useRouteEvents,Wn as useRouteObserver,On as useRouteObserverReactNavigation,Xe as useRouteSitemap};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/route-events",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.78",
|
|
4
4
|
"description": "Inspect reported navigation state and supported route actions in React Native apps using Expo Router or React Navigation.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
],
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@buoy-gg/floating-tools-core": "^7.0.
|
|
38
|
-
"@buoy-gg/shared-ui": "^7.0.
|
|
37
|
+
"@buoy-gg/floating-tools-core": "^7.0.78",
|
|
38
|
+
"@buoy-gg/shared-ui": "^7.0.78"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@buoy-gg/license": "7.0.
|
|
41
|
+
"@buoy-gg/license": "7.0.78",
|
|
42
42
|
"react": "*"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@types/react-native": "^0.73.0",
|
|
66
66
|
"expo-router": "~5.0.7",
|
|
67
67
|
"typescript": "~5.8.3",
|
|
68
|
-
"@buoy-gg/license": "^7.0.
|
|
68
|
+
"@buoy-gg/license": "^7.0.78"
|
|
69
69
|
},
|
|
70
70
|
"react-native-builder-bob": {
|
|
71
71
|
"source": "src",
|