PageSourceSearch

https://www.usta.com/etc.clientlibs/usta/clientlibs/authUtils.min.70c7da6a2dceb62ed206df4bdcdf393b.js

js usta.com collected 2026-09-24 08:29:03 UTC 15,136 bytes, 36 lines download raw bytes

1/*
2 JavaScript Cookie v2.2.0
3 https://github.com/js-cookie/js-cookie
4
5 Copyright 2006, 2015 Klaus Hartl & Fagner Brack
6 Released under the MIT license
7*/
8(function(l){var m=!1;"function"===typeof define&&define.amd&&(define(l),m=!0);"object"===typeof exports&&(module.exports=l(),m=!0);if(!m){var c=window.Cookies,a=window.Cookies=l();a.noConflict=function(){window.Cookies=c;return a}}})(function(){function l(){for(var c=0,a={};c<arguments.length;c++){var b=arguments[c],e;for(e in b)a[e]=b[e]}return a}function m(c){function a(b,e,g){if("undefined"!==typeof document){if(1<arguments.length){g=l({path:"/"},a.defaults,g);if("number"===typeof g.expires){var f=
9new Date;f.setMilliseconds(f.getMilliseconds()+864E5*g.expires);g.expires=f}g.expires=g.expires?g.expires.toUTCString():"";try{var d=JSON.stringify(e);/^[\{\[]/.test(d)&&(e=d)}catch(q){}e=c.write?c.write(e,b):encodeURIComponent(String(e)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent);b=encodeURIComponent(String(b));b=b.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent);b=b.replace(/[\(\)]/g,escape);d="";for(var h in g)g[h]&&(d+="; "+h,!0!==g[h]&&(d+="\x3d"+
10g[h]));return document.cookie=b+"\x3d"+e+d}b||(d={});h=document.cookie?document.cookie.split("; "):[];for(var k=/(%[0-9A-Z]{2})+/g,r=0;r<h.length;r++){var p=h[r].split("\x3d"),n=p.slice(1).join("\x3d");this.json||'"'!==n.charAt(0)||(n=n.slice(1,-1));try{f=p[0].replace(k,decodeURIComponent);n=c.read?c.read(n,f):c(n,f)||n.replace(k,decodeURIComponent);if(this.json)try{n=JSON.parse(n)}catch(q){}if(b===f){d=n;break}b||(d[f]=n)}catch(q){}}return d}}a.set=a;a.get=function(b){return a.call(a,b)};a.getJSON=
11function(){return a.apply({json:!0},[].slice.call(arguments))};a.defaults={};a.remove=function(b,e){a(b,"",l(e,{expires:-1}))};a.withConverter=m;return a}return m(function(){})});"use strict";
12(function(){function l(g){a=g;document.querySelectorAll(".youtube.usta-consent-embed--c0005").forEach(function(f){var d=f.querySelector("iframe.usta-consent-embed__iframe");f=f.querySelector(".usta-consent-placeholder--c0005");d&&(g?(d.dataset.src&&d.getAttribute("src")!==d.dataset.src&&(d.src=d.dataset.src),d.style.display="",f&&(f.style.display="none")):(d.hasAttribute("src")&&d.removeAttribute("src"),d.style.display="none",f&&(f.style.display="")))});document.querySelectorAll(".usta-consent-embed--c0005").forEach(function(f){if(!f.classList.contains("youtube")){var d=
13f.querySelector(".usta-consent-embed__content");f=f.querySelector(".usta-consent-placeholder--c0005");d&&(d.style.display=g?"":"none");f&&(f.style.display=g?"none":"")}})}function m(){b||"undefined"===typeof MutationObserver||(b=!0,(new MutationObserver(function(g){g.some(function(f){return Array.from(f.addedNodes).some(function(d){var h,k;return d.nodeType===Node.ELEMENT_NODE&&((null===(h=d.classList)||void 0===h?void 0:h.contains("usta-consent-embed--c0005"))||(null===(k=d.querySelector)||void 0===
14k?void 0:k.call(d,".usta-consent-embed--c0005")))})})&&l(a)})).observe(document.documentElement,{childList:!0,subtree:!0}))}var c=window.usta||{},a=!1,b=!1,e=!1;c.cookies={groups:[{groupId:"C0001",cookies:"oauth_state owtsi-profile cartNumber dontShowSenior showForm updateSegment currentLocation sharedLocation section district wcmmode orderredirecturl returnUrl ssoLogoutRequired ghostAccountReturnToPage".split(" ")},{groupId:"C0002",cookies:"registrationType userType userLogin_success loginRegErrPageMsg grid_search_results_found navigationLocation accountRegistration_success s_cc s_sq s_vi s_vnum s_ecid AMCV_ _hjSession_ _hjSessionUser_ _hjid _hjFirstSeen _hjAbsoluteSessionInProgress".split(" ")},
15{groupId:"C0003",cookies:["userUaid","closed-","bannerClosed-","_cfuvid"]},{groupId:"C0004",cookies:["_gac_","_gcl_","IDE","ANID","__eoi"]},{groupId:"C0005",cookies:"VISITOR_INFO1_LIVE YSC yt-remote- yt-player- _fbp _fbc fr twid auth_token ct0 li_at liap li_oatml".split(" ")}],set:function(g,f,d){this.isCookieAllowed(g)&&Cookies.set(g,f,d)},get:function(g){return this.isCookieAllowed(g)?Cookies.get(g):null},remove:function(g,f){Cookies.remove(g,f)},isCookieAllowed:function(g){var f=this.groups.find(function(d){return d.cookies.some(function(h){return g.startsWith(h)})});
16return f?"C0001"===f.groupId||"undefined"===typeof OnetrustActiveGroups||null===OnetrustActiveGroups?!0:OnetrustActiveGroups.split(",").includes(f.groupId):(console.warn('[CookieConsent] Cookie "'.concat(g,'" is not assigned to any consent group. Add it to usta.cookies.groups.')),!0)},optanonWrapper:function(){function g(d,h){d=d.split(",").filter(
16Boolean);h=h.split(",").filter(Boolean);return d.filter(function(k){return-1>=h.indexOf(k)})}function f(d){var h=d.Name;d.patternKey&&(h=Object.keys(Cookies.get()).find(function(k){return k.startsWith(h)}));
17h&&(Cookies.remove(h),Cookies.remove(h,{domain:".usta.com"}))}"undefined"===typeof window.OptanonWrapperCount&&(window.OptanonWrapperCount="",window.otIniGrps=OnetrustActiveGroups);(function(d){var h=Optanon.GetDomainData().Groups,k=g(d,OnetrustActiveGroups);if(k.length){h.length&&h.forEach(function(p){p.CustomGroupId&&k.includes(p.CustomGroupId)&&p.Cookies.forEach(function(n){f(n)})});var r=Object.keys(Cookies.get());c.cookies.groups.forEach(function(p){k.includes(p.groupId)&&p.cookies.forEach(function(n){r.forEach(function(q){q.startsWith(n)&&
18(Cookies.remove(q),Cookies.remove(q,{path:"/"}),Cookies.remove(q,{domain:".usta.com"}),Cookies.remove(q,{path:"/",domain:".usta.com"}))})})})}window.OptanonWrapperCount="";window.otIniGrps=OnetrustActiveGroups})(window.otIniGrps);(function(){var d=OnetrustActiveGroups.split(","),h=d.includes("C0002"),k=d.includes("C0004");d=d.includes("C0005");window.googletag&&window.googletag.cmd&&window.googletag.cmd.push(function(){k?(window.googletag.pubads().setPrivacySettings({nonPersonalizedAds:!1,restrictDataProcessing:!1}),
19e&&(window.googletag.pubads().refresh(),e=!1)):(window.googletag.pubads().setPrivacySettings({nonPersonalizedAds:!0,restrictDataProcessing:!1}),window.googletag.pubads().clear(),e=!0)});"function"===typeof window.gtag&&window.gtag("consent","update",{analytics_storage:h?"granted":"denied",ad_storage:k?"granted":"denied",ad_user_data:k?"granted":"denied",ad_personalization:k?"granted":"denied"});l(d);m()})()}}})();"use strict";
20(function(){function l(a){try{var b=a.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),e=b+"\x3d".repeat((4-b.length%4)%4),g=Uint8Array.from(atob(e),function(f){return f.charCodeAt(0)});return JSON.parse((new TextDecoder).decode(g))}catch(f){return console.error("Failed to decode JWT payload",f),null}}function m(a){if(!a)return!0;a=l(a);if(!a||!a.exp)throw Error("Error parsing Access Token");var b=Math.round((new Date).getTime()/1E3);return 300>=a.exp-b}var c=window.usta||{};c.authUtils={isSecuredPage:!1,
21idpPageType:{AUTH:"authPath",LOGIN:"loginPath",SIGNUP:"signUpPath",LOGOUT:"logoutPath",CLAIM:"claimPath"},getTokens:function(a,b){a={code:a};return $.ajax({url:"/etc/usta/idpcoderesponse.".concat(b,".").concat(this.getPageLocale(),".json"),method:"POST",contentType:"application/json",dataType:"json",data:JSON.stringify(a)})},validateAuthTokens:function(){var a=this,b=!1;if(this.isRecognizedUser()&&!m(this.getAccessToken()))b=!0;else{var e=this.getRefreshToken();e&&$.ajax({type:"POST",async:!1,dataType:"json",
22contentType:"application/json",url:"/etc/usta/getrefreshtoken.secure.usta.json",data:JSON.stringify({refresh_token:e})}).done(function(g){var f=g.access_token;g=g.id_token;
22f&&g&&(a.setAccessToken(f),a.setIdToken(g),b=!0)}).fail(function(){c.authUtils.cleanUserStorages()})}return b},init:function(a,b,e,g,f){if(!this.isEditMode()){this.getUrlParameter("forgotPasswordFlow")&&this.redirectTo(this.getIDPAuthPage(this.idpPageType.CLAIM));if(this.isUserLoggedIn()&&this.isASMUser()&&!sessionStorage.getItem("newASMSessionStarted")){var d=
23c.idpProperties.clientId;sessionStorage.setItem("newASMSessionStarted",!0);localStorage.removeItem("access_token_".concat(d));localStorage.removeItem("id_token_".concat(d))}this.isSecuredPage=a;a=this.validateAuthTokens();!this.isSecuredPage||a||this.isUserLoggedIn()||(g&&localStorage.setItem("redirectAfterSignUp",!0),f?this.redirectToIdpSignUpPage():this.openSignInOrSysUpdate());this.isSecuredPage&&this.isGhostUser()&&this.redirectToLWRPage(b,e)}},redirectToIdpSignUpPage:function(a){this.savePostLoginPage(a);
24this.redirectTo(this.getIDPAuthPage(c.authUtils.idpPageType.SIGNUP))},redirectToLWRPage:function(a,b){var e=this.getLocalizedUrl(c.idpProperties.registrationPage);if(!window.location.href.includes(e)){localStorage.getItem("orgJoinType")?(a="".concat(window.location.origin).concat(b),localStorage.removeItem("orgJoinType")):a="".concat(window.location.origin).concat(a);a=window.decodeURI(a);b=this.getLocalizedUrl(c.idpProperties.homePage);var g=-1===e.indexOf("?")?"?":"\x26";window.location.href="".concat(e).concat(g,
25"redirect_uri\x3d").concat(a,"\x26logout_uri\x3d").concat(b,"\x26client_id\x3d").concat(c.idpProperties.clientId)}},isUserLoggedIn:function(){return!!this.getAccessToken()&&!!this.getRefreshToken()&&!this.isGhostUser()},isGhostUser:function(){var a=this.getIdTokenObject();return a?"NO_CUSTOMER"===a.uaid:!1},isRecognizedUser:function(){return this.isUserLoggedIn()||this.isGhostUser()},isASMUser:function(){var a=this.getAccessToken();a=this.parseToken(a);return(null===a||void 0===a?void 0:a.permissions.includes("asm"))||
26!1},getIDPAuthPage:function(a,b,e){e||(e=c.idpProperties);var g=a?e[a]:e.loginPath,f=this.getLocalizedUrl(e.redirectUri);if(a===c.authUtils.idpPageType.LOGOUT)return a=b?"".concat(f,"?returnToIDP\x3dtrue"):e.homePage,"".concat(e.idpUrl+g,"?returnTo\x3d").concat(a,"\x26client_id\x3d").concat(e.clientId);e="".concat(e.idpUrl+g,"?scope\x3dopenid offline_access email\x26response_type\x3dcode\x26client_id\x3d").concat(e.clientId)+"\x26redirect_uri\x3d".concat(f,"\x26audience\x3dusta\x26state\x3d").concat(this.generateState(e.clientId));
27a===c.authUtils.idpPageType.SIGNUP&&(e+="\x26screen_hint\x3dsignup");return e},openSignInOrSysUpdate:function(a){this.savePostLoginPage(a);this.redirectTo(this.getIDPAuthPage(c.authUtils.idpPageType.AUTH))},generateState:function(a){a="oauth_state_".concat(a);var b=c.cookies.get(a);b||(b=Math.floor(1E3*Math.random()*Date.now()),c.cookies.set(a,b,{path:"/"}));return b},isStateValid:function(a,b){b="oauth_state_".concat(b);var e=c.cookies.get(b);c.cookies.remove(b);return a&&e&&a===e},savePostLoginPage:function(a){a=
28a||window.location.href;this.getUrlParameter("isOrganization")&&localStorage.setItem("orgJoinType",!0);localStorage.setItem("postLoginPageUrl",a)},getRegistrationType:function(a){var b;a=a||this.getIdTokenObject();return(a=null===a||void 0===a||null===(b=a.sub)||void 0===b?void 0:b.split("|")[0])&&"auth0"!==a?a:"Traditional"},getIdTokenObject:function(a){a=this.getIdToken(a);return this.parseToken(a)},parseToken:function(a){return a?l(a):null},getAccessToken:function(){return localStorage.getItem("access_token_".concat(c.idpProperties.clientId))},
29setAccessToken:function(a){localStorage.setItem("access_token_".concat(c.idpProperties.clientId),a)},getIdToken:function(a){return a?localStorage.getItem("id_token_".concat(a)):localStorage.getItem("id_token_".concat(c.idpProperties.clientId))},setIdToken:function(a){return localStorage.setItem("id_token_".concat(c.idpProperties.clientId),a)},getRefreshToken:function(){return localStorage.getItem("refresh_token_".concat(c.idpProperties.clientId))},setRefreshToken:function(a){return localStorage.setItem("refresh_token_".concat(c.idpProperties.clientId),
30a)},applyTokens:function(a){var b,e,g=1<arguments.length&&void 0!==arguments[1]?arguments[1]:!1;if(!a||"object"!==typeof a)throw Error("applyTokens(tokenResponse): tokenResponse must be an object");var f=a.access_token,d=a.id_token,h=a.refresh_token;if(!f||!d||!h)throw Error("applyTokens(tokenResponse): access_token, id_token, refresh_token are required");null!==(b=window)&&void 0!==b&&null!==(b=b.usta)&&void 0!==b&&null!==(b=b.authUtils)&&void 0!==b&&null!==(e=b.isUserLoggedIn)&&void 0!==e&&e.call(b)&&
31this.cleanUserStorages();this.setAccessToken(f);this.setIdToken(d);this.setRefreshToken(h);try{c.cookies.set("registrationType",this.getRegistrationType())}catch(r){}try{var k=this.getIdTokenObject();null!==k&&void 0!==k&&k.uaid&&c.cookies.set("userUaid",k.uaid)}catch(r){}c.cookies.set("userLogin_success","true");g&&window.location.reload()},isEditMode:function(){return"edit"===Cookies.get("wcmmode")},getUrlParameter:function(a){return(new URLSearchParams(window.location.search)).get(a)},getUrlParameters:function(){return Object.fromEntries(new URLSearchParams(window.location.search))},
32getPageLocale:function(){var a="en",b=$("html").attr("lang");b&&(a=b.startsWith("es")?"es":b);return a},getLocalizedUrl:function(a){return a.replace("{locale}",this.getPageLocale())},redirectTo:function(a){a&&"undefined"!==a&&0<a.length&&(window.location.href=a)},redirectToErrorPage:function(a,b){var e=new URLSearchParams({error:a});b&&e.append("error_description",b);c.cookies.set("loginRegErrPageMsg",b?"".concat(a," (").concat(b,")"):a);window.location.href="".concat(c.authUtils.getLocalizedUrl(c.idpProperties.errorPage),
33"?").concat(e.toString())},isValidUrl:function(a){return null!=(null===a||void 0===a?void 0:a.match(/^(http(s)?:\/\/)(([\w#%+-.:=@~]{2,256}\.(usta\.com|clubspark\.io|scalasports\.com|scalasports\.app|redballtennis\.com))|localhost)\b([\w#%&+-./:=?@~]*)$/))||null!=(null===a||void 0===a?void 0:a.match(/^com\.usta(.*?):\/\/(.*)$/))},cleanUserStorages:function(){var a=c.idpProperties.clientId;
33c.cacheManager&&c.cacheManager.cachingConfigs.forEach(function(b){return c.common.removeCacheIfNeeded(b.endpointUri)});
34localStorage.removeItem("refresh_token_".concat(a));localStorage.removeItem(c.constants.membership.ORDER_INFORMATION);localStorage.removeItem(c.constants.membership.ORDER_ANALYTICS);localStorage.removeItem("access_token_".concat(a));localStorage.removeItem("id_token_".concat(a));localStorage.removeItem("avatar_data")},ssoLogoutWithRedirect:function(a,b){a||(a=c.authUtils.getLocalizedUrl(c.idpProperties.homePage));b||(b=c.idpProperties.clientId);window.location.href="".concat(c.idpProperties.idpUrl+
35c.idpProperties.logoutPath,"?client_id\x3d").concat(b,"\x26returnTo\x3d").concat(a)},ssoLogoutWithSignInRedirect:function(){window.location.href=c.authUtils.getIDPAuthPage(c.authUtils.idpPageType.LOGOUT,!0)},parseAccessToken:function(){var a=this.getAccessToken();return a?this.parseToken(a):null},isSocialLogin:function(){var a;return null===(a=this.parseAccessToken())||void 0===a?void 0:a.is_social},redirectToHomePage:function(){window.location.href=c.authUtils.getLocalizedUrl(c.idpProperties.homePage)}}})();
36"use strict";(function(){var l=window.usta||{};l.authToken={getAccessHeaders:function(m){if(l.authUtils.isEditMode())throw Error("Call is blocked in Edit mode");if(m)return{headers:{Authorization:"Bearer ".concat(m)}};if(l.authUtils.validateAuthTokens())return m=l.authUtils.getAccessToken(),{headers:{Authorization:"Bearer ".concat(m)}};l.authValidation.softLogout()}}})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.