function ParseApplicationConfig()
{
	const applicationConfigElement = document.getElementById( 'application_config' );

	if( applicationConfigElement )
	{
		/** @type {ApplicationConfig} */
		const applicationConfig = JSON.parse( applicationConfigElement.dataset.config );
		const accessToken = JSON.parse( applicationConfigElement.dataset.loyalty_webapi_token );

		if( accessToken )
		{
			applicationConfig.WEBAPI_ACCESS_TOKEN = accessToken;
		}

		return applicationConfig;
	}

	// Application config does not exist if user is logged out, so we have to reconstruct the data
	/** @type {ApplicationConfig} */
	const applicationConfig =
	{
		WEBAPI_BASE_URL: 'https://api.steampowered.com/',
	};

	/** @type {NodeListOf<HTMLScriptElement>} */
	const scriptTags = document.querySelectorAll( 'script[src]' );

	for( const script of scriptTags )
	{
		const scriptLanguage = new URL( script.src ).searchParams.get( 'l' );

		if( scriptLanguage )
		{
			applicationConfig.LANGUAGE = scriptLanguage;
			break;
		}
	}

	// Game logo cdn
	const gameLogoUrl = /** @type {HTMLImageElement} */ ( document.querySelector( '.profile_small_header_additional .gameLogo img' ) ).src;
	const gameLogoUrlAppsIndex = gameLogoUrl.lastIndexOf( '/apps/' );

	if( gameLogoUrlAppsIndex > 0 )
	{
		applicationConfig.STORE_ICON_BASE_URL = gameLogoUrl.substring( 0, gameLogoUrlAppsIndex + '/apps/'.length );
	}

	// Media cdn
	/** @type {NodeListOf<HTMLImageElement>} */
	const imageTags = document.querySelectorAll( '.achieveImgHolder > img' );

	for( const image of imageTags )
	{
		const index = image.src.lastIndexOf( '/images/apps/' );

		if( index > 0 )
		{
			applicationConfig.MEDIA_CDN_COMMUNITY_URL = image.src.substring( 0, index + 1 );
			break;
		}
	}

	return applicationConfig;
}
@typedef {{WEBAPI_BASE_URL: string, WEBAPI_ACCESS_TOKEN?: string, MEDIA_CDN_COMMUNITY_URL?: string, STORE_ICON_BASE_URL?: string, LANGUAGE?: string, STORE_ITEM_BASE_URL?: string, COUNTRY?: string, EREALM?: string}} ApplicationConfig