/**\*\***\*\*\*\***\*\***\*\***\*\***\*\*\*\***\*\***\*\*\*\***\*\***\*\*\*\***\*\***\*\***\*\***\*\*\*\***\*\*** \*

-   ADOBE CONFIDENTIAL
-   ***
-
-   Copyright 2015-2023 Adobe Inc.
-   All Rights Reserved.
-
-   NOTICE: All information contained herein is, and remains
-   the property of Adobe Inc. and its suppliers,
-   if any. The intellectual and technical concepts contained
-   herein are proprietary to Adobe Inc. and its
-   suppliers and are protected by trade secret or copyright law.
-   Dissemination of this information or reproduction of this material
-   is strictly forbidden unless prior written permission is obtained
-   from Adobe Inc..
    **\*\***\*\*\*\***\*\***\*\*\*\***\*\***\*\*\*\***\*\***\*\***\*\***\*\*\*\***\*\***\*\*\*\***\*\***\*\*\*\***\*\***/

!function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=50)}([function(e,t){e.exports=require("@babel/runtime/regenerator")},function(e,t,r){"use strict";r.r(t);var n=r(7),a=r.n(n),s=r(8),o=r.n(s),i=r(4),c=r.n(i),u=r(19),l=r(35),d=r(33),f=r(12),p=new(function(){function e(){a()(this,e),c()(this,"config",{ENVIRONMENT:"production",ACTIVE_VERSIONS:["V1","V2","V2_5","V2_8","V3_0","V3_1","V4_0"],SUPPORTED_ACTIVE_VERSIONS:5,SETTINGS_FILE:"settings.json",SETTINGS_FILE_VERSION:3,LOOKUP_MAP_FILE:"map.json",FILE_ACCESSOR_WRITE_FOLDER:"clientLogs",FILE_ACCESSOR_FILE_COUNT_LIMIT:500,FILE_ACCESSOR_WRITE_VERSION:1,SUPPORTED_FILE_WRITE_VERSIONS:[1],FILE_ACCESS_MAP_FILE:"api.json",FILE_ACCESS_MAP_FILE_VERSION:1,FILE_ACCESS_RENAME_THROTTLE:36e5,ERR_MESSAGE_SIZE_LIMIT:1024,ASSETS_DIRNAME:"assets",CC_SETTINGS_FILE:"C3Config.xml",CONSOLE_LOGGING:!1,SCOPES:"openid,AdobeID",FILE_ACCESSOR_WRITE_ENABLED:!1,FILEACCESSOR_WRITE_SLA:864e5,FILEACCESSOR_WRITE_TIME_BUFFER:3e5,MAX_ACCESSOR_FILE_SIZE:102400,SYNC_INITIAL_RETRY:24e4,KILLED_BEFORE_RESPONSE_INITIAL_RETRY:1e3,MAX_LOG_SIZE:5242880,PROXY_REQUEST_TIMEOUT:2e3,CLIENT_REQUEST_TIMEOUT:9e5,USER_ANALYTICS__REQUEST_TIMEOUT:2e3,GET_NOTIFICATION_DATA_TIMEOUT:2e3,NETWORK_STATUS_INTERVAL:1e3,NETWORK_MAX_LATENCY:3e3,NETWORK_MAX_SOCKETS:1,NETWORK_MAX_LATENCY_RETRIES:20,NETWORK_MINIMUM_PARTIAL_SIZE:524288,STOP_SYNCING_BEYOND:2556e5,HEALTH_POLL_INTERVAL:864e5,INITIAL_HEALTH_MEASUREMENT_DELAY:18e4,CPU_POLL_DURATION:6e4,DEFAULT_MEMOIZE_TIMEOUT:6e4,MAX_BACK_OFF:864e5,RETRYABLE_ERRORS:["ECONNRESET","ETIMEDOUT","ECONNREFUSED","LOCAL_RETRY","ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC"],NGL_ERRORS_TO_INFO_LOG:[403,407,408],EMBARGO_BACK_OFF:20736e5,RETRYABLE_DEFAULT_ATTEMPTS:8,GLOBAL_BACKOFF_SYNC_THROTTLE:1e4,ONLINE_SYNC_THROTTLE:1e4,OFFLINE_SYNC_THROTTLE:1e4,LEARN_DEFAULT_EXPIRATION:2592e5,ASSET_DEFAULT_EXPIRATION:2592e5,KILLSWITCH_MEMOIZE_TIMEOUT:864e5,TEMP_KILL_SWITCH_REGISTRY_KEY:"\\SOFTWARE\\Policies\\Adobe\\CCXProcess",TEMP_KILL_SWITCH_PLIST_PATH:"/Library/Preferences/com.adobe.CCXProcess.plist",TEMP_DEFAULT_TEMPLATES_DOWNLOADED:100,TEMP_STOCK_TEMPLATE_DOWNLOAD_LIMIT_REGISTRY_SETTING:"TempStockDownloadLimit",TEMP_CCD_CONTENT_DOWNLOAD_REGISTRY_SETTING:"TempCCDContentDownloadDisabled",TEMP_CCD_CONTENT_DOWNLOAD_DISABLED:!1,TEMP_SENSEI_MODELS_CONTENT_DOWNLOAD_REGISTRY_SETTING:"TempSenseiModelContentDownloadDisabled",TEMP_SENSEI_MODELS_CONTENT_DOWNLOAD_DISABLED:!1,TEMP_NETWORK_STATUS_REGISTRY_SETTING:"TempNetworkStatusDisabled",TEMP_NETWORK_STATUS_DISABLED:!1,LAUNCH_AGENT:"".concat(process.env.HOME,"/Library/LaunchAgents/com.adobe.ccxprocess.plist"),LAUNCH_DIRECTORY:"".concat(process.env.HOME,"/Library/LaunchAgents/"),NGL_INITIALIZE_TIMEOUT:3e5,TIER_1_LOCALES:["en_US","fr_FR","de_DE","ja_JP","ko_KR"],SUPPORTED_LOCALES:["cs_CZ","da_DK","de_DE","en_US","en_AE","en_GB","en_IL","es_ES","es_MX","fi_FI","fr_FR","fr_CA","fr_MA","hu_HU","it_IT","ja_JP","ko_KR","nb_NO","nl_NL","pl_PL","pt_BR","ru_RU","sv_SE","tr_TR","uk_UA","zh_CN","zh_TW"],DOWNLOAD_ASSET_TIMEOUT:6e4,DNS_CACHE_DURATION:24e4,MAX_EPERM_RENAMES:10,NUM_CONCURRENT_REQUESTS:10,MIN_RANDOMIZED_TIME:1e3,MAX_RANDOMIZED_TIME:9e5,MAX_RANDOMIZED_TIME_SHORT:3e4,TIME_FOR_SHORT_RANDOMIZE:36e5,FILE_ACCESSOR_RETRY_FOR_EMPTY_LOOKUPMAP:864e5,MAX_TIMEOUT:Math.pow(2,31)-1,MIN_TIMEOUT:36e6,NETWORK_POLL_INTERVAL:36e5,DNS_RESOLVE_TIMEOUT:2e3,MIN_REFRESH:6e4,TRIAL_DAYS:7,USER_INTENT_DIALOG:"User Intent Dialog",USER_INTENT_SUPPORTED_PLAYLIST_TYPES:["playlist"],USER_INTENT_SUPPORTED_UTUT_TYPES:["helpUsing","inApp","helpLearn"],PRODUCT_ALIASES:{PHSP:"PHXS",PHSPPR:"PHXS",PHSPBETA:"PHXS",PPROBETA:"PPRO",AEFTBETA:"AEFT",IDSNBETA:"IDSN",IDSNPR:"IDSN",FLPRBETA:"FLPR",FLPRPR:"FLPR",SPRKDV:"SPRK",SPRKPR:"SPRK",KCCC:"ACCC",ILSTBETA:"ILST",ILSTPR:"ILST"},PRODUCT_LIST:["PHXS","IDSN","PPRO","ILST","AEFT","MUSE","DRWV","FLPR","SPRK"],IGNORED_FILES_REGEXP:"\\bassets|api|clientLogs\\b",NODE_AID_RESPONSE_SCHEMA:{id:"NODE_AID_RESPONSE",type:"object",properties:{ProductsInfo:{type:"object",properties:{ProductInfo:{type:"array",items:{type:"object",properties:{SAPCode:{type:"array",items:{type:"string"}},CodexVersion:{type:"array",items:{type:"string"}},Platform:{type:"array",items:{type:"string"}},InstallerType:{type:"array",items:{type:"string"}},IsUWPProduct:{type:"array",items:{type:"string"}},InstallLanguage:{type:"array",items:{type:"string"}},DisplayName:{type:"array",items:{type:"string"}},BuildVersion:{type:"array",items:{type:"string"}},LaunchString:{type:"array",items:{type:"string"}}}}}}}}},MAP_DATA_SCHEMA:{id:"MAP_DATA",type:"object",properties:{versionInfo:{type:"object"},metadata:{type:"object"},assetMetadata:{type:"object"},version:{type:"number"}},required:["versionInfo","metadata","assetMetadata","version"]},CARDS_CONTROL_SCHEMA:{id:"/CARDS_CONTROL",type:"object",properties:{modeID:{type:["string","null"]},cardOrder:{type:["array","null"],items:{type:"number"}}},required:["modeID","cardOrder"]},SOPHIA_RESPONSE_SCHEMA:{id:"/SOPHIA_RESPONSE",type:"object",properties:{analyticsData:{type:"object",properties:{responseGUID:{type:"string"}}},surfaces:{type:"object",additionalProperties:{type:"object",properties:{containers:{type:"array",items:{type:"object",properties:{data:{type:"string",dataType:"string"},containerAnalyticsData:{type:"object"}}}},surfaceAnalyticsData:{type:"object",properties:{surfaceId:{type:"string"}}}}}},expirationDTS:{type:"string"}},required:["expirationDTS"]},CARDS_DATA_SCHEMA:{V1:{id:"CARDS_DATA",type:"object",properties:{cards:{type:"array"},expirationDTS:{type:"string"},cardControl:{type:"array",items:{$ref:"/CARDS_CONTROL"}},version:{type:"number"}},required:["expirationDTS","cards","cardControl"]},V2:{id:"CARDS_DATA",type:"object",properties:{cards:{type:"array"},expirationDTS:{type:"string"},cardControl:{type:"array",items:{$ref:"/CARDS_CONTROL"}},version:{type:"number"}},required:["expirationDTS","cards","cardControl"]},V2_4:{id:"CARDS_DATA",type:"object",properties:{cards:{type:"array"},expirationDTS:{type:"string"},cardControl:{type:"array",items:{$ref:"/CARDS_CONTROL"}},version:{type:"number"}},required:["expirationDTS","cards","cardControl"]},V2_5:{id:"CARDS_DATA",type:"object",properties:{cards:{type:"array"},expirationDTS:{type:"string"},cardControl:{type:"array",items:{$ref:"/CARDS_CONTROL"}},version:{type:"number"}},required:["expirationDTS","cards","cardControl"]},V2_8:{id:"/SOPHIA_RESPONSE",type:"object",properties:{surfaces:{type:"object"},expirationDTS:{type:"string"},version:{type:"number"}},required:["expirationDTS","surfaces"]},V3_0:{id:"/SOPHIA_RESPONSE",type:"object",properties:{surfaces:{type:"object"},expirationDTS:{type:"string"},version:{type:"number"}},required:["expirationDTS","surfaces"]},V3_1:{id:"/SOPHIA_RESPONSE",type:"object",properties:{surfaces:{type:"object"},expirationDTS:{type:"string"},version:{type:"number"}},required:["expirationDTS","surfaces"]},V4_0:{id:"/SOPHIA_RESPONSE",type:"object",properties:{surfaces:{type:"object"},expirationDTS:{type:"string"},version:{type:"number"}},required:["expirationDTS","surfaces"]}},VULCAN_PREFIX:"vulcan.SuiteMessage.",VULCAN_STARTUP_MESSAGE:"ccxprocess.Initialized",VULCAN_PING_REQUEST:"ccxprocess.in.request.app.ping",VULCAN_PING_RESPONSE:"ccxprocess.out.response.app.ping",VULCAN_PSDK_FEED_REQUEST:"ccxprocess.PSDKFeedRequest",VULCAN_PSDK_FEED_RESPONSE:"ccxprocess.PSDKFeedResponse",VULCAN_PSDK_FEED_BROADCAST:"ccxprocess.PSDKFeedBroadcast",VULCAN_LEARN_REQUEST:"ccxprocess.LearnRequest",VULCAN_LEARN_RESPONSE:"ccxprocess.LearnResponse",VULCAN_LEARN_USAGE_MARKER:"ccxprocess.LearnUsageMarker",VULCAN_LEARN_BROADCAST:"ccxprocess.LearnBroadcast",VULCAN_GET_USER_REQUEST:"ccxprocess.GetUserRequest",VULCAN_GET_USER_RESPONSE:"ccxprocess.GetUserResponse",VULCAN_START_SETTINGS_REQUEST:"ccxprocess.StartSettingsRequest",VULCAN_START_SETTINGS_GET_REQUEST:"ccxprocess.StartSettingsGetRequest",VULCAN_START_SETTINGS_GET_RESPONSE:"ccxprocess.StartSettingsGetResponse",VULCAN_START_SETTINGS_PATCH_UPDATE:"ccxprocess.StartSettingsPatchUpdate",VULCAN_STOCK_REQUEST:"ccxprocess.StockTemplateRequest",VULCAN_STOCK_RESPONSE:"ccxprocess.StockTemplateResponse",VULCAN_CC_PHOTO_DOWNLOAD_REQUEST:"ccxprocess.CCPhotoDownloadRequest",VULCAN_CC_PHOTO_DOWNLOAD_RESPONSE:"ccxprocess.CCPhotoDownloadResponse",VULCAN_CC_PHOTO_DOWNLOAD_PROGRESS:"ccxprocess.CCPhotoDownloadProgress",VULCAN_CC_PHOTO_DOWNLOAD_ERROR:"ccxprocess.CCPhotoDownloadError",VULCAN_AVATAR_REQUEST:"ccxprocess.UserAvatarRequest",VULCAN_AVATAR_RESPONSE:"ccxprocess.UserAvatarResponse",VULCAN_AVATAR_REQUEST_V2:"ccxprocess.AvatarRequest",VULCAN_AVATAR_RESPONSE_V2:"ccxprocess.AvatarResponse",SKIP_LOGGING_MESSAGE_LIST:["ccxprocess.in.request.app.ping","ccxprocess.out.response.app.ping"],SKIP_LOGGING_MESSAGE_CONTENT:["ccxprocess.in.request.app.ping","ccxprocess.out.response.app.ping","adbproduct.app.UserContextDataResponse","accc.app.ProxySettingsResponse","any.accc.app.ProxySettingsChanged","any.accc.app.UserContextData"],NOTIFICATION_REQUEST:"accc.notifications",NOTIFICATION_PSDK_RESPONSE:"ccxprocess.notification.psdk",NOTIFICATION_STOCK_RESPONSE:"ccxprocess.notification.stock",NOTIFICATION_FORCE_REFRESH_RESPONSE:"ccxprocess.notification.force-refresh",NOTIFICATION_PSDK_QUERY_DATA_BY_ID_RESPONSE:"ccxprocess.notification.psdk.byID.data",NOTIFICATION_STOCK_QUERY_DATA_BY_ID_RESPONSE:"ccxprocess.notification.stock.byID.data",NOTIFICATION_PSDK_QUERY_DATA_BY_TIME_RESPONSE:"ccxprocess.notification.psdk.byTime.data",NOTIFICATION_STOCK_QUERY_DATA_BY_TIME_RESPONSE:"ccxprocess.notification.stock.byTime.data",NOTIFICATION_FORCE_REFRESH_QUERY_DATA_BY_TIME_RESPONSE:"ccxprocess.notification.force-refresh.byTime.data",ANS_PSDK_NOTIFICATION_TYPE:"com.adobe.psdk.v1",ANS_PSDK_NOTIFICATION_SUB_TYPE:"operational.profile.updated",ANS_STOCK_NOTIFICATION_TYPE:"com.adobe.stock",ANS_STOCK_NOTIFICATION_SUB_TYPE:"templates.update",ANS_FORCE_REFRESH_NOTIFICATION_TYPE:"com.adobe.accc.generic.v1",ANS_FORCE_REFRESH_NOTIFICATION_SUB_TYPE:"esdk.force.refresh",ANS_NUJ_REFRESH_NOTIFICATION_TYPE:"com.adobe.dunamis",ANS_NUJ_REFRESH_NOTIFICATION_SUB_TYPE:"profile.state.change",USER_ANALYTICS_ENABLED:!1,ANALYTICS_INGEST_PATH:"/ingest",ANALYTICS_X_PRODUCT:"CCXStart/2.5",ANALYTICS_PROJECT:"ccx-process-service",ANALYTICS_INGEST_TYPE:"dunamis",ANALYTICS_API_KEY:"ccx-process-service",ANALYTICS_MAX_QUEUED_EVENTS:600,ANALYTICS_DEBOUNCE:1e4,ALLOW_NO_TOKEN:!0,ANALYTICS_HEARTBEAT_INTERVAL:36e5,ANALYTICS_EVENT_VALIDATION_INTERVAL:144e5,UNSUPPORTED_WINDOWS_UXP_APPS:["PHXS","ILST","SPRK","IDSN","PPRO","AEFT"],EARLIEST_SUPPORTED_WINDOWS_VERSION_UXP:"6.2",SUPPORTED_LEARN_THIRD_PARTY_START_MIN_VERSION:"2.7",LEARN_DATA_SCHEMA:{id:"/LEARN_CARD_DATA",type:"object",properties:{tutorials:{type:"array",items:{type:"object",properties:{metadata:{type:"object",properties:{images:{type:"object",properties:{hero:{type:"string"},thumbnail:{type:"string"}}}}}}}}}},CARD_DATA_SCHEMA:{v2:{id:"/CARD_DATA",type:"object",properties:{cardType:{type:"string"},cardName:{type:"string"},displayTemplate:{type:"string"},backgroundImage:{type:["string","null"]},backgroundImageLocalPath:{type:["string","null"]},backgroundFillColor:{type:["string","null"]},startDTS:{type:["string","null"]},endDTS:{type:["string","null"]},overlayTintColor:{type:["string","null"]}},required:["cardType"]},openDoc:{},firstrun:{},footer:{},learn:{},discover:{},trial:{},welcome:{}},PRODUCT_PRIORITY:{PHXS:9,ILST:8,IDSN:7,PPRO:6,AEFT:5,SPRK:4,DRWV:3,FLPR:2,MUSE:1},DEFAULT:{LOOKUP_MAP_FILE_VERSION:2,URL_STAGING:"https://p13n-stage.adobe.io/psdk/v2/content",URL_PRODUCTION:"https://p13n.adobe.io/psdk/v2/content",SUPPORTED_PRODUCTS:{},LOOKUP_COLLECTION_FILE_VERSION:1,PRIORITY_CHANNEL:f.b.Unknown,HTTP_STATUS_HEAD_CHECK_URL:"https://odin.adobe.com/content/odin/home.html",DNS_RESOLVE_STATUS_CHECK_URL:"https://p13n.adobe.io"},OZ:{LOG_PREFIX:"Oz"},V1:{VERSION_LESS_THAN:"2.0",START_VERSION:"1.0",FIRST_MILE_PREFETCH_CLIENTS:{AEFT:"15.0",DRWV:"18.0",IDSN:"13.0",ILST:"22.0",MUSE:"2018.0",PHXS:"19.0",PPRO:"12.0"},FIRST_MILE_SURFACE_ID:["welcome","openDoc"],FIRST_MILE_SURFACE_MODE_MAP:{openDoc:"openDoc",welcome:"welcome"}},V2:{VERSION_LESS_THAN:"2.4",START_VERSION:"2.2.1.120",FIRST_MILE_PREFETCH_CLIENTS:{AEFT:"16.0",DRWV:"19.0",IDSN:"14.0",ILST:"23.0",MUSE:"2019.0",PHXS:"20.0",PPRO:"13.0"},FIRST_MILE_SURFACE_ID:["CCX_Start_2.0_FirstRun","CCX_Start_2.0_Footer","CCX_Start_2.0_Learn","CCX_Start_2.0_Discover","CCX_Start_2.0_Trial"],FIRST_MILE_SURFACE_MODE_MAP:{"CCX_Start_2.0_FirstRun":"firstrun","CCX_Start_2.0_Footer":"footer","CCX_Start_2.0_Learn":"learn","CCX_Start_2.0_Discover":"discover","CCX_Start_2.0_Trial":"trial"}},V2_4:{VERSION_LESS_THAN:"2.5",START_VERSION:"2.4.0.11",FIRST_MILE_SURFACE_ID:["CCX_TUTORIAL_2.5","CCX_Start_2.5_Learn","CCX_Start_2.5_Toast","CCX_Start_2.5_Home"],FIRST_MILE_SURFACE_MODE_MAP:{"CCX_TUTORIAL_2.5":"CCX_TUTORIAL_2.5","CCX_Start_2.5_Learn":"CCX_Start_2.5_Learn","CCX_Start_2.5_Home":"CCX_Start_2.5_Home","CCX_Start_2.5_Toast":"CCX_Start_2.5_Toast"},FIRST_MILE_PREFETCH_CLIENTS:{AEFT:"16.0",DRWV:"19.0",IDSN:"14.0",ILST:"23.0",MUSE:"2019.0",PHXS:"20.0",PPRO:"13.0"},HOME_SURFACE_ID:"CCX_Start_2.5_Home",LEARN_SURFACE_ID:"CCX_TUTORIAL_2.5"},V2_5:{VERSION_LESS_THAN:"2.8",START_VERSION:"2.7.2.14",FIRST_MILE_PREFETCH_CLIENTS:{AEFT:"16.99",DRWV:"99.99",IDSN:"14.99",ILST:"23.99",MUSE:"2019.99",PHXS:"20.99",PPRO:"13.99"},FIRST_MILE_SURFACE_ID:["CCX_Start_2.5_Learn","CCX_Start_2.5_Toast","CCX_Start_2.5_Home"],FIRST_MILE_SURFACE_MODE_MAP:{"CCX_TUTORIAL_2.5":"CCX_TUTORIAL_2.5","CCX_Start_2.5_Learn":"CCX_Start_2.5_Learn","CCX_Start_2.5_Home":"CCX_Start_2.5_Home","CCX_Start_2.5_Toast":"CCX_Start_2.5_Toast"},HOME_SURFACE_ID:"CCX_Start_2.5_Home",LEARN_SURFACE_ID:"CCX_TUTORIAL_2.5"},V2_8:{VERSION_LESS_THAN:"3.0",START_VERSION:"2.16.0.8",FIRST_MILE_PREFETCH_CLIENTS:{AEFT:"18.0",IDSN:"15.99",ILST:"24.0",MUSE:"2099.0",PHXS:"21.0",PPRO:"14.4"},FIRST_MILE_SURFACE_ID:["CCX_Start_3.1_Learn","CCX_Start_3.1_Toast","CCX_Start_3.1_Home","CCX_Start_3.1_Whats_New"],FIRST_MILE_SURFACE_MODE_MAP:{"CCX_Start_3.1_Tutorials":"CCX_Start_3.1_Tutorials","CCX_Start_3.1_Learn":"CCX_Start_3.1_Learn","CCX_Start_3.1_Home":"CCX_Start_3.1_Home","CCX_Start_3.1_Toast":"CCX_Start_3.1_Toast","CCX_Start_3.1_Whats_New":"CCX_Start_3.1_Whats_New"},HOME_SURFACE_ID:"CCX_Start_3.1_Home",LEARN_SURFACE_ID:"CCX_Start_3.1_Tutorials"},V3_0:{VERSION_LESS_THAN:"3.1",START_VERSION:"3.0.4",FIRST_MILE_PREFETCH_CLIENTS:{FLPR:"20.0",ILST:"24.0",PHXS:"21.0"},FIRST_MILE_SURFACE_ID:["CCX_Start_3.0_Learn","CCX_Start_3.0_Toast","CCX_Start_3.0_Home"],FIRST_MILE_SURFACE_MODE_MAP:{"CCX_Start_3.0_Tutorials":"CCX_Start_3.0_Tutorials","CCX_Start_3.0_Learn":"CCX_Start_3.0_Learn","CCX_Start_3.0_Home":"CCX_Start_3.0_Home","CCX_Start_3.0_Toast":"CCX_Start_3.0_Toast"},HOME_SURFACE_ID:"CCX_Start_3.0_Home",LEARN_SURFACE_ID:"CCX_Start_3.0_Tutorials"},V3_1:{VERSION_LESS_THAN:"4.0",START_VERSION:"3.8.0.28",FIRST_MILE_PREFETCH_CLIENTS:{FLPR:"21.0.3",PHXS:"22.2",ILST:"25.2",SPRK:"38.0",IDSN:"16.1",PPRO:"14.9"},FIRST_MILE_SURFACE_ID:["CCX_Start_3.1_Learn","CCX_Start_3.1_Toast","CCX_Start_3.1_Home","CCX_Start_3.1_Whats_New"],FIRST_MILE_SURFACE_MODE_MAP:{"CCX_Start_3.1_Tutorials":"CCX_Start_3.1_Tutorials","CCX_Start_3.1_Learn":"CCX_Start_3.1_Learn","CCX_Start_3.1_Home":"CCX_Start_3.1_Home","CCX_Start_3.1_Toast":"CCX_Start_3.1_Toast","CCX_Start_3.1_Whats_New":"CCX_Start_3.1_Whats_New"},HOME_SURFACE_ID:"CCX_Start_3.1_Home",LEARN_SURFACE_ID:"CCX_Start_3.1_Tutorials"},V4_0:{VERSION_LESS_THAN:"99.9",START_VERSION:"6.5.0.61",FIRST_MILE_PREFETCH_CLIENTS:{FLPR:"99.0",ILST:"99.0",PHXS:"99.0",SPRK:"99.0",PPRO:"99.0",IDSN:"99.0",AEFT:"99.0"},FIRST_MILE_SURFACE_ID:["CCX_Start_4.0_Toast","CCX_Start_4.0_Home","CCX_Start_4.0_Whats_New"],FIRST_MILE_SURFACE_MODE_MAP:{"CCX_Start_3.1_Tutorials":"CCX_Start_3.1_Tutorials","CCX_Start_4.0_Home":"CCX_Start_4.0_Home","CCX_Start_4.0_Toast":"CCX_Start_4.0_Toast","CCX_Start_4.0_Whats_New":"CCX_Start_4.0_Whats_New"},HOME_SURFACE_ID:"CCX_Start_4.0_Home",LEARN_SURFACE_ID:"CCX_Start_3.1_Tutorials"},ANALYTICS:{w_CCX_PROCESS:"CCX Process",w_NOTIFICATION:"Notification",w_INTERNAL:"Internal",c_DESKTOP:"DESKTOP",SOPHIA_CARDS:"Sophia Cards",UTUTS:"Ututs",sc_CONFIG_SETTINGS:"Config Settings",sc_CUSTOM_HOOK:"CustomHook.ts",sc_PROCESS:"Process",sc_SOPHIA:"Sophia",sc_STOCK:"Stock",sc_LEARN:"Learn",sc_CCX_START:"CCX Start",sc_CC_PHOTO:"CC Photo",sc_LR_CONTENT:"Lightroom Content",sc_CC_SEARCH:"CC Search",sc_OZ:"Oz",sc_CC_SEARCH_STORAGE:"CC Storage",sc_UTUTS:"Ututs",sc_LCM:"LCM",sc_RECOMMMENDATIONS:"Recommendations",sc_USER_INTENT_RECOMMENDATIONS:"UserIntentRecommendations",sc_AUTH:"Auth",sc_AVATAR:"Avatar",sc_FORCE_REFRESH:"Force Refresh",sc_CCX_FILE_DOWNLOAD:"CCX Start File Download",sc_PULSE:"Pulse",sc_Network:"Network",sc_Proxy:"Proxy",sc_METRICS:"Metrics",t_INSTALL:"install",t_UNINSTALL:"uninstall",t_UPDATE:"update",t_INIT:"init",t_START:"start",t_REQUEST:"request",t_RESPONSE:"response",t_SIGNOUT:"signout",t_SIGNIN:"signin",t_FETCH:"fetch",t_CLEAR:"clear",t_PERFORMANCE:"performance",t_APP:"app",t_INFO:"info",t_WARNING:"warning",st_PROCESS:"process",st_API:"api",st_ANS:"ans",st_CC_PHOTOS:"cc photos",st_NETWORK:"network",st_CLIENT:"client",st_TOKEN:"token",st_RECEIVED:"received",st_FINISHED:"finished",st_RUNNING:"running",st_STATUS:"status",st_SETTINGS:"settings",st_DEBUG:"debug",st_ACCESSOR:"file accessor",LOOKUP_MAP_ERROR:"Lookup Map Save",ACCESSOR_WRITE_SUCCESS:"File Accessor Write API Success",ERROR:"error",NO_ERROR:null,AGGREGATE_ERROR:"Aggregate Error",AGGREGATE_ERROR_DESCRIPTION:" aggregation error.",PARAM_VALIDATION_ERR:"Param Validation Error",PAYLOAD_PARSE_FAIL:"Fail to parse payload",UNEXPECTED_ANS_MSG:"Received unexpected ANS message",PARSE_MSG_FAIL:"Fail to parse message",GET_NOTIFICATION_DATA:"Get Notification Data By ID",DATA_VALIDATION_ERR:"Data Validation Error",GC_ERROR:"GC Error",NETWORK_ERR:"Network Error",IO_ERR:"I/O Error",ACCESSOR_WRITE_FILE_ERROR_TYPE:"write_client",ACCESSOR_CLIENT_ERROR_TYPE:"client_input",ACCESSOR_WRITE_ERROR_NO_PARAMS_CODE:"X_ACCESSOR_NO_PARAMS",ACCESSOR_WRITE_ERROR_NO_CONTENT:"X_ACCESSOR_NO_CONTENT",ACCESSOR_WRITE_ERROR_CREATING_DIR_CODE:"X_ACCESSOR_CREATING_DIR",ACCESSOR_WRITE_ERROR_READING_DIR_CODE:"X_ACCESSOR_READING_DIR",ACCESSOR_WRITE_ERROR_INVALID_VERSION_CODE:"X_ACCESSOR_INVALID_VERSION",ACCESSOR_WRITE_ERROR_INVALID_TIMESTAMP_CODE:"X_ACCESSOR_INVALID_TIMESTAMP",ACCESSOR_WRITE_ERROR_TIMESTAMP_FUTURE_CODE:"X_ACCESSOR_INVALID_TIMESTAMP_FUTURE",ACCESSOR_WRITE_ERROR_TIMESTAMP_OLDER_CODE:"X_ACCESSOR_TIMESTAMP_OLDER",ACCESSOR_WRITE_ERROR_NO_USER_CODE:"X_ACCESSOR_WRITE_NO_USER",ACCESSOR_WRITE_ERROR_NO_PATH_DESCRIPTION_CODE:"X_ACCESSOR_WRITE_NO_PATH_DESCRIPTION",ACCESSOR_WRITE_ERROR_FILE_TYPE_CODE:"X_ACCESSOR_WRITE_FILE_TYPE",ACCESSOR_WRITE_ERROR_FILE_SIZE_CODE:"X_ACCESSOR_WRITE_FILE_SIZE",ACCESSOR_WRITE_ERROR_FILE_INVALID_JSON_CODE:"X_ACCESSOR_WRITE_INVALID_JSON",ACCESSOR_READ_ERROR_CODE:"X_ACCESSOR_READ_SAVE",ACCESSOR_WRITE_DISPLAY_ID_NOT_FOUND_CODE:"X_ACCESSOR_DISPLAY_ID_NOT_FOUND",ACCESSOR_READ_RENAME_ERROR_CODE:"X_ACCESSOR_READ_RENAME",ACCESSOR_ERROR_TYPE:"File_Accessor_Save",LR_PHOTO_DOWNLOAD_ERR:"Lightroom Photo Download Error",NO_DATA:"No data to save",NO_STOCK_PARAMS:"No Stock Params",MISSING_DATA:"Missing Data",SIGNED_OUT:"User Signed Out",OFFLINE_ERROR:"Offline",INVALID_JSON:"Invalid JSON",EXPIRED_DATA:"Expired Data",NGL_PROFILE_ERROR:"NGL Profile",NGL_TOKEN_ERROR:"NGL Token",AID_GET_INSTALLED_APPS_ERROR:"AID Installed App Sync DB Error",ONLINE_SYNC_ERROR:"Online Sync Error",INVALID_COLLECTION:"Invalid Collection Data",DEBUG_INTERFACE:"DEBUG Interface"},ON_DEMAND_REQUEST_SCHEMA:{id:"/ON_DEMAND_REQUEST_SCHEMA",type:"object",properties:{params:{type:"object"},requestId:{type:"string"},version:{type:"integer",maximum:1,minimum:1},force:{type:"object",properties:{type:{type:"string",pattern:"stale|always|none"},depth:{type:"integer",minimum:0,maximum:2}}},analytics:{type:"object"},required:["version","params","requestId"]}},ON_DEMAND_LIST_REQUEST_SCHEMA:{id:"/ON_DEMAND_LIST_REQUEST_SCHEMA",type:"object",properties:{params:{type:"object"},requestId:{type:"string"},version:{type:"integer",maximum:1,minimum:1},required:["version","params","requestId"]}},SERVICE_REQUEST_SCHEMA:{id:"/SERVICE_REQUEST_SCHEMA",type:"object",properties:{params:{type:"object"},requestId:{type:"string"},version:{type:"integer",maximum:1,minimum:1},displayed:{type:"string"},urgent:{type:"boolean"},updateLastUseTime:{type:"boolean"},force:{type:"object",properties:{type:{type:"string",pattern:"stale|always|none"},depth:{type:"integer",minimum:0,maximum:2}}},analytics:{type:"object"},required:["version","params","requestId"]}},FORCE_REFRESH_SCHEMA:{id:"/FORCE_REFRESH_SCHEMA",type:"object",properties:{expire:{type:"object",properties:{AVATAR:{type:["boolean","array"]},CCD:{type:["boolean","array"]},DISCOVER_PANEL:{type:["boolean","array"]},FIRST_MILE:{type:["boolean","array"]},LEARN:{type:["boolean","array"]},SENSEI_MODELS:{type:["boolean","array"]},STOCK:{type:["boolean","array"]},XD:{type:["boolean","array"]}}},force:{type:"object",properties:{type:{enum:["stale","always","none"]},depth:{type:"integer",minimum:0,maximum:2}},required:["type"]}},required:["expire"]},CC_DIR:"",ROOT_DIR:"",LOG_DIR:"",DOWNLOAD_TMP_EXTENSION:"",PROGRESS_THROTTLE_INTERVAL:0,TMP_PHOTOS_DOWNLOAD_DIRECTORY:"",STOCK_API_PATH:"",STOCK_API_ROOT:"",CC_SEARCH_IDENTIFIER:"ccsearch-component-service",CC_TOUT_DOWNLOAD_IDENTIFIER:"ccxstart-download-file"}),c()(this,"environments",{staging:{LABEL:"Staging",CLIENT_NAME:"CCXProcess1",CLIENT_ID:"CCXProcess_v4_14",CLIENT_SECRET:"s8e-vtKe4R4agQoOZt1ViFYwdA22qhedM_Mr",IMS:"ims-na1-stg1.adobelogin.com",UTUTS_SERVICE:"https://utut-service.stage.adobe.com/api/ututs"},production:{LABEL:"Production",CLIENT_NAME:"CCXProcess1",CLIENT_ID:"CCXProcess_v4_14",CLIENT_SECRET:"p8e-0_8xAUhqtnJioUNPe9TtstmqUPTGpjr4",IMS:"ims-na1.adobelogin.com",UTUTS_SERVICE:"https://utut-service.adobe.com/api/ututs"}}),c()(this,"settings",{SETTINGS_FILE_VERSION:this.config.SETTINGS_FILE_VERSION}),c()(this,"currentDiskState",void 0),c()(this,"analytics",this.get("ANALYTICS")),this.init()}return o()(e,[{key:"init",value:function(){var e=this;if(this.isPlatformWindows()){var t=process.env.USERPROFILE.replace(/\\/g,"/");this.config.ROOT_DIR="".concat(t,"/AppData/Roaming/"),this.config.LOG_DIR="".concat(process.env.TEMP.replace(/\\/g,"/"),"/CreativeCloud/CCX Welcome/");var r="".concat(this.isArm()?process.env.ProgramFiles:process.env["ProgramFiles(x86)"]).replace(/\\/g,"/");this.config.CC_DIR="".concat(r,"/Adobe/Adobe Creative Cloud/")}else this.config.ROOT_DIR="".concat(process.env.HOME,"/Library/Caches/"),this.config.LOG_DIR="".concat(process.env.HOME,"/Library/Logs/CreativeCloud/CCX Welcome/"),this.config.CC_DIR="/Applications/Utilities/Adobe Creative Cloud/";var n=!1;this.isStagingRedirectInEffect()&&(this.config.ENVIRONMENT="staging",n=!0),this.config.ROOT_DIR+="Adobe/CCX Welcome/"+(n?"stage/":""),this.config.LOG_DIR+=n?"stage/":"",this.config.STOCK_API_ROOT="/Rest/Media/".concat(this.config.STOCK_API_VERSION),this.config.STOCK_API_PATH="".concat(this.config.STOCK_API_ROOT,"/Search/Templates"),this.config.TMP_PHOTOS_DOWNLOAD_DIRECTORY="com.adobe.ccx.start.lrphotos/",this.config.PROGRESS_THROTTLE_INTERVAL=250,this.config.DOWNLOAD_TMP_EXTENSION=".tmp",["openDoc","firstrun","footer","learn","discover","trial","welcome"].forEach(function(t){e.config.CARD_DATA_SCHEMA[t]=e.config.CARD_DATA_SCHEMA.v2}),this.loadSettings(),process.argv.forEach(function(t){"--debug"===t&&(e.config.CONSOLE_LOGGING=!0)}),this.config.CONSOLE_LOGGING||global.test||(console.log("Outputting logs to: ".concat(this.config.LOG_DIR)),console.log("To view log messages on the console, use the --debug argument"))}},{key:"isPlatformWindows",value:function(){return 0===process.platform.indexOf("win")}},{key:"isArm",value:function(){return 0===process.arch.indexOf("arm")}},{key:"get",value:function(e,t){return t?this.settings[t]&&void 0!==this.settings[t][e]?this.settings[t][e]:this.config[t]&&this.config[t][e]:void 0!==this.settings[e]?this.settings[e]:this.config[e]}},{key:"set",value:function(e,t,r){return r?(this.settings[r]=this.settings[r]||{},this.settings[r][e]=t):this.settings[e]=t,this.saveSettings()}},{key:"default",value:function(e){var t=e.LABEL.toLowerCase().replace(/^\w/,function(e){return e.toUpperCase()});return e.ANALYTICS_SUBCATEGORY=e.ANALYTICS_SUBCATEGORY||t,e.LOG_PREFIX=e.LOG_PREFIX||t,e.DIR=e.DIR||t.toLowerCase()+"/",e.VULCAN_TYPE=e.VULCAN_TYPE||t,e.AGGREGATE_TYPE=e.AGGREGATE_TYPE||t,e}},{key:"patch",value:function(e,t){this.config[e]=this.config[e]||{};var r=Object.assign({},this.config[e]);Object.assign(this.config[e],this.config.DEFAULT,r,t),this.default(this.config[e])}},{key:"getEnvironment",value:function(){var e=this.get("ENVIRONMENT");return this.environments[e]||this.environments[this.config.ENVIRONMENT]}},{key:"isStagingRedirectInEffect",value:function(){var e=!1;try{var t=l.readFileSync(this.config.CC_DIR+this.config.CC_SETTINGS_FILE,"utf8");new d.Parser({async:!1}).parseString(t,function(t,r){t||r.C3Config.config[0].namespace.forEach(function(t){t&&t.$&&t.$.name&&"accc.container"===t.$.name&&t.property.forEach(function(t){t&&t.$&&t.$.name&&"IMS_ENV"===t.$.name&&"STG"===t._&&(e=!0)})})})}catch(e){}return e}},{key:"loadSettings",value:function(){try{this.currentDiskState=l.readFileSync(this.config.ROOT_DIR+this.config.SETTINGS_FILE,"utf8");var e=JSON.parse(this.currentDiskState);this.settings.SETTINGS_FILE_VERSION===e.SETTINGS_FILE_VERSION&&(this.settings=e)}catch(e){}}},{key:"saveSettings",value:function(){var e=JSON.stringify(this.settings,void 0,2);if(e===this.currentDiskState)return!1;try{var t="".concat(this.config.SETTINGS_FILE,".TEMP_").concat(u.v4());l.writeFileSync(this.config.ROOT_DIR+t,e),l.renameSync(this.config.ROOT_DIR+t,this.config.ROOT_DIR+this.config.SETTINGS_FILE),this.currentDiskState=e}catch(e){}return!0}}]),e}());t.default=p},function(e,t){e.exports=require("@babel/runtime/helpers/asyncToGenerator")},function(e,t,r){"use strict";r.r(t);var n=r(2),a=r.n(n),s=r(7),o=r.n(s),i=r(8),c=r.n(i),u=r(4),l=r.n(u),d=r(0),f=r.n(d),p=r(37),h=r(13),_=r(10),v=r(24),E=r(33),y=r(1),m=r(40),g=r(41),S=r.n(g),O=r(5),T=new(function(){function e(){var t=this;o()(this,e),l()(this,"memoize",function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.resolver,a=r.refresher,s=r.wrapper,o=r.timeout,i=void 0===o?y.default.get("DEFAULT_MEMOIZE_TIMEOUT"):o,c=r.destructor,u=void 0===c?function(){return!0}:c,l=t,d=function t(){var r=arguments,o=n?n.apply(this,r):r[0],c=t.cacheTimeout.get(o);if(c&&clearTimeout(c),i>0&&t.cacheTimeout.set(o,setTimeout(function e(){t.cache.get(o)&&(u(o,t.cache.get(o))?t.cache.delete(o):t.cacheTimeout.set(o,setTimeout(e,i)))},i)),t.cache.has(o)){var d=t.cache.get(o);if(!a||!a(d))return s?s(r,d,!0):d}var f=e.apply(this,r);return f instanceof Promise&&l.enablePromiseStateAccess(f),t.cache.set(o,f),s?s(r,f,!1):f};return d.cache=new Map,d.cacheTimeout=new Map,d}),l()(this,"throttle",function(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){var a=this,s=(new Date).getTime(),o=arguments;t&&s<t+n?(clearTimeout(r),r=setTimeout(function(){t=s,e.apply(a,o)},n)):(t=s,e.apply(a,o))}}),l()(this,"setTimeoutAsync",function(e){return new Promise(function(t){return setTimeout(t,e)})})}return c()(e,[{key:"getTimeToExpiry",value:function(e){if(!e)return 0;var t=(new Date).valueOf(),r=new Date(e).valueOf()-t;return isNaN(r)?0:Math.max(0,r)}},{key:"enablePromiseStateAccess",value:function(e){e.state="pending",e.then(function(t){e.state="resolved",e.value=t},function(t){e.state="rejected",e.value=t})}},{key:"isDebugModeEnabled",value:function(){return y.default.get("DEBUG_MODE")}},{key:"isDateExpired",value:function(e){return 0===this.getTimeToExpiry(e)}},{key:"getHumanReadableTime",value:function(e){var t=e/36e5,r=e/6e4%60,n=e/1e3%60;return t>1?t.toFixed(2)+" hr":r>1?r.toFixed(2)+" min":n>1?n.toFixed(2)+" s":e+" ms"}},{key:"getRandomizedTime",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=y.default.get("MIN_RANDOMIZED_TIME"),r=e?y.default.get("MAX_RANDOMIZED_TIME_SHORT"):y.default.get("MAX_RANDOMIZED_TIME");return Math.floor(Math.random()*(r-t))+t}},{key:"validateDataFields",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=new m.Validator;r&&r.forEach(function(e){n.addSchema(e,e.id)});var a=n.validate(e,t);return 0===a.errors.length?null:a.errors}},{key:"parseXml",value:function(){var e=a()(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise(function(){var e=a()(f.a.mark(function e(r,n){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:E.parseString(t,function(e,t){e?n(e):r(t)});case 1:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}());case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"getProductAlias",value:function(e){var t=y.default.get("PRODUCT_ALIASES");return t&&t[e]||e}},{key:"getProcessVersion",value:function(){return"".concat(p.version,"-").concat("2")}},{key:"isWindows",value:function(){return"win32"===process.platform}},{key:"getOsVersion",value:function(){return v.release()}},{key:"getOsPlatform",value:function(){var e=this.isWindows()?"win":"mac";return"arm64"===v.arch()?e+="arm64":e+="64",e}},{key:"getClientContentVersion",value:function(e,t){return y.default.get("ACTIVE_VERSIONS",t).find(function(r){var n=y.default.get(r,t).PREFETCH_CLIENTS[e.productCode];return 1!==T.compareMajorMinorVersions(n,e.productVersion)})||"V1"}},{key:"ccxVersionToString",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{ccxVersion:""},r=t.ccxVersion;return t.ccxVersion?y.default.get("ACTIVE_VERSIONS").find(function(t){var n=y.default.get("VERSION_LESS_THAN",t);return-1===e.compareMajorMinorVersions(n,r)})||"V1":(r=y.default.get("ACTIVE_VERSIONS").filter(function(r){if(!t.productCode||!t.productVersion)return!1;var n=y.default.get("FIRST_MILE_PREFETCH_CLIENTS",r)[t.productCode];return!(!n||1===e.compareMajorMinorVersions(n,t.productVersion))})[0])||"V1"}},{key:"retryLocalErrors",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y.default.get("RETRYABLE_DEFAULT_ATTEMPTS");return function(){var r=a()(f.a.mark(function r(n){var a,s,o,i=this;return f.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:a=0,s=null,o=null;case 1:return s=null,r.next=4,e(n).catch(function(e){if(!y.default.get("RETRYABLE_ERRORS").includes(null==e?void 0:e.code))throw e;s=e,i.log.disk("Retry-able error present. Retrying ".concat(a+1,". Underlying error ").concat(e))});case 4:o=r.sent;case 5:if(++a<t&&s){r.next=1;break}case 6:if(!s){r.next=8;break}throw new O.default("LOCAL_NETWORK_ERROR_RETRY_FAILED",s);case 8:return r.abrupt("return",o);case 9:case"end":return r.stop()}},r)}));return function(e){return r.apply(this,arguments)}}()}},{key:"sanitizeLocale",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y.default.get("SUPPORTED_LOCALES");if(t.includes(e))return e;var r=e.slice(0,2);return t.find(function(e){return e.slice(0,2)===r})||"en_US"}},{key:"compareMajorMinorVersions",value:function(e,t){if(!e)return 1;if(!t)return-1;var r,n,a,s;try{r=parseInt(e.split(".")[0],10),a=parseInt(e.split(".")[1]||"0",10)}catch(e){return 1}try{n=parseInt(t.split(".")[0],10),s=parseInt(t.split(".")[1]||"0",10)}catch(e){return-1}return r===n&&a===s?0:r<n||r===n&&a<s?1:-1}},{key:"getClientsThatNeedRefresh",value:function(e){var t=this,r={};y.default.get("ACTIVE_VERSIONS").forEach(function(e){r[e]={}});var n=e.getCachedRequestData();Object.keys(n).forEach(function(e){Object.keys(n[e]).forEach(function(a){n[e][a].forEach(function(n){var s=t.ccxVersionToString(n),o=y.default.get("FIRST_MILE_PREFETCH_CLIENTS",s)[e];if(o&&-1===t.compareMajorMinorVersions(o,a)){var i=[e,a,n.productLanguage,n.countryCode].join("-");r[s][i]||(r[s][i]=n)}})})});var a={};return Object.keys(r).map(function(e){a[e]=Object.values(r[e])}),a}},{key:"hasBeenUsedRecently",value:function(e){if(!e)return!1;var t=new Date(e);return!isNaN(t)&&(t.setMilliseconds(y.default.get("STOP_SYNCING_BEYOND")),t>new Date)}},{key:"getDiskSize",value:function(){var e=a()(f.a.mark(function e(){var t,r,n,s=this,o=arguments;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:y.default.get("ROOT_DIR"),e.next=3,h.readdir(t);case 3:return r=e.sent,e.next=6,T.waitAll(r.map(function(){var e=a()(f.a.mark(function e(r){var n;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=_.join(t,r),e.next=3,h.stat(r).catch(function(e){return{isFile:function(){return!1},size:0,isDirectory:function(){return!1}}});case 3:if(!(n=e.sent).isFile()){e.next=8;break}return e.abrupt("return",n.size);case 8:if(!n.isDirectory()){e.next=12;break}return e.next=11,s.getDiskSize(r);case 11:return e.abrupt("return",e.sent);case 12:return e.abrupt("return",0);case 13:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 6:return n=e.sent.reduce(function(e,t){return e+t},0),e.abrupt("return",n);case 8:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"deleteTempFiles",value:function(){var e=a()(f.a.mark(function e(t){var r,n,s,o=arguments;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>1&&void 0!==o[1]?o[1]:864e5,n=new Date,e.next=4,h.readdir(t);case 4:return s=e.sent,e.next=7,T.waitAll(s.map(function(){var e=a()(f.a.mark(function e(a){var s,o;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s=_.join(t,a),e.next=3,h.stat(s);case 3:if(o=e.sent,!(Number(n)-Number(o.mtime)<r)){e.next=6;break}return e.abrupt("return");case 6:return e.next=8,h.unlink(s);case 8:return e.abrupt("return","Deleted ".concat(s));case 9:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()).map(function(e){return e.catch(function(e){return"Error deleting temp file: ".concat(e)})}));case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"scrubStack",value:function(e){return e?(e=e.toString()).replace(/[A-Z]?\:?(\\|\/).*\1/g,function(e){return e.length>=5?"<r>":e}).trim():e}},{key:"getLocks",value:function(){var e=a()(f.a.mark(function e(t,r,n){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,a){var s=void 0,o=void 0,i=function(){t(function(){return new Promise(function(e){s=e})})},c=function(){r(function(){return new Promise(function(e){o=e})})};setTimeout(function t(){s&&o?n().then(e).catch(a).finally(function(){s(),o()}):s?(s(),s=void 0,setTimeout(i,10),setTimeout(t,30)):o?(o(),o=void 0,setTimeout(c,10),setTimeout(t,30)):setTimeout(t,20)},20),i(),c()}));case 1:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"waitAll",value:function(){var e=a()(f.a.mark(function e(t){var r,n;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=null,e.next=3,Promise.all(t.map(function(e){return e.catch(function(e){return r=r||e})}));case 3:if(n=e.sent,!r){e.next=6;break}throw r;case 6:return e.abrupt("return",n);case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"exec",value:function(e,t){return new Promise(function(r,n){return S.a.exec(e,t,function(e,t){return e?n(e):r(t)})})}}]),e}());t.default=T},function(e,t){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,t,r){"use strict";r.r(t),r.d(t,"default",function(){return I});var n=r(25),a=r.n(n),s=r(7),o=r.n(s),i=r(8),c=r.n(i),u=r(9),l=r.n(u),d=r(15),f=r.n(d),p=r(16),h=r.n(p),_=r(6),v=r.n(_),E=r(42),y=r.n(E),m=r(4),g=r.n(m),S=r(24);function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function T(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach(function(t){g()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=v()(e);if(t){var a=v()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return h()(this,r)}}var I=function(e){f()(r,e);var t=A(r);function r(e){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return o()(this,r),n=t.call(this,e||a instanceof Error&&a.message||"Unknown"),g()(l()(n),"underlyingError",void 0),g()(l()(n),"error_code",void 0),g()(l()(n),"silent",!1),g()(l()(n),"skipStack",!1),g()(l()(n),"context",""),g()(l()(n),"headers",void 0),g()(l()(n),"payload",{}),g()(l()(n),"subErrorList",[]),g()(l()(n),"supportData",void 0),a&&(a instanceof r?(n.silent=a.isSilent,n.underlyingError=a,a.hasSubErrors&&n.addSubError({err:a}),Object.assign(n.payload,a.ingestPayload)):n.underlyingError=a),n.error_code=s||n.underlyingError&&"string"!=typeof n.underlyingError&&n.underlyingError.code||"Unknown",n}return c()(r,[{key:"addSubError",value:function(e){var t=this,n=e.err;return this.underlyingError||(n instanceof r?(this.silent=n.isSilent,this.underlyingError="",Object.assign(this.payload,n.ingestPayload)):this.underlyingError=""),"Unknown"===this.error_code&&n instanceof Error&&void 0!==n.code&&(this.underlyingError=n,this.error_code=n.code),n instanceof r&&null!=n&&n.hasSubErrors?n.subErrors.forEach(function(r){t.addSubError(T(T({},e),r))}):this.subErrorList.push(e),this}},{key:"assignSubErrors",value:function(e){return this.subErrorList.forEach(function(t){Object.assign(t,e,t)}),this}},{key:"addSubErrors",value:function(e){var t=this;Object.keys(e||{}).forEach(function(r){var n;null==e||null===(n=e[r].failed)||void 0===n||n.forEach(function(e){return t.addSubError(T(T({},e),{},{surface:r}))})})}},{key:"subErrorJSON",get:function(){var e={};return new Set(this.subErrorList.map(function(e){return e.surface})).forEach(function(t){return e[t||"unknown"]={failed:[]}}),this.subErrorList.forEach(function(t){e[t.surface||"unknown"].failed.push(T(T({},t),{},{surface:void 0}))}),this.subErrorList.length>0?e:void 0}},{key:"hasSubErrors",get:function(){return this.subErrorList.length>0}},{key:"subErrors",get:function(){return a()(this.subErrorList)}},{key:"code",get:function(){return this.error_code}},{key:"short",get:function(){return this.message+(this.context||"")}},{key:"description",get:function(){var e=this.context?this.context+S.EOL:"";return this.subErrorList&&(e+=this.subErrorList.map(function(e){var t,r;return(e.err instanceof String?e.err:"".concat(null===(t=e.err)||void 0===t?void 0:t.message," (").concat(null===(r=e.err)||void 0===r?void 0:r.code,")"))+"@ ".concat(e.url)}).join(S.EOL)),!this.skipStack&&this.stack&&(e+=this.stack+S.EOL),this.underlyingError&&(e+=" VIA ",this.underlyingError instanceof r?e+=this.underlyingError.message+" "+this.underlyingError.code+S.EOL+this.underlyingError.description+S.EOL:this.underlyingError instanceof Error?e+=this.underlyingError.message+this.underlyingError.code+(this.underlyingError.stack?S.EOL+this.underlyingError.stack:"")+S.EOL:e+=this.underlyingError),e}},{key:"responseHeaders",get:function(){return this.headers}},{key:"ingestPayload",get:function(){return this.payload}},{key:"setPayload",value:function(e){return Object.assign(this.payload,e),this}},{key:"setResponseHeaders",value:function(e){return this.headers=e,this}},{key:"setContext",value:function(e){return this.context+=e,this}},{key:"toString",value:function(){return this.message+(this.description||this.message?S.EOL:"")+this.description}},{key:"toJSON",value:function(){return{desc:this.context,message:this.message,code:this.code}}},{key:"toSnapshot",value:function(){var e="".concat(this.message," (").concat(this.code,") ");return this.underlyingError instanceof r?e+this.underlyingError.toSnapshot():this.underlyingError instanceof Error?e+this.underlyingError.message+(this.underlyingError.code?" ".concat(this.underlyingError.code):""):e+this.underlyingError}},{key:"silence",value:function(){return this.silent=!0,this}},{key:"removeStack",value:function(){return this.skipStack=!0,this}},{key:"isSilent",get:function(){return this.silent}}]),r}(y()(Error))},function(e,t){e.exports=require("@babel/runtime/helpers/getPrototypeOf")},function(e,t){e.exports=require("@babel/runtime/helpers/classCallCheck")},function(e,t){e.exports=require("@babel/runtime/helpers/createClass")},function(e,t){e.exports=require("@babel/runtime/helpers/assertThisInitialized")},function(e,t){e.exports=require("path")},function(e,t,r){"use strict";r.r(t);var n=r(43),a=r.n(n),s=r(2),o=r.n(s),i=r(7),c=r.n(i),u=r(8),l=r.n(u),d=r(9),f=r.n(d),p=r(15),h=r.n(p),_=r(16),v=r.n(_),E=r(6),y=r.n(E),m=r(4),g=r.n(m),S=r(0),O=r.n(S),T=r(1),A=r(22),I=r(3),R=r(14),C=r(27),k=r(20),x=r(5),b=r(24);function N(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=y()(e);if(t){var a=y()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return v()(this,r)}}var D=r(54),w=r(37),L=1e4,P=T.default.getEnvironment(),M=315,U=function(e){h()(r,e);var t=N(r);function r(){var e;return c()(this,r),e=t.call(this),g()(f()(e),"log",void 0),g()(f()(e),"init",I.default.memoize(function(){return new Promise(function(t,r){var n=setTimeout(function(){e.log.error(new x.default("NGL initialization timed out")),t()},T.default.get("NGL_INITIALIZE_TIMEOUT")),a=D.InitializeProfileUpdates(e.nglConfig,function(){var r=o()(O.a.mark(function r(a,s){var o,i;return O.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(a&&(T.default.get("NGL_ERRORS_TO_INFO_LOG").includes(a)?e.log.disk("".concat(T.default.analytics.NGL_PROFILE_ERROR,": Ignoring ").concat(a," from NGL Library")):e.log.error(new x.default("Error from NGL Library "+a,T.default.analytics.NGL_PROFILE_ERROR,a))),o=e.getUserId(),e.setUserProfile(s),i=e.getUserId(),e.isInitialized){r.next=10;break}e.isInitialized=!0,clearTimeout(n),t(),r.next=21;break;case 10:if(!o||i){r.next=16;break}e.log.disk("Received Sign out event with error: ".concat(a)),e.log.context({authenticationDisabled:!1}).info(T.default.analytics.t_SIGNOUT),k.default.flush(!0,function(){e.log.disk("Flushed logs due to user sign out event"),e.reset(),e.emit("SIGN_OUT")}),r.next=21;break;case 16:if(i==o){r.next=21;break}return r.next=19,R.b.updateBackOff({clear:!0,type:R.a.AUTH});case 19:e.log.context({authenticationDisabled:!1}).info(T.default.analytics.t_SIGNIN),e.emit("SIGN_IN");case 21:case"end":return r.stop()}},r)}));return function(e,t){return r.apply(this,arguments)}}()).userProfile;e.setUserProfile(a)})},{timeout:-1})),g()(f()(e),"isInitialized",!1),g()(f()(e),"userProfile",void 0),g()(f()(e),"getDeviceID",I.default.memoize(function(){return Object.values(b.networkInterfaces()).map(function(e){return e[0].mac}).find(function(e){return"00:00:00:00:00:00"!=e})})),g()(f()(e),"getAccessTokenExpiry",I.default.memoize(function(t){try{var r=JSON.parse(Buffer.from(t.split(".")[1],"base64").toString("utf-8"));return new Date(parseInt(r.created_at)+parseInt(r.expires_in)-L)}catch(r){return t&&e.log.error(new x.default("Failed parsing access token",r)),-1}})),g()(f()(e),"getAccessToken",I.default.memoize(function(){return new Promise(function(){var t=o()(O.a.mark(function t(r,n){var a,s;return O.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.init();case 2:if(a=e.getUserId()){t.next=5;break}return t.abrupt("return",n(new x.default("Not Logged in").silence()));case 5:if(!R.b.isWaitingForBackOff(R.a.AUTH)){t.next=9;break}return s="Access Token awaiting global Auth back-off ".concat(R.b.backOffCause(R.a.AUTH)),e.log.disk(s),t.abrupt("return",n(new x.default(s,T.default.analytics.NGL_TOKEN_ERROR).silence()));case 9:e.log.disk("Started NGL.GetImsAccessToken."),D.GetImsAccessToken(e.nglConfig,function(){var t=o()(O.a.mark(function t(s,o){var i,c,u,l,d,f,p,h,_;return O.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.log.disk("Finished NGL.GetImsAccessToken."),e.getUserId()==a){t.next=3;break}return t.abrupt("return",n(new x.default("User changed").silence()));case 3:if(s!==M){t.next=9;break}return i=new x.default("Services not provisioned",T.default.analytics.NGL_TOKEN_ERROR,s.toString()),e.log.error(i),t.next=8,R.b.updateBackOff({cause:i.message,type:R.a.AUTH});case 8:return t.abrupt("return",n(i));case 9:if(!s||o){t.next=17;break}return c=s.toString(),u="Error from NGL fetching access token: ".concat(s.toString()),l=new x.default(u,T.default.analytics.NGL_TOKEN_ERROR,c),e.log.error(l),t.next=16,R.b.updateBackOff({cause:u,type:R.a.AUTH});case 16:return t.abrupt("return",n(l));case 17:d=0,s&&(d=s instanceof Error?s.code:parseInt(s.toString(),10)||void 0),f=s instanceof Error?s:s instanceof String?new Error(s.toString()):void 0,p={},t.prev=21,p=JSON.parse(o),t.next=32;break;case 25:return t.prev=25,t.t0=t.catch(21),h=new x.default("Cannot parse NGL access token response",f,d),e.log.error(h),t.next=31,R.b.updateBackOff({cause:h.message,type:R.a.AUTH});case 31:return t.abrupt("return",n(h));case 32:if(p.access_token){t.next=38;break}return _="No access token",e.log.error(new x.default(_,f,d)),t.next=37,R.b.updateBackOff({cause:_,type:R.a.AUTH});case 37:return t.abrupt("return",n(new x.default(_,f,d)));case 38:return s&&e.log.disk("Ignoring ".concat(s," from NGL Library while fetching access token")),e.log.context({authenticationDisabled:!1}).info(T.default.analytics.t_FETCH,"Successfully obtained access token"),t.next=42,R.b.updateBackOff({clear:!0,type:R.a.AUTH});case 42:return t.abrupt("return",r(p.access_token));case 43:case"end":return t.stop()}},t,null,[[21,25]])}));return function(e,r){return t.apply(this,arguments)}}());case 11:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}())},{refresher:e.checkAccessTokenNeedsRefresh.bind(f()(e)),timeout:864e5})),e.log=new A.default({prefix:"IMS > ",payload:{"event.subcategory":T.default.analytics.sc_AUTH,"event.subtype":T.default.analytics.st_TOKEN},authenticationDisabled:!0}),e.on("SIGN_IN",function(){k.default.resetEventInterval()}),e.on("SIGN_OUT",function(){k.default.resetEventInterval()}),e}return l()(r,[{key:"nglConfig",get:function(){var e=w.version.split("."),t=a()(e,2),r=t[0],n=t[1];return{clientName:P.CLIENT_NAME,clientId:P.CLIENT_ID,clientSecret:P.CLIENT_SECRET,clientScope:T.default.get("SCOPES"),clientVersion:"".concat(r,".").concat(n),clientLocale:"en_US",isStage:"Staging"===P.LABEL,forceRefresh:!0}}},{key:"setUserProfile",value:function(e){try{var t,r=this.getUserId();if(this.userProfile=JSON.parse(e),r!==this.getUserId())this.log.disk("Default User: ".concat(null===(t=this.getUserInfo())||void 0===t?void 0:t.userId))}catch(t){this.log.error(new x.default("Unable to parse user profile from NGL "+JSON.stringify(e,function(e,t){if("enigmaData"!=e)return"UserProfile"==e?{accountType:t.accountType,countryCode:t.countryCode,userId:t.userId}:t},2)))}}},{key:"checkAccessTokenNeedsRefresh",value:function(e){var t=e.state,r=e.value;return"pending"!==t&&("resolved"!==t||!r||this.getAccessTokenExpiry(r)<new Date)}},{key:"getUserInfo",value:function(){var e;return null===(e=this.userProfile)||void 0===e?void 0:e.UserProfile}},{key:"getUserId",value:function(){var e;return null===(e=this.getUserInfo())||void 0===e?void 0:e.userId}},{key:"reset",value:function(){this.log.info(T.default.analytics.t_CLEAR),this.getAccessToken.cache&&this.getAccessToken.cache.clear()}}]),r}(C.EventEmitter);t.default=new U},function(e,t,r){"use strict";r.d(t,"b",function(){return n}),r.d(t,"c",function(){return a}),r.d(t,"a",function(){return _}),r.d(t,"d",function(){return E});var n,a,s=r(2),o=r.n(s),i=r(7),c=r.n(i),u=r(8),l=r.n(u),d=r(4),f=r.n(d),p=r(0),h=r.n(p);!function(e){e[e.Unknown=0]="Unknown",e[e.Deprecated=1]="Deprecated",e[e.XdPrimary=2]="XdPrimary",e[e.SenseiModels=3]="SenseiModels",e[e.Stock=4]="Stock",e[e.CollectionTemplates=5]="CollectionTemplates",e[e.DiscoverPanel=6]="DiscoverPanel",e[e.FirstMileOld=7]="FirstMileOld",e[e.Lcm=8]="Lcm",e[e.Avatar=9]="Avatar",e[e.Learn=10]="Learn",e[e.CcdQuarternary=11]="CcdQuarternary",e[e.CcdTertiary=12]="CcdTertiary",e[e.CcdSecondary=13]="CcdSecondary",e[e.CcdPrimary=14]="CcdPrimary",e[e.FirstMileLatest=15]="FirstMileLatest",e[e.Photoshop=16]="Photoshop"}(n||(n={})),function(e){e[e.Regular=0]="Regular",e[e.BackgroundRequest=1]="BackgroundRequest",e[e.Installation=2]="Installation",e[e.UrgentRequest=3]="UrgentRequest"}(a||(a={}));var _=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.key,s=void 0===r?"":r,o=t.value,i=void 0===o?0:o,u=t.channel,l=void 0===u?n.Unknown:u,d=t.level,p=void 0===d?a.Regular:d;c()(this,e),f()(this,"key",void 0),f()(this,"value",void 0),f()(this,"channel",void 0),f()(this,"level",void 0),this.key=s,this.value=i,this.channel=l,this.level=p}return l()(e,[{key:"toString",value:function(){return"".concat(1e3*this.queue+this.value)}},{key:"queue",get:function(){return this.channel+100*this.level}}]),e}(),v=n.Unknown+100*a.Regular,E=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:108e5;c()(this,e),this.maxLocks=r,this.defaultTimeout=n,f()(this,"hasWriteLock",!1),f()(this,"readsInProgress",[]),f()(this,"pendingReads",[]),f()(this,"pendingWrites",[]),f()(this,"priorityOverrides",{}),f()(this,"prioritize",function(r){var n=r.key;n&&(t.priorityOverrides[n]=r,e.noTimeout()||setTimeout(function(){n&&delete t.priorityOverrides[n]},1e4),t.pendingReads.forEach(function(e){e.priority.key===n&&t.applyOverride(r,e.priority)}),t.check())})}return l()(e,[{key:"call",value:function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=setTimeout(function(){t.reject(new Error("Lock Timed out"))},t.timeout),e.next=3,t.callback().then(function(e){t.resolve(e),clearTimeout(r)}).catch(function(e){t.reject(e),clearTimeout(r)});case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"checkReads",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=[],!this.hasWriteLock&&this.pendingReads.length>0)for(n=function(){var e=r,n=a.call(e).then(function(){a.readsInProgress.splice(a.readsInProgress.indexOf(e),1),a.check()});t.push(n)};r=this.nextReadLock();)n();return e.next=4,Promise.all(t);case 4:return e.abrupt("return",t.length);case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"nextReadLock",value:function(){if(0!==this.pendingReads.length){var e=this.readsInProgress.length>0&&this.readsInProgress.reduce(function(e,t){return e.priority.queue>t.priority.queue?e:t}),t=e?e.priority.queue:v,r=this.pendingReads.reduce(function(e,t){return e.priority.queue>t.priority.queue?e:t}).priority.queue;if(!(r<t)){if(r===t)if(this.readsInProgress.filter(function(e){return e.priority.queue===t}).length>=this.maxLocks)return;var n=this.pendingReads.filter(function(e){return e.priority.queue===r});if(0!==n.length){var a=n.reduce(function(e,t){return t.priority.value>e.priority.value?t:e});return this.pendingReads.splice(this.pendingReads.indexOf(a),1),this.readsInProgress.push(a),a}}}}},{key:"check",value:function(){var e=o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.checkReads();case 2:if(e.t0=e.sent,0===e.t0){e.next=7;break}e.next=0;break;case 7:if(0!==this.readsInProgress.length||this.hasWriteLock){e.next=15;break}if(!(t=this.pendingWrites.shift())){e.next=15;break}return this.hasWriteLock=!0,e.next=13,this.call(t);case 13:this.hasWriteLock=!1,this.check();case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"read",value:function(){var e=o()(h.a.mark(function e(t){var r,s,o=this,i=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>1&&void 0!==i[1]?i[1]:new _({}),s=i.length>2&&void 0!==i[2]?i[2]:this.defaultTimeout,r.channel=r.channel||n.Unknown,r.level=r.level||a.Regular,r.value=r.value||0,r.key&&this.priorityOverrides[r.key]&&this.applyOverride(this.priorityOverrides[r.key],r),e.abrupt("return",new Promise(function(e,n){o.pendingReads.push({callback:t,resolve:e,reject:n,priority:r,timeout:s}),o.check()}));case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"write",value:function(){var e=o()(h.a.mark(function e(t){var r,n=this,a=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:this.defaultTimeout,e.abrupt("return",new Promise(function(e,a){n.pendingWrites.push({callback:t,resolve:e,reject:a,timeout:r}),n.check()}));case 2:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"applyOverride",value:function(e,t){t.level=Math.max(t.level,e.level)}}],[{key:"noTimeout",value:function(){return!1}}]),e}()},function(e,t){e.exports=require("fs-extra")},function(e,t,r){"use strict";r.d(t,"a",function(){return a});var n,a,s=r(2),o=r.n(s),i=r(7),c=r.n(i),u=r(8),l=r.n(u),d=r(9),f=r.n(d),p=r(15),h=r.n(p),_=r(16),v=r.n(_),E=r(6),y=r.n(E),m=r(4),g=r.n(m),S=r(0),O=r.n(S),T=r(27),A=r(1);function I(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=y()(e);if(t){var a=y()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return v()(this,r)}}!function(e){e.SYNC="SYNC"}(n||(n={})),function(e){e.AUTH="BackoffAuthentication",e.NETWORK="BackOffNetwork"}(a||(a={}));var R=new(function(e){h()(r,e);var t=I(r);function r(){var e;c()(this,r);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e=t.call.apply(t,[this].concat(s)),g()(f()(e),"SYNC",n.SYNC),g()(f()(e),"_syncRetryTimeout",null),e}return l()(r,[{key:"isWaitingForBackOff",value:function(e){var t=A.default.get("BACK_OFF_EXPIRY",e);return!!(t&&new Date(t)>new Date)}},{key:"backOffCause",value:function(e){return A.default.get("BACK_OFF_CAUSE",e)}},{key:"backOffWaitTime",value:function(e){return A.default.get("BACK_OFF",e)}},{key:"backOffExpiry",value:function(e){return A.default.get("BACK_OFF_EXPIRY",e)}},{key:"updateBackOff",value:function(){var e=o()(O.a.mark(function e(){var t,r,n,s,o,i,c,u,l,d,f=this,p=arguments;return O.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=p.length>0&&void 0!==p[0]?p[0]:{clear:!1,sync:!0,cause:"Unknown",type:a.NETWORK},r=t.clear,n=void 0!==r&&r,s=t.cause,o=void 0===s?"Unknown":s,i=t.type,c=t.sync,u=void 0===c||c,l=this.backOffWaitTime(i),!n){e.next=7;break}return l&&(A.default.set("BACK_OFF_EXPIRY",void 0,i),A.default.set("BACK_OFF",void 0,i),A.default.set("BACK_OFF_CAUSE",void 0,i)),u&&l&&(clearTimeout(this._syncRetryTimeout),this.emit(this.SYNC)),e.abrupt("return");case 7:return this.isWaitingForBackOff(i)||(l?l*=2:l=A.default.get("SYNC_INITIAL_RETRY"),l=Math.min(l,A.default.get("MAX_BACK_OFF")),A.default.set("BACK_OFF",l,i),(d=new Date).setMilliseconds(d.getMilliseconds()+l),A.default.set("BACK_OFF_EXPIRY",d.toISOString(),i),A.default.set("BACK_OFF_CAUSE","".concat(o," for ").concat(l/1e3,"s expiring ").concat(d.toISOString()),i),clearTimeout(this._syncRetryTimeout),this._syncRetryTimeout=setTimeout(function(){f.emit(f.SYNC)},this.backOffWaitTime(i))),e.abrupt("return");case 9:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(T.EventEmitter));t.b=R},function(e,t){e.exports=require("@babel/runtime/helpers/inherits")},function(e,t){e.exports=require("@babel/runtime/helpers/possibleConstructorReturn")},function(e,t,r){"use strict";r.r(t);var n=r(2),a=r.n(n),s=r(7),o=r.n(s),i=r(8),c=r.n(i),u=r(9),l=r.n(u),d=r(15),f=r.n(d),p=r(16),h=r.n(p),_=r(6),v=r.n(_),E=r(4),y=r.n(E),m=r(0),g=r.n(m),S=r(1),O=r(27),T=r(22),A=r(3),I=r(20),R=r(5),C=r(28);function k(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=v()(e);if(t){var a=v()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return h()(this,r)}}function x(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?x(Object(r),!0).forEach(function(t){y()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var N=r(57),D=function(e){return Object.keys(e).reduce(function(t,r){return b(b({},t),{},y()({},r,e[r][0]))},{})},w=new(function(e){f()(n,e);var t=k(n);function n(){var e;o()(this,n),e=t.call(this),y()(l()(e),"log",new T.default({prefix:"VulcanWrapper > "})),y()(l()(e),"vulcan",void 0),y()(l()(e),"installedApps",{}),y()(l()(e),"aidFetched",!1),y()(l()(e),"getInstalledApps",A.default.memoize(a()(g.a.mark(function t(){var r,n,s,o,i;return g.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!e.aidFetched){t.next=3;break}return t.abrupt("return",e.installedApps);case 3:return t.next=5,new Promise(function(){var e=a()(g.a.mark(function e(t,r){return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",N.getAllInstalledApps(!1,function(e,n){e?r(new R.default(S.default.analytics.AID_GET_INSTALLED_APPS_ERROR,e)):t(n)}));case 1:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}());case 5:return r=t.sent,t.next=8,A.default.parseXml(r);case 8:if(n=t.sent,!(s=A.default.validateDataFields(n,S.default.get("NODE_AID_RESPONSE_SCHEMA")))){t.next=13;break}throw new R.default(I.default.DATA_VALIDATION_ERR,"Invalid data: ".concat(JSON.stringify(null===(o=s[0])||void 0===o?void 0:o.message)));case 13:return i=n.ProductsInfo.ProductInfo,e.installedApps=i.reduce(function(e,t){var r=D(t);return r.SAPCode=A.default.getProductAlias(r.SAPCode),b(b({},e),{},y()({},r.SAPCode,b(b({},e[r.SAPCode]),{},y()({},r.CodexVersion,r))))},{}),e.aidFetched=!0,t.abrupt("return",e.installedApps);case 19:return t.prev=19,t.t0=t.catch(0),e.log.error(t.t0),t.abrupt("return",{});case 23:case"end":return t.stop()}},t,null,[[0,19]])})))),y()(l()(e),"getAppLanguage",function(){var t=a()(g.a.mark(function t(r,n){var a,s,o;return g.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,C.a.getOSLocale();case 2:return a=t.sent,t.next=5,e.getKeyForApp("InstallLanguage",r,n);case 5:if((s=t.sent)&&"mul"!==s){t.next=8;break}return t.abrupt("return",void 0);case 8:if(!s.includes(",")){t.next=11;break}return o=s.split(","),t.abrupt("return",o.includes(a)?a:o.includes("en_US")?"en_US":void 0);case 11:return t.abrupt("return",s);case 12:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),e.log.disk("Loading Vulcan Library...");var s=r(38);return e.log.disk("Vulcan Library Successfully Loaded."),e.vulcan=s.createMessageAdapter("CCXP","1.0.0"),e.vulcan.addMessageListener(function(t,r,n,a){t=t.replace(S.default.get("VULCAN_PREFIX"),""),0!==e.listenerCount(t)&&(e.shouldLogMessage(t)&&e.log.disk("<- ".concat(n," ").concat(a,": ").concat(t," \n ").concat(e.shouldLogContent(t)?r:"").trim()),e.emit(t,r,n,a))}),e}return c()(n,[{key:"clearInstalledAppsCache",value:function(){this.aidFetched=!1,this.getInstalledApps.cache.clear()}},{key:"shouldLogMessage",value:function(e){var t=S.default.get("SKIP_LOGGING_MESSAGE_LIST");return!t||!t.includes(e)||S.default.get("CONSOLE_LOGGING")}},{key:"shouldLogContent",value:function(e){var t=S.default.get("SKIP_LOGGING_MESSAGE_CONTENT");return!t||!t.includes(e)}},{key:"sendMessage",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=r?"".concat(r," ").concat(n||"*"):"BROADCAST";"string"!=typeof t&&(t=JSON.stringify(t)),this.shouldLogMessage(e)&&this.log.disk("-> ".concat(a,": ").concat(e," \n ").concat(this.shouldLogContent(e)?t:"").trim()),this.vulcan.sendMessage(e,t,r,n)}},{key:"getKeyForApp",value:function(){var e=a()(g.a.mark(function e(t,r,n){var a,s;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getInstalledApps();case 2:if(e.t2=r,e.t3=a=e.sent[e.t2],e.t1=null===e.t3,e.t1){e.next=7;break}e.t1=void 0===a;case 7:if(!e.t1){e.next=11;break}e.t4=void 0,e.next=12;break;case 11:e.t4=a[n];case 12:if(e.t0=e.t4,e.t0){e.next=15;break}e.t0={};case 15:return s=e.t0,e.abrupt("return",s[t]);case 17:case"end":return e.stop()}},e,this)}));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"getSpecifiers",value:function(){var e=a()(g.a.mark(function e(){return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getInstalledApps();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),n}(O));w.setMaxListeners(20),t.default=w},function(e,t,r){"use strict";r.d(t,"a",function(){return w});var n=r(2),a=r.n(n),s=r(7),o=r.n(s),i=r(8),c=r.n(i),u=r(9),l=r.n(u),d=r(15),f=r.n(d),p=r(16),h=r.n(p),_=r(6),v=r.n(_),E=r(4),y=r.n(E),m=r(0),g=r.n(m),S=r(27),O=r(36),T=r(1),A=r(22),I=r(3),R=r(26),C=r(14),k=r(5),x=r(30),b=r(19);function N(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=v()(e);if(t){var a=v()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return h()(this,r)}}var D,w,L=x.ReachabilityChanged;!function(e){e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e.UNKNOWN="UNKNOWN"}(D||(D={})),function(e){e.OS_NETWORK_NOTIFICATION="OS_NETWORK_NOTIFICATION ",e.CLIENT_REQUEST="CLIENT_REQUEST",e.ONDEMAND_REQUEST="ONDEMAND_REQUEST",e.NETWORK_SLOW_POLL="NETWORK_SLOW_POLL",e.CCXPROCESS_INITIALIZED="CCXPROCESS_INITIALIZED",e.LOOKUP_MAP_SYNC="LOOKUP_MAP_SYNC",e.DOWNLOAD_FETCH_ERROR="DOWNLOAD_FETCH_ERROR",e.UNKNOWN="UNKNOWN"}(w||(w={}));var P=new(function(e){f()(r,e);var t=N(r);function r(){var e;return o()(this,r),e=t.call(this),y()(l()(e),"networkCheckTimeout",void 0),y()(l()(e),"resolver",void 0),y()(l()(e),"currentCheckId","unknown"),y()(l()(e),"UNKNOWN",D.UNKNOWN),y()(l()(e),"ONLINE",D.ONLINE),y()(l()(e),"OFFLINE",D.OFFLINE),y()(l()(e),"status",D.UNKNOWN),y()(l()(e),"dnsFailed",!1),y()(l()(e),"log",void 0),y()(l()(e),"check",void 0),y()(l()(e),"isOnline",void 0),e.log=new A.default({prefix:"NetworkStatus >",payload:{"event.subcategory":T.default.analytics.sc_Network,"event.subtype":T.default.analytics.st_STATUS}}),e.resolver=new O.Resolver,e.isOnline=function(){return x.isOnline},e.check=I.default.memoize(e.checkInternal.bind(l()(e)),{refresher:function(e){return"pending"!==e.state},destructor:function(e,t){return"pending"!==t.state}}),e.on(e.OFFLINE,I.default.throttle(function(){var t=a()(g.a.mark(function t(r,n){return g.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r===e.OFFLINE){t.next=6;break}return I.default.isDebugModeEnabled()&&e.log.disk("[".concat(n,"] Change in Network Status from ").concat(r," to ").concat(e.OFFLINE,". Entering Network Backoff")),t.next=4,C.b.updateBackOff({type:C.a.NETWORK,cause:"Offline[Network Check]"});case 4:t.next=7;break;case 6:I.default.isDebugModeEnabled()&&e.log.disk("[".concat(n,"] Detected OFFLINE Network Status (unchanged from before)"));case 7:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}(),T.default.get("OFFLINE_SYNC_THROTTLE"))),e.on(e.ONLINE,I.default.throttle(function(){var t=a()(g.a.mark(function t(r,n){return g.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r===e.ONLINE){t.next=9;break}return I.default.isDebugModeEnabled()&&e.log.disk("[".concat(n,"] Change in Network Status from ").concat(r," to ").concat(e.ONLINE,".  Clearing Network Backoff")),t.next=4,C.b.updateBackOff({clear:!0,type:C.a.NETWORK,sync:!1});case 4:return t.next=6,C.b.updateBackOff({clear:!0,type:C.a.AUTH,sync:!0});case 6:e.clearScheduledNetworkCheck(),t.next=10;break;case 9:I.default.isDebugModeEnabled()&&e.log.disk("[".concat(n,"] Detected ONLINE Network Status (unchanged from before)"));case 10:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}(),T.default.get("ONLINE_SYNC_THROTTLE"))),x.on(L,a()(g.a.mark(function t(){return g.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.status===e.ONLINE){t.next=5;break}return t.next=3,e.runCheck();case 3:t.next=6;break;case 5:I.default.isDebugModeEnabled()&&e.log.disk("Reachability Notification Received - Skipping network check since networks status is online.");case 6:case"end":return t.stop()}},t)}))),e}return c()(r,[{key:"getDnsServers",value:function(){var e=a()(g.a.mark(function e(){return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O.getServers();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"runCheck",value:function(){var e=a()(g.a.mark(function e(){return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.check(w.OS_NETWORK_NOTIFICATION);case 2:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"checkInternal",value:function(){var e=a()(g.a.mark(function e(t){var r,n,a;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=b.v4(),this.currentCheckId=r,n=this.status,!T.default.get("TEMP_NETWORK_STATUS_DISABLED")){e.next=7;break}return e.next=6,this.emitAndSetStatus(this.ONLINE,n,r);case 6:return e.abrupt("return");case 7:return e.next=9,this.isOnline();case 9:if(!e.sent){e.next=13;break}e.t0=this.ONLINE,e.next=14;break;case 13:e.t0=this.OFFLINE;case 14:if((a=e.t0)!==this.OFFLINE){e.next=22;break}return I.default.isDebugModeEnabled()&&this.log.disk("[".concat(r,"] isOnline() Check returned FALSE from ").concat(t)),e.next=19,this.dnsCheck(r,t);case 19:this.dnsFailed?I.default.isDebugModeEnabled()&&this.log.disk("[".concat(r,"] DNS.resolve()  Check FAILED - from ").concat(t)):(a=this.ONLINE,I.default.isDebugModeEnabled()&&this.log.disk("[".concat(r,"] DNS.resolve()  Check  SUCCESSFUL - from ").concat(t))),e.next=24;break;case 22:I.default.isDebugModeEnabled()&&this.log.disk("[".concat(r,"] isOnline() Check returned TRUE from ").concat(t));case 24:if(n===a){e.next=30;break}return t===w.NETWORK_SLOW_POLL&&this.log.warning("Network Slow Poll resulted in changed Network Status").appendPayload({"event.value":"".concat(n,":").concat(this.status),"event.context_guid":r}),e.next=28,this.emitAndSetStatus(a,n,r);case 28:e.next=31;break;case 30:I.default.isDebugModeEnabled()&&this.log.disk("[".concat(r,"] No Change in Network Status [").concat(this.status,"] Check due to ").concat(t));case 31:this.scheduleNextNetworkCheck(r);case 32:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"dnsCheck",value:function(){var e=a()(g.a.mark(function e(t){var r,n,s=this,o=arguments;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>1&&void 0!==o[1]?o[1]:w.UNKNOWN,n=new R.URL(T.default.get("DNS_RESOLVE_STATUS_CHECK_URL","DEFAULT")).host,I.default.isDebugModeEnabled()&&this.log.disk("[".concat(t,"] triggered DNS check (").concat(n,") due to  ").concat(r)),e.abrupt("return",new Promise(function(){var e=a()(g.a.mark(function e(r){var o,i;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:o=Date.now(),i=setTimeout(function(){s.resolver.cancel(),I.default.isDebugModeEnabled()&&s.log.disk("[".concat(t,"] DNS Timeout occured. Cancelling DNS Check")),s.dnsFailed=!0},T.default.get("DNS_RESOLVE_TIMEOUT")),s.resolver.resolve(n,function(){var e=a()(g.a.mark(function e(a){var c;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(c=Date.now()-o,!a){e.next=16;break}return s.dnsFailed=!0,e.t0=s.log,e.t1=new k.default("DNS FAILED TO RESOLVE",a,a.code),e.t2=n,e.t3=c,e.t4=t,e.next=10,s.getDnsServers();case 10:e.t5=e.sent,e.t6={"event.url":e.t2,"event.value":e.t3,"event.context_guid":e.t4,"ccxp.dns_ip":e.t5},e.t7=e.t1.setPayload.call(e.t1,e.t6).silence(),e.t0.error.call(e.t0,e.t7),e.next=17;break;case 16:s.dnsFailed=!1;case 17:clearTimeout(i),r();case 19:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"scheduleNextNetworkCheck",value:function(){var e=a()(g.a.mark(function e(){var t,r,n=arguments;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=n.length>0&&void 0!==n[0]?n[0]:"unknown",this.status!==this.ONLINE&&this.currentCheckId===t?((r=new Date).setMilliseconds(T.default.get("NETWORK_POLL_INTERVAL")),this.clearScheduledNetworkCheck(),this.log.disk("[".concat(t,"] Scheduling Next Network Check in: ").concat(I.default.getHumanReadableTime(r.valueOf()-(new Date).valueOf()))),this.networkCheckTimeout=setTimeout(this.check.bind(this,w.NETWORK_SLOW_POLL),T.default.get("NETWORK_POLL_INTERVAL"))):I.default.isDebugModeEnabled()&&this.log.disk("[".concat(t,"] Network Status is ").concat(this.status,".  Not Scheduling Slow Poll. Network ID Matches ? ").concat(this.currentCheckId===t));case 2:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"emitAndSetStatus",value:function(){var e=a()(g.a.mark(function e(t,r,n){return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.currentCheckId===n&&(this.status=t,this.emit(t,r,n));case 1:case"end":return e.stop()}},e,this)}));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"clearScheduledNetworkCheck",value:function(){var e=a()(g.a.mark(function e(){return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.networkCheckTimeout&&(I.default.isDebugModeEnabled()&&this.log.disk("Clearing the slow poll"),clearTimeout(this.networkCheckTimeout),delete this.networkCheckTimeout);case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(S.EventEmitter));P.setMaxListeners(30),t.b=P},function(e,t){e.exports=require("uuid")},function(e,t,r){"use strict";r.r(t);var n=r(2),a=r.n(n),s=r(8),o=r.n(s),i=r(7),c=r.n(i),u=r(4),l=r.n(u),d=r(0),f=r.n(d),p=r(19),h=r(24),_=r(1),v=r(18),E=r(31),y=r(3),m=r(11),g=r(28),S=r(5),O=r(22);function T(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return A(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return A(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,i=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){i=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(i)throw s}}}}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}global.fetch=r(58);var I=!1,R=r(59),C={ENVIRONMENT:"Staging"===_.default.getEnvironment().LABEL?"stage":"prod",ANALYTICS_API_KEY:_.default.get("ANALYTICS_API_KEY"),ANALYTICS_X_PRODUCT:_.default.get("ANALYTICS_X_PRODUCT"),ANALYTICS_PROJECT:_.default.get("ANALYTICS_PROJECT"),ANALYTICS_INGEST_TYPE:_.default.get("ANALYTICS_INGEST_TYPE"),ANALYTICS_MAX_QUEUED_EVENTS:_.default.get("ANALYTICS_MAX_QUEUED_EVENTS"),ANALYTICS_DEBOUNCE:_.default.get("ANALYTICS_DEBOUNCE"),ALLOW_NO_TOKEN:_.default.get("ALLOW_NO_TOKEN")},k=function e(){var t=this;c()(this,e),l()(this,"getAccessToken",function(e){if(I)return e();m.default.getAccessToken().then(function(t){e(null,t)}).catch(function(r){t.log("Error getting access token - ".concat(r)),e()})}),l()(this,"log",function(e){N.disk(e)}),l()(this,"getAgent",function(e,t){var r=E.a.stripPathFromURL(e);g.a.getNodeTunnelOptionsForURL(r).then(function(e){delete e.agent,t(null,e)},function(e){t(e)})})},x=new R(new k,C),b=new R(new k,C),N=new O.default({prefix:"Ingest >"}),D=function(){function e(){var t=this;c()(this,e),l()(this,"NO_PARAMS",null),l()(this,"session_guid",p.v4()),l()(this,"event_session_tracker",p.v4()),l()(this,"_status",!1),l()(this,"_eventCount",0),l()(this,"_eventInterval",void 0),l()(this,"setEventInterval",function(){y.default.isDebugModeEnabled()&&(t._eventInterval&&t.clearEventInterval(),t._eventInterval=setInterval(function(){t.sendEventValidation(),t.resetEventCount(),t.resetEventSessionGuid()},_.default.get("ANALYTICS_EVENT_VALIDATION_INTERVAL")))}),l()(this,"clearEventInterval",function(){clearInterval(t._eventInterval),t._eventInterval=void 0}),l()(this,"resetEventCount",function(){t._eventCount=-1}),l()(this,"incrementEventCount",function(){t._eventCount++}),l()(this,"checkIMS",function(e,t){return t["user.service_code"]="creative_cloud",t}),l()(this,"sendEventValidation",function(){y.default.isDebugModeEnabled()&&N.context({payload:{"event.subcategory":"Metrics","event.subtype":"Ingest","event.value":t._eventCount,"ccxp.event_session_tracker":t.event_session_tracker}}).info("validation")}),l()(this,"resetEventInterval",function(){t.clearEventInterval(),m.default.getUserId()&&(t.sendEventValidation(),t.resetEventCount(),t.resetEventSessionGuid(),t.setEventInterval())}),l()(this,"getIpAddress",y.default.memoize(function(){var e=h.networkInterfaces(),t=Object.keys(e).map(function(t){return e[t].filter(function(e){return"IPv4"===e.family&&!e.internal})[0]}).filter(function(e){return e});return t.length>0?t[0].address:""})),l()(this,"resetEventSessionGuid",function(){t.event_session_tracker=p.v4(),N.disk("Updated Event Tracking Session GUID: ".concat(t.event_session_tracker))}),l()(this,"cleanPSDKParameters",function(e,t){return t&&(e["event.language"]=t.productLanguage,e["source.name"]=t.productCode,e["source.version"]=t.productVersion,e["source.device"]="Desktop",e["consumer.name"]="CCX Start",e["consumer.platform"]=y.default.getOsPlatform(),e["consumer.os_version"]=y.default.getOsVersion(),e["consumer.version"]=t.ccxVersion),e}),l()(this,"createPayload",function(){var e=a()(f.a.mark(function e(r,n,a){var s,o=arguments;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o.length>3&&void 0!==o[3]&&o[3]||(s=m.default.getUserId(),r["event.user_guid"]=s,r=t.checkIMS(s||"",r)),r["event.guid"]=p.v4(),r["event.session_guid"]=r["event.session_guid"]||t.session_guid,r["event.coll_dts"]=(new Date).toISOString(),r["event.dts_start"]=r["event.dts_start"]||(new Date).toISOString(),r["event.dts_end"]=r["event.dts_end"]||(new Date).toISOString(),r["event.workflow"]=r["event.workflow"]||_.default.analytics.w_CCX_PROCESS,r["event.category"]=_.default.analytics.c_DESKTOP,r["event.offline"]=v.b.status===v.b.OFFLINE,r["event.ip"]=t.getIpAddress(),e.t0=r["event.language"],e.t0){e.next=16;break}return e.next=15,g.a.getOSLocale();case 15:e.t0=e.sent;case 16:return r["event.language"]=e.t0,r["event.device_guid"]=m.default.getDeviceID(),r["env.com.name"]=_.default.analytics.w_CCX_PROCESS,r["env.com.version"]=y.default.getProcessVersion(),r["source.client_id"]=_.default.getEnvironment().CLIENT_ID,r["source.platform"]=y.default.getOsPlatform(),r["source.os_version"]=y.default.getOsVersion(),r["ccxp.event_session_tracker"]=r["ccxp.event_session_tracker"]||t.event_session_tracker,n&&(r=t.cleanPSDKParameters(r,n)),a&&t.addSurfaceAnalytics(r,a),e.abrupt("return",r);case 27:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),l()(this,"reset",function(e){return t.clearEventInterval(),e&&(x=new R(new k,e)),x}),l()(this,"resetOperational",function(e){return t.clearEventInterval(),e&&(b=new R(new k,e)),b}),l()(this,"logProcessEvent",function(){var e=a()(f.a.mark(function e(r,n,a,s,o,i){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.createPayload(r,n,a,o);case 2:r=e.sent,s&&(s instanceof S.default||(s=new S.default(s)),r["event.error_desc"]=t.limitMessageSize(y.default.scrubStack(s.description)),r["event.error_type"]=t.limitMessageSize(y.default.scrubStack(s.message)),r["event.error_code"]=s.code,r["ccxp.underlying_error"]&&(r["ccxp.underlying_error"]=t.limitMessageSize(r["ccxp.underlying_error"]))),o?(I=!0,t.postEvent(r,i),t.flush(!0,function(){I=!1})):t.postEvent(r,i);case 5:case"end":return e.stop()}},e)}));return function(t,r,n,a,s,o){return e.apply(this,arguments)}}()),l()(this,"logPollingEvent",function(){var e=a()(f.a.mark(function e(r,n,a){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.createPayload(r);case 2:r=e.sent,n?(I=!0,t.operationalPostEvent(r,a),t.operationalFlush(!0,function(){I=!1})):t.operationalPostEvent(r,a);case 4:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),l()(this,"operationalPostEvent",function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};t.incrementEventCount(),b.postEvent(e,r)}),l()(this,"operationalFlush",function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};b.flush(e,t)}),l()(this,"flush",function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};x.flush(e,t)}),l()(this,"postEvent",function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};t.incrementEventCount(),x.postEvent(e,r)}),l()(this,"enable",function(e){t._status=e,x.enable(e),b.enable(!0)}),l()(this,"limitMessageSize",function(e){return e.substring(0,_.default.get("ERR_MESSAGE_SIZE_LIMIT"))}),v.b.on(v.b.ONLINE,function(){t.getIpAddress.cache.clear()}),this.setEventInterval()}return o()(e,[{key:"addSurfaceAnalytics",value:function(e,t){var r=function(t,r){r&&(e[t]=e[t]||"",e[t].toString().includes(r)||(e[t]+=(e[t].toString().length>0?", ":"")+r))};if(t){var n,a=T(t);try{for(a.s();!(n=a.n()).done;){var s=n.value;s.surface&&r("exp.surface_id",s.surface),s.campaignId&&r("exp.campaign_id",""+s.campaignId),s.variationId&&r("exp.variation_id",s.variationId),s.treatmentId&&r("exp.treatment_id",s.treatmentId),s.controlGroupId&&r("exp.control_group_id",s.controlGroupId),s.actionBlockId&&r("exp.action_block_id",s.actionBlockId)}}catch(e){a.e(e)}finally{a.f()}}return e}}]),e}();t.default=Object.assign(new D,_.default.analytics)},function(e,t){e.exports=require("@babel/runtime/helpers/get")},function(e,t,r){"use strict";r.r(t);var n=r(2),a=r.n(n),s=r(32),o=r.n(s),i=r(25),c=r.n(i),u=r(7),l=r.n(u),d=r(8),f=r.n(d),p=r(4),h=r.n(p),_=r(0),v=r.n(_),E=r(29),y=r(19),m=r(1),g=r(9),S=r.n(g),O=r(15),T=r.n(O),A=r(16),I=r.n(A),R=r(6),C=r.n(R),k=r(13);function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=C()(e);if(t){var a=C()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return I()(this,r)}}var b,N=new(function(e){T()(r,e);var t=x(r);function r(){var e;l()(this,r);for(var n=arguments.length,a=new Array(n),s=0;s<n;s++)a[s]=arguments[s];return e=t.call.apply(t,[this].concat(a)),h()(S()(e),"logFilePath","".concat(m.default.get("LOG_DIR"),"CCX Process.log")),h()(S()(e),"prevLogFilePath","".concat(m.default.get("LOG_DIR"),"CCX Process (prev).log")),h()(S()(e),"pendingLogWrite",void 0),h()(S()(e),"writingToLog",!1),e}return f()(r,[{key:"swapLogIfNeeded",value:function(e){var t=this;k.stat(this.logFilePath,function(r,n){!r&&n.size>m.default.get("MAX_LOG_SIZE")?k.rename(t.logFilePath,t.prevLogFilePath,e):e(null)})}},{key:"doLogWrite",value:function(){var e=this;k.ensureDir(m.default.get("LOG_DIR"),function(t){if(t)return e.pendingLogWrite=void 0,void console.log(t);e.swapLogIfNeeded(function(t){if(t)return e.pendingLogWrite=void 0,void console.log(t);var r=e.pendingLogWrite;e.pendingLogWrite=void 0,e.writingToLog=!0,k.appendFile(e.logFilePath,r,function(t){t&&console.log(t),e.writingToLog=!1,e.pendingLogWrite&&e.doLogWrite(),e.emit("logWrite")})})})}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.join(": ");m.default.get("CONSOLE_LOGGING")&&n.match(new RegExp(process.argv[3]||".*"))&&console.log(n);var a=new Date,s=m.default.get("JSON_LOGGING")?n:"".concat(a.toString().replace(/(\d+\:\d+\:\d+)/,"$1."+a.getMilliseconds())," ").concat(n,"\n");this.pendingLogWrite?this.pendingLogWrite+=s:(this.pendingLogWrite=s,this.writingToLog||this.doLogWrite())}}]),r}(r(27).EventEmitter)),D=r(5),w=r(24),L=r(3);function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P(Object(r),!0).forEach(function(t){h()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}r.d(t,"LogBuilder",function(){return U}),r.d(t,"default",function(){return F});var U=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;l()(this,e),h()(this,"options",void 0),h()(this,"level",void 0),h()(this,"args",void 0),h()(this,"logArgs",[]),h()(this,"error",void 0),h()(this,"params",void 0),h()(this,"payload",void 0),h()(this,"surfaceAnalytics",void 0),this.options=t,this.level=r;for(var n=arguments.length,a=new Array(n>2?n-2:0),s=2;s<n;s++)a[s-2]=arguments[s];this.args=a,this.logArgs=[],this.payload=Object.assign({},this.options.payload),this.options.params&&this.setParams(this.options.params),this.options.surfaceAnalytics&&this.addSurfaceAnalytics(this.options.surfaceAnalytics)}return f()(e,[{key:"stringifyWithCycles",value:function(e){return"string"==typeof e?e:(e instanceof Error&&e.stack&&(e.stack=e.stack.replace(/[A-Z]?:?(\\|\/).*\1/g," ")),E.inspect(e))}},{key:"convertArgsToString",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.map(this.stringifyWithCycles).join(" ")}},{key:"post",value:function(){var e,t=this;if(this.error&&this.error instanceof D.default&&this.error.isSilent)return this;this.options.skipDiskLog||(m.default.get("JSON_LOGGING")?N.log(JSON.stringify(M(M(M({level:this.level.toUpperCase(),prefix:null===(e=this.options.prefix)||void 0===e?void 0:e.trim(),message:this.convertArgsToString.apply(this,c()(this.args).concat(c()(this.logArgs))).trim(),timestamp:(new Date).toISOString()},this.params),this.surfaceAnalytics),this.options.diskParams))+w.EOL):N.log(this.options.prefix+"[".concat(this.level.toUpperCase(),"] ")+this.convertArgsToString.apply(this,c()(this.args).concat(c()(this.logArgs)))));return(this.options.forceSilentError||!1!==this.options.analytics)&&(this.error instanceof D.default&&this.error.hasSubErrors&&!this.options.combineSubErrors?this.error.subErrors.forEach(function(e){e.err&&b.logProcessEvent(M(M(M({},t.payload),e.err.ingestPayload||{}),e.url&&{"event.url":e.url}),t.params,[e],e.err,t.options.authenticationDisabled)}):b.logProcessEvent(this.payload,this.params,this.surfaceAnalytics,this.error,this.options.authenticationDisabled)),this}},{key:"addSurfaceAnalytics",value:function(e){var t;this.surfaceAnalytics=this.surfaceAnalytics||[],(t=this.surfaceAnalytics).push.apply(t,c()(e))}},{key:"addDiskLog",value:function(){var e;return this.args=(e=this.args).concat.apply(e,arguments),this}},{key:"appendPayload",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(this.payload,e),this}},{key:"setError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new D.default("No error object passed");return e instanceof Error||(e=new D.default(""+e)),this.appendPayload({"event.type":m.default.analytics.ERROR}),e instanceof D.default&&this.appendPayload(e.ingestPayload),this.args.push(e),this.error=e,this}},{key:"setParams",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.productCode&&this.logArgs.push(" for product ".concat(e.productCode,"[").concat(e.productVersion,"]")+(e.productLanguage?"[".concat(e.productLanguage,"]"):"")),this.params=e,this}}]),e}(),F=function(){function e(t){l()(this,e),h()(this,"options",{}),this.options=t}return f()(e,[{key:"context",value:function(t){return new e(M(M(M({},this.options),t),{},{diskParams:M(M({},this.options.diskParams),t.diskParams),combineSubErrors:this.options.combineSubErrors||t.combineSubErrors,payload:M(M({},this.options.payload),t.payload),surfaceAnalytics:[].concat(c()(this.options.surfaceAnalytics||[]),c()(t.surfaceAnalytics||[]))}))}},{key:"disk",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return o()(U,[M({analytics:!1},this.options),"DISK"].concat(t)).post()}},{key:"diskDebug",value:function(){if(L.default.isDebugModeEnabled()){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return o()(U,[M({analytics:!1},this.options),"DISK"].concat(t)).post()}}},{key:"error",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return o()(U,[this.options,"error"].concat(r)).setError(e).post()}},{key:"info",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return o()(U,[this.options,"info",e].concat(r)).appendPayload({"event.type":m.default.analytics.t_INFO,"ccxp.message":e}).post()}},{key:"warning",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return o()(U,[this.options,"warning",e].concat(r)).appendPayload({"event.type":m.default.analytics.t_WARNING,"ccxp.message":e}).post()}},{key:"time",value:function(){var e=a()(v.a.mark(function e(t){var r,n,a;return v.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=Date.now(),n=new U(M(M({},this.options),{},{skipDiskLog:!0}),"Perf"),e.next=4,t(n);case 4:return a=e.sent,n.appendPayload({"event.dts_start":new Date(r).toISOString(),"event.dts_end":(new Date).toISOString(),"event.type":m.default.analytics.t_PERFORMANCE,"event.value":n.payload&&n.payload["event.value"]||Date.now()-r}).post(),e.abrupt("return",a);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"request",value:function(){var e=a()(v.a.mark(function e(t){var r,n,a,s,o;return v.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.options.payload,n="usage-marker"===(null==r?void 0:r["ccxp.mode"]),a=r&&r["event.context_guid"]||y.v4(),s=Date.now(),n||new U(this.options,"INFO").appendPayload({"event.type":m.default.analytics.t_REQUEST,"event.context_guid":a}).addDiskLog("Request Received").post(),o=new U(M(M({},this.options),{},{forceSilentError:!0}),"INFO"),e.next=8,t(o).then(function(e){return n||o.appendPayload({"event.type":m.default.analytics.t_RESPONSE,"event.context_guid":a,"event.value":Date.now()-s,"ccxp.partial":!1}).addDiskLog("Response sent in ".concat(Date.now()-s,"ms")).post(),e}).catch(function(e){var t,s;e instanceof D.default&&r&&r["event.subtype"]&&"client"==r["event.subtype"]&&(t={"ccxp.partial":!(null===(s=e.supportData)||void 0===s||!s.path)});throw n||o.appendPayload(M({"event.context_guid":a},void 0!==t&&t)).setError(e).post(),e});case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"console",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){var e;(e=console).log.apply(e,arguments)})}],[{key:"init",value:function(){b=r(20).default}}]),e}();h()(F,"Builder",void 0),F.Builder=U},function(e,t,r){"use strict";r.r(t);var n=r(7),a=r.n(n),s=r(8),o=r.n(s),i=r(15),c=r.n(i),u=r(16),l=r.n(u),d=r(6),f=r.n(d);function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=f()(e);if(t){var a=f()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return l()(this,r)}}var h=r(19),_=r(33),v=r(17).default,E=r(1).default,y=r(27),m=r(22).default,g=r(5).default,S=r(20).default,O=r(11).default,T=r(3).default,A=new _.Parser,I=new(function(e){c()(r,e);var t=p(r);function r(){var e;return a()(this,r),(e=t.call(this)).log=new m({prefix:"CCNotifications > ",payload:{"event.subcategory":E.analytics.sc_PROCESS,"event.subtype":E.analytics.st_ANS}}),e.events={SIGN_IN:"signIn",SIGN_OUT:"signOut",PROXY_SETTINGS_CHANGED:"proxySettingsChanged",PROFILE_UPDATED:"profileUpdated",INSTALL_APPLICATION:"installApplication",UNINSTALL_APPLICATION:"uninstallApplication",UPDATE_APPLICATION:"updateApplication",SUBSCRIPTION_STATUS_CHANGED:"subscriptionStatusChanged",UPDATE_STOCK:"updateStock",UPDATE_APPLICATION_COMPONENTS:"updateApplicationComponents",USER_ANALYTICS_CHANGED:"userAnalyticsChanged",FORCE_REFRESH:"forceRefresh"},e.getProxyCredentials=e._getProxyCredentials,e.getUserAnalyticsEnabledFlag=e._getUserAnalyticsEnabledFlag,e.handlePayload=e._handlePayload,e.registerANSNotifications=e._registerANSNotifications,e.addListeners(),e}return o()(r,[{key:"getMessageValue",value:function(e,t){var r=null;if(e){var n=new RegExp("<".concat(t,"[^<>]*>([^<>]*)</").concat(t,">"),""),a=e.match(n);r=a&&a[1]}return r}},{key:"constructMessage",value:function(e,t){var r=e;return Object.keys(t).forEach(function(e){r=r.replace(e,t[e])}),r}},{key:"normalizeProductCode",value:function(e){return T.getProductAlias(e)}},{key:"addListeners",value:function(){var e=this;v.addListener("accc.localapps.panel.refresh.ssoevent",function(t){var r=e.getMessageValue(t,"event_type");e.log.disk("ACCC Sign-on State: ".concat(r)),"signin_success"===r?e.emit(e.events.SIGN_IN):"signout_success"===r&&e.emit(e.events.SIGN_OUT)}),v.addListener("accc.any.NoListenerAvailable",function(t){e.log.error("No Listener Available: ".concat(t))}),v.addListener("com.adobe.aam.AAMIMSStatus",function(t){var r=e.getMessageValue(t,"Status");e.log.disk("AAM Sign-on State: ".concat(r)),"USER_AUTH_SUCCESS"===r&&e.emit(e.events.SIGN_IN)}),v.addListener("com.adobe.aam.AAMSIGNOUTStatus",function(t){e.emit(e.events.SIGN_OUT),e.log.disk("AAM Sign-on State: signOut")}),v.addListener("any.accc.app.UserContextData",function(t){var r=E.get(O.getUserId(),"USER_ANALYTICS_ENABLED")||!1;if(!t)return e.log.error(new g(E.analytics.PARSE_MSG_FAIL,"Fail to receive user analytics message on sign in")),void S.enable(r);A.parseString(t,function(t,n){if(t||!n)return e.log.error(new g(E.analytics.PARSE_MSG_FAIL,"Fail to parse user analytics flag on update, err=".concat(t))),void S.enable(r);if(n.response&&n.response.error)return e.log.error(new g(E.analytics.PARSE_MSG_FAIL,"Error in user analytics flag on update, err=".concat(JSON.stringify(n.response.error)))),void S.enable(r);var a=n["feature-response"]&&n["feature-response"]["feature-entry"]&&n["feature-response"]["feature-entry"].find(function(e,t){return"com.adobe.oobe.acc.v1.piip.user.status"===e.$.id});if(a&&a.$){e.log.disk("GetUserAnalyticsFlag - Successfully updated user analytics enabled flag: ".concat(a.$.state));var s="OptedIn"===a.$.state;return S.enable(s),void E.set(O.getUserId(),s,"USER_ANALYTICS_ENABLED")}return e.log.error(new g(E.analytics.PARSE_MSG_FAIL,"Fail to parse userAnalyticsStatus, userAnalyticsStatus=".concat(a))),void S.enable(r)})}),v.addListener("any.accc.app.ProxySettingsChanged",function(t){var r=e.getMessageValue(t,"proxyuser"),n=e.getMessageValue(t,"proxypassword");null!==r&&null!==n&&e.emit(e.events.PROXY_SETTINGS_CHANGED,r,n)}),v.addListener("any.accc.app.ProductDeploymentEvent",function(t){var n={productCode:e.getMessageValue(t,"productCode"),productVersion:e.getMessageValue(t,"productVersion"),productLanguage:e.getMessageValue(t,"productLanguage"),countryCode:e.getMessageValue(t,"countryCode"),productID:e.getMessageValue(t,"productID")};if(n.productCode=n.productCode?e.normalizeProductCode(n.productCode):"",E.get("PRODUCT_LIST").includes(n.productCode))switch(e.getMessageValue(t,"eventType")){case"Install":case"Install-Start":case"Install-Progress":e.emit(e.events.INSTALL_APPLICATION,n);break;case"Uninstall":e.emit(e.events.UNINSTALL_APPLICATION,n);break;case"Update":case"Update-Start":case"Update-Progress":e.emit(e.events.UPDATE_APPLICATION,n);break;case"UpdateComponents":0!==r.listenerCount(e.events.UPDATE_APPLICATION_COMPONENTS)&&e.emit(e.events.UPDATE_APPLICATION_COMPONENTS,n)}}),v.addListener(E.get("NOTIFICATION_PSDK_RESPONSE"),function(t){e.handleNotificationResponse(t,E.get("ANS_PSDK_NOTIFICATION_TYPE"),E.get("NOTIFICATION_PSDK_QUERY_DATA_BY_ID_RESPONSE"))}),v.addListener(E.get("NOTIFICATION_STOCK_RESPONSE"),function(t){e.handleNotificationResponse(t,E.get("ANS_STOCK_NOTIFICATION_TYPE"),E.get("NOTIFICATION_STOCK_QUERY_DATA_BY_ID_RESPONSE"))}),v.addListener(E.get("NOTIFICATION_FORCE_REFRESH_RESPONSE"),function(t){e.handleNotificationResponse(t,E.get("ANS_FORCE_REFRESH_NOTIFICATION_TYPE"),E.get("ANS_FORCE_REFRESH_NOTIFICATION_SUB_TYPE"))}),v.addListener(E.get("NOTIFICATION_FORCE_REFRESH_RESPONSE"),function(t){e.handleNotificationResponse(t,E.get("ANS_NUJ_REFRESH_NOTIFICATION_TYPE"),E.get("ANS_NUJ_REFRESH_NOTIFICATION_SUB_TYPE"))})}},{key:"_handlePayload",value:function(e,t){var r=this,n={};A.parseString(e,function(e,a){if(e)r.log.error(new g(e,"Fail to parse message"));else{var s=a["notification-error"];if(s){var o=s.error&&s.error[0],i=o&&o.$&&o.$.desc||"Unknown notification error";r.log.disk(i)}else{var c,u=a&&a.notifications&&a.notifications.notification||[];r.log.disk("Received ".concat(u.length," ANS notifications.")),u.forEach(function(e){var a=e.type[0],s=e["sub-type"][0],o=parseInt(e.timestamp[0],10),i=e.payload;(!t||o>t)&&(c=!c||o>c?o:c,function(e,t,a){if(e===E.get("ANS_PSDK_NOTIFICATION_TYPE")&&t===E.get("ANS_PSDK_NOTIFICATION_SUB_TYPE")){var s;r.log.disk("Handle ANS message: type=".concat(e,", subtype=").concat(t,", payload=").concat(a));try{s=a&&JSON.parse(a)}catch(e){return r.log.error(new g(E.analytics.PAYLOAD_PARSE_FAIL,"Fail to parse payload: ".concat(a)))}switch(s&&s.eventType){case"HVA_COMMUNICATION":case"HVA_COMPLETED":case"SEGMENT_CHANGE":case"EXPERIENCE_CHANGE":case"APS_COMMUNICATION":case"APPLAUNCH_BUCKET_CHANGE":case"PERSONA_SEGMENT_CHANGE":case"ENTITLEMENT_CHANGE":case"ENGAGEMENT_CLICK_EVENT":n.profileUpdated=!0;break;case"MEMBERSHIP_CHANGE":n.subscriptionStatusChanged=!0}}else if(e===E.get("ANS_STOCK_NOTIFICATION_TYPE")&&t===E.get("ANS_STOCK_NOTIFICATION_SUB_TYPE"))n.updateStock=!0;else if(e===E.get("ANS_FORCE_REFRESH_NOTIFICATION_TYPE")&&t===E.get("ANS_FORCE_REFRESH_NOTIFICATION_SUB_TYPE"))try{n[r.events.FORCE_REFRESH]=JSON.parse(a).payload}catch(n){r.log.error(new g(E.analytics.UNEXPECTED_ANS_MSG,"Unable to parse ANS message payload, type=".concat(e,", subType=").concat(t,", payload=").concat(a)))}else if(e===E.get("ANS_NUJ_REFRESH_NOTIFICATION_TYPE")&&t===E.get("ANS_NUJ_REFRESH_NOTIFICATION_SUB_TYPE"))try{n[r.events.FORCE_REFRESH]=JSON.parse(a[0])}catch(n){r.log.error(new g(E.analytics.UNEXPECTED_ANS_MSG,"Unable to parse ANS message payload, type=".concat(e,", subType=").concat(t,", payload=").concat(a)))}}(a,s,i))}),Object.keys(n).forEach(function(e){r.emit(e,c||(new Date).getTime(),n[e]||null)})}}})}},{key:"_queryANSNotificationsByTime",value:function(e,t,r){var n,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,s=h.v4(),o=function e(a){clearTimeout(n),v.removeListener(t,e),r(null,a)};v.addListener(t,o);var i={"{{TIME_STAMP}}":(new Date).getTime(),"{{NOTIFICATION_TYPE}}":e,"{{NOTIFICATION_COUNT}}":"10","{{uuid}}":s,"{{requestor-namespace}}":t};a&&(i["{{NOTIFNOTIFICATION_SUB_TYPE}}"]=a),v.sendMessage(E.get("NOTIFICATION_REQUEST"),this.constructMessage('<?xml version="1.0" encoding="utf-8"?><NEMessage action="GetDataByTime"><timestamp>{{TIME_STAMP}}</timestamp><type>{{NOTIFICATION_TYPE}}</type><notifications-count-limit>{{NOTIFICATION_COUNT}}</notifications-count-limit><request-context>{{uuid}}</request-context><requestor-namespace>{{requestor-namespace}}</requestor-namespace></NEMessage>',i),"ADCS",""),n=setTimeout(function(){v.removeListener(t,o),r(new Error("GetNotificationDataByTime timeout"))},E.get("GET_NOTIFICATION_DATA_TIMEOUT"))}},{key:"_getUserAnalyticsEnabledFlag",value:function(){var e=this;return new Promise(function(t){var r,n,a=E.get(O.getUserId(),"USER_ANALYTICS_ENABLED")||!1,s=function s(o){if(v.removeListener("adbproduct.app.UserContextDataResponse",s),clearTimeout(r),!o)return e.log.error(new g(E.analytics.PARSE_MSG_FAIL,"Fail to receive user analytics message on sign in.")),void t({enabled:a});A.parseString(o,function(r,s){if(r||!s)return e.log.error(new g(E.analytics.PARSE_MSG_FAIL,"Fail to receive user analytics flag on sign in, err=".concat(r))),void t({enabled:a});if(s.response&&s.response.error){var o=s.response.error;return o[0]&&"SignInPending"===o[0].$.id?(e.log.disk("User sign in pending. Analytics flag not received yet."),void t({enabled:a})):(e.log.error(new g(E.analytics.PARSE_MSG_FAIL,"Fail to parse user analytics flag on sign in, err=".concat(JSON.stringify(s.response.error)))),void t({enabled:a}))}var i=s.response&&s.response.UserfeatureXML&&s.response.UserfeatureXML[0];A.parseString(i,function(r,s){if(r||!s)return e.log.error(new g(E.analytics.PARSE_MSG_FAIL,"Fail to parse UserfeatureXML, err=".concat(r))),void t({enabled:a});if((n=s["feature-response"]&&s["feature-response"]["feature-entry"]&&s["feature-response"]["feature-entry"].find(function(e,t){return e&&e.$&&"com.adobe.oobe.acc.v1.piip.user.status"===e.$.id}))&&n.$){e.log.disk("GetUserAnalyticsFlag - Successfully obtained user analytics enabled flag: ".concat(n.$.state));var o="OptedIn"===n.$.state;return t({enabled:o}),void E.set(O.getUserId(),o,"USER_ANALYTICS_ENABLED")}return e.log.error(new g(E.analytics.PARSE_MSG_FAIL,"Fail to parse userAnalyticsStatus, userAnalyticsStatus=".concat(n))),void t({enabled:a})})})};v.addListener("adbproduct.app.UserContextDataResponse",s),v.sendMessage("accc.app.UserContextDataRequest",e.constructMessage('<?xml version= "1.0" encoding= "utf-8"?><request><request-id>{{uuid}}</request-id></request>',{"{{uuid}}":h.v4()}),"ADCS",""),r=setTimeout(function(){v.removeListener("adbproduct.app.UserContextDataResponse",s),e.log.disk("GetUserAnalyticsFlag - Error: timed out getting user analytics enabled flag"),t({enabled:a})},E.get("USER_ANALYTICS__REQUEST_TIMEOUT"))})}},{key:"_getProxyCredentials",value:function(){var e=this;return new Promise(function(t){var r,n=function n(a){v.removeListener("accc.app.ProxySettingsResponse",n),clearTimeout(r);var s=e.getMessageValue(a,"proxyuser"),o=e.getMessageValue(a,"proxypassword");e.log.disk("GetProxySettings - Successfully obtained username/password"),t({user:s,password:o})};v.addListener("accc.app.ProxySettingsResponse",n),v.sendMessage("accc.app.ProxySettingsRequest",e.constructMessage('<?xml version="1.0" encoding="utf-8"?><request><type>accc.app.ProxySettingsRequest</type><request_id>{{uuid}}</request_id></request>',{"{{uuid}}":h.v4()}),"ADCS",""),r=setTimeout(function(){v.removeListener("accc.app.ProxySettingsResponse",n),e.log.disk("GetProxySettings - Error: timed out getting proxy settings"),t({})},E.get("PROXY_REQUEST_TIMEOUT"))})}},{key:"_registerANSNotifications",value:function(){var e=this;[{"{{NOTIFICATION_TYPE}}":E.get("ANS_PSDK_NOTIFICATION_TYPE"),"{{NOTIFICATION_SUB_TYPE}}":E.get("ANS_PSDK_NOTIFICATION_SUB_TYPE"),"{{observer-namespace}}":E.get("NOTIFICATION_PSDK_RESPONSE")},{"{{NOTIFICATION_TYPE}}":E.get("ANS_STOCK_NOTIFICATION_TYPE"),"{{NOTIFICATION_SUB_TYPE}}":E.get("ANS_STOCK_NOTIFICATION_SUB_TYPE"),"{{observer-namespace}}":E.get("NOTIFICATION_STOCK_RESPONSE")},{"{{NOTIFICATION_TYPE}}":E.get("ANS_FORCE_REFRESH_NOTIFICATION_TYPE"),"{{NOTIFICATION_SUB_TYPE}}":E.get("ANS_FORCE_REFRESH_NOTIFICATION_SUB_TYPE"),"{{observer-namespace}}":E.get("NOTIFICATION_FORCE_REFRESH_RESPONSE")},{"{{NOTIFICATION_TYPE}}":E.get("ANS_NUJ_REFRESH_NOTIFICATION_TYPE"),"{{NOTIFICATION_SUB_TYPE}}":E.get("ANS_NUJ_REFRESH_NOTIFICATION_SUB_TYPE"),"{{observer-namespace}}":E.get("NOTIFICATION_FORCE_REFRESH_RESPONSE")}].forEach(function(t){v.sendMessage(E.get("NOTIFICATION_REQUEST"),e.constructMessage('<?xml version="1.0" encoding="utf-8"?><NEMessage action="RegisterObserver"><type>{{NOTIFICATION_TYPE}}</type><sub-type>{{NOTIFICATION_SUB_TYPE}}</sub-type><observer-namespace>{{observer-namespace}}</observer-namespace></NEMessage>',t),"ADCS","")})}},{key:"getNotificationDataByIDs",value:function(e,t,r,n){var a=this;if(0!==Object.keys(e).length){var s,o=h.v4(),i=function e(t){v.removeListener(r,e),clearTimeout(s),n(null,t)};v.addListener(r,i);var c="";Object.keys(e).forEach(function(e){c+="<notification-id>".concat(e,"</notification-id>")});var u={"{{NOTIFICATION_TYPE}}":t,"{{NOTIFICATION_IDS}}":c,"{{uuid}}":o,"{{requestor-namespace}}":r};v.sendMessage(E.get("NOTIFICATION_REQUEST"),this.constructMessage('<?xml version="1.0" encoding="utf-8"?><NEMessage action="GetDataByID"><notification-ids>{{NOTIFICATION_IDS}}</notification-ids><request-context>{{uuid}}</request-context><requestor-namespace>{{requestor-namespace}}</requestor-namespace></NEMessage>',u),"ADCS",""),s=setTimeout(function(){v.removeListener(r,i);var e=new g(E.analytics.GET_NOTIFICATION_DATA,"GetNotificationDataByID - Error: timed out getting notification data");a.log.error(e),n(e)},E.get("GET_NOTIFICATION_DATA_TIMEOUT"))}else n(new Error("No notification id"))}},{key:"handleNotificationResponse",value:function(e,t,r){var n=this,a={};A.parseString(e,function(s,o){if(s)n.log.error(new g(E.analytics.PARSE_MSG_FAIL,"Fail to parse message, message=".concat(e)));else{var i=o&&o["notifications-signal"],c=i&&i["notification-signal"];(c&&c[0]&&c[0]["notification-info"]||[]).forEach(function(e){var t=e&&e["notification-ids"]&&e["notification-ids"][0];(t&&t["notification-id"]||[]).forEach(function(e){a[e]=!0})}),n.getNotificationDataByIDs(a,t,r,function(e,t){e?n.log.disk(e):n.handlePayload(t)})}})}},{key:"checkForMissedNotifications",value:function(e,t,r){var n=this;[{type:E.get("ANS_PSDK_NOTIFICATION_TYPE"),requestNamespace:E.get("NOTIFICATION_PSDK_QUERY_DATA_BY_TIME_RESPONSE"),lastTimeOfNotification:e},{type:E.get("ANS_STOCK_NOTIFICATION_TYPE"),requestNamespace:E.get("NOTIFICATION_STOCK_QUERY_DATA_BY_TIME_RESPONSE"),lastTimeOfNotification:t},{type:E.get("ANS_FORCE_REFRESH_NOTIFICATION_TYPE"),subtype:E.get("ANS_FORCE_REFRESH_NOTIFICATION_SUB_TYPE"),requestNamespace:E.get("NOTIFICATION_FORCE_REFRESH_QUERY_DATA_BY_TIME_RESPONSE"),lastTimeOfNotification:r},{type:E.get("ANS_NUJ_REFRESH_NOTIFICATION_TYPE"),subtype:E.get("ANS_NUJ_REFRESH_NOTIFICATION_SUB_TYPE"),requestNamespace:E.get("NOTIFICATION_FORCE_REFRESH_QUERY_DATA_BY_TIME_RESPONSE"),lastTimeOfNotification:r}].forEach(function(e){var t=e.lastTimeOfNotification;n.queryANSNotificationsByTime(e,function(e,r){e?n.log.disk(e):n.handlePayload(r,t)})})}},{key:"queryANSNotificationsByTime",value:function(e,t){this._queryANSNotificationsByTime(e.type,e.requestNamespace,t,e.subtype)}}]),r}(y));I.setMaxListeners(20),t.default=I},function(e,t){e.exports=require("os")},function(e,t){e.exports=require("@babel/runtime/helpers/toConsumableArray")},function(e,t){e.exports=require("url")},function(e,t){e.exports=require("events")},function(e,t,r){"use strict";var n=r(2),a=r.n(n),s=r(7),o=r.n(s),i=r(8),c=r.n(i),u=r(9),l=r.n(u),d=r(15),f=r.n(d),p=r(16),h=r.n(p),_=r(6),v=r.n(_),E=r(4),y=r.n(E),m=r(0),g=r.n(m),S=r(22),O=r(27),T=r(29),A=r(3),I=r(5),R=r(1);function C(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=v()(e);if(t){var a=v()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return h()(this,r)}}var k=new S.default({prefix:"Proxy > ",payload:{"event.subcategory":R.default.analytics.sc_Network}}),x=r(39),b=r(55),N=r(39).globalAgent,D={},w=r(56)(function(e,t){k.disk(t)}),L={getRootCA:T.promisify(w.getRootCA),resolve:T.promisify(w.resolve),getOSLocale:T.promisify(w.getOSLocale)},P=function(e){f()(n,e);var t=C(n);function n(){var e;return o()(this,n),e=t.call(this),y()(l()(e),"_lastCredentials",new Map),y()(l()(e),"_ca",void 0),y()(l()(e),"proxyUser",void 0),y()(l()(e),"proxyPassword",void 0),y()(l()(e),"proxyResolver",{getRootCA:T.promisify(w.getRootCA),resolve:T.promisify(w.resolve),getOSLocale:T.promisify(w.getOSLocale)}),y()(l()(e),"getOSLocale",A.default.memoize(L.getOSLocale,{timeout:-1})),y()(l()(e),"getNodeTunnelOptionsForURL",A.default.memoize(e._getNodeTunnelOptionsForURL,{destructor:function(e,t){var r=t.value.agent;return!(!r||!r.isAvailable||0!==Object.values(r.sockets).map(function(e){return e.length}).reduce(function(e,t){},0))&&(r.destroy(),r.isAvailable=!1,!0)}})),y()(l()(e),"init",A.default.memoize(a()(g.a.mark(function t(){var n,a,s,o;return g.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return w.setAuthenticationCallback(function(t,r){var n=e._lastCredentials.get(t.proxy.host+t.proxy.port)||{};if(n.username===e.proxyUser&&n.password===e.proxyPassword)r(new I.default("No new credentials for ".concat(t.proxy.host,":").concat(t.proxy.port),void 0,"PROXY"));else if(e.proxyUser){var a;n.username=e.proxyUser,n.password=e.proxyPassword,r(null,n),e._lastCredentials.set((null==t?void 0:null===(a=t.proxy)||void 0===a?void 0:a.host)+t.proxy.port,n)}else{r(new I.default("No credentials present for ".concat(t.proxy.host,":").concat(t.proxy.port),void 0,"PROXY"))}}),w.on("change",function(){k.disk("System proxy settings changed"),e.getNodeTunnelOptionsForURL.cache.clear(),e.emit("change",!0)}),t.next=4,e.proxyResolver.getRootCA().catch(function(e){k.error(e,"Error getting Root CA")});case 4:return e._ca=t.sent,N.options.ca=e._ca,n=r(23).default,t.next=9,n.getProxyCredentials();case 9:a=t.sent,s=a.user,o=a.password,e.setProxyCredentials(s,o);case 13:case"end":return t.stop()}},t)})),{timeout:-1})),e}return c()(n,[{key:"_getNodeTunnelOptionsForURL",value:function(){var e=a()(g.a.mark(function e(t){var r,n,a,s,o,i,c;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,L.resolve(t).catch(function(e){k.error(e,"Error getting proxy settings")});case 2:if(n=(n=e.sent)&&n[0],a=n&&n.agentClass||(t.startsWith("https")?x.Agent:b.Agent),s=n&&n.agentOptions||{},o={},s.ca=this._ca,s.keepAlive=!0,s.keepAliveMsecs=1e3,s.maxFreeSockets=5,i=s.proxy?s.proxy.host+s.proxy.port:t.startsWith("https")?"https":"http",D[i]=null!==(r=D[i])&&void 0!==r&&r.isAvailable?D[i]:new a(s),D[i].isAvailable=!0,o.agent=D[i],!n.agent){e.next=23;break}return e.next=18,this.init();case 18:c="".concat(n.hostname,":").concat(n.port).concat(this.proxyUser?" with":" without"," authentication"),k.disk("Setting proxy for ".concat(t,": ").concat(c)),o.details=c,e.next=25;break;case 23:k.disk("No proxy (direct connection) for ".concat(t)),o.details="No Proxy";case 25:return e.abrupt("return",o);case 26:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"setProxyCredentials",value:function(e,t){this.proxyUser===e&&this.proxyPassword===t||(k.disk("Setting proxy username and password"),this.proxyUser=e,this.proxyPassword=t,this.getNodeTunnelOptionsForURL.cache.clear(),this.emit("change",!1))}},{key:"getProxyCredentials",value:function(){return{user:this.proxyUser,password:this.proxyPassword}}},{key:"clearCache",value:function(){this.getNodeTunnelOptionsForURL.cache&&this.getNodeTunnelOptionsForURL.cache.clear(),this.proxyUser=void 0,this.proxyPassword=void 0,this._lastCredentials.clear()}}]),n}(O.EventEmitter);t.a=new P},function(e,t){e.exports=require("util")},function(e,t){e.exports=require("@ccx/node-reachability")},function(e,t,r){"use strict";r.d(t,"a",function(){return u});var n=r(7),a=r.n(n),s=r(8),o=r.n(s),i=r(26),c=r(3).default,u=function(){function e(){a()(this,e)}return o()(e,null,[{key:"stripPathFromURL",value:function(e){if("string"==typeof e){var t=i.parse(e);if(t.protocol&&t.host)return"".concat(t.protocol,"//").concat(t.host)}}},{key:"getRetryAfterHeader",value:function(e){if(e){var t=e.get("retry-after");if(t)try{var r=parseInt(t,10);if(r)return Math.max(0,r);var n=new Date(t);if(!isNaN(n)){var a=(new Date).valueOf(),s=Math.max(0,n-a),o=c.getRandomizedTime();return Math.round((s+o)/1e3)}}catch(e){}}return 0}},{key:"getExpiry",value:function(e){var t=e.get("expiry")?new Date(e.get("expiry")||""):void 0,r=e.get("cache-control");if(r&&"string"==typeof r&&r.includes("max-age=")){var n=parseInt(r.split("max-age=")[1].trim(),10);isNaN(n)||(t=new Date).setSeconds(n)}if(t&&!isNaN(t))return t.toISOString()}},{key:"getContentTypeHeader",value:function(e){if(e){var t=e.get("content-type");if(t&&"string"==typeof t){var r=t.indexOf(";");return r>0&&(t=t.substring(0,r)),t}}}}]),e}()},function(e,t){e.exports=require("@babel/runtime/helpers/construct")},function(e,t){e.exports=require("xml2js")},function(e,t){e.exports=require("@ccx/parallel-fetch")},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("dns")},function(e){e.exports={name:"ccx-welcome-process",version:"4.14.2",private:!0,description:"CCXProcess",dependencies:{"@babel/runtime":"^7.14.6","@ccx/node-ProxyResolver":"git+ssh://git@git.corp.adobe.com:ProjectCentral/node-ProxyResolver.git#v2.3.2","@ccx/node-aid":"git+ssh://git@git.corp.adobe.com:CCX/node-aid.git#v0.0.11","@ccx/node-ngl":"git+ssh://git@git.corp.adobe.com:ProjectCentral/node-ngl.git#v1.31.0","@ccx/parallel-fetch":"0.0.31","@ccx/node-reachability":"git+ssh://git@git.corp.adobe.com:CCX/node-reachability.git#v1.3.5",decompress:"^4.2.1","fs-ext":"2.0.0","fs-extra":"10.0.0",ingest:"git+ssh://git@git.corp.adobe.com:CCX/Ingest.git#v4.3.0",jsonschema:"1.4.0",mime:"2.5.2",mkdirp:"^1.0.4","node-vulcanjs":"git+ssh://git@git.corp.adobe.com:slade/VulcanJS.git#v2.1.0","simple-plist":"^1.1.1",uuid:"8.3.2",winreg:"^1.2.4",xml2js:"0.4.23"},devDependencies:{"7zip":"0.0.6","@adobe/tessa-npm-plugin":"1.2.1","@babel/cli":"^7.14.5","@babel/core":"^7.14.6","@babel/plugin-proposal-class-properties":"^7.14.5","@babel/plugin-proposal-object-rest-spread":"^7.14.7","@babel/plugin-transform-runtime":"^7.14.5","@babel/preset-env":"^7.14.7","@babel/preset-typescript":"^ 7.14.5","@ccx/hyperdrive-builder":"git+ssh://git@git.corp.adobe.com:CCX/hyperdrive-builder.git#5.0.10","@types/core-js":"^2.5.0","@types/decompress":"^4.2.3","@types/es6-promise":"^3.3.0","@types/fs-ext":"0.0.29","@types/fs-extra":"5.0.4","@types/glob":"^7.1.1","@types/jest":"23.3.7","@types/mime":"^2.0.0","@types/mustache":"^4.0.1","@types/nock":"^9.3.0","@types/node":"^10.12.0","@types/uuid":"^3.4.4","@types/webpack":"^4.4.17","@types/winreg":"^1.2.4","@types/xml2js":"0.4.3","babel-loader":"^8.2.2",glob:"7.1.3",husky:"1.1.2",jest:"23.6.0","jest-date-mock":"1.0.5","jest-extended":"0.11.0",jsftp:"2.1.3",matchdep:"2.0.0",mockery:"2.1.0",mustache:"^4.0.1",nock:"10.0.1","node-gyp":"^7.1.0","node-uglifier":"0.5.41",prettier:"2.0.5","pretty-quick":"1.8.0","terser-webpack-plugin":"1.1.0","ts-jest":"23.10.4","ts-loader":"5.2.2","ts-node":"7.0.1","ts-node-dev":"^1.0.0-pre.30",typescript:"3.8",webpack:"4.23.0","webpack-node-externals":"1.7.2"},prettier:{tabWidth:4,useTabs:!1,singleQuote:!0,trailingComma:"all",printWidth:120,arrowParens:"avoid",endOfLine:"auto"},engines:{node:">=16.13.2"},scripts:{test:"jest",coverage:"jest --coverage",updateBuildCoverageComment:"ts-node packaging/updateCoverage",main:"ts-node-dev --no-deps --files main --debug",tessa:"tessa-npm-plugin update --yarn","tessa-plugin-pr":"tessa-npm-plugin check --errorOnNewVulnerability --yarn",kill:'pkill -f ".*CCXProcess.app/Contents/MacOS/../js/main.js$"',killWin:'cmd /C taskkill /f /im "CCXProcess.exe" /t',build:"ts-node --files packaging/build.ts compile","build:arm":"ts-node --files packaging/build.ts compile arm","build:mac-arm":"ts-node --files packaging/build.ts compile mac-arm",package:"ts-node --files packaging/build.ts hyperdrive","package:arm":"ts-node --files packaging/build.ts hyperdrive arm","package:mac-arm":"ts-node --files packaging/build.ts hyperdrive mac-arm",jira:"node packaging/jiraRestApi",preinstall:"node packaging/credentials",start:"node -p \"if (process.platform == 'darwin') { try { require('child_process').execSync('yarn run kill')} catch(err) {}} else { try { require('child_process').exec('yarn run killWin')} catch (err) {}} require('child_process').execSync('yarn run main', {stdio: [0,1,2]})\"",postinstall:"node packaging/fixDepsMac",installNoDepCopy:"NO_DEP_COPY=true yarn install",addTessaLibrary:"node packaging/addTessaLib"},cepPanels:[{NOTE:"REMOVING START 2.7 from the CCXPROCESS WILL CAUSE LEARN TAB TO GO MISSING IN FRESH INSTALLS OF CC 2019 APPS. ALSO DISABLE YBR NON 2.5 COMPATIBLE CAMPAIGNS BEFORE THIS, Locking 2.7.2-15 version",product:"CCX Start",subproduct:"Extension",version:"2.7.2",build:"2.7.2-15",certification:"Not Tested",destination:"com.adobe.ccx.start-2.7.2",name:"com.adobe.ccx.start"},{product:"CCX Start",subproduct:"Extension",version:"2.16.0",certification:"Not Tested",destination:"com.adobe.ccx.start-2.16.0",name:"com.adobe.ccx.start"},{product:"CCX Start",subproduct:"CmdN",version:"3.5.0",certification:"Not Tested",destination:"com.adobe.ccx.fnft-3.5.0",name:"com.adobe.ccx.fnft"}],"UNINSTALLATION INSTRUCTIONS":{STEPS:"NAME THE KEY uninstall to uninstall extensions. The contents of the key add  an array objects each with a destination folder name and isCEP which is true if this is a CEP extension and false if this is a UXP extension.",SAMPLE:{uninstall:[{COMMENT:"The provided destination folder(com.adobe.ccx.start-2.6.1) in the CEP or UXP (CEP in this case) extension is deleted",destination:"com.adobe.ccx.start-2.6.1",isCEP:!0}]}},"uninstall-example":[{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.3.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.3.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.5.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.5.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.5.1) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.5.1",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.6.1) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.6.1",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.7.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.7.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.7.2) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.7.2",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.7.4) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.7.4",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.8.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.8.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.9.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.9.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.10.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.10.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.11.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.11.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.12.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.12.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.13.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.13.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.14.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.14.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2019) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2019",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-3.1.0) in UXP extensions is deleted",destination:"com.adobe.ccx.start-3.1.0",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.start-3.2.0) in UXP extensions is deleted",destination:"com.adobe.ccx.start-3.2.0",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.start-3.3.0) in UXP extensions is deleted",destination:"com.adobe.ccx.start-3.3.0",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.start-3.4.0) in UXP extensions is deleted",destination:"com.adobe.ccx.start-3.4.0",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.start-3.5.0) in UXP extensions is deleted",destination:"com.adobe.ccx.start-3.5.0",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.start-3.6.0) in UXP extensions is deleted",destination:"com.adobe.ccx.start-3.6.0",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.start-3.7.0) in UXP extensions is deleted",destination:"com.adobe.ccx.start-3.7.0",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.start.uxp-2019) in UXP extensions is deleted",destination:"com.adobe.ccx.start.uxp-2019",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-2.5.0) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-2.5.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-2.5.1) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-2.5.1",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-2.6.0) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-2.6.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-3.0.0) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-3.0.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-3.1.0) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-3.1.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-3.2.0) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-3.2.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-3.3.0) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-3.3.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-3.4.0) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-3.4.0",isCEP:!0}],uxpPanels:[{product:"CCX Start",subproduct:"HomeScreenUXP",version:"6.5.0",certification:"Golden Master",destination:"com.adobe.ccx.start-6.5.0",name:"com.adobe.ccx.start.{{build}}"}],thor:[{product:"ACCC",subproduct:"Application",version:"5.9.0",certification:"Release Candidate",name:"ACCCx5_9_0_{{build}}",volume:"Creative Cloud",build:"^\\d+$"},{product:"ACCC",subproduct:"HDSetup",version:"5.9.0",certification:"Release Candidate",name:"HDSetup",volume:"Release"}],AdobePIM:{product:"ACCC",subproduct:"AdobePIM",version:"5.9.0",certification:"Release Candidate",name:"AdobePIM",volume:"Release",platform:"winarm64",extension:"zip"},resolutions:{xml2js:"0.4.23","node-fetch":"3.0.0-beta.7"},husky:{hooks:{"pre-commit":"pretty-quick --staged"}}}},function(e,t){e.exports=require("node-vulcanjs")},function(e,t){e.exports=require("https")},function(e,t){e.exports=require("jsonschema")},function(e,t){e.exports=require("child_process")},function(e,t){e.exports=require("@babel/runtime/helpers/wrapNativeSuper")},function(e,t){e.exports=require("@babel/runtime/helpers/slicedToArray")},function(e,t){e.exports=require("fs-ext")},function(e,t){e.exports=require("decompress")},function(e,t){e.exports=require("@babel/runtime/helpers/typeof")},function(e,t){e.exports=require("mime")},function(e,t){e.exports=require("abort-controller")},function(e,t){e.exports=require("simple-plist")},function(e,t,r){e.exports=r(61)},function(e,t){e.exports=require("module")},function(e,t){e.exports=require("v8")},function(e,t){e.exports=require("vm")},function(e,t){e.exports=require("@ccx/node-ngl")},function(e,t){e.exports=require("http")},function(e,t){e.exports=require("@ccx/node-ProxyResolver")},function(e,t){e.exports=require("@ccx/node-aid")},function(e,t){e.exports=require("node-fetch")},function(e,t){e.exports=require("ingest/src/ingest")},function(e,t){e.exports=require("winreg")},function(e,t,r){"use strict";r.r(t);var n=r(25),a=r.n(n),s=r(2),o=r.n(s),i=r(7),c=r.n(i),u=r(8),l=r.n(u),d=r(4),f=r.n(d),p=r(0),h=r.n(p),_=r(1),v=r(3),E=r(22),y=r(38),m=r(20),g=y.createControlAdapter(),S=new(function(){function e(){c()(this,e),f()(this,"log",new E.default({prefix:"HeartbeatProductAnalytics > "}))}return l()(e,[{key:"createOperationalPayload",value:function(e){var t={};return t["event.workflow"]=_.default.analytics.w_INTERNAL,t["event.subcategory"]=_.default.analytics.sc_PULSE,t["event.type"]=_.default.analytics.t_APP,t["event.subtype"]=_.default.analytics.st_RUNNING,t["source.name"]=e.SAPCode,t["source.version"]=e.CodexVersion,t["source.platform"]=v.default.getOsPlatform(),t["source.device"]="Desktop",t["source.os_version"]=v.default.getOsVersion(),t}},{key:"sendPollingEvent",value:function(){var e=this;g.getInstalledApps().filter(function(e){return e.SAPCode&&g.isAppRunning(e.SAPCode)}).forEach(function(t){var r=e.createOperationalPayload(t);e.log.disk("App Running: ".concat(t.SAPCode,":").concat(t.CodexVersion)),m.default.logPollingEvent(r)})}},{key:"startPoll",value:function(){var e=this;setInterval(function(){return e.sendPollingEvent()},_.default.get("ANALYTICS_HEARTBEAT_INTERVAL"))}}]),e}()),O=r(11),T=r(13),A=r(10),I=r(44),R=r(19),C=r(29),k=r(24),x=r(45),b=C.promisify(I.flock),N=function(){function e(){c()(this,e)}return l()(e,null,[{key:"writeJsonAtomic",value:function(){var t=o()(h.a.mark(function t(r,n,a){var s,o,i,c=arguments;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return s=c.length>3&&void 0!==c[3]&&c[3],r.endsWith("/")||(r+="/"),i="".concat(o=r+n,"_").concat(R.v4(),".json"),t.next=6,T.ensureDir(r);case 6:return t.next=8,T.writeJson(i,a,{spaces:2,EOL:k.EOL});case 8:return t.next=10,e.rename(i,o,s);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}},t)}));return function(e,r,n){return t.apply(this,arguments)}}()},{key:"unzip",value:function(){var e=o()(h.a.mark(function e(t,r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",x(t,r));case 1:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"rename",value:function(){var t=o()(h.a.mark(function t(r,n){var a,s,i,c=arguments;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=c.length>2&&void 0!==c[2]&&c[2],s=Date.now(),i=0,t.next=5,T.rename(r,n).catch(function(){var t=o()(h.a.mark(function t(o){return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i<100&&(i+=10),!o||"EACCES"!==o.code&&"EPERM"!==o.code&&"ENOENT"!==o.code||!(Date.now()-s<6e4)){t.next=17;break}return t.next=4,v.default.setTimeoutAsync(i);case 4:if(!a){t.next=8;break}return t.next=7,e.removeOrRename(n);case 7:n=t.sent;case 8:return t.next=10,T.pathExists(n);case 10:if(!t.sent){t.next=12;break}throw o;case 12:return t.next=14,T.rename(r,n).catch(c);case 14:return t.abrupt("return",n);case 17:throw o;case 18:case"end":return t.stop()}},t)}));function c(e){return t.apply(this,arguments)}return c}());case 5:return t.abrupt("return",n);case 6:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"writeAtomic",value:function(){var t=o()(h.a.mark(function t(r){var n,a,s,o,i,c,u,l;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.response,a=r.target,s=r.progress,o=void 0===s?function(){}:s,i=r.renameOnError,c=void 0!==i&&i,u=a+_.default.get("DOWNLOAD_TMP_EXTENSION"),l=v.default.throttle(o,_.default.get("PROGRESS_THROTTLE_INTERVAL")),t.next=5,T.ensureDir(A.dirname(a));case 5:if(!c){t.next=9;break}return t.next=8,e.removeOrRename(u);case 8:u=t.sent;case 9:return n.emitter.on("progress",function(e){l(e.done,e.total,u)}),t.next=12,n.file(u);case 12:return n.emitter.removeAllListeners(),t.next=15,e.rename(u,a,c);case 15:return t.abrupt("return",a);case 16:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()},{key:"removeOrRename",value:function(){var t=o()(h.a.mark(function t(r){var n;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,T.remove(r).catch(function(){});case 2:return t.next=4,T.access(r).then(function(){return!0}).catch(function(e){return"ENOENT"!==e.code});case 4:if(!t.sent){t.next=13;break}if(n=r,(r=e.renameFile(r))!==n){t.next=9;break}return t.abrupt("return",r);case 9:return t.next=11,T.remove(r).catch(function(){});case 11:t.next=2;break;case 13:return t.abrupt("return",r);case 14:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()},{key:"renameFile",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_.default.get("MAX_EPERM_RENAMES"),r=A.extname(e),n=A.basename(e,r),a=n.substr(-3),s=/^\-(\d\d)$/.exec(a),o=s&&s[1]?parseInt(s[1],10):0,i=n.substr(0,n.length-3);return 0===o&&(i=n),++o>t?e:(o<10&&(o="0"+o),A.join(A.dirname(e),i+"-"+o+r))}},{key:"cleanupFolder",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=u.length>1&&void 0!==u[1]?u[1]:{},n=u.length>2&&void 0!==u[2]?u[2]:/^$/,e.next=4,T.ensureDir(t);case 4:return e.next=6,T.readdir(t);case 6:return a=e.sent,s=[],i=[],c=[],a.forEach(function(){var e=o()(h.a.mark(function e(a){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r[a]||n.test(a)?s.push(a):c.push(T.remove(t+a).then(function(){i.push(a)}).catch(function(){s.push(a)}));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=12,v.default.waitAll(c);case 12:return e.abrupt("return",{left:s.sort(),removed:i.sort()});case 13:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"obtainProcessLock",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=_.default.get("ROOT_DIR"),e.next=3,T.ensureDir(r);case 3:return n="".concat(r,".").concat(t),e.next=6,T.open(n,"w");case 6:return a=e.sent,e.next=9,b(a,"exnb");case 9:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"getFileSize",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T.stat(t);case 2:return e.abrupt("return",e.sent.size);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()}]),e}(),D=r(14),w=r(26),L=r(12),P=r(5);function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function U(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var F=r(17).default,V=function(){function e(){c()(this,e)}return l()(e,null,[{key:"getMissingProductList",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.getCachedRequestData(),n=new E.default({prefix:"LookupMapUtils > ".concat(t.type),payload:{"event.subcategory":_.default.get("ANALYTICS_SUBCATEGORY",t.type)}}),a=_.default.get("SUPPORTED_PRODUCTS",t.type),s=[],e.next=6,F.getSpecifiers();case 6:return i=e.sent,e.next=9,Promise.all(Object.keys(i).map(function(){var e=o()(h.a.mark(function e(t){var c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return c=v.default.getProductAlias(t),e.abrupt("return",Promise.all(Object.keys(i[t]).map(function(){var e=o()(h.a.mark(function e(o){var i,u,l,d;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F.getAppLanguage(t,o);case 2:(i=e.sent)&&c&&a[c]&&v.default.compareMajorMinorVersions(a[c],o)>-1&&(u=r[c],l=u&&(u[o]||u["".concat(o,".0")]),d=l&&l.find(function(e){return void 0===e.productLanguage||e.productLanguage===i}),u&&l&&d||(n.disk("App NOT found, Adding : ",c,o,i),s.push({productCode:c,productVersion:o,productLanguage:i})));case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 9:return e.abrupt("return",s);case 10:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"getExcessProductList",value:function(){var e=o()(h.a.mark(function e(t){var r,n,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=[],Object.values(t).forEach(function(e){Object.values(e).forEach(function(e){r.push.apply(r,a()(e))})}),e.next=4,F.getSpecifiers();case 4:return n=e.sent,s=[],e.next=8,Promise.all(Object.keys(n).map(function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=v.default.getProductAlias(t),Object.keys(n[t]).map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r&&t&&s.push({productCode:r,productVersion:t});case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 8:return e.abrupt("return",r.filter(function(e){return!s.find(function(t){return t.productCode===e.productCode&&(t.productVersion===e.productVersion||e.productVersion===t.productVersion+".0")})}));case 9:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"getStockCollectionUrl",value:function(e){var t=e.id,r=e.params,n=e.options,a=e.map,s=_.default.getEnvironment(),o=new w.URL(_.default.get("COLLECTION_URL_".concat(s.LABEL.toUpperCase()),a.type));return r.productCode&&o.searchParams.set("product",r.productCode),r.productLanguage&&o.searchParams.set("locale",r.productLanguage),r.countryCode&&o.searchParams.set("country_code",r.countryCode),o.searchParams.set("search_parameters[offset]",n.offset||"0"),o.searchParams.set("search_parameters[gallery_id]",t),o.searchParams.set("search_parameters[limit]",n.limit||"100"),o.searchParams.set("ff_9909481692","1"),o.searchParams.set("search_parameters[enable_templates]",n.enable_templates||"1"),o.toString()}},{key:"downloadStockCollection",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,y,m,g,S,O,I,R;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.id,n=t.params,a=t.map,s=t.force,i=void 0===s?{type:"none"}:s,c=t.priority,u=t.options,l=void 0===u?{}:u,d=new P.default(_.default.analytics.AGGREGATE_ERROR,"CollectionTemplates"+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),f=0,p=0,y=new E.default({prefix:"LookupMapUtils > ".concat(a.type),payload:{"event.subcategory":_.default.get("ANALYTICS_SUBCATEGORY",a.type)}}),(m=new L.a(c)).channel=L.b.CollectionTemplates,g=this.getStockCollectionUrl({id:r,params:n,options:l,map:a}),e.next=10,a.fetchAsset({href:g,priority:m,force:i,params:n,assetsDir:a.assetsDir,headers:{"X-API-Key":_.default.getEnvironment().CLIENT_ID,"X-Product":"".concat(n.productCode),"Content-Type":"application/json"}}).catch(function(e){return d.addSubError({err:e,url:g}),{time:0,path:void 0}});case 10:if(S=e.sent,f+=S.time,p++,!(O=S.path)){e.next=22;break}return I="".concat(a.getPath(),"/").concat(O),e.next=18,T.readJSON(I).catch(function(e){y.error(new P.default("filesystem",e)),d.addSubError({err:e,id:r,url:O})});case 18:if(R=e.sent,!Array.isArray(null==R?void 0:R.files)){e.next=22;break}return e.next=22,v.default.waitAll(R.files.map(function(){var e=o()(h.a.mark(function e(t){var r,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null==t||!t.thumbnail_url||null==t||null===(r=t.thumbnail_url)||void 0===r||!r.startsWith("http")){e.next=7;break}return e.next=3,a.fetchAsset({href:t.thumbnail_url,priority:m,force:U(U({},i),{},{depth:i.depth-1}),params:n,assetsDir:a.assetsDir}).catch(function(e){return d.addSubError({url:null==t?void 0:t.thumbnail_url,err:e}),{time:0,path:null==t?void 0:t.thumbnail_url}});case 3:s=e.sent,t.thumbnail_url=s.path,f+=s.time,p++;case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())).finally(o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,N.writeJsonAtomic(A.dirname(I)+"/",A.basename(I),R,!0);case 2:if(!(t=e.sent)||t===I){e.next=8;break}return O=A.basename(A.dirname(t))+"/"+A.basename(I),a.cachedAsset(g).path=O,e.next=8,a.save();case 8:case"end":return e.stop()}},e)})));case 22:if(!d.hasSubErrors&&O){e.next=24;break}throw d.assignSubErrors({id:r});case 24:return e.abrupt("return",{path:O,time:f,count:p});case 25:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getTutorialUrl",value:function(e){var t=e.id,r=e.productLanguage,n=void 0===r?"en_US":r,a=e.status,s=void 0===a?"live":a,o=e.productVersion,i=e.surface,c=void 0===i?"in_app_panel:v2":i,u=new w.URL(_.default.getEnvironment().UTUTS_SERVICE);return u.searchParams.set("aem_id",t),u.searchParams.set("locale",n),u.searchParams.set("inline_surface",c),u.searchParams.set("status",s),o&&u.searchParams.set("app_version",o),u.toString()}},{key:"downloadTutorial",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,y,m,g,S,O,I,R,C,k,x,b;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.params,n=t.id,a=t.url,s=t.priority,i=t.force,c=void 0===i?{type:"none"}:i,u=t.analyticsData,l=t.filePrefix,d=t.status,f=void 0===d?"live":d,p=t.map,y=new P.default(_.default.analytics.AGGREGATE_ERROR,"Ututs"+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),m=0,g=0,S=new E.default({prefix:"LookupMapUtils > ".concat(p.type),payload:{"event.subcategory":_.default.get("ANALYTICS_SUBCATEGORY",p.type)}}),O=U(U({},r),{},{filePrefix:l}),(I=new L.a(s)).channel=L.b.Lcm,R=null!=a?a:this.getTutorialUrl({id:n,productLanguage:null==r?void 0:r.productLanguage,status:f,productVersion:null==r?void 0:r.productVersion,surface:_.default.get("UTUTS_API_REQUEST_SURFACE",p.type)}),e.next=11,p.fetchAsset({href:R,analyticsData:u,priority:I,force:c,params:O,assetsDir:p.assetsDir,headers:{"X-API-Key":_.default.getEnvironment().CLIENT_ID}}).catch(function(e){return y.addSubError({err:e,url:R}),{time:0,path:void 0}});case 11:if(C=e.sent,m+=C.time,g++,!(k=C.path)){e.next=28;break}return x="".concat(p.getPath(),"/").concat(k),e.next=19,T.readJSON(x).catch(function(e){S.error(new P.default("filesystem",e)),y.addSubError({err:e,id:n,url:k})});case 19:if(b=e.sent,!Array.isArray(null==b?void 0:b.tutorials)){e.next=25;break}return e.next=23,v.default.waitAll(b.tutorials.map(function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null==t||null===(r=t.metadata)||void 0===r||null===(n=r.images)||void 0===n||!n.hero){e.next=7;break}return e.next=3,p.fetchAsset({href:t.metadata.images.hero,analyticsData:u,priority:I,force:U(U({},c),{},{depth:c.depth-1}),params:O,assetsDir:p.assetsDir}).catch(function(e){var r,n;return y.addSubError({url:null==t?void 0:null===(r=t.metadata)||void 0===r?void 0:null===(n=r.images)||void 0===n?void 0:n.hero,err:e}),{time:0,path:void 0}});case 3:o=e.sent,t.metadata.images.heroPath=o.path,m+=o.time,g++;case 7:if(null==t||null===(a=t.metadata)||void 0===a||null===(s=a.images)||void 0===s||!s.thumbnail){e.next=14;break}return e.next=10,p.fetchAsset({href:t.metadata.images.thumbnail,analyticsData:u,priority:I,force:U(U({},c),{},{depth:c.depth-1}),params:O,assetsDir:p.assetsDir}).catch(function(e){var r,n;return y.addSubError({err:e,url:null==t?void 0:null===(r=t.metadata)||void 0===r?void 0:null===(n=r.images)||void 0===n?void 0:n.thumbnail}),{time:0,path:void 0}});case 10:i=e.sent,t.metadata.images.thumbnailPath=i.path,m+=i.time,g++;case 14:return e.next=16,N.writeJsonAtomic(A.dirname(x)+"/",A.basename(x),b,!0);case 16:if(!(l=e.sent)||l===x){e.next=22;break}return k=A.basename(A.dirname(l))+"/"+A.basename(x),p.cachedAsset(R).path=k,e.next=22,p.save();case 22:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 23:e.next=28;break;case 25:if(!Array.isArray(null==b?void 0:b.playlists)){e.next=28;break}return e.next=28,v.default.waitAll(null==b?void 0:b.playlists.map(function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null==t||null===(r=t.images)||void 0===r||!r.hero){e.next=7;break}return e.next=3,p.fetchAsset({href:null===(a=t.images)||void 0===a?void 0:a.hero,analyticsData:u,priority:I,force:U(U({},c),{},{depth:c.depth-1}),params:O,assetsDir:p.assetsDir}).catch(function(e){var r;return y.addSubError({url:null==t?void 0:null===(r=t.images)||void 0===r?void 0:r.hero,err:e}),{time:0,path:void 0}});case 3:s=e.sent,t.images.heroPath=s.path,m+=s.time,g++;case 7:if(null==t||null===(n=t.images)||void 0===n||!n.thumbnail){e.next=14;break}return e.next=10,p.fetchAsset({href:null==t?void 0:null===(o=t.images)||void 0===o?void 0:o.thumbnail,analyticsData:u,priority:I,force:U(U({},c),{},{depth:c.depth-1}),params:O,assetsDir:p.assetsDir}).catch(function(e){var r;return y.addSubError({url:null===(r=t.images)||void 0===r?void 0:r.thumbnail,err:e}),{time:0,path:void 0}});case 10:i=e.sent,t.images.thumbnailPath=i.path,m+=i.time,g++;case 14:return e.next=16,N.writeJsonAtomic(A.dirname(x)+"/",A.basename(x),b,!0);case 16:if(!(l=e.sent)||l===x){e.next=22;break}return k=A.basename(A.dirname(l))+"/"+A.basename(x),p.cachedAsset(R).path=k,e.next=22,p.save();case 22:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 28:if(!y.hasSubErrors&&k){e.next=30;break}throw y.assignSubErrors({id:n});case 30:return e.abrupt("return",{path:k,time:m,count:g});case 31:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),e}(),j=r(28),G=r(23),H=r(21),B=r.n(H),Y=r(15),X=r.n(Y),K=r(16),W=r.n(K),q=r(6),J=r.n(q),Q=r(46),z=r.n(Q),Z=r(9),$=r.n(Z),ee=r(18),te=r(47),re=r(31),ne=r(27),ae=r(48),se=r.n(ae),oe=r(34),ie=r.n(oe),ce=r(17);function ue(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return le(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return le(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,i=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){i=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(i)throw s}}}}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function de(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function fe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?de(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):de(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function pe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var he=function(e){X()(r,e);var t=pe(r);function r(e){var n;return c()(this,r),n=t.call(this),f()($()(n),"_data",void 0),f()($()(n),"_apiData",void 0),f()($()(n),"_type",void 0),f()($()(n),"_path",void 0),f()($()(n),"_fileName",void 0),f()($()(n),"_apiFileName",void 0),f()($()(n),"_downloadManager",void 0),f()($()(n),"_diskLock",void 0),f()($()(n),"_syncLock",void 0),f()($()(n),"log",void 0),f()($()(n),"gc",void 0),f()($()(n),"_syncTimeout",void 0),f()($()(n),"fetchOnDemandContent",void 0),f()($()(n),"fetchAsset",void 0),f()($()(n),"_fetchCollectionData",void 0),f()($()(n),"fetchCollectionIndex",void 0),f()($()(n),"_saveInProgress",!1),f()($()(n),"_calledSave",!1),f()($()(n),"logApiRenameError",v.default.throttle(function(){n.log.error(new P.default(_.default.analytics.ACCESSOR_ERROR_TYPE,"Renamed api file: ".concat(n._apiFileName),_.default.analytics.ACCESSOR_READ_RENAME_ERROR_CODE)).appendPayload({"event.subtype":_.default.analytics.st_ACCESSOR,"ccxp.path":n._apiFileName})},_.default.get("FILE_ACCESS_RENAME_THROTTLE"))),f()($()(n),"abortControllers",{}),_.default.patch(e.LABEL,e||{}),n._type=e.LABEL,n._path=A.join(_.default.get("ROOT_DIR"),_.default.get("DIR",n.type)),n._fileName=_.default.get("LOOKUP_MAP_FILE",n.type)||_.default.get("LOOKUP_MAP_FILE"),n._apiFileName=_.default.get("FILE_ACCESS_MAP_FILE"),n._downloadManager=null,n._diskLock=new L.d,n._syncLock=new L.d(9999),n.log=new E.default({prefix:"".concat(_.default.get("LOG_PREFIX",n.type),"LookupMap > "),payload:{"event.subcategory":_.default.get("ANALYTICS_SUBCATEGORY",n.type)}}),n.fetchOnDemandContent=v.default.memoize(v.default.retryLocalErrors(n._fetchOnDemandContent.bind($()(n))),{refresher:function(e){return"pending"!==e.state},resolver:function(e){return n.paramsToOnDemandId(e)},destructor:function(e,t){return"pending"!==t.state}}),n.fetchAsset=v.default.memoize(v.default.retryLocalErrors(n._fetchAsset.bind($()(n))),{refresher:function(e){return"pending"!==e.state},resolver:function(e){return e.key||e.href},wrapper:function(e,t,r){var a=e[0]||{};return a.force&&a.force.type&&r&&["stale","always"].includes(a.force.type)?t.then(function(){return n._fetchAsset(a)}):t},destructor:function(e,t){return"pending"!==t.state}}),n._fetchCollectionData=v.default.memoize(n._fetchCollectionDataRaw,{refresher:function(e){return"pending"!==e.state},resolver:function(e){return n.paramsToId(e.params,!1)},wrapper:function(e,t,r){var a=e[0]||{};return a.force&&a.force.type&&r&&["stale","always"].includes(a.force.type)?t.then(function(){return n._fetchCollectionData(a)}):t},destructor:function(e,t){return"pending"!==t.state}}),n.fetchCollectionIndex=v.default.retryLocalErrors(n.fetchCollectionIndexRaw.bind($()(n))),n.gc=v.default.memoize(n._gc,{refresher:function(e){return"pending"!==e.state},destructor:function(e,t){return"pending"!==t.state}}),n}return l()(r,[{key:"createFAClientDir",value:function(){var e=o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=this.clientDir,T.ensureDir(t).catch(function(e){throw new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,e,_.default.analytics.ACCESSOR_WRITE_ERROR_CREATING_DIR_CODE)});case 2:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"isSyncInProgress",value:function(e){var t=this._fetchCollectionData.cache&&this._fetchCollectionData.cache.get(e);return t&&"pending"===t.state}},{key:"paramsToIdRaw",value:function(e){var t=this._getCollectionInfo(e);if(t&&t.pendingId)return t.pendingId;if(t&&t.latestId){var r=this._data.metadata[t.latestId];if(v.default.getTimeToExpiry(null==r?void 0:r.expiryTime)>0)return t.latestId}}},{key:"paramsToId",value:function(e){var t,r,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=this.paramsToIdRaw(e);if(a)return a;var s=this.generateId(e);return this._addNewCollectionInfo({params:e,isPending:!0,collectionId:s,file:null===(t=this._data)||void 0===t?void 0:null===(r=t.metadata[s])||void 0===r?void 0:r.path}),n?this.save().then(function(){return s}):(this.save(),s)}},{key:"generateId",value:function(e){return[e.filePrefix,e.productCode,e.productVersion,e.productLanguage,R.v4()].filter(function(e){return!!e}).join("-").trim()}},{key:"expireAll",value:function(){var e=o()(h.a.mark(function e(t){var r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._data){e.next=2;break}return e.abrupt("return");case 2:return Object.keys(this._data.metadata).forEach(function(e){t&&t===r._data.metadata[e].userId&&delete r._data.metadata[e].expiryTime}),e.next=5,this.save();case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"forceRefresh",value:function(){var e=o()(h.a.mark(function e(t){var r,n,s=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=a()(Object.values(t)),n=this.getIdsByKeys(r),e.next=4,Promise.all(n.map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.expireOne(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getIdsByKeys",value:function(e){var t=[],r=e.reduce(function(e,r){return e[r]?e[r]:(t.push(r),e)},this._data.versionInfo[O.default.getUserId()]),n=[];if(r.lastUsedId&&n.push(r.lastUsedId),r.pendingId&&n.push(r.pendingId),r.lastDisplayedId&&n.push(r.lastDisplayedId),r.latestId&&n.push(r.latestId),n.length>0)return n;var a=new Set;return function e(r){var s=!1;r.lastUsedId&&(n.push(r.lastUsedId),s=!0),r.pendingId&&(n.push(r.pendingId),s=!0),r.lastDisplayedId&&(n.push(r.lastDisplayedId),s=!0),r.latestId&&(n.push(r.latestId),s=!0);var o=Object.keys(r).some(function(e){return"object"===z()(r[e])});if(!s&&o){var i=Object.keys(r),c=t.find(function(e){return!!r[e]});c?(a.add(c),e(r[c])):i.forEach(function(t){return e(r[t])})}}(r),t.length>a.size?[]:n}},{key:"expireOne",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,delete this._data.metadata[t].expiryTime,e.next=7;break;case 4:return e.prev=4,e.t0=e.catch(0),e.abrupt("return");case 7:return e.next=9,this.save();case 9:case"end":return e.stop()}},e,this,[[0,4]])}));return function(t){return e.apply(this,arguments)}}()},{key:"_getLookupKeys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.makeVersionLookupKey(e.productVersion),n=[t||O.default.getUserId()];return n.push(e.productCode,r,e.productLanguage),n}},{key:"makeVersionLookupKey",value:function(e){var t=e&&e.split(".");return t&&"".concat(t[0],".").concat(t[1])}},{key:"_getCollectionInfo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){var r=this._getLookupKeys(e,t),n=this._data.versionInfo;return r.forEach(function(e){n&&(n=n[e])}),n}}},{key:"_setCollectionInfo",value:function(e,t){var r=this._getLookupKeys(e),n=this._data.versionInfo;return r.forEach(function(e,a){a===r.length-1?n[e]=t:(n[e]=n[e]||{},n=n[e])}),n}},{key:"_isDataReferenced",value:function(e){var t=this._data.metadata[e],r=t&&this._getCollectionInfo(t.params,t.userId);return!!r&&!!Object.keys(r).find(function(t){return e===r[t]})}},{key:"_isDataPrimaryReference",value:function(e){var t=this._data.metadata[e],r=t&&this._getCollectionInfo(t.params,t.userId);if(r){if(r.pendingId)return e===r.pendingId;if(r.latestId)return e===r.latestId}return!1}},{key:"_checkValidity",value:function(e,t){}},{key:"_addNewCollectionInfo",value:function(e){var t=this,r=e.params,n=e.isPending,a=e.collectionId,s=e.expiry,o=e.retry,i=e.cause,c=void 0===i?"Unknown":i,u=e.refreshTime,l=e.file,d=e.subErrors,f=this._getCollectionInfo(r)||{},p=new Date,h=void 0;return Object.values(f).forEach(function(e){var r=t._data.metadata[e];if(r&&r.lastUseTime){var n=new Date(r.lastUseTime);!isNaN(n.getTime())&&n>p&&(p=n)}!o&&null!=r&&r.retry&&(o=r.retry),h=h||(null==r?void 0:r.delay),r&&delete r.delay}),!n&&h&&u&&new Date(u)>new Date(h.expiryTime)?h=void 0:n&&h&&new Date>new Date(h.expiryTime)&&(h=void 0),n?f.pendingId=a:(f.latestId=a,delete f.pendingId),this._setCollectionInfo(r,f),this._data.metadata[a]={expiryTime:s?s.toISOString():void 0,userId:O.default.getUserId(),lastUseTime:p.toISOString(),retry:o,cause:c,params:r,refreshTime:u,path:null!=l?l:n?void 0:"".concat(a,".json"),subErrors:d,delay:h},this._data.metadata[a]}},{key:"sanitizeParams",value:function(e){return e.productLanguage=v.default.sanitizeLocale(e.productLanguage),e}},{key:"isRequestPoisoned",value:function(e){var t=_.default.get("SUPPORTED_PRODUCTS",this.type);return!(e.productCode&&t[e.productCode]&&v.default.compareMajorMinorVersions(t[e.productCode],e.productVersion)>-1)}},{key:"_calculateExpiry",value:function(e,t){var r,n=e?e.expiryTime:void 0;if(n){r=new Date(n);var a=new Date;a.setMilliseconds(_.default.get("MAX_TIMEOUT")),r>a&&(r=a);var s=new Date;s.setMilliseconds(_.default.get("MIN_TIMEOUT")),r<s&&(r=s)}return r}},{key:"_calculateBackOffMetadata",value:function(e){var t=e.metadata,r=e.error,n=e.updateBackOff,a=void 0===n||n,s=e.initialRetry,o=void 0===s?_.default.get("SYNC_INITIAL_RETRY"):s,i="killed before response",c=r;if(c&&c.responseHeaders){var u=re.a.getRetryAfterHeader(c.responseHeaders);u&&(o=1e3*u)}else null!=t&&t.retry&&(o=t.retry*(a?2:1),o=Math.max(_.default.get("SYNC_INITIAL_RETRY"),o));o=Math.min(o,_.default.get("MAX_BACK_OFF")),c&&(i=c.short?c.short:c.message?null==c?void 0:c.message:c.toString(),c.code&&"403012"===c.code.toString()&&(o=_.default.get("EMBARGO_BACK_OFF")));var l=new Date;return l.setMilliseconds(o),{expiry:l,retry:o,cause:i,subErrors:null==r?void 0:r.subErrorJSON}}},{key:"fetchCollectionIndexRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l,d,f,p,E,y,m,g=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.requestId,s=t.desiredId,o=t.params,i=t.oldMetadata,c=t.priority,u=t.force,l=t.skipAuth,d=void 0!==l&&l,f=this._createCollectionData(s),p=!0,e.next=5,f.load({version:this.getClientVersion(o,this.type),file:null===(r=this._data)||void 0===r?void 0:null===(n=r.metadata[s])||void 0===n?void 0:n.path}).then(function(){var e;null!==(e=g._data)&&void 0!==e&&e.metadata[s]&&(g._data.metadata[s].path=f.fileName)}).catch(function(e){p=!1});case 5:if(p&&v.default.isDateExpired(f.expiryTime)&&(p=!1),p&&f.isDefaultData&&(p=!1),E=i&&i.refreshTime,p&&("stale"===u.type&&v.default.isDateExpired(null==i?void 0:i.expiryTime)?p=!1:"always"===u.type&&(p=!1)),p&&!d){e.next=24;break}return e.next=12,this.downloadManager.downloadCollectionData({id:a,params:o,priority:c,skipAuth:d});case 12:if((y=e.sent)._ccx=y._ccx||{},y._ccx.version=_.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type),!(m=f.setData(y,this.getClientVersion(o,this.type)))){e.next=18;break}throw m;case 18:return e.next=20,f.save();case 20:return E=(new Date).toISOString(),this._data.metadata[s]&&(this._data.metadata[s].path=f.fileName,this._data.metadata[s].refreshTime=E),e.next=24,this.save();case 24:return this._checkValidity(f,o),e.abrupt("return",f);case 26:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"defaultCollectionData",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.params,t.desiredId,e.abrupt("return",void 0);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"_fetchCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=void 0===r?{}:r,a=t.priority,s=void 0===a?void 0:a,i=t.payload,c=void 0===i?void 0:i,u=t.force,l=void 0===u?{type:"none"}:u,d=t.fetchType,f=void 0===d?"pre-fetch":d,O.default.getUserId()){e.next=3;break}throw new P.default("signed out").silence();case 3:return n=this.sanitizeParams(n),e.next=6,this._syncLock.read(o()(h.a.mark(function e(){var t,r,a,i,u,d,E,y,m,g,S,T,A;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(ee.b.status!==ee.b.OFFLINE){e.next=3;break}throw p.log.disk("Not downloading collection - offline"),new P.default("offline").silence();case 3:if(!D.b.isWaitingForBackOff(D.a.NETWORK)){e.next=5;break}throw new P.default("Awaiting global back-off ".concat(D.b.backOffCause(D.a.NETWORK))).silence();case 5:return e.next=7,p.paramsToId(n);case 7:if(a=e.sent,i=p._getCollectionInfo(n),u=a,!i||a!==i.latestId){e.next=19;break}if("always"===l.type){e.next=15;break}return e.abrupt("return",p._createCollectionData(a));case 15:try{delete p._data.metadata[a].expiryTime}catch(e){p.log.disk("Failed to find desiredId ".concat(a," for deletion."))}return e.next=18,p.paramsToId(n);case 18:a=e.sent;case 19:if(d=function(e){p.emit(a,e),u!==a&&p.emit(u,e)},(s=s||p.priority({params:n,key:a})).key=a,!p.isRequestPoisoned(n)){e.next=24;break}throw new P.default("Poisoned request not supported.").silence();case 24:if(!(E=Object.assign({},p._data.metadata[a]))||v.default.isDateExpired(E.expiryTime)||"none"!==l.type){e.next=30;break}throw y="Waiting for back-off ".concat(E.cause," for ").concat(v.default.getHumanReadableTime(E.retry||0)," expiring at ").concat(E.expiryTime," in ").concat(v.default.getHumanReadableTime(new Date(E.expiryTime).getTime()-Date.now())),p.log.context({params:n}).disk(y),new P.default(y).silence();case 30:return p._addNewCollectionInfo(fe(fe({params:n,isPending:!0,collectionId:a,refreshTime:E.refreshTime},p._calculateBackOffMetadata({metadata:p._data.metadata[a],initialRetry:_.default.get("KILLED_BEFORE_RESPONSE_INITIAL_RETRY")})),{},{file:null===(t=p._data)||void 0===t?void 0:null===(r=t.metadata[a])||void 0===r?void 0:r.path})),e.next=33,p.save();case 33:return m=R.v4(),e.next=36,p.downloadManager.url(n);case 36:return g=e.sent,S=new w.URL(g).origin,e.next=40,j.a.getNodeTunnelOptionsForURL(S);case 40:return T=e.sent.details,A=p.log.context({params:n,payload:fe(fe({},c),{},{"exp.request_guid":m,"event.url":g,"content.action":g,"event.subtype":_.default.analytics.st_API,"ccxp.mode":f,"ccxp.request_type":"get","ccxp.proxy":T},p.downloadManager.additionalAnalytics(n))}),e.next=44,A.request(function(){var e=o()(h.a.mark(function e(t){var r,i,c,u,f,v,y;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,d(r={}),i={requestId:m,params:n,desiredId:a,oldMetadata:E,force:l,priority:s},e.next=6,p.fetchCollectionIndex(i).catch(function(){var e=o()(h.a.mark(function e(t){var r,s,c,u;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,"401013"!==(null==t?void 0:null===(r=t.code)||void 0===r?void 0:r.toString())){e.next=10;break}return p.log.context({params:n}).error(new P.default("Retrying with fresh token",t)),O.default.reset(),e.next=6,D.b.updateBackOff({clear:!0,type:D.a.AUTH,sync:!1});case 6:return e.next=8,p.fetchCollectionIndex(i).catch(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:throw t;case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 8:return s=e.sent,e.abrupt("return",s);case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),p.log.context({params:n}).error(new P.default("Auth retry failed",e.t0));case 15:if(e.t1=!_.default.get("ANONYMOUS_RETRY_DISABLED",p.type),!e.t1){e.next=20;break}return e.next=19,O.default.getAccessToken().catch(function(e){return!1});case 19:e.t1=!!e.sent;case 20:if(!e.t1){e.next=33;break}return i.skipAuth=!0,p.log.context({params:n}).error(new P.default("Attempting Context only (bypass)",t)),e.next=25,p.fetchCollectionIndex(i).catch(function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(_.default.get("DEFAULT_URLS_ENABLED",p.type)){e.next=2;break}throw t;case 2:return p.log.context({params:n}).error(new P.default("Attempting Default URL (bypass)",t,"X_ERR_DEFAULT_URL_BYPASS")),e.next=5,p.defaultCollectionData({params:n,desiredId:a});case 5:if(r=e.sent){e.next=8;break}throw t;case 8:return e.next=10,r.save();case 10:return e.abrupt("return",r);case 11:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 25:if(c=e.sent){e.next=28;break}throw t;case 28:return e.next=30,c.save();case 30:return e.abrupt("return",c);case 33:if(_.default.get("DEFAULT_URLS_ENABLED",p.type)){e.next=35;break}throw t;case 35:return p.log.context({params:n}).error(new P.default("Attempting Default URL (bypass)",t,"X_ERR_DEFAULT_URL_BYPASS")),e.next=38,p.defaultCollectionData({params:n,desiredId:a});case 38:if(u=e.sent){e.next=41;break}throw t;case 41:return e.next=43,u.save();case 43:return e.abrupt("return",u);case 44:case"end":return e.stop()}},e,null,[[0,12]])}));return function(t){return e.apply(this,arguments)}}());case 6:return c=e.sent,p.downloadManager.applyResponseAnalytics(t,c.data,n),r.path="".concat(p._path+c.fileName),r.contentId=c.id,r.total=c.totalItems,p._data.metadata[c.id]&&(p._data.metadata[c.id].path=c.fileName),d(r),e.next=15,c.sync({priority:s,payload:t.options.payload,params:n,progress:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){r.path="".concat(p._path+c.fileName),d(Object.assign(e,r))}),force:l});case 15:return p._checkValidity(c,n),p._addNewCollectionInfo({params:n,isPending:!1,collectionId:c.id,expiry:p._calculateExpiry(c,n),refreshTime:p._data&&p._data.metadata[a]&&p._data.metadata[a].refreshTime,file:c.fileName}),e.next=19,p.save();case 19:return p.emit("newCollection",n,c),e.abrupt("return",c);case 23:return e.prev=23,e.t0=e.catch(0),p._addNewCollectionInfo(fe(fe({params:n,isPending:!0,collectionId:a,refreshTime:p._data.metadata[a].refreshTime},p._calculateBackOffMetadata({metadata:p._data.metadata[a],error:e.t0,updateBackOff:!1})),{},{file:null===(u=p._data)||void 0===u?void 0:null===(f=u.metadata[a])||void 0===f?void 0:f.path})),e.next=28,p.save();case 28:throw e.t0 instanceof P.default&&(e.t0.supportData={id:a,path:null===(v=p._data)||void 0===v?void 0:null===(y=v.metadata[a])||void 0===y?void 0:y.path}),e.t0;case 30:case"end":return e.stop()}},e,null,[[0,23]])}));return function(t){return e.apply(this,arguments)}}());case 44:return e.abrupt("return",e.sent);case 45:case"end":return e.stop()}},e)})),s).catch(function(){var e=o()(h.a.mark(function e(t){var r,a;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t instanceof P.default)||t.supportData||t.hasSubErrors){e.next=7;break}return e.next=3,p.paramsToId(n);case 3:r=e.sent,a=p._data.metadata[r],t.addSubErrors(null==a?void 0:a.subErrors),null!=a&&a.path&&(t.supportData={id:r,path:null==a?void 0:a.path});case 7:throw t;case 8:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_clearScheduledSyncJob",value:function(){this._syncTimeout&&(clearTimeout(this._syncTimeout),delete this._syncTimeout)}},{key:"_scheduleNextSyncJob",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=1/0,this._clearScheduledSyncJob(),!D.b.isWaitingForBackOff(D.a.NETWORK)){e.next=8;break}return n=new Date(D.b.backOffExpiry(D.a.NETWORK)).getTime()-(new Date).getTime(),this.log.disk("Scheduling next sync in ".concat(v.default.getHumanReadableTime(n)," after global backoff")),n=Math.min(_.default.get("MAX_TIMEOUT"),n),this._syncTimeout=setTimeout(function(){s.sync.bind(s)().catch(function(e){s.log.disk("Error syncing after content backoff for ".concat(s.type),e)})},n),e.abrupt("return");case 8:return e.next=10,v.default.waitAll(Object.keys(this._data.metadata).map(function(){var e=o()(h.a.mark(function e(t){var r,a,o,i,c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=s._data.metadata[t],a=r.params,!s.needsSync(t,{checkExpiry:!1})){e.next=14;break}if(o=v.default.getTimeToExpiry(r.expiryTime),r.delay&&(i=v.default.getTimeToExpiry(r.delay.expiryTime),0===o&&(o=i),n=Math.min(n,i)),0!==o){e.next=13;break}return o=_.default.get("SYNC_INITIAL_RETRY"),(c=new Date).setMilliseconds(o),r.expiryTime=c.toISOString(),e.next=12,s.save();case 12:s.log.context({params:a}).info(_.default.analytics.EXPIRED_DATA,"Scheduling with expired data. Add back-off for ".concat(a.productCode,"[").concat(a.productLanguage,"] - ").concat(r.expiryTime));case 13:n=Math.min(n,o);case 14:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 10:return e.next=12,v.default.waitAll(Object.values(null!==(t=null===(r=this._data)||void 0===r?void 0:r.onDemandMetadata)&&void 0!==t?t:{}).map(function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:"notReady"!==s.getOnDemandCollectionInfo(t.params)||s.isOnDemandSyncInProgress(s.paramsToOnDemandId(t.params))||(r=v.default.getTimeToExpiry(t.expiryTime),n=Math.min(n,r));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 12:if(n!==1/0){e.next=14;break}return e.abrupt("return");case 14:(a=_.default.get("LAST_FILEACCESSOR_WRITE_PARSED",this._type))&&!isNaN(Date.parse(a))&&(n=Math.min(n,Date.parse(a)-Date.now()+_.default.get("FILEACCESSOR_WRITE_SLA"))),n+=v.default.getRandomizedTime(n<_.default.get("TIME_FOR_SHORT_RANDOMIZE")),n=Math.min(n,_.default.get("MAX_TIMEOUT")),this.log.disk("Scheduling next sync in ".concat(v.default.getHumanReadableTime(n)," at ").concat(new Date(Date.now()+n).toISOString())),this._syncTimeout=setTimeout(function(){s.sync.bind(s)().catch(function(e){s.log.disk("Error syncing content for ".concat(s.type),e)})},n);case 20:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"_getReferencedIdList",value:function(){var e=this,t={};return Object.keys(this._data.metadata).forEach(function(r){e._isDataReferenced(r)&&(t[r]=!0)}),t}},{key:"_isPendingCollection",value:function(e){var t=this._data.metadata[e],r=t&&this._getCollectionInfo(t.params,t.userId);return!(!r||!r.pendingId)&&e===r.pendingId}},{key:"_refetchCollection",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._data.metadata,!(n=r[t]&&r[t].params)){e.next=8;break}return this.clearCollectionInfo(n,t,!1),this.log.disk("Refetch collection [".concat(t,"]")),e.next=7,this.addNewCollectionData({params:n}).catch(function(e){return a.log.context({params:n}).error(new P.default("Error Re-fetching collection",e))&&void 0});case 7:return e.abrupt("return",e.sent);case 8:return e.abrupt("return",Promise.resolve());case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_getReferencedAssetList",value:function(){var e=o()(h.a.mark(function e(t){var r,n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={},e.next=3,v.default.waitAll(Object.keys(t).map(function(){var e=o()(h.a.mark(function e(t){var a,s,o,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=n._createCollectionData(t),e.prev=1,o=n.getClientVersion(n._data.metadata[t].params,n.type),e.next=5,a.load({version:o,skipSaving:!0,file:null===(s=n._data.metadata[t])||void 0===s?void 0:s.path});case 5:return e.t0=Object,e.t1=r,e.next=9,a.getReferencedAssets();case 9:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2),e.next=22;break;case 13:if(e.prev=13,e.t3=e.catch(1),"ENOENT"!==e.t3.code&&e.t3.code!==m.default.INVALID_COLLECTION){e.next=21;break}n.log.disk("File is missing for collection [".concat(a.id,"]")),(i=n._data.metadata[a.id])&&i.userId===O.default.getUserId()&&n._isDataPrimaryReference(a.id)&&!n._isPendingCollection(a.id)&&n._refetchCollection(a.id),e.next=22;break;case 21:throw e.t3;case 22:case"end":return e.stop()}},e,null,[[1,13]])}));return function(t){return e.apply(this,arguments)}}()));case 3:return e.abrupt("return",r);case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"_cleanupCache",value:function(e,t){var r,n=this,a=this._data.metadata;Object.keys(a).forEach(function(r){var s,o;n._isDataPrimaryReference(r)||e[r]&&t.includes(null!==(s=null===(o=n._data.metadata[r])||void 0===o?void 0:o.path)&&void 0!==s?s:"".concat(r,".json"))||delete a[r]});var s=null!==(r=this._data.onDemandMetadata)&&void 0!==r?r:{};Object.keys(s).forEach(function(e){n.getOnDemandCollectionInfo(s[e].params,s[e].userId)||delete s[e]})}},{key:"_cleanupAssetsCache",value:function(e,t){var r=this._data.assetMetadata;Object.keys(r).forEach(function(n){var a=r[n];a.path&&(e[a.path]&&t.includes(A.basename(a.path))||delete r[n])})}},{key:"generateApiFile",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n={},Object.keys(this._data.versionInfo).forEach(function(e){r[e]={data:[]},Object.keys(t.metadata).forEach(function(s,o){var i,c=a._getLookupKeys(t.metadata[s].params).reduce(function(e,t){return e[t]?e[t]:e},a._data.versionInfo[e]);c.latestId&&(n[c.latestId]||(r[e].data.push(null===(i=a._data)||void 0===i?void 0:i.metadata[c.latestId]),n[c.latestId]=!0))})}),e.abrupt("return",{version:_.default.get("FILE_ACCESS_MAP_FILE_VERSION"),client:this.type,session:m.default.event_session_tracker,lastUpdateTime:new Date(Date.now()).toISOString(),users:r});case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"setData",value:function(e){var t=v.default.validateDataFields(e,_.default.get("MAP_DATA_SCHEMA"));return t?this.log.error(new P.default(m.default.DATA_VALIDATION_ERR,t[0])):this._data=e,t}},{key:"getMinorVersion",value:function(e,t,r,n){var a=Object.keys(n.metadata).find(function(a){var s,o,i=null===(s=n.metadata[a])||void 0===s?void 0:s.params;return(null==i?void 0:i.productCode)===t&&(null==i?void 0:i.productVersion.split(".")[0])===r&&(null===(o=n.metadata[a])||void 0===o?void 0:o.userId)===e});if(!a)return null;var s=n.metadata[a].params.productVersion;return this.makeVersionLookupKey(s)}},{key:"upgrade",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null);case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"getTutorialAssets",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{});case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"getCollectionAsset",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{});case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"load",value:function(){var e=o()(h.a.mark(function e(){var t,r,n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T.readJson(this._path+this._fileName).catch(function(e){n.log.disk("Failed to load lookup file from disk: ".concat(n._fileName," - ").concat(e))});case 2:if(t=e.sent,r=!1,t){e.next=8;break}this.log.disk("Empty lookup file: ".concat(this._fileName)),e.next=14;break;case 8:if(t.version===_.default.get("LOOKUP_MAP_FILE_VERSION",this._type)){e.next=14;break}return this.log.disk("Lookup file version mismatch: ".concat(this._fileName)),e.next=12,this.upgrade(t).catch(function(e){return null});case 12:t=e.sent,r=!0;case 14:if(t&&!this.setData(t)||((t={}).version=_.default.get("LOOKUP_MAP_FILE_VERSION",this._type),t.versionInfo={},t.metadata={},t.assetMetadata={},t.usersInfo={},t.onDemand={},t.onDemandMetadata={},this.setData(t)),t.onDemand||(t.onDemand={},t.onDemandMetadata={},r=!0),!r){e.next=19;break}return e.next=19,this.save();case 19:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getPath",value:function(){return this._path}},{key:"updateDisplayedId",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,!(n=t.displayed)||!r){e.next=10;break}if(s=null!==(a=Object.keys(this._data.metadata).find(function(e){return i._data.metadata[e].path===n}))&&void 0!==a?a:A.basename(n,".json"),(o=this._getCollectionInfo(r))||(this._addNewCollectionInfo({params:r,isPending:!1,collectionId:s,file:n}),o=this._getCollectionInfo(r)),!o||o.lastDisplayedId===s){e.next=10;break}return o.lastDisplayedId=s,this._setCollectionInfo(r,o),e.next=10,this.save();case 10:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"validateParams",value:function(e){var t=v.default.validateDataFields(e,_.default.get("PARAMETERS_SCHEMA",this.type));if(t)throw new P.default(_.default.analytics.PARAM_VALIDATION_ERR,t[0])}},{key:"getPending",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.updateLastUseTime,r){e.next=5;break}return a=new P.default(m.default.DATA_VALIDATION_ERR,"No data to get the path for in LookupMap"),this.log.error(a),e.abrupt("return");case 5:e.prev=5,this.validateParams(r),e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(5),this.log.error(new P.default(e.t0,"No data to get the path for in LookupMap")),e.abrupt("return");case 13:if(s=!1,o=void 0,i=void 0,!(c=this._getCollectionInfo(r))){e.next=25;break}if(u=[c.partialId,c.latestId,c.pendingId].reduce(function(e,t){var r,n;return e?t?new Date((null===(r=l._data.metadata[e])||void 0===r?void 0:r.refreshTime)||0)>new Date((null===(n=l._data.metadata[t])||void 0===n?void 0:n.refreshTime)||0)?e:t:e:t}),o=u&&this._data.metadata[u].path,i=u&&this._data.metadata[u].subErrors,n&&((u&&this._data.metadata[c.pendingId?c.pendingId:u]||{}).lastUseTime=(new Date).toISOString(),s=!0),!s){e.next=25;break}return e.next=25,this.save();case 25:return e.abrupt("return",{partial:o,failures:i});case 26:case"end":return e.stop()}},e,this,[[5,9]])}));return function(t){return e.apply(this,arguments)}}()},{key:"updatePending",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.id,a=t.updateLastUseTime,s=t.err,r){e.next=5;break}return o=new P.default(m.default.DATA_VALIDATION_ERR,"No data to get the path for in LookupMap"),this.log.error(o),e.abrupt("return");case 5:if(this.validateParams(r),i=!1,!(c=this._getCollectionInfo(r))){e.next=14;break}if(c.partialId!==n&&(c.partialId=n,this._data.metadata[n]=this._data.metadata[n]||{},this._data.metadata[n].subErrors=s.subErrorJSON,i=!0),a&&((this._data.metadata[c.pendingId?c.pendingId:c.partialId]||{}).lastUseTime=(new Date).toISOString(),i=!0),!i){e.next=14;break}return e.next=14,this.save();case 14:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getLatestPath",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l,d,f,p,v,E,y,g,S,T,A=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.updateLastUsedId,a=void 0!==n&&n,s=t.updateLastUseTime,o=void 0!==s&&s,r){e.next=5;break}return i=new P.default(m.default.DATA_VALIDATION_ERR,"No data to get the path for in LookupMap"),this.log.error(i),e.abrupt("return");case 5:if(this.validateParams(r),!(c=this._getCollectionInfo(r))||!c.latestId){e.next=17;break}if(d=!1,a&&c.latestId!==c.lastUsedId&&(c.lastUsedId=c.latestId,this._setCollectionInfo(r,c),d=!0),o&&(f=this._data.metadata[c.lastUsedId?c.lastUsedId:""]||{},p=f.lastUseTime,f.lastUseTime=(new Date).toISOString(),p&&((v=new Date(p)).setMilliseconds(_.default.get("STOP_SYNCING_BEYOND")),v<new Date&&this.sync().catch(function(e){A.log.disk("Error syncing outdated content ",e)})),d=!0),!d){e.next=14;break}return e.next=14,this.save();case 14:return(E=this._data.metadata[c.latestId])&&E.userId===O.default.getUserId()&&!this._isPendingCollection(c.latestId)&&((T=this._createCollectionData(c.latestId)).load({version:this.getClientVersion(r,this.type),file:null===(y=this._data)||void 0===y?void 0:null===(g=y.metadata[c.latestId])||void 0===g?void 0:g.path}).catch(function(e){"ENOENT"===e.code&&(A.log.disk("File is missing for collection [".concat(T.id,"]")),A._refetchCollection(T.id))}),null!==(S=this._data)&&void 0!==S&&S.metadata[c.latestId]&&(this._data.metadata[c.latestId].path=T.fileName)),e.abrupt("return",this._path+(null!==(u=null===(l=this._data.metadata[c.latestId])||void 0===l?void 0:l.path)&&void 0!==u?u:"".concat(c.latestId,".json")));case 17:return e.abrupt("return",void 0);case 18:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getExpiry",value:function(e){return this._data.metadata[e]&&this._data.metadata[e].expiryTime}},{key:"save",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._data){e.next=4;break}throw t=new P.default(m.default.DATA_VALIDATION_ERR,"No data to save to LookupMap."),this.log.error(t),t;case 4:if(!this._saveInProgress){e.next=7;break}return this._calledSave=!0,e.abrupt("return");case 7:return this._calledSave=!1,this._saveInProgress=!0,e.next=11,this._diskLock.write(o()(h.a.mark(function e(){var t,n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,N.writeJsonAtomic(r._path,_.default.get("LOOKUP_MAP_FILE"),r._data,!0);case 3:t=e.sent,A.basename(t)!==r._fileName&&(r._fileName=A.basename(t),_.default.set("LOOKUP_MAP_FILE",r._fileName,r.type)),e.next=11;break;case 7:return e.prev=7,e.t0=e.catch(0),r.log.error(new P.default(_.default.analytics.LOOKUP_MAP_ERROR,e.t0,e.t0.code),"Error writing to map json file: ".concat(r._fileName)),e.abrupt("return");case 11:return e.prev=11,e.next=14,r.generateApiFile(r._data);case 14:return r._apiData=e.sent,e.next=17,N.writeJsonAtomic(r._path,_.default.get("FILE_ACCESS_MAP_FILE"),r._apiData,!0);case 17:n=e.sent,A.basename(n)!==_.default.get("FILE_ACCESS_MAP_FILE")&&(r._apiFileName=A.basename(n),r.logApiRenameError()),e.next=24;break;case 21:e.prev=21,e.t1=e.catch(11),r.log.error(new P.default(_.default.analytics.ACCESSOR_ERROR_TYPE,e.t1,_.default.analytics.ACCESSOR_READ_ERROR_CODE),"Error writing to api json file: ".concat(r._apiFileName));case 24:case"end":return e.stop()}},e,null,[[0,7],[11,21]])})));case 11:if(this._saveInProgress=!1,!this._calledSave){e.next=16;break}return e.next=15,this.save();case 15:this._calledSave=!1;case 16:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"cachedAsset",value:function(e){return this._data.assetMetadata[e]}},{key:"_fetchAsset",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,p,E,y,m,g,S,O,I,R,C,k,x,b,D,w,L,M,U,F,V,j,G,H,B,Y,X,K,W,q,J,Q,z,Z,$,ee,ne,ae,se=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(c=t.href,u=t.assetsDir,l=t.priority,d=t.params,p=t.force,E=t.key,y=t.headers,m=t.auth,g=t.progressKey,E=E||c,S=(null===(r=this._data)||void 0===r?void 0:r.assetMetadata[E])||{},O=S.lastModified,I=S.expiry,R=S.etag,C=S.date,e.t0=S.path,!e.t0){e.next=9;break}return e.next=8,T.pathExists("".concat(u,"../").concat(S.path));case 8:e.t0=e.sent;case 9:if((k=e.t0)||(O=R=C=I=void 0),p&&p.depth>=0&&"always"===p.type&&(!p.from||!S.refreshTime||new Date(p.from)>new Date(S.refreshTime))&&(O=R=C=I=void 0),!(new Date(I||"")>new Date)){e.next=14;break}return e.abrupt("return",{path:S.path});case 14:if("always"===(null==p?void 0:p.type)&&(null!==(n=null==p?void 0:p.depth)&&void 0!==n?n:0)>=0||!k||!S.path||".json"===A.extname(S.path)||_.default.get("NON_IDEMPOTENT_IMAGES",this.type)){e.next=16;break}return e.abrupt("return",{path:S.path});case 16:if(x=null!=l&&l.key?this.abortControllers[l.key]:void 0,b=S.temp&&A.normalize("".concat(u,"/../").concat(S.temp)),e.t1=b,!e.t1){e.next=23;break}return e.next=22,T.pathExists(b);case 22:e.t1=e.sent;case 23:if(D=e.t1,w=!0,L=0,M=void 0,U=S.path,F=function(e){var t,r;g=null!==(t=g)&&void 0!==t?t:"Asset-"+(null!==(r=null==l?void 0:l.key)&&void 0!==r?r:E),se.emit(g,f()({},E||c,e))},V=v.default.throttle(F,_.default.get("PROGRESS_THROTTLE_INTERVAL")),k||!D||!b||!S.path){e.next=46;break}return e.next=33,this.downloadManager.load(b).catch(function(e){se.log.error(new P.default("Could not load file for resume",e))});case 33:if(!(j=e.sent)){e.next=46;break}return j.emitter.on("progress",V),e.next=38,this.downloadManager.resume(j,{url:c,priority:l,options:{signal:null==x?void 0:x.signal}}).catch(function(){var e=o()(h.a.mark(function e(t){var r,n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(se.log.error(new P.default("Resume Failed",t)),"ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC"!==t.code){e.next=5;break}throw n=null!==(r=_.default.get("ASSET_MAX_SOCKETS",se._type))&&void 0!==r?r:_.default.get("NETWORK_MAX_SOCKETS"),_.default.set("ASSET_MAX_SOCKETS",Math.max(Math.floor(n/2),1),se._type),new P.default("server",t,"LOCAL_RETRY");case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 38:if(G=e.sent,j.emitter.off("progress",V),w=void 0===G){e.next=45;break}return e.next=44,N.rename(b,"".concat(u,"../").concat(S.path)).catch(function(){return w=!0});case 44:L+=G||0;case 45:M=j.headers;case 46:if(H=S.id||this.generateId(d||{}),!w){e.next=80;break}return y=y||{},R?y["If-None-Match"]=R:O?y["If-Modified-Since"]=O:C&&(y["If-Modified-Since"]=C),e.next=52,this.downloadManager.get({url:c,options:{headers:y,parallel:{minimumPartialSize:null!==(B=_.default.get("ASSET_MINIMUM_PARTIAL_SIZE",this._type))&&void 0!==B?B:_.default.get("NETWORK_MINIMUM_PARTIAL_SIZE"),maxSockets:null!==(Y=_.default.get("ASSET_MAX_SOCKETS",this._type))&&void 0!==Y?Y:_.default.get("NETWORK_MAX_SOCKETS"),maxLatency:null!==(X=_.default.get("ASSET_MAX_LATENCY",this._type))&&void 0!==X?X:_.default.get("NETWORK_MAX_LATENCY"),maxLatencyRetries:null!==(K=_.default.get("ASSET_MAX_LATENCY_RETRIES",this._type))&&void 0!==K?K:_.default.get("NETWORK_MAX_LATENCY_RETRIES")},signal:null==x?void 0:x.signal},auth:m,priority:l,id:H}).catch(function(){var e=o()(h.a.mark(function e(t){var r,n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC"!==t.code){e.next=4;break}throw n=null!==(r=_.default.get("ASSET_MAX_SOCKETS",se._type))&&void 0!==r?r:_.default.get("NETWORK_MAX_SOCKETS"),_.default.set("ASSET_MAX_SOCKETS",Math.max(Math.floor(n/2),1),se._type),new P.default("server",t,"LOCAL_RETRY");case 4:if(4!==Math.floor(t.code/100)&&5!==Math.floor(t.code/100)||!y||!y["If-None-Match"]&&!y["If-Modified-Since"]){e.next=11;break}return delete S.date,delete S.lastModified,delete S.etag,e.next=10,se.save();case 10:throw new P.default("server",t,"LOCAL_RETRY");case 11:throw t;case 12:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 52:if(q=e.sent,J=q.response,M=J.headers,L+=q.time,304!==J.status){e.next=63;break}if(!S.path){e.next=62;break}return this._data.assetMetadata[E]=fe(fe({},S),{},{expiry:M&&re.a.getExpiry(M)||new Date(Date.now()+_.default.get("ASSET_DEFAULT_EXPIRATION")),refreshTime:(new Date).toISOString()}),e.next=61,this.save();case 61:return e.abrupt("return",{path:S.path});case 62:throw new Error("Got 304 for asset not on disk for url ".concat(c));case 63:return(Q=te.getExtension(re.a.getContentTypeHeader(J.headers)||""))||(Q=(Q=(Q=A.extname(J.url))&&Q.substr(1))||"bin"),z="".concat(u).concat(H,".").concat(Q),this._data.assetMetadata[E]=(null===(W=this._data)||void 0===W?void 0:W.assetMetadata[E])||{},this._data.assetMetadata[E].id=H,this._data.assetMetadata[E].path=A.basename(u)+"/".concat(H,".").concat(Q),e.next=71,this.save();case 71:return Z=Date.now(),$=!1,e.next=75,N.writeAtomic({response:J,target:z,progress:function(e,t,r){var n;!$&&E&&se._data.assetMetadata[E]&&(null===(n=se._data.assetMetadata[E])||void 0===n?void 0:n.temp)!==r&&(se._data.assetMetadata[E].temp=A.basename(u)+"/"+A.basename(r),se.save()),V({done:e,total:t})},renameOnError:!0});case 75:z=e.sent,$=!0,U="".concat(A.basename(u),"/").concat(A.basename(z)),M=J.headers,L+=Date.now()-Z;case 80:return this._data.assetMetadata[E]={id:H,path:U,expiry:M&&re.a.getExpiry(M)||new Date(Date.now()+_.default.get("ASSET_DEFAULT_EXPIRATION")),refreshTime:(new Date).toISOString()},null!==(a=M)&&void 0!==a&&a.get("last-modified")&&(this._data.assetMetadata[E].lastModified=null===(ee=M)||void 0===ee?void 0:ee.get("last-modified")),null!==(s=M)&&void 0!==s&&s.get("etag")&&(this._data.assetMetadata[E].etag=null===(ne=M)||void 0===ne?void 0:ne.get("etag")),null!==(i=M)&&void 0!==i&&i.get("date")&&(this._data.assetMetadata[E].date=null===(ae=M)||void 0===ae?void 0:ae.get("date")),e.next=86,this.save();case 86:return e.abrupt("return",{path:U,time:L});case 87:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"priority",value:function(e){var t=e.params,r=e.key,n=void 0===r?"":r,a=e.level,s=void 0===a?L.c.Regular:a;return new L.a({key:n,value:_.default.get("PRODUCT_PRIORITY")[t.productCode]||0,channel:_.default.get("PRIORITY_CHANNEL",this._type),level:s})}},{key:"isValidDataForParams",value:function(e){e.id,e.params;return!0}},{key:"addDelay",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,!("always"===(n=t.force).type&&n.delay&&n.delay>0)){e.next=11;break}return e.next=4,this.paramsToId(r);case 4:if(s=this._getCollectionInfo(r),!(o=null!==(a=null==s?void 0:s.pendingId)&&void 0!==a?a:null==s?void 0:s.latestId)){e.next=11;break}return this._data.metadata[o].delay={depth:n.depth||0,expiryTime:new Date(Date.now()+n.delay).toISOString()},e.next=10,this._scheduleNextSyncJob();case 10:return e.abrupt("return",this._createCollectionData(o));case 11:return e.abrupt("return",void 0);case 12:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"delayExpiry",value:function(e){var t,r,n;return e?null===(t=this._data)||void 0===t?void 0:null===(r=t.metadata[e])||void 0===r?void 0:null===(n=r.delay)||void 0===n?void 0:n.expiryTime:void 0}},{key:"addNewCollectionData",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f,p,E,y,g,S,O,T,A,I,R,C,k,x,b,N,D=this,w=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=w.length>0&&void 0!==w[0]?w[0]:{},a=n.params,s=n.payload,i=n.priorityLevel,c=n.progress,u=void 0===c?function(){}:c,l=n.force,d=n.fetchType,f=void 0===d?"pre-fetch":d,a){e.next=5;break}throw p=new P.default(m.default.DATA_VALIDATION_ERR,"No parameters to add the collection of."),this.log.error(p),p;case 5:return e.next=7,this.updateParams([a]);case 7:if(E=e.sent[0],a=null!=E?E:a,this.validateParams(a),null===(t=l)||void 0===t||!t.delay){e.next=16;break}return e.next=13,this.addDelay({params:a,force:l});case 13:return y=e.sent,f="delayed",e.abrupt("return",y);case 16:if(!(g=this._getCollectionInfo(a))||!a.ccxVersion){e.next=23;break}if(S=!1,Object.values(g).forEach(function(e){var t=D._data.metadata[e];t&&t.params&&t.params.ccxVersion&&(t.params.ccxVersion&&-1!==v.default.compareMajorMinorVersions(a.ccxVersion,t.params.ccxVersion)||(t.params.ccxVersion=a.ccxVersion,S=!0))}),!S){e.next=23;break}return e.next=23,this.save();case 23:if(!g||!a.vmStatus){e.next=30;break}if(O=!1,T=!(256&a.vmStatus),Object.values(g).forEach(function(e){var t=D._data.metadata[e];t&&t.params&&(T||!t.params.vmStatus)&&(t.params.vmStatus=a.vmStatus,O=!0)}),!O){e.next=30;break}return e.next=30,this.save();case 30:if(!g||!g.latestId){e.next=53;break}if(A=g.latestId,this._data.metadata[A]=this._data.metadata[A]||{},I=!0,_.default.get("MINOR_VERSION_SHOULD_UPDATE_CONTENT",this.type)&&(Object.values(g).some(function(e){var t=D._data.metadata[e];return!!(t&&t.params&&t.params.productVersion&&0==v.default.compareMajorMinorVersions(a.productVersion,t.params.productVersion))})||(l={type:"always"})),!l){e.next=46;break}e.t0=l.type,e.next="always"===e.t0?39:"stale"===e.t0?43:46;break;case 39:f="force-always",I=!1;try{delete this._data.metadata[A].expiryTime}catch(e){this.log.disk("Failed to find id: ".concat(A," for deletion."))}return e.abrupt("break",46);case 43:return f="force-stale",v.default.isDateExpired(null===(r=this._data.metadata[A])||void 0===r?void 0:r.expiryTime)&&(f="expired",I=!1),e.abrupt("break",46);case 46:if(this._data.metadata[A]){if(!this.isValidDataForParams({id:A,params:a})){I=!1;try{delete this._data.metadata[A].expiryTime}catch(e){this.log.disk("Failed to find id: ".concat(A," for deletion."))}}}else I=!1;if(!I){e.next=53;break}return k=this._createCollectionData(A),this._data.metadata[A].params=a,e.next=52,k.load({version:this.getClientVersion(a,this.type),file:null===(R=this._data)||void 0===R?void 0:null===(C=R.metadata[A])||void 0===C?void 0:C.path}).then(function(e){var t;return null!==(t=D._data)&&void 0!==t&&t.metadata[A]&&(D._data.metadata[A].path=k.fileName),e}).catch(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return D.clearCollectionInfo(a,A,!1),e.next=3,D.addNewCollectionData({params:a,payload:s,progress:u,priorityLevel:i,force:l,fetchType:f});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 52:return e.abrupt("return",e.sent);case 53:return e.next=55,this.paramsToId(a);case 55:return x=e.sent,b=this.priority({params:a,key:x,level:i||L.c.Regular}),this._syncLock.prioritize(b),this._downloadManager.prioritize(b),this.addListener(x,u),e.next=62,this._fetchCollectionData({params:a,priority:b,payload:s,force:l,fetchType:f}).catch(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return D.log.context({params:a}).disk(t,"Error adding new collection"),e.next=3,D._scheduleNextSyncJob();case 3:throw D.removeListener(x,u),t;case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 62:return N=e.sent,this.removeListener(x,u),e.abrupt("return",N);case 65:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"needsSync",value:function(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.checkExpiry,s=void 0===a||a,o=n.force,i=void 0!==o&&o,c=n.inFuture,u=void 0!==c&&c,l=this._data.metadata[e],d=l&&l.userId===O.default.getUserId()&&this._isDataPrimaryReference(e)&&!this.isRequestPoisoned(l.params);u&&l.delay?d=d&&!(this.isSyncInProgress(e)&&v.default.isDateExpired(null===(t=l.delay)||void 0===t?void 0:t.expiryTime)):d=d&&!this.isSyncInProgress(e);(i||(d=d&&v.default.hasBeenUsedRecently(l.lastUseTime)),s&&!i)&&(l.delay&&v.default.isDateExpired(null===(r=l.delay)||void 0===r?void 0:r.expiryTime)||(d=d&&v.default.isDateExpired(null==l?void 0:l.expiryTime)));return d}},{key:"parseFileAccessorWrites",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.log.context({payload:{"event.subtype":_.default.analytics.st_ACCESSOR}}),_.default.get("FILE_ACCESSOR_WRITE_ENABLED",this.type)){e.next=3;break}return e.abrupt("return");case 3:return r=_.default.get("FILE_ACCESSOR_WRITE_FOLDER"),n=A.join(this.getPath(),r),e.next=7,T.ensureDir(n).catch(function(e){throw new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,e,_.default.analytics.ACCESSOR_WRITE_ERROR_CREATING_DIR_CODE)});case 7:return e.next=9,T.readdir(n).catch(function(e){throw new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,e,_.default.analytics.ACCESSOR_WRITE_ERROR_READING_DIR_CODE)});case 9:a=e.sent,s=_.default.get("LAST_FILEACCESSOR_WRITE_PARSED",this.type),_.default.set("LAST_FILEACCESSOR_WRITE_PARSED",(new Date).toISOString(),this.type),i=[],a.length&&t.disk("Processing ".concat(a.length," file accessor writes.")),c=ue(a),e.prev=15,l=h.a.mark(function e(){var r,a,o,c,l,f,p,v,E;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.value,a={},o={},c=A.join(n,r),l=void 0,a["exp.request_guid"]=r.replace(/.json$/,""),e.prev=6,r.endsWith(".json")){e.next=9;break}throw new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,"File is not JSON",_.default.analytics.ACCESSOR_WRITE_ERROR_FILE_TYPE_CODE).removeStack();case 9:return e.next=11,N.getFileSize(c).catch(function(e){throw new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,"Err getting file size ".concat(e),_.default.analytics.ACCESSOR_WRITE_ERROR_FILE_SIZE_CODE)});case 11:if(!(e.sent>_.default.get("MAX_ACCESSOR_FILE_SIZE"))){e.next=14;break}throw new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,"File is larger than ".concat(_.default.get("MAX_ACCESSOR_FILE_SIZE")),_.default.analytics.ACCESSOR_WRITE_ERROR_FILE_SIZE_CODE).removeStack();case 14:return e.next=16,T.readJson(c);case 16:if(l=e.sent){e.next=19;break}throw new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,"Empty File Content",_.default.analytics.ACCESSOR_WRITE_ERROR_NO_CONTENT).removeStack();case 19:if(l.clientSession?a["ccxp.clientSession"]=l.clientSession:d.log.context({payload:a,params:o}).disk("No clientSession provided"),l.timestamp&&(a["event.dts_start"]=l.timestamp),l.params){e.next=23;break}throw new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,"Params not supplied.",_.default.analytics.ACCESSOR_WRITE_ERROR_NO_PARAMS_CODE).removeStack();case 23:if(o=l.params,a["event.context_guid"]=l.session,_.default.get("SUPPORTED_FILE_WRITE_VERSIONS").includes(parseInt(l.version))){e.next=27;break}throw new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,"Invalid version: ".concat(l.version),_.default.analytics.ACCESSOR_WRITE_ERROR_INVALID_VERSION_CODE).removeStack();case 27:if(!isNaN(Date.parse(l.timestamp||""))){e.next=29;break}throw new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,"Invalid timestamp.",_.default.analytics.ACCESSOR_WRITE_ERROR_INVALID_TIMESTAMP_CODE).removeStack();case 29:if(!((p=new Date(l.timestamp)).getTime()>Date.now())){e.next=32;break}throw new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,"Timestamp is in the future.",_.default.analytics.ACCESSOR_WRITE_ERROR_TIMESTAMP_FUTURE_CODE).removeStack();case 32:if(!(s&&p.getTime()<new Date(s).getTime())){e.next=34;break}throw new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,"Timestamp is older than last parsed timestamp.",_.default.analytics.ACCESSOR_WRITE_ERROR_TIMESTAMP_OLDER_CODE).removeStack();case 34:if(l.user){e.next=36;break}throw new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,"User not supplied.",_.default.analytics.ACCESSOR_WRITE_ERROR_NO_USER_CODE).removeStack();case 36:if(a["ccxp.path"]=l.path,a["ccxp.client_params"]=l.params,a["ccxp.accessor_user"]=l.user,l.user!==O.default.getUserId()&&t.context({payload:a,params:o}).disk("User does not match. Expected ".concat(O.default.getUserId()," but got ").concat(l.user,".")),l.path||null!==(f=l.error)&&void 0!==f&&f.description){e.next=42;break}throw new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,"No path or error description specified in Write API File ".concat(r),_.default.analytics.ACCESSOR_WRITE_ERROR_NO_PATH_DESCRIPTION_CODE).removeStack();case 42:e.next=50;break;case 44:return e.prev=44,e.t0=e.catch(6),e.t0 instanceof P.default?t.context({payload:a,params:o}).error(e.t0):t.context({payload:a,params:o}).error(new P.default(_.default.analytics.ACCESSOR_WRITE_FILE_ERROR_TYPE,"Error parsing write api file:"+e.t0,_.default.analytics.ACCESSOR_WRITE_ERROR_FILE_INVALID_JSON_CODE)),e.next=49,T.remove(c).catch(function(e){d.log.disk("Error removing file ".concat(c))});case 49:return e.abrupt("return","continue");case 50:l.error?(E=new P.default(_.default.analytics.ACCESSOR_CLIENT_ERROR_TYPE,null===(v=l)||void 0===v?void 0:v.error.description,l.error.code).setPayload({"ccxp.underlying_error":JSON.stringify(l.error.underlyingError)}).removeStack(),t.context({payload:a,params:o}).error(E),delete l.error):t.context({payload:a,params:o}).info(_.default.analytics.ACCESSOR_WRITE_SUCCESS),i.push({filePath:c,content:l,payload:a,params:o});case 52:case"end":return e.stop()}},e,null,[[6,44]])}),c.s();case 18:if((u=c.n()).done){e.next=25;break}return e.delegateYield(l(),"t0",20);case 20:if("continue"!==e.t0){e.next=23;break}return e.abrupt("continue",23);case 23:e.next=18;break;case 25:e.next=30;break;case 27:e.prev=27,e.t1=e.catch(15),c.e(e.t1);case 30:return e.prev=30,c.f(),e.finish(30);case 33:return i=i.sort(function(e,t){var r,n;return new Date(null!==(r=e.content.timestamp)&&void 0!==r?r:0)<new Date(null!==(n=t.content.timestamp)&&void 0!==n?n:0)?-1:1}),e.next=36,v.default.waitAll(i.map(function(){var e=o()(h.a.mark(function e(r){var n,a,s,o,i,c,u,l,f,p,v,E,y;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.filePath,a=r.content,s=r.payload,o=r.params,s["exp.request_guid"]=A.basename(n,".json"),s["event.subtype"]=_.default.analytics.st_ACCESSOR,s["event.context_guid"]=a.session,e.next=6,d.updateParams([a.params]);case 6:return i=e.sent[0],e.next=9,d.addNewCollectionData({params:i,payload:s,priorityLevel:L.c.BackgroundRequest,fetchType:"file-accessor"}).catch(function(e){});case 9:return(c=d._getCollectionInfo(i))?(a.path&&(u=A.basename(a.path,".json"),l=u.substr(-3),f=/^\-(\d\d)$/.exec(l),0!==(f&&f[1]?parseInt(f[1],10):0)&&(u=u.slice(0,-3)),d._data.metadata[u]?c.lastDisplayedId?(v=d._data.metadata[c.lastDisplayedId]||{},new Date(null!==(p=v.lastUseTime)&&void 0!==p?p:"")<new Date(a.timestamp)&&(c.lastDisplayedId=u)):c.lastDisplayedId=u:t.context({payload:s,params:o}).error(new P.default(_.default.analytics.ACCESSOR_ERROR_TYPE,"Displayed id ".concat(u," not found in metadata}."),_.default.analytics.ACCESSOR_WRITE_DISPLAY_ID_NOT_FOUND_CODE).removeStack())),E=d._data.metadata[c.lastDisplayedId||c.latestId||c.pendingId||c.partialId||""]||{},(!(y=E.lastUseTime)||new Date(y)<new Date(a.timestamp))&&(E.lastUseTime=new Date(a.timestamp).toISOString())):t.context({payload:s,params:i}).error(new P.default(_.default.analytics.ACCESSOR_ERROR_TYPE,"Cannot update last use time / displayed as collectionInfo not found.")),e.next=13,T.remove(n);case 13:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())).catch(function(e){});case 36:if(!(i.length>0)){e.next=39;break}return e.next=39,this.save();case 39:case"end":return e.stop()}},e,this,[[15,27,30,33]])}));return function(){return e.apply(this,arguments)}}()},{key:"sync",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a=this,s=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>0&&void 0!==s[0]?s[0]:{type:"none"},e.next=3,this.parseFileAccessorWrites();case 3:if(n="pre-fetch",ee.b.status!==ee.b.OFFLINE){e.next=13;break}return e.next=7,D.b.updateBackOff({cause:"Offline[Network-Sync]",type:D.a.NETWORK});case 7:return e.next=9,ee.b.check(ee.a.LOOKUP_MAP_SYNC);case 9:return e.next=11,this._scheduleNextSyncJob();case 11:throw new P.default("Offline[Network-Sync]",new Error("Offline-Lookup-Sync"),_.default.analytics.OFFLINE_ERROR);case 13:if(this._clearScheduledSyncJob(),"always"!==r.type){e.next=18;break}return n="force-always",e.next=18,this.expireAll(O.default.getUserId());case 18:if(null===(t=this._data)||void 0===t||!t.metadata){e.next=21;break}return e.next=21,v.default.waitAll(Object.keys(this._data.metadata).map(function(e){var t=a._data.metadata[e],s=fe({},r),o=n;return a.needsSync(e,{force:"none"!==s.type,checkExpiry:!a._isPendingCollection(e)})?(t&&t.expiryTime&&v.default.isDateExpired(t.expiryTime)?o="expired":null!=t&&t.delay&&v.default.isDateExpired(t.delay.expiryTime)&&(o="delayed",s.type="always",s.depth=t.delay.depth),a._fetchCollectionData({params:t.params,force:s,fetchType:o})):Promise.resolve()})).then(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.syncOnDemandAssets();case 2:case"end":return e.stop()}},e)}))).catch(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a._scheduleNextSyncJob();case 2:throw t;case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 21:return e.next=23,this.gc();case 23:return e.next=25,this._scheduleNextSyncJob();case 25:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"_gc",value:function(){var e=o()(h.a.mark(function e(){var t=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,v.default.getLocks(this._syncLock.write.bind(this._syncLock),this._diskLock.write.bind(this._diskLock),o()(h.a.mark(function e(){var r,n,a,s,o,i,c,u,l,d,f,p;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.log.disk("GC starts."),r=t._getReferencedIdList(),n={},a={},Object.keys(r).forEach(function(e){var r,a,s,o=null!==(r=null===(a=t._data)||void 0===a?void 0:null===(s=a.metadata[e])||void 0===s?void 0:s.path)&&void 0!==r?r:"".concat(e,".json");n[o]=!0}),n[t._fileName]=!0,e.next=8,N.cleanupFolder(t._path,n,new RegExp(_.default.get("IGNORED_FILES_REGEXP")));case 8:return s=e.sent,o=s.left,(i=s.removed).length>0&&t.log.disk("Removed from ".concat(t._path," - ").concat(i.join(" "))),e.next=14,t._getReferencedAssetList(r);case 14:return c=e.sent,e.next=17,t._getOnDemandAssetList();case 17:return u=e.sent,Object.assign(c,u),Object.keys(c).forEach(function(e){a[A.basename(e)]=!0}),l=t._path+_.default.get("ASSETS_DIRNAME")+"/",e.next=23,N.cleanupFolder(l,a);case 23:d=e.sent,f=d.left,(p=d.removed).length>0&&t.log.disk("Removed from ".concat(l," - ").concat(p.join(", "))),t._cleanupCache(r,o),t._cleanupAssetsCache(c,f);case 29:case"end":return e.stop()}},e)})));case 3:return e.next=5,this.save();case 5:this.log.disk("GC ended successfully."),e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(0),this.log.error(new P.default(e.t0,_.default.analytics.GC_ERROR)),e.t0;case 12:case"end":return e.stop()}},e,this,[[0,8]])}));return function(){return e.apply(this,arguments)}}()},{key:"setForUser",value:function(){var e=o()(h.a.mark(function e(t,r){var n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(n=(n=this._data.usersInfo)||{})[O.default.getUserId()]=n[O.default.getUserId()]||{},n[O.default.getUserId()][t]=r,e.next=6,this.save();case 6:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"getForUser",value:function(e){var t=this._data.usersInfo&&this._data.usersInfo[O.default.getUserId()];return t&&t[e]}},{key:"getLastTimeOfNotification",value:function(){var e=this.getForUser("lastTimeOfNotification");return e||(e=(new Date).getTime(),this.setForUser("lastTimeOfNotification",e)),Number(e)}},{key:"setLastTimeOfNotification",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setForUser("lastTimeOfNotification",t);case 2:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"uninstall",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.clearCollectionInfo(t);case 2:return e.next=4,this.clearOnDemandCollectionInfo(t);case 4:return e.next=6,this.gc();case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"update",value:function(){var e=o()(h.a.mark(function e(t,r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.updateOnDemandCollectionInfo(t,r);case 2:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"clearCollectionInfo",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l,d,f,p,_,v,E,y,m,g=this,S=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=S.length>1&&void 0!==S[1]?S[1]:void 0,n=!(S.length>2&&void 0!==S[2])||S[2],this.validateParams(t),a=this._getLookupKeys(t),!n){e.next=39;break}return e.next=7,ce.default.getInstalledApps();case 7:if(e.t1=t.productCode,e.t2=s=e.sent[e.t1],e.t0=null!==e.t2,!e.t0){e.next=12;break}e.t0=void 0!==s;case 12:if(!e.t0){e.next=16;break}e.t3=s,e.next=17;break;case 16:e.t3={};case 17:return o=e.t3,e.next=20,this.updateParams(Object.values(o).map(function(e){var t=e;return t.InstallLanguage.split(",").map(function(e){return{productCode:t.SAPCode,productVersion:t.CodexVersion,productLanguage:e}})}).flat());case 20:i=e.sent,c=ue(i),e.prev=22,c.s();case 24:if((u=c.n()).done){e.next=31;break}if(l=u.value,JSON.stringify(this._getLookupKeys(l))!==JSON.stringify(a)){e.next=29;break}return this.log.context({params:t}).disk("Not uninstalling regular ".concat(t.productCode,"[").concat(t.productVersion,"] because a competing key software still exists.")),e.abrupt("return");case 29:e.next=24;break;case 31:e.next=36;break;case 33:e.prev=33,e.t4=e.catch(22),c.e(e.t4);case 36:return e.prev=36,c.f(),e.finish(36);case 39:if(d=this._data.versionInfo,f=!1,p=[["root",d]],a.forEach(function(e){d&&d[e]?(d=d[e],p.push([e,d])):f=!0}),!f&&0!==p.length){e.next=45;break}return e.abrupt("return");case 45:for(_=p.pop(),v=_[0],E=_[1],y=[],Object.keys(E).forEach(function(e){r?E[e]===r&&(delete E[e],y.push(r)):(y.push(E[e]),delete E[e])}),y.forEach(function(e){return delete g._data.metadata[e]});p.length>0&&0===Object.keys(E).length;)m=v,_=p.pop(),v=_[0],delete(E=_[1])[m];return e.next=53,this.save();case 53:case"end":return e.stop()}},e,this,[[22,33,36,39]])}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadManager",get:function(){return this._downloadManager}},{key:"type",get:function(){return this._type}},{key:"getCachedRequestData",value:function(){var e=this,t={};return Object.keys(this._data.metadata).forEach(function(r){var n=e._data.metadata[r];if(n.userId===O.default.getUserId()){var a=n.params;if(a&&a.productCode&&a.productVersion){t[a.productCode]||(t[a.productCode]={});!function(e){t[e.productCode][e.productVersion]||(t[e.productCode][e.productVersion]=[]),t[e.productCode][e.productVersion].push(e)}(n.params)}}}),t}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=JSON.parse(JSON.stringify(t)),e.next=3,j.a.getOSLocale();case 3:return a=e.sent,s=(null===(r=O.default.getUserInfo())||void 0===r?void 0:r.countryCode)||(null==a?void 0:a.split("_")[1]),n.forEach(function(e){e.productLanguage=e.productLanguage||a,e.countryCode=e.countryCode||s,e.productCode&&(e.productCode=v.default.getProductAlias(e.productCode))}),e.abrupt("return",n);case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"getClientVersion",value:function(e,t){return v.default.ccxVersionToString(e)}},{key:"targetDetails",value:function(e){return e}},{key:"diskLock",get:function(){return this._diskLock}},{key:"clientDir",get:function(){var e=A.join(_.default.get("ROOT_DIR"),_.default.get("DIR",this.type));return e=A.join(e,_.default.get("FILE_ACCESSOR_WRITE_FOLDER"))}},{key:"assetsDir",get:function(){return A.join(_.default.get("ROOT_DIR"),_.default.get("DIR",this.type),_.default.get("ASSETS_DIRNAME"))+"/"}},{key:"_getOnDemandLookupKeys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._getLookupKeys(e,t)}},{key:"getOnDemandCollection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){var r=this._getOnDemandLookupKeys(e,t),n=this._data.onDemand;return r.forEach(function(e){n&&(n=n[e])}),n}var a=new P.default(m.default.DATA_VALIDATION_ERR,"No data to get collection for in LookupMap.");this.log.error(a)}},{key:"getOnDemandCollectionInfo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.getOnDemandCollection(e,t);if(r)return r[this.paramsToOnDemandId(e)]}},{key:"paramsToOnDemandId",value:function(e){return(null==e?void 0:e.url)||(null==e?void 0:e.id)}},{key:"addOnDemandCollectionInfo",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l,d,f,p,_,v,E,y,m;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.state,a=t.updateLastUseTime,s=void 0!==a&&a,o=t.expiry,i=t.retry,c=t.cause,!(u=this.paramsToOnDemandId(r))){e.next=11;break}p=this._getOnDemandLookupKeys(r),_=this._data.onDemand,v=ue(p);try{for(v.s();!(E=v.n()).done;)m=E.value,_[m]=null!==(y=_[m])&&void 0!==y?y:{},_=_[m]}catch(e){v.e(e)}finally{v.f()}return _[u]=n,this._data.onDemandMetadata[u]={userId:O.default.getUserId(),params:r,lastUseTime:s?(new Date).toISOString():null===(l=this._data)||void 0===l?void 0:null===(d=l.onDemandMetadata)||void 0===d?void 0:null===(f=d[u])||void 0===f?void 0:f.lastUseTime,expiryTime:null==o?void 0:o.toISOString(),retry:i,cause:c},e.next=11,this.save();case 11:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_getOnDemandAssetList",value:function(){var e=o()(h.a.mark(function e(){var t,r,n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={},Object.values((null===(t=this._data)||void 0===t?void 0:t.onDemandMetadata)||{}).forEach(function(e){var t,a=n.paramsToOnDemandId(e.params),s=null===(t=n._data.assetMetadata[a])||void 0===t?void 0:t.path;s&&(r[s]=!0)}),e.abrupt("return",r);case 3:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"_fetchOnDemandContent",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.force,a=t.priority,s=this.paramsToOnDemandId(r)){e.next=4;break}throw new Error(m.default.DATA_VALIDATION_ERR);case 4:return e.next=6,this.fetchAsset({href:s,assetsDir:this.assetsDir,force:n,priority:a,params:r});case 6:return e.abrupt("return",e.sent.path);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"updateOnDemandCollectionInfo",value:function(){var e=o()(h.a.mark(function e(t,r){var n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.validateParams(r),this.validateParams(t),Object.keys(this._data.onDemand).forEach(function(e){var a=n.getOnDemandCollection(t,e);if(a){var s,o=n._getOnDemandLookupKeys(r),i=n._data.onDemand,c=ue(o);try{for(c.s();!(s=c.n()).done;){var u,l=s.value;i[l]=null!==(u=i[l])&&void 0!==u?u:{},i=i[l]}}catch(e){c.e(e)}finally{c.f()}Object.keys(a).forEach(function(e){n._data.onDemandMetadata[e]&&(n._data.onDemandMetadata[e].params=Object.assign(n._data.onDemandMetadata[e].params,r)),i[e]=a[e]})}}),e.next=6,this.save();case 6:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"clearOnDemandCollectionInfo",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l,d,f,p,_,v,E,y,m,g=this,S=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=S.length>1&&void 0!==S[1]?S[1]:void 0,n=!(S.length>2&&void 0!==S[2])||S[2],this.validateParams(t),a=this._getOnDemandLookupKeys(t),!n){e.next=39;break}return e.next=7,ce.default.getInstalledApps();case 7:if(e.t1=t.productCode,e.t2=s=e.sent[e.t1],e.t0=null!==e.t2,!e.t0){e.next=12;break}e.t0=void 0!==s;case 12:if(!e.t0){e.next=16;break}e.t3=s,e.next=17;break;case 16:e.t3={};case 17:return o=e.t3,e.next=20,this.updateParams(Object.values(o).map(function(e){var t=e;return t.InstallLanguage.split(",").map(function(e){return{productCode:t.SAPCode,productVersion:t.CodexVersion,productLanguage:e}})}).flat());case 20:i=e.sent,c=ue(i),e.prev=22,c.s();case 24:if((u=c.n()).done){e.next=31;break}if(l=u.value,JSON.stringify(this._getOnDemandLookupKeys(l))!==JSON.stringify(a)){e.next=29;break}return this.log.context({params:t}).disk("Not uninstalling on demand ".concat(t.productCode,"[").concat(t.productVersion,"] because a competing key software still exists.")),e.abrupt("return");case 29:e.next=24;break;case 31:e.next=36;break;case 33:e.prev=33,e.t4=e.catch(22),c.e(e.t4);case 36:return e.prev=36,c.f(),e.finish(36);case 39:if(d=this._data.onDemand,f=!1,p=[["root",d]],a.forEach(function(e){d&&d[e]?(d=d[e],p.push([e,d])):f=!0}),!f&&0!==p.length){e.next=45;break}return e.abrupt("return");case 45:for(_=p.pop(),v=_[0],E=_[1],y=[],Object.keys(E).forEach(function(e){r?e===r&&(delete E[e],y.push(r)):(y.push(e),delete E[e])});p.length>0&&0===Object.keys(E).length;)m=v,_=p.pop(),v=_[0],delete(E=_[1])[m];return y.forEach(function(e){g.getOnDemandCollectionInfo(g._data.onDemandMetadata[e].params)||delete g._data.onDemandMetadata[e]}),e.next=53,this.save();case 53:case"end":return e.stop()}},e,this,[[22,33,36,39]])}));return function(t){return e.apply(this,arguments)}}()},{key:"syncOnDemandAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.default.waitAll(Object.values((null===(t=this._data)||void 0===t?void 0:t.onDemandMetadata)||{}).map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!v.default.hasBeenUsedRecently(t.lastUseTime)||"paused"===r.getOnDemandCollectionInfo(t.params)){e.next=3;break}return e.next=3,r.getOnDemandData({params:t.params,force:{type:"stale",depth:999}});case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"isOnDemandSyncInProgress",value:function(e){var t=this.fetchOnDemandContent.cache&&this.fetchOnDemandContent.cache.get(e);return t&&"pending"===t.state}},{key:"getOnDemandAssetPath",value:function(e){var t,r,n;return e.url?null===(t=this._data)||void 0===t?void 0:null===(r=t.assetMetadata)||void 0===r?void 0:null===(n=r[e.url])||void 0===n?void 0:n.path:void 0}},{key:"getOnDemandData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,_,E,y,g,S,O,T,A,I,R,C=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.params,a=void 0===n?{}:n,s=t.force,i=void 0===s?{type:"none"}:s,c=t.updateLastUseTime,u=void 0!==c&&c,l=t.priorityLevel,d=void 0===l?L.c.Regular:l,f=this.paramsToOnDemandId(a)){e.next=6;break}throw p=new P.default(m.default.DATA_VALIDATION_ERR,"Cannot generate key from parameters."),this.log.error(p),p;case 6:if(this.abortControllers[f]=this.abortControllers[f]||new se.a,_=this.priority({params:a,key:f,level:d}),this._downloadManager.prioritize(_),this.getOnDemandCollectionInfo(a)){e.next=14;break}return e.next=12,this.addOnDemandCollectionInfo(fe({params:a,state:"notReady",updateLastUseTime:u},this._calculateBackOffMetadata({updateBackOff:!1,metadata:null===(E=this._data)||void 0===E?void 0:E.onDemandMetadata[f]})));case 12:e.next=19;break;case 14:if(!(g=null===(y=this._data)||void 0===y?void 0:y.onDemandMetadata[f])||v.default.isDateExpired(g.expiryTime)||"none"!==i.type){e.next=19;break}throw S="Waiting for back-off ".concat(g.cause," for ").concat(v.default.getHumanReadableTime(g.retry||0)," expiring ").concat(g.expiryTime," in ").concat(v.default.getHumanReadableTime(new Date(g.expiryTime).getTime()-Date.now())),this.log.context({params:a}).disk(S),new P.default(S).silence();case 19:if(O=a&&a.url&&this._data.assetMetadata[null===(r=a)||void 0===r?void 0:r.url],T=i&&"always"===i.type||"ready"!=this.getOnDemandCollectionInfo(a)||O&&v.default.getTimeToExpiry(O.expiry)<=0,!(A=T?void 0:this.getOnDemandAssetPath(a))){e.next=25;break}e.next=38;break;case 25:if(this.isOnDemandSyncInProgress(f)){e.next=35;break}return I={assets:{}},R=function(e){Object.assign(I.assets,e),C.emit(f,I)},this.on("Asset-".concat(f),R),e.next=31,this._syncLock.read(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,C.log.context({payload:{"ccxp.mode":"on-demand","event.subtype":"api","ccxp.request_type":"get","event.url":a.url,"content.id":a.id}}).request(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,C.updateParams([a]);case 2:return a=e.sent[0],e.next=5,C._fetchOnDemandContent({params:a,force:i,priority:_}).catch(function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t instanceof oe.AbortError){e.next=5;break}return e.next=3,C.addOnDemandCollectionInfo(fe({params:a,state:"notReady"},C._calculateBackOffMetadata({metadata:null===(r=C._data)||void 0===r?void 0:r.onDemandMetadata[f],error:t})));case 3:C.log.error(new P.default("Error getting on demand data",t)),C._scheduleNextSyncJob();case 5:throw t;case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}},e)})));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)})),_);case 31:A=e.sent,this.off("Asset-".concat(f),R),e.next=38;break;case 35:return e.next=37,this._fetchOnDemandContent({params:a,force:i,priority:_});case 37:A=e.sent;case 38:return e.next=40,this.addOnDemandCollectionInfo({params:a,state:"ready",updateLastUseTime:u});case 40:return delete this.abortControllers[f],e.abrupt("return",A);case 42:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"onDemandAbort",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=s.length>0&&void 0!==s[0]?s[0]:{},n=this.paramsToOnDemandId(r)){e.next=6;break}throw a=new Error(m.default.DATA_VALIDATION_ERR),this.log.error(new P.default("Cannot generate key from parameters.",a)),a;case 6:if(null===(t=this.abortControllers[n])||void 0===t||t.abort(),!this.isOnDemandSyncInProgress(n)){e.next=10;break}return e.next=10,this.getOnDemandData({params:r});case 10:"notReady"===this.getOnDemandCollectionInfo(r)&&this.addOnDemandCollectionInfo({params:r,state:"paused",updateLastUseTime:!1}),delete this.abortControllers[n];case 12:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(ne);function _e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ve(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_e(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Ee=function(){function e(t,r){c()(this,e),f()(this,"_id",void 0),f()(this,"_lookupMap",void 0),f()(this,"_diskLock",void 0),f()(this,"log",void 0),f()(this,"_fileName",void 0),f()(this,"_data",void 0),this._id=t,this._lookupMap=r,this._diskLock=r.diskLock,this.log=new E.default({prefix:"".concat(_.default.get("LOG_PREFIX",r.type),"Data > "),payload:{"event.subcategory":_.default.get("ANALYTICS_SUBCATEGORY",r.type)}}),this._fileName="".concat(this._id,".json")}return l()(e,[{key:"setData",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!e)return new P.default(m.default.MISSING_DATA,"No data to set for ".concat(this._lookupMap.type));var r,n=this.validateData(e,t);n?this.log.error(m.default.DATA_VALIDATION_ERR,new P.default("[Collection]: Invalid data: ".concat(JSON.stringify(null===(r=n[0])||void 0===r?void 0:r.message)))):this._data=e;return n}},{key:"fileName",get:function(){return this._fileName}},{key:"assetsDir",get:function(){return A.join(_.default.get("ROOT_DIR"),_.default.get("DIR",this._lookupMap.type),_.default.get("ASSETS_DIRNAME"))+"/"}},{key:"hasValidCards",value:function(e){return!0}},{key:"id",get:function(){return this._id}},{key:"expiryTime",get:function(){return this._data&&this._data.expirationDTS}},{key:"upgrade",value:function(){var e=o()(h.a.mark(function e(t,r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null);case 1:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"load",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.version,n=t.skipSaving,a=t.file,this._fileName=null!=a?a:this._fileName,e.next=4,T.readJson(this._lookupMap.getPath()+this._fileName);case 4:if(s=e.sent,o=!1,s){e.next=8;break}throw new P.default(m.default.DATA_VALIDATION_ERR,"Failure to load collection JSON");case 8:if(i=s._ccx&&s._ccx.version||s.version,c=_.default.get("LOOKUP_COLLECTION_FILE_VERSION",this._lookupMap.type),!s||i===c){e.next=18;break}return this.log.disk("Collection File mismatch. File ".concat(this._fileName," with version:").concat(i," vs version from lookup:").concat(c)),e.next=14,this.upgrade(s,r).catch(function(e){return null});case 14:if(s=e.sent){e.next=17;break}throw new P.default(m.default.INVALID_COLLECTION,"Required Collection Lookup file upgrade not available for ".concat(this._lookupMap.type," - ").concat(i,":").concat(c),m.default.INVALID_COLLECTION);case 17:o=!0;case 18:if(!(u=this.setData(s,r))){e.next=21;break}throw u;case 21:if(u||!o||n){e.next=24;break}return e.next=24,this.save();case 24:return e.abrupt("return",this);case 25:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"save",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._data){e.next=2;break}throw new Error("No data to save");case 2:return e.next=4,this._diskLock.write(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,N.writeJsonAtomic(r._lookupMap.getPath(),r._fileName,r._data,!0);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)})));case 4:t=e.sent,this._fileName=A.basename(t);case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"logFailures",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:Object.keys(null!==(r=null==this?void 0:null===(n=this._data)||void 0===n?void 0:n.surfaces)&&void 0!==r?r:{}).forEach(function(e){var t;((null===(t=a._data.surfaces[e||""])||void 0===t?void 0:t.failedContainers)||[]).forEach(function(t){t&&e&&a.log.disk("Sophia Surface Error (".concat(t.errorCode,"): ").concat(t.errorMessage," - ").concat(e,"(").concat(t.containerId,")"))})});case 1:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"sync",value:function(){var e=o()(h.a.mark(function e(t){var r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._data){e.next=2;break}throw new P.default(_.default.analytics.MISSING_DATA,"No data to sync");case 2:return this.logFailures((null==t?void 0:t.params)||{}),e.next=5,this.syncData(ve(ve({},t),{},{progress:function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.save();case 2:t.progress&&t.progress(n);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()})).finally(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.save();case 2:case"end":return e.stop()}},e)})));case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"isDefaultData",get:function(){return!!(this._data&&this._data._ccx&&this._data._ccx.isDefault)}},{key:"totalItems",get:function(){var e;return null!==(e=this._data)&&void 0!==e&&e.surfaces?Object.keys(this._data.surfaces).length:0}},{key:"data",get:function(){return this._data}},{key:"validateData",value:function(e,t){return null}}]),e}();function ye(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function me(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ye(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var ge=function(){function e(t,r){c()(this,e),f()(this,"lock",void 0),f()(this,"log",void 0),f()(this,"assetsDir",void 0),this.log=new E.default({prefix:"".concat(_.default.get("LOG_PREFIX",t),"DataManager"),payload:{"event.subcategory":_.default.get("ANALYTICS_SUBCATEGORY",t)}}),this.assetsDir=A.join(_.default.get("ROOT_DIR"),_.default.get("DIR",t),_.default.get("ASSETS_DIRNAME"))+"/",this.lock=r}return l()(e,[{key:"downloadAemCollectionTemplateData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,E,y=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.card,n=t.lookupMap,a=t.priority,t.bundle,s=t.params,i=t.started,c=t.force,u=0,l=0,d={},f="",p="",!("URL"===r.dataType&&r.data||r.contentURL)){e.next=22;break}return p="URL"===r.dataType&&r.data?"data":"contentURL",e.next=9,n.fetchAsset({href:r[p],assetsDir:this.assetsDir,priority:a,params:s,force:me(me({},c),{},{depth:(c.depth||0)-1})});case 9:if(e.t0=e.sent,e.t0){e.next=12;break}e.t0={};case 12:return E=e.t0,u++,l+=E.time,f=A.basename(E.path),e.next=18,T.readJson("".concat(this.assetsDir,"/").concat(f));case 18:d=e.sent,r.path=E.path,e.next=34;break;case 22:if("application/json"!==r.dataType||!r.data){e.next=33;break}return d=JSON.parse(r.data),f=n.generateId(s)+".json",e.t1=A,e.next=28,N.writeJsonAtomic(this.assetsDir,f,d,!0);case 28:e.t2=e.sent,f=e.t1.basename.call(e.t1,e.t2),r.path=_.default.get("ASSETS_DIRNAME")+"/"+f,e.next=34;break;case 33:return e.abrupt("return",{totalTime:l,count:u});case 34:if(i(),!d.data){e.next=37;break}return e.delegateYield(h.a.mark(function e(){var t,i,E,m,g,S;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=new P.default(_.default.analytics.AGGREGATE_ERROR,"AEM"+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),i=0,E=Object.values(d.data);case 2:if(!(i<E.length)){e.next=10;break}if(g=E[i],!Array.isArray(null===(m=g.item)||void 0===m?void 0:m.templateCollections)){e.next=7;break}return e.next=7,v.default.waitAll(null===(S=g.item)||void 0===S?void 0:S.templateCollections.map(function(){var e=o()(h.a.mark(function e(r){var o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.collectionId){e.next=6;break}return e.next=3,V.downloadStockCollection({id:r.collectionId,options:r.options,priority:a,params:s,force:me(me({},c),{},{depth:(c.depth||0)-2}),map:n}).catch(function(e){return t.addSubError({err:e,url:r._publishUrl,id:r._path}),{path:void 0,time:0}});case 3:o=e.sent,r.path=o.path,o.time&&(u++,l+=o.time);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())).finally(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y.lock.write(o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=A.basename(y.assetsDir)+"/",e.t1=A,e.next=4,N.writeJsonAtomic(y.assetsDir,f,d,!0);case 4:if(e.t2=e.sent,e.t3=e.t1.basename.call(e.t1,e.t2),r.path=e.t0+e.t3,!(p.length>0)){e.next=13;break}if((null===(t=n.cachedAsset(r[p]))||void 0===t?void 0:t.path)===r.path||!n.cachedAsset(r[p])){e.next=13;break}return n.cachedAsset(r[p]).path=r.path,e.next=13,n.save();case 13:case"end":return e.stop()}},e)})));case 2:case"end":return e.stop()}},e)})));case 7:i++,e.next=2;break;case 10:if(!t.hasSubErrors){e.next=12;break}throw t;case 12:case"end":return e.stop()}},e)})(),"t3",37);case 37:return e.abrupt("return",{totalTime:l,count:u});case 38:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadAEMData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,E,y=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.card,n=t.lookupMap,a=t.priority,t.bundle,s=t.params,i=t.started,c=t.force,u=0,l=0,d={},f="",p="",!("URL"===r.dataType&&r.data||r.contentURL)){e.next=23;break}return p="URL"===r.dataType&&r.data?"data":"contentURL",e.next=9,n.fetchAsset({href:r[p],assetsDir:this.assetsDir,priority:a,params:s,force:me(me({},c),{},{depth:(c.depth||0)-1})});case 9:if(e.t0=e.sent,e.t0){e.next=12;break}e.t0={};case 12:return E=e.t0,u++,l+=E.time,f=A.basename(E.path),e.next=18,T.readJson("".concat(this.assetsDir,"/").concat(f));case 18:d=e.sent,r.path=E.path,r.content=d,e.next=36;break;case 23:if("application/json"!==r.dataType||!r.data){e.next=35;break}return d=JSON.parse(r.data),r.content=d,f=n.generateId(s)+".json",e.t1=A,e.next=30,N.writeJsonAtomic(this.assetsDir,f,d,!0);case 30:e.t2=e.sent,f=e.t1.basename.call(e.t1,e.t2),r.path=_.default.get("ASSETS_DIRNAME")+"/"+f,e.next=36;break;case 35:return e.abrupt("return",{totalTime:l,count:u});case 36:if(i(),!d.data){e.next=39;break}return e.delegateYield(h.a.mark(function e(){var t,i,E,m;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=new P.default(_.default.analytics.AGGREGATE_ERROR,"AEM"+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),i=0,E=Object.values(d.data);case 2:if(!(i<E.length)){e.next=10;break}if(m=E[i],!Array.isArray(m._references)){e.next=7;break}return e.next=7,v.default.waitAll(m._references.map(function(){var e=o()(h.a.mark(function e(r){var o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!r._publishUrl){e.next=6;break}return e.next=3,n.fetchAsset({href:r._publishUrl,assetsDir:y.assetsDir,priority:a,params:s,force:me(me({},c),{},{depth:(c.depth||0)-2})}).catch(function(e){return t.addSubError({err:e,url:r._publishUrl,id:r._path}),{path:void 0,time:0}});case 3:o=e.sent,r.path=o.path,o.time&&(u++,l+=o.time);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())).finally(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y.lock.write(o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=A.basename(y.assetsDir)+"/",e.t1=A,e.next=4,N.writeJsonAtomic(y.assetsDir,f,d,!0);case 4:if(e.t2=e.sent,e.t3=e.t1.basename.call(e.t1,e.t2),r.path=e.t0+e.t3,!(p.length>0)){e.next=13;break}if((null===(t=n.cachedAsset(r[p]))||void 0===t?void 0:t.path)===r.path||!n.cachedAsset(r[p])){e.next=13;break}return n.cachedAsset(r[p]).path=r.path,e.next=13,n.save();case 13:case"end":return e.stop()}},e)})));case 2:case"end":return e.stop()}},e)})));case 7:i++,e.next=2;break;case 10:if(!t.hasSubErrors){e.next=12;break}throw t;case 12:case"end":return e.stop()}},e)})(),"t3",39);case 39:return e.abrupt("return",{totalTime:l,count:u});case 40:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"passThroughContent",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.card,n=t.lookupMap,t.priority,t.bundle,a=t.params,s=t.started,t.force,o=0,i=0,u="",s(),l=new P.default(_.default.analytics.AGGREGATE_ERROR,"PASS"+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),e.prev=4,c={data:r.data},u=n.generateId(a)+".json",e.t0=A,e.next=10,N.writeJsonAtomic(this.assetsDir,u,c,!0);case 10:e.t1=e.sent,u=e.t0.basename.call(e.t0,e.t1),r.path=_.default.get("ASSETS_DIRNAME")+"/"+u,o++,e.next=19;break;case 16:e.prev=16,e.t2=e.catch(4),l.addSubError({err:e.t2,url:r.data});case 19:if(!l.hasSubErrors){e.next=21;break}throw l;case 21:return e.abrupt("return",{totalTime:i,count:o});case 22:case"end":return e.stop()}},e,this,[[4,16]])}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadIndexFileData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,E,y,m,g,S,O=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.card,s=t.lookupMap,i=t.priority,t.bundle,c=t.params,u=t.started,l=t.force,d=0,f=0,p={},E="",y="",!("URL"===a.dataType&&a.data||a.contentURL)){e.next=22;break}return y="URL"===a.dataType&&a.data?"data":"contentURL",e.next=9,s.fetchAsset({href:a[y],assetsDir:this.assetsDir,priority:i,params:c,force:me(me({},l),{},{depth:(l.depth||0)-1})});case 9:if(e.t0=e.sent,e.t0){e.next=12;break}e.t0={};case 12:return m=e.t0,d++,f+=m.time,E=A.basename(m.path),e.next=18,T.readJson("".concat(this.assetsDir,"/").concat(E));case 18:p=e.sent,a.path=m.path,e.next=34;break;case 22:if("application/json"!==a.dataType||!a.data){e.next=33;break}return p=JSON.parse(a.data),E=s.generateId(c)+".json",e.t1=A,e.next=28,N.writeJsonAtomic(this.assetsDir,E,p,!0);case 28:e.t2=e.sent,E=e.t1.basename.call(e.t1,e.t2),a.path=_.default.get("ASSETS_DIRNAME")+"/"+E,e.next=34;break;case 33:return e.abrupt("return",{totalTime:f,count:d});case 34:if(u(),g=new P.default(_.default.analytics.AGGREGATE_ERROR,"DP Index"+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),null===(r=p)||void 0===r||!r.paths){e.next=43;break}return p._assetPaths={},S=Object.keys(p.paths),e.next=41,v.default.waitAll(S.map(function(){var e=o()(h.a.mark(function e(t){var r,n,a,o,u;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(r=p)||void 0===r||null===(n=r.paths)||void 0===n||!n[t]){e.next=6;break}return e.next=3,s.fetchAsset({href:null===(a=p)||void 0===a?void 0:null===(o=a.paths)||void 0===o?void 0:o[t],assetsDir:O.assetsDir,priority:i,params:c,force:me(me({},l),{},{depth:(l.depth||0)-2})}).catch(function(e){var r,n;return g.addSubError({err:e,url:null===(r=p)||void 0===r?void 0:null===(n=r.paths)||void 0===n?void 0:n[t]}),{path:void 0,time:0,count:0}});case 3:(u=e.sent).path&&(p._assetPaths[t]=u.path),u.time&&(d++,f+=u.time);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())).finally(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O.lock.write(o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=A.basename(O.assetsDir)+"/",e.t1=A,e.next=4,N.writeJsonAtomic(O.assetsDir,E,p,!0);case 4:if(e.t2=e.sent,e.t3=e.t1.basename.call(e.t1,e.t2),a.path=e.t0+e.t3,!(y.length>0)){e.next=13;break}if((null===(t=s.cachedAsset(a[y]))||void 0===t?void 0:t.path)===a.path||!s.cachedAsset(a[y])){e.next=13;break}return s.cachedAsset(a[y]).path=a.path,e.next=13,s.save();case 13:case"end":return e.stop()}},e)})));case 2:case"end":return e.stop()}},e)})));case 41:e.next=47;break;case 43:if(null===(n=p)||void 0===n||!n.toolTechniques){e.next=47;break}return p._toolTechniquesPaths={},e.next=47,v.default.waitAll(p.toolTechniques.map(function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,V.downloadTutorial({params:c,id:t,priority:i,force:l,analyticsData:{},filePrefix:"DP",status:c.status||"live",map:s}).catch(function(e){return g.addSubError({err:e,id:t}),{path:void 0,time:0,count:0}});case 2:(r=e.sent).path&&(p._toolTechniquesPaths[t]=r.path),f+=r.time,d+=r.count;case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())).finally(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O.lock.write(o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=A.basename(O.assetsDir)+"/",e.t1=A,e.next=4,N.writeJsonAtomic(O.assetsDir,E,p,!0);case 4:if(e.t2=e.sent,e.t3=e.t1.basename.call(e.t1,e.t2),a.path=e.t0+e.t3,!(y.length>0)){e.next=13;break}if((null===(t=s.cachedAsset(a[y]))||void 0===t?void 0:t.path)===a.path||!s.cachedAsset(a[y])){e.next=13;break}return s.cachedAsset(a[y]).path=a.path,e.next=13,s.save();case 13:case"end":return e.stop()}},e)})));case 2:case"end":return e.stop()}},e)})));case 47:if(!g.hasSubErrors){e.next=49;break}throw g;case 49:return e.abrupt("return",{totalTime:f,count:d});case 50:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadContentfulData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,_,E,y=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.card,n=t.lookupMap,a=t.priority,s=t.urlKey,i=t.bundle,c=t.params,u=t.started,l=t.force,r[s]&&0!==r[s].length){e.next=3;break}return e.abrupt("return",{count:0,totalTime:0});case 3:return d=0,f=0,e.next=6,n.fetchAsset({href:r[s],assetsDir:this.assetsDir,priority:a,params:c,force:me(me({},l),{},{depth:(l.depth||0)-1})});case 6:if(e.t0=e.sent,e.t0){e.next=9;break}e.t0={};case 9:return p=e.t0,d++,f+=p.time,_=A.basename(p.path),e.next=15,T.readJson("".concat(this.assetsDir,"/").concat(_));case 15:if(E=e.sent,i&&(r.content=E),r.path=p.path,u(),!E.includes||!Array.isArray(E.includes.Asset)){e.next=22;break}return e.next=22,v.default.waitAll(E.includes.Asset.map(function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t.fields&&t.fields.file&&t.fields.file.url)){e.next=6;break}return e.next=3,n.fetchAsset({href:t.fields.file.url,assetsDir:y.assetsDir,priority:a,params:c,force:me(me({},l),{},{depth:(l.depth||0)-2})});case 3:r=e.sent,t.fields.file.path=r.path,r.time&&(d++,f+=r.time);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())).finally(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y.lock.write(o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=A.basename(y.assetsDir)+"/",e.t1=A,e.next=4,N.writeJsonAtomic(y.assetsDir,_,E,!0);case 4:if(e.t2=e.sent,e.t3=e.t1.basename.call(e.t1,e.t2),r.path=e.t0+e.t3,(null===(t=n.cachedAsset(r[s]))||void 0===t?void 0:t.path)===r.path||!n.cachedAsset(r[s])){e.next=12;break}return n.cachedAsset(r[s]).path=r.path,e.next=12,n.save();case 12:case"end":return e.stop()}},e)})));case 2:case"end":return e.stop()}},e)})));case 22:return e.abrupt("return",{count:d,totalTime:f});case 23:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadLegacyData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.card,n=t.lookupMap,a=t.priority,s=t.params,r.backgroundImage&&0!==r.backgroundImage.length){e.next=3;break}return e.abrupt("return",{count:0,totalTime:0});case 3:return o=null,e.prev=4,e.next=7,n.fetchAsset({href:r.backgroundImage,assetsDir:this.assetsDir,priority:a,params:s});case 7:i=e.sent,o=i.path,e.next=22;break;case 11:if(e.prev=11,e.t0=e.catch(4),404!==e.t0.statusCode||0===r.backgroundImage.indexOf("1000x560")){e.next=21;break}return r.backgroundImage=r.backgroundImage.replace("1000x560","730x280"),e.next=17,n.fetchAsset({href:r.backgroundImage,assetsDir:this.assetsDir,priority:a});case 17:i=e.sent,o=i.path,e.next=22;break;case 21:throw e.t0;case 22:return r.backgroundImageLocalpath=o,e.abrupt("return",{count:1,totalTime:i.time});case 24:case"end":return e.stop()}},e,this,[[4,11]])}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l,d,f,p;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=t.modeID,n=t.card,a=t.lookupMap,s=t.priority,o=t.bundle,i=void 0!==o&&o,c=t.params,u=void 0===c?{}:c,l=t.started,d=void 0===l?function(){}:l,f=t.force,p=void 0===f?{type:"none"}:f,e.prev=1,e.t0=r,e.next="CCX_Start_2.5_Learn"===e.t0?5:"CCX_Start_2.5_Toast"===e.t0?5:"CCX_Start_2.5_Home"===e.t0?5:"firstrun"===e.t0?8:"footer"===e.t0?8:"learn"===e.t0?8:"discover"===e.t0?8:"trial"===e.t0?8:"openDoc"===e.t0?8:"welcome"===e.t0?8:"CCX_Start_3.0_Learn"===e.t0?11:"CCX_Start_3.0_Home"===e.t0?11:"CCX_Start_3.0_Toast"===e.t0?11:"ACCC_ALL_APPS_BANNERS"===e.t0?11:"ACCC_CATEGORIES_BANNERS"===e.t0?11:"ACCC_APPS_CATALOG"===e.t0?11:"ACCC_APP_SKELETON"===e.t0?11:"CCX_Start_3.1_Learn"===e.t0?11:"CCX_Start_3.1_Toast"===e.t0?11:"CCX_Start_3.1_Home"===e.t0?11:"CCX_Start_3.1_Whats_New"===e.t0?11:"Discover_Panel"===e.t0?14:"DP_Tool_Techniques_v1"===e.t0?14:"payment_notification_banner"===e.t0?17:"CCX_Start_5.11_Stock"===e.t0?20:"CCX_Start_4.0_Home"===e.t0?23:"CCX_Start_4.0_Whats_New"===e.t0?23:"CCX_Start_4.0_Toast"===e.t0?23:"CCD_ALL_APPS_BANNERS"===e.t0?23:"CCD_APP_SKELETON"===e.t0?23:(e.t0,23);break;case 5:return e.next=7,this.downloadContentfulData({card:n,lookupMap:a,priority:s,urlKey:"contentURL",bundle:i,params:u,started:d,force:p});case 7:return e.abrupt("return",e.sent);case 8:return e.next=10,this.downloadLegacyData({card:n,lookupMap:a,priority:s,params:u});case 10:return e.abrupt("return",e.sent);case 11:return e.next=13,this.downloadContentfulData({card:n,lookupMap:a,priority:s,urlKey:"data",bundle:i,params:u,started:d,force:p});case 13:return e.abrupt("return",e.sent);case 14:return e.next=16,this.downloadIndexFileData({card:n,lookupMap:a,priority:s,bundle:i,params:u,started:d,force:p});case 16:return e.abrupt("return",e.sent);case 17:return e.next=19,this.passThroughContent({card:n,lookupMap:a,priority:s,bundle:i,params:u,started:d,force:p});case 19:return e.abrupt("return",e.sent);case 20:return e.next=22,this.downloadAemCollectionTemplateData({card:n,lookupMap:a,priority:s,bundle:i,params:u,started:d,force:p});case 22:return e.abrupt("return",e.sent);case 23:return e.next=25,this.downloadAEMData({card:n,lookupMap:a,priority:s,bundle:i,params:u,started:d,force:p});case 25:return e.abrupt("return",e.sent);case 26:e.next=32;break;case 28:throw e.prev=28,e.t1=e.catch(1),this.log.disk("Error downloading content for ".concat(r," ").concat(e.t1,", ").concat(e.t1.stack,", card: ").concat(JSON.stringify(n),",")),e.t1;case 32:case"end":return e.stop()}},e,this,[[1,28]])}));return function(t){return e.apply(this,arguments)}}()},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(t,r,n){var a,s,i,c,u,l,d,p,_,E,y,m,g,S,O;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a={},!r.backgroundImageLocalpath){e.next=3;break}return e.abrupt("return",f()({},"".concat(r.backgroundImageLocalpath),!0));case 3:e.t0=t,e.next="CCX_Start_3.0_Learn"===e.t0?6:"CCX_Start_3.0_Home"===e.t0?6:"CCX_Start_3.0_Toast"===e.t0?6:"CCX_Start_2.5_Learn"===e.t0?6:"CCX_Start_2.5_Toast"===e.t0?6:"CCX_Start_2.5_Home"===e.t0?6:"ACCC_ALL_APPS_BANNERS"===e.t0?6:"ACCC_CATEGORIES_BANNERS"===e.t0?6:"ACCC_APPS_CATALOG"===e.t0?6:"ACCC_APP_SKELETON"===e.t0?6:"CCX_Start_3.1_Learn"===e.t0?6:"CCX_Start_3.1_Toast"===e.t0?6:"CCX_Start_3.1_Home"===e.t0?6:"CCX_Start_3.1_Whats_New"===e.t0?6:"Discover_Panel"===e.t0?15:"DP_Tool_Techniques_v1"===e.t0?15:"CCX_Start_5.11_Stock"===e.t0?26:"CCX_Start_4.0_Home"===e.t0?36:"CCX_Start_4.0_Whats_New"===e.t0?36:"CCX_Start_4.0_Toast"===e.t0?36:"CCD_ALL_APPS_BANNERS"===e.t0?36:"CCD_APP_SKELETON"===e.t0?36:"CCD_APPS_CATALOG"===e.t0?36:(e.t0,36);break;case 6:if(s=r.content,!r.path){e.next=13;break}return a[r.path]=!0,i=A.basename(r.path),e.next=12,T.readJson("".concat(this.assetsDir,"/").concat(i)).catch(function(){delete a[r.path]});case 12:s=e.sent;case 13:return s&&s.includes&&Array.isArray(s.includes.Asset)&&s.includes.Asset.forEach(function(e){e.fields&&e.fields.file&&e.fields.file.path&&(a[e.fields.file.path]=!0)}),e.abrupt("return",a);case 15:if(!r.path){e.next=25;break}return a[r.path]=!0,c=A.basename(r.path),e.next=20,T.readJson("".concat(this.assetsDir,"/").concat(c)).catch(function(){return delete a[r.path],{}});case 20:if(null!=(u=e.sent)&&u._assetPaths&&(Object.keys(u._assetPaths)||[]).forEach(function(e){a[u._assetPaths[e]]=!0}),null==u||!u._toolTechniquesPaths){e.next=25;break}return e.next=25,v.default.waitAll((Object.values(u._toolTechniquesPaths)||[]).map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Object,e.t1=a,e.next=4,null==n?void 0:n.getTutorialAssets(t);case 4:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 25:return e.abrupt("return",a);case 26:if(!r.path){e.next=35;break}return a[r.path]=!0,p=A.basename(r.path),e.next=31,T.readJson("".concat(this.assetsDir,"/").concat(p)).catch(function(){return delete a[r.path],{}});case 31:if(null==(_=e.sent)||null===(l=_.data)||void 0===l||null===(d=l.modalCollectionsByPath)||void 0===d||!d.item.templateCollections){e.next=35;break}return e.next=35,v.default.waitAll(null==_?void 0:null===(E=_.data)||void 0===E?void 0:E.modalCollectionsByPath.item.templateCollections.map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Object,e.t1=a,e.next=4,null==n?void 0:n.getCollectionAsset(t.path);case 4:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 35:return e.abrupt("return",a);case 36:if(!r.path){e.next=43;break}return a[r.path]=!0,y=A.basename(r.path),e.next=41,T.readJson("".concat(this.assetsDir,"/").concat(y)).catch(function(){return delete a[r.path],{}});case 41:if((m=e.sent)&&m.data)for(g=0,S=Object.values(m.data);g<S.length;g++)O=S[g],Array.isArray(O._references)&&O._references.forEach(function(e){e.path&&(a[e.path]=!0)});case 43:return e.abrupt("return",a);case 44:case"end":return e.stop()}},e,this)}));return function(t,r,n){return e.apply(this,arguments)}}()}]),e}();function Se(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Oe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Se(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Se(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Te(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var Ae=function(e){X()(r,e);var t=Te(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"cardDataManager",void 0),a.cardDataManager=new ge(n.type,a._lookupMap.diskLock),a}return l()(r,[{key:"validateData",value:function(e,t){var n;if(!e.cardControl)return B()(J()(r.prototype),"validateData",this).call(this,e,"");if(n=v.default.validateDataFields(e,_.default.get("CARDS_DATA_SCHEMA")[t],[_.default.get("CARDS_CONTROL_SCHEMA")]))return n;var a=[];return e.cardControl&&e.cardControl.forEach(function(t){var r=_.default.get("CARD_DATA_SCHEMA")[t.modeID];if(!r)return null;t.cardOrder.forEach(function(t){var s=e.cards[t];s&&(n=v.default.validateDataFields(s,r))&&(a=a.concat(n))})}),a.length>0?a:null}},{key:"upgrade",value:function(){var e=o()(h.a.mark(function e(t,r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("V3_0"!==r||!t||!t.cardControl){e.next=5;break}return this.log.disk("Invalidating Home Data: ".concat(this._fileName)),e.abrupt("return",null);case 5:if(t.version!==_.default.get("LOOKUP_COLLECTION_FILE_VERSION",this._lookupMap.type)){e.next=9;break}return e.abrupt("return",t);case 9:if(!t||2!==t.version){e.next=14;break}return t.version=_.default.get("LOOKUP_COLLECTION_FILE_VERSION",this._lookupMap.type),e.abrupt("return",t);case 14:return this.log.disk("Unsupported format, downloading new content: ".concat(this._fileName)),e.abrupt("return",null);case 16:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"syncDataPromises",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.analyticsParams,n=t.payload,a=t.surface,s=t.card,i=t.priority,c=t.params,u=t.started,l=t.force,e.next=3,this.log.context({payload:n,surfaceAnalytics:[Oe({surface:a},r)]}).time(function(){var e=o()(h.a.mark(function e(t){var r,n,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.cardDataManager.downloadData({modeID:a,card:s,lookupMap:d._lookupMap,priority:i,bundle:!0,params:c,started:u,force:l});case 2:r=e.sent,n=r.count,o=r.totalTime,t.appendPayload({"event.url":"URL"===s.dataType&&s.data||"","event.count":n,"event.value":o/(n||1),"exp.surface_id":"".concat(a,"(").concat(s.containerId,")")});case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"totalItems",get:function(){var e,t;return null!==(e=this._data)&&void 0!==e&&e.surfaces?Object.keys(this._data.surfaces).length:null!==(t=this._data)&&void 0!==t&&t.cardControl?this._data.cardControl.map(function(e){return e.modeID}).length:0}},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.priority,n=t.payload,a=t.params,s=t.progress,i=t.force,this._data){e.next=3;break}return e.abrupt("return");case 3:if(c={started:[],complete:[],failed:[]},u=new P.default(_.default.analytics.AGGREGATE_ERROR,_.default.get("AGGREGATE_TYPE",this._lookupMap.type)+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),l=[],!this._data.surfaces){e.next=10;break}Object.keys(this._data.surfaces).forEach(function(e){var t,f=!1;l.push(v.default.waitAll(null===(t=(d._data.surfaces[e].containers||[]).filter(function(e){return"URL"===e.dataType}))||void 0===t?void 0:t.map(function(){var t=o()(h.a.mark(function t(o){return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d.syncDataPromises({analyticsParams:o.containerAnalyticsData,payload:n,surface:e,card:o,priority:r,params:a,force:i,started:function(){c.started.includes(e)||(c.started.push(e),s(Object.assign({},c)))}}).catch(function(t){f=!0,u.addSubError(Oe(Oe({surface:e,url:o.data},o.containerAnalyticsData),{},{err:t}))});case 2:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())).then(function(){c.started.includes(e)||c.started.push(e),f?c.failed.push(e):c.complete.push(e),s(Object.assign({},c))}))}),e.next=15;break;case 10:if(!this._data.cardControl){e.next=14;break}this._data.cardControl.forEach(function(e){l.push(v.default.waitAll(e.cardOrder.map(function(){var t=o()(h.a.mark(function t(o,u){var l;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(l=d._data.cards[o])){t.next=4;break}return t.next=4,d.syncDataPromises({analyticsParams:e.containerAnalyticsParams&&e.containerAnalyticsParams[u],payload:n,surface:e.modeID,card:l,priority:r,params:a,force:i,started:function(){c.started.includes(e.modeID)||(c.started.push(e.modeID),s(Object.assign({},c)))}});case 4:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}())).then(function(){c.started.includes(e.modeID)||c.started.push(e.modeID),c.complete.push(e.modeID),s(Object.assign({},c))}))}),e.next=15;break;case 14:return e.abrupt("return");case 15:return e.next=17,v.default.waitAll(l);case 17:if(!u.hasSubErrors){e.next=19;break}throw u;case 19:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"hasValidCards",value:function(){var e=_.default.get("ACTIVE_VERSIONS"),t=_.default.get("SUPPORTED_ACTIVE_VERSIONS"),r=e.slice(-1*t),n=v.default.ccxVersionToString(this._data);if(!r.includes(n))return!0;var a=_.default.get("HOME_SURFACE_ID",n);return["V1","V2","V2_5"].includes(n)?!!this._data.cardControl.find(function(e){return e.modeID===a}):!!Object.keys(this._data.surfaces).includes(a)}},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},!this._data||!this._data.surfaces){e.next=6;break}return e.next=4,v.default.waitAll(Object.keys(this._data.surfaces).map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.default.waitAll((r._data.surfaces[n].containers||[]).map(function(){var e=o()(h.a.mark(function e(a){var s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.cardDataManager.getReferencedAssets(n,a);case 2:s=e.sent,Object.assign(t,s);case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:e.next=9;break;case 6:if(!this._data||!this._data.cardControl){e.next=9;break}return e.next=9,v.default.waitAll(this._data.cardControl.map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.default.waitAll(n.cardOrder.map(function(){var e=o()(h.a.mark(function e(a){var s,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(s=r._data.cards[a])){e.next=6;break}return e.next=4,r.cardDataManager.getReferencedAssets(n.modeID,s);case 4:o=e.sent,Object.assign(t,o);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 9:return e.abrupt("return",t);case 10:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(Ee),Ie={ANALYTICS_SUBCATEGORY:"Sophia",LOOKUP_MAP_FILE_VERSION:6,LOOKUP_COLLECTION_FILE_VERSION:3,ASSET_MAX_SOCKETS:4,ASSET_MINIMUM_PARTIAL_SIZE:65536,FILE_ACCESSOR_WRITE_ENABLED:!0,SUPPORTED_PRODUCTS:{AEFT:"15.0",DRWV:"18.0",FLPR:"20.0",IDSN:"13.0",ILST:"22.0",MUSE:"2018.0",PHXS:"19.0",PPRO:"12.0",SPRK:"31.0"},PARAMETERS_SCHEMA:{id:"psdk_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"}},required:["productCode","productVersion","productLanguage"]},LOG_PREFIX:"FirstMile",LABEL:"FIRST_MILE",DIR:"data/",VULCAN_TYPE:"FirstMile",PRIORITY_CHANNEL:L.b.FirstMileLatest,ANONYMOUS_RETRY_DISABLED:!1,DEFAULT_DATA_EXPIRATION:864e5,DEFAULT_URLS_ENABLED:!0,DEFAULT_URLS:{V2_5:{PHXS:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/953/2drOpU2WQ0s4qG6KacAgmk/{locale}.json",PPRO:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/62/3JrN0dcjvNeCc1oEZPABh9/{locale}.json",AEFT:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/687/50WW9E93Dvfv7Otfe3B2UO/{locale}.json",ILST:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/832/7pCFzXfA6QAaKI6MsicKO2/{locale}.json",IDSN:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/619/1dyQrULwM8wCi4oiaY0gUy/{locale}.json",DRWV:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/709/4gK0NuqSF2G4YwYc6MoSO/{locale}.json"},V2_8:{PHXS:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/169/45a57xm7FMMg2CHHSsI5T/{locale}.json",PPRO:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/508/XFd1SlnnXACOaGHvHrkzR/{locale}.json",AEFT:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/53/66SsgxKgPwafhzfZhaH73y/{locale}.json",ILST:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/959/3QlaTwccpuG2gM4WwJu2O5/{locale}.json",IDSN:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/71/3fF2Ay5mQhhH3ruR2k7fU8/{locale}.json"},V3_0:{PHXS:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/953/2drOpU2WQ0s4qG6KacAgmk/{locale}.json",ILST:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/832/7pCFzXfA6QAaKI6MsicKO2/{locale}.json"},V3_1:{PHXS:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/169/45a57xm7FMMg2CHHSsI5T/{locale}.json",PPRO:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/508/XFd1SlnnXACOaGHvHrkzR/{locale}.json",AEFT:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/53/66SsgxKgPwafhzfZhaH73y/{locale}.json",ILST:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/959/3QlaTwccpuG2gM4WwJu2O5/{locale}.json",IDSN:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/71/3fF2Ay5mQhhH3ruR2k7fU8/{locale}.json",SPRK:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/634/hs2oiIlx8QNVYkYXaNJrs/{locale}.json"},V4_0:{PHXS:"https://odin.adobe.com/content/dam/ccfirstmile/PHSP/{locale}/experienceHomeMx19/Ps-Home-Max-2020-Photo-editing.cfm.gql.json",PPRO:"https://odin.adobe.com/content/dam/ccfirstmile/PPRO/{locale}/experienceHomeMx19/Pr-NUJ-M3-2020-Social-video.cfm.gql.json",AEFT:"https://odin.adobe.com/content/dam/ccfirstmile/AEFT/{locale}/experienceHomeMx19/Ae-NUJ-M3-Home-2020-Social.cfm.gql.json",ILST:"https://odin.adobe.com/content/dam/ccfirstmile/ILST/{locale}/experienceHomeMx19/Ai-MAX-2020-Home-Individual-Enterprise-AEM.cfm.gql.json",IDSN:"https://odin.adobe.com/content/dam/ccfirstmile/IDSN/{locale}/experienceHomeMx19/Id-MAX-2020-Home-Individual-Enterprise-AEM.cfm.gql.json"}},MINOR_VERSION_SHOULD_UPDATE_CONTENT:!0,SOPHIA_VERBOSE_FLAG_ENABLED:!0,ASSET_DOWNLOAD_TIMEOUT:36e5,SUPPORTS_ON_DEMAND:!0},Re=function(){function e(t){c()(this,e),f()(this,"type",void 0),f()(this,"_requestLock",void 0),f()(this,"prioritize",void 0),f()(this,"log",void 0),f()(this,"downloadCollectionData",void 0),this.type=t,e.requestLock=e.requestLock||new L.d(_.default.get("NUM_CONCURRENT_REQUESTS")),this._requestLock=e.requestLock,this.prioritize=this._requestLock.prioritize,this.log=new E.default({prefix:"".concat(_.default.get("LOG_PREFIX",t),"DownloadManager > "),payload:{"event.subtype":_.default.analytics.st_API,"event.subcategory":_.default.get("ANALYTICS_SUBCATEGORY",this.type)}}),this.downloadCollectionData=v.default.retryLocalErrors(this.downloadCollectionDataRaw.bind(this))}return l()(e,[{key:"url",value:function(){var e=o()(h.a.mark(function e(t){var r,n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=_.default.getEnvironment(),n=new w.URL(_.default.get("URL_".concat(r.LABEL.toUpperCase()),this.type)),(t.verbose||_.default.get("SOPHIA_VERBOSE_FLAG_ENABLED",this.type))&&(t.verbose=_.default.get("SOPHIA_VERBOSE_FLAG_ENABLED",this.type)),this.appendUrlSearchParams(n.searchParams,t),e.abrupt("return",n.toString());case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"additionalAnalytics",value:function(e){return{}}},{key:"applyResponseAnalytics",value:function(e,t,r){if(e.appendPayload({"exp.response_guid":t.analyticsData&&t.analyticsData.responseGUID}),t.surfaces)for(var n in t.surfaces)e.addSurfaceAnalytics([{surface:n}]),Array.isArray(t.surfaces[n].containers)&&e.addSurfaceAnalytics(t.surfaces[n].containers.map(function(e){return e.containerAnalyticsData}))}},{key:"downloadCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.params,n=t.priority,a=t.id,s=void 0===a?R.v4():a,i=t.skipAuth,e.next=3,this.url(r);case 3:return c=e.sent,e.next=6,this.log.context({params:r}).time(function(){var e=o()(h.a.mark(function e(t){var r,a,o,u,d;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=l,e.t1=c,e.t2={method:"GET",headers:{"content-type":"application/json","x-gw-ims-user-id":O.default.getUserId(),"X-API-Key":_.default.getEnvironment().CLIENT_ID}},e.t3=n,e.t4=!i,!e.t4){e.next=9;break}return e.next=8,O.default.getAccessToken().catch(function(e){return!1});case 8:e.t4=!!e.sent;case 9:return e.t5=e.t4,e.t6=s,e.t7={url:e.t1,options:e.t2,priority:e.t3,auth:e.t5,id:e.t6},e.next=14,e.t0.get.call(e.t0,e.t7);case 14:return r=e.sent,a=r.response,o=r.time,t.appendPayload({"event.value":o,"event.url":c,"env.svc.name":_.default.get("ANALYTICS_SUBCATEGORY",l.type)}),u=Date.now(),e.next=21,l.getResponseJson(a,c);case 21:return d=e.sent,o+=Date.now()-u,e.abrupt("return",d);case 24:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 6:return(u=e.sent).analyticsData&&(u.analyticsData.requestId=s),e.abrupt("return",u);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"load",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(oe.load)(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"resume",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c=this,u=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:{},n=r.url,a=r.priority,s=r.id,i=void 0===s?R.v4():s,!D.b.isWaitingForBackOff(D.a.NETWORK)){e.next=4;break}throw new Error("Waiting for global back-off ".concat(D.b.backOffCause(D.a.NETWORK)));case 4:if(ee.b.status!==ee.b.OFFLINE){e.next=6;break}throw new Error("Cannot get ".concat(n," - Offline"));case 6:return e.next=8,this._requestLock.read(o()(h.a.mark(function e(){var s,o,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return c.log.disk("[".concat(i,"] Resuming ").concat(n," - Priority(").concat(a&&a.toString()||0,")")),s=Date.now(),o=new w.URL(n||t.url).origin,u=r.options||{},e.next=6,j.a.getNodeTunnelOptionsForURL(o);case 6:return u.agent=e.sent.agent,e.next=9,t.resume(n,u);case 9:return l=Date.now()-s,c.log.disk("[".concat(i,"] Finished.")),e.abrupt("return",l);case 12:case"end":return e.stop()}},e)})),a);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"get",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f=this,p=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=p.length>0&&void 0!==p[0]?p[0]:{url:""},r=t.url,n=t.options,a=void 0===n?{}:n,s=t.auth,i=void 0!==s&&s,c=t.id,u=void 0===c?R.v4():c,l=t.priority,!D.b.isWaitingForBackOff(D.a.NETWORK)){e.next=4;break}throw new Error("Waiting for global back-off ".concat(D.b.backOffCause(D.a.NETWORK)));case 4:if(ee.b.status!==ee.b.OFFLINE){e.next=6;break}throw new Error("Cannot get ".concat(r," - Offline"));case 6:return a.headers=a.headers||{},a.headers["X-Request-Id"]=u,a.headers["user-agent"]="Adobe CCXProcess-".concat(v.default.getProcessVersion(),"/").concat(process.platform,"-").concat(v.default.getOsVersion(),"-").concat(process.arch),a.parallel=Object.assign({minimumPartialSize:_.default.get("NETWORK_MINIMUM_PARTIAL_SIZE"),maxSockets:_.default.get("NETWORK_MAX_SOCKETS"),maxLatency:_.default.get("NETWORK_MAX_LATENCY"),maxLatencyRetries:_.default.get("NETWORK_MAX_LATENCY_RETRIES"),exitOnLatency:!1},a.parallel||{}),a.timeout=_.default.get("ASSET_DOWNLOAD_TIMEOUT",this.type),d=this.log.context({diskParams:{id:u,priority:null==l?void 0:l.toString(),auth:!!i,url:r}}),e.next=14,this._requestLock.read(o()(h.a.mark(function e(){var t,n,s,c,p,v,E,y,m,g,S;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Date.now(),n=new w.URL(r).origin,e.t0=i,!e.t0){e.next=7;break}return e.next=6,O.default.getAccessToken().catch(function(e){return f.log.disk("Error getting access token - ".concat(e)),!1});case 6:e.t0=e.sent;case 7:if(s=e.t0,c=!1,!i||s){e.next=12;break}if(!D.b.isWaitingForBackOff(D.a.AUTH)||!_.default.get("ANONYMOUS_RETRY_DISABLED",f.type)){e.next=12;break}throw new Error("Waiting for global back-off ".concat(D.b.backOffCause(D.a.AUTH)));case 12:return i&&s&&(a.headers.Authorization="Bearer ".concat(s),c=!0),a.headers.Connection="keep-alive",e.next=16,j.a.getNodeTunnelOptionsForURL(n);case 16:return a.agent=e.sent.agent,d.disk("[".concat(u,"] Requesting ").concat(c?"with Auth Headers":"without Auth Headers"," ").concat(r," - Priority(").concat(l&&l.toString()||0,")")),e.next=20,ie()(r,a).catch(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("system"!==t.type||"ENOTFOUND"!==t.code&&"EADDRNOTAVAIL"!==t.code){e.next=6;break}return e.next=3,D.b.updateBackOff({cause:"Offline[Network-"+t.code+"]",type:D.a.NETWORK});case 3:return e.next=5,ee.b.check(ee.a.DOWNLOAD_FETCH_ERROR);case 5:throw new P.default("Offline[Network]",new Error("Offline-Download"),t.code||_.default.analytics.OFFLINE_ERROR).setPayload({"event.url":r});case 6:if("system"!==t.type||"PROXY"!==t.code){e.next=9;break}return e.next=9,D.b.updateBackOff({cause:t.message,type:D.a.NETWORK});case 9:throw t;case 10:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 20:if((p=e.sent).ok||304===p.status){e.next=36;break}return e.next=24,p.text();case 24:if(v=e.sent,E=0,429!==p.status){e.next=29;break}return e.next=29,D.b.updateBackOff({cause:"Server Error[".concat(p.status,"]"),type:D.a.NETWORK});case 29:if(401!==p.status){e.next=32;break}return e.next=32,D.b.updateBackOff({cause:"Server Error[".concat(p.status,"]"),type:D.a.AUTH});case 32:try{m=JSON.parse(v),E=null!==(y=null==m?void 0:m.error_code)&&void 0!==y?y:0}catch(e){}throw(g=new P.default(_.default.analytics.st_NETWORK,"Failed to get ".concat(r," with status code ").concat(p.status," - ").concat(v),0!=E?E:p.status).setPayload({"event.url":r})).setResponseHeaders(p.headers),g;case 36:return e.next=38,D.b.updateBackOff({clear:!0,type:D.a.NETWORK});case 38:return S=Date.now()-t,d.context({diskParams:{time:S}}).disk("[".concat(u,"] Finished ").concat(S,"ms with status ").concat(p.status)),e.abrupt("return",{response:p,time:S});case 41:case"end":return e.stop()}},e)})),l).catch(function(e){throw d.disk("[".concat(u,"] Failed - ").concat(e)),e});case 14:return e.abrupt("return",e.sent);case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getResponseJson",value:function(){var e=o()(h.a.mark(function e(t,r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.json().catch(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=new P.default(_.default.analytics.INVALID_JSON,n),e.t1=r,e.next=4,t.text();case 4:throw e.t2=e.sent.length,e.t3={"event.url":e.t1,"event.value":e.t2},e.t0.setPayload.call(e.t0,e.t3);case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"appendUrlSearchParams",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=function(r){Array.isArray(t[r])?t[r].forEach(function(t){e.append(r,t||"")}):e.append(r,t[r]||"")};for(var n in t)r(n)}}]),e}();function Ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ke(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ce(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function xe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}f()(Re,"requestLock",void 0);var be=function(e){X()(r,e);var t=xe(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"_convertSurfaceIdToModeId",value:function(e,t){var r=_.default.get("FIRST_MILE_SURFACE_MODE_MAP",t);return r&&r[e]?r[e]:e}},{key:"url",value:function(){var e=o()(h.a.mark(function e(t){var n,a;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=_.default.get("FIRST_MILE_SURFACE_ID",v.default.ccxVersionToString(t)),a={productCode:t.productCode,productLanguage:t.productLanguage,productVersion:t.productVersion,productSemver:t.productVersion,surfaceId:n,ccxVersion:t.ccxVersion,osVersion:v.default.getOsVersion(),platform:v.default.getOsPlatform(),verbose:!0},t.vmStatus&&(a.vmStatus=t.vmStatus),e.abrupt("return",B()(J()(r.prototype),"url",this).call(this,a));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"additionalAnalytics",value:function(e){return{"exp.surface_id":_.default.get("FIRST_MILE_SURFACE_ID",v.default.ccxVersionToString(e)).join(", ")}}},{key:"applyResponseAnalytics",value:function(e,t,r){if(e.appendPayload({"exp.response_guid":t.analyticsParams&&t.analyticsParams.responseGUID,"content.type":_.default.analytics.SOPHIA_CARDS,"content.size":t.cards?t.cards.length:0}),r&&["V2_8","V3_0","V3_1","V4_0"].includes(v.default.ccxVersionToString(r))){if(null!=t&&t.surfaces)for(var n in e.appendPayload({"exp.response_guid":t.analyticsData&&t.analyticsData.responseGUID,"content.size":Object.keys(t.surfaces).length}),t.surfaces){var a,s,o;if(e.addSurfaceAnalytics([{surface:n}]),null!=t&&null!==(a=t.surfaces)&&void 0!==a&&null!==(s=a[n])&&void 0!==s&&s.containers&&Array.isArray(t.surfaces[n].containers))e.addSurfaceAnalytics(null===(o=t.surfaces[n])||void 0===o?void 0:o.containers.map(function(e){return e&&e.containerAnalyticsData}))}}else t.cardControl&&Array.isArray(t.cardControl)&&t.cardControl.forEach(function(t){Array.isArray(t.containerAnalyticsParams)&&(e.addSurfaceAnalytics(t.containerAnalyticsParams),e.addSurfaceAnalytics([{surface:t.modeID}]))})}},{key:"downloadCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,E=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.params,n=t.priority,a=t.id,s=void 0===a?R.v4():a,i=t.skipAuth,c=void 0!==i&&i,e.next=3,this.url(r);case 3:return u=e.sent,e.next=6,this.log.context({params:r}).time(function(){var e=o()(h.a.mark(function e(t){var r,a,o,i,l,d,f;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r={"content-type":"application/json","X-API-Key":_.default.getEnvironment().CLIENT_ID},e.t0=!c,!e.t0){e.next=6;break}return e.next=5,O.default.getAccessToken().catch(function(e){return!1});case 5:e.t0=!!e.sent;case 6:return(a=e.t0)&&(r["x-gw-ims-user-id"]=O.default.getUserId()),e.next=10,E.get({url:u,options:{method:"GET",timeout:_.default.get("SERVER_TIMEOUT"),headers:r},priority:n,auth:a,id:s});case 10:return o=e.sent,i=o.response,l=o.time,t.appendPayload({"event.value":l,"event.url":u,"env.svc.name":"Sophia"}),d=Date.now(),e.next=17,E.getResponseJson(i,u);case 17:return f=e.sent,l+=Date.now()-d,e.abrupt("return",f);case 20:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 6:if(l=e.sent,d=_.default.get("SOPHIA_RESPONSE_SCHEMA"),!(f=v.default.validateDataFields(l,d))){e.next=11;break}throw new P.default(_.default.analytics.PARAM_VALIDATION_ERR,f);case 11:if(!["V2_8","V3_0","V3_1","V4_0"].includes(v.default.ccxVersionToString(r))){e.next=16;break}return l.analyticsData&&(l.analyticsData.requestId=s),l.ccxVersion=r.ccxVersion,l.surfaces&&Object.keys(l.surfaces).forEach(function(e){var t=l.surfaces[e];t.containers&&(t.containers=t.containers.map(function(e){return e.data&&"application/json"===e.dataType?ke(ke({},e),{},{content:JSON.parse(e.data)}):e}))}),e.abrupt("return",l);case 16:return p={cards:[],cardControl:[],expirationDTS:new Date(Math.min(new Date(l.expirationDTS||0).getTime(),new Date(Date.now()+_.default.get("MAX_TIMEOUT")).getTime())).toISOString(),analyticsParams:{responseGUID:l.analyticsData&&l.analyticsData.responseGUID,requestId:s},ccxVersion:r.ccxVersion},l.surfaces&&Object.keys(l.surfaces).forEach(function(e){if(Array.isArray(l.surfaces[e].containers)&&0!=l.surfaces[e].containers.length){var t={modeID:E._convertSurfaceIdToModeId(e,v.default.ccxVersionToString(r)),cardOrder:[],containerAnalyticsParams:[]};l.surfaces[e].containers.forEach(function(r){r.containerAnalyticsData=r.containerAnalyticsData||{},t.containerAnalyticsParams.push(r.containerAnalyticsData);var n={startDTS:r.startDTS,endDTS:r.endDTS};if(r.data&&"application/json"===r.dataType)try{Object.assign(n,JSON.parse(r.data))}catch(n){E.log.error(new P.default(_.default.analytics.PARAM_VALIDATION_ERR,n).setContext("Error parsing card data for ".concat(e," with analytics ").concat(JSON.stringify(t.containerAnalyticsParams)," which was ").concat(r.data)))}else"URL"===r.dataType?Object.assign(n,{contentURL:r.data}):Object.assign(n,r);p.cards.push(n),t.cardOrder.push(p.cards.length-1)}),p.cardControl.push(t)}}),"V2"===v.default.ccxVersionToString(r)&&p.cards.forEach(function(e){e.backgroundImage&&(e.backgroundImage=e.backgroundImage.replace("730x280","1000x560"))}),e.abrupt("return",p);case 20:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(Re);function Ne(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var De=function(e){X()(r,e);var t=Ne(r);function r(){var e;return c()(this,r),(e=t.call(this,Ie))._downloadManager=new be(e.type),e}return l()(r,[{key:"generateId",value:function(e){return"".concat(e.productCode,"-").concat(e.productVersion,"-").concat(e.productLanguage,"-").concat(R.v4()).trim()}},{key:"priority",value:function(e){var t=e.params,n=B()(J()(r.prototype),"priority",this).call(this,e),a=this.getClientVersion(t);return n.value+=_.default.get("priority",a),"V1"!==a&&"V2"!==a||(n.channel=L.b.Deprecated),"V2_5"!==a&&"V3_0"!==a||(n.channel=L.b.FirstMileOld),n}},{key:"_createCollectionData",value:function(e){return new Ae(e,this)}},{key:"_getLookupKeys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=B()(J()(r.prototype),"_getLookupKeys",this).call(this,e,t),a=this.getClientVersion(e);return n.splice(1,0,a),n}},{key:"upgrade",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,5!==t.version){e.next=30;break}e.t0=h.a.keys(t.versionInfo);case 3:if((e.t1=e.t0()).done){e.next=28;break}r=e.t1.value,e.t2=h.a.keys(t.versionInfo[r]);case 6:if((e.t3=e.t2()).done){e.next=26;break}n=e.t3.value,e.t4=h.a.keys(t.versionInfo[r][n]);case 9:if((e.t5=e.t4()).done){e.next=24;break}a=e.t5.value,e.t6=h.a.keys(t.versionInfo[r][n][a]);case 12:if((e.t7=e.t6()).done){e.next=22;break}if(s=e.t7.value,o=t.versionInfo[r][n][a][s],i=this.getMinorVersion(r,a,s,t)){e.next=18;break}return e.abrupt("continue",12);case 18:delete t.versionInfo[r][n][a][s],t.versionInfo[r][n][a][i]=o,e.next=12;break;case 22:e.next=9;break;case 24:e.next=6;break;case 26:e.next=3;break;case 28:return t.version=_.default.get("LOOKUP_MAP_FILE_VERSION",this._type),e.abrupt("return",t);case 30:e.next=35;break;case 32:e.prev=32,e.t8=e.catch(0),console.error("Error performing lookupmap upgrade: ",e.t8);case 35:return e.abrupt("return",null);case 36:case"end":return e.stop()}},e,this,[[0,32]])}));return function(t){return e.apply(this,arguments)}}()},{key:"_checkValidity",value:function(e,t){if(!e||!e.hasValidCards||!e.hasValidCards())throw new P.default(m.default.MISSING_DATA,"Empty Sophia Cards")}},{key:"forceRefresh",value:function(){var e=o()(h.a.mark(function e(t){var r,n,s,i=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=_.default.get("ACTIVE_VERSIONS"),n=r.map(function(e){return[e].concat(a()(Object.values(t)))}),s=n.map(function(e){return i.getIdsByKeys(e)}).reduce(function(e,t){return[].concat(a()(e),a()(t))},[]).filter(function(e,t,r){return r.indexOf(e)===t}),e.next=5,Promise.all(s.map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.expireOne(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"isRequestPoisoned",value:function(e){var t=this.getClientVersion(e),r=_.default.get("SUPPORTED_PRODUCTS",this.type)||{};return"V1"===t||("V2"===t&&!_.default.get("TIER_1_LOCALES").includes(e.productLanguage)||(!("V2_8"!==t&&"V3_1"!==t&&"V4_0"!==t||!e||"DRWV"!==e.productCode)||(!!(e.productCode&&r[e.productCode]&&v.default.compareMajorMinorVersions(r[e.productCode],e.productVersion)<0)||!!(v.default.isWindows()&&v.default.compareMajorMinorVersions(_.default.get("EARLIEST_SUPPORTED_WINDOWS_VERSION_UXP"),v.default.getOsVersion())<0&&_.default.get("UNSUPPORTED_WINDOWS_UXP_APPS").includes(e.productCode)))))}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){var n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,B()(J()(r.prototype),"updateParams",this).call(this,t);case 2:return(n=e.sent).forEach(function(e){var t=_.default.get("ACTIVE_VERSIONS").find(function(t){var r=_.default.get("FIRST_MILE_PREFETCH_CLIENTS",t)[e.productCode];return 1===v.default.compareMajorMinorVersions(e.productVersion,r)});e.ccxVersion=e.ccxVersion||_.default.get("START_VERSION",t),e.surfaceId=_.default.get("FIRST_MILE_SURFACE_ID",t),e.platform=v.default.getOsPlatform(),e.osVersion=v.default.getOsVersion()}),e.abrupt("return",n);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"defaultCollectionData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.desiredId,a=this.getClientVersion(r),!["V2_5","V2_8","V3_0","V3_1","V4_0"].includes(a)){e.next=15;break}if(s=this._createCollectionData(n),o=_.default.get("DEFAULT_URLS",this.type)[a][r.productCode],i=o&&o.replace("{locale}",r.productLanguage)){e.next=8;break}return e.abrupt("return",void 0);case 8:return c={ccxVersion:"2.7.4.99",cards:[{startDTS:(new Date).toISOString(),endDTS:(new Date).toISOString(),contentURL:i}],cardControl:[{modeID:"CCX_Start_2.5_Home",cardOrder:[0],containerAnalyticsParams:[{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"}]}],analyticsParams:{responseGUID:"dummy",requestId:"dummy"},expirationDTS:new Date(Date.now()+_.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString(),_ccx:{isDefault:!0,version:_.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type)}},"V2_8"===a&&(c={ccxVersion:"2.8.0.99",_ccx:{isDefault:!0,version:_.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type)},surfaces:{"CCX_Start_3.1_Home":{containers:[{dataType:"URL",data:i,containerAnalyticsData:{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"}}]}},analyticsData:{responseGUID:"dummy",requestId:"dummy"},expirationDTS:new Date(Date.now()+_.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString()}),"V3_1"===a&&(c={ccxVersion:"3.1.0.99",_ccx:{isDefault:!0,version:_.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type)},surfaces:{"CCX_Start_3.1_Home":{containers:[{dataType:"URL",data:i,containerAnalyticsData:{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"}}]}},analyticsData:{responseGUID:"dummy",requestId:"dummy"},expirationDTS:new Date(Date.now()+_.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString()}),"V4_0"===a&&(c={ccxVersion:"4.1.0.0",_ccx:{isDefault:!0,version:_.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type)},surfaces:{"CCX_Start_4.0_Home":{containers:[{dataType:"URL",data:i,containerAnalyticsData:{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"}}]}},analyticsData:{responseGUID:"dummy",requestId:"dummy"},expirationDTS:new Date(Date.now()+_.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString()}),"V3_0"===a&&(c={ccxVersion:"3.0.1.99",_ccx:{isDefault:!0,version:_.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type)},surfaces:{"CCX_Start_3.0_Home":{containers:[{dataType:"URL",data:i,containerAnalyticsData:{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"}}]}},analyticsData:{responseGUID:"dummy",requestId:"dummy"},expirationDTS:new Date(Date.now()+_.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString()}),s.setData(c,a),e.abrupt("return",s);case 15:return e.abrupt("return",void 0);case 16:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(he);function we(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Le(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?we(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):we(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Pe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var Me=function(e){X()(r,e);var t=Pe(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"cardDataManager",void 0),f()($()(a),"_lookupMap",void 0),a._lookupMap=n,a.cardDataManager=new ge(n.type,a._lookupMap.diskLock),a}return l()(r,[{key:"validateData",value:function(e){return v.default.validateDataFields(e,_.default.get("LEARN_DATA_SCHEMA"))}},{key:"ututAnalyticsData",value:function(e){return{"event.subcategory":_.default.analytics.sc_UTUTS,"event.subtype":_.default.analytics.st_API,"content.id":e.tutorialUUID||e.aem_id,"content.name":e.metadata&&e.metadata.descriptions&&e.metadata.descriptions.short,"content.category":e.metadata&&e.metadata.level,"content.action":e.metadata&&e.metadata.urls&&e.metadata.urls.helpx,"content.type":e.metadata&&e.metadata.learning_approach}}},{key:"ututPlaylistAnalyticsData",value:function(e,t){return{"event.subcategory":_.default.analytics.sc_LCM,"event.subtype":_.default.analytics.st_API,"content.id":t,"content.name":e.description,"content.category":e.level}}},{key:"recommendationAnalyticsData",value:function(e){var t,r;return{"event.subcategory":_.default.analytics.sc_RECOMMMENDATIONS,"event.subtype":_.default.analytics.st_API,"content.id":null==e?void 0:null===(t=e.content)||void 0===t?void 0:t.id,"content.type":null==e?void 0:null===(r=e.content)||void 0===r?void 0:r.type}}},{key:"userIntentRecommendationAnalyticsData",value:function(e){var t,r;return{"event.subcategory":_.default.analytics.sc_USER_INTENT_RECOMMENDATIONS,"event.subtype":_.default.analytics.st_API,"content.id":null==e?void 0:null===(t=e.content)||void 0===t?void 0:t.id,"content.type":null==e?void 0:null===(r=e.content)||void 0===r?void 0:r.type}}},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f=this,p=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=p.length>0&&void 0!==p[0]?p[0]:{},n=r.priority,a=r.payload,s=r.params,i=r.progress,c=void 0===i?function(){}:i,u=r.force,l=void 0===u?{type:"none"}:u,d=this._data,l.depth=null!==(t=l.depth)&&void 0!==t?t:0,e.next=5,this.log.time(function(){var e=o()(h.a.mark(function e(t){var r,i,u,p,E,y,m;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=0,u=0,p={started:[],complete:[],failed:[]},E=[],y=new P.default(_.default.analytics.AGGREGATE_ERROR,_.default.get("AGGREGATE_TYPE",f._lookupMap.type)+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),null!==(r=f._data)&&void 0!==r&&r.surfaces&&Object.keys(null===(m=f._data)||void 0===m?void 0:m.surfaces).forEach(function(e){var t=!1;E.push(v.default.waitAll((f._data.surfaces[e].containers||[]).map(function(){var r=o()(h.a.mark(function r(o){var i;return h.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(o.containerLabel!==_.default.get("USER_INTENT_DIALOG")){r.next=6;break}return f.log.disk("Downloading AEM Content for User Intent Dialog"),(i=new L.a(n)).value+=_.default.get("SURFACE_PRIORITY",f._lookupMap.type)[e]||0,r.next=6,f.syncDataPromises({analyticsParams:o.containerAnalyticsData,payload:a,surface:e,card:o,priority:i,params:s,force:l,started:function(){p.started.includes(e)||(p.started.push(e),c(Object.assign({},p)))}}).catch(function(r){t=!0,y.addSubError(Le(Le({surface:e,url:o.data},o.containerAnalyticsData),{},{err:r}))}).then(function(){p.started.includes(e)||p.started.push(e),t?p.failed.push(e):p.complete.push(e),c(Object.assign({},p))});case 6:case"end":return r.stop()}},r)}));return function(e){return r.apply(this,arguments)}}())))}),e.next=8,v.default.waitAll(E);case 8:if(!y.hasSubErrors){e.next=10;break}throw y;case 10:return p={started:[],complete:[],failed:[]},e.next=13,v.default.waitAll(Object.keys(d.surfaces||{}).map(function(){var e=o()(h.a.mark(function e(t){var r,a,E;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=d.surfaces[t],a=r.containers||[],p.started.push(t),c(p),e.next=6,v.default.waitAll(a.map(function(){var e=o()(h.a.mark(function e(r){var a,c,d,p,m,g,S,O,T,I,R,C,k,x,b,D,w,M,U,F,j,G;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(E=!1,r&&r.content){e.next=3;break}return e.abrupt("return");case 3:if(r.containerLabel!==_.default.get("USER_INTENT_DIALOG")){e.next=18;break}return(k=new L.a(n)).channel=L.b.Learn,e.next=8,v.default.waitAll(null!==(p=null==r?void 0:null===(m=r.content)||void 0===m?void 0:null===(g=m.data)||void 0===g?void 0:null===(S=g.userintentByPath)||void 0===S?void 0:null===(O=S.item)||void 0===O?void 0:null===(T=O.pages)||void 0===T?void 0:null===(I=T.recommendations)||void 0===I?void 0:null===(R=I.items)||void 0===R?void 0:R.map(function(){var e=o()(h.a.mark(function e(n){var a,o,i,c,u,d,p,v,m,g;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!_.default.get("USER_INTENT_SUPPORTED_UTUT_TYPES").includes(null===(a=n.content)||void 0===a?void 0:a.type)){e.next=6;break}return f.log.disk("Downloading UTUT [".concat(null===(i=n.content)||void 0===i?void 0:i.type,"]  Content for User Intent Dialog")),e.next=4,V.downloadTutorial({params:s,url:null==n?void 0:null===(c=n.content)||void 0===c?void 0:c.downloadUrl,id:(null==n?void 0:null===(u=n.content)||void 0===u?void 0:u.id)||"",priority:k,force:Le(Le({},l),{},{depth:(l.depth||0)-1}),analyticsData:f.userIntentRecommendationAnalyticsData(n),filePrefix:"HEL",map:f._lookupMap}).catch(function(e){var a;return y.addSubError(Le(Le({err:e,id:null==n?void 0:null===(a=n.content)||void 0===a?void 0:a.id},null==r?void 0:r.containerAnalyticsData),{},{surface:t})),E=!0,{time:0,count:0}});case 4:d=e.sent,n.path=d.path;case 6:if(!_.default.get("USER_INTENT_SUPPORTED_PLAYLIST_TYPES").includes(null===(o=n.content)||void 0===o?void 0:o.type)){e.next=12;break}return f.log.disk("Downloading Playlist [".concat(null===(p=n.content)||void 0===p?void 0:p.type,"]  Content for User Intent Dialog")),e.next=10,V.downloadTutorial({params:s,url:null==n?void 0:null===(v=n.content)||void 0===v?void 0:v.downloadUrl,id:(null==n?void 0:null===(m=n.content)||void 0===m?void 0:m.id)||"",priority:k,force:Le(Le({},l),{},{depth:(l.depth||0)-1}),analyticsData:f.userIntentRecommendationAnalyticsData(n),filePrefix:"PLA",map:f._lookupMap}).catch(function(e){var a;return y.addSubError(Le(Le({err:e,id:null==n?void 0:null===(a=n.content)||void 0===a?void 0:a.id},null==r?void 0:r.containerAnalyticsData),{},{surface:t})),E=!0,{time:0,count:0}});case 10:g=e.sent,n.path=g.path;case 12:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()))&&void 0!==p?p:[]);case 8:if(C=r.path){e.next=12;break}return f.log.disk("not valid container"),e.abrupt("return");case 12:return e.next=14,f._lookupMap.diskLock.write(o()(h.a.mark(function e(){var t,n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=null==r?void 0:r.content,e.t0=A,e.next=4,N.writeJsonAtomic(f.assetsDir,A.basename(C),t,!0);case 4:e.t1=e.sent,n=e.t0.basename.call(e.t0,e.t1),r.path=A.basename(f.assetsDir)+"/"+n;case 7:case"end":return e.stop()}},e)})));case 14:return e.next=16,f._lookupMap.save();case 16:e.next=39;break;case 18:if(!Array.isArray(null==r?void 0:null===(a=r.content)||void 0===a?void 0:a.tutorials)){e.next=25;break}return(x=new L.a(n)).channel=L.b.Learn,e.next=23,v.default.waitAll(r.content.tutorials.map(function(){var e=o()(h.a.mark(function e(n){var a,o,c,d;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null==n||null===(a=n.metadata)||void 0===a||null===(o=a.images)||void 0===o||null===(c=o.hero)||void 0===c||!c.length){e.next=7;break}return e.next=3,f._lookupMap.fetchAsset({href:n.metadata.images.hero,analyticsData:f.ututAnalyticsData(n),priority:x,params:s,force:Le(Le({},l),{},{depth:(l.depth||0)-1}),assetsDir:f.assetsDir}).catch(function(e){var a,s;return y.addSubError(Le(Le({err:e,url:null==n?void 0:null===(a=n.metadata)||void 0===a?void 0:null===(s=a.images)||void 0===s?void 0:s.hero,id:(null==n?void 0:n.tutorialUUID)||(null==n?void 0:n.aem_id)},null==r?void 0:r.containerAnalyticsData),{},{surface:t})),E=!0,{path:void 0,time:0}});case 3:d=e.sent,n.metadata.images.heroPath=d.path,u+=null==d?void 0:d.time,i++;case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 23:e.next=39;break;case 25:if(null==r||null===(c=r.content)||void 0===c||!c.playlists){e.next=32;break}return(b=new L.a(n)).channel=L.b.Lcm,e.next=30,v.default.waitAll(r.content.playlists.map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!Array.isArray(null==n?void 0:n.tutorial_ids)){e.next=4;break}return n.tutorial_paths={},e.next=4,v.default.waitAll(n.tutorial_ids.map(function(){var e=o()(h.a.mark(function e(a){var o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,V.downloadTutorial({params:s,id:a,priority:b,force:Le(Le({},l),{},{depth:(l.depth||0)-1}),analyticsData:f.ututPlaylistAnalyticsData(n,a),filePrefix:"LCM",status:n.status||"live",map:f._lookupMap}).catch(function(e){return y.addSubError(Le(Le({err:e,id:a},null==r?void 0:r.containerAnalyticsData),{},{surface:t})),E=!0,{time:0,count:0}});case 2:o=e.sent,n.tutorial_paths[a]=o.path,u+=o.time,i+=o.count;case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 30:e.next=39;break;case 32:if(null==r||null===(d=r.content)||void 0===d||!d.data){e.next=39;break}if(!Array.isArray(null==r?void 0:null===(D=r.content)||void 0===D?void 0:null===(w=D.data)||void 0===w?void 0:w.recommendations)){e.next=38;break}return(G=new L.a(n)).channel=L.b.Learn,e.next=38,v.default.waitAll(null==r?void 0:null===(F=r.content)||void 0===F?void 0:null===(j=F.data)||void 0===j?void 0:j.recommendations.map(function(){var e=o()(h.a.mark(function e(a){var c,d,p,_,v,m,g;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("quickAction"===(null==a?void 0:null===(c=a.content)||void 0===c?void 0:c.type)&&(v={},Object.keys((null==a?void 0:null===(_=a.content)||void 0===_?void 0:_.assetUrls)||{}).map(function(){var e=o()(h.a.mark(function e(t){var r,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=null==a?void 0:a.content.assetUrls[t],!f.shouldPrefetchAsset(t)){e.next=10;break}return e.next=4,f._lookupMap.fetchAsset({href:r,analyticsData:f.recommendationAnalyticsData(a),priority:n,params:s,force:Le(Le({},l),{},{depth:(l.depth||0)-1}),assetsDir:f.assetsDir}).catch(function(e){var t;return y.addSubError({err:e,url:r,id:null==a?void 0:null===(t=a.content)||void 0===t?void 0:t.uuid}),E=!0,{path:void 0,time:0}});case 4:(o=e.sent).path&&(v[t]=o.path),u+=null==o?void 0:o.time,i++,e.next=11;break;case 10:f.log.disk("Asset ".concat(t," in QuickAction deny list. Skipping prefetch"));case 11:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),a.content.assetPaths=v),null==a||null===(d=a.content)||void 0===d||!d.downloadUrl||"ututService"!==(null==a?void 0:null===(p=a.content)||void 0===p?void 0:p.source)){e.next=8;break}return e.next=4,V.downloadTutorial({params:s,url:null==a?void 0:null===(m=a.content)||void 0===m?void 0:m.downloadUrl,id:a.content.id||"",priority:G,force:Le(Le({},l),{},{depth:(l.depth||0)-1}),analyticsData:f.recommendationAnalyticsData(a),filePrefix:"REC",map:f._lookupMap}).catch(function(e){var n;return y.addSubError(Le(Le({err:e,id:null==a?void 0:null===(n=a.content)||void 0===n?void 0:n.id},null==r?void 0:r.containerAnalyticsData),{},{surface:t})),E=!0,{time:0,count:0}});case 4:g=e.sent,a.content.path=g.path,u+=g.time,i+=g.count;case 8:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 38:Array.isArray(null==r?void 0:null===(M=r.content)||void 0===M?void 0:null===(U=M.data)||void 0===U?void 0:U.errors)&&r.content.data.errors.forEach(function(e){y.addSubError(Le(Le({err:new P.default(e.type||"Dynamic Recommendations Error",e.title||"",e.status)},null==r?void 0:r.containerAnalyticsData),{},{surface:t})),E=!0});case 39:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())).finally(function(){p.started.includes(t)||p.started.push(t),E?p.failed.push(t):p.complete.push(t),c(Object.assign({},p))});case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 13:if(t.appendPayload(Le(Le({},a),{},{"event.url":"","event.count":i,"event.value":u/i})),!y.hasSubErrors){e.next=16;break}throw y;case 16:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"syncDataPromises",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.analyticsParams,n=t.payload,a=t.surface,s=t.card,i=t.priority,c=t.params,u=t.started,l=t.force,e.next=3,this.log.context({payload:n,surfaceAnalytics:[Le({surface:a},r)]}).time(function(){var e=o()(h.a.mark(function e(t){var r,n,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.cardDataManager.downloadData({modeID:a,card:s,lookupMap:d._lookupMap,priority:i,bundle:!0,params:c,started:u,force:l});case 2:r=e.sent,n=r.count,o=r.totalTime,t.appendPayload({"event.url":"URL"===(null==s?void 0:s.dataType)&&s.data||"","event.count":n,"event.value":o/(n||1),"exp.surface_id":"".concat(a,"(").concat(null==s?void 0:s.containerId,")")});case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"shouldPrefetchAsset",value:function(e){return!(_.default.get("QUICK_ACTIONS_PREFETCH_DENY_LIST",this._lookupMap.type)||[]).includes(e)}},{key:"getReferencedTutorialsOrPlaylists",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={},t.tutorials?null===(n=t.tutorials)||void 0===n||n.forEach(function(e){if(e&&e.metadata&&e.metadata.images){var t=e.metadata.images;t.heroPath&&(r[t.heroPath]=!0),t.thumbnailPath&&(r[t.thumbnailPath]=!0)}}):t.playlists&&(null===(a=t.playlists)||void 0===a||a.forEach(function(e){if(e&&e.images){var t=e.images;t.heroPath&&(r[t.heroPath]=!0),t.thumbnailPath&&(r[t.thumbnailPath]=!0)}})),e.abrupt("return",r);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t={},r=this._data,n=h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!Array.isArray(null==r?void 0:r.surfaces[n].containers)){e.next=3;break}return e.next=3,v.default.waitAll(r.surfaces[n].containers.map(function(){var e=o()(h.a.mark(function e(r){var a,i,c,u,l,d,f,p,E,y,m,g;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r.containerLabel!==_.default.get("USER_INTENT_DIALOG")){e.next=9;break}return e.next=3,s.cardDataManager.getReferencedAssets(n,r,s._lookupMap);case 3:return g=e.sent,Object.assign(t,g),e.next=7,v.default.waitAll((null===(l=r.content)||void 0===l?void 0:null===(d=l.data)||void 0===d?void 0:null===(f=d.userintentByPath)||void 0===f?void 0:null===(p=f.item)||void 0===p?void 0:null===(E=p.pages)||void 0===E?void 0:null===(y=E.recommendations)||void 0===y?void 0:null===(m=y.items)||void 0===m?void 0:m.map(function(){var e=o()(h.a.mark(function e(r){var n,a;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.path){e.next=9;break}return e.next=3,T.readJson(s.assetsDir+"/"+A.basename(r.path));case 3:return n=e.sent,e.next=6,s.getReferencedTutorialsOrPlaylists(n);case 6:(a=e.sent)[r.path]=!0,Object.assign(t,a);case 9:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()))||[]);case 7:e.next=21;break;case 9:if(!Array.isArray(null==r?void 0:null===(a=r.content)||void 0===a?void 0:a.tutorials)){e.next=13;break}r.content.tutorials.forEach(function(e){if(e&&e.metadata&&e.metadata.images){var r=e.metadata.images;r.heroPath&&(t[r.heroPath]=!0)}}),e.next=21;break;case 13:if(!Array.isArray(null==r?void 0:null===(i=r.content)||void 0===i?void 0:i.playlists)){e.next=18;break}return e.next=16,v.default.waitAll(r.content.playlists.map(function(){var e=o()(h.a.mark(function e(r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.default.waitAll(Object.values(r.tutorial_paths||{}).map(function(){var e=o()(h.a.mark(function e(r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Object,e.t1=t,e.next=4,s._lookupMap.getTutorialAssets(r);case 4:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 16:e.next=21;break;case 18:if(!Array.isArray(null==r?void 0:null===(c=r.content)||void 0===c?void 0:null===(u=c.data)||void 0===u?void 0:u.recommendations)){e.next=21;break}return e.next=21,v.default.waitAll(r.content.data.recommendations.map(function(){var e=o()(h.a.mark(function e(r){var n,a,i,c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Object,e.t1=t,e.next=4,s._lookupMap.getTutorialAssets(null==r?void 0:null===(n=r.content)||void 0===n?void 0:n.path);case 4:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2),"quickAction"===(null==r?void 0:null===(a=r.content)||void 0===a?void 0:a.type)&&null!=r&&null!==(i=r.content)&&void 0!==i&&i.assetPaths&&Object.keys(null==r?void 0:null===(c=r.content)||void 0===c?void 0:c.assetPaths).map(function(){var e=o()(h.a.mark(function e(n){var a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:(s=null==r?void 0:null===(a=r.content)||void 0===a?void 0:a.assetPaths[n])&&(t[s]=!0);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 21:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}},e)}),e.t0=h.a.keys(null==r?void 0:r.surfaces);case 4:if((e.t1=e.t0()).done){e.next=9;break}return a=e.t1.value,e.delegateYield(n(a),"t2",7);case 7:e.next=4;break;case 9:return e.abrupt("return",t);case 10:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(Ee);function Ue(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var Fe=function(e){X()(r,e);var t=Ue(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"url",value:function(){var e=o()(h.a.mark(function e(t){var n,a,s,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=_.default.get("LEARN_SURFACE_ID",v.default.ccxVersionToString(t)),a=v.default.compareMajorMinorVersions(_.default.get("SUPPORTED_LEARN_THIRD_PARTY_START_MIN_VERSION"),t.ccxVersion||"")>-1,s={productCode:t.productCode,productLanguage:t.productLanguage,productVersion:t.productVersion,productSemver:t.productVersion,surfaceId:[n],ccxVersion:t.ccxVersion,allowThirdPartyContent:a.toString(),osVersion:v.default.getOsVersion(),platform:v.default.getOsPlatform(),verbose:t.verbose},(o=_.default.get("LCM_SUPPORTED_PRODUCTS",this.type)||{})[t.productCode]&&v.default.compareMajorMinorVersions(t.productVersion,o[t.productCode])<=0&&s.surfaceId.push(_.default.get("UTUTS_SURFACE",this.type)),e.abrupt("return",B()(J()(r.prototype),"url",this).call(this,s));case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"additionalAnalytics",value:function(e){return{"exp.surface_id":_.default.get("LEARN_SURFACE_ID",v.default.ccxVersionToString(e))}}},{key:"numberOfTutorials",value:function(e,t){var r,n,a,s,o,i=0,c=0,u=0,l=_.default.get("LEARN_SURFACE_ID",v.default.ccxVersionToString(t));e&&e.surfaces&&e.surfaces[l]&&Array.isArray(e.surfaces[l].containers)&&e.surfaces[l].containers.forEach(function(e){e.content&&Array.isArray(e.content.tutorials)&&e.content.tutorials.length>0&&(e.content.tutorials[0].metadata&&Array.isArray(e.content.tutorials[0].metadata.platforms)&&e.content.tutorials[0].metadata.platforms.includes("in-app")?c=e.content.tutorials.length:i=e.content.tutorials.length)});var d,f,p,h,E,y,m=_.default.get("UTUTS_SURFACE",this.type);Array.isArray(null==e?void 0:null===(r=e.surfaces)||void 0===r?void 0:null===(n=r[m])||void 0===n?void 0:null===(a=n.containers)||void 0===a?void 0:null===(s=a[0])||void 0===s?void 0:null===(o=s.content)||void 0===o?void 0:o.playlists)&&(u=(null==e?void 0:null===(d=e.surfaces)||void 0===d?void 0:null===(f=d[m])||void 0===f?void 0:null===(p=f.containers)||void 0===p?void 0:null===(h=p[0])||void 0===h?void 0:null===(E=h.content)||void 0===E?void 0:null===(y=E.playlists)||void 0===y?void 0:y.length)||0);return{web:i,app:c,ututs:u}}},{key:"applyResponseAnalytics",value:function(e,t,r){var n=this.numberOfTutorials(t,r);if(e.appendPayload({"exp.response_guid":t.analyticsData&&t.analyticsData.responseGUID,"content.type":_.default.analytics.UTUTS,"content.size":"".concat(n.web,":").concat(n.app,":").concat(null==n?void 0:n.ututs)}),t.surfaces)for(var a in t.surfaces)e.addSurfaceAnalytics([{surface:a}]),Array.isArray(t.surfaces[a].containers)&&e.addSurfaceAnalytics(t.surfaces[a].containers.map(function(e){return e.containerAnalyticsData}))}},{key:"downloadCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,E=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.params,n=t.priority,a=t.id,s=void 0===a?R.v4():a,i=t.skipAuth,e.next=3,this.url(r);case 3:return c=e.sent,e.next=6,this.log.context({params:r}).time(function(){var e=o()(h.a.mark(function e(t){var r,a,o,u,l,d,f;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r={"content-type":"application/json","X-API-Key":_.default.getEnvironment().CLIENT_ID},e.t0=!i,!e.t0){e.next=6;break}return e.next=5,O.default.getAccessToken().catch(function(e){return!1});case 5:e.t0=!!e.sent;case 6:return(a=e.t0)&&(r["x-gw-ims-user-id"]=O.default.getUserId()),e.next=10,E.get({url:c,options:{method:"GET",timeout:_.default.get("SERVER_TIMEOUT"),headers:r},priority:n,auth:a,id:s});case 10:return o=e.sent,u=o.response,l=o.time,t.appendPayload({"event.value":l,"event.url":c,"env.svc.name":"Learn"}),d=Date.now(),e.next=17,E.getResponseJson(u,c);case 17:return f=e.sent,l+=Date.now()-d,e.abrupt("return",f);case 20:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 6:if(u=e.sent,l=_.default.get("SOPHIA_RESPONSE_SCHEMA"),!(d=v.default.validateDataFields(u,l))){e.next=11;break}throw new P.default(_.default.analytics.PARAM_VALIDATION_ERR,d);case 11:for(p in f=function(e){Array.isArray(u.surfaces[e].containers)&&u.surfaces[e].containers.forEach(function(t,n){if(t.data)t.content=JSON.parse(t.data);else{var a=t.containerAnalyticsData;E.log.context({params:r,surfaceAnalytics:[{surface:e,campaignId:null==a?void 0:a.campaignId,variationId:null==a?void 0:a.variationId,treatmentId:null==a?void 0:a.treatmentId,controlGroupId:null==a?void 0:a.controlGroupId,actionBlockId:null==a?void 0:a.actionBlockId}]}).error(new P.default("Missing data field in container(".concat(n+1,")"),_.default.analytics.DATA_VALIDATION_ERR,"X_ERR_MISSING_DATA_FIELD"))}})},u.surfaces)f(p);return e.abrupt("return",u);case 14:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(Re),Ve={ANALYTICS_SUBCATEGORY:"Learn",LOOKUP_COLLECTION_FILE_VERSION:3,LOOKUP_MAP_FILE_VERSION:2,LOG_PREFIX:"Learn",SUPPORTED_PRODUCTS:{AEFT:"16.0",DRWV:"19.0",FLPR:"20.0",IDSN:"14.0",ILST:"23.0",PHXS:"20.0",PPRO:"13.0",SPRK:"31.0"},PARAMETERS_SCHEMA:{id:"learn_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"}},required:["productCode","productVersion","productLanguage"]},SURFACE_PRIORITY:{"CCX_Start_3.1_Tutorials":100,LCM_LEARN_PANEL:100},FILE_ACCESSOR_WRITE_ENABLED:!0,LABEL:"LEARN",VULCAN_TYPE:"Tutorial",DIR:"learn/",NON_IDEMPOTENT_IMAGES:!0,PRIORITY_CHANNEL:L.b.Learn,ANONYMOUS_RETRY_DISABLED:!1,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!0,LCM_SUPPORTED_PRODUCTS:{PHXS:"22.0",ILST:"26.0"},UTUTS_SURFACE:"LCM_LEARN_PANEL",UTUTS_API_REQUEST_SURFACE:"in_app_panel:v2",SUPPORTS_ON_DEMAND:!0,SOPHIA_VERBOSE_FLAG_ENABLED:!0,ASSET_DOWNLOAD_TIMEOUT:36e5,QUICK_ACTIONS_PREFETCH_DENY_LIST:["sampleFile"]};function je(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var Ge=function(e){X()(r,e);var t=je(r);function r(){var e;return c()(this,r),(e=t.call(this,Ve))._downloadManager=new Fe(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new Me(e,this)}},{key:"upgrade",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,1!==t.version){e.next=25;break}e.t0=h.a.keys(t.versionInfo);case 3:if((e.t1=e.t0()).done){e.next=23;break}r=e.t1.value,e.t2=h.a.keys(t.versionInfo[r]);case 6:if((e.t3=e.t2()).done){e.next=21;break}n=e.t3.value,e.t4=h.a.keys(t.versionInfo[r][n]);case 9:if((e.t5=e.t4()).done){e.next=19;break}if(a=e.t5.value,s=t.versionInfo[r][n][a],o=this.getMinorVersion(r,n,a,t)){e.next=15;break}return e.abrupt("continue",9);case 15:delete t.versionInfo[r][n][a],t.versionInfo[r][n][o]=s,e.next=9;break;case 19:e.next=6;break;case 21:e.next=3;break;case 23:return t.version=_.default.get("LOOKUP_MAP_FILE_VERSION",this._type),e.abrupt("return",t);case 25:e.next=30;break;case 27:e.prev=27,e.t6=e.catch(0),console.error("Error performing lookupmap upgrade: ",e.t6);case 30:return e.abrupt("return",null);case 31:case"end":return e.stop()}},e,this,[[0,27]])}));return function(t){return e.apply(this,arguments)}}()},{key:"isRequestPoisoned",value:function(e){var t=v.default.ccxVersionToString(e),r=_.default.get("SUPPORTED_PRODUCTS",this.type)||{};if("V1"===t){var n=_.default.get("LCM_SUPPORTED_PRODUCTS",this.type)||{};return!(e.productCode&&e.productVersion&&n[e.productCode]&&v.default.compareMajorMinorVersions(n[e.productCode],e.productVersion)<=0)}return"V2"===t&&!_.default.get("TIER_1_LOCALES").includes(e.productLanguage)||(!("V2_8"!==t&&"V3_1"!==t&&"V4_0"!==t||!e||"DRWV"!==e.productCode)||(!!(e.productCode&&r[e.productCode]&&v.default.compareMajorMinorVersions(r[e.productCode],e.productVersion)<0)||!!(v.default.isWindows()&&v.default.compareMajorMinorVersions(_.default.get("EARLIEST_SUPPORTED_WINDOWS_VERSION_UXP"),v.default.getOsVersion())<0&&_.default.get("UNSUPPORTED_WINDOWS_UXP_APPS").includes(e.productCode))))}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,B()(J()(r.prototype),"updateParams",this).call(this,t);case 2:return e.abrupt("return",e.sent.map(function(e){var t=_.default.get("ACTIVE_VERSIONS").find(function(t){var r=(_.default.get("FIRST_MILE_PREFETCH_CLIENTS",t)||{})[e.productCode];return 1===v.default.compareMajorMinorVersions(e.productVersion,r)});return e.ccxVersion=e.ccxVersion||_.default.get("START_VERSION",t),e.platform=v.default.getOsPlatform(),e.osVersion=v.default.getOsVersion(),e}));case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_fetchOnDemandContent",value:function(){var e=o()(h.a.mark(function e(t){var n,a,s,o,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.params,a=t.force,s=t.priority,!n.url){e.next=5;break}return e.next=4,B()(J()(r.prototype),"_fetchOnDemandContent",this).call(this,t);case 4:return e.abrupt("return",e.sent);case 5:if(n.id){e.next=7;break}throw new P.default(_.default.analytics.DATA_VALIDATION_ERR,"Cannot add on demand model without id");case 7:return e.next=9,V.downloadTutorial({id:n.id,priority:s,params:n,force:a,analyticsData:{"content.id":n.id},filePrefix:"LCM",status:n.status||"live",map:this});case 9:if(o=e.sent,i=o.path){e.next=13;break}throw new P.default("FETCH","No path downloaded from AEM");case 13:return e.abrupt("return",i);case 14:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_getOnDemandLookupKeys",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=null===(t=e.productVersion)||void 0===t?void 0:t.split(".")[0],a=[r||O.default.getUserId()];return a.push(e.productCode,n,e.productLanguage),a}},{key:"getOnDemandAssetPath",value:function(e){var t,r,n,a,s,o,i=e.id,c=void 0===i?"":i,u=e.productLanguage,l=e.status,d=e.productVersion;return e.url?null===(t=this._data)||void 0===t?void 0:null===(r=t.assetMetadata)||void 0===r?void 0:null===(n=r[e.url])||void 0===n?void 0:n.path:null===(a=this._data)||void 0===a?void 0:null===(s=a.assetMetadata)||void 0===s?void 0:null===(o=s[V.getTutorialUrl({id:c,productLanguage:u,status:l,productVersion:d,surface:_.default.get("UTUTS_API_REQUEST_SURFACE",this.type)})])||void 0===o?void 0:o.path}},{key:"_getOnDemandAssetList",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,o,i,c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r={},n=Object.values((null===(t=this._data)||void 0===t?void 0:t.onDemandMetadata)||{}),a=0,s=n;case 3:if(!(a<s.length)){e.next=18;break}if(!(o=s[a]).params.id){e.next=14;break}return e.t0=Object,e.t1=r,e.next=10,this.getTutorialAssets(null===(i=this._data)||void 0===i?void 0:null===(c=i.assetMetadata[V.getTutorialUrl({id:o.params.id||"",productLanguage:o.params.productLanguage,status:o.params.status,productVersion:o.params.productVersion,surface:_.default.get("UTUTS_API_REQUEST_SURFACE",this.type)})])||void 0===c?void 0:c.path);case 10:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2),e.next=15;break;case 14:r[(null===(u=this._data)||void 0===u?void 0:null===(l=u.assetMetadata[o.params.url||""])||void 0===l?void 0:l.path)||""]=!0;case 15:a++,e.next=3;break;case 18:return e.abrupt("return",r);case 19:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getTutorialAssets",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",{});case 2:return(n={})[t]=!0,e.next=6,T.readJSON("".concat(this.getPath(),"/").concat(t)).catch(function(e){s.log.error(new P.default("filesystem",e))});case 6:return null==(a=e.sent)||null===(r=a.tutorials)||void 0===r||r.forEach(function(e){var t,r,a,s;null!==(t=e.metadata)&&void 0!==t&&null!==(r=t.images)&&void 0!==r&&r.heroPath&&(n[e.metadata.images.heroPath]=!0),null!==(a=e.metadata)&&void 0!==a&&null!==(s=a.images)&&void 0!==s&&s.thumbnailPath&&(n[e.metadata.images.thumbnailPath]=!0)}),e.abrupt("return",n);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(he),He={LABEL:"CCD",ANALYTICS_SUBCATEGORY:"CCD",VULCAN_TYPE:"CCD",LOG_PREFIX:"CCD",LOOKUP_MAP_FILE_VERSION:2,LOOKUP_COLLECTION_FILE_VERSION:1,SUPPORTED_PRODUCTS:{ACCC:"5.0"},FILE_ACCESSOR_WRITE_ENABLED:!0,DIR:"ccd/",SURFACE_V2_VERSION:"5.4.0",PRIORITY_CHANNEL:L.b.CcdPrimary,SURFACE_PRIORITY:{payment_notification_banner:0,CCD_PMP:0,CCD_USER_FEEDBACK:200,CCD_FRAMEWORK:200,CCD_QUICK_ACTIONS:300,ACCC_APPS_CATALOG:300,CCD_APPS_CATALOG:300,ACCC_CATEGORIES_BANNERS:400,CCD_ALL_APPS_BANNERS:500,ACCC_ALL_APPS_BANNERS:500,CCD_APP_SKELETON:600,ACCC_APP_SKELETON:600,CCD_HOME_SKELETON:600},AEM_SURFACES:["CCD_ALL_APPS_BANNERS","CCD_APPS_CATALOG","CCD_APP_SKELETON","CCD_PMP","CCD_USER_FEEDBACK","CCD_HOME_SKELETON","CCD_FRAMEWORK","CCD_QUICK_ACTIONS","payment_notification_banner"],SECONDARY_SURFACES:["ACCC_ALL_APPS_BANNERS","CCD_ALL_APPS_BANNERS","CCD_HOME_SKELETON","CCD_QUICK_ACTIONS"],TERTIARY_SURFACES:["ACCC_APPS_CATALOG","ACCC_CATEGORIES_BANNERS","CCD_APPS_CATALOG"],QUARTERNARY_SURFACES:["CCD_USER_FEEDBACK","CCD_PMP","payment_notification_banner"],SUPPORTED_LOCALES:["cs_CZ","da_DK","de_DE","en_US","es_ES","es_MX","fi_FI","fr_FR","fr_CA","it_IT","ja_JP","ko_KR","nb_NO","nl_NL","pl_PL","pt_BR","ru_RU","sv_SE","tr_TR","zh_CN","zh_TW"],IGNORE_PERF_EVENTS_FOR_SURFACES:["payment_notification_banner"],ANONYMOUS_RETRY_DISABLED:!1,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!0,SOPHIA_VERBOSE_FLAG_ENABLED:!0,ASSET_DOWNLOAD_TIMEOUT:36e5};function Be(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var Ye=function(e){X()(r,e);var t=Be(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"url",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",B()(J()(r.prototype),"url",this).call(this,Object.assign(t,{comLocale:t.comLocale||(t.productLanguage?t.productLanguage.substring(0,2):"en"),comCustomerUi:t.comCustomerUi||"cc_desktop"})));case 1:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.priority,a=t.id,s=void 0===a?R.v4():a,i=t.skipAuth,!_.default.get("TEMP_CCD_CONTENT_DOWNLOAD_DISABLED")){e.next=5;break}return(c=new Date).setDate(c.getDate()+14),e.abrupt("return",{expirationDTS:c.toISOString(),surfaces:{}});case 5:return e.next=7,this.url(r);case 7:return u=e.sent,e.next=10,this.log.context({params:r}).time(function(){var e=o()(h.a.mark(function e(t){var r,a,o,c,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=p,e.t1=u,e.t2={method:"GET",timeout:_.default.get("SERVER_TIMEOUT"),headers:{"content-type":"application/json","x-gw-ims-user-id":O.default.getUserId(),"X-API-Key":_.default.getEnvironment().CLIENT_ID}},e.t3=n,e.t4=!i,!e.t4){e.next=9;break}return e.next=8,O.default.getAccessToken().catch(function(e){return!1});case 8:e.t4=!!e.sent;case 9:return e.t5=e.t4,e.t6=s,e.t7={url:e.t1,options:e.t2,priority:e.t3,auth:e.t5,id:e.t6},e.next=14,e.t0.get.call(e.t0,e.t7);case 14:return r=e.sent,a=r.response,o=r.time,t.appendPayload({"event.value":o,"event.url":u,"env.svc.name":_.default.get("ANALYTICS_SUBCATEGORY",p.type)}),c=Date.now(),e.next=21,p.getResponseJson(a,u);case 21:return l=e.sent,o+=Date.now()-c,e.abrupt("return",l);case 24:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 10:if(l=e.sent,d=_.default.get("SOPHIA_RESPONSE_SCHEMA"),!(f=v.default.validateDataFields(l,d))){e.next=15;break}throw new P.default(_.default.analytics.PARAM_VALIDATION_ERR,f);case 15:return l.analyticsData&&(l.analyticsData.requestId=s),e.abrupt("return",l);case 17:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(Re);function Xe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ke(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xe(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xe(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function We(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var qe=function(e){X()(r,e);var t=We(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"dataManager",void 0),a.dataManager=new ge(n.type,a._lookupMap.diskLock),a}return l()(r,[{key:"syncDataPromises",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.analyticsParams,n=t.payload,a=t.surface,s=t.card,i=t.priority,c=t.params,u=t.force,l=t.started,d=_.default.get("IGNORE_PERF_EVENTS_FOR_SURFACES",this._lookupMap.type).includes(a),e.next=4,this.log.context({analytics:!d,payload:n,surfaceAnalytics:[Ke({surface:a},r)]}).time(function(){var e=o()(h.a.mark(function e(t){var r,n,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,f.dataManager.downloadData({modeID:a,card:s,lookupMap:f._lookupMap,priority:i,params:c,started:l,force:u});case 2:r=e.sent,n=r.count,o=r.totalTime,t.appendPayload({"event.url":"URL"===s.dataType&&s.data||"","event.count":n,"event.value":o/n,"exp.surface_id":"".concat(a,"(").concat(s.containerId,")")});case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f,p=this,E=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=E.length>0&&void 0!==E[0]?E[0]:{},r=t.priority,n=t.payload,a=t.params,s=t.progress,i=void 0===s?function(){}:s,c=t.force,u=void 0===c?{type:"none"}:c,this._data){e.next=3;break}return e.abrupt("return");case 3:return l={started:[],complete:[],failed:[]},d=new P.default(_.default.analytics.AGGREGATE_ERROR,_.default.get("AGGREGATE_TYPE",this._lookupMap.type)+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),f=[],Object.keys(this._data.surfaces).forEach(function(e){var t=!1;f.push(v.default.waitAll((p._data.surfaces[e].containers||[]).map(function(){var s=o()(h.a.mark(function s(o){var c;return h.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return(c=new L.a(r)).value+=_.default.get("SURFACE_PRIORITY",p._lookupMap.type)[e]||0,_.default.get("SECONDARY_SURFACES",p._lookupMap.type).includes(e)&&(c.channel=L.b.CcdSecondary),_.default.get("TERTIARY_SURFACES",p._lookupMap.type).includes(e)&&(c.channel=L.b.CcdTertiary),_.default.get("QUARTERNARY_SURFACES",p._lookupMap.type).includes(e)&&(c.channel=L.b.CcdQuarternary),s.next=7,p.syncDataPromises({analyticsParams:o.containerAnalyticsData,payload:n,surface:e,card:o,priority:c,params:a,force:u,started:function(){l.started.includes(e)||(l.started.push(e),i(Object.assign({},l)))}}).catch(function(r){t=!0,d.addSubError(Ke(Ke({surface:e,url:o.data},o.containerAnalyticsData),{},{err:r}))});case 7:case"end":return s.stop()}},s)}));return function(e){return s.apply(this,arguments)}}())).then(function(){l.started.includes(e)||l.started.push(e),t?l.failed.push(e):l.complete.push(e),i(Object.assign({},l))}))}),e.next=9,v.default.waitAll(f);case 9:if(!d.hasSubErrors){e.next=11;break}throw d;case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},!this._data||!this._data.surfaces){e.next=4;break}return e.next=4,v.default.waitAll(Object.keys(this._data.surfaces).map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.default.waitAll((r._data.surfaces[n].containers||[]).map(function(){var e=o()(h.a.mark(function e(a){var s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.dataManager.getReferencedAssets(n,a);case 2:s=e.sent,Object.assign(t,s);case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:return e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(Ee);function Je(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var Qe=function(e){X()(r,e);var t=Je(r);function r(){var e;return c()(this,r),(e=t.call(this,He))._downloadManager=new Ye(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new qe(e,this)}},{key:"_getLookupKeys",value:function(e,t){var r=[t||O.default.getUserId()];return r.push(e.productLanguage),r}},{key:"validateParams",value:function(e){}},{key:"uninstall",value:function(){var e=o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"isRequestPoisoned",value:function(e){return!1}},{key:"generateId",value:function(e){return"".concat(e.productLanguage,"-").concat(R.v4()).trim()}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){var n,a,s=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=null===(n=O.default.getUserInfo())||void 0===n?void 0:n.countryCode,e.next=3,B()(J()(r.prototype),"updateParams",this).call(this,t);case 3:return e.abrupt("return",e.sent.map(function(e){var t=1===v.default.compareMajorMinorVersions(e.productVersion,_.default.get("SURFACE_V2_VERSION",s.type))?["ACCC_ALL_APPS_BANNERS","ACCC_CATEGORIES_BANNERS","ACCC_APPS_CATALOG","ACCC_APP_SKELETON"]:_.default.get("AEM_SURFACES",s.type),r=e.comLocale||(e.productLanguage?e.productLanguage.substring(0,2):"en"),n=e.comCustomerUi||"cc_desktop",o=Object.assign({surfaceId:e.surfaceId,productLanguage:e.productLanguage,productCode:e.productCode||"ACCC",productVersion:e.productVersion,productSemver:e.productSemver||e.productVersion,osVersion:v.default.getOsVersion(),platform:""},a?{countryCode:a}:{},{comLocale:r,comCustomerUi:n},e);return o.surfaceId=t,o.platform=v.default.getOsPlatform(),o}));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"sanitizeParams",value:function(e){return e.productLanguage=v.default.sanitizeLocale(e.productLanguage,_.default.get("SUPPORTED_LOCALES",this.type)),e}},{key:"targetDetails",value:function(e){return{productCode:"ACCC"}}},{key:"isValidDataForParams",value:function(e){var t=e.id,r=e.params,n=this._data.metadata[t];return!(n&&n.params&&n.params.countryCode&&r.countryCode&&n.params.countryCode!==r.countryCode)}},{key:"addNewCollectionData",value:function(){var e=o()(h.a.mark(function e(t){var n,a,s,o,i,c,u,l,d,f,p;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.params){e.next=4;break}throw o=new P.default(_.default.analytics.DATA_VALIDATION_ERR,"No parameters to add the collection of."),this.log.error(o),o;case 4:return e.next=6,this.updateParams([t.params]);case 6:return t.params=e.sent[0],e.next=9,this.paramsToId(t.params);case 9:if(i=e.sent,!(c=null===(n=this._data)||void 0===n?void 0:n.metadata[i])){e.next=21;break}if(d=Array.from((null==c?void 0:null===(u=c.params)||void 0===u?void 0:u.surfaceId)||[]).sort(),f=Array.from((null==t?void 0:null===(l=t.params)||void 0===l?void 0:l.surfaceId)||[]).sort(),JSON.stringify(d)===JSON.stringify(f)){e.next=21;break}if(!t||!t.params){e.next=21;break}if(!(p=this._getCollectionInfo(t.params))){e.next=21;break}return delete p.latestId,e.next=21,this.save();case 21:return null!==(a=t.params)&&void 0!==a&&null!==(s=a.surfaceId)&&void 0!==s&&s.includes("ACCC_ALL_APPS_BANNERS")&&(t.progress=function(){}),e.abrupt("return",B()(J()(r.prototype),"addNewCollectionData",this).call(this,t));case 23:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(he),ze={LABEL:"DISCOVER_PANEL",ANALYTICS_SUBCATEGORY:"DiscoverPanel",VULCAN_TYPE:"DiscoverPanel",LOG_PREFIX:"DiscoverPanel",LOOKUP_MAP_FILE_VERSION:1,LOOKUP_COLLECTION_FILE_VERSION:1,ACTIVE_VERSIONS:["V1","V2","V3"],DIR:"discover_panel/",FILE_ACCESSOR_WRITE_ENABLED:!0,SUPPORTED_PRODUCTS:{PHXS:"22.4",ILST:"26.0"},PARAMETERS_SCHEMA:{id:"discover_panel_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"}},required:["productCode","productVersion","productLanguage"]},V1:{SURFACES:["Discover_Panel"],PREFETCH_CLIENTS:{PHXS:"22.4"},REQUIRED_SURFACES:[]},V2:{SURFACES:["Discover_Panel","DP_Tool_Techniques_v1"],PREFETCH_CLIENTS:{ILST:"27.2",PHXS:"23.3"},REQUIRED_SURFACES:[]},V3:{SURFACES:["Discover_Panel","DP_Tool_Techniques_v1","in_app_contextual_notifications"],PREFETCH_CLIENTS:{ILST:"99.9",PHXS:"99.9"},REQUIRED_SURFACES:[]},PRIORITY_CHANNEL:L.b.DiscoverPanel,NON_IDEMPOTENT_IMAGES:!0,SURFACE_PRIORITY:{Discover_Panel:100,DP_Tool_Techniques_v1:100,in_app_contextual_notifications:100},ANONYMOUS_RETRY_DISABLED:!1,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!1,SOPHIA_VERBOSE_FLAG_ENABLED:!0,UTUTS_API_REQUEST_SURFACE:"help_json",SUPPORTS_ON_DEMAND:!0,ASSET_DOWNLOAD_TIMEOUT:36e5};function Ze(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function $e(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ze(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function et(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var tt=function(e){X()(r,e);var t=et(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"dataManager",void 0),a.dataManager=new ge(n.type,a._lookupMap.diskLock),a}return l()(r,[{key:"syncDataPromises",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.analyticsParams,n=t.payload,a=t.surface,s=t.card,i=t.priority,c=t.params,u=t.force,l=t.started,e.next=3,this.log.context({payload:n,surfaceAnalytics:[$e({surface:a},r)]}).time(function(){var e=o()(h.a.mark(function e(t){var r,n,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.dataManager.downloadData({modeID:a,card:s,lookupMap:d._lookupMap,priority:i,params:c,started:l,force:u});case 2:r=e.sent,n=r.count,o=r.totalTime,t.appendPayload({"event.url":"URL"===s.dataType&&s.data||"","event.count":n,"event.value":o/n,"exp.surface_id":"".concat(a,"(").concat(s.containerId,")")});case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f,p=this,E=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=E.length>0&&void 0!==E[0]?E[0]:{},r=t.priority,n=t.payload,a=t.params,s=t.progress,i=void 0===s?function(){}:s,c=t.force,u=void 0===c?{type:"none"}:c,this._data){e.next=3;break}return e.abrupt("return");case 3:return l={started:[],complete:[],failed:[]},d=[],f=new P.default(_.default.analytics.AGGREGATE_ERROR,_.default.get("AGGREGATE_TYPE",this._lookupMap.type)+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),Object.keys(this._data.surfaces).forEach(function(e){var t=!1;d.push(v.default.waitAll((p._data.surfaces[e].containers||[]).map(function(){var s=o()(h.a.mark(function s(o){var c;return h.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return(c=new L.a(r)).value+=_.default.get("SURFACE_PRIORITY",p._lookupMap.type)[e]||0,s.next=4,p.syncDataPromises({analyticsParams:o.containerAnalyticsData,payload:n,surface:e,card:o,priority:c,params:a,force:u,started:function(){l.started.includes(e)||(l.started.push(e),i(Object.assign({},l)))}}).catch(function(r){t=!0,f.addSubError($e($e({surface:e,url:o.data},o.containerAnalyticsData),{},{err:r}))});case 4:case"end":return s.stop()}},s)}));return function(e){return s.apply(this,arguments)}}())).then(function(){l.started.includes(e)||l.started.push(e),t?l.failed.push(e):l.complete.push(e),i(Object.assign({},l))}))}),e.next=9,v.default.waitAll(d);case 9:if(!f.hasSubErrors){e.next=11;break}throw f;case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},!this._data||!this._data.surfaces){e.next=4;break}return e.next=4,v.default.waitAll(Object.keys(this._data.surfaces).map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.default.waitAll((r._data.surfaces[n].containers||[]).map(function(){var e=o()(h.a.mark(function e(a){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Object,e.t1=t,e.next=4,r.dataManager.getReferencedAssets(n,a,r._lookupMap);case 4:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:return e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(Ee);function rt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var nt=function(e){X()(r,e);var t=rt(r);function r(){var e;return c()(this,r),(e=t.call(this,ze))._downloadManager=new Re(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new tt(e,this)}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){var n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,B()(J()(r.prototype),"updateParams",this).call(this,t);case 2:return(n=e.sent).forEach(function(e){var t=a.getClientVersion(e,a.type);e.surfaceId=_.default.get(t,a.type).SURFACES,e.productSemver=e.productSemver||e.productVersion,e.osVersion=v.default.getOsVersion(),e.platform=v.default.getOsPlatform()}),e.abrupt("return",n);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_checkValidity",value:function(e,t){if(!e||!e.hasValidCards||!e.hasValidCards(t))throw new P.default(m.default.MISSING_DATA,"Failed Sophia Container")}},{key:"getClientVersion",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;return v.default.getClientContentVersion(e,t)}},{key:"getTutorialAssets",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",{});case 2:return(n={})[t]=!0,e.next=6,T.readJSON("".concat(this.getPath()).concat(t)).catch(function(e){s.log.error(new P.default("filesystem",e))});case 6:return null==(a=e.sent)||null===(r=a.tutorials)||void 0===r||r.forEach(function(e){var t,r,a,s;null!==(t=e.metadata)&&void 0!==t&&null!==(r=t.images)&&void 0!==r&&r.heroPath&&(n[e.metadata.images.heroPath]=!0),null!==(a=e.metadata)&&void 0!==a&&null!==(s=a.images)&&void 0!==s&&s.thumbnailPath&&(n[e.metadata.images.thumbnailPath]=!0)}),e.abrupt("return",n);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(he);function at(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function st(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?at(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):at(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ot(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var it=function(e){X()(r,e);var t=ot(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"_lookupMap",void 0),a._lookupMap=n,a}return l()(r,[{key:"totalItems",get:function(){var e;return Object.values((null===(e=this._data)||void 0===e?void 0:e.surfaces)||{}).map(function(e){var t;return(null===(t=e.containers)||void 0===t?void 0:t.map(function(e){var t,r;try{e.content=e.content||JSON.parse((null==e?void 0:e.data)||"{}")}catch(e){}return(null===(t=e.content)||void 0===t?void 0:null===(r=t.models)||void 0===r?void 0:r.length)||0}).reduce(function(e,t){return e+t},0))||0}).reduce(function(e,t){return e+t},0)||0}},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.priority,n=t.payload,a=t.params,s=t.progress,i=void 0===s?function(){}:s,this._data){e.next=3;break}return e.abrupt("return");case 3:return c={count:0,time:0},u={started:[],complete:[],failed:[]},l=Promise.resolve(),d=new P.default(_.default.analytics.AGGREGATE_ERROR,_.default.get("AGGREGATE_TYPE",this._lookupMap.type)+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),e.next=9,this._lookupMap.modelLock.write(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return l=f.log.time(function(){var e=o()(h.a.mark(function e(t){var s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null==(s=f._data)||!s.surfaces){e.next=4;break}return e.next=4,v.default.waitAll(Object.values(s.surfaces).map(function(){var e=o()(h.a.mark(function e(s){var l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.default.waitAll((null===(l=s.containers)||void 0===l?void 0:l.map(function(){var e=o()(h.a.mark(function e(t){var n,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.content=t.content||JSON.parse((null==t?void 0:t.data)||"{}"),e.next=3,v.default.waitAll((null===(n=t.content)||void 0===n?void 0:null===(s=n.models)||void 0===s?void 0:s.map(function(){var e=o()(h.a.mark(function e(n){var s,o,l,p,_;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n.id||!n.prefetch){e.next=14;break}return u.started.push(n.id),i(u),(o=new L.a(r)).value=o.value+(null!==(s=n.priority)&&void 0!==s?s:0)/100,e.next=7,f._lookupMap.downloadModel(n,o,a).catch(function(e){var r,a=void 0;e instanceof P.default&&(a=null===(r=e.ingestPayload)||void 0===r?void 0:r["event.url"]);return d.addSubError(st(st({url:a,id:n.id},t.containerAnalyticsData),{},{err:e})),{path:void 0,time:0}});case 7:return l=e.sent,p=l.path,_=l.time,p?(n.path=p,c.count++,c.time+=_,u.complete.push(n.id)):u.failed.push(n.id),e.next=13,f.save();case 13:i(u);case 14:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()))||[]);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()))||[]);case 2:t.appendPayload(st(st({},n),{},{"event.count":c.count,"event.value":c.time/c.count}));case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=3,v.default.setTimeoutAsync(10);case 3:case"end":return e.stop()}},e)})));case 9:return e.next=11,l;case 11:if(!d.hasSubErrors){e.next=13;break}throw d;case 13:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r,n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},null==(r=this._data)||!r.surfaces){e.next=5;break}return e.next=5,v.default.waitAll(Object.values(r.surfaces).map(function(){var e=o()(h.a.mark(function e(r){var a;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.default.waitAll((null==r?void 0:null===(a=r.containers)||void 0===a?void 0:a.map(function(){var e=o()(h.a.mark(function e(r){var a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.default.waitAll((null==r?void 0:null===(a=r.content)||void 0===a?void 0:null===(s=a.models)||void 0===s?void 0:s.map(function(){var e=o()(h.a.mark(function e(r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Object,e.t1=t,e.next=4,n._lookupMap.getModelAssets(r.path);case 4:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()))||[]);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()))||[]);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 5:return e.abrupt("return",t);case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(Ee);function ct(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var ut=function(e){X()(r,e);var t=ct(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"downloadCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!_.default.get("TEMP_SENSEI_MODELS_CONTENT_DOWNLOAD_DISABLED")){e.next=4;break}return(n=new Date).setDate(n.getDate()+14),e.abrupt("return",{expirationDTS:n.toISOString(),surfaces:{}});case 4:return e.next=6,B()(J()(r.prototype),"downloadCollectionDataRaw",this).call(this,t);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"url",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return delete t.type,e.abrupt("return",B()(J()(r.prototype),"url",this).call(this,t));case 2:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(Re),lt={ANALYTICS_SUBCATEGORY:"SenseiModels",LOOKUP_MAP_FILE_VERSION:1,LOOKUP_COLLECTION_FILE_VERSION:1,SUPPORTED_PRODUCTS:{PHXS:"22.0"},PARAMETERS_SCHEMA:{id:"sensei_models_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},surfaceId:{type:"array",items:{type:"string"}}},required:["productCode","productVersion"]},LOG_PREFIX:"SenseiModels",DIR:"senseiModels/",LABEL:"SENSEI_MODELS",FILE_ACCESSOR_WRITE_ENABLED:!0,PRIORITY_CHANNEL:L.b.SenseiModels,VULCAN_TYPE:"SenseiModels",ANONYMOUS_RETRY_DISABLED:!0,DEFAULT_URLS_ENABLED:!0,DEFAULT_DATA_EXPIRATION:864e5,DEFAULT_URL_WIN:"https://cc-cdn.adobe.com/content/neural-filters/sensei/win-models.json",DEFAULT_URL_MAC:"https://cc-cdn.adobe.com/content/neural-filters/sensei/mac-models.json",MINOR_VERSION_SHOULD_UPDATE_CONTENT:!1,MODEL_URL_PRODUCTION:"https://senseimds.adobe.io/compositemodels/",MODEL_URL_STAGING:"https://senseimds-stage.adobe.io/compositemodels/",ASSET_MINIMUM_PARTIAL_SIZE:1048576,ASSET_MAX_SOCKETS:16,NON_IDEMPOTENT_IMAGES:!0,SUPPORTS_ON_DEMAND:!0,MAXIMUM_PARALLEL_MODEL_DOWNLOADS:2,SOPHIA_VERBOSE_FLAG_ENABLED:!0,ASSET_DOWNLOAD_TIMEOUT:36e5};function dt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ft(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?dt(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function pt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var ht=function(e){X()(r,e);var t=pt(r);function r(){var e;return c()(this,r),e=t.call(this,lt),f()($()(e),"modelLock",void 0),f()($()(e),"downloadModel",void 0),e.downloadModel=v.default.memoize(e._downloadModel,{refresher:function(e){return"pending"!==e.state},resolver:function(e){return e.id},destructor:function(e,t){return"pending"!==t.state}}),e._downloadManager=new ut("SENSEI_MODELS"),e.modelLock=new L.d(_.default.get("MAXIMUM_PARALLEL_MODEL_DOWNLOADS",e.type)),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new it(e,this)}},{key:"generateId",value:function(e){return"".concat(e.productCode,"-").concat(e.productVersion,"-").concat(e.filePrefix?e.filePrefix+"-":"","-").concat(R.v4()).trim()}},{key:"sanitizeParams",value:function(e){var t=!!e.productLanguage,n=B()(J()(r.prototype),"sanitizeParams",this).call(this,e);return t||delete n.productLanguage,n}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,B()(J()(r.prototype),"updateParams",this).call(this,t);case 2:return e.abrupt("return",e.sent.map(function(e){delete e.productLanguage,delete e.countryCode;var t=Object.assign({surfaceId:e.surfaceId||["sensei_model"],productSemver:e.productSemver||e.productVersion,productVersion:e.productVersion,osVersion:v.default.getOsVersion(),platform:""},e);return t.platform=v.default.getOsPlatform(),t}));case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_getLookupKeys",value:function(e,t){var r=[t||O.default.getUserId()||""];return r.push(e.productCode,(e.productVersion||"").match(/\d*(\.\d+)?/)[0]),r}},{key:"getModelUrl",value:function(e){var t=e.id,r=e.type,n=_.default.get("MODEL_URL_"+_.default.getEnvironment().LABEL.toUpperCase(),this.type);return n+=t,(n=new w.URL(n)).searchParams.set("runtime",r),n.toString()}},{key:"_downloadModel",value:function(){var e=o()(h.a.mark(function e(t,r,n,a){var s,i,c,u,l,d,f,p,E,y=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.id&&t.type){e.next=2;break}throw new P.default(_.default.analytics.DATA_VALIDATION_ERR,"Cannot add download model without required fields: id: ".concat(t.id," type: model.type"));case 2:if((a=a||{type:"none"}).type=a.type||"none",a.depth=a.depth||0,s=0,i="Asset-"+t.id,c=this.getModelUrl(t),null==(u=this.cachedAsset(c))||!u.path||!("always"!==a.type||a.depth<1)){e.next=20;break}return e.next=12,T.readJson("".concat(this.getPath(),"/").concat(u.path)).catch(function(){});case 12:if(E=e.sent,e.t0=null!=E&&null!==(l=E.targets)&&void 0!==l&&null!==(d=l[t.type])&&void 0!==d&&d.folder,!e.t0){e.next=18;break}return e.next=17,T.pathExists("".concat(this.getPath(),"/").concat(null==E?void 0:null===(f=E.targets)||void 0===f?void 0:null===(p=f[t.type])||void 0===p?void 0:p.folder));case 17:e.t0=e.sent;case 18:if(!e.t0){e.next=20;break}return e.abrupt("return",{time:0,path:u.path});case 20:return e.next=22,this.modelLock.read(o()(h.a.mark(function e(){var a,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y.fetchAsset({href:c,assetsDir:y.assetsDir,force:{type:"always",depth:3},priority:r,params:ft(ft({},n),{},{filePrefix:t.id}),auth:!0,headers:{"x-api-key":_.default.getEnvironment().CLIENT_ID,"x-forwarded-for":m.default.getIpAddress()},progressKey:i});case 2:return a=e.sent,s+=a.time,u="".concat(y.getPath(),"/").concat(a.path),e.next=7,T.readJson(u);case 7:return l=e.sent,e.next=10,v.default.waitAll(Object.keys((null==l?void 0:l.targets)||{}).map(function(){var e=o()(h.a.mark(function e(o){var c,d,f,p,v,E,g,S,O;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(f=null==l?void 0:null===(c=l.targets)||void 0===c?void 0:null===(d=c[o])||void 0===d?void 0:d.cdnUri)){e.next=28;break}return p=t.id+"-"+o,e.next=5,y.fetchAsset({key:p,href:f,assetsDir:y.assetsDir,priority:r,force:{type:"always",depth:3},params:n,progressKey:i,headers:{"x-api-key":_.default.getEnvironment().CLIENT_ID,"x-forwarded-for":m.default.getIpAddress()}});case 5:return v=e.sent,s+=v.time,E=A.basename(v.path,".bin"),g="".concat(y.assetsDir,"/").concat(E),e.next=11,T.mkdirp(g);case 11:return e.next=13,T.emptyDir(g);case 13:return e.next=15,N.unzip(A.join(g,"../",A.basename(v.path)),g);case 15:return l.targets[o].folder=A.dirname(v.path)+"/"+E,y.cachedAsset(p).path=l.targets[o].folder,e.next=19,T.remove(y.assetsDir+A.basename(v.path));case 19:return e.next=21,N.writeJsonAtomic(A.dirname(u),A.basename(u),l,!0);case 21:if(S=e.sent,O=a.path,a.path=A.basename(A.dirname(S))+"/"+A.basename(S),O===a.path||!y.cachedAsset(f)){e.next=28;break}return y.cachedAsset(f).path=a.path,e.next=28,y.save();case 28:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 10:return e.abrupt("return",{time:s,path:a.path});case 11:case"end":return e.stop()}},e)})),r);case 22:return e.abrupt("return",e.sent);case 23:case"end":return e.stop()}},e,this)}));return function(t,r,n,a){return e.apply(this,arguments)}}()},{key:"defaultCollectionData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.params,r=t.desiredId,n=v.default.isWindows()?_.default.get("DEFAULT_URL_WIN",this.type):_.default.get("DEFAULT_URL_MAC",this.type),e.next=4,this.downloadManager.get({url:n});case 4:return a=e.sent,e.next=7,a.response.json();case 7:return s=e.sent,o=this._createCollectionData(r),i={surfaces:{sensei_model:{containers:[{containerId:1,containerLabel:"1",dataType:"application/json",data:JSON.stringify(s),containerAnalyticsData:{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"},content:s}],surfaceAnalyticsData:{surfaceId:"sensei_model"}}},expirationDTS:new Date(Date.now()+_.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString(),analyticsData:{responseGUID:"dummy",requestId:"dummy"},_ccx:{version:1}},o.setData(i),e.abrupt("return",o);case 12:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_fetchOnDemandContent",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.force,a=t.priority,r.id&&r.type){e.next=3;break}throw new P.default(_.default.analytics.DATA_VALIDATION_ERR,"Cannot add on demand model without required fields: id: ".concat(r.id," type: params.type"));case 3:return s=r.id,o=r.type,i=r.runtime_version,this.modelLock.prioritize(a),e.next=7,this.downloadModel({id:s,type:o,runtime_version:i},a,r,n);case 7:return c=e.sent,u=c.path,e.abrupt("return",u);case 10:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getOnDemandAssetPath",value:function(e){var t,r,n,a=e.id,s=e.type,o=e.runtime_version;return a&&s?null===(t=this._data)||void 0===t?void 0:null===(r=t.assetMetadata)||void 0===r?void 0:null===(n=r[this.getModelUrl({id:a,type:s,runtime_version:o})])||void 0===n?void 0:n.path:void 0}},{key:"_getOnDemandAssetList",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,o,i,c,u,l,d,f,p;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r={},n=Object.values((null===(t=this._data)||void 0===t?void 0:t.onDemandMetadata)||{}),a=0,s=n;case 3:if(!(a<s.length)){e.next=16;break}return c=s[a],u=c.params,l=u.id,d=u.type,f=u.runtime_version,p=l&&d?null===(o=this._data)||void 0===o?void 0:null===(i=o.assetMetadata[this.getModelUrl({id:l,type:d,runtime_version:f})])||void 0===i?void 0:i.path:void 0,e.t0=Object,e.t1=r,e.next=11,this.getModelAssets(p);case 11:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2);case 13:a++,e.next=3;break;case 16:return e.abrupt("return",r);case 17:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getModelAssets",value:function(){var e=o()(h.a.mark(function e(t){var r,n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r={},t){e.next=3;break}return e.abrupt("return",r);case 3:return r[t]=!0,e.next=6,T.readJson(this.assetsDir+"/../"+t).catch(function(){});case 6:return n=e.sent,Object.keys((null==n?void 0:n.targets)||{}).forEach(function(e){var t,a;null!=n&&null!==(t=n.targets)&&void 0!==t&&null!==(a=t[e])&&void 0!==a&&a.folder&&(r[n.targets[e].folder]=!0)}),e.abrupt("return",r);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(he),_t={LABEL:"XD",ANALYTICS_SUBCATEGORY:"XD",VULCAN_TYPE:"XD",LOG_PREFIX:"XD",LOOKUP_MAP_FILE_VERSION:1,LOOKUP_COLLECTION_FILE_VERSION:1,FILE_ACCESSOR_WRITE_ENABLED:!0,ACTIVE_VERSIONS:["V1"],SUPPORTED_PRODUCTS:{SPRK:"43.0"},DIR:"xd/",PARAMETERS_SCHEMA:{id:"xd_client_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"}},required:["productCode","productVersion","productLanguage"]},PRIORITY_CHANNEL:L.b.XdPrimary,SURFACE_PRIORITY:{XD_SURFACE_PRODUCTIVITY_TIP_V1:500},V1:{SURFACES:["XD_SURFACE_PRODUCTIVITY_TIP_V1"],PREFETCH_CLIENTS:{SPRK:"99.0"},SOPHIA_RESPONSE_SCHEMA:{id:"/SOPHIA_RESPONSE",type:"object",properties:{surfaces:{type:"object"},expirationDTS:{type:"string"},version:{type:"number"}},required:["expirationDTS","surfaces"]}},ANONYMOUS_RETRY_DISABLED:!1,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!1,SOPHIA_VERBOSE_FLAG_ENABLED:!0,ASSET_DOWNLOAD_TIMEOUT:36e5};function vt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Et(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vt(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function yt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var mt=function(e){X()(r,e);var t=yt(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"dataManager",void 0),a.dataManager=new ge(n.type,a._lookupMap.diskLock),a}return l()(r,[{key:"validateData",value:function(e,t){return v.default.validateDataFields(e,_.default.get(t,this._lookupMap.type).SOPHIA_RESPONSE_SCHEMA)||null}},{key:"syncDataPromises",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.analyticsParams,n=t.payload,a=t.surface,s=t.card,i=t.priority,c=t.params,u=t.force,l=t.started,e.next=3,this.log.context({payload:n,surfaceAnalytics:[Et({surface:a},r)]}).time(function(){var e=o()(h.a.mark(function e(t){var r,n,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.dataManager.downloadData({modeID:a,card:s,lookupMap:d._lookupMap,priority:i,params:c,started:l,force:u});case 2:r=e.sent,n=r.count,o=r.totalTime,t.appendPayload({"event.url":"URL"===s.dataType&&s.data||"","event.count":n,"event.value":o/n,"exp.surface_id":"".concat(a,"(").concat(s.containerId,")")});case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f,p=this,E=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=E.length>0&&void 0!==E[0]?E[0]:{},r=t.priority,n=t.payload,a=t.params,s=t.progress,i=void 0===s?function(){}:s,c=t.force,u=void 0===c?{type:"none"}:c,this._data){e.next=3;break}return e.abrupt("return");case 3:return l={started:[],complete:[],failed:[]},d=new P.default(_.default.analytics.AGGREGATE_ERROR,_.default.get("AGGREGATE_TYPE",this._lookupMap.type)+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),f=[],Object.keys(this._data.surfaces).forEach(function(e){var t=!1;f.push(v.default.waitAll((p._data.surfaces[e].containers||[]).map(function(){var s=o()(h.a.mark(function s(o){var c;return h.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return(c=new L.a(r)).value+=_.default.get("SURFACE_PRIORITY",p._lookupMap.type)[e]||0,s.next=4,p.syncDataPromises({analyticsParams:o.containerAnalyticsData,payload:n,surface:e,card:o,priority:c,params:a,force:u,started:function(){l.started.includes(e)||(l.started.push(e),i(Object.assign({},l)))}}).catch(function(r){t=!0,d.addSubError(Et(Et({surface:e,url:o.data},o.containerAnalyticsData),{},{err:r}))});case 4:case"end":return s.stop()}},s)}));return function(e){return s.apply(this,arguments)}}())).then(function(){l.started.includes(e)||l.started.push(e),t?l.failed.push(e):l.complete.push(e),i(Object.assign({},l))}))}),e.next=9,v.default.waitAll(f);case 9:if(!d.hasSubErrors){e.next=11;break}throw d;case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},!this._data||!this._data.surfaces){e.next=4;break}return e.next=4,v.default.waitAll(Object.keys(this._data.surfaces).map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.default.waitAll((r._data.surfaces[n].containers||[]).map(function(){var e=o()(h.a.mark(function e(a){var s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.dataManager.getReferencedAssets(n,a);case 2:s=e.sent,Object.assign(t,s);case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:return e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(Ee);function gt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var St=function(e){X()(r,e);var t=gt(r);function r(){var e;return c()(this,r),(e=t.call(this,_t))._downloadManager=new Re(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new mt(e,this)}},{key:"_getLookupKeys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=B()(J()(r.prototype),"_getLookupKeys",this).call(this,e,t),a=this.getClientVersion(e,this.type);return n.splice(1,0,a),n}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){var n,a,s,o=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=null===(n=O.default.getUserInfo())||void 0===n?void 0:n.countryCode,e.next=3,B()(J()(r.prototype),"updateParams",this).call(this,t);case 3:return(s=e.sent).map(function(e){var t=o.getClientVersion(e,o.type);e.surfaceId=_.default.get(t,o.type).SURFACES,e.productSemver=e.productSemver||e.productVersion,e.osVersion=v.default.getOsVersion(),e.platform=v.default.getOsPlatform(),a&&(e.countryCode=a)}),e.abrupt("return",s);case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getClientVersion",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;return v.default.getClientContentVersion(e,t)}}]),r}(he),Ot={LABEL:"Photoshop",ANALYTICS_SUBCATEGORY:"Photoshop",VULCAN_TYPE:"Photoshop",LOG_PREFIX:"Photoshop",LOOKUP_MAP_FILE_VERSION:1,LOOKUP_COLLECTION_FILE_VERSION:1,FILE_ACCESSOR_WRITE_ENABLED:!0,ACTIVE_VERSIONS:["V1"],SUPPORTED_PRODUCTS:{PHXS:"24.1"},DIR:"photoshop/",PARAMETERS_SCHEMA:{id:"photoshop_client_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"}},required:["productCode","productVersion","productLanguage"]},PRIORITY_CHANNEL:L.b.Photoshop,SURFACE_PRIORITY:{Ps_Feature_Flag:500},V1:{SURFACES:["Ps_Feature_Flag"],PREFETCH_CLIENTS:{PHXS:"99.0"},SOPHIA_RESPONSE_SCHEMA:{id:"/SOPHIA_RESPONSE",type:"object",properties:{surfaces:{type:"object"},expirationDTS:{type:"string"},version:{type:"number"}},required:["expirationDTS","surfaces"]}},ANONYMOUS_RETRY_DISABLED:!1,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!1,SOPHIA_VERBOSE_FLAG_ENABLED:!0,ASSET_DOWNLOAD_TIMEOUT:36e5};function Tt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function At(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Tt(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function It(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var Rt=function(e){X()(r,e);var t=It(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"dataManager",void 0),a.dataManager=new ge(n.type,a._lookupMap.diskLock),a}return l()(r,[{key:"validateData",value:function(e,t){return v.default.validateDataFields(e,_.default.get(t,this._lookupMap.type).SOPHIA_RESPONSE_SCHEMA)||null}},{key:"syncDataPromises",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.analyticsParams,n=t.payload,a=t.surface,s=t.card,i=t.priority,c=t.params,u=t.force,l=t.started,e.next=3,this.log.context({payload:n,surfaceAnalytics:[At({surface:a},r)]}).time(function(){var e=o()(h.a.mark(function e(t){var r,n,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.dataManager.downloadData({modeID:a,card:s,lookupMap:d._lookupMap,priority:i,params:c,started:l,force:u});case 2:r=e.sent,n=r.count,o=r.totalTime,t.appendPayload({"event.url":"URL"===s.dataType&&s.data||"","event.count":n,"event.value":o/n,"exp.surface_id":"".concat(a,"(").concat(s.containerId,")")});case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f,p=this,E=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=E.length>0&&void 0!==E[0]?E[0]:{},r=t.priority,n=t.payload,a=t.params,s=t.progress,i=void 0===s?function(){}:s,c=t.force,u=void 0===c?{type:"none"}:c,this._data){e.next=3;break}return e.abrupt("return");case 3:return l={started:[],complete:[],failed:[]},d=new P.default(_.default.analytics.AGGREGATE_ERROR,_.default.get("AGGREGATE_TYPE",this._lookupMap.type)+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),f=[],Object.keys(this._data.surfaces).forEach(function(e){var t=!1;f.push(v.default.waitAll((p._data.surfaces[e].containers||[]).map(function(){var s=o()(h.a.mark(function s(o){var c;return h.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return(c=new L.a(r)).value+=_.default.get("SURFACE_PRIORITY",p._lookupMap.type)[e]||0,s.next=4,p.syncDataPromises({analyticsParams:o.containerAnalyticsData,payload:n,surface:e,card:o,priority:c,params:a,force:u,started:function(){l.started.includes(e)||(l.started.push(e),i(Object.assign({},l)))}}).catch(function(r){t=!0,d.addSubError(At(At({surface:e,url:o.data},o.containerAnalyticsData),{},{err:r}))});case 4:case"end":return s.stop()}},s)}));return function(e){return s.apply(this,arguments)}}())).then(function(){l.started.includes(e)||l.started.push(e),t?l.failed.push(e):l.complete.push(e),i(Object.assign({},l))}))}),e.next=9,v.default.waitAll(f);case 9:if(!d.hasSubErrors){e.next=11;break}throw d;case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},!this._data||!this._data.surfaces){e.next=4;break}return e.next=4,v.default.waitAll(Object.keys(this._data.surfaces).map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.default.waitAll((r._data.surfaces[n].containers||[]).map(function(){var e=o()(h.a.mark(function e(a){var s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.dataManager.getReferencedAssets(n,a);case 2:s=e.sent,Object.assign(t,s);case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:return e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(Ee);function Ct(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var kt=function(e){X()(r,e);var t=Ct(r);function r(){var e;return c()(this,r),(e=t.call(this,Ot))._downloadManager=new Re(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new Rt(e,this)}},{key:"_getLookupKeys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=B()(J()(r.prototype),"_getLookupKeys",this).call(this,e,t),a=this.getClientVersion(e,this.type);return n.splice(1,0,a),n}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){var n,a,s,o=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=null===(n=O.default.getUserInfo())||void 0===n?void 0:n.countryCode,e.next=3,B()(J()(r.prototype),"updateParams",this).call(this,t);case 3:return(s=e.sent).map(function(e){var t=o.getClientVersion(e,o.type);e.surfaceId=_.default.get(t,o.type).SURFACES,e.productSemver=e.productSemver||e.productVersion,e.osVersion=v.default.getOsVersion(),e.platform=v.default.getOsPlatform(),a&&(e.countryCode=a)}),e.abrupt("return",s);case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getClientVersion",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;return v.default.getClientContentVersion(e,t)}}]),r}(he);function xt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function bt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xt(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Nt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var Dt=function(e){X()(r,e);var t=Nt(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"downloadAsset",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.asset,n=t.link,a=t.priority,s=t.analytics,o=t.params,i=r&&r[n],r&&i&&0!==i.length){e.next=4;break}throw new P.default(_.default.analytics.DATA_VALIDATION_ERR,"Missing stock asset for ".concat(JSON.stringify(i)));case 4:return e.next=6,this._lookupMap.fetchAsset({href:i.toString(),assetsDir:this.assetsDir,priority:a,params:o});case 6:c=e.sent,u=c.path,l=c.time,s&&s.count&&s.time&&(s.time+=l,s.count++),r[n]=u;case 11:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"validateData",value:function(e){return v.default.validateDataFields(e,_.default.get("TEMPLATES_DATA_SCHEMA",this._lookupMap.type))}},{key:"totalItems",get:function(){return this._data&&this._data.templates&&this._data.templates.length||0}},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.priority,n=t.payload,a=t.params,s=t.progress,i=void 0===s?function(){}:s,this._data&&this._data.templates){e.next=3;break}return e.abrupt("return");case 3:return c={count:0,time:0},u=[],l={started:0,complete:0,failed:0},d=new P.default(_.default.analytics.AGGREGATE_ERROR,_.default.get("AGGREGATE_TYPE",this._lookupMap.type)+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),this._data.templates.forEach(function(e){l.started++,i(l);var t=0;function n(){return s.apply(this,arguments)}function s(){return(s=o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:2===++t&&(l.complete++,i(l));case 2:case"end":return e.stop()}},e)}))).apply(this,arguments)}e.thumbnail_url&&0!==e.thumbnail_url.length&&e.thumbnail_url.startsWith("http")&&u.push(f.downloadAsset({asset:e,link:"thumbnail_url",priority:r,analytics:c,params:a}).then(n).catch(function(r){var n;d.addSubError({id:null===(n=e.id)||void 0===n?void 0:n.toString(),url:e.thumbnail_url,err:r}),-1!==t&&(l.failed=l.failed+1,i(l),t=-1)})),e.previews&&0!==e.previews.length&&e.previews.forEach(function(s){s&&s.url&&s.url.startsWith("http")&&u.push(f.downloadAsset({asset:s,link:"url",priority:r,analytics:c,params:a}).then(n).catch(function(r){var n;d.addSubError({id:null===(n=e.id)||void 0===n?void 0:n.toString(),url:s.url,err:r}),-1!==t&&(l.failed=l.failed+1,i(l),t=-1)}))})}),e.next=10,this.log.time(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.appendPayload(bt(bt({},n),{},{"event.count":c.count,"event.value":c.time/c.count})),e.next=3,v.default.waitAll(u);case 3:if(!d.hasSubErrors){e.next=5;break}throw d;case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 10:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t={},this._data&&this._data.templates&&this._data.templates.forEach(function(e){e&&e.thumbnail_url&&(t[e.thumbnail_url]=!0),e&&e.previews&&e.previews.forEach(function(e){e&&e.url&&(t[e.url]=!0)})}),e.abrupt("return",t);case 3:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(Ee);function wt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var Lt=function(e){X()(r,e);var t=wt(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"url",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=_.default.getEnvironment(),n=Math.min(100,_.default.get("TEMP_DEFAULT_TEMPLATES_DOWNLOADED")),isNaN(n)&&(n=100),a=new w.URL(_.default.get("URL_".concat(r.LABEL.toUpperCase()),this.type)),s=f()({product:t.productCode,locale:t.productLanguage,country_code:t.countryCode},"search_parameters[limit]","".concat(n)),this.appendUrlSearchParams(a.searchParams,s),e.abrupt("return",a.toString());case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l,d;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.priority,a=t.id,s=void 0===a?R.v4():a,_.default.get("TEMP_DEFAULT_TEMPLATES_DOWNLOADED")){e.next=5;break}return(o=new Date).setDate(o.getDate()+14),e.abrupt("return",{expirationDTS:o.toISOString(),templates:[]});case 5:return e.next=7,this.url(r);case 7:return i=e.sent,e.t0=this,e.t1=i,e.t2={timeout:_.default.get("SERVER_TIMEOUT"),headers:{"X-API-Key":_.default.getEnvironment().CLIENT_ID,"X-Product":"".concat(r.productCode,"/").concat(r.productVersion),"Content-Type":"application/json"}},e.t3=n,e.t4=s,e.next=15,O.default.getAccessToken().catch(function(e){return!1});case 15:return e.t5=!!e.sent,e.t6={url:e.t1,options:e.t2,priority:e.t3,id:e.t4,auth:e.t5},e.next=19,e.t0.get.call(e.t0,e.t6);case 19:return c=e.sent,u=c.response,e.next=23,this.getResponseJson(u,i);case 23:return"number"==typeof(l=e.sent).expirationDTS&&(d=new Date(1e3*l.expirationDTS),l.expirationDTS=d.toISOString()),e.abrupt("return",l);case 26:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(Re),Pt={ANALYTICS_SUBCATEGORY:"Stock",LOOKUP_MAP_FILE_VERSION:3,LOOKUP_COLLECTION_FILE_VERSION:1,FILE_ACCESSOR_WRITE_ENABLED:!0,SUPPORTED_PRODUCTS:{IDSN:"12.0",ILST:"21.0",PHXS:"18.0"},PARAMETERS_SCHEMA:{id:"stock_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"},countryCode:{type:"string"}},required:["productCode","productVersion","productLanguage","countryCode"]},TEMPLATES_DATA_SCHEMA:{id:"STOCK_TEMPLATES_DATA",type:"object",properties:{templates:{type:"array"},expirationDTS:{type:"string"},nb_results:{type:"number"}},required:["expirationDTS"]},LOG_PREFIX:"Stock",URL_STAGING:"https://stock-stage.adobe.io/Rest/Media/1/Search/Templates",URL_PRODUCTION:"https://stock.adobe.io/Rest/Media/1/Search/Templates",DIR:"stock/",LABEL:"STOCK",PRIORITY_CHANNEL:L.b.Stock,ANONYMOUS_RETRY_DISABLED:!0,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!1,TEMP_DEFAULT_TEMPLATES_DOWNLOADED:100,ASSET_DOWNLOAD_TIMEOUT:36e5};function Mt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var Ut=function(e){X()(r,e);var t=Mt(r);function r(){var e;return c()(this,r),(e=t.call(this,Pt))._downloadManager=new Lt(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new Dt(e,this)}},{key:"uninstall",value:function(){var e=o()(h.a.mark(function e(t){var n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ce.default.getInstalledApps();case 2:if(n=e.sent,!t.productCode||!n[t.productCode]){e.next=5;break}return e.abrupt("return");case 5:return e.abrupt("return",B()(J()(r.prototype),"uninstall",this).call(this,t));case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_getLookupKeys",value:function(e,t){var r=[t||O.default.getUserId()||""];return r.push(e.productCode,e.productLanguage),r}}]),r}(he);function Ft(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var Vt=function(e){X()(r,e);var t=Ft(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"totalItems",get:function(){return 1}},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t={},this._data&&this._data.path&&(t[this._data.path]=!0),e.abrupt("return",t);case 3:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.priority,t.payload,n=t.params,e.next=3,this._lookupMap.fetchAsset({href:this._data.user.images[50],assetsDir:this.assetsDir,priority:r,params:n});case 3:return a=e.sent,s=a.path,this._data.path=s,e.abrupt("return");case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(Ee);function jt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var Gt=function(e){X()(r,e);var t=jt(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"url",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=_.default.getEnvironment(),n=O.default.getUserId(),a=_.default.get("URL_".concat(r.LABEL.toUpperCase()),this.type),s=new w.URL("".concat(a).concat(n)),this.appendUrlSearchParams(s.searchParams,{card:"0"}),e.abrupt("return",s.toString());case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.params,n=t.priority,a=t.id,void 0===a?R.v4():a,e.next=3,this.url(r);case 3:return s=e.sent,e.next=6,this.log.context({params:r}).time(function(){var e=o()(h.a.mark(function e(t){var r,a,o,i,c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.get({url:s,priority:n,options:{method:"GET",headers:{"X-API-Key":_.default.getEnvironment().CLIENT_ID}}});case 2:return r=e.sent,a=r.response,o=r.time,t.appendPayload({"event.value":o,"event.url":s,"env.svc.name":_.default.get("ANALYTICS_SUBCATEGORY",d.type)}),i=Date.now(),e.next=9,d.getResponseJson(a,s);case 9:return c=e.sent,o+=Date.now()-i,e.abrupt("return",c);case 12:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 6:if(i=e.sent,c=_.default.get("RESPONSE_SCHEMA",this.type),!(u=v.default.validateDataFields(i,c))){e.next=11;break}throw new P.default(_.default.analytics.PARAM_VALIDATION_ERR,u);case 11:return(l=new Date).setDate(l.getDate()+1),i.expirationDTS=l.toISOString(),e.abrupt("return",i);case 15:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(Re),Ht={ANALYTICS_SUBCATEGORY:"Avatar",LOG_PREFIX:"Avatar",DIR:"avatar/",LABEL:"AVATAR",VULCAN_TYPE:"Avatar",LOOKUP_MAP_FILE_VERSION:1,FILE_ACCESSOR_WRITE_ENABLED:!0,LOOKUP_COLLECTION_FILE_VERSION:1,PARAMETERS_SCHEMA:{id:"avatar_parameters",type:"object",properties:{}},RESPONSE_SCHEMA:{id:"avatar_endpoint_schema",type:"object",properties:{user:{type:"object",properties:{images:{type:"object",properties:{50:{type:"string"}},required:["50"]}},required:["images"]}},required:["user"]},SUPPORTED_PRODUCTS:{CCXP:"4.3"},URL_STAGING:"https://cc-api-behance-stage.adobe.io/v2/users/",URL_PRODUCTION:"https://cc-api-behance.adobe.io/v2/users/",PRIORITY_CHANNEL:L.b.Avatar,ANONYMOUS_RETRY_DISABLED:!0,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!1,ASSET_DOWNLOAD_TIMEOUT:36e5};function Bt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var Yt=function(e){X()(r,e);var t=Bt(r);function r(){var e;return c()(this,r),(e=t.call(this,Ht))._downloadManager=new Gt(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new Vt(e,this)}},{key:"uninstall",value:function(){var e=o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return");case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"_getLookupKeys",value:function(e,t){return[t||O.default.getUserId()||""]}},{key:"isRequestPoisoned",value:function(e){return!1}},{key:"generateId",value:function(e){return"".concat(R.v4()).trim()}}]),r}(he);function Xt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Kt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xt(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Wt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var qt=function(e){X()(r,e);var t=Wt(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"dataManager",void 0),a.dataManager=new ge(n.type,a._lookupMap.diskLock),a}return l()(r,[{key:"syncDataPromises",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.analyticsParams,n=t.payload,a=t.surface,s=t.card,i=t.priority,c=t.params,u=t.force,l=t.started,e.next=3,this.log.context({payload:n,surfaceAnalytics:[Kt({surface:a},r)]}).time(function(){var e=o()(h.a.mark(function e(t){var r,n,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.dataManager.downloadData({modeID:a,card:s,lookupMap:d._lookupMap,priority:i,params:c,started:l,force:u});case 2:r=e.sent,n=r.count,o=r.totalTime,t.appendPayload({"event.url":"URL"===s.dataType&&s.data||"","event.count":n,"event.value":o/n,"exp.surface_id":"".concat(a,"(").concat(s.containerId,")")});case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f,p=this,E=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=E.length>0&&void 0!==E[0]?E[0]:{},r=t.priority,n=t.payload,a=t.params,s=t.progress,i=void 0===s?function(){}:s,c=t.force,u=void 0===c?{type:"none"}:c,this._data){e.next=3;break}return e.abrupt("return");case 3:return l={started:[],complete:[],failed:[]},d=[],f=new P.default(_.default.analytics.AGGREGATE_ERROR,_.default.get("AGGREGATE_TYPE",this._lookupMap.type)+_.default.analytics.AGGREGATE_ERROR_DESCRIPTION),Object.keys(this._data.surfaces).forEach(function(e){var t=!1;d.push(v.default.waitAll((p._data.surfaces[e].containers||[]).map(function(){var s=o()(h.a.mark(function s(o){var c;return h.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return(c=new L.a(r)).value+=_.default.get("SURFACE_PRIORITY",p._lookupMap.type)[e]||0,s.next=4,p.syncDataPromises({analyticsParams:o.containerAnalyticsData,payload:n,surface:e,card:o,priority:c,params:a,force:u,started:function(){l.started.includes(e)||(l.started.push(e),i(Object.assign({},l)))}}).catch(function(r){t=!0,f.addSubError(Kt(Kt({surface:e,url:o.data},o.containerAnalyticsData),{},{err:r}))});case 4:case"end":return s.stop()}},s)}));return function(e){return s.apply(this,arguments)}}())).then(function(){l.started.includes(e)||l.started.push(e),t?l.failed.push(e):l.complete.push(e),i(Object.assign({},l))}))}),e.next=9,v.default.waitAll(d);case 9:if(!f.hasSubErrors){e.next=11;break}throw f;case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"totalItems",get:function(){var e;return null!==(e=this._data)&&void 0!==e&&e.surfaces?Object.keys(this._data.surfaces).length:0}},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},!this._data||!this._data.surfaces){e.next=4;break}return e.next=4,v.default.waitAll(Object.keys(this._data.surfaces).map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.default.waitAll((r._data.surfaces[n].containers||[]).map(function(){var e=o()(h.a.mark(function e(a){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Object,e.t1=t,e.next=4,r.dataManager.getReferencedAssets(n,a,r._lookupMap);case 4:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:return e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(Ee),Jt={LABEL:"COLLECTION_TEMPLATES",ANALYTICS_SUBCATEGORY:"CollectionTemplates",VULCAN_TYPE:"CollectionTemplates",LOG_PREFIX:"CollectionTemplates",LOOKUP_MAP_FILE_VERSION:1,LOOKUP_COLLECTION_FILE_VERSION:1,FILE_ACCESSOR_WRITE_ENABLED:!0,ACTIVE_VERSIONS:["V1"],DIR:"collectionTemplates/",SUPPORTED_PRODUCTS:{ILST:"26.0"},PARAMETERS_SCHEMA:{id:"stock_collection_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"},countryCode:{type:"string"}},required:["productCode","productVersion","productLanguage","countryCode"]},TEMPLATES_DATA_SCHEMA:{id:"STOCK_COLLECTIONS_DATA",type:"object",properties:{templates:{type:"array"},expirationDTS:{type:"string"},nb_results:{type:"number"}},required:["expirationDTS"]},V1:{SURFACES:["CCX_Start_5.11_Stock"],PREFETCH_CLIENTS:{ILST:"26.0"}},COLLECTION_URL_STAGING:"https://stock-stage.adobe.io/Rest/Media/1/Search/Collections",COLLECTION_URL_PRODUCTION:"https://stock.adobe.io/Rest/Media/1/Search/Collections",PRIORITY_CHANNEL:L.b.CollectionTemplates,SURFACE_PRIORITY:{"CCX_Start_5.11_Stock":0},ANONYMOUS_RETRY_DISABLED:!1,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!1,SOPHIA_VERBOSE_FLAG_ENABLED:!0,ASSET_DOWNLOAD_TIMEOUT:36e5};function Qt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var zt=function(e){X()(r,e);var t=Qt(r);function r(){var e;return c()(this,r),(e=t.call(this,Jt))._downloadManager=new Re(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new qt(e,this)}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){var n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,B()(J()(r.prototype),"updateParams",this).call(this,t);case 2:return(n=e.sent).forEach(function(e){var t=a.getClientVersion(e,a.type);e.surfaceId=_.default.get(t,a.type).SURFACES,e.productSemver=e.productSemver||e.productVersion,e.osVersion=v.default.getOsVersion(),e.platform=v.default.getOsPlatform()}),e.abrupt("return",n);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"uninstall",value:function(){var e=o()(h.a.mark(function e(t){var n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ce.default.getInstalledApps();case 2:if(n=e.sent,!t.productCode||!n[t.productCode]){e.next=5;break}return e.abrupt("return");case 5:return e.abrupt("return",B()(J()(r.prototype),"uninstall",this).call(this,t));case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_getLookupKeys",value:function(e,t){var r=[t||O.default.getUserId()||""];return r.push(e.productCode,e.productLanguage),r}},{key:"getClientVersion",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;return v.default.getClientContentVersion(e,t)}},{key:"getCollectionAsset",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",{});case 2:return(r={})[t]=!0,e.next=6,T.readJSON("".concat(this.getPath()).concat(t)).catch(function(e){a.log.error(new P.default("filesystem",e))});case 6:return null==(n=e.sent)||n.files.forEach(function(e){e.thumbnail_url&&(r[e.thumbnail_url]=!0)}),e.abrupt("return",r);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(he);function Zt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function $t(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Zt(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var er=function(){function e(t){c()(this,e),f()(this,"log",void 0),f()(this,"maps",void 0),f()(this,"_firstMileLookupMap",void 0),f()(this,"_stockLookupMap",void 0),f()(this,"_learnLookupMap",void 0),f()(this,"_downloadManager",void 0),this.log=new E.default({prefix:"ServiceInterface > ",payload:{"event.subtype":m.default.st_CLIENT},combineSubErrors:!0}),this._firstMileLookupMap=t.find(function(e){return"FIRST_MILE"===e.type}),this._stockLookupMap=t.find(function(e){return"STOCK"===e.type}),this._learnLookupMap=t.find(function(e){return"LEARN"===e.type}),this.maps=t}return l()(e,[{key:"init",value:function(){var e=o()(h.a.mark(function e(){var t,r,n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:ce.default.addListener(_.default.get("VULCAN_PING_REQUEST"),function(e,t,r){ce.default.sendMessage(_.default.get("VULCAN_PING_RESPONSE"),"",t,r)}),ce.default.addListener(_.default.get("VULCAN_AVATAR_REQUEST"),function(e,t,r){var a=n.log.context({payload:{"event.subcategory":_.default.analytics.sc_CCX_START}}),s=t,i=r;e=JSON.stringify({params:{productCode:t,productVersion:r}}),ce.default.once(_.default.get("VULCAN_AVATAR_RESPONSE_V2"),function(){var e=o()(h.a.mark(function e(t,r,n){var c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(t=JSON.parse(t)).path){e.next=8;break}return e.next=5,T.readFile(t.path,{encoding:"utf-8"});case 5:u=e.sent,l=JSON.parse(u),c={path:"".concat(_.default.get("ROOT_DIR")).concat(_.default.get("DIR","AVATAR")).concat(l.path)};case 8:e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),a.error(new P.default(_.default.analytics.INVALID_JSON,e.t0),"Unable to parse avatar message: ".concat(t)),c={path:"",err:"Unable to parse avatar message: ".concat(t)};case 14:a.request(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:ce.default.sendMessage(_.default.get("VULCAN_AVATAR_RESPONSE"),JSON.stringify(c),s,i);case 1:case"end":return e.stop()}},e)})));case 15:case"end":return e.stop()}},e,null,[[0,10]])}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.sendMessage(_.default.get("VULCAN_AVATAR_REQUEST_V2"),e,"CCXP","1.0.0")}),ce.default.addListener(_.default.get("VULCAN_PSDK_FEED_REQUEST"),function(){var e=o()(h.a.mark(function e(t,r,a){var s,i,c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i={};try{i=JSON.parse(t)}catch(e){s=new P.default(_.default.analytics.PARAM_VALIDATION_ERR,e).setContext("Unable to parse PSDK feed data:".concat(t))}return i.psdkParams=i.psdkParams||{},u={"event.context_guid":i.radarSessionGUID||R.v4()},c=n.log.context({params:i&&i.psdkParams,payload:$t({"event.subcategory":_.default.analytics.sc_SOPHIA},u)}),e.next=7,c.request(o()(h.a.mark(function e(){var t,r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!s){e.next=2;break}throw s;case 2:if(O.default.getUserId()){e.next=4;break}throw new Error(_.default.analytics.SIGNED_OUT);case 4:return t=n._firstMileLookupMap,r={requestId:i.requestId,settings:_.default.get("".concat(i.psdkParams.productCode,"_PSDK"),"SETTINGS_".concat(O.default.getUserId()))||{}},e.next=8,t.updateDisplayedId({params:i.psdkParams,displayed:i.psdkParams.displayed});case 8:if(!i.psdkParams.urgent){e.next=17;break}return delete i.psdkParams.urgent,e.next=12,t.addNewCollectionData({params:i.psdkParams,payload:u,priorityLevel:L.c.UrgentRequest,fetchType:"client-request"});case 12:return e.next=14,t.getLatestPath({params:i.psdkParams,updateLastUsedId:!0,updateLastUseTime:!0});case 14:r.path=e.sent,e.next=21;break;case 17:return e.next=19,t.getLatestPath({params:i.psdkParams,updateLastUsedId:!0,updateLastUseTime:!0});case 19:r.path=e.sent,r.path||t.addNewCollectionData({params:i.psdkParams,payload:u,priorityLevel:L.c.BackgroundRequest,fetchType:"client-request"});case 21:return r.path&&(r.path=r.path.replace(/\\/gi,"/")),e.abrupt("return",r);case 23:case"end":return e.stop()}},e)}))).catch(function(e){return{requestId:i.requestId,err:e}});case 7:l=e.sent,ce.default.sendMessage(_.default.get("VULCAN_PSDK_FEED_RESPONSE"),l,r,a);case 9:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.addListener(_.default.get("VULCAN_LEARN_REQUEST"),function(){var e=o()(h.a.mark(function e(t,r,a){var s,i,c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i={};try{i=JSON.parse(t)}catch(e){s=new P.default(_.default.analytics.PARAM_VALIDATION_ERR,e).setContext("Unable to parse Learn feed data:".concat(t))}return i.params=i.params||{},u={"event.context_guid":i.radarSessionGUID||R.v4()},c=n.log.context({params:i&&i.params,payload:$t({"event.subcategory":_.default.analytics.sc_LEARN},u)}),e.next=7,c.request(o()(h.a.mark(function e(){var t,r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!s){e.next=2;break}throw s;case 2:if(O.default.getUserId()){e.next=4;break}throw new P.default(_.default.analytics.SIGNED_OUT,"","X_ERR_USER_SIGNEDOUT");case 4:return t=n._learnLookupMap,r={requestId:i.requestId},e.next=8,t.addNewCollectionData({params:i.params,payload:u,priorityLevel:L.c.BackgroundRequest,fetchType:"client-request"});case 8:return e.next=10,t.getLatestPath({params:i.params,updateLastUsedId:!0,updateLastUseTime:!1});case 10:return r.path=e.sent,r.path&&(r.path=r.path.replace(/\\/gi,"/")),e.abrupt("return",r);case 13:case"end":return e.stop()}},e)}))).catch(function(e){return{requestId:i.requestId,err:e}});case 7:l=e.sent,ce.default.sendMessage(_.default.get("VULCAN_LEARN_RESPONSE"),l,r,a);case 9:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.addListener(_.default.get("VULCAN_LEARN_USAGE_MARKER"),function(){var e=o()(h.a.mark(function e(t,r,a){var s,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.log.context({payload:{"event.subcategory":_.default.analytics.sc_LEARN}}),e.prev=1,o=JSON.parse(t),e.next=5,n._learnLookupMap.getLatestPath({params:o.params,updateLastUsedId:!1,updateLastUseTime:!0});case 5:s.context({params:o.params,payload:{"event.context_guid":o.radarSessionGUID||R.v4()}}).info(_.default.analytics.t_UPDATE,"Update last use time"),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),s.error(new P.default(_.default.analytics.PARAM_VALIDATION_ERR,e.t0),"Error parsing learn usage marker");case 11:case"end":return e.stop()}},e,null,[[1,8]])}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.addListener(_.default.get("VULCAN_GET_USER_REQUEST"),function(){var e=o()(h.a.mark(function e(t,r,a){var s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.log.context({payload:{"event.subcategory":_.default.analytics.sc_CCX_START}}),e.next=3,s.request(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:ce.default.sendMessage(_.default.get("VULCAN_GET_USER_RESPONSE"),{userId:O.default.getUserId()},r,a);case 1:case"end":return e.stop()}},e)})));case 3:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.addListener(_.default.get("VULCAN_START_SETTINGS_REQUEST"),function(){var e=o()(h.a.mark(function e(t,r,a){var s,i,c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:s=null,i=null;try{i=JSON.parse(t)}catch(e){s=new Error("Unable to parse settings storage request from ".concat(r,"(").concat(a,"): ").concat(t))}return c=n.log.context({params:i,payload:{"event.subcategory":m.default.sc_CCX_START}}),e.next=6,c.request(o()(h.a.mark(function e(){var t,r,n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!s){e.next=2;break}throw s;case 2:if(O.default.getUserId()){e.next=4;break}throw new Error("Discarding start settings storage - not logged in");case 4:if(O.default.getUserId()===i.userId){e.next=6;break}throw new Error("Different user in request(".concat(i.userId,") than the one logged in(").concat(O.default.getUserId(),")"));case 6:t="".concat(i.productCode,"_PSDK"),r="SETTINGS_".concat(O.default.getUserId()),n=_.default.get(t,r)||{},Object.keys(i.settings).forEach(function(e){n[e]?Object.assign(n[e],i.settings[e]):n[e]=i.settings[e]}),n.lastModified=(new Date).toISOString(),_.default.set(t,n,r);case 12:case"end":return e.stop()}},e)}))).catch(function(e){return i=null});case 6:i&&ce.default.sendMessage(_.default.get("VULCAN_START_SETTINGS_PATCH_UPDATE"),{settings:i.settings,userId:i.userId},i.productCode);case 7:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.addListener(_.default.get("VULCAN_START_SETTINGS_GET_REQUEST"),function(){var e=o()(h.a.mark(function e(t,r,a){var s,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:s={},o=n.log.context({params:{productCode:r,productVersion:a},payload:{"event.subcategory":m.default.sc_CCX_START,"event.subtype":m.default.st_SETTINGS}});try{s=JSON.parse(t)}catch(e){o.error(new Error("Unable to parse settings get request from ".concat(r,"(").concat(a,"): ").concat(t)))}ce.default.sendMessage(_.default.get("VULCAN_START_SETTINGS_GET_RESPONSE"),{requestId:s.requestId,userId:O.default.getUserId(),settings:_.default.get("".concat(r,"_PSDK"),"SETTINGS_".concat(O.default.getUserId()))||{}},r,a);case 4:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.addListener(_.default.get("VULCAN_STOCK_REQUEST"),function(){var e=o()(h.a.mark(function e(t,r,a){var s,i,c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i={};try{i=JSON.parse(t)}catch(e){(s=new Error(_.default.analytics.PARAM_VALIDATION_ERR)).desc="Unable to parse Stock template request:".concat(t)}return i.stockParams=i.stockParams||{},u={"event.context_guid":i.radarSessionGUID||R.v4()},c=n.log.context({params:i.stockParams,payload:$t({"event.subcategory":_.default.analytics.sc_STOCK},u)}),e.next=7,c.request(o()(h.a.mark(function e(){var t,r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!s){e.next=2;break}throw s;case 2:if(O.default.getUserId()){e.next=4;break}throw new Error(_.default.analytics.SIGNED_OUT);case 4:return t=n._stockLookupMap,r={requestId:i.requestId},e.next=8,t.getLatestPath({params:i.stockParams,updateLastUsedId:!0,updateLastUseTime:!0});case 8:return r.path=e.sent,r.path||t.addNewCollectionData({params:i.stockParams,priorityLevel:L.c.BackgroundRequest,fetchType:"client-request"}),r.path&&(r.path=r.path.replace(/\\/gi,"/")),e.abrupt("return",r);case 12:case"end":return e.stop()}},e)}))).catch(function(e){return{requestId:i.requestId,err:e}});case 7:l=e.sent,ce.default.sendMessage(_.default.get("VULCAN_STOCK_RESPONSE"),l,r,a);case 9:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.addListener(_.default.get("VULCAN_CC_PHOTO_DOWNLOAD_REQUEST"),function(){var e=o()(h.a.mark(function e(t,r,a){var s,i,c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i="OZ",c=_.default.analytics.sc_LR_CONTENT,u=_.default.analytics.sc_OZ,e.prev=3,(s=JSON.parse(t)).source&&s.source===_.default.get("CC_SEARCH_IDENTIFIER")&&(i="CCSearch",c=_.default.analytics.sc_CC_SEARCH,u=_.default.analytics.sc_CC_SEARCH_STORAGE),s.source&&s.source===_.default.get("CC_TOUT_DOWNLOAD_IDENTIFIER")&&(i="CCXFileDownload",c=_.default.analytics.sc_CCX_FILE_DOWNLOAD,u=s.downloadSubcategory),e.next=14;break;case 9:return e.prev=9,e.t0=e.catch(3),ce.default.sendMessage(_.default.get("VULCAN_CC_PHOTO_DOWNLOAD_ERROR"),e.t0.toString(),r,a),n.log.context({payload:{"event.subcategory":_.default.analytics.sc_CC_PHOTO,"source.name":r,"source.version":a,"ccxp.mode":"download"}}).error(new P.default(e.t0)),e.abrupt("return");case 14:return e.next=16,n.log.context({payload:{"event.subcategory":c,"source.name":r,"source.version":a,"ccxp.mode":"download"}}).request(o()(h.a.mark(function e(){var t,c,l,d;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=A.join(k.tmpdir(),_.default.get("TMP_PHOTOS_DOWNLOAD_DIRECTORY")),c="".concat(s.id,"-").concat(s.filename),l=t+c,d={id:s.id,path:l.replace(/\\/g,"/")},e.next=6,T.access(l,T.constants.R_OK).catch(function(){var e=o()(h.a.mark(function e(t){var c,d,f,p;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n._downloadManager=n._downloadManager||new Re(i),c=R.v4(),e.next=4,n.log.context({payload:{"event.subcategory":u,"event.subtype":_.default.analytics.st_API,"source.name":r,"source.version":a,"ccxp.mode":"download"}}).request(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n._downloadManager.get({url:s.url,options:{headers:{"x-api-key":s.clientId}},auth:!0,id:c});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)})));case 4:return d=e.sent,f=d.response,p=f.headers.get("content-length"),e.next=9,N.writeAtomic({response:f,target:l,progress:function(e){ce.default.sendMessage(_.default.get("VULCAN_CC_PHOTO_DOWNLOAD_PROGRESS"),{id:s.id,percentage:100*e/p},r,a)}});case 9:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 6:return e.next=8,v.default.deleteTempFiles(t,void 0).catch(function(e){return n.log.disk("Err deleting temp files - ".concat(e))});case 8:return e.abrupt("return",d);case 9:case"end":return e.stop()}},e)}))).catch(function(e){ce.default.sendMessage(_.default.get("VULCAN_CC_PHOTO_DOWNLOAD_ERROR"),e.toString(),r,a)});case 16:(l=e.sent)&&ce.default.sendMessage(_.default.get("VULCAN_CC_PHOTO_DOWNLOAD_RESPONSE"),l,r,a);case 18:case"end":return e.stop()}},e,null,[[3,9]])}));return function(t,r,n){return e.apply(this,arguments)}}()),null===(t=this._firstMileLookupMap)||void 0===t||t.addListener("newCollection",function(e){ce.default.sendMessage(_.default.get("VULCAN_PSDK_FEED_BROADCAST"),e,e.productCode,e.productVersion)}),null===(r=this._learnLookupMap)||void 0===r||r.addListener("newCollection",function(e){ce.default.sendMessage(_.default.get("VULCAN_LEARN_BROADCAST"),e,e.productCode,e.productVersion)}),this.maps.forEach(function(e){var t=_.default.get("VULCAN_TYPE",e.type),r=function(){var r=o()(h.a.mark(function r(a,s,i,c){var u,l,d,f,p,E,y,g,S,T,A,I,R,C=arguments;return h.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:d=C.length>4&&void 0!==C[4]?C[4]:"client-request",p={};try{p=JSON.parse(a)}catch(e){f=new P.default(_.default.analytics.PARAM_VALIDATION_ERR,"Unable to parse ".concat(t," request:").concat(a))}if(E=void 0,y=null,(g=function(){null!=y&&clearTimeout(y),y=c?setTimeout(function(){n.log.error(new P.default("CCX Process Hung. Quitting",void 0,"X_ERR_PROCESS_HUNG")),m.default.flush(!0,process.exit)},_.default.get("CLIENT_REQUEST_TIMEOUT")):null})(),S=p.params||{},T=p.analytics||{},p.force&&((A=p.force).delay?(d="delayed",E=A.delay):"always"===A.type?d="force-always":"stale"===A.type&&(d="expired")),I=n.log.context({params:S,payload:$t($t($t({},T),{},{"event.subcategory":_.default.get("ANALYTICS_SUBCATEGORY",e.type),"ccxp.mode":d},"client-request"!==d&&{"ccxp.force_depth":null===(u=p)||void 0===u?void 0:null===(l=u.force)||void 0===l?void 0:l.depth}),void 0!==E&&{"event.value":E})}),ee.b.status!==ee.b.OFFLINE&&!D.b.isWaitingForBackOff(D.a.NETWORK)){r.next=15;break}return n.log.disk("Incoming client Request while in Network Backoff or Offline - Doing network Check"),r.next=15,ee.b.check(ee.a.CLIENT_REQUEST);case 15:return r.next=17,I.request(o()(h.a.mark(function r(){var n,a,o;return h.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!f){r.next=2;break}throw f;case 2:if(O.default.getUserId()){r.next=4;break}throw new P.default(_.default.analytics.SIGNED_OUT,_.default.analytics.SIGNED_OUT,"X_ERR_USER_SIGNEDOUT");case 4:if(n=v.default.validateDataFields(p,_.default.get("SERVICE_REQUEST_SCHEMA")),!Array.isArray(n)){r.next=7;break}throw n[0];case 7:if(!p.displayed){r.next=10;break}return r.next=10,e.updateDisplayedId(p);case 10:if(c){r.next=15;break}if(!p.updateLastUseTime){r.next=14;break}return r.next=14,e.getLatestPath(p);case 14:return r.abrupt("return");case 15:return a={requestId:p.requestId},r.next=18,e.addNewCollectionData({params:S,payload:T,priorityLevel:p.urgent?L.c.UrgentRequest:L.c.BackgroundRequest,force:$t($t({type:"none"},p.force),{},{from:Date.now()}),fetchType:d,progress:function(e){e.requestId=p.requestId,ce.default.sendMessage("ccxprocess.".concat(t,"Progress"),e,s,i),g()}});case 18:if(o=r.sent,!E){r.next=23;break}a.scheduled=!0,r.next=28;break;case 23:return r.next=25,e.getLatestPath($t($t({},p),{},{updateLastUsedId:!0,updateLastUseTime:p.urgent?!1!==p.updateLastUseTime:p.updateLastUseTime}));case 25:a.path=r.sent,a.contentId=null==o?void 0:o.id,a.expiry=o&&e.getExpiry(o.id)||(null==o?void 0:o.expiryTime);case 28:return r.abrupt("return",a);case 29:case"end":return r.stop()}},r)}))).catch(function(){var t=o()(h.a.mark(function t(r){var n,a,s,o,i,c;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(a=void 0,s=void 0,!(r instanceof P.default&&null!==(n=r.supportData)&&void 0!==n&&n.id)){t.next=9;break}return t.next=5,e.updatePending({params:S,id:null===(o=r.supportData)||void 0===o?void 0:o.id,updateLastUseTime:p.urgent||p.updateLastUseTime||!1,err:r});case 5:a=null===(i=r.supportData)||void 0===i?void 0:i.path,s=r.subErrorJSON,t.next=14;break;case 9:return t.next=11,e.getPending({params:S,updateLastUseTime:p.urgent||p.updateLastUseTime||!1});case 11:c=t.sent,a=null==c?void 0:c.partial,s=null==c?void 0:c.failures;case 14:return a&&(a=e.getPath()+a),t.abrupt("return",$t($t({requestId:p.requestId,err:r instanceof Error&&!(r instanceof P.default)?{message:r.message}:r},void 0!==a&&{partial:a}),{},{failures:s}));case 16:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}());case 17:R=r.sent,c&&(null!=y&&clearTimeout(y),ce.default.sendMessage("ccxprocess.".concat(t,"Response"),R,s,i));case 19:case"end":return r.stop()}},r)}));return function(e,t,n,a){return r.apply(this,arguments)}}();ce.default.addListener("ccxprocess.".concat(t,"Request"),function(e,t,n){return r(e,t,n,!0)}),ce.default.addListener("ccxprocess.".concat(t,"UsageMarker"),function(e,t,n){return r(e,t,n,!1,"usage-marker")}),e.addListener("newCollection",function(){var r=o()(h.a.mark(function r(n,a){var s;return h.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return s=e.targetDetails(n),r.t0=ce.default,r.t1="ccxprocess.".concat(t,"Broadcast"),r.t2=n,r.next=6,e.getLatestPath({params:n});case 6:r.t3=r.sent,r.t4=a.id,r.t5={params:r.t2,path:r.t3,contentId:r.t4},r.t6=s.productCode,r.t7=s.productVersion,r.t0.sendMessage.call(r.t0,r.t1,r.t5,r.t6,r.t7);case 12:case"end":return r.stop()}},r)}));return function(e,t){return r.apply(this,arguments)}}()),_.default.get("SUPPORTS_ON_DEMAND",e.type)&&(ce.default.addListener("ccxprocess.".concat(t,"OnDemandRequest"),function(){var r=o()(h.a.mark(function r(a,s,i){var c,u,l,d,f,p,E,y,g,S,T;return h.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:try{f=JSON.parse(a)}catch(e){p=new P.default(_.default.analytics.PARAM_VALIDATION_ERR,"Unable to parse ".concat(t," request:").concat(a))}if(E=null,function(){null!=E&&clearTimeout(E),E=setTimeout(function(){n.log.error(new P.default("CCX Process Hung. Quitting")),m.default.flush(!0,process.exit)},_.default.get("CLIENT_REQUEST_TIMEOUT"))}(),y=(null===(c=f)||void 0===c?void 0:c.params)||{},g=(null===(u=f)||void 0===u?void 0:u.analytics)||{},S=n.log.context({params:y,payload:$t($t({},g),{},{"event.subcategory":_.default.get("ANALYTICS_SUBCATEGORY",e.type),"ccxp.mode":"on-demand","ccxp.request_type":null!==(l=null===(d=f)||void 0===d?void 0:d.action)&&void 0!==l?l:"get"})}),ee.b.status!==ee.b.OFFLINE&&!D.b.isWaitingForBackOff(D.a.NETWORK)){r.next=11;break}return n.log.disk("Incoming On Demand Request while in Network Backoff or Offline - Doing network Check"),r.next=11,ee.b.check(ee.a.ONDEMAND_REQUEST);case 11:return r.next=13,S.request(o()(h.a.mark(function r(){var n,a,o,c,u,l,d;return h.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!p&&f){r.next=2;break}throw p;case 2:if(O.default.getUserId()){r.next=4;break}throw new Error(_.default.analytics.SIGNED_OUT);case 4:if(o=v.default.validateDataFields(f,_.default.get("ON_DEMAND_REQUEST_SCHEMA")),!Array.isArray(o)){r.next=7;break}throw o[0];case 7:c=null!==(n=null===(a=f)||void 0===a?void 0:a.action)&&void 0!==n?n:"get",u={requestId:f.requestId},r.t0=c.toLowerCase(),r.next="get"===r.t0?12:"pause"===r.t0?24:"delete"===r.t0?27:33;break;case 12:return l=e.paramsToOnDemandId(f.params||{}),d=function(e){var r;ce.default.sendMessage("ccxprocess.".concat(t,"OnDemandProgress"),$t($t({},e),{},{requestId:null===(r=f)||void 0===r?void 0:r.requestId}),s,i)},l&&e.on(l,d),r.t1=A,r.t2=e.getPath(),r.next=19,e.getOnDemandData({params:f.params,force:f.force,updateLastUseTime:!0,priorityLevel:L.c.UrgentRequest}).finally(function(){l&&e.off(l,d)});case 19:return r.t3=r.sent,r.t4=r.t2+r.t3,u.path=r.t1.normalize.call(r.t1,r.t4),l&&e.off(l,d),r.abrupt("break",33);case 24:return r.next=26,e.onDemandAbort(f.params);case 26:return r.abrupt("break",33);case 27:return r.next=29,e.onDemandAbort(f.params);case 29:return r.next=31,e.clearOnDemandCollectionInfo(y,e.paramsToOnDemandId(y),!1);case 31:return e.sync(),r.abrupt("break",33);case 33:return r.abrupt("return",u);case 34:case"end":return r.stop()}},r)}))).catch(function(e){var t;return{requestId:null===(t=f)||void 0===t?void 0:t.requestId,err:e instanceof Error&&!(e instanceof P.default)?{message:e.message}:e}});case 13:T=r.sent,null!=E&&clearTimeout(E),ce.default.sendMessage("ccxprocess.".concat(t,"OnDemandResponse"),T,s,i);case 16:case"end":return r.stop()}},r)}));return function(e,t,n){return r.apply(this,arguments)}}()),ce.default.addListener("ccxprocess.".concat(t,"OnDemandListRequest"),function(){var r=o()(h.a.mark(function r(a,s,i){var c,u,l,d,f,p,E,y;return h.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:try{l=JSON.parse(a)}catch(e){d=new P.default(_.default.analytics.PARAM_VALIDATION_ERR,"Unable to parse ".concat(t," request:").concat(a))}return f=(null===(c=l)||void 0===c?void 0:c.params)||{},p=(null===(u=l)||void 0===u?void 0:u.analytics)||{},E=n.log.context({params:f,payload:$t($t({},p),{},{"event.subcategory":_.default.get("ANALYTICS_SUBCATEGORY",e.type),"ccxp.mode":"on-demand","ccxp.request_type":"list"})}),r.next=6,E.request(o()(h.a.mark(function t(){var r,n,a,s;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!d&&l){t.next=2;break}throw d;case 2:if(n=v.default.validateDataFields(l,_.default.get("ON_DEMAND_LIST_REQUEST_SCHEMA")),!Array.isArray(n)){t.next=5;break}throw n[0];case 5:if(l.params){t.next=7;break}throw new P.default(_.default.analytics.PARAM_VALIDATION_ERR,"Need params to get the list for");case 7:return a=e.getOnDemandCollection(l.params),s=[],a&&(s=Object.keys(a).map(function(t){var r,n={key:t,state:a[t]},s=null===(r=e.cachedAsset(t))||void 0===r?void 0:r.path;return s&&(n.path=A.normalize(e.getPath()+s)),n})),t.abrupt("return",{requestId:null===(r=l)||void 0===r?void 0:r.requestId,list:s});case 11:case"end":return t.stop()}},t)}))).catch(function(e){var t;return{requestId:null===(t=l)||void 0===t?void 0:t.requestId,err:e instanceof Error&&!(e instanceof P.default)?{message:e.message}:e}});case 6:y=r.sent,ce.default.sendMessage("ccxprocess.".concat(t,"OnDemandListResponse"),y,s,i);case 8:case"end":return r.stop()}},r)}));return function(e,t,n){return r.apply(this,arguments)}}()))}),ce.default.sendMessage(_.default.get("VULCAN_STARTUP_MESSAGE"),"","","");case 14:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),e}(),tr=r(49),rr=r(60),nr=new(function(){function e(){var t=this;c()(this,e),f()(this,"isKillSwitchEnabled",v.default.memoize(function(){var e=o()(h.a.mark(function e(r){var n,a,s,o,i,c,u,l,d,f,p,E,y,m,g;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=_.default.get("TEMP_STOCK_TEMPLATE_DOWNLOAD_LIMIT_REGISTRY_SETTING"),a=_.default.get("TEMP_CCD_CONTENT_DOWNLOAD_REGISTRY_SETTING"),s=_.default.get("TEMP_SENSEI_MODELS_CONTENT_DOWNLOAD_REGISTRY_SETTING"),o=_.default.get("TEMP_NETWORK_STATUS_REGISTRY_SETTING"),i=function(e,t){t&&(null!==t[n]&&void 0!==t[n]&&_.default.set("TEMP_DEFAULT_TEMPLATES_DOWNLOADED",parseInt(t[n])),_.default.set("TEMP_CCD_CONTENT_DOWNLOAD_DISABLED",!!parseInt(t[a])),_.default.set("TEMP_SENSEI_MODELS_CONTENT_DOWNLOAD_DISABLED",!!parseInt(t[s])),_.default.set("TEMP_NETWORK_STATUS_DISABLED",!!parseInt(t[o]))),r(e,t)},!v.default.isWindows()){e.next=29;break}return c={},e.prev=7,l=null,d=null,f=null,p=null,e.next=14,t.getRegistryByKey(rr.HKLM,_.default.get("TEMP_KILL_SWITCH_REGISTRY_KEY"));case 14:if(E=e.sent)for(y=0;y<E.length;y++)E[y].name===n?l=E[y].value:E[y].name===a?d=E[y].value:E[y].name===s?f=E[y].value:E[y].name===o&&(p=E[y].value);c[n]=l,c[a]=d,c[s]=f,c[o]=p,i(u,c),e.next=27;break;case 23:e.prev=23,e.t0=e.catch(7),u=e.t0,i(u,c);case 27:e.next=31;break;case 29:try{m=tr.readFileSync(_.default.get("TEMP_KILL_SWITCH_PLIST_PATH"))}catch(e){g=e}i(g,m);case 31:case"end":return e.stop()}},e,null,[[7,23]])}));return function(t){return e.apply(this,arguments)}}(),{timeout:_.default.get("KILLSWITCH_MEMOIZE_TIMEOUT")}))}return l()(e,[{key:"getRegistryByKey",value:function(){var e=o()(h.a.mark(function e(t,r){var n,a;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=new rr({hive:t,key:r}),a=function(){return new Promise(function(e){n.values(function(t,r){t?e(null):r&&r.length?e(r):e(null)})})},e.abrupt("return",a());case 3:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()}]),e}()),ar=r(30);function sr(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return or(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return or(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,i=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){i=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(i)throw s}}}}function or(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ir(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return W()(this,r)}}var cr=function(e){X()(r,e);var t=ir(r);function r(){var e;return c()(this,r),e=t.call(this),f()($()(e),"log",void 0),f()($()(e),"maps",void 0),e.log=new E.default({prefix:"DebugInterface > ",payload:{"event.subcategory":_.default.analytics.sc_PROCESS,"event.subtype":_.default.analytics.st_ANS}}),e.maps=[],e}return l()(r,[{key:"init",value:function(e){this.log.disk("**********Initializing DEBUG Interface*****"),this.addNetworkDebugListeners(),this.maps=e}},{key:"addNetworkDebugListeners",value:function(){var e=o()(h.a.mark(function e(){var t=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ce.default.addListener("TRIGGER_OS_NETWORK_NOTIFCATION",function(){t.log.disk("Triggering Reachability Notification: ",ar.ReachabilityChanged),ee.b.emit(ar.ReachabilityChanged)});case 2:return e.next=4,ce.default.addListener("TOGGLE_NETWORK_STATUS",o()(h.a.mark(function e(){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r="[DEBUG_INTERFACE]"+R.v4(),e.next=3,ee.b.isOnline();case 3:if(e.sent){e.next=10;break}return t.log.disk("Current Network Status is OFFLINE. Moving to Online. ID ".concat(r)),e.next=8,ee.b.emitAndSetStatus(ee.b.ONLINE,ee.b.OFFLINE,r);case 8:e.next=13;break;case 10:return t.log.disk("Current Network Status is ONLINE. Moving to Offline. ID ".concat(r)),e.next=13,ee.b.emitAndSetStatus(ee.b.OFFLINE,ee.b.ONLINE,r);case 13:case"end":return e.stop()}},e)})));case 4:return e.next=6,ce.default.addListener("TRIGGER_CLIENT_SYNC",function(){var e=o()(h.a.mark(function e(r){var n,a,s,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n={type:"none"},a=sr(t.maps),e.prev=2,o=h.a.mark(function e(){var a;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((a=s.value).type!==r){e.next=5;break}return console.log("******** TRIGGERING Client SYNC: ",r),e.next=5,a.sync(n).catch(function(e){t.log.disk("Failed to sync ".concat(a.type),e)});case 5:case"end":return e.stop()}},e)}),a.s();case 5:if((s=a.n()).done){e.next=9;break}return e.delegateYield(o(),"t0",7);case 7:e.next=5;break;case 9:e.next=14;break;case 11:e.prev=11,e.t1=e.catch(2),a.e(e.t1);case 14:return e.prev=14,a.f(),e.finish(14);case 17:case"end":return e.stop()}},e,null,[[2,11,14,17]])}));return function(t){return e.apply(this,arguments)}}());case 6:return e.next=8,ce.default.addListener("SET_ONLINE",o()(h.a.mark(function e(){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r="[DEBUG_INTERFACE]"+R.v4(),t.setOnline(r);case 2:case"end":return e.stop()}},e)})));case 8:return e.next=10,ce.default.addListener("SET_OFFLINE",o()(h.a.mark(function e(){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r="[DEBUG_INTERFACE]"+R.v4(),t.setOffline(r);case 2:case"end":return e.stop()}},e)})));case 10:return e.next=12,ce.default.addListener("NETWORK_STATUS",o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.log.disk("****** Current Network Status is: ",ee.b.status);case 1:case"end":return e.stop()}},e)})));case 12:ce.default.addListener("FORCE_REFRESH_TEST",function(e){t.log.disk("************ Force Refresh Test ************"),t.log.disk("payload: ",e),t.log.disk("********************************************"),G.default.emit(G.default.events.FORCE_REFRESH,void 0,JSON.parse(e))});case 13:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"setOnline",value:function(e){var t=ee.b.status;this.log.disk("".concat(e," -- Current Network Status ").concat(t," . Changing status to ONLINE.")),ee.b.status=ee.b.ONLINE,ee.b.emit(ee.b.ONLINE,t,e)}},{key:"setOffline",value:function(e){var t=ee.b.status;this.log.disk("".concat(e," -- Current Network Status ").concat(t," . Changing status to OFFLINE.")),ee.b.status=ee.b.OFFLINE,ee.b.emit(ee.b.OFFLINE,t,e)}}]),r}(ne.EventEmitter);function ur(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return lr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return lr(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,i=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){i=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(i)throw s}}}}function lr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var dr=function(){function e(){c()(this,e),f()(this,"log",void 0),f()(this,"initialHealthMetric",{MEMORY:void 0,TIME:void 0}),f()(this,"maps",void 0),E.default.init(),this.log=new E.default({prefix:"Main > ",payload:{"event.subcategory":_.default.analytics.sc_PROCESS,"event.subtype":_.default.analytics.st_PROCESS}}),this.maps=[]}return l()(e,[{key:"init",value:function(){var e=o()(h.a.mark(function e(t){var r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t&&(this.maps=t),e.next=3,this.monitorHealth();case 3:return setTimeout(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.getCurrentHealthMetric();case 2:r.initialHealthMetric=e.sent,r.log.disk("Initial Memory Metric:",JSON.stringify(r.initialHealthMetric)),r.log.context({payload:{"event.subcategory":"Metrics","ccxp.metric_ram":r.initialHealthMetric.MEMORY}}).info(_.default.analytics.t_PERFORMANCE);case 5:case"end":return e.stop()}},e)})),_.default.get("INITIAL_HEALTH_MEASUREMENT_DELAY")),e.abrupt("return",this);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getFileCountViolators",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,o=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t={},r=_.default.get("FILE_ACCESSOR_WRITE_FOLDER"),n=ur(this.maps),e.prev=3,s=h.a.mark(function e(){var n,s,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.value,_.default.get("FILE_ACCESSOR_WRITE_ENABLED",n.type)){e.next=3;break}return e.abrupt("return","continue");case 3:return s=n.getPath()+"/"+r,e.next=6,T.readdir(s).catch(function(e){o.log.disk("Err reading contents of ".concat(s,": ").concat(e))});case 6:(i=e.sent)&&i.length>=_.default.get("FILE_ACCESSOR_FILE_COUNT_LIMIT")&&(o.log.disk("".concat(n.type," has violated file count threshold of ").concat(_.default.get("FILE_ACCESSOR_FILE_COUNT_LIMIT"))),t[n.type]=i.length);case 8:case"end":return e.stop()}},e)}),n.s();case 6:if((a=n.n()).done){e.next=13;break}return e.delegateYield(s(),"t0",8);case 8:if("continue"!==e.t0){e.next=11;break}return e.abrupt("continue",11);case 11:e.next=6;break;case 13:e.next=18;break;case 15:e.prev=15,e.t1=e.catch(3),n.e(e.t1);case 18:return e.prev=18,n.f(),e.finish(18);case 21:return e.abrupt("return",t);case 22:case"end":return e.stop()}},e,this,[[3,15,18,21]])}));return function(){return e.apply(this,arguments)}}()},{key:"monitorHealth",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,o,i,c,u,l,d,f,p,E,y=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((t=new Date(_.default.get("HEALTH_POLL")||"2010-01-01T00:00:00Z")).setMilliseconds(_.default.get("HEALTH_POLL_INTERVAL")),!(t<new Date)){e.next=30;break}return r=process.cpuUsage(),n=process.hrtime(),e.next=7,v.default.setTimeoutAsync(_.default.get("CPU_POLL_DURATION"));case 7:return a=process.cpuUsage(r),s=process.hrtime(n),o=(100*(a.system+a.user)/(1e6*s[0]+s[1]/1e3)).toFixed(2),e.next=12,v.default.getDiskSize().catch(function(e){return y.log.error(new P.default(e,"Error getting disk size")),-1});case 12:return e.t0=e.sent,e.t1=1048576,i=(e.t0/e.t1).toFixed(2),e.next=17,this.calcMemChange();case 17:return c=e.sent,u=c.elapsedTimeMs,l=c.percMemChange,d=c.normalizedMemChange,f=(process.memoryUsage().rss/1048576).toFixed(2),e.next=24,this.getFileCountViolators();case 24:p=e.sent,isNaN(d)&&isNaN(l)&&isNaN(u)?this.log.disk("Mem metric not available due to -- Elapsed Time ".concat(u,", mem change per hour ").concat(d,", mem change per hour ").concat(l)):(E=Object.assign({"event.subcategory":_.default.analytics.sc_METRICS,"ccxp.metric_cpu":o,"ccxp.metric_disk":i,"ccxp.metric_ram":f,"ccxp.metric_perc_memdiff":null==l?void 0:l.toFixed(2),"ccxp.metric_perc_memdiff_normalized":null==d?void 0:d.toFixed(2),"ccxp.metric_elapsedms":u},0!==Object.keys(p).length?{"ccxp.client_filecount_violators":JSON.stringify(p)}:{}),this.log.context({payload:E}).info(_.default.analytics.t_PERFORMANCE),this.log.disk("CPU: ".concat(o,"%, RAM: ").concat(f,"MB, Disk: ").concat(i,"MB,FileCountViolations: ").concat(JSON.stringify(p))),this.log.disk("RAM Change: ".concat(null==l?void 0:l.toFixed(2),"%, RAM Change/Hr: ").concat(null==d?void 0:d.toFixed(4),"%, Elapsed Time: ").concat(u&&(u/36e5).toFixed(2)," Hours"))),_.default.set("HEALTH_POLL",(new Date).toISOString()),setTimeout(this.monitorHealth.bind(this),_.default.get("HEALTH_POLL_INTERVAL")),e.next=31;break;case 30:setTimeout(this.monitorHealth.bind(this),t.valueOf()-(new Date).valueOf());case 31:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"calcMemChange",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getInitialMetric();case 2:return t=e.sent,e.next=5,this.getCurrentHealthMetric();case 5:r=e.sent,n=0,a=0,s=0;try{n=(r.MEMORY-t.MEMORY)/(t.MEMORY<=0?1:t.MEMORY)*100,a=r.TIME-t.TIME,s=n/(a/36e5)}catch(e){this.log.disk("Calculation Error: ".concat(e)),this.log.disk("Start: ".concat(JSON.stringify(t)," -- End: ").concat(JSON.stringify(r)))}return e.abrupt("return",{elapsedTimeMs:a,percMemChange:n,normalizedMemChange:s});case 9:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getInitialMetric",value:function(){var e=o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.initialHealthMetric);case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getCurrentHealthMetric",value:function(){var e=o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(t={}).MEMORY=(process.memoryUsage().rss/1048576).toFixed(2),t.TIME=new Date,e.abrupt("return",t);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()}]),e}();function fr(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return pr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return pr(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,i=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){i=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(i)throw s}}}}function pr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var hr=function(){function e(){c()(this,e),f()(this,"log",void 0),f()(this,"maps",void 0),f()(this,"firstMileLookupMap",void 0),f()(this,"stockLookupMap",void 0),f()(this,"learnLookupMap",void 0),f()(this,"ccdLookupMap",void 0),f()(this,"senseiModelsLookupMap",void 0),f()(this,"xdLookupMap",void 0),f()(this,"photoshopLookupMap",void 0),f()(this,"discoverPanelLookupMap",void 0),f()(this,"avatarLookupMap",void 0),f()(this,"collectionTemplatesLookupMap",void 0),f()(this,"lastKnownCredentials",void 0),f()(this,"serviceInterface",void 0),f()(this,"debugInterface",void 0),f()(this,"healthMonitor",void 0),E.default.init(),this.log=new E.default({prefix:"Main > ",payload:{"event.subcategory":_.default.analytics.sc_PROCESS,"event.subtype":_.default.analytics.st_PROCESS}}),S.startPoll(),this.stockLookupMap=new Ut,this.firstMileLookupMap=new De,this.learnLookupMap=new Ge,this.ccdLookupMap=new Qe,this.senseiModelsLookupMap=new ht,this.xdLookupMap=new St,this.discoverPanelLookupMap=new nt,this.avatarLookupMap=new Yt,this.collectionTemplatesLookupMap=new zt,this.photoshopLookupMap=new kt,this.maps=[this.firstMileLookupMap,this.stockLookupMap,this.learnLookupMap,this.ccdLookupMap,this.senseiModelsLookupMap,this.xdLookupMap,this.discoverPanelLookupMap,this.avatarLookupMap,this.collectionTemplatesLookupMap,this.photoshopLookupMap],this.lastKnownCredentials={},this.serviceInterface=new er(this.maps),this.debugInterface=_.default.get("DEBUG_MODE")?new cr:void 0,this.healthMonitor=new dr}return l()(e,[{key:"sync",value:function(){var e=o()(h.a.mark(function e(){var t,r,n=this,a=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:this.maps,r=a.length>1&&void 0!==a[1]?a[1]:{type:"none"},O.default.getUserId()){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,v.default.waitAll(t.map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.sync(r).catch(function(e){n.log.disk("Failed to sync ".concat(t.type),e)});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"updateLookupMapWithInstalledApps",value:function(){var e=o()(h.a.mark(function e(){var t=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(O.default.getUserId()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,v.default.waitAll(this.maps.map(function(){var e=o()(h.a.mark(function e(r){var n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,V.getMissingProductList(r);case 2:return n=e.sent,e.t0=v.default,e.next=6,r.updateParams(n);case 6:return e.t1=e.sent.map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.addNewCollectionData({params:t});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=9,e.t0.waitAll.call(e.t0,e.t1);case 9:return e.next=11,V.getExcessProductList(r.getCachedRequestData());case 11:e.sent.forEach(function(e){r.uninstall(e).catch(function(r){t.log.context({params:e}).error(new P.default("Uninstall Error - LookupUpdate",r))})});case 13:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"setProxyCredentials",value:function(){var e=o()(h.a.mark(function e(t,r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t||this.lastKnownCredentials.user===t||this.lastKnownCredentials.password===r){e.next=5;break}return this.lastKnownCredentials={user:t,password:r},j.a.setProxyCredentials(t,r),e.next=5,this.sync();case 5:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"setUserAnalyticsFlag",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];m.default.enable(e)}},{key:"prefetchData",value:function(){var e=this;if(O.default.getUserId()){var t=v.default.getClientsThatNeedRefresh(this.firstMileLookupMap);Object.keys(t).forEach(function(r){t[r].forEach(function(t){var n=JSON.parse(JSON.stringify(t));n.ccxVersion=_.default.get("START_VERSION",r),delete n.radarSessionGUID,delete n.requestId,e.firstMileLookupMap.isRequestPoisoned(n)||e.firstMileLookupMap.addNewCollectionData({params:n}).catch(function(t){return e.log.context({params:n}).disk(t,"Error pre-fetching")})})})}}},{key:"addProductInfoToLookup",value:function(){var e=o()(h.a.mark(function e(t,r){var n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.default.waitAll(this.maps.map(function(){var e=o()(h.a.mark(function e(a){var s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(s=_.default.get("SUPPORTED_PRODUCTS",a.type),null==t||!t.productCode||!s[t.productCode]||1===v.default.compareMajorMinorVersions(t.productVersion,s[t.productCode])){e.next=8;break}return e.t0=v.default,e.next=5,a.updateParams([t]);case 5:return e.t1=e.sent.map(function(){var e=o()(h.a.mark(function e(s){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.addNewCollectionData({params:s,priorityLevel:r}).catch(function(e){n.log.context({params:t}).disk(e,"Error adding new ".concat(a.type," product"))});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=8,e.t0.waitAll.call(e.t0,e.t1);case 8:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"forceRefresh",value:function(){var e=o()(h.a.mark(function e(t,r){var n,a,s,i,c,u,l,d,f,p,y=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=O.default.getUserId()){e.next=3;break}return e.abrupt("return");case 3:if(a=new E.default({prefix:"Force Refresh > ",payload:{"event.workflow":_.default.analytics.w_NOTIFICATION,"event.subcategory":_.default.analytics.sc_FORCE_REFRESH}}),!(s=v.default.validateDataFields(r,_.default.get("FORCE_REFRESH_SCHEMA")))){e.next=7;break}throw new P.default(m.default.DATA_VALIDATION_ERR,"Invalid data: ".concat(JSON.stringify(null===(i=s[0])||void 0===i?void 0:i.message)));case 7:if(e.prev=7,c=r.expire,u=void 0===c?{}:c,l=r.force,d=void 0===l?{type:"stale"}:l,f=Object.keys(u).filter(function(e){return!!y.maps.find(function(t){return t.type===e})}),!((p=this.maps.filter(function(e){return f.includes(e.type)})).length<1)){e.next=13;break}return e.abrupt("return");case 13:return e.next=15,D.b.updateBackOff({clear:!0,type:D.a.NETWORK,sync:!1});case 15:return e.next=17,D.b.updateBackOff({clear:!0,type:D.a.AUTH,sync:!1});case 17:return a.context({payload:{"event.subtype":_.default.analytics.t_REQUEST,"event.value":f.join(", ")}}).info(_.default.analytics.st_RECEIVED),e.next=20,Promise.all(p.map(function(){var e=o()(h.a.mark(function e(r){var a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=[],t&&a.push(r.setLastTimeOfNotification(t)),!0!==u[r.type]){e.next=6;break}return e.next=5,r.expireAll(n);case 5:return e.abrupt("return",e.sent);case 6:if(s=u[r.type]||[],!Array.isArray(s)){e.next=12;break}return s.forEach(function(e){if(!e.productCode)throw new P.default(m.default.DATA_VALIDATION_ERR,"No product code provided: ".concat(JSON.stringify(s)));e.productCode&&(e.productCode=v.default.getProductAlias(e.productCode),a.push(r.forceRefresh(e)))}),e.next=11,Promise.all(a);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 20:return e.next=22,this.sync(p,d);case 22:a.context({payload:{"event.subtype":_.default.analytics.t_REQUEST,"event.value":f.join(", ")}}).info(_.default.analytics.st_FINISHED),e.next=28;break;case 25:throw e.prev=25,e.t0=e.catch(7),e.t0;case 28:case"end":return e.stop()}},e,this,[[7,25]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"registerNotifications",value:function(){var e=o()(h.a.mark(function e(){var t,r,n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:O.default.on("SIGN_OUT",function(){return n.setUserAnalyticsFlag(!1)}),D.b.on(D.b.SYNC,v.default.throttle(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n.log.disk("Global backoff over, syncing data."),e.next=3,n.sync();case 3:case"end":return e.stop()}},e)})),_.default.get("GLOBAL_BACKOFF_SYNC_THROTTLE"))),O.default.on("SIGN_IN",o()(h.a.mark(function e(){var t,r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.updateLookupMapWithInstalledApps().catch(function(e){n.log.error(new P.default("Failed to update lookup map on sign in",e))});case 2:return e.next=4,G.default.getUserAnalyticsEnabledFlag().catch(function(e){n.log.error(new P.default("Could not enable analytics on sign in",e))});case 4:return t=e.sent,r=t.enabled,n.setUserAnalyticsFlag(r),n.prefetchData(),e.next=10,n.sync();case 10:case"end":return e.stop()}},e)}))),G.default.addListener(G.default.events.PROXY_SETTINGS_CHANGED,function(){var e=o()(h.a.mark(function e(t,r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.setProxyCredentials(t,r);case 2:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),G.default.addListener(G.default.events.FORCE_REFRESH,function(e,t){n.forceRefresh(e,t).catch(function(e){n.log.context({prefix:"Force Refresh > ",payload:{"event.workflow":_.default.analytics.w_NOTIFICATION,"event.subcategory":_.default.analytics.sc_FORCE_REFRESH,"event.value":t}}).error(e)})}),G.default.addListener(G.default.events.PROFILE_UPDATED,function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=3;break}return e.next=3,n.firstMileLookupMap.setLastTimeOfNotification(t);case 3:return e.next=5,n.sync([n.firstMileLookupMap],{type:"always"});case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),G.default.addListener(G.default.events.SUBSCRIPTION_STATUS_CHANGED,function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=5;break}return e.next=3,n.firstMileLookupMap.setLastTimeOfNotification(t);case 3:return e.next=5,n.stockLookupMap.setLastTimeOfNotification(t);case 5:return e.next=7,n.sync([n.firstMileLookupMap]);case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),G.default.addListener(G.default.events.UPDATE_STOCK,function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=3;break}return e.next=3,n.stockLookupMap.setLastTimeOfNotification(t);case 3:return e.next=5,n.sync([n.stockLookupMap],{type:"always"});case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),G.default.addListener(G.default.events.INSTALL_APPLICATION,function(e){n.log.context({params:e}).disk("Handle installApplication"),ce.default.clearInstalledAppsCache(),n.addProductInfoToLookup(e,L.c.Installation)}),t={},G.default.addListener(G.default.events.UPDATE_APPLICATION,function(){var e=o()(h.a.mark(function e(r){var a,s,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ce.default.getInstalledApps();case 2:return e.t0=r.productCode,s=e.sent[e.t0],t[r.productCode]=Object.assign(null!=s?s:{},null!==(a=t[r.productCode])&&void 0!==a?a:{}),n.log.context({params:r}).disk("Handle updateApplication event"),n.addProductInfoToLookup(r,L.c.Installation),e.next=9,v.default.setTimeoutAsync(1e3);case 9:return ce.default.clearInstalledAppsCache(),e.next=12,ce.default.getInstalledApps();case 12:return e.t1=r.productCode,i=e.sent[e.t1],e.next=16,v.default.waitAll(Object.keys(t[r.productCode]).map(function(){var e=o()(h.a.mark(function e(a){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i[a]){e.next=3;break}return e.next=3,v.default.waitAll(n.maps.map(function(){var e=o()(h.a.mark(function e(n){var s,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s=t[r.productCode][a],i={productCode:s.SAPCode,productVersion:s.CodexVersion,productLanguage:r.productLanguage,countryCode:r.countryCode},e.next=4,n.update(i,r);case 4:return e.next=6,v.default.waitAll(s.InstallLanguage.split(",").map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i.productLanguage=t;case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 16:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),G.default.addListener(G.default.events.UNINSTALL_APPLICATION,function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.default.setTimeoutAsync(1e3);case 2:return n.log.context({params:t}).disk("Handle uninstallApplication event"),ce.default.clearInstalledAppsCache(),e.next=6,ce.default.getInstalledApps();case 6:(r=e.sent)[t.productCode]&&(r[t.productCode][t.productVersion]||r[t.productCode][t.productVersion+".0"])?n.log.disk("Ignoring uninstall as the version or alias is already installed."):(n.log.disk("Removing ".concat(t.productCode,"[").concat(t.productVersion,"]")),n.maps.forEach(function(e){return e.uninstall(t).catch(function(e){n.log.context({params:t}).error(new P.default("Uninstall Error - Notification",e))})}));case 8:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),j.a.addListener("change",function(){var e=o()(h.a.mark(function e(t){var r,a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=8;break}return e.next=3,G.default.getProxyCredentials();case 3:return r=e.sent,a=r.user,s=r.password,e.next=8,n.setProxyCredentials(a,s);case 8:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),G.default.registerANSNotifications(),O.default.getUserId()&&(r=this.maps.map(function(e){return e.getLastTimeOfNotification()}),G.default.checkForMissedNotifications(r[0],r[1],Math.max.apply(Math,a()(r))));case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"onLoadHouseKeeping",value:function(){var e=o()(h.a.mark(function e(){var t=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,N.obtainProcessLock("lockfile").catch(function(e){"EAGAIN"===e.code||"EWOULDBLOCK"===e.code?t.log.disk("Unable to get lock. Process is already running"):t.log.error(new P.default(e,"Failed to get Lockfile.")),process.exit(1)});case 2:this.log.info(_.default.analytics.t_INIT),Error.stackTraceLimit=1/0,process.on("uncaughtException",function(e){return t.log.error(new P.default("Uncaught Exception",e,"X_ERR_UNCAUGHT_EXCEPTION"))}),process.on("unhandledRejection",function(e){return t.log.error(new P.default("Unhandled Promise Rejection",e))}),this.healthMonitor.init(this.maps);case 7:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"preventQuitting",value:function(){setTimeout(this.preventQuitting.bind(this),999999)}},{key:"initNetwork",value:function(){var e=o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Re.requestLock.write(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,j.a.init();case 2:case"end":return e.stop()}},e)})));case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"init",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,o,i=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.log.disk("-------------------------Startup------------------------------"),this.log.disk("Build version is ".concat(v.default.getProcessVersion(),", Environment: ").concat(_.default.getEnvironment().LABEL)),e.next=4,nr.isKillSwitchEnabled(function(e,t){e&&"ENOENT"!==e.code&&i.log.error(new P.default("Failed to enable admin download blocking.",e)),t&&i.log.disk("Successfully updated admin settings: ".concat(JSON.stringify(t)))});case 4:return e.next=6,this.onLoadHouseKeeping();case 6:t=fr(this.maps),e.prev=7,n=h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.value,e.next=3,t.load().catch(function(e){return i.log.error(new P.default("Failed to load lookup map ".concat(t.type),e))});case 3:return e.next=5,t.createFAClientDir().catch(function(e){i.log.error(e)});case 5:case"end":return e.stop()}},e)}),t.s();case 10:if((r=t.n()).done){e.next=14;break}return e.delegateYield(n(),"t0",12);case 12:e.next=10;break;case 14:e.next=19;break;case 16:e.prev=16,e.t1=e.catch(7),t.e(e.t1);case 19:return e.prev=19,t.f(),e.finish(19);case 22:return!0===_.default.get("DEBUG_MODE")&&(this.log.disk("***** CCXP Debug Mode Enabled"),void 0!==this.debugInterface&&this.debugInterface.init(this.maps)),a=this.initNetwork(),e.next=27,O.default.init();case 27:return this.log.disk("CCXP Session GUID: ".concat(m.default.session_guid)),this.log.disk("Event Session GUID: ".concat(m.default.event_session_tracker)),e.next=31,ee.b.check(ee.a.CCXPROCESS_INITIALIZED);case 31:return e.next=33,this.serviceInterface.init();case 33:return e.next=35,this.registerNotifications().catch(function(e){i.log.error(new P.default("Failed to register for notifications",e))});case 35:return e.next=37,this.updateLookupMapWithInstalledApps().catch(function(e){i.log.error(new P.default("Failed to update lookup map on launch",e))});case 37:return e.next=39,G.default.getUserAnalyticsEnabledFlag().catch(function(e){i.log.error(new P.default("Could not enable analytics on startup",e))});case 39:return s=e.sent,o=s.enabled,this.setUserAnalyticsFlag(o),this.prefetchData(),e.next=45,this.sync();case 45:return this.preventQuitting(),e.next=48,a.catch(function(e){i.log.error(new P.default("Failed to initialize network",e))});case 48:return e.abrupt("return",this);case 49:case"end":return e.stop()}},e,this,[[7,16,19,22]])}));return function(){return e.apply(this,arguments)}}()}]),e}(),_r=r(51).Module,vr=_r._nodeModulePaths.bind(_r);_r._nodeModulePaths=function(e){return vr(e).filter(function(e){return e.startsWith(__dirname)})};var Er=r(52),yr=r(53);Er.setFlagsFromString("--expose_gc"),Er.setFlagsFromString("--max_heap_size=100"),Er.setFlagsFromString("--optimize-for-size"),global.gc=yr.runInNewContext("gc"),setTimeout(function e(){global.gc(),setTimeout(e,3e4)},3e4);t.default=(new hr).init()}]);