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

-   ADOBE CONFIDENTIAL
-   ***
-
-   Copyright 2015-2019 Adobe Systems Incorporated
-   All Rights Reserved.
-
-   NOTICE: All information contained herein is, and remains
-   the property of Adobe Systems Incorporated and its suppliers,
-   if any. The intellectual and technical concepts contained
-   herein are proprietary to Adobe Systems Incorporated 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 Systems Incorporated.
    ************************************\*\*************************************/

!function(t){var e={};function a(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=t,a.c=e,a.d=function(t,e,s){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(a.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)a.d(s,r,function(e){return t[e]}.bind(null,r));return s},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=38)}([function(t,e,a){"use strict";a.r(e);var s=a(7),r=a(24),i=a(29),n=a(8);function o(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const c=new class{constructor(){o(this,"config",{ENVIRONMENT:"production",ACTIVE_VERSIONS:["V1","V2","V2_5","V2_8","V3_0","V3_1"],SUPPORTED_ACTIVE_VERSIONS:4,SETTINGS_FILE:"settings.json",SETTINGS_FILE_VERSION:3,LOOKUP_MAP_FILE:"map.json",ASSETS_DIRNAME:"assets",CC_SETTINGS_FILE:"C3Config.xml",CONSOLE_LOGGING:!1,SCOPES:"openid,AdobeID,creative_cloud,creative_sdk",SYNC_INITIAL_RETRY:24e4,MAX_LOG_SIZE:5242880,PROXY_REQUEST_TIMEOUT:2e3,REQUEST_TIMEOUT:3e5,CLIENT_REQUEST_TIMEOUT:9e5,USER_ANALYTICS__REQUEST_TIMEOUT:2e3,GET_NOTIFICATION_DATA_TIMEOUT:2e3,NETWORK_STATUS_INTERVAL:1e3,STOP_SYNCING_BEYOND:6048e5,MAX_BACK_OFF:18e5,GLOBAL_BACKOFF_SYNC_THROTTLE:1e4,ONLINE_SYNC_THROTTLE:1e4,SERVER_TIMEOUT:3e4,LEARN_DEFAULT_EXPIRATION:2592e5,ASSET_DEFAULT_EXPIRATION:2592e5,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,NUM_CONCURRENT_REQUESTS:10,MIN_RANDOMIZED_TIME:1e3,MAX_RANDOMIZED_TIME:9e5,MAX_TIMEOUT:Math.pow(2,31)-1,MIN_TIMEOUT:36e6,TRIAL_DAYS:7,PRODUCT_LIST:["PHSP","PHXS","IDSN","PPRO","ILST","AEFT","MUSE","DRWV","FLPR"],IGNORED_FILES_REGEXP:"^map.json|\\bassets\\b",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"]},FIRST_MILE_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_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"]}},STOCK_TEMPLATES_DATA_SCHEMA:{id:"STOCK_TEMPLATES_DATA",type:"object",properties:{templates:{type:"array"},expirationDTS:{type:"string"},nb_results:{type:"number"}},required:["expirationDTS"]},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_SPECIFIER_MAP:{photoshop:"PHXS",illustrator:"ILST",indesign:"IDSN",aftereffects:"AEFT",dreamweaver:"DRWV",premierepro:"PPRO",creativecloud:"ACCC",flash:"FLPR"},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"],NOTIFICATION_REQUEST:"accc.notifications",NOTIFICATION_PSDK_RESPONSE:"ccxprocess.notification.psdk",NOTIFICATION_STOCK_RESPONSE:"ccxprocess.notification.stock",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",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",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,LEARN_START_VERSION_CEP:"2.8.0.148",LEARN_START_VERSION_UXP:"3.1.0.156",SUPPORTED_UXP_LEARN_APPS:{PHXS:"21.0",ILST:"24.0",FLPR:"20.0"},UNSUPPORTED_WINDOWS_UXP_APPS:["PHXS","ILST"],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,DRWV:4,FLPR:3,MUSE:2},DEFAULT:{LOOKUP_MAP_FILE_VERSION:1,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:n.PriorityChannels.Unknown},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:"19.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.8.0.148",FIRST_MILE_PREFETCH_CLIENTS:{AEFT:"99.0",DRWV:"99.0",IDSN:"99.0",ILST:"24.0",MUSE:"2099.0",PHXS:"21.0",PPRO:"99.0"},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:"99.9",START_VERSION:"3.1.0.156",FIRST_MILE_PREFETCH_CLIENTS:{FLPR:"99.0",ILST:"99.0",PHXS:"99.0"},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"},ANALYTICS:{w_CCX_PROCESS:"CCX Process",c_DESKTOP:"DESKTOP",SOPHIA_CARDS:"Sophia Cards",UTUTS:"Ututs",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_AUTH:"Auth",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",st_PROCESS:"process",st_API:"api",st_ANS:"ans",st_CC_PHOTOS:"cc photos",st_NETWORK:"network",st_CLIENT:"client",st_TOKEN:"token",ERROR:"error",NO_ERROR:null,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",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"},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"]}},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"}),o(this,"environments",{staging:{LABEL:"Staging",CLIENT_ID:"CCXInAppWelcomeProcess2",CLIENT_SECRET:"220debb8-26c5-4ce3-9c92-cc38bf589c7d",IMS:"ims-na1-stg1.adobelogin.com"},production:{LABEL:"Production",CLIENT_ID:"CCXInAppWelcomeProcess2",CLIENT_SECRET:"07a10ad7-27d4-4aec-8c8d-e4b47dffd414",IMS:"ims-na1.adobelogin.com"}}),o(this,"settings",{SETTINGS_FILE_VERSION:this.config.SETTINGS_FILE_VERSION}),o(this,"currentDiskState",void 0),o(this,"analytics",this.get("ANALYTICS")),this.init()}init(){if(this.isPlatformWindows()){const t=process.env.USERPROFILE.replace(/\\/g,"/");this.config.ROOT_DIR=`${t}/AppData/Roaming/`,this.config.LOG_DIR=`${process.env.TEMP.replace(/\\/g,"/")}/CreativeCloud/CCX Welcome/`;const e=(process.env["ProgramFiles(x86)"]||process.env.PROGRAMFILES).replace(/\\/g,"/");this.config.CC_DIR=`${e}/Adobe/Adobe Creative Cloud/`}else this.config.ROOT_DIR=`${process.env.HOME}/Library/Caches/`,this.config.LAUNCH_AGENT=`${process.env.HOME}/Library/LaunchAgents/com.adobe.ccxprocess.plist`,this.config.LOG_DIR=`${process.env.HOME}/Library/Logs/CreativeCloud/CCX Welcome/`,this.config.CC_DIR="/Applications/Utilities/Adobe Creative Cloud/";let t=!1;this.isStagingRedirectInEffect()&&(this.config.ENVIRONMENT="staging",t=!0),this.config.ROOT_DIR+="Adobe/CCX Welcome/"+(t?"stage/":""),this.config.LOG_DIR+=t?"stage/":"",this.config.STOCK_API_ROOT=`/Rest/Media/${this.config.STOCK_API_VERSION}`,this.config.STOCK_API_PATH=`${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(t=>{this.config.CARD_DATA_SCHEMA[t]=this.config.CARD_DATA_SCHEMA.v2}),this.loadSettings(),process.argv.forEach(t=>{"--debug"===t&&(this.config.CONSOLE_LOGGING=!0)}),this.config.CONSOLE_LOGGING||global.test||(console.log(`Outputting logs to: ${this.config.LOG_DIR}`),console.log("To view log messages on the console, use the --debug argument"))}isPlatformWindows(){return 0===process.platform.indexOf("win")}get(t,e){return e?this.settings[e]&&void 0!==this.settings[e][t]?this.settings[e][t]:this.config[e]&&this.config[e][t]:void 0!==this.settings[t]?this.settings[t]:this.config[t]}set(t,e,a){return a?(this.settings[a]=this.settings[a]||{},this.settings[a][t]=e):this.settings[t]=e,this.saveSettings()}default(t){const e=t.LABEL.toLowerCase().replace(/^\w/,t=>t.toUpperCase());return t.ANALYTICS_SUBCATEGORY=t.ANALYTICS_SUBCATEGORY||e,t.LOG_PREFIX=t.LOG_PREFIX||e,t.DIR=t.DIR||e.toLowerCase()+"/",t.VULCAN_TYPE=t.VULCAN_TYPE||e,t}patch(t,e){this.config[t]=this.config[t]||{};const a=Object.assign({},this.config[t]);Object.assign(this.config[t],this.config.DEFAULT,a,e),this.default(this.config[t])}getEnvironment(){const t=this.get("ENVIRONMENT");return this.environments[t]||this.environments[this.config.ENVIRONMENT]}isStagingRedirectInEffect(){let t=!1;try{const e=r.readFileSync(this.config.CC_DIR+this.config.CC_SETTINGS_FILE,"utf8");new i.Parser({async:!1}).parseString(e,(e,a)=>{e||a.C3Config.config[0].namespace.forEach(e=>{e&&e.$&&e.$.name&&"accc.container"===e.$.name&&e.property.forEach(e=>{e&&e.$&&e.$.name&&"IMS_ENV"===e.$.name&&"STG"===e._&&(t=!0)})})})}catch(t){}return t}loadSettings(){try{const t="readFileSync";this.currentDiskState=r[t](this.config.ROOT_DIR+this.config.SETTINGS_FILE,"utf8");const e=JSON.parse(this.currentDiskState);this.settings.SETTINGS_FILE_VERSION===e.SETTINGS_FILE_VERSION&&(this.settings=e)}catch(t){}}saveSettings(){const t=JSON.stringify(this.settings,void 0,2);if(t===this.currentDiskState)return!1;try{const e=`${this.config.SETTINGS_FILE}.TEMP_${s.v4()}`;r.writeFileSync(this.config.ROOT_DIR+e,t),r.renameSync(this.config.ROOT_DIR+e,this.config.ROOT_DIR+this.config.SETTINGS_FILE),this.currentDiskState=t}catch(t){}return!0}};e.default=c},function(t,e,a){"use strict";a.r(e);var s=a(33),r=a(2),i=a(6),n=a(9),o=a(0),c=a(34),d=a(3);function l(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const u=new class{constructor(){l(this,"memoize",(t,{resolver:e,refresher:a,wrapper:s}={})=>{const r=this,i=function(){const n=arguments,o=e?e.apply(this,n):n[0];if(i.cache.has(o)){const t=i.cache.get(o);if(!a||!a(t))return s?s(n,t,!0):t}const c=t.apply(this,n);return c instanceof Promise&&r.enablePromiseStateAccess(c),i.cache.set(o,c),s?s(n,c,!1):c};return i.cache=new Map,i}),l(this,"throttle",(t,e=250)=>{let a,s;return function(){const r=this,i=(new Date).getTime(),n=arguments;a&&i<a+e?(clearTimeout(s),s=setTimeout(()=>{a=i,t.apply(r,n)},e)):(a=i,t.apply(r,n))}}),l(this,"setTimeoutAsync",t=>new Promise(e=>setTimeout(e,t)))}getTimeToExpiry(t){if(!t)return 0;const e=(new Date).valueOf(),a=new Date(t).valueOf()-e;return isNaN(a)?0:Math.max(0,a)}enablePromiseStateAccess(t){t.state="pending",t.then(e=>{t.state="resolved",t.value=e},e=>{t.state="rejected",t.value=e})}isDateExpired(t){return 0===this.getTimeToExpiry(t)}getRandomizedTime(){const t=o.default.get("MIN_RANDOMIZED_TIME"),e=o.default.get("MAX_RANDOMIZED_TIME");return Math.floor(Math.random()*(e-t))+t}validateDataFields(t,e,a=null){const s=new c.Validator;a&&a.forEach(t=>{s.addSchema(t,t.id)});const r=s.validate(t,e);return 0===r.errors.length?null:r.errors}getProcessVersion(){return`${s.a}-39`}isWindows(){return"win32"===process.platform}getOsVersion(){return n.release()}ccxVersionToString(t={ccxVersion:""}){return t.ccxVersion?o.default.get("ACTIVE_VERSIONS").find(e=>{const a=o.default.get("VERSION_LESS_THAN",e);return-1===this.compareMajorMinorVersions(a,t.ccxVersion)}):"V1"}retryLocalErrors(t,e=3){return async function(a){let s=0,r=null,i=null;do{r=null,i=await t(a).catch(t=>{if("ECONNRESET"!==t.code&&"ETIMEDOUT"!==t.code&&"NODE_FETCH_HUNG"!==t.code)throw t;r=t,this.log.disk(`Retry-able error present. Retrying ${s+1}. Underlying error ${t}`)})}while(++s<e&&r);if(r)throw new d.default("LOCAL_NETWORK_ERROR_RETRY_FAILED",r);return i}}sanitizeLocale(t="",e=o.default.get("SUPPORTED_LOCALES")){if(e.includes(t))return t;const a=t.slice(0,2);return e.find(t=>t.slice(0,2)===a)||"en_US"}compareMajorMinorVersions(t,e){if(!t)return 1;if(!e)return-1;let a,s,r,i;try{a=parseInt(t.split(".")[0],10),r=parseInt(t.split(".")[1]||"0",10)}catch(t){return 1}try{s=parseInt(e.split(".")[0],10),i=parseInt(e.split(".")[1]||"0",10)}catch(t){return-1}return a===s&&r===i?0:a<s||a===s&&r<i?1:-1}getClientsThatNeedRefresh(t){const e={};o.default.get("ACTIVE_VERSIONS").forEach(t=>{e[t]={}});const a=t.getCachedRequestData();Object.keys(a).forEach(t=>{Object.keys(a[t]).forEach(s=>{a[t][s].forEach(a=>{const r=this.ccxVersionToString(a),i=o.default.get("FIRST_MILE_PREFETCH_CLIENTS",r)[t];if(!i)return;if(-1!==this.compareMajorMinorVersions(i,s))return;const n=[t,s,a.subscriptionStatus,a.productLanguage,a.countryCode].join("-");e[r][n]||(e[r][n]=a)})})});const s={};return Object.keys(e).map(t=>{s[t]=Object.values(e[t])}),s}hasBeenUsedRecently(t){if(!t)return!1;const e=new Date(t);return!isNaN(e)&&(e.setMilliseconds(o.default.get("STOP_SYNCING_BEYOND")),e>new Date)}async deleteTempFiles(t,e){const a=new Date;void 0===e&&(e=864e5);const s=await r.readdir(t);await u.waitAll(s.map(async s=>{const n=i.join(t,s),o=await r.stat(n);if(!(Number(a)-Number(o.mtime)<e))return await r.unlink(n),`Deleted ${n}`}).map(t=>t.catch(t=>`Error deleting temp file: ${t}`)))}scrubStack(t){return t?(t=t.toString()).replace(/[A-Z]?\:?(\\|\/).*\1/g,"<redacted>").trim():t}async waitAll(t){let e=null;const a=await Promise.all(t.map(t=>t.catch(t=>e=e||t)));if(e)throw e;return a}};e.default=u},function(t,e){t.exports=require("fs-extra")},function(t,e,a){"use strict";a.r(e),a.d(e,"default",function(){return n});var s=a(1),r=a(9);function i(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class n extends Error{constructor(t,e,a){super(t||"Unknown"),i(this,"underlyingError",void 0),i(this,"error_code",void 0),i(this,"silent",!1),i(this,"context",""),i(this,"headers",void 0),i(this,"payload",{}),e&&(e instanceof n?(this.silent=e.isSilent,this.underlyingError=e,Object.assign(this.payload,e.ingestPayload)):this.underlyingError=e),this.error_code=a||this.underlyingError&&"string"!=typeof this.underlyingError&&this.underlyingError.code||"Unknown"}get code(){return this.error_code}get short(){return this.message+(this.context||"")}get description(){let t=this.context+r.EOL;return this.stack&&(t+=s.default.scrubStack(this.stack)+r.EOL),this.underlyingError&&(t+=" VIA ",this.underlyingError instanceof n?t+=this.underlyingError.message+" "+this.underlyingError.code+r.EOL+this.underlyingError.description+r.EOL:this.underlyingError instanceof Error?t+=this.underlyingError.message+this.underlyingError.code+(this.underlyingError.stack?r.EOL+s.default.scrubStack(this.underlyingError.stack):"")+r.EOL:t+=this.underlyingError),t}get responseHeaders(){return this.headers}get ingestPayload(){return this.payload}setPayload(t){return Object.assign(this.payload,t),this}setResponseHeaders(t){return this.headers=t,this}setContext(t){return this.context+=t,this}toString(){return this.message+this.description}toJSON(){return{desc:this.context,message:this.message,code:this.code}}toSnapshot(){const t=`${this.message}(${this.code}) `;return this.underlyingError instanceof n?t+this.underlyingError.toSnapshot():this.underlyingError instanceof Error?t+this.underlyingError.message+this.underlyingError.code:t+this.underlyingError}silence(){return this.silent=!0,this}get isSilent(){return this.silent}}},function(t,e,a){"use strict";a.r(e),a.d(e,"BackOffType",function(){return o});var s,r=a(15),i=a(0);function n(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}let o;!function(t){t.SYNC="SYNC"}(s||(s={})),function(t){t.AUTH="BackoffAuthentication",t.NETWORK="BackOffNetwork"}(o||(o={}));const c=new class extends r.EventEmitter{constructor(...t){super(...t),n(this,"SYNC",s.SYNC),n(this,"_syncRetryTimeout",null)}isWaitingForBackOff(t){const e=i.default.get("BACK_OFF_EXPIRY",t);return!!(e&&new Date(e)>new Date)}backOffCause(t){return i.default.get("BACK_OFF_CAUSE",t)}backOffWaitTime(t){return i.default.get("BACK_OFF",t)}backOffExpiry(t){return i.default.get("BACK_OFF_EXPIRY",t)}updateBackOff(t={clear:!1,cause:"Unknown",type:o.NETWORK}){const{clear:e=!1,cause:a="Unknown",type:s}=t;let r=this.backOffWaitTime(s);if(e)return r&&(i.default.set("BACK_OFF_EXPIRY",void 0,s),i.default.set("BACK_OFF",void 0,s),i.default.set("BACK_OFF_CAUSE",void 0,s)),void clearTimeout(this._syncRetryTimeout);if(!this.isWaitingForBackOff(s)){r?r*=2:r=i.default.get("SYNC_INITIAL_RETRY"),r=Math.min(r,i.default.get("MAX_BACK_OFF")),i.default.set("BACK_OFF",r,s);const t=new Date;t.setMilliseconds(t.getMilliseconds()+r),i.default.set("BACK_OFF_EXPIRY",t.toISOString(),s),i.default.set("BACK_OFF_CAUSE",`${a} for ${r/1e3}s expiring ${t.toISOString()}`,s),clearTimeout(this._syncRetryTimeout),this._syncRetryTimeout=setTimeout(()=>{this.emit(this.SYNC)},this.backOffWaitTime(s))}}};e.default=c},function(t,e,a){"use strict";a.r(e);var s=a(0),r=a(10),i=a(14),n=a(3),o=a(4);function c(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const d=a(1).default,l=a(4).default,u=a(15).EventEmitter,p=a(13).default,_=1e4,h=s.default.getEnvironment();e.default=new class extends u{constructor(){super(),c(this,"proxyPassword",""),c(this,"proxyUser",""),c(this,"lastIMSLogMessage",""),c(this,"getUserInfo",d.memoize(()=>{let t,e;const a=i.createRefEx(h.IMS);try{e=(t=i.fetchDefaultUserInfoForClientId(a,h.CLIENT_ID))?`Default User: ${t.Email} (${t.UserID})`:"No default user"}catch(t){e=`Error fetching default user: ${t}`,this.lastIMSLogMessage!==e&&this.log.error(new n.default(t,"Error fetching default user"))}return i.releaseRef(a),e!==this.lastIMSLogMessage&&this.log.disk(e),this.lastIMSLogMessage=e,t},{refresher:t=>!t})),c(this,"getDeviceID",d.memoize(()=>{const t=i.createRefEx(h.IMS),e=i.getDeviceID(t);return i.releaseRef(t),e})),c(this,"getAccessTokenExpiry",d.memoize(t=>{try{const e=JSON.parse(Buffer.from(t.split(".")[1],"base64").toString("utf-8"));return new Date(parseInt(e.created_at)+parseInt(e.expires_in)-_)}catch(e){return t&&this.log.error(e,"Failed parsing access token"),-1}})),c(this,"getAccessToken",d.memoize(()=>new Promise((t,e)=>{const a=this.getUserId();if(!a)return void e(new n.default("Not Logged in").silence());if(l.isWaitingForBackOff(o.BackOffType.AUTH))throw new n.default(`Access Token awaiting global back-off ${l.backOffCause(o.BackOffType.AUTH)}`).silence();const r=i.createRefEx(h.IMS);this.log.disk("Started IMSLib.fetchAccessToken."),r&&this.proxyUser&&this.proxyPassword&&i.setProxyCredentialsInIMSLibSession(r,this.proxyUser,this.proxyPassword),i.fetchAccessToken(r,h.CLIENT_ID,h.CLIENT_SECRET,a,"",s.default.get("SCOPES"),(a,n)=>{if(this.log.disk("Finished IMSLib.fetchAccessToken."),setTimeout(()=>{i.releaseRef(r)},0),a){this.log.error(a,"Error from IMS");const t=`Error from IMSLib - ${a}`;return l.updateBackOff({cause:t,type:o.BackOffType.AUTH}),e(new Error(t))}if("ride_AdobeID_subs_actreq"===n.error){const t=new Error("Services not provisioned");return this.log.error(t),l.updateBackOff({cause:t.message,type:o.BackOffType.AUTH}),e(t)}if(n.error){this.log.error(n.error,"Error from IMS fetch access token");const t=`'Access token failed due to ${n.error}`;return l.updateBackOff({cause:t,type:o.BackOffType.AUTH}),e(new Error(t))}if(!n.access_token)return this.log.error("No Access Token"),l.updateBackOff({cause:"No access token",type:o.BackOffType.AUTH}),e(new Error("No access token"));this.log.context({authenticationDisabled:!1}).info(s.default.analytics.t_FETCH,"Successfully obtained access token"),t(n.access_token)})}),{refresher:this.checkAccessTokenNeedsRefresh.bind(this)})),this.log=new r.default({prefix:"IMS > ",payload:{"event.subcategory":s.default.analytics.sc_AUTH,"event.subtype":s.default.analytics.st_TOKEN},authenticationDisabled:!0});const t=i.createRefEx(h.IMS);i.registerClientToGroup(t,h.CLIENT_ID,"AAM"),i.releaseRef(t)}init(){const t=a(31);t.addListener(t.events.SIGN_OUT,()=>{this.log.disk("Received Sign out event."),this.log.context({authenticationDisabled:!1}).info(s.default.analytics.t_SIGNOUT),p.flush(!0,()=>{this.log.disk("Flushed logs due to user sign out event"),this.reset(),this.getUserId()?this.log.error(new n.default("Got sign out event without sign out")):this.emit("SIGN_OUT")})}),t.addListener(t.events.SIGN_IN,()=>{this.getUserId()?(l.updateBackOff({clear:!0,type:o.BackOffType.AUTH}),this.log.context({authenticationDisabled:!1}).info(s.default.analytics.t_SIGNIN),this.emit("SIGN_IN")):this.log.error(new n.default("Early sign out event"))})}checkAccessTokenNeedsRefresh(t){const e=t.state,a=t.value;return"pending"!==e&&("resolved"!==e||!a||this.getAccessTokenExpiry(a)<new Date)}getUserId(){return this.getUserInfo()&&this.getUserInfo().UserID}reset(){this.log.info(s.default.analytics.t_CLEAR),this.getUserInfo.cache.clear(),this.getAccessToken.cache&&this.getAccessToken.cache.clear()}setProxyCredentials(t,e){this.proxyUser=t,this.proxyPassword=e,this.getUserId()||this.reset()}}},function(t,e){t.exports=require("path")},function(t,e){t.exports=require("uuid")},function(t,e,a){"use strict";function s(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}let r,i;a.r(e),a.d(e,"PriorityChannels",function(){return r}),a.d(e,"PriorityLevels",function(){return i}),a.d(e,"Priority",function(){return n}),a.d(e,"default",function(){return c}),function(t){t[t.Unknown=0]="Unknown",t[t.Deprecated=1]="Deprecated",t[t.Stock=2]="Stock",t[t.CcdTertiary=3]="CcdTertiary",t[t.FirstMileOld=4]="FirstMileOld",t[t.CcdSecondary=5]="CcdSecondary",t[t.Learn=6]="Learn",t[t.CcdPrimary=7]="CcdPrimary",t[t.FirstMileLatest=8]="FirstMileLatest"}(r||(r={})),function(t){t[t.Regular=0]="Regular",t[t.BackgroundRequest=1]="BackgroundRequest",t[t.Installation=2]="Installation",t[t.UrgentRequest=3]="UrgentRequest"}(i||(i={}));class n{constructor({key:t="",value:e=0,channel:a=r.Unknown,level:n=i.Regular}={}){s(this,"key",void 0),s(this,"value",void 0),s(this,"channel",void 0),s(this,"level",void 0),this.key=t,this.value=e,this.channel=a,this.level=n}toString(){return 1e3*this.queue+this.value}get queue(){return this.channel+100*this.level}}const o=r.Unknown+100*i.Regular;class c{constructor(t=1,e=6e5){this.maxLocks=t,this.defaultTimeout=e,s(this,"hasWriteLock",!1),s(this,"readsInProgress",[]),s(this,"pendingReads",[]),s(this,"pendingWrites",[]),s(this,"priorityOverrides",{}),s(this,"prioritize",t=>{let{key:e}=t;e&&(this.priorityOverrides[e]=t,setTimeout(()=>{e&&delete this.priorityOverrides[e]},1e4),this.pendingReads.forEach(a=>{a.priority.key===e&&this.applyOverride(t,a.priority)}),this.check())})}async call(t){const e=setTimeout(()=>{t.reject(new Error("Lock Timed out"))},t.timeout);await t.callback().then(a=>{t.resolve(a),clearTimeout(e)}).catch(a=>{t.reject(a),clearTimeout(e)})}async checkReads(){const t=[];if(!this.hasWriteLock&&this.pendingReads.length>0){let e;for(;e=this.nextReadLock();){const a=e,s=this.call(a).then(()=>{this.readsInProgress.splice(this.readsInProgress.indexOf(a),1),this.check()});t.push(s)}}return await Promise.all(t),t.length}nextReadLock(){if(0===this.pendingReads.length)return;const t=this.readsInProgress.length>0&&this.readsInProgress.reduce((t,e)=>t.priority.queue>e.priority.queue?t:e),e=t?t.priority.queue:o,a=this.pendingReads.reduce((t,e)=>t.priority.queue>e.priority.queue?t:e).priority.queue;if(a<e)return;if(a===e){if(this.readsInProgress.filter(t=>t.priority.queue===e).length>=this.maxLocks)return}const s=this.pendingReads.filter(t=>t.priority.queue===a);if(0===s.length)return;const r=s.reduce((t,e)=>e.priority.value>t.priority.value?e:t);return this.pendingReads.splice(this.pendingReads.indexOf(r),1),this.readsInProgress.push(r),r}async check(){for(;0!==await this.checkReads(););if(0===this.readsInProgress.length&&!this.hasWriteLock){const t=this.pendingWrites.shift();t&&(this.hasWriteLock=!0,await this.call(t),this.hasWriteLock=!1,this.check())}}async read(t,e=new n({}),a=this.defaultTimeout){return e.channel=e.channel||r.Unknown,e.level=e.level||i.Regular,e.value=e.value||0,e.key&&this.priorityOverrides[e.key]&&this.applyOverride(this.priorityOverrides[e.key],e),new Promise((s,r)=>{this.pendingReads.push({callback:t,resolve:s,reject:r,priority:e,timeout:a}),this.check()})}async write(t,e=this.defaultTimeout){return new Promise((a,s)=>{this.pendingWrites.push({callback:t,resolve:a,reject:s,timeout:e}),this.check()})}applyOverride(t,e){e.level=Math.max(e.level,t.level)}}},function(t,e){t.exports=require("os")},function(t,e,a){"use strict";a.r(e),a.d(e,"LogBuilder",function(){return u}),a.d(e,"default",function(){return p});var s=a(22),r=a(7),i=a(0),n=a(23),o=a(3);function c(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{},s=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(a).filter(function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),s.forEach(function(e){d(t,e,a[e])})}return t}function d(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}let l;class u{constructor(t={},e,...a){d(this,"options",void 0),d(this,"level",void 0),d(this,"args",void 0),d(this,"logArgs",[]),d(this,"error",void 0),d(this,"params",void 0),d(this,"payload",void 0),d(this,"surfaceAnalytics",void 0),this.options=t,this.level=e,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)}stringifyWithCycles(t){return"string"==typeof t?t:(t instanceof Error&&t.stack&&(t.stack=t.stack.replace(/[A-Z]?:?(\\|\/).*\1/g," ")),s.inspect(t))}convertArgsToString(...t){return t.map(this.stringifyWithCycles).join(" ")}post(){return this.error&&this.error instanceof o.default&&this.error.isSilent?this:(this.options.skipDiskLog||n.default.log(this.options.prefix+`[${this.level.toUpperCase()}] `+this.convertArgsToString(...this.args,...this.logArgs)),(this.options.forceSilentError||!1!==this.options.analytics)&&l.logProcessEvent(this.payload,this.params,this.surfaceAnalytics,this.error,this.options.authenticationDisabled),this)}addSurfaceAnalytics(t){this.surfaceAnalytics=this.surfaceAnalytics||[],this.surfaceAnalytics.push(...t)}addDiskLog(...t){return this.args=this.args.concat(...t),this}appendPayload(t={}){return Object.assign(this.payload,t),this}setError(t=new o.default("No error object passed")){return t instanceof Error||(t=new o.default(""+t)),this.appendPayload({"event.type":i.default.analytics.ERROR}),t instanceof o.default&&this.appendPayload(t.ingestPayload),this.args.push(t),this.error=t,this}setParams(t={}){return t.productCode&&this.logArgs.push(` for product ${t.productCode}[${t.productVersion}]`),this.params=t,this}}class p{static init(){l=a(13).default}constructor(t){d(this,"options",{}),this.options=t}context(t){return new p(c({},this.options,t,{payload:c({},t.payload,this.options.payload),surfaceAnalytics:[...this.options.surfaceAnalytics||[],...t.surfaceAnalytics||[]]}))}disk(...t){return new u(c({analytics:!1},this.options),"DISK",...t).post()}error(t,...e){return new u(this.options,"error",...e).setError(t).post()}info(t,...e){return new u(this.options,"info",t,...e).appendPayload({"event.type":t}).post()}async time(t){const e=Date.now(),a=new u(c({},this.options,{skipDiskLog:!0}),"Perf"),s=await t(a);return a.appendPayload({"event.dts_start":new Date(e).toISOString(),"event.dts_end":(new Date).toISOString(),"event.type":i.default.analytics.t_PERFORMANCE,"event.value":a.payload&&a.payload["event.value"]||Date.now()-e}).post(),s}async request(t){const e=this.options.payload&&this.options.payload["event.context_guid"]||r.v4(),a=Date.now();new u(this.options,"INFO").appendPayload({"event.type":i.default.analytics.t_REQUEST,"event.context_guid":e}).addDiskLog("Request Received").post();const s=new u(c({},this.options,{forceSilentError:!0}),"INFO");return await t(s).then(t=>(s.appendPayload({"event.type":i.default.analytics.t_RESPONSE,"event.context_guid":e,"event.value":Date.now()-a}).addDiskLog(`Response sent in ${Date.now()-a}ms`).post(),t)).catch(t=>{throw s.appendPayload({"event.context_guid":e}).setError(t).post(),t})}console(...t){console.log(...t)}}d(p,"Builder",void 0),p.Builder=u},function(t,e){t.exports=require("url")},function(t,e,a){"use strict";a.r(e);var s=a(15),r=a(27),i=a(0),n=a(10),o=a(11);function c(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const d=a(1).default,l=a(4).default;var u;!function(t){t.ONLINE="ONLINE",t.OFFLINE="OFFLINE"}(u||(u={}));const p=new class extends s.EventEmitter{constructor(){super(),c(this,"ONLINE",u.ONLINE),c(this,"OFFLINE",u.OFFLINE),c(this,"status",u.ONLINE),c(this,"lastKnownError",void 0),c(this,"log",void 0),c(this,"check",d.memoize(this.checkInternal,{refresher:t=>"pending"!==t.state})),this.on(this.OFFLINE,()=>{l.updateBackOff({cause:"Offline[DNS]"}),setTimeout(this.check.bind(this),i.default.get("NETWORK_STATUS_INTERVAL"))}),this.log=new n.default({prefix:"NetworkStatus >",payload:{"event.subcategory":i.default.analytics.sc_PROCESS,"event.subtype":i.default.analytics.st_PROCESS}})}async checkInternal(){return new Promise(async t=>{const e=i.default.getEnvironment(),a=new o.URL(i.default.get(`URL_${e.LABEL.toUpperCase()}`,"FIRST_MILE")).host;r.resolve(a,e=>{e?(this.lastKnownError&&this.lastKnownError.code===e.code||(this.log.error(e,"Network Error"),this.lastKnownError=e),this.status=this.OFFLINE):this.status=this.ONLINE,this.emit(this.status),t()})})}};e.default=p},function(t,e,a){"use strict";a.r(e);var s=a(7),r=a(9),i=a(0),n=a(23),o=a(12),c=a(21),d=a(1),l=a(5),u=a(19),p=a(3);function _(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}let h=!1;const f=a(44),g={ENVIRONMENT:"Staging"===i.default.getEnvironment().LABEL?"stage":"prod",ANALYTICS_API_KEY:i.default.get("ANALYTICS_API_KEY"),ANALYTICS_X_PRODUCT:i.default.get("ANALYTICS_X_PRODUCT"),ANALYTICS_PROJECT:i.default.get("ANALYTICS_PROJECT"),ANALYTICS_INGEST_TYPE:i.default.get("ANALYTICS_INGEST_TYPE"),ANALYTICS_MAX_QUEUED_EVENTS:i.default.get("ANALYTICS_MAX_QUEUED_EVENTS"),ANALYTICS_DEBOUNCE:i.default.get("ANALYTICS_DEBOUNCE"),ALLOW_NO_TOKEN:i.default.get("ALLOW_NO_TOKEN")};class S{constructor(){_(this,"getAccessToken",t=>{if(h)return t();l.default.getAccessToken().then(e=>t(null,e)).catch(e=>t(null,e))}),_(this,"log",t=>{n.default.log(t)}),_(this,"getAgent",(t,e)=>{const a=c.a.stripPathFromURL(t);u.getNodeTunnelOptionsForURL(a).then(t=>{delete t.agent,e(null,t)},t=>{e(t)})})}}let E=f.createInstance(new S,g);e.default=Object.assign(new class{constructor(){_(this,"NO_PARAMS",null),_(this,"session_guid",s.v4()),_(this,"_status",!1),_(this,"checkIMS",(t,e)=>{const a=l.default.getUserInfo(),s=!(!a||!a.IMSProfile)&&JSON.parse(a.IMSProfile);return s&&t===a.UserID&&(e["user.service_code"]=s.serviceAccounts&&s.serviceAccounts[0]?s.serviceAccounts[0].serviceCode:"creative_cloud",e["user.service_level"]=s.serviceAccounts&&s.serviceAccounts[0]?s.serviceAccounts[0].serviceLevel:""),e}),_(this,"getIpAddress",d.default.memoize(()=>{var t=r.networkInterfaces();const e=Object.keys(t).map(e=>t[e].filter(t=>"IPv4"===t.family&&!t.internal)[0]).filter(t=>t);return e.length>0?e[0].address:""})),_(this,"cleanPSDKParameters",(t,e)=>(e&&(t["event.language"]=e.productLanguage,t["source.client_id"]=i.default.getEnvironment().CLIENT_ID,t["source.name"]=e.productCode,t["source.version"]=e.productVersion,t["source.platform"]=r.platform(),t["source.device"]="Desktop",t["source.os_version"]=r.release(),t["consumer.name"]="CCX Start",t["consumer.platform"]=r.platform(),t["consumer.os_version"]=r.release(),t["consumer.version"]=e.ccxVersion),t)),_(this,"createPayload",(t,e,a,r=!1)=>{if(!r){const e=l.default.getUserId();t["event.user_guid"]=e,t=this.checkIMS(e,t)}return t["event.guid"]=s.v4(),t["event.session_guid"]=this.session_guid,t["event.coll_dts"]=(new Date).toISOString(),t["event.dts_start"]=t["event.dts_start"]||(new Date).toISOString(),t["event.dts_end"]=t["event.dts_end"]||(new Date).toISOString(),t["event.workflow"]=i.default.analytics.w_CCX_PROCESS,t["event.category"]=i.default.analytics.c_DESKTOP,t["event.offline"]=o.default.status===o.default.OFFLINE,t["event.ip"]=this.getIpAddress(),t["event.language"]=t["event.language"]||u.getOSLocale(),t["event.device_guid"]=l.default.getDeviceID(),t["env.com.name"]=i.default.analytics.w_CCX_PROCESS,t["env.com.version"]=d.default.getProcessVersion(),t=this.cleanPSDKParameters(t,e),this.addSurfaceAnalytics(t,a),t}),_(this,"reset",t=>(t&&(E=f.createInstance(new S,t)),E)),_(this,"logProcessEvent",(t,e,a,s,r,i)=>{t=this.createPayload(t,e,a,r),s&&(s instanceof p.default||(s=new p.default(s)),t["event.error_desc"]=this.limitMessageSize(s.description),t["event.error_type"]=s.message,t["event.error_code"]=s.code),r?(h=!0,this.postEvent(t,i),this.flush(!0,()=>{h=!1})):this.postEvent(t,i)}),_(this,"flush",(t,e=(()=>{}))=>{E.flush(t,e)}),_(this,"postEvent",(t,e=(()=>{}))=>{E.postEvent(t,e)}),_(this,"enable",t=>{this._status=t,E.enable(t)}),_(this,"limitMessageSize",t=>t.substring(0,1024)),o.default.on(o.default.ONLINE,()=>{this.getIpAddress.cache.clear()})}addSurfaceAnalytics(t,e){const a=(e,a)=>{a&&(t[e]=t[e]||"",t[e].toString().includes(a)||(t[e]+=(t[e].toString().length>0?", ":"")+a))};if(e)for(const t of e)t.surface&&a("exp.surface_id",t.surface),t.campaignId&&a("exp.campaign_id",""+t.campaignId),t.variationId&&a("exp.variation_id",t.variationId),t.treatmentId&&a("exp.treatment_id",t.treatmentId),t.controlGroupId&&a("exp.control_group_id",t.controlGroupId),t.actionBlockId&&a("exp.action_block_id",t.actionBlockId);return t}},i.default.analytics)},function(t,e){t.exports=require("@ccx/node-imslib")},function(t,e){t.exports=require("events")},function(t,e,a){"use strict";a.r(e),a.d(e,"default",function(){return _});var s=a(2),r=a(6),i=a(35),n=a(7),o=a(0),c=a(22),d=a(9),l=a(3);const u=a(1).default,p=c.promisify(i.flock);class _{static async writeJsonAtomic(t,e,a){const r=t+e,i=`${r}_${n.v4()}.json`;await s.ensureDir(t),await s.writeJson(i,a,{spaces:2,EOL:d.EOL}),await _.rename(i,r)}static async rename(t,e){let a=Date.now(),r=0;await s.rename(t,e).catch(async function i(n){if(r<100&&(r+=10),!n||"EACCES"!==n.code&&"EPERM"!==n.code&&"ENOENT"!==n.code||!(Date.now()-a<6e4))throw n;if(await u.setTimeoutAsync(r),await s.pathExists(e))throw n;await s.rename(t,e).catch(i)})}static async writeAtomic({stream:t,target:e,progress:a=(()=>{}),url:i="unknown"}){const n=e+o.default.get("DOWNLOAD_TMP_EXTENSION"),c=u.throttle(a,o.default.get("PROGRESS_THROTTLE_INTERVAL"));await s.ensureDir(r.dirname(e)),await s.remove(n);const d=s.createWriteStream(n);return await new Promise((e,a)=>{const s=new l.default("NODE_FETCH_ERROR",`Timed out with node-fetch for URL ${i}`,"NODE_FETCH_HUNG").setPayload({"event.url":i});let r=setTimeout(()=>{a(s)},1e3),n=0;t.pipe(d),t.on("data",t=>{clearTimeout(r),r=setTimeout(()=>{a(s)},1e3),c(n+=t.length)}),t.on("error",a),t.on("close",e),d.on("close",e),d.on("error",a),d.on("finish",e)}),await _.rename(n,e),e}static async cleanupFolder(t,e={},a=/^$/){await s.ensureDir(t);const r=await s.readdir(t),i=[],n=[],o=[];return r.forEach(async r=>{e[r]||a.test(r)?i.push(r):(n.push(r),o.push(s.remove(t+r)))}),await u.waitAll(o),{left:i,removed:n}}static async obtainProcessLock(t){const e=o.default.get("ROOT_DIR");await s.ensureDir(e);const a=`${e}.${t}`,r=await s.open(a,"w");await p(r,"exnb")}}},function(t,e,a){"use strict";a.r(e),a.d(e,"default",function(){return E});var s=a(7),r=a(0),i=a(10),n=a(8),o=a(19),c=a(5),d=a(12),l=a(37),u=a.n(l),p=a(11),_=a(3),h=a(4),f=a(1),g=a(27);function S(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class E{constructor(t){S(this,"type",void 0),S(this,"_requestLock",void 0),S(this,"prioritize",void 0),S(this,"log",void 0),S(this,"downloadCollectionData",void 0),S(this,"dns",void 0),this.type=t,this.dns={},E.requestLock=E.requestLock||new n.default(r.default.get("NUM_CONCURRENT_REQUESTS")),this._requestLock=E.requestLock,this.prioritize=this._requestLock.prioritize,this.log=new i.default({prefix:`${r.default.get("LOG_PREFIX",t)}DownloadManager > `,payload:{"event.subtype":r.default.analytics.st_API}}),this.downloadCollectionData=f.default.retryLocalErrors(this.downloadCollectionDataRaw.bind(this))}async url(t){const e=r.default.getEnvironment(),a=new p.URL(r.default.get(`URL_${e.LABEL.toUpperCase()}`,this.type));return this.appendUrlSearchParams(a.searchParams,t),a.toString()}additionalAnalytics(t){return{}}applyResponseAnalytics(t,e,a){}async downloadCollectionDataRaw(t){}async performDnsCaching(t,e){const a=new p.URL(t),s=a.hostname;return this.dns[s]||await new Promise(t=>{g.lookup(a.hostname,{family:4},(e,a)=>{this.dns[s]=a||s,t(),r.default.get("DISABLE_DNS_CACHE_TIMEOUT")||setTimeout(()=>{delete this.dns[s]},r.default.get("DNS_CACHE_DURATION"))})}),a.hostname=this.dns[s],e.headers=e.headers||{},e.headers.Host=s,{url:a.toString(),options:e}}async get(t={url:""}){let{url:e,options:a={},auth:i=!1,id:n=s.v4(),priority:l}=t;if(h.default.isWaitingForBackOff(h.BackOffType.NETWORK))throw new Error(`Waiting for global back-off ${h.default.backOffCause(h.BackOffType.NETWORK)}`);if(d.default.status===d.default.OFFLINE)throw new Error(`Cannot get ${e} - Offline`);return a.headers=a.headers||{},a.timeout=a.timeout||r.default.get("REQUEST_TIMEOUT"),a.headers["X-Request-Id"]=n,await this._requestLock.read(async()=>{this.log.disk(`[${n}] Requesting ${e} - Priority(${l&&l.toString()||0})`);const t=Date.now(),s=new p.URL(e).origin;if(i){if(h.default.isWaitingForBackOff(h.BackOffType.AUTH))throw new Error(`Waiting for global back-off ${h.default.backOffCause(h.BackOffType.AUTH)}`);const t=await c.default.getAccessToken();a.headers.Authorization=`Bearer ${t}`}a.headers.Connection="keep-alive",a.agent=(await o.getNodeTunnelOptionsForURL(s)).agent;const f=await this.performDnsCaching(e,a),g=await u()(f.url,f.options).catch(t=>{if("system"===t.type&&"ENOTFOUND"===t.code)throw d.default.check(),h.default.updateBackOff({cause:"Offline[Network]",type:h.BackOffType.NETWORK}),new _.default(r.default.analytics.OFFLINE_ERROR).setPayload({"event.url":e});throw"system"===t.type&&"PROXY"===t.code&&h.default.updateBackOff({cause:t.message,type:h.BackOffType.NETWORK}),t});if(!g.ok&&304!==g.status){429===g.status&&h.default.updateBackOff({cause:`Server Error[${g.status}]`,type:h.BackOffType.NETWORK}),401===g.status&&h.default.updateBackOff({cause:`Server Error[${g.status}]`,type:h.BackOffType.AUTH});const t=await g.text(),a=new _.default(r.default.analytics.st_NETWORK,`Failed to get ${e} with status code ${g.status} - ${t}`,g.status).setPayload({"event.url":e});throw a.setResponseHeaders(g.headers),a}h.default.updateBackOff({clear:!0,type:h.BackOffType.NETWORK});const S=Date.now()-t;return this.log.disk(`[${n}] Finished ${S}ms`),{response:g,time:S}},l).catch(t=>{throw this.log.disk(`[${n}] Failed - ${t}`),t})}async getResponseJson(t,e){return await Promise.race([t.json().catch(t=>{throw new _.default(r.default.analytics.INVALID_JSON,t).setPayload({"event.url":e})}),new Promise((a,s)=>{const r=new _.default("NODE_FETCH_ERROR",`Timed out with node-fetch for url ${e}`).setPayload({"event.url":e});let i=setTimeout(()=>{s(r)},1e3);t.body.on("data",()=>{clearTimeout(i),i=setTimeout(()=>{s(r)},1e3)})})])}appendUrlSearchParams(t,e={}){const a=e;for(const e in a)Array.isArray(a[e])?a[e].forEach(a=>{t.append(e,a||"")}):t.append(e,a[e]||"")}}S(E,"requestLock",void 0)},function(t,e,a){"use strict";a.d(e,"a",function(){return u});var s=a(16),r=a(2),i=a(13),n=a(3),o=a(10),c=a(0),d=a(6);function l(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class u{constructor(t,e){l(this,"_id",void 0),l(this,"_lookupMap",void 0),l(this,"_diskLock",void 0),l(this,"log",void 0),l(this,"_fileName",void 0),l(this,"_data",void 0),this._id=t,this._lookupMap=e,this._diskLock=e.diskLock,this.log=new o.default({prefix:`${c.default.get("LOG_PREFIX",e.type)}Data > `,payload:{"event.subcategory":c.default.get("ANALYTICS_SUBCATEGORY",e.type)}}),this._fileName=`${this._id}.json`}setData(t,e){const a=this.validateData(t,e);return a?this.log.error(new n.default(i.default.DATA_VALIDATION_ERR,`Invalid data: ${JSON.stringify(t)}`)):this._data=t,a}get fileName(){return this._fileName}get assetsDir(){return d.join(c.default.get("ROOT_DIR"),c.default.get("DIR",this._lookupMap.type),c.default.get("ASSETS_DIRNAME"))+"/"}hasValidCards(){return!0}get id(){return this._id}get expiryTime(){return this._data&&this._data.expirationDTS}async upgrade(t,e){return null}async load({version:t,skipSaving:e}){let a=await r.readJson(this._lookupMap.getPath()+this._fileName),s=!1;const i=a._ccx&&a._ccx.version||a.version;a&&i!==c.default.get("LOOKUP_COLLECTION_FILE_VERSION",this._lookupMap.type)&&(this.log.disk(`Collection Lookup file version mismatch: ${this._fileName}`),a=await this.upgrade(a,t).catch(t=>null),s=!0);let n=this.setData(a,t);if(n)throw n;return n||!s||e||await this.save(),this}async save(){if(!this._data)throw new Error("No data to save");await this._diskLock.write(async()=>await s.default.writeJsonAtomic(this._lookupMap.getPath(),this._fileName,this._data))}async sync(t){if(!this._data)throw new Error("Invalid data");await this.syncData(function(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{},s=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(a).filter(function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),s.forEach(function(e){l(t,e,a[e])})}return t}({},t,{progress:async e=>{await this.save(),t.progress&&t.progress(e)}})),await this.save()}get isDefaultData(){return!!(this._data&&this._data._ccx&&this._data._ccx.isDefault)}get data(){return this._data}validateData(t,e){return null}}},function(t,e,a){const s=a(10).default,r=a(15),i=a(22),n=a(1).default,o=new s({prefix:"Proxy > "}),c=a(32),d=a(42),l=a(32).globalAgent,u={},p=a(43)((t,e)=>{o.disk(e)}),_={getRootCA:i.promisify(p.getRootCA),resolve:i.promisify(p.resolve)};t.exports=new class extends r{constructor(){super(),this._lastCredentials={},this.getOSLocale=n.memoize(p.getOSLocale),this.getNodeTunnelOptionsForURL=n.memoize(this._getNodeTunnelOptionsForURL)}async init(){p.setAuthenticationCallback((t,e)=>{const a=this._lastCredentials[t.proxy.host+t.proxy.port]||{};if(a.username===this.proxyUser&&a.password===this.proxyPassword){const a=new Error(`No new credentials for ${t.proxy.host}:${t.proxy.port}`);a.code="PROXY",e(a)}else if(this.proxyUser)a.username=this.proxyUser,a.password=this.proxyPassword,e(null,a),this._lastCredentials[t.proxy.host+t.proxy.port]=a;else{const a=new Error(`No credentials present for ${t.proxy.host}:${t.proxy.port}`);a.code="PROXY",e(a)}}),p.on("change",()=>{o.disk("System proxy settings changed"),this.getNodeTunnelOptionsForURL.cache.clear(),this.emit("change",!0)}),this._ca=await _.getRootCA().catch(t=>{o.error(t,"Error getting Root CA")}),l.options.ca=this._ca}async _getNodeTunnelOptionsForURL(t){let e=await _.resolve(t).catch(t=>{o.error(t,"Error getting proxy settings")});const a=(e=e&&e[0])&&e.agentClass||(t.startsWith("https")?c.Agent:d.Agent),s=e&&e.agentOptions||{},r={};s.ca=this._ca,s.keepAlive=!0,s.keepAliveMsecs=1e4,s.maxFreeSockets=1e3;const i=s.proxy?s.proxy.host+s.proxy.port:t.startsWith("https")?"https":"http";if(u[i]=u[i]||new a(s),r.agent=u[i],e.agent){const a=`${e.hostname}:${e.port}${this.proxyUser?" with":" without"} authentication`;o.disk(`Setting proxy for ${t}: ${a}`),r.details=a}else o.disk(`No proxy (direct connection) for ${t}`),r.details="No Proxy";return r}setProxyCredentials(t,e){this.proxyUser===t&&this.proxyPassword===e||(o.disk("Setting proxy username and password"),this.proxyUser=t,this.proxyPassword=e,this.getNodeTunnelOptionsForURL.cache.clear(),this.emit("change",!1))}getProxyCredentials(){return{user:this.proxyUser,password:this.proxyPassword}}clearCache(){this.getNodeTunnelOptionsForURL.cache&&this.getNodeTunnelOptionsForURL.cache.clear(),this.proxyUser=void 0,this.proxyPassword=void 0,this._lastCredentials={}}}},function(t,e,a){"use strict";a.r(e),a.d(e,"default",function(){return C});var s=a(0),r=a(8),i=a(3),n=a(6),o=a(11),c=a(12),d=a(4),l=a(7),u=a(2),p=a(36),_=a(5),h=a(16),f=a(10),g=a(1),S=a(21),E=a(13),y=a(15);function T(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{},s=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(a).filter(function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),s.forEach(function(e){I(t,e,a[e])})}return t}function I(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const A=a(19);class C extends y{constructor(t){super(),I(this,"_data",void 0),I(this,"_type",void 0),I(this,"_path",void 0),I(this,"_fileName",void 0),I(this,"_downloadManager",void 0),I(this,"_diskLock",void 0),I(this,"_syncLock",void 0),I(this,"log",void 0),I(this,"gc",void 0),I(this,"_syncTimeout",void 0),I(this,"fetchAsset",void 0),I(this,"_fetchCollectionData",void 0),I(this,"fetchCollectionIndex",void 0),I(this,"_saveInProgress",!1),I(this,"_calledSave",!1),s.default.patch(t.LABEL,t||{}),this._type=t.LABEL,this._path=n.join(s.default.get("ROOT_DIR"),s.default.get("DIR",this.type)),this._fileName=s.default.get("LOOKUP_MAP_FILE"),this._downloadManager=null,this._diskLock=new r.default,this._syncLock=new r.default(9999),this.log=new f.default({prefix:`${s.default.get("LOG_PREFIX",this.type)}LookupMap > `,payload:{"event.subcategory":s.default.get("ANALYTICS_SUBCATEGORY",this.type)}}),this.fetchAsset=g.default.memoize(g.default.retryLocalErrors(this._fetchAsset.bind(this)),{refresher:t=>"pending"!==t.state,resolver:t=>t.href,wrapper:(t,e,a)=>{const s=t[0]||{};return s.force&&s.force.type&&a&&["stale","always"].includes(s.force.type)?e.then(()=>this._fetchAsset(s)):e}}),this._fetchCollectionData=g.default.memoize(this._fetchCollectionDataRaw,{refresher:t=>"pending"!==t.state,resolver:t=>this.paramsToId(t.params,!1),wrapper:(t,e,a)=>{const s=t[0]||{};return s.force&&s.force.type&&a&&["stale","always"].includes(s.force.type)?e.then(()=>this._fetchCollectionData(s)):e}}),this.fetchCollectionIndex=g.default.retryLocalErrors(this.fetchCollectionIndexRaw.bind(this)),this.gc=g.default.memoize(this._gc,{refresher:t=>"pending"!==t.state})}isSyncInProgress(t){const e=this._fetchCollectionData.cache&&this._fetchCollectionData.cache.get(t);return e&&"pending"===e.state}paramsToIdRaw(t){const e=this._getCollectionInfo(t);if(e&&e.pendingId)return e.pendingId;if(e&&e.latestId){const t=this._data.metadata[e.latestId];if(g.default.getTimeToExpiry(t.expiryTime)>0)return e.latestId}}paramsToId(t,e=!0){const a=this.paramsToIdRaw(t);if(a)return a;const s=this._generateId(t);return this._addNewCollectionInfo({params:t,isPending:!0,collectionId:s}),e?this.save().then(()=>s):(this.save(),s)}_generateId(t){return`${t.productCode}-${t.productVersion}-${t.productLanguage}-${l.v4()}`.trim()}async expireAll(t){Object.keys(this._data.metadata).forEach(e=>{t&&t===this._data.metadata[e].userId&&delete this._data.metadata[e].expiryTime}),await this.save()}_getLookupKeys(t,e=null){const a=t.productVersion&&t.productVersion.split(".")[0],s=[e||_.default.getUserId()];return s.push(t.productCode,a,t.productLanguage),s}_getCollectionInfo(t,e=null){if(!t)return;const a=this._getLookupKeys(t,e);let s=this._data.versionInfo;return a.forEach(t=>{s&&(s=s[t])}),s}_setCollectionInfo(t,e){const a=this._getLookupKeys(t);let s=this._data.versionInfo;return a.forEach((t,r)=>{r===a.length-1?s[t]=e:(s[t]=s[t]||{},s=s[t])}),s}_isDataReferenced(t){const e=this._data.metadata[t],a=e&&this._getCollectionInfo(e.params,e.userId);return!!a&&!!Object.keys(a).find(e=>t===a[e])}_isDataPrimaryReference(t){const e=this._data.metadata[t],a=e&&this._getCollectionInfo(e.params,e.userId);if(a){if(a.pendingId)return t===a.pendingId;if(a.latestId)return t===a.latestId}return!1}_checkValidity(t,e){}_addNewCollectionInfo({params:t,isPending:e,collectionId:a,expiry:s,retry:r,cause:i="Unknown",refreshTime:n}){const o=this._getCollectionInfo(t)||{};let c=new Date;return Object.values(o).forEach(t=>{const e=this._data.metadata[t];if(e&&e.lastUseTime){const t=new Date(e.lastUseTime);!isNaN(t.getTime())&&t>c&&(c=t)}!r&&e&&e.retry&&(r=e.retry)}),e?o.pendingId=a:(o.latestId=a,delete o.pendingId),this._setCollectionInfo(t,o),this._data.metadata[a]={expiryTime:s?s.toISOString():void 0,userId:_.default.getUserId(),lastUseTime:c.toISOString(),retry:r,cause:i,params:t,refreshTime:n},this._data.metadata[a].params=t,this._data.metadata[a]}sanitizeParams(t){return t.productLanguage=g.default.sanitizeLocale(t.productLanguage),t}isRequestPoisoned(t){const e=s.default.get("SUPPORTED_PRODUCTS",this.type);return!(t.productCode&&e[t.productCode]&&g.default.compareMajorMinorVersions(e[t.productCode],t.productVersion)>-1)}_calculateExpiry(t,e){const a=t?t.expiryTime:void 0;let r;if(a){r=new Date(a);const t=new Date;t.setMilliseconds(s.default.get("MAX_TIMEOUT")),r>t&&(r=t);const e=new Date;e.setMilliseconds(s.default.get("MIN_TIMEOUT")),r<e&&(r=e)}return r}_calculateBackOffMetadata({id:t,error:e,updateBackOff:a=!0}){let r=0,i="killed before response";const n=e,o=this._data.metadata[t];if(n&&n.responseHeaders){const t=S.a.getRetryAfterHeader(n.responseHeaders);t&&(r=1e3*t)}else o&&o.retry&&(r=o.retry*(a?2:1));n&&(i=n.short?n.short:n.message?n.message:n.toString()),r=Math.max(s.default.get("SYNC_INITIAL_RETRY"),Math.min(r,s.default.get("MAX_TIMEOUT")));const c=new Date;return c.setMilliseconds(r),{expiry:c,retry:r,cause:i}}async fetchCollectionIndexRaw({requestId:t,desiredId:e,params:a,oldMetadata:r,priority:i,force:n,skipAuth:o=!1}){const c=this._createCollectionData(e);let d=!0;await c.load({version:g.default.ccxVersionToString(a)}).catch(t=>{d=!1}),d&&g.default.isDateExpired(c.expiryTime)&&(d=!1),d&&c.isDefaultData&&(d=!1);let l=r&&r.refreshTime;if(d&&("stale"===n.type&&g.default.isDateExpired(r.expiryTime)?d=!1:"always"===n.type&&(d=!1)),!d||o){const r=await this.downloadManager.downloadCollectionData({id:t,params:a,priority:i,skipAuth:o});r._ccx=r._ccx||{},r._ccx.version=s.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type);let n=c.setData(r,g.default.ccxVersionToString(a));if(n)throw n;await c.save(),l=(new Date).toISOString(),this._data.metadata[e].refreshTime=l,await this.save()}return this._checkValidity(c,a),c}async defaultCollectionData({params:t,desiredId:e}){}async _fetchCollectionDataRaw({params:t,priority:e,payload:a,force:r={type:"none"}}){if(d.default.isWaitingForBackOff(d.BackOffType.NETWORK))throw new i.default(`Awaiting global back-off ${d.default.backOffCause(d.BackOffType.NETWORK)}`).silence();return await this._syncLock.read(async()=>{if(!_.default.getUserId())throw new i.default("signed out").silence();if(c.default.status===c.default.OFFLINE)throw this.log.disk("Not downloading collection - offline"),new i.default("offline").silence();let n=await this.paramsToId(t);const d=this._getCollectionInfo(t),u=n;if(d&&n===d.latestId){if(!r||"always"!==r.type)return this._createCollectionData(n);delete this._data.metadata[n].expiryTime,n=await this.paramsToId(t)}let p=t=>{this.emit(n,t),u!==n&&this.emit(u,t)};if(t=this.sanitizeParams(t),(e=e||this.priority({params:t,key:n})).key=n,this.isRequestPoisoned(t))throw new i.default("Poisoned request not supported.").silence();const h=Object.assign({},this._data.metadata[n]);if(h&&!g.default.isDateExpired(h.expiryTime)){const e=`Waiting for back-off ${h.cause} for ${(h.retry||0)/1e3}s expiring ${h.expiryTime}`;throw this.log.context({params:t}).disk(e),new i.default(e).silence()}this._addNewCollectionInfo(T({params:t,isPending:!0,collectionId:n,refreshTime:h.refreshTime},this._calculateBackOffMetadata({id:n}))),await this.save();const f=l.v4(),S=await this.downloadManager.url(t),E=await A.getNodeTunnelOptionsForURL(new o.URL(S).origin).details;let y=this.log.context({params:t,payload:T({},a,{"exp.request_guid":f,"event.url":S,"content.action":S,"event.subtype":s.default.analytics.st_API,"ccxp.proxy":E},this.downloadManager.additionalAnalytics(t))});return await y.request(async a=>{try{const o={};p(o);const c={requestId:f,params:t,desiredId:n,oldMetadata:h,force:r,priority:e},d=await this.fetchCollectionIndex(c).catch(async e=>{if(!s.default.get("ANONYMOUS_RETRY_DISABLED",this.type)&&await _.default.getAccessToken()){c.skipAuth=!0,this.log.context({params:t}).error(new i.default("Attempting Context only (bypass)",e));const a=await this.fetchCollectionIndex(c).catch(async e=>{if(!s.default.get("DEFAULT_URLS_ENABLED",this.type))throw e;this.log.context({params:t}).error(new i.default("Attempting Default URL (bypass)",e));const a=await this.defaultCollectionData({params:t,desiredId:n});if(!a)throw e;return await a.save(),a});if(!a)throw e;return await a.save(),a}{this.log.context({params:t}).error(new i.default("Attempting Default URL (bypass)",e));const a=await this.defaultCollectionData({params:t,desiredId:n});if(!a)throw e;return await a.save(),a}});return this.downloadManager.applyResponseAnalytics(a,d.data,t),o.path=`${this._path+d.id}.json`,o.contentId=d.id,o.total=d.totalItems,p(o),await d.sync({priority:e,payload:a.options.payload,params:t,progress:t=>{p(Object.assign(t,o))},force:r}),this._checkValidity(d,t),this._addNewCollectionInfo({params:t,isPending:!1,collectionId:d.id,expiry:this._calculateExpiry(d,t),refreshTime:this._data&&this._data.metadata[n]&&this._data.metadata[n].refreshTime}),await this.save(),this.emit("newCollection",t,d),d}catch(e){throw this._addNewCollectionInfo(T({params:t,isPending:!0,collectionId:n,refreshTime:this._data.metadata[n].refreshTime},this._calculateBackOffMetadata({id:n,error:e,updateBackOff:!1}))),await this.save(),e}})},e)}_clearScheduledSyncJob(){this._syncTimeout&&(clearTimeout(this._syncTimeout),delete this._syncTimeout)}async _scheduleNextSyncJob(){let t=1/0;if(this._clearScheduledSyncJob(),d.default.isWaitingForBackOff(d.BackOffType.NETWORK))return t=new Date(d.default.backOffExpiry(d.BackOffType.NETWORK)).getTime()-(new Date).getTime(),this.log.disk(`Scheduling next sync in ${t}ms after global backoff`),t=Math.min(s.default.get("MAX_TIMEOUT"),t),void(this._syncTimeout=setTimeout(this.sync.bind(this),t));await g.default.waitAll(Object.keys(this._data.metadata).map(async e=>{const a=this._data.metadata[e],r=a.params;if(this.needsSync(e,{checkExpiry:!1})){let e=g.default.getTimeToExpiry(a.expiryTime);if(0===e){e=s.default.get("SYNC_INITIAL_RETRY");const t=new Date;t.setMilliseconds(e),a.expiryTime=t.toISOString(),await this.save(),this.log.context({params:r}).info(s.default.analytics.MISSING_DATA,`Scheduling with expired data. Add back-off for ${r.productCode}[${r.productLanguage}] - ${a.expiryTime}`)}t=Math.min(t,e)}})),t!==1/0&&(t+=g.default.getRandomizedTime(),t=Math.min(t,s.default.get("MAX_TIMEOUT")),this.log.disk(`Scheduling next sync in ${t}ms at ${new Date(Date.now()+t).toISOString()}`),this._syncTimeout=setTimeout(this.sync.bind(this),t))}_getReferencedIdList(){const t={};return Object.keys(this._data.metadata).forEach(e=>{this._isDataReferenced(e)&&(t[e]=!0)}),t}_isPendingCollection(t){const e=this._data.metadata[t],a=e&&this._getCollectionInfo(e.params,e.userId);return!(!a||!a.pendingId)&&t===a.pendingId}async _refetchCollection(t){const e=this._data.metadata,a=e[t]&&e[t].params;return a?(this.clearCollectionInfo(a,t),this.log.disk(`Refetch collection [${t}]`),await this.addNewCollectionData({params:a}).catch(t=>this.log.context({params:a}).error(t,"Error Re-fetching collection")&&void 0)):Promise.resolve()}async _getReferencedAssetList(t){const e={};return await g.default.waitAll(Object.keys(t).map(async t=>{let a=this._createCollectionData(t);try{const s=g.default.ccxVersionToString(this._data.metadata[t].params);await a.load({version:s,skipSaving:!0}),Object.assign(e,await a.getReferencedAssets())}catch(t){if("ENOENT"!==t.code)throw t;{this.log.disk(`File is missing for collection [${a.id}]`);const t=this._data.metadata[a.id];t&&t.userId===_.default.getUserId()&&this._isDataPrimaryReference(a.id)&&!this._isPendingCollection(a.id)&&this._refetchCollection(a.id)}}})),e}_cleanupCache(t,e){const a=this._data.metadata;Object.keys(a).forEach(s=>{this._isDataPrimaryReference(s)||t[s]&&e.includes(`${s}.json`)||delete a[s]})}_cleanupAssetsCache(t,e){const a=this._data.assetMetadata;Object.keys(a).forEach(s=>{const r=a[s];r.path&&(t[r.path]&&e.includes(n.basename(r.path))||delete a[s])})}setData(t){const e=g.default.validateDataFields(t,s.default.get("MAP_DATA_SCHEMA"));return e?this.log.error(new i.default(E.default.DATA_VALIDATION_ERR,e[0])):this._data=t,e}async upgrade(t){return null}async load(){let t=await u.readJson(this._path+this._fileName).catch(t=>{this.log.disk(`Failed to load lookup file from disk: ${this._fileName} - ${g.default.scrubStack(t)}`)}),e=!1;t?t.version!==s.default.get("LOOKUP_MAP_FILE_VERSION",this._type)&&(this.log.disk(`Lookup file version mismatch: ${this._fileName}`),t=await this.upgrade(t).catch(t=>null),e=!0):this.log.disk(`Empty lookup file: ${this._fileName}`),t&&!this.setData(t)||((t={}).version=s.default.get("LOOKUP_MAP_FILE_VERSION",this._type),t.versionInfo={},t.metadata={},t.assetMetadata={},t.usersInfo={},this.setData(t)),e&&await this.save()}getPath(){return this._path}async updateDisplayedId({params:t,displayed:e}){if(e&&t){const a=n.basename(e,".json");let s=this._getCollectionInfo(t);s||(this._addNewCollectionInfo({params:t,isPending:!1,collectionId:a}),s=this._getCollectionInfo(t)),s&&s.lastDisplayedId!==a&&(s.lastDisplayedId=a,this._setCollectionInfo(t,s),await this.save())}}validateParams(t){const e=g.default.validateDataFields(t,s.default.get("PARAMETERS_SCHEMA",this.type));if(e)throw new i.default(s.default.analytics.PARAM_VALIDATION_ERR,e[0])}async getLatestPath({params:t,updateLastUsedId:e=!1,updateLastUseTime:a=!1}){this.validateParams(t);const r=this._getCollectionInfo(t);if(r&&r.latestId){let i=!1;if(e&&r.latestId!==r.lastUsedId&&(r.lastUsedId=r.latestId,this._setCollectionInfo(t,r),i=!0),a){const t=this._data.metadata[r.lastUsedId?r.lastUsedId:""]||{},e=t.lastUseTime;if(t.lastUseTime=(new Date).toISOString(),e){const t=new Date(e);t.setMilliseconds(s.default.get("STOP_SYNCING_BEYOND")),t<new Date&&this.sync()}i=!0}i&&await this.save();const n=this._data.metadata[r.latestId];if(n&&n.userId===_.default.getUserId()&&!this._isPendingCollection(r.latestId)){const e=this._createCollectionData(r.latestId);e.load({version:g.default.ccxVersionToString(t)}).catch(t=>{"ENOENT"===t.code&&(this.log.disk(`File is missing for collection [${e.id}]`),this._refetchCollection(e.id))})}return`${this._path+r.latestId}.json`}}getExpiry(t){return this._data.metadata[t]&&this._data.metadata[t].expiryTime}async save(){if(!this._data){const t=new Error(E.default.DATA_VALIDATION_ERR);throw this.log.error(t,"No data to save to LookupMap."),t}this._saveInProgress?this._calledSave=!0:(this._calledSave=!1,this._saveInProgress=!0,await this._diskLock.write(async()=>{await h.default.writeJsonAtomic(this._path,this._fileName,this._data)}).catch(t=>{this._saveInProgress=!1,this.log.error(t,`Error writing to ${this._fileName}`)}),this._saveInProgress=!1,this._calledSave&&(await this.save(),this._calledSave=!1))}async _fetchAsset({href:t,assetsDir:e,priority:a,params:r,force:i}){const o=this._data.assetMetadata[t]||{};let{lastModified:c,expiry:d}=o;if(c&&!await u.pathExists(`${e}../${o.path}`)&&(c=void 0,d=void 0),i&&i.depth>=0&&("always"===i.type||"stale"===i.type)&&(!i.from||!o.refreshTime||new Date(i.from)>new Date(o.refreshTime))&&(c=void 0,d=void 0),new Date(d||"")>new Date)return{path:o.path};if(c&&o.path&&".json"!==n.extname(o.path)&&!s.default.get("NON_IDEMPOTENT_IMAGES",this.type))return{path:o.path};const l=this._generateId(r||{}),_=c?{"If-Modified-Since":c}:void 0;let{response:f,time:g}=await this.downloadManager.get({url:t,options:{headers:_},priority:a,id:l});if(304===f.status){if(o.path)return{path:o.path};throw new Error(`Got 304 for asset not on disk for url ${t}`)}let E=p.getExtension(S.a.getContentTypeHeader(f.headers)||"");E||(E=(E=n.extname(f.url))&&E.substr(1));const y=`${e}${l}.${E}`,T=`${n.basename(e)}/${l}.${E}`,I=Date.now();return await h.default.writeAtomic({stream:f.body,target:y,url:t}),g+=Date.now()-I,this._data.assetMetadata[t]={path:T,lastModified:f.headers.get("last-modified")||(new Date).toISOString(),expiry:S.a.getExpiry(f.headers)||new Date(Date.now()+s.default.get("ASSET_DEFAULT_EXPIRATION")),refreshTime:(new Date).toISOString()},await this.save(),{path:T,time:g}}priority({params:t,key:e="",level:a=r.PriorityLevels.Regular}){return new r.Priority({key:e,value:s.default.get("PRODUCT_PRIORITY")[t.productCode]||0,channel:s.default.get("PRIORITY_CHANNEL",this._type),level:a})}isValidDataForParams({id:t,params:e}){return!0}async addNewCollectionData({params:t,payload:e,priorityLevel:a,progress:s=(()=>{}),force:i}={}){if(!t){const t=new Error(E.default.DATA_VALIDATION_ERR);throw this.log.error(t,"No parameters to add the collection of."),t}this.validateParams(t);const n=this._getCollectionInfo(t);if(n&&t.ccxVersion){let e=!1;Object.values(n).forEach(a=>{const s=this._data.metadata[a];s&&s.params&&s.params.ccxVersion&&(s.params.ccxVersion&&-1!==g.default.compareMajorMinorVersions(t.ccxVersion,s.params.ccxVersion)||(s.params.ccxVersion=t.ccxVersion,e=!0))}),e&&await this.save()}if(n&&n.latestId){const r=n.latestId;this._data.metadata[r]=this._data.metadata[r]||{};let o=!0;if(i)switch(i.type){case"always":delete this._data.metadata[r].expiryTime;case"stale":g.default.isDateExpired(this._data.metadata[r].expiryTime)&&(o=!1)}if(this.isValidDataForParams({id:r,params:t})||(o=!1,delete this._data.metadata[r].expiryTime),o){const n=this._createCollectionData(r);return this._data.metadata[r].params=t,await n.load({version:g.default.ccxVersionToString(t)}).catch(async n=>(this.clearCollectionInfo(t,r),await this.addNewCollectionData({params:t,payload:e,progress:s,priorityLevel:a,force:i})))}}const o=await this.paramsToId(t),c=this.priority({params:t,key:o,level:a||r.PriorityLevels.Regular});this._syncLock.prioritize(c),this._downloadManager.prioritize(c),this.addListener(o,s);const d=await this._fetchCollectionData({params:t,priority:c,payload:e,force:i}).catch(async e=>{throw this.log.context({params:t}).disk(e,"Error adding new collection"),await this._scheduleNextSyncJob(),this.removeListener(o,s),e});return this.removeListener(o,s),d}needsSync(t,e={}){const{checkExpiry:a=!0,force:s=!1}=e,r=this._data.metadata[t];let i=r&&r.userId===_.default.getUserId()&&this._isDataPrimaryReference(t)&&!this.isSyncInProgress(t)&&!this.isRequestPoisoned(r.params);return s||(i=i&&g.default.hasBeenUsedRecently(r.lastUseTime)),a&&!s&&(i=i&&g.default.isDateExpired(r.expiryTime)),i}async sync(t=!1){if(c.default.status===c.default.OFFLINE){d.default.updateBackOff({cause:"Offline[Network]",type:d.BackOffType.NETWORK}),await this._scheduleNextSyncJob();const t=new i.default("Offline");throw this.log.disk(t),t}this._clearScheduledSyncJob(),t&&await this.expireAll(_.default.getUserId()),this._data&&this._data.metadata&&await g.default.waitAll(Object.keys(this._data.metadata).map(e=>{const a=this._data.metadata[e];return this.needsSync(e,{force:t,checkExpiry:!this._isPendingCollection(e)})?this._fetchCollectionData({params:a.params}):Promise.resolve()})).catch(async t=>{throw await this._scheduleNextSyncJob(),t}),await this.gc(),await this._scheduleNextSyncJob()}async _gc(){try{await this._syncLock.write(async()=>{await this._diskLock.write(async()=>{this.log.disk("GC starts.");const t=this._getReferencedIdList(),e={},a={};Object.keys(t).forEach(t=>{e[`${t}.json`]=!0});const{left:r,removed:i}=await h.default.cleanupFolder(this._path,e,new RegExp(s.default.get("IGNORED_FILES_REGEXP")));i.length>0&&this.log.disk(`Removed from ${this._path} - ${i.join(" ")}`);const o=await this._getReferencedAssetList(t);Object.keys(o).forEach(t=>{a[n.basename(t)]=!0});const c=this._path+s.default.get("ASSETS_DIRNAME")+"/",{left:d,removed:l}=await h.default.cleanupFolder(c,a);l.length>0&&this.log.disk(`Removed from ${c} - ${l.join(", ")}`),this._cleanupCache(t,r),this._cleanupAssetsCache(o,d)})}),await this.save(),this.log.disk("GC ended successfully.")}catch(t){throw this.log.error(t,s.default.analytics.GC_ERROR),t}}async setForUser(t,e){let a=this._data.usersInfo;(a=a||{})[_.default.getUserId()]=a[_.default.getUserId()]||{},a[_.default.getUserId()][t]=e,await this.save()}getForUser(t){const e=this._data.usersInfo&&this._data.usersInfo[_.default.getUserId()];return e&&e[t]}async getLastTimeOfNotification(){let t=this.getForUser("lastTimeOfNotification");return t||(t=(new Date).getTime(),this.setForUser("lastTimeOfNotification",t)),t}async setLastTimeOfNotification(t){await this.setForUser("lastTimeOfNotification",t)}async clearCollectionInfo(t,e){this.validateParams(t);const a=this._getLookupKeys(t);let s=this._data.versionInfo,r=!1;const i=[["root",s]];if(a.forEach(t=>{s&&s[t]?(s=s[t],i.push([t,s])):r=!0}),r||0===i.length)return;let n=i.pop(),o=n[0],c=n[1];const d=[];for(Object.keys(c).forEach(t=>{e?c[t]===e&&(delete c[t],d.push(e)):(d.push(c[t]),delete c[t])}),d.forEach(t=>delete this._data.metadata[t]);i.length>0&&0===Object.keys(c).length;){let t=o;o=(n=i.pop())[0],delete(c=n[1])[t]}await this.save()}async updateLicenseInformation(t){if(!t)return;const e=Object.assign({},t);"trial"===t.subscriptionStatus?e.subscriptionStatus="paid":e.subscriptionStatus="trial",await this.clearCollectionInfo(e)}get downloadManager(){return this._downloadManager}get type(){return this._type}getCachedRequestData(){const t={};return Object.keys(this._data.metadata).forEach(e=>{const a=this._data.metadata[e];if(a.userId===_.default.getUserId()){const e=a.params;if(e&&e.productCode&&e.productVersion){t[e.productCode]||(t[e.productCode]={}),(e=>{t[e.productCode][e.productVersion]||(t[e.productCode][e.productVersion]=[]),t[e.productCode][e.productVersion].push(e)})(a.params)}}}),t}updateParams(t){const e=JSON.parse(JSON.stringify(t)),a=A.getOSLocale(),s=_.default.getUserInfo()&&_.default.getUserInfo().CountryCode||a.split("_")[1];return e.forEach(t=>{t.productLanguage=t.productLanguage||a,t.countryCode=t.countryCode||s}),e}targetDetails(t){return t}get diskLock(){return this._diskLock}}},function(t,e,a){"use strict";a.d(e,"a",function(){return i});var s=a(11);const r=a(1).default;class i{static stripPathFromURL(t){if("string"!=typeof t)return;const e=s.parse(t);return e.protocol&&e.host?`${e.protocol}//${e.host}`:void 0}static getRetryAfterHeader(t){if(t){const e=t.get("retry-after");if(e)try{const t=parseInt(e,10);if(t)return Math.max(0,t);const a=new Date(e);if(!isNaN(a)){const t=(new Date).valueOf(),e=Math.max(0,a-t),s=r.getRandomizedTime();return Math.round((e+s)/1e3)}}catch(t){}}return 0}static getExpiry(t){let e=new Date(t.get("expiry")||"");const a=t.get("cache-control");if(a&&"string"==typeof a&&a.includes("max-age=")){const t=parseInt(a.split("max-age=")[1].trim(),10);t&&(e=new Date).setSeconds(t)}if(!isNaN(e))return e.toISOString()}static getContentTypeHeader(t){if(t){let e=t.get("content-type");if(e&&"string"==typeof e){const t=e.indexOf(";");return t>0&&(e=e.substring(0,t)),e}}}}},function(t,e){t.exports=require("util")},function(t,e,a){"use strict";a.r(e);var s=a(2),r=a(0),i=a(15);function n(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const o=new class extends i.EventEmitter{constructor(...t){super(...t),n(this,"logFilePath",`${r.default.get("LOG_DIR")}CCX Process.log`),n(this,"prevLogFilePath",`${r.default.get("LOG_DIR")}CCX Process (prev).log`),n(this,"pendingLogWrite",void 0),n(this,"writingToLog",!1),n(this,"logQueue",[])}swapLogIfNeeded(t){s.stat(this.logFilePath,(e,a)=>{!e&&a.size>r.default.get("MAX_LOG_SIZE")?s.rename(this.logFilePath,this.prevLogFilePath,t):t(null)})}doLogWrite(){s.ensureDir(r.default.get("LOG_DIR"),t=>{if(t)return this.pendingLogWrite=void 0,void console.log(t);this.swapLogIfNeeded(t=>{if(t)return this.pendingLogWrite=void 0,void console.log(t);const e=this.pendingLogWrite;this.pendingLogWrite=void 0,this.writingToLog=!0,s.appendFile(this.logFilePath,e,t=>{t&&console.log(t),this.writingToLog=!1,this.pendingLogWrite&&this.doLogWrite(),this.emit("logWrite")})})})}addMessageToLogQueue(t){this.logQueue.length>=r.default.get("MAX_ANALYTICS_LOGS")&&this.logQueue.shift(),this.logQueue.push(t)}log(...t){const e=t.join(": ");r.default.get("CONSOLE_LOGGING")&&console.log(e),this.addMessageToLogQueue(e);const a=`${(new Date).toString()} ${e}\n`;this.pendingLogWrite?this.pendingLogWrite+=a:(this.pendingLogWrite=a,this.writingToLog||this.doLogWrite())}};e.default=o},function(t,e){t.exports=require("fs")},function(t,e,a){"use strict";a.r(e);var s=a(0),r=a(15),i=a(10);function n(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const o=new class extends r{constructor(){super(),n(this,"log",new i.default({prefix:"VulcanWrapper > "})),n(this,"vulcan",void 0),n(this,"vulcanControl",void 0),this.log.disk("Loading Vulcan Library...");const t=a(41);this.log.disk("Vulcan Library Successfully Loaded."),this.vulcan=new t.VulcanAdapter("CCXP","1.0.0"),this.vulcanControl=new t.VulcanControlAdapter,this.vulcan.addMessageListener((t,e,a,r)=>{t=t.replace(s.default.get("VULCAN_PREFIX"),""),0!==this.listenerCount(t)&&(this.shouldLogMessage(t)&&this.log.disk(`<- ${a} ${r}: ${t} \n ${this.shouldLogContent(t)?e:""}`),this.emit(t,e,a,r))})}shouldLogMessage(t){const e=s.default.get("SKIP_LOGGING_MESSAGE_LIST");return!e||!e.includes(t)||s.default.get("CONSOLE_LOGGING")}shouldLogContent(t){const e=s.default.get("SKIP_LOGGING_MESSAGE_CONTENT");return!e||!e.includes(t)}sendMessage(t,e="",a="",s=""){const r=a?`${a} ${s||"*"}`:"BROADCAST";"string"!=typeof e&&(e=JSON.stringify(e)),this.shouldLogMessage(t)&&this.log.disk(`-> ${r}: ${t} \n ${this.shouldLogContent(t)?e:""}`),this.vulcan.sendMessage(t,e,a,s)}getSpecifiers(){return this.vulcanControl.getSpecifiers()}getAppVersion(t){return this.vulcanControl.getAppVersion(t)}getAppPath(t){return this.vulcanControl.getAppPath(t)}};e.default=o},function(t,e){t.exports=require("child_process")},function(t,e){t.exports=require("dns")},function(t,e,a){"use strict";a.d(e,"a",function(){return u});var s=a(0),r=a(10),i=a(2),n=a(6),o=a(1),c=a(16);function d(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{},s=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(a).filter(function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),s.forEach(function(e){l(t,e,a[e])})}return t}function l(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class u{constructor(t,e){l(this,"lock",void 0),l(this,"log",void 0),l(this,"assetsDir",void 0),this.log=new r.default({prefix:`${s.default.get("LOG_PREFIX",t)}DataManager`,payload:{"event.subcategory":s.default.get("ANALYTICS_SUBCATEGORY",t)}}),this.assetsDir=n.join(s.default.get("ROOT_DIR"),s.default.get("DIR",t),s.default.get("ASSETS_DIRNAME"))+"/",this.lock=e}async downloadYukonData({card:t,lookupMap:e,priority:a,urlKey:s,bundle:r,params:l,started:u,force:p}){if(!t[s]||0===t[s].length)return{count:0,totalTime:0};let _=0,h=0;const f=await e.fetchAsset({href:t[s],assetsDir:this.assetsDir,priority:a,params:l,force:d({},p,{depth:(p.depth||0)-1})})||{};_++,h+=f.time;const g=n.basename(f.path),S=await i.readJson(`${this.assetsDir}/${g}`);return r&&(t.content=S),t.path=f.path,u(),S.includes&&Array.isArray(S.includes.Asset)&&await o.default.waitAll(S.includes.Asset.map(async t=>{if(t.fields&&t.fields.file&&t.fields.file.url){const s=await e.fetchAsset({href:t.fields.file.url,assetsDir:this.assetsDir,priority:a,params:l,force:d({},p,{depth:(p.depth||0)-2})});t.fields.file.path=s.path,s.time&&(_++,h+=s.time)}})).catch(async t=>{throw await this.lock.write(async()=>{await c.default.writeJsonAtomic(this.assetsDir,g,S)}),t}),await this.lock.write(async()=>{await c.default.writeJsonAtomic(this.assetsDir,g,S)}),{count:_,totalTime:h}}async downloadLegacyData({card:t,lookupMap:e,priority:a,params:s}){if(!t.backgroundImage||0===t.backgroundImage.length)return{count:0,totalTime:0};let r,i=null;try{i=(r=await e.fetchAsset({href:t.backgroundImage,assetsDir:this.assetsDir,priority:a,params:s})).path}catch(s){if(404!==s.statusCode||0===t.backgroundImage.indexOf("1000x560"))throw s;t.backgroundImage=t.backgroundImage.replace("1000x560","730x280"),i=(r=await e.fetchAsset({href:t.backgroundImage,assetsDir:this.assetsDir,priority:a})).path}return t.backgroundImageLocalpath=i,{count:1,totalTime:r.time}}async downloadData({modeID:t,card:e,lookupMap:a,priority:s,bundle:r=!1,params:i={},started:n=(()=>{}),force:o={type:"none"}}){try{switch(t){case"CCX_Start_2.5_Learn":case"CCX_Start_2.5_Toast":case"CCX_Start_2.5_Home":return await this.downloadYukonData({card:e,lookupMap:a,priority:s,urlKey:"contentURL",bundle:r,params:i,started:n,force:o});case"firstrun":case"footer":case"learn":case"discover":case"trial":case"openDoc":case"welcome":return await this.downloadLegacyData({card:e,lookupMap:a,priority:s,params:i});case"CCX_Start_3.0_Learn":case"CCX_Start_3.0_Home":case"CCX_Start_3.0_Toast":default:return await this.downloadYukonData({card:e,lookupMap:a,priority:s,urlKey:"data",bundle:r,params:i,started:n,force:o})}}catch(a){throw this.log.disk(`Error downloading content for ${t} ${a}, ${a.stack}, card: ${JSON.stringify(e)},`),a}}async getReferencedAssets(t,e){const a={};if(e.backgroundImageLocalpath)return{[`${e.backgroundImageLocalpath}`]:!0};switch(t){case"CCX_Start_3.0_Learn":case"CCX_Start_3.0_Home":case"CCX_Start_3.0_Toast":case"CCX_Start_2.5_Learn":case"CCX_Start_2.5_Toast":case"CCX_Start_2.5_Home":default:let s=e.content;if(e.path){a[e.path]=!0;const t=n.basename(e.path);s=await i.readJson(`${this.assetsDir}/${t}`).catch(()=>{delete a[e.path]})}return s&&s.includes&&Array.isArray(s.includes.Asset)&&s.includes.Asset.forEach(t=>{t.fields&&t.fields.file&&t.fields.file.path&&(a[t.fields.file.path]=!0)}),a}}}},function(t,e){t.exports=require("xml2js")},,function(t,e,a){const s=a(7),r=a(29),i=a(25).default,n=a(0).default,o=a(15),c=a(10).default,d=a(3).default,l=a(13).default,u=a(5).default,p="com.adobe.aam.AAMIMSStatus",_="com.adobe.aam.AAMSIGNOUTStatus",h="accc.app.ProxySettingsRequest",f="accc.app.ProxySettingsResponse",g="any.accc.app.ProxySettingsChanged",S="accc.localapps.panel.refresh.ssoevent",E="any.accc.app.UserContextData",y="accc.app.UserContextDataRequest",T="adbproduct.app.UserContextDataResponse",I="any.accc.app.ProductDeploymentEvent",A='<?xml version="1.0" encoding="utf-8"?><request><type>accc.app.ProxySettingsRequest</type><request_id>{{uuid}}</request_id></request>',C='<?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>',O='<?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>',m='<?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>',N='<?xml version= "1.0" encoding= "utf-8"?><request><request-id>{{uuid}}</request-id></request>',R=new r.Parser;class L extends o{constructor(){super(),this.log=new c({prefix:"CCNotifications > ",payload:{"event.subcategory":n.analytics.sc_PROCESS,"event.subtype":n.analytics.st_ANS}}),this.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"},this.addListeners()}getMessageValue(t,e){let a=null;if(t){const s=new RegExp(`<${e}[^<>]*>([^<>]*)</${e}>`,""),r=t.match(s);a=r&&r[1]}return a}constructMessage(t,e){let a=t;return Object.keys(e).forEach(t=>{a=a.replace(t,e[t])}),a}normalizeProductCode(t){let e=t;return"PHSP"===t&&(e="PHXS"),e}addListeners(){i.addListener(S,t=>{const e=this.getMessageValue(t,"event_type");this.log.disk(`ACCC Sign-on State: ${e}`),"signin_success"===e?this.emit(this.events.SIGN_IN):"signout_success"===e&&this.emit(this.events.SIGN_OUT)}),i.addListener("accc.any.NoListenerAvailable",t=>{this.log.error(`No Listener Available: ${t}`)}),i.addListener(p,t=>{const e=this.getMessageValue(t,"Status");this.log.disk(`AAM Sign-on State: ${e}`),"USER_AUTH_SUCCESS"===e&&this.emit(this.events.SIGN_IN)}),i.addListener(_,t=>{this.emit(this.events.SIGN_OUT),this.log.disk("AAM Sign-on State: signOut")}),i.addListener(E,t=>{const e=n.get("USER_ANALYTICS_ENABLED",u.getUserId())||!1;if(!t)return this.log.error(new d(n.analytics.PARSE_MSG_FAIL,"Fail to receive user analytics message on sign in")),void l.enable(e);R.parseString(t,(t,a)=>{if(t||!a)return this.log.error(new d(n.analytics.PARSE_MSG_FAIL,`Fail to parse user analytics flag on update, err=${t}`)),void l.enable(e);if(a.response&&a.response.error)return this.log.error(new d(n.analytics.PARSE_MSG_FAIL,`Error in user analytics flag on update, err=${JSON.stringify(a.response.error)}`)),void l.enable(e);const s=a["feature-response"]&&a["feature-response"]["feature-entry"]&&a["feature-response"]["feature-entry"].find((t,e)=>"com.adobe.oobe.acc.v1.piip.user.status"===t.$.id);if(s&&s.$){this.log.disk(`GetUserAnalyticsFlag - Successfully updated user analytics enabled flag: ${s.$.state}`);const t="OptedIn"===s.$.state;return l.enable(t),void n.set(u.getUserId(),t,"USER_ANALYTICS_ENABLED")}return this.log.error(new d(n.analytics.PARSE_MSG_FAIL,`Fail to parse userAnalyticsStatus, userAnalyticsStatus=${s}`)),void l.enable(e)})}),i.addListener(g,t=>{const e=this.getMessageValue(t,"proxyuser"),a=this.getMessageValue(t,"proxypassword");null!==e&&null!==a&&this.emit(this.events.PROXY_SETTINGS_CHANGED,e,a)}),i.addListener(I,t=>{const e={productCode:this.getMessageValue(t,"productCode"),productVersion:this.getMessageValue(t,"productVersion"),productLanguage:this.getMessageValue(t,"productLanguage"),countryCode:this.getMessageValue(t,"countryCode"),subscriptionStatus:this.getMessageValue(t,"subscriptionStatus")};if(n.get("PRODUCT_LIST").includes(e.productCode))switch(e.productCode=this.normalizeProductCode(e.productCode),this.getMessageValue(t,"eventType")){case"Install":case"Install-Start":case"Install-Progress":this.emit(this.events.INSTALL_APPLICATION,e);break;case"Uninstall":this.emit(this.events.UNINSTALL_APPLICATION,e);break;case"Update":case"Update-Start":case"Update-Progress":this.emit(this.events.UPDATE_APPLICATION,e);break;case"UpdateComponents":0!==L.listenerCount(this.events.UPDATE_APPLICATION_COMPONENTS)&&(e.productID=this.getMessageValue(t,"productID"),this.emit(this.events.UPDATE_APPLICATION_COMPONENTS,e))}}),i.addListener(n.get("NOTIFICATION_PSDK_RESPONSE"),t=>{this.handleNotificationResponse(t,n.get("ANS_PSDK_NOTIFICATION_TYPE"),n.get("NOTIFICATION_PSDK_QUERY_DATA_BY_ID_RESPONSE"))}),i.addListener(n.get("NOTIFICATION_STOCK_RESPONSE"),t=>{this.handleNotificationResponse(t,n.get("ANS_STOCK_NOTIFICATION_TYPE"),n.get("NOTIFICATION_STOCK_QUERY_DATA_BY_ID_RESPONSE"))})}_handlePayload(t,e){const a={},s=(t,e,s)=>{if(t===n.get("ANS_PSDK_NOTIFICATION_TYPE")&&e===n.get("ANS_PSDK_NOTIFICATION_SUB_TYPE")){let r;this.log.disk(`Handle ANS message: type=${t}, subtype=${e}, payload=${s}`);try{r=s&&JSON.parse(s)}catch(t){return this.log.error(new Error(n.analytics.PAYLOAD_PARSE_FAIL,`Fail to parse payload: ${s}`))}switch(r&&r.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":a.profileUpdated=!0;break;case"MEMBERSHIP_CHANGE":a.subscriptionStatusChanged=!0}}else t===n.get("ANS_STOCK_NOTIFICATION_TYPE")&&e===n.get("ANS_STOCK_NOTIFICATION_SUB_TYPE")?a.updateStock=!0:this.log.error(new d(n.analytics.UNEXPECTED_ANS_MSG,`Received unexpected ANS message, type=${t}, subType=${e}`))};R.parseString(t,(t,r)=>{if(t)return void this.log.error(t,"Fail to parse message");const i=r["notification-error"];if(i){const t=i.error&&i.error[0],e=t&&t.$&&t.$.desc||"Unknown notification error";return void this.log.disk(e)}const n=r&&r.notifications&&r.notifications.notification||[];let o;this.log.disk(`Received ${n.length} ANS notifications.`),n.forEach(t=>{const a=t.type[0],r=t["sub-type"][0],i=parseInt(t.timestamp[0],10),n=t.payload;(!e||i>e)&&(o=!o||i>o?i:o,s(a,r,n))}),Object.keys(a).forEach(t=>{this.emit(t,o||(new Date).getTime())})})}_queryANSNotificationsByTime(t,e,a){const r=s.v4();let o;const c=t=>{clearTimeout(o),i.removeListener(e,c),a(null,t)};i.addListener(e,c);const d={"{{TIME_STAMP}}":(new Date).getTime(),"{{NOTIFICATION_TYPE}}":t,"{{NOTIFICATION_COUNT}}":"10","{{uuid}}":r,"{{requestor-namespace}}":e};i.sendMessage(n.get("NOTIFICATION_REQUEST"),this.constructMessage(O,d),"ADCS",""),o=setTimeout(()=>{i.removeListener(e,c),a(new Error("GetNotificationDataByTime timeout"))},n.get("GET_NOTIFICATION_DATA_TIMEOUT"))}getUserAnalyticsEnabledFlag(){return new Promise(t=>{let e,a;const r=n.get("USER_ANALYTICS_ENABLED",u.getUserId())||!1,o=s=>{if(i.removeListener(T,o),clearTimeout(e),!s)return this.log.error(new d(n.analytics.PARSE_MSG_FAIL,"Fail to receive user analytics message on sign in.")),void t({enabled:r});R.parseString(s,(e,s)=>{if(e||!s)return this.log.error(new d(n.analytics.PARSE_MSG_FAIL,`Fail to receive user analytics flag on sign in, err=${e}`)),void t({enabled:r});if(s.response&&s.response.error){const e=s.response.error;return e[0]&&"SignInPending"===e[0].$.id?(this.log.disk("User sign in pending. Analytics flag not received yet."),void t({enabled:r})):(this.log.error(new d(n.analytics.PARSE_MSG_FAIL,`Fail to parse user analytics flag on sign in, err=${JSON.stringify(s.response.error)}`)),void t({enabled:r}))}{const e=s.response&&s.response.UserfeatureXML&&s.response.UserfeatureXML[0];R.parseString(e,(e,s)=>{if(e||!s)return this.log.error(new d(n.analytics.PARSE_MSG_FAIL,`Fail to parse UserfeatureXML, err=${e}`)),void t({enabled:r});if((a=s["feature-response"]&&s["feature-response"]["feature-entry"]&&s["feature-response"]["feature-entry"].find((t,e)=>t&&t.$&&"com.adobe.oobe.acc.v1.piip.user.status"===t.$.id))&&a.$){this.log.disk(`GetUserAnalyticsFlag - Successfully obtained user analytics enabled flag: ${a.$.state}`);const e="OptedIn"===a.$.state;return t({enabled:e}),void n.set(u.getUserId(),e,"USER_ANALYTICS_ENABLED")}return this.log.error(new d(n.analytics.PARSE_MSG_FAIL,`Fail to parse userAnalyticsStatus, userAnalyticsStatus=${a}`)),void t({enabled:r})})}})};i.addListener(T,o),i.sendMessage(y,this.constructMessage(N,{"{{uuid}}":s.v4()}),"ADCS",""),e=setTimeout(()=>{i.removeListener(T,o),this.log.disk("GetUserAnalyticsFlag - Error: timed out getting user analytics enabled flag"),t({enabled:r})},n.get("USER_ANALYTICS__REQUEST_TIMEOUT"))})}getProxyCredentials(){return new Promise(t=>{let e;const a=s=>{i.removeListener(f,a),clearTimeout(e);const r=this.getMessageValue(s,"proxyuser"),n=this.getMessageValue(s,"proxypassword");this.log.disk("GetProxySettings - Successfully obtained username/password"),t({user:r,password:n})};i.addListener(f,a),i.sendMessage(h,this.constructMessage(A,{"{{uuid}}":s.v4()}),"ADCS",""),e=setTimeout(()=>{i.removeListener(f,a),this.log.disk("GetProxySettings - Error: timed out getting proxy settings"),t({})},n.get("PROXY_REQUEST_TIMEOUT"))})}registerANSNotifications(){[{"{{NOTIFICATION_TYPE}}":n.get("ANS_PSDK_NOTIFICATION_TYPE"),"{{NOTIFICATION_SUB_TYPE}}":n.get("ANS_PSDK_NOTIFICATION_SUB_TYPE"),"{{observer-namespace}}":n.get("NOTIFICATION_PSDK_RESPONSE")},{"{{NOTIFICATION_TYPE}}":n.get("ANS_STOCK_NOTIFICATION_TYPE"),"{{NOTIFICATION_SUB_TYPE}}":n.get("ANS_STOCK_NOTIFICATION_SUB_TYPE"),"{{observer-namespace}}":n.get("NOTIFICATION_STOCK_RESPONSE")}].forEach(t=>{i.sendMessage(n.get("NOTIFICATION_REQUEST"),this.constructMessage(C,t),"ADCS","")})}getNotificationDataByIDs(t,e,a,r){if(0===Object.keys(t).length)return void r(new Error("No notification id"));let o;const c=s.v4(),l=t=>{i.removeListener(a,l),clearTimeout(o),r(null,t)};i.addListener(a,l);let u="";Object.keys(t).forEach(t=>{u+=`<notification-id>${t}</notification-id>`});const p={"{{NOTIFICATION_TYPE}}":e,"{{NOTIFICATION_IDS}}":u,"{{uuid}}":c,"{{requestor-namespace}}":a};i.sendMessage(n.get("NOTIFICATION_REQUEST"),this.constructMessage(m,p),"ADCS",""),o=setTimeout(()=>{i.removeListener(a,l);const t=new d(n.analytics.GET_NOTIFICATION_DATA,"GetNotificationDataByID - Error: timed out getting notification data");this.log.error(t),r(t)},n.get("GET_NOTIFICATION_DATA_TIMEOUT"))}handleNotificationResponse(t,e,a){const s={};R.parseString(t,(r,i)=>{if(r)return void this.log.error(new d(n.analytics.PARSE_MSG_FAIL,`Fail to parse message, message=${t}`));const o=i&&i["notifications-signal"],c=o&&o["notification-signal"];(c&&c[0]&&c[0]["notification-info"]||[]).forEach(t=>{const e=t&&t["notification-ids"]&&t["notification-ids"][0];(e&&e["notification-id"]||[]).forEach(t=>{s[t]=!0})}),this.getNotificationDataByIDs(s,e,a,(t,e)=>{t?this.log.disk(t):this._handlePayload(e)})})}checkForMissedNotifications(t,e){[{type:n.get("ANS_PSDK_NOTIFICATION_TYPE"),requestNamespace:n.get("NOTIFICATION_PSDK_QUERY_DATA_BY_TIME_RESPONSE"),lastTimeOfNotification:t},{type:n.get("ANS_STOCK_NOTIFICATION_TYPE"),requestNamespace:n.get("NOTIFICATION_STOCK_QUERY_DATA_BY_TIME_RESPONSE"),lastTimeOfNotification:e}].forEach(t=>{const e=t.lastTimeOfNotification;this.queryANSNotificationsByTime(t,(t,a)=>{t?this.log.disk(t):this._handlePayload(a,e)})})}queryANSNotificationsByTime(t,e){this._queryANSNotificationsByTime(t.type,t.requestNamespace,e)}}t.exports=new L},function(t,e){t.exports=require("https")},function(t){t.exports={a:"3.3.0"}},function(t,e){t.exports=require("jsonschema")},function(t,e){t.exports=require("fs-ext")},function(t,e){t.exports=require("mime")},function(t,e){t.exports=require("node-fetch")},function(t,e,a){t.exports=a(39)},function(t,e,a){const s=a(40);t.exports=(new s).init()},function(t,e,a){const s=a(0).default,r=a(1).default,i=a(10).default,n=a(5).default,o=a(16).default,c=a(4).default,d=a(4).BackOffType,l=a(45).default,u=a(19),p=a(31),_=a(56).default,h=a(55).default,f=a(54).default,g=a(47),S=a(51),E=a(13).default,y=a(52),T=a(12).default,I=a(17).default,A=a(8).PriorityLevels,C=a(3).default,O=a(25).default,m=a(2),N=a(9),R=a(6),L=a(26),P=(t,e)=>new Promise((a,s)=>L.exec(t,e,(t,e)=>t?s(t):a(e)));t.exports=class{constructor(){i.init(),this.log=new i({prefix:"Main > ",payload:{"event.subcategory":s.analytics.sc_PROCESS,"event.subtype":s.analytics.st_PROCESS}}),this.stockLookupMap=new g,this.firstMileLookupMap=new _,this.learnLookupMap=new h,this.maps=[this.firstMileLookupMap,this.stockLookupMap,this.learnLookupMap,new f],this.lastKnownCredentials={},this.serviceInterface=new S(this.maps)}async verifyAutoLaunch(){if(O.getSpecifiers().includes("ccxprocess-1")){const t=O.getAppPath("ccxprocess-1");if(s.isPlatformWindows()){const e=`Windows Registry Editor Version 5.00\n\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run]\n"CCXProcess"="\\"${t.replace(/\\/g,"\\\\")}\\""\n`,a=R.resolve(N.tmpdir(),`./ccxprocess-${Date.now()}.reg`);return await m.writeFile(a,e,{encoding:"utf-8"}),await P(`reg.exe import ${a}`).catch(t=>{this.log.error("Error saving auto-launch",t)}),await m.remove(a),void this.log.disk("Auto-launch enabled")}{const e=`<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n<dict>\n\t<key>Label</key>\n\t<string>com.adobe.ccxprocess</string>\n\t<key>ProgramArguments</key>\n\t<array>\n\t\t<string>/usr/bin/open</string>\n        <string>-a</string>\n        <string>${t}</string>\n\t</array>\n\t<key>RunAtLoad</key>\n\t<true/>\n</dict>\n</plist>`,a=s.get("LAUNCH_AGENT");if(!await m.pathExists(a)||await m.readFile(a,{encoding:"utf-8"})!==e)return await m.writeFile(a,e,{encoding:"utf-8"}),await P("launchctl load com.adobe.ccxprocess.plist",{cwd:R.dirname(a)}),void this.log.disk("Auto-launch enabled")}}this.log.disk("Auto-launch not needed")}async sync(t=this.maps,e=!1){n.getUserId()&&await r.waitAll(t.map(async t=>{await t.sync(e).catch(e=>{this.log.disk(e,`Failed to sync ${t.type}`)})}))}async updateLookupMapWithInstalledApps(){await r.waitAll(this.maps.map(async t=>{const e=l.getMissingProductList(t);await r.waitAll(t.updateParams(e).map(async e=>await t.addNewCollectionData({params:e}))),l.getExcessProductList(t.getCachedRequestData()).forEach(e=>{t.clearCollectionInfo(e)})}))}setProxyCredentials(t,e){t&&this.lastKnownCredentials.user!==t&&this.lastKnownCredentials.password!==e&&(this.lastKnownCredentials={user:t,password:e},n.setProxyCredentials(t,e),u.setProxyCredentials(t,e),this.sync())}setUserAnalyticsFlag(t){E.enable(t)}prefetchData(){if(!n.getUserId())return;const t=r.getClientsThatNeedRefresh(this.firstMileLookupMap);Object.keys(t).forEach(e=>{t[e].forEach(t=>{const a=JSON.parse(JSON.stringify(t));a.ccxVersion=s.get("START_VERSION",e),delete a.radarSessionGUID,delete a.requestId,this.firstMileLookupMap.isRequestPoisoned(a)||this.firstMileLookupMap.addNewCollectionData({params:a}).catch(t=>this.log.context({params:a}).disk(t,"Error pre-fetching"))})})}async addProductInfoToLookup(t,e){await r.waitAll(this.maps.map(async a=>{const i=s.get("SUPPORTED_PRODUCTS",a.type);i[t.productCode]&&1!==r.compareMajorMinorVersions(t.productVersion,i[t.productCode])&&await r.waitAll(a.updateParams([t]).map(async s=>{await a.addNewCollectionData({params:s,priorityLevel:e}).catch(e=>{this.log.context({params:t}).disk(e,`Error adding new ${a.type} product`)})}))}))}async registerNotifications(){this.log.info(s.analytics.t_START),n.on("SIGN_OUT",()=>this.setUserAnalyticsFlag(!1)),T.on(T.ONLINE,r.throttle(()=>{this.log.disk("Network status back to online."),c.updateBackOff({clear:!0,type:d.NETWORK}),this.sync()},s.get("ONLINE_SYNC_THROTTLE"))),c.on(c.SYNC,r.throttle(()=>{this.log.disk("Global backoff over, syncing data."),this.sync()},s.get("GLOBAL_BACKOFF_SYNC_THROTTLE"))),n.on("SIGN_IN",()=>{n.getUserId(),p.getUserAnalyticsEnabledFlag().then(({enabled:t})=>{this.setUserAnalyticsFlag(t)}),this.sync(),this.updateLookupMapWithInstalledApps(),this.prefetchData()}),p.addListener(p.events.PROXY_SETTINGS_CHANGED,(t,e)=>{this.setProxyCredentials(t,e)}),p.addListener(p.events.PROFILE_UPDATED,async t=>{t&&await this.firstMileLookupMap.setLastTimeOfNotification(t),await this.sync([this.firstMileLookupMap],!0)}),p.addListener(p.events.SUBSCRIPTION_STATUS_CHANGED,async t=>{t&&(await this.firstMileLookupMap.setLastTimeOfNotification(t),await this.stockLookupMap.setLastTimeOfNotification(t)),await this.sync([this.firstMileLookupMap])}),p.addListener(p.events.UPDATE_STOCK,async t=>{t&&await this.stockLookupMap.setLastTimeOfNotification(t),await this.sync([this.stockLookupMap],!0)}),p.addListener(p.events.INSTALL_APPLICATION,t=>{this.log.context({params:t}).disk("Handle installApplication"),this.addProductInfoToLookup(t,A.Installation)}),p.addListener(p.events.UPDATE_APPLICATION,t=>{this.log.context({params:t}).disk("Handle updateApplication event"),this.addProductInfoToLookup(t,A.Installation)}),p.addListener(p.events.UNINSTALL_APPLICATION,t=>{this.log.context({params:t}).disk("Handle uninstallApplication event"),this.maps.forEach(e=>e.clearCollectionInfo(t))}),u.addListener("change",async t=>{if(t){const{user:t,password:e}=await p.getProxyCredentials();this.setProxyCredentials(t,e)}}),p.registerANSNotifications(),n.getUserId()&&p.checkForMissedNotifications(await this.firstMileLookupMap.getLastTimeOfNotification(),await this.stockLookupMap.getLastTimeOfNotification())}async onLoadHouseKeeping(){await o.obtainProcessLock("lockfile").catch(t=>{"EAGAIN"===t.code||"EWOULDBLOCK"===t.code?this.log.disk("Unable to get lock. Process is already running"):this.log.error(t,"Failed to get Lockfile."),process.exit(1)}),this.log.info(s.analytics.t_INIT),y.start(),Error.stackTraceLimit=1/0,process.on("uncaughtException",t=>this.log.error(t,"Uncaught Exception")),process.on("unhandledRejection",t=>this.log.error(t,"Uncaught Promise Rejection"))}preventQuitting(){setTimeout(this.preventQuitting.bind(this),999999)}async initNetwork(){await I.requestLock.write(async()=>{await u.init();const{user:t,password:e}=await p.getProxyCredentials();this.setProxyCredentials(t,e)})}async init(){this.log.disk("-------------------------Startup------------------------------"),this.log.disk(`Build version is ${r.getProcessVersion()}, Environment: ${s.getEnvironment().LABEL}`),await T.check(),await this.onLoadHouseKeeping();for(const t of this.maps)await t.load().catch(e=>this.log.error(new C(`Failed to load lookup map ${t.type}`,e)));const t=this.initNetwork();this.serviceInterface.init(),await this.registerNotifications().catch(t=>{this.log.error(new C("Failed to register for notifications",t))}),await this.updateLookupMapWithInstalledApps().catch(t=>{this.log.error(new C("Failed to update lookup map on launch",t))}),await this.verifyAutoLaunch().catch(t=>{this.log.error(new C("Could not enable auto-launch",t))});const{enabled:e}=await p.getUserAnalyticsEnabledFlag().catch(t=>{this.log.error(new C("Could not enable analytics",t))});return this.setUserAnalyticsFlag(e),n.init(),this.prefetchData(),await this.sync().catch(t=>{this.log.error(new C("Launch sync failed",t))}),this.preventQuitting(),await t.catch(t=>{this.log.error(new C("Failed to initialize network",t))}),this}}},function(t,e){t.exports=require("node-vulcanjs")},function(t,e){t.exports=require("http")},function(t,e){t.exports=require("node-ProxyResolver")},function(t,e){t.exports=require("ingest")},function(t,e,a){"use strict";a.r(e),a.d(e,"default",function(){return o});var s=a(0),r=a(10),i=a(1);const n=a(25).default;class o{static getMissingProductList(t){const e=t.getCachedRequestData(),a=new r.default({prefix:`LookupMapUtils > ${t.type}`}),o=s.default.get("SUPPORTED_PRODUCTS",t.type),c=[];return n.getSpecifiers().forEach(t=>{const r=t.split("-")[0],d=s.default.get("VULCAN_SPECIFIER_MAP")[r],l=n.getAppVersion(t);d&&o[d]&&i.default.compareMajorMinorVersions(o[d],l)>-1&&(e[d]&&(e[d][l]||e[d][`${l}.0`])||(a.disk("App NOT found, Adding : ",d,l),c.push({productCode:d,productVersion:l})))}),c}static getExcessProductList(t){const e=[];Object.values(t).forEach(t=>{Object.values(t).forEach(t=>{e.push(...t)})});const a=n.getSpecifiers().map(t=>{const e=t.split("-")[0],a=s.default.get("VULCAN_SPECIFIER_MAP")[e],r=n.getAppVersion(t);return a&&r?{productCode:a,productVersion:r}:{}});return e.filter(t=>!a.find(e=>e.productCode===t.productCode&&(e.productVersion===t.productVersion||t.productVersion===e.productVersion+".0")))}}},function(t,e,a){const s=a(7),r=a(17).default,i=a(0).default,n=a(1).default,o=a(5).default,c=a(3).default,d=a(11).URL;t.exports=class extends r{_convertSurfaceIdToModeId(t,e){const a=i.get("FIRST_MILE_SURFACE_MODE_MAP",e);return a&&a[t]?a[t]:t}async url(t){const e=i.getEnvironment(),a=new d(i.get(`URL_${e.LABEL.toUpperCase()}`,this.type)),s=i.get("FIRST_MILE_SURFACE_ID",n.ccxVersionToString(t)),r={productCode:t.productCode,productLanguage:t.productLanguage,productVersion:t.productVersion,subscriptionStatus:t.subscriptionStatus,surfaceId:s,ccxVersion:t.ccxVersion};return this.appendUrlSearchParams(a.searchParams,r),a.toString()}additionalAnalytics(t){return{"exp.surface_id":i.get("FIRST_MILE_SURFACE_ID",n.ccxVersionToString(t)).join(", ")}}applyResponseAnalytics(t,e,a){if(t.appendPayload({"exp.response_guid":e.analyticsParams&&e.analyticsParams.responseGUID,"content.type":i.analytics.SOPHIA_CARDS,"content.size":e.cards?e.cards.length:0}),a&&["V2_8","V3_0","V3_1"].includes(n.ccxVersionToString(a))){t.appendPayload({"exp.response_guid":e.analyticsData&&e.analyticsData.responseGUID,"content.size":Object.keys(e.surfaces).length});for(let a in e.surfaces)t.addSurfaceAnalytics([{surface:a}]),Array.isArray(e.surfaces[a].containers)&&t.addSurfaceAnalytics(e.surfaces[a].containers.map(t=>t.containerAnalyticsData))}else e.cardControl&&Array.isArray(e.cardControl)&&e.cardControl.forEach(e=>{Array.isArray(e.containerAnalyticsParams)&&(t.addSurfaceAnalytics(e.containerAnalyticsParams),t.addSurfaceAnalytics([{surface:e.modeID}]))})}async downloadCollectionDataRaw({params:t,priority:e,id:a=s.v4(),skipAuth:r=!1}){const d=await this.url(t),l=await this.log.context({params:t}).time(async t=>{let s={"content-type":"application/json","X-API-Key":i.getEnvironment().CLIENT_ID};const n=!r&&!!await o.getAccessToken().catch(t=>!1);n&&(s["x-gw-ims-user-id"]=o.getUserId());let{response:c,time:l}=await this.get({url:d,options:{method:"GET",timeout:i.get("SERVER_TIMEOUT"),headers:s},priority:e,auth:n,id:a});t.appendPayload({"event.value":l,"event.url":d,"env.svc.name":"Sophia"});const u=Date.now(),p=await this.getResponseJson(c,d);return l+=Date.now()-u,p}),u=i.get("FIRST_MILE_RESPONSE_SCHEMA"),p=n.validateDataFields(l,u);if(p)throw new c(i.analytics.PARAM_VALIDATION_ERR,p);if(["V2_8","V3_0","V3_1"].includes(n.ccxVersionToString(t)))return l.analyticsData&&(l.analyticsData.requestId=a),l.ccxVersion=t.ccxVersion,l;const _={cards:[],cardControl:[],expirationDTS:new Date(Math.min(new Date(l.expirationDTS||0),new Date(Date.now()+i.get("MAX_TIMEOUT")))).toISOString(),analyticsParams:{responseGUID:l.analyticsData&&l.analyticsData.responseGUID,requestId:a},ccxVersion:t.ccxVersion};return l.surfaces&&Object.keys(l.surfaces).forEach(e=>{if(!Array.isArray(l.surfaces[e].containers)||0==l.surfaces[e].containers.length)return;const a={modeID:this._convertSurfaceIdToModeId(e,n.ccxVersionToString(t)),cardOrder:[],containerAnalyticsParams:[]};l.surfaces[e].containers.forEach(t=>{t.containerAnalyticsData=t.containerAnalyticsData||{},a.containerAnalyticsParams.push(t.containerAnalyticsData);let s={startDTS:t.startDTS,endDTS:t.endDTS};if("application/json"===t.dataType)try{Object.assign(s,JSON.parse(t.data))}catch(s){this.log.error(new c(i.analytics.PARAM_VALIDATION_ERR,s).setContext(`Error parsing card data for ${e} with analytics ${JSON.stringify(a.containerAnalyticsData)} which was ${t.data}`))}else"URL"===t.dataType?Object.assign(s,{contentURL:t.data}):Object.assign(s,t);_.cards.push(s),a.cardOrder.push(_.cards.length-1)}),_.cardControl.push(a)}),"V2"===n.ccxVersionToString(t)&&_.cards.forEach(t=>{t.backgroundImage&&(t.backgroundImage=t.backgroundImage.replace("730x280","1000x560"))}),_}}},function(t,e,a){a(0).default;const s=a(20).default,r=a(48).default,i=(a(13).default,a(49).default),n=(a(10).default,a(5).default),o=a(50).default;t.exports=class extends s{constructor(){super(o),this._downloadManager=new i("STOCK")}_createCollectionData(t){return new r(t,this)}_getLookupKeys(t,e){t.productVersion&&t.productVersion.split(".")[0];const a=[e||n.getUserId()];return a.push(t.productCode,t.productLanguage),a}async upgrade(t){let e=null;return 1===t.version&&(e={version:2,versionInfo:t.stockTemplates,metadata:t.stockTemplatesCache,assetMetadata:t.assetsCache,usersInfo:t.usersInfo},Object.keys(e.metadata).forEach(t=>{e.metadata[t].params=e.metadata[t].stockParams,delete e.metadata[t].stockParams}),Object.keys(e.versionInfo).forEach(t=>{Object.keys(e.versionInfo[t]).forEach(a=>{const s=e.versionInfo[t][a];e.versionInfo[t][a]={},Object.keys(s).forEach(r=>{Object.keys(s[r]).forEach(i=>{e.versionInfo[t][a][i]=s[r][i];let n=s[r][i];n.latestId=n.paid&&n.paid.latestId||n.trial&&n.trial.latestId,delete n.trial,delete n.paid})})})})),e}}},function(t,e,a){"use strict";a.r(e),a.d(e,"default",function(){return o});var s=a(0),r=a(1),i=a(18);function n(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class o extends i.a{async downloadAsset({asset:t,link:e,priority:a,analytics:s,params:r}){const i=t&&t[e];if(!t||!i||0===i.length)throw new Error("Invalid data");const{path:n,time:o}=await this._lookupMap.fetchAsset({href:i.toString(),assetsDir:this.assetsDir,priority:a,params:r});s&&s.count&&s.time&&(s.time+=o,s.count++),t[e]=n}validateData(t){return r.default.validateDataFields(t,s.default.get("STOCK_TEMPLATES_DATA_SCHEMA"))}get totalItems(){return this._data&&this._data.templates&&this._data.templates.length||0}async syncData({priority:t,payload:e,params:a,progress:s=(()=>{})}){if(!this._data||!this._data.templates)return;let i={count:0,time:0};const o=[],c={started:0,complete:0};this._data.templates.forEach(e=>{c.started++,s(c);let r=0;async function n(){2===++r&&(c.complete++,s(c))}e.thumbnail_url&&0!==e.thumbnail_url.length&&o.push(this.downloadAsset({asset:e,link:"thumbnail_url",priority:t,analytics:i,params:a}).then(n)),e.previews&&0!==e.previews.length&&e.previews.forEach(e=>{e&&e.url&&o.push(this.downloadAsset({asset:e,link:"url",priority:t,analytics:i,params:a}).then(n))})}),await this.log.time(async t=>{t.appendPayload(function(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{},s=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(a).filter(function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),s.forEach(function(e){n(t,e,a[e])})}return t}({},e,{"event.count":i.count,"event.value":i.time/i.count})),await r.default.waitAll(o)})}async getReferencedAssets(){const t={};return this._data&&this._data.templates&&this._data.templates.forEach(e=>{e&&e.thumbnail_url&&(t[e.thumbnail_url]=!0),e&&e.previews&&e.previews.forEach(e=>{e&&e.url&&(t[e.url]=!0)})}),t}}},function(t,e,a){"use strict";a.r(e),a.d(e,"default",function(){return c});var s=a(0),r=a(7),i=a(11),n=a(17),o=a(5);class c extends n.default{async url(t){const e=s.default.getEnvironment();let a=new i.URL(s.default.get(`URL_${e.LABEL.toUpperCase()}`,this.type));const r={product:t.productCode,locale:t.productLanguage,country_code:t.countryCode};return this.appendUrlSearchParams(a.searchParams,r),a.toString()}async downloadCollectionDataRaw({params:t,priority:e,id:a=r.v4()}){const i=await this.url(t),{response:n}=await this.get({url:i,options:{timeout:s.default.get("SERVER_TIMEOUT"),headers:{"X-API-Key":s.default.getEnvironment().CLIENT_ID,"X-Product":`${t.productCode}/${t.productVersion}`,"Content-Type":"application/json"}},priority:e,id:a,auth:!!await o.default.getAccessToken().catch(t=>!1)}),c=await this.getResponseJson(n,i);if("number"==typeof c.expirationDTS){const t=new Date(1e3*c.expirationDTS);c.expirationDTS=t.toISOString()}return c}}},function(t,e,a){"use strict";a.r(e);let s={ANALYTICS_SUBCATEGORY:"Stock",LOOKUP_MAP_FILE_VERSION:3,LOOKUP_COLLECTION_FILE_VERSION:1,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"]},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:a(8).PriorityChannels.Stock,ANONYMOUS_RETRY_DISABLED:!0,DEFAULT_URLS_ENABLED:!1};e.default=s},function(t,e,a){function s(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{},s=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(a).filter(function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),s.forEach(function(e){r(t,e,a[e])})}return t}function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const i=a(9),n=a(6),o=a(2),c=a(7),d=a(5).default,l=a(25).default,u=a(0).default,p=a(10).default,_=a(1).default,h=a(16).default,f=a(13).default,g=a(17).default,S=a(3).default,E=a(8).PriorityLevels;a(23);t.exports=class{constructor(t){this.log=new p({prefix:"ServiceInterface > ",payload:{"event.subtype":f.st_CLIENT}}),this._firstMileLookupMap=t.find(t=>"FIRST_MILE"===t.type),this._stockLookupMap=t.find(t=>"STOCK"===t.type),this._learnLookupMap=t.find(t=>"LEARN"===t.type),this.maps=t}init(){l.addListener(u.get("VULCAN_PING_REQUEST"),(t,e,a)=>{l.sendMessage(u.get("VULCAN_PING_RESPONSE"),"",e,a)}),l.addListener(u.get("VULCAN_PSDK_FEED_REQUEST"),async(t,e,a)=>{let r,i,n={};try{n=JSON.parse(t)}catch(e){r=new S(u.analytics.PARAM_VALIDATION_ERR,e).setContext(`Unable to parse PSDK feed data:${t}`)}n.psdkParams=n.psdkParams||{};const o={"event.context_guid":n.radarSessionGUID||c.v4()};i=this.log.context({params:n&&n.psdkParams,payload:s({"event.subcategory":u.analytics.sc_SOPHIA},o)});const p=await i.request(async()=>{if(r)throw r;if(!d.getUserId())throw new Error(u.analytics.SIGNED_OUT);const t=this._firstMileLookupMap,e={requestId:n.requestId,settings:u.get(`${n.psdkParams.productCode}_PSDK`,`SETTINGS_${d.getUserId()}`)||{}};return this._firstMileLookupMap.updateLicenseInformation(n.psdkParams),await t.updateDisplayedId({params:n.psdkParams,displayed:n.psdkParams.displayed}),n.psdkParams.urgent?(delete n.psdkParams.urgent,await t.addNewCollectionData({params:n.psdkParams,payload:o,level:E.UrgentRequest}),e.path=await t.getLatestPath({params:n.psdkParams,updateLastUsedId:!0,updateLastUseTime:!0})):(e.path=await t.getLatestPath({params:n.psdkParams,updateLastUsedId:!0,updateLastUseTime:!0}),e.path||t.addNewCollectionData({params:n.psdkParams,payload:o,level:E.BackgroundRequest})),e.path&&(e.path=e.path.replace(/\\/gi,"/")),e}).catch(t=>({requestId:n.requestId,err:t}));l.sendMessage(u.get("VULCAN_PSDK_FEED_RESPONSE"),p,e,a)}),l.addListener(u.get("VULCAN_LEARN_REQUEST"),async(t,e,a)=>{let r,i,n={};try{n=JSON.parse(t)}catch(e){r=new S(u.analytics.PARAM_VALIDATION_ERR,e).setContext(`Unable to parse Learn feed data:${t}`)}n.params=n.params||{};const o={"event.context_guid":n.radarSessionGUID||c.v4()};i=this.log.context({params:n&&n.params,payload:s({"event.subcategory":u.analytics.sc_LEARN},o)});const p=await i.request(async()=>{if(r)throw r;if(!d.getUserId())throw new S(u.analytics.SIGNED_OUT);const t=this._learnLookupMap,e={requestId:n.requestId};return await t.addNewCollectionData({params:n.params,payload:o,level:E.BackgroundRequest}),e.path=await t.getLatestPath({params:n.params,updateLastUsedId:!0,updateLastUseTime:!1}),e.path&&(e.path=e.path.replace(/\\/gi,"/")),e}).catch(t=>({requestId:n.requestId,err:t}));l.sendMessage(u.get("VULCAN_LEARN_RESPONSE"),p,e,a)}),l.addListener(u.get("VULCAN_LEARN_USAGE_MARKER"),async(t,e,a)=>{const s=this.log.context({payload:{"event.subcategory":u.analytics.sc_LEARN}});try{const e=JSON.parse(t);await this._learnLookupMap.getLatestPath({params:e.params,updateLastUsedId:!1,updateLastUseTime:!0}),s.context({params:e.params,payload:{"event.context_guid":e.radarSessionGUID||c.v4()}}).info(u.analytics.t_UPDATE,"Update last use time")}catch(t){s.error(new S(u.PARAM_VALIDATION_ERR,t),"Error parsing learn usage marker")}}),l.addListener(u.get("VULCAN_GET_USER_REQUEST"),async(t,e,a)=>{const s=this.log.context({payload:{"event.subcategory":u.analytics.sc_CCX_START}});await s.request(async()=>{l.sendMessage(u.get("VULCAN_GET_USER_RESPONSE"),{userId:d.getUserId()},e,a)})}),l.addListener(u.get("VULCAN_START_SETTINGS_REQUEST"),async(t,e,a)=>{let s=null,r=null;try{r=JSON.parse(t)}catch(r){s=new Error(`Unable to parse settings storage request from ${e}(${a}): ${t}`)}const i=this.log.context({params:r,payload:{"event.subcategory":f.sc_CCX_START}});await i.request(async()=>{if(s)throw s;if(!d.getUserId())throw new Error("Discarding start settings storage - not logged in");if(d.getUserId()!==r.userId)throw new Error(`Different user in request(${r.userId}) than the one logged in(${d.getUserId()})`);const t=`${r.productCode}_PSDK`,e=`SETTINGS_${d.getUserId()}`,a=u.get(t,e)||{};Object.keys(r.settings).forEach(t=>{a[t]?Object.assign(a[t],r.settings[t]):a[t]=r.settings[t]}),a.lastModified=(new Date).toISOString(),u.set(t,a,e)}).catch(t=>r=null),r&&l.sendMessage(u.get("VULCAN_START_SETTINGS_PATCH_UPDATE"),{settings:r.settings,userId:r.userId},r.productCode)}),l.addListener(u.get("VULCAN_START_SETTINGS_GET_REQUEST"),async(t,e,a)=>{let s={};const r=this.log.context({params:{productCode:e,productVersion:a},payload:{"event.subcategory":f.sc_CCX_START}});r.info("Start settings get Request");try{s=JSON.parse(t)}catch(s){r.error(new Error(`Unable to parse settings get request from ${e}(${a}): ${t}`))}l.sendMessage(u.get("VULCAN_START_SETTINGS_GET_RESPONSE"),{requestId:s.requestId,userId:d.getUserId(),settings:u.get(`${e}_PSDK`,`SETTINGS_${d.getUserId()}`)||{}},e,a)}),l.addListener(u.get("VULCAN_STOCK_REQUEST"),async(t,e,a)=>{let r,i,n={};try{n=JSON.parse(t)}catch(e){(r=new Error(u.analytics.PARAM_VALIDATION_ERR)).desc=`Unable to parse Stock template request:${t}`}n.stockParams=n.stockParams||{};const o={"event.context_guid":n.radarSessionGUID||c.v4()};i=this.log.context({params:n.stockParams,payload:s({"event.subcategory":u.analytics.sc_STOCK},o)});const p=await i.request(async()=>{if(r)throw r;if(!d.getUserId())throw new Error(u.analytics.SIGNED_OUT);const t=this._stockLookupMap,e={requestId:n.requestId};return e.path=await t.getLatestPath({params:n.stockParams,updateLastUsedId:!0,updateLastUseTime:!0}),e.path||t.addNewCollectionData({params:n.stockParams,level:E.BackgroundRequest}),e.path&&(e.path=e.path.replace(/\\/gi,"/")),e}).catch(t=>({requestId:n.requestId,err:t}));l.sendMessage(u.get("VULCAN_STOCK_RESPONSE"),p,e,a)}),l.addListener(u.get("VULCAN_CC_PHOTO_DOWNLOAD_REQUEST"),async(t,e,a)=>{let s,r="OZ",d=u.analytics.sc_LR_CONTENT,p=u.analytics.sc_OZ;try{(s=JSON.parse(t)).source&&s.source===u.get("CC_SEARCH_IDENTIFIER")&&(r="CCSearch",d=u.analytics.sc_CC_SEARCH,p=u.analytics.sc_CC_SEARCH_STORAGE)}catch(t){return l.sendMessage(u.get("VULCAN_CC_PHOTO_DOWNLOAD_ERROR"),t.toString(),e,a),void this.log.context({payload:{"event.subcategory":u.analytics.sc_CC_PHOTO,"source.name":e,"source.version":a}}).error(new S(t))}const f=await this.log.context({payload:{"event.subcategory":d,"source.name":e,"source.version":a}}).request(async()=>{const t=n.join(i.tmpdir(),u.get("TMP_PHOTOS_DOWNLOAD_DIRECTORY")),d=t+`${s.id}-${s.filename}`,f={id:s.id,path:d.replace(/\\/g,"/")};return await o.access(d,o.constants.R_OK).catch(async t=>{this._downloadManager=this._downloadManager||new g(r);const i=c.v4(),{response:n}=await this.log.context({payload:{"event.subcategory":p,"event.subtype":u.analytics.st_API,"source.name":e,"source.version":a}}).request(async()=>await this._downloadManager.get({url:s.url,options:{headers:{"x-api-key":s.clientId}},auth:!0,id:i})),o=n.headers.get("content-length");await h.writeAtomic({stream:n.body,target:d,url:s.url,progress:t=>{l.sendMessage(u.get("VULCAN_CC_PHOTO_DOWNLOAD_PROGRESS"),{id:s.id,percentage:100*t/o},e,a)}})}),await _.deleteTempFiles(t).catch(t=>this.log.disk(`Err deleting temp files - ${t}`)),f}).catch(t=>{l.sendMessage(u.get("VULCAN_CC_PHOTO_DOWNLOAD_ERROR"),t.toString(),e,a)});f&&l.sendMessage(u.get("VULCAN_CC_PHOTO_DOWNLOAD_RESPONSE"),f,e,a)}),this._firstMileLookupMap.addListener("newCollection",t=>{l.sendMessage(u.get("VULCAN_PSDK_FEED_BROADCAST"),t,t.productCode,t.productVersion)}),this._learnLookupMap.addListener("newCollection",t=>{l.sendMessage(u.get("VULCAN_LEARN_BROADCAST"),t,t.productCode,t.productVersion)}),this.maps.forEach(t=>{const e=u.get("VULCAN_TYPE",t.type),a=async(a,r,i,n)=>{let o,c={};try{c=JSON.parse(a)}catch(t){o=new S(u.analytics.PARAM_VALIDATION_ERR,`Unable to parse ${e} request:${a}`)}const p=n&&setTimeout(()=>{this.log.error(new S("CCX Process Hung. Quitting")),f.flush(!0,process.exit)},u.get("CLIENT_REQUEST_TIMEOUT")),h=c.params||{},g=c.analytics||{},y=this.log.context({params:h,payload:s({},g,{"event.subcategory":u.get("ANALYTICS_SUBCATEGORY",t.type)})}),T=await y.request(async()=>{if(o)throw o;if(!d.getUserId())throw new Error(u.analytics.SIGNED_OUT);let a=_.validateDataFields(c,u.get("SERVICE_REQUEST_SCHEMA"));if(Array.isArray(a))throw a[0];if(c.displayed&&await t.updateDisplayedId(c),!n)return void(c.updateLastUseTime&&await t.getLatestPath(c));const p={requestId:c.requestId},f=await t.addNewCollectionData({params:h,payload:g,level:c.urgent?E.UrgentRequest:E.BackgroundRequest,force:s({},c.force,{from:Date.now()}),progress:t=>{t.requestId=c.requestId,l.sendMessage(`ccxprocess.${e}Progress`,t,r,i)}});return p.path=await t.getLatestPath(s({},c,{updateLastUsedId:!0})),p.contentId=f.id,p.expiry=t.getExpiry(f.id)||f.expiryTime,p}).catch(t=>({requestId:c.requestId,err:t instanceof Error&&!(t instanceof S)?{message:t.message}:t}));n&&(clearTimeout(p),l.sendMessage(`ccxprocess.${e}Response`,T,r,i))};l.addListener(`ccxprocess.${e}Request`,(t,e,s)=>a(t,e,s,!0)),l.addListener(`ccxprocess.${e}UsageMarker`,(t,e,s)=>a(t,e,s,!1)),t.addListener("newCollection",async(a,s)=>{const r=t.targetDetails(a);l.sendMessage(`ccxprocess.${e}Broadcast`,{params:a,path:await t.getLatestPath({params:a}),contentId:s.id},r.productCode,r.productVersion)})}),l.sendMessage(u.get("VULCAN_STARTUP_MESSAGE"),"","","")}}},function(t,e){t.exports=require("idle-gc")},,function(t,e,a){"use strict";a.r(e);var s=a(8);var r={LABEL:"CCD",ANALYTICS_SUBCATEGORY:"CCD",VULCAN_TYPE:"CCD",LOG_PREFIX:"CCD",LOOKUP_MAP_FILE_VERSION:2,SUPPORTED_PRODUCTS:{ACCC:"5.0"},PRIORITY_CHANNEL:s.PriorityChannels.CcdPrimary,SURFACE_PRIORITY:{ACCC_APPS_CATALOG:0,ACCC_CATEGORIES_BANNERS:100,ACCC_ALL_APPS_BANNERS:200,ACCC_APP_SKELETON:300},SECONDARY_SURFACES:["ACCC_ALL_APPS_BANNERS"],TERTIARY_SURFACES:["ACCC_APPS_CATALOG","ACCC_CATEGORIES_BANNERS"],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"],DEFAULT_URLS_ENABLED:!1},i=a(7),n=a(17),o=a(5),c=a(0);class d extends n.default{applyResponseAnalytics(t,e,a){if(t.appendPayload({"exp.response_guid":e.analyticsData&&e.analyticsData.responseGUID}),e.surfaces)for(let a in e.surfaces)t.addSurfaceAnalytics([{surface:a}]),Array.isArray(e.surfaces[a].containers)&&t.addSurfaceAnalytics(e.surfaces[a].containers.map(t=>t.containerAnalyticsData))}async downloadCollectionDataRaw({params:t,priority:e,id:a=i.v4(),skipAuth:s}){const r=await this.url(t),n=await this.log.context({params:t}).time(async t=>{let{response:i,time:n}=await this.get({url:r,options:{method:"GET",timeout:c.default.get("SERVER_TIMEOUT"),headers:{"content-type":"application/json","x-gw-ims-user-id":o.default.getUserId(),"X-API-Key":c.default.getEnvironment().CLIENT_ID}},priority:e,auth:!s&&!!await o.default.getAccessToken().catch(t=>!1),id:a});t.appendPayload({"event.value":n,"event.url":r,"env.svc.name":"Learn"});const d=Date.now(),l=await this.getResponseJson(i,r);return n+=Date.now()-d,l});return n.analyticsData&&(n.analyticsData.requestId=a),n}}var l=a(18),u=a(28),p=a(1);function _(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class h extends l.a{constructor(t,e){super(t,e),_(this,"dataManager",void 0),this.dataManager=new u.a(e.type,this._lookupMap.diskLock)}async syncDataPromises({analyticsParams:t,payload:e,surface:a,card:s,priority:r,params:i,force:n,started:o}){await this.log.context({payload:e,surfaceAnalytics:[function(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{},s=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(a).filter(function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),s.forEach(function(e){_(t,e,a[e])})}return t}({surface:a},t)]}).time(async t=>{let{count:e,totalTime:c}=await this.dataManager.downloadData({modeID:a,card:s,lookupMap:this._lookupMap,priority:r,params:i,started:o,force:n});t.appendPayload({"event.url":"","event.count":e,"event.value":c/e})})}async syncData({priority:t,payload:e,params:a,progress:r=(()=>{}),force:i={type:"none"}}={}){if(!this._data)return;const n={started:[],complete:[]};let o=[];Object.keys(this._data.surfaces).forEach(d=>{o.push(p.default.waitAll(this._data.surfaces[d].containers.map(async o=>{const l=new s.Priority(t);l.value+=c.default.get("SURFACE_PRIORITY",this._lookupMap.type)[d]||0,c.default.get("SECONDARY_SURFACES",this._lookupMap.type).includes(d)&&(l.channel=s.PriorityChannels.CcdSecondary),c.default.get("TERTIARY_SURFACES",this._lookupMap.type).includes(d)&&(l.channel=s.PriorityChannels.CcdTertiary),await this.syncDataPromises({analyticsParams:o.containerAnalyticsData,payload:e,surface:d,card:o,priority:l,params:a,force:i,started(){n.started.includes(d)||(n.started.push(d),r(Object.assign({},n)))}})})).then(()=>{n.started.includes(d)||n.started.push(d),n.complete.push(d),r(Object.assign({},n))}))}),await p.default.waitAll(o)}get totalItems(){return this._data&&this._data.surfaces?Object.keys(this._data.surfaces):0}async getReferencedAssets(){const t={};return this._data&&this._data.surfaces&&await p.default.waitAll(Object.keys(this._data.surfaces).map(async e=>{await p.default.waitAll(this._data.surfaces[e].containers.map(async a=>{const s=await this.dataManager.getReferencedAssets(e,a);Object.assign(t,s)}))})),t}}var f=a(20);a.d(e,"default",function(){return g});class g extends f.default{constructor(t){super(r),this._downloadManager=new d(this.type)}_createCollectionData(t){return new h(t,this)}_getLookupKeys(t,e){const a=[e||o.default.getUserId()];return a.push(t.productLanguage),a}validateParams(t){}isRequestPoisoned(t){return!1}_generateId(t){return`${t.productLanguage}-${i.v4()}`.trim()}updateParams(t){const e=o.default.getUserInfo()?o.default.getUserInfo().CountryCode:null;return super.updateParams(t).map(t=>(delete t.productCode,delete t.productVersion,Object.assign({surfaceId:t.surfaceId||["ACCC_ALL_APPS_BANNERS","ACCC_CATEGORIES_BANNERS","ACCC_APPS_CATALOG","ACCC_APP_SKELETON"],productLanguage:t.productLanguage},e?{countryCode:e}:{},t)))}sanitizeParams(t){return t.productLanguage=p.default.sanitizeLocale(t.productLanguage,c.default.get("SUPPORTED_LOCALES",this.type)),t}targetDetails(t){return{productCode:"ACCC"}}isValidDataForParams({id:t,params:e}){const a=this._data.metadata[t];return!(a&&a.params&&a.params.countryCode&&e.countryCode&&a.params.countryCode!==e.countryCode)}}},function(t,e,a){"use strict";a.r(e);var s=a(0),r=a(1),i=a(3),n=a(18);function o(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{},s=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(a).filter(function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),s.forEach(function(e){c(t,e,a[e])})}return t}function c(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class d extends n.a{constructor(t,e){super(t,e)}validateData(t){return r.default.validateDataFields(t,s.default.get("LEARN_DATA_SCHEMA"))}ututAnalyticsData(t){return{"event.subcategory":s.default.analytics.sc_UTUTS,"event.subtype":s.default.analytics.st_API,"content.id":t.tutorialUUID||t.aem_id,"content.name":t.metadata&&t.metadata.descriptions&&t.metadata.descriptions.short,"content.category":t.metadata&&t.metadata.level,"content.action":t.metadata&&t.metadata.urls&&t.metadata.urls.helpx,"content.type":t.metadata&&t.metadata.learning_approach}}async upgrade(t,e){if("V3_0"===e&&t&&t.surfaces&&t.surfaces["CCX_TUTORIAL_2.5"]){this.log.disk(`Reformatting Learn Data: ${this._fileName}`);const e={surfaces:{"CCX_Start_3.0_Tutorials":t.surfaces["CCX_TUTORIAL_2.5"]},expirationDTS:t.expirationDTS,analyticsData:t.analyticsData,version:s.default.get("LOOKUP_COLLECTION_FILE_VERSION",this._lookupMap.type)};return e.surfaces["CCX_Start_3.0_Tutorials"].surfaceAnalyticsData&&(e.surfaces["CCX_Start_3.0_Tutorials"].surfaceAnalyticsData.surfaceId="CCX_Start_3.0_Tutorials"),e}return"V3_1"!==e&&"V2_8"!==e||!t||!t.surfaces||t.surfaces["CCX_Start_3.1_Tutorials"]?(t.version=2,t):(this.log.disk(`Surface mismatch, downloading new 3.1 surface content: ${this._fileName}`),null)}get totalItems(){if(this._data&&this._data.surfaces){const t=Object.values(this._data.surfaces)[0];if(t&&t.containers)return t.containers.reduce((t,e)=>e&&e.content&&e.content.tutorials&&e.content.tutorials.length?t+e.content.tutorials.length:t,0)}return 0}async syncData({priority:t,payload:e,params:a,progress:n=(()=>{})}={}){const c=this._data,d=s.default.get("LEARN_SURFACE_ID",r.default.ccxVersionToString(a));if(!c||!c.surfaces||!c.surfaces[d]||Array.isArray(!c.surfaces[d].containers))return;const l=c.surfaces[d].containers,u=this._lookupMap,p=this.assetsDir,_={started:0,complete:0};await this.log.time(async c=>{let d=0,h=0;await r.default.waitAll(l.map(async e=>{e&&e.content&&Array.isArray(e.content.tutorials)&&await r.default.waitAll(e.content.tutorials.map(async r=>{if(!r||!r.metadata||!r.metadata.images)return;const c=r.metadata.images;if(!c.thumbnail||0===c.thumbnail.length)return;_.started++,n(_);const{path:l,time:f}=await u.fetchAsset({href:c.thumbnail,assetsDir:p,priority:t,params:a}).catch(t=>(this.log.context({payload:o({},this.ututAnalyticsData(r),{"event.url":c.thumbnail})}).error(new i.default(s.default.analytics.t_FETCH,t)),e.content.tutorials.splice(e.content.tutorials.indexOf(r),1),{path:void 0,time:void 0}));_.complete++,n(_),c.thumbnailPath=l,f&&(h+=f,d+=1)}))})),c.appendPayload(o({},e,{"event.url":"","event.count":d,"event.value":h/d}))})}async getReferencedAssets(){const t={},e=this._data,a=s.default.get("LEARN_SURFACE_ID","V2_5"),r=s.default.get("LEARN_SURFACE_ID","V2_8"),i=s.default.get("LEARN_SURFACE_ID","V3_0"),n=s.default.get("LEARN_SURFACE_ID","V3_1");if(!e||!e.surfaces||!e.surfaces[a]&&!e.surfaces[r]&&!e.surfaces[i]&&!e.surfaces[n]||e.surfaces[a]&&e.surfaces[a].containers&&Array.isArray(!e.surfaces[a].containers)||e.surfaces[a]&&e.surfaces[a].containers&&Array.isArray(!e.surfaces[a].containers))return t;let o=a;return e.surfaces[i]&&(o=i),e.surfaces[r]&&(o=r),e.surfaces[n]&&(o=n),e.surfaces[o].containers.forEach(e=>{e&&e.content&&Array.isArray(e.content.tutorials)&&e.content.tutorials.forEach(e=>{if(e&&e.metadata&&e.metadata.images){const a=e.metadata.images;a.thumbnailPath&&(t[a.thumbnailPath]=!0)}})}),t}}var l=a(17),u=a(7),p=a(5),_=a(11);class h extends l.default{async url(t){const e=s.default.getEnvironment(),a=new _.URL(s.default.get(`URL_${e.LABEL.toUpperCase()}`,this.type)),i=s.default.get("LEARN_SURFACE_ID",r.default.ccxVersionToString(t)),n=r.default.compareMajorMinorVersions(s.default.get("SUPPORTED_LEARN_THIRD_PARTY_START_MIN_VERSION"),t.ccxVersion||"")>-1,o={productCode:t.productCode,productLanguage:t.productLanguage,productVersion:t.productVersion,surfaceId:i,ccxVersion:t.ccxVersion,allowThirdPartyContent:n.toString()};return this.appendUrlSearchParams(a.searchParams,o),a.toString()}additionalAnalytics(t){return{"exp.surface_id":s.default.get("LEARN_SURFACE_ID",r.default.ccxVersionToString(t))}}numberOfTutorials(t,e){let a=0,i=0;const n=s.default.get("LEARN_SURFACE_ID",r.default.ccxVersionToString(e));return t&&t.surfaces&&t.surfaces[n]&&Array.isArray(t.surfaces[n].containers)&&t.surfaces[n].containers.forEach(t=>{t.content&&Array.isArray(t.content.tutorials)&&t.content.tutorials.length>0&&(t.content.tutorials[0].metadata&&Array.isArray(t.content.tutorials[0].metadata.platforms)&&t.content.tutorials[0].metadata.platforms.includes("in-app")?i=t.content.tutorials.length:a=t.content.tutorials.length)}),{web:a,app:i}}applyResponseAnalytics(t,e,a){const r=this.numberOfTutorials(e,a);if(t.appendPayload({"exp.response_guid":e.analyticsData&&e.analyticsData.responseGUID,"content.type":s.default.analytics.UTUTS,"content.size":`${r.web}:${r.app}`}),e.surfaces)for(let a in e.surfaces)t.addSurfaceAnalytics([{surface:a}]),Array.isArray(e.surfaces[a].containers)&&t.addSurfaceAnalytics(e.surfaces[a].containers.map(t=>t.containerAnalyticsData))}async downloadCollectionDataRaw({params:t,priority:e,id:a=u.v4(),skipAuth:i}){const n=await this.url(t),o=await this.log.context({params:t}).time(async t=>{let r={"content-type":"application/json","X-API-Key":s.default.getEnvironment().CLIENT_ID};const o=!i&&!!await p.default.getAccessToken().catch(t=>!1);o&&(r["x-gw-ims-user-id"]=p.default.getUserId());let{response:c,time:d}=await this.get({url:n,options:{method:"GET",timeout:s.default.get("SERVER_TIMEOUT"),headers:r},priority:e,auth:o,id:a});t.appendPayload({"event.value":d,"event.url":n,"env.svc.name":"Learn"});const l=Date.now(),u=await this.getResponseJson(c,n);return d+=Date.now()-l,u}),c=s.default.get("LEARN_SURFACE_ID",r.default.ccxVersionToString(t));return o.surfaces&&o.surfaces[c]&&Array.isArray(o.surfaces[c].containers)&&o.surfaces[c].containers.forEach(t=>{t.data&&(t.content=JSON.parse(t.data))}),o}}var f={ANALYTICS_SUBCATEGORY:"Learn",LOOKUP_COLLECTION_FILE_VERSION:3,SUPPORTED_PRODUCTS:{AEFT:"16.0",DRWV:"19.0",FLPR:"20.0",IDSN:"14.0",ILST:"23.0",PHXS:"20.0",PPRO:"13.0"},PARAMETERS_SCHEMA:{id:"learn_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"}},required:["productCode","productVersion","productLanguage"]},LABEL:"LEARN",VULCAN_TYPE:"Tutorial",NON_IDEMPOTENT_IMAGES:!0,PRIORITY_CHANNEL:a(8).PriorityChannels.Learn,DEFAULT_URLS_ENABLED:!1},g=a(20);a.d(e,"default",function(){return S});class S extends g.default{constructor(){super(f),this._downloadManager=new h(this.type)}_createCollectionData(t){return new d(t,this)}_checkValidity(t,e){const{web:a}=this._downloadManager.numberOfTutorials(t.data,e);if(0===a)throw new i.default(s.default.analytics.MISSING_DATA,"No valid web tutorials")}isRequestPoisoned(t){return!!(r.default.isWindows()&&r.default.compareMajorMinorVersions(s.default.get("EARLIEST_SUPPORTED_WINDOWS_VERSION_UXP"),r.default.getOsVersion())<0&&s.default.get("UNSUPPORTED_WINDOWS_UXP_APPS").includes(t.productCode))}updateParams(t){return super.updateParams(t).map(t=>{const e=s.default.get("ACTIVE_VERSIONS").find(e=>{const a=s.default.get("FIRST_MILE_PREFETCH_CLIENTS",e)[t.productCode];return 1===r.default.compareMajorMinorVersions(t.productVersion,a)});return t.ccxVersion=s.default.get("START_VERSION",e),t})}}},function(t,e,a){"use strict";a.r(e);var s=a(0),r=a(20),i=a(1),n=a(18),o=a(28);function c(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class d extends n.a{constructor(t,e){super(t,e),c(this,"cardDataManager",void 0),this.cardDataManager=new o.a(e.type,this._lookupMap.diskLock)}validateData(t,e){let a;if(a=i.default.validateDataFields(t,s.default.get("CARDS_DATA_SCHEMA")[e],[s.default.get("CARDS_CONTROL_SCHEMA")]))return a;let r=[];return t.cardControl&&t.cardControl.forEach(e=>{const n=s.default.get("CARD_DATA_SCHEMA")[e.modeID];if(!n)return null;e.cardOrder.forEach(e=>{const s=t.cards[e];s&&(a=i.default.validateDataFields(s,n))&&(r=r.concat(a))})}),r.length>0?r:null}async upgrade(t,e){return"V3_0"===e&&t&&t.cardControl?(this.log.disk(`Invalidating Home Data: ${this._fileName}`),null):t.version===s.default.get("LOOKUP_COLLECTION_FILE_VERSION",this._lookupMap.type)?t:t&&2===t.version?(t.version=s.default.get("LOOKUP_COLLECTION_FILE_VERSION",this._lookupMap.type),t):(this.log.disk(`Unsupported format, downloading new content: ${this._fileName}`),null)}async syncDataPromises({analyticsParams:t,payload:e,surface:a,card:s,priority:r,params:i,started:n}){await this.log.context({payload:e,surfaceAnalytics:[function(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{},s=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(a).filter(function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),s.forEach(function(e){c(t,e,a[e])})}return t}({surface:a},t)]}).time(async t=>{let{count:e,totalTime:o}=await this.cardDataManager.downloadData({modeID:a,card:s,lookupMap:this._lookupMap,priority:r,bundle:!0,params:i,started:n});t.appendPayload({"event.url":"","event.count":e,"event.value":o/(e||1)})})}get totalItems(){return this._data&&this._data.surfaces?Object.keys(this._data.surfaces):this._data&&this._data.cardControl?this._data.cardControl.map(t=>t.modeID):0}async syncData({priority:t,payload:e,params:a,progress:s}){if(!this._data)return;const r={started:[],complete:[]};let n=[];if(this._data.surfaces)Object.keys(this._data.surfaces).forEach(o=>{n.push(i.default.waitAll(this._data.surfaces[o].containers.map(async i=>{await this.syncDataPromises({analyticsParams:i.containerAnalyticsData,payload:e,surface:o,card:i,priority:t,params:a,started(){r.started.includes(o)||(r.started.push(o),s(Object.assign({},r)))}})})).then(()=>{r.started.includes(o)||r.started.push(o),r.complete.push(o),s(Object.assign({},r))}))});else{if(!this._data.cardControl)return;this._data.cardControl.forEach(o=>{n.push(i.default.waitAll(o.cardOrder.map(async(i,n)=>{const c=this._data.cards[i];c&&await this.syncDataPromises({analyticsParams:o.containerAnalyticsParams&&o.containerAnalyticsParams[n],payload:e,surface:o.modeID,card:c,priority:t,params:a,started(){r.started.includes(o.modeID)||(r.started.push(o.modeID),s(Object.assign({},r)))}})})).then(()=>{r.started.includes(o.modeID)||r.started.push(o.modeID),r.complete.push(o.modeID),s(Object.assign({},r))}))})}await i.default.waitAll(n)}hasValidCards(){const t=s.default.get("ACTIVE_VERSIONS"),e=s.default.get("SUPPORTED_ACTIVE_VERSIONS"),a=t.slice(-1*e),r=i.default.ccxVersionToString(this._data);if(!a.includes(r))return!0;const n=s.default.get("HOME_SURFACE_ID",r);return["V1","V2","V2_5"].includes(r)?!!this._data.cardControl.find(t=>t.modeID===n):!!Object.keys(this._data.surfaces).includes(n)}async getReferencedAssets(){const t={};return this._data&&this._data.surfaces?await i.default.waitAll(Object.keys(this._data.surfaces).map(async e=>{await i.default.waitAll(this._data.surfaces[e].containers.map(async a=>{const s=await this.cardDataManager.getReferencedAssets(e,a);Object.assign(t,s)}))})):this._data&&this._data.cardControl&&await i.default.waitAll(this._data.cardControl.map(async e=>{await i.default.waitAll(e.cardOrder.map(async a=>{const s=this._data.cards[a];if(s){const a=await this.cardDataManager.getReferencedAssets(e.modeID,s);Object.assign(t,a)}}))})),t}}var l=a(13),u=a(3),p=a(7),_=a(8);var h={ANALYTICS_SUBCATEGORY:"Sophia",LOOKUP_MAP_FILE_VERSION:5,LOOKUP_COLLECTION_FILE_VERSION:3,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"},PARAMETERS_SCHEMA:{id:"psdk_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"},subscriptionStatus:{type:"string"}},required:["productCode","productVersion","productLanguage","subscriptionStatus"]},LOG_PREFIX:"FirstMile",LABEL:"FIRST_MILE",DIR:"data/",VULCAN_TYPE:"FirstMile",PRIORITY_CHANNEL:_.PriorityChannels.FirstMileLatest,DEFAULT_DATA_EXPIRATION:2592e5,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"}}};a.d(e,"default",function(){return g});const f=a(46);class g extends r.default{constructor(){super(h),this._downloadManager=new f(this.type)}_generateId(t){return`${t.productCode}-${t.productVersion}-${t.productLanguage}-${t.subscriptionStatus}-${p.v4()}`.trim()}priority(t){let{params:e}=t;const a=super.priority(t),r=i.default.ccxVersionToString(e);return a.value+=s.default.get("priority",r),"V1"!==r&&"V2"!==r||(a.channel=_.PriorityChannels.Deprecated),"V2_5"!==r&&"V3_0"!==r||(a.channel=_.PriorityChannels.FirstMileOld),a}_createCollectionData(t){return new d(t,this)}_getLookupKeys(t,e=null){const a=super._getLookupKeys(t,e),s=i.default.ccxVersionToString(t);return a.splice(1,0,s),a.push(t.subscriptionStatus||"paid"),a}_checkValidity(t,e){if(!t||!t.hasValidCards||!t.hasValidCards())throw new u.default(l.default.MISSING_DATA,"Empty Sophia Cards")}isRequestPoisoned(t){const e=i.default.ccxVersionToString(t);return"V1"===e||("V2"===e&&!s.default.get("TIER_1_LOCALES").includes(t.productLanguage)||!!(i.default.isWindows()&&i.default.compareMajorMinorVersions(s.default.get("EARLIEST_SUPPORTED_WINDOWS_VERSION_UXP"),i.default.getOsVersion())<0&&s.default.get("UNSUPPORTED_WINDOWS_UXP_APPS").includes(t.productCode)))}updateParams(t){t=super.updateParams(t);const e=[];return t.forEach(t=>{if(!t.subscriptionStatus){const a=Object.assign({},t);a.subscriptionStatus="trial",e.push(a),t.subscriptionStatus="paid"}e.push(t)}),e.forEach(t=>{const e=s.default.get("ACTIVE_VERSIONS").find(e=>{const a=s.default.get("FIRST_MILE_PREFETCH_CLIENTS",e)[t.productCode];return 1===i.default.compareMajorMinorVersions(t.productVersion,a)});t.ccxVersion=s.default.get("START_VERSION",e)}),e}async defaultCollectionData({params:t,desiredId:e}){const a=i.default.ccxVersionToString(t);if(["V2_5","V2_8","V3_0","V3_1"].includes(a)){const r=this._createCollectionData(e),i=s.default.get("DEFAULT_URLS",this.type)[a][t.productCode],n=i&&i.replace("{locale}",t.productLanguage);if(!n)return;let o={ccxVersion:"2.7.4.99",cards:[{startDTS:(new Date).toISOString(),endDTS:(new Date).toISOString(),contentURL:n}],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()+s.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString(),_ccx:{isDefault:!0,version:s.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type)}};return"V2_8"===a&&(o={ccxVersion:"2.8.0.99",_ccx:{isDefault:!0,version:s.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type)},surfaces:{"CCX_Start_3.1_Home":{containers:[{dataType:"URL",data:n,containerAnalyticsData:{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"}}]}},analyticsData:{responseGUID:"dummy",requestId:"dummy"},expirationDTS:new Date(Date.now()+s.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString()}),"V3_1"===a&&(o={ccxVersion:"3.1.0.99",_ccx:{isDefault:!0,version:s.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type)},surfaces:{"CCX_Start_3.1_Home":{containers:[{dataType:"URL",data:n,containerAnalyticsData:{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"}}]}},analyticsData:{responseGUID:"dummy",requestId:"dummy"},expirationDTS:new Date(Date.now()+s.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString()}),"V3_0"===a&&(o={ccxVersion:"3.0.1.99",_ccx:{isDefault:!0,version:s.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type)},surfaces:{"CCX_Start_3.0_Home":{containers:[{dataType:"URL",data:n,containerAnalyticsData:{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"}}]}},analyticsData:{responseGUID:"dummy",requestId:"dummy"},expirationDTS:new Date(Date.now()+s.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString()}),r.setData(o,a),r}}}}]);