{"id":233,"date":"2024-05-22T15:27:22","date_gmt":"2024-05-22T15:27:22","guid":{"rendered":"https:\/\/www.buddyupgo.com\/?page_id=233"},"modified":"2024-05-22T15:27:22","modified_gmt":"2024-05-22T15:27:22","slug":"account","status":"publish","type":"page","link":"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/account\/","title":{"rendered":"Account"},"content":{"rendered":"<div class=\"buddyUpPjaxContainer\" data-buddyup-pjax-container=\"1\"><style>body {\n    background: var(--buddyup-background);\n}\n\n#buddyUpModalWrapper .buddyUpModalContent {\n    width: 500px;\n    max-width: 100%;\n}\n\n.pinnacleMainNavBar .logo-wrapper img {\n    height: 75px !important;\n    width: auto;\n}\n\n#accountWrapper .buddyUpElWrapper {\n    box-shadow: 0 2px 10px -2px rgba(0,0,0,.05), 0 2px 15px -2px rgba(0,0,0,.05);\n}\n\n#accountWrapper aside#profileSidebar .buddyUpElWrapper {\n    margin-bottom: 1rem;\n    padding: 5px;\n}\n\n.buddyUpProfileInfoWrapper {\n    padding: 0 15px 15px;\n}\n\n\/* Profile Sidebar *\/\naside#profileSidebar {\n    --sidebar-width: 315px;\n    max-width: var(--sidebar-width);\n    min-width: var(--sidebar-width);\n    width: var(--sidebar-width);\n    \/* padding: 0 20px; *\/\n}\n\n.imageWrapper {\n    position: relative;\n    border-radius: var(--border-radius);\n    overflow: hidden;\n    line-height: 0;\n    height: 300px;\n}\n\n.imageWrapper:after {\n    content: '';\n    position: absolute;\n    bottom: 0;\n    left: 0;\n    display: block;\n    height: 30%;\n    width: 100%;\n    background: rgb(0,0,0);\n    background: -moz-linear-gradient(360deg, rgba(0,0,0,.7) 0%, rgba(0,0,0,.2) 75%, rgba(0,0,0,0) 100%);\n    background: -webkit-linear-gradient(360deg, rgba(0,0,0,.7) 0%, rgba(0,0,0,.2) 75%, rgba(0,0,0,0) 100%);\n    background: linear-gradient(360deg, rgba(0,0,0,.7) 0%, rgba(0,0,0,.2) 75%, rgba(0,0,0,0) 100%);\n    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=\"#000000\",endColorstr=\"#000000\",GradientType=1);\n}\n\n.imageWrapper > img {\n    height: 100%;\n    width: 100%;\n    object-fit: cover;\n}\n\n.imageWrapper [class*='buddyUpSubscriptionBadge']{\n    position: absolute;\n    bottom: .65rem;\n    right: .65rem;\n    z-index: 2;\n}\n\n.userNameWrapper {\n    position: relative;\n}\n\n#userName {\n    margin: 1rem 0 0.5rem;\n    font-weight: bold;\n    font-size: 1.2rem;\n    width: calc(100% - 50px);\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n#shareProfile {\n    position: absolute;\n    right: 0;\n    top: 50%;\n    transform: translateY(-50%);\n    border: none;\n    font-size: 1rem;\n    padding: 0;\n    margin: 0;\n}\n\n.buddyUpShareProfileModal .textHeading {\n    margin-bottom: .5rem;\n}\n\n.buddyUpShareProfileModal p:last-child {\n    padding-bottom: 0;\n    margin-bottom: 0;\n}\n\n#buddyUpCopyButton {\n    text-transform: none;\n    font-size: inherit;\n    overflow: hidden;\n    text-overflow: ellipsis;\n    margin-bottom: 0;\n    width: 370px;\n    max-width: 100%;\n    letter-spacing: normal;\n    font-weight: normal;\n}\n\n.userInfoWrapper {\n    line-height: 1.5rem;\n}\n\n#userInterestsWrapper {\n    margin: 1rem 0 0;\n}\n\n#userAboutWrapper {\n    margin: 1.5rem 0 0;\n}\n\n#userAboutWrapper p {\n    margin-top: .5rem;\n}\n\n#accountInformation {\n    max-width: calc(100% - var(--sidebar-width));\n    position: relative;\n}\n\n.buddyUpPrivateAccountOverlay {\n    position: absolute;\n    inset: 0;\n    z-index: 10;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    background: rgba(255, 255, 255, 0.72);\n    backdrop-filter: blur(3px);\n    border-radius: var(--border-radius);\n}\n\n.buddyUpPrivateAccountOverlayCard {\n    background: var(--buddyup-background);\n    border: 1px solid rgba(0,0,0,.14);\n    border-radius: 10px;\n    padding: .9rem 1rem;\n    text-align: center;\n    max-width: 320px;\n}\n\n.buddyUpPrivateAccountOverlayCard p {\n    margin: .35rem 0 0;\n    font-size: .92rem;\n    opacity: .85;\n}\n\n#accountWrapper.isPrivateAccountView #userCityState,\n#accountWrapper.isPrivateAccountView #userInterestsWrapper,\n#accountWrapper.isPrivateAccountView #userAboutWrapper,\n#accountWrapper.isPrivateAccountView #buddyUpBuddiesList,\n#accountWrapper.isPrivateAccountView .userAddBuddyWrapper,\n#accountWrapper.isPrivateAccountView #buddySendMessageWrapper,\n#accountWrapper.isPrivateAccountView #reportUser {\n    display: none !important;\n}\n\n\/* Buddies List *\/\n#buddyUpBuddiesList {\n    margin-top: 1.5rem;\n    text-align: center;\n}\n#buddyUpBuddiesList ul {\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    padding: 0;\n    margin-top: .8rem;\n}\n\n#buddyUpBuddiesList li {\n    margin: 0;\n    transition: margin .2s;\n}\n\n#buddyUpBuddiesList li:before {\n    content: '';\n    display: none;\n}\n\n#buddyUpBuddiesList li:not(:first-of-type) {\n    margin-left: -8px;\n}\n\n#buddyUpBuddiesList .buddyUpBuddyIcon {\n    height: 45px;\n    width: 45px;\n}\n\n#buddyUpBuddiesList .buddyUpAdditionalBuddies {\n    background: var(--buddyup-background);\n    color: rgba(0,0,0,.8);\n    padding: 0;\n    margin: 0;\n    border: 1px solid rgba(0,0,0,.2);\n    font-size: .9rem;\n    font-weight: 600;\n    letter-spacing: .5px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n}\n\n\n\/* Sidebar buttons *\/\n#buddySendMessageWrapper #buddySendMessage {\n    width: 100%;\n    margin-bottom: .5rem;\n}\n\n#buddySendMessage i {\n    font-size: .9rem;\n}\n\n.userAddBuddyWrapper {\n    text-align: center;\n    padding-bottom: 0;\n}\n\n.userAddBuddyWrapper button {\n    border-width: 1px !important;\n    margin: 0 0 1rem 0;\n    padding: 0.4rem .8rem !important;\n    border-radius: var(--buddyup-control-radius);\n    font-size: .9rem;\n}\n\n.userAddBuddyWrapper button i {\n    font-size: .8rem;\n    margin-right: 2px;\n}\n\n.userAddBuddyWrapper #userBlockBuddy {\n    margin-left: 5px;\n}\n\n.userAddBuddyWrapper #userBlockBuddy:not(:disabled) {\n    background: #f2f2f2 !important;\n}\n\n.userAddBuddyWrapper #userAddBuddy.isBuddy.buddyUpButton3 {\n    background: #cc0000 !important;\n    color: white !important;\n    border-color: #cc0000 !important;\n}\n\n.userAddBuddyWrapper #userAddBuddy.isPending.buddyUpButton3 {\n    background: var(--primary-color) !important;\n    color: white !important;\n    border-color: var(--primary-color) !important;\n}\n\n.userAddBuddyWrapper #userAddBuddy.isBuddy.buddyUpButton3:hover {\n    opacity: .8;\n}\n\n#buddyUpUserNavigation {\n    padding: .5rem 0;\n}\n\n#buddyUpUserNavigation .buddyUpUserNavigationViewSubscriptionTiers {\n    color: white;\n    font-weight: bold;\n    left: -5px;\n    width: calc(100% + 10px);\n    padding-left: calc(25px + .5rem);\n}\n\n@media (min-width: 651px){\n    #buddyUpBuddiesList li:hover,\n    #buddyUpBuddiesList li:hover + li {\n        margin-left: 0;\n    }\n}\n\n\/* Events *\/\n#accountInformationContent {\n    padding: 0 30px 30px;\n}\n\n#buddyUpAccountAdventuresFeed {\n    display: flex;\n    flex-direction: column;\n    gap: .85rem;\n    background: white;\n    border-radius: var(--border-radius);\n    padding: .9rem;\n    box-shadow: 0px 3px 16px -9px rgba(0,0,0,.1);\n}\n\n.buddyUpAccountAdventureFeedCard {\n    margin-bottom: 0;\n}\n\n.buddyUpAccountAdventureFeedHeader {\n    display: flex;\n    align-items: center;\n    gap: .55rem;\n}\n\n.buddyUpAccountAdventureOwnerAvatar {\n    display: block;\n    width: 42px;\n    height: 42px;\n    border-radius: 50%;\n    overflow: hidden;\n    line-height: 0;\n}\n\n.buddyUpAccountAdventureOwnerAvatar img {\n    width: 100%;\n    height: 100%;\n    object-fit: cover;\n}\n\n.buddyUpAdventureCard {\n    display: grid;\n    grid-template-columns: 220px 1fr;\n    gap: .75rem;\n    padding: .8rem;\n    cursor: pointer;\n}\n\n.buddyUpAdventureCard:focus-visible {\n    outline: 2px solid var(--buddyup-color1);\n    outline-offset: 2px;\n}\n\n.buddyUpAdventureCardPreview {\n    width: 100%;\n}\n\n.buddyUpAdventureCardCover {\n    width: 100%;\n    height: 160px;\n    border-radius: 8px;\n    object-fit: cover;\n    display: block;\n}\n\n.buddyUpAdventureCardCoverPlaceholder {\n    background: rgba(0, 0, 0, .06);\n}\n\n.buddyUpAdventureCardMain {\n    min-width: 0;\n}\n\n.buddyUpAdventureActionsBtn {\n    margin-left: auto;\n    min-width: 32px;\n}\n\n#buddyUpAccountEventsGroupsSplit {\n    display: grid;\n    grid-template-columns: repeat(2, minmax(0, 1fr));\n    gap: 1rem;\n    margin-top: 1.2rem;\n}\n\n.buddyUpAccountSplitColumn {\n    min-width: 0;\n}\n\n.buddyUpAccountSquareGrid {\n    display: grid;\n    grid-template-columns: repeat(2, minmax(0, 1fr));\n    gap: .75rem;\n}\n\n.buddyUpAccountSquareGrid .singleEventCard {\n    margin-bottom: 0;\n    height: 100%;\n    display: flex;\n    flex-direction: column;\n}\n\n.buddyUpAccountSquareGrid .singleEventCard .eventCardImageWrapper {\n    height: auto;\n    max-height: none;\n    aspect-ratio: 1 \/ 1;\n}\n\n.buddyUpAccountSquareGrid .singleEventCard .eventCardInfoWrapper {\n    display: flex;\n    flex-direction: column;\n    gap: .3rem;\n    min-height: 112px;\n    justify-content: flex-start;\n}\n\n.buddyUpAccountSquareGrid .singleEventCard .eventCardTitle {\n    display: -webkit-box;\n    line-clamp: 2;\n    -webkit-line-clamp: 2;\n    -webkit-box-orient: vertical;\n    overflow: hidden;\n}\n\n.buddyUpAccountSquareGrid .singleEventCard .eventCardInfoWrapper .textSmall {\n    display: -webkit-box;\n    line-clamp: 2;\n    -webkit-line-clamp: 2;\n    -webkit-box-orient: vertical;\n    overflow: hidden;\n}\n\n.buddyUpAccountSquareGrid .noEventsCard,\n.buddyUpAccountSquareGrid .noGroupsCard {\n    min-height: 180px;\n}\n\n#accountInformationContent .infoHeader:first-of-type {\n    margin-top: 30px;\n}\n\n.noEventsCard {\n    width: 100%;\n    background: white;\n    color: #666;\n    font-weight: bold;\n    border-radius: var(--border-radius);\n    height: 200px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    box-shadow: 0px 3px 16px -9px rgba(0,0,0,.1)\n}\n\n.singleEventCard {\n    box-shadow: 0px 3px 16px -9px rgba(0,0,0,.1)\n}\n\n#findEvents {\n    margin-top: 0;\n}\n\n@media (max-width: 1100px){\n    #accountWrapper {\n        --sidebar-width: 250px;\n    }\n}\n\n@media (max-width: 650px){\n    .container.full-width-no-header {\n        width: 100%;\n        padding: 0;\n    }\n\n    #accountWrapper {\n        flex-direction: column;\n    }\n\n    #accountInformation{\n        width: 100%;\n        max-width: 100%;\n    }\n\n    aside#profileSidebar {\n        width: 95%;\n        max-width: 95%;\n        margin: 0 auto;\n    }\n    \n    #accountInformation > #accountInformationContent {\n        padding: 0 20px 40px 20px;\n    }\n\n    .buddyUpAdventureCard {\n        grid-template-columns: 1fr;\n    }\n\n    .buddyUpAdventureCardCover {\n        height: 190px;\n    }\n\n    #buddyUpAccountEventsGroupsSplit {\n        grid-template-columns: 1fr;\n    }\n\n    .imageWrapper {\n        height: calc(100vw - 5vw);\n        max-height: 350px;\n        max-width: 350px;\n        margin: 0 auto;\n    }\n}\n\n@media (max-width: 420px){\n    .singleEventCard .eventCardImageWrapper {\n        height: 150px;\n        max-height: 150px;\n    }\n}\n\n\/* Messaging *\/\n#buddyUpModalWrapper .buddyUpModalContentWrapper.messagesModal .buddyUpModalContent {\n    padding: 2rem;\n    width: 700px;\n    max-width: 100%;\n}\n\n.chatMessagesWrapper {\n    display: flex;\n    flex-direction: column;\n    background: #fff;\n    border: 1px solid rgba(0,0,0,.06);\n    border-radius: 12px;\n    padding: .8rem;\n    height: 70vh;\n}\n\n#currentChat {\n    flex: 1;\n    min-height: 0;\n    overflow-y: auto;\n    margin: 0;\n    padding: .15rem .1rem .55rem;\n}\n\n.chatMessagesWrapper .currentChat .userMessageWrapper {\n    gap: 10px;\n    margin-bottom: .5rem;\n}\n\n.chatMessagesWrapper .currentChat .userMessageWrapper .userMessage span {\n    background: #f2f3f5;\n    color: #222;\n    padding: 8px 14px;\n    border-radius: 0 12px 12px 12px;\n    max-width: 100%;\n}\n\n.chatMessagesWrapper .currentChat .userMessageWrapper .userMessage.currentUser span {\n    background: var(--primary-color);\n    color: #fff;\n    border-radius: 12px 0 12px 12px;\n}\n\n.chatMessagesWrapper .currentChat .userMessageImage {\n    width: 36px;\n    height: 36px;\n}\n\n#chatNewMessageWrapper {\n    margin-top: auto;\n    border-top: 1px solid rgba(0,0,0,.08);\n    padding-top: .7rem;\n}\n\n#chatNewMessageForm {\n    background: #f3f3f3;\n    border: 1px solid rgba(0,0,0,.08);\n    border-radius: 12px;\n    align-items: flex-end;\n    padding-right: 6px;\n}\n\n#chatNewMessageInput {\n    min-height: 42px;\n    padding: .65rem .7rem;\n}\n\n#chatNewMessageSubmit {\n    border-radius: 999px;\n    border: none !important;\n    background: var(--primary-color) !important;\n    color: #fff !important;\n    height: 34px;\n    width: 34px;\n    min-width: 34px;\n    margin: 0;\n    padding: 0;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n}\n\n#chatNewMessageSubmit:disabled {\n    background: #d5d5d5 !important;\n    color: #777 !important;\n}\n\n@media (min-width: 551px){\n    #chatNewMessageWrapper .buddyUpSubscriptionCTAWrapper {\n        display: flex;\n        justify-content: space-between;\n        align-items: center;\n        padding: .5rem .6rem .5rem 1rem;\n    }\n\n    #chatNewMessageWrapper .buddyUpSubscriptionCTAWrapper p {\n        padding: 0;\n    }\n}\n\n@media (max-width: 600px){\n    #buddyUpModalWrapper .buddyUpModalContentWrapper.messagesModal {\n        max-width: calc(100vw - 1rem);\n        height: calc(var(--buddyup-mobile-usable-vh, 100dvh) - 4rem);\n    }\n\n    #buddyUpModalWrapper .buddyUpModalContentWrapper .buddyUpModalContent {\n        padding: 20px;\n    }\n\n    .chatMessagesWrapper {\n        max-height: calc(var(--buddyup-mobile-usable-vh, 100dvh) - 181px);\n        height: calc(var(--buddyup-mobile-usable-vh, 100dvh) - 181px);\n    }\n}\n\n\/* PWA Message - New Users *\/\n#buddyUpPWAMessage {\n    margin-top: .5rem;\n    margin-bottom: 2rem;\n    align-items: center;\n    padding: 20px;\n}\n\n@media (min-width: 651px) and (max-width: 1051px){\n    #buddyUpPWAMessage {\n        flex-direction: column;\n        text-align: center;\n    }\n}\n\n@media (max-width: 450px){\n    #buddyUpPWAMessage {\n        flex-direction: column;\n        text-align: center;\n    }\n}<\/style><div class=\"buddyUpPjaxContainer\" data-buddyup-pjax-container=\"1\"><style>#buddyUpNoUserSection .buddyUpButton1 {\n    margin-bottom: 1rem;\n}<\/style>\n<section id=\"buddyUpNoUserSection\" class=\"buddyUpErrorPage hidden\">\n    <div class=\"buddyUpNoUserWrapper\">\n        <img decoding=\"async\" src=\"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/wp-content\/plugins\/buddyup\/img\/trailer-image.webp\" alt=\"BuddyUp illustration\" class=\"buddyUpErrorPageImage\">\n        <h1>Not logged in<\/h1>\n        <p>Please log in to your account to view your account.<\/p>\n        <a href=\"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/login\/\" class=\"buddyUpButton1\">Go to login<\/a>\n    <\/div>\n<\/section><\/div><section id=\"accountWrapper\" class=\"flexWrapper buddyUpContainer hidden\" data-userid=\"current\">\n    <aside id=\"profileSidebar\">\n        <div id=\"profileSidebarContent\">\n            <div class=\"buddyUpElWrapper\">\n                <div class=\"imageWrapper\">\n                    <img decoding=\"async\" src=\"\" alt=\"Image of \" id=\"profileImage\" onerror=\"BUDDYUP.onErrProfileImage(this)\">\n                <\/div>\n                <div class=\"buddyUpProfileInfoWrapper\">\n                    <div class=\"userNameWrapper\"><div id=\"userName\"><\/div> <button id=\"shareProfile\" aria-label=\"Copy this profile's link\" title=\"Share profile\"><i class=\"fa fa-solid fa-share-alt fa-fw\"><\/i><\/button><\/div>\n                    <div id=\"userCityState\" class=\"userInfoWrapper textSmall\">\n                        <div><i class=\"fa fa-solid fa-map-marker fa-fw\"><\/i> <\/div>\n                    <\/div>\n                    \n                    <div id=\"userInterestsWrapper\">\n                        <strong>My interests<\/strong>\n                        <ul id=\"userInterests\" class=\"buddyUpPillWrapper\"><\/ul>\n                    <\/div>\n\n                    <div id=\"userAboutWrapper\">\n                        <strong>A bit about me<\/strong>\n                        <p id=\"userAbout\"><\/p>\n                    <\/div>\n\n                    <div id=\"buddyUpBuddiesList\">\n                        <strong>Your Buddies<\/strong>\n                    <\/div>\n\n                                    <\/div>\n                \n                <nav id=\"buddyUpUserNavigation\" class=\"sidebarNavigation\">\n                    <a href=\"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/messages\/\" aria-label=\"View your messages\"><i class=\"fa fa-solid fa-inbox fa-fw\"><\/i> Messages<\/a>\n                    <a href=\"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/buddies-list\/\" aria-label=\"View your buddies\"><i class=\"fa fa-solid fa-users fa-fw\"><\/i> Buddies<\/a>\n                    <a href=\"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/events\/\" aria-label=\"Find events\"><i class=\"fa fa-solid fa-mountain fa-fw\"><\/i> Find Events<\/a>\n                    <a href=\"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/matchup\/\" aria-label=\"Go to Matchup\"><\/i><div class=\"matchupBadgeIconsWrapper\"><i class=\"fa fa-regular fa-id-badge fa-fw\"><\/i><i class=\"fa-solid fa-id-badge fa-fw badge-2\"><\/i><\/div> Matchup<\/a>\n                    <button type=\"button\" id=\"buddyUpSyncContactsBtn\" aria-label=\"Find contacts on BuddyUp\"><i class=\"fa fa-solid fa-address-book fa-fw\"><\/i> Find Contacts on BuddyUp<\/button>\n                    <a href=\"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/account\/\/edit\" aria-label=\"Edit your profile\"><i class=\"fa fa-solid fa-user-pen fa-fw\"><\/i> Edit Profile<\/a>\n                    <button href=\"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/subscription-tiers\/\" class=\"buddyUpAccountDownloadPWA\" aria-label=\"Download site PWA\"><i class=\"fa fa-download\"><\/i>  Download Site<\/button>\n                    <span id=\"buddyUpAccountSubscriptionAction\">\n                        <a href=\"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/subscription-tiers\/\" class=\"buddyUpUserNavigationViewSubscriptionTiers buddyUpSubscriptionButton\" aria-label=\"Upgrade account tiers\"><i class=\"fa fa-solid fa-crown fa-fw\"><\/i>  Explore Account Tiers<\/a>\n                    <\/span>\n                    <button class=\"buddyUpLogOut\" aria-label=\"Logout\"><i class=\"fa fa-solid fa-right-from-bracket fa-fw\"><\/i> Logout<\/button>\n                <\/nav>\n            <\/div>\n        <\/div>\n    <\/aside>\n    <div id=\"accountInformation\">\n        <div id=\"buddyUpPrivateAccountOverlay\" class=\"buddyUpPrivateAccountOverlay hidden\" aria-live=\"polite\">\n            <div class=\"buddyUpPrivateAccountOverlayCard\">\n                <strong>Private account<\/strong>\n                <p>This user shares full profile details with buddies only.<\/p>\n            <\/div>\n        <\/div>\n        <div id=\"accountInformationContent\" class=\"\">\n            <div id=\"buddyUpAccountAdventuresFeed\" class=\"buddyUpAccountAdventuresFeed\">\n                <div class=\"noEventsCard\">No adventures to display<\/div>\n            <\/div>\n\n            <div id=\"buddyUpAccountEventsGroupsSplit\" class=\"buddyUpAccountEventsGroupsSplit\">\n                <div class=\"buddyUpAccountSplitColumn\">\n                    <div class=\"infoHeader textHeading\">Events<\/div>\n                    <div id=\"buddyUpAccountEventsGrid\" class=\"buddyUpAccountSquareGrid\">\n                        <div class=\"noEventsCard\">No events to display<\/div>\n                    <\/div>\n                <\/div>\n\n                <div class=\"buddyUpAccountSplitColumn\">\n                    <div class=\"infoHeader textHeading\">Groups<\/div>\n                    <div id=\"buddyUpAccountGroupsGrid\" class=\"buddyUpAccountSquareGrid\">\n                        <div class=\"noGroupsCard\">No groups to display<\/div>\n                    <\/div>\n                <\/div>\n            <\/div>\n\n        <\/div>\n    <\/div>\n<\/section>\n<script>const accountWrapper = document.getElementById('accountWrapper');\nconst account404Wrapper = document.getElementById('buddyUpNoUserSection');\nconst currentUser = BUDDYUP.getCurrentUser();\n\n\/\/ Debug helper: enable by visiting the page with `?bu_debug=1` or setting `localStorage.bu_debug = '1'`.\nfunction buddyUpAccountDebugEnabled(){\n    try {\n        if (window && window.location && typeof window.location.search === 'string' && window.location.search.includes('bu_debug=1')) return true;\n    } catch (e) {}\n    try {\n        if (window && window.localStorage && localStorage.getItem('bu_debug') === '1') return true;\n    } catch (e) {}\n    return false;\n}\n\nfunction buddyUpAccountDebug(){\n    if (!buddyUpAccountDebugEnabled()) return;\n    try { console.log.apply(console, arguments); } catch (e) {}\n}\n\nfunction buddyUpAccountHasSubscriptionSuccessParam(){\n    try {\n        const params = new URLSearchParams(window.location.search || '');\n        const v = params.get('subscription_success');\n        return v === '1' || v === 'true' || v === 'yes';\n    } catch (e) {\n        return false;\n    }\n}\n\nfunction buddyUpAccountNormalizeTier(tier){\n    tier = parseInt(tier);\n    if (isNaN(tier)) tier = 0;\n    if (![0, 1, 2].includes(tier)) tier = 0;\n    return tier;\n}\n\nfunction buddyUpAccountGetSubscriptionTierHintParam(){\n    try {\n        const params = new URLSearchParams(window.location.search || '');\n        return buddyUpAccountNormalizeTier(params.get('subscription_tier'));\n    } catch (e) {\n        return 0;\n    }\n}\n\nfunction buddyUpAccountExtractTierFromUser(user){\n    if (!user || typeof user !== 'object') return 0;\n\n    let tier = (typeof user.user_subscription !== 'undefined' ? user.user_subscription : null);\n    tier = tier === null && typeof user.subscription !== 'undefined' ? user.subscription : tier;\n    tier = tier === null && typeof user.subscription_tier !== 'undefined' ? user.subscription_tier : tier;\n    tier = tier === null && typeof user.tier !== 'undefined' ? user.tier : tier;\n\n    return buddyUpAccountNormalizeTier(tier);\n}\n\nfunction buddyUpAccountLooksLikeAuthSessionError(message){\n    const msg = String(message || '').toLowerCase();\n    if (!msg) return false;\n\n    return (\n        msg.includes('invalid user or token') ||\n        msg.includes('invalid user token') ||\n        msg.includes('authentication failed') ||\n        msg.includes('authentication required') ||\n        msg.includes('session expired') ||\n        msg.includes('user not found')\n    );\n}\n\nfunction buddyUpAccountSyncSelfTierCache(userData, viewedUserTier){\n    try {\n        if (!BUDDYUP || typeof BUDDYUP.getCurrentUser !== 'function') return;\n        const current = BUDDYUP.getCurrentUser();\n        if (!current || typeof current !== 'object') return;\n\n        const existingTier = buddyUpAccountExtractTierFromUser(current);\n        const nextTier = Math.max(existingTier, buddyUpAccountNormalizeTier(viewedUserTier));\n\n        current.user_subscription = nextTier;\n        current.subscription = nextTier;\n        current.subscription_tier = nextTier;\n        current.tier = nextTier;\n\n        if (userData && (userData.subscription_expires_at || userData.expires_at)) {\n            current.subscription_expires_at = userData.subscription_expires_at || userData.expires_at;\n        }\n\n        if (typeof BUDDYUP.setUser === 'function') {\n            BUDDYUP.setUser(current);\n        } else {\n            localStorage.setItem('buddyup_user', JSON.stringify(current));\n        }\n    } catch (e) {}\n}\n\nfunction buddyUpAccountClearSubscriptionSuccessParam(){\n    try {\n        const url = new URL(window.location.href);\n        url.searchParams.delete('subscription_success');\n        url.searchParams.delete('subscription_tier');\n        window.history.replaceState({}, document.title, url.pathname + url.search + url.hash);\n    } catch (e) {}\n}\n\nfunction buddyUpAccountMonthsRemaining(expiresAt){\n    const ts = Date.parse(String(expiresAt || ''));\n    if (!Number.isFinite(ts)) return null;\n\n    const now = new Date();\n    const end = new Date(ts);\n    if (end <= now) return 0;\n\n    let months = (end.getFullYear() - now.getFullYear()) * 12 + (end.getMonth() - now.getMonth());\n    if (end.getDate() >= now.getDate()) months += 1;\n    if (months < 1) months = 1;\n    return months;\n}\n\nfunction buddyUpAccountShowSubscriptionSuccessModal(userData, viewedUserTier, isSelfAccount){\n    if (!isSelfAccount) return;\n    if (!buddyUpAccountHasSubscriptionSuccessParam()) return;\n\n    const tierLabel = Number(viewedUserTier) === 2 ? 'Enthusiast' : (Number(viewedUserTier) === 1 ? 'Adventurer' : 'Subscription');\n    const expiresRaw = userData && (userData.subscription_expires_at || userData.expires_at) ? (userData.subscription_expires_at || userData.expires_at) : '';\n\n    let expiryLine = 'We are finalizing your billing period details.';\n    if (expiresRaw) {\n        const dt = new Date(expiresRaw);\n        if (!Number.isNaN(dt.getTime())) {\n            expiryLine = 'Current period ends on <strong>' + dt.toLocaleDateString() + '<\/strong>.';\n        }\n    }\n\n    const monthsRemaining = buddyUpAccountMonthsRemaining(expiresRaw);\n    const renewLine = monthsRemaining === null\n        ? 'Auto-renew term: <strong>Monthly<\/strong>.'\n        : 'Auto-renew term: <strong>Monthly<\/strong> \u2022 Approximately <strong>' + monthsRemaining + ' month' + (monthsRemaining === 1 ? '' : 's') + '<\/strong> left in this cycle.';\n\n    BUDDYUP.openModal(\n        '<p>Your <strong>' + tierLabel + '<\/strong> subscription is active.<\/p>' +\n        '<p>' + expiryLine + '<\/p>' +\n        '<p>' + renewLine + '<\/p>',\n        'Subscription Successful',\n        'buddyUpSubscriptionSuccessModal'\n    );\n\n    buddyUpAccountClearSubscriptionSuccessParam();\n}\n\nfunction buddyUpFindAccountSubscriptionActionWrapper(){\n    try {\n        const byId = document.getElementById('buddyUpAccountSubscriptionAction');\n        if (byId) return { el: byId, via: 'id', mode: 'container' };\n\n        const nav = document.getElementById('buddyUpUserNavigation') || document.querySelector('#profileSidebarContent nav.sidebarNavigation');\n        if (!nav) return { el: null, via: 'no-nav', mode: null };\n\n        const link = nav.querySelector('a.buddyUpUserNavigationViewSubscriptionTiers, a.buddyUpSubscriptionButton[href*=\"subscriptions\"], a.buddyUpSubscriptionButton[href*=\"subscription\"]');\n        if (link) {\n            const container = link.closest('#buddyUpAccountSubscriptionAction') || link.closest('span#buddyUpAccountSubscriptionAction');\n            if (container) return { el: container, via: 'link', mode: 'container' };\n\n            \/\/ If markup differs, only replace the link element (never its parent).\n            return { el: link, via: 'link', mode: 'link' };\n        }\n\n        return { el: null, via: 'no-link', mode: null };\n    } catch (e) {\n        return { el: null, via: 'exception', mode: null };\n    }\n}\n\n\/\/ Prove this file executed.\nbuddyUpAccountDebug('[BuddyUp][account_theme] loaded', {\n    hasAccountWrapper: !!accountWrapper,\n    has404Wrapper: !!account404Wrapper,\n    currentUserId: currentUser && currentUser.id ? currentUser.id : null,\n    env: (buddyUpVariables && buddyUpVariables.buddyup_env) ? buddyUpVariables.buddyup_env : null,\n    href: (window && window.location) ? window.location.href : null,\n});\n\nasync function buddyUpCancelSubscriptionFlow(data){\n    data = data && typeof data === 'object' ? data : {};\n\n    const user = BUDDYUP.getCurrentUser();\n    if (!user || !user.id || !user.user_token){\n        BUDDYUP.openModal(`<p>Please log in again to continue.<\/p><a href=\"${buddyUpVariables.login_link}\" class=\"buddyUpButton1\">Log in<\/a>`, 'Session required', 'buddyUpCancelSubscriptionModal');\n        return;\n    }\n\n    const heading = 'Cancel subscription';\n    const actionEndpoint = 'hyfin-cancel-subscription';\n\n    const helpText = `<p>This will cancel your recurring subscription billing (best-effort). You may lose access to paid features immediately.<\/p>`;\n\n    const content = `\n        ${helpText}\n        <label class=\"buddyUpElWrapper\" style=\"display:block;margin-top:.75rem;\">\n            <div class=\"textSmall\" style=\"opacity:.85;margin-bottom:.25rem;\">Confirm with your password<\/div>\n            <input id=\"buddyUpCancelSubPassword\" type=\"password\" class=\"buddyUpInput\" autocomplete=\"current-password\" \/>\n        <\/label>\n        <div class=\"buddyUpErrorMessage hidden\" id=\"buddyUpCancelSubError\" style=\"margin-top:.5rem;\"><\/div>\n        <div style=\"display:flex;gap:.5rem;justify-content:flex-end;margin-top:1rem;\">\n            <button type=\"button\" class=\"buddyUpButton3\" id=\"buddyUpCancelSubClose\">Close<\/button>\n            <button type=\"button\" class=\"buddyUpButton4\" id=\"buddyUpCancelSubConfirm\">Cancel subscription<\/button>\n        <\/div>\n    `;\n\n    BUDDYUP.openModal(content, heading, 'buddyUpCancelSubscriptionModal');\n\n    const closeBtn = document.getElementById('buddyUpCancelSubClose');\n    const confirmBtn = document.getElementById('buddyUpCancelSubConfirm');\n    const pwEl = document.getElementById('buddyUpCancelSubPassword');\n    const errEl = document.getElementById('buddyUpCancelSubError');\n    if (closeBtn) closeBtn.addEventListener('click', (e) => { e.preventDefault(); BUDDYUP.closeModal(); });\n\n    if (confirmBtn) confirmBtn.addEventListener('click', async (e) => {\n        e.preventDefault();\n        if (!pwEl || !pwEl.value){\n            if (errEl){ errEl.innerHTML = 'Password is required.'; errEl.classList.remove('hidden'); }\n            return;\n        }\n        if (errEl) errEl.classList.add('hidden');\n        confirmBtn.setAttribute('disabled', 'disabled');\n\n        const request = await BUDDYUP.apiRequest(actionEndpoint, {\n            user_id: user.id,\n            user_token: user.user_token,\n            user_password: String(pwEl.value),\n            env: buddyUpVariables && buddyUpVariables.hyfin_env ? buddyUpVariables.hyfin_env : null,\n            debug: (BUDDYUP && BUDDYUP.debug),\n        });\n\n        if (BUDDYUP && BUDDYUP.debug) {\n            console.log('[buddyUpCancelSubscriptionFlow] response:', actionEndpoint, request);\n            try {\n                if (request && request.trace) {\n                    console.log('[buddyUpCancelSubscriptionFlow] trace:', request.trace);\n                } else if (request && request.hyfin && request.hyfin.errors) {\n                    console.log('[buddyUpCancelSubscriptionFlow] hyfin.errors:', request.hyfin.errors);\n                }\n            } catch (e) {}\n        }\n\n        confirmBtn.removeAttribute('disabled');\n\n        if (!request || request.status !== 'success'){\n            let msg = request && (request.message || request.data || request.error) ? (request.message || request.data || request.error) : 'An error occurred. Please try again.';\n\n            \/\/ Backend only includes `details` in staging\/dev; if present, show it.\n            try {\n                if (request && request.details && request.details.reason) {\n                    const rid = request.rid ? String(request.rid) : '';\n                    msg += `<div class=\"textSmall\" style=\"opacity:.85;margin-top:.35rem;\">Debug: ${String(request.details.reason)}${rid ? ' (rid ' + rid + ')' : ''}<\/div>`;\n                }\n            } catch (e) {}\n\n            if (errEl){ errEl.innerHTML = msg; errEl.classList.remove('hidden'); }\n            return;\n        }\n\n        \/\/ Cancellation is scheduled: keep tier, but store the effective expiry.\n        try {\n            const updated = BUDDYUP.getCurrentUser();\n            if (updated){\n                if (request && request.effective_expires_at) {\n                    updated.subscription_expires_at = request.effective_expires_at;\n                }\n                updated.cancel_pending = true;\n                BUDDYUP.setUser(updated);\n            }\n        } catch (e) {}\n\n        BUDDYUP.closeModal();\n        const until = request && request.effective_expires_at ? String(request.effective_expires_at) : '';\n        const extra = until ? `<div class=\"textSmall\" style=\"opacity:.85;\">You will keep access until: <strong>${until}<\/strong><\/div>` : '';\n        BUDDYUP.openModal(`<p>Your subscription has been scheduled to cancel.<\/p>${extra}`, 'Success', 'buddyUpCancelSubscriptionSuccessModal');\n    });\n}\n\/*Contact sync - full sync for Android, fallbacks for iOS*\/\nfunction buddyUpNormalizeEmail(email){\n    if (!email || typeof email !== 'string') return '';\n    return email.trim().toLowerCase();\n}\n\nfunction buddyUpNormalizePhone(phone){\n    if (!phone || typeof phone !== 'string') return '';\n    const digits = phone.replace(\/\\D+\/g, '');\n    return digits.length >= 7 ? digits : '';\n}\n\nfunction buddyUpUniqueStrings(values){\n    const out = [];\n    const seen = {};\n    (Array.isArray(values) ? values : []).forEach((value) => {\n        if (!value || seen[value]) return;\n        seen[value] = true;\n        out.push(value);\n    });\n    return out;\n}\n\nfunction buddyUpPhoneVariants(phone){\n    const normalized = buddyUpNormalizePhone(phone);\n    if (!normalized) return [];\n\n    const options = [normalized];\n    if (normalized.length > 10) {\n        options.push(normalized.slice(-10));\n    }\n\n    return buddyUpUniqueStrings(options);\n}\n\nfunction buddyUpContactDisplayName(contact){\n    const name = contact && contact.name ? String(contact.name).trim() : '';\n    return name || 'Contact';\n}\n\nfunction buddyUpNormalizeContact(contact){\n    if (!contact || typeof contact !== 'object') return null;\n\n    const phonesRaw = Array.isArray(contact.phones) ? contact.phones : [];\n    const emailsRaw = Array.isArray(contact.emails) ? contact.emails : [];\n\n    const phones = buddyUpUniqueStrings(\n        phonesRaw\n            .map((value) => buddyUpNormalizePhone(String(value || '')))\n            .filter(Boolean)\n    );\n\n    const emails = buddyUpUniqueStrings(\n        emailsRaw\n            .map((value) => buddyUpNormalizeEmail(String(value || '')))\n            .filter(Boolean)\n    );\n\n    if (phones.length === 0 && emails.length === 0) return null;\n\n    return {\n        name: buddyUpContactDisplayName(contact),\n        phones,\n        emails,\n    };\n}\n\n\/*determine if mobile browser supports the contacts picker API *\/\nfunction buddyUpContactsPickerSupported(){\n    return !!(navigator && navigator.contacts && typeof navigator.contacts.select === 'function');\n}\n\nfunction buddyUpCollectContactsFromPicker(rawContacts){\n    const contacts = [];\n    const seen = {};\n\n    if (!Array.isArray(rawContacts)) return contacts;\n\n    rawContacts.forEach((entry) => {\n        const names = Array.isArray(entry && entry.name) ? entry.name : [];\n        const phones = Array.isArray(entry && entry.tel) ? entry.tel : [];\n        const emails = Array.isArray(entry && entry.email) ? entry.email : [];\n        const normalized = buddyUpNormalizeContact({\n            name: names.length > 0 && names[0] ? String(names[0]) : 'Contact',\n            phones,\n            emails,\n        });\n\n        if (!normalized) return;\n\n        const dedupeKey = `${normalized.name}|${normalized.phones.join('|')}|${normalized.emails.join('|')}`;\n        if (seen[dedupeKey]) return;\n        seen[dedupeKey] = true;\n        contacts.push(normalized);\n    });\n\n    return contacts;\n}\n\n\/*Manual contact entry for unsupported browsers*\/\nfunction buddyUpPromptManualContacts(){\n    const content = `\n        <p>Contact sync is not available on your device. Paste phone numbers and\/or email addresses below (comma, space, or new line separated).<\/p>\n\n        <div class=\"buddyUpElWrapper\" style=\"padding:.6rem .7rem; margin-bottom:.5rem;\">\n            <div style=\"font-weight:600; margin-bottom:.4rem;\">Paste Phone Numbers<\/div>\n            <textarea id=\"buddyUpContactsPhoneInput\" class=\"buddyUpInput\" rows=\"4\" placeholder=\"(555) 123-4567, +1 555 000 1111\"><\/textarea>\n        <\/div>\n\n        <div class=\"buddyUpElWrapper\" style=\"padding:.6rem .7rem;\">\n            <div style=\"font-weight:600; margin-bottom:.4rem;\">Paste Emails<\/div>\n            <textarea id=\"buddyUpContactsEmailInput\" class=\"buddyUpInput\" rows=\"4\" placeholder=\"friend1@email.com, friend2@email.com\"><\/textarea>\n        <\/div>\n\n        <div class=\"buddyUpErrorMessage hidden\" id=\"buddyUpContactsEmailError\" style=\"margin-top:.5rem;\"><\/div>\n        <div style=\"display:flex;gap:.5rem;justify-content:flex-end;margin-top:1rem;\">\n            <button type=\"button\" class=\"buddyUpButton3\" id=\"buddyUpContactsCancelBtn\">Close<\/button>\n            <button type=\"button\" class=\"buddyUpButton1\" id=\"buddyUpContactsSearchBtn\">Find Contacts<\/button>\n        <\/div>\n    `;\n\n    BUDDYUP.openModal(content, 'Find Contacts on BuddyUp', 'buddyUpContactsFallbackModal');\n\n    return new Promise((resolve) => {\n        const cancelBtn = document.getElementById('buddyUpContactsCancelBtn');\n        const searchBtn = document.getElementById('buddyUpContactsSearchBtn');\n        const phoneInput = document.getElementById('buddyUpContactsPhoneInput');\n        const input = document.getElementById('buddyUpContactsEmailInput');\n        const err = document.getElementById('buddyUpContactsEmailError');\n\n        if (cancelBtn){\n            cancelBtn.addEventListener('click', (e) => {\n                e.preventDefault();\n                BUDDYUP.closeModal();\n                resolve([]);\n            });\n        }\n\n        if (searchBtn){\n            searchBtn.addEventListener('click', (e) => {\n                e.preventDefault();\n                const rawPhones = phoneInput && phoneInput.value ? String(phoneInput.value) : '';\n                const rawEmails = input && input.value ? String(input.value) : '';\n\n                const phones = buddyUpUniqueStrings(\n                    rawPhones\n                        .split(\/[\\s,;]+\/g)\n                        .map(v => buddyUpNormalizePhone(v))\n                        .filter(Boolean)\n                );\n\n                const emails = buddyUpUniqueStrings(\n                    rawEmails\n                        .split(\/[\\s,;]+\/g)\n                        .map(v => buddyUpNormalizeEmail(v))\n                        .filter(v => \/^\\S+@\\S+\\.\\S+$\/.test(v))\n                );\n\n                const unique = [];\n                phones.forEach((phone) => {\n                    unique.push({ name: 'Contact', phones: [phone], emails: [] });\n                });\n                emails.forEach((email) => {\n                    unique.push({ name: 'Contact', phones: [], emails: [email] });\n                });\n\n                if (unique.length === 0){\n                    if (err){\n                        err.innerHTML = 'Please add at least one valid phone number or email address.';\n                        err.classList.remove('hidden');\n                    }\n                    return;\n                }\n\n                BUDDYUP.closeModal();\n                resolve(unique);\n            });\n        }\n    });\n}\n\/*Invite contacts if there is no match for their email*\/\nfunction buddyUpBuildInvitePayload(){\n    const inviteUrl = (buddyUpVariables && buddyUpVariables.register_link) ? buddyUpVariables.register_link : (buddyUpVariables && buddyUpVariables.home_link ? buddyUpVariables.home_link : window.location.origin);\n    const text = `Join me on BuddyUp! ${inviteUrl}`;\n    return {\n        url: inviteUrl,\n        text,\n        title: 'Join BuddyUp',\n    };\n}\n\nfunction buddyUpBuildSmsHref(phone, bodyText){\n    const numbers = Array.isArray(phone)\n        ? phone\n        : String(phone || '').split(',');\n\n    const recipients = buddyUpUniqueStrings(\n        numbers\n            .map((value) => buddyUpNormalizePhone(String(value || '')))\n            .filter(Boolean)\n    ).join(',');\n\n    if (!recipients) return '';\n\n    const ua = (navigator && navigator.userAgent) ? navigator.userAgent.toLowerCase() : '';\n    const isApple = ua.includes('iphone') || ua.includes('ipad') || ua.includes('ipod');\n    const delimiter = isApple ? '&' : '?';\n    return `sms:${recipients}${delimiter}body=${encodeURIComponent(bodyText)}`;\n}\n\nasync function buddyUpTryShareInvite(payload){\n    try {\n        if (navigator && typeof navigator.share === 'function') {\n            await navigator.share({ title: payload.title, text: payload.text, url: payload.url });\n            return true;\n        }\n    } catch (e) {}\n    return false;\n}\n\nasync function buddyUpInviteContact(contact, channel){\n    const data = buddyUpNormalizeContact(contact);\n    if (!data) return;\n\n    const payload = buddyUpBuildInvitePayload();\n    const firstPhone = data.phones.length ? data.phones[0] : '';\n    const firstEmail = data.emails.length ? data.emails[0] : '';\n\n    if (channel === 'sms' && firstPhone) {\n        const smsHref = buddyUpBuildSmsHref(firstPhone, payload.text);\n        if (smsHref) {\n            window.location.href = smsHref;\n            return;\n        }\n    }\n\n    if (channel === 'email' && firstEmail) {\n        const subject = encodeURIComponent('Join me on BuddyUp');\n        const body = encodeURIComponent(payload.text);\n        window.location.href = `mailto:${firstEmail}?subject=${subject}&body=${body}`;\n        return;\n    }\n\n    const shared = await buddyUpTryShareInvite(payload);\n    if (shared) return;\n\n    if (firstEmail) {\n        const subject = encodeURIComponent('Join me on BuddyUp');\n        const body = encodeURIComponent(payload.text);\n        window.location.href = `mailto:${firstEmail}?subject=${subject}&body=${body}`;\n    }\n}\n\n\/*invite all unmatched contacts at once*\/\nasync function buddyUpInviteAllUnmatched(unmatchedContacts, channel){\n    if (!Array.isArray(unmatchedContacts) || unmatchedContacts.length === 0) return;\n\n    const payload = buddyUpBuildInvitePayload();\n    const allPhones = buddyUpUniqueStrings(\n        unmatchedContacts\n            .flatMap(c => Array.isArray(c && c.phones) ? c.phones : [])\n            .map(v => buddyUpNormalizePhone(v))\n            .filter(Boolean)\n    );\n\n    const allEmails = buddyUpUniqueStrings(\n        unmatchedContacts\n            .flatMap(c => Array.isArray(c && c.emails) ? c.emails : [])\n            .map(v => buddyUpNormalizeEmail(v))\n            .filter(Boolean)\n    );\n\n    if (channel === 'sms' && allPhones.length > 0) {\n        const smsHref = buddyUpBuildSmsHref(allPhones.join(','), payload.text);\n        if (smsHref) {\n            window.location.href = smsHref;\n            return;\n        }\n    }\n\n    if (channel === 'email' && allEmails.length > 0) {\n        const subject = encodeURIComponent('Join me on BuddyUp');\n        const body = encodeURIComponent(payload.text);\n        window.location.href = `mailto:${allEmails.join(',')}?subject=${subject}&body=${body}`;\n        return;\n    }\n\n    const shared = await buddyUpTryShareInvite(payload);\n    if (shared) return;\n\n    if (allEmails.length > 0) {\n        const subject = encodeURIComponent('Join me on BuddyUp');\n        const body = encodeURIComponent(payload.text);\n        window.location.href = `mailto:${allEmails.join(',')}?subject=${subject}&body=${body}`;\n    }\n}\n\nfunction buddyUpUserPhoneVariants(user){\n    const variants = [];\n    if (!user || typeof user !== 'object') return variants;\n\n    ['mobile_phone', 'phone', 'phone_number'].forEach((key) => {\n        if (!user[key]) return;\n        variants.push.apply(variants, buddyUpPhoneVariants(String(user[key])));\n    });\n\n    return buddyUpUniqueStrings(variants);\n}\n\nfunction buddyUpSelectBestContactMatch(users, contact, liveUserId){\n    if (!Array.isArray(users) || !contact) return null;\n\n    const emailSet = {};\n    (Array.isArray(contact.emails) ? contact.emails : []).forEach((email) => {\n        const normalized = buddyUpNormalizeEmail(email);\n        if (normalized) emailSet[normalized] = true;\n    });\n\n    const phoneSet = {};\n    (Array.isArray(contact.phones) ? contact.phones : []).forEach((phone) => {\n        buddyUpPhoneVariants(phone).forEach((variant) => {\n            if (variant) phoneSet[variant] = true;\n        });\n    });\n\n    let best = null;\n    let bestScore = -1;\n\n    users.forEach((user) => {\n        if (!user || !user.id || String(user.id) === String(liveUserId)) return;\n\n        let score = 0;\n\n        const userEmail = buddyUpNormalizeEmail(user && user.email_address ? user.email_address : '');\n        if (userEmail && emailSet[userEmail]) score += 20;\n\n        const userPhones = buddyUpUserPhoneVariants(user);\n        userPhones.forEach((value) => {\n            if (phoneSet[value]) score += 100;\n        });\n\n        if (score > bestScore) {\n            best = user;\n            bestScore = score;\n        }\n    });\n\n    return bestScore > 0 ? best : null;\n}\n\nasync function buddyUpRunContactsSyncHelper(){\n    const liveUser = BUDDYUP.getCurrentUser();\n    if (!liveUser || !liveUser.id){\n        BUDDYUP.openModal(`<p>Please log in again to continue.<\/p><a href=\"${buddyUpVariables.login_link}\" class=\"buddyUpButton1\">Log in<\/a>`, 'Session required', 'buddyUpContactsSyncSessionRequired');\n        return;\n    }\n\n    let selectedContacts = [];\n\n    if (buddyUpContactsPickerSupported()){\n        try {\n            const picked = await navigator.contacts.select(['name', 'tel', 'email'], { multiple: true });\n            selectedContacts = buddyUpCollectContactsFromPicker(picked);\n        } catch (e) {\n            selectedContacts = [];\n        }\n    }\n\n    if (!Array.isArray(selectedContacts) || selectedContacts.length === 0){\n        selectedContacts = await buddyUpPromptManualContacts();\n    }\n\n    if (!Array.isArray(selectedContacts) || selectedContacts.length === 0){\n        return;\n    }\n\n    selectedContacts = selectedContacts\n        .map((contact) => buddyUpNormalizeContact(contact))\n        .filter(Boolean);\n\n    if (selectedContacts.length === 0) return;\n\n    BUDDYUP.openModal(`<div style=\"padding:1rem 0;\">${BUDDYUP.loading('Matching contacts on BuddyUp')}<\/div>`, 'Finding Matches', 'buddyUpContactsSyncLoading');\n\n    const usersById = {};\n    const matchedContactIndexes = {};\n\n    for (let i = 0; i < selectedContacts.length; i++){\n        const contact = selectedContacts[i];\n        if (!contact) continue;\n\n        let matchedUser = null;\n        const phoneTerms = buddyUpUniqueStrings(\n            (Array.isArray(contact.phones) ? contact.phones : [])\n                .flatMap((phone) => buddyUpPhoneVariants(phone))\n        );\n        const emailTerms = buddyUpUniqueStrings(Array.isArray(contact.emails) ? contact.emails : []);\n\n        const searchTerms = phoneTerms.concat(emailTerms);\n        for (const term of searchTerms){\n            const found = await BUDDYUP.apiRequest('users-admin-search', { search: term });\n            if (!found || found.status !== 'success' || !Array.isArray(found.users) || found.users.length === 0) continue;\n\n            matchedUser = buddyUpSelectBestContactMatch(found.users, contact, liveUser.id);\n            if (matchedUser) break;\n        }\n\n        if (matchedUser && matchedUser.id){\n            usersById[matchedUser.id] = matchedUser;\n            matchedContactIndexes[i] = true;\n        }\n    }\n\n    const matchedUsers = Object.values(usersById);\n    const unmatchedContacts = selectedContacts.filter((contact, index) => !matchedContactIndexes[index]);\n\n    const unmatchedCount = unmatchedContacts.length;\n\n    \/* For each matched contact, fetch friendship state so we can render the correct button.*\/\n    const relationByUserId = {};\n    await Promise.all(matchedUsers.map(async (user) => {\n        const uid = user && user.id ? Number(user.id) : 0;\n        if (!uid) return;\n\n        try {\n            const rel = await BUDDYUP.apiRequest('account-get', { id: uid });\n            const val = rel && rel.status === 'success' && typeof rel.is_buddy !== 'undefined'\n                ? Number(rel.is_buddy)\n                : 0;\n            relationByUserId[uid] = Number.isNaN(val) ? 0 : val;\n        } catch (e) {\n            relationByUserId[uid] = 0;\n        }\n    }));\n\n    let listHtml = `<p style=\"margin-bottom:.25rem;\">Found <strong>${matchedUsers.length}<\/strong> BuddyUp match${matchedUsers.length === 1 ? '' : 'es'}.<\/p>`;\n    listHtml += `<p class=\"textSmall\" style=\"margin-top:0;opacity:.85;\">${unmatchedCount} contact${unmatchedCount === 1 ? '' : 's'} not matched.<\/p>`;\n\n    if (matchedUsers.length > 0){\n        listHtml += '<div id=\"buddyUpContactMatchesList\" style=\"display:flex;flex-direction:column;gap:.6rem;\">';\n    }\n    matchedUsers.forEach((user) => {\n        const relation = Number(relationByUserId[Number(user.id)] || 0);\n        const isDisabled = relation === 1 || relation === 2 || relation === 3;\n        const buttonLabel = relation === 1\n            ? 'Already Buddy'\n            : relation === 2\n                ? 'Pending'\n                : relation === 3\n                    ? 'Blocked'\n                    : 'Add Buddy';\n\n        const image = BUDDYUP.profileImageSrc(user.profile_image);\n        const name = user.full_name ? String(user.full_name) : 'BuddyUp User';\n        const username = user && user.username ? `@${String(user.username)}` : 'BuddyUp User';\n        listHtml += `\n            <div class=\"buddyUpElWrapper\" style=\"padding:.55rem .65rem;display:flex;align-items:center;gap:.65rem;\">\n                <img decoding=\"async\" src=\"${image}\" alt=\"${name}\" onerror=\"BUDDYUP.onErrProfileImage(this)\" style=\"height:38px;width:38px;border-radius:999px;object-fit:cover;\" \/>\n                <div style=\"min-width:0;flex:1;\">\n                    <div style=\"font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;\">${username}<\/div>\n                <\/div>\n                <button type=\"button\" class=\"buddyUpButton1 buddyUpContactsAddBuddy\" data-user-id=\"${user.id}\" data-relation=\"${relation}\" style=\"margin:0;\" ${isDisabled ? 'disabled=\"disabled\"' : ''}>${buttonLabel}<\/button>\n            <\/div>\n        `;\n    });\n    if (matchedUsers.length > 0){\n        listHtml += '<\/div>';\n    }\n\n    if (unmatchedCount > 0){\n        listHtml += `\n            <div style=\"margin-top:1rem;\">\n                <div style=\"font-weight:700;margin-bottom:.45rem;\">Invite to BuddyUp<\/div>\n                <div style=\"display:flex;flex-wrap:wrap;gap:.4rem;margin:.1rem 0 .6rem 0;\">\n                    <button type=\"button\" id=\"buddyUpContactsInviteAllShareBtn\" class=\"buddyUpButton3\" style=\"margin:0;\">Invite All<\/button>\n                    <button type=\"button\" id=\"buddyUpContactsInviteAllSmsBtn\" class=\"buddyUpButton3\" style=\"margin:0;\">Invite All via SMS<\/button>\n                    <button type=\"button\" id=\"buddyUpContactsInviteAllEmailBtn\" class=\"buddyUpButton3\" style=\"margin:0;\">Invite All via Email<\/button>\n                <\/div>\n                <div id=\"buddyUpContactInviteList\" style=\"display:flex;flex-direction:column;gap:.45rem;\"><\/div>\n            <\/div>\n        `;\n    }\n\n    if (matchedUsers.length === 0 && unmatchedCount === 0){\n        listHtml += `<p class=\"textSmall\" style=\"margin-top:.5rem;\">No valid contacts were selected.<\/p>`;\n    }\n\n    BUDDYUP.openModal(listHtml, 'Contact Results', 'buddyUpContactsSyncMatches');\n\n    if (unmatchedCount > 0){\n        const inviteList = document.getElementById('buddyUpContactInviteList');\n        if (inviteList){\n            unmatchedContacts.forEach((contact, index) => {\n                const name = buddyUpContactDisplayName(contact);\n                const hasPhone = Array.isArray(contact && contact.phones) && contact.phones.length > 0;\n                const hasEmail = Array.isArray(contact && contact.emails) && contact.emails.length > 0;\n\n                inviteList.insertAdjacentHTML('beforeend', `\n                    <div class=\"buddyUpElWrapper\" style=\"padding:.5rem .65rem;display:flex;align-items:center;gap:.65rem;\">\n                        <div style=\"min-width:0;flex:1;\">\n                            <div style=\"font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;\">${name}<\/div>\n                        <\/div>\n                        <div style=\"display:flex;gap:.35rem;flex-wrap:wrap;justify-content:flex-end;\">\n                            <button type=\"button\" class=\"buddyUpButton1 buddyUpContactsInviteBtn\" data-contact-index=\"${index}\" data-channel=\"share\" style=\"margin:0;\">Invite<\/button>\n                            <button type=\"button\" class=\"buddyUpButton1 buddyUpContactsInviteBtn\" data-contact-index=\"${index}\" data-channel=\"sms\" style=\"margin:0;\" ${hasPhone ? '' : 'disabled=\"disabled\"'}>SMS<\/button>\n                            <button type=\"button\" class=\"buddyUpButton1 buddyUpContactsInviteBtn\" data-contact-index=\"${index}\" data-channel=\"email\" style=\"margin:0;\" ${hasEmail ? '' : 'disabled=\"disabled\"'}>Email<\/button>\n                        <\/div>\n                    <\/div>\n                `);\n            });\n        }\n\n        const inviteAllShareBtn = document.getElementById('buddyUpContactsInviteAllShareBtn');\n        if (inviteAllShareBtn){\n            inviteAllShareBtn.addEventListener('click', async (e) => {\n                e.preventDefault();\n                inviteAllShareBtn.setAttribute('disabled', 'disabled');\n                await buddyUpInviteAllUnmatched(unmatchedContacts, 'share');\n                inviteAllShareBtn.removeAttribute('disabled');\n            });\n        }\n\n        const inviteAllSmsBtn = document.getElementById('buddyUpContactsInviteAllSmsBtn');\n        if (inviteAllSmsBtn){\n            if (!unmatchedContacts.some(c => Array.isArray(c && c.phones) && c.phones.length > 0)) {\n                inviteAllSmsBtn.setAttribute('disabled', 'disabled');\n            }\n            inviteAllSmsBtn.addEventListener('click', async (e) => {\n                e.preventDefault();\n                inviteAllSmsBtn.setAttribute('disabled', 'disabled');\n                await buddyUpInviteAllUnmatched(unmatchedContacts, 'sms');\n                inviteAllSmsBtn.removeAttribute('disabled');\n            });\n        }\n\n        const inviteAllEmailBtn = document.getElementById('buddyUpContactsInviteAllEmailBtn');\n        if (inviteAllEmailBtn){\n            if (!unmatchedContacts.some(c => Array.isArray(c && c.emails) && c.emails.length > 0)) {\n                inviteAllEmailBtn.setAttribute('disabled', 'disabled');\n            }\n            inviteAllEmailBtn.addEventListener('click', async (e) => {\n                e.preventDefault();\n                inviteAllEmailBtn.setAttribute('disabled', 'disabled');\n                await buddyUpInviteAllUnmatched(unmatchedContacts, 'email');\n                inviteAllEmailBtn.removeAttribute('disabled');\n            });\n        }\n\n        const inviteButtons = document.querySelectorAll('.buddyUpContactsInviteBtn');\n        inviteButtons.forEach((btn) => {\n            btn.addEventListener('click', async (e) => {\n                e.preventDefault();\n                const indexRaw = btn.getAttribute('data-contact-index') || '-1';\n                const channel = btn.getAttribute('data-channel') || 'share';\n                const index = Number(indexRaw);\n                if (Number.isNaN(index) || index < 0 || index >= unmatchedContacts.length) return;\n                const contact = unmatchedContacts[index];\n\n                btn.setAttribute('disabled', 'disabled');\n                await buddyUpInviteContact(contact, channel);\n                btn.innerHTML = 'Invited';\n            });\n        });\n    }\n\n    const addButtons = document.querySelectorAll('.buddyUpContactsAddBuddy');\n    addButtons.forEach((btn) => {\n        btn.addEventListener('click', async (e) => {\n            e.preventDefault();\n            const userId = btn.getAttribute('data-user-id');\n            const relation = Number(btn.getAttribute('data-relation') || '0');\n            if (!userId) return;\n            if (relation === 1 || relation === 2 || relation === 3) return;\n\n            btn.setAttribute('disabled', 'disabled');\n            const addResp = await BUDDYUP.apiRequest('buddy-add', { id: userId, current_user_id: liveUser.id });\n            if (addResp && addResp.status === 'success'){\n                btn.innerHTML = 'Requested';\n                btn.setAttribute('data-relation', '2');\n                return;\n            }\n\n            const errMsg = String((addResp && (addResp.message || addResp.data || addResp.error)) || '').toLowerCase();\n            if (errMsg.includes('already') && errMsg.includes('buddy')) {\n                btn.innerHTML = 'Already Buddy';\n                btn.setAttribute('data-relation', '1');\n                return;\n            }\n            if (errMsg.includes('pending') || errMsg.includes('request')) {\n                btn.innerHTML = 'Pending';\n                btn.setAttribute('data-relation', '2');\n                return;\n            }\n\n            btn.removeAttribute('disabled');\n            const msg = (addResp && (addResp.message || addResp.data || addResp.error)) ? (addResp.message || addResp.data || addResp.error) : 'Please wait a moment and try again.';\n            BUDDYUP.openModal(msg, 'Could not add buddy', 'buddyUpContactsSyncAddError');\n        });\n    });\n}\n\/*end contact sync*\/\n\nif (accountWrapper){\n    var accountPageUserID = accountWrapper.getAttribute('data-userid'); \/\/ Get current user id\n    var buddyUpAccountHasSubscriptionSuccess = buddyUpAccountHasSubscriptionSuccessParam();\n    var buddyUpAccountSubscriptionTierHint = buddyUpAccountGetSubscriptionTierHintParam();\n\n    buddyUpAccountDebug('[BuddyUp][account_theme] init', {\n        accountPageUserID,\n        currentUserId: currentUser && currentUser.id ? currentUser.id : null,\n        subscriptionSuccess: buddyUpAccountHasSubscriptionSuccess,\n        subscriptionTierHint: buddyUpAccountSubscriptionTierHint,\n    });\n\n    if (!currentUser || accountPageUserID == currentUser.id){ \/\/ If user is not signed in  remove the add buddy and messaging buttons\n        BUDDYUP.clearAllElements('.userAddBuddyWrapper, #buddySendMessageWrapper');\n    }\n\n    async function getUserData(accountPageUserID){\n        const userToGet = currentUser && accountPageUserID === 'current' ? currentUser.id : accountPageUserID;\n\n        const requestData = {'id': userToGet};\n        if (buddyUpAccountHasSubscriptionSuccess) {\n            requestData._force = true;\n            requestData._cb = Date.now();\n        }\n\n        buddyUpAccountDebug('[BuddyUp][account_theme] account-get START', {\n            accountPageUserID,\n            userToGet,\n            currentUserId: currentUser && currentUser.id ? currentUser.id : null,\n            forced: !!requestData._force,\n        });\n        const userData = await BUDDYUP.apiRequest('account-get', requestData);\n\n        buddyUpAccountDebug('[BuddyUp][account_theme] account-get RESPONSE', {\n            status: userData && userData.status,\n            keys: (userData && typeof userData === 'object') ? Object.keys(userData) : null,\n            tierFields: userData ? {\n                user_subscription: userData.user_subscription,\n                subscription: userData.subscription,\n                subscription_tier: userData.subscription_tier,\n                tier: userData.tier,\n            } : null,\n        });\n        \n        if (userToGet != currentUser.id) {\n            BUDDYUP.clearAllElements('#buddyUpUserNavigation');\n        }\n\n        if (userData.status === 'success'){\n            \/\/ Show PWA popup if this is a newly logged in user\n            if (localStorage.getItem('buddyup_new_user') == 'true'){\n                const buddyUpPWAMessage = `<div id=\"buddyUpPWAMessage\" class=\"flexWrapper buddyUpWrapper\">\n                    <div style=\"font-size: .9rem;\">For the best experience, install the <strong>Web App<\/strong> to your home screen directly from your browser by clicking the button below or by using the toolbar at the bottom of the page.<\/div>\n                    <div><button class=\"buddyUpButton1 buddyUpAccountDownloadPWA\" style=\"margin: 0;\">Download App<\/button><\/div>\n                <\/div>`;\n                document.getElementById('accountInformationContent').insertAdjacentHTML('afterbegin', buddyUpPWAMessage);\n\n                localStorage.removeItem('buddyup_new_user');\n            }\n\n            \/\/ Add full name\n            const safeDisplayName = BUDDYUP.displayNameFromUser(userData, 'User');\n            document.getElementById('userName').innerHTML = safeDisplayName;\n\n            \/\/ Update profile image\n            const profileImageEl = document.getElementById('profileImage');\n            if (profileImageEl){\n                profileImageEl.setAttribute('src', BUDDYUP.profileImageSrc(userData.profile_image));\n                profileImageEl.setAttribute('alt', `Image of ${safeDisplayName}`);\n                profileImageEl.setAttribute('onerror', 'BUDDYUP.onErrProfileImage(this)');\n            }\n\n            const isSelfProfileAccount = currentUser && (\n                accountPageUserID === 'current' ||\n                String(accountPageUserID) === String(currentUser.id) ||\n                String(userData.id) === String(currentUser.id)\n            );\n            const isBuddy = Number(userData.is_buddy || 0) === 1;\n            const isPrivate = (userData.private === true || userData.private === 1 || userData.private === '1');\n            const isPrivateRestrictedView = !!(!isSelfProfileAccount && isPrivate && !isBuddy);\n\n            const privateOverlayEl = document.getElementById('buddyUpPrivateAccountOverlay');\n            if (privateOverlayEl) {\n                privateOverlayEl.classList.toggle('hidden', !isPrivateRestrictedView);\n            }\n            const accountWrapperEl = document.getElementById('accountWrapper');\n            if (accountWrapperEl) {\n                accountWrapperEl.classList.toggle('isPrivateAccountView', isPrivateRestrictedView);\n            }\n\n            \/\/ Add the VIEWED USER's subscription badge\n            \/\/ Tier may arrive under several aliases depending on backend\/proxy shape.\n            \/\/ IMPORTANT: Use userData (the viewed\/fetched user), NOT current user's subscription\n            let viewedUserTier =\n                (typeof userData.user_subscription !== 'undefined' ? userData.user_subscription : null);\n            viewedUserTier = viewedUserTier === null && typeof userData.subscription !== 'undefined' ? userData.subscription : viewedUserTier;\n            viewedUserTier = viewedUserTier === null && typeof userData.subscription_tier !== 'undefined' ? userData.subscription_tier : viewedUserTier;\n            viewedUserTier = viewedUserTier === null && typeof userData.tier !== 'undefined' ? userData.tier : viewedUserTier;\n            viewedUserTier = (BUDDYUP && typeof BUDDYUP.normalizeSubscriptionTier === 'function')\n                ? BUDDYUP.normalizeSubscriptionTier(viewedUserTier)\n                : (isNaN(parseInt(viewedUserTier)) ? 0 : parseInt(viewedUserTier));\n\n            if (isSelfProfileAccount && buddyUpAccountHasSubscriptionSuccess && buddyUpAccountSubscriptionTierHint > viewedUserTier) {\n                buddyUpAccountDebug('[BuddyUp][account_theme] applying subscription tier hint override', {\n                    fromTier: viewedUserTier,\n                    toTier: buddyUpAccountSubscriptionTierHint,\n                });\n                viewedUserTier = buddyUpAccountSubscriptionTierHint;\n            }\n\n            buddyUpAccountDebug('[BuddyUp][account_theme] computed viewedUserTier', {\n                viewedUserTier,\n                raw: {\n                    user_subscription: userData.user_subscription,\n                    subscription: userData.subscription,\n                    subscription_tier: userData.subscription_tier,\n                    tier: userData.tier,\n                }\n            });\n\n            if (isSelfProfileAccount) {\n                buddyUpAccountSyncSelfTierCache(userData, viewedUserTier);\n            }\n\n            buddyUpAccountShowSubscriptionSuccessModal(userData, viewedUserTier, isSelfProfileAccount);\n\n            document.querySelector('#profileSidebarContent .imageWrapper').insertAdjacentHTML('beforeend', `${BUDDYUP.subscriptionBadge(viewedUserTier)}`);\n\n            \/\/ Swap the sidebar subscription action\n            const wrapperInfo = buddyUpFindAccountSubscriptionActionWrapper();\n            const subscriptionActionWrapper = wrapperInfo && wrapperInfo.el ? wrapperInfo.el : null;\n            const liveUser = (BUDDYUP && typeof BUDDYUP.getCurrentUser === 'function') ? BUDDYUP.getCurrentUser() : currentUser;\n            const isSelfAccount = !!(liveUser && liveUser.id && (\n                accountPageUserID === 'current' ||\n                String(accountPageUserID) === String(liveUser.id) ||\n                String(userToGet) === String(liveUser.id)\n            ));\n\n            buddyUpAccountDebug('[BuddyUp][account_theme] subscriptionAction check', {\n                hasWrapper: !!subscriptionActionWrapper,\n                via: wrapperInfo ? wrapperInfo.via : null,\n                isSelfAccount,\n                viewedUserTier,\n                accountPageUserID,\n                userToGet,\n                liveUserId: liveUser && liveUser.id ? liveUser.id : null,\n            });\n\n            if (!subscriptionActionWrapper && buddyUpAccountDebugEnabled()) {\n                try {\n                    const nav = document.getElementById('buddyUpUserNavigation');\n                    const navIds = nav ? Array.from(nav.querySelectorAll('[id]')).map(n => n.id) : [];\n                    const hasExplore = !!document.querySelector('a.buddyUpUserNavigationViewSubscriptionTiers');\n                    buddyUpAccountDebug('[BuddyUp][account_theme] subscriptionAction wrapper missing (details)', {\n                        navExists: !!nav,\n                        navIds,\n                        hasExplore,\n                    });\n                } catch (e) {}\n            }\n\n            \/\/ Retry a few times in case DOM is being replaced\/late-rendered.\n            const trySwapLater = (delayMs) => {\n                try {\n                    setTimeout(() => {\n                        const wi = buddyUpFindAccountSubscriptionActionWrapper();\n                        const w = wi && wi.el ? wi.el : null;\n                        buddyUpAccountDebug('[BuddyUp][account_theme] subscriptionAction retry', { delayMs, hasWrapper: !!w, via: wi ? wi.via : null, mode: wi ? wi.mode : null, isSelfAccount, viewedUserTier });\n                        if (w && isSelfAccount && viewedUserTier && Number(viewedUserTier) > 0) {\n                            const cancelBtnHtml = `<button type=\"button\" class=\"buddyUpUserNavigationCancelSubscription buddyUpButton4\" aria-label=\"Cancel my subscription\"><i class=\"fa fa-solid fa-ban fa-fw\"><\/i> Cancel my subscription<\/button>`;\n\n                            \/\/ Add the cancel button alongside the explore link\n                            w.insertAdjacentHTML('beforeend', cancelBtnHtml);\n                            const btn = w.querySelector('.buddyUpUserNavigationCancelSubscription');\n                            if (btn){\n                                btn.addEventListener('click', (e) => {\n                                    e.preventDefault();\n                                    buddyUpCancelSubscriptionFlow({ reset: false });\n                                });\n                            }\n                            buddyUpAccountDebug('[BuddyUp][account_theme] subscriptionAction ADDED cancel button (retry)', { delayMs, viewedUserTier });\n                        }\n                    }, delayMs);\n                } catch (e) {}\n            };\n\n            if (subscriptionActionWrapper && isSelfAccount){\n                if (viewedUserTier && Number(viewedUserTier) > 0){\n                    const cancelBtnHtml = `<button type=\"button\" class=\"buddyUpUserNavigationCancelSubscription buddyUpButton4\" aria-label=\"Cancel my subscription\"><i class=\"fa fa-solid fa-ban fa-fw\"><\/i> Cancel my subscription<\/button>`;\n\n                    \/\/ Add the cancel button alongside the explore link\n                    subscriptionActionWrapper.insertAdjacentHTML('beforeend', cancelBtnHtml);\n                    const btn = subscriptionActionWrapper.querySelector('.buddyUpUserNavigationCancelSubscription');\n                    if (btn){\n                        btn.addEventListener('click', (e) => {\n                            e.preventDefault();\n                            buddyUpCancelSubscriptionFlow({ reset: false });\n                        });\n                    }\n                    buddyUpAccountDebug('[BuddyUp][account_theme] subscriptionAction ADDED cancel button', { viewedUserTier });\n                } else {\n                    \/\/ Free tier: keep the Explore tiers link as-is.\n                    buddyUpAccountDebug('[BuddyUp][account_theme] subscriptionAction NOT swapped (free tier)', { viewedUserTier });\n                }\n            } else {\n                \/\/ No wrapper yet (or not self): retry a couple times.\n                if (isSelfAccount && viewedUserTier && Number(viewedUserTier) > 0) {\n                    trySwapLater(50);\n                    trySwapLater(250);\n                    trySwapLater(1000);\n                }\n            }\n\n            \/\/ Staging Dev Panel removed\n            \n            if (!isPrivateRestrictedView) {\n                \/\/ Cycle through interests and add interest elements\n                var interestEls = '';\n                if (userData.interests.length > 0){\n                    for (i in userData.interests){\n                        var interest = userData.interests[i];\n                        interestEls += interest != '' ? `<li class=\"singlePill textSmall\">${interest}<\/li>` : '';\n                    }\n                }\n                interestEls = interestEls !== '' ? interestEls : '<li class=\"singlePill textSmall\">No Interests<\/li>';\n\n                document.getElementById('userInterests').innerHTML = '';\n                document.getElementById('userInterests').insertAdjacentHTML('beforeend', interestEls);\n\n                \/\/ Add city and state if available\n                var cityState = userData.city;\n                    cityState += cityState != '' && userData.state != '' ? ', ' : '';\n                    cityState += userData.state;\n                    cityState = cityState === '' ? ' Unknown' : cityState;\n                document.getElementById('userCityState').innerHTML = `<div><i class=\"fa fa-solid fa-map-marker fa-fw\"><\/i> ${cityState}<\/div>`;\n                \n                \/\/ Add about me if available\n                if (userData.about_me && userData.about_me != ''){\n                    document.getElementById('userAbout').innerHTML = userData.about_me;\n                } else {\n                    BUDDYUP.clearAllElements('#userAboutWrapper');\n                }\n            }\n\n            const isSelfAccountForFeed = currentUser && (\n                accountPageUserID === 'current' ||\n                String(accountPageUserID) === String(currentUser.id) ||\n                String(userData.id) === String(currentUser.id)\n            );\n\n            const escapeHtml = (value) => {\n                if (typeof BUDDYUP.escapeHtml === 'function') return BUDDYUP.escapeHtml(String(value || ''));\n                return String(value || '').replace(\/[&<>\"']\/g, (m) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '\"': '&quot;', \"'\": '&#39;' }[m]));\n            };\n\n            const buildAdventureLink = (adventureId) => {\n                const id = Number(adventureId);\n                if (!isFinite(id) || id <= 0) return '#';\n                const base = String((buddyUpVariables && buddyUpVariables.adventure_link) ? buddyUpVariables.adventure_link : '').trim();\n                if (!base) return '#';\n                return `${base}${base.indexOf('?') >= 0 ? (base.endsWith('?') || base.endsWith('&') ? '' : '&') : '?'}adventure_id=${id}`;\n            };\n\n            const getAdventureCoverMedia = (adventure) => {\n                const media = Array.isArray(adventure && adventure.media) ? adventure.media : [];\n                if (!media.length) return null;\n\n                const explicit = media.find((m) => m && (m.is_cover === true || m.cover === true || Number(m.is_cover) === 1 || Number(m.cover) === 1));\n                if (explicit && explicit.url) return explicit;\n\n                const firstImage = media.find((m) => m && m.url && String(m.type || '').toLowerCase() !== 'video');\n                if (firstImage) return firstImage;\n\n                return media.find((m) => m && m.url) || null;\n            };\n\n            const toTimeValue = (v) => {\n                const stamp = Date.parse(String(v || ''));\n                return Number.isFinite(stamp) ? stamp : 0;\n            };\n\n            const uniqueById = (rows, idGetter) => {\n                const seen = {};\n                const out = [];\n                (Array.isArray(rows) ? rows : []).forEach((row) => {\n                    const idVal = Number(idGetter(row));\n                    if (!isFinite(idVal) || idVal <= 0 || seen[idVal]) return;\n                    seen[idVal] = true;\n                    out.push(row);\n                });\n                return out;\n            };\n\n            async function renderAdventuresFeed() {\n                const feedEl = document.getElementById('buddyUpAccountAdventuresFeed');\n                if (!feedEl) return;\n\n                feedEl.innerHTML = BUDDYUP.loading('Loading adventures feed');\n\n                const ownerIds = new Set();\n                ownerIds.add(Number(userData.id));\n                (Array.isArray(userData.buddies) ? userData.buddies : []).forEach((b) => {\n                    const bid = Number(b && b.id);\n                    if (isFinite(bid) && bid > 0) ownerIds.add(bid);\n                });\n\n                const ownerMeta = {};\n                ownerMeta[Number(userData.id)] = {\n                    username: userData.username || '',\n                    full_name: userData.full_name || 'User',\n                    profile_image: userData.profile_image || '',\n                    id: Number(userData.id),\n                };\n                (Array.isArray(userData.buddies) ? userData.buddies : []).forEach((b) => {\n                    if (!b || !b.id) return;\n                    ownerMeta[Number(b.id)] = {\n                        username: b.username || '',\n                        full_name: b.full_name || `${b.first_name || ''} ${b.last_name || ''}`.trim() || 'Buddy',\n                        profile_image: b.profile_image || '',\n                        id: Number(b.id),\n                    };\n                });\n\n                const exploreResp = await BUDDYUP.apiRequest('adventures-explore-map', { limit: 400 });\n                const allPublic = exploreResp && exploreResp.status === 'success' && Array.isArray(exploreResp.adventures)\n                    ? exploreResp.adventures\n                    : [];\n\n                let visibilityById = {};\n                if (isSelfAccountForFeed && currentUser && currentUser.id) {\n                    const mineResp = await BUDDYUP.apiRequest('adventures-list-mine', { limit: 200 });\n                    const mineRows = mineResp && mineResp.status === 'success'\n                        ? (Array.isArray(mineResp.created_adventures) ? mineResp.created_adventures : (Array.isArray(mineResp.adventures) ? mineResp.adventures : []))\n                        : [];\n\n                    mineRows.forEach((row) => {\n                        const aid = Number(row && row.id);\n                        if (!isFinite(aid) || aid <= 0) return;\n                        visibilityById[aid] = {\n                            privacy: String(row.privacy || 'private') === 'public' ? 'public' : 'private',\n                            show_on_map: Number(row.show_on_map) === 1 ? 1 : 0,\n                        };\n                    });\n                }\n\n                const feedRows = allPublic\n                    .filter((row) => ownerIds.has(Number(row && row.user_id)))\n                    .sort((a, b) => toTimeValue(b && b.created_at) - toTimeValue(a && a.created_at));\n\n                const saveAdventureVisibility = async (adventureId, privacy, showOnMap) => {\n                    const upd = await BUDDYUP.apiRequest('adventures-set-visibility', {\n                        adventure_id: Number(adventureId),\n                        privacy,\n                        show_on_map: Number(showOnMap) === 1 ? 1 : 0,\n                    });\n                    return upd && upd.status === 'success';\n                };\n\n                const openAdventureActionsMenu = ({ advId, ownCard, currentVisibility, reportButtonRef }) => {\n                    const canReportAdventure = !!(currentUser && currentUser.id && !ownCard);\n\n                    let menuHtml = '<div class=\"buddyUpAdventureActionsMenu\">';\n                    if (ownCard) {\n                        const isPublic = currentVisibility.privacy === 'public';\n                        const showOnMap = Number(currentVisibility.show_on_map) === 1;\n                        menuHtml += `\n                            <h3 class=\"textHeading\" style=\"margin-top:0;margin-bottom:.4rem;\">Adventure visibility<\/h3>\n                            <label class=\"textSmall buddyUpAdventureMenuRow\" style=\"display:flex;align-items:center;gap:.35rem;\">\n                                <input type=\"checkbox\" id=\"buddyUpAdventureMenuPublicToggle\" ${isPublic ? 'checked=\"checked\"' : ''} \/>\n                                Public\n                            <\/label>\n                            <label class=\"textSmall buddyUpAdventureMenuRow\" style=\"display:flex;align-items:center;gap:.35rem;margin-top:.35rem;\">\n                                <input type=\"checkbox\" id=\"buddyUpAdventureMenuMapToggle\" ${showOnMap ? 'checked=\"checked\"' : ''} ${isPublic ? '' : 'disabled=\"disabled\"'} \/>\n                                Show on map\n                            <\/label>\n                            <div style=\"display:flex;justify-content:flex-end;gap:.5rem;margin-top:.85rem;\">\n                                <button type=\"button\" class=\"buddyUpButton1\" id=\"buddyUpAdventureMenuSaveBtn\">Save<\/button>\n                            <\/div>\n                        `;\n                    }\n\n                    if (canReportAdventure) {\n                        menuHtml += `\n                            ${ownCard ? '<hr style=\"margin:.9rem 0;border:none;border-top:1px solid rgba(0,0,0,.1);\" \/>' : ''}\n                            <button type=\"button\" class=\"buddyUpButton4\" id=\"buddyUpAdventureMenuReportBtn\" style=\"width:100%;\">\n                                <i class=\"fa fa-solid fa-flag\"><\/i> Report Adventure\n                            <\/button>\n                        `;\n                    }\n\n                    if (!ownCard && !canReportAdventure) {\n                        menuHtml += '<div class=\"textSmall\">No actions available.<\/div>';\n                    }\n                    menuHtml += '<\/div>';\n\n                    BUDDYUP.openModal(menuHtml, 'Adventure Actions', 'buddyUpAdventureActionsModal');\n\n                    const publicToggle = document.getElementById('buddyUpAdventureMenuPublicToggle');\n                    const mapToggle = document.getElementById('buddyUpAdventureMenuMapToggle');\n                    const saveBtn = document.getElementById('buddyUpAdventureMenuSaveBtn');\n                    const reportBtn = document.getElementById('buddyUpAdventureMenuReportBtn');\n\n                    if (publicToggle && mapToggle) {\n                        publicToggle.addEventListener('change', () => {\n                            if (publicToggle.checked) {\n                                mapToggle.removeAttribute('disabled');\n                            } else {\n                                mapToggle.checked = false;\n                                mapToggle.setAttribute('disabled', 'disabled');\n                            }\n                        });\n                    }\n\n                    if (saveBtn) {\n                        saveBtn.addEventListener('click', async (e) => {\n                            e.preventDefault();\n                            saveBtn.setAttribute('disabled', 'disabled');\n                            const privacy = publicToggle && publicToggle.checked ? 'public' : 'private';\n                            const showOnMap = mapToggle && mapToggle.checked ? 1 : 0;\n\n                            const ok = await saveAdventureVisibility(advId, privacy, showOnMap);\n                            saveBtn.removeAttribute('disabled');\n                            if (!ok) {\n                                BUDDYUP.openModal('Could not update visibility. Please try again.', 'Update failed', 'buddyUpAdventureVisibilityError');\n                                return;\n                            }\n\n                            BUDDYUP.closeModal();\n                            await renderAdventuresFeed();\n                        });\n                    }\n\n                    if (reportBtn) {\n                        reportBtn.addEventListener('click', (e) => {\n                            e.preventDefault();\n                            BUDDYUP.closeModal();\n                            BUDDYUP.startReport(reportButtonRef || null, advId, 'adventure');\n                        });\n                    }\n                };\n\n                if (!feedRows.length) {\n                    feedEl.innerHTML = '<div class=\"noEventsCard\">No adventures to display<\/div>';\n                    return;\n                }\n\n                feedEl.innerHTML = '';\n                feedRows.forEach((adv, idx) => {\n                    const advId = Number(adv && adv.id);\n                    const detailUrl = buildAdventureLink(advId);\n                    const ownerId = Number(adv && adv.user_id);\n                    const owner = ownerMeta[ownerId] || null;\n                    const ownerName = (typeof BUDDYUP.displayNameFromUser === 'function')\n                        ? BUDDYUP.displayNameFromUser(owner || {}, 'BuddyUp User')\n                        : (owner && owner.full_name ? owner.full_name : 'BuddyUp User');\n                    const ownerImage = owner && owner.profile_image ? BUDDYUP.profileImageSrc(owner.profile_image) : BUDDYUP.defaultProfileImage;\n                    const coverMedia = getAdventureCoverMedia(adv);\n                    const coverUrl = coverMedia && coverMedia.url ? String(coverMedia.url) : (adv.preview_url ? String(adv.preview_url) : '');\n                    const coverType = coverMedia && String(coverMedia.type || '').toLowerCase() === 'video' ? 'video' : 'image';\n                    const bodyPreview = String(adv && adv.body ? adv.body : '').replace(\/<[^>]*>\/g, ' ').trim();\n                    const categories = Array.isArray(adv && adv.categories) ? adv.categories : [];\n                    const ownCard = isSelfAccountForFeed && currentUser && Number(ownerId) === Number(currentUser.id);\n                    const currentVisibility = visibilityById[advId] || { privacy: 'public', show_on_map: 0 };\n                    const cardId = `buddyUpAccountAdventure_${advId}_${idx}`;\n                    const ownerProfileLink = ownerId > 0 ? `${buddyUpVariables.account_link}${ownerId}` : '#';\n                    const canShowMenu = !!(ownCard || (currentUser && currentUser.id && !ownCard));\n\n                    const catsHtml = categories.map((c) => `<li class=\"singlePill textSmall\">${escapeHtml(c)}<\/li>`).join('');\n\n                    feedEl.insertAdjacentHTML('beforeend', `\n                        <div id=\"${cardId}\" class=\"buddyUpElWrapper buddyUpAdventureCard buddyUpAccountAdventureFeedCard\" tabindex=\"0\" role=\"link\" aria-label=\"Open ${escapeHtml(adv.title || 'adventure')}\">\n                            <div class=\"buddyUpAdventureCardPreview\">\n                                ${coverUrl\n                                    ? (coverType === 'video'\n                                        ? BUDDYUP.renderVideoMediaHtml(coverUrl, { className: 'buddyUpAdventureCardCover', compact: true, title: `${adv.title ? adv.title : 'Adventure'} video` })\n                                        : `<img decoding=\"async\" class=\"buddyUpAdventureCardCover\" src=\"${coverUrl}\" alt=\"${escapeHtml(adv.title || 'Adventure')} cover\" \/>`)\n                                    : `<div class=\"buddyUpAdventureCardCover buddyUpAdventureCardCoverPlaceholder\"><\/div>`\n                                }\n                            <\/div>\n                            <div class=\"buddyUpAdventureCardMain\">\n                                <div class=\"buddyUpAccountAdventureFeedHeader\">\n                                    <a href=\"${ownerProfileLink}\" class=\"buddyUpAccountAdventureOwnerAvatar buddyUpNoCardNav\" aria-label=\"View ${escapeHtml(ownerName)}'s profile\">\n                                        <img decoding=\"async\" src=\"${ownerImage}\" alt=\"${escapeHtml(ownerName)} avatar\" onerror=\"BUDDYUP.onErrProfileImage(this)\" \/>\n                                    <\/a>\n                                    <div>\n                                        <a href=\"${ownerProfileLink}\" class=\"buddyUpLink buddyUpNoCardNav\">${escapeHtml(ownerName)}<\/a>\n                                        <div class=\"textSmall\" style=\"opacity:.8;\">${escapeHtml(adv.created_at || '')}<\/div>\n                                    <\/div>\n                                    ${canShowMenu ? `\n                                        <button type=\"button\" class=\"buddyUpButton3 buddyUpAdventureActionsBtn buddyUpNoCardNav\" aria-label=\"Adventure actions\" style=\"margin-left:auto;padding:.2rem .45rem;line-height:1;\">\n                                            <i class=\"fa fa-solid fa-ellipsis\"><\/i>\n                                        <\/button>\n                                    ` : ''}\n                                <\/div>\n\n                                <div style=\"font-weight:700; margin-top:.35rem;\">${escapeHtml(adv.title || 'Adventure Post')}<\/div>\n                                ${bodyPreview ? `<p class=\"textSmall\" style=\"opacity:.9;margin:.5rem 0 .35rem 0;\">${escapeHtml(bodyPreview.length > 180 ? `${bodyPreview.substring(0, 180)}...` : bodyPreview)}<\/p>` : ''}\n                                ${catsHtml ? `<ul class=\"buddyUpPillWrapper buddyUpList\" style=\"margin:.1rem 0 .45rem 0;\">${catsHtml}<\/ul>` : ''}\n\n                                <div style=\"margin-top:.35rem;\"><a href=\"${detailUrl}\" class=\"buddyUpLink buddyUpAdventureCardOpenLink buddyUpNoCardNav\">Open Adventure<\/a><\/div>\n                            <\/div>\n                        <\/div>\n                    `);\n\n                    const card = document.getElementById(cardId);\n                    if (!card) return;\n\n                    const goToAdventure = () => {\n                        if (!detailUrl || detailUrl === '#') return;\n                        if (typeof BUDDYUP !== 'undefined' && typeof BUDDYUP.pjaxNavigate === 'function') {\n                            BUDDYUP.pjaxNavigate(detailUrl);\n                        } else {\n                            window.location.href = detailUrl;\n                        }\n                    };\n\n                    card.addEventListener('click', (e) => {\n                        if (e.target && e.target.closest('a,button,input,label,select,textarea,.buddyUpAdventureCardControls,.buddyUpNoCardNav')) return;\n                        goToAdventure();\n                    });\n                    card.addEventListener('keydown', (e) => {\n                        if (e.key === 'Enter' || e.key === ' ') {\n                            e.preventDefault();\n                            goToAdventure();\n                        }\n                    });\n\n                    const openLink = card.querySelector('.buddyUpAdventureCardOpenLink');\n                    if (openLink) {\n                        openLink.addEventListener('click', (e) => {\n                            e.preventDefault();\n                            goToAdventure();\n                        });\n                    }\n\n                    const adventureActionsBtn = card.querySelector('.buddyUpAdventureActionsBtn');\n                    if (adventureActionsBtn) {\n                        adventureActionsBtn.addEventListener('click', (e) => {\n                            e.preventDefault();\n                            e.stopPropagation();\n                            openAdventureActionsMenu({\n                                advId,\n                                ownCard,\n                                currentVisibility,\n                                reportButtonRef: adventureActionsBtn,\n                            });\n                        });\n                    }\n                });\n            }\n\n            function eventCardHTML(e) {\n                const id = e.event_id || e.id || 0;\n                const title = e.name || e.event_name || 'Event';\n                const img = e.event_image || e.image || '';\n                const href = `${buddyUpVariables.event_link}${id}`;\n\n                const normalizeUsername = (v) => {\n                    const cleaned = String(v == null ? '' : v).trim().replace(\/^@+\/, '');\n                    if (!cleaned) return '';\n                    const lowered = cleaned.toLowerCase();\n                    if (lowered === 'unknown' || lowered === 'n\/a' || lowered === 'null' || lowered === 'undefined') return '';\n                    return cleaned;\n                };\n\n                const userIdNum = Number(userData && userData.id ? userData.id : 0);\n                const userUsername = normalizeUsername(userData && userData.username ? userData.username : '');\n                const buddies = Array.isArray(userData && userData.buddies) ? userData.buddies : [];\n\n                const usernameFromId = (idValue) => {\n                    const targetId = Number(idValue || 0);\n                    if (!targetId) return '';\n                    if (targetId === userIdNum && userUsername) return userUsername;\n                    const match = buddies.find((b) => Number((b && (b.id || b.user_id)) || 0) === targetId);\n                    if (!match) return '';\n                    return normalizeUsername(match.username || match.user_name || match.handle || match.full_name || '');\n                };\n\n                const creatorUsername = normalizeUsername(\n                    e.organizer_username ||\n                    (e.organizer && e.organizer.username) ||\n                    e.creator_username ||\n                    e.username ||\n                    e.created_by_username ||\n                    e.host_username ||\n                    usernameFromId(e.organizer_id || e.created_by || e.host_id || e.user_id) ||\n                    e.organizer ||\n                    ''\n                ) || 'unknown';\n\n                const eventDateRaw =\n                    (e.date_formatted && (e.date_formatted.full || e.date_formatted.long || e.date_formatted.short)) ||\n                    e.event_date ||\n                    e.date ||\n                    '';\n\n                const dateStamp = Date.parse(String(eventDateRaw || ''));\n                const secondaryLine = Number.isFinite(dateStamp)\n                    ? new Date(dateStamp).toLocaleDateString(undefined, {\n                        year: 'numeric',\n                        month: 'short',\n                        day: 'numeric',\n                    })\n                    : String(eventDateRaw || '').trim();\n\n                return `\n                    <div class=\"singleEventCard flexWrapper\">\n                        <div class=\"eventCardImageWrapper\">${img ? `<img decoding=\"async\" src=\"${img}\" alt=\"${escapeHtml(title)}\" onerror=\"BUDDYUP.onErrProfileImage(this)\">` : ''}<\/div>\n                        <div class=\"eventCardInfoWrapper\">\n                            <a href=\"${href}\" class=\"eventCardLink\"><strong class=\"eventCardTitle\">${escapeHtml(title)}<\/strong><\/a>\n                            <div class=\"textSmall\">@${escapeHtml(creatorUsername)}<\/div>\n                            <div class=\"textSmall\">${secondaryLine}<\/div>\n                        <\/div>\n                    <\/div>\n                `;\n            }\n\n            function groupCardHTML(g) {\n                const id = g.id || g.group_id || 0;\n                const name = g.name || 'Group';\n                const img = g.image || g.group_image || '';\n                const href = `${buddyUpVariables.group_link}${id}`;\n\n                const normalizeUsername = (v) => {\n                    const cleaned = String(v == null ? '' : v).trim().replace(\/^@+\/, '');\n                    if (!cleaned) return '';\n                    const lowered = cleaned.toLowerCase();\n                    if (lowered === 'unknown' || lowered === 'n\/a' || lowered === 'null' || lowered === 'undefined') return '';\n                    return cleaned;\n                };\n\n                const userIdNum = Number(userData && userData.id ? userData.id : 0);\n                const userUsername = normalizeUsername(userData && userData.username ? userData.username : '');\n                const buddies = Array.isArray(userData && userData.buddies) ? userData.buddies : [];\n\n                const usernameFromId = (idValue) => {\n                    const targetId = Number(idValue || 0);\n                    if (!targetId) return '';\n                    if (targetId === userIdNum && userUsername) return userUsername;\n                    const match = buddies.find((b) => Number((b && (b.id || b.user_id)) || 0) === targetId);\n                    if (!match) return '';\n                    return normalizeUsername(match.username || match.user_name || match.handle || match.full_name || '');\n                };\n\n                const creatorUsername = normalizeUsername(\n                    g.owner_username ||\n                    (g.owner && g.owner.username) ||\n                    (g.owner && g.owner.full_name) ||\n                    g.creator_username ||\n                    g.group_owner_username ||\n                    g.username ||\n                    g.created_by_username ||\n                    usernameFromId(g.owner_id || g.group_owner || g.group_owner_id || g.user_id || g.created_by) ||\n                    ''\n                ) || 'unknown';\n\n                const numericCount = [\n                    g.member_count,\n                    g.members_count,\n                    g.total_members,\n                    g.member_total,\n                    g.members_total,\n                    g.total,\n                    g.count,\n                    g.num_members,\n                    g.current_members,\n                ]\n                    .map((v) => Number(v))\n                    .find((v) => Number.isFinite(v) && v >= 0);\n\n                const derivedCount = [\n                    Array.isArray(g.members) ? g.members.length : 0,\n                    Array.isArray(g.member_ids) ? g.member_ids.length : 0,\n                    Array.isArray(g.organizers) ? g.organizers.length : 0,\n                ].reduce((max, v) => (v > max ? v : max), 0);\n\n                let memberCount = Number.isFinite(numericCount) ? numericCount : derivedCount;\n                if (!memberCount) {\n                    const ownerPresent = Number(g.owner_id || g.group_owner || g.group_owner_id || 0) > 0;\n                    memberCount = ownerPresent ? 1 : 0;\n                }\n\n                return `\n                    <div class=\"singleEventCard flexWrapper\">\n                        <div class=\"eventCardImageWrapper\">${img ? `<img decoding=\"async\" src=\"${img}\" alt=\"${escapeHtml(name)}\" onerror=\"BUDDYUP.onErrProfileImage(this)\">` : ''}<\/div>\n                        <div class=\"eventCardInfoWrapper\">\n                            <a href=\"${href}\" class=\"eventCardLink\"><strong class=\"eventCardTitle\">${escapeHtml(name)}<\/strong><\/a>\n                            <div class=\"textSmall\">@${escapeHtml(creatorUsername)}<\/div>\n                            <div class=\"textSmall\">${memberCount} ${memberCount === 1 ? 'member' : 'members'}<\/div>\n                        <\/div>\n                    <\/div>\n                `;\n            }\n\n            function renderSquareGrid(containerId, rows, emptyText, builder) {\n                const el = document.getElementById(containerId);\n                if (!el) return;\n\n                if (!Array.isArray(rows) || rows.length === 0) {\n                    el.innerHTML = `<div class=\"noEventsCard\">${emptyText}<\/div>`;\n                    return;\n                }\n\n                el.innerHTML = '';\n                rows.forEach((row) => {\n                    el.insertAdjacentHTML('beforeend', builder(row));\n                });\n            }\n\n            const upcomingEvents = Array.isArray(userData.events && userData.events.upcoming) ? userData.events.upcoming : [];\n            const pastEvents = Array.isArray(userData.events && userData.events.past) ? userData.events.past : [];\n            const allEvents = uniqueById(upcomingEvents.concat(pastEvents), (event) => event && (event.event_id || event.id));\n\n            let groupsPayload = userData.groups || userData.group_data || userData.my_groups || {};\n            let ownedGroups = [];\n            let joinedGroups = [];\n            if (Array.isArray(groupsPayload)) {\n                ownedGroups = groupsPayload.filter(g => {\n                    const owner = g.group_owner || g.owner_id || (g.owner && g.owner.id) || g.ownerId || g.group_owner_id || g.group_owner;\n                    return owner && Number(owner) === Number(userData.id);\n                });\n                joinedGroups = groupsPayload.filter(g => {\n                    const owner = g.owner_id || (g.owner && g.owner.id) || g.ownerId || g.group_owner_id || g.group_owner;\n                    return !(owner && Number(owner) === Number(userData.id));\n                });\n            } else {\n                ownedGroups = groupsPayload.owned || groupsPayload.owner || groupsPayload.owned_groups || [];\n                joinedGroups = groupsPayload.joined || groupsPayload.member || groupsPayload.joined_groups || [];\n            }\n            const allGroups = uniqueById([].concat(ownedGroups || [], joinedGroups || []), (group) => group && (group.id || group.group_id));\n\n            renderSquareGrid('buddyUpAccountEventsGrid', allEvents, 'No events to display', (event) => eventCardHTML(event));\n            renderSquareGrid('buddyUpAccountGroupsGrid', allGroups, 'No groups to display', (group) => groupCardHTML(group));\n            await renderAdventuresFeed();\n\n\n            \n            \/\/ Add Buddies\n            if (document.getElementById('buddyUpBuddiesList')){\n                if (userData.buddies && userData.buddies.length > 0){\n                    var buddiesListEl = '';\n                    var limit = 4;\n                    for (i in userData.buddies){\n                        if (i >= limit){ break; } \/\/ Buddy limit is reached\n                        var buddy = userData.buddies[i];\n                        buddiesListEl += `<li><a href=\"${buddyUpVariables.account_link}${buddy.id}\" class=\"buddyUpBuddyIcon buddyUpImageCircle\" aria-label=\"View ${buddy.full_name}'s profile\"><img decoding=\"async\" src=\"${BUDDYUP.profileImageSrc(buddy.profile_image)}\" alt=\"${buddy.full_name} profile image\" onerror=\"BUDDYUP.onErrProfileImage(this)\"><\/a><\/li>`;\n                    }\n                    \n                    if (userData.buddies.length > limit){\n                        var remainder = userData.buddies.length - limit;\n                        buddiesListEl += `<li><a href=\"${buddyUpVariables.buddies_list_link}\" class=\"buddyUpBuddyIcon buddyUpImageCircle buddyUpAdditionalBuddies\" aria-label=\"View all buddies\">+${remainder}<\/a><\/li>`;\n                    }\n                    \n                    document.getElementById('buddyUpBuddiesList').insertAdjacentHTML('beforeend', `<ul>${buddiesListEl}<\/ul>`);\n                } else {\n                    document.getElementById('buddyUpBuddiesList').insertAdjacentHTML('beforeend', `<p>No buddies found. Go out and find some new buddies!<\/p>`);\n                }\n            }\n\n            const pwaDownloadButtons = document.querySelectorAll('.buddyUpAccountDownloadPWA');\n            const pwaHelperBar = document.querySelector('.tsg-helperBarModal');\n            if (pwaDownloadButtons && pwaHelperBar){\n                pwaDownloadButtons.forEach(el => {\n                    el.addEventListener('click', () => {\n                        pwaHelperBar.style.display = 'block';\n                    });\n                });\n            } else {\n                BUDDYUP.clearAllElements('.buddyUpAccountDownloadPWA');\n            }\n\n            const syncContactsBtn = document.getElementById('buddyUpSyncContactsBtn');\n            const isSelfAccountForContacts = currentUser && (\n                accountPageUserID === 'current' ||\n                String(accountPageUserID) === String(currentUser.id) ||\n                String(userData.id) === String(currentUser.id)\n            );\n            if (!isSelfAccountForContacts) {\n                BUDDYUP.clearAllElements('#buddyUpSyncContactsBtn');\n            } else if (syncContactsBtn && !syncContactsBtn.getAttribute('data-bound')) {\n                syncContactsBtn.setAttribute('data-bound', '1');\n                syncContactsBtn.addEventListener('click', async (e) => {\n                    e.preventDefault();\n                    await buddyUpRunContactsSyncHelper();\n                });\n            }\n            \n            \/\/ Remove 404 page and show account page\n            BUDDYUP.clearAllElements('#buddyUpNoUserSection, #profileLoadingWrapper');\n            document.getElementById('accountWrapper').classList.remove('hidden');\n        } else { \/\/ If current user was not sent back, show 404 page\n            const isSelfAccountRequest = !!(currentUser && (String(userToGet) === String(currentUser.id)));\n            if (isSelfAccountRequest && buddyUpAccountLooksLikeAuthSessionError(userData && userData.message)) {\n                await BUDDYUP.logUserOut();\n                BUDDYUP.pjaxNavigate(buddyUpVariables.login_link);\n                return;\n            }\n\n            if (userData.message && userData.message !== ''){\n                const errPage = document.getElementById('buddyUpNoUserSection');\n                \/\/ errPage.querySelector('h1').innerHTML = 'An error occurred';\n                \/\/ errPage.querySelector('p').innerHTML = userData.message;\n            }\n            account404Wrapper.classList.remove('hidden');\n            BUDDYUP.clearAllElements('#accountWrapper, #profileLoadingWrapper');\n        }\n\n        \n        \/***\n         * Share user profile button\n         *\/\n        var shareButton = document.querySelectorAll('#shareProfile');\n        shareButton.forEach((button) => {\n            button.addEventListener('click', (e) => {\n                e.preventDefault();\n                var link = `${userData.profile_url}\/`;\n                \n                var copyEventEl = `<p>Click below to copy the profile link!<\/p>\n                <button id=\"buddyUpCopyButton\" type=\"text\" aria-label=\"Copy profile link\">${link}<\/button>`;\n                BUDDYUP.openModal(copyEventEl, 'Share this profile', 'buddyUpShareProfileModal');\n                \n                var buddyUpCopyButton = document.querySelector('#buddyUpCopyButton');\n                buddyUpCopyButton.addEventListener('click', e => {\n                    e.preventDefault();\n                    if (buddyUpCopyButton.classList.contains('buddyUpCopied')){\n                        return;\n                    }\n        \n                    const selection = window.getSelection();\n                    const range = document.createRange();\n                    range.selectNodeContents(buddyUpCopyButton);\n                    selection.removeAllRanges();\n                    selection.addRange(range);\n            \n                    try {\n                        document.execCommand('copy');\n                        selection.removeAllRanges();\n                    } catch(e) {\n                        console.warn('Could not copy');\n                    }\n                    \n                    buddyUpCopyButton.innerHTML = 'Copied!';\n                    buddyUpCopyButton.classList.add('buddyUpCopied');\n                    \n                    setTimeout(() => {\n                        buddyUpCopyButton.innerHTML = link;\n                        buddyUpCopyButton.classList.remove('buddyUpCopied');\n                    }, 3000);\n                });\n            });\n        });\n        \n        if (accountPageUserID !== 'current' && accountPageUserID != currentUser.id){\n            BUDDYUP.clearAllElements('#buddyUpBuddiesList');\n            \n            if (userData.is_blocked === true){\n                BUDDYUP.clearAllElements('.userAddBuddyWrapper, #buddySendMessageWrapper');\n            } else if (userData.is_buddy === 3){\n                console.log('blocking');\n                document.getElementById('userAddBuddy').classList.add('hidden');\n                document.getElementById('buddySendMessageWrapper').classList.add('hidden');\n            }\n            \n            \/***\n             * Add\/Remove Buddy\n             *\/\n            const toggleBuddyButton = document.getElementById('userAddBuddy');\n            if (toggleBuddyButton){\n                function toggleBuddyButtonChange(toggle){\n                    if (toggle === 'friend'){\n                        toggleBuddyButton.classList.add('isBuddy');\n                        toggleBuddyButton.innerHTML = '<i class=\"fa-solid fa-user-minus\"><\/i> Remove Buddy';\n                    } else if (toggle === 'remove'){\n                        toggleBuddyButton.classList.add('isBuddy');\n                        toggleBuddyButton.innerHTML = '<i class=\"fa-solid fa-user-minus\"><\/i> Cancel Request';\n                    } else if (toggle === 'pending'){\n                        toggleBuddyButton.classList.add('isPending');\n                        toggleBuddyButton.innerHTML = '<i class=\"fa-solid fa-user\"><\/i> View Request';\n                    } else {\n                        toggleBuddyButton.classList.remove('isBuddy');\n                        toggleBuddyButton.innerHTML = '<i class=\"fa-solid fa-user-plus\"><\/i> Add Buddy';\n                    }\n                }\n\n                let buddyButtonStatus = userData.is_buddy === 1 ? 'friend' : false;\n                    buddyButtonStatus = userData.is_buddy === 2 ? 'pending' : buddyButtonStatus;\n                    toggleBuddyButtonChange(buddyButtonStatus);\n\n                async function toggleUser(addRemove){\n                    const endpoint = addRemove === 'remove' ? 'buddy-remove' : 'buddy-add';\n                    const toggleUser = await BUDDYUP.apiRequest(endpoint, {'id': accountPageUserID, 'current_user_id': currentUser.id});\n                    \n                    if (toggleUser.status == 'success'){ \/\/ Success\n                        if (addRemove === 'remove' && toggleBuddyButton.classList.contains('isBuddy')){\n                            toggleBuddyButtonChange('add');\n                        } else {\n                            toggleBuddyButtonChange('pending');\n                            \n                            const modalContent = `Give your Buddy a moment to view your request.`;\n                            BUDDYUP.openModal(modalContent, 'Buddy Request Sent!', 'buddyUpTextCenter');\n                        }\n                    } else { \/\/ Error\n                        const modalContent = `Please wait a moment and try again.`;\n                        BUDDYUP.openModal(modalContent, 'An error occurred', 'buddyUpTextCenter');\n                    }\n                    toggleBuddyButton.removeAttribute('disabled');\n                }\n                \n                toggleBuddyButton.addEventListener('click', e => {\n                    if (toggleBuddyButton.classList.contains('isPending')){\n                        BUDDYUP.pjaxNavigate(buddyUpVariables.buddies_list_link);\n                    } else {\n                        const toggle = toggleBuddyButton.classList.contains('isBuddy') ? 'remove' : 'add';\n                        toggleUser(toggle);\n                    }\n                });\n            }\n        \n        \n            \/***\n             * Block Buddy\n             *\/\n            const blockBuddyButton = document.getElementById('userBlockBuddy');\n\n            if (blockBuddyButton){\n                const isCurrentlyBlocked = userData.is_buddy === 3 ? 1 : 0; \n                toggleBlockButtonChange(isCurrentlyBlocked);\n                function toggleBlockButtonChange(toggle){\n                    if (toggle === 1){ \/\/ 1 == set to unblock button\n                        blockBuddyButton.setAttribute('data-blocked', 1);\n                        blockBuddyButton.innerHTML = '<i class=\"fa fa-solid fa-ban\"><\/i> Unblock';\n                    } else {\n                        blockBuddyButton.setAttribute('data-blocked', 0);\n                        blockBuddyButton.innerHTML = '<i class=\"fa fa-solid fa-ban\"><\/i> Block';\n                    }\n                }\n\n                async function blockUser(){\n                    blockBuddyButton.setAttribute('disabled', 'disabled');\n                    const currentBlockStatus = blockBuddyButton.getAttribute('data-blocked') === '1' ? 0 : 1; \/\/ If user is blocked (1), then treat this as an unblock request\n                    console.log(blockBuddyButton.getAttribute('data-blocked'));\n                    const blockUser = await BUDDYUP.apiRequest('buddy-block', {'id': accountPageUserID, 'block': currentBlockStatus });\n                    \n                    if (blockUser.status === 'success'){ \/\/ Success\n                        toggleBlockButtonChange(currentBlockStatus); \/\/ Change button to show block or unblock\n\n                        let messageButtonWrapper = document.getElementById('buddySendMessageWrapper'); \/\/ Show message\n                        let addBuddyButton = document.getElementById('buddySendMessageWrapper'); \/\/ Add buddy\n                        \n                        let fullName = document.getElementById('userName');\n                            fullName = fullName && fullName.innerHTML !== '' ? fullName.innerHTML : 'This user';\n                        if (currentBlockStatus === 1){ \/\/ User is blocked\n                            toggleBuddyButton.classList.add('hidden');\n                            messageButtonWrapper.classList.add('hidden');\n                            addBuddyButton.classList.add('hidden');\n                            const modalContent = `${fullName} has been blocked. You will no longer receive or be able to communicate with them.`;\n                            BUDDYUP.openModal(modalContent, 'User blocked', 'buddyUpTextCenter');\n                        } else { \/\/ User is unblocked\n                            toggleBuddyButton.classList.remove('hidden');\n                            messageButtonWrapper.classList.remove('hidden');\n                            addBuddyButton.classList.remove('hidden');\n                            const modalContent = `${fullName} has been unblocked. You can now communicate again!`;\n                            BUDDYUP.openModal(modalContent, 'User unblocked', 'buddyUpTextCenter');\n                        }\n        \n                    } else { \/\/ Error\n                        const modalContent = blockUser.message ? blockUser.message : `Please wait a moment and try again.`;\n                        BUDDYUP.openModal(modalContent, 'An error occurred', 'buddyUpTextCenter');\n                    }\n                    blockBuddyButton.removeAttribute('disabled');\n                }\n                \n                blockBuddyButton.addEventListener('click', e => {\n                    const toggle = blockBuddyButton.classList.contains('isBuddy') ? 'remove' : 'add';\n                    blockUser();\n                });\n            }\n            \n\n            \/***\n             * Report User\n             *\/\n            const reportUserButton = document.getElementById('reportUser');\n\n            if (reportUserButton){\n                reportUserButton.addEventListener('click', e => {\n                    e.preventDefault();\n                    BUDDYUP.startReport(reportUserButton, accountPageUserID, 'user');\n                });\n            }\n        \n            \/***\n             * Messaging\n             *\/\n            const buddySendMessageButton = document.getElementById('buddySendMessage');\n            if (buddySendMessageButton){\n                async function startChat(userID){\n                    buddySendMessageButton.setAttribute('disabled', 'disabled'); \/\/ Disable message button to prevent multiple requests\n                    const messagesResponse = await BUDDYUP.getChatMessages(userID, 'user_id'); \/\/ Get messages by user ID\n                    console.log(messagesResponse);\n                    if (messagesResponse.status === 'success'){\n                        let subscription = messagesResponse.subscription;\n                        let canMessage = true;\n                        try {\n                            const limitsResp = await BUDDYUP.getUserLimits();\n                            const limit = Number(limitsResp?.limits?.messaging?.daily_limit ?? 0);\n                            const current = Number(limitsResp?.current?.messaging?.current_today ?? 0);\n                            if (limit > 0 && current >= limit) canMessage = false;\n                        } catch (e) {}\n                        if (!document.querySelector('.currentChat')){\n                            const chatID = messagesResponse.id ? `data-id=\"${messagesResponse.id}\"` : '';\n\n                            const newMessageInput = !canMessage ? BUDDYUP.subscriptionCTA('You\u2019ve reached your daily message limit. Upgrade to send more.', 'small') : `<form id=\"chatNewMessageForm\" class=\"flexWrapper\">\n                                <input type=\"text\" id=\"chatNewMessageInput\" \/>\n                                <button type=\"submit\" id=\"chatNewMessageSubmit\" class=\"buddyUpButton1\" aria-label=\"Send Message\" title=\"Send Message\" disabled=\"disabled\"><i class=\"fa-solid fa-paper-plane\"><\/i><\/button>\n                            <\/form>`;\n                            \n                            const messagesElement = `\n                                <div id=\"currentChatWrapper\" class=\"chatMessagesWrapper\" ${chatID}>\n                                    <ul id=\"currentChat\" class=\"currentChat\"><\/ul>\n                                    <div id=\"chatNewMessageWrapper\">\n                                        ${newMessageInput}\n                                    <\/div>\n                                <\/div>`;\n                            BUDDYUP.openModal(messagesElement, 'Messages', '');\n                            document.querySelector('.buddyUpModalContentWrapper').classList.add('messagesModal');\n                        }\n            \n                        BUDDYUP.updateChat('.currentChat', messagesResponse.messages, messagesResponse.users);\n        \n                        \/***\n                         * Send Message\n                         *\/\n                        const submitButton = document.getElementById('chatNewMessageSubmit');\n                        const newMessageInput = document.getElementById('chatNewMessageInput');\n                        const tier = await BUDDYUP.getSubscriptionTier();\n                        if (submitButton && newMessageInput){\n                            document.getElementById('chatNewMessageForm').addEventListener('submit', e => {\n                                e.preventDefault();\n                                \n                                const activeChat = document.querySelector('.chatMessagesWrapper'); \/\/ Check to see if a user chat is currently active\n                                if (activeChat){\n                                    var newMessage = {\n                                        id: 'new-message',\n                                        user_id: currentUser.id,\n                                        message: newMessageInput.value,\n                                        subscription: tier,\n                                    };\n                                    \n                                    const chatID = activeChat.getAttribute('data-id');\n                                    \n                                    if (chatID && chatID !== ''){\n                                        newMessage.chat_type = 'id';\n                                        newMessage.chat_id = chatID;\n                                    } else {\n                                        newMessage.chat_type = 'user';\n                                        newMessage.chat_id = userID;\n                                    }\n                \n                                    if (canMessage) {\n                                        BUDDYUP.updateChat('#currentChat', [newMessage], null);\n\n                                        newMessageInput.value = '';\n                                        submitButton.setAttribute('disabled', 'disabled');\n                                    } else {\n                                        const modalHeading = 'Message limit reached';\n                                        const modalContent = 'You\u2019ve reached your daily messaging limit. Upgrade to send more.';\n                                        BUDDYUP.subscriptionModal(modalContent, modalHeading);\n                                    }\n                                }\n                            });\n                            newMessageInput.addEventListener('keyup', e => {\n                                if (newMessageInput.value !== ''){\n                                    submitButton.removeAttribute('disabled');\n                                } else {\n                                    submitButton.setAttribute('disabled', 'disabled');\n                                }\n                            });\n                        }\n                    } else {\n                        let modalContent = messagesResponse.message && !messagesResponse.message.includes('critical error on this website') ? messagesResponse.message : 'An error occured getting your chat. Please try again.';\n                        BUDDYUP.openModal(modalContent, `An error occurred`, 'buddyUpErrModal');\n                    }\n\n                    buddySendMessageButton.removeAttribute('disabled');\n                }\n\n                buddySendMessageButton.addEventListener('click', e => {\n                    e.preventDefault();\n                    startChat(accountPageUserID);\n                });\n            }\n        }\n        \n        return;\n    }\n    \n    const loadingMessage = accountPageUserID === 'current' ? 'Retrieving your profile' : 'Finding profile';\n    accountWrapper.insertAdjacentHTML('beforebegin', `<div id=\"profileLoadingWrapper\" style=\"margin: 0 auto; text-align: center;\"><div class=\"buddyUpElWrapper\" style=\"display: inline-block; padding: 40px 45px;\">${BUDDYUP.loading(loadingMessage)}<\/div><\/div>`);\n    getUserData(accountPageUserID);\n\n\n    accountWrapper.removeAttribute('data-userid'); \/\/ Attribute cleanup\n} else if (account404Wrapper){\n    BUDDYUP.clearAllElements('#buddyUpLoadingEl');\n    account404Wrapper.classList.remove('hidden');\n}<\/script><\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"templates\/full-width-no-header.php","meta":{"footnotes":""},"class_list":["post-233","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/api\/wp\/v2\/pages\/233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/api\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/api\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/api\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/api\/wp\/v2\/comments?post=233"}],"version-history":[{"count":1,"href":"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/api\/wp\/v2\/pages\/233\/revisions"}],"predecessor-version":[{"id":446,"href":"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/api\/wp\/v2\/pages\/233\/revisions\/446"}],"wp:attachment":[{"href":"https:\/\/buddyupapi-staging.us35.cdn-alpha.com\/api\/wp\/v2\/media?parent=233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}