@buoy-gg/shared-ui 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/JsModal.js +1 -1
- package/lib/commonjs/dataViewer/SplitDiffViewer.js +1 -1
- package/lib/commonjs/dataViewer/ThemedSplitView.js +1 -1
- package/lib/commonjs/dataViewer/VirtualizedDataExplorer.js +1 -1
- package/lib/commonjs/history/components/HistoryList.js +1 -1
- package/lib/commonjs/license/FreeAccountPrompt.js +1 -1
- package/lib/commonjs/settings/components/BubbleSettingsSection.js +1 -1
- package/lib/commonjs/ui/components/ChipStrip.js +1 -1
- package/lib/commonjs/ui/components/DataInspector.js +1 -1
- package/lib/commonjs/ui/components/DetailView.js +1 -1
- package/lib/commonjs/ui/components/DynamicFilterView.js +1 -1
- package/lib/commonjs/ui/components/EntityFilterView.js +1 -1
- package/lib/commonjs/ui/components/EventHistoryViewer/EventHistoryViewer.js +1 -1
- package/lib/commonjs/ui/components/EventHistoryViewer/EventPickerModal.js +1 -1
- package/lib/module/JsModal.js +1 -1
- package/lib/module/dataViewer/SplitDiffViewer.js +1 -1
- package/lib/module/dataViewer/ThemedSplitView.js +1 -1
- package/lib/module/dataViewer/VirtualizedDataExplorer.js +1 -1
- package/lib/module/history/components/HistoryList.js +1 -1
- package/lib/module/license/FreeAccountPrompt.js +1 -1
- package/lib/module/settings/components/BubbleSettingsSection.js +1 -1
- package/lib/module/ui/components/ChipStrip.js +1 -1
- package/lib/module/ui/components/DataInspector.js +1 -1
- package/lib/module/ui/components/DetailView.js +1 -1
- package/lib/module/ui/components/DynamicFilterView.js +1 -1
- package/lib/module/ui/components/EntityFilterView.js +1 -1
- package/lib/module/ui/components/EventHistoryViewer/EventHistoryViewer.js +1 -1
- package/lib/module/ui/components/EventHistoryViewer/EventPickerModal.js +1 -1
- package/lib/typescript/commonjs/JsModal.d.ts +7 -0
- package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/module/JsModal.d.ts +7 -0
- package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
- package/lib/web/chunks/chunk-BMITMQVB.mjs +3 -3
- package/lib/web/chunks/chunk-GTRVOJUH.mjs +1 -1
- package/lib/web/chunks/chunk-HE5ONCAL.mjs +6 -0
- package/lib/web/chunks/chunk-OQB3GW44.mjs +1 -0
- package/lib/web/dataViewer.mjs +2 -2
- package/lib/web/history.mjs +1 -1
- package/lib/web/index.mjs +2 -2
- package/lib/web/ui.mjs +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DynamicFilterView=DynamicFilterView;var _reactNative=require("react-native");var _react=require("react");var _index=require("../../icons/index.js");var _SectionHeader=require("./SectionHeader.js");var _FilterComponents=require("./FilterComponents.js");var _useFilterManager=require("../../hooks/useFilterManager.js");var _gameUIColors=require("../gameUI/constants/gameUIColors.js");var _nightTheme=require("../night/nightTheme.js");var _fonts=require("../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function DynamicFilterView({sections:y=[],filterSummarySection:l,addFilterSection:g,includeOnlySection:t,availableItemsSection:c,howItWorksSection:a,previewSection:d,onFilterChange:b,onPatternToggle:f,onPatternAdd:h,activePatterns:n=new Set,renderPatternMeta:C,tabs:s,activeTab:j,onTabChange:m}){const o=(0,_useFilterManager.useFilterManager)(n);const i=(0,_useFilterManager.useFilterManager)(t?.patterns||new Set);const[T,w]=(0,_react.useState)(s?.[0]?.id||"");const u=j||T;(0,_react.useEffect)(()=>{if(n.size!==o.filters.size||!Array.from(n).every(e=>o.filters.has(e))){}},[n,o.filters]);const F=()=>{if(o.newFilter.trim()&&h){h(o.newFilter.trim());o.addFilter(o.newFilter)}};const S=()=>{if(i.newFilter.trim()&&t?.onPatternAdd){t.onPatternAdd(i.newFilter.trim());i.addFilter(i.newFilter)}};const x=c?.items?.filter(e=>{return!Array.from(n).some(r=>e.includes(r))})||[];const z=()=>{if(!s||s.length===0)return null;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tabContainer,children:s.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{onPress:()=>{if(m)m(e.id);else w(e.id)},style:[styles.tabButton,u===e.id?styles.tabButtonActive:styles.tabButtonInactive],children:[e.icon&&(0,_jsxRuntime.jsx)(e.icon,{size:14,color:u===e.id?_gameUIColors.buoyColors.primary:_nightTheme.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.tabButtonText,u===e.id?styles.tabButtonTextActive:styles.tabButtonTextInactive],children:e.label}),e.count!==void 0&&e.count>0&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tabBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tabBadgeText,children:e.count})})]},e.id))})};const I=e=>{if(e.type==="custom"&&e.renderCustom){return e.renderCustom()}if(e.type==="patterns"){return null}if(!e.data||e.data.length===0)return null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[e.icon&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:e.icon,color:e.color||_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:e.title})]}),e.description&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionDescription,children:e.description}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.filterGrid,children:e.data.map(r=>{const p=r.count!==void 0;const v=p&&r.count===0;const B=e.type!=="method"||r.icon;return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{testID:`buoy-filter-option-${r.id}`,accessibilityRole:"button",accessibilityLabel:String(r.label??r.id),style:[styles.filterCard,r.isActive&&styles.activeFilterCard],onPress:()=>b?.(r.id,r.value),children:[r.icon?(0,_jsxRuntime.jsx)(r.icon,{size:24,color:r.color,style:styles.filterIcon}):e.type==="method"?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.methodBadgeCompact,{backgroundColor:`${r.color}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.methodTextCompact,{color:r.color}],numberOfLines:1,adjustsFontSizeToFit:true,minimumFontScale:.8,children:r.label})}):null,p&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[v?styles.filterCountZero:styles.filterCountActive],children:r.count}),B&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.filterLabelCompact,children:r.label}),r.description&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.filterDescriptionBottom,children:r.description})]},r.id)})})]},e.id)};const H=()=>{if(s&&u){const e=s.find(r=>r.id===u);if(e?.content){return e.content()}}return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[l?.enabled&&(l.includePatterns?.size||l.excludePatterns?.size)?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.filterSummarySection,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.filterSummaryHeader,children:[(0,_jsxRuntime.jsx)(_index.Info,{size:14,color:_gameUIColors.buoyColors.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.filterSummaryTitle,children:"Filters Active"})]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.filterSummaryText,children:["Showing ",l.filteredCount," of ",l.totalCount," queries",l.includePatterns?.size?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.filterSummaryInclude,children:[" ","\u2022 Including: ",Array.from(l.includePatterns).join(", ")]}):null,l.excludePatterns?.size?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.filterSummaryExclude,children:[" ","\u2022 Excluding: ",Array.from(l.excludePatterns).join(", ")]}):null]})]}):null,y.map(I),t?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.includeOnlySection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:t.icon||_index.Eye,color:_gameUIColors.buoyColors.success,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:t.title||"INCLUDE ONLY FILTERS"}),t.patterns.size>0&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:t.patterns.size,color:_gameUIColors.buoyColors.success})]}),t.description&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.includeOnlyDescription,children:t.description}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.includeOnlyInputWrapper,children:!i.showAddInput?(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterButton,{onPress:()=>i.setShowAddInput(true),color:_gameUIColors.buoyColors.success,label:"Add include pattern",testID:"buoy-filter-include-add-open"}):(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterInput,{value:i.newFilter,onChange:i.setNewFilter,onSubmit:S,onCancel:()=>{i.setShowAddInput(false);i.setNewFilter("")},placeholder:t.placeholder||"Enter pattern to include...",color:_gameUIColors.buoyColors.success,testID:"buoy-filter-include-input"})}),t.patterns.size>0&&(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{testID:"buoy-filter-include-scroll",style:styles.includeOnlyFiltersContent,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,children:(0,_jsxRuntime.jsx)(_FilterComponents.FilterList,{filters:t.patterns,onRemoveFilter:t.onPatternToggle,color:_gameUIColors.buoyColors.success,renderItemMeta:t.renderPatternMeta})})]}),g?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.excludeFiltersSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:_index.Filter,color:_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:g.title||"EXCLUDE FILTERS"}),n.size>0&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:n.size,color:_gameUIColors.buoyColors.primary})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.excludeFiltersDescription,children:"Hide queries matching these patterns from the list."}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.excludeFiltersInputWrapper,children:!o.showAddInput?(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterButton,{onPress:()=>o.setShowAddInput(true),color:_gameUIColors.buoyColors.primary,label:"Add exclude pattern"}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[g.renderExtra?.(),(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterInput,{value:o.newFilter,onChange:o.setNewFilter,onSubmit:F,onCancel:()=>{o.setShowAddInput(false);o.setNewFilter("")},placeholder:g.placeholder||"Enter pattern to exclude...",color:_gameUIColors.buoyColors.primary})]})}),n.size>0&&(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{testID:"buoy-filter-active-scroll",style:styles.excludeFiltersContent,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,children:(0,_jsxRuntime.jsx)(_FilterComponents.FilterList,{filters:n,onRemoveFilter:f,color:_gameUIColors.buoyColors.primary,renderItemMeta:C})})]}),c?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.availableKeysSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:c.icon||_index.Plus,color:_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:c.title||"AVAILABLE ITEMS"}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:x.length,color:_gameUIColors.buoyColors.primary})]}),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.availableKeysScroll,horizontal:false,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,scrollEnabled:true,children:x.length>0?x.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{onPress:()=>{if(h){h(e);o.addFilter(e)}},style:styles.availableKeyItem,"sentry-label":"ignore-touchable-opacity",testID:`buoy-filter-available-${e}`,accessibilityRole:"button",accessibilityLabel:`Add filter ${e}`,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.availableKeyText,numberOfLines:1,children:e}),(0,_jsxRuntime.jsx)(_index.Plus,{size:12,color:_gameUIColors.buoyColors.primary})]},e)):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyStateText,children:c.emptyMessage||"No items available"})})]}),a?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.howItWorksSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:a.icon||_index.Filter,color:_nightTheme.night.color.textSecondary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:a.title||"HOW FILTERS WORK"})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.howItWorksText,children:a.description||"Filters help you focus on relevant data by hiding unwanted items."}),a.examples&&a.examples.length>0&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.examplesContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.examplesTitle,children:"EXAMPLES:"}),a.examples.map((e,r)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.exampleItem,children:e},r))]})]}),d?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.previewSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:d.icon||_index.Copy,color:_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:d.title||"PREVIEW"}),d.headerActions&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Actions,{children:d.headerActions()})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.previewContent,children:d.content()})]})]})};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[z(),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{testID:"buoy-filter-scroll",style:styles.content,contentContainerStyle:styles.scrollContent,showsVerticalScrollIndicator:false,"sentry-label":"ignore-scrollview",children:H()})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},content:{flex:1},scrollContent:{paddingTop:16,paddingHorizontal:16,paddingBottom:24},tabContainer:{flexDirection:"row",paddingHorizontal:16,paddingVertical:12,gap:8,backgroundColor:_nightTheme.night.color.surface,borderBottomWidth:1,borderBottomColor:_nightTheme.night.color.border},tabButton:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,paddingHorizontal:16,borderRadius:8,borderWidth:1},tabButtonActive:{backgroundColor:_gameUIColors.buoyColors.primary+"20",borderColor:_gameUIColors.buoyColors.primary,borderWidth:2},tabButtonInactive:{backgroundColor:_nightTheme.night.color.surfaceElevated,borderColor:_nightTheme.night.color.border},tabButtonText:{fontSize:11,fontWeight:"600",letterSpacing:.5},tabButtonTextActive:{color:_gameUIColors.buoyColors.primary},tabButtonTextInactive:{color:_nightTheme.night.color.textTertiary},tabBadge:{backgroundColor:_gameUIColors.buoyColors.primary+"40",paddingHorizontal:6,paddingVertical:1,borderRadius:8,minWidth:18,alignItems:"center"},tabBadgeText:{fontSize:9,color:_gameUIColors.buoyColors.primary,fontWeight:"700"},section:{marginBottom:8},filterInputWrapper:{marginBottom:4},filterGrid:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:8},filterCard:{backgroundColor:_nightTheme.night.color.surface,borderRadius:12,paddingHorizontal:8,paddingVertical:10,flexDirection:"column",alignItems:"center",justifyContent:"center",borderWidth:1,borderColor:_nightTheme.night.color.border,width:72,minHeight:68},activeFilterCard:{backgroundColor:_gameUIColors.buoyColors.primary+"33",borderColor:_gameUIColors.buoyColors.primary,borderWidth:2,shadowColor:_gameUIColors.buoyColors.primary,shadowOffset:{width:0,height:0},shadowOpacity:.3,shadowRadius:8,elevation:4},filterIcon:{marginBottom:0},filterCountActive:{fontSize:14,fontWeight:"700",color:_nightTheme.night.color.text,fontFamily:_fonts.monoFont,marginTop:3,marginBottom:1,textShadowColor:"rgba(0, 0, 0, 0.2)",textShadowOffset:{width:0,height:.5},textShadowRadius:1},filterCountZero:{fontSize:11,fontWeight:"500",color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,marginTop:3,marginBottom:1},filterLabelCompact:{fontSize:10,color:_nightTheme.night.color.text,fontWeight:"600",textAlign:"center",textTransform:"capitalize",textShadowColor:"rgba(0, 0, 0, 0.3)",textShadowOffset:{width:0,height:.5},textShadowRadius:1},filterDescriptionBottom:{fontSize:8,color:_nightTheme.night.color.textTertiary,textAlign:"center",marginTop:2,lineHeight:11},sectionDescription:{fontSize:10,color:_nightTheme.night.color.textSecondary,marginTop:4,marginBottom:4,lineHeight:14},methodBadgeCompact:{paddingHorizontal:8,paddingVertical:4,borderRadius:5,minWidth:48,maxWidth:60,alignItems:"center",justifyContent:"center"},methodTextCompact:{fontSize:13,fontWeight:"700",letterSpacing:.3,fontFamily:_fonts.monoFont},activeFiltersSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},activeFiltersContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:16,maxHeight:200},includeOnlySection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},includeOnlyDescription:{fontSize:10,color:_nightTheme.night.color.textSecondary,paddingHorizontal:16,paddingTop:8,lineHeight:14},includeOnlyInputWrapper:{paddingHorizontal:16,paddingTop:8,paddingBottom:8},includeOnlyFiltersContent:{paddingHorizontal:16,paddingBottom:16,maxHeight:150},excludeFiltersSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},excludeFiltersDescription:{fontSize:10,color:_nightTheme.night.color.textSecondary,paddingHorizontal:16,paddingTop:8,lineHeight:14},excludeFiltersInputWrapper:{paddingHorizontal:16,paddingTop:8,paddingBottom:8},excludeFiltersContent:{paddingHorizontal:16,paddingBottom:16,maxHeight:150},filterSummarySection:{backgroundColor:_gameUIColors.buoyColors.warning+"15",borderRadius:8,borderWidth:1,borderColor:_gameUIColors.buoyColors.warning+"40",padding:12,marginBottom:12},filterSummaryHeader:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:6},filterSummaryTitle:{fontSize:12,fontWeight:"600",color:_gameUIColors.buoyColors.warning},filterSummaryText:{fontSize:11,color:_nightTheme.night.color.text,lineHeight:16},filterSummaryInclude:{color:_gameUIColors.buoyColors.success,fontWeight:"500"},filterSummaryExclude:{color:_gameUIColors.buoyColors.primary,fontWeight:"500"},emptyStateText:{fontSize:11,color:_nightTheme.night.color.textTertiary,fontStyle:"italic",textAlign:"center",paddingVertical:12},availableKeysSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},availableKeysScroll:{maxHeight:150,paddingHorizontal:16,paddingTop:8,paddingBottom:16},availableKeyItem:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,paddingHorizontal:12,backgroundColor:_nightTheme.night.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border,marginBottom:8},availableKeyText:{flex:1,fontSize:11,color:_nightTheme.night.color.text,fontFamily:_fonts.monoFont,marginRight:8},howItWorksSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},howItWorksText:{fontSize:11,color:_nightTheme.night.color.textSecondary,lineHeight:16,marginBottom:12,marginTop:8,paddingHorizontal:16,fontFamily:_fonts.monoFont},examplesContainer:{paddingTop:8,paddingHorizontal:16,paddingBottom:16,borderTopWidth:1,borderTopColor:_nightTheme.night.color.border},examplesTitle:{fontSize:10,fontWeight:"600",color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,letterSpacing:.5,marginBottom:6},exampleItem:{fontSize:10,color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,lineHeight:16},previewSection:{backgroundColor:_nightTheme.night.color.surfaceElevated,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.fillTertiary,marginTop:16,overflow:"hidden"},previewContent:{paddingHorizontal:16,paddingTop:12,paddingBottom:16,backgroundColor:_nightTheme.night.color.bg,marginHorizontal:12,marginBottom:12,borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DynamicFilterView=DynamicFilterView;var _reactNative=require("react-native");var _react=require("react");var _index=require("../../icons/index.js");var _SectionHeader=require("./SectionHeader.js");var _FilterComponents=require("./FilterComponents.js");var _useFilterManager=require("../../hooks/useFilterManager.js");var _gameUIColors=require("../gameUI/constants/gameUIColors.js");var _nightTheme=require("../night/nightTheme.js");var _fonts=require("../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function DynamicFilterView({sections:y=[],filterSummarySection:l,addFilterSection:h,includeOnlySection:t,availableItemsSection:c,howItWorksSection:a,previewSection:d,onFilterChange:b,onPatternToggle:f,onPatternAdd:g,activePatterns:n=new Set,renderPatternMeta:C,tabs:s,activeTab:T,onTabChange:p}){const o=(0,_useFilterManager.useFilterManager)(n);const i=(0,_useFilterManager.useFilterManager)(t?.patterns||new Set);const[j,w]=(0,_react.useState)(s?.[0]?.id||"");const u=T||j;(0,_react.useEffect)(()=>{if(n.size!==o.filters.size||!Array.from(n).every(e=>o.filters.has(e))){}},[n,o.filters]);const S=()=>{if(o.newFilter.trim()&&g){g(o.newFilter.trim());o.addFilter(o.newFilter)}};const F=()=>{if(i.newFilter.trim()&&t?.onPatternAdd){t.onPatternAdd(i.newFilter.trim());i.addFilter(i.newFilter)}};const x=c?.items?.filter(e=>{return!Array.from(n).some(r=>e.includes(r))})||[];const z=()=>{if(!s||s.length===0)return null;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tabContainer,children:s.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{onPress:()=>{if(p)p(e.id);else w(e.id)},style:[styles.tabButton,u===e.id?styles.tabButtonActive:styles.tabButtonInactive],children:[e.icon&&(0,_jsxRuntime.jsx)(e.icon,{size:14,color:u===e.id?_gameUIColors.buoyColors.primary:_nightTheme.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.tabButtonText,u===e.id?styles.tabButtonTextActive:styles.tabButtonTextInactive],children:e.label}),e.count!==void 0&&e.count>0&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tabBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tabBadgeText,children:e.count})})]},e.id))})};const I=e=>{if(e.type==="custom"&&e.renderCustom){return e.renderCustom()}if(e.type==="patterns"){return null}if(!e.data||e.data.length===0)return null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[e.icon&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:e.icon,color:e.color||_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:e.title})]}),e.description&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionDescription,children:e.description}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.filterGrid,children:e.data.map(r=>{const m=r.count!==void 0;const v=m&&r.count===0;const B=e.type!=="method"||r.icon;return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{testID:`buoy-filter-option-${r.id}`,accessibilityRole:"button",accessibilityLabel:String(r.label??r.id),style:[styles.filterCard,r.isActive&&styles.activeFilterCard],onPress:()=>b?.(r.id,r.value),children:[r.icon?(0,_jsxRuntime.jsx)(r.icon,{size:24,color:r.color,style:styles.filterIcon}):e.type==="method"?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.methodBadgeCompact,{backgroundColor:`${r.color}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.methodTextCompact,{color:r.color}],numberOfLines:1,adjustsFontSizeToFit:true,minimumFontScale:.8,children:r.label})}):null,m&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[v?styles.filterCountZero:styles.filterCountActive],children:r.count}),B&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.filterLabelCompact,children:r.label}),r.description&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.filterDescriptionBottom,children:r.description})]},r.id)})})]},e.id)};const H=()=>{if(s&&u){const e=s.find(r=>r.id===u);if(e?.content){return e.content()}}return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[l?.enabled&&(l.includePatterns?.size||l.excludePatterns?.size)?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.filterSummarySection,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.filterSummaryHeader,children:[(0,_jsxRuntime.jsx)(_index.Info,{size:14,color:_gameUIColors.buoyColors.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.filterSummaryTitle,children:"Filters Active"})]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.filterSummaryText,children:["Showing ",l.filteredCount," of ",l.totalCount," queries",l.includePatterns?.size?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.filterSummaryInclude,children:[" ","\u2022 Including: ",Array.from(l.includePatterns).join(", ")]}):null,l.excludePatterns?.size?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.filterSummaryExclude,children:[" ","\u2022 Excluding: ",Array.from(l.excludePatterns).join(", ")]}):null]})]}):null,y.map(I),t?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.includeOnlySection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:t.icon||_index.Eye,color:_gameUIColors.buoyColors.success,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:t.title||"INCLUDE ONLY FILTERS"}),t.patterns.size>0&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:t.patterns.size,color:_gameUIColors.buoyColors.success})]}),t.description&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.includeOnlyDescription,children:t.description}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.includeOnlyInputWrapper,children:!i.showAddInput?(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterButton,{onPress:()=>i.setShowAddInput(true),color:_gameUIColors.buoyColors.success,label:"Add include pattern",testID:"buoy-filter-include-add-open"}):(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterInput,{value:i.newFilter,onChange:i.setNewFilter,onSubmit:F,onCancel:()=>{i.setShowAddInput(false);i.setNewFilter("")},placeholder:t.placeholder||"Enter pattern to include...",color:_gameUIColors.buoyColors.success,testID:"buoy-filter-include-input"})}),t.patterns.size>0&&(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",testID:"buoy-filter-include-scroll",style:styles.includeOnlyFiltersContent,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,children:(0,_jsxRuntime.jsx)(_FilterComponents.FilterList,{filters:t.patterns,onRemoveFilter:t.onPatternToggle,color:_gameUIColors.buoyColors.success,renderItemMeta:t.renderPatternMeta})})]}),h?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.excludeFiltersSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:_index.Filter,color:_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:h.title||"EXCLUDE FILTERS"}),n.size>0&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:n.size,color:_gameUIColors.buoyColors.primary})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.excludeFiltersDescription,children:"Hide queries matching these patterns from the list."}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.excludeFiltersInputWrapper,children:!o.showAddInput?(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterButton,{onPress:()=>o.setShowAddInput(true),color:_gameUIColors.buoyColors.primary,label:"Add exclude pattern"}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[h.renderExtra?.(),(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterInput,{value:o.newFilter,onChange:o.setNewFilter,onSubmit:S,onCancel:()=>{o.setShowAddInput(false);o.setNewFilter("")},placeholder:h.placeholder||"Enter pattern to exclude...",color:_gameUIColors.buoyColors.primary})]})}),n.size>0&&(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",testID:"buoy-filter-active-scroll",style:styles.excludeFiltersContent,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,children:(0,_jsxRuntime.jsx)(_FilterComponents.FilterList,{filters:n,onRemoveFilter:f,color:_gameUIColors.buoyColors.primary,renderItemMeta:C})})]}),c?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.availableKeysSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:c.icon||_index.Plus,color:_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:c.title||"AVAILABLE ITEMS"}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:x.length,color:_gameUIColors.buoyColors.primary})]}),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.availableKeysScroll,horizontal:false,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,scrollEnabled:true,children:x.length>0?x.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{onPress:()=>{if(g){g(e);o.addFilter(e)}},style:styles.availableKeyItem,"sentry-label":"ignore-touchable-opacity",testID:`buoy-filter-available-${e}`,accessibilityRole:"button",accessibilityLabel:`Add filter ${e}`,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.availableKeyText,numberOfLines:1,children:e}),(0,_jsxRuntime.jsx)(_index.Plus,{size:12,color:_gameUIColors.buoyColors.primary})]},e)):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyStateText,children:c.emptyMessage||"No items available"})})]}),a?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.howItWorksSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:a.icon||_index.Filter,color:_nightTheme.night.color.textSecondary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:a.title||"HOW FILTERS WORK"})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.howItWorksText,children:a.description||"Filters help you focus on relevant data by hiding unwanted items."}),a.examples&&a.examples.length>0&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.examplesContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.examplesTitle,children:"EXAMPLES:"}),a.examples.map((e,r)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.exampleItem,children:e},r))]})]}),d?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.previewSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:d.icon||_index.Copy,color:_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:d.title||"PREVIEW"}),d.headerActions&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Actions,{children:d.headerActions()})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.previewContent,children:d.content()})]})]})};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[z(),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",testID:"buoy-filter-scroll",style:styles.content,contentContainerStyle:styles.scrollContent,showsVerticalScrollIndicator:false,"sentry-label":"ignore-scrollview",children:H()})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},content:{flex:1},scrollContent:{paddingTop:16,paddingHorizontal:16,paddingBottom:24},tabContainer:{flexDirection:"row",paddingHorizontal:16,paddingVertical:12,gap:8,backgroundColor:_nightTheme.night.color.surface,borderBottomWidth:1,borderBottomColor:_nightTheme.night.color.border},tabButton:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,paddingHorizontal:16,borderRadius:8,borderWidth:1},tabButtonActive:{backgroundColor:_gameUIColors.buoyColors.primary+"20",borderColor:_gameUIColors.buoyColors.primary,borderWidth:2},tabButtonInactive:{backgroundColor:_nightTheme.night.color.surfaceElevated,borderColor:_nightTheme.night.color.border},tabButtonText:{fontSize:11,fontWeight:"600",letterSpacing:.5},tabButtonTextActive:{color:_gameUIColors.buoyColors.primary},tabButtonTextInactive:{color:_nightTheme.night.color.textTertiary},tabBadge:{backgroundColor:_gameUIColors.buoyColors.primary+"40",paddingHorizontal:6,paddingVertical:1,borderRadius:8,minWidth:18,alignItems:"center"},tabBadgeText:{fontSize:9,color:_gameUIColors.buoyColors.primary,fontWeight:"700"},section:{marginBottom:8},filterInputWrapper:{marginBottom:4},filterGrid:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:8},filterCard:{backgroundColor:_nightTheme.night.color.surface,borderRadius:12,paddingHorizontal:8,paddingVertical:10,flexDirection:"column",alignItems:"center",justifyContent:"center",borderWidth:1,borderColor:_nightTheme.night.color.border,width:72,minHeight:68},activeFilterCard:{backgroundColor:_gameUIColors.buoyColors.primary+"33",borderColor:_gameUIColors.buoyColors.primary,borderWidth:2,shadowColor:_gameUIColors.buoyColors.primary,shadowOffset:{width:0,height:0},shadowOpacity:.3,shadowRadius:8,elevation:4},filterIcon:{marginBottom:0},filterCountActive:{fontSize:14,fontWeight:"700",color:_nightTheme.night.color.text,fontFamily:_fonts.monoFont,marginTop:3,marginBottom:1,textShadowColor:"rgba(0, 0, 0, 0.2)",textShadowOffset:{width:0,height:.5},textShadowRadius:1},filterCountZero:{fontSize:11,fontWeight:"500",color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,marginTop:3,marginBottom:1},filterLabelCompact:{fontSize:10,color:_nightTheme.night.color.text,fontWeight:"600",textAlign:"center",textTransform:"capitalize",textShadowColor:"rgba(0, 0, 0, 0.3)",textShadowOffset:{width:0,height:.5},textShadowRadius:1},filterDescriptionBottom:{fontSize:8,color:_nightTheme.night.color.textTertiary,textAlign:"center",marginTop:2,lineHeight:11},sectionDescription:{fontSize:10,color:_nightTheme.night.color.textSecondary,marginTop:4,marginBottom:4,lineHeight:14},methodBadgeCompact:{paddingHorizontal:8,paddingVertical:4,borderRadius:5,minWidth:48,maxWidth:60,alignItems:"center",justifyContent:"center"},methodTextCompact:{fontSize:13,fontWeight:"700",letterSpacing:.3,fontFamily:_fonts.monoFont},activeFiltersSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},activeFiltersContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:16,maxHeight:200},includeOnlySection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},includeOnlyDescription:{fontSize:10,color:_nightTheme.night.color.textSecondary,paddingHorizontal:16,paddingTop:8,lineHeight:14},includeOnlyInputWrapper:{paddingHorizontal:16,paddingTop:8,paddingBottom:8},includeOnlyFiltersContent:{paddingHorizontal:16,paddingBottom:16,maxHeight:150},excludeFiltersSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},excludeFiltersDescription:{fontSize:10,color:_nightTheme.night.color.textSecondary,paddingHorizontal:16,paddingTop:8,lineHeight:14},excludeFiltersInputWrapper:{paddingHorizontal:16,paddingTop:8,paddingBottom:8},excludeFiltersContent:{paddingHorizontal:16,paddingBottom:16,maxHeight:150},filterSummarySection:{backgroundColor:_gameUIColors.buoyColors.warning+"15",borderRadius:8,borderWidth:1,borderColor:_gameUIColors.buoyColors.warning+"40",padding:12,marginBottom:12},filterSummaryHeader:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:6},filterSummaryTitle:{fontSize:12,fontWeight:"600",color:_gameUIColors.buoyColors.warning},filterSummaryText:{fontSize:11,color:_nightTheme.night.color.text,lineHeight:16},filterSummaryInclude:{color:_gameUIColors.buoyColors.success,fontWeight:"500"},filterSummaryExclude:{color:_gameUIColors.buoyColors.primary,fontWeight:"500"},emptyStateText:{fontSize:11,color:_nightTheme.night.color.textTertiary,fontStyle:"italic",textAlign:"center",paddingVertical:12},availableKeysSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},availableKeysScroll:{maxHeight:150,paddingHorizontal:16,paddingTop:8,paddingBottom:16},availableKeyItem:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,paddingHorizontal:12,backgroundColor:_nightTheme.night.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border,marginBottom:8},availableKeyText:{flex:1,fontSize:11,color:_nightTheme.night.color.text,fontFamily:_fonts.monoFont,marginRight:8},howItWorksSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},howItWorksText:{fontSize:11,color:_nightTheme.night.color.textSecondary,lineHeight:16,marginBottom:12,marginTop:8,paddingHorizontal:16,fontFamily:_fonts.monoFont},examplesContainer:{paddingTop:8,paddingHorizontal:16,paddingBottom:16,borderTopWidth:1,borderTopColor:_nightTheme.night.color.border},examplesTitle:{fontSize:10,fontWeight:"600",color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,letterSpacing:.5,marginBottom:6},exampleItem:{fontSize:10,color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,lineHeight:16},previewSection:{backgroundColor:_nightTheme.night.color.surfaceElevated,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.fillTertiary,marginTop:16,overflow:"hidden"},previewContent:{paddingHorizontal:16,paddingTop:12,paddingBottom:16,backgroundColor:_nightTheme.night.color.bg,marginHorizontal:12,marginBottom:12,borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EntityFilterView=EntityFilterView;var _react=require("react");var _reactNative=require("react-native");var _index=require("../../icons/index.js");var _nightTheme=require("../night/nightTheme.js");var _SectionHeader=require("./SectionHeader.js");var _FilterComponents=require("./FilterComponents.js");var _fonts=require("../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function isHidden(o,n){return Array.from(n).some(i=>o.name.toLowerCase().includes(i.toLowerCase()))}function colorForPattern(o,n){const i=n.find(l=>l.name.toLowerCase()===o.toLowerCase());return i?i.color:null}function EntityFilterView({entities:o,ignoredPatterns:n,onTogglePattern:i,onAddPattern:l,entityNoun:h,entitySingular:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EntityFilterView=EntityFilterView;var _react=require("react");var _reactNative=require("react-native");var _index=require("../../icons/index.js");var _nightTheme=require("../night/nightTheme.js");var _SectionHeader=require("./SectionHeader.js");var _FilterComponents=require("./FilterComponents.js");var _fonts=require("../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function isHidden(o,n){return Array.from(n).some(i=>o.name.toLowerCase().includes(i.toLowerCase()))}function colorForPattern(o,n){const i=n.find(l=>l.name.toLowerCase()===o.toLowerCase());return i?i.color:null}function EntityFilterView({entities:o,ignoredPatterns:n,onTogglePattern:i,onAddPattern:l,entityNoun:h,entitySingular:d,entityKey:a,testIDPrefix:r,slug:p,howItWorks:u,examples:m,addPlaceholder:y,emptyMessage:x}){const[T,c]=(0,_react.useState)(false);const[g,s]=(0,_react.useState)("");const b=()=>{const e=g.trim();if(e){l(e);s("");c(false)}};return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",style:styles.container,contentContainerStyle:styles.scrollContent,showsVerticalScrollIndicator:false,nestedScrollEnabled:true,testID:`${r}-filters-scroll`,children:[o.length===0&&x?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader,{children:(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader.Title,{children:["REGISTERED ",h]})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyText,testID:`${r}-filters-${a}s-empty`,children:x})]}):null,o.length>0&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader.Title,{children:["REGISTERED ",h]}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:o.length,color:_nightTheme.night.color.accent,testID:`${r}-filters-${a}-count`})]}),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",style:styles.entityList,contentContainerStyle:styles.entityListContent,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,testID:`${r}-filters-${a}-list`,children:o.map(e=>{const t=isHidden(e,n);return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.entityRow,t&&styles.entityRowHidden],onPress:()=>l(e.name),disabled:t,testID:`${r}-filters-${a}-${p(e.name)}`,accessibilityRole:"button",accessibilityLabel:`Hide ${e.name}`,accessibilityState:{disabled:t},children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.dot,{backgroundColor:t?_nightTheme.night.color.textTertiary:e.color}]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.entityText,t?styles.entityTextHidden:{color:e.color}],numberOfLines:1,children:e.name}),t?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.hiddenLabel,children:"hidden"}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.addLabel,{color:e.color+"99"}],children:"+ hide"})]},e.name)})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:_index.Filter,color:_nightTheme.night.color.accent,size:12}),(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader.Title,{children:[d.toUpperCase()," NAME FILTERS"]}),n.size>0&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:n.size,color:_nightTheme.night.color.accent,testID:`${r}-filters-count`})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.addInputWrapper,children:!T?(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterButton,{onPress:()=>c(true),color:_nightTheme.night.color.accent,label:`Add ${d} name pattern`,testID:`${r}-filters-add-open`}):(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterInput,{value:g,onChange:s,onSubmit:b,onCancel:()=>{c(false);s("")},placeholder:y??`Enter ${d} name pattern to hide...`,color:_nightTheme.night.color.accent,testID:`${r}-filters-add-input`})}),n.size>0&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.patternList,children:Array.from(n).map(e=>{const t=colorForPattern(e,o);return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.patternRow,onPress:()=>i(e),activeOpacity:.8,testID:`${r}-filters-chip-${p(e)}`,accessibilityRole:"button",accessibilityLabel:`Remove filter ${e}`,children:[t?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.dot,{backgroundColor:t}]}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.patternText,t?{color:t}:null],numberOfLines:1,children:e}),(0,_jsxRuntime.jsx)(_index.X,{size:12,color:_nightTheme.night.color.accent+"80"})]},e)})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:_index.Filter,color:_nightTheme.night.color.textSecondary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:"HOW EVENT FILTERS WORK"})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.howItWorksText,children:u}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.examplesContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.examplesTitle,children:"EXAMPLES:"}),m.map(e=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.exampleItem,children:e},e))]})]})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},scrollContent:{paddingTop:16,paddingHorizontal:16,paddingBottom:24,gap:16},section:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,overflow:"hidden"},entityList:{maxHeight:180},entityListContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:16,gap:10},entityRow:{flexDirection:"row",alignItems:"center",gap:10,paddingVertical:10,paddingHorizontal:12,backgroundColor:_nightTheme.night.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border},entityRowHidden:{opacity:.45},dot:{width:7,height:7,borderRadius:3.5},entityText:{flex:1,fontSize:12,fontWeight:"600",fontFamily:_fonts.monoFont},entityTextHidden:{color:_nightTheme.night.color.textTertiary,textDecorationLine:"line-through"},hiddenLabel:{fontSize:10,fontWeight:"500",color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont},addLabel:{fontSize:10,fontWeight:"600",fontFamily:_fonts.monoFont},addInputWrapper:{paddingHorizontal:16,paddingTop:8,paddingBottom:8},patternList:{paddingHorizontal:16,paddingBottom:16,gap:8},patternRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,paddingHorizontal:12,backgroundColor:_nightTheme.night.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border,gap:8},patternText:{flex:1,fontSize:12,fontFamily:_fonts.monoFont,color:_nightTheme.night.color.text},emptyText:{fontSize:11,color:_nightTheme.night.color.textTertiary,paddingHorizontal:16,paddingTop:8,paddingBottom:16,fontFamily:_fonts.monoFont},howItWorksText:{fontSize:11,color:_nightTheme.night.color.textSecondary,lineHeight:16,marginTop:8,paddingHorizontal:16,fontFamily:_fonts.monoFont},examplesContainer:{paddingTop:8,paddingHorizontal:16,paddingBottom:16,borderTopWidth:1,borderTopColor:_nightTheme.night.color.border,marginTop:12},examplesTitle:{fontSize:10,fontWeight:"600",color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,letterSpacing:.5,marginBottom:6},exampleItem:{fontSize:10,color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,lineHeight:16}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EventHistoryViewer=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _macOSDesignSystemColors=require("../../gameUI/constants/macOSDesignSystemColors.js");var _EventStepperFooter=require("../EventStepperFooter.js");var _ViewToggleCards=require("./ViewToggleCards.js");var _DiffModeTabs=require("./DiffModeTabs.js");var _CompareBar=require("./CompareBar.js");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(a,n){if("function"==typeof WeakMap)var i=new WeakMap,u=new WeakMap;return(_interopRequireWildcard=function(e,c){if(!c&&e&&e.__esModule)return e;var r,s,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(r=c?u:i){if(r.has(e))return r.get(e);r.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((s=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(s.get||s.set)?r(o,t,s):o[t]=e[t]);return o})(a,n)}function DiffSectionContainer({scrolls:a,style:n,children:i}){if(!a)return(0,_jsxRuntime.jsx)(_reactNative.View,{style:n,children:i});return(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.contentScroll,contentContainerStyle:styles.contentScrollInner,showsVerticalScrollIndicator:true,children:i})}const EventHistoryViewer=exports.EventHistoryViewer=(0,_react.memo)(function a({activeView:n,onViewChange:i,currentViewLabel:u,currentViewDescription:e,currentViewIcon:c,diffViewLabel:r,diffViewDescription:s,diffViewIcon:o,renderCurrentView:t,diffModeTabs:l,activeDiffMode:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EventHistoryViewer=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _macOSDesignSystemColors=require("../../gameUI/constants/macOSDesignSystemColors.js");var _EventStepperFooter=require("../EventStepperFooter.js");var _ViewToggleCards=require("./ViewToggleCards.js");var _DiffModeTabs=require("./DiffModeTabs.js");var _CompareBar=require("./CompareBar.js");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(a,n){if("function"==typeof WeakMap)var i=new WeakMap,u=new WeakMap;return(_interopRequireWildcard=function(e,c){if(!c&&e&&e.__esModule)return e;var r,s,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(r=c?u:i){if(r.has(e))return r.get(e);r.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((s=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(s.get||s.set)?r(o,t,s):o[t]=e[t]);return o})(a,n)}function DiffSectionContainer({scrolls:a,style:n,children:i}){if(!a)return(0,_jsxRuntime.jsx)(_reactNative.View,{style:n,children:i});return(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",style:styles.contentScroll,contentContainerStyle:styles.contentScrollInner,showsVerticalScrollIndicator:true,children:i})}const EventHistoryViewer=exports.EventHistoryViewer=(0,_react.memo)(function a({activeView:n,onViewChange:i,currentViewLabel:u,currentViewDescription:e,currentViewIcon:c,diffViewLabel:r,diffViewDescription:s,diffViewIcon:o,renderCurrentView:t,diffModeTabs:l,activeDiffMode:x,onDiffModeChange:p,renderDiffContent:g,leftEvent:y,rightEvent:S,showCompareNavigation:j,onLeftPrevious:w,onLeftNext:b,onRightPrevious:m,onRightNext:_,canLeftPrevious:V,canLeftNext:C,canRightPrevious:P,canRightNext:q,onLeftPickerOpen:E,onRightPickerOpen:k,scrollDiffSection:v,disableInternalFooter:h,footerCurrentIndex:D,footerTotalItems:d,footerItemLabel:H,footerSubtitle:L,onFooterPrevious:O,onFooterNext:I}){const f=t!=null;const N=d<=1;return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,{paddingBottom:!h&&d>1?96:0}],children:[f&&(0,_jsxRuntime.jsx)(_ViewToggleCards.ViewToggleCards,{activeView:n,onViewChange:i??(()=>{}),currentLabel:u??"",currentDescription:e??"",currentIcon:c,diffLabel:r,diffDescription:s,diffIcon:o,diffDisabled:N}),f&&n==="current"&&(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",style:styles.contentScroll,contentContainerStyle:styles.contentScrollInner,showsVerticalScrollIndicator:true,children:t?.()}),(!f||n==="diff")&&(0,_jsxRuntime.jsxs)(DiffSectionContainer,{scrolls:v,style:styles.contentSection,children:[l&&l.length>0&&p&&(0,_jsxRuntime.jsx)(_DiffModeTabs.DiffModeTabs,{tabs:l,activeTab:x??l[0]?.key??"",onTabChange:p}),(0,_jsxRuntime.jsx)(_CompareBar.CompareBar,{leftEvent:y,rightEvent:S,showNavigation:j,onLeftPrevious:w,onLeftNext:b,onRightPrevious:m,onRightNext:_,canLeftPrevious:V,canLeftNext:C,canRightPrevious:P,canRightNext:q,onLeftPress:E,onRightPress:k}),v?g():(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.diffContent,children:g()})]})]}),!h&&(0,_jsxRuntime.jsx)(_EventStepperFooter.EventStepperFooter,{currentIndex:D,totalItems:d,onPrevious:O,onNext:I,itemLabel:H,subtitle:L,absolute:true})]})});const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:_macOSDesignSystemColors.macOSColors.background.base},contentSection:{flex:1,minHeight:0,paddingHorizontal:14,paddingVertical:10},contentScroll:{flex:1},contentScrollInner:{flexGrow:1,paddingHorizontal:14,paddingVertical:10},diffContent:{flex:1,minHeight:0}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EventPickerModal=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _absoluteFill=require("../../../utils/absoluteFill.js");var _macOSDesignSystemColors=require("../../gameUI/constants/macOSDesignSystemColors.js");var _lucideIcons=require("../../../icons/lucide-icons.js");var _fonts=require("../../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(n,l){if("function"==typeof WeakMap)var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EventPickerModal=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _absoluteFill=require("../../../utils/absoluteFill.js");var _macOSDesignSystemColors=require("../../gameUI/constants/macOSDesignSystemColors.js");var _lucideIcons=require("../../../icons/lucide-icons.js");var _fonts=require("../../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(n,l){if("function"==typeof WeakMap)var s=new WeakMap,c=new WeakMap;return(_interopRequireWildcard=function(o,i){if(!i&&o&&o.__esModule)return o;var r,t,e={__proto__:null,default:o};if(null===o||"object"!=typeof o&&"function"!=typeof o)return e;if(r=i?c:s){if(r.has(o))return r.get(o);r.set(o,e)}for(const a in o)"default"!==a&&{}.hasOwnProperty.call(o,a)&&((t=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(o,a))&&(t.get||t.set)?r(e,a,t):e[a]=o[a]);return e})(n,l)}const EventPickerModal=exports.EventPickerModal=(0,_react.memo)(function n({isOpen:l,onClose:s,title:c,position:o,items:i,onSelect:r}){if(!l)return null;const t=o==="left";return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.overlay,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.backdrop,activeOpacity:1,onPress:s}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.card,t?styles.cardLeft:styles.cardRight],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.header,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.title,t?styles.titleLeft:styles.titleRight],children:c}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:s,style:styles.closeBtn,accessibilityLabel:"Close event picker",children:(0,_jsxRuntime.jsx)(_lucideIcons.X,{size:16,color:_macOSDesignSystemColors.macOSColors.text.secondary})})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.divider}),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",style:styles.scroll,contentContainerStyle:styles.list,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,children:i.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{disabled:e.disabled,onPress:()=>r(e.index),style:[styles.item,e.selected&&styles.itemSelected,e.selected&&t&&styles.itemSelectedLeft,e.selected&&!t&&styles.itemSelectedRight,e.disabled&&styles.itemDisabled],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.itemIndex,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.itemTime,children:e.timestamp}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.itemRelative,children:["(",e.relativeTime,")"]}),e.badge,e.diffPreview]},e.index))})]})]})});const styles=_reactNative.StyleSheet.create({overlay:{..._absoluteFill.absoluteFill,zIndex:20,justifyContent:"center",alignItems:"center"},backdrop:{..._absoluteFill.absoluteFill,backgroundColor:"rgba(0,0,0,0.65)"},card:{width:"86%",maxHeight:320,backgroundColor:_macOSDesignSystemColors.macOSColors.background.card,borderRadius:16,borderWidth:2,padding:16,shadowOffset:{width:0,height:0},shadowOpacity:.5,shadowRadius:40,elevation:15},cardLeft:{borderColor:_macOSDesignSystemColors.macOSColors.semantic.debug,shadowColor:_macOSDesignSystemColors.macOSColors.semantic.debug},cardRight:{borderColor:_macOSDesignSystemColors.macOSColors.semantic.success,shadowColor:_macOSDesignSystemColors.macOSColors.semantic.success},header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},title:{fontSize:13,fontWeight:"700",fontFamily:_fonts.monoFont,textTransform:"uppercase",marginBottom:8,letterSpacing:.6},titleLeft:{color:_macOSDesignSystemColors.macOSColors.semantic.debug},titleRight:{color:_macOSDesignSystemColors.macOSColors.semantic.success},closeBtn:{padding:6,borderRadius:6,backgroundColor:_macOSDesignSystemColors.macOSColors.background.card,borderWidth:1,borderColor:_macOSDesignSystemColors.macOSColors.border.default},divider:{height:1,backgroundColor:_macOSDesignSystemColors.macOSColors.background.input,marginVertical:8},scroll:{maxHeight:260},list:{gap:4},item:{paddingVertical:10,paddingHorizontal:12,borderRadius:10,backgroundColor:_macOSDesignSystemColors.macOSColors.background.base,borderWidth:1,borderColor:_macOSDesignSystemColors.macOSColors.border.default,flexDirection:"row",alignItems:"center",gap:8,marginBottom:6},itemSelected:{borderWidth:1.5,shadowOffset:{width:0,height:2},shadowOpacity:.25,shadowRadius:12,elevation:4},itemSelectedLeft:{backgroundColor:_macOSDesignSystemColors.macOSColors.semantic.debug+"1A",borderColor:_macOSDesignSystemColors.macOSColors.semantic.debug,shadowColor:_macOSDesignSystemColors.macOSColors.semantic.debug},itemSelectedRight:{backgroundColor:_macOSDesignSystemColors.macOSColors.semantic.successBackground+"30",borderColor:_macOSDesignSystemColors.macOSColors.semantic.success,shadowColor:_macOSDesignSystemColors.macOSColors.semantic.success},itemDisabled:{opacity:.4},itemIndex:{fontSize:10,color:_macOSDesignSystemColors.macOSColors.text.secondary,fontFamily:_fonts.monoFont,width:40},itemTime:{fontSize:11,color:_macOSDesignSystemColors.macOSColors.text.primary,fontFamily:_fonts.monoFont,flex:1},itemRelative:{fontSize:10,color:_macOSDesignSystemColors.macOSColors.text.secondary,fontFamily:_fonts.monoFont}});
|
package/lib/module/JsModal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{getUseAccountAccess as ke}from"./license/licenseModule.js";import{AccountSetup as Le}from"./license/AccountSetup";import{useState as j,useRef as d,useEffect as V,useMemo as ne,useCallback as Q,memo as kt,isValidElement as re,cloneElement as ie}from"react";import{View as s,StyleSheet as Lt,TouchableWithoutFeedback as ae,Dimensions as Be,PanResponder as se,Animated as i,ScrollView as le,Text as Ft}from"react-native";import{absoluteFill as Pt}from"./utils/absoluteFill.js";import{useSafeAreaInsets as Ae}from"./hooks/useSafeAreaInsets";import{gameUIColors as L,buoyColors as m}from"./ui/gameUI/index.js";import{DraggableHeader as We,ModalHintBanner as Me,WindowControls as de}from"./ui/components/index.js";import{ToolBackground as Bt}from"./ui/backgrounds/ToolBackground.js";import{night as C}from"./ui/night/nightTheme.js";import{persistentStorage as ce}from"./utils/persistentStorage";import{ModalStorage as Gt}from"./utils/modalStorage.js";import{devToolsStorageKeys as ue}from"./storage/devToolsStorageKeys.js";import{useHintsDisabled as Ne}from"./context/index.js";import{jsx as o,jsxs as Y}from"react/jsx-runtime";const he=true;const h=Be.get("window");const Oe=100;const Ee=400;const ut=h.width;const ht=500;const Rt=h.width*.25;const Tt=80;const Fe=20;const fe=kt(function c({isResizing:a,mode:B,hasCustomContent:X=false,variant:D="default"}){return Y(s,{style:[e.dragIndicatorContainer,X&&e.dragIndicatorContainerCustom],children:[o(s,{style:[e.dragIndicator,B==="floating"&&e.floatingDragIndicator,a&&e.dragIndicatorActive,D==="night"&&e.nightDragIndicator]}),a&&B==="bottomSheet"&&Y(s,{style:e.resizeGripContainer,children:[o(s,{style:e.resizeGripLine}),o(s,{style:e.resizeGripLine}),o(s,{style:e.resizeGripLine})]})]})});const ge=kt(function c({position:a,isActive:B}){return o(s,{style:[e.cornerHandle],children:o(s,{style:[e.handler,B&&e.handlerActive]})})});const pe=kt(function c({header:a,onClose:B,onToggleMode:X,onMinimize:D,isResizing:Z,mode:at,panHandlers:I,variant:f="default"}){const S=d(0);const $=d(0);const A=d(null);const x=Q(()=>{const P=Date.now();const st=P-S.current;if(st>500){$.current=0}$.current++;S.current=P;if(A.current){clearTimeout(A.current)}A.current=setTimeout(()=>{if($.current===2){X()}else if($.current>=3){if(D){D()}}$.current=0},300)},[X,D]);V(()=>{return()=>{if(A.current){clearTimeout(A.current)}}},[]);const W=I?I:{};const ft=!!I;if(a?.customContent){const P=re(a.customContent)&&typeof a.customContent.type==="function"&&a.customContent.type.name==="CyberpunkModalHeader";if(P){return ie(a.customContent,{onToggleMode:X,onClose:B,mode:at,panHandlers:W,showToggleButton:a?.showToggleButton!==false,hideCloseButton:a?.hideCloseButton})}let st=a.customContent;if(re(a.customContent)&&D){st=ie(a.customContent,{onMinimize:D})}const T=Y(s,{style:e.headerInner,children:[o(fe,{isResizing:Z,mode:at,hasCustomContent:true,variant:f}),st]});return o(s,{style:[e.header,f==="night"&&e.nightHeader],...W,children:ft?o(ae,{onPress:x,children:T}):T})}const K=Y(s,{style:e.headerInner,children:[o(fe,{isResizing:Z,mode:at,variant:f}),Y(s,{style:e.headerContent,children:[a?.title&&o(Ft,{style:e.headerTitle,children:a.title}),a?.subtitle&&o(Ft,{style:e.headerSubtitle,children:a.subtitle})]}),o(s,{style:e.headerHintText,children:o(Ft,{style:e.hintText,children:"Double tap: Toggle \u2022 Triple tap: Close"})})]});return o(s,{style:[e.header,at==="floating"&&e.floatingModeHeader,f==="night"&&e.nightHeader],...W,children:ft?o(ae,{onPress:x,children:K}):K})});const Pe=({visible:c,onClose:a,children:B,header:X,styles:D={},minHeight:Z=Oe,maxHeight:at,initialHeight:I=Ee,animatedHeight:f,benchMotion:S,initialMode:$="bottomSheet",onModeChange:A,persistenceKey:x,enablePersistence:W=true,initialFloatingPosition:ft,footer:K,footerHeight:P=0,onBack:st,onMinimize:T,minimizeRequest:Vt=0,minimizeTargetPosition:At,initialModalState:g,zIndex:Dt,disableScrollWrapper:_t=false,background:It=true,variant:H="night"})=>{const N=Ae();const[zt,jt]=j(!W);const[l,Wt]=j($);const[lt,O]=j(false);const[St,dt]=j(false);const[we,Mt]=j(I);const[G,gt]=j({width:ut,height:ht,top:(h.height-ht)/2,left:0});const[xt]=j({width:h.width,height:h.height});const[be,Ht]=j(false);const[ye,Yt]=j(false);const Ce=Ne();const w=d(new i.Value(0)).current;const R=d(new i.Value(h.height)).current;const Xt=d(new i.Value(0)).current;const E=d(new i.Value(I)).current;const F=d(I);V(()=>{if(!W||!x||!zt)return;const t=setTimeout(()=>{Gt.save(x,{mode:l,panelHeight:F.current,dimensions:G,isVisible:c})},500);return()=>clearTimeout(t)},[l,we,G,c,x,W,zt]);const Ut=d(false);V(()=>{if(f&&!Ut.current){Ut.current=true;F.current=I;f.setValue(I)}},[f,I]);V(()=>{y.current=G},[G]);const p=d(new i.ValueXY({x:ft?.x??0,y:ft?.y??(h.height-ht)/2})).current;const tt=d(new i.Value(0)).current;const et=d(new i.Value(ut)).current;const ot=d(new i.Value(ht)).current;const y=d(G);const Jt=d(G);const Re=d(0);const Te=d(0);const Ve=d(0);const De=d(0);V(()=>{let t=true;const r=async()=>{try{const n=ue.modal.hintAcknowledged();const _=await ce.getItem(n);if(t){Ht(_!=="true");Yt(true)}}catch(n){if(t){Ht(true);Yt(true)}}};r();return()=>{t=false}},[]);const Ie=Q(async()=>{try{const t=ue.modal.hintAcknowledged();await ce.setItem(t,"true");Ht(false)}catch(t){Ht(false)}},[]);const qt=d(A);qt.current=A;V(()=>{if(!W||!x){jt(true);return}let t=true;const r=async()=>{const n=await Gt.load(x);if(t&&n){if(n.mode){Wt(n.mode);qt.current?.(n.mode)}if(n.panelHeight){Mt(n.panelHeight);F.current=n.panelHeight;E.setValue(n.panelHeight);f?.setValue(n.panelHeight)}if(n.dimensions){gt(n.dimensions);p.setValue({x:n.dimensions.left,y:n.dimensions.top});et.setValue(n.dimensions.width);ot.setValue(n.dimensions.height)}}if(t)jt(true)};r();return()=>{t=false}},[x,W,E,ot,et,p]);V(()=>{return()=>{w.stopAnimation();R.stopAnimation();tt.stopAnimation();Xt.stopAnimation();E.stopAnimation();p.stopAnimation();et.stopAnimation();ot.stopAnimation();w.setValue(0);R.setValue(h.height);tt.setValue(0);Xt.setValue(0);E.setValue(I);F.current=I}},[]);const Qt=w.interpolate({inputRange:[0,1],outputRange:[0,1],extrapolate:"clamp"});const Nt=at||h.height-N.top;const nt=Q(()=>{dt(false);O(false);const t=l==="bottomSheet"?"floating":"bottomSheet";Wt(t);A?.(t)},[l,A]);V(()=>{dt(false);O(false)},[l]);const U=Q(()=>{if(!T)return;const t={mode:l,panelHeight:F.current,floatingPosition:{x:y.current.left,y:y.current.top},floatingDimensions:{width:y.current.width,height:y.current.height}};if(W&&x)void Gt.saveMinimized(x,t);const r=At?.x??h.width-50;const n=At?.y??h.height-150;if(l==="bottomSheet"){i.parallel([i.timing(w,{toValue:0,duration:300,useNativeDriver:true}),i.timing(R,{toValue:h.height,duration:300,useNativeDriver:true})]).start(()=>{T(t)})}else{i.parallel([i.timing(tt,{toValue:0,duration:300,useNativeDriver:true}),i.timing(w,{toValue:0,duration:300,useNativeDriver:true}),i.timing(p,{toValue:{x:r,y:n},duration:300,useNativeDriver:true})]).start(()=>{T(t)})}},[l,T,At,W,x,w,R,tt,p]);const Zt=d(Vt);V(()=>{if(Zt.current===Vt)return;Zt.current=Vt;U()},[Vt,U]);V(()=>{if(!g)return;if(g.mode){Wt(g.mode);A?.(g.mode)}if(g.panelHeight){Mt(g.panelHeight);F.current=g.panelHeight;E.setValue(g.panelHeight)}if(g.floatingDimensions&&g.floatingPosition){const t={width:g.floatingDimensions.width,height:g.floatingDimensions.height,top:g.floatingPosition.y,left:g.floatingPosition.x};gt(t);p.setValue({x:g.floatingPosition.x,y:g.floatingPosition.y});et.setValue(g.floatingDimensions.width);ot.setValue(g.floatingDimensions.height)}},[g]);const $t=t=>{if(t){if(l==="bottomSheet"){R.setValue(0)}else{tt.setValue(1);p.setValue({x:y.current.left,y:y.current.top})}w.setValue(1)}else{if(l==="bottomSheet"){R.setValue(h.height)}w.setValue(0)}};const Kt=d(null);if(he&&Kt.current!==c){Kt.current=c;$t(c)}V(()=>{let t=null;let r=null;if(he){$t(c);return}if(c){R.setValue(h.height);w.setValue(0);if(l==="bottomSheet"){t=i.parallel([i.spring(R,{toValue:0,tension:180,friction:22,useNativeDriver:true}),i.timing(w,{toValue:1,duration:200,useNativeDriver:true})]);t.start()}else{tt.setValue(1);p.setValue({x:y.current.left,y:y.current.top});t=i.timing(w,{toValue:1,duration:200,useNativeDriver:true});t.start()}}else{if(l==="bottomSheet"){r=i.parallel([i.spring(R,{toValue:h.height,tension:180,friction:22,useNativeDriver:true}),i.timing(w,{toValue:0,duration:200,useNativeDriver:true})]);r.start()}else{r=i.timing(w,{toValue:0,duration:200,useNativeDriver:true});r.start()}}return()=>{if(t){t.stop()}if(r){r.stop()}}},[c,l,w,R,tt,p,f]);const te=d(0);V(()=>{if(!__DEV__||!S||!c)return void 0;let t=null;let r=null;let n=true;const _=Date.now();let v=false;const J=z=>{v=z;if(S==="resize"||S==="float-resize"){O(z)}else if(S==="float-drag"){dt(z)}};if(S==="mode-cycle"){r=setInterval(()=>nt(),2200)}else{const z=Z;const vt=Nt;const bt=()=>{if(!n)return;const ct=(Date.now()-_)/1e3;const u=ct%2.5;if(u<2&&!v)J(true);else if(u>=2&&v)J(false);if(v){const k=(Math.sin(ct*2.2)+1)/2;if(S==="resize"){const b=z+k*(vt-z);E.setValue(b);F.current=b;if(f){f.setValue(b)}}else if(S==="float-drag"){const b=(Math.sin(ct*1.7)+1)/2;p.setValue({x:10+k*Math.max(h.width-ut-20,0),y:70+b*260})}else if(S==="float-resize"){const b=ut+k*Math.max(h.width-ut-40,0);const M=ht+k*240;et.setValue(b);ot.setValue(M);y.current={...y.current,width:b,height:M}}}t=requestAnimationFrame(bt)};t=requestAnimationFrame(bt)}return()=>{n=false;if(t!=null)cancelAnimationFrame(t);if(r!=null)clearInterval(r);O(false);dt(false)}},[S,c]);const Se=ne(()=>se.create({onStartShouldSetPanResponder:()=>l==="bottomSheet",onMoveShouldSetPanResponder:(t,r)=>l==="bottomSheet"&&Math.abs(r.dy)>3,onPanResponderTerminationRequest:()=>false,onPanResponderGrant:t=>{O(true);te.current=t.nativeEvent.locationY||0;E.stopAnimation(r=>{F.current=r});f?.stopAnimation();R.stopAnimation()},onPanResponderMove:t=>{const r=t.nativeEvent.pageY-te.current;let n=h.height-r;n=Math.max(Z,Math.min(n,Nt));E.setValue(n);F.current=n;if(f){f.setValue(n)}},onPanResponderRelease:(t,r)=>{O(false);const n=F.current;const _=r.vy>.8&&r.dy>50||r.dy>150&&n<=Z;if(_){i.parallel([i.timing(w,{toValue:0,duration:200,useNativeDriver:true}),i.spring(R,{toValue:h.height,tension:180,friction:22,useNativeDriver:true})]).start(()=>a());return}Mt(n);if(f)f.setValue(n)},onPanResponderTerminate:()=>{O(false)}}),[l,Z,Nt,E,f,R,w,a]);const pt=Q(t=>{let r=false;return se.create({onStartShouldSetPanResponder:()=>l==="floating",onMoveShouldSetPanResponder:()=>l==="floating",onPanResponderGrant:()=>{r=false;const n=y.current;p.stopAnimation(({x:_,y:v})=>{p.setValue({x:_,y:v})});O(true);Jt.current={...n};Ve.current=n.height;De.current=n.width;Re.current=n.left;Te.current=n.top},onPanResponderMove:(n,_)=>{const{dx:v,dy:J}=_;if(Math.abs(v)<.5&&Math.abs(J)<.5)return;r=true;const z=Math.max(0,N.left||0);const vt=xt.width-Math.max(0,N.right||0);const bt=Math.max(0,N.top||0);const ct=xt.height-Math.max(0,N.bottom||0);const u=Jt.current;const k=u.left+u.width;const b=u.top+u.height;let M=u.left;let q=u.top;let yt=k;let Ct=b;switch(t){case"topLeft":{const rt=Math.max(z,Math.min(u.left+v,k-Rt));const it=Math.max(bt,Math.min(u.top+J,b-Tt));M=rt;q=it;yt=k;Ct=b;break}case"topRight":{const rt=Math.min(vt,Math.max(k+v,u.left+Rt));const it=Math.max(bt,Math.min(u.top+J,b-Tt));M=u.left;q=it;yt=rt;Ct=b;break}case"bottomLeft":{const rt=Math.max(z,Math.min(u.left+v,k-Rt));const it=Math.min(ct,Math.max(b+J,u.top+Tt));M=rt;q=u.top;yt=k;Ct=it;break}case"bottomRight":{const rt=Math.min(vt,Math.max(k+v,u.left+Rt));const it=Math.min(ct,Math.max(b+J,u.top+Tt));M=u.left;q=u.top;yt=rt;Ct=it;break}}const Ot=Math.max(Rt,yt-M);const Et=Math.max(Tt,Ct-q);gt({width:Ot,height:Et,left:M,top:q});et.setValue(Ot);ot.setValue(Et);p.setValue({x:M,y:q});y.current={width:Ot,height:Et,left:M,top:q}},onPanResponderRelease:()=>{O(false);r=false;gt(y.current)},onPanResponderTerminate:()=>{O(false);r=false}})},[l,xt,N.left,N.right,N.top,N.bottom,p,et,ot,a,st]);const ee=ne(()=>{return{topLeft:pt("topLeft"),topRight:pt("topRight"),bottomLeft:pt("bottomLeft"),bottomRight:pt("bottomRight")}},[pt]);const xe=Q(()=>{dt(true)},[]);const He=Q(t=>{dt(false);const r=y.current;const n={...r,left:t.x,top:t.y};gt(n)},[]);const oe=d(0);const mt=d(0);const wt=d(null);const ve=Q(()=>{const t=Date.now();const r=t-oe.current;if(r>500){mt.current=0}mt.current++;oe.current=t;if(wt.current){clearTimeout(wt.current)}wt.current=setTimeout(()=>{if(mt.current===2){nt()}else if(mt.current>=3){if(T){U()}}mt.current=0},300)},[nt,T,U]);V(()=>{return()=>{if(wt.current){clearTimeout(wt.current)}}},[]);if(l==="floating"){return Y(i.View,{nativeID:"jsmodal-root",pointerEvents:c?"auto":"none",accessibilityElementsHidden:!c,importantForAccessibility:c?"auto":"no-hide-descendants",style:[e.floatingModal,{width:G.width,height:G.height,opacity:Qt,transform:[{translateX:p.x},{translateY:p.y}],...Dt!==void 0&&{zIndex:Dt}},H==="night"&&e.nightFloatingModal,(St||lt)&&e.floatingModalDragging,D.container,!c&&e.parkedOffscreen],children:[It&&H==="night"?o(s,{style:e.nightBackdropFloating,pointerEvents:"none",children:o(Bt,{})}):null,o(We,{position:p,onDragStart:xe,onDragEnd:He,onTap:ve,containerBounds:xt,elementSize:G,minPosition:{x:0,y:N.top},style:e.floatingHeader,enabled:l==="floating"&&!lt,children:o(pe,{header:X,onClose:a,onToggleMode:nt,onMinimize:T?U:void 0,isResizing:St||lt,mode:l,variant:H})}),o(s,{style:e.windowControlsContainer,children:o(de,{onClose:a,onMinimize:T?U:void 0,onToggleMode:nt,mode:l,variant:H})}),Y(s,{style:[e.content,H==="night"&&e.nightContent,D.content],children:[It&&H!=="night"?o(Bt,{}):null,_t?o(s,{style:{flex:1,paddingBottom:P},children:B}):o(le,{style:{flex:1},contentContainerStyle:{flexGrow:1,paddingBottom:P},showsVerticalScrollIndicator:true,nestedScrollEnabled:true,keyboardShouldPersistTaps:"handled",children:B}),K?o(s,{style:me.footerContainer,children:K}):null]}),o(s,{...ee.bottomLeft.panHandlers,style:[e.cornerHandleWrapper,{bottom:4,left:4}],hitSlop:{top:2,left:2,right:2,bottom:2},children:o(ge,{position:"bottomLeft",isActive:St||lt})}),o(s,{...ee.bottomRight.panHandlers,style:[e.cornerHandleWrapper,{bottom:4,right:4}],hitSlop:{top:2,left:2,right:2,bottom:2},children:o(ge,{position:"bottomRight",isActive:St||lt})})]})}return o(s,{style:[c?e.fullScreenContainer:e.parkedFullScreen,c&&Dt!==void 0&&{zIndex:Dt}],pointerEvents:c?"box-none":"none",accessibilityElementsHidden:!c,importantForAccessibility:c?"auto":"no-hide-descendants",children:o(i.View,{nativeID:"jsmodal-root",style:[e.bottomSheetWrapper,{opacity:Qt,transform:[{translateY:R}]}],children:Y(i.View,{style:[e.bottomSheet,H==="night"&&e.nightBottomSheet,D.container,{height:f||E}],children:[It&&H==="night"?o(s,{style:e.nightBackdropSheet,pointerEvents:"none",children:o(Bt,{})}):null,o(pe,{header:X,onClose:a,onToggleMode:nt,onMinimize:T?U:void 0,isResizing:lt,mode:l,panHandlers:Se.panHandlers,variant:H}),o(s,{style:e.windowControlsContainer,children:o(de,{onClose:a,onMinimize:T?U:void 0,onToggleMode:nt,mode:l,variant:H})}),ye&&be&&l==="bottomSheet"&&!Ce&&o(Me,{onAcknowledge:Ie}),Y(s,{style:[e.content,H==="night"&&e.nightContent,D.content],children:[It&&H!=="night"?o(Bt,{}):null,_t?o(s,{style:{flex:1,paddingBottom:P},children:B}):o(le,{style:{flex:1},contentContainerStyle:{flexGrow:1,paddingBottom:P},showsVerticalScrollIndicator:true,nestedScrollEnabled:true,keyboardShouldPersistTaps:"handled",children:B}),K?o(s,{style:me.footerContainer,children:K}):null]})]})})})};const e=Lt.create({fullScreenContainer:{...Pt,zIndex:1e3},bottomSheetWrapper:{position:"absolute",bottom:0,left:0,right:0},bottomSheet:{backgroundColor:m.card,borderTopLeftRadius:6,borderTopRightRadius:6,borderWidth:1,borderColor:m.border,shadowColor:m.primary,shadowOffset:{width:0,height:-4},shadowOpacity:.2,shadowRadius:12,elevation:20},parkedOffscreen:{left:-9999,top:-9999,opacity:0},parkedFullScreen:{position:"absolute",left:-9999,top:-9999,width:h.width,height:h.height,opacity:0},floatingModal:{position:"absolute",backgroundColor:m.card,borderRadius:6,borderWidth:1,borderColor:m.border,shadowColor:m.primary,shadowOffset:{width:0,height:0},shadowOpacity:.3,shadowRadius:20,elevation:24,zIndex:1e3,width:ut,height:ht},floatingModalDragging:{borderColor:m.primary,borderWidth:2,shadowColor:m.primary+"99",shadowOpacity:.8,shadowRadius:12},header:{borderTopLeftRadius:6,borderTopRightRadius:6,backgroundColor:m.card,minHeight:56,borderWidth:1,borderColor:m.border,borderBottomWidth:1,borderBottomColor:m.border},nightBottomSheet:{backgroundColor:C.color.bg,borderTopLeftRadius:C.radius.sheet,borderTopRightRadius:C.radius.sheet,borderWidth:Lt.hairlineWidth,borderColor:C.color.accent+"55",shadowColor:C.color.accent,shadowOffset:{width:0,height:-4},shadowOpacity:.22,shadowRadius:10},nightFloatingModal:{backgroundColor:C.color.bg,borderRadius:C.radius.sheet,borderWidth:Lt.hairlineWidth,borderColor:C.color.accent+"55",shadowColor:C.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.22,shadowRadius:14},nightHeader:{backgroundColor:"transparent",borderWidth:0,borderBottomWidth:0,borderTopLeftRadius:C.radius.sheet,borderTopRightRadius:C.radius.sheet},nightContent:{backgroundColor:"transparent"},nightBackdropSheet:{...Pt,borderTopLeftRadius:C.radius.sheet,borderTopRightRadius:C.radius.sheet,overflow:"hidden"},nightBackdropFloating:{...Pt,borderRadius:C.radius.sheet,overflow:"hidden"},nightDragIndicator:{width:36,height:5,borderRadius:2.5,backgroundColor:C.color.placeholder,shadowOpacity:0,elevation:0},floatingHeader:{borderTopLeftRadius:6,borderTopRightRadius:6},windowControlsContainer:{position:"absolute",top:4,right:4,zIndex:10},floatingModeHeader:{borderTopLeftRadius:6,borderTopRightRadius:6},headerInner:{flex:1,justifyContent:"center"},dragIndicatorContainer:{alignItems:"center",paddingVertical:8,backgroundColor:"transparent"},dragIndicatorContainerCustom:{minHeight:Fe,justifyContent:"center",paddingVertical:0,backgroundColor:"transparent"},dragIndicator:{width:40,height:3,backgroundColor:m.primary,borderRadius:2,shadowColor:m.primary,shadowOffset:{width:0,height:0},shadowOpacity:.6,shadowRadius:4},floatingDragIndicator:{width:50,height:5,backgroundColor:m.textMuted},dragIndicatorActive:{backgroundColor:m.primary,width:40},resizeGripContainer:{position:"absolute",flexDirection:"row",gap:2,marginTop:12},resizeGripLine:{width:12,height:1,backgroundColor:L.success,opacity:.6},headerContent:{paddingHorizontal:16,alignItems:"center"},headerControls:{position:"absolute",top:8,right:16,flexDirection:"row",alignItems:"center"},headerTitle:{fontSize:16,fontWeight:"600",color:L.primary},headerSubtitle:{fontSize:12,color:L.secondary,paddingTop:4},headerHintText:{position:"absolute",top:0,left:0,right:0,bottom:0,justifyContent:"center",alignItems:"center"},hintText:{fontSize:10,color:L.muted,fontStyle:"italic"},controlButton:{width:28,height:28,borderRadius:6,justifyContent:"center",alignItems:"center",marginLeft:8},toggleButton:{backgroundColor:L.info+"1A",borderWidth:1,borderColor:L.info+"33"},closeButton:{width:28,height:28,borderRadius:6,justifyContent:"center",alignItems:"center",backgroundColor:L.error+"1A",borderWidth:1,borderColor:L.error+"33",marginLeft:8},iconLine:{position:"absolute",top:7.25,left:2,width:12,height:1.5,backgroundColor:L.error},content:{flex:1,backgroundColor:m.base,borderBottomLeftRadius:16,borderBottomRightRadius:16,overflow:"hidden"},cornerHandle:{position:"absolute",zIndex:1},cornerHandleWrapper:{position:"absolute",width:30,height:30,zIndex:1e3},handler:{width:20,height:20,backgroundColor:"transparent",borderRadius:10,borderWidth:0,borderColor:"transparent"},handlerActive:{backgroundColor:L.success+"1A",borderColor:L.success,borderWidth:2,shadowColor:L.success+"99",shadowOffset:{width:0,height:0},shadowOpacity:1,shadowRadius:8}});const me=Lt.create({footerContainer:{position:"absolute",left:0,right:0,bottom:0,backgroundColor:m.base,borderBottomLeftRadius:16,borderBottomRightRadius:16}});export const JsModal=kt(c=>{const a=ke()();if(a.status!=="admitted")return c.visible?o(Le,{}):null;return o(Pe,{...c})});
|
|
1
|
+
"use strict";import{getUseAccountAccess as Me}from"./license/licenseModule.js";import{AccountSetup as Ne}from"./license/AccountSetup";import{useState as Y,useRef as d,useEffect as C,useMemo as _t,useCallback as Q,memo as Bt,isValidElement as le,cloneElement as de}from"react";import{View as c,StyleSheet as At,TouchableWithoutFeedback as ce,Dimensions as Oe,PanResponder as ue,Animated as i,ScrollView as he,Text as zt,Keyboard as Vt,Platform as Ee,Easing as Fe}from"react-native";import{absoluteFill as jt}from"./utils/absoluteFill.js";import{useSafeAreaInsets as Pe}from"./hooks/useSafeAreaInsets";import{gameUIColors as A,buoyColors as b}from"./ui/gameUI/index.js";import{DraggableHeader as Ge,ModalHintBanner as _e,WindowControls as fe}from"./ui/components/index.js";import{ToolBackground as Wt}from"./ui/backgrounds/ToolBackground.js";import{night as T}from"./ui/night/nightTheme.js";import{persistentStorage as ge}from"./utils/persistentStorage";import{ModalStorage as Yt}from"./utils/modalStorage.js";import{devToolsStorageKeys as me}from"./storage/devToolsStorageKeys.js";import{useHintsDisabled as ze}from"./context/index.js";import{jsx as n,jsxs as X}from"react/jsx-runtime";const pe=true;const u=Oe.get("window");const je=100;const Ye=400;const ht=u.width;const ft=500;const Tt=u.width*.25;const Dt=80;const Xe=20;const be=Bt(function a({isResizing:s,mode:W,hasCustomContent:U=false,variant:S="default"}){return X(c,{style:[o.dragIndicatorContainer,U&&o.dragIndicatorContainerCustom],children:[n(c,{style:[o.dragIndicator,W==="floating"&&o.floatingDragIndicator,s&&o.dragIndicatorActive,S==="night"&&o.nightDragIndicator]}),s&&W==="bottomSheet"&&X(c,{style:o.resizeGripContainer,children:[n(c,{style:o.resizeGripLine}),n(c,{style:o.resizeGripLine}),n(c,{style:o.resizeGripLine})]})]})});const we=Bt(function a({position:s,isActive:W}){return n(c,{style:[o.cornerHandle],children:n(c,{style:[o.handler,W&&o.handlerActive]})})});const ye=Bt(function a({header:s,onClose:W,onToggleMode:U,onMinimize:S,isResizing:Z,mode:at,panHandlers:I,variant:g="default"}){const x=d(0);const $=d(0);const M=d(null);const k=Q(()=>{const z=Date.now();const st=z-x.current;if(st>500){$.current=0}$.current++;x.current=z;if(M.current){clearTimeout(M.current)}M.current=setTimeout(()=>{if($.current===2){U()}else if($.current>=3){if(S){S()}}$.current=0},300)},[U,S]);C(()=>{return()=>{if(M.current){clearTimeout(M.current)}}},[]);const N=I?I:{};const gt=!!I;if(s?.customContent){const z=le(s.customContent)&&typeof s.customContent.type==="function"&&s.customContent.type.name==="CyberpunkModalHeader";if(z){return de(s.customContent,{onToggleMode:U,onClose:W,mode:at,panHandlers:N,showToggleButton:s?.showToggleButton!==false,hideCloseButton:s?.hideCloseButton})}let st=s.customContent;if(le(s.customContent)&&S){st=de(s.customContent,{onMinimize:S})}const D=X(c,{style:o.headerInner,children:[n(be,{isResizing:Z,mode:at,hasCustomContent:true,variant:g}),st]});return n(c,{style:[o.header,g==="night"&&o.nightHeader],...N,children:gt?n(ce,{onPress:k,children:D}):D})}const K=X(c,{style:o.headerInner,children:[n(be,{isResizing:Z,mode:at,variant:g}),X(c,{style:o.headerContent,children:[s?.title&&n(zt,{style:o.headerTitle,children:s.title}),s?.subtitle&&n(zt,{style:o.headerSubtitle,children:s.subtitle})]}),n(c,{style:o.headerHintText,children:n(zt,{style:o.hintText,children:"Double tap: Toggle \u2022 Triple tap: Close"})})]});return n(c,{style:[o.header,at==="floating"&&o.floatingModeHeader,g==="night"&&o.nightHeader],...N,children:gt?n(ce,{onPress:k,children:K}):K})});const Ue=({visible:a,onClose:s,children:W,header:U,styles:S={},minHeight:Z=je,maxHeight:at,initialHeight:I=Ye,animatedHeight:g,benchMotion:x,initialMode:$="bottomSheet",onModeChange:M,persistenceKey:k,enablePersistence:N=true,initialFloatingPosition:gt,footer:K,footerHeight:z=0,onBack:st,onMinimize:D,minimizeRequest:St=0,minimizeTargetPosition:Mt,initialModalState:m,zIndex:It,disableScrollWrapper:Xt=false,background:xt=true,variant:H="night",avoidKeyboard:Ut=true})=>{const L=Pe();const Nt=d(false);C(()=>{if(a)Nt.current=true;else if(Nt.current)Vt.dismiss()},[a]);C(()=>()=>{if(Nt.current)Vt.dismiss()},[]);const[Jt,qt]=Y(!N);const[l,Ot]=Y($);const[lt,G]=Y(false);const[kt,dt]=Y(false);const[Re,Et]=Y(I);const[j,mt]=Y({width:ht,height:ft,top:(u.height-ft)/2,left:0});const[Ht]=Y({width:u.width,height:u.height});const[Ve,Lt]=Y(false);const[Te,Qt]=Y(false);const De=ze();const w=d(new i.Value(0)).current;const R=d(new i.Value(u.height)).current;const Zt=d(new i.Value(0)).current;const _=d(new i.Value(I)).current;const O=d(I);const ct=d(new i.Value(0)).current;C(()=>{const t=Ee.OS==="ios"&&a&&l==="bottomSheet"&&Ut;if(!t){ct.setValue(0);return}const r=(h,v)=>{i.timing(ct,{toValue:h,duration:v?.duration||250,easing:Fe.bezier(.17,.59,.4,.77),useNativeDriver:true}).start()};const e=h=>{const v=Math.max(0,u.height-h.endCoordinates.screenY);const F=Math.max(0,u.height-L.top-O.current);r(Math.min(v,F),h)};const E=[Vt.addListener("keyboardWillShow",e),Vt.addListener("keyboardWillChangeFrame",e),Vt.addListener("keyboardWillHide",h=>r(0,h))];return()=>{E.forEach(h=>h.remove());ct.setValue(0)}},[a,l,Ut,L.top,ct]);const Se=_t(()=>i.subtract(R,ct),[R,ct]);C(()=>{if(!N||!k||!Jt)return;const t=setTimeout(()=>{Yt.save(k,{mode:l,panelHeight:O.current,dimensions:j,isVisible:a})},500);return()=>clearTimeout(t)},[l,Re,j,a,k,N,Jt]);const $t=d(false);C(()=>{if(g&&!$t.current){$t.current=true;O.current=I;g.setValue(I)}},[g,I]);C(()=>{V.current=j},[j]);const p=d(new i.ValueXY({x:gt?.x??0,y:gt?.y??(u.height-ft)/2})).current;const tt=d(new i.Value(0)).current;const et=d(new i.Value(ht)).current;const ot=d(new i.Value(ft)).current;const V=d(j);const Kt=d(j);const Ie=d(0);const xe=d(0);const ke=d(0);const He=d(0);C(()=>{let t=true;const r=async()=>{try{const e=me.modal.hintAcknowledged();const E=await ge.getItem(e);if(t){Lt(E!=="true");Qt(true)}}catch(e){if(t){Lt(true);Qt(true)}}};r();return()=>{t=false}},[]);const Le=Q(async()=>{try{const t=me.modal.hintAcknowledged();await ge.setItem(t,"true");Lt(false)}catch(t){Lt(false)}},[]);const te=d(M);te.current=M;C(()=>{if(!N||!k){qt(true);return}let t=true;const r=async()=>{const e=await Yt.load(k);if(t&&e){if(e.mode){Ot(e.mode);te.current?.(e.mode)}if(e.panelHeight){Et(e.panelHeight);O.current=e.panelHeight;_.setValue(e.panelHeight);g?.setValue(e.panelHeight)}if(e.dimensions){mt(e.dimensions);p.setValue({x:e.dimensions.left,y:e.dimensions.top});et.setValue(e.dimensions.width);ot.setValue(e.dimensions.height)}}if(t)qt(true)};r();return()=>{t=false}},[k,N,_,ot,et,p]);C(()=>{return()=>{w.stopAnimation();R.stopAnimation();tt.stopAnimation();Zt.stopAnimation();_.stopAnimation();p.stopAnimation();et.stopAnimation();ot.stopAnimation();w.setValue(0);R.setValue(u.height);tt.setValue(0);Zt.setValue(0);_.setValue(I);O.current=I}},[]);const ee=w.interpolate({inputRange:[0,1],outputRange:[0,1],extrapolate:"clamp"});const Ft=at||u.height-L.top;const nt=Q(()=>{dt(false);G(false);const t=l==="bottomSheet"?"floating":"bottomSheet";Ot(t);M?.(t)},[l,M]);C(()=>{dt(false);G(false)},[l]);const J=Q(()=>{if(!D)return;const t={mode:l,panelHeight:O.current,floatingPosition:{x:V.current.left,y:V.current.top},floatingDimensions:{width:V.current.width,height:V.current.height}};if(N&&k)void Yt.saveMinimized(k,t);const r=Mt?.x??u.width-50;const e=Mt?.y??u.height-150;if(l==="bottomSheet"){i.parallel([i.timing(w,{toValue:0,duration:300,useNativeDriver:true}),i.timing(R,{toValue:u.height,duration:300,useNativeDriver:true})]).start(()=>{D(t)})}else{i.parallel([i.timing(tt,{toValue:0,duration:300,useNativeDriver:true}),i.timing(w,{toValue:0,duration:300,useNativeDriver:true}),i.timing(p,{toValue:{x:r,y:e},duration:300,useNativeDriver:true})]).start(()=>{D(t)})}},[l,D,Mt,N,k,w,R,tt,p]);const oe=d(St);C(()=>{if(oe.current===St)return;oe.current=St;J()},[St,J]);C(()=>{if(!m)return;if(m.mode){Ot(m.mode);M?.(m.mode)}if(m.panelHeight){Et(m.panelHeight);O.current=m.panelHeight;_.setValue(m.panelHeight)}if(m.floatingDimensions&&m.floatingPosition){const t={width:m.floatingDimensions.width,height:m.floatingDimensions.height,top:m.floatingPosition.y,left:m.floatingPosition.x};mt(t);p.setValue({x:m.floatingPosition.x,y:m.floatingPosition.y});et.setValue(m.floatingDimensions.width);ot.setValue(m.floatingDimensions.height)}},[m]);const ne=t=>{if(t){if(l==="bottomSheet"){R.setValue(0)}else{tt.setValue(1);p.setValue({x:V.current.left,y:V.current.top})}w.setValue(1)}else{if(l==="bottomSheet"){R.setValue(u.height)}w.setValue(0)}};const re=d(null);if(pe&&re.current!==a){re.current=a;ne(a)}C(()=>{let t=null;let r=null;if(pe){ne(a);return}if(a){R.setValue(u.height);w.setValue(0);if(l==="bottomSheet"){t=i.parallel([i.spring(R,{toValue:0,tension:180,friction:22,useNativeDriver:true}),i.timing(w,{toValue:1,duration:200,useNativeDriver:true})]);t.start()}else{tt.setValue(1);p.setValue({x:V.current.left,y:V.current.top});t=i.timing(w,{toValue:1,duration:200,useNativeDriver:true});t.start()}}else{if(l==="bottomSheet"){r=i.parallel([i.spring(R,{toValue:u.height,tension:180,friction:22,useNativeDriver:true}),i.timing(w,{toValue:0,duration:200,useNativeDriver:true})]);r.start()}else{r=i.timing(w,{toValue:0,duration:200,useNativeDriver:true});r.start()}}return()=>{if(t){t.stop()}if(r){r.stop()}}},[a,l,w,R,tt,p,g]);const ie=d(0);C(()=>{if(!__DEV__||!x||!a)return void 0;let t=null;let r=null;let e=true;const E=Date.now();let h=false;const v=F=>{h=F;if(x==="resize"||x==="float-resize"){G(F)}else if(x==="float-drag"){dt(F)}};if(x==="mode-cycle"){r=setInterval(()=>nt(),2200)}else{const F=Z;const vt=Ft;const yt=()=>{if(!e)return;const ut=(Date.now()-E)/1e3;const f=ut%2.5;if(f<2&&!h)v(true);else if(f>=2&&h)v(false);if(h){const B=(Math.sin(ut*2.2)+1)/2;if(x==="resize"){const y=F+B*(vt-F);_.setValue(y);O.current=y;if(g){g.setValue(y)}}else if(x==="float-drag"){const y=(Math.sin(ut*1.7)+1)/2;p.setValue({x:10+B*Math.max(u.width-ht-20,0),y:70+y*260})}else if(x==="float-resize"){const y=ht+B*Math.max(u.width-ht-40,0);const P=ft+B*240;et.setValue(y);ot.setValue(P);V.current={...V.current,width:y,height:P}}}t=requestAnimationFrame(yt)};t=requestAnimationFrame(yt)}return()=>{e=false;if(t!=null)cancelAnimationFrame(t);if(r!=null)clearInterval(r);G(false);dt(false)}},[x,a]);const ve=_t(()=>ue.create({onStartShouldSetPanResponder:()=>l==="bottomSheet",onMoveShouldSetPanResponder:(t,r)=>l==="bottomSheet"&&Math.abs(r.dy)>3,onPanResponderTerminationRequest:()=>false,onPanResponderGrant:t=>{G(true);ie.current=t.nativeEvent.locationY||0;_.stopAnimation(r=>{O.current=r});g?.stopAnimation();R.stopAnimation()},onPanResponderMove:t=>{const r=t.nativeEvent.pageY-ie.current;let e=u.height-r;e=Math.max(Z,Math.min(e,Ft));_.setValue(e);O.current=e;if(g){g.setValue(e)}},onPanResponderRelease:(t,r)=>{G(false);const e=O.current;const E=r.vy>.8&&r.dy>50||r.dy>150&&e<=Z;if(E){i.parallel([i.timing(w,{toValue:0,duration:200,useNativeDriver:true}),i.spring(R,{toValue:u.height,tension:180,friction:22,useNativeDriver:true})]).start(()=>s());return}Et(e);if(g)g.setValue(e)},onPanResponderTerminate:()=>{G(false)}}),[l,Z,Ft,_,g,R,w,s]);const pt=Q(t=>{let r=false;return ue.create({onStartShouldSetPanResponder:()=>l==="floating",onMoveShouldSetPanResponder:()=>l==="floating",onPanResponderGrant:()=>{r=false;const e=V.current;p.stopAnimation(({x:E,y:h})=>{p.setValue({x:E,y:h})});G(true);Kt.current={...e};ke.current=e.height;He.current=e.width;Ie.current=e.left;xe.current=e.top},onPanResponderMove:(e,E)=>{const{dx:h,dy:v}=E;if(Math.abs(h)<.5&&Math.abs(v)<.5)return;r=true;const F=Math.max(0,L.left||0);const vt=Ht.width-Math.max(0,L.right||0);const yt=Math.max(0,L.top||0);const ut=Ht.height-Math.max(0,L.bottom||0);const f=Kt.current;const B=f.left+f.width;const y=f.top+f.height;let P=f.left;let q=f.top;let Ct=B;let Rt=y;switch(t){case"topLeft":{const rt=Math.max(F,Math.min(f.left+h,B-Tt));const it=Math.max(yt,Math.min(f.top+v,y-Dt));P=rt;q=it;Ct=B;Rt=y;break}case"topRight":{const rt=Math.min(vt,Math.max(B+h,f.left+Tt));const it=Math.max(yt,Math.min(f.top+v,y-Dt));P=f.left;q=it;Ct=rt;Rt=y;break}case"bottomLeft":{const rt=Math.max(F,Math.min(f.left+h,B-Tt));const it=Math.min(ut,Math.max(y+v,f.top+Dt));P=rt;q=f.top;Ct=B;Rt=it;break}case"bottomRight":{const rt=Math.min(vt,Math.max(B+h,f.left+Tt));const it=Math.min(ut,Math.max(y+v,f.top+Dt));P=f.left;q=f.top;Ct=rt;Rt=it;break}}const Pt=Math.max(Tt,Ct-P);const Gt=Math.max(Dt,Rt-q);mt({width:Pt,height:Gt,left:P,top:q});et.setValue(Pt);ot.setValue(Gt);p.setValue({x:P,y:q});V.current={width:Pt,height:Gt,left:P,top:q}},onPanResponderRelease:()=>{G(false);r=false;mt(V.current)},onPanResponderTerminate:()=>{G(false);r=false}})},[l,Ht,L.left,L.right,L.top,L.bottom,p,et,ot,s,st]);const ae=_t(()=>{return{topLeft:pt("topLeft"),topRight:pt("topRight"),bottomLeft:pt("bottomLeft"),bottomRight:pt("bottomRight")}},[pt]);const Be=Q(()=>{dt(true)},[]);const Ae=Q(t=>{dt(false);const r=V.current;const e={...r,left:t.x,top:t.y};mt(e)},[]);const se=d(0);const bt=d(0);const wt=d(null);const We=Q(()=>{const t=Date.now();const r=t-se.current;if(r>500){bt.current=0}bt.current++;se.current=t;if(wt.current){clearTimeout(wt.current)}wt.current=setTimeout(()=>{if(bt.current===2){nt()}else if(bt.current>=3){if(D){J()}}bt.current=0},300)},[nt,D,J]);C(()=>{return()=>{if(wt.current){clearTimeout(wt.current)}}},[]);if(l==="floating"){return X(i.View,{nativeID:"jsmodal-root",pointerEvents:a?"auto":"none",accessibilityElementsHidden:!a,importantForAccessibility:a?"auto":"no-hide-descendants",style:[o.floatingModal,{width:j.width,height:j.height,opacity:ee,transform:[{translateX:p.x},{translateY:p.y}],...It!==void 0&&{zIndex:It}},H==="night"&&o.nightFloatingModal,(kt||lt)&&o.floatingModalDragging,S.container,!a&&o.parkedOffscreen],children:[xt&&H==="night"?n(c,{style:o.nightBackdropFloating,pointerEvents:"none",children:n(Wt,{})}):null,n(Ge,{position:p,onDragStart:Be,onDragEnd:Ae,onTap:We,containerBounds:Ht,elementSize:j,minPosition:{x:0,y:L.top},style:o.floatingHeader,enabled:l==="floating"&&!lt,children:n(ye,{header:U,onClose:s,onToggleMode:nt,onMinimize:D?J:void 0,isResizing:kt||lt,mode:l,variant:H})}),n(c,{style:o.windowControlsContainer,children:n(fe,{onClose:s,onMinimize:D?J:void 0,onToggleMode:nt,mode:l,variant:H})}),X(c,{style:[o.content,H==="night"&&o.nightContent,S.content],children:[xt&&H!=="night"?n(Wt,{}):null,Xt?n(c,{style:{flex:1,paddingBottom:z},children:W}):n(he,{style:{flex:1},contentContainerStyle:{flexGrow:1,paddingBottom:z},showsVerticalScrollIndicator:true,nestedScrollEnabled:true,keyboardShouldPersistTaps:"handled",children:W}),K?n(c,{style:Ce.footerContainer,children:K}):null]}),n(c,{...ae.bottomLeft.panHandlers,style:[o.cornerHandleWrapper,{bottom:4,left:4}],hitSlop:{top:2,left:2,right:2,bottom:2},children:n(we,{position:"bottomLeft",isActive:kt||lt})}),n(c,{...ae.bottomRight.panHandlers,style:[o.cornerHandleWrapper,{bottom:4,right:4}],hitSlop:{top:2,left:2,right:2,bottom:2},children:n(we,{position:"bottomRight",isActive:kt||lt})})]})}return n(c,{style:[a?o.fullScreenContainer:o.parkedFullScreen,a&&It!==void 0&&{zIndex:It}],pointerEvents:a?"box-none":"none",accessibilityElementsHidden:!a,importantForAccessibility:a?"auto":"no-hide-descendants",children:n(i.View,{nativeID:"jsmodal-root",style:[o.bottomSheetWrapper,{opacity:ee,transform:[{translateY:Se}]}],children:X(i.View,{style:[o.bottomSheet,H==="night"&&o.nightBottomSheet,S.container,{height:g||_}],children:[xt&&H==="night"?n(c,{style:o.nightBackdropSheet,pointerEvents:"none",children:n(Wt,{})}):null,n(ye,{header:U,onClose:s,onToggleMode:nt,onMinimize:D?J:void 0,isResizing:lt,mode:l,panHandlers:ve.panHandlers,variant:H}),n(c,{style:o.windowControlsContainer,children:n(fe,{onClose:s,onMinimize:D?J:void 0,onToggleMode:nt,mode:l,variant:H})}),Te&&Ve&&l==="bottomSheet"&&!De&&n(_e,{onAcknowledge:Le}),X(c,{style:[o.content,H==="night"&&o.nightContent,S.content],children:[xt&&H!=="night"?n(Wt,{}):null,Xt?n(c,{style:{flex:1,paddingBottom:z},children:W}):n(he,{style:{flex:1},contentContainerStyle:{flexGrow:1,paddingBottom:z},showsVerticalScrollIndicator:true,nestedScrollEnabled:true,keyboardShouldPersistTaps:"handled",children:W}),K?n(c,{style:Ce.footerContainer,children:K}):null]})]})})})};const o=At.create({fullScreenContainer:{...jt,zIndex:1e3},bottomSheetWrapper:{position:"absolute",bottom:0,left:0,right:0},bottomSheet:{backgroundColor:b.card,borderTopLeftRadius:6,borderTopRightRadius:6,borderWidth:1,borderColor:b.border,shadowColor:b.primary,shadowOffset:{width:0,height:-4},shadowOpacity:.2,shadowRadius:12,elevation:20},parkedOffscreen:{left:-9999,top:-9999,opacity:0},parkedFullScreen:{position:"absolute",left:-9999,top:-9999,width:u.width,height:u.height,opacity:0},floatingModal:{position:"absolute",backgroundColor:b.card,borderRadius:6,borderWidth:1,borderColor:b.border,shadowColor:b.primary,shadowOffset:{width:0,height:0},shadowOpacity:.3,shadowRadius:20,elevation:24,zIndex:1e3,width:ht,height:ft},floatingModalDragging:{borderColor:b.primary,borderWidth:2,shadowColor:b.primary+"99",shadowOpacity:.8,shadowRadius:12},header:{borderTopLeftRadius:6,borderTopRightRadius:6,backgroundColor:b.card,minHeight:56,borderWidth:1,borderColor:b.border,borderBottomWidth:1,borderBottomColor:b.border},nightBottomSheet:{backgroundColor:T.color.bg,borderTopLeftRadius:T.radius.sheet,borderTopRightRadius:T.radius.sheet,borderWidth:At.hairlineWidth,borderColor:T.color.accent+"55",shadowColor:T.color.accent,shadowOffset:{width:0,height:-4},shadowOpacity:.22,shadowRadius:10},nightFloatingModal:{backgroundColor:T.color.bg,borderRadius:T.radius.sheet,borderWidth:At.hairlineWidth,borderColor:T.color.accent+"55",shadowColor:T.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.22,shadowRadius:14},nightHeader:{backgroundColor:"transparent",borderWidth:0,borderBottomWidth:0,borderTopLeftRadius:T.radius.sheet,borderTopRightRadius:T.radius.sheet},nightContent:{backgroundColor:"transparent"},nightBackdropSheet:{...jt,borderTopLeftRadius:T.radius.sheet,borderTopRightRadius:T.radius.sheet,overflow:"hidden"},nightBackdropFloating:{...jt,borderRadius:T.radius.sheet,overflow:"hidden"},nightDragIndicator:{width:36,height:5,borderRadius:2.5,backgroundColor:T.color.placeholder,shadowOpacity:0,elevation:0},floatingHeader:{borderTopLeftRadius:6,borderTopRightRadius:6},windowControlsContainer:{position:"absolute",top:4,right:4,zIndex:10},floatingModeHeader:{borderTopLeftRadius:6,borderTopRightRadius:6},headerInner:{flex:1,justifyContent:"center"},dragIndicatorContainer:{alignItems:"center",paddingVertical:8,backgroundColor:"transparent"},dragIndicatorContainerCustom:{minHeight:Xe,justifyContent:"center",paddingVertical:0,backgroundColor:"transparent"},dragIndicator:{width:40,height:3,backgroundColor:b.primary,borderRadius:2,shadowColor:b.primary,shadowOffset:{width:0,height:0},shadowOpacity:.6,shadowRadius:4},floatingDragIndicator:{width:50,height:5,backgroundColor:b.textMuted},dragIndicatorActive:{backgroundColor:b.primary,width:40},resizeGripContainer:{position:"absolute",flexDirection:"row",gap:2,marginTop:12},resizeGripLine:{width:12,height:1,backgroundColor:A.success,opacity:.6},headerContent:{paddingHorizontal:16,alignItems:"center"},headerControls:{position:"absolute",top:8,right:16,flexDirection:"row",alignItems:"center"},headerTitle:{fontSize:16,fontWeight:"600",color:A.primary},headerSubtitle:{fontSize:12,color:A.secondary,paddingTop:4},headerHintText:{position:"absolute",top:0,left:0,right:0,bottom:0,justifyContent:"center",alignItems:"center"},hintText:{fontSize:10,color:A.muted,fontStyle:"italic"},controlButton:{width:28,height:28,borderRadius:6,justifyContent:"center",alignItems:"center",marginLeft:8},toggleButton:{backgroundColor:A.info+"1A",borderWidth:1,borderColor:A.info+"33"},closeButton:{width:28,height:28,borderRadius:6,justifyContent:"center",alignItems:"center",backgroundColor:A.error+"1A",borderWidth:1,borderColor:A.error+"33",marginLeft:8},iconLine:{position:"absolute",top:7.25,left:2,width:12,height:1.5,backgroundColor:A.error},content:{flex:1,backgroundColor:b.base,borderBottomLeftRadius:16,borderBottomRightRadius:16,overflow:"hidden"},cornerHandle:{position:"absolute",zIndex:1},cornerHandleWrapper:{position:"absolute",width:30,height:30,zIndex:1e3},handler:{width:20,height:20,backgroundColor:"transparent",borderRadius:10,borderWidth:0,borderColor:"transparent"},handlerActive:{backgroundColor:A.success+"1A",borderColor:A.success,borderWidth:2,shadowColor:A.success+"99",shadowOffset:{width:0,height:0},shadowOpacity:1,shadowRadius:8}});const Ce=At.create({footerContainer:{position:"absolute",left:0,right:0,bottom:0,backgroundColor:b.base,borderBottomLeftRadius:16,borderBottomRightRadius:16}});export const JsModal=Bt(a=>{const s=Me()();if(s.status!=="admitted")return a.visible?n(Ne,{}):null;return n(Ue,{...a})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import J,{Fragment as O,useMemo as w,memo as W}from"react";import{View as i,Text as c,ScrollView as H,StyleSheet as j}from"react-native";import{computeLineDiff as U,DiffType as d}from"./lineDiff.js";import{DiffSummary as G}from"./DiffSummary.js";import{devToolsDefaultTheme as _}from"./diffThemes.js";import{monoFont as g}from"../ui/fonts.js";import{jsx as t,Fragment as E,jsxs as f}from"react/jsx-runtime";export const SplitDiffViewer=W(function o({oldValue:m,newValue:D,theme:r=_,options:N={},showThemeName:L=false,height:b=400}){const{hideLineNumbers:C=false,disableWordDiff:x=false,showDiffOnly:h=false,compareMethod:S="words",contextLines:T=3}=N;const F={compareMethod:S,disableWordDiff:x,showDiffOnly:h,contextLines:T};const y=w(()=>U(m,D,F),[m,D,S,x,h,T]);const e=w(()=>P(r,b),[r,b]);const v=n=>{return n.map((l,u)=>{let a="transparent";if(l.type===d.ADDED){a=r.addedWordHighlight}else if(l.type===d.REMOVED){a=r.removedWordHighlight}return t(c,{style:[e.wordDiff,{backgroundColor:a}],children:l.value},u)})};const I=(n,l=false)=>{if(l){return{background:r.modifiedBackground,text:r.modifiedText,markerBg:r.markerModifiedBackground}}switch(n){case d.ADDED:return{background:r.addedBackground,text:r.addedText,markerBg:r.markerAddedBackground};case d.REMOVED:return{background:r.removedBackground,text:r.removedText,markerBg:r.markerRemovedBackground};case d.DEFAULT:return{background:r.unchangedBackground,text:r.unchangedText,markerBg:"transparent"};default:return{background:r.unchangedBackground,text:r.unchangedText,markerBg:"transparent"}}};const k=(n,l,u,a,p=false)=>{if(p){return f(E,{children:[!C&&t(i,{style:[e.gutter,e.emptyGutter],children:t(c,{style:e.lineNumber,children:" "})}),t(i,{style:[e.marker,e.emptyMarker],children:t(c,{style:e.markerText,children:" "})}),t(i,{style:[e.contentCell,e.emptyContent],children:t(c,{style:e.content,children:" "})})]})}const s=I(u);return f(E,{children:[!C&&t(i,{style:[e.gutter,{backgroundColor:r.lineNumberBackground}],children:t(c,{style:e.lineNumber,children:n||" "})}),t(i,{style:[e.marker,{backgroundColor:s.markerBg}],children:t(c,{style:[e.markerText,{color:r.markerText}],children:a})}),t(i,{style:[e.contentCell,{backgroundColor:s.background}],children:t(c,{style:[e.content,{color:s.text}],children:Array.isArray(l)?v(l):l||" "})})]})};const R=(n,l)=>{if(!h||n===0)return false;const u=l[n-1];const a=l[n];const p=a.leftLineNumber&&u.leftLineNumber&&a.leftLineNumber-u.leftLineNumber>1;const s=a.rightLineNumber&&u.rightLineNumber&&a.rightLineNumber-u.rightLineNumber>1;return p||s};const V=(n,l,u)=>{const a=n.type===d.REMOVED;const p=n.type===d.ADDED;const s=n.type===d.MODIFIED;const B=n.type===d.DEFAULT;return f(O,{children:[R(l,u)&&t(i,{style:e.separator,children:t(c,{style:e.separatorText,children:"\u2022 \u2022 \u2022"})}),f(i,{style:e.row,children:[t(i,{style:e.leftSide,children:a||s||B?k(n.leftLineNumber,n.leftContent,s?d.REMOVED:n.type,a||s?"-":" "):k(void 0,void 0,d.DEFAULT," ",true)}),t(i,{style:e.centerDivider}),t(i,{style:e.rightSide,children:p||s||B?k(n.rightLineNumber,n.rightContent,s?d.ADDED:n.type,p||s?"+":" "):k(void 0,void 0,d.DEFAULT," ",true)})]})]},l)};const z=y.filter(n=>n.type===d.ADDED).length;const A=y.filter(n=>n.type===d.REMOVED).length;const M=y.filter(n=>n.type===d.MODIFIED).length;return f(i,{style:[e.container,r.glowColor&&{shadowColor:r.glowColor,shadowOffset:{width:0,height:0},shadowOpacity:r.neonIntensity&&r.neonIntensity>.7?.5:r.neonIntensity&&r.neonIntensity>.3?.3:.1,shadowRadius:r.neonIntensity&&r.neonIntensity>.7?10:r.neonIntensity&&r.neonIntensity>.3?5:2}],children:[L&&f(i,{style:e.themeBadge,children:[t(c,{style:e.themeName,children:r.name}),t(c,{style:e.themeDescription,children:r.description})]}),f(i,{style:e.header,children:[t(i,{style:e.headerLeft,children:t(c,{style:e.headerTitle,children:"PREV"})}),t(i,{style:e.divider}),t(i,{style:e.headerRight,children:t(c,{style:e.headerTitle,children:"CUR"})})]}),t(G,{added:z,removed:A,modified:M,theme:r}),t(H,{style:e.scrollView,showsVerticalScrollIndicator:false,contentContainerStyle:e.scrollContent,children:y.length===0?t(i,{style:e.emptyState,children:t(c,{style:e.emptyText,children:h?"No differences found":"No content to display"})}):y.map((n,l)=>V(n,l,y))})]})});function P(o,m){return j.create({container:{height:m,backgroundColor:o.background,borderRadius:8,overflow:"hidden",borderWidth:1,borderColor:o.borderColor},themeBadge:{backgroundColor:o.panelBackground,paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:o.borderColor},themeName:{fontSize:12,fontWeight:"700",color:o.accentColor||o.unchangedText,fontFamily:g,letterSpacing:.5},themeDescription:{fontSize:10,color:o.unchangedText,fontFamily:g,marginTop:2,opacity:.8},header:{flexDirection:"row",backgroundColor:o.headerBackground,borderBottomWidth:1,borderBottomColor:o.borderColor},headerLeft:{flex:1,paddingVertical:8,paddingHorizontal:12},headerRight:{flex:1,paddingVertical:8,paddingHorizontal:12},headerTitle:{fontSize:10,fontWeight:"700",color:o.accentColor||o.unchangedText,fontFamily:g,letterSpacing:.5,textTransform:"uppercase"},divider:{width:1,backgroundColor:o.dividerColor},scrollView:{flex:1},scrollContent:{paddingBottom:10},row:{flexDirection:"row",minHeight:20},leftSide:{flex:1,flexDirection:"row"},rightSide:{flex:1,flexDirection:"row"},centerDivider:{width:1,backgroundColor:o.dividerColor},gutter:{width:35,paddingHorizontal:4,justifyContent:"center",alignItems:"flex-end",backgroundColor:o.lineNumberBackground,borderRightWidth:1,borderRightColor:o.lineNumberBorder},emptyGutter:{backgroundColor:o.contextBackground},lineNumber:{fontSize:9,fontFamily:g,color:o.lineNumberText},marker:{width:20,justifyContent:"center",alignItems:"center"},emptyMarker:{backgroundColor:o.contextBackground},markerText:{fontSize:10,fontFamily:g,fontWeight:"600"},contentCell:{flex:1,paddingHorizontal:8,paddingVertical:2},emptyContent:{backgroundColor:o.contextBackground},content:{fontSize:10,fontFamily:g,lineHeight:16},wordDiff:{fontSize:10,fontFamily:g},separator:{height:20,justifyContent:"center",alignItems:"center",backgroundColor:o.separatorBackground},separatorText:{fontSize:8,color:o.separatorText,fontFamily:g,letterSpacing:2},emptyState:{padding:40,alignItems:"center",justifyContent:"center"},emptyText:{fontSize:11,color:o.emptyStateText,fontStyle:"italic",fontFamily:g}})}
|
|
1
|
+
"use strict";import J,{Fragment as O,useMemo as w,memo as W}from"react";import{View as i,Text as c,ScrollView as H,StyleSheet as j}from"react-native";import{computeLineDiff as U,DiffType as d}from"./lineDiff.js";import{DiffSummary as G}from"./DiffSummary.js";import{devToolsDefaultTheme as _}from"./diffThemes.js";import{monoFont as g}from"../ui/fonts.js";import{jsx as t,Fragment as E,jsxs as f}from"react/jsx-runtime";export const SplitDiffViewer=W(function o({oldValue:m,newValue:D,theme:r=_,options:N={},showThemeName:L=false,height:b=400}){const{hideLineNumbers:C=false,disableWordDiff:x=false,showDiffOnly:h=false,compareMethod:S="words",contextLines:T=3}=N;const F={compareMethod:S,disableWordDiff:x,showDiffOnly:h,contextLines:T};const y=w(()=>U(m,D,F),[m,D,S,x,h,T]);const e=w(()=>P(r,b),[r,b]);const v=n=>{return n.map((l,u)=>{let a="transparent";if(l.type===d.ADDED){a=r.addedWordHighlight}else if(l.type===d.REMOVED){a=r.removedWordHighlight}return t(c,{style:[e.wordDiff,{backgroundColor:a}],children:l.value},u)})};const I=(n,l=false)=>{if(l){return{background:r.modifiedBackground,text:r.modifiedText,markerBg:r.markerModifiedBackground}}switch(n){case d.ADDED:return{background:r.addedBackground,text:r.addedText,markerBg:r.markerAddedBackground};case d.REMOVED:return{background:r.removedBackground,text:r.removedText,markerBg:r.markerRemovedBackground};case d.DEFAULT:return{background:r.unchangedBackground,text:r.unchangedText,markerBg:"transparent"};default:return{background:r.unchangedBackground,text:r.unchangedText,markerBg:"transparent"}}};const k=(n,l,u,a,p=false)=>{if(p){return f(E,{children:[!C&&t(i,{style:[e.gutter,e.emptyGutter],children:t(c,{style:e.lineNumber,children:" "})}),t(i,{style:[e.marker,e.emptyMarker],children:t(c,{style:e.markerText,children:" "})}),t(i,{style:[e.contentCell,e.emptyContent],children:t(c,{style:e.content,children:" "})})]})}const s=I(u);return f(E,{children:[!C&&t(i,{style:[e.gutter,{backgroundColor:r.lineNumberBackground}],children:t(c,{style:e.lineNumber,children:n||" "})}),t(i,{style:[e.marker,{backgroundColor:s.markerBg}],children:t(c,{style:[e.markerText,{color:r.markerText}],children:a})}),t(i,{style:[e.contentCell,{backgroundColor:s.background}],children:t(c,{style:[e.content,{color:s.text}],children:Array.isArray(l)?v(l):l||" "})})]})};const R=(n,l)=>{if(!h||n===0)return false;const u=l[n-1];const a=l[n];const p=a.leftLineNumber&&u.leftLineNumber&&a.leftLineNumber-u.leftLineNumber>1;const s=a.rightLineNumber&&u.rightLineNumber&&a.rightLineNumber-u.rightLineNumber>1;return p||s};const V=(n,l,u)=>{const a=n.type===d.REMOVED;const p=n.type===d.ADDED;const s=n.type===d.MODIFIED;const B=n.type===d.DEFAULT;return f(O,{children:[R(l,u)&&t(i,{style:e.separator,children:t(c,{style:e.separatorText,children:"\u2022 \u2022 \u2022"})}),f(i,{style:e.row,children:[t(i,{style:e.leftSide,children:a||s||B?k(n.leftLineNumber,n.leftContent,s?d.REMOVED:n.type,a||s?"-":" "):k(void 0,void 0,d.DEFAULT," ",true)}),t(i,{style:e.centerDivider}),t(i,{style:e.rightSide,children:p||s||B?k(n.rightLineNumber,n.rightContent,s?d.ADDED:n.type,p||s?"+":" "):k(void 0,void 0,d.DEFAULT," ",true)})]})]},l)};const z=y.filter(n=>n.type===d.ADDED).length;const A=y.filter(n=>n.type===d.REMOVED).length;const M=y.filter(n=>n.type===d.MODIFIED).length;return f(i,{style:[e.container,r.glowColor&&{shadowColor:r.glowColor,shadowOffset:{width:0,height:0},shadowOpacity:r.neonIntensity&&r.neonIntensity>.7?.5:r.neonIntensity&&r.neonIntensity>.3?.3:.1,shadowRadius:r.neonIntensity&&r.neonIntensity>.7?10:r.neonIntensity&&r.neonIntensity>.3?5:2}],children:[L&&f(i,{style:e.themeBadge,children:[t(c,{style:e.themeName,children:r.name}),t(c,{style:e.themeDescription,children:r.description})]}),f(i,{style:e.header,children:[t(i,{style:e.headerLeft,children:t(c,{style:e.headerTitle,children:"PREV"})}),t(i,{style:e.divider}),t(i,{style:e.headerRight,children:t(c,{style:e.headerTitle,children:"CUR"})})]}),t(G,{added:z,removed:A,modified:M,theme:r}),t(H,{keyboardShouldPersistTaps:"handled",style:e.scrollView,showsVerticalScrollIndicator:false,contentContainerStyle:e.scrollContent,children:y.length===0?t(i,{style:e.emptyState,children:t(c,{style:e.emptyText,children:h?"No differences found":"No content to display"})}):y.map((n,l)=>V(n,l,y))})]})});function P(o,m){return j.create({container:{height:m,backgroundColor:o.background,borderRadius:8,overflow:"hidden",borderWidth:1,borderColor:o.borderColor},themeBadge:{backgroundColor:o.panelBackground,paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:o.borderColor},themeName:{fontSize:12,fontWeight:"700",color:o.accentColor||o.unchangedText,fontFamily:g,letterSpacing:.5},themeDescription:{fontSize:10,color:o.unchangedText,fontFamily:g,marginTop:2,opacity:.8},header:{flexDirection:"row",backgroundColor:o.headerBackground,borderBottomWidth:1,borderBottomColor:o.borderColor},headerLeft:{flex:1,paddingVertical:8,paddingHorizontal:12},headerRight:{flex:1,paddingVertical:8,paddingHorizontal:12},headerTitle:{fontSize:10,fontWeight:"700",color:o.accentColor||o.unchangedText,fontFamily:g,letterSpacing:.5,textTransform:"uppercase"},divider:{width:1,backgroundColor:o.dividerColor},scrollView:{flex:1},scrollContent:{paddingBottom:10},row:{flexDirection:"row",minHeight:20},leftSide:{flex:1,flexDirection:"row"},rightSide:{flex:1,flexDirection:"row"},centerDivider:{width:1,backgroundColor:o.dividerColor},gutter:{width:35,paddingHorizontal:4,justifyContent:"center",alignItems:"flex-end",backgroundColor:o.lineNumberBackground,borderRightWidth:1,borderRightColor:o.lineNumberBorder},emptyGutter:{backgroundColor:o.contextBackground},lineNumber:{fontSize:9,fontFamily:g,color:o.lineNumberText},marker:{width:20,justifyContent:"center",alignItems:"center"},emptyMarker:{backgroundColor:o.contextBackground},markerText:{fontSize:10,fontFamily:g,fontWeight:"600"},contentCell:{flex:1,paddingHorizontal:8,paddingVertical:2},emptyContent:{backgroundColor:o.contextBackground},content:{fontSize:10,fontFamily:g,lineHeight:16},wordDiff:{fontSize:10,fontFamily:g},separator:{height:20,justifyContent:"center",alignItems:"center",backgroundColor:o.separatorBackground},separatorText:{fontSize:8,color:o.separatorText,fontFamily:g,letterSpacing:2},emptyState:{padding:40,alignItems:"center",justifyContent:"center"},emptyText:{fontSize:11,color:o.emptyStateText,fontStyle:"italic",fontFamily:g}})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Fragment as C,memo as O,useCallback as S,useEffect as W,useMemo as x,useRef as H,useState as A}from"react";import{View as u,Text as m,FlatList as V,StyleSheet as j,TouchableOpacity as
|
|
1
|
+
"use strict";import{Fragment as C,memo as O,useCallback as S,useEffect as W,useMemo as x,useRef as H,useState as A}from"react";import{View as u,Text as m,FlatList as V,StyleSheet as j,TouchableOpacity as P}from"react-native";import{computeLineDiff as _,DiffType as g}from"./lineDiff.js";import{DiffSummary as $}from"./DiffSummary.js";import{TimestampDeltaBar as U}from"./TimestampDeltaBar.js";import{describeTimestampDeltas as G}from"./timestampDiff.js";import{JsonStringNotice as J}from"./JsonStringNotice.js";import{decodeJsonStringPair as X}from"./jsonStringValue.js";import{monoFont as y}from"../ui/fonts.js";import{jsx as o,jsxs as k}from"react/jsx-runtime";const Z={hideLineNumbers:false,disableWordDiff:false,showDiffOnly:false,compareMethod:"words",contextLines:3,lineOffset:0};export function ThemedSplitView({oldValue:e,newValue:r,theme:n,options:l=Z,showThemeName:a=false,scrollEnabled:c=true}){const t=x(()=>re(n,c),[n,c]);const i=x(()=>({compareMethod:l.compareMethod,disableWordDiff:l.disableWordDiff,showDiffOnly:l.showDiffOnly,contextLines:l.contextLines}),[l.compareMethod,l.disableWordDiff,l.showDiffOnly,l.contextLines]);const d=x(()=>X(e,r),[e,r]);const f=x(()=>_(d.left,d.right,i),[d,i]);const p=x(()=>{let s=0;let D=0;let h=0;for(const T of f){if(T.type===g.ADDED)s++;else if(T.type===g.REMOVED)D++;else if(T.type===g.MODIFIED)h++}return{added:s,removed:D,modified:h}},[f]);const b=x(()=>G(d.left,d.right),[d]);const[I,B]=A(()=>new Set);const E=H(false);W(()=>{if(!E.current){E.current=true;return}B(new Set)},[e,r]);const F=x(()=>K(f,I),[f,I]);const N=S(s=>{B(D=>{const h=new Set(D);if(h.has(s))h.delete(s);else h.add(s);return h})},[]);const L=S(s=>s.kind==="row"?`r:${s.diffIndex}`:`f:${s.foldId}`,[]);const w=S(s=>{if(s.kind==="fold"){return o(Q,{foldId:s.foldId,count:s.count,expanded:s.expanded,theme:n,styles:t,onToggle:N})}return o(Y,{diff:s.diff,showSeparator:false,theme:n,options:l,styles:t})},[n,l,t,N]);const z=S(({item:s})=>w(s),[w]);return k(u,{style:[t.container,n.glowColor&&{shadowColor:n.glowColor,shadowOffset:{width:0,height:0},shadowOpacity:n.neonIntensity&&n.neonIntensity>.7?.5:n.neonIntensity&&n.neonIntensity>.3?.3:.1,shadowRadius:n.neonIntensity&&n.neonIntensity>.7?10:n.neonIntensity&&n.neonIntensity>.3?5:2}],children:[a&&k(u,{style:t.themeBadge,children:[o(m,{style:t.themeName,children:n.name}),o(m,{style:t.themeDescription,children:n.description})]}),k(u,{style:t.header,children:[o(u,{style:t.headerLeft,children:o(m,{style:t.headerTitle,children:"PREV"})}),o(u,{style:t.divider}),o(u,{style:t.headerRight,children:o(m,{style:t.headerTitle,children:"CUR"})})]}),o($,{added:p.added,removed:p.removed,modified:p.modified,theme:n}),o(J,{visible:d.decoded,theme:n}),o(U,{deltas:b,theme:n}),f.length===0?o(u,{style:t.emptyState,children:o(m,{style:t.emptyText,children:l.showDiffOnly?"No differences found":"No content to display"})}):c?o(V,{keyboardShouldPersistTaps:"handled",style:t.scrollView,contentContainerStyle:t.scrollContent,data:F,renderItem:z,keyExtractor:L,showsVerticalScrollIndicator:false,initialNumToRender:20,maxToRenderPerBatch:20,windowSize:7,removeClippedSubviews:true}):o(u,{style:t.scrollContent,children:F.map(s=>o(C,{children:w(s)},L(s)))})]})}const v=3;const q=4;function K(e,r){const n=e.length;if(n===0)return[];const l=new Array(n).fill(false);for(let i=0;i<n;i++){if(e[i].type!==g.DEFAULT){const d=Math.max(0,i-v);const f=Math.min(n-1,i+v);for(let p=d;p<=f;p++)l[p]=true}}const a=[];let c=0;let t=0;while(t<n){if(l[t]){a.push({kind:"row",diff:e[t],diffIndex:t});t++;continue}let i=t;while(i<n&&!l[i])i++;const d=i-t;if(d<q){for(let f=t;f<i;f++){a.push({kind:"row",diff:e[f],diffIndex:f})}}else{const f=c++;const p=r.has(f);a.push({kind:"fold",foldId:f,count:d,expanded:p});if(p){for(let b=t;b<i;b++){a.push({kind:"row",diff:e[b],diffIndex:b})}}}t=i}return a}const Q=O(function e({foldId:r,count:n,expanded:l,theme:a,styles:c,onToggle:t}){return o(P,{style:[c.foldHeader,{backgroundColor:a.separatorBackground}],onPress:()=>t(r),activeOpacity:.7,children:o(m,{style:[c.foldHeaderText,{color:a.separatorText}],children:l?`\u25BC ${n} unchanged line${n===1?"":"s"} \u2014 tap to hide`:`\u25B6 ${n} unchanged line${n===1?"":"s"} \u2014 tap to expand`})})});const Y=O(function e({diff:r,showSeparator:n,theme:l,options:a,styles:c}){const t=r.type===g.REMOVED;const i=r.type===g.ADDED;const d=r.type===g.MODIFIED;const f=r.type===g.DEFAULT;return k(C,{children:[n&&o(u,{style:c.separator,children:o(m,{style:c.separatorText,children:"\u2022 \u2022 \u2022"})}),k(u,{style:c.row,children:[o(u,{style:c.leftSide,children:t||d||f?o(R,{lineNumber:r.leftLineNumber,content:r.leftContent,type:d?g.REMOVED:r.type,marker:t||d?"-":" ",theme:l,options:a,styles:c}):o(M,{options:a,styles:c})}),o(u,{style:c.centerDivider}),o(u,{style:c.rightSide,children:i||d||f?o(R,{lineNumber:r.rightLineNumber,content:r.rightContent,type:d?g.ADDED:r.type,marker:i||d?"+":" ",theme:l,options:a,styles:c}):o(M,{options:a,styles:c})})]})]})});function R({lineNumber:e,content:r,type:n,marker:l,theme:a,options:c,styles:t}){const i=ee(n,a);return k(C,{children:[!c.hideLineNumbers&&o(u,{style:[t.gutter,{backgroundColor:a.lineNumberBackground}],children:o(m,{style:t.lineNumber,children:e||" "})}),o(u,{style:[t.marker,{backgroundColor:i.markerBg}],children:o(m,{style:[t.markerText,{color:a.markerText}],children:l})}),o(u,{style:[t.contentCell,{backgroundColor:i.background}],children:o(m,{style:[t.content,{color:i.text}],children:Array.isArray(r)?r.map((d,f)=>{let p="transparent";if(d.type===g.ADDED){p=a.addedWordHighlight}else if(d.type===g.REMOVED){p=a.removedWordHighlight}return o(m,{style:[t.wordDiff,{backgroundColor:p}],children:d.value},f)}):r||" "})})]})}function M({options:e,styles:r}){return k(C,{children:[!e.hideLineNumbers&&o(u,{style:[r.gutter,r.emptyGutter],children:o(m,{style:r.lineNumber,children:" "})}),o(u,{style:[r.marker,r.emptyMarker],children:o(m,{style:r.markerText,children:" "})}),o(u,{style:[r.contentCell,r.emptyContent],children:o(m,{style:r.content,children:" "})})]})}function ee(e,r){switch(e){case g.ADDED:return{background:r.addedBackground,text:r.addedText,markerBg:r.markerAddedBackground};case g.REMOVED:return{background:r.removedBackground,text:r.removedText,markerBg:r.markerRemovedBackground};case g.DEFAULT:default:return{background:r.unchangedBackground,text:r.unchangedText,markerBg:"transparent"}}}function re(e,r){return j.create({container:{...r?{height:400}:null,backgroundColor:e.background,borderRadius:8,overflow:"hidden",borderWidth:1,borderColor:e.borderColor},themeBadge:{backgroundColor:e.panelBackground,paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:e.borderColor},themeName:{fontSize:12,fontWeight:"700",color:e.accentColor||e.unchangedText,fontFamily:y,letterSpacing:.5},themeDescription:{fontSize:10,color:e.unchangedText,fontFamily:y,marginTop:2,opacity:.8},header:{flexDirection:"row",backgroundColor:e.headerBackground,borderBottomWidth:1,borderBottomColor:e.borderColor},headerLeft:{flex:1,paddingVertical:8,paddingHorizontal:12},headerRight:{flex:1,paddingVertical:8,paddingHorizontal:12},headerTitle:{fontSize:10,fontWeight:"700",color:e.accentColor||e.unchangedText,fontFamily:y,letterSpacing:.5,textTransform:"uppercase"},divider:{width:1,backgroundColor:e.dividerColor},scrollView:{flex:1},scrollContent:{paddingBottom:10},row:{flexDirection:"row",minHeight:20},leftSide:{flex:1,flexDirection:"row"},rightSide:{flex:1,flexDirection:"row"},centerDivider:{width:1,backgroundColor:e.dividerColor},gutter:{width:35,paddingHorizontal:4,justifyContent:"center",alignItems:"flex-end",backgroundColor:e.lineNumberBackground,borderRightWidth:1,borderRightColor:e.lineNumberBorder},emptyGutter:{backgroundColor:e.contextBackground},lineNumber:{fontSize:9,fontFamily:y,color:e.lineNumberText},marker:{width:20,justifyContent:"center",alignItems:"center"},emptyMarker:{backgroundColor:e.contextBackground},markerText:{fontSize:10,fontFamily:y,fontWeight:"600"},contentCell:{flex:1,paddingHorizontal:8,paddingVertical:2},emptyContent:{backgroundColor:e.contextBackground},content:{fontSize:10,fontFamily:y,lineHeight:16},wordDiff:{fontSize:10,fontFamily:y},summaryBar:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:16,paddingVertical:6,backgroundColor:e.summaryBackground,borderTopWidth:1,borderTopColor:e.borderColor},summaryItem:{flexDirection:"row",alignItems:"center"},summaryText:{fontSize:10,fontFamily:y,fontWeight:"700"},separator:{height:20,justifyContent:"center",alignItems:"center",backgroundColor:e.separatorBackground},separatorText:{fontSize:8,color:e.separatorText,fontFamily:y,letterSpacing:2},foldHeader:{paddingVertical:6,paddingHorizontal:12,alignItems:"center",justifyContent:"center",borderTopWidth:1,borderBottomWidth:1,borderColor:e.borderColor},foldHeaderText:{fontSize:10,fontFamily:y,letterSpacing:.5},emptyState:{padding:40,alignItems:"center",justifyContent:"center"},emptyText:{fontSize:11,color:e.emptyStateText,fontStyle:"italic",fontFamily:y}})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useState as B,useMemo as re,useCallback as U,useRef as _,useEffect as te,memo as oe}from"react";import{Text as P,TouchableOpacity as ie,View as u,StyleSheet as ue,FlatList as pe}from"react-native";import{displayValue as Me}from"../utils/displayValue.js";import{gameUIColors as a}from"../ui/gameUI/index.js";import{night as ye}from"../ui/night/nightTheme.js";import{CopyButton as De}from"../ui/components/CopyButton.js";import{ChevronRight as Re}from"../icons/index.js";import{IndentGuidesOverlay as he}from"./IndentGuidesOverlay.js";import{monoFont as se}from"../ui/fonts.js";import{jsx as i,jsxs as T,Fragment as je}from"react/jsx-runtime";const ge={top:10,bottom:10,left:10,right:10};const z=24;const ke=24;const ee=50;const ne=15;const Pe=500;const Ze=30;const Le=300;const ae=16;const me=Array.from({length:ne+1},(e,l)=>ue.create({container:{marginLeft:l*ae}}).container);const Ae=new Map([["string",a.dataTypes.string],["number",a.dataTypes.number],["bigint",a.optional],["boolean",a.dataTypes.boolean],["null",a.dataTypes.null],["undefined",a.dataTypes.undefined],["function",a.dataTypes.function],["symbol",a.critical],["date",a.critical],["error",a.error],["array",a.dataTypes.array],["object",a.dataTypes.object],["map",a.info],["set",a.success],["circular",a.warning]]);const o=ue.create({container:{backgroundColor:ye.color.bg,borderRadius:8,borderWidth:1,borderColor:ye.color.border},header:{flexDirection:"column",paddingHorizontal:16,paddingVertical:12},headerRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:6},title:{color:a.primary,fontSize:14,fontWeight:"500"},description:{color:a.secondary,fontSize:12,marginTop:2},typeLegend:{flexDirection:"row",flexWrap:"wrap",gap:6,marginTop:8,paddingTop:8,borderTopWidth:1,borderTopColor:a.primary+"14"},typeBadge:{flexDirection:"row",alignItems:"center",paddingHorizontal:6,paddingVertical:2,borderRadius:4,borderWidth:1},typeColor:{width:8,height:8,borderRadius:4,marginRight:4},typeName:{fontSize:10,fontWeight:"500",color:a.secondary},itemContainer:{minHeight:z,backgroundColor:"transparent",position:"relative",flexDirection:"row",alignItems:"flex-start"},itemTouchable:{flex:1,flexDirection:"row",alignItems:"flex-start",paddingLeft:0,paddingRight:16,paddingVertical:2,minHeight:24},itemTouchablePressed:{backgroundColor:a.primary+"0A"},itemSelected:{backgroundColor:a.primary+"14"},expanderContainer:{width:16,alignItems:"center",justifyContent:"center",marginTop:4},expanderIcon:{width:12,height:12},labelContainer:{flex:1,flexDirection:"row",alignItems:"flex-start",paddingLeft:2},labelContainerVertical:{flex:1,flexDirection:"column",paddingLeft:2,paddingVertical:2},labelContainerVerticalRow:{flexDirection:"row",alignItems:"center",marginBottom:2},labelText:{color:a.primary,fontSize:12,fontWeight:"500",fontFamily:se,marginRight:8,flexShrink:1},labelTextTruncated:{color:a.primary,fontSize:12,fontWeight:"500",fontFamily:se,flexShrink:1},valueText:{fontSize:12,fontFamily:se,flex:1,color:a.primaryLight},loadingContainer:{padding:16,alignItems:"center"},loadingText:{color:a.secondary,fontSize:12},noDataContainer:{padding:16,alignItems:"center"},noDataText:{color:a.secondary,fontSize:12},listContent:{paddingBottom:8},headerTouchable:{flex:1,flexDirection:"row",alignItems:"center"},expanderMargin:{marginLeft:8}});function le(e){return{path:e.path.slice(1),value:e.value,label:e.key}}function ce(e,l,d=0){if(d>=l)return d;let h=d+1;if(Array.isArray(e)){for(const w of e){if(h>=l)return h;h=ce(w,l,h)}}else if(e!==null&&typeof e==="object"){for(const w of Object.values(e)){if(h>=l)return h;h=ce(w,l,h)}}return h}const _e=e=>{if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(e instanceof Date)return"date";if(e instanceof Error)return"error";if(e instanceof Map)return"map";if(e instanceof Set)return"set";if(e instanceof RegExp)return"regexp";if(typeof e==="function")return"function";if(typeof e==="symbol")return"symbol";if(typeof e==="bigint")return"bigint";if(typeof e==="object")return"object";return typeof e};const Ve=(e,l)=>{if(e===null)return 0;switch(l){case"array":return Array.isArray(e)?e.length:0;case"object":return typeof e==="object"&&!(e instanceof Date)&&!(e instanceof Error)&&!(e instanceof RegExp)&&!(e instanceof Map)&&!(e instanceof Set)?Object.keys(e).length:0;case"map":return e instanceof Map?e.size:0;case"set":return e instanceof Set?e.size:0;default:return 0}};const He=(e,l)=>{if(e===null)return"null";if(e===void 0)return"undefined";switch(l){case"string":return`"${String(e)}"`;case"boolean":return e===true?"true":"false";case"function":return typeof e==="function"?e.toString().slice(0,50)+"...":"undefined";case"symbol":return typeof e==="symbol"?String(e):"undefined";case"date":return e instanceof Date?e.toISOString():"undefined";case"regexp":return e instanceof RegExp?e.toString():"undefined";case"bigint":return typeof e==="bigint"?e.toString()+"n":"undefined";case"error":return e instanceof Error?`${e.name}: ${e.message}`:"undefined";default:return Me(e)}};const be=e=>{return Ae.get(e)||a.dataTypes.array};const xe=({expanded:e,onPress:l})=>{return i(ie,{"sentry-label":"ignore devtools data explorer expander",style:o.expanderContainer,onPress:l,hitSlop:ge,children:i(u,{style:o.expanderIcon,children:i(Re,{size:12,color:a.secondary,strokeWidth:2,style:{transform:[{rotate:e?"90deg":"0deg"}]}})})})};xe.displayName="Expander";const Te=oe(xe);const Se=({visibleTypes:e})=>{const l=Array.from(new Set(e)).slice(0,8);return i(u,{style:o.typeLegend,children:l.map(d=>{const h=be(d);return T(u,{style:[o.typeBadge,{backgroundColor:`${h}10`,borderColor:`${h}30`}],children:[i(u,{style:[o.typeColor,{backgroundColor:h}]}),i(P,{style:o.typeName,children:d})]},d)})})};Se.displayName="TypeLegend";const ze=oe(Se);const Oe=(e,l=10,d=false)=>{const[h,w]=B([]);const V=_(new Map);const Q=U(()=>{const t=new Set(["root"]);if(d&&e&&typeof e==="object"){if(Array.isArray(e)){e.forEach((m,s)=>{t.add(`root.${s}`)})}else{Object.keys(e).forEach(m=>{t.add(`root.${m}`)})}}return t},[d,e]);const[L,O]=B(()=>Q());const[$,A]=B(false);const I=_(new WeakSet);const j=_(false);const N=_(0);const W=_(0);const c=_(void 0);const C=U((t,m,s,g="root",n=0,M,x=[],S=0,k=1,E=[])=>{if(n>Math.min(l,ne))return[];const p=[...x,g];const f=p.join(".");const b=_e(t);const F=["object","array","map","set"].includes(b)&&t!==null;const J=F?Ve(t,b):0;const H=Math.min(J,Pe);if(t&&typeof t==="object"){if(s.has(t)){return[{id:f,key:g,value:"[Circular Reference]",valueType:"circular",depth:n,isExpandable:false,isExpanded:false,parentId:M,hasChildren:false,childCount:0,path:p,type:"circular",isLastChild:S===k-1,parentHasMoreSiblings:[...E],siblingIndex:S,totalSiblings:k}]}s.add(t)}const r={id:f,key:g,value:t,valueType:b,depth:n,isExpandable:F,isExpanded:m.has(f),parentId:M,hasChildren:H>0,childCount:H,path:p,type:F?"expandable":b,isLastChild:S===k-1,parentHasMoreSiblings:[...E],siblingIndex:S,totalSiblings:k};const y=[r];if(F&&m.has(f)&&n<Math.min(l,ne)){try{let D=[];switch(b){case"array":D=Array.isArray(t)?t.map((R,G)=>[G.toString(),R]):[];break;case"object":D=typeof t==="object"&&t!==null&&!(t instanceof Date)&&!(t instanceof Error)&&!(t instanceof RegExp)&&!(t instanceof Map)&&!(t instanceof Set)?Object.entries(t):[];break;case"map":D=t instanceof Map?Array.from(t.entries()).map(([R,G])=>[String(R),G]):[];break;case"set":D=t instanceof Set?Array.from(t.values()).map((R,G)=>[G.toString(),R]):[];break}const v=D.slice(0,H);const Ce=v.length;const de=[...E];if(n>0){de[n-1]=!r.isLastChild}for(let R=0;R<v.length;R+=ee){const G=v.slice(R,R+ee);let fe=R;for(const[we,Ie]of G){y.push(...C(Ie,m,s,we,n+1,f,p,fe,Ce,de));fe++}if(R>0&&R%(ee*2)===0){break}}}catch(D){console.error("[Buoy]",D)}}return y},[l]);te(()=>{if(c.current&&(c.current.type==="expand"||c.current.type==="collapse")){if($){A(false);j.current=false}c.current=void 0;return}if(j.current){return}let t;const m=++N.current;const s=()=>N.current===m;j.current=true;A(true);const g=async()=>{t=setTimeout(()=>{if(j.current&&s()){A(false);j.current=false}},5e3);await new Promise(n=>setTimeout(()=>n(),10));if(!s()){return}try{I.current=new WeakSet;W.current=Date.now();const n=C(e,L,I.current,"root",0,void 0,[],0,1,[]);const M=new Map;n.forEach((x,S)=>{M.set(x.id,{item:x,index:S})});V.current=M;if(t)clearTimeout(t);if(s()){w(n);A(false);j.current=false}}catch(n){console.error("[Buoy]",n);if(t)clearTimeout(t);if(s()){w([]);V.current=new Map;A(false);j.current=false}}};g();return()=>{j.current=false;if(t)clearTimeout(t)}},[e,L,C,l]);const Y=U((t,m)=>{A(false);j.current=false;w(s=>{const g=V.current.get(t);if(!g){return s}const{item:n,index:M}=g;if(m&&n.isExpandable&&n.hasChildren){const x=[...s];const S=new WeakSet;if(n.value&&typeof n.value==="object"){S.add(n.value)}const k=[];try{let f=[];const b=n.valueType;switch(b){case"array":f=Array.isArray(n.value)?n.value.map((r,y)=>[y.toString(),r]):[];break;case"object":f=typeof n.value==="object"&&n.value!==null&&!(n.value instanceof Date)&&!(n.value instanceof Error)&&!(n.value instanceof RegExp)&&!(n.value instanceof Map)&&!(n.value instanceof Set)?Object.entries(n.value):[];break;case"map":f=n.value instanceof Map?Array.from(n.value.entries()).map(([r,y])=>[String(r),y]):[];break;case"set":f=n.value instanceof Set?Array.from(n.value.values()).map((r,y)=>[y.toString(),r]):[];break}const F=f.length;const J=n.parentHasMoreSiblings||[];const H=[...J];if(n.depth>0){H[n.depth-1]=!n.isLastChild}f.forEach(([r,y],D)=>{const v=C(y,new Set,S,r,n.depth+1,t,n.path,D,F,H);k.push(...v)})}catch(f){console.error("[Buoy]",f)}const E=k;if(E.length>0){}x[M]={...n,isExpanded:true};x.splice(M+1,0,...E);const p=new Map;x.forEach((f,b)=>{p.set(f.id,{item:f,index:b})});V.current=p;return x}else if(!m){const x=new Set;const S=(p,f)=>{s.forEach(b=>{if(b.parentId===p||b.id.startsWith(p+".")&&b.depth>f){x.add(b.id);if(b.hasChildren){S(b.id,b.depth)}}})};S(t,n.depth);const k=s.map(p=>{if(p.id===t){return{...p,isExpanded:false}}return p}).filter(p=>!x.has(p.id));const E=new Map;k.forEach((p,f)=>{E.set(p.id,{item:p,index:f})});V.current=E;return k}return s})},[C]);const X=U(t=>{O(m=>{const s=new Set(m);const g=!s.has(t);if(g){s.add(t)}else{s.delete(t)}c.current={type:g?"expand":"collapse",itemId:t};Y(t,g);return s})},[Y]);const K=ce(e,ee,0)<ee;const q=re(()=>{if(!K)return null;return C(e,L,new WeakSet,"root",0,void 0,[],0,1,[])},[K,e,L,C]);const Z=U(t=>{if(t.length===0)return;O(m=>{if(t.every(g=>m.has(g)))return m;const s=new Set(m);for(const g of t)s.add(g);return s})},[]);return{flatData:q??h,isProcessing:q?false:$,toggleExpanded:X,revealPath:Z}};const Ee=({item:e,onToggleExpanded:l,index:d,onSelect:h,isSelected:w,selectable:V,onRequestInlineEdit:Q,isInlineEditing:L,inlineEditor:O,testIDPrefix:$})=>{const[A,I]=B(false);const[j,N]=B(false);const W=V===true;const c=_(0);const C=e.path.slice(1);const Y=me[Math.min(e.depth,ne)]||me[0];const X=be(e.valueType);const K=false;const q=()=>{if(W){const s=Date.now();const g=s-c.current<Le;c.current=s;if(g&&!e.isExpandable&&Q){Q(e);return}h(e);return}if(e.isExpandable){l(e.id)}h(e)};const Z=()=>{if(e.isExpandable){l(e.id)}h(e)};const t=()=>{};const m=e.key;return T(u,{style:[o.itemContainer,Y],children:[T(ie,{"sentry-label":"ignore devtools data explorer item",testID:`${$}-${e.id}`,accessibilityLabel:`${e.key}: ${e.valueType}`,style:[o.itemTouchable,A&&o.itemTouchablePressed,W&&w&&o.itemSelected,K&&{minHeight:ke,paddingVertical:2}],onPress:q,onPressIn:()=>I(true),onPressOut:()=>I(false),activeOpacity:e.isExpandable||W?.7:1,disabled:!e.isExpandable&&!W,children:[e.isExpandable?i(Te,{expanded:e.isExpanded,onPress:Z}):i(u,{style:o.expanderContainer}),T(u,{style:o.labelContainer,children:[T(P,{style:o.labelText,numberOfLines:1,children:[e.key,":"]}),L&&O?O:e.isExpandable?T(P,{style:[o.valueText,{color:a.secondary}],numberOfLines:1,children:[e.valueType," (",e.childCount," ",e.childCount===1?"item":"items",")"]}):i(P,{style:[o.valueText,{color:X}],numberOfLines:1,children:He(e.value,e.valueType)})]})]}),e.value!==void 0?i(De,{value:e.value,size:14,buttonStyle:{marginLeft:8,marginRight:8}}):null]})};Ee.displayName="VirtualizedItem";const Ne=oe(Ee);export const VirtualizedDataExplorer=({title:e,description:l,data:d,maxDepth:h=10,rawMode:w=false,initialExpanded:V=false,disableCopy:Q=false,onSelectionChange:L,onRequestInlineEdit:O,inlineEditPath:$,renderInlineEditor:A,selectPath:I,testIDPrefix:j="buoy-tree-row"})=>{const[N,W]=B(w);const{flatData:c,isProcessing:C,toggleExpanded:Y,revealPath:X}=Oe(d,h,V);const K=_(null);const[q,Z]=B({start:0,end:Math.min(c.length-1,Math.max(0,Math.ceil(400/z)-1))});const t=_({itemVisiblePercentThreshold:1});const m=_(({viewableItems:r})=>{const y=r.map(D=>D.index).filter(D=>typeof D==="number");if(y.length){Z({start:Math.min(...y),end:Math.max(...y)})}}).current;te(()=>{Z({start:0,end:Math.min(c.length-1,Math.max(0,Math.ceil(400/z)-1))})},[c.length]);const s=re(()=>{const r=new Set;for(const y of c){r.add(y.valueType);if(r.size>=8)break}return Array.from(r)},[c]);const g=()=>{W(!N)};const[n,M]=B(null);const x=re(()=>n==null?void 0:c.find(r=>r.id===n),[c,n]);const S=x?.depth;te(()=>{if(!L)return;L(x?le(x):null)},[x,L]);const k=U(r=>{M(y=>y===r.id?null:r.id)},[]);const E=I===void 0?void 0:I===null?"\0null":I.join(".");const p=_(E);te(()=>{if(E===p.current)return;p.current=E;if(E===void 0)return;if(I==null){M(null);return}const r=["root"];for(const y of I.slice(0,-1)){r.push(`${r[r.length-1]}.${y}`)}X(r);M(["root",...I].join("."))},[E,I,X]);const f=U(r=>{M(r.id);O?.(le(r))},[O]);const b=({item:r,index:y})=>i(Ne,{item:r,index:y,onToggleExpanded:Y,onSelect:k,isSelected:x?.id===r.id,selectable:L!=null,onRequestInlineEdit:f,isInlineEditing:$!=null&&$.join(".")===r.path.slice(1).join("."),inlineEditor:A?A(le(r)):null,testIDPrefix:j});const F=z;const J=r=>r.id;const H=d!==null&&d!==void 0&&(typeof d==="string"?d.length>0:typeof d==="number"||typeof d==="boolean"?true:Array.isArray(d)?d.length>0:typeof d==="object"?Object.keys(d).length>0:false);if(w){if(!H){return i(u,{style:{flex:1,justifyContent:"center",alignItems:"center",padding:20},children:i(P,{style:o.noDataText,children:"No data available"})})}return i(u,{style:{minHeight:C?40:c.length*z},children:C?i(u,{style:{flex:1,justifyContent:"center",alignItems:"center"},children:T(P,{style:o.loadingText,children:["Processing data... (raw mode, isProcessing=",String(C),")"]})}):T(u,{style:{position:"relative",height:c.length*z},children:[i(he,{items:c,visibleRange:{start:0,end:Math.max(0,c.length-1)},itemHeight:z,indentWidth:ae,activeDepth:S}),i(pe,{ref:K,"sentry-label":"ignore devtools data explorer list",data:c,renderItem:b,keyExtractor:J,showsVerticalScrollIndicator:true,contentContainerStyle:o.listContent,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:false})]})})}if(!H){return T(u,{style:o.container,children:[i(u,{style:o.header,children:i(u,{style:o.headerRow,children:T(u,{style:{flex:1},children:[i(P,{style:o.title,children:e}),l&&i(P,{style:o.description,children:l})]})})}),i(u,{style:o.noDataContainer,children:i(P,{style:o.noDataText,children:"No data available"})})]})}return T(u,{style:o.container,children:[T(u,{style:o.header,children:[i(u,{style:o.headerRow,children:T(ie,{"sentry-label":"ignore devtools data explorer header toggle",onPress:g,hitSlop:ge,style:o.headerTouchable,children:[T(u,{style:{flex:1},children:[i(P,{style:o.title,children:e}),l&&i(P,{style:o.description,children:l})]}),i(u,{style:o.expanderMargin,children:i(Te,{expanded:N,onPress:g})})]})}),N&&s.length>0&&!w&&i(ze,{visibleTypes:s})]}),N&&i(je,{children:C?i(u,{style:o.loadingContainer,children:T(P,{style:o.loadingText,children:["Processing data... (isProcessing=",String(C),")"]})}):T(u,{style:{height:c.length*z,position:"relative"},children:[i(he,{items:c,visibleRange:q,itemHeight:z,indentWidth:ae,activeDepth:S}),i(pe,{ref:K,"sentry-label":"ignore devtools data explorer collapsed list",data:c,renderItem:b,keyExtractor:J,showsVerticalScrollIndicator:true,contentContainerStyle:o.listContent,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:false,onViewableItemsChanged:m,viewabilityConfig:t.current})]})})]})};
|
|
1
|
+
"use strict";import{useState as B,useMemo as re,useCallback as U,useRef as _,useEffect as te,memo as oe}from"react";import{Text as j,TouchableOpacity as ie,View as u,StyleSheet as ue,FlatList as pe}from"react-native";import{displayValue as Me}from"../utils/displayValue.js";import{gameUIColors as a}from"../ui/gameUI/index.js";import{night as ye}from"../ui/night/nightTheme.js";import{CopyButton as De}from"../ui/components/CopyButton.js";import{ChevronRight as Re}from"../icons/index.js";import{IndentGuidesOverlay as he}from"./IndentGuidesOverlay.js";import{monoFont as se}from"../ui/fonts.js";import{jsx as i,jsxs as T,Fragment as ke}from"react/jsx-runtime";const ge={top:10,bottom:10,left:10,right:10};const z=24;const Pe=24;const ee=50;const ne=15;const je=500;const Ze=30;const Le=300;const ae=16;const me=Array.from({length:ne+1},(e,l)=>ue.create({container:{marginLeft:l*ae}}).container);const Ae=new Map([["string",a.dataTypes.string],["number",a.dataTypes.number],["bigint",a.optional],["boolean",a.dataTypes.boolean],["null",a.dataTypes.null],["undefined",a.dataTypes.undefined],["function",a.dataTypes.function],["symbol",a.critical],["date",a.critical],["error",a.error],["array",a.dataTypes.array],["object",a.dataTypes.object],["map",a.info],["set",a.success],["circular",a.warning]]);const o=ue.create({container:{backgroundColor:ye.color.bg,borderRadius:8,borderWidth:1,borderColor:ye.color.border},header:{flexDirection:"column",paddingHorizontal:16,paddingVertical:12},headerRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:6},title:{color:a.primary,fontSize:14,fontWeight:"500"},description:{color:a.secondary,fontSize:12,marginTop:2},typeLegend:{flexDirection:"row",flexWrap:"wrap",gap:6,marginTop:8,paddingTop:8,borderTopWidth:1,borderTopColor:a.primary+"14"},typeBadge:{flexDirection:"row",alignItems:"center",paddingHorizontal:6,paddingVertical:2,borderRadius:4,borderWidth:1},typeColor:{width:8,height:8,borderRadius:4,marginRight:4},typeName:{fontSize:10,fontWeight:"500",color:a.secondary},itemContainer:{minHeight:z,backgroundColor:"transparent",position:"relative",flexDirection:"row",alignItems:"flex-start"},itemTouchable:{flex:1,flexDirection:"row",alignItems:"flex-start",paddingLeft:0,paddingRight:16,paddingVertical:2,minHeight:24},itemTouchablePressed:{backgroundColor:a.primary+"0A"},itemSelected:{backgroundColor:a.primary+"14"},expanderContainer:{width:16,alignItems:"center",justifyContent:"center",marginTop:4},expanderIcon:{width:12,height:12},labelContainer:{flex:1,flexDirection:"row",alignItems:"flex-start",paddingLeft:2},labelContainerVertical:{flex:1,flexDirection:"column",paddingLeft:2,paddingVertical:2},labelContainerVerticalRow:{flexDirection:"row",alignItems:"center",marginBottom:2},labelText:{color:a.primary,fontSize:12,fontWeight:"500",fontFamily:se,marginRight:8,flexShrink:1},labelTextTruncated:{color:a.primary,fontSize:12,fontWeight:"500",fontFamily:se,flexShrink:1},valueText:{fontSize:12,fontFamily:se,flex:1,color:a.primaryLight},loadingContainer:{padding:16,alignItems:"center"},loadingText:{color:a.secondary,fontSize:12},noDataContainer:{padding:16,alignItems:"center"},noDataText:{color:a.secondary,fontSize:12},listContent:{paddingBottom:8},headerTouchable:{flex:1,flexDirection:"row",alignItems:"center"},expanderMargin:{marginLeft:8}});function le(e){return{path:e.path.slice(1),value:e.value,label:e.key}}function ce(e,l,d=0){if(d>=l)return d;let h=d+1;if(Array.isArray(e)){for(const w of e){if(h>=l)return h;h=ce(w,l,h)}}else if(e!==null&&typeof e==="object"){for(const w of Object.values(e)){if(h>=l)return h;h=ce(w,l,h)}}return h}const _e=e=>{if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(e instanceof Date)return"date";if(e instanceof Error)return"error";if(e instanceof Map)return"map";if(e instanceof Set)return"set";if(e instanceof RegExp)return"regexp";if(typeof e==="function")return"function";if(typeof e==="symbol")return"symbol";if(typeof e==="bigint")return"bigint";if(typeof e==="object")return"object";return typeof e};const Ve=(e,l)=>{if(e===null)return 0;switch(l){case"array":return Array.isArray(e)?e.length:0;case"object":return typeof e==="object"&&!(e instanceof Date)&&!(e instanceof Error)&&!(e instanceof RegExp)&&!(e instanceof Map)&&!(e instanceof Set)?Object.keys(e).length:0;case"map":return e instanceof Map?e.size:0;case"set":return e instanceof Set?e.size:0;default:return 0}};const He=(e,l)=>{if(e===null)return"null";if(e===void 0)return"undefined";switch(l){case"string":return`"${String(e)}"`;case"boolean":return e===true?"true":"false";case"function":return typeof e==="function"?e.toString().slice(0,50)+"...":"undefined";case"symbol":return typeof e==="symbol"?String(e):"undefined";case"date":return e instanceof Date?e.toISOString():"undefined";case"regexp":return e instanceof RegExp?e.toString():"undefined";case"bigint":return typeof e==="bigint"?e.toString()+"n":"undefined";case"error":return e instanceof Error?`${e.name}: ${e.message}`:"undefined";default:return Me(e)}};const be=e=>{return Ae.get(e)||a.dataTypes.array};const xe=({expanded:e,onPress:l})=>{return i(ie,{"sentry-label":"ignore devtools data explorer expander",style:o.expanderContainer,onPress:l,hitSlop:ge,children:i(u,{style:o.expanderIcon,children:i(Re,{size:12,color:a.secondary,strokeWidth:2,style:{transform:[{rotate:e?"90deg":"0deg"}]}})})})};xe.displayName="Expander";const Te=oe(xe);const Se=({visibleTypes:e})=>{const l=Array.from(new Set(e)).slice(0,8);return i(u,{style:o.typeLegend,children:l.map(d=>{const h=be(d);return T(u,{style:[o.typeBadge,{backgroundColor:`${h}10`,borderColor:`${h}30`}],children:[i(u,{style:[o.typeColor,{backgroundColor:h}]}),i(j,{style:o.typeName,children:d})]},d)})})};Se.displayName="TypeLegend";const ze=oe(Se);const Oe=(e,l=10,d=false)=>{const[h,w]=B([]);const V=_(new Map);const Q=U(()=>{const t=new Set(["root"]);if(d&&e&&typeof e==="object"){if(Array.isArray(e)){e.forEach((m,s)=>{t.add(`root.${s}`)})}else{Object.keys(e).forEach(m=>{t.add(`root.${m}`)})}}return t},[d,e]);const[L,O]=B(()=>Q());const[$,A]=B(false);const I=_(new WeakSet);const k=_(false);const N=_(0);const W=_(0);const c=_(void 0);const C=U((t,m,s,g="root",n=0,M,x=[],S=0,P=1,E=[])=>{if(n>Math.min(l,ne))return[];const p=[...x,g];const f=p.join(".");const b=_e(t);const F=["object","array","map","set"].includes(b)&&t!==null;const J=F?Ve(t,b):0;const H=Math.min(J,je);if(t&&typeof t==="object"){if(s.has(t)){return[{id:f,key:g,value:"[Circular Reference]",valueType:"circular",depth:n,isExpandable:false,isExpanded:false,parentId:M,hasChildren:false,childCount:0,path:p,type:"circular",isLastChild:S===P-1,parentHasMoreSiblings:[...E],siblingIndex:S,totalSiblings:P}]}s.add(t)}const r={id:f,key:g,value:t,valueType:b,depth:n,isExpandable:F,isExpanded:m.has(f),parentId:M,hasChildren:H>0,childCount:H,path:p,type:F?"expandable":b,isLastChild:S===P-1,parentHasMoreSiblings:[...E],siblingIndex:S,totalSiblings:P};const y=[r];if(F&&m.has(f)&&n<Math.min(l,ne)){try{let D=[];switch(b){case"array":D=Array.isArray(t)?t.map((R,G)=>[G.toString(),R]):[];break;case"object":D=typeof t==="object"&&t!==null&&!(t instanceof Date)&&!(t instanceof Error)&&!(t instanceof RegExp)&&!(t instanceof Map)&&!(t instanceof Set)?Object.entries(t):[];break;case"map":D=t instanceof Map?Array.from(t.entries()).map(([R,G])=>[String(R),G]):[];break;case"set":D=t instanceof Set?Array.from(t.values()).map((R,G)=>[G.toString(),R]):[];break}const v=D.slice(0,H);const Ce=v.length;const de=[...E];if(n>0){de[n-1]=!r.isLastChild}for(let R=0;R<v.length;R+=ee){const G=v.slice(R,R+ee);let fe=R;for(const[we,Ie]of G){y.push(...C(Ie,m,s,we,n+1,f,p,fe,Ce,de));fe++}if(R>0&&R%(ee*2)===0){break}}}catch(D){console.error("[Buoy]",D)}}return y},[l]);te(()=>{if(c.current&&(c.current.type==="expand"||c.current.type==="collapse")){if($){A(false);k.current=false}c.current=void 0;return}if(k.current){return}let t;const m=++N.current;const s=()=>N.current===m;k.current=true;A(true);const g=async()=>{t=setTimeout(()=>{if(k.current&&s()){A(false);k.current=false}},5e3);await new Promise(n=>setTimeout(()=>n(),10));if(!s()){return}try{I.current=new WeakSet;W.current=Date.now();const n=C(e,L,I.current,"root",0,void 0,[],0,1,[]);const M=new Map;n.forEach((x,S)=>{M.set(x.id,{item:x,index:S})});V.current=M;if(t)clearTimeout(t);if(s()){w(n);A(false);k.current=false}}catch(n){console.error("[Buoy]",n);if(t)clearTimeout(t);if(s()){w([]);V.current=new Map;A(false);k.current=false}}};g();return()=>{k.current=false;if(t)clearTimeout(t)}},[e,L,C,l]);const Y=U((t,m)=>{A(false);k.current=false;w(s=>{const g=V.current.get(t);if(!g){return s}const{item:n,index:M}=g;if(m&&n.isExpandable&&n.hasChildren){const x=[...s];const S=new WeakSet;if(n.value&&typeof n.value==="object"){S.add(n.value)}const P=[];try{let f=[];const b=n.valueType;switch(b){case"array":f=Array.isArray(n.value)?n.value.map((r,y)=>[y.toString(),r]):[];break;case"object":f=typeof n.value==="object"&&n.value!==null&&!(n.value instanceof Date)&&!(n.value instanceof Error)&&!(n.value instanceof RegExp)&&!(n.value instanceof Map)&&!(n.value instanceof Set)?Object.entries(n.value):[];break;case"map":f=n.value instanceof Map?Array.from(n.value.entries()).map(([r,y])=>[String(r),y]):[];break;case"set":f=n.value instanceof Set?Array.from(n.value.values()).map((r,y)=>[y.toString(),r]):[];break}const F=f.length;const J=n.parentHasMoreSiblings||[];const H=[...J];if(n.depth>0){H[n.depth-1]=!n.isLastChild}f.forEach(([r,y],D)=>{const v=C(y,new Set,S,r,n.depth+1,t,n.path,D,F,H);P.push(...v)})}catch(f){console.error("[Buoy]",f)}const E=P;if(E.length>0){}x[M]={...n,isExpanded:true};x.splice(M+1,0,...E);const p=new Map;x.forEach((f,b)=>{p.set(f.id,{item:f,index:b})});V.current=p;return x}else if(!m){const x=new Set;const S=(p,f)=>{s.forEach(b=>{if(b.parentId===p||b.id.startsWith(p+".")&&b.depth>f){x.add(b.id);if(b.hasChildren){S(b.id,b.depth)}}})};S(t,n.depth);const P=s.map(p=>{if(p.id===t){return{...p,isExpanded:false}}return p}).filter(p=>!x.has(p.id));const E=new Map;P.forEach((p,f)=>{E.set(p.id,{item:p,index:f})});V.current=E;return P}return s})},[C]);const X=U(t=>{O(m=>{const s=new Set(m);const g=!s.has(t);if(g){s.add(t)}else{s.delete(t)}c.current={type:g?"expand":"collapse",itemId:t};Y(t,g);return s})},[Y]);const K=ce(e,ee,0)<ee;const q=re(()=>{if(!K)return null;return C(e,L,new WeakSet,"root",0,void 0,[],0,1,[])},[K,e,L,C]);const Z=U(t=>{if(t.length===0)return;O(m=>{if(t.every(g=>m.has(g)))return m;const s=new Set(m);for(const g of t)s.add(g);return s})},[]);return{flatData:q??h,isProcessing:q?false:$,toggleExpanded:X,revealPath:Z}};const Ee=({item:e,onToggleExpanded:l,index:d,onSelect:h,isSelected:w,selectable:V,onRequestInlineEdit:Q,isInlineEditing:L,inlineEditor:O,testIDPrefix:$})=>{const[A,I]=B(false);const[k,N]=B(false);const W=V===true;const c=_(0);const C=e.path.slice(1);const Y=me[Math.min(e.depth,ne)]||me[0];const X=be(e.valueType);const K=false;const q=()=>{if(W){const s=Date.now();const g=s-c.current<Le;c.current=s;if(g&&!e.isExpandable&&Q){Q(e);return}h(e);return}if(e.isExpandable){l(e.id)}h(e)};const Z=()=>{if(e.isExpandable){l(e.id)}h(e)};const t=()=>{};const m=e.key;return T(u,{style:[o.itemContainer,Y],children:[T(ie,{"sentry-label":"ignore devtools data explorer item",testID:`${$}-${e.id}`,accessibilityLabel:`${e.key}: ${e.valueType}`,style:[o.itemTouchable,A&&o.itemTouchablePressed,W&&w&&o.itemSelected,K&&{minHeight:Pe,paddingVertical:2}],onPress:q,onPressIn:()=>I(true),onPressOut:()=>I(false),activeOpacity:e.isExpandable||W?.7:1,disabled:!e.isExpandable&&!W,children:[e.isExpandable?i(Te,{expanded:e.isExpanded,onPress:Z}):i(u,{style:o.expanderContainer}),T(u,{style:o.labelContainer,children:[T(j,{style:o.labelText,numberOfLines:1,children:[e.key,":"]}),L&&O?O:e.isExpandable?T(j,{style:[o.valueText,{color:a.secondary}],numberOfLines:1,children:[e.valueType," (",e.childCount," ",e.childCount===1?"item":"items",")"]}):i(j,{style:[o.valueText,{color:X}],numberOfLines:1,children:He(e.value,e.valueType)})]})]}),e.value!==void 0?i(De,{value:e.value,size:14,buttonStyle:{marginLeft:8,marginRight:8}}):null]})};Ee.displayName="VirtualizedItem";const Ne=oe(Ee);export const VirtualizedDataExplorer=({title:e,description:l,data:d,maxDepth:h=10,rawMode:w=false,initialExpanded:V=false,disableCopy:Q=false,onSelectionChange:L,onRequestInlineEdit:O,inlineEditPath:$,renderInlineEditor:A,selectPath:I,testIDPrefix:k="buoy-tree-row"})=>{const[N,W]=B(w);const{flatData:c,isProcessing:C,toggleExpanded:Y,revealPath:X}=Oe(d,h,V);const K=_(null);const[q,Z]=B({start:0,end:Math.min(c.length-1,Math.max(0,Math.ceil(400/z)-1))});const t=_({itemVisiblePercentThreshold:1});const m=_(({viewableItems:r})=>{const y=r.map(D=>D.index).filter(D=>typeof D==="number");if(y.length){Z({start:Math.min(...y),end:Math.max(...y)})}}).current;te(()=>{Z({start:0,end:Math.min(c.length-1,Math.max(0,Math.ceil(400/z)-1))})},[c.length]);const s=re(()=>{const r=new Set;for(const y of c){r.add(y.valueType);if(r.size>=8)break}return Array.from(r)},[c]);const g=()=>{W(!N)};const[n,M]=B(null);const x=re(()=>n==null?void 0:c.find(r=>r.id===n),[c,n]);const S=x?.depth;te(()=>{if(!L)return;L(x?le(x):null)},[x,L]);const P=U(r=>{M(y=>y===r.id?null:r.id)},[]);const E=I===void 0?void 0:I===null?"\0null":I.join(".");const p=_(E);te(()=>{if(E===p.current)return;p.current=E;if(E===void 0)return;if(I==null){M(null);return}const r=["root"];for(const y of I.slice(0,-1)){r.push(`${r[r.length-1]}.${y}`)}X(r);M(["root",...I].join("."))},[E,I,X]);const f=U(r=>{M(r.id);O?.(le(r))},[O]);const b=({item:r,index:y})=>i(Ne,{item:r,index:y,onToggleExpanded:Y,onSelect:P,isSelected:x?.id===r.id,selectable:L!=null,onRequestInlineEdit:f,isInlineEditing:$!=null&&$.join(".")===r.path.slice(1).join("."),inlineEditor:A?A(le(r)):null,testIDPrefix:k});const F=z;const J=r=>r.id;const H=d!==null&&d!==void 0&&(typeof d==="string"?d.length>0:typeof d==="number"||typeof d==="boolean"?true:Array.isArray(d)?d.length>0:typeof d==="object"?Object.keys(d).length>0:false);if(w){if(!H){return i(u,{style:{flex:1,justifyContent:"center",alignItems:"center",padding:20},children:i(j,{style:o.noDataText,children:"No data available"})})}return i(u,{style:{minHeight:C?40:c.length*z},children:C?i(u,{style:{flex:1,justifyContent:"center",alignItems:"center"},children:T(j,{style:o.loadingText,children:["Processing data... (raw mode, isProcessing=",String(C),")"]})}):T(u,{style:{position:"relative",height:c.length*z},children:[i(he,{items:c,visibleRange:{start:0,end:Math.max(0,c.length-1)},itemHeight:z,indentWidth:ae,activeDepth:S}),i(pe,{keyboardShouldPersistTaps:"handled",ref:K,"sentry-label":"ignore devtools data explorer list",data:c,renderItem:b,keyExtractor:J,showsVerticalScrollIndicator:true,contentContainerStyle:o.listContent,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:false})]})})}if(!H){return T(u,{style:o.container,children:[i(u,{style:o.header,children:i(u,{style:o.headerRow,children:T(u,{style:{flex:1},children:[i(j,{style:o.title,children:e}),l&&i(j,{style:o.description,children:l})]})})}),i(u,{style:o.noDataContainer,children:i(j,{style:o.noDataText,children:"No data available"})})]})}return T(u,{style:o.container,children:[T(u,{style:o.header,children:[i(u,{style:o.headerRow,children:T(ie,{"sentry-label":"ignore devtools data explorer header toggle",onPress:g,hitSlop:ge,style:o.headerTouchable,children:[T(u,{style:{flex:1},children:[i(j,{style:o.title,children:e}),l&&i(j,{style:o.description,children:l})]}),i(u,{style:o.expanderMargin,children:i(Te,{expanded:N,onPress:g})})]})}),N&&s.length>0&&!w&&i(ze,{visibleTypes:s})]}),N&&i(ke,{children:C?i(u,{style:o.loadingContainer,children:T(j,{style:o.loadingText,children:["Processing data... (isProcessing=",String(C),")"]})}):T(u,{style:{height:c.length*z,position:"relative"},children:[i(he,{items:c,visibleRange:q,itemHeight:z,indentWidth:ae,activeDepth:S}),i(pe,{keyboardShouldPersistTaps:"handled",ref:K,"sentry-label":"ignore devtools data explorer collapsed list",data:c,renderItem:b,keyExtractor:J,showsVerticalScrollIndicator:true,contentContainerStyle:o.listContent,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:false,onViewableItemsChanged:m,viewabilityConfig:t.current})]})})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useCallback as m,useMemo as y}from"react";import{FlatList as w,View as L,Text as u,StyleSheet as
|
|
1
|
+
"use strict";import{useCallback as m,useMemo as y}from"react";import{FlatList as w,View as L,Text as u,StyleSheet as E}from"react-native";import{buoyColors as T}from"../../ui/gameUI/constants/gameUIColors.js";import{HistoryEntryRow as b}from"./HistoryEntryRow.js";import{useAllHistoryEntries as H,useHistoryAdapters as k}from"../HistoryProvider.js";import{jsx as o,jsxs as g}from"react/jsx-runtime";export function HistoryList({filter:h,selectedEntryId:n,onSelectEntry:s,showSource:i=true,emptyMessage:a="No history entries yet",ListHeaderComponent:c,ListFooterComponent:x}){const C=H(h);const p=k();const l=y(()=>{const t=new Map;p.forEach(d=>t.set(d.id,d));return t},[p]);const f=m(t=>`${t.source}-${t.id}`,[]);const S=m(({item:t})=>{const d=l.get(t.source);return o(b,{entry:t,adapter:d,isSelected:n===t.id,onPress:s,showSource:i})},[l,n,s,i]);const e=y(()=>g(L,{style:r.emptyContainer,children:[o(u,{style:r.emptyText,children:a}),o(u,{style:r.emptySubtext,children:"Actions will appear here as they happen"})]}),[a]);return o(w,{keyboardShouldPersistTaps:"handled",data:C,keyExtractor:f,renderItem:S,ListEmptyComponent:e,ListHeaderComponent:c,ListFooterComponent:x,contentContainerStyle:r.listContent,showsVerticalScrollIndicator:false,removeClippedSubviews:true,maxToRenderPerBatch:15,windowSize:10,initialNumToRender:15,getItemLayout:void 0})}export function StandaloneHistoryList({entries:h,adapters:n=[],selectedEntryId:s,onSelectEntry:i,showSource:a=true,emptyMessage:c="No history entries yet",ListHeaderComponent:x,ListFooterComponent:C}){const p=y(()=>{const e=new Map;n.forEach(t=>e.set(t.id,t));return e},[n]);const l=m(e=>`${e.source}-${e.id}`,[]);const f=m(({item:e})=>{const t=p.get(e.source);return o(b,{entry:e,adapter:t,isSelected:s===e.id,onPress:i,showSource:a})},[p,s,i,a]);const S=y(()=>g(L,{style:r.emptyContainer,children:[o(u,{style:r.emptyText,children:c}),o(u,{style:r.emptySubtext,children:"Actions will appear here as they happen"})]}),[c]);return o(w,{keyboardShouldPersistTaps:"handled",data:h,keyExtractor:l,renderItem:f,ListEmptyComponent:S,ListHeaderComponent:x,ListFooterComponent:C,contentContainerStyle:r.listContent,showsVerticalScrollIndicator:false,removeClippedSubviews:true,maxToRenderPerBatch:15,windowSize:10,initialNumToRender:15})}const r=E.create({listContent:{flexGrow:1,paddingVertical:4},emptyContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingVertical:60,paddingHorizontal:20},emptyText:{fontSize:16,fontWeight:"600",color:T.text,marginBottom:8},emptySubtext:{fontSize:13,color:T.textMuted,textAlign:"center"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Modal as
|
|
1
|
+
"use strict";import{Modal as l,Pressable as o,ScrollView as i,StyleSheet as t,View as n}from"react-native";import{AccountSetupCard as c}from"./AccountSetupContent.js";import{jsx as e,jsxs as d}from"react/jsx-runtime";export{LOGIN_COMMAND}from"./AccountSetupContent.js";export function FreeAccountPrompt({visible:a,onClose:r}){if(!a)return null;return e(l,{visible:true,transparent:true,animationType:"fade",onRequestClose:r,children:d(n,{style:s.overlay,accessibilityViewIsModal:true,children:[e(o,{style:t.absoluteFill,onPress:r,accessible:false}),e(i,{keyboardShouldPersistTaps:"handled",style:s.frame,bounces:false,children:e(c,{onClose:r})})]})})}const s=t.create({overlay:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.65)",alignItems:"center",justifyContent:"center",padding:20},frame:{width:"100%",maxWidth:368,maxHeight:"90%",flexGrow:0,borderRadius:20}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{View as r,Text as s,StyleSheet as D,Switch as F,ScrollView as R}from"react-native";import{Settings as C,EyeOff as V,Database as W}from"../../icons/index.js";import{useState as S,useEffect as B}from"react";import{CyberpunkSectionButton as N}from"../../ui/console/CyberpunkSectionButton.js";import{devToolsStorageKeys as x}from"../../storage/devToolsStorageKeys.js";import{persistentStorage as c}from"../../utils/persistentStorage";import{macOSColors as m}from"../../ui/gameUI/constants/macOSDesignSystemColors.js";import{buoyColors as n}from"../../ui/gameUI/constants/gameUIColors.js";import{jsx as t,jsxs as d}from"react/jsx-runtime";const u=x.bubble.settings();const w=x.bubble.userPreferences();const p={showEnvironment:true,showQueryButton:true,showWifiToggle:true,showEnvButton:false,showSentryButton:false,showStorageButton:false};export function BubbleSettingsSection({onPress:i}){const[l,g]=S(p);B(()=>{y()},[]);const y=async()=>{try{const a=await c.getItem(u);if(a){g(JSON.parse(a))}}catch(a){console.error("[Buoy]","Failed to load bubble settings:",a)}};const h=()=>{return Object.values(l).filter(Boolean).length};return t(N,{id:"bubble-settings",title:"SETTINGS",subtitle:`${h()}/6 visible`,icon:C,iconColor:"#10B981",iconBackgroundColor:"rgba(16, 185, 129, 0.1)",onPress:i||(()=>{}),index:5})}export function BubbleSettingsDetail({onSettingsChange:i}){const[l,g]=S(p);const[y,h]=S(true);B(()=>{a()},[]);const a=async()=>{try{const o=await c.getItem(u);if(o){g(JSON.parse(o))}}catch(o){console.error("[Buoy]","Failed to load bubble settings:",o)}finally{h(false)}};const T=async o=>{try{await c.setItem(u,JSON.stringify(o));g(o);i?.(o)}catch(f){console.error("[Buoy]","Failed to save bubble settings:",f)}};const v=async o=>{const f={...l,[o]:!l[o]};try{const b=await c.getItem(w);const
|
|
1
|
+
"use strict";import{View as r,Text as s,StyleSheet as D,Switch as F,ScrollView as R}from"react-native";import{Settings as C,EyeOff as V,Database as W}from"../../icons/index.js";import{useState as S,useEffect as B}from"react";import{CyberpunkSectionButton as N}from"../../ui/console/CyberpunkSectionButton.js";import{devToolsStorageKeys as x}from"../../storage/devToolsStorageKeys.js";import{persistentStorage as c}from"../../utils/persistentStorage";import{macOSColors as m}from"../../ui/gameUI/constants/macOSDesignSystemColors.js";import{buoyColors as n}from"../../ui/gameUI/constants/gameUIColors.js";import{jsx as t,jsxs as d}from"react/jsx-runtime";const u=x.bubble.settings();const w=x.bubble.userPreferences();const p={showEnvironment:true,showQueryButton:true,showWifiToggle:true,showEnvButton:false,showSentryButton:false,showStorageButton:false};export function BubbleSettingsSection({onPress:i}){const[l,g]=S(p);B(()=>{y()},[]);const y=async()=>{try{const a=await c.getItem(u);if(a){g(JSON.parse(a))}}catch(a){console.error("[Buoy]","Failed to load bubble settings:",a)}};const h=()=>{return Object.values(l).filter(Boolean).length};return t(N,{id:"bubble-settings",title:"SETTINGS",subtitle:`${h()}/6 visible`,icon:C,iconColor:"#10B981",iconBackgroundColor:"rgba(16, 185, 129, 0.1)",onPress:i||(()=>{}),index:5})}export function BubbleSettingsDetail({onSettingsChange:i}){const[l,g]=S(p);const[y,h]=S(true);B(()=>{a()},[]);const a=async()=>{try{const o=await c.getItem(u);if(o){g(JSON.parse(o))}}catch(o){console.error("[Buoy]","Failed to load bubble settings:",o)}finally{h(false)}};const T=async o=>{try{await c.setItem(u,JSON.stringify(o));g(o);i?.(o)}catch(f){console.error("[Buoy]","Failed to save bubble settings:",f)}};const v=async o=>{const f={...l,[o]:!l[o]};try{const b=await c.getItem(w);const E=b?JSON.parse(b):{};const I=o.replace("show","hasSet");const z={...E,[I]:true};await c.setItem(w,JSON.stringify(z))}catch(b){console.error("[Buoy]","Failed to save user preference marker:",b)}T(f)};if(y){return t(r,{style:e.detailContainer,children:t(s,{style:e.loadingText,children:"Loading settings..."})})}const k=[{key:"showEnvironment",label:"Environment Indicator",description:"Shows current environment (dev, staging, prod)",icon:t(r,{style:[e.indicator,{backgroundColor:"#10B981"}]})},{key:"showQueryButton",label:"React Query Button",description:"Opens React Query dev tools",icon:t(r,{style:[e.indicator,{backgroundColor:"#F59E0B"}]})},{key:"showWifiToggle",label:"WiFi",description:"Toggle WiFi for testing offline scenarios",icon:t(r,{style:[e.indicator,{backgroundColor:"#8B5CF6"}]})},{key:"showEnvButton",label:"Environment Variables",description:"View and check environment variables",icon:t(C,{size:16,color:"#10B981"})},{key:"showSentryButton",label:"Sentry Events",description:"View captured Sentry events and errors",icon:t(r,{style:[e.indicator,{backgroundColor:"#a855f7"}]})},{key:"showStorageButton",label:"Storage Browser",description:"Browse and inspect AsyncStorage data",icon:t(W,{size:16,color:"#3B82F6"})}];return t(r,{style:e.detailContainer,children:d(R,{keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,contentContainerStyle:e.scrollContent,"sentry-label":"ignore bubble settings scroll",children:[d(r,{style:e.header,children:[t(s,{style:e.headerTitle,children:"Developer Tools Settings"}),t(s,{style:e.headerDescription,children:"Configure bubble button visibility"})]}),t(r,{style:e.sectionDivider,children:t(s,{style:e.sectionTitle,children:"Bubble Button Visibility"})}),t(r,{style:e.settingsList,children:k.map(o=>d(r,{style:e.settingItem,children:[t(r,{style:e.settingIconContainer,children:o.icon}),d(r,{style:e.settingContent,children:[t(s,{style:e.settingLabel,children:o.label}),t(s,{style:e.settingDescription,children:o.description})]}),t(F,{"sentry-label":"ignore bubble settings section",value:l[o.key],onValueChange:()=>v(o.key),trackColor:{false:"#4B5563",true:"#10B981"},thumbColor:l[o.key]?"#fff":n.textSecondary})]},o.key))}),d(r,{style:e.footer,children:[d(r,{style:e.noteContainer,children:[t(V,{size:16,color:n.textSecondary}),t(s,{style:e.noteText,children:"User status indicator is always visible and cannot be disabled"})]}),t(s,{style:e.restartNote,children:"Changes are saved automatically and will persist across app restarts"})]})]})})}export async function getBubbleVisibilitySettings(){try{const i=await c.getItem(u);if(i){return JSON.parse(i)}}catch(i){console.error("[Buoy]","Failed to load bubble settings:",i)}return p}const e=D.create({scrollContent:{flexGrow:1},sectionCard:{backgroundColor:n.input,borderRadius:8,padding:16,flexDirection:"row",alignItems:"center",marginBottom:12},iconContainer:{width:36,height:36,borderRadius:8,backgroundColor:"rgba(16, 185, 129, 0.1)",justifyContent:"center",alignItems:"center",marginRight:12},textContainer:{flex:1},title:{color:n.text,fontSize:14,fontWeight:"600",marginBottom:2},subtitle:{color:n.textSecondary,fontSize:12},chevron:{color:m.text.icon,fontSize:20},detailContainer:{flex:1,backgroundColor:n.card},loadingText:{color:n.textSecondary,fontSize:14,textAlign:"center",marginTop:20},header:{padding:16,borderBottomWidth:1,borderBottomColor:"rgba(128, 128, 128, 0.2)"},headerTitle:{color:n.text,fontSize:16,fontWeight:"600",marginBottom:4},headerDescription:{color:n.textSecondary,fontSize:12},settingsList:{padding:16},settingItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,borderBottomWidth:1,borderBottomColor:"rgba(128, 128, 128, 0.1)"},settingIconContainer:{width:32,height:32,justifyContent:"center",alignItems:"center",marginRight:12},settingContent:{flex:1,marginRight:12},settingLabel:{color:n.text,fontSize:14,fontWeight:"500",marginBottom:2},settingDescription:{color:m.text.icon,fontSize:11},indicator:{width:8,height:8,borderRadius:4},footer:{padding:16,borderTopWidth:1,borderTopColor:"rgba(128, 128, 128, 0.2)"},noteContainer:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:8},noteText:{color:n.textSecondary,fontSize:12,flex:1},restartNote:{color:m.text.icon,fontSize:11,fontStyle:"italic"},sectionDivider:{paddingHorizontal:16,paddingVertical:8,marginTop:8,borderTopWidth:1,borderTopColor:"rgba(128, 128, 128, 0.12)"},sectionTitle:{color:n.textSecondary,fontSize:12,fontWeight:"600",letterSpacing:.5,textTransform:"uppercase"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useCallback as l,useRef as u,useState as
|
|
1
|
+
"use strict";import{useCallback as l,useRef as u,useState as f}from"react";import{ScrollView as m,StyleSheet as x,View as y}from"react-native";import{jsx as S}from"react/jsx-runtime";const p=5;const E=300;export function useChipTap(){const[e,n]=f(false);const o=u(0);const r=u(0);const s=l(t=>{o.current=t.nativeEvent.pageX;r.current=t.nativeEvent.pageY},[]);const d=l(t=>{if(!t)return true;const g=Math.abs(t.nativeEvent.pageX-o.current);const h=Math.abs(t.nativeEvent.pageY-r.current);return!(g>p||h>p||e)},[e]);const i=l(()=>{setTimeout(()=>n(false),E)},[]);const a=l(()=>n(true),[]);return{scrollProps:{onScrollBeginDrag:a,onScrollEndDrag:i,onMomentumScrollBegin:a,onMomentumScrollEnd:i},onTouchStart:s,isTap:d}}export function ChipStrip({children:e,scrollProps:n,sentryLabel:o,style:r,contentStyle:s}){return S(y,{style:[c.container,r],children:S(m,{keyboardShouldPersistTaps:"handled","sentry-label":o,horizontal:true,showsHorizontalScrollIndicator:false,style:c.scrollView,contentContainerStyle:[c.scrollContent,s],...n,children:e})})}const c=x.create({container:{flex:1,minWidth:0},scrollView:{flex:1},scrollContent:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:4,paddingVertical:4,flexGrow:1}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useState as p}from"react";import{View as n,Text as a,StyleSheet as R,ScrollView as
|
|
1
|
+
"use strict";import{useState as p}from"react";import{View as n,Text as a,StyleSheet as R,ScrollView as z,TouchableOpacity as y,TextInput as D}from"react-native";import{Search as O,Edit3 as W,Check as A,X as F}from"../../icons/index.js";import{gameUIColors as o}from"../gameUI/index.js";import{CopyButton as J}from"./CopyButton.js";import{monoFont as P}from"../fonts.js";import{jsx as e,jsxs as l}from"react/jsx-runtime";export function DataInspector({data:c,mode:r="view",syntax:i="json",theme:f="dark",collapsible:d=true,searchable:h=true,onEdit:k,style:v,title:m}){const[g,E]=p("");const[s,x]=p(false);const[w,b]=p("");const B=()=>{if(i==="json"){try{return JSON.stringify(c,null,2)}catch{return String(c)}}return String(c)};const I=u=>{if(!g)return u;const V=u.split(new RegExp(`(${g})`,"gi"));return V.map((S,H)=>{if(S.toLowerCase()===g.toLowerCase()){return e(a,{style:t.highlight,children:S},H)}return S})};const T=()=>{if(!s){b(B());x(true)}else{try{const u=i==="json"?JSON.parse(w):w;k?.(u);x(false)}catch(u){console.error("[Buoy]","Failed to parse edited data",u)}}};const j=()=>{x(false);b("")};const C=B();return l(n,{style:[t.container,v],children:[(m||h||r==="edit")&&l(n,{style:t.header,children:[m&&e(a,{style:t.title,children:m}),l(n,{style:t.controls,children:[h&&!s&&l(n,{style:t.searchContainer,children:[e(O,{size:12,color:o.secondary}),e(D,{style:t.searchInput,placeholder:"Search...",placeholderTextColor:o.tertiary,value:g,onChangeText:E})]}),r==="edit"&&e(y,{style:t.editButton,onPress:s?T:()=>T(),children:s?e(A,{size:14,color:o.success}):e(W,{size:14,color:o.primary})}),s&&e(y,{style:t.cancelButton,onPress:j,children:e(F,{size:14,color:o.error})}),!s&&e(J,{value:C,size:12})]})]}),e(z,{style:t.scrollView,horizontal:true,showsHorizontalScrollIndicator:false,children:e(z,{keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:s?e(D,{style:t.editor,value:w,onChangeText:b,multiline:true,autoCapitalize:"none",autoCorrect:false}):e(a,{style:t.codeText,children:g?I(C):C})})})]})}DataInspector.Json=function c({data:r,searchable:i,style:f}){return e(DataInspector,{data:r,syntax:"json",mode:"view",searchable:i,style:f})};DataInspector.Editable=function c({data:r,onSave:i,style:f}){return e(DataInspector,{data:r,mode:"edit",onEdit:i,style:f})};DataInspector.Diff=function c({oldData:r,newData:i,style:f}){const[d,h]=p("diff");return l(n,{style:f,children:[l(n,{style:t.diffControls,children:[e(y,{style:[t.diffButton,d==="old"&&t.diffButtonActive],onPress:()=>h("old"),children:e(a,{style:t.diffButtonText,children:"Old"})}),e(y,{style:[t.diffButton,d==="new"&&t.diffButtonActive],onPress:()=>h("new"),children:e(a,{style:t.diffButtonText,children:"New"})}),e(y,{style:[t.diffButton,d==="diff"&&t.diffButtonActive],onPress:()=>h("diff"),children:e(a,{style:t.diffButtonText,children:"Diff"})})]}),d==="old"&&e(DataInspector,{data:r,searchable:false}),d==="new"&&e(DataInspector,{data:i,searchable:false}),d==="diff"&&l(n,{style:t.diffContainer,children:[l(n,{style:t.diffPane,children:[e(a,{style:t.diffPaneTitle,children:"Old"}),e(DataInspector,{data:r,searchable:false})]}),l(n,{style:t.diffPane,children:[e(a,{style:t.diffPaneTitle,children:"New"}),e(DataInspector,{data:i,searchable:false})]})]})]})};const t=R.create({container:{backgroundColor:o.background,borderRadius:8,overflow:"hidden"},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:8,borderBottomWidth:1,borderBottomColor:o.border+"20"},title:{fontSize:12,fontWeight:"600",color:o.text},controls:{flexDirection:"row",gap:8},searchContainer:{flexDirection:"row",alignItems:"center",backgroundColor:o.panel,borderRadius:4,paddingHorizontal:8,gap:4},searchInput:{fontSize:11,color:o.text,minWidth:100,paddingVertical:4},editButton:{padding:4,borderRadius:4,backgroundColor:o.primary+"20"},cancelButton:{padding:4,borderRadius:4,backgroundColor:o.error+"20"},scrollView:{maxHeight:300},codeText:{fontFamily:P,fontSize:11,color:o.text,padding:12,lineHeight:16},editor:{fontFamily:P,fontSize:11,color:o.text,padding:12,lineHeight:16,minHeight:200},highlight:{backgroundColor:o.warning+"40",color:o.text},diffControls:{flexDirection:"row",gap:8,padding:8},diffButton:{paddingHorizontal:12,paddingVertical:4,borderRadius:4,backgroundColor:o.panel},diffButtonActive:{backgroundColor:o.primary},diffButtonText:{fontSize:11,color:o.text,fontWeight:"500"},diffContainer:{flexDirection:"row",gap:8},diffPane:{flex:1},diffPaneTitle:{fontSize:10,fontWeight:"600",color:o.secondary,padding:8,textTransform:"uppercase"}});
|