diff --git a/packages/common/src/services/remote-config/feature-flags.ts b/packages/common/src/services/remote-config/feature-flags.ts index 84f1a255b30..c25e79dc686 100644 --- a/packages/common/src/services/remote-config/feature-flags.ts +++ b/packages/common/src/services/remote-config/feature-flags.ts @@ -20,6 +20,7 @@ export enum FeatureFlags { NOW_PLAYING_COMMENTS = 'now_playing_comments', TRACK_TILE_WAVEFORM = 'track_tile_waveform', NOW_PLAYING_WAVEFORM = 'now_playing_waveform', + NOW_PLAYING_VISUALIZER = 'now_playing_visualizer', MOBILE_MANAGER_MODE = 'mobile_manager_mode', BULK_TRACK_EDIT = 'bulk_track_edit', WEEKLY_ARTIST_RECAP = 'weekly_artist_recap', @@ -39,6 +40,7 @@ export const environmentFlagDefaults: Record< [FeatureFlags.FAN_CLUB_TEXT_POST_POSTING]: true, [FeatureFlags.TRACK_TILE_WAVEFORM]: true, [FeatureFlags.NOW_PLAYING_WAVEFORM]: true, + [FeatureFlags.NOW_PLAYING_VISUALIZER]: true, [FeatureFlags.MOBILE_MANAGER_MODE]: true, [FeatureFlags.BULK_TRACK_EDIT]: true, [FeatureFlags.WEEKLY_ARTIST_RECAP]: true, @@ -70,6 +72,7 @@ export const flagDefaults: FlagDefaults = { [FeatureFlags.NOW_PLAYING_COMMENTS]: true, [FeatureFlags.TRACK_TILE_WAVEFORM]: false, [FeatureFlags.NOW_PLAYING_WAVEFORM]: true, + [FeatureFlags.NOW_PLAYING_VISUALIZER]: false, [FeatureFlags.MOBILE_MANAGER_MODE]: false, [FeatureFlags.BULK_TRACK_EDIT]: false, [FeatureFlags.WEEKLY_ARTIST_RECAP]: false, diff --git a/packages/mobile/.eslintignore b/packages/mobile/.eslintignore index 1c1c0ac7fa4..e035a38091c 100644 --- a/packages/mobile/.eslintignore +++ b/packages/mobile/.eslintignore @@ -2,3 +2,6 @@ # Vendored react-native-collapsible-tab-view 8.0.1, kept close to upstream src/components/collapsible-tabs/** + +# Generated by scripts/generate-visualizer-libs.js +src/components/now-playing-panel/visualizerLibs.ts diff --git a/packages/mobile/ios/AudiusReactNative.xcodeproj/project.pbxproj b/packages/mobile/ios/AudiusReactNative.xcodeproj/project.pbxproj index b4fbde5fe32..2b9c128b845 100644 --- a/packages/mobile/ios/AudiusReactNative.xcodeproj/project.pbxproj +++ b/packages/mobile/ios/AudiusReactNative.xcodeproj/project.pbxproj @@ -18,6 +18,7 @@ 43C373D295154DA6B89272D5 /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 04F6B3542BF84180BC937315 /* Colors.xcassets */; }; 5983D8FED74747CCA45F8FC4 /* AvenirNextLTPro-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = 33E11CC84EEA4109B8A1AE2C /* AvenirNextLTPro-Medium.otf */; }; 5CE1A0022EA1000000A1B2C3 /* SceneDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CE1A0012EA1000000A1B2C3 /* SceneDelegate.mm */; }; + 5CE1B0022EA1000000A1B2C3 /* AudiusHinge.m in Sources */ = {isa = PBXBuildFile; fileRef = 5CE1B0012EA1000000A1B2C3 /* AudiusHinge.m */; }; 7103C3ED2929C6B5002B9072 /* BootSplash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7103C3EC2929C6B5002B9072 /* BootSplash.storyboard */; }; 717F36E82733C73F0017511F /* AvenirNextLTPro-DemiBold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 717F36E72733C73F0017511F /* AvenirNextLTPro-DemiBold.otf */; }; 838AABE023CE3813004B2DA3 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 838AABDF23CE3813004B2DA3 /* GoogleService-Info.plist */; }; @@ -78,6 +79,8 @@ 453FC09EC343ACA359EB312C /* Pods-AudiusReactNative.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AudiusReactNative.release.xcconfig"; path = "Target Support Files/Pods-AudiusReactNative/Pods-AudiusReactNative.release.xcconfig"; sourceTree = ""; }; 5CE1A0002EA1000000A1B2C3 /* SceneDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SceneDelegate.h; path = AudiusReactNative/SceneDelegate.h; sourceTree = ""; }; 5CE1A0012EA1000000A1B2C3 /* SceneDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SceneDelegate.mm; path = AudiusReactNative/SceneDelegate.mm; sourceTree = ""; }; + 5CE1B0002EA1000000A1B2C3 /* AudiusHinge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AudiusHinge.h; path = AudiusReactNative/AudiusHinge.h; sourceTree = ""; }; + 5CE1B0012EA1000000A1B2C3 /* AudiusHinge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AudiusHinge.m; path = AudiusReactNative/AudiusHinge.m; sourceTree = ""; }; 622045C334F0F16E3CF4011F /* libPods-AudiusReactNative.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AudiusReactNative.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 6F65A9A9BAD047FABD240C59 /* AvenirNextLTPro-Regular.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "AvenirNextLTPro-Regular.otf"; path = "../src/assets/fonts/AvenirNextLTPro-Regular.otf"; sourceTree = ""; }; 7103C3EC2929C6B5002B9072 /* BootSplash.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = BootSplash.storyboard; path = AudiusReactNative/BootSplash.storyboard; sourceTree = ""; }; @@ -145,6 +148,8 @@ 13B07FB01A68108700A75B9A /* AppDelegate.mm */, 5CE1A0002EA1000000A1B2C3 /* SceneDelegate.h */, 5CE1A0012EA1000000A1B2C3 /* SceneDelegate.mm */, + 5CE1B0002EA1000000A1B2C3 /* AudiusHinge.h */, + 5CE1B0012EA1000000A1B2C3 /* AudiusHinge.m */, 13B07FB51A68108700A75B9A /* Images.xcassets */, 13B07FB61A68108700A75B9A /* Info.plist */, 7103C3EC2929C6B5002B9072 /* BootSplash.storyboard */, @@ -475,6 +480,7 @@ 253BCCFA2B324974007DC74C /* NSureSDK.m in Sources */, 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */, 5CE1A0022EA1000000A1B2C3 /* SceneDelegate.mm in Sources */, + 5CE1B0022EA1000000A1B2C3 /* AudiusHinge.m in Sources */, 83F7359F23C55C2D0040A4C5 /* AirplayViewManager.m in Sources */, 13B32CE723D2782B002F0526 /* SampleSwiftFile.swift in Sources */, 83F735A523C64C950040A4C5 /* AirplayEvent.m in Sources */, diff --git a/packages/mobile/ios/AudiusReactNative/AudiusHinge.h b/packages/mobile/ios/AudiusReactNative/AudiusHinge.h new file mode 100644 index 00000000000..027d594e112 --- /dev/null +++ b/packages/mobile/ios/AudiusReactNative/AudiusHinge.h @@ -0,0 +1,11 @@ +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface AudiusHinge : NSObject + ++ (void)observeHingeForView:(UIView *)view; + +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/mobile/ios/AudiusReactNative/AudiusHinge.m b/packages/mobile/ios/AudiusReactNative/AudiusHinge.m new file mode 100644 index 00000000000..9b38100808e --- /dev/null +++ b/packages/mobile/ios/AudiusReactNative/AudiusHinge.m @@ -0,0 +1,108 @@ +#import "AudiusHinge.h" + +#import +#import + +static NSString *const AudiusHingeDidChangeNotification = @"AudiusHingeDidChange"; +static NSDictionary *latestHingeState = nil; + +@interface AudiusHingeEmitter : RCTEventEmitter +@end + +@implementation AudiusHinge + ++ (void)observeHingeForView:(UIView *)view +{ +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 270100 + if (@available(iOS 27.1, *)) { + UIHingeInteraction *interaction = [[UIHingeInteraction alloc] + initWithUpdateHandler:^(UIHingeInteraction *_, UIHingeInteractionUpdate *update) { + UIHinge *hinge = update.hinge; + NSDictionary *state; + if (hinge == nil) { + state = @{@"available" : @NO}; + } else { + NSString *status; + switch (hinge.status) { + case UIHingeStatusClosed: + status = @"closed"; + break; + case UIHingeStatusPartiallyOpen: + status = @"partiallyOpen"; + break; + case UIHingeStatusFullyOpen: + status = @"fullyOpen"; + break; + default: + status = @"unknown"; + break; + } + state = @{ + @"available" : @YES, + @"status" : status, + @"angle" : @(hinge.angle * 180.0 / M_PI) + }; + } + latestHingeState = state; + [[NSNotificationCenter defaultCenter] postNotificationName:AudiusHingeDidChangeNotification + object:nil + userInfo:state]; + }]; + [view addInteraction:interaction]; + } +#endif +} + +@end + +@implementation AudiusHingeEmitter { + BOOL _hasListeners; +} + +RCT_EXPORT_MODULE(AudiusHinge); + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +- (dispatch_queue_t)methodQueue +{ + return dispatch_get_main_queue(); +} + +- (NSArray *)supportedEvents +{ + return @[ @"hingeChanged" ]; +} + +- (void)startObserving +{ + _hasListeners = YES; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(hingeDidChange:) + name:AudiusHingeDidChangeNotification + object:nil]; +} + +- (void)stopObserving +{ + _hasListeners = NO; + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +- (void)hingeDidChange:(NSNotification *)notification +{ + if (_hasListeners) { + [self sendEventWithName:@"hingeChanged" body:notification.userInfo]; + } +} + +RCT_EXPORT_METHOD(getState + : (RCTPromiseResolveBlock)resolve rejecter + : (RCTPromiseRejectBlock)reject) +{ + resolve(latestHingeState ?: @{@"available" : @NO}); +} + +@end diff --git a/packages/mobile/ios/AudiusReactNative/SceneDelegate.mm b/packages/mobile/ios/AudiusReactNative/SceneDelegate.mm index 02de38479a9..81ed3608ca9 100644 --- a/packages/mobile/ios/AudiusReactNative/SceneDelegate.mm +++ b/packages/mobile/ios/AudiusReactNative/SceneDelegate.mm @@ -1,5 +1,6 @@ #import "SceneDelegate.h" #import "AppDelegate.h" +#import "AudiusHinge.h" #import #import @@ -16,6 +17,7 @@ - (void)scene:(UIScene *)scene AppDelegate *appDelegate = (AppDelegate *)UIApplication.sharedApplication.delegate; self.window = [appDelegate loadReactNativeWindowInScene:(UIWindowScene *)scene connectionOptions:connectionOptions]; + [AudiusHinge observeHingeForView:self.window]; // React Native reads the launch URL from launchOptions. TikTok still needs // to see it here. diff --git a/packages/mobile/scripts/generate-visualizer-libs.js b/packages/mobile/scripts/generate-visualizer-libs.js new file mode 100644 index 00000000000..8048e46b756 --- /dev/null +++ b/packages/mobile/scripts/generate-visualizer-libs.js @@ -0,0 +1,22 @@ +const fs = require('fs') +const path = require('path') + +const read = (request) => + fs + .readFileSync(require.resolve(request), 'utf8') + .replace(/<\/script/gi, '<\\/script') + +const output = path.resolve( + __dirname, + '../src/components/now-playing-panel/visualizerLibs.ts' +) + +fs.writeFileSync( + output, + [ + `export const butterchurnSource = ${JSON.stringify(read('butterchurn/lib/butterchurn.min.js'))}`, + '', + `export const butterchurnPresetsSource = ${JSON.stringify(read('butterchurn-presets/lib/butterchurnPresetsMinimal.min.js'))}`, + '' + ].join('\n') +) diff --git a/packages/mobile/src/components/bottom-tab-bar/BottomTabBar.tsx b/packages/mobile/src/components/bottom-tab-bar/BottomTabBar.tsx index fcd60cc29d9..b8ffe898c75 100644 --- a/packages/mobile/src/components/bottom-tab-bar/BottomTabBar.tsx +++ b/packages/mobile/src/components/bottom-tab-bar/BottomTabBar.tsx @@ -6,12 +6,7 @@ import type { BottomTabBarProps as RNBottomTabBarProps } from '@react-navigation/bottom-tabs' import type { NavigationHelpers, ParamListBase } from '@react-navigation/native' -import { - Animated, - Pressable, - StyleSheet, - useWindowDimensions -} from 'react-native' +import { Animated, Pressable, StyleSheet } from 'react-native' import type { SharedValue } from 'react-native-reanimated' import Reanimated, { interpolate, @@ -24,8 +19,9 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context' import { Flex, IconSearch } from '@audius/harmony-native' import { GlassSurface } from 'app/components/core/Screen/GlassSurface' import { LiquidGlassView } from 'app/components/core/Screen/LiquidGlass' -import { FULL_DRAWER_HEIGHT } from 'app/components/drawer' +import { useFullDrawerHeight } from 'app/components/drawer' import { PLAY_BAR_HEIGHT } from 'app/components/now-playing-drawer' +import { useContentWidth } from 'app/hooks/useContentWidth' import { useIsTabBarCollapsed, useTabBarHiddenProgress @@ -61,18 +57,16 @@ export const bottomTabBarButtons = { const interpolatePostion = ( translationAnim: Animated.Value, - bottomInset: number + bottomInset: number, + fullDrawerHeight: number ) => ({ transform: [ { translateY: translationAnim.interpolate({ inputRange: [ 0, - FULL_DRAWER_HEIGHT - - bottomInset - - BOTTOM_BAR_HEIGHT - - PLAY_BAR_HEIGHT, - FULL_DRAWER_HEIGHT + fullDrawerHeight - bottomInset - BOTTOM_BAR_HEIGHT - PLAY_BAR_HEIGHT, + fullDrawerHeight ], outputRange: [bottomInset + BOTTOM_BAR_HEIGHT, 0, 0] }) @@ -97,6 +91,7 @@ export const BottomTabBar = (props: BottomTabBarProps) => { const { translationAnim, navigation, state } = props const { routes, index: activeIndex } = state const insets = useSafeAreaInsets() + const fullDrawerHeight = useFullDrawerHeight() const floating = useFloatingTabBar() const handlePress = useCallback( @@ -153,7 +148,7 @@ export const BottomTabBar = (props: BottomTabBarProps) => { style={[ styles.floatingRoot, { height: BOTTOM_BAR_HEIGHT + insets.bottom }, - interpolatePostion(translationAnim, insets.bottom) + interpolatePostion(translationAnim, insets.bottom, fullDrawerHeight) ]} > { {/* @@ -207,7 +202,7 @@ const FloatingPill = (props: FloatingPillProps) => { const { bottom, activeIndex, tabCount, onPressSearch, children } = props const isDarkMode = isDarkTheme(useThemeVariant()) const colorScheme = isDarkMode ? 'dark' : 'light' - const { width: windowWidth } = useWindowDimensions() + const windowWidth = useContentWidth() const hidden = useTabBarHiddenProgress() const isCollapsed = useIsTabBarCollapsed() const index = useSharedValue(activeIndex) diff --git a/packages/mobile/src/components/collapsible-tabs/Container.tsx b/packages/mobile/src/components/collapsible-tabs/Container.tsx index 4ca5e8e99a5..af8f49d3639 100644 --- a/packages/mobile/src/components/collapsible-tabs/Container.tsx +++ b/packages/mobile/src/components/collapsible-tabs/Container.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { StyleSheet, useWindowDimensions, View } from 'react-native' +import { StyleSheet, View } from 'react-native' import PagerView from 'react-native-pager-view' import Animated, { useAnimatedReaction, @@ -32,6 +32,7 @@ import { IndexChangeEventData, TabName } from './types' +import { useContentWidth } from 'app/hooks/useContentWidth' const AnimatedPagerView = Animated.createAnimatedComponent(PagerView) @@ -67,7 +68,7 @@ export const Container = React.memo( const [refMap, setRef] = useAnimatedDynamicRefs() - const windowWidth = useWindowDimensions().width + const windowWidth = useContentWidth() const width = customWidth ?? windowWidth const [containerHeight, getContainerLayoutHeight] = useLayoutHeight() diff --git a/packages/mobile/src/components/collapsible-tabs/MaterialTabBar/TabBar.tsx b/packages/mobile/src/components/collapsible-tabs/MaterialTabBar/TabBar.tsx index 16ff5328402..760c899aa99 100644 --- a/packages/mobile/src/components/collapsible-tabs/MaterialTabBar/TabBar.tsx +++ b/packages/mobile/src/components/collapsible-tabs/MaterialTabBar/TabBar.tsx @@ -1,7 +1,6 @@ import React, { useLayoutEffect } from 'react' import { StyleSheet, - useWindowDimensions, LayoutChangeEvent } from 'react-native' import Animated, { @@ -18,6 +17,7 @@ import { Indicator } from './Indicator' import { MaterialTabItem } from './TabItem' import { MaterialTabBarProps, ItemLayout } from './types' import { TabName } from '../types' +import { useContentWidth } from 'app/hooks/useContentWidth' export const TABBAR_HEIGHT = 48 @@ -41,7 +41,7 @@ const MaterialTabBar = ({ keepActiveTabCentered }: MaterialTabBarProps): React.ReactElement => { const tabBarRef = useAnimatedRef() - const windowWidth = useWindowDimensions().width + const windowWidth = useContentWidth() const width = customWidth ?? windowWidth const isFirstRender = React.useRef(true) const itemLayoutGathering = React.useRef(new Map()) diff --git a/packages/mobile/src/components/drawer/Drawer.tsx b/packages/mobile/src/components/drawer/Drawer.tsx index 558712d7852..6c2b0b30d99 100644 --- a/packages/mobile/src/components/drawer/Drawer.tsx +++ b/packages/mobile/src/components/drawer/Drawer.tsx @@ -25,7 +25,7 @@ import { makeStyles } from 'app/styles' import { attachToDy } from 'app/utils/animation' import { DrawerHeader } from './DrawerHeader' -import { FULL_DRAWER_HEIGHT } from './constants' +import { getFullDrawerHeight, useFullDrawerHeight } from './constants' const MAX_SHADOW_OPACITY = 0.15 const ON_MOVE_RESPONDER_DY = 10 @@ -152,8 +152,10 @@ export const springToValue = ({ friction = 25 break case DrawerAnimationStyle.SPRINGY: - tension = 70 + 60 * (1 - Math.min(drawerHeight / FULL_DRAWER_HEIGHT, 1)) - friction = 10 + 2 * (1 - Math.min(drawerHeight / FULL_DRAWER_HEIGHT, 1)) + tension = + 70 + 60 * (1 - Math.min(drawerHeight / getFullDrawerHeight(), 1)) + friction = + 10 + 2 * (1 - Math.min(drawerHeight / getFullDrawerHeight(), 1)) break } Animated.spring(animation, { @@ -203,6 +205,7 @@ export const Drawer: DrawerComponent = ({ }: DrawerProps) => { const styles = useStyles() const insets = useSafeAreaInsets() + const FULL_DRAWER_HEIGHT = useFullDrawerHeight() const [drawerHeight, setDrawerHeight] = useState( isFullscreen ? FULL_DRAWER_HEIGHT : 0 @@ -506,6 +509,7 @@ export const Drawer: DrawerComponent = ({ } }), [ + FULL_DRAWER_HEIGHT, translationAnim, drawerHeight, initialOffsetOpenPosition, diff --git a/packages/mobile/src/components/drawer/constants.ts b/packages/mobile/src/components/drawer/constants.ts index ee842aa16b8..8666e5ad671 100644 --- a/packages/mobile/src/components/drawer/constants.ts +++ b/packages/mobile/src/components/drawer/constants.ts @@ -1,5 +1,9 @@ -import { Dimensions } from 'react-native' +import { Dimensions, Platform, useWindowDimensions } from 'react-native' -const { height } = Dimensions.get('screen') +export const getFullDrawerHeight = () => + Dimensions.get(Platform.OS === 'ios' ? 'window' : 'screen').height -export const FULL_DRAWER_HEIGHT = height +export const useFullDrawerHeight = () => { + useWindowDimensions() + return getFullDrawerHeight() +} diff --git a/packages/mobile/src/components/fold/FoldLayoutContext.tsx b/packages/mobile/src/components/fold/FoldLayoutContext.tsx new file mode 100644 index 00000000000..d41caf8082b --- /dev/null +++ b/packages/mobile/src/components/fold/FoldLayoutContext.tsx @@ -0,0 +1,50 @@ +import type { ReactNode } from 'react' +import { createContext, useContext, useMemo } from 'react' + +import { useWindowDimensions } from 'react-native' + +import { useHinge } from './useHinge' + +export const WIDE_LAYOUT_MIN_WIDTH = 600 + +export type FoldPosture = 'phone' | 'open' | 'book' + +type FoldLayout = { + posture: FoldPosture + isWide: boolean + windowWidth: number +} + +const FoldLayoutContext = createContext({ + posture: 'phone', + isWide: false, + windowWidth: 0 +}) + +export const FoldLayoutProvider = ({ children }: { children: ReactNode }) => { + const { width, height } = useWindowDimensions() + const hinge = useHinge() + const isWide = width >= WIDE_LAYOUT_MIN_WIDTH + const isBook = + isWide && + width > height && + hinge.available && + hinge.status === 'partiallyOpen' + + const value = useMemo( + () => ({ + posture: (isBook ? 'book' : isWide ? 'open' : 'phone') as FoldPosture, + isWide, + windowWidth: width + }), + [isBook, isWide, width] + ) + + return ( + + {children} + + ) +} + +export const useFoldLayout = () => useContext(FoldLayoutContext) diff --git a/packages/mobile/src/components/fold/index.ts b/packages/mobile/src/components/fold/index.ts new file mode 100644 index 00000000000..7a2342d0339 --- /dev/null +++ b/packages/mobile/src/components/fold/index.ts @@ -0,0 +1,2 @@ +export * from './FoldLayoutContext' +export * from './useHinge' diff --git a/packages/mobile/src/components/fold/useHinge.ts b/packages/mobile/src/components/fold/useHinge.ts new file mode 100644 index 00000000000..e4c87c08c2f --- /dev/null +++ b/packages/mobile/src/components/fold/useHinge.ts @@ -0,0 +1,39 @@ +import { useEffect, useState } from 'react' + +import { NativeEventEmitter, NativeModules, Platform } from 'react-native' + +export type HingeStatus = 'unknown' | 'closed' | 'partiallyOpen' | 'fullyOpen' + +export type HingeState = { + available: boolean + status?: HingeStatus + angle?: number +} + +const UNAVAILABLE: HingeState = { available: false } + +const HingeModule = + Platform.OS === 'ios' ? NativeModules.AudiusHinge : undefined +const emitter = HingeModule ? new NativeEventEmitter(HingeModule) : null + +export const useHinge = () => { + const [hinge, setHinge] = useState(UNAVAILABLE) + + useEffect(() => { + if (!HingeModule || !emitter) return + let cancelled = false + HingeModule.getState?.().then((state: HingeState) => { + if (!cancelled) setHinge(state) + }) + const subscription = emitter.addListener( + 'hingeChanged', + (state: HingeState) => setHinge(state) + ) + return () => { + cancelled = true + subscription.remove() + } + }, []) + + return hinge +} diff --git a/packages/mobile/src/components/now-playing-drawer/Artwork.tsx b/packages/mobile/src/components/now-playing-drawer/Artwork.tsx index c3fd0916228..59d9587da9f 100644 --- a/packages/mobile/src/components/now-playing-drawer/Artwork.tsx +++ b/packages/mobile/src/components/now-playing-drawer/Artwork.tsx @@ -7,9 +7,10 @@ import type { Track } from '@audius/common/models' import { averageColorSelectors, playbackSelectors } from '@audius/common/store' import type { CommonState } from '@audius/common/store' import type { Nullable } from '@audius/common/utils' -import { Dimensions, View } from 'react-native' +import { View } from 'react-native' import { useSelector } from 'react-redux' +import { useContentWidth } from 'app/hooks/useContentWidth' import { makeStyles } from 'app/styles' import { TrackImage } from '../image/TrackImage' @@ -19,14 +20,12 @@ import { mostSaturated } from './useDominantArtworkColors' const { getPreviewing } = playbackSelectors const { getDominantColorsByTrack } = averageColorSelectors -const dimensions = Dimensions.get('window') const spacing = 24 const useStyles = makeStyles(({ palette }) => ({ root: { marginLeft: spacing, marginRight: spacing, - maxHeight: dimensions.width - spacing * 2, alignSelf: 'center', backgroundColor: palette.white, borderRadius: 8, @@ -53,10 +52,12 @@ const useStyles = makeStyles(({ palette }) => ({ type ArtworkProps = { track: Nullable isOpen: boolean + maxSize?: number } -export const Artwork = ({ track, isOpen }: ArtworkProps) => { +export const Artwork = ({ track, isOpen, maxSize }: ArtworkProps) => { const styles = useStyles() + const contentWidth = useContentWidth() const dominantColors = useSelector((state: CommonState) => getDominantColorsByTrack(state, { @@ -86,7 +87,13 @@ export const Artwork = ({ track, isOpen }: ArtworkProps) => { isPreviewing || canPurchase || shouldDisplayPremiumDownloadLocked return ( - + { +export const usePlaybackPosition = (isActive: boolean, mediaKey: string) => { const [position, setPosition] = useState(0) const seek = useSelector(getSeek) const seekCounter = useSelector(getSeekCounter) @@ -121,6 +121,7 @@ const Bubble = ({ }) => { const navigation = useNavigation() const { open } = useCommentDrawer() + const contentWidth = useContentWidth() const { data: name } = useUser(comment.userId, { select: (user) => user.name }) @@ -152,7 +153,7 @@ const Bubble = ({ style={{ paddingVertical: 2, borderRadius: 999, - maxWidth: BUBBLE_MAX_WIDTH + maxWidth: contentWidth * 0.85 }} > diff --git a/packages/mobile/src/components/now-playing-drawer/Logo.tsx b/packages/mobile/src/components/now-playing-drawer/Logo.tsx index ea5da004209..a69386ed619 100644 --- a/packages/mobile/src/components/now-playing-drawer/Logo.tsx +++ b/packages/mobile/src/components/now-playing-drawer/Logo.tsx @@ -3,7 +3,7 @@ import { StyleSheet, Animated } from 'react-native' import AudiusLogoHorizontal from 'app/assets/images/audiusLogoHorizontalDeprecated.svg' import { useThemeColors } from 'app/utils/theme' -import { NOW_PLAYING_HEIGHT } from './constants' +import { useNowPlayingHeight } from './constants' const styles = StyleSheet.create({ root: { @@ -18,6 +18,7 @@ type LogoProps = { export const Logo = ({ translationAnim }: LogoProps) => { const { neutralLight4 } = useThemeColors() + const NOW_PLAYING_HEIGHT = useNowPlayingHeight() return ( ({ container: { paddingTop: 0, - height: FULL_DRAWER_HEIGHT, justifyContent: 'space-evenly' }, playBarContainer: { @@ -137,15 +133,14 @@ export const NowPlayingDrawer = memo(function NowPlayingDrawer( const navigation = useNavigation({ customNavigation: contextNavigation }) - const dispatch = useDispatch() const insets = useSafeAreaInsets() const staticTopInset = useRef(insets.top) const styles = useStyles() + const FULL_DRAWER_HEIGHT = useFullDrawerHeight() const { isOpen, onOpen, onClose } = useDrawer('NowPlaying') const tabBarHidden = useTabBarHiddenProgress() const { isOpen: isCommentDrawerOpen } = useCommentDrawer() - const playCounter = useSelector(getCounter) const currentTrackId = useSelector(getTrackId) const isPlaying = useSelector(getPlaying) const isBuffering = useSelector(getBuffering) @@ -280,24 +275,19 @@ export const NowPlayingDrawer = memo(function NowPlayingDrawer( const [isGestureEnabled, setIsGestureEnabled] = useState(true) - const track = useCurrentTrack() - const trackDuration = useCurrentTrackDuration() - const trackId = track?.track_id - - const { data: user } = useUser(track?.owner_id) - const [mediaKey, setMediaKey] = useState(0) - - const { isEnabled: isNowPlayingCommentsEnabled } = useFeatureFlag( - FeatureFlags.NOW_PLAYING_COMMENTS - ) - const { isEnabled: isWaveformEnabled } = useFeatureFlag( - FeatureFlags.NOW_PLAYING_WAVEFORM - ) - useDominantArtworkColors(trackId, isWaveformEnabled && isOpen) - const timestampedComments = useTimestampedComments( + const { + track, trackId, - (isNowPlayingCommentsEnabled || isWaveformEnabled) && isOpen - ) + user, + trackDuration, + mediaKey, + isLongFormContent, + isNowPlayingCommentsEnabled, + isWaveformEnabled, + timestampedComments, + onNext, + onPrevious + } = useNowPlayingControls(isOpen) const commentMarkers = useMemo( () => trackDuration > 0 && timestampedComments.length > 0 @@ -308,40 +298,16 @@ export const NowPlayingDrawer = memo(function NowPlayingDrawer( [timestampedComments, trackDuration] ) - useEffect(() => { - setMediaKey((mediaKey) => mediaKey + 1) - }, [playCounter, currentTrackId]) - - const onNext = useCallback(async () => { - const isLongFormContent = - track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks - if (isLongFormContent) { - const { position: currentPosition } = await TrackPlayer.getProgress() - const newPosition = currentPosition + SKIP_DURATION_SEC - dispatch(seek({ seconds: Math.min(track.duration, newPosition) })) - } else { - dispatch(next({ skip: true })) - setMediaKey((mediaKey) => mediaKey + 1) - } - }, [dispatch, setMediaKey, track]) - - const onPrevious = useCallback(async () => { - const { position: currentPosition } = await TrackPlayer.getProgress() - const isLongFormContent = - track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks - if (isLongFormContent) { - const newPosition = currentPosition - SKIP_DURATION_SEC - dispatch(seek({ seconds: Math.max(0, newPosition) })) - } else { - const shouldGoToPrevious = currentPosition < RESTART_THRESHOLD_SEC - if (shouldGoToPrevious) { - dispatch(previous()) - setMediaKey((mediaKey) => mediaKey + 1) - } else { - dispatch(reset({ shouldAutoplay: true })) - } - } - }, [dispatch, setMediaKey, track]) + const { isEnabled: isVisualizerEnabled } = useFeatureFlag( + FeatureFlags.NOW_PLAYING_VISUALIZER + ) + const [isVisualizerOn, setIsVisualizerOn] = useState(false) + const toggleVisualizer = useCallback(() => { + setIsVisualizerOn((isOn) => !isOn) + }, []) + const showVisualizer = + !!isVisualizerEnabled && isVisualizerOn && isOpen && !!trackId + const { pulseStyle, handlePulse } = useArtworkPulse() const onPressScrubberIn = useCallback(() => { setIsGestureEnabled(false) @@ -362,7 +328,7 @@ export const NowPlayingDrawer = memo(function NowPlayingDrawer( const playBar = ( - {floating ? null : playBar} - - - - - - - - - - - - {isWaveformEnabled && trackId ? ( - + {floating ? null : playBar} + + + + + + + + + + + + + + {isWaveformEnabled && trackId ? ( + + ) : ( + + )} + + {isNowPlayingCommentsEnabled && trackId ? ( + - ) : ( - + ) : null} + + - )} - - {isNowPlayingCommentsEnabled && trackId ? ( - - ) : null} - {isWaveformEnabled ? ( - - ) : null} - - - - + + + diff --git a/packages/mobile/src/components/now-playing-drawer/PlayBar.tsx b/packages/mobile/src/components/now-playing-drawer/PlayBar.tsx index 2cac8f93f2b..51a1203b66c 100644 --- a/packages/mobile/src/components/now-playing-drawer/PlayBar.tsx +++ b/packages/mobile/src/components/now-playing-drawer/PlayBar.tsx @@ -42,7 +42,7 @@ import { TrackImage } from '../image/TrackImage' import { PlayButton } from './PlayButton' import { TrackingBar } from './TrackingBar' -import { NOW_PLAYING_HEIGHT, PLAY_BAR_HEIGHT } from './constants' +import { PLAY_BAR_HEIGHT, useNowPlayingHeight } from './constants' const { getPreviewing } = playbackSelectors const QUEUE_BUTTON_WIDTH = 32 @@ -201,6 +201,7 @@ export const PlayBar = (props: PlayBarProps) => { 'clamp' ) })) + const NOW_PLAYING_HEIGHT = useNowPlayingHeight() const queueStyle = useAnimatedStyle(() => { const shrink = interpolate( hidden.value, diff --git a/packages/mobile/src/components/now-playing-drawer/TitleBar.tsx b/packages/mobile/src/components/now-playing-drawer/TitleBar.tsx index 7106dec566b..d040f3667fe 100644 --- a/packages/mobile/src/components/now-playing-drawer/TitleBar.tsx +++ b/packages/mobile/src/components/now-playing-drawer/TitleBar.tsx @@ -1,20 +1,25 @@ import { Text, IconCaretRight, + IconStars, IconButton, Flex, Box } from '@audius/harmony-native' const messages = { - nowPlaying: 'Now playing' + nowPlaying: 'Now playing', + visualizer: 'Visualizer' } type TitleBarProps = { onClose: () => void + isVisualizerOn?: boolean + onToggleVisualizer?: () => void } -export const TitleBar = ({ onClose }: TitleBarProps) => { +export const TitleBar = (props: TitleBarProps) => { + const { onClose, isVisualizerOn, onToggleVisualizer } = props return ( { {messages.nowPlaying} - + {onToggleVisualizer ? ( + + ) : ( + + )} ) } diff --git a/packages/mobile/src/components/now-playing-drawer/TrackingBar.tsx b/packages/mobile/src/components/now-playing-drawer/TrackingBar.tsx index f1ade64cda8..b6d030f32e5 100644 --- a/packages/mobile/src/components/now-playing-drawer/TrackingBar.tsx +++ b/packages/mobile/src/components/now-playing-drawer/TrackingBar.tsx @@ -3,7 +3,7 @@ import { useCallback, useEffect, useRef } from 'react' import { useCurrentTrack } from '@audius/common/hooks' import { playbackSelectors, playbackRateValueMap } from '@audius/common/store' import { Genre } from '@audius/common/utils' -import { Animated, Dimensions } from 'react-native' +import { Animated, useWindowDimensions } from 'react-native' import TrackPlayer, { useIsPlaying } from 'react-native-track-player' import { useSelector } from 'react-redux' import { useAsync } from 'react-use' @@ -14,9 +14,7 @@ import type { LinearAnimation } from 'app/utils/animation' import { animateLinear } from 'app/utils/animation' import { useThemeColors } from 'app/utils/theme' -import { NOW_PLAYING_HEIGHT } from './constants' - -const width = Dimensions.get('window').width +import { useNowPlayingHeight } from './constants' const { getSeek, getPaused, getBuffering } = playbackSelectors @@ -113,6 +111,8 @@ export const TrackingBar = (props: TrackingBarProps) => { useEffect(() => () => currentAnimation.current?.stop(), []) + const NOW_PLAYING_HEIGHT = useNowPlayingHeight() + const { width } = useWindowDimensions() const rootOpacity = translateYAnimation.interpolate({ inputRange: [0, 0.9 * NOW_PLAYING_HEIGHT, NOW_PLAYING_HEIGHT], outputRange: [0, 0, 2] diff --git a/packages/mobile/src/components/now-playing-drawer/WaveformScrubber.tsx b/packages/mobile/src/components/now-playing-drawer/WaveformScrubber.tsx index 7942ff06c65..198befda494 100644 --- a/packages/mobile/src/components/now-playing-drawer/WaveformScrubber.tsx +++ b/packages/mobile/src/components/now-playing-drawer/WaveformScrubber.tsx @@ -98,7 +98,7 @@ const buildPath = ( return d } -const usePlaybackSeconds = (isActive: boolean, mediaKey: string) => { +export const usePlaybackSeconds = (isActive: boolean, mediaKey: string) => { const [position, setPosition] = useState(0) const seek = useSelector(getSeek) const seekCounter = useSelector(getSeekCounter) @@ -198,6 +198,7 @@ type WaveformScrubberProps = { comments: TimestampedComment[] onPressIn: () => void onPressOut: () => void + unplayedColor?: string } export const WaveformScrubber = (props: WaveformScrubberProps) => { @@ -209,11 +210,14 @@ export const WaveformScrubber = (props: WaveformScrubberProps) => { isPlaying, comments, onPressIn, - onPressOut + onPressOut, + unplayedColor: unplayedColorOverride } = props const dispatch = useDispatch() const { color, type } = useTheme() - const unplayedColor = type === 'day' ? color.neutral.n150 : color.neutral.n300 + const unplayedColor = + unplayedColorOverride ?? + (type === 'day' ? color.neutral.n150 : color.neutral.n300) const [width, setWidth] = useState(0) const [dragFraction, setDragFraction] = useState(null) const position = usePlaybackSeconds(isOpen && isPlaying, mediaKey) diff --git a/packages/mobile/src/components/now-playing-drawer/constants.ts b/packages/mobile/src/components/now-playing-drawer/constants.ts index 8a1ad233d3d..c3f3b04d05c 100644 --- a/packages/mobile/src/components/now-playing-drawer/constants.ts +++ b/packages/mobile/src/components/now-playing-drawer/constants.ts @@ -1,6 +1,7 @@ import { BOTTOM_BAR_HEIGHT } from 'app/components/bottom-tab-bar' -import { FULL_DRAWER_HEIGHT } from 'app/components/drawer' +import { useFullDrawerHeight } from 'app/components/drawer' export const PLAY_BAR_HEIGHT = 52 -export const NOW_PLAYING_HEIGHT = - FULL_DRAWER_HEIGHT - BOTTOM_BAR_HEIGHT - PLAY_BAR_HEIGHT + +export const useNowPlayingHeight = () => + useFullDrawerHeight() - BOTTOM_BAR_HEIGHT - PLAY_BAR_HEIGHT diff --git a/packages/mobile/src/components/now-playing-drawer/useNowPlayingControls.ts b/packages/mobile/src/components/now-playing-drawer/useNowPlayingControls.ts new file mode 100644 index 00000000000..33bf1153032 --- /dev/null +++ b/packages/mobile/src/components/now-playing-drawer/useNowPlayingControls.ts @@ -0,0 +1,102 @@ +import { useCallback, useEffect, useState } from 'react' + +import { useTimestampedComments, useUser } from '@audius/common/api' +import { useCurrentTrack, useFeatureFlag } from '@audius/common/hooks' +import { FeatureFlags } from '@audius/common/services' +import { playbackActions, playbackSelectors } from '@audius/common/store' +import { Genre } from '@audius/common/utils' +import TrackPlayer from 'react-native-track-player' +import { useDispatch, useSelector } from 'react-redux' + +import { + RESTART_THRESHOLD_SEC, + SKIP_DURATION_SEC +} from 'app/components/audio/constants' + +import { useCurrentTrackDuration } from './useCurrentTrackDuration' +import { useDominantArtworkColors } from './useDominantArtworkColors' + +const { seekTo: seek, reset, next, previous } = playbackActions +const { getPlaying, getTrackId, getCounter, getBuffering } = playbackSelectors + +export const useNowPlayingControls = (isVisible: boolean) => { + const dispatch = useDispatch() + const playCounter = useSelector(getCounter) + const currentTrackId = useSelector(getTrackId) + const isPlaying = useSelector(getPlaying) + const isBuffering = useSelector(getBuffering) + const track = useCurrentTrack() + const trackDuration = useCurrentTrackDuration() + const trackId = track?.track_id + const { data: user } = useUser(track?.owner_id) + const [mediaKey, setMediaKey] = useState(0) + + const { isEnabled: isNowPlayingCommentsEnabled } = useFeatureFlag( + FeatureFlags.NOW_PLAYING_COMMENTS + ) + const { isEnabled: isWaveformEnabled } = useFeatureFlag( + FeatureFlags.NOW_PLAYING_WAVEFORM + ) + useDominantArtworkColors(trackId, !!isWaveformEnabled && isVisible) + const timestampedComments = useTimestampedComments( + trackId, + (!!isNowPlayingCommentsEnabled || !!isWaveformEnabled) && isVisible + ) + + useEffect(() => { + setMediaKey((key) => key + 1) + }, [playCounter, currentTrackId]) + + const isLongFormContent = + track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks + + const onNext = useCallback(async () => { + if (isLongFormContent && track) { + const { position } = await TrackPlayer.getProgress() + dispatch( + seek({ + seconds: Math.min(track.duration, position + SKIP_DURATION_SEC) + }) + ) + } else { + dispatch(next({ skip: true })) + setMediaKey((key) => key + 1) + } + }, [dispatch, isLongFormContent, track]) + + const onPrevious = useCallback(async () => { + const { position } = await TrackPlayer.getProgress() + if (isLongFormContent) { + dispatch(seek({ seconds: Math.max(0, position - SKIP_DURATION_SEC) })) + } else if (position < RESTART_THRESHOLD_SEC) { + dispatch(previous()) + setMediaKey((key) => key + 1) + } else { + dispatch(reset({ shouldAutoplay: true })) + } + }, [dispatch, isLongFormContent]) + + const onSeek = useCallback( + (seconds: number) => { + dispatch(seek({ seconds })) + }, + [dispatch] + ) + + return { + track, + trackId, + user, + trackDuration, + mediaKey: `${mediaKey}`, + isPlaying, + isBuffering, + isLongFormContent, + isNowPlayingCommentsEnabled: !!isNowPlayingCommentsEnabled, + isWaveformEnabled: !!isWaveformEnabled, + timestampedComments, + onNext, + onPrevious, + onSeek + } +} diff --git a/packages/mobile/src/components/now-playing-panel/Gatefold.tsx b/packages/mobile/src/components/now-playing-panel/Gatefold.tsx new file mode 100644 index 00000000000..27fd9afa653 --- /dev/null +++ b/packages/mobile/src/components/now-playing-panel/Gatefold.tsx @@ -0,0 +1,324 @@ +import { + useCallback, + useContext, + useEffect, + useMemo, + useRef, + useState +} from 'react' + +import { useUser } from '@audius/common/api' +import type { TimestampedComment } from '@audius/common/api' +import type { LayoutChangeEvent } from 'react-native' +import { FlatList, Pressable, View } from 'react-native' +import { useSafeAreaInsets } from 'react-native-safe-area-context' + +import { + Flex, + IconButton, + IconClose, + Text, + useTheme +} from '@audius/harmony-native' +import { ProfilePicture } from 'app/components/core' +import { Artwork } from 'app/components/now-playing-drawer/Artwork' +import { AudioControls } from 'app/components/now-playing-drawer/AudioControls' +import { usePlaybackPosition } from 'app/components/now-playing-drawer/CommentBubble' +import { TrackInfo } from 'app/components/now-playing-drawer/TrackInfo' +import { WaveformScrubber } from 'app/components/now-playing-drawer/WaveformScrubber' +import { useNowPlayingControls } from 'app/components/now-playing-drawer/useNowPlayingControls' +import { Scrubber } from 'app/components/scrubber' +import { ContentWidthContext } from 'app/hooks/useContentWidth' +import { useNavigation } from 'app/hooks/useNavigation' +import { AppTabNavigationContext } from 'app/screens/app-screen/AppTabNavigationProvider' + +import { UpNext } from './NowPlayingPanel' + +const HINGE_GUTTER = 32 +const COMMENT_ROW_HEIGHT = 64 +const ARTWORK_MARGIN = 24 + +const messages = { + comments: 'Comments', + commentsHint: 'Moments listeners called out, in time with the music', + upNextHint: 'No timed comments on this track yet', + close: 'Back to browsing' +} + +const formatTimestamp = (seconds: number) => { + const whole = Math.max(0, Math.floor(seconds)) + const minutes = Math.floor(whole / 60) + return `${minutes}:${String(whole % 60).padStart(2, '0')}` +} + +type GatefoldProps = { + width: number + onClose: () => void +} + +export const Gatefold = ({ width, onClose }: GatefoldProps) => { + const { color, spacing } = useTheme() + const insets = useSafeAreaInsets() + const [measuredWidth, setMeasuredWidth] = useState(width) + const [artworkBox, setArtworkBox] = useState({ width: 0, height: 0 }) + const { + track, + trackId, + user, + trackDuration, + mediaKey, + isPlaying, + isBuffering, + isLongFormContent, + isWaveformEnabled, + timestampedComments, + onNext, + onPrevious, + onSeek + } = useNowPlayingControls(true) + const { navigation: tabNavigation } = useContext(AppTabNavigationContext) + const navigation = useNavigation({ customNavigation: tabNavigation }) + const pageWidth = measuredWidth / 2 + const artworkSize = Math.max( + 0, + Math.min(artworkBox.width - ARTWORK_MARGIN * 2, artworkBox.height) + ) + + const handleLayout = useCallback((e: LayoutChangeEvent) => { + setMeasuredWidth(e.nativeEvent.layout.width) + }, []) + + const handleArtworkLayout = useCallback((e: LayoutChangeEvent) => { + const { width, height } = e.nativeEvent.layout + setArtworkBox({ width, height }) + }, []) + + const handlePressTitle = useCallback(() => { + if (!trackId) return + onClose() + navigation?.push('Track', { trackId }) + }, [navigation, onClose, trackId]) + + return ( + + + + + {artworkSize > 0 ? ( + + + + ) : null} + + + + + {isWaveformEnabled && trackId ? ( + + ) : ( + + )} + + + + + + + + {messages.comments} + + + {timestampedComments.length > 0 + ? messages.commentsHint + : messages.upNextHint} + + + + + {timestampedComments.length > 0 && trackId ? ( + + ) : ( + + )} + + + + ) +} + +const noop = () => {} + +type SyncedCommentsProps = { + comments: TimestampedComment[] + isActive: boolean + mediaKey: string + onSeek: (seconds: number) => void + bottomInset: number +} + +const SyncedComments = (props: SyncedCommentsProps) => { + const { comments, isActive, mediaKey, onSeek, bottomInset } = props + const { spacing } = useTheme() + const position = usePlaybackPosition(isActive, mediaKey) + const listRef = useRef>(null) + + const activeIndex = useMemo(() => { + let found = -1 + comments.forEach((comment, i) => { + if (comment.trackTimestampS <= position) found = i + }) + return found + }, [comments, position]) + + useEffect(() => { + if (activeIndex < 0) return + listRef.current?.scrollToIndex({ + index: activeIndex, + viewPosition: 0.35, + animated: true + }) + }, [activeIndex]) + + const getItemLayout = useCallback( + (_: ArrayLike | null | undefined, index: number) => ({ + length: COMMENT_ROW_HEIGHT, + offset: COMMENT_ROW_HEIGHT * index, + index + }), + [] + ) + + return ( + `${comment.id}`} + getItemLayout={getItemLayout} + showsVerticalScrollIndicator={false} + contentContainerStyle={{ + paddingTop: spacing.xl, + paddingBottom: bottomInset + spacing['4xl'] + }} + renderItem={({ item, index }) => ( + onSeek(item.trackTimestampS)} + /> + )} + /> + ) +} + +type SyncedCommentRowProps = { + comment: TimestampedComment + state: 'past' | 'active' | 'upcoming' + onPress: () => void +} + +const SyncedCommentRow = ({ + comment, + state, + onPress +}: SyncedCommentRowProps) => { + const { data: name } = useUser(comment.userId, { + select: (user) => user.name + }) + const isActive = state === 'active' + + return ( + + + + + + {formatTimestamp(comment.trackTimestampS)} + {name ? ` ยท ${name}` : ''} + + + {comment.message} + + + + + ) +} diff --git a/packages/mobile/src/components/now-playing-panel/ImmersiveBackdrop.tsx b/packages/mobile/src/components/now-playing-panel/ImmersiveBackdrop.tsx new file mode 100644 index 00000000000..c52e89584ef --- /dev/null +++ b/packages/mobile/src/components/now-playing-panel/ImmersiveBackdrop.tsx @@ -0,0 +1,109 @@ +import type { ReactNode } from 'react' +import { useCallback, useMemo } from 'react' + +import type { Color, ID, Track } from '@audius/common/models' +import { averageColorSelectors } from '@audius/common/store' +import type { CommonState } from '@audius/common/store' +import type { Nullable } from '@audius/common/utils' +import { StyleSheet, View } from 'react-native' +import { + useAnimatedStyle, + useSharedValue, + withSequence, + withTiming +} from 'react-native-reanimated' +import { useSelector } from 'react-redux' + +import { ThemeProvider } from '@audius/harmony-native' +import type { ResolvedThemeName } from 'app/utils/theme' +import { ThemeOverrideContext, useResolvedThemeName } from 'app/utils/theme' + +import { Visualizer } from './Visualizer' + +const { getDominantColorsByTrack } = averageColorSelectors + +export const UNPLAYED_WAVEFORM_COLOR = 'rgba(255,255,255,0.45)' +const TINT_COLOR_COUNT = 3 +const MIN_TINT_CHROMA = 40 +const BEAT_SCALE = 0.035 +const DROP_SCALE = 0.09 + +const toDarkTheme = (name: ResolvedThemeName): ResolvedThemeName => + name === 'matrix' + ? name + : name.startsWith('classic') + ? 'classic-dark' + : 'default-dark' + +type ImmersiveThemeProps = { + enabled: boolean + children: ReactNode +} + +export const ImmersiveTheme = ({ enabled, children }: ImmersiveThemeProps) => { + const themeName = useResolvedThemeName() + const name = enabled ? toDarkTheme(themeName) : themeName + + return ( + + {children} + + ) +} + +export const useArtworkPulse = () => { + const pulse = useSharedValue(0) + const handlePulse = useCallback( + (strength: number, isDrop: boolean) => { + const amount = strength * (isDrop ? DROP_SCALE : BEAT_SCALE) + pulse.value = withSequence( + withTiming(amount, { duration: 60 }), + withTiming(0, { duration: isDrop ? 900 : 260 }) + ) + }, + [pulse] + ) + const pulseStyle = useAnimatedStyle(() => ({ + transform: [{ scale: 1 + pulse.value }] + })) + + return { pulseStyle, handlePulse } +} + +type ImmersiveBackdropProps = { + onPulse: (strength: number, isDrop: boolean) => void + track: Nullable + trackId: ID + duration: number + mediaKey: string + isPlaying: boolean + isWide?: boolean +} + +const chroma = ({ r, g, b }: Color) => Math.max(r, g, b) - Math.min(r, g, b) + +export const ImmersiveBackdrop = ({ + track, + ...props +}: ImmersiveBackdropProps) => { + const dominantColors = useSelector((state: CommonState) => + getDominantColorsByTrack(state, { track }) + ) + const colors = useMemo( + () => + [...(dominantColors ?? [])] + .filter((color) => chroma(color) >= MIN_TINT_CHROMA) + .sort((a, b) => chroma(b) - chroma(a)) + .slice(0, TINT_COLOR_COUNT) + .map( + ({ r, g, b }) => `rgb(${r.toFixed()},${g.toFixed()},${b.toFixed()})` + ), + [dominantColors] + ) + + return ( + + + + ) +} diff --git a/packages/mobile/src/components/now-playing-panel/NowPlayingPanel.tsx b/packages/mobile/src/components/now-playing-panel/NowPlayingPanel.tsx new file mode 100644 index 00000000000..ff62143d0b6 --- /dev/null +++ b/packages/mobile/src/components/now-playing-panel/NowPlayingPanel.tsx @@ -0,0 +1,306 @@ +import { useCallback, useContext, useState } from 'react' + +import { playbackActions, playbackSelectors } from '@audius/common/store' +import type { LayoutChangeEvent } from 'react-native' +import { Pressable, ScrollView, View } from 'react-native' +import Animated from 'react-native-reanimated' +import { useSafeAreaInsets } from 'react-native-safe-area-context' +import { useDispatch, useSelector } from 'react-redux' + +import { + Flex, + IconButton, + IconStars, + Text, + useTheme +} from '@audius/harmony-native' +import { ActionsBar } from 'app/components/now-playing-drawer/ActionsBar' +import { Artwork } from 'app/components/now-playing-drawer/Artwork' +import { AudioControls } from 'app/components/now-playing-drawer/AudioControls' +import { CommentBubble } from 'app/components/now-playing-drawer/CommentBubble' +import { TrackInfo } from 'app/components/now-playing-drawer/TrackInfo' +import { WaveformScrubber } from 'app/components/now-playing-drawer/WaveformScrubber' +import { useNowPlayingControls } from 'app/components/now-playing-drawer/useNowPlayingControls' +import { MiniTrackRow } from 'app/components/queue-drawer/QueueDrawer' +import { Scrubber } from 'app/components/scrubber' +import { ContentWidthContext } from 'app/hooks/useContentWidth' +import { useNavigation } from 'app/hooks/useNavigation' +import { AppTabNavigationContext } from 'app/screens/app-screen/AppTabNavigationProvider' + +import { + ImmersiveBackdrop, + ImmersiveTheme, + UNPLAYED_WAVEFORM_COLOR, + useArtworkPulse +} from './ImmersiveBackdrop' + +const { getPlaybackQueue, getPlaybackIndex } = playbackSelectors +const { playTrackAt } = playbackActions + +const UP_NEXT_LIMIT = 8 +const ARTWORK_GUTTER = 48 +const EXPANDED_COLUMN_WIDTH = 520 +const SIDE_COLUMN_WIDTH = 440 +const IMMERSIVE_ARTWORK_GUTTER = 24 + +const messages = { + nowPlaying: 'Now Playing', + visualizer: 'Visualizer', + upNext: 'Up Next' +} + +type NowPlayingPanelProps = { + width: number + isVisualizerOn?: boolean + onToggleVisualizer?: () => void +} + +export const NowPlayingPanel = (props: NowPlayingPanelProps) => ( + + + +) + +const Panel = (props: NowPlayingPanelProps) => { + const { width, isVisualizerOn, onToggleVisualizer } = props + const immersive = !!isVisualizerOn + const isExpanded = immersive + const { color, spacing } = useTheme() + const insets = useSafeAreaInsets() + const [panelHeight, setPanelHeight] = useState(0) + const [artworkBox, setArtworkBox] = useState({ width: 0, height: 0 }) + const usableWidth = width - insets.left - insets.right + const isSideBySide = !!isExpanded && panelHeight > 0 && width > panelHeight + const columnWidth = isSideBySide + ? Math.min(SIDE_COLUMN_WIDTH, Math.floor(usableWidth / 2)) + : isExpanded + ? Math.min(width, EXPANDED_COLUMN_WIDTH) + : width + const artworkGutter = immersive ? IMMERSIVE_ARTWORK_GUTTER : ARTWORK_GUTTER + const artworkSize = Math.max( + 0, + Math.min(artworkBox.width - artworkGutter, artworkBox.height) + ) + const controls = useNowPlayingControls(true) + const { + track, + trackId, + user, + trackDuration, + mediaKey, + isPlaying, + isBuffering, + isLongFormContent, + isNowPlayingCommentsEnabled, + isWaveformEnabled, + timestampedComments, + onNext, + onPrevious + } = controls + const { navigation: tabNavigation } = useContext(AppTabNavigationContext) + const navigation = useNavigation({ customNavigation: tabNavigation }) + + const handlePressTitle = useCallback(() => { + if (trackId) navigation?.push('Track', { trackId }) + }, [navigation, trackId]) + + const handlePanelLayout = useCallback((e: LayoutChangeEvent) => { + setPanelHeight(e.nativeEvent.layout.height) + }, []) + + const { pulseStyle, handlePulse } = useArtworkPulse() + + const handleArtworkLayout = useCallback((e: LayoutChangeEvent) => { + const { width, height } = e.nativeEvent.layout + setArtworkBox({ width, height }) + }, []) + + const header = ( + + + {messages.nowPlaying} + + {onToggleVisualizer ? ( + + ) : null} + + ) + + const artwork = ( + + {artworkSize > 0 ? ( + + + + + + ) : null} + + ) + + const details = ( + <> + + + + + {isWaveformEnabled && trackId ? ( + + ) : ( + + )} + + {isNowPlayingCommentsEnabled && trackId ? ( + + ) : null} + + + + + + + ) + + return ( + + + {immersive && trackId ? ( + + ) : null} + + {isSideBySide ? ( + + {artwork} + + {header} + {details} + + + ) : ( + + {header} + {artwork} + {details} + + )} + + + + + + + ) +} + +const noop = () => {} + +export const UpNext = ({ limit = UP_NEXT_LIMIT }: { limit?: number }) => { + const dispatch = useDispatch() + const queue = useSelector(getPlaybackQueue) + const index = useSelector(getPlaybackIndex) + const upcoming = queue + .map((item, queueIndex) => ({ trackId: item.trackId, queueIndex })) + .slice(index + 1, index + 1 + limit) + + if (upcoming.length === 0) return null + + return ( + + + + {messages.upNext} + + + {upcoming.map(({ trackId, queueIndex }) => ( + dispatch(playTrackAt({ index: queueIndex }))} + /> + ))} + + ) +} diff --git a/packages/mobile/src/components/now-playing-panel/Visualizer.tsx b/packages/mobile/src/components/now-playing-panel/Visualizer.tsx new file mode 100644 index 00000000000..4bd3d2d3300 --- /dev/null +++ b/packages/mobile/src/components/now-playing-panel/Visualizer.tsx @@ -0,0 +1,336 @@ +import { useCallback, useEffect, useMemo, useRef } from 'react' + +import { useTrackWaveformPeaks } from '@audius/common/api' +import type { ID } from '@audius/common/models' +import { makeWaveformPeaks, resampleWaveformPeaks } from '@audius/common/utils' +import { StyleSheet } from 'react-native' +import TrackPlayer from 'react-native-track-player' +import { WebView } from 'react-native-webview' +import type { WebViewMessageEvent } from 'react-native-webview' + +import { usePlaybackSeconds } from 'app/components/now-playing-drawer/WaveformScrubber' + +import { butterchurnPresetsSource, butterchurnSource } from './visualizerLibs' + +const FALLBACK_PEAK_COUNT = 750 +const LOOKAHEAD_S = 0.25 +const KICK_GAIN = 5 +const MAX_DECODE_S = 420 + +const html = ` + + + + + + + +
+
+ + + + +` + +const envelopeAt = (peaks: number[], fraction: number) => { + if (!peaks.length) return 0 + const at = Math.min(1, Math.max(0, fraction)) * (peaks.length - 1) + const index = Math.floor(at) + const next = Math.min(peaks.length - 1, index + 1) + return peaks[index] + (peaks[next] - peaks[index]) * (at - index) +} + +type VisualizerProps = { + trackId: ID + duration: number + mediaKey: string + isPlaying: boolean + colors: string[] + isWide?: boolean + onPulse?: (strength: number, isDrop: boolean) => void +} + +export const Visualizer = (props: VisualizerProps) => { + const { trackId, duration, mediaKey, isPlaying, colors, isWide, onPulse } = + props + const webViewRef = useRef(null) + const position = usePlaybackSeconds(isPlaying, mediaKey) + const { data: realPeaks, isFetched } = useTrackWaveformPeaks(trackId, true) + + const peaks = useMemo(() => { + if (!isFetched) return [] + return realPeaks + ? resampleWaveformPeaks(realPeaks, realPeaks.length) + : makeWaveformPeaks(trackId, FALLBACK_PEAK_COUNT) + }, [trackId, realPeaks, isFetched]) + + const lastEnvelope = useRef(0) + + useEffect(() => { + const envelope = + isPlaying && duration + ? envelopeAt(peaks, (position + LOOKAHEAD_S) / duration) + : 0 + const kick = Math.min( + 1, + Math.max(0, envelope - lastEnvelope.current) * KICK_GAIN + ) + lastEnvelope.current = envelope + webViewRef.current?.injectJavaScript( + `window.setLevel&&window.setLevel(${envelope.toFixed(3)},${kick.toFixed(3)},${isPlaying},${position.toFixed(3)});true;` + ) + }, [position, duration, peaks, isPlaying]) + + const colorsKey = colors.join('|') + const applyTrack = useCallback(() => { + webViewRef.current?.injectJavaScript( + `window.setWide&&window.setWide(${!!isWide});window.setTrack&&window.setTrack(${trackId},${JSON.stringify(colorsKey ? colorsKey.split('|') : [])});true;` + ) + }, [trackId, colorsKey, isWide]) + + useEffect(applyTrack, [applyTrack]) + + const applyAudio = useCallback(async () => { + const active = await TrackPlayer.getActiveTrack() + const url = typeof active?.url === 'string' ? active.url : '' + const canDecode = + url.startsWith('http') && duration > 0 && duration <= MAX_DECODE_S + webViewRef.current?.injectJavaScript( + `window.setAudio&&window.setAudio(${JSON.stringify(canDecode ? url : '')});true;` + ) + }, [duration]) + + useEffect(() => { + applyAudio() + }, [applyAudio, trackId, mediaKey, isPlaying]) + + const handleMessage = useCallback( + (event: WebViewMessageEvent) => { + try { + const message = JSON.parse(event.nativeEvent.data) + if (message.type === 'beat' || message.type === 'drop') { + onPulse?.(message.strength, message.type === 'drop') + } + } catch {} + }, + [onPulse] + ) + + const handleLoadEnd = useCallback(() => { + applyTrack() + applyAudio() + }, [applyTrack, applyAudio]) + + return ( + + ) +} + +const styles = StyleSheet.create({ + webView: { + flex: 1, + backgroundColor: 'transparent' + } +}) diff --git a/packages/mobile/src/components/now-playing-panel/visualizerLibs.ts b/packages/mobile/src/components/now-playing-panel/visualizerLibs.ts new file mode 100644 index 00000000000..50242d15214 --- /dev/null +++ b/packages/mobile/src/components/now-playing-panel/visualizerLibs.ts @@ -0,0 +1,3 @@ +export const butterchurnSource = "!function(t,e){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define(\"butterchurn\",[],e):\"object\"==typeof exports?exports.butterchurn=e():t.butterchurn=e()}(window,function(){return function(t){var e={};function i(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(t,\"__esModule\",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&\"object\"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,\"default\",{enumerable:!0,value:t}),2&e&&\"string\"!=typeof t)for(var r in t)i.d(s,r,function(e){return t[e]}.bind(null,r));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,\"a\",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p=\"\",i(i.s=5)}([function(t,e,i){var s;void 0===(s=function(){return{baseVals:{gammaadj:1.25,wave_g:.5,mv_x:12,warpscale:1,brighten:0,mv_y:9,wave_scale:1,echo_alpha:0,additivewave:0,sx:1,sy:1,warp:.01,red_blue:0,wave_mode:0,wave_brighten:0,wrap:0,zoomexp:1,fshader:0,wave_r:.5,echo_zoom:1,wave_smoothing:.75,warpanimspeed:1,wave_dots:0,wave_x:.5,wave_y:.5,zoom:1,solarize:0,modwavealphabyvolume:0,dx:0,cx:.5,dy:0,darken_center:0,cy:.5,invert:0,bmotionvectorson:0,rot:0,modwavealphaend:.95,wave_mystery:-.2,decay:.9,wave_a:1,wave_b:.5,rating:5,modwavealphastart:.75,darken:0,echo_orient:0,ib_r:.5,ib_g:.5,ib_b:.5,ib_a:0,ib_size:0,ob_r:.5,ob_g:.5,ob_b:.5,ob_a:0,ob_size:0,mv_dx:0,mv_dy:0,mv_a:0,mv_r:.5,mv_g:.5,mv_b:.5,mv_l:0},init_eqs:function(){return{}},frame_eqs:function(t){return t.rkeys=[\"warp\"],t.zoom=1.01+.02*t.treb_att,t.warp=.15+.25*t.bass_att,t},pixel_eqs:function(t){return t.warp=t.warp+.15*t.rad,t},waves:[{baseVals:{a:1,enabled:0,b:1,g:1,scaling:1,samples:512,additive:0,usedots:0,spectrum:0,r:1,smoothing:.5,thick:0,sep:0},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t},point_eqs:\"\"},{baseVals:{a:1,enabled:0,b:1,g:1,scaling:1,samples:512,additive:0,usedots:0,spectrum:0,r:1,smoothing:.5,thick:0,sep:0},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t},point_eqs:\"\"},{baseVals:{a:1,enabled:0,b:1,g:1,scaling:1,samples:512,additive:0,usedots:0,spectrum:0,r:1,smoothing:.5,thick:0,sep:0},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t},point_eqs:\"\"},{baseVals:{a:1,enabled:0,b:1,g:1,scaling:1,samples:512,additive:0,usedots:0,spectrum:0,r:1,smoothing:.5,thick:0,sep:0},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t},point_eqs:\"\"}],shapes:[{baseVals:{r2:0,a:1,enabled:0,b:0,tex_ang:0,thickoutline:0,g:0,textured:0,g2:1,tex_zoom:1,additive:0,border_a:.1,border_b:1,b2:0,a2:0,r:1,border_g:1,rad:.1,x:.5,y:.5,ang:0,sides:4,border_r:1},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t}},{baseVals:{r2:0,a:1,enabled:0,b:0,tex_ang:0,thickoutline:0,g:0,textured:0,g2:1,tex_zoom:1,additive:0,border_a:.1,border_b:1,b2:0,a2:0,r:1,border_g:1,rad:.1,x:.5,y:.5,ang:0,sides:4,border_r:1},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t}},{baseVals:{r2:0,a:1,enabled:0,b:0,tex_ang:0,thickoutline:0,g:0,textured:0,g2:1,tex_zoom:1,additive:0,border_a:.1,border_b:1,b2:0,a2:0,r:1,border_g:1,rad:.1,x:.5,y:.5,ang:0,sides:4,border_r:1},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t}},{baseVals:{r2:0,a:1,enabled:0,b:0,tex_ang:0,thickoutline:0,g:0,textured:0,g2:1,tex_zoom:1,additive:0,border_a:.1,border_b:1,b2:0,a2:0,r:1,border_g:1,rad:.1,x:.5,y:.5,ang:0,sides:4,border_r:1},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t}}],warp:\"shader_body {\\nret = texture2D(sampler_main, uv).rgb;\\nret -= 0.004;\\n}\\n\",comp:\"shader_body {\\nret = texture2D(sampler_main, uv).rgb;\\nret *= hue_shader;\\n}\\n\"}}.apply(e,[]))||(t.exports=s)},function(t,e,i){\"use strict\";{const t=(t,e)=>{var i=\"function\"==typeof e,s=\"function\"==typeof e,r=\"function\"==typeof e;Object.defineProperty(Math,t,{configurable:i,enumerable:r,writable:s,value:e})};t(\"DEG_PER_RAD\",Math.PI/180),t(\"RAD_PER_DEG\",180/Math.PI);const e=new Float32Array(1);t(\"scale\",function(t,e,i,s,r){return 0===arguments.length?NaN:Number.isNaN(t)||Number.isNaN(e)||Number.isNaN(i)||Number.isNaN(s)||Number.isNaN(r)?NaN:t===1/0||t===-1/0?t:(t-e)*(r-s)/(i-e)+s}),t(\"fscale\",function(t,i,s,r,a){return e[0]=Math.scale(t,i,s,r,a),e[0]}),t(\"clamp\",function(t,e,i){return Math.min(i,Math.max(e,t))}),t(\"radians\",function(t){return t*Math.DEG_PER_RAD}),t(\"degrees\",function(t){return t*Math.RAD_PER_DEG})}},function(t,e){window.sqr=function(t){return t*t},window.sqrt=function(t){return Math.sqrt(Math.abs(t))},window.log10=function(t){return Math.log(t)*Math.LOG10E},window.sign=function(t){return t>0?1:t<0?-1:0},window.rand=function(t){var e=Math.floor(t);return e<1?Math.random():Math.random()*e},window.randint=function(t){return Math.floor(rand(t))},window.bnot=function(t){return Math.abs(t)<1e-5?1:0},window.pow=function(t,e){var i,s=Math.pow(t,e);return i=s,!isFinite(i)||isNaN(i)?0:s},window.div=function(t,e){return 0===e?0:t/e},window.mod=function(t,e){return 0===e?0:Math.floor(t)%Math.floor(e)},window.bitor=function(t,e){return Math.floor(t)|Math.floor(e)},window.bitand=function(t,e){return Math.floor(t)&Math.floor(e)},window.sigmoid=function(t,e){var i=1+Math.exp(-t*e);return Math.abs(i)>1e-5?1/i:0},window.bor=function(t,e){return Math.abs(t)>1e-5||Math.abs(e)>1e-5?1:0},window.band=function(t,e){return Math.abs(t)>1e-5&&Math.abs(e)>1e-5?1:0},window.equal=function(t,e){return Math.abs(t-e)<1e-5?1:0},window.above=function(t,e){return t>e?1:0},window.below=function(t,e){return t1e-5?e:i},window.memcpy=function(t,e,i,s){var r=e,a=i,h=s;return a<0&&(h+=a,r-=a,a=0),r<0&&(h+=r,a-=r,r=0),h>0&&t.copyWithin(r,a,h),e}},,,function(t,e,i){\"use strict\";i.r(e);i(1),i(2);function s(t,e){for(var i=0;i2&&void 0!==arguments[2]&&arguments[2];!function(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this.samplesIn=e,this.samplesOut=i,this.equalize=s,this.NFREQ=2*i,this.equalize&&this.initEqualizeTable(),this.initBitRevTable(),this.initCosSinTable()}var e,i,r;return e=t,(i=[{key:\"initEqualizeTable\",value:function(){this.equalizeArr=new Float32Array(this.samplesOut);for(var t=1/this.samplesOut,e=0;ei){var s=this.bitrevtable[i];this.bitrevtable[i]=this.bitrevtable[e],this.bitrevtable[e]=s}for(var r=this.NFREQ>>1;r>=1&&e>=r;)e-=r,r>>=1;e+=r}}},{key:\"initCosSinTable\",value:function(){for(var t=2,e=0;t<=this.NFREQ;)e+=1,t<<=1;this.cossintable=[new Float32Array(e),new Float32Array(e)],t=2;for(var i=0;t<=this.NFREQ;){var s=-2*Math.PI/t;this.cossintable[0][i]=Math.cos(s),this.cossintable[1][i]=Math.sin(s),i+=1,t<<=1}}},{key:\"timeToFrequencyDomain\",value:function(t){for(var e=new Float32Array(this.NFREQ),i=new Float32Array(this.NFREQ),s=0;s>1,g=0;g0){var s=e;!t.isFiniteNumber(s)||s<15?s=15:s>144&&(s=144),this.imm.fill(0);for(var r=0;r<3;r++)for(var a=this.starts[r];athis.avg[h]?.2:.5,o=t.adjustRateToFPS(o,30,s),this.avg[h]=this.avg[h]*o+this.imm[h]*(1-o),o=i<50?.9:.992,o=t.adjustRateToFPS(o,30,s),this.longAvg[h]=this.longAvg[h]*o+this.imm[h]*(1-o),this.longAvg[h]<.001?(this.val[h]=1,this.att[h]=1):(this.val[h]=this.imm[h]/this.longAvg[h],this.att[h]=this.avg[h]/this.longAvg[h])}}}},{key:\"bass\",get:function(){return this.val[0]}},{key:\"bass_att\",get:function(){return this.att[0]}},{key:\"mid\",get:function(){return this.val[1]}},{key:\"mid_att\",get:function(){return this.att[1]}},{key:\"treb\",get:function(){return this.val[2]}},{key:\"treb_att\",get:function(){return this.att[2]}}])&&o(e.prototype,i),s&&o(e,s),t}(),l=i(0),m=i.n(l);function u(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e0)for(var a=0;a0)for(var m=0;m-1){var i=t.substring(0,e),s=t.substring(e),r=s.indexOf(\"{\"),a=s.lastIndexOf(\"}\");return[i,s.substring(r+1,a)]}return[\"\",t]}},{key:\"getFragmentFloatPrecision\",value:function(t){return t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0?\"highp\":t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?\"mediump\":\"lowp\"}},{key:\"getUserSamplers\",value:function(t){var e=[],i=t.match(v);if(i&&i.length>0)for(var s=0;s0){var a=r[1];e.push({sampler:a})}}return e}}],(i=null)&&d(e.prototype,i),s&&d(e,s),t}();function x(t,e){for(var i=0;i3&&void 0!==arguments[3]&&arguments[3],a=0,h=0,o=1,n=0;n5&&void 0!==arguments[5]&&arguments[5],o=0,n=0,l=1,m=0;m1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this.gl=e;this.positions=new Float32Array(1536),this.positions2=new Float32Array(1536),this.oldPositions=new Float32Array(1536),this.oldPositions2=new Float32Array(1536),this.smoothedPositions=new Float32Array(3069),this.smoothedPositions2=new Float32Array(3069),this.color=[0,0,0,1],this.texsizeX=i.texsizeX,this.texsizeY=i.texsizeY,this.aspectx=i.aspectx,this.aspecty=i.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.floatPrecision=_.getFragmentFloatPrecision(this.gl),this.createShader(),this.vertexBuf=this.gl.createBuffer()}var e,i,s;return e=t,s=[{key:\"processWaveform\",value:function(t,e){var i=[],s=e.wave_scale/128,r=e.wave_smoothing,a=s*(1-r);i.push(t[0]*s);for(var h=1;h-.01&&h>.001&&s.length>0){var n=t.processWaveform(s,a),l=t.processWaveform(r,a),m=Math.floor(a.wave_mode)%8,u=Math.floor(a.old_wave_mode)%8,g=2*a.wave_x-1,c=2*a.wave_y-1;this.numVert=0,this.oldNumVert=0;for(var A=e&&m!==u?2:1,f=0;f1)||(v=.5*v+.5,v-=Math.floor(v),v=2*(v=Math.abs(v))-1);var p=void 0,_=void 0,x=void 0;if(0===f?(_=this.positions,x=this.positions2):(_=this.oldPositions,x=this.oldPositions2),h=a.wave_a,0===d){if(a.modwavealphabyvolume>0){var T=a.modwavealphaend-a.modwavealphastart;h*=(o-a.modwavealphastart)/T}h=Math.clamp(h,0,1);for(var E=1/((p=Math.floor(n.length/2)+1)-1),P=Math.floor((n.length-p)/2),R=0;R0){var w=a.modwavealphaend-a.modwavealphastart;h*=(o-a.modwavealphastart)/w}h=Math.clamp(h,0,1),p=Math.floor(n.length/2);for(var U=0;U=1024&&this.texsizeX<2048?h*=.11:h*=.13,a.modwavealphabyvolume>0){var q=a.modwavealphaend-a.modwavealphastart;h*=(o-a.modwavealphastart)/q}h=Math.clamp(h,0,1),p=n.length;for(var z=0;z=1024&&this.texsizeX<2048?h*=.22:h*=.33,h*=1.3,h*=a.treb*a.treb,a.modwavealphabyvolume>0){var B=a.modwavealphaend-a.modwavealphastart;h*=(o-a.modwavealphastart)/B}h=Math.clamp(h,0,1),p=n.length;for(var C=0;C0){var D=a.modwavealphaend-a.modwavealphastart;h*=(o-a.modwavealphastart)/D}h=Math.clamp(h,0,1),(p=n.length)>this.texsizeX/3&&(p=Math.floor(this.texsizeX/3));for(var V=1/p,I=Math.floor((n.length-p)/2),X=.45+.5*(.5*v+.5),k=1-X,N=0;N1&&(O=O*k+X*(2*_[3*(N-1)+0]-_[3*(N-2)+0]),W=W*k+X*(2*_[3*(N-1)+1]-_[3*(N-2)+1])),_[3*N+0]=O,_[3*N+1]=W,_[3*N+2]=0}}else if(5===d){if(this.texsizeX<1024?h*=.09:this.texsizeX>=1024&&this.texsizeX<2048?h*=.11:h*=.13,a.modwavealphabyvolume>0){var Q=a.modwavealphaend-a.modwavealphastart;h*=(o-a.modwavealphastart)/Q}h=Math.clamp(h,0,1);var Y=Math.cos(.3*a.time),G=Math.sin(.3*a.time);p=n.length;for(var H=0;H0){var Z=a.modwavealphaend-a.modwavealphastart;h*=(o-a.modwavealphastart)/Z}h=Math.clamp(h,0,1),(p=Math.floor(n.length/2))>this.texsizeX/3&&(p=Math.floor(this.texsizeX/3));for(var $=Math.floor((n.length-p)/2),tt=.5*Math.PI*v,et=Math.cos(tt),it=Math.sin(tt),st=[g*Math.cos(tt+.5*Math.PI)-3*et,g*Math.cos(tt+.5*Math.PI)+3*et],rt=[g*Math.sin(tt+.5*Math.PI)-3*it,g*Math.sin(tt+.5*Math.PI)+3*it],at=0;at<2;at++)for(var ht=0;ht<4;ht++){var ot=void 0,nt=!1;switch(ht){case 0:st[at]>1.1&&(ot=(1.1-st[1-at])/(st[at]-st[1-at]),nt=!0);break;case 1:st[at]<-1.1&&(ot=(-1.1-st[1-at])/(st[at]-st[1-at]),nt=!0);break;case 2:rt[at]>1.1&&(ot=(1.1-rt[1-at])/(rt[at]-rt[1-at]),nt=!0);break;case 3:rt[at]<-1.1&&(ot=(-1.1-rt[1-at])/(rt[at]-rt[1-at]),nt=!0)}if(nt){var lt=st[at]-st[1-at],mt=rt[at]-rt[1-at];st[at]=st[1-at]+lt*ot,rt[at]=rt[1-at]+mt*ot}}et=(st[1]-st[0])/p,it=(rt[1]-rt[0])/p;var ut=Math.atan2(it,et),gt=Math.cos(ut+.5*Math.PI),ct=Math.sin(ut+.5*Math.PI);if(6===d)for(var At=0;At0&&(h=bt*this.alpha+Tt*this.oldAlpha);var Et=Math.clamp(a.wave_r,0,1),Pt=Math.clamp(a.wave_g,0,1),Rt=Math.clamp(a.wave_b,0,1);if(0!==a.wave_brighten){var Lt=Math.max(Et,Pt,Rt);Lt>.01&&(Et/=Lt,Pt/=Lt,Rt/=Lt)}if(this.color=[Et,Pt,Rt,h],this.oldNumVert>0)if(7===m){for(var St=(this.oldNumVert-1)/(2*this.numVert),yt=0;yt0){var n=Object.assign({},a.mdVSWaves[this.index],a.mdVSFrameMapWaves[this.index],a.mdVSQAfterFrame,a.mdVSTWaveInits[this.index],r),l=h.frame_eqs(n);Object.prototype.hasOwnProperty.call(l,\"samples\")?this.samples=l.samples:this.samples=512,this.samples>512&&(this.samples=512),this.samples=Math.floor(this.samples);var m=Math.floor(l.sep),u=l.scaling,g=l.spectrum,A=l.smoothing,f=l.usedots,d=l.r,v=l.g,p=l.b,_=l.a,x=a.mdVS.wave_scale;if(this.samples-=m,this.samples>=2||0!==f&&this.samples>=1){var T=0!==g,E=(T?.15:.004)*u*x,P=T?i:t,R=T?s:e,L=T?0:Math.floor((512-this.samples)/2-m/2),S=T?0:Math.floor((512-this.samples)/2+m/2),y=T?(512-m)/this.samples:1,w=Math.pow(.98*A,.5),U=1-w;this.pointsData[0][0]=P[L],this.pointsData[1][0]=R[S];for(var M=1;M=0;z--)this.pointsData[0][z]=this.pointsData[0][z]*U+this.pointsData[0][z+1]*w,this.pointsData[1][z]=this.pointsData[1][z]*U+this.pointsData[1][z+1]*w;for(var B=0;B=1024?1:0)):this.gl.uniform1f(this.sizeLoc,1+(this.texsizeX>=1024?1:0)):(this.gl.uniform1f(this.sizeLoc,1),g&&(A=4)),c?this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE):this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA);for(var f=u?this.gl.POINTS:this.gl.LINE_STRIP,d=0;d0,z=Math.abs(w)>=1,B=Math.abs(y)>=1,C=Math.abs(F)>=1;this.positions[0]=A,this.positions[1]=f,this.positions[2]=0,this.colors[0]=d,this.colors[1]=v,this.colors[2]=p,this.colors[3]=_*t,z&&(this.uvs[0]=.5,this.uvs[1]=.5);for(var D=.25*Math.PI,V=1;V<=m+1;V++){var I=2*((V-1)/m)*Math.PI,X=I+g+D;if(this.positions[3*V+0]=A+u*Math.cos(X)*this.aspecty,this.positions[3*V+1]=f+u*Math.sin(X),this.positions[3*V+2]=0,this.colors[4*V+0]=x,this.colors[4*V+1]=b,this.colors[4*V+2]=T,this.colors[4*V+3]=E*t,z){var k=I+M+D;this.uvs[2*V+0]=.5+.5*Math.cos(k)/U*this.aspecty,this.uvs[2*V+1]=.5+.5*Math.sin(k)/U}q&&(this.borderPositions[3*(V-1)+0]=this.positions[3*V+0],this.borderPositions[3*(V-1)+1]=this.positions[3*V+1],this.borderPositions[3*(V-1)+2]=this.positions[3*V+2])}this.mdVSShapeFrame=l,this.drawCustomShapeInstance(r,m,z,q,B,C)}var N=i.mdVSUserKeysShapes[this.index],O=c.pick(this.mdVSShapeFrame,N);i.mdVSFrameMapShapes[this.index]=O}}},{key:\"setupShapeBuffers\",value:function(t){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.DYNAMIC_DRAW),this.gl.vertexAttribPointer(this.aPosLocation,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aPosLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.colorVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.colors,this.gl.DYNAMIC_DRAW),this.gl.vertexAttribPointer(this.aColorLocation,4,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aColorLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.uvVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.uvs,this.gl.DYNAMIC_DRAW),this.gl.vertexAttribPointer(this.aUvLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aUvLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.borderPositionVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.borderPositions,this.gl.DYNAMIC_DRAW),this.gl.vertexAttribPointer(this.aBorderPosLoc,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aBorderPosLoc);var e=0!==t.wrap?this.gl.REPEAT:this.gl.CLAMP_TO_EDGE;this.gl.samplerParameteri(this.mainSampler,this.gl.TEXTURE_WRAP_S,e),this.gl.samplerParameteri(this.mainSampler,this.gl.TEXTURE_WRAP_T,e)}},{key:\"drawCustomShapeInstance\",value:function(t,e,i,s,r,a){this.gl.useProgram(this.shaderProgram);var h=new Float32Array(this.positions.buffer,0,3*(e+2));this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionVertexBuf),this.gl.bufferSubData(this.gl.ARRAY_BUFFER,0,h),this.gl.vertexAttribPointer(this.aPosLocation,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aPosLocation);var o=new Float32Array(this.colors.buffer,0,4*(e+2));if(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.colorVertexBuf),this.gl.bufferSubData(this.gl.ARRAY_BUFFER,0,o),this.gl.vertexAttribPointer(this.aColorLocation,4,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aColorLocation),i){var n=new Float32Array(this.uvs.buffer,0,2*(e+2));this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.uvVertexBuf),this.gl.bufferSubData(this.gl.ARRAY_BUFFER,0,n),this.gl.vertexAttribPointer(this.aUvLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aUvLocation)}if(this.gl.uniform1f(this.texturedLoc,i?1:0),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.bindSampler(0,this.mainSampler),this.gl.uniform1i(this.textureLoc,0),a?this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE):this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_FAN,0,e+2),s){this.gl.useProgram(this.borderShaderProgram);var l=new Float32Array(this.borderPositions.buffer,0,3*(e+1));this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.borderPositionVertexBuf),this.gl.bufferSubData(this.gl.ARRAY_BUFFER,0,l),this.gl.vertexAttribPointer(this.aBorderPosLoc,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aBorderPosLoc),this.gl.uniform4fv(this.uBorderColorLoc,this.borderColor);for(var m=r?4:1,u=0;u1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this.gl=e,this.positions=new Float32Array(72),this.aspectx=i.aspectx,this.aspecty=i.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.floatPrecision=_.getFragmentFloatPrecision(this.gl),this.createShader(),this.vertexBuf=this.gl.createBuffer()}var e,i,s;return e=t,(i=[{key:\"updateGlobals\",value:function(t){this.aspectx=t.aspectx,this.aspecty=t.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty}},{key:\"createShader\",value:function(){this.shaderProgram=this.gl.createProgram();var t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,\"#version 300 es\\n in vec3 aPos;\\n void main(void) {\\n gl_Position = vec4(aPos, 1.0);\\n }\"),this.gl.compileShader(t);var e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,\"#version 300 es\\n precision \".concat(this.floatPrecision,\" float;\\n precision highp int;\\n precision mediump sampler2D;\\n out vec4 fragColor;\\n uniform vec4 u_color;\\n void main(void) {\\n fragColor = u_color;\\n }\")),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.aPosLoc=this.gl.getAttribLocation(this.shaderProgram,\"aPos\"),this.colorLoc=this.gl.getUniformLocation(this.shaderProgram,\"u_color\")}},{key:\"addTriangle\",value:function(t,e,i,s){this.positions[t+0]=e[0],this.positions[t+1]=e[1],this.positions[t+2]=e[2],this.positions[t+3]=i[0],this.positions[t+4]=i[1],this.positions[t+5]=i[2],this.positions[t+6]=s[0],this.positions[t+7]=s[1],this.positions[t+8]=s[2]}},{key:\"generateBorder\",value:function(t,e,i){if(e>0&&t[3]>0){var s=i/2,r=e/2+s,a=2*s,h=2*s,o=2*r,n=2*r,l=[-1+a,-1+n,0],m=[-1+a,1-n,0],u=[-1+o,1-n,0],g=[-1+o,-1+n,0];return this.addTriangle(0,g,m,l),this.addTriangle(9,g,u,m),l=[1-a,-1+n,0],m=[1-a,1-n,0],u=[1-o,1-n,0],g=[1-o,-1+n,0],this.addTriangle(18,l,m,g),this.addTriangle(27,m,u,g),l=[-1+a,-1+h,0],m=[-1+a,n-1,0],u=[1-a,n-1,0],g=[1-a,-1+h,0],this.addTriangle(36,g,m,l),this.addTriangle(45,g,u,m),l=[-1+a,1-h,0],m=[-1+a,1-n,0],u=[1-a,1-n,0],g=[1-a,1-h,0],this.addTriangle(54,l,m,g),this.addTriangle(63,m,u,g),!0}return!1}},{key:\"drawBorder\",value:function(t,e,i){this.generateBorder(t,e,i)&&(this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.aPosLoc,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aPosLoc),this.gl.uniform4fv(this.colorLoc,t),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLES,0,this.positions.length/3))}}])&&y(e.prototype,i),s&&y(e,s),t}();function U(t,e){for(var i=0;i.001&&s>0&&r>0){var a=t.mv_x-s,h=t.mv_y-r;s>this.maxX&&(s=this.maxX,a=0),r>this.maxY&&(r=this.maxY,h=0);var o=t.mv_dx,n=t.mv_dy,l=t.mv_l,m=1/this.texsizeX;this.numVecVerts=0;for(var u=0;u1e-4&&g<.9999)for(var c=0;c1e-4&&A<.9999){var f=this.getMotionDir(e,A,g),d=f[0],v=f[1],p=d-A,_=v-g;p*=l,_*=l;var x=Math.sqrt(p*p+_*_);x1e-8?(p*=x=m/x,_*=x):(p=m,p=m);var b=2*A-1,T=2*g-1,E=2*(d=A+p)-1,P=2*(v=g+_)-1;this.positions[3*this.numVecVerts+0]=b,this.positions[3*this.numVecVerts+1]=T,this.positions[3*this.numVecVerts+2]=0,this.positions[3*(this.numVecVerts+1)+0]=E,this.positions[3*(this.numVecVerts+1)+1]=P,this.positions[3*(this.numVecVerts+1)+2]=0,this.numVecVerts+=2}}}if(this.numVecVerts>0)return this.color=[t.mv_r,t.mv_g,t.mv_b,i],!0}return!1}},{key:\"drawMotionVectors\",value:function(t,e){this.generateMotionVectors(t,e)&&(this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.aPosLoc,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aPosLoc),this.gl.uniform4fv(this.colorLoc,this.color),this.gl.lineWidth(1),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.LINES,0,this.numVecVerts))}}])&&F(e.prototype,i),s&&F(e,s),t}();function z(t,e){for(var i=0;i3&&void 0!==arguments[3]?arguments[3]:{};!function(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this.gl=e,this.noise=i,this.image=s,this.texsizeX=r.texsizeX,this.texsizeY=r.texsizeY,this.mesh_width=r.mesh_width,this.mesh_height=r.mesh_height,this.aspectx=r.aspectx,this.aspecty=r.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.buildPositions(),this.indexBuf=e.createBuffer(),this.positionVertexBuf=this.gl.createBuffer(),this.warpUvVertexBuf=this.gl.createBuffer(),this.warpColorVertexBuf=this.gl.createBuffer(),this.floatPrecision=_.getFragmentFloatPrecision(this.gl),this.createShader(),this.mainSampler=this.gl.createSampler(),this.mainSamplerFW=this.gl.createSampler(),this.mainSamplerFC=this.gl.createSampler(),this.mainSamplerPW=this.gl.createSampler(),this.mainSamplerPC=this.gl.createSampler(),e.samplerParameteri(this.mainSampler,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.samplerParameteri(this.mainSampler,e.TEXTURE_MAG_FILTER,e.LINEAR),e.samplerParameteri(this.mainSampler,e.TEXTURE_WRAP_S,e.REPEAT),e.samplerParameteri(this.mainSampler,e.TEXTURE_WRAP_T,e.REPEAT),e.samplerParameteri(this.mainSamplerFW,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.samplerParameteri(this.mainSamplerFW,e.TEXTURE_MAG_FILTER,e.LINEAR),e.samplerParameteri(this.mainSamplerFW,e.TEXTURE_WRAP_S,e.REPEAT),e.samplerParameteri(this.mainSamplerFW,e.TEXTURE_WRAP_T,e.REPEAT),e.samplerParameteri(this.mainSamplerFC,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.samplerParameteri(this.mainSamplerFC,e.TEXTURE_MAG_FILTER,e.LINEAR),e.samplerParameteri(this.mainSamplerFC,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.samplerParameteri(this.mainSamplerFC,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.samplerParameteri(this.mainSamplerPW,e.TEXTURE_MIN_FILTER,e.NEAREST_MIPMAP_NEAREST),e.samplerParameteri(this.mainSamplerPW,e.TEXTURE_MAG_FILTER,e.NEAREST),e.samplerParameteri(this.mainSamplerPW,e.TEXTURE_WRAP_S,e.REPEAT),e.samplerParameteri(this.mainSamplerPW,e.TEXTURE_WRAP_T,e.REPEAT),e.samplerParameteri(this.mainSamplerPC,e.TEXTURE_MIN_FILTER,e.NEAREST_MIPMAP_NEAREST),e.samplerParameteri(this.mainSamplerPC,e.TEXTURE_MAG_FILTER,e.NEAREST),e.samplerParameteri(this.mainSamplerPC,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.samplerParameteri(this.mainSamplerPC,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}var e,i,s;return e=t,(i=[{key:\"buildPositions\",value:function(){for(var t=this.mesh_width,e=this.mesh_height,i=t+1,s=e+1,r=2/t,a=2/e,h=[],o=0;o0&&void 0!==arguments[0]?arguments[0]:\"\";if(0===i.length)t=\"ret = texture(sampler_main, uv).rgb * decay;\",e=\"\";else{var s=_.getShaderParts(i);e=s[0],t=s[1]}t=(t=t.replace(/texture2D/g,\"texture\")).replace(/texture3D/g,\"texture\"),this.userTextures=_.getUserSamplers(e),this.shaderProgram=this.gl.createProgram();var r=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(r,\"#version 300 es\\n precision \".concat(this.floatPrecision,\" float;\\n const vec2 halfmad = vec2(0.5);\\n in vec2 aPos;\\n in vec2 aWarpUv;\\n in vec4 aWarpColor;\\n out vec2 uv;\\n out vec2 uv_orig;\\n out vec4 vColor;\\n void main(void) {\\n gl_Position = vec4(aPos, 0.0, 1.0);\\n uv_orig = aPos * halfmad + halfmad;\\n uv = aWarpUv;\\n vColor = aWarpColor;\\n }\")),this.gl.compileShader(r);var a=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(a,\"#version 300 es\\n precision \".concat(this.floatPrecision,\" float;\\n precision highp int;\\n precision mediump sampler2D;\\n precision mediump sampler3D;\\n\\n in vec2 uv;\\n in vec2 uv_orig;\\n in vec4 vColor;\\n out vec4 fragColor;\\n uniform sampler2D sampler_main;\\n uniform sampler2D sampler_fw_main;\\n uniform sampler2D sampler_fc_main;\\n uniform sampler2D sampler_pw_main;\\n uniform sampler2D sampler_pc_main;\\n uniform sampler2D sampler_blur1;\\n uniform sampler2D sampler_blur2;\\n uniform sampler2D sampler_blur3;\\n uniform sampler2D sampler_noise_lq;\\n uniform sampler2D sampler_noise_lq_lite;\\n uniform sampler2D sampler_noise_mq;\\n uniform sampler2D sampler_noise_hq;\\n uniform sampler2D sampler_pw_noise_lq;\\n uniform sampler3D sampler_noisevol_lq;\\n uniform sampler3D sampler_noisevol_hq;\\n uniform float time;\\n uniform float decay;\\n uniform vec2 resolution;\\n uniform vec4 aspect;\\n uniform vec4 texsize;\\n uniform vec4 texsize_noise_lq;\\n uniform vec4 texsize_noise_mq;\\n uniform vec4 texsize_noise_hq;\\n uniform vec4 texsize_noise_lq_lite;\\n uniform vec4 texsize_noisevol_lq;\\n uniform vec4 texsize_noisevol_hq;\\n\\n uniform float bass;\\n uniform float mid;\\n uniform float treb;\\n uniform float vol;\\n uniform float bass_att;\\n uniform float mid_att;\\n uniform float treb_att;\\n uniform float vol_att;\\n\\n uniform float frame;\\n uniform float fps;\\n\\n uniform vec4 _qa;\\n uniform vec4 _qb;\\n uniform vec4 _qc;\\n uniform vec4 _qd;\\n uniform vec4 _qe;\\n uniform vec4 _qf;\\n uniform vec4 _qg;\\n uniform vec4 _qh;\\n\\n #define q1 _qa.x\\n #define q2 _qa.y\\n #define q3 _qa.z\\n #define q4 _qa.w\\n #define q5 _qb.x\\n #define q6 _qb.y\\n #define q7 _qb.z\\n #define q8 _qb.w\\n #define q9 _qc.x\\n #define q10 _qc.y\\n #define q11 _qc.z\\n #define q12 _qc.w\\n #define q13 _qd.x\\n #define q14 _qd.y\\n #define q15 _qd.z\\n #define q16 _qd.w\\n #define q17 _qe.x\\n #define q18 _qe.y\\n #define q19 _qe.z\\n #define q20 _qe.w\\n #define q21 _qf.x\\n #define q22 _qf.y\\n #define q23 _qf.z\\n #define q24 _qf.w\\n #define q25 _qg.x\\n #define q26 _qg.y\\n #define q27 _qg.z\\n #define q28 _qg.w\\n #define q29 _qh.x\\n #define q30 _qh.y\\n #define q31 _qh.z\\n #define q32 _qh.w\\n\\n uniform vec4 slow_roam_cos;\\n uniform vec4 roam_cos;\\n uniform vec4 slow_roam_sin;\\n uniform vec4 roam_sin;\\n\\n uniform float blur1_min;\\n uniform float blur1_max;\\n uniform float blur2_min;\\n uniform float blur2_max;\\n uniform float blur3_min;\\n uniform float blur3_max;\\n\\n uniform float scale1;\\n uniform float scale2;\\n uniform float scale3;\\n uniform float bias1;\\n uniform float bias2;\\n uniform float bias3;\\n\\n uniform vec4 rand_frame;\\n uniform vec4 rand_preset;\\n\\n float PI = \").concat(Math.PI,\";\\n\\n \").concat(e,\"\\n\\n void main(void) {\\n vec3 ret;\\n float rad = length(uv_orig - 0.5);\\n float ang = atan(uv_orig.x - 0.5, uv_orig.y - 0.5);\\n\\n \").concat(t,\"\\n\\n fragColor = vec4(ret, 1.0) * vColor;\\n }\")),this.gl.compileShader(a),this.gl.attachShader(this.shaderProgram,r),this.gl.attachShader(this.shaderProgram,a),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,\"aPos\"),this.warpUvLocation=this.gl.getAttribLocation(this.shaderProgram,\"aWarpUv\"),this.warpColorLocation=this.gl.getAttribLocation(this.shaderProgram,\"aWarpColor\"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_main\"),this.textureFWLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_fw_main\"),this.textureFCLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_fc_main\"),this.texturePWLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_pw_main\"),this.texturePCLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_pc_main\"),this.blurTexture1Loc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_blur1\"),this.blurTexture2Loc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_blur2\"),this.blurTexture3Loc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_blur3\"),this.noiseLQLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_noise_lq\"),this.noiseMQLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_noise_mq\"),this.noiseHQLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_noise_hq\"),this.noiseLQLiteLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_noise_lq_lite\"),this.noisePointLQLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_pw_noise_lq\"),this.noiseVolLQLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_noisevol_lq\"),this.noiseVolHQLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_noisevol_hq\"),this.decayLoc=this.gl.getUniformLocation(this.shaderProgram,\"decay\"),this.texsizeLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize\"),this.texsizeNoiseLQLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize_noise_lq\"),this.texsizeNoiseMQLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize_noise_mq\"),this.texsizeNoiseHQLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize_noise_hq\"),this.texsizeNoiseLQLiteLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize_noise_lq_lite\"),this.texsizeNoiseVolLQLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize_noisevol_lq\"),this.texsizeNoiseVolHQLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize_noisevol_hq\"),this.resolutionLoc=this.gl.getUniformLocation(this.shaderProgram,\"resolution\"),this.aspectLoc=this.gl.getUniformLocation(this.shaderProgram,\"aspect\"),this.bassLoc=this.gl.getUniformLocation(this.shaderProgram,\"bass\"),this.midLoc=this.gl.getUniformLocation(this.shaderProgram,\"mid\"),this.trebLoc=this.gl.getUniformLocation(this.shaderProgram,\"treb\"),this.volLoc=this.gl.getUniformLocation(this.shaderProgram,\"vol\"),this.bassAttLoc=this.gl.getUniformLocation(this.shaderProgram,\"bass_att\"),this.midAttLoc=this.gl.getUniformLocation(this.shaderProgram,\"mid_att\"),this.trebAttLoc=this.gl.getUniformLocation(this.shaderProgram,\"treb_att\"),this.volAttLoc=this.gl.getUniformLocation(this.shaderProgram,\"vol_att\"),this.timeLoc=this.gl.getUniformLocation(this.shaderProgram,\"time\"),this.frameLoc=this.gl.getUniformLocation(this.shaderProgram,\"frame\"),this.fpsLoc=this.gl.getUniformLocation(this.shaderProgram,\"fps\"),this.blur1MinLoc=this.gl.getUniformLocation(this.shaderProgram,\"blur1_min\"),this.blur1MaxLoc=this.gl.getUniformLocation(this.shaderProgram,\"blur1_max\"),this.blur2MinLoc=this.gl.getUniformLocation(this.shaderProgram,\"blur2_min\"),this.blur2MaxLoc=this.gl.getUniformLocation(this.shaderProgram,\"blur2_max\"),this.blur3MinLoc=this.gl.getUniformLocation(this.shaderProgram,\"blur3_min\"),this.blur3MaxLoc=this.gl.getUniformLocation(this.shaderProgram,\"blur3_max\"),this.scale1Loc=this.gl.getUniformLocation(this.shaderProgram,\"scale1\"),this.scale2Loc=this.gl.getUniformLocation(this.shaderProgram,\"scale2\"),this.scale3Loc=this.gl.getUniformLocation(this.shaderProgram,\"scale3\"),this.bias1Loc=this.gl.getUniformLocation(this.shaderProgram,\"bias1\"),this.bias2Loc=this.gl.getUniformLocation(this.shaderProgram,\"bias2\"),this.bias3Loc=this.gl.getUniformLocation(this.shaderProgram,\"bias3\"),this.randPresetLoc=this.gl.getUniformLocation(this.shaderProgram,\"rand_preset\"),this.randFrameLoc=this.gl.getUniformLocation(this.shaderProgram,\"rand_frame\"),this.qaLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qa\"),this.qbLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qb\"),this.qcLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qc\"),this.qdLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qd\"),this.qeLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qe\"),this.qfLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qf\"),this.qgLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qg\"),this.qhLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qh\"),this.slowRoamCosLoc=this.gl.getUniformLocation(this.shaderProgram,\"slow_roam_cos\"),this.roamCosLoc=this.gl.getUniformLocation(this.shaderProgram,\"roam_cos\"),this.slowRoamSinLoc=this.gl.getUniformLocation(this.shaderProgram,\"slow_roam_sin\"),this.roamSinLoc=this.gl.getUniformLocation(this.shaderProgram,\"roam_sin\");for(var h=0;h3&&void 0!==arguments[3]?arguments[3]:{};!function(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this.gl=e,this.noise=i,this.image=s,this.mesh_width=r.mesh_width,this.mesh_height=r.mesh_height,this.texsizeX=r.texsizeX,this.texsizeY=r.texsizeY,this.aspectx=r.aspectx,this.aspecty=r.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.compWidth=32,this.compHeight=24,this.buildPositions(),this.indexBuf=e.createBuffer(),this.positionVertexBuf=this.gl.createBuffer(),this.compColorVertexBuf=this.gl.createBuffer(),this.floatPrecision=_.getFragmentFloatPrecision(this.gl),this.createShader(),this.mainSampler=this.gl.createSampler(),this.mainSamplerFW=this.gl.createSampler(),this.mainSamplerFC=this.gl.createSampler(),this.mainSamplerPW=this.gl.createSampler(),this.mainSamplerPC=this.gl.createSampler(),e.samplerParameteri(this.mainSampler,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.samplerParameteri(this.mainSampler,e.TEXTURE_MAG_FILTER,e.LINEAR),e.samplerParameteri(this.mainSampler,e.TEXTURE_WRAP_S,e.REPEAT),e.samplerParameteri(this.mainSampler,e.TEXTURE_WRAP_T,e.REPEAT),e.samplerParameteri(this.mainSamplerFW,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.samplerParameteri(this.mainSamplerFW,e.TEXTURE_MAG_FILTER,e.LINEAR),e.samplerParameteri(this.mainSamplerFW,e.TEXTURE_WRAP_S,e.REPEAT),e.samplerParameteri(this.mainSamplerFW,e.TEXTURE_WRAP_T,e.REPEAT),e.samplerParameteri(this.mainSamplerFC,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.samplerParameteri(this.mainSamplerFC,e.TEXTURE_MAG_FILTER,e.LINEAR),e.samplerParameteri(this.mainSamplerFC,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.samplerParameteri(this.mainSamplerFC,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.samplerParameteri(this.mainSamplerPW,e.TEXTURE_MIN_FILTER,e.NEAREST_MIPMAP_NEAREST),e.samplerParameteri(this.mainSamplerPW,e.TEXTURE_MAG_FILTER,e.NEAREST),e.samplerParameteri(this.mainSamplerPW,e.TEXTURE_WRAP_S,e.REPEAT),e.samplerParameteri(this.mainSamplerPW,e.TEXTURE_WRAP_T,e.REPEAT),e.samplerParameteri(this.mainSamplerPC,e.TEXTURE_MIN_FILTER,e.NEAREST_MIPMAP_NEAREST),e.samplerParameteri(this.mainSamplerPC,e.TEXTURE_MAG_FILTER,e.NEAREST),e.samplerParameteri(this.mainSamplerPC,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.samplerParameteri(this.mainSamplerPC,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}var e,i,s;return e=t,s=[{key:\"generateHueBase\",value:function(t){for(var e=new Float32Array([1,1,1,1,1,1,1,1,1,1,1,1]),i=0;i<4;i++){e[3*i+0]=.6+.3*Math.sin(30*t.time*.0143+3+21*i+t.rand_start[3]),e[3*i+1]=.6+.3*Math.sin(30*t.time*.0107+1+13*i+t.rand_start[1]),e[3*i+2]=.6+.3*Math.sin(30*t.time*.0129+6+9*i+t.rand_start[2]);for(var s=Math.max(e[3*i],e[3*i+1],e[3*i+2]),r=0;r<3;r++)e[3*i+r]=e[3*i+r]/s,e[3*i+r]=.5+.5*e[3*i+r]}return e}}],(i=[{key:\"buildPositions\",value:function(){for(var t=this.compWidth,e=this.compHeight,i=t+1,s=e+1,r=2/t,a=2/e,h=[],o=0;o0&&void 0!==arguments[0]?arguments[0]:\"\";if(0===i.length)t=\"float orient_horiz = mod(echo_orientation, 2.0);\\n float orient_x = (orient_horiz != 0.0) ? -1.0 : 1.0;\\n float orient_y = (echo_orientation >= 2.0) ? -1.0 : 1.0;\\n vec2 uv_echo = ((uv - 0.5) *\\n (1.0 / echo_zoom) *\\n vec2(orient_x, orient_y)) + 0.5;\\n\\n ret = mix(texture(sampler_main, uv).rgb,\\n texture(sampler_main, uv_echo).rgb,\\n echo_alpha);\\n\\n ret *= gammaAdj;\\n\\n if(fShader >= 1.0) {\\n ret *= hue_shader;\\n } else if(fShader > 0.001) {\\n ret *= (1.0 - fShader) + (fShader * hue_shader);\\n }\\n\\n if(brighten != 0) ret = sqrt(ret);\\n if(darken != 0) ret = ret*ret;\\n if(solarize != 0) ret = ret * (1.0 - ret) * 4.0;\\n if(invert != 0) ret = 1.0 - ret;\",e=\"\";else{var s=_.getShaderParts(i);e=s[0],t=s[1]}t=(t=t.replace(/texture2D/g,\"texture\")).replace(/texture3D/g,\"texture\"),this.userTextures=_.getUserSamplers(e),this.shaderProgram=this.gl.createProgram();var r=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(r,\"#version 300 es\\n const vec2 halfmad = vec2(0.5);\\n in vec2 aPos;\\n in vec4 aCompColor;\\n out vec2 vUv;\\n out vec4 vColor;\\n void main(void) {\\n gl_Position = vec4(aPos, 0.0, 1.0);\\n vUv = aPos * halfmad + halfmad;\\n vColor = aCompColor;\\n }\"),this.gl.compileShader(r);var a=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(a,\"#version 300 es\\n precision \".concat(this.floatPrecision,\" float;\\n precision highp int;\\n precision mediump sampler2D;\\n precision mediump sampler3D;\\n\\n vec3 lum(vec3 v){\\n return vec3(dot(v, vec3(0.32,0.49,0.29)));\\n }\\n\\n in vec2 vUv;\\n in vec4 vColor;\\n out vec4 fragColor;\\n uniform sampler2D sampler_main;\\n uniform sampler2D sampler_fw_main;\\n uniform sampler2D sampler_fc_main;\\n uniform sampler2D sampler_pw_main;\\n uniform sampler2D sampler_pc_main;\\n uniform sampler2D sampler_blur1;\\n uniform sampler2D sampler_blur2;\\n uniform sampler2D sampler_blur3;\\n uniform sampler2D sampler_noise_lq;\\n uniform sampler2D sampler_noise_lq_lite;\\n uniform sampler2D sampler_noise_mq;\\n uniform sampler2D sampler_noise_hq;\\n uniform sampler2D sampler_pw_noise_lq;\\n uniform sampler3D sampler_noisevol_lq;\\n uniform sampler3D sampler_noisevol_hq;\\n\\n uniform float time;\\n uniform float gammaAdj;\\n uniform float echo_zoom;\\n uniform float echo_alpha;\\n uniform float echo_orientation;\\n uniform int invert;\\n uniform int brighten;\\n uniform int darken;\\n uniform int solarize;\\n uniform vec2 resolution;\\n uniform vec4 aspect;\\n uniform vec4 texsize;\\n uniform vec4 texsize_noise_lq;\\n uniform vec4 texsize_noise_mq;\\n uniform vec4 texsize_noise_hq;\\n uniform vec4 texsize_noise_lq_lite;\\n uniform vec4 texsize_noisevol_lq;\\n uniform vec4 texsize_noisevol_hq;\\n\\n uniform float bass;\\n uniform float mid;\\n uniform float treb;\\n uniform float vol;\\n uniform float bass_att;\\n uniform float mid_att;\\n uniform float treb_att;\\n uniform float vol_att;\\n\\n uniform float frame;\\n uniform float fps;\\n\\n uniform vec4 _qa;\\n uniform vec4 _qb;\\n uniform vec4 _qc;\\n uniform vec4 _qd;\\n uniform vec4 _qe;\\n uniform vec4 _qf;\\n uniform vec4 _qg;\\n uniform vec4 _qh;\\n\\n #define q1 _qa.x\\n #define q2 _qa.y\\n #define q3 _qa.z\\n #define q4 _qa.w\\n #define q5 _qb.x\\n #define q6 _qb.y\\n #define q7 _qb.z\\n #define q8 _qb.w\\n #define q9 _qc.x\\n #define q10 _qc.y\\n #define q11 _qc.z\\n #define q12 _qc.w\\n #define q13 _qd.x\\n #define q14 _qd.y\\n #define q15 _qd.z\\n #define q16 _qd.w\\n #define q17 _qe.x\\n #define q18 _qe.y\\n #define q19 _qe.z\\n #define q20 _qe.w\\n #define q21 _qf.x\\n #define q22 _qf.y\\n #define q23 _qf.z\\n #define q24 _qf.w\\n #define q25 _qg.x\\n #define q26 _qg.y\\n #define q27 _qg.z\\n #define q28 _qg.w\\n #define q29 _qh.x\\n #define q30 _qh.y\\n #define q31 _qh.z\\n #define q32 _qh.w\\n\\n uniform vec4 slow_roam_cos;\\n uniform vec4 roam_cos;\\n uniform vec4 slow_roam_sin;\\n uniform vec4 roam_sin;\\n\\n uniform float blur1_min;\\n uniform float blur1_max;\\n uniform float blur2_min;\\n uniform float blur2_max;\\n uniform float blur3_min;\\n uniform float blur3_max;\\n\\n uniform float scale1;\\n uniform float scale2;\\n uniform float scale3;\\n uniform float bias1;\\n uniform float bias2;\\n uniform float bias3;\\n\\n uniform vec4 rand_frame;\\n uniform vec4 rand_preset;\\n\\n uniform float fShader;\\n\\n float PI = \").concat(Math.PI,\";\\n\\n \").concat(e,\"\\n\\n void main(void) {\\n vec3 ret;\\n vec2 uv = vUv;\\n vec2 uv_orig = vUv;\\n uv.y = 1.0 - uv.y;\\n uv_orig.y = 1.0 - uv_orig.y;\\n float rad = length(uv - 0.5);\\n float ang = atan(uv.x - 0.5, uv.y - 0.5);\\n vec3 hue_shader = vColor.rgb;\\n\\n \").concat(t,\"\\n\\n fragColor = vec4(ret, vColor.a);\\n }\")),this.gl.compileShader(a),this.gl.attachShader(this.shaderProgram,r),this.gl.attachShader(this.shaderProgram,a),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,\"aPos\"),this.compColorLocation=this.gl.getAttribLocation(this.shaderProgram,\"aCompColor\"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_main\"),this.textureFWLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_fw_main\"),this.textureFCLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_fc_main\"),this.texturePWLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_pw_main\"),this.texturePCLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_pc_main\"),this.blurTexture1Loc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_blur1\"),this.blurTexture2Loc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_blur2\"),this.blurTexture3Loc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_blur3\"),this.noiseLQLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_noise_lq\"),this.noiseMQLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_noise_mq\"),this.noiseHQLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_noise_hq\"),this.noiseLQLiteLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_noise_lq_lite\"),this.noisePointLQLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_pw_noise_lq\"),this.noiseVolLQLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_noisevol_lq\"),this.noiseVolHQLoc=this.gl.getUniformLocation(this.shaderProgram,\"sampler_noisevol_hq\"),this.timeLoc=this.gl.getUniformLocation(this.shaderProgram,\"time\"),this.gammaAdjLoc=this.gl.getUniformLocation(this.shaderProgram,\"gammaAdj\"),this.echoZoomLoc=this.gl.getUniformLocation(this.shaderProgram,\"echo_zoom\"),this.echoAlphaLoc=this.gl.getUniformLocation(this.shaderProgram,\"echo_alpha\"),this.echoOrientationLoc=this.gl.getUniformLocation(this.shaderProgram,\"echo_orientation\"),this.invertLoc=this.gl.getUniformLocation(this.shaderProgram,\"invert\"),this.brightenLoc=this.gl.getUniformLocation(this.shaderProgram,\"brighten\"),this.darkenLoc=this.gl.getUniformLocation(this.shaderProgram,\"darken\"),this.solarizeLoc=this.gl.getUniformLocation(this.shaderProgram,\"solarize\"),this.texsizeLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize\"),this.texsizeNoiseLQLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize_noise_lq\"),this.texsizeNoiseMQLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize_noise_mq\"),this.texsizeNoiseHQLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize_noise_hq\"),this.texsizeNoiseLQLiteLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize_noise_lq_lite\"),this.texsizeNoiseVolLQLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize_noisevol_lq\"),this.texsizeNoiseVolHQLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize_noisevol_hq\"),this.resolutionLoc=this.gl.getUniformLocation(this.shaderProgram,\"resolution\"),this.aspectLoc=this.gl.getUniformLocation(this.shaderProgram,\"aspect\"),this.bassLoc=this.gl.getUniformLocation(this.shaderProgram,\"bass\"),this.midLoc=this.gl.getUniformLocation(this.shaderProgram,\"mid\"),this.trebLoc=this.gl.getUniformLocation(this.shaderProgram,\"treb\"),this.volLoc=this.gl.getUniformLocation(this.shaderProgram,\"vol\"),this.bassAttLoc=this.gl.getUniformLocation(this.shaderProgram,\"bass_att\"),this.midAttLoc=this.gl.getUniformLocation(this.shaderProgram,\"mid_att\"),this.trebAttLoc=this.gl.getUniformLocation(this.shaderProgram,\"treb_att\"),this.volAttLoc=this.gl.getUniformLocation(this.shaderProgram,\"vol_att\"),this.frameLoc=this.gl.getUniformLocation(this.shaderProgram,\"frame\"),this.fpsLoc=this.gl.getUniformLocation(this.shaderProgram,\"fps\"),this.blur1MinLoc=this.gl.getUniformLocation(this.shaderProgram,\"blur1_min\"),this.blur1MaxLoc=this.gl.getUniformLocation(this.shaderProgram,\"blur1_max\"),this.blur2MinLoc=this.gl.getUniformLocation(this.shaderProgram,\"blur2_min\"),this.blur2MaxLoc=this.gl.getUniformLocation(this.shaderProgram,\"blur2_max\"),this.blur3MinLoc=this.gl.getUniformLocation(this.shaderProgram,\"blur3_min\"),this.blur3MaxLoc=this.gl.getUniformLocation(this.shaderProgram,\"blur3_max\"),this.scale1Loc=this.gl.getUniformLocation(this.shaderProgram,\"scale1\"),this.scale2Loc=this.gl.getUniformLocation(this.shaderProgram,\"scale2\"),this.scale3Loc=this.gl.getUniformLocation(this.shaderProgram,\"scale3\"),this.bias1Loc=this.gl.getUniformLocation(this.shaderProgram,\"bias1\"),this.bias2Loc=this.gl.getUniformLocation(this.shaderProgram,\"bias2\"),this.bias3Loc=this.gl.getUniformLocation(this.shaderProgram,\"bias3\"),this.randPresetLoc=this.gl.getUniformLocation(this.shaderProgram,\"rand_preset\"),this.randFrameLoc=this.gl.getUniformLocation(this.shaderProgram,\"rand_frame\"),this.fShaderLoc=this.gl.getUniformLocation(this.shaderProgram,\"fShader\"),this.qaLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qa\"),this.qbLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qb\"),this.qcLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qc\"),this.qdLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qd\"),this.qeLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qe\"),this.qfLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qf\"),this.qgLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qg\"),this.qhLoc=this.gl.getUniformLocation(this.shaderProgram,\"_qh\"),this.slowRoamCosLoc=this.gl.getUniformLocation(this.shaderProgram,\"slow_roam_cos\"),this.roamCosLoc=this.gl.getUniformLocation(this.shaderProgram,\"roam_cos\"),this.slowRoamSinLoc=this.gl.getUniformLocation(this.shaderProgram,\"slow_roam_sin\"),this.roamSinLoc=this.gl.getUniformLocation(this.shaderProgram,\"roam_sin\");for(var h=0;h lumaMax))\\n color = vec4(rgbA, 1.0);\\n else\\n color = vec4(rgbB, 1.0);\\n\\n fragColor = color;\\n }\")),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,\"aPos\"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,\"uTexture\"),this.texsizeLoc=this.gl.getUniformLocation(this.shaderProgram,\"texsize\")}},{key:\"createShader\",value:function(){this.shaderProgram=this.gl.createProgram();var t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,\"#version 300 es\\n const vec2 halfmad = vec2(0.5);\\n in vec2 aPos;\\n out vec2 uv;\\n void main(void) {\\n gl_Position = vec4(aPos, 0.0, 1.0);\\n uv = aPos * halfmad + halfmad;\\n }\"),this.gl.compileShader(t);var e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,\"#version 300 es\\n precision \".concat(this.floatPrecision,\" float;\\n precision highp int;\\n precision mediump sampler2D;\\n\\n in vec2 uv;\\n out vec4 fragColor;\\n uniform sampler2D uTexture;\\n\\n void main(void) {\\n fragColor = vec4(texture(uTexture, uv).rgb, 1.0);\\n }\")),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,\"aPos\"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,\"uTexture\")}},{key:\"renderQuadTexture\",value:function(t){this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.positionLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.positionLocation),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.uniform1i(this.textureLoc,0),this.useFXAA()&&this.gl.uniform4fv(this.texsizeLoc,new Float32Array([this.texsizeX,this.texsizeY,1/this.texsizeX,1/this.texsizeY])),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4)}}])&&V(e.prototype,i),s&&V(e,s),t}();function X(t,e){for(var i=0;i3&&void 0!==arguments[3]?arguments[3]:{};!function(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this.blurLevel=e,this.blurRatios=i,this.gl=s,this.texsizeX=r.texsizeX,this.texsizeY=r.texsizeY,this.anisoExt=this.gl.getExtension(\"EXT_texture_filter_anisotropic\")||this.gl.getExtension(\"MOZ_EXT_texture_filter_anisotropic\")||this.gl.getExtension(\"WEBKIT_EXT_texture_filter_anisotropic\"),this.blurHorizontalFrameBuffer=this.gl.createFramebuffer(),this.blurVerticalFrameBuffer=this.gl.createFramebuffer(),this.blurHorizontalTexture=this.gl.createTexture(),this.blurVerticalTexture=this.gl.createTexture(),this.setupFrameBufferTextures(),this.blurHorizontal=new Q(s,this.blurLevel,r),this.blurVertical=new O(s,this.blurLevel,r)}var e,i,s;return e=t,(i=[{key:\"updateGlobals\",value:function(t){this.texsizeX=t.texsizeX,this.texsizeY=t.texsizeY,this.setupFrameBufferTextures()}},{key:\"getTextureSize\",value:function(t){var e=Math.max(this.texsizeX*t,16);e=16*Math.floor((e+3)/16);var i=Math.max(this.texsizeY*t,16);return[e,i=4*Math.floor((i+3)/4)]}},{key:\"setupFrameBufferTextures\",value:function(){var t=this.blurLevel>0?this.blurRatios[this.blurLevel-1]:[1,1],e=this.blurRatios[this.blurLevel],i=this.getTextureSize(t[1]),s=this.getTextureSize(e[0]);this.bindFrameBufferTexture(this.blurHorizontalFrameBuffer,this.blurHorizontalTexture,s);var r=s,a=this.getTextureSize(e[1]);this.bindFrameBufferTexture(this.blurVerticalFrameBuffer,this.blurVerticalTexture,a),this.horizontalTexsizes=[i,s],this.verticalTexsizes=[r,a]}},{key:\"bindFrambufferAndSetViewport\",value:function(t,e){this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,t),this.gl.viewport(0,0,e[0],e[1])}},{key:\"bindFrameBufferTexture\",value:function(t,e,i){if(this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,i[0],i[1],0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,new Uint8Array(i[0]*i[1]*4)),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR_MIPMAP_LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.anisoExt){var s=this.gl.getParameter(this.anisoExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT);this.gl.texParameterf(this.gl.TEXTURE_2D,this.anisoExt.TEXTURE_MAX_ANISOTROPY_EXT,s)}this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,t),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,e,0)}},{key:\"renderBlurTexture\",value:function(t,e,i,s){this.bindFrambufferAndSetViewport(this.blurHorizontalFrameBuffer,this.horizontalTexsizes[1]),this.blurHorizontal.renderQuadTexture(t,e,i,s,this.horizontalTexsizes[0]),this.gl.bindTexture(this.gl.TEXTURE_2D,this.blurHorizontalTexture),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.bindFrambufferAndSetViewport(this.blurVerticalFrameBuffer,this.verticalTexsizes[1]),this.blurVertical.renderQuadTexture(this.blurHorizontalTexture,e,this.verticalTexsizes[0]),this.gl.bindTexture(this.gl.TEXTURE_2D,this.blurVerticalTexture),this.gl.generateMipmap(this.gl.TEXTURE_2D)}}])&&Y(e.prototype,i),s&&Y(e,s),t}();function H(t,e){for(var i=0;i1?216:256,h=.5*a,o=0;o1){for(var m=0;m1?216:256,h=.5*a,o=0;o1){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this.gl=e,this.texsizeX=i.texsizeX,this.texsizeY=i.texsizeY,this.aspectx=i.aspectx,this.aspecty=i.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.buildPositions(),this.textTexture=this.gl.createTexture(),this.indexBuf=e.createBuffer(),this.positionVertexBuf=this.gl.createBuffer(),this.vertexBuf=this.gl.createBuffer(),this.canvas=document.createElement(\"canvas\"),this.canvas.width=this.texsizeX,this.canvas.height=this.texsizeY,this.context2D=this.canvas.getContext(\"2d\"),this.floatPrecision=_.getFragmentFloatPrecision(this.gl),this.createShader()}var e,i,s;return e=t,(i=[{key:\"generateTitleTexture\",value:function(t){this.context2D.clearRect(0,0,this.texsizeX,this.texsizeY),this.fontSize=Math.floor(this.texsizeX/256*16),this.fontSize=Math.max(this.fontSize,6),this.context2D.font=\"italic \".concat(this.fontSize,\"px Times New Roman\");var e=t,i=this.context2D.measureText(e).width;if(i>this.texsizeX){var s=this.texsizeX/i*.91;e=\"\".concat(e.substring(0,Math.floor(e.length*s)),\"...\"),i=this.context2D.measureText(e).width}this.context2D.fillStyle=\"#FFFFFF\",this.context2D.fillText(e,(this.texsizeX-i)/2,this.texsizeY/2);var r=new Uint8Array(this.context2D.getImageData(0,0,this.texsizeX,this.texsizeY).data.buffer);this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.textTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.texsizeX,this.texsizeY,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,r),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR_MIPMAP_LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.bindTexture(this.gl.TEXTURE_2D,null)}},{key:\"updateGlobals\",value:function(t){this.texsizeX=t.texsizeX,this.texsizeY=t.texsizeY,this.aspectx=t.aspectx,this.aspecty=t.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.canvas.width=this.texsizeX,this.canvas.height=this.texsizeY}},{key:\"buildPositions\",value:function(){for(var t=[],e=0;e<8;e++)for(var i=e*(2/7)-1,s=0;s<16;s++){var r=s*(2/15)-1;t.push(r,-i,0)}for(var a=[],h=0;h<7;h++)for(var o=0;o<15;o++){var n=o+16*h,l=o+16*(h+1),m=o+1+16*(h+1),u=o+1+16*h;a.push(n,l,u),a.push(l,m,u)}this.vertices=new Float32Array(t),this.indices=new Uint16Array(a)}},{key:\"createShader\",value:function(){this.shaderProgram=this.gl.createProgram();var t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,\"#version 300 es\\n const vec2 halfmad = vec2(0.5);\\n in vec2 aPos;\\n in vec2 aUv;\\n out vec2 uv_orig;\\n out vec2 uv;\\n void main(void) {\\n gl_Position = vec4(aPos, 0.0, 1.0);\\n uv_orig = aPos * halfmad + halfmad;\\n uv = aUv;\\n }\"),this.gl.compileShader(t);var e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,\"#version 300 es\\n precision \".concat(this.floatPrecision,\" float;\\n precision highp int;\\n precision mediump sampler2D;\\n\\n in vec2 uv_orig;\\n in vec2 uv;\\n out vec4 fragColor;\\n uniform sampler2D uTexture;\\n uniform float textColor;\\n\\n void main(void) {\\n fragColor = texture(uTexture, uv) * vec4(textColor);\\n }\")),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,\"aPos\"),this.uvLocation=this.gl.getAttribLocation(this.shaderProgram,\"aUv\"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,\"uTexture\"),this.textColorLoc=this.gl.getUniformLocation(this.shaderProgram,\"textColor\")}},{key:\"generateUvs\",value:function(t,e,i){for(var s=[],r=0;r<8;r++)for(var a=0;a<16;a++){var h=2*(a/15)-1,o=2*(.75*(r/7-.5)+.5)-1;t>=1&&(o+=1/this.texsizeY),s.push(h,e?o:-o)}for(var n=Math.max(0,1-1.5*t),l=1.3*Math.pow(n,1.8),m=0;m<8;m++)for(var u=0;u<16;u++){var g=16*m+u;s[g]+=.07*l*Math.sin(.31*i.time+.39*s[g]-1.94*s[g+1]),s[g]+=.044*l*Math.sin(.81*i.time-1.91*s[g]+.27*s[g+1]),s[g]+=.061*l*Math.sin(1.31*i.time+.61*s[g]+.74*s[g+1]),s[g+1]+=.061*l*Math.sin(.37*i.time+1.83*s[g]+.69*s[g+1]),s[g+1]+=.07*l*Math.sin(.67*i.time+.42*s[g]-1.39*s[g+1]),s[g+1]+=.087*l*Math.sin(1.07*i.time+3.55*s[g]+.89*s[g+1])}for(var c=1.01/(Math.pow(t,.21)+.01),A=0;A=2&&(0===t&&(this.vertInfoC[h*(this.mesh_width+1)+t]=.5*(o+l)+(2*Math.random()-1)*r*this.aspecty),this.vertInfoC[h*(this.mesh_width+1)+e]=.5*(n+m)+(2*Math.random()-1)*r*this.aspecty),e-t>=2&&(0===i&&(this.vertInfoC[i*(this.mesh_width+1)+a]=.5*(o+n)+(2*Math.random()-1)*r*this.aspectx),this.vertInfoC[s*(this.mesh_width+1)+a]=.5*(l+m)+(2*Math.random()-1)*r*this.aspectx),s-i>=2&&e-t>=2&&(o=this.vertInfoC[h*(this.mesh_width+1)+t],n=this.vertInfoC[h*(this.mesh_width+1)+e],l=this.vertInfoC[i*(this.mesh_width+1)+a],m=this.vertInfoC[s*(this.mesh_width+1)+a],this.vertInfoC[h*(this.mesh_width+1)+a]=.25*(l+m+o+n)+(2*Math.random()-1)*r,this.genPlasma(t,a,i,h,.5*r),this.genPlasma(a,e,i,h,.5*r),this.genPlasma(t,a,h,s,.5*r),this.genPlasma(a,e,h,s,.5*r))}},{key:\"createBlendPattern\",value:function(){var t=1+Math.floor(3*Math.random());if(0===t)for(var e=0,i=0;i<=this.mesh_height;i++)for(var s=0;s<=this.mesh_width;s++)this.vertInfoA[e]=1,this.vertInfoC[e]=0,e+=1;else if(1===t)for(var r=6.28*Math.random(),a=Math.cos(r),h=Math.sin(r),o=.1+.2*Math.random(),n=1/o,l=0,m=0;m<=this.mesh_height;m++)for(var u=m/this.mesh_height*this.aspecty,g=0;g<=this.mesh_width;g++){var c=(g/this.mesh_width*this.aspectx-.5)*a+(u-.5)*h+.5;c=(c-.5)/Math.sqrt(2)+.5,this.vertInfoA[l]=n*(1+o),this.vertInfoC[l]=n*c-n,l+=1}else if(2===t){var A=.12+.13*Math.random(),f=1/A;this.vertInfoC[0]=Math.random(),this.vertInfoC[this.mesh_width]=Math.random(),this.vertInfoC[this.mesh_height*(this.mesh_width+1)]=Math.random(),this.vertInfoC[this.mesh_height*(this.mesh_width+1)+this.mesh_width]=Math.random(),this.genPlasma(0,this.mesh_width,0,this.mesh_height,.25);for(var d=this.vertInfoC[0],v=this.vertInfoC[0],p=0,_=0;_<=this.mesh_height;_++)for(var x=0;x<=this.mesh_width;x++)d>this.vertInfoC[p]&&(d=this.vertInfoC[p]),vthis.texsizeX?this.texsizeX/this.texsizeY:1,this.aspecty=this.texsizeX>this.texsizeY?this.texsizeY/this.texsizeX:1,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.qs=c.range(1,33).map(function(t){return\"q\".concat(t)}),this.ts=c.range(1,9).map(function(t){return\"t\".concat(t)}),this.regs=c.range(0,100).map(function(t){return t<10?\"reg0\".concat(t):\"reg\".concat(t)}),this.blurRatios=[[.5,.25],[.125,.125],[.0625,.0625]],this.audioLevels=new n(this.audio),this.prevFrameBuffer=this.gl.createFramebuffer(),this.targetFrameBuffer=this.gl.createFramebuffer(),this.prevTexture=this.gl.createTexture(),this.targetTexture=this.gl.createTexture(),this.compFrameBuffer=this.gl.createFramebuffer(),this.compTexture=this.gl.createTexture(),this.anisoExt=this.gl.getExtension(\"EXT_texture_filter_anisotropic\")||this.gl.getExtension(\"MOZ_EXT_texture_filter_anisotropic\")||this.gl.getExtension(\"WEBKIT_EXT_texture_filter_anisotropic\"),this.bindFrameBufferTexture(this.prevFrameBuffer,this.prevTexture),this.bindFrameBufferTexture(this.targetFrameBuffer,this.targetTexture),this.bindFrameBufferTexture(this.compFrameBuffer,this.compTexture);var r={pixelRatio:this.pixelRatio,textureRatio:this.textureRatio,texsizeX:this.texsizeX,texsizeY:this.texsizeY,mesh_width:this.mesh_width,mesh_height:this.mesh_height,aspectx:this.aspectx,aspecty:this.aspecty};this.noise=new j(e),this.image=new J(e),this.warpShader=new B(e,this.noise,this.image,r),this.compShader=new D(e,this.noise,this.image,r),this.outputShader=new I(e,r),this.prevWarpShader=new B(e,this.noise,this.image,r),this.prevCompShader=new D(e,this.noise,this.image,r),this.numBlurPasses=0,this.blurShader1=new G(0,this.blurRatios,e,r),this.blurShader2=new G(1,this.blurRatios,e,r),this.blurShader3=new G(2,this.blurRatios,e,r),this.blurTexture1=this.blurShader1.blurVerticalTexture,this.blurTexture2=this.blurShader2.blurVerticalTexture,this.blurTexture3=this.blurShader3.blurVerticalTexture,this.basicWaveform=new E(e,r),this.customWaveforms=c.range(4).map(function(t){return new R(t,e,r)}),this.customShapes=c.range(4).map(function(t){return new S(t,e,r)}),this.prevCustomWaveforms=c.range(4).map(function(t){return new R(t,e,r)}),this.prevCustomShapes=c.range(4).map(function(t){return new S(t,e,r)}),this.darkenCenter=new M(e,r),this.innerBorder=new w(e,r),this.outerBorder=new w(e,r),this.motionVectors=new q(e,r),this.titleText=new $(e,r),this.blendPattern=new et(r),this.resampleShader=new k(e),this.supertext={startTime:-1},this.warpUVs=new Float32Array((this.mesh_width+1)*(this.mesh_height+1)*2),this.warpColor=new Float32Array((this.mesh_width+1)*(this.mesh_height+1)*4),this.gl.clearColor(0,0,0,1),this.blankPreset=m.a;var a={frame:0,time:0,fps:45,bass:1,bass_att:1,mid:1,mid_att:1,treb:1,treb_att:1};this.preset=m.a,this.prevPreset=this.preset,this.presetEquationRunner=new f(this.preset,a,r),this.prevPresetEquationRunner=new f(this.prevPreset,a,r),this.regVars=this.presetEquationRunner.mdVSRegs}var e,i,s;return e=t,s=[{key:\"getHighestBlur\",value:function(t){return/sampler_blur3/.test(t)?3:/sampler_blur2/.test(t)?2:/sampler_blur1/.test(t)?1:0}},{key:\"mixFrameEquations\",value:function(t,e,i){var s=.5-.5*Math.cos(t*Math.PI),r=1-s,a=c.cloneVars(e);return a.decay=s*e.decay+r*i.decay,a.wave_a=s*e.wave_a+r*i.wave_a,a.wave_r=s*e.wave_r+r*i.wave_r,a.wave_g=s*e.wave_g+r*i.wave_g,a.wave_b=s*e.wave_b+r*i.wave_b,a.wave_x=s*e.wave_x+r*i.wave_x,a.wave_y=s*e.wave_y+r*i.wave_y,a.wave_mystery=s*e.wave_mystery+r*i.wave_mystery,a.ob_size=s*e.ob_size+r*i.ob_size,a.ob_r=s*e.ob_r+r*i.ob_r,a.ob_g=s*e.ob_g+r*i.ob_g,a.ob_b=s*e.ob_b+r*i.ob_b,a.ob_a=s*e.ob_a+r*i.ob_a,a.ib_size=s*e.ib_size+r*i.ib_size,a.ib_r=s*e.ib_r+r*i.ib_r,a.ib_g=s*e.ib_g+r*i.ib_g,a.ib_b=s*e.ib_b+r*i.ib_b,a.ib_a=s*e.ib_a+r*i.ib_a,a.mv_x=s*e.mv_x+r*i.mv_x,a.mv_y=s*e.mv_y+r*i.mv_y,a.mv_dx=s*e.mv_dx+r*i.mv_dx,a.mv_dy=s*e.mv_dy+r*i.mv_dy,a.mv_l=s*e.mv_l+r*i.mv_l,a.mv_r=s*e.mv_r+r*i.mv_r,a.mv_g=s*e.mv_g+r*i.mv_g,a.mv_b=s*e.mv_b+r*i.mv_b,a.mv_a=s*e.mv_a+r*i.mv_a,a.echo_zoom=s*e.echo_zoom+r*i.echo_zoom,a.echo_alpha=s*e.echo_alpha+r*i.echo_alpha,a.echo_orient=s*e.echo_orient+r*i.echo_orient,a.wave_dots=s<.5?i.wave_dots:e.wave_dots,a.wave_thick=s<.5?i.wave_thick:e.wave_thick,a.additivewave=s<.5?i.additivewave:e.additivewave,a.wave_brighten=s<.5?i.wave_brighten:e.wave_brighten,a.darken_center=s<.5?i.darken_center:e.darken_center,a.gammaadj=s<.5?i.gammaadj:e.gammaadj,a.wrap=s<.5?i.wrap:e.wrap,a.invert=s<.5?i.invert:e.invert,a.brighten=s<.5?i.brighten:e.brighten,a.darken=s<.5?i.darken:e.darken,a.solarize=s<.5?i.brighten:e.solarize,a.b1n=s*e.b1n+r*i.b1n,a.b2n=s*e.b2n+r*i.b2n,a.b3n=s*e.b3n+r*i.b3n,a.b1x=s*e.b1x+r*i.b1x,a.b2x=s*e.b2x+r*i.b2x,a.b3x=s*e.b3x+r*i.b3x,a.b1ed=s*e.b1ed+r*i.b1ed,a}},{key:\"getBlurValues\",value:function(t){var e=t.b1n,i=t.b2n,s=t.b3n,r=t.b1x,a=t.b2x,h=t.b3x;if(r-e<.1){var o=.5*(e+r);e=o-.05,r=o-.05}if((a=Math.min(r,a))-(i=Math.max(e,i))<.1){var n=.5*(i+a);i=n-.05,a=n-.05}if((h=Math.min(a,h))-(s=Math.max(i,s))<.1){var l=.5*(s+h);s=l-.05,h=l-.05}return{blurMins:[e,i,s],blurMaxs:[r,a,h]}}}],(i=[{key:\"loadPreset\",value:function(e,i){this.blendPattern.createBlendPattern(),this.blending=!0,this.blendStartTime=this.time,this.blendDuration=i,this.blendProgress=0,this.prevPresetEquationRunner=this.presetEquationRunner,this.prevPreset=this.preset,this.preset=e,this.preset.baseVals.old_wave_mode=this.prevPreset.baseVals.wave_mode,this.presetTime=this.time;var s={frame:this.frameNum,time:this.time,fps:this.fps,bass:this.audioLevels.bass,bass_att:this.audioLevels.bass_att,mid:this.audioLevels.mid,mid_att:this.audioLevels.mid_att,treb:this.audioLevels.treb,treb_att:this.audioLevels.treb_att},r={pixelRatio:this.pixelRatio,textureRatio:this.textureRatio,texsizeX:this.texsizeX,texsizeY:this.texsizeY,mesh_width:this.mesh_width,mesh_height:this.mesh_height,aspectx:this.aspectx,aspecty:this.aspecty};this.presetEquationRunner=new f(this.preset,s,r),this.regVars=this.presetEquationRunner.mdVSRegs;var a=this.prevWarpShader;this.prevWarpShader=this.warpShader,this.warpShader=a;var h=this.prevCompShader;this.prevCompShader=this.compShader,this.compShader=h;var o=this.preset.warp.trim(),n=this.preset.comp.trim();this.warpShader.updateShader(o),this.compShader.updateShader(n),0===o.length?this.numBlurPasses=0:this.numBlurPasses=t.getHighestBlur(o),0!==n.length&&(this.numBlurPasses=Math.max(this.numBlurPasses,t.getHighestBlur(n)))}},{key:\"loadExtraImages\",value:function(t){this.image.loadExtraImages(t)}},{key:\"setRendererSize\",value:function(t,e,i){var s=this.texsizeX,r=this.texsizeY;if(this.width=t,this.height=e,this.mesh_width=i.meshWidth||this.mesh_width,this.mesh_height=i.meshHeight||this.mesh_height,this.pixelRatio=i.pixelRatio||this.pixelRatio,this.textureRatio=i.textureRatio||this.textureRatio,this.texsizeX=t*this.pixelRatio*this.textureRatio,this.texsizeY=e*this.pixelRatio*this.textureRatio,this.aspectx=this.texsizeY>this.texsizeX?this.texsizeX/this.texsizeY:1,this.aspecty=this.texsizeX>this.texsizeY?this.texsizeY/this.texsizeX:1,this.texsizeX!==s||this.texsizeY!==r){var a=this.gl.createTexture();this.bindFrameBufferTexture(this.targetFrameBuffer,a),this.bindFrambufferAndSetViewport(this.targetFrameBuffer,this.texsizeX,this.texsizeY),this.resampleShader.renderQuadTexture(this.targetTexture),this.targetTexture=a,this.bindFrameBufferTexture(this.prevFrameBuffer,this.prevTexture),this.bindFrameBufferTexture(this.compFrameBuffer,this.compTexture)}this.updateGlobals(),this.frameNum>0&&this.renderToScreen()}},{key:\"setInternalMeshSize\",value:function(t,e){this.mesh_width=t,this.mesh_height=e,this.updateGlobals()}},{key:\"setOutputAA\",value:function(t){this.outputFXAA=t}},{key:\"updateGlobals\",value:function(){var t={pixelRatio:this.pixelRatio,textureRatio:this.textureRatio,texsizeX:this.texsizeX,texsizeY:this.texsizeY,mesh_width:this.mesh_width,mesh_height:this.mesh_height,aspectx:this.aspectx,aspecty:this.aspecty};this.presetEquationRunner.updateGlobals(t),this.prevPresetEquationRunner.updateGlobals(t),this.warpShader.updateGlobals(t),this.prevWarpShader.updateGlobals(t),this.compShader.updateGlobals(t),this.prevCompShader.updateGlobals(t),this.outputShader.updateGlobals(t),this.blurShader1.updateGlobals(t),this.blurShader2.updateGlobals(t),this.blurShader3.updateGlobals(t),this.basicWaveform.updateGlobals(t),this.customWaveforms.forEach(function(e){return e.updateGlobals(t)}),this.customShapes.forEach(function(e){return e.updateGlobals(t)}),this.prevCustomWaveforms.forEach(function(e){return e.updateGlobals(t)}),this.prevCustomShapes.forEach(function(e){return e.updateGlobals(t)}),this.darkenCenter.updateGlobals(t),this.innerBorder.updateGlobals(t),this.outerBorder.updateGlobals(t),this.motionVectors.updateGlobals(t),this.titleText.updateGlobals(t),this.blendPattern.updateGlobals(t),this.warpUVs=new Float32Array((this.mesh_width+1)*(this.mesh_height+1)*2),this.warpColor=new Float32Array((this.mesh_width+1)*(this.mesh_height+1)*4)}},{key:\"calcTimeAndFPS\",value:function(t){var e;if(t)e=t;else{var i=performance.now();((e=(i-this.lastTime)/1e3)>1||e<0||this.frame<2)&&(e=1/30),this.lastTime=i}this.time+=1/this.fps,this.blending&&(this.blendProgress=(this.time-this.blendStartTime)/this.blendDuration,this.blendProgress>1&&(this.blending=!1));var s=this.timeHist[this.timeHist.length-1]+e;this.timeHist.push(s),this.timeHist.length>this.timeHistMax&&this.timeHist.shift();var r=this.timeHist.length/(s-this.timeHist[0]);if(Math.abs(r-this.fps)>3&&this.frame>this.timeHistMax)this.fps=r;else{this.fps=.93*this.fps+(1-.93)*r}}},{key:\"runPixelEquations\",value:function(t,e,i,s){for(var r=this.mesh_width,a=this.mesh_height,h=r+1,o=a+1,n=this.time*e.warpanimspeed,l=1/e.warpscale,m=11.68+4*Math.cos(1.413*n+10),u=8.77+3*Math.cos(1.113*n+7),g=10.54+3*Math.cos(1.233*n+3),A=11.49+4*Math.cos(.933*n+5),f=0/this.texsizeX,d=0/this.texsizeY,v=this.aspectx,p=this.aspecty,_=c.cloneVars(e),x=0,b=0,T=0;T0&&void 0!==arguments[0]?arguments[0]:{},s=i.audioLevels,r=i.elapsedTime;this.calcTimeAndFPS(r),this.frameNum+=1,s?this.audio.updateAudio(s.timeByteArray,s.timeByteArrayL,s.timeByteArrayR):this.audio.sampleAudio(),this.audioLevels.updateAudioLevels(this.fps,this.frameNum);var a={frame:this.frameNum,time:this.time,fps:this.fps,bass:this.audioLevels.bass,bass_att:this.audioLevels.bass_att,mid:this.audioLevels.mid,mid_att:this.audioLevels.mid_att,treb:this.audioLevels.treb,treb_att:this.audioLevels.treb_att,meshx:this.mesh_width,meshy:this.mesh_height,aspectx:this.invAspectx,aspecty:this.invAspecty,pixelsx:this.texsizeX,pixelsy:this.texsizeY},h=Object.assign({},a);h.gmegabuf=this.prevPresetEquationRunner.gmegabuf,a.gmegabuf=this.presetEquationRunner.gmegabuf,Object.assign(a,this.regVars),this.presetEquationRunner.runFrameEquations(a);var o,n=this.presetEquationRunner.mdVSFrame;this.runPixelEquations(this.presetEquationRunner.preset,n,this.presetEquationRunner.runVertEQs,!1),Object.assign(this.regVars,c.pick(this.mdVSVertex,this.regs)),Object.assign(a,this.regVars),this.blending?(this.prevPresetEquationRunner.runFrameEquations(h),this.runPixelEquations(this.prevPresetEquationRunner.preset,this.prevPresetEquationRunner.mdVSFrame,this.prevPresetEquationRunner.runVertEQs,!0),o=t.mixFrameEquations(this.blendProgress,n,this.prevPresetEquationRunner.mdVSFrame)):o=n;var l=this.targetTexture;this.targetTexture=this.prevTexture,this.prevTexture=l;var m=this.targetFrameBuffer;this.targetFrameBuffer=this.prevFrameBuffer,this.prevFrameBuffer=m,this.gl.bindTexture(this.gl.TEXTURE_2D,this.prevTexture),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.bindFrambufferAndSetViewport(this.targetFrameBuffer,this.texsizeX,this.texsizeY),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.enable(this.gl.BLEND),this.gl.blendEquation(this.gl.FUNC_ADD),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA);var u=t.getBlurValues(o),g=u.blurMins,A=u.blurMaxs;this.blending?(this.prevWarpShader.renderQuadTexture(!1,this.prevTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,g,A,this.prevPresetEquationRunner.mdVSFrame,this.warpUVs,this.warpColor),this.warpShader.renderQuadTexture(!0,this.prevTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,g,A,o,this.warpUVs,this.warpColor)):this.warpShader.renderQuadTexture(!1,this.prevTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,g,A,n,this.warpUVs,this.warpColor),this.numBlurPasses>0&&(this.blurShader1.renderBlurTexture(this.targetTexture,n,g,A),this.numBlurPasses>1&&(this.blurShader2.renderBlurTexture(this.blurTexture1,n,g,A),this.numBlurPasses>2&&this.blurShader3.renderBlurTexture(this.blurTexture2,n,g,A)),this.bindFrambufferAndSetViewport(this.targetFrameBuffer,this.texsizeX,this.texsizeY)),this.motionVectors.drawMotionVectors(o,this.warpUVs),this.preset.shapes&&this.preset.shapes.length>0&&this.customShapes.forEach(function(t,i){t.drawCustomShape(e.blending?e.blendProgress:1,a,e.presetEquationRunner,e.preset.shapes[i],e.prevTexture)}),this.preset.waves&&this.preset.waves.length>0&&this.customWaveforms.forEach(function(t,i){t.drawCustomWaveform(e.blending?e.blendProgress:1,e.audio.timeArrayL,e.audio.timeArrayR,e.audio.freqArrayL,e.audio.freqArrayR,a,e.presetEquationRunner,e.preset.waves[i])}),this.blending&&(this.prevPreset.shapes&&this.prevPreset.shapes.length>0&&this.prevCustomShapes.forEach(function(t,i){t.drawCustomShape(1-e.blendProgress,h,e.prevPresetEquationRunner,e.prevPreset.shapes[i],e.prevTexture)}),this.prevPreset.waves&&this.prevPreset.waves.length>0&&this.prevCustomWaveforms.forEach(function(t,i){t.drawCustomWaveform(1-e.blendProgress,e.audio.timeArrayL,e.audio.timeArrayR,e.audio.freqArrayL,e.audio.freqArrayR,h,e.prevPresetEquationRunner,e.prevPreset.waves[i])})),this.basicWaveform.drawBasicWaveform(this.blending,this.blendProgress,this.audio.timeArrayL,this.audio.timeArrayR,o),this.darkenCenter.drawDarkenCenter(o);var f=[o.ob_r,o.ob_g,o.ob_b,o.ob_a];this.outerBorder.drawBorder(f,o.ob_size,0);var d=[o.ib_r,o.ib_g,o.ib_b,o.ib_a];if(this.innerBorder.drawBorder(d,o.ib_size,o.ob_size),this.supertext.startTime>=0){var v=(this.time-this.supertext.startTime)/this.supertext.duration;v>=1&&this.titleText.renderTitle(v,!0,a)}this.globalVars=a,this.mdVSFrame=n,this.mdVSFrameMixed=o,this.renderToScreen()}},{key:\"renderToScreen\",value:function(){this.outputFXAA?this.bindFrambufferAndSetViewport(this.compFrameBuffer,this.texsizeX,this.texsizeY):this.bindFrambufferAndSetViewport(null,this.width,this.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.enable(this.gl.BLEND),this.gl.blendEquation(this.gl.FUNC_ADD),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA);var e=t.getBlurValues(this.mdVSFrameMixed),i=e.blurMins,s=e.blurMaxs;if(this.blending?(this.prevCompShader.renderQuadTexture(!1,this.targetTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,i,s,this.prevPresetEquationRunner.mdVSFrame,this.warpColor),this.compShader.renderQuadTexture(!0,this.targetTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,i,s,this.mdVSFrameMixed,this.warpColor)):this.compShader.renderQuadTexture(!1,this.targetTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,i,s,this.mdVSFrame,this.warpColor),this.supertext.startTime>=0){var r=(this.time-this.supertext.startTime)/this.supertext.duration;this.titleText.renderTitle(r,!1,this.globalVars),r>=1&&(this.supertext.startTime=-1)}this.outputFXAA&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.compTexture),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.bindFrambufferAndSetViewport(null,this.width,this.height),this.outputShader.renderQuadTexture(this.compTexture))}},{key:\"launchSongTitleAnim\",value:function(t){this.supertext={startTime:this.time,duration:1.7},this.titleText.generateTitleTexture(t)}},{key:\"toDataURL\",value:function(){var e=this,i=new Uint8Array(this.texsizeX*this.texsizeY*4),s=this.gl.createFramebuffer(),r=this.gl.createTexture();this.bindFrameBufferTexture(s,r);var a=t.getBlurValues(this.mdVSFrameMixed),h=a.blurMins,o=a.blurMaxs;this.compShader.renderQuadTexture(!1,this.targetTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,h,o,this.mdVSFrame,this.warpColor),this.gl.readPixels(0,0,this.texsizeX,this.texsizeY,this.gl.RGBA,this.gl.UNSIGNED_BYTE,i),Array.from({length:this.texsizeY},function(t,s){return i.slice(s*e.texsizeX*4,(s+1)*e.texsizeX*4)}).forEach(function(t,s){return i.set(t,(e.texsizeY-s-1)*e.texsizeX*4)});var n=document.createElement(\"canvas\");n.width=this.texsizeX,n.height=this.texsizeY;var l=n.getContext(\"2d\"),m=l.createImageData(this.texsizeX,this.texsizeY);return m.data.set(i),l.putImageData(m,0,0),this.gl.deleteTexture(r),this.gl.deleteFramebuffer(s),n.toDataURL()}},{key:\"warpBufferToDataURL\",value:function(){var t=new Uint8Array(this.texsizeX*this.texsizeY*4);this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.targetFrameBuffer),this.gl.readPixels(0,0,this.texsizeX,this.texsizeY,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t);var e=document.createElement(\"canvas\");e.width=this.texsizeX,e.height=this.texsizeY;var i=e.getContext(\"2d\"),s=i.createImageData(this.texsizeX,this.texsizeY);return s.data.set(t),i.putImageData(s,0,0),e.toDataURL()}}])&&it(e.prototype,i),s&&it(e,s),t}();function rt(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:0,i=Object.assign({},t);i.baseVals=Object.assign({},this.baseValsDefaults,i.baseVals);for(var s=0;s2&&void 0!==arguments[2]?arguments[2]:{};this.renderer.setRendererSize(t,e,i)}},{key:\"setInternalMeshSize\",value:function(t,e){this.renderer.setInternalMeshSize(t,e)}},{key:\"setOutputAA\",value:function(t){this.renderer.setOutputAA(t)}},{key:\"render\",value:function(t){this.renderer.render(t)}},{key:\"launchSongTitleAnim\",value:function(t){this.renderer.launchSongTitleAnim(t)}},{key:\"toDataURL\",value:function(){return this.renderer.toDataURL()}},{key:\"warpBufferToDataURL\",value:function(){return this.renderer.warpBufferToDataURL()}}])&&rt(e.prototype,i),s&&rt(e,s),t}();function ht(t,e){for(var i=0;ib;b++)a.megabuf[Math.floor(a.index)]=0,a.gmegabuf[Math.floor(a.index)]=0,a.index+=1;a.zang=1;a.yang=0;a.zang=2;\",frame_eqs_str:\"a.xlen=45;a.ylen=45;a.flen=30;a.reg00=div(a.xlen*a.ylen,4);a.reg01=div(a.reg00,4);a.dec_med=1-div(.06*30,a.fps);a.dec_slow=1-div(.6,a.fps);a.dec_f=pow(.8,div(30,a.fps));a.q30=a.dec_slow;a.smooth=Math.max(1,pow(6,div(a.fps,30))-2);a.cbeat=a.bass+a.mid+a.treb;a.decc=.00001a.cbeat?1:0)?.8:a.dec_med;a.vol=a.vol*a.decc+(1-a.decc)*a.cbeat;a.avg=a.avg*a.dec_slow+a.cbeat*(1-a.dec_slow);a.is_beat=above(a.cbeat,1.5*a.avg)*above(a.time,a.tc0+.2);a.tc0=.00001c;c++){a.xind=-1;for(var d=0;3>d;d++)a.ox=mod((a.cx+.5)*a.xlen+a.xind,a.xlen),a.oy=mod((a.cy+.5)*a.ylen+a.yind,a.ylen),a.amp=3*(a.cx*a.cx+a.cy*a.cy),a.megabuf[Math.floor(a.oy*a.ylen+a.ox)]-=div(div(60,a.fps)*sqrt(a.amp)*above(a.amp,.02),1+a.xind*a.xind+a.yind*a.yind),a.xind+=1;a.yind+=1}a.ind+=1}for(b=a.yind=0;bMath.abs(mod(a.bindex,4)-0)?1:0)?a.ran2=div(randint(100)-30,60):0;.00001\\nMath.abs(mod(a.bindex,4)-2)?1:0)?a.ran3=div(randint(100)-30,60):0;.00001Math.abs(mod(a.bindex,6)-2)?1:0)?a.ran4=div(randint(100)-30,60):0;a.dec_v=Math.min(Math.max(0,1-div(8*a.vol,a.fps)),a.dec_slow);a.ran2_=a.ran2_*a.dec_v+(1-a.dec_v)*a.ran2;a.ran3_=a.ran3_*a.dec_v+(1-a.dec_v)*a.ran3;a.ran4_=a.ran4_*a.dec_v+(1-a.dec_v)*a.ran4;a.trelx+=div(div(a.ran2_,a.fps),7);a.trely+=div(div(a.ran3_,a.fps),2);a.trelz+=div(div(a.ran4_,a.fps),6);a.zang=6*Math.sin(a.trelz);a.xang=6*Math.sin(div(a.zang,\\n5)+a.trelx);a.yang=6*Math.sin(0*div(a.zang,3)+a.trely);a.q1=Math.cos(a.xang);a.q2=Math.sin(a.xang);a.q3=Math.cos(a.yang);a.q4=Math.sin(a.yang);a.q5=Math.cos(a.zang);a.q6=Math.sin(a.zang);a.fov=1;for(b=a.yind=0;b 0.0))\\n ) * 0.2) * min (1.0, (1.0/(tmpvar_8))));\\n ret_4 = (ret_4 + tmpvar_14);\\n ret_4 = (ret_4 + ((\\n (sin((12.0 * q2)) * tmpvar_7)\\n * tmpvar_14) * dot (\\n (12.0 * ((texture (sampler_blur1, (tmpvar_10 - vec2(-0.5, 0.3))).xyz * scale1) + bias1))\\n , vec3(0.32, 0.49, 0.29))));\\n ret_4 = (ret_4 + ((\\n ((0.5 / abs(tmpvar_8)) * normalize(xlat_mutablecol))\\n * \\n float((tmpvar_8 < 0.0))\\n ) * tmpvar_7));\\n vec4 tmpvar_15;\\n tmpvar_15.w = 1.0;\\n tmpvar_15.xyz = ret_4;\\n ret = tmpvar_15.xyz;\\n }\"}},101:function(a,e){a.exports={baseVals:{rating:5,gammaadj:1.980001,decay:.5,echo_zoom:.999998,echo_alpha:.5,echo_orient:3,modwavealphabyvolume:1,darken:1,wave_a:.001,wave_scale:10.437056,wave_smoothing:.45,wave_mystery:.08,modwavealphastart:0,modwavealphaend:1.32,warpanimspeed:1.4595,warpscale:2.0067,zoom:.9999,warp:.01,sx:.9999,wave_r:0,wave_g:.99,ob_size:0,ob_r:1,ob_g:1,ob_b:1,ib_size:0,mv_x:64,mv_y:48,mv_l:1.85,mv_r:.4999,mv_g:.4999,mv_b:.4999,mv_a:0,b1ed:0},shapes:[{baseVals:{enabled:1,rad:.048958,tex_ang:1.00531,tex_zoom:1.531168,r:.5,g:1,b:.9,r2:.83,g2:.93,b2:.8,a2:1,border_b:0,border_a:0},init_eqs_str:\"a.trel=0;a.q20=0;a.q28=0;a.q26=0;\",frame_eqs_str:\"a.trel=div(a.time,2)+a.q20;a.x=.5+Math.sin(2*a.trel);a.y=.5+Math.cos(1.3*a.trel+div(a.q28,3));a.a=div(a.q26,4)+.2;\"},{baseVals:{enabled:0}},{baseVals:{enabled:1,x:.503,rad:.038857,tex_zoom:.609857,g:.1,a:.9,r2:1,b2:1,border_r:.5,border_g:.5,border_b:.5,border_a:0},init_eqs_str:\"a.is_beat=0;a.t0=0;a.q21=0;\",frame_eqs_str:\"a.x=div(randint(10),10);a.y=div(randint(10),10);a.r=div(randint(4),3);a.g=div(randint(4),3);a.b=div(randint(4),3);a.is_beat=above(a.time,a.t0+.03);a.t0=a.is_beat*a.time+(1-a.is_beat)*a.t0;a.a=Math.min(div(a.q21,2),.9)*a.is_beat;a.rad=div(a.a*a.a,3);\"},{baseVals:{enabled:0}}],waves:[{baseVals:{enabled:1,sep:120,additive:1,scaling:.891519,smoothing:.82,a:.6},init_eqs_str:\"a.k1=0;a.k2=0;a.xi=0;a.yi=0;a.dx=0;a.dy=0;a.q22=0;a.t2=0;a.t1=1+.3*(.01*randint(101)-.01*randint(101));a.t2=1+.3*(.01*randint(101)-.01*randint(101));a.t3=1+.3*(.01*randint(101)-.01*randint(101));a.t4=1+.3*(.01*randint(101)-.01*randint(101));a.t5=1+.3*(.01*randint(101)-.01*randint(101));a.t6=1+.3*(.01*randint(101)-.01*randint(101));a.t7=1+.3*(.01*randint(101)-.01*randint(101));a.t8=1+.3*(.01*randint(101)-.01*randint(101));\",frame_eqs_str:\"a.t2+=a.bass_att;\",point_eqs_str:\"a.k1=mod(100*a.sample,8);a.k2=bnot(a.k1);a.xi=a.value1*a.k2+a.xi*(1-a.k2);a.yi=a.value2*(1-a.k2)+a.yi*a.k2;a.dx=.99*a.dx+a.xi;a.dy=.99*a.dy+a.yi;a.x=.5+div(a.xi,2);a.y=.5+div(a.yi,2);a.a=div(a.q22,8);a.a=Math.min(a.a,.2);\"},{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:0}}],init_eqs_str:\"a.index=0;a.q22=0;a.q21=0;a.fade=0;a.q1=0;a.dec_med=0;a.rott=0;a.is_beat=0;a.q23=0;a.k1=0;a.q24=0;a.dec_slow=0;a.q4=0;a.q26=0;a.p2=0;a.avg=0;a.beat=0;a.p1=0;a.peak=0;a.q2=0;a.q27=0;a.q3=0;a.t0=0;a.q32=0;a.q20=0;a.fade=.5;\",frame_eqs_str:\"a.dec_med=pow(.9,div(30,a.fps));a.dec_slow=pow(.99,div(30,a.fps));a.beat=Math.max(Math.max(a.bass,a.mid),a.treb);a.avg=a.avg*a.dec_slow+a.beat*(1-a.dec_slow);a.is_beat=above(a.beat,.5+a.avg+a.peak)*above(a.time,a.t0+.2);a.t0=a.is_beat*a.time+(1-a.is_beat)*a.t0;a.peak=a.is_beat*a.beat+(1-a.is_beat)*a.peak*a.dec_med;a.index=mod(a.index+a.is_beat,8);a.q20=a.avg;a.q21=a.beat;a.q22=a.peak;a.q23=a.index;a.q24=a.is_beat;a.q26=a.bass+a.mid+a.treb;a.k1=a.is_beat*equal(a.index,0);a.p1=\\na.k1*(a.p1+1)+(1-a.k1)*a.p1;a.p2=a.dec_med*a.p2+(1-a.dec_med)*a.p1;a.rott=div(3.14159265358*a.p2,2);a.q27=a.index+1;a.q1=Math.cos(a.rott);a.q2=Math.sin(a.rott);a.q3=-a.q2;a.q4=a.q1;a.zoom=1;a.rot=-0*a.index;a.fade=a.fade*a.dec_med+pow(.996,div(30,a.fps))*(1-a.dec_med);a.q32=a.fade;\",pixel_eqs_str:\"\",pixel_eqs:\"\",warp:\" shader_body { \\n vec2 zz_1;\\n mat2 tmpvar_2;\\n tmpvar_2[uint(0)] = _qa.xy;\\n tmpvar_2[1u] = _qa.zw;\\n zz_1 = (((\\n (uv - vec2(0.5, 0.5))\\n * texsize.xy) * (0.015 * q27)) * tmpvar_2);\\n vec4 tmpvar_3;\\n tmpvar_3.w = 1.0;\\n tmpvar_3.xyz = (((q32 * texture (sampler_main, \\n (uv + ((clamp (\\n (sin(zz_1) / cos(zz_1))\\n , vec2(-20.0, -20.0), vec2(20.0, 20.0)) * texsize.zw) * 8.0))\\n ).xyz) + (\\n (0.03 * texture (sampler_noise_lq, ((uv * 0.3) + (0.01 * rand_frame).xy)))\\n .xyz * \\n (1.0 - ((texture (sampler_blur1, uv).xyz * scale1) + bias1))\\n )) - 0.02);\\n ret = tmpvar_3.xyz;\\n }\",comp:\" shader_body { \\n vec4 tmpvar_1;\\n tmpvar_1 = texture (sampler_main, uv);\\n vec4 tmpvar_2;\\n tmpvar_2.w = 1.0;\\n tmpvar_2.xyz = ((tmpvar_1.xyz + clamp (\\n (3.0 * (((texture (sampler_blur1, \\n (uv - (0.01 * tmpvar_1.xyz).xy)\\n ).xyz * scale1) + bias1) - vec3(0.1, 0.1, 0.2)))\\n , 0.0, 1.0)) * 1.3);\\n ret = tmpvar_2.xyz;\\n }\"}},104:function(a,e){a.exports={baseVals:{rating:3,gammaadj:1.98,decay:.5,echo_zoom:1,echo_alpha:.5,echo_orient:3,wave_mode:6,wave_thick:1,modwavealphabyvolume:1,wave_brighten:0,darken:1,wave_a:.001,wave_scale:.527,wave_smoothing:.09,modwavealphastart:0,modwavealphaend:1.32,warpanimspeed:1.459,warpscale:2.007,zoom:.9999,warp:.01,sx:.9999,wave_r:.8,wave_g:.49,ob_a:1,ib_size:.26,mv_x:64,mv_y:48,mv_l:1.85,mv_r:.5,mv_g:.5,mv_b:.5,mv_a:0,b2x:.7,b1ed:0},shapes:[{baseVals:{enabled:1,sides:12,num_inst:1024,rad:.03632,tex_ang:1.00531,tex_zoom:1.53117,b:1,a:0,g2:0,border_b:0,border_a:0},init_eqs_str:\"a.fov=0;a.n=0;a.x0=0;a.y0=0;a.z0=0;a.q32=0;a.t1=0;\",frame_eqs_str:\"a.fov=a.reg03;a.n=a.instance*a.reg00;a.x0=a.gmegabuf[Math.floor(a.n)];a.y0=a.gmegabuf[Math.floor(a.n+1)];a.z0=a.gmegabuf[Math.floor(a.n+2)]+a.reg02;a.x=div(a.x0,a.z0)*a.fov+.5;a.y=div(a.y0,a.z0)*a.q32*a.fov+.5;a.r=a.gmegabuf[Math.floor(a.n+3)];a.g=a.gmegabuf[Math.floor(a.n+4)];a.b=a.gmegabuf[Math.floor(a.n+5)];a.r2=div(a.r,2);a.g2=div(a.g,2);a.b2=div(a.b2,2);a.a=div(a.instance,1024);a.a2=.5*a.a;a.rad=Math.min(div(.02,a.z0),.5)*(0b;b++)a.megabuf[Math.floor(a.index)]=0,a.gmegabuf[Math.floor(a.index)]=0,a.index+=1;a.recsize=8;a.reg00=a.recsize;a.points=1024;a.reg01=0;a.zofs=1+2*div(randint(100),100);a.reg02=a.zofs;a.fov=.3;a.reg03=a.fov;',frame_eqs_str:'a.dec_f=pow(.3,div(30,a.fps));a.dec_m=pow(.85,div(30,a.fps));a.dec_s=pow(.95,div(30,a.fps));a.beat=a.bass+a.mid+a.treb-(a.bass_att+a.mid_att+a.treb_att)+(a.bass+a.mid+a.treb);a.beat/=3;a.peak=a.peak*a.dec_m+(1-a.dec_m)*pow(a.beat-1,1)*(1Math.abs(a.index-2)?1:0))?(a.ran4=div(randint(100),50)-1,a.ran5=div(randint(100),50)-1,a.ran6=div(randint(100),50)-1):0;a.ran4_=a.dec_m*a.ran4_+(1-a.dec_m)*a.ran4;a.ran5_=a.dec_m*a.ran5_+(1-a.dec_m)*a.ran5;a.ran6_=\\na.dec_m*a.ran6_+(1-a.dec_m)*a.ran6;.00001Math.abs(a.index-6)?1:0))?(a.ran7=div(randint(100),50)-1,a.ran8=div(randint(100),50)-1,a.ran9=div(randint(100),50)-1):0;a.ran7_=a.dec_m*a.ran7_+(1-a.dec_m)*a.ran7;a.ran8_=a.dec_m*a.ran8_+(1-a.dec_m)*a.ran8;a.ran9_=a.dec_m*a.ran9_+(1-a.dec_m)*a.ran9;a.pk=sqrt(a.peak+.1);a[\"new\"]=Math.floor(12*(a.ran4-a.ran5)*a.pk-div(12*(a.ran3-a.ran1),a.pk));a[\"new\"]=Math.max(Math.min(a[\"new\"],20),2);a.reg01+=a[\"new\"];a.dec=a.dec_m;a.n=a.recsize*\\na.points;a.m=0;a.dt1=div(div(.00001 0.5)))\\n * 2.0)));\\n flash_1 = tmpvar_14;\\n float angle_15;\\n float tmpvar_16;\\n tmpvar_16 = abs(xlat_mutableuv2.x);\\n if ((xlat_mutableuv2.y >= 0.0)) {\\n angle_15 = (1.0 - ((xlat_mutableuv2.y - tmpvar_16) / (xlat_mutableuv2.y + tmpvar_16)));\\n } else {\\n angle_15 = (3.0 - ((xlat_mutableuv2.y + tmpvar_16) / (tmpvar_16 - xlat_mutableuv2.y)));\\n };\\n angle_15 = (angle_15 * 0.25);\\n float tmpvar_17;\\n if ((xlat_mutableuv2.x < 0.0)) {\\n tmpvar_17 = -(angle_15);\\n } else {\\n tmpvar_17 = angle_15;\\n };\\n flash_1 = (tmpvar_14 * (tmpvar_14 / (\\n abs((fract((\\n (3.0 * tmpvar_17)\\n + \\n (time * 2.0)\\n )) - 0.5))\\n + 0.18)));\\n vec3 tmpvar_18;\\n tmpvar_18 = max ((texture (sampler_main, uv).xyz * 2.0), ((\\n (texture (sampler_blur2, uv).xyz * scale2)\\n + bias2) * 2.0));\\n vec2 tmpvar_19;\\n tmpvar_19 = sin(xlat_mutableuv3);\\n ret_4 = (clamp ((0.025 / \\n sqrt(dot (tmpvar_19, tmpvar_19))\\n ), 0.0, 1.0) * vec3(0.4, 0.1, 1.0));\\n ret_4 = (ret_4 + clamp ((stars_3 * stars_3), 0.0, 1.0));\\n ret_4 = (ret_4 * clamp ((1.0 - \\n (2.0 * dot (tmpvar_18, vec3(0.32, 0.49, 0.29)))\\n ), 0.0, 1.0));\\n ret_4 = (ret_4 + tmpvar_18);\\n vec3 tmpvar_20;\\n tmpvar_20.x = q10;\\n tmpvar_20.y = q11;\\n tmpvar_20.z = q12;\\n ret_4 = (ret_4 + ((2.0 * \\n clamp (flash_1, 0.0, 1.0)\\n ) * tmpvar_20));\\n vec4 tmpvar_21;\\n tmpvar_21.w = 1.0;\\n tmpvar_21.xyz = ret_4;\\n ret = tmpvar_21.xyz;\\n }\"}},105:function(a,e){a.exports={baseVals:{rating:4,gammaadj:1.98,decay:.5,echo_zoom:1,echo_alpha:.5,echo_orient:3,additivewave:1,wave_thick:1,modwavealphabyvolume:1,darken:1,wave_a:.001,wave_scale:.133,wave_smoothing:0,wave_mystery:-1,modwavealphastart:1,modwavealphaend:1.3,warpanimspeed:1.459,warpscale:2.007,zoom:.9999,warp:.01,sx:.9999,wave_r:.5,wave_g:.5,wave_b:.5,ob_size:.015,ob_b:1,ib_size:.26,mv_a:0,b2x:.3,b1ed:0},shapes:[{baseVals:{enabled:1,sides:40,thickoutline:1,rad:.06623,tex_zoom:1.79845,r:0,a:.1,g2:0,border_b:0,border_a:0},init_eqs_str:\"a.vol=0;a.bob=0;a.border_1=0;a.ro=0;a.sp=0;a.red=0;a.spi=0;a.tm=0;a.bob=1.5;a.ro=0;a.red=randint(20);\",frame_eqs_str:\"a.vol=1+.2*div(a.bass_att+a.treb_att+a.mid_att,3);a.bob=a.bob*above(a.bob,.01)-.01+(1-above(a.bob,.01));a.bob=.4+.4*Math.sin(.8*a.time);a.bob*=a.vol;a.border_1=.4;a.sides=30;a.ro+=.02;a.ang=a.ro;a.sp=.025*a.red;a.spi=.5-a.sp;a.tm=.1*a.time;a.border_r=.5+a.sp*Math.sin(.6*a.tm)+a.spi*Math.cos(1.46*a.tm);a.border_g=.5+a.sp*Math.sin(1.294*a.tm)+a.spi*Math.cos(.87*a.tm);a.border_b=.5+a.sp*Math.sin(1.418*a.tm)+a.spi*Math.cos(.76*a.tm);\"},{baseVals:{enabled:1,sides:40,additive:1,num_inst:4,g:1,b:1,g2:0,border_a:0},init_eqs_str:\"\",frame_eqs_str:\"a.x=.5+.225*Math.sin(.7*div(a.time,a.instance));a.y=.5+.3*Math.cos(.7*div(a.time,a.instance));a.x-=.4*a.x*Math.sin(a.time);a.y-=.4*a.y*Math.cos(a.time);a.rad*=a.mid_att;a.r=.5+.5*Math.sin(.5*a.frame);a.b=.5+.5*Math.sin(.5*a.frame+2.094);a.g=.5+.5*Math.sin(.5*a.frame+4.188);\"},{baseVals:{enabled:1,sides:40,additive:1,g:1,b:1,g2:0,border_a:0},init_eqs_str:\"\",frame_eqs_str:\"a.x=.5+.5*(.3*Math.sin(1.1*a.time)+.7*Math.sin(.5*a.time));a.x=.5+.225*Math.sin(a.time+2.09);a.y=.5+.3*Math.cos(a.time+2.09);a.rad*=a.bass_att;a.r=.5+.5*Math.sin(.5*a.frame);a.b=.5+.5*Math.sin(.5*a.frame+2.094);a.g=.5+.5*Math.sin(.5*a.frame+4.188);\"},{baseVals:{enabled:1,sides:40,additive:1,num_inst:5,rad:.07419,g:1,b:1,g2:0,border_a:0},init_eqs_str:\"\",frame_eqs_str:\"a.x=.5+.225*Math.sin(div(a.time,a.instance));a.y=.5+.3*Math.cos(div(a.time,a.instance));a.x+=.4*a.x*Math.sin(a.time);a.y+=.4*a.y*Math.cos(a.time);a.rad*=a.treb_att;a.r=.5+.5*Math.sin(.5*a.frame);a.b=.5+.5*Math.sin(.5*a.frame+2.094);a.g=.5+.5*Math.sin(.5*a.frame+4.188);\"}],waves:[{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:0}}],init_eqs_str:\"a.index2=0;a.index=0;a.q22=0;a.q21=0;a.q1=0;a.dec_med=0;a.ps=0;a.rott=0;a.is_beat=0;a.q23=0;a.k1=0;a.q24=0;a.dec_slow=0;a.q4=0;a.q26=0;a.p2=0;a.avg=0;a.beat=0;a.p1=0;a.peak=0;a.q2=0;a.q27=0;a.q3=0;a.t0=0;a.q28=0;a.q20=0;\",frame_eqs_str:\"a.dec_med=pow(.7,div(30,a.fps));a.dec_slow=pow(.99,div(30,a.fps));a.beat=Math.max(Math.max(a.bass,a.mid),a.treb);a.avg=a.avg*a.dec_slow+a.beat*(1-a.dec_slow);a.is_beat=above(a.beat,.2+a.avg+a.peak)*above(a.time,a.t0+.2);a.t0=a.is_beat*a.time+(1-a.is_beat)*a.t0;a.peak=a.is_beat*a.beat+(1-a.is_beat)*a.peak*a.dec_med;a.index=mod(a.index+a.is_beat,8);a.index2=mod(a.index2+a.is_beat*bnot(a.index),2);a.q20=a.avg;a.q21=a.beat;a.q22=a.peak;a.ps=.9*a.ps+.1*a.q22;a.q23=a.ps;a.q24=a.is_beat;\\na.q26=a.bass_att+a.mid_att+a.treb_att;a.q27=a.index+1;a.q28=a.index2;a.k1=a.is_beat*equal(mod(a.index,2),0);a.p1=a.k1*(a.p1+1)+(1-a.k1)*a.p1;a.p2=a.dec_med*a.p2+(1-a.dec_med)*a.p1;a.rott=div(3.1416*a.p2,4);a.q1=Math.cos(a.rott);a.q2=Math.sin(a.rott);a.q3=-a.q2;a.q4=a.q1;\",pixel_eqs_str:\"a.zoom=1.05;\",warp:\" shader_body { \\n vec2 uv_1;\\n vec2 tmpvar_2;\\n tmpvar_2 = (uv - vec2(0.5, 0.5));\\n vec4 tmpvar_3;\\n tmpvar_3.w = 0.0;\\n vec4 tmpvar_4;\\n tmpvar_4 = texture (sampler_blur1, uv);\\n tmpvar_3.xyz = ((tmpvar_4.xyz * scale1) + bias1);\\n float tmpvar_5;\\n tmpvar_5 = (dot (tmpvar_3, roam_sin) * 16.0);\\n mat2 tmpvar_6;\\n tmpvar_6[uint(0)].x = cos(tmpvar_5);\\n tmpvar_6[uint(0)].y = -(sin(tmpvar_5));\\n tmpvar_6[1u].x = sin(tmpvar_5);\\n tmpvar_6[1u].y = cos(tmpvar_5);\\n uv_1 = ((tmpvar_2 + (\\n (0.2 * dot (((tmpvar_4.xyz * scale1) + bias1), vec3(0.32, 0.49, 0.29)))\\n * \\n (tmpvar_2 * tmpvar_6)\\n )) - 0.5);\\n vec2 tmpvar_7;\\n tmpvar_7 = ((uv_1 * texsize.xy) * 0.02);\\n vec2 tmpvar_8;\\n tmpvar_8.x = (cos((tmpvar_7.y * q1)) * sin(-(tmpvar_7.y)));\\n tmpvar_8.y = (sin(tmpvar_7.x) * cos((tmpvar_7.y * q2)));\\n uv_1 = (uv_1 - ((tmpvar_8 * texsize.zw) * 12.0));\\n vec4 tmpvar_9;\\n tmpvar_9.w = 1.0;\\n tmpvar_9.xyz = ((texture (sampler_main, uv_1).xyz * 0.98) - 0.02);\\n ret = tmpvar_9.xyz;\\n }\",comp:\"vec3 xlat_mutableret1;\\nvec2 xlat_mutablers;\\nvec2 xlat_mutableuv1;\\nfloat xlat_mutablez;\\n shader_body { \\n xlat_mutableuv1 = (uv - 0.5);\\n xlat_mutablez = (0.2 / abs(xlat_mutableuv1.y));\\n xlat_mutablers.x = (xlat_mutableuv1.x * xlat_mutablez);\\n xlat_mutablers.y = ((xlat_mutablez / 2.0) + (time * 4.0));\\n vec4 tmpvar_1;\\n tmpvar_1 = texture (sampler_noise_hq, xlat_mutablers);\\n xlat_mutableret1 = ((tmpvar_1.xyz * vec3(\\n greaterThanEqual (tmpvar_1.xyz, vec3(0.0, 0.0, 0.0))\\n )) - 0.6);\\n float tmpvar_2;\\n tmpvar_2 = clamp ((128.0 * xlat_mutableuv1.y), 0.0, 1.0);\\n vec2 tmpvar_3;\\n tmpvar_3 = fract(((\\n (xlat_mutableuv1 * (1.0 - abs(xlat_mutableuv1.x)))\\n - 0.5) - (\\n (xlat_mutableret1 * 0.05)\\n * tmpvar_2).xy));\\n float x_4;\\n x_4 = (tmpvar_3.y - 0.52);\\n vec3 tmpvar_5;\\n tmpvar_5 = (texture (sampler_main, tmpvar_3) + ((0.02 / \\n (0.02 + sqrt((x_4 * x_4)))\\n ) * slow_roam_sin)).xyz;\\n xlat_mutableret1 = tmpvar_5;\\n vec2 tmpvar_6;\\n tmpvar_6 = (32.0 * ((\\n (uv * mat2(0.6, -0.8, 0.8, 0.6))\\n + \\n (tmpvar_5 * 0.1)\\n .xy) + (time / 64.0)));\\n vec2 tmpvar_7;\\n tmpvar_7 = abs((fract(tmpvar_6) - 0.5));\\n vec3 tmpvar_8;\\n tmpvar_8 = clamp (((0.25 / \\n sqrt(dot (tmpvar_7, tmpvar_7))\\n ) * vec3((texture (sampler_pw_noise_lq, \\n (tmpvar_6 / 256.0)\\n ).y - 0.9))), 0.0, 1.0);\\n vec4 tmpvar_9;\\n tmpvar_9.w = 1.0;\\n tmpvar_9.xyz = (tmpvar_5 + ((\\n (tmpvar_8.x * tmpvar_8.x)\\n + \\n ((rand_preset * (0.5 - uv.y)).xyz * vec3(0.0, 0.0, 1.0))\\n ) * (1.0 - tmpvar_2)));\\n ret = tmpvar_9.xyz;\\n }\"}},107:function(a,e){a.exports={baseVals:{rating:3,wave_mode:4,additivewave:1,wave_dots:1,modwavealphabyvolume:1,wave_a:.331,wave_scale:.898,wave_smoothing:.108,wave_mystery:.1,modwavealphastart:.72,modwavealphaend:1.28,zoom:1.3345,wave_r:0,wave_g:.5,wave_b:.5,wave_y:.54,mv_x:24.8,mv_dy:.16,mv_l:1.5,mv_a:0},shapes:[{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:0}}],waves:[{baseVals:{enabled:1,samples:352,usedots:1,additive:1,scaling:.03856,smoothing:.2,g:0},init_eqs_str:\"a.t02=0;a.q1=0;a.ratio=0;a.ampl=0;a.x1=0;a.y1=0;\",frame_eqs_str:\"a.q1=a.bass_att;\",point_eqs_str:\"a.r=Math.abs(Math.sin(div(a.frame,38)));a.g=.5*Math.abs(Math.cos(div(a.frame,45)));a.b=.5*Math.abs(Math.sin(div(a.frame,133)));a.a=.3;a.t02+=div(a.q1,10);a.ratio=Math.sin(div(a.frame,49));a.ampl=.01+.4*sqr(Math.sin(div(a.frame,18))*Math.cos(div(a.frame,123)));a.x1=div(a.r-.5,15)+.5+a.ampl*Math.sin(6.28*a.sample);a.y1=div(a.b-.5,15)+.5+a.ampl*Math.cos(6.28*a.sample);a.x=a.x1+.2*(a.ampl+a.ratio)*Math.sin(6.28*a.sample*a.ratio*7.3);a.y=a.y1+.2*(a.ampl+a.ratio)*Math.cos(37.68*a.sample);\\n\"},{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:0}}],init_eqs_str:\"a.oldshift=0;a.shift=0;a.normalframez=0;a.crash=0;a.nex=0;a.rshift=0;a.q1=0;a.zoom1=0;\",frame_eqs_str:\"a.dx=0;a.oldshift=a.shift;a.normalframez+=1;a.shift=above(a.bass_att,1)*above(a.treb_att,.9);a.crash=Math.abs(a.oldshift-a.shift);a.nex=1*equal(a.rshift,0)+2*equal(a.rshift,1);a.rshift=.00001 0.9)) {\\n ret_2.x = 0.0;\\n };\\n if ((ret_2.y > 0.9)) {\\n ret_2.y = 0.0;\\n };\\n if ((ret_2.z > 0.9)) {\\n ret_2.z = 0.0;\\n };\\n vec4 tmpvar_7;\\n tmpvar_7.w = 1.0;\\n tmpvar_7.xyz = ret_2;\\n ret = tmpvar_7.xyz;\\n }\",comp:\" shader_body { \\n vec3 ret1_1;\\n vec2 uv1_2;\\n vec3 ret_3;\\n vec4 tmpvar_4;\\n tmpvar_4 = texture (sampler_main, uv);\\n ret_3 = (tmpvar_4.xyz * (0.6 + (0.3 * \\n sin(((uv.x * 10.0) + time))\\n )));\\n vec2 tmpvar_5;\\n tmpvar_5.x = (texture (sampler_main, (uv - vec2(0.001, 0.0))).xyz - texture (sampler_main, (uv + vec2(0.001, 0.0))).xyz).x;\\n tmpvar_5.y = (texture (sampler_main, (uv - vec2(0.0, 0.001))).xyz - texture (sampler_main, (uv + vec2(0.0, 0.001))).xyz).x;\\n uv1_2 = ((0.5 * cos(\\n (((uv - 0.5) * 1.5) + 1.6)\\n )) - (3.0 * tmpvar_5));\\n ret1_1 = ((0.3 * dot (tmpvar_4.xyz, vec3(0.32, 0.49, 0.29))) + ((\\n clamp ((0.01 / sqrt(dot (uv1_2, uv1_2))), 0.0, 1.0)\\n * \\n mix (vec3(dot (((texture (sampler_blur2, uv).xyz * scale2) + bias2), vec3(0.32, 0.49, 0.29))), ret_3, pow (ret_3, vec3((0.05 + (mid_att * 0.03)))))\\n ) * (\\n (4.0 + bass)\\n + \\n (mid + treb_att)\\n )));\\n ret_3 = ret1_1;\\n vec4 tmpvar_6;\\n tmpvar_6.w = 1.0;\\n tmpvar_6.xyz = ret1_1;\\n ret = tmpvar_6.xyz;\\n }\"}},12:function(a,e,t){var n=t(13);a.exports=function(a,e,t){if(n(a),void 0===e)return a;switch(t){case 1:return function(t){return a.call(e,t)};case 2:return function(t,n){return a.call(e,t,n)};case 3:return function(t,n,r){return a.call(e,t,n,r)}}return function(){return a.apply(e,arguments)}}},13:function(a,e){a.exports=function(a){if(\"function\"!=typeof a)throw TypeError(a+\" is not a function!\");return a}},14:function(a,e,t){var n=t(4),r=t(19);a.exports=t(0)?function(a,e,t){return n.f(a,e,r(1,t))}:function(a,e,t){return a[e]=t,a}},15:function(a,e,t){var n=t(1);a.exports=function(a){if(!n(a))throw TypeError(a+\" is not an object!\");return a}},16:function(a,e,t){a.exports=!t(0)&&!t(5)(function(){return 7!=Object.defineProperty(t(17)(\"div\"),\"a\",{get:function(){return 7}}).a})},17:function(a,e,t){var n=t(1),r=t(2).document,s=n(r)&&n(r.createElement);a.exports=function(a){return s?r.createElement(a):{}}},18:function(a,e,t){var n=t(1);a.exports=function(a,e){if(!n(a))return a;var t,r;if(e&&\"function\"==typeof(t=a.toString)&&!n(r=t.call(a)))return r;if(\"function\"==typeof(t=a.valueOf)&&!n(r=t.call(a)))return r;if(!e&&\"function\"==typeof(t=a.toString)&&!n(r=t.call(a)))return r;throw TypeError(\"Can't convert object to primitive value\")}},19:function(a,e){a.exports=function(a,e){return{enumerable:!(1&a),configurable:!(2&a),writable:!(4&a),value:e}}},2:function(a,e){var t=a.exports=\"undefined\"!=typeof window&&window.Math==Math?window:\"undefined\"!=typeof self&&self.Math==Math?self:Function(\"return this\")();\"number\"==typeof __g&&(__g=t)},22:function(a,e){a.exports={baseVals:{rating:0,gammaadj:1,decay:.96,echo_zoom:.99663,echo_orient:1,wave_mode:2,wave_dots:1,wave_brighten:0,wrap:0,darken:1,wave_a:.001,wave_scale:.011726,wave_smoothing:.9,warpanimspeed:.010284,warpscale:.01,warp:.01,wave_r:.5,wave_g:.4,wave_b:.3,ob_size:0,ob_r:.11,ob_b:.1,ib_size:0,ib_r:0,ib_g:0,ib_b:0,mv_x:64,mv_y:48,mv_l:5,mv_r:0,mv_g:0,mv_b:0,mv_a:0},shapes:[{baseVals:{enabled:1,sides:32,additive:1,rad:.194774,r:0,b:1,a:1e-6,r2:.63,g2:.7,b2:1,a2:.07,border_a:0},init_eqs_str:\"a.lens_scale=0;a.cang=0;a.n=0;a.yq=0;a.xp=0;a.fix=0;a.yp=0;a.t1=0;a.q1=0;a.pos_scale=0;a.cubesize=0;a.xq=0;a.sang=0;a.flip=0;a.zq=0;a.tm=0;a.zp=0;a.q2=0;a.sample=0;a.q8=0;a.flip=1;\",frame_eqs_str:\"a.flip=-a.flip;a.lens_scale=.5*a.flip+.5;a.lens_scale=1+2.4*a.lens_scale;a.pos_scale=.00001 1.0)\\n ) * (\\n (tmpvar_8 * -2.0)\\n + 1.570796)));\\n tmpvar_6 = (tmpvar_8 * sign((uv_1.y / uv_1.x)));\\n if ((abs(uv_1.x) > (1e-08 * abs(uv_1.y)))) {\\n if ((uv_1.x < 0.0)) {\\n if ((uv_1.y >= 0.0)) {\\n tmpvar_6 += 3.141593;\\n } else {\\n tmpvar_6 = (tmpvar_6 - 3.141593);\\n };\\n };\\n } else {\\n tmpvar_6 = (sign(uv_1.y) * 1.570796);\\n };\\n xlat_mutablers0.x = (((tmpvar_6 / 3.1416) * 6.0) * q28);\\n xlat_mutablers0.y = inversesqrt(dot (uv_1, uv_1));\\n vec2 tmpvar_9;\\n tmpvar_9.x = (xlat_mutablers0.x + (q9 * 8.0));\\n tmpvar_9.y = (xlat_mutablers0.y + ((q9 * q28) * 4.0));\\n xlat_mutablerss = (tmpvar_9 / 12.0);\\n vec2 tmpvar_10;\\n tmpvar_10.x = q5;\\n tmpvar_10.y = q6;\\n ofs_2 = (0.1 * tmpvar_10.yx);\\n float tmpvar_11;\\n float tmpvar_12;\\n tmpvar_12 = -(q9);\\n tmpvar_11 = fract(tmpvar_12);\\n mat2 tmpvar_13;\\n tmpvar_13[uint(0)].x = 1.0;\\n tmpvar_13[uint(0)].y = -0.0;\\n tmpvar_13[1u].x = 0.0;\\n tmpvar_13[1u].y = 1.0;\\n xlat_mutableuv2 = ((uv_1 * (\\n (q13 * tmpvar_11)\\n * tmpvar_13)) * aspect.yx);\\n vec2 tmpvar_14;\\n tmpvar_14 = fract(((xlat_mutableuv2 + 0.5) + ofs_2));\\n xlat_mutableneu = (texture (sampler_main, tmpvar_14).xyz + ((texture (sampler_blur1, tmpvar_14).xyz * scale1) + bias1));\\n ret1_3 = max (vec3(0.0, 0.0, 0.0), ((xlat_mutableneu * \\n (1.0 - (tmpvar_11 * tmpvar_11))\\n ) * 2.0));\\n float tmpvar_15;\\n tmpvar_15 = fract((tmpvar_12 + 0.3333333));\\n mat2 tmpvar_16;\\n tmpvar_16[uint(0)].x = -0.4990803;\\n tmpvar_16[uint(0)].y = -0.8665558;\\n tmpvar_16[1u].x = 0.8665558;\\n tmpvar_16[1u].y = -0.4990803;\\n xlat_mutableuv2 = ((uv_1 * (\\n (q13 * tmpvar_15)\\n * tmpvar_16)) * aspect.yx);\\n vec2 tmpvar_17;\\n tmpvar_17 = fract(((xlat_mutableuv2 + 0.5) + ofs_2));\\n xlat_mutableneu = (texture (sampler_main, tmpvar_17).xyz + ((texture (sampler_blur1, tmpvar_17).xyz * scale1) + bias1));\\n ret1_3 = max (ret1_3, ((xlat_mutableneu * \\n (1.0 - (tmpvar_15 * tmpvar_15))\\n ) * 2.0));\\n float tmpvar_18;\\n tmpvar_18 = fract((tmpvar_12 + 0.6666667));\\n mat2 tmpvar_19;\\n tmpvar_19[uint(0)].x = -0.5018377;\\n tmpvar_19[uint(0)].y = 0.8649619;\\n tmpvar_19[1u].x = -0.8649619;\\n tmpvar_19[1u].y = -0.5018377;\\n xlat_mutableuv2 = ((uv_1 * (\\n (q13 * tmpvar_18)\\n * tmpvar_19)) * aspect.yx);\\n vec2 tmpvar_20;\\n tmpvar_20 = fract(((xlat_mutableuv2 + 0.5) + ofs_2));\\n xlat_mutableneu = (texture (sampler_main, tmpvar_20).xyz + ((texture (sampler_blur1, tmpvar_20).xyz * scale1) + bias1));\\n ret1_3 = max (ret1_3, ((xlat_mutableneu * \\n (1.0 - (tmpvar_18 * tmpvar_18))\\n ) * 2.0));\\n float tmpvar_21;\\n tmpvar_21 = fract((tmpvar_12 + 1.0));\\n mat2 tmpvar_22;\\n tmpvar_22[uint(0)].x = 0.9999949;\\n tmpvar_22[uint(0)].y = 0.003185092;\\n tmpvar_22[1u].x = -0.003185092;\\n tmpvar_22[1u].y = 0.9999949;\\n xlat_mutableuv2 = ((uv_1 * (\\n (q13 * tmpvar_21)\\n * tmpvar_22)) * aspect.yx);\\n vec2 tmpvar_23;\\n tmpvar_23 = fract(((xlat_mutableuv2 + 0.5) + ofs_2));\\n xlat_mutableneu = (texture (sampler_main, tmpvar_23).xyz + ((texture (sampler_blur1, tmpvar_23).xyz * scale1) + bias1));\\n ret1_3 = max (ret1_3, ((xlat_mutableneu * \\n (1.0 - (tmpvar_21 * tmpvar_21))\\n ) * 2.0));\\n vec2 tmpvar_24;\\n tmpvar_24.x = (ret1_3.x + ret1_3.z);\\n tmpvar_24.y = (ret1_3.x - ret1_3.y);\\n vec4 tmpvar_25;\\n tmpvar_25.w = 1.0;\\n tmpvar_25.xyz = ((ret1_3 + (\\n ((bass_att * 0.004) / sqrt(dot (uv_1, uv_1)))\\n * roam_sin).xyz) + ((2.0 * \\n (bass_att * ((texture (sampler_blur1, fract(\\n (xlat_mutablerss + (tmpvar_24 / 2.0))\\n )).xyz * scale1) + bias1).zxy)\\n ) * clamp (\\n (1.0 - (ret1_3 * 4.0))\\n , 0.0, 1.0)));\\n ret = tmpvar_25.xyz;\\n }\"}},5:function(a,e){a.exports=function(a){try{return!!a()}catch(a){return!0}}},59:function(a,e){a.exports={baseVals:{rating:4,gammaadj:1,wave_thick:1,wrap:0,wave_a:.004,wave_scale:9.731,wave_smoothing:0,wave_mystery:1,modwavealphastart:1,modwavealphaend:1,warpanimspeed:.442,warpscale:7.315,zoomexp:1.50374,warp:.08563,wave_y:.04,ob_size:0,ob_g:1,ob_a:1,ib_size:0,ib_r:1,ib_g:0,ib_b:.75,ib_a:1,mv_x:64,mv_y:48,mv_l:0,mv_b:0,mv_a:0,b1ed:0},shapes:[{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:1,sides:3,additive:1,num_inst:400,rad:.16283,tex_zoom:.73458,g:1,b:1,a:.5,g2:0,border_a:0},init_eqs_str:\"a.bending=0;a.ppo=0;a.index=0;a.i3=0;a.dir=0;a.i4=0;a.size=0;a.q2=0;a.q32=0;a.sample=0;a.i3=0;a.i4=0;\",frame_eqs_str:\"a.i3=.00001b;b++)a.gmegabuf[Math.floor(a.i)]=0,a.i+=1;a.count=50;a.attributes=32;a.nliststart=24;a.minradius=.004;a.maxradius=.04;a.v=0;for(b=a.index=0;ba.q2?1:0))]*(1-a.dec);a.gmegabuf[Math.floor(a.n+1E4)]=.2*a.gmegabuf[Math.floor(a.n+1E4)]+div(.8*a.vol,3);a.a=0;a.x=a.sample;a.y=.2+.23*a.gmegabuf[Math.floor(a.n+0)];\"},{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:0}}],init_eqs_str:\"a.n=0;a.sw2=0;a.in1=0;a.q12=0;a.q13=0;a.sw3=0;a.dif=0;a.q1=0;a.lev3=0;a.flen=0;a.lev4=0;a.in2=0;a.lev1=0;a.k1=0;a.q11=0;a.ofs=0;a.dec_m=0;a.i=0;a.k=0;a.m2=0;a.vol=0;a.q2=0;a.slen=0;a.m1=0;a.q14=0;a.sw1=0;a.lev2=0;a.q3=0;a.reg00=0;a.vol_=0;a.dec=0;a.q32=0;a.sw4=0;for(var b=a.n=0;5E4>b;b++)a.gmegabuf[Math.floor(a.n)]=0,a.megabuf[Math.floor(a.n)]=0,a.n+=1;a.sw1=randint(8);a.sw2=randint(8);a.sw3=randint(8);a.sw4=randint(8);\",frame_eqs_str:\"a.flen=512;a.reg00=a.flen;a.slen=div(a.flen,2);a.dec_m=pow(.94,div(30,a.fps));a.n=0;for(var b=a.vol=0;ba.in1*a.in1+a.in2*a.in2?1:0)?.8:.94,a.dec=pow(a.dec,div(30,a.fps)),a.gmegabuf[Math.floor(2E3+a.n)]=a.gmegabuf[Math.floor(2E3+a.n)]*a.dec+(1-a.dec)*a.in1,a.gmegabuf[Math.floor(2E3+a.flen+a.n)]=a.gmegabuf[Math.floor(2E3+a.flen+a.n)]*a.dec+(1-a.dec)*a.in2,a.n+=1;a.q1=div(a.bass+a.treb+a.mid,3);a.q2=div(a.bass_att+a.treb_att+a.mid_att,3);a.q3=a.vol_;a.q11=a.sw1;a.q12=a.sw2;a.q13=\\na.sw3;a.q14=a.sw4;a.rot=0;a.zoom=.98;a.warp=.3;a.rot=0;a.q32=a.aspecty;a.monitor=a.dif;\",pixel_eqs_str:\"\",pixel_eqs:\"\",warp:\" shader_body { \\n vec4 tmpvar_1;\\n tmpvar_1.w = 1.0;\\n tmpvar_1.xyz = ((texture (sampler_main, uv).xyz * clamp (\\n (q1 - 0.8)\\n , 0.0, 1.0)) * 0.92);\\n ret = tmpvar_1.xyz;\\n }\",comp:\" shader_body { \\n vec3 ret_1;\\n ret_1 = (texture (sampler_main, uv).xyz + ((texture (sampler_blur2, uv).xyz * scale2) + bias2));\\n ret_1 = (ret_1 + ((0.8 * \\n (hue_shader - 0.8)\\n ) * (1.0 - uv.y)));\\n vec4 tmpvar_2;\\n tmpvar_2.w = 1.0;\\n tmpvar_2.xyz = ret_1;\\n ret = tmpvar_2.xyz;\\n }\"}},9:function(a,e,t){t(10);var n=t(3).Object;a.exports=function(a,e,t){return n.defineProperty(a,e,t)}},92:function(a,e){a.exports={baseVals:{rating:5,gammaadj:1.98,decay:.5,echo_zoom:.952,echo_alpha:.5,echo_orient:3,wave_mode:5,additivewave:1,wave_thick:1,modwavealphabyvolume:1,wave_brighten:0,darken:1,wave_a:.001,wave_scale:.474,wave_smoothing:.45,modwavealphastart:0,modwavealphaend:1.32,warpanimspeed:1.459,warpscale:2.007,zoom:.9999,warp:.01,sx:.9999,wave_r:.8,wave_g:.49,ob_size:0,ob_a:.3,ib_size:.26,mv_x:64,mv_y:48,mv_l:1.85,mv_r:.5,mv_g:.5,mv_b:.5,mv_a:0,b1x:.8,b1ed:0},shapes:[{baseVals:{enabled:1,sides:7,additive:1,num_inst:1024,rad:.04896,tex_ang:1.00531,tex_zoom:1.53117,r:0,g:1,b:1,a:0,g2:0,border_b:0,border_a:0},init_eqs_str:\"a.max_age=0;a.n=0;a.x0=0;a.y0=0;a.z0=0;a.rad0=0;\",frame_eqs_str:\"a.max_age=a.reg00;a.n=12*a.instance;a.x0=a.gmegabuf[Math.floor(a.n)];a.y0=a.gmegabuf[Math.floor(a.n+1)];a.z0=a.gmegabuf[Math.floor(a.n+2)];.00001a.z0?1:0)?(a.rad=0,a.gmegabuf[Math.floor(a.n+8)]=a.max_age):(a.rad0=div(pow(1-div(a.gmegabuf[Math.floor(a.n+8)],a.max_age),.2),a.z0)*a.gmegabuf[Math.floor(a.n+7)]+.01,a.rad=.032*Math.abs(a.rad0),a.x=.5+div(a.x0,a.z0),a.y=.5+div(a.y0,a.z0));a.a=1;a.a2=.2;a.g=.8;a.g2=0;a.b=.2*(3a.z0?1:0);a.b2=0;\\n\"},{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:0}}],waves:[{baseVals:{enabled:1,samples:160,sep:20,usedots:1,additive:1,scaling:7.858,smoothing:.1,r:.2,g:.3,a:.6},init_eqs_str:\"a.q32=0;\",frame_eqs_str:\"\",point_eqs_str:\"a.x=div(randint(100),100);a.y=.5-div(1-.7,a.q32)-.15*(div(randint(100),100)-.5);a.a=.15;a.r=0;a.b=1;a.g=0;\"},{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:0}}],init_eqs_str:'a.max_age=0;a.ind2=0;a.n=0;a.free=0;a.high=0;a.index=0;a.tht=0;a.v00=0;a.yobf=0;a.dt=0;a.y0=0;a.q1=0;a.dec_med=0;a.q5=0;a.ran1_=0;a[\"new\"]=0;a.push=0;a.new1=0;a.is_beat=0;a.q24=0;a.vol_alt=0;a.dec_slow=0;a.ran2=0;a.ind1=0;a.q10=0;a.v0=0;a.med=0;a.beat=0;a.vol=0;a.peak=0;a.dec_fast=0;a.q27=0;a.bass1=0;a.q3=0;a.t0=0;a.vol_=0;a.dec=0;a.m=0;a.ran1=0;a.q32=0;a.phi=0;a.air=0;a.max_age=4.5;a.reg00=a.max_age;for(var b=a.n=0;12288>b;b++)a.gmegabuf[Math.floor(a.n)]=a.max_age-1+randint(2),\\na.n+=1;a.q9=2*(randint(25)-10);a.q3=div(randint(100),100);a.q4=div(randint(100),100);',frame_eqs_str:'a.dec_fast=1-div(8.8,a.fps);a.dec_med=1-div(6,a.fps);a.dec_slow=1-div(1.6,a.fps);a.vol=div(a.bass+a.med+a.treb,3);a.vol_=a.vol_*a.dec_slow+(1-a.dec_slow)*a.vol;a.beat=a.vol;a.is_beat=above(a.beat,1+4*a.peak)*above(a.time,a.t0+.2);a.t0=.00001b;b++)a.megabuf[Math.floor(a.n)]=a.gmegabuf[Math.floor(a.n)],a.megabuf[Math.floor(a.n+1)]=a.gmegabuf[Math.floor(a.n+\\n1)],a.megabuf[Math.floor(a.n+2)]=a.gmegabuf[Math.floor(a.n+2)],.00001a.max_age?1:0)?.00001=10*a.dt*bnot(a.high)?1:0,200>a[\"new\"]?1:0))?(--a.free,a[\"new\"]+=1,a.tht=div(randint(100),500)*(1+1.5*a.high),a.phi=randint(12),a.v0=a.v00*(1+div(randint(10),40)),a.gmegabuf[Math.floor(a.n)]=1.7*a.ran1,a.gmegabuf[Math.floor(a.n+1)]=a.y0+2.2*a.high,a.gmegabuf[Math.floor(a.n+2)]=2,a.gmegabuf[Math.floor(a.n+3)]=a.v0*Math.sin(a.tht)*Math.cos(a.phi),a.gmegabuf[Math.floor(a.n+\\n4)]=a.v0*Math.cos(4*a.tht)*(1-1.5*a.high),a.gmegabuf[Math.floor(a.n+5)]=a.v0*Math.sin(a.tht)*Math.sin(a.phi)*1.5*a.vol,a.gmegabuf[Math.floor(a.n+7)]=0,a.gmegabuf[Math.floor(a.n+8)]=div(randint(100),100)):0:(--a.free,a.gmegabuf[Math.floor(a.n)]+=a.gmegabuf[Math.floor(a.n+3)]*a.dt,a.gmegabuf[Math.floor(a.n+1)]+=a.gmegabuf[Math.floor(a.n+4)]*a.dt,a.gmegabuf[Math.floor(a.n+2)]+=a.gmegabuf[Math.floor(a.n+5)]*a.dt,a.gmegabuf[Math.floor(a.n+3)]*=1-a.air,a.gmegabuf[Math.floor(a.n+4)]*=1-a.air,a.gmegabuf[Math.floor(a.n+\\n4)]-=.8*a.dt,a.gmegabuf[Math.floor(a.n+5)]*=1-a.air,a.gmegabuf[Math.floor(a.n+7)]=(a.gmegabuf[Math.floor(a.n+1)]>a.yobf?1:0)*Math.min(1,18*(a.gmegabuf[Math.floor(a.n+1)]-a.yobf)),.00001a.gmegabuf[Math.floor(a.n+4)]?1:0))?a.gmegabuf[8]=a.max_age:0,a.gmegabuf[Math.floor(a.n+8)]+=a.dt),a.n+=12;for(b=a.n=0;512>b;b++)a.m=6132+a.n,a.gmegabuf[Math.floor(a.m)]=div(a.gmegabuf[Math.floor(a.n)]+a.megabuf[Math.floor(a.n)],2),a.gmegabuf[Math.floor(a.m+\\n1)]=div(a.gmegabuf[Math.floor(a.n+1)]+a.megabuf[Math.floor(a.n+1)],2),a.gmegabuf[Math.floor(a.m+2)]=div(a.gmegabuf[Math.floor(a.n+2)]+a.megabuf[Math.floor(a.n+2)],2),a.gmegabuf[Math.floor(a.m+7)]=a.gmegabuf[Math.floor(a.n+7)],a.gmegabuf[Math.floor(a.m+8)]=a.gmegabuf[Math.floor(a.n+8)],a.n+=12;a.dec=.00001a.bass1?1:0)?.5:.9;a.bass1=a.bass1*a.dec+a.bass*(1-a.dec);a.q1=Math.min(1,Math.max(0,a.bass1-1.5)*Math.abs(a.q3-.5)*3);a.q10=Math.max(a.vol_-.1,.1);a.vol_alt=a.vol;a.q32=a.aspecty;\\na.new1=.00001 0.5))))\\n , 0.0, 1.0)));\\n vec3 tmpvar_21;\\n tmpvar_21.z = 0.0;\\n tmpvar_21.xy = (((texture (sampler_blur3, uv_2).xyz * scale3) + bias3).xy * vec2(3.0, 5.0));\\n ret_3 = (ret_3 + ((xlat_mutablesmoke * \\n dot (tmpvar_21, vec3(0.32, 0.49, 0.29))\\n ) * vec3(1.0, 0.84, 0.62)));\\n float tmpvar_22;\\n tmpvar_22 = clamp (((1.2 * \\n clamp (texture (sampler_main, uv_2).y, 0.0, 1.0)\\n ) - 0.2), 0.0, 1.0);\\n vec3 tmpvar_23;\\n tmpvar_23.x = tmpvar_22;\\n tmpvar_23.y = (tmpvar_22 * tmpvar_22);\\n tmpvar_23.z = pow (tmpvar_22, 8.0);\\n vec3 tmpvar_24;\\n tmpvar_24 = clamp ((tmpvar_23 / vec3(0.8, 0.8, 0.8)), 0.0, 1.0);\\n ret_3 = (ret_3 + (tmpvar_24 * (tmpvar_24 * \\n (3.0 - (2.0 * tmpvar_24))\\n )));\\n float tmpvar_25;\\n tmpvar_25 = clamp (0.52, 0.0, 1.0);\\n vec3 tmpvar_26;\\n tmpvar_26.x = tmpvar_25;\\n tmpvar_26.y = (tmpvar_25 * tmpvar_25);\\n tmpvar_26.z = pow (tmpvar_25, 8.0);\\n vec3 tmpvar_27;\\n tmpvar_27 = clamp ((tmpvar_26 / vec3(0.8, 0.8, 0.8)), 0.0, 1.0);\\n vec3 tmpvar_28;\\n tmpvar_28 = mix (clamp (ret_3, 0.0, 1.0), (tmpvar_27 * (tmpvar_27 * \\n (3.0 - (2.0 * tmpvar_27))\\n )), vec3((pow (\\n ((1.0 - uv_2.y) - ((uv_2.x - 0.5) * (q3 - 0.5)))\\n , 4.0) * q1)));\\n ret_3 = tmpvar_28;\\n vec4 tmpvar_29;\\n tmpvar_29.w = 1.0;\\n tmpvar_29.xyz = tmpvar_28;\\n ret = tmpvar_29.xyz;\\n }\"}},98:function(a,e){a.exports={baseVals:{rating:3,gammaadj:1.98,decay:.5,echo_zoom:1,echo_alpha:.5,echo_orient:3,wave_mode:7,additivewave:1,wave_thick:1,modwavealphabyvolume:1,wave_brighten:0,wrap:0,darken:1,wave_a:.001,wave_scale:.958,wave_smoothing:.45,modwavealphastart:0,modwavealphaend:1.32,warpanimspeed:1.459,warpscale:2.007,zoom:.9999,warp:.01,sx:.9999,wave_r:0,wave_g:0,wave_b:0,ob_size:.05,ob_g:.1,ob_b:1,ob_a:1,ib_size:0,ib_r:0,ib_g:0,ib_b:0,mv_x:25.6,mv_y:9.6,mv_l:0,mv_r:.5,mv_g:.5,mv_b:.5,mv_a:0,b1ed:0},shapes:[{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:0}}],waves:[{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:0}},{baseVals:{enabled:0}}],init_eqs_str:\"a.look=0;a.n=0;a.reg26=0;a.uvx0=0;a.reg34=0;a.reg28=0;a.reg23=0;a.q25=0;a.angchg=0;a.reg20=0;a.reg15=0;a.reg10=0;a.q12=0;a.v3=0;a.q22=0;a.q21=0;a.diry=0;a.q13=0;a.q6=0;a.posx=0;a.fps_=0;a.reg25=0;a.uvx=0;a.q1=0;a.travel=0;a.posz=0;a.q5=0;a.dirz=0;a.dec_s=0;a.reg16=0;a.slow=0;a.reg36=0;a.reg22=0;a.uvy=0;a.rotz=0;a.ly=0;a.dist_=0;a.q23=0;a.q24=0;a.reg24=0;a.cran0=0;a.ran2=0;a.q11=0;a.q10=0;a.reg14=0;a.posy=0;a.reg31=0;a.dirx=0;a.q4=0;a.start=0;a.reg12=0;a.reg13=0;a.c2=0;a.reg37=\\n0;a.s3=0;a.yslope=0;a.lampy=0;a.q16=0;a.xslope=0;a.q26=0;a.reg38=0;a.reg35=0;a.reg11=0;a.tx=0;a.avg=0;a.uvz=0;a.c3=0;a.uvy0=0;a.reg27=0;a.q19=0;a.beat=0;a.reg32=0;a.lx=0;a.reg21=0;a.uvz0=0;a.len=0;a.reg18=0;a.reg30=0;a.q2=0;a.q27=0;a.slen=0;a.q14=0;a.dist=0;a.reg17=0;a.v1=0;a.speed=0;a.s1=0;a.t0=0;a.s2=0;a.ran1=0;a.reg33=0;a.q7=0;a.ds=0;a.q28=0;a.lampx=0;a.ty=0;a.c1=0;a.v2=0;a.q20=0;a.q8=0;a.avg=.01;a.q7=.25;a.q8=randint(2)-1;a.q16=1+randint(2);a.q18=randint(.8)+.1;a.q30=1;a.q31=128;a.start=1;a.travel=\\n0;a.rotz=0;a.look=0;a.slow=0;a.t0=a.time+3;a.lampx=.5;a.lampy=.5;a.cran0=randint(1);for(var b=a.n=0;1E4>b;b++)a.gmegabuf[Math.floor(a.n)]=0,a.n+=1;for(b=a.n=0;1E4>b;b++)a.megabuf[Math.floor(a.n)]=0,a.n+=1;a.trelx=0;a.trely=0;a.trelz=0;a.reg20=1;a.reg21=0;a.reg22=0;a.reg23=0;a.reg24=1;a.reg25=0;a.reg26=0;a.reg27=0;a.reg28=1;b=0;do{b+=1;var c;a.ran1=div(randint(800),100);a.ran2=div(randint(800),100);a.ran3=div(randint(800),100);a.posx=randint(5)-2;a.posy=randint(5)-2;a.posz=randint(5)-2;a.c1=Math.cos(a.ran1);\\na.c2=Math.cos(a.ran2);a.c3=Math.cos(a.ran3);a.s1=Math.sin(a.ran1);a.s2=Math.sin(a.ran2);a.s3=Math.sin(a.ran3);a.reg20=a.c2*a.c1;a.reg21=a.c2*a.s1;a.reg22=-a.s2;a.reg23=a.s3*a.s2*a.c1-a.c3*a.s1;a.reg24=a.s3*a.s2*a.s1+a.c3*a.c1;a.reg25=a.s3*a.c2;a.reg26=a.c3*a.s2*a.c1+a.s3*a.s1;a.reg27=a.c3*a.s2*a.s1-a.s3*a.c1;a.reg28=a.c3*a.c2;a.dist=.001;var d=0;do{d+=1;a.uvx=div(a.reg26*a.dist,a.q7);a.uvy=div(a.reg27*a.dist,a.q7);a.uvz=div(a.reg28*a.dist,a.q7);a.uvx+=a.posx;a.uvy+=a.posy;a.uvz+=a.posz;a.uvx=8*(div(a.uvx,\\n8)+30.5-Math.floor(div(a.uvx,8)+30.5)-.5);a.uvy=8*(div(a.uvy,8)+30.5-Math.floor(div(a.uvy,8)+30.5)-.5);a.uvz=8*(div(a.uvz,8)+30.5-Math.floor(div(a.uvz,8)+30.5)-.5);a.uvx0=a.uvx+a.q8;a.uvy0=a.uvy+a.q8;a.uvz0=a.uvz+a.q8;for(c=0;8>c;c++)a.uvx=.00001a.uvx?1:0)?-2-a.uvx:a.uvx,a.uvy=.00001a.uvy?1:0)?-2-a.uvy:a.uvy,a.uvz=.00001a.uvz?1:0)?-2-a.uvz:a.uvz,a.slen=\\na.uvx*a.uvx+a.uvy*a.uvy+a.uvz*a.uvz,a.uvx=2.6*(.00001a.slen?1:0)?4*a.uvx:.00001a.slen?1:0)?div(a.uvx,a.slen):a.uvx)+a.uvx0,a.uvy=2.6*(.00001a.slen?1:0)?4*a.uvy:.00001a.slen?1:0)?div(a.uvy,a.slen):a.uvy)+a.uvy0,a.uvz=2.6*(.00001a.slen?1:0)?4*a.uvz:.00001a.slen?1:0)?div(a.uvz,a.slen):a.uvz)+a.uvz0;a.len=sqrt(a.uvx*a.uvx+a.uvy*a.uvy+a.uvz*a.uvz);a.dist*=1.05;c=(.6>a.dist?1:0)*(30\\nd);d=.06>a.dist?1:0}while(.00001b);\",frame_eqs_str:\"a.fps_=0*a.fps_+1*(.00001=a.fps?1:0)?a.fps:25+.5*(a.fps-25));a.dec_s=1-div(.06*30,a.fps_);a.beat=a.time>a.t0+3?1:0;a.t0=.00001Math.abs(a.rotz-0)?1:0)?a.beat*(randint(100)<20*a.travel?1:0)*(div(randint(10),10)-.3):bnot(a.beat*(30>randint(100)?1:0))*a.rotz;a.slow=.00001randint(1E3*a.avg)?1:0):bnot(a.beat*(50>randint(100)?1:0));a.look=.00001randint(1E3*a.speed)?1:0):bnot(a.beat*(50>randint(100)?1:0));a.lx=.00001a.dist_?1:0)*2;a.travel=.00001b;b++){a.n+=1;a.ran1=div(randint(100),100);a.ran2=div(randint(100),200)-.25;a.tx=Math.cos(1.57*a.n+a.ran2)*(4>=a.n?1:0)*a.ran1;a.ty=Math.sin(1.57*a.n+a.ran2)*(4>=a.n?1:0)*a.ran1;a.c1=Math.cos(a.v1);a.c2=Math.cos(a.v2+a.ty);a.c3=Math.cos(a.v3+a.tx);a.s1=Math.sin(a.v1);a.s2=Math.sin(a.v2+a.ty);a.s3=Math.sin(a.v3+a.tx);a.reg10=a.c2*a.c1;a.reg11=a.c2*a.s1;a.reg12=-a.s2;a.reg13=a.s3*a.s2*a.c1-a.c3*a.s1;a.reg14=a.s3*a.s2*a.s1+a.c3*a.c1;a.reg15=a.s3*\\na.c2;a.reg16=a.c3*a.s2*a.c1+a.s3*a.s1;a.reg17=a.c3*a.s2*a.s1-a.s3*a.c1;a.reg18=a.c3*a.c2;a.reg20=a.reg30;a.reg21=a.reg31;a.reg22=a.reg32;a.reg23=a.reg33;a.reg24=a.reg34;a.reg25=a.reg35;a.reg26=a.reg36;a.reg27=a.reg37;a.reg28=a.reg38;a.q20=a.reg10*a.reg20+a.reg11*a.reg23+a.reg12*a.reg26;a.q21=a.reg10*a.reg21+a.reg11*a.reg24+a.reg12*a.reg27;a.q22=a.reg10*a.reg22+a.reg11*a.reg25+a.reg12*a.reg28;a.q23=a.reg13*a.reg20+a.reg14*a.reg23+a.reg15*a.reg26;a.q24=a.reg13*a.reg21+a.reg14*a.reg24+a.reg15*a.reg27;\\na.q25=a.reg13*a.reg22+a.reg14*a.reg25+a.reg15*a.reg28;a.q26=a.reg16*a.reg20+a.reg17*a.reg23+a.reg18*a.reg26;a.q27=a.reg16*a.reg21+a.reg17*a.reg24+a.reg18*a.reg27;a.q28=a.reg16*a.reg22+a.reg17*a.reg25+a.reg18*a.reg28;a.reg20=a.q20;a.reg21=a.q21;a.reg22=a.q22;a.reg23=a.q23;a.reg24=a.q24;a.reg25=a.q25;a.reg26=a.q26;a.reg27=a.q27;a.reg28=a.q28;a.dist=.002;var c,d=0;do{d+=1;a.uvx=div(a.reg26*a.dist,a.q7);a.uvy=div(a.reg27*a.dist,a.q7);a.uvz=div(a.reg28*a.dist,a.q7);a.uvx+=a.posx;a.uvy+=a.posy;a.uvz+=a.posz;\\na.uvx=8*(div(a.uvx,8)+30.5-Math.floor(div(a.uvx,8)+30.5)-.5);a.uvy=8*(div(a.uvy,8)+30.5-Math.floor(div(a.uvy,8)+30.5)-.5);a.uvz=8*(div(a.uvz,8)+30.5-Math.floor(div(a.uvz,8)+30.5)-.5);a.uvx0=a.uvx+a.q8;a.uvy0=a.uvy+a.q8;a.uvz0=a.uvz+a.q8;for(c=0;8>c;c++)a.uvx=.00001a.uvx?1:0)?-2-a.uvx:a.uvx,a.uvy=.00001a.uvy?1:0)?-2-a.uvy:a.uvy,a.uvz=.00001a.uvz?1:0)?\\n-2-a.uvz:a.uvz,a.slen=a.uvx*a.uvx+a.uvy*a.uvy+a.uvz*a.uvz,a.uvx=2.6*(.00001a.slen?1:0)?4*a.uvx:.00001a.slen?1:0)?div(a.uvx,a.slen):a.uvx)+a.uvx0,a.uvy=2.6*(.00001a.slen?1:0)?4*a.uvy:.00001a.slen?1:0)?div(a.uvy,a.slen):a.uvy)+a.uvy0,a.uvz=2.6*(.00001a.slen?1:0)?4*a.uvz:.00001a.slen?1:0)?div(a.uvz,a.slen):a.uvz)+a.uvz0;a.len=sqrt(a.uvx*a.uvx+a.uvy*a.uvy+a.uvz*a.uvz);a.dist*=1.1;c=(.6>a.dist?1:0)*(30d);a.megabuf[Math.floor(a.n)]=a.megabuf[Math.floor(a.n)]*a.dec_s+(1-a.dec_s)*a.dist;a.avg+=Math.abs(div(a.megabuf[Math.floor(a.n)],5))}a.n=0;for(b=a.avg=0;5>b;b++)a.n+=1,a.avg+=Math.abs(div(a.megabuf[Math.floor(a.n)],5));a.xslope=Math.min(Math.max(div(2,a.avg)*(a.megabuf[1]-a.megabuf[3]),-3),3);a.yslope=Math.min(Math.max(div(2,a.avg)*(a.megabuf[4]-a.megabuf[2]),-3),3);a.monitor=a.avg;a.dist_=a.dist_*a.dec_s+(1-a.dec_s)*a.dist;a.q10=a.ds*a.q7;a.q14=Math.abs(a.ds)+2*(Math.abs(a.v1)+\\nMath.abs(a.v2)+Math.abs(a.v3))+div(1,255)+.05*a.start;a.q19=.6+.4*Math.sin(.02*a.time+6*a.cran0);a.start*=.9;a.q11=a.v1;a.q12=a.v2;a.q13=a.v3;a.monitor=a.q16;\",pixel_eqs_str:\"a.warp=0;a.zoom=1;a.dx=div(-a.q12,a.q16)*(1+0*pow(a.x-.5,2));a.dy=div(a.q13,a.q16)*(1+0*pow(a.y-.5,2));a.rot=a.q11;\",warp:\"float sustain;\\nfloat xlat_mutabledist;\\nfloat xlat_mutablestruc;\\nvec2 xlat_mutableuv1;\\nvec3 xlat_mutableuv2;\\n shader_body { \\n mat3 tmpvar_1;\\n tmpvar_1[uint(0)].x = q20;\\n tmpvar_1[uint(0)].y = q23;\\n tmpvar_1[uint(0)].z = q26;\\n tmpvar_1[1u].x = q21;\\n tmpvar_1[1u].y = q24;\\n tmpvar_1[1u].z = q27;\\n tmpvar_1[2u].x = q22;\\n tmpvar_1[2u].y = q25;\\n tmpvar_1[2u].z = q28;\\n vec3 tmpvar_2;\\n tmpvar_2.x = q4;\\n tmpvar_2.y = q5;\\n tmpvar_2.z = q6;\\n sustain = (0.98 - q14);\\n vec2 uv_3;\\n vec3 ret_4;\\n vec2 tmpvar_5;\\n tmpvar_5 = (uv - 0.5);\\n xlat_mutableuv1 = ((tmpvar_5 * aspect.xy) * q16);\\n vec4 tmpvar_6;\\n tmpvar_6 = texture (sampler_pc_main, uv);\\n uv_3 = ((tmpvar_5 * (1.0 - \\n (q10 / (1.0 - ((tmpvar_6.z + \\n (0.003921569 * tmpvar_6.y)\\n ) + (q10 * 0.7))))\\n )) + 0.5);\\n vec4 tmpvar_7;\\n tmpvar_7 = fract((8.0 * texture (sampler_noise_lq, (uv_3 + rand_frame.yz))));\\n xlat_mutabledist = tmpvar_7.x;\\n if ((tmpvar_7.y > 0.2)) {\\n vec3 tmpvar_8;\\n tmpvar_8 = (tmpvar_7.xyz - vec3(0.4, 0.5, 0.5));\\n vec2 uvi_9;\\n uvi_9 = ((tmpvar_8.zy * 0.003) + uv_3);\\n vec2 pix_10;\\n vec4 nb2_11;\\n vec4 nb_12;\\n vec2 x_13;\\n x_13 = (uvi_9 - 0.5);\\n pix_10 = (texsize.zw * (1.0 + (\\n sqrt(dot (x_13, x_13))\\n * 8.0)));\\n float tmpvar_14;\\n tmpvar_14 = (q10 * 0.7);\\n vec4 tmpvar_15;\\n tmpvar_15 = texture (sampler_pc_main, (uvi_9 - pix_10));\\n nb_12.x = (1.0 - ((tmpvar_15.z + \\n (0.003921569 * tmpvar_15.y)\\n ) + tmpvar_14));\\n vec4 tmpvar_16;\\n tmpvar_16 = texture (sampler_pc_main, (uvi_9 + (pix_10 * vec2(1.0, -1.0))));\\n nb_12.y = (1.0 - ((tmpvar_16.z + \\n (0.003921569 * tmpvar_16.y)\\n ) + tmpvar_14));\\n vec4 tmpvar_17;\\n tmpvar_17 = texture (sampler_pc_main, (uvi_9 + pix_10));\\n nb_12.z = (1.0 - ((tmpvar_17.z + \\n (0.003921569 * tmpvar_17.y)\\n ) + tmpvar_14));\\n vec4 tmpvar_18;\\n tmpvar_18 = texture (sampler_pc_main, (uvi_9 + (pix_10 * vec2(-1.0, 1.0))));\\n nb_12.w = (1.0 - ((tmpvar_18.z + \\n (0.003921569 * tmpvar_18.y)\\n ) + tmpvar_14));\\n vec4 tmpvar_19;\\n tmpvar_19 = texture (sampler_pc_main, (uvi_9 + (pix_10 * vec2(0.0, -1.0))));\\n nb2_11.x = (1.0 - ((tmpvar_19.z + \\n (0.003921569 * tmpvar_19.y)\\n ) + tmpvar_14));\\n vec4 tmpvar_20;\\n tmpvar_20 = texture (sampler_pc_main, (uvi_9 + (pix_10 * vec2(1.0, 0.0))));\\n nb2_11.y = (1.0 - ((tmpvar_20.z + \\n (0.003921569 * tmpvar_20.y)\\n ) + tmpvar_14));\\n vec4 tmpvar_21;\\n tmpvar_21 = texture (sampler_pc_main, (uvi_9 + (pix_10 * vec2(0.0, 1.0))));\\n nb2_11.z = (1.0 - ((tmpvar_21.z + \\n (0.003921569 * tmpvar_21.y)\\n ) + tmpvar_14));\\n vec4 tmpvar_22;\\n tmpvar_22 = texture (sampler_pc_main, (uvi_9 + (pix_10 * vec2(-1.0, 0.0))));\\n nb2_11.w = (1.0 - ((tmpvar_22.z + \\n (0.003921569 * tmpvar_22.y)\\n ) + tmpvar_14));\\n vec4 tmpvar_23;\\n tmpvar_23 = min (nb_12, nb2_11);\\n nb_12.zw = tmpvar_23.zw;\\n nb_12.xy = min (tmpvar_23.xy, tmpvar_23.zw);\\n xlat_mutabledist = (min (nb_12.x, nb_12.y) + ((0.008 * tmpvar_8.x) * abs(tmpvar_8.y)));\\n };\\n vec4 tmpvar_24;\\n tmpvar_24 = texture (sampler_pc_main, uv_3);\\n float tmpvar_25;\\n tmpvar_25 = min (xlat_mutabledist, (1.0 - (\\n (tmpvar_24.z + (0.003921569 * tmpvar_24.y))\\n + \\n (q10 * 0.7)\\n )));\\n xlat_mutabledist = tmpvar_25;\\n float tmpvar_26;\\n tmpvar_26 = (tmpvar_25 + pow (tmpvar_25, 3.0));\\n vec3 tmpvar_27;\\n tmpvar_27.xy = (xlat_mutableuv1 * tmpvar_26);\\n tmpvar_27.z = tmpvar_26;\\n xlat_mutableuv2 = (((tmpvar_27 / q7) * tmpvar_1) + tmpvar_2);\\n xlat_mutableuv2 = ((fract(\\n ((xlat_mutableuv2 / 8.0) + 0.5)\\n ) - 0.5) * 8.0);\\n float li_28;\\n vec3 zz0_29;\\n vec3 zz_30;\\n zz0_29 = (xlat_mutableuv2 + q8);\\n li_28 = 0.0;\\n zz_30 = ((2.0 * clamp (xlat_mutableuv2, vec3(-1.0, -1.0, -1.0), vec3(1.0, 1.0, 1.0))) - xlat_mutableuv2);\\n float tmpvar_31;\\n tmpvar_31 = dot (zz_30, zz_30);\\n if ((tmpvar_31 <= 0.25)) {\\n zz_30 = (zz_30 * 4.0);\\n li_28 = 24.0;\\n } else {\\n if ((tmpvar_31 <= 1.0)) {\\n zz_30 = (zz_30 / tmpvar_31);\\n };\\n };\\n zz_30 = ((2.6 * zz_30) + zz0_29);\\n zz_30 = ((2.0 * clamp (zz_30, vec3(-1.0, -1.0, -1.0), vec3(1.0, 1.0, 1.0))) - zz_30);\\n float tmpvar_32;\\n tmpvar_32 = dot (zz_30, zz_30);\\n if ((tmpvar_32 <= 0.25)) {\\n zz_30 = (zz_30 * 4.0);\\n li_28 = 24.0;\\n } else {\\n if ((tmpvar_32 <= 1.0)) {\\n zz_30 = (zz_30 / tmpvar_32);\\n };\\n };\\n zz_30 = ((2.6 * zz_30) + zz0_29);\\n zz_30 = ((2.0 * clamp (zz_30, vec3(-1.0, -1.0, -1.0), vec3(1.0, 1.0, 1.0))) - zz_30);\\n float tmpvar_33;\\n tmpvar_33 = dot (zz_30, zz_30);\\n if ((tmpvar_33 <= 0.25)) {\\n zz_30 = (zz_30 * 4.0);\\n li_28 = 24.0;\\n } else {\\n if ((tmpvar_33 <= 1.0)) {\\n zz_30 = (zz_30 / tmpvar_33);\\n };\\n };\\n zz_30 = ((2.6 * zz_30) + zz0_29);\\n zz_30 = ((2.0 * clamp (zz_30, vec3(-1.0, -1.0, -1.0), vec3(1.0, 1.0, 1.0))) - zz_30);\\n float tmpvar_34;\\n tmpvar_34 = dot (zz_30, zz_30);\\n if ((tmpvar_34 <= 0.25)) {\\n zz_30 = (zz_30 * 4.0);\\n li_28 = 24.0;\\n } else {\\n if ((tmpvar_34 <= 1.0)) {\\n zz_30 = (zz_30 / tmpvar_34);\\n };\\n };\\n zz_30 = ((2.6 * zz_30) + zz0_29);\\n zz_30 = ((2.0 * clamp (zz_30, vec3(-1.0, -1.0, -1.0), vec3(1.0, 1.0, 1.0))) - zz_30);\\n float tmpvar_35;\\n tmpvar_35 = dot (zz_30, zz_30);\\n if ((tmpvar_35 <= 0.25)) {\\n zz_30 = (zz_30 * 4.0);\\n li_28 = 24.0;\\n } else {\\n if ((tmpvar_35 <= 1.0)) {\\n zz_30 = (zz_30 / tmpvar_35);\\n };\\n };\\n zz_30 = ((2.6 * zz_30) + zz0_29);\\n zz_30 = ((2.0 * clamp (zz_30, vec3(-1.0, -1.0, -1.0), vec3(1.0, 1.0, 1.0))) - zz_30);\\n float tmpvar_36;\\n tmpvar_36 = dot (zz_30, zz_30);\\n if ((tmpvar_36 <= 0.25)) {\\n zz_30 = (zz_30 * 4.0);\\n li_28 = 24.0;\\n } else {\\n if ((tmpvar_36 <= 1.0)) {\\n zz_30 = (zz_30 / tmpvar_36);\\n };\\n };\\n zz_30 = ((2.6 * zz_30) + zz0_29);\\n zz_30 = ((2.0 * clamp (zz_30, vec3(-1.0, -1.0, -1.0), vec3(1.0, 1.0, 1.0))) - zz_30);\\n float tmpvar_37;\\n tmpvar_37 = dot (zz_30, zz_30);\\n if ((tmpvar_37 <= 0.25)) {\\n zz_30 = (zz_30 * 4.0);\\n li_28 = 24.0;\\n } else {\\n if ((tmpvar_37 <= 1.0)) {\\n zz_30 = (zz_30 / tmpvar_37);\\n };\\n };\\n zz_30 = ((2.6 * zz_30) + zz0_29);\\n zz_30 = ((2.0 * clamp (zz_30, vec3(-1.0, -1.0, -1.0), vec3(1.0, 1.0, 1.0))) - zz_30);\\n float tmpvar_38;\\n tmpvar_38 = dot (zz_30, zz_30);\\n if ((tmpvar_38 <= 0.25)) {\\n zz_30 = (zz_30 * 4.0);\\n li_28 = 24.0;\\n } else {\\n if ((tmpvar_38 <= 1.0)) {\\n zz_30 = (zz_30 / tmpvar_38);\\n };\\n };\\n zz_30 = ((2.6 * zz_30) + zz0_29);\\n vec4 tmpvar_39;\\n tmpvar_39.xyz = zz_30;\\n tmpvar_39.w = li_28;\\n float tmpvar_40;\\n tmpvar_40 = sqrt(dot (zz_30, zz_30));\\n xlat_mutablestruc = (sqrt(dot (tmpvar_39.xyw, tmpvar_39.xyw)) / 24.0);\\n vec4 tmpvar_41;\\n tmpvar_41 = texture (sampler_pc_main, uv_3);\\n float tmpvar_42;\\n float tmpvar_43;\\n tmpvar_43 = (q10 * 0.7);\\n tmpvar_42 = ((log(\\n (1.0 + (tmpvar_40 / 24.0))\\n ) * 0.02) * (1.0 - (1.0 - \\n ((tmpvar_41.z + (0.003921569 * tmpvar_41.y)) + tmpvar_43)\\n )));\\n float tmpvar_44;\\n vec4 tmpvar_45;\\n tmpvar_45 = texture (sampler_pc_main, uv_3);\\n tmpvar_44 = (1.0 - ((tmpvar_45.z + \\n (0.003921569 * tmpvar_45.y)\\n ) + tmpvar_43));\\n if ((((tmpvar_25 <= tmpvar_44) && (tmpvar_40 < 24.0)) && (tmpvar_25 > 0.005))) {\\n ret_4.x = (((1.0 - sustain) * xlat_mutablestruc) + (sustain * mix (texture (sampler_main, uv_3).xyz, \\n ((texture (sampler_blur1, uv_3).xyz * scale1) + bias1)\\n , vec3(\\n (q14 * 4.0)\\n )).x));\\n float x_46;\\n x_46 = ((1.0 - tmpvar_25) * 255.0);\\n float ip_47;\\n ip_47 = float(int(x_46));\\n vec2 tmpvar_48;\\n tmpvar_48.x = (x_46 - ip_47);\\n tmpvar_48.y = (ip_47 / 255.0);\\n ret_4.yz = tmpvar_48;\\n } else {\\n vec3 tmpvar_49;\\n tmpvar_49.y = 0.0;\\n tmpvar_49.x = sustain;\\n tmpvar_49.z = (1.0 - tmpvar_42);\\n vec3 tmpvar_50;\\n tmpvar_50.xy = vec2(0.003921569, 0.0);\\n tmpvar_50.z = (q14 / 6.0);\\n ret_4 = ((texture (sampler_fc_main, uv_3).xyz * tmpvar_49) - tmpvar_50);\\n };\\n vec4 tmpvar_51;\\n tmpvar_51.w = 1.0;\\n tmpvar_51.xyz = ret_4;\\n ret = tmpvar_51.xyz;\\n }\",comp:\" shader_body { \\n vec3 tmpvar_1;\\n tmpvar_1.x = q4;\\n tmpvar_1.y = q5;\\n tmpvar_1.z = q6;\\n mat3 tmpvar_2;\\n tmpvar_2[uint(0)].x = q20;\\n tmpvar_2[uint(0)].y = q23;\\n tmpvar_2[uint(0)].z = q26;\\n tmpvar_2[1u].x = q21;\\n tmpvar_2[1u].y = q24;\\n tmpvar_2[1u].z = q27;\\n tmpvar_2[2u].x = q22;\\n tmpvar_2[2u].y = q25;\\n tmpvar_2[2u].z = q28;\\n vec2 tmpvar_3;\\n tmpvar_3.x = q1;\\n tmpvar_3.y = q2;\\n vec2 uv_4;\\n vec3 ret_5;\\n uv_4 = (((uv - 0.5) * 0.9) + 0.5);\\n vec3 tmpvar_6;\\n tmpvar_6.xy = ((uv_4 - 0.5) * min ((1.0 - texture (sampler_main, uv_4).z), (1.0 - \\n ((texture (sampler_blur2, uv_4).xyz * scale2) + bias2)\\n .z)));\\n tmpvar_6.z = min ((1.0 - texture (sampler_main, uv_4).z), (1.0 - (\\n (texture (sampler_blur2, uv_4).xyz * scale2)\\n + bias2).z));\\n float tmpvar_7;\\n tmpvar_7 = clamp ((abs(\\n ((1.0 - ((texture (sampler_blur2, uv_4).xyz * scale2) + bias2).z) - clamp ((1.0 - (\\n (texture (sampler_blur2, tmpvar_3).xyz * scale2)\\n + bias2).z), 0.1, 0.4))\\n ) + 0.2), 0.0, 1.0);\\n float tmpvar_8;\\n tmpvar_8 = clamp (((1.0 - \\n exp(-(((texture (sampler_blur1, uv_4).xyz * scale1) + bias1).x))\\n ) - 0.2), 0.0, 1.0);\\n ret_5 = ((mix (texture (sampler_main, uv_4).xyz, \\n ((texture (sampler_blur1, uv_4).xyz * scale1) + bias1)\\n , vec3(tmpvar_7)).x * (0.2 + \\n ((1.0 - tmpvar_7) * (1.0 - min ((1.0 - texture (sampler_main, uv_4).z), (1.0 - \\n ((texture (sampler_blur2, uv_4).xyz * scale2) + bias2)\\n .z))))\\n )) * (1.0 + (0.5 * \\n sin((((tmpvar_6 / q7) * tmpvar_2) + tmpvar_1))\\n )));\\n vec3 tmpvar_9;\\n tmpvar_9.xy = vec2(0.0, 1.0);\\n tmpvar_9.z = (tmpvar_8 * 3.0);\\n ret_5 = (mix (ret_5, tmpvar_9, vec3(tmpvar_8)) + ((\\n pow ((1.0 - mix (texture (sampler_main, uv_4).xyz, (\\n (texture (sampler_blur1, uv_4).xyz * scale1)\\n + bias1), vec3(0.8, 0.8, 0.8)).z), 3.0)\\n * \\n (0.5 + (0.5 * slow_roam_cos))\\n ) * q19).xyz);\\n ret_5 = (1.0 - exp((-2.0 * ret_5)));\\n vec4 tmpvar_10;\\n tmpvar_10.w = 1.0;\\n tmpvar_10.xyz = ret_5;\\n ret = tmpvar_10.xyz;\\n }\"}}})});" diff --git a/packages/mobile/src/components/queue-drawer/QueueDrawer.tsx b/packages/mobile/src/components/queue-drawer/QueueDrawer.tsx index adb67288e03..5f85f468493 100644 --- a/packages/mobile/src/components/queue-drawer/QueueDrawer.tsx +++ b/packages/mobile/src/components/queue-drawer/QueueDrawer.tsx @@ -7,7 +7,7 @@ import type { QueueSource } from '@audius/common/store' import { playbackActions, playbackSelectors } from '@audius/common/store' import { useQueryClient } from '@tanstack/react-query' import { make, useRecord } from 'common/store/analytics/actions' -import { Dimensions, Pressable, View } from 'react-native' +import { Pressable, useWindowDimensions, View } from 'react-native' import DraggableFlatList from 'react-native-draggable-flatlist' import { useDispatch, useSelector } from 'react-redux' @@ -44,8 +44,6 @@ const { const DRAWER_NAME = 'Queue' -const SCREEN_HEIGHT = Dimensions.get('window').height -const COLLAPSED_HEIGHT = Math.round(SCREEN_HEIGHT * 0.85) const ROW_HEIGHT = 64 const messages = { @@ -90,7 +88,7 @@ type RowProps = { onDragHandleLongPress?: () => void } -const MiniTrackRow = ({ +export const MiniTrackRow = ({ trackId, variant, isPlaying, @@ -276,6 +274,7 @@ export const QueueDrawer = () => { const index = useSelector(getPlaybackIndex) const isPlaying = useSelector(getIsPlaying) const { spacing, color } = useTheme() + const { height: windowHeight } = useWindowDimensions() const { trackIds: nextFromIds, sourceKey } = useNextFromSourceMobile() const record = useRecord() @@ -531,7 +530,7 @@ export const QueueDrawer = () => { diff --git a/packages/mobile/src/components/suggested-follows/SuggestedFollows.tsx b/packages/mobile/src/components/suggested-follows/SuggestedFollows.tsx index 81e8545a7d6..6c44c344556 100644 --- a/packages/mobile/src/components/suggested-follows/SuggestedFollows.tsx +++ b/packages/mobile/src/components/suggested-follows/SuggestedFollows.tsx @@ -6,7 +6,7 @@ import { usersSocialActions } from '@audius/common/store' import { useQueryClient } from '@tanstack/react-query' import * as signOnActions from 'common/store/pages/signon/actions' import { getFollowIds } from 'common/store/pages/signon/selectors' -import { Dimensions, FlatList, ScrollView, View } from 'react-native' +import { FlatList, ScrollView, useWindowDimensions, View } from 'react-native' import { useDispatch, useSelector } from 'react-redux' import { Text } from 'app/components/core' @@ -15,12 +15,9 @@ import { makeStyles } from 'app/styles' import { ContinueButton } from './ContinueButton' import { SuggestedArtistsList } from './SuggestedArtistsList' -const { height } = Dimensions.get('window') - const useStyles = makeStyles(({ spacing, palette }) => ({ root: { - flex: 1, - height: height - 220 + flex: 1 }, header: { paddingHorizontal: spacing(4), @@ -48,6 +45,7 @@ const messages = { export const SuggestedFollows = () => { const styles = useStyles() + const { height } = useWindowDimensions() const dispatch = useDispatch() const queryClient = useQueryClient() @@ -80,7 +78,7 @@ export const SuggestedFollows = () => { ) return ( - + { const horizontalPadding = Math.max(6 - state.routes.length, 0) * HORIZONTAL_PADDING - const screenWidth = Dimensions.get('screen').width + const screenWidth = useContentWidth() const tabsWidth = screenWidth - horizontalPadding * 2 const tabWidth = tabsWidth / state.routes.length diff --git a/packages/mobile/src/components/top-tab-bar/TopTabBar.tsx b/packages/mobile/src/components/top-tab-bar/TopTabBar.tsx index ceb56a4b83c..f446dc9462d 100644 --- a/packages/mobile/src/components/top-tab-bar/TopTabBar.tsx +++ b/packages/mobile/src/components/top-tab-bar/TopTabBar.tsx @@ -1,6 +1,7 @@ -import { Animated, Dimensions, TouchableOpacity, View } from 'react-native' +import { Animated, TouchableOpacity, View } from 'react-native' import { Text } from '@audius/harmony-native' +import { useContentWidth } from 'app/hooks/useContentWidth' import { makeStyles } from 'app/styles' import { useThemeColors } from 'app/utils/theme' @@ -74,7 +75,7 @@ const useStyles = makeStyles(({ palette, spacing }) => ({ export const TopTabBar = ({ state, descriptors, navigation, position }) => { const horizontalPadding = Math.max(6 - state.routes.length, 0) * HORIZONTAL_PADDING - const screenWidth = Dimensions.get('screen').width + const screenWidth = useContentWidth() const tabsWidth = screenWidth - horizontalPadding * 2 const tabWidth = tabsWidth / state.routes.length diff --git a/packages/mobile/src/hooks/useContentWidth.tsx b/packages/mobile/src/hooks/useContentWidth.tsx new file mode 100644 index 00000000000..aba2c156712 --- /dev/null +++ b/packages/mobile/src/hooks/useContentWidth.tsx @@ -0,0 +1,11 @@ +import { createContext, useContext } from 'react' + +import { useWindowDimensions } from 'react-native' + +export const ContentWidthContext = createContext(null) + +export const useContentWidth = () => { + const { width } = useWindowDimensions() + const contentWidth = useContext(ContentWidthContext) + return contentWidth ?? width +} diff --git a/packages/mobile/src/screens/app-drawer-screen/AppDrawerScreen.tsx b/packages/mobile/src/screens/app-drawer-screen/AppDrawerScreen.tsx index fd370c54084..205d8d7b6ba 100644 --- a/packages/mobile/src/screens/app-drawer-screen/AppDrawerScreen.tsx +++ b/packages/mobile/src/screens/app-drawer-screen/AppDrawerScreen.tsx @@ -4,6 +4,7 @@ import type { DrawerContentComponentProps } from '@react-navigation/drawer' import { createDrawerNavigator } from '@react-navigation/drawer' import { useNavigation } from '@react-navigation/native' import { Platform, View, StyleSheet } from 'react-native' +import { useSafeAreaInsets } from 'react-native-safe-area-context' import { IconAudiusLogoHorizontal } from '@audius/harmony-native' import { AudioPlayer } from 'app/components/audio/AudioPlayer' @@ -16,6 +17,8 @@ import { AppDrawerContextProvider } from './AppDrawerContext' import { LeftNavDrawer } from './left-nav-drawer' const DRAWER_SWIPE_EDGE_WIDTH = 40 +const ISLAND_LOGO_TOP = 14 +const ISLAND_LOGO_HEIGHT = 25 const Drawer = createDrawerNavigator() @@ -53,6 +56,9 @@ export const AppDrawerScreen = memo(() => { const [gesturesDisabled, setGesturesDisabled] = useState(false) const [isAtStackRoot, setIsAtStackRootState] = useState(true) const { isOpen: isNowPlayingDrawerOpen } = useDrawer('NowPlaying') + const insets = useSafeAreaInsets() + const showIslandLogo = + Platform.OS === 'ios' && insets.top >= ISLAND_LOGO_TOP + ISLAND_LOGO_HEIGHT const drawerHelpersRef = useRef< DrawerContentComponentProps['navigation'] | null >(null) @@ -109,9 +115,13 @@ export const AppDrawerScreen = memo(() => { push/pop transitions instead of fading with the leaving screen. pointerEvents=none lets touches pass through to the navigator below. */} - {Platform.OS === 'ios' ? ( + {showIslandLogo ? ( - + ) : null} @@ -121,7 +131,7 @@ export const AppDrawerScreen = memo(() => { const styles = StyleSheet.create({ dynamicIslandLogo: { position: 'absolute', - top: 14, + top: ISLAND_LOGO_TOP, left: 0, right: 0, alignItems: 'center', diff --git a/packages/mobile/src/screens/app-screen/AppTabBar.tsx b/packages/mobile/src/screens/app-screen/AppTabBar.tsx index 81e49204a0f..5a79226fab7 100644 --- a/packages/mobile/src/screens/app-screen/AppTabBar.tsx +++ b/packages/mobile/src/screens/app-screen/AppTabBar.tsx @@ -1,7 +1,7 @@ -import { useRef } from 'react' +import { useContext, useEffect, useRef } from 'react' import type { BottomTabBarProps } from '@react-navigation/bottom-tabs' -import { Animated, StyleSheet } from 'react-native' +import { Animated, StatusBar, StyleSheet } from 'react-native' import Reanimated, { useAnimatedStyle } from 'react-native-reanimated' import { useSafeAreaInsets } from 'react-native-safe-area-context' @@ -10,9 +10,12 @@ import { BOTTOM_BAR_HEIGHT, useFloatingTabBar } from 'app/components/bottom-tab-bar' -import { FULL_DRAWER_HEIGHT } from 'app/components/drawer' +import { SetPlayBarVisibilityContext } from 'app/components/core/BottomBarInsetContext' +import { getFullDrawerHeight } from 'app/components/drawer' +import { useFoldLayout } from 'app/components/fold' import { NowPlayingDrawer } from 'app/components/now-playing-drawer' import { OtaUpdateBanner } from 'app/components/ota-update-banner/OtaUpdateBanner' +import { useDrawer } from 'app/hooks/useDrawer' import { useTabBarHiddenProgress } from './TabBarAutoHideContext' @@ -23,12 +26,25 @@ export const AppTabBar = (props: TabBarProps) => { const insets = useSafeAreaInsets() const hidden = useTabBarHiddenProgress() const floating = useFloatingTabBar() + const { isWide } = useFoldLayout() + const setPlayBarVisible = useContext(SetPlayBarVisibilityContext) + const { isOpen: isNowPlayingOpen, onClose: closeNowPlaying } = + useDrawer('NowPlaying') const translationAnimRef = useRef(null) if (translationAnimRef.current === null) { - translationAnimRef.current = new Animated.Value(FULL_DRAWER_HEIGHT) + translationAnimRef.current = new Animated.Value(getFullDrawerHeight()) } const translationAnim = translationAnimRef.current + useEffect(() => { + if (!isWide) return + setPlayBarVisible(false) + if (isNowPlayingOpen) { + closeNowPlaying() + StatusBar.setHidden(false, 'fade') + } + }, [isWide, isNowPlayingOpen, closeNowPlaying, setPlayBarVisible]) + const hideStyle = useAnimatedStyle( () => ({ transform: [ @@ -44,7 +60,7 @@ export const AppTabBar = (props: TabBarProps) => { return ( <> - + {isWide ? null : } } +const { getTrackId } = playbackSelectors + const Tab = createBottomTabNavigator() +const PANEL_MAX_WIDTH = 420 +const PANEL_WIDTH_RATIO = 0.42 + const screenOptions = { headerShown: false } const tabBar = (props: BottomTabBarProps) => @@ -38,20 +55,106 @@ export const AppTabsScreen = () => { usePrefetchNotifications() return ( - - - - - - - - - - - + + + + + + + ) } + +const SplitLayout = () => { + const { isWide, posture, windowWidth } = useFoldLayout() + const hasTrack = !!useSelector(getTrackId) + const [isGatefoldDismissed, setIsGatefoldDismissed] = useState(false) + + useEffect(() => { + if (posture !== 'book') setIsGatefoldDismissed(false) + }, [posture]) + + const handleCloseGatefold = useCallback(() => { + setIsGatefoldDismissed(true) + }, []) + + const { isEnabled: isVisualizerEnabled } = useFeatureFlag( + FeatureFlags.NOW_PLAYING_VISUALIZER + ) + const [isVisualizerOn, setIsVisualizerOn] = useState(false) + const handleToggleVisualizer = useCallback(() => { + setIsVisualizerOn((isOn) => !isOn) + }, []) + + useEffect(() => { + if (posture !== 'open') setIsVisualizerOn(false) + }, [posture]) + + const showPanel = isWide && hasTrack + const canShowVisualizer = posture === 'open' && !!isVisualizerEnabled + const isExpanded = showPanel && canShowVisualizer && isVisualizerOn + const panelWidth = isExpanded + ? windowWidth + : posture === 'book' + ? Math.round(windowWidth / 2) + : Math.min(PANEL_MAX_WIDTH, Math.round(windowWidth * PANEL_WIDTH_RATIO)) + const showGatefold = posture === 'book' && hasTrack && !isGatefoldDismissed + + return ( + + + + + + + + + + + + + {showPanel && !showGatefold ? ( + + ) : null} + + + + + + + ) +} + +const styles = StyleSheet.create({ + row: { + flex: 1, + flexDirection: 'row' + }, + content: { + flex: 1, + overflow: 'hidden' + }, + hidden: { + display: 'none' + } +}) diff --git a/packages/mobile/src/screens/app-screen/CompactHeader.tsx b/packages/mobile/src/screens/app-screen/CompactHeader.tsx index 01f896d0121..1dcc12cf32b 100644 --- a/packages/mobile/src/screens/app-screen/CompactHeader.tsx +++ b/packages/mobile/src/screens/app-screen/CompactHeader.tsx @@ -1,7 +1,7 @@ import type { ReactNode } from 'react' import { useState } from 'react' -import { ScrollView, StyleSheet, Text, useWindowDimensions } from 'react-native' +import { ScrollView, StyleSheet, Text } from 'react-native' import type { SharedValue } from 'react-native-reanimated' import Animated, { runOnJS, @@ -13,6 +13,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context' import { GlassCapsule } from 'app/components/core/Screen/GlassCapsule' import { isLiquidGlassAvailable } from 'app/components/core/Screen/LiquidGlass' +import { useContentWidth } from 'app/hooks/useContentWidth' import { makeStyles } from 'app/styles' import { useThemeColors } from 'app/utils/theme' import { zIndex } from 'app/utils/zIndex' @@ -121,7 +122,7 @@ export const CompactControls = (props: CompactControlsProps) => { const floating = useSharedValue(1) const tint = useCompactTint() const top = insets.top + COMPACT_TOP_GAP - const { width } = useWindowDimensions() + const width = useContentWidth() const { isShown, frameStyle, contentStyle } = useCompactFade(progress) return ( diff --git a/packages/mobile/src/screens/chat-screen/ChatMessageListItem.tsx b/packages/mobile/src/screens/chat-screen/ChatMessageListItem.tsx index 4f1999880f6..c933f9e84e1 100644 --- a/packages/mobile/src/screens/chat-screen/ChatMessageListItem.tsx +++ b/packages/mobile/src/screens/chat-screen/ChatMessageListItem.tsx @@ -15,7 +15,7 @@ import type { ReactionTypes, ChatMessageReaction } from '@audius/sdk' import { css } from '@emotion/native' import { find } from 'linkifyjs' import type { ViewStyle, StyleProp } from 'react-native' -import { Dimensions, Keyboard } from 'react-native' +import { Keyboard } from 'react-native' import { useSelector } from 'react-redux' import { Flex, spacing, Text } from '@audius/harmony-native' @@ -25,6 +25,7 @@ import { ProfilePicture, UserGeneratedText } from 'app/components/core' +import { useContentWidth } from 'app/hooks/useContentWidth' import { makeStyles } from 'app/styles' import { useThemeColors } from 'app/utils/theme' import { zIndex } from 'app/utils/zIndex' @@ -119,7 +120,7 @@ const useStyles = makeStyles(({ spacing, palette }) => ({ marginLeft: GROUP_AVATAR_SIZE + GROUP_AVATAR_GAP }, unfurl: { - width: Dimensions.get('window').width - 48, + width: 0, minHeight: 72, borderRadius: 0 } @@ -244,13 +245,16 @@ export const ChatMessageListItem = memo(function ChatMessageListItem( }, [linkValue]) const { secondaryDark1, neutralLight7 } = useThemeColors() + const contentWidth = useContentWidth() const borderBottomColor = isAuthor ? secondaryDark1 : neutralLight7 const borderBottomWidth = hideMessage || isCollection || isTrack ? 0 : 1 + const unfurlWidth = contentWidth - 48 const unfurlStyles = { ...styles.unfurl, + width: unfurlWidth, ...(isGroupOther - ? { width: styles.unfurl.width - GROUP_AVATAR_SIZE - GROUP_AVATAR_GAP } + ? { width: unfurlWidth - GROUP_AVATAR_SIZE - GROUP_AVATAR_GAP } : null), borderBottomColor, borderBottomWidth diff --git a/packages/mobile/src/screens/chat-screen/ReactionPopup.tsx b/packages/mobile/src/screens/chat-screen/ReactionPopup.tsx index 28463829f60..4f5aa6833c2 100644 --- a/packages/mobile/src/screens/chat-screen/ReactionPopup.tsx +++ b/packages/mobile/src/screens/chat-screen/ReactionPopup.tsx @@ -8,9 +8,10 @@ import { chatActions } from '@audius/common/store' import type { Nullable } from '@audius/common/utils' import { OptionalId } from '@audius/sdk' import Clipboard from '@react-native-clipboard/clipboard' -import { Dimensions, Pressable, Animated } from 'react-native' +import { Pressable, Animated } from 'react-native' import { useDispatch } from 'react-redux' +import { useContentWidth } from 'app/hooks/useContentWidth' import { usePopupAnimation } from 'app/hooks/usePopupAnimation' import { useToast } from 'app/hooks/useToast' import { makeStyles } from 'app/styles' @@ -62,7 +63,6 @@ const useStyles = makeStyles(({ spacing, palette, typography }) => ({ borderRadius: spacing(12), borderColor: palette.neutralLight9, zIndex: zIndex.CHAT_REACTIONS_POPUP_CONTENT, - width: Dimensions.get('window').width - spacing(10), backgroundColor: palette.white, marginHorizontal: spacing(5), shadowColor: 'black', @@ -72,7 +72,6 @@ const useStyles = makeStyles(({ spacing, palette, typography }) => ({ }, popupChatMessage: { position: 'absolute', - maxWidth: Dimensions.get('window').width - spacing(12), zIndex: zIndex.CHAT_REACTIONS_POPUP_CONTENT }, emoji: { @@ -105,6 +104,7 @@ export const ReactionPopup = ({ onClose }: ReactionPopupProps) => { const styles = useStyles() + const contentWidth = useContentWidth() const dispatch = useDispatch() const { data: userId } = useCurrentUserId() const { toast } = useToast() @@ -195,6 +195,7 @@ export const ReactionPopup = ({ style={[ styles.popupChatMessage, { + maxWidth: contentWidth - spacing(12), top: messageTop - containerTop, right: isAuthor ? spacing(6) : undefined, left: !isAuthor ? spacing(6) : undefined @@ -217,6 +218,7 @@ export const ReactionPopup = ({ style={[ styles.reactionsContainer, { + width: contentWidth - spacing(10), top: Math.max( messageTop - containerTop - REACTION_CONTAINER_HEIGHT, containerTop - diff --git a/packages/mobile/src/screens/explore-screen/components/FeaturedRemixContests.tsx b/packages/mobile/src/screens/explore-screen/components/FeaturedRemixContests.tsx index 4b3c1215860..bd4ec7406dd 100644 --- a/packages/mobile/src/screens/explore-screen/components/FeaturedRemixContests.tsx +++ b/packages/mobile/src/screens/explore-screen/components/FeaturedRemixContests.tsx @@ -2,11 +2,11 @@ import React from 'react' import { useAllRemixContests } from '@audius/common/api' import { exploreMessages as messages } from '@audius/common/messages' -import { useWindowDimensions } from 'react-native' import { useTheme } from '@audius/harmony-native' import { ContestCard, ContestCardSkeleton } from 'app/components/contest-card' import { CardList } from 'app/components/core' +import { useContentWidth } from 'app/hooks/useContentWidth' import { useDeferredElement } from '../../../hooks/useDeferredElement' @@ -16,7 +16,7 @@ const CONTEST_CARD_PEEK = 48 export const FeaturedRemixContests = () => { const { spacing } = useTheme() - const { width: windowWidth } = useWindowDimensions() + const windowWidth = useContentWidth() const contestCardWidth = windowWidth - CONTEST_CARD_PEEK const { InViewWrapper, inView } = useDeferredElement() const { data: allContestTrackIds, isPending: isAllContestsPending } = diff --git a/packages/mobile/src/screens/sign-on-screen/components/AccountHeader.tsx b/packages/mobile/src/screens/sign-on-screen/components/AccountHeader.tsx index 0ab9bbd949c..34ba5c8af04 100644 --- a/packages/mobile/src/screens/sign-on-screen/components/AccountHeader.tsx +++ b/packages/mobile/src/screens/sign-on-screen/components/AccountHeader.tsx @@ -9,7 +9,7 @@ import { import type { ImageFieldValue } from '@audius/web/src/pages/sign-up-page/components/ImageField' import { css } from '@emotion/native' import { isEmpty } from 'lodash' -import { Pressable, Dimensions } from 'react-native' +import { Pressable, useWindowDimensions } from 'react-native' import type { ImageSourcePropType } from 'react-native' import { useSelector } from 'react-redux' @@ -42,6 +42,7 @@ type AccountHeaderProps = { } export const AccountHeader = (props: AccountHeaderProps) => { + const { width: windowWidth } = useWindowDimensions() const { onSelectCoverPhoto, onSelectProfilePicture, @@ -70,7 +71,7 @@ export const AccountHeader = (props: AccountHeaderProps) => { position: 'absolute', left: spacing.unit4, top: spacing.unit10, - width: Dimensions.get('window').width - spacing.unit16 + width: windowWidth - spacing.unit16 })} > { ...other } = props const insets = useSafeAreaInsets() + const { width: windowWidth } = useWindowDimensions() const { spacing } = useTheme() const { handleSubmit, dirty, isValid } = useFormikContext() ?? {} @@ -107,7 +108,7 @@ export const PageFooter = (props: PageFooterProps) => { return ( ( + null +) + export const useResolvedThemeName = (): ResolvedThemeName => { + const override = useContext(ThemeOverrideContext) const theme = useSelector(getTheme) const themePalette = useSelector(getThemePalette) const themeMode = useSelector(getThemeMode) const systemAppearance = useSelector(getSystemAppearance) - return resolveThemeName(themePalette, themeMode, theme, systemAppearance) + return ( + override ?? + resolveThemeName(themePalette, themeMode, theme, systemAppearance) + ) } export const useThemeVariant = (): ResolvedThemeName => {