!(function (window, $) {$(document).ready(function () {let BASE_URL = $('#wcm-base-url') ? $('#wcm-base-url').val() : '';let PROFILE_NAME = $('#wcm-profile-name') ? $('#wcm-profile-name').val() : '';const constants = {LANGUAGE_NAME: { zh_CN: '简体中文', en_US: 'English', ja_JP: '日本語', ru_RU: 'Русский', pt_BR: 'Português', ES_MX: 'español' },LANGUAGE: { ZH_CN: 'zh_CN', EN_US: 'en_US', JA_JP: 'ja_JP', RU_RU: 'ru_RU', ES_MX: 'es_MX', PT_BR: 'pt_BR' },APP_ID: 'com.huawei.channelsales.echannel.echannel2.0',SUB_APP_ID: 'ePartner_service',MY_TODO_NAME_MAP: { zh_CN: '我的待办', en_US: 'My Todo', ru_RU: 'Мои задачи' },LANGUAGE_TYPE: { zh_CN: 'cn', en_US: 'en', ja_JP: 'jp', ru_RU: 'ru', pt_BR: 'pt', ES_MX: 'es' },CONTEXT_ROOT: '/eplusweb',COMMON_SERVICE: '/ePartner/apigateway/com.huawei.channelsales.echannel.echannel2.0:ePartner_comservice/ePartner/commonservice/services',E_PARTNER_SERVICE: '/ePartner/apigateway/com.huawei.channelsales.echannel.echannel2.0:ePartner_service/ePartner/service/services',uipmIcslOrigin: 'icsl-uipm.his-beta.huawei.com',VALID_ORIGIN: ['cn', 'com'],BOOLEAN: { Y: 'Y', N: 'N' },LANGUAGE_LIST: {ALL: [{ text: '简体中文', href: '', targetBlank: false, active: true, language: 'zh_CN' },{ text: 'English', href: '', targetBlank: false, active: false, language: 'en_US' },{ text: '日本語', href: '', targetBlank: false, active: false, language: 'ja_JP' },{ text: 'Русский', href: '', targetBlank: false, active: false, language: 'ru_RU' },{ text: 'Português', href: '', targetBlank: false, active: false, language: 'pt_BR' },{ text: 'español', href: '', targetBlank: false, active: false, language: 'es_MX' },],SAMPLE: [{ text: '简体中文', href: '', targetBlank: false, active: true, language: 'zh_CN' },{ text: 'English', href: '', targetBlank: false, active: false, language: 'en_US' },],},isSupportAllLang: true,};function replaceDomain(url) {if (!url) {return url;}try {const urlObj = new URL(url);const curHost = window.location.host;const curOrigin = curHost.split('.').pop().split(':').shift();const urlHost = urlObj.host;const urlOrigin = urlHost.split('.').pop().split(':').shift();if (!constants.VALID_ORIGIN.includes(curOrigin) || !constants.VALID_ORIGIN.includes(urlOrigin)) {return url;}const newHost = urlHost.replace(urlOrigin, curOrigin);urlObj.host = newHost;return urlObj.href;} catch (e) {return url;}}if (!BASE_URL || BASE_URL.indexOf('wcm_base_url') > -1) {if (window.location.href.indexOf('partnersit') > -1 ||window.location.href.indexOf('b1') > -1 ||window.location.href.indexOf('localhost.huawei.com') > -1) {BASE_URL = 'https://partnersit.beta.huawei.com';PROFILE_NAME = 'sit';} else if (window.location.href.indexOf('uat') > -1) {BASE_URL = 'https://kweuat.huawei.com';PROFILE_NAME = 'uat';} else if (window.location.href.indexOf('icsl') > -1) {BASE_URL = 'https://icsl-epartner.his-beta.huawei.com';PROFILE_NAME = 'icsl';} else {BASE_URL = 'https://partner.huawei.com';PROFILE_NAME = 'production';}}const newUrl = replaceDomain(BASE_URL);BASE_URL = newUrl.endsWith('/') ? newUrl.slice(0, -1) : newUrl;let LOGIN_PATH = $('#wcm-login-url') ? $('#wcm-login-url').val() : '';if (!LOGIN_PATH || LOGIN_PATH.indexOf('wcm_login_url') > -1) {if (window.location.href.indexOf('sit') > -1 || window.location.href.indexOf('b1') > -1 || window.location.href.indexOf('localhost.huawei.com') > -1) {LOGIN_PATH = 'https://uniportal-beta.huawei.com/uniportal1/login-pc.html';} else if (window.location.href.indexOf('uat') > -1) {LOGIN_PATH = 'https://uniportal-beta.huawei.com/uniportal1/login-pc.html';} else if (window.location.href.indexOf('icsl') > -1) {LOGIN_PATH = 'https://uniportal-beta.huawei.com/uniportal1/login-pc.html';} else {LOGIN_PATH = 'https://uniportal.huawei.com/uniportal1/login-pc.html';}}LOGIN_PATH = replaceDomain(LOGIN_PATH);function getS3BaseUrl() {let S3_BASE_PATH = $('#wcm_s3_base_url') ? $('#wcm_s3_base_url').val() : '';if (!S3_BASE_PATH || S3_BASE_PATH.indexOf('wcm_s3_base_url') > -1) {if (window.location.href.indexOf('partnersit') > -1 ||window.location.href.indexOf('b1') > -1 ||window.location.href.indexOf('localhost.huawei.com') > -1) {S3_BASE_PATH = 'https://partnersit.beta.huawei.com/partnercloud/epartner/assets';} else if (window.location.href.indexOf('icsl') > -1) {S3_BASE_PATH = 'https://partnersit.beta.huawei.com/partnercloud/epartner/assets';} else if (window.location.href.indexOf('uat') > -1) {S3_BASE_PATH = 'https://kweuat.huawei.com/partnercloud/epartner/assets';} else {S3_BASE_PATH = 'https://partner.huawei.com/partnercloud/epartner/assets';}}return replaceDomain(S3_BASE_PATH);}let IS_DEVELOPMENT = $('#wcm_resource_load') ? $('#wcm_resource_load').val() : '';if (!IS_DEVELOPMENT || IS_DEVELOPMENT.indexOf('wcm_resource_load') > -1) {IS_DEVELOPMENT = true;} else {IS_DEVELOPMENT = false;}let HOME_BASE_URL = $('#wcm-worldwide-base-url') ? $('#wcm-worldwide-base-url').val() : '';if (!HOME_BASE_URL || HOME_BASE_URL.indexOf('wcm-worldwide-base-url') > -1) {if (window.location.href.indexOf('partnersit') > -1 ||window.location.href.indexOf('b1') > -1 ||window.location.href.indexOf('localhost.huawei.com') > -1) {HOME_BASE_URL = 'https://partnersit.beta.huawei.com/eplusmeta';} else if (window.location.href.indexOf('icsl') > -1) {HOME_BASE_URL = 'https://icsl-epartner.his-beta.huawei.com/eplusmeta';} else if (window.location.href.indexOf('uat') > -1) {HOME_BASE_URL = 'https://kweuat.huawei.com/eplusmeta';} else {HOME_BASE_URL = 'https://partner.huawei.com/eplusmeta';}}HOME_BASE_URL = replaceDomain(HOME_BASE_URL);function initAjaxSet() {$.ajaxSetup({xhrFields: {withCredentials: true,},contentType: 'application/json',crossDomain: true,});}function interceptAjax() {$.ajaxSetup({beforeSend: function (xhr, config) {if (config.url.indexOf(constants.APP_ID) === -1) {return;}const token = sessionStorage.getItem('x-csrf-token');if (token) {xhr.setRequestHeader('x-csrf-token', token);}if (!config.headers) {config.headers = {};}if (!config.headers['x-app-id']) {xhr.setRequestHeader('x-app-id', constants.APP_ID);}if (!config.headers['x-sub-app-id']) {xhr.setRequestHeader('x-sub-app-id', constants.SUB_APP_ID);}},complete: function (xhr, config) {const csrfToken = xhr.getResponseHeader('x-csrf-token');if (csrfToken) {sessionStorage.setItem('x-csrf-token', csrfToken);}if (xhr.status === 403) {goUniPortalLogin();}},});}function getCurrentLanguage() {return sessionStorage.getItem('epartner-current-language');}function getCurrentUserInfo() {return sessionStorage.getItem('current-user-info') && JSON.parse(sessionStorage.getItem('current-user-info'));}function isLogin() {return sessionStorage.getItem('epartner-is-login') && sessionStorage.getItem('epartner-is-login').toString() === 'true';}function isChina() {return sessionStorage.getItem('epartner-current-language') && sessionStorage.getItem('epartner-current-language').toString() === constants.LANGUAGE.ZH_CN;}function isAssociatedCompany() {return sessionStorage.getItem('epartner-is-associated') && sessionStorage.getItem('epartner-is-associated').toString() === 'true';}function isHW() {return getCurrentUserInfo().userType && getCurrentUserInfo().userType !== 'E_PT';}function goUniPortalLogin(url) {const origin = window.location.origin;const com = origin.substring(origin.lastIndexOf('.') + 1, origin.length).split(':')[0];if (url) {url = url.replace(/{origin}/gi, com);}sessionStorage.removeItem('x-csrf-token');window.location.href = DOMPurify.sanitize(`${LOGIN_PATH.replace('com', com)}?redirect=${url || window.location.href}`);}function getLogoOutUrl() {return sessionStorage.getItem('epartner-logout-url');}function getHomeUrl() {return sessionStorage.getItem('epartner-home-url');}function getProfileName() {return PROFILE_NAME;}function isProduction() {return PROFILE_NAME === 'production';}function replaceOrigin(str, oldV) {let origin = BASE_URL,newV = '';if (origin.indexOf('huawei.com') == -1) {newV = `.huawei.${origin.substring(origin.lastIndexOf('.') + 1, origin.length)}`;}if (newV != '') {let reg = new RegExp(`\\${oldV}`, 'gi');return str.replace(reg, newV);}return str;}function getUrlValue(value) {let hashs = top.window.location.hash.split('?');if (value != '' && hashs != undefined) {let arr = hashs[hashs.length - 1].split('&');for (let i = 0; i < arr.length; i++) {if (arr[i].search(`${value}=`) != -1) {return arr[i].substring(arr[i].indexOf('=') + 1, arr[i].length);}}}return '';}function dialogDragging({ $dialog, $header, closeDialog }) {let baseLeft = 0;let baseTop = 0;return e => {var offsetX = e.clientX - $dialog.offsetLeft;var offsetY = e.clientY - $dialog.offsetTop;const width = $($dialog).width();const height = $($dialog).height();const isOuterLeft = offsetX < -width / 2;const isOuterRight = offsetX > width / 2;const isOuterTop = offsetY < -height / 2;const isOuterBottom = offsetY > height / 2;if (isOuterLeft || isOuterRight || isOuterTop || isOuterBottom) {closeDialog();return;}const isOuterHeader = offsetY > -height / 2 + $($header).outerHeight();if (isOuterHeader) {return;}if (baseLeft === 0) {baseLeft = $dialog.offsetLeft;baseTop = $dialog.offsetTop;}function dragDialog(ev) {let left = ev.clientX - offsetX;let top = ev.clientY - offsetY;if (left < width / 2) {left = width / 2;} else if (left >= Math.floor(baseLeft * 2 - width / 2 - 1)) {left = Math.floor(baseLeft * 2 - width / 2 - 1);}if (top < height / 2) {top = height / 2;} else if (top >= Math.floor(baseTop * 2 - height / 2 - 1)) {top = Math.floor(baseTop * 2 - height / 2 - 1);}$dialog.style.left = left + 'px';$dialog.style.top = top + 'px';}function stopDragging() {document.removeEventListener('mousemove', dragDialog);document.removeEventListener('mouseup', stopDragging);}document.addEventListener('mousemove', dragDialog);document.addEventListener('mouseup', stopDragging);};}function isIcsl() {return PROFILE_NAME === 'icsl';}function checkUserIsAdmin() {return new Promise((resolve, reject) => {const cacheResult = sessionStorage.getItem('partnerOverseaIsAdmin');if (typeof cacheResult === 'string') {resolve(cacheResult === constants.BOOLEAN.Y);return;}$.ajax({dataType: 'json',type: 'GET',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/account/findAccountRole`,error: function (e) {sessionStorage.setItem('partnerOverseaIsAdmin', constants.BOOLEAN.N);resolve(false);},success: function (res) {sessionStorage.setItem('partnerOverseaIsAdmin', res.isAdmin);resolve(res.isAdmin === constants.BOOLEAN.Y);},});});}function partnerI18n() {this.i18nConfig = {zh_CN: {pageTitle: '华为政企合作伙伴门户',},en_US: {pageTitle: 'Huawei Partner for Global Enterprise Business',},};}partnerI18n.prototype.init = function (key) {window.$t = key => {const lang = getCurrentLanguage();const currentI18n = this.i18nConfig[lang];if (!key) {return '';}i18nKeyArr = key.toString().split('.');let result = '';let tempI18n = JSON.parse(JSON.stringify(currentI18n));i18nKeyArr.some(item => {if (tempI18n[item]) {tempI18n = tempI18n[item];}});if (typeof tempI18n === 'string') {return tempI18n;}return key;};};function checkLanguage(isLoginType, isAssociatedType, countryName) {let url = window.location.href;let lang;let domainType = false;let hrefList = ['http://localhost.huawei.com:8082/','http://localhost.huawei.com:8082','http://localhost.huawei.com:8082/#','http://localhost.huawei.com:8082/#/','https://partnersit.beta.huawei.com/eplusweb/','https://partnersit.beta.huawei.com/eplusweb','https://partnersit.beta.huawei.com/eplusweb/#','https://partnersit.beta.huawei.com/eplusweb/#/','https://kweuat.huawei.com/eplusweb/','https://kweuat.huawei.com/eplusweb','https://kweuat.huawei.com/eplusweb/#','https://kweuat.huawei.com/eplusweb/#/','https://partner.huawei.com/','https://partner.huawei.com','https://partner.huawei.com/#','https://partner.huawei.com/#/','http://partner.huawei.com/','http://partner.huawei.com','http://partner.huawei.com/#','http://partner.huawei.com/#/',];domainType = hrefList.includes(url);if (domainType) {lang = domainLanguageFn(isLoginType, isAssociatedType, countryName);} else {lang = getLangFromPageUrl();}return lang;}function getLangFromPageUrl() {const url = window.location.href;let lang = '';if (url.indexOf('/en/') > -1) {lang = 'en_US';} else if (url.indexOf('/jp/') > -1) {lang = 'ja_JP';} else if (url.indexOf('/es/') > -1) {lang = 'es_MX';} else if (url.indexOf('/ru/') > -1) {lang = 'ru_RU';} else if (url.indexOf('/cn/') > -1) {lang = 'zh_CN';} else if (url.indexOf('/pt/') > -1) {lang = 'pt_BR';} else {lang = 'en_US';}return lang;}function domainLanguageFn(isLoginType, isAssociatedType, countryName) {let lang;if (isLoginType && isAssociatedType) {switch (countryName) {case 'China':lang = 'zh_CN';break;case 'Russia':lang = 'ru_RU';break;case 'Japan':lang = 'ja_JP';break;default:lang = 'en_US';break;}} else if (!isLoginType || (isLoginType && !isAssociatedType)) {let navLang = navigator.language || navigator.userLanguage;navLang = navLang.substr(0, 2);if (navLang === 'ru') {lang = 'ru_RU';} else if (navLang === 'ja') {lang = 'ja_JP';} else if (navLang === 'es') {lang = 'es_MX';} else if (navLang === 'pt') {lang = 'pt_BR';} else {lang = navLang === 'zh' ? 'zh_CN' : 'en_US';}}return lang;}function initLogin() {checkLoginByInterface();}async function checkLoginByInterface(obj) {$.ajax({type: 'GET',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/docHand/loginForMarket`,error: function (e) {sessionStorage.setItem('epartner-is-login', false);checkLoginCallback();},success: function (res) {if ((res.status && res.status.toString() === '200') || (res.respCode && res.respCode.toString() === '200')) {sessionStorage.setItem('epartner-is-login', true);} else {sessionStorage.setItem('epartner-is-login', false);}checkLoginCallback();},});}async function checkLoginCallback() {interceptAjax();if (isLogin()) {await getLoginUserInfo();} else {await getUnLoginUserInfo();}new partnerI18n().init();document.title = $t('pageTitle');new epartnerPageTopNav({ loginFlag: isLogin() }).init();new epartnerPageMenuHorizontal({ loginFlag: isLogin() }).init();showLoginInfo();$('.header-lang-current .header-lang-label').html(constants.LANGUAGE_NAME[getCurrentLanguage()]);initLang();initTools();if (isLogin()) {$('.pep-partner-login') && $('.pep-partner-login').css('display', 'none');} else {$('.pep-partner-login') && $('.pep-partner-login').css('display', 'flex');}new search().init();new downloadEApp().init();new menuHead({ loginFlag: isLogin(), isAssociatedType: isAssociatedCompany(), isHW: isHW() }).init();}async function getLoginUserInfo(linkArr, linkDesc) {let res = await getUserInfo();if (res.status === 403) {sessionStorage.setItem('epartner-is-login', false);goUniPortalLogin();return;}if (res.user && res.user.userAccount) {handlerHwAccount();sessionStorage.setItem('epartner-is-login', true);const userInfo = res.user;sessionStorage.setItem('current-user-info', JSON.stringify(userInfo));$('.register').remove();new protocolAndWebsite().init();const [isAssociatedType, accountInfo, workspaceRes] = await Promise.all([checkAssociated(), findAccountRoleFn(), queryWorkspaceFlag()]);sessionStorage.setItem('epartner-is-associated', isAssociatedType);if (isAssociatedType || isHW()) {getMenuData();}new expartnerDialog({ loginFlag: isLogin() }).init();new uncertified({ isHW: isHW(), accountInfo: accountInfo }).init();const lang = checkLanguage(true, isAssociatedType, accountInfo.countryName);sessionStorage.setItem('epartner-current-language', lang);if (isAssociatedType) {$('.header-lang').remove();}$('.login-user-info .item-container').css('borderLeft', 'none');initLogout();initMyTodo();if (workspaceRes.value !== '1') {$('.header-user-list #myHuawei').remove();$('.header-user-list #workspace').remove();} else if (!isAssociatedType) {$('.header-user-list #myHuawei').remove();}if (workspaceRes.value === '1' && isAssociatedType) {createGoMyWorkspaceElement();}}}function getUnLoginUserInfo() {return new Promise(resolve => {$('.register').css('display', 'flex');sessionStorage.setItem('epartner-current-language', checkLanguage(false));sessionStorage.setItem('current-user-info', JSON.stringify({ userAccount: '-Default-' }));resolve(true);});}function logOut() {const curOrigin = BASE_URL.split('://')[1];const logoutOrigin = isIcsl() ? constants.uipmIcslOrigin : curOrigin;const deleteCookieUrl = `https://${logoutOrigin}/uipmgateway/app_000000035487:uipmfront/uipm/servlet/logout?redirect=https://${curOrigin}/eplusmeta/en/worldwide.html`;const logoutCookieIframe = ``;$('.epartner-tenant-header-topnav').append(logoutCookieIframe);setTimeout(() => {const logoutUrl = replaceOrigin(getLogoOutUrl(), '.huawei.com');sessionStorage.removeItem('x-csrf-token');if (isProduction()) {window.location.href = logoutUrl;} else {window.location.href = `https://${curOrigin}${logoutUrl}`;}});}function initLogout() {$('.epartner-tenant-topnav-menu-right').on('click', '.log-out', function () {logOut();});}function initLang() {const langEnPageList = constants.isSupportAllLang ? constants.LANGUAGE_LIST.ALL : constants.LANGUAGE_LIST.SAMPLE;let langHtml = '';langEnPageList.forEach(item => {langHtml += `
`;});$('.epartner-tenant-topnav-menu-right .header-lang-list .header-site-right').html(langHtml);$('.header-lang').on('click', '.lang-select-item', function (e) {const curLang = e.currentTarget.dataset.lang;$('.header-lang-list').css('display', 'none');if (curLang === getCurrentLanguage()) {return;}sessionStorage.setItem('epartner-current-language', curLang);$('.header-lang-list .lang-select-item').removeClass('active');$(e.currentTarget).addClass('active');$('.header-lang-current .header-lang-label').html(constants.LANGUAGE_NAME[curLang]);if (curLang === constants.LANGUAGE.EN_US) {return;}const link = isHomeLink(curLang);window.location.href = new originCnReplace().replaceSingeOrigin(link);});$('.header-lang-list .lang-select-item').removeClass('active');$(`#${getCurrentLanguage()}`).addClass('active');$('.header-lang-current .header-lang-label').html(constants.LANGUAGE_NAME[getCurrentLanguage()]);$('.header-lang').on('mouseover', function () {$('.header-lang-list').css('display', 'flex');});$('.header-lang').on('mouseleave', function () {$('.header-lang-list').css('display', 'none');});}async function initMyTodo() {if (isAssociatedCompany() && !isHW()) {const myTodoNum = await getToDoNum();const name = constants.MY_TODO_NAME_MAP[getCurrentLanguage()] || constants.MY_TODO_NAME_MAP[constants.LANGUAGE.EN_US];$('.my-todo').css('display', 'flex');$('.my-todo').off('click');$('.my-todo').on('click', function () {const end = constants.LANGUAGE_TYPE[getCurrentLanguage()] == 'cn' ? 'cn' : 'en';window.open(`${BASE_URL}/eplus/#/${constants.LANGUAGE_TYPE[getCurrentLanguage()]}/group/mytodolist-${end}`);});$('.my-todo .name').html(name);$('.my-todo .value').html(myTodoNum);if (myTodoNum > 0) {$('.my-todo-name').attr('title', 'You have new to-do tasks. Please handle in time.');}}}function isHomeLink(lang) {const link = 'web';const href = location.href;if ((href.indexOf('/cn/') > -1 && !lang) || lang === constants.LANGUAGE.ZH_CN) {return `${HOME_BASE_URL}/cn/web/china.html`;}if ((href.indexOf('/en/') > -1 && !lang) || lang === constants.LANGUAGE.EN_US) {return `${HOME_BASE_URL}/en/web/worldwide.html`;}return isOtherHomeLink(lang, href, link);}function isOtherHomeLink(lang, href, link) {if ((href.indexOf('/ru/') > -1 && !lang) || lang === constants.LANGUAGE.RU_RU) {return `${BASE_URL + constants.CONTEXT_ROOT}/#/ru/${link}/worldwide`;}if ((href.indexOf('/pt/') > -1 && !lang) || lang === constants.LANGUAGE.PT_BR) {return `${BASE_URL + constants.CONTEXT_ROOT}/#/pt/${link}/worldwide`;}if ((href.indexOf('/es/') > -1 && !lang) || lang === constants.LANGUAGE.EN_US) {return `${BASE_URL + constants.CONTEXT_ROOT}/#/es/${link}/worldwide`;} else {return `${BASE_URL + constants.CONTEXT_ROOT}/#/jp/${link}/worldwide`;}}function getUserInfo() {return new Promise((resolve, reject) => {$.ajax({type: 'GET',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/jalor/web/support/workspace/current?_t=${new Date().getTime()}`,success: function (res) {resolve(res);},error: function (e) {resolve(e);},});});}async function getToDoNum() {const curLang = getCurrentLanguage();const lang = [constants.LANGUAGE.ZH_CN, constants.LANGUAGE.RU_RU, constants.LANGUAGE.JA_JP].includes(curLang) ? curLang : constants.LANGUAGE.EN_US;let params = {language: lang,status: 1,};return new Promise(resolve => {$.ajax({type: 'GET',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/todoList/queryTodoRecords?language=${params.language}&status=${params.status}`,success: function (res) {if (res && res.result) {resolve(res.result);} else {resolve(0);}},error: function () {resolve(0);},});});}function findAccountRoleFn() {return new Promise((resolve, reject) => {$.ajax({dataType: 'json',type: 'GET',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/account/findAccountRole`,success: function (res) {sessionStorage.setItem('partnerOverseaIsAdmin', res.isAdmin);resolve(res || {});},error: function (e) {sessionStorage.setItem('partnerOverseaIsAdmin', constants.BOOLEAN.N);resolve(e.responseJSON || {});},});});}function showLoginInfo() {const userContainerDom = $('.item-current-user');const unLoginDom = $('.item-current-user .unLogin-user-info');const loginDom = $('.item-current-user .login-user-info');if (isLogin()) {loginDom.css('display', 'flex');userContainerDom.addClass('already-login');unLoginDom.css('display', 'none');const userInfo = getCurrentUserInfo();$('.item-current-user .login-user-info .header-topnav-right-text').html(userInfo.userAccount);} else {loginDom.css('display', 'none');userContainerDom.removeClass('already-login');unLoginDom.css('display', 'flex');}}function handlerHwAccount() {$.ajax({type: 'GET',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/external/handlerHwAccount`,});}function queryWorkspaceFlag() {return new Promise((resolve, reject) => {$.ajax({type: 'GET',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/findRegistByPath/App.worktableFlag/true`,success: function (res) {resolve(res || {});},error: function (e) {resolve(e.responseJSON || {});},});});}function createGoMyWorkspaceElement() {const btnDev = document.createElement('div');btnDev.title = 'Go to Workspace';btnDev.className = 'workspace';const icon = document.createElement('div');icon.className = 'icon';btnDev.append(icon);btnDev.addEventListener('click', async function () {let herfLink = `/eplus/#/en/group/login-page`;let newMenu = await getMenusPrivilege();if (!newMenu.newStyle && newMenu.switchFlag) {herfLink = `${herfLink}?isToggleChange=true`;}window.open(herfLink);});$('#epartnerPageMenu').append(btnDev);}function initHeaderRightUserClickEvent() {const userContainerDom = $('.item-current-user');userContainerDom.on('click', '.unLogin-user-info', function () {goUniPortalLogin(getHomeUrl());});}function loginView(url, flag) {let origin = window.location.origin;let com1 = origin.substring(origin.lastIndexOf('.') + 1, origin.length);if (flag) {return url.replace(/{origin}/gi, com1);}const loginPath = '{wcm_login_url}';return `${loginPath.replace(/com/gi, com1)}?redirect=${url}`;}function skipToRegisterPage() {const lang = getCurrentLanguage() || 'en_US';let hrefUrl = '';if (window.location.origin.indexOf('localhost.huawei.com') > -1 || window.location.origin.indexOf('//partner.huawei') == -1) {hrefUrl = `https://uniportal-beta.huawei.com/accounts1/register-pc.html?redirect=${window.location.origin}#/cn/group/login-page&msg=1&v=V0.1&lang=`;} else {hrefUrl = `https://uniportal.huawei.com/accounts1/register-pc.html?redirect=${window.location.origin}#/cn/group/login-page&msg=1&v=V0.1&lang=`;}window.location.href = loginView(`${new originCnReplace().replaceSingeOrigin(hrefUrl)}${lang}`, true);}function initRegisterClickEvent() {$('.epartner-tenant-topnav-menu-right').on('click', '.register', function () {skipToRegisterPage();});}async function getMenuData() {const menusPrivilege = await getMenusPrivilege();}function getMenusPrivilege() {return new Promise((resolve, reject) => {$.ajax({type: 'GET',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/control/getMenusPrivilege`,error: function (e) {resolve(e);},success: function (res) {resolve(res);},});});}const toolsBarObject = {flags: false,position: { x: 0, y: 0 },dx: '',dy: '',nx: '',ny: '',xPum: '',yPum: '',isIHepShunt: false,sidebarList: [],sidebarSubList: [],isAssociated: false,isShowList: 0,isFaq: false,searchData: {},allSidebarList: [],judgeDragOffset: 2,};function toolsBarMouseDown(event) {const target = $('.partner-drag-drop-tools');if (!target) {return;}setOffsetLocal();$('.floatBar-bottom-demo').css('display', 'none');const targetWindow = window.getComputedStyle(target[0], null);const prefixX = event.clientX - parseFloat(targetWindow.left);const prefixY = event.clientY - parseFloat(targetWindow.top);let ww = document.documentElement.clientWidth;let wh = window.innerHeight;if (event.preventDefault) {event.preventDefault();} else {event.returnValue = false;}document.onmousemove = function (e) {const moveEvent = e || window.event;if (moveEvent.clientY < 0 || moveEvent.clientX < 0 || moveEvent.clientY > wh || moveEvent.clientX > ww) {return false;}$('.floatBar-bottom-demo').css('display', 'block');const curLeft = moveEvent.clientX - prefixX;const curTop = moveEvent.clientY - prefixY;target[0].style.left = `${curLeft}px`;target[0].style.top = `${curTop}px`;target[0].style.right = 'unset';};}function toolsBarMouseUp() {document.onmousemove = null;}function toolsBarTouchStart(event) {const target = $('.partner-drag-drop-tools');if (!target) {return;}document.body.onselectstart = () => {return false;};document.body.onselect = () => {return false;};toolsBarObject.flags = false;let touch;if (event.touches) {touch = event.touches[0];} else {touch = (event.originalEvent && event.originalEvent.touches[0]) || event;}toolsBarObject.position.x = touch.clientX;toolsBarObject.position.y = touch.clientY;toolsBarObject.dx = target[0].offsetLeft;toolsBarObject.dy = target[0].offsetTop;}function toolsBarTouchMove(touchEvent) {const target = $('.partner-drag-drop-tools');if (!target) {return;}let touch;if (touchEvent.touches) {touch = touchEvent.touches[0];} else {touch = (touchEvent.originalEvent && touchEvent.originalEvent.touches[0]) || touchEvent;}toolsBarObject.flags = true;toolsBarObject.nx = touch.clientX - toolsBarObject.position.x;toolsBarObject.ny = touch.clientY - toolsBarObject.position.y;toolsBarObject.xPum = toolsBarObject.dx + toolsBarObject.nx;toolsBarObject.yPum = toolsBarObject.dy + toolsBarObject.ny;let width = window.innerWidth - target[0].offsetWidth;let height = window.innerHeight - target[0].offsetHeight;toolsBarObject.xPum < 0 && (toolsBarObject.xPum = 0);toolsBarObject.yPum < 0 && (toolsBarObject.yPum = 0);toolsBarObject.xPum > width && (toolsBarObject.xPum = width);toolsBarObject.yPum > height && (toolsBarObject.yPum = height);target[0].style.left = `${toolsBarObject.xPum}px`;target[0].style.top = `${toolsBarObject.yPum}px`;target[0].style.right = 'unset';}function toolsBarTouchEnd(event) {toolsBarObject.flags = false;$('.floatBar-bottom-demo').css('display', 'none');}function showHelp() {turnPageLookUp(toolsBarObject.sidebarList[0].linkUrl);}function openBusiness() {toolsBarObject.isShowList = 2;showBusinessList();toolsBarObject.showBusiness = true;$('#business-list-help-container').addClass('more-width');$('.i-help-shunt').css('display', 'none');}function queryAssociatedStatus(params) {return new Promise((resolve, reject) => {$.ajax({type: 'GET',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/account/isAssociatedCompany`,success: function (res) {resolve(res);},error: function (e) {resolve(e);},});});}function initToolsEvent() {$(document).on('mousedown', '.partner-drag-drop-tools', function (e) {toolsBarMouseDown(e);});$(document).on('mouseup', '.partner-drag-drop-tools', function (e) {toolsBarMouseUp(e);});$(document).on('touchstart', '.partner-drag-drop-tools', function (e) {toolsBarTouchStart(e);});$(document).on('touchmove', '.partner-drag-drop-tools', function (e) {toolsBarTouchMove(e);});$(document).on('touchend', '.partner-drag-drop-tools', function (e) {toolsBarTouchEnd(e);});$('.partner-drag-drop-tools').on('click', '.partner-it-help-icon', function (e) {showHelp(e);});$('.partner-drag-drop-tools').on('click', '.partner-business-icon', function (e) {openBusiness(e);});document.addEventListener('mouseup', e => {const itBusinessContainer = document.getElementById('it-business-help-container');if (itBusinessContainer) {if (!itBusinessContainer.contains(e.target)) {toolsBarObject.isFaq = false;toolsBarObject.isShowList = 0;itBusinessContainer.style.display = 'none';}}let list = document.getElementById('business-list-help-container');if (list) {if (!list.contains(e.target)) {toolsBarObject.isFaq = false;toolsBarObject.isShowList = 0;list.style.display = 'none';}}});}function setOffsetLocal() {const toolsDom = document.getElementById('partner-drag-drop-tools');sessionStorage['ePartnerToolsPosition'] = JSON.stringify({ curTop: toolsDom.offsetTop, curLeft: toolsDom.offsetLeft });}function isToolsDrag(curTop, curLeft) {const container = document.getElementById('partner-drag-drop-tools');return (curTop !== undefined &&!(Math.abs(curLeft - container.offsetLeft) < toolsBarObject.judgeDragOffset && Math.abs(curTop - container.offsetTop) < toolsBarObject.judgeDragOffset));}function isHomeOrWorkView() {let href = window.location.href;let views = ['/cn-cp', '/china', '/cn-csp', '/salespartnerworkspace', '/solutionpartnerworkspace'];views.forEach(item => {if (href.indexOf(item) > -1 && href.indexOf('/cn/') > -1) {toolsBarObject.isIHepShunt = true;}});let viewsOverseas = ['/en/group/worldwide', '/en/web/worldwide', '/overseas-cp', '/overseas-csp', '/solutionpartnerworkspace-en'];viewsOverseas.forEach(item => {if ((href.indexOf(item) > -1 && href.indexOf('/en/') > -1) || true) {toolsBarObject.isIHepShunt = true;}});return toolsBarObject.isIHepShunt;}function checkAssociated() {const params = {};return new Promise(resolve => {queryAssociatedStatus(params).then(res => {let isAssociatedCompany = false;if (typeof res === 'string' && res !== '') {res = JSON.parse(res);}if (res.status === true) {isAssociatedCompany = true;} else {isAssociatedCompany = false;}resolve(isAssociatedCompany);}).catch(() => {resolve(false);});});}function getOnlineSupportTree(website) {return new Promise((resolve, reject) => {$.ajax({type: 'GET',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/online/getOnlineSupportTree?website=${website}`,success: function (res) {resolve(res);},error: function (e) {resolve(e);},});});}async function getOnLineList() {let website = '';if (getCurrentLanguage() === constants.LANGUAGE.EN_US) {website = 2;} else {website = 1;}let res = await getOnlineSupportTree(website);if (!res) {return;}let html = '';res.children.forEach(item => {html += `${item.name} `;html += '
';html += '
';});const htmlSrc = new originCnReplace().replaceOriginRichtext(html);$('#online-support-tree').html(htmlSrc);}function initTools() {initToolsEvent();findHelpSidebarList();if (isLogin()) {getOnLineList();} else {$('.partner-drag-drop-tools').addClass('partner-mobile-tools');}}function getFAQAndInstructionInfo(params) {return new Promise((resolve, reject) => {$.ajax({type: 'GET',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/file/ifaqmanageservice/getFAQAndInstructionInfo?searchUrl=${params.searchUrl}`,success: function (res) {resolve(res);},error: function (e) {resolve(e);},});});}function findBusinessContactList() {return new Promise((resolve, reject) => {$.ajax({type: 'GET',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/contact/findBusinessContactList`,success: function (res) {resolve(res);},error: function (e) {resolve(e);},});});}function initHelp() {return new Promise((resolve, reject) => {$.ajax({type: 'post',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/jalor/lookup/item/list/iHelp_config/page/new/300/1`,success: function (res) {resolve(res);},error: function (e) {resolve(e);},});});}function turnPageByLookUp(url) {const myUrl = url.split('?')[0];initHelp().then(data => {setTimeout(() => {if (myAppId != '') {window.open(new originCnReplace().replaceSingeOrigin(`${myUrl}?appId=${getAppId(data)}&page_category=`));} else {window.open(new originCnReplace().replaceSingeOrigin(url));}}, 300);});}function getAppId(res) {let myAppId = '';if (!res || !res.data || !res.res.result || res.data.result.length <= 1) {return myAppId;}res.data.result.forEach(v => {if (window.location.href.indexOf(v.itemName) > -1) {myAppId = v.itemAttr1;}});return myAppId;}function openHelpByCondition(url) {url = new originCnReplace().replaceSingeOrigin(url);if (url.indexOf('index.do?appId') > 1) {turnPageLookUp(url);} else {window.open(url);}}function showBusinessList() {$('#business-list-help-container').css('display', 'inline-block');}function getAssociatedDoc() {toolsBarObject.searchData = { faqList: [], instructionInfoList: [] };const pathArr = window.location.href.split('eplusmeta');const pathPrefix = pathArr.length > 1 ? pathArr[1].split('.')[0] : '';if (!pathPrefix) {return;}let params = {searchUrl: encodeURIComponent(`/eplus/${pathPrefix}`),};const p1 = getFAQAndInstructionInfo(params);const p2 = findBusinessContactList();let httpArr = [p1, p2];if (getCurrentLanguage() != constants.LANGUAGE.ZH_CN) {httpArr = [p1];}Promise.all(httpArr).then(res => {parseAssociatedDoc(res);}).catch(() => {turnPageByLookUp(toolsBarObject.sidebarList[0].linkUrl);});}function parseAssociatedDoc(res) {if (getCurrentLanguage() === constants.LANGUAGE.ZH_CN) {if (res[1].data && res[1].data.length) {res[1].data.forEach((item, index) => {item.email = '点击获取邮箱';item.itemIndex = index;item.emailStyle = false;});}}if (!res[0]) {turnPageByLookUp(toolsBarObject.sidebarList[0].linkUrl);return;}if (res[0].faqList.length == 0 && res[0].instructionInfoList.length == 0) {toolsBarObject.isFaq = true;if (isHomeOrWorkView()) {toolsBarObject.isShowList = 0;$('.i-help-shunt').css('display', 'block');if (isChina()) {$('.i-help-shunt .cn-business-entery').css('display', 'flex');}$('.i-help-shunt').on('click', '.icon-close', function (e) {$('.i-help-shunt').css('display', 'none');});return;}if (!isChina()) {turnPageByLookUp(toolsBarObject.sidebarList[0].linkUrl);return;}toolsBarObject.isShowList = 1;$('#help_container_list').addClass('help_container_list');$('#help_container_list').html('IT在线帮助
业务接口人
');return;}toolsBarObject.isFaq = true;toolsBarObject.isShowList = 2;showBusinessList();toolsBarObject.showBusiness = false;$('#business-list-help-container').removeClass('more-width');toolsBarObject.dowloadNum = 0;toolsBarObject.searchData = res[0].data;}function iHelpClick(e) {let { curTop, curLeft } = sessionStorage['ePartnerToolsPosition'] ? JSON.parse(sessionStorage['ePartnerToolsPosition']) : {};if (isToolsDrag(curTop, curLeft)) {return;}const index = e.currentTarget.dataset?.index;const obj = toolsBarObject.sidebarList[index];if (!obj) {return;}if (index.toString() === '0' && isLogin() && (isAssociatedCompany() || isHW())) {getAssociatedDoc();return;}if (obj.uemPageCode) {window.hwa && window.hwa('trackPageView', obj.uemPageCode);}if (obj.linkUrl) {const href = new originCnReplace().replaceSingeOrigin(obj.linkUrl);checkUrl(href);} else {toolsBarObject.sidebarList.map((item, i) => {if (i === index) {obj.flag = true;} else {obj.flag = false;}return item;});initIHelpHtml();}}function openToolsPage(toolUrl) {if (toolUrl.indexOf('pvmvc#/create-task') > -1) {window.location.href = toolUrl;} else {window.open(toolUrl);}}function checkUrl(url) {try {const urlObject = new URL(url);if (urlObject.host.indexOf('huawei') > -1) {openToolsPage(url);} else {createUrlConfirmDialog(url);}} catch (e) {openToolsPage(url);}}function createUrlConfirmDialog(url) {const dialog = document.createElement('dialog');dialog.className = 'epartner-dialog p-dialog url-confirm-dialog';document.body.append(dialog);const tipsHeader = document.createElement('div');tipsHeader.className = 'epartner-dialog-header p-dialog__header p-dialog__title';const dialogTitle = document.createElement('div');const icon = document.createElement('span');icon.className = 'icon-warn';icon.innerHTML = '!';dialogTitle.append(icon);dialogTitle.append('Tips');tipsHeader.append(dialogTitle);dialog.append(tipsHeader);const content = document.createElement('div');content.className = 'epartner-dialog-content p-dialog__body small-scrollbar popup-content';content.innerHTML = `The URL to which the tool is redirected is not a Huawei domain name, which may cause security risks. Are you sure you want to continue?
`;dialog.append(content);const operateRow = document.createElement('div');operateRow.className = 'epartner-dialog-opt-row p-dialog__footer p-button-group';dialog.append(operateRow);const okBtn = document.createElement('button');okBtn.className = 'p-button p-button--primary is-plain';okBtn.innerHTML = 'OK';operateRow.append(okBtn);const cancelBtn = document.createElement('button');cancelBtn.className = 'p-button p-button--default';cancelBtn.innerText = 'Cancel';operateRow.append(cancelBtn);createEvents({ cancelBtn, signBtn: okBtn, dialog, header: tipsHeader, body: content, url });}function createEvents({ cancelBtn, signBtn, dialog, header, body, url }) {dialog.showModal();$(body).scrollTop(0);const closeEnDialog = () => {dialog.className = 'epartner-dialog p-dialog url-confirm-dialog close';setTimeout(() => {dialog.close();dialog.removeEventListener('mousedown', startDrag);}, 300);};const startDrag = dialogDragging({ $dialog: dialog, $header: header, closeDialog: closeEnDialog });dialog.addEventListener('mousedown', startDrag);$(cancelBtn).off('click');$(cancelBtn).on('click', () => {closeEnDialog();});$(signBtn).off('click');$(signBtn).on('click', () => {openToolsPage(url);closeEnDialog();});}function changeStyle(e) {const index = e.currentTarget.dataset?.index;const obj = toolsBarObject.sidebarList[index];if (!obj) {return;}const setImgUrl = url => new originCnReplace().replaceSingeOrigin(url);if (!obj.flag) {if (obj.defaultImagePath.indexOf('.gif') === -1) {$(e.currentTarget).find('.bar-item-container img').prop('src', setImgUrl(obj.hoverImagePath));$(e.currentTarget).addClass('float-bar__list__li_color');}} else {$(e.currentTarget).find('.bar-item-container img').prop('src', setImgUrl(obj.defaultImagePath));$(e.currentTarget).removeClass('float-bar__list__li_color');}toolsBarObject.sidebarList[index].flag = !toolsBarObject.sidebarList[index].flag;}function initIHelpHtml() {let html = '';toolsBarObject.sidebarList.forEach((item, index) => {html += ``;html += '';html += `
`;html += `
${item.buttonName}
`;html += '
';html += ' ';});const htmlSrc = new originCnReplace().replaceOriginRichtext(html);$('.partner-drag-drop-tools .ihelp-list').html(htmlSrc);}function setHelpData(res) {const maxShowSize = 5;const defaultShowSize = 3;if (!res.length && isLogin()) {$('.float-bar__list').remove();}if (!isAssociatedCompany() && !isHW() && isLogin()) {const listNotAssociate = res.filter(item => {return item.buttonName === 'Guide' || item.buttonName === '帮助';});toolsBarObject.sidebarSubList = listNotAssociate;$('.exp').css('display', 'none');} else if (res.length > maxShowSize) {$('.exp').css('display', 'block');toolsBarObject.sidebarSubList = res.slice(0, defaultShowSize);$('.exp').off('click');$('.partner-drag-drop-tools .ihelp-list').removeClass('no-last-border');$('.exp').on('click', () => {if ($('.float-bar__list').hasClass('float-bar__list-show')) {$('.float-bar').removeClass('float-bar_all');$('.float-bar__list').removeClass('float-bar__list-show');toolsBarObject.sidebarList = toolsBarObject.sidebarSubList;$('.exp').removeClass('translate');} else {toolsBarObject.sidebarList = toolsBarObject.allSidebarList;$('.float-bar').addClass('float-bar_all');$('.float-bar__list').addClass('float-bar__list-show');$('.exp').addClass('translate');}initIHelpHtml();});} else {toolsBarObject.sidebarSubList = res;$('.partner-drag-drop-tools .ihelp-list').addClass('no-last-border');$('.exp').css('display', 'none');}toolsBarObject.sidebarList = toolsBarObject.sidebarSubList;toolsBarObject.allSidebarList = res;initIHelpHtml();$('.partner-drag-drop-tools .ihelp-list').on('click', '.float-bar__list__li', function (e) {iHelpClick(e);});$('.partner-drag-drop-tools .ihelp-list').on('mouseover', '.float-bar__list__li', function (e) {changeStyle(e);});$('.partner-drag-drop-tools .ihelp-list').on('mouseout', '.float-bar__list__li', function (e) {changeStyle(e);});}function getHelp(website) {let origin = window.location.origin;let com = origin.substring(origin.lastIndexOf('.') + 1, origin.length);let data = {buttonName: '在线支持',defaultImagePath: IS_DEVELOPMENT? 'https://partnersit.beta.huawei.com/partnercloud/epartner/assets/image/support.png': `${getS3BaseUrl()}/image/support.png`,hoverImagePath: IS_DEVELOPMENT? 'https://partnersit.beta.huawei.com/partnercloud/epartner/assets/image/support.png': `${getS3BaseUrl()}/image/support.png`,linkUrl: `https://app.huawei.${com}/ihelp/icsclientC60/index.do?appId=M000735&page_category=`,};if (website == 2) {data.buttonName = 'Help';}return data;}function findHelpSidebarList() {const website = isChina() ? 1 : 2;$.ajax({type: 'GET',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/pub/public/findHelpSidebarList?website=${website}&sidebarVersion=V2`,success: function (res) {const data = res || [];if (isLogin()) {data.unshift(getHelp(website));}if (data.length == 0) {$('.partner-drag-drop-tools').css('display', 'none');} else {$('.partner-drag-drop-tools').css('display', 'block');}setHelpData(data);},error: function () {setHelpData([getHelp(website)]);},});}const data = {topnav: {menuTextpc: '选择区域/语言',menuTextmb: '语言',language: [{text: '简体中文',href: '',targetBlank: false,active: false,language: 'zh_CN',},{text: 'English',href: '',targetBlank: false,active: true,language: 'en_US',},{text: '日本語',href: '',targetBlank: false,active: false,language: 'ja_JP',},{text: 'Русский',href: '',targetBlank: false,active: false,language: 'ru_RU',},{text: 'Português',href: '',targetBlank: false,active: false,language: 'pt_BR',},{text: 'español',href: '',targetBlank: false,active: false,language: 'es_MX',},],leftMenuTitle: 'Enterprise',contactList: [{id: 1,text: {zh_CN: '企业业务网站',en_US: 'Enterprise',ja_JP: '法人向け製品',ru_RU: 'Для предприятий',es_MX: 'Negócios',pt_BR: 'Los negocios',},subText: {zh_CN: '企业商用产品、解决方案和云服务',en_US: 'Enterprise products, solutions & services',ja_JP: '企業ユーザー向け製品、ソリューション、サービス',ru_RU: 'Продукты, решения и услуги для предприятий',es_MX: 'Produtos, soluções and serviços para negócios',pt_BR: 'Productos, soluciones and servicios para los negocios',},href: {zh_CN: 'https://e.huawei.com/cn/',en_US: 'https://e.huawei.com/en/',ja_JP: 'https://e.huawei.com/jp/',ru_RU: 'https://e.huawei.com/kz/',es_MX: 'https://e.huawei.com/es/',pt_BR: 'https://e.huawei.com/br/',},},{id: 2,text: {zh_CN: '华为云网站',en_US: 'Huawei Cloud',ja_JP: 'コンシューマー向け製品',ru_RU: 'Интернет-магазин',es_MX: 'Huawei Cloud',pt_BR: 'Portadores',},subText: {zh_CN: '华为云服务及解决方案',en_US: 'Cloud products, solutions & services',ja_JP: '携帯電話、PC、タブレット、ウェアラブルなどの個人用および家庭用製品',ru_RU: 'Смартфоны, ПК и планшеты, носимые устройства и многое другое',es_MX: 'Cloud products, solutions & services',pt_BR: 'Productos, soluciones and servicios para portadores',},href: {zh_CN: 'https://www.huaweicloud.com/',en_US: 'https://www.huaweicloud.com/',ja_JP: 'https://consumer.huawei.com/jp/',ru_RU: 'https://consumer.huawei.com/ru/',es_MX: 'https://carrier.huawei.com/en',pt_BR: 'https://www.huaweicloud.com/intl/pt-br/',},},{id: 3,text: {zh_CN: '运营商网络业务网站',en_US: 'Carrier',ja_JP: 'コーポレート',ru_RU: 'Сайт Huawei Россия',es_MX: 'Transportadores',pt_BR: 'Personal',},subText: {zh_CN: '运营商网络解决方案、产品及服务',en_US: 'Products, Solutions and Services for Carrier',ja_JP: '会社紹介、ニュース&展示会の活動など',ru_RU: 'О компании Huawei, пресса, события и многое другое',es_MX: 'Produtos, soluções and serviços paratransportadores',pt_BR: 'Teléfonos, PC y Tablets, Wearables y más',},href: {zh_CN: 'https://carrier.huawei.com/cn/',en_US: 'https://carrier.huawei.com/en',ja_JP: 'https://www.huawei.com/jp',ru_RU: 'https://www.huawei.com/ru',es_MX: 'https://consumer.huawei.com/es/',pt_BR: 'https://carrier.huawei.com/en',},},{id: 4,text: {zh_CN: '消费者业务网站',en_US: 'Consumer',ja_JP: '通信事業者向け製品',ru_RU: 'Для операторов',es_MX: 'Pessoal',pt_BR: 'Corporativo',},subText: {zh_CN: '手机,PC和平板等智慧生活产品',en_US: 'Phones, laptops, tablets, wearables & other devices',ja_JP: '通信機器、ソリューションおよびサービス',ru_RU: 'Продукты, решения и услуги для операторов',es_MX: 'Celulares, Computadores e Tablets, Utensílios e mais',pt_BR: 'Acerca de HUAWEI, Prensa & Eventos , y más',},href: {zh_CN: 'https://consumer.huawei.com/cn/',en_US: 'https://consumer.huawei.com/en/',ja_JP: 'https://carrier.huawei.com/jp',ru_RU: 'https://carrier.huawei.com/en',es_MX: 'https://www.huawei.com/es',pt_BR: 'https://consumer.huawei.com/br/',},},{id: 5,text: {zh_CN: '集团网站',en_US: 'Corporate',ja_JP: '',ru_RU: '',es_MX: 'Corporativo',pt_BR: '',},subText: {zh_CN: '公司介绍、新闻动态、展会活动等信息',en_US: 'About Huawei, Press & Events , and More',ja_JP: '',ru_RU: '',es_MX: 'Sobre a Huawei , Imprensa e Eventos , e mais',pt_BR: '',},href: {zh_CN: 'https://www.huawei.com/cn',en_US: 'https://www.huawei.com/en',ja_JP: '',ru_RU: '/',es_MX: '/',pt_BR: 'https://www.huawei.com/en',},},],},logo: {href: 'https://std.crm.saas.huawei.com/pep/page/metacrm.huawei.com/index.html',targetBlank: true,},menus: [],};const DELAY_TIME = 300;const newMenuBtnMap = {'Products and Solutions': [{label: 'New Products',url: 'https://e.huawei.com/en/products-and-solutions/new-products',icon: '#iconForwarding svg',iconClass: 'scale-80 icon-red',},{ label: 'All Products and Solutions', url: 'https://e.huawei.com/en/products-and-solutions', icon: '#iconDown svg', iconClass: 'rotate--90 icon-red' },{ label: 'Resource Center', url: 'https://e.huawei.com/en/resource/material-center', icon: '#iconDown svg', iconClass: 'rotate--90 icon-red' },],'Learning and Tech Support': [{ label: 'Technical Support Home', url: 'https://support.huawei.com/enterprise/en/index.html', icon: '#iconForwarding svg', iconClass: 'scale-80' },{ label: 'Community', url: 'https://forum.huawei.com/enterprise/en/index.html', icon: '#iconForwarding svg', iconClass: 'scale-80' },],Partners: [{ label: 'Partner Home', url: 'https://partner.huawei.com/eplusmeta/en/web/worldwide.html', icon: '#iconForwarding svg', iconClass: 'scale-80' },],'How to Buy': [{ label: 'How to Buy', url: 'https://e.huawei.com/en/how-to-buy', icon: '#iconDown svg', iconClass: 'scale-80' }],};const level2MenuBtnMap = {'Ask the Chatbot': [{label: 'Ask Now',url: 'https://weiknow.gts.huawei.com/weiknow/#/question?locale=en_US&lang=en&source=Enterprise',icon: '#iconDown svg',iconClass: 'rotate--90 icon-red',},],'Contact Huawei Sales': [{label: 'Get in Touch',url: 'https://e.huawei.com/en/how-to-buy/get-price-info?source_website=01MHQHQ257U903L',icon: '#iconDown svg',iconClass: 'rotate--90 icon-red',},],'Find a Reseller': [{ label: 'Find a Reseller', url: 'https://partner.huawei.com/eplus/#/aui/en/web/findpartner', icon: '#iconDown svg', iconClass: 'rotate--90 icon-red' },],};function showLevel1MenuFlag(item) {return item.items && item.items.length > 0;}function showLevel2MenuFlag(item) {return item.hasPermission && item.items && item.items.length > 0;}function showLevel3MenuFlag(item) {return item.hasPermission || item.isLock !== null;}const LANG_DESC = {zh_CN: 'china',ja_JP: 'japan',ru_RU: 'russia',en_US: 'worldwide',es_MX: 'spanish',pt_BR: 'portuguesebr',};const epartnerPageTopNav = function ({ loginFlag }) {this.$container = $('#epartnerPageTopNav');this.loginFlag = loginFlag;this.data = data;};epartnerPageTopNav.prototype.init = function () {this.$container.find('#navLeftMenuTitle').text(this.data.topnav.leftMenuTitle);this.createMenuList();this.createMobile();this.registerEvents();};epartnerPageTopNav.prototype.createMenuList = function () {const $ul = document.createElement('ul');const contactList = this.data.topnav.contactList;for (let i = 0; i < contactList.length; i++) {const item = contactList[i];const $li = document.createElement('li');const $menuHead = document.createElement('div');$menuHead.className = 'menu-row';const $linkHead = document.createElement('a');$($linkHead).attr({href: new originCnReplace().replaceSingeOrigin(item.href.en_US),target: '_blank',class: 'menu-title',rel: 'noopener noreferrer',});$linkHead.innerHTML = `${item.text.en_US} `;$menuHead.append($linkHead);$li.append($menuHead);const $menuContent = document.createElement('div');$menuContent.className = 'menu-row';const $linkContent = document.createElement('a');$($linkContent).attr({href: new originCnReplace().replaceSingeOrigin(item.href.en_US),target: '_blank',class: 'menu-comment',rel: 'noopener noreferrer',});$linkContent.innerText = item.subText.en_US;$menuContent.append($linkContent);$li.append($menuContent);$ul.append($li);}this.$container.find('.epartner-home-topnav-menu').append($ul);};epartnerPageTopNav.prototype.registerEvents = function () {const $icon = $('.epartner-home-topnav-left').find('.icon-right');const $menu = $('.epartner-home-topnav-menu');$('.epartner-home-topnav-left').on('click', function () {const openClassName = 'icon-right-to-up';const closeClassName = 'icon-right-to-down';const isExpand = $icon.hasClass(openClassName);if (isExpand) {$icon.removeClass(openClassName).addClass(closeClassName);$menu.slideUp();} else {$icon.removeClass(closeClassName).addClass(openClassName);$menu.slideDown();}});$('.epartner-home-menu-right').on('click', '.log-in', () => {goUniPortalLogin(getHomeUrl());}).on('click', '.log-out', () => {logOut();});$('#epartnerOSMobileMenuContent').on('click', 'button.m-menu-logout-btn', () => {logOut();});};epartnerPageTopNav.prototype.createMobile = function () {const $footer = $('.epartner-m-menu-footer');const $langMenu = $('#epartnerOSMobLangMenu');$('#epartnerOSMobQuickMenuTitle').html(`${this.data.topnav.leftMenuTitle} `);$footer.on('click', '#epartnerOSMobQuickMenuTitle', () => {$('#epartnerOSMobQuickMenuTitle').toggleClass('active');$('#epartnerOSMobQuickMenu').toggle();$('#epartnerOSMobLangMenuTitle').removeClass('active');$('#epartnerOSMobLangMenu').hide();});if (this.loginFlag) {$('#epartnerPageMenu').find('.log-out').addClass('show');} else {$('#epartnerPageMenu').find('.log-in').addClass('show');}const $quickMenu = $('#epartnerOSMobQuickMenu');const contactList = this.data.topnav.contactList;for (let i = 0; i < contactList.length; i++) {const item = contactList[i];const $item = document.createElement('a');$($item).attr({ href: new originCnReplace().replaceSingeOrigin(item.href.en_US), target: '_blank', class: 'menu-title', rel: 'noopener noreferrer' });const $menuHead = document.createElement('div');$menuHead.className = 'menu-header';$menuHead.innerHTML = `${item.text.en_US} `;if (i > 0) {$menuHead.innerHTML += ' ';}$item.append($menuHead);const $menuContent = document.createElement('div');$menuContent.className = 'menu-row';$menuContent.innerText = item.subText.en_US;$item.append($menuContent);$quickMenu.append($item);}const $ul = document.createElement('ul');const langList = this.data.topnav.language;for (let i = 0; i < langList.length; i++) {const $li = document.createElement('li');const langItem = langList[i];$($li).attr({ 'data-lang': langItem.language });if (langItem.language === getCurrentLanguage()) {$li.innerHTML = `${langItem.text} 🗸 `;} else {$li.innerText = langItem.text;}$ul.append($li);}$langMenu.append($ul);$('#epartnerOSMobLangMenuTitle').on('click', () => {$('#epartnerOSMobLangMenuTitle').toggleClass('active');$('#epartnerOSMobLangMenu').toggle();$('#epartnerOSMobQuickMenuTitle').removeClass('active');$('#epartnerOSMobQuickMenu').hide();});$('#epartnerOSMobLangMenu').on('click', 'li', e => {const currentLang = $(e.target).closest('li').data('lang');if (currentLang === getCurrentLanguage()) {return;}const link = isHomeLink(currentLang);window.location.href = new originCnReplace().replaceSingeOrigin(link);});};function setMenuData(item1) {if (!item1.items || item1.items.length <= 0) {return;}item1.items.forEach(item2 => {let newArr = [];item2.children = [];item2.levelTwo = true;item2.items &&item2.items.length &&item2.items.forEach(item3 => {item3.levelThree = true;if (!item3.hasPermission && !item3.isLock) {newArr.push(item3);}});if (item2.items && newArr.length === item2.items.length) {item2.hasPermission = false;}});}function menuDataReplaceUrl(res) {if (window.location.hostname.indexOf('localhost.huawei.com') > -1) {this.menuData = res;} else {let dataStr = JSON.stringify(res);this.menuData = JSON.parse(new originCnReplace().replaceOriginRichtext(dataStr));}}const epartnerPageMenuHorizontal = function ({ loginFlag }) {this.$container = $('#epartnerPageMenu');this.loginFlag = loginFlag;this.cssSuffix = loginFlag ? 'login' : 'unlogin';this.data = [];this.mobileMenuPath = [];if (loginFlag) {this.userAccount = getCurrentUserInfo().userAccount;}this.language = getCurrentLanguage();this.newStyle = false;};epartnerPageMenuHorizontal.prototype.init = async function () {const isAssociated = sessionStorage.getItem('epartner-is-associated') === 'true';let res = {};if (this.loginFlag && isHW()) {res = await this.getMenuListByAuth();} else if (this.loginFlag && !isAssociated) {res = await this.findOfficialWebsiteList();} else {res = await this.findOfficialWebsiteList();}if (isHW()) {this.getResData(res);this.loadMenu(res);} else {this.loadEOfficialWebsite(res);}};epartnerPageMenuHorizontal.prototype.loadMenu = function (res) {this.data = res.menuData || res.menuDataList;new epartnerPageMenuVertical({ loginFlag: this.loginFlag, data: res.menuData || res.menuDataList, newStyle: this.newStyle }).init();this.createLevel1Menu();this.createMobileContent();this.createMobileEvents();res.luBanlogoOutURL && sessionStorage.setItem('epartner-logout-url', replaceOrigin(res.luBanlogoOutURL, '.huawei.com'));res.luBanHomeURL && sessionStorage.setItem('epartner-home-url', replaceOrigin(res.luBanHomeURL, '.huawei.com'));this.createEvents();};epartnerPageMenuHorizontal.prototype.getV2MenuListByAuth = function () {let params = {languageId: this.language,description: LANG_DESC[this.language],};return new Promise(resolve => {$.get(`${constants.COMMON_SERVICE}/common/v1/menu/getV2MenuListByAuth`, params, res => {this.parseV2MenuList(res);menuDataReplaceUrl(res);resolve(res);});});};epartnerPageMenuHorizontal.prototype.parseV2MenuList = function (res) {if (res.horizontalMenuList.length > 0) {res.menuData = res.horizontalMenuList;res.menuData.forEach(item1 => {item1.levelOne = true;item1.children = item1.items;setMenuData(item1);});}if (res.verticalMenuList.length > 0) {res.verticalMenuList.forEach(item1 => {item1.levelOne = true;item1.children = item1.items;setMenuData(item1);});}};epartnerPageMenuHorizontal.prototype.munuSwitchFlag = function () {const params = {classifyCode: 'home_page_switches',language: 'zh',};return new Promise(resolve => {$.get(`${constants.COMMON_SERVICE}/common/v1/public/queryLookupList`, params, res => {this.parseMenuSwitchFlag();resolve();});});};epartnerPageMenuHorizontal.prototype.parseMenuSwitchFlag = function (res) {if (!res || !res.data) {return;}res.data.forEach(ele => {if (ele.itemName == 'menuShow') {sessionStorage.setItem('munuSwitchFlag', ele.itemDesc);}});};epartnerPageMenuHorizontal.prototype.getMenuListByAuth = async function () {try {await this.munuSwitchFlag();} finally {const url = JSON.parse(sessionStorage.getItem('munuSwitchFlag'))? `${BASE_URL}${constants.E_PARTNER_SERVICE}/common/v1/menu/getMenuListByAuth`: `${BASE_URL}${constants.COMMON_SERVICE}/common/v1/menu/getMenuListByAuth`;return new Promise(resolve => {$.get(url,{languageId: this.language,description: LANG_DESC[this.language],},res => {resolve(res);});});}};epartnerPageMenuHorizontal.prototype.getCMSPublicMenu = function () {return new Promise(resolve => {$.get(`${BASE_URL}${constants.COMMON_SERVICE}/common/v1/menu/getCMSPublicMenu`,{languageId: this.language,description: LANG_DESC[this.language],},res => {resolve(res);});});};epartnerPageMenuHorizontal.prototype.findOfficialWebsiteList = function () {return new Promise(resolve => {$.get(`${BASE_URL}${constants.E_PARTNER_SERVICE}/public/official/findOfficialWebsiteList?languageId=${this.language}&description=${LANG_DESC[this.language]}`,{},res => {menuDataReplaceUrl(res);resolve(res);});});};epartnerPageMenuHorizontal.prototype.loadEOfficialWebsite = function (res) {this.data = res.menuDataList;new epartnerPageMenuVertical({loginFlag: this.loginFlag,data: res.menuDataList,newStyle: this.newStyle,}).init();this.createLevel1EOfficialMenu();this.createMobileEOfficialMenu({ children: this.data });this.createEOfficialMobileEvents();this.replaceHowToBuyIcon();res.luBanlogoOutURL && sessionStorage.setItem('epartner-logout-url', replaceOrigin(res.luBanlogoOutURL, '.huawei.com'));res.luBanHomeURL && sessionStorage.setItem('epartner-home-url', replaceOrigin(res.luBanHomeURL, '.huawei.com'));this.createEvents();};epartnerPageMenuHorizontal.prototype.replaceHowToBuyIcon = function (res) {const wrapper = $('.icon-wrapper');const $iconRight = this.cloneNodeByTemplate('#iconDown svg');wrapper.append($iconRight);const $wrapperRed = $('.icon-wrapper-red');const $iconRightRed = this.cloneNodeByTemplate('#iconDown svg', 'icon-red rotate-270');$wrapperRed.append($iconRightRed);const shoppingWrapper = $('.LiveChat');const $iconShopping = this.cloneNodeByTemplate('#iconShoppingCart svg');shoppingWrapper.append($iconShopping);};epartnerPageMenuHorizontal.prototype.createMobileEOfficialMenu = function (level1Data) {const $content = $('#epartnerOSMobileMenuContent');const $level1Wrapper = document.createElement('div');$level1Wrapper.className = 'epartner-m-new-menu-page';const $list = this.createEOfficialMenuList(level1Data, {ul: 'epartner-home-official-menu-level1 small-scrollbar',li: 'epartner-m-os-new-menu-level1-item',});$level1Wrapper.append($list);const $loginWrapper = this.createMobileEOfficialMenuFooterLogin();$level1Wrapper.append($loginWrapper);$content.append($level1Wrapper);$('.epartner-m-os-new-menu-level1-item').on('click', event => {const currentTargetId = event.currentTarget?.id;let level2Page = document.querySelector(`.epartner-m-os-new-menu-level2-page[data-parent='${currentTargetId}']`);if (!level2Page) {const data = this.data.find(v => String(v.id) === String(currentTargetId));this.createMobileEOfficialMenuLevel2(data);}$('.epartner-m-os-new-menu-level2-page,.epartner-m-new-menu-page').hide();$(`.epartner-m-os-new-menu-level2-page[data-parent='${currentTargetId}']`).show();});$('#epartnerOSMobileMenuContent').on('click', '.epartner-m-os-new-menu-level2-item', event => {$(event.currentTarget).siblings().find('.epartner-m-os-new-menu-level-item-wrapper svg').removeClass('rotate-180');$(event.currentTarget).siblings().find('.epartner-m-os-new-menu-level3-list').removeClass('flex');$(event.currentTarget).find('.epartner-m-os-new-menu-level3-list').toggleClass('flex');$(event.currentTarget).siblings().find('.epartner-m-os-menu-level2-btn').removeClass('flex');$(event.currentTarget).find('.epartner-m-os-menu-level2-btn').toggleClass('flex');$(event.currentTarget).find('>.epartner-m-os-new-menu-level-item-wrapper svg').toggleClass('rotate-180');$('.epartner-m-os-new-menu-level4-wrapper').removeClass('flex');});$('#epartnerOSMobileMenuContent').on('click', '.epartner-m-os-new-menu-level3-item', event => {event.stopPropagation();$(event.currentTarget).siblings().find('.epartner-m-os-new-menu-level-item-wrapper svg').removeClass('rotate-180');$(event.currentTarget).siblings().find('.epartner-m-os-new-menu-level4-wrapper').removeClass('flex');$(event.currentTarget).find('.epartner-m-os-new-menu-level4-wrapper').toggleClass('flex');$(event.currentTarget).find('>.epartner-m-os-new-menu-level-item-wrapper svg').toggleClass('rotate-180');});$('#epartnerOSMobileMenuContent').on('click', '.epartner-m-os-new-menu-level2-page .back', () => {$('.epartner-m-os-new-menu-level2-page').hide();$('.epartner-m-new-menu-page').show();});$('#epartnerOSMobileMenuContent').on('click', '.epartner-m-os-new-menu-level4-item', event => {event.stopPropagation();});$('.epartner-m-menu-header .m-menu-back').on('click', () => {$('#epartnerMobileMenu').hide();});return $content;};epartnerPageMenuHorizontal.prototype.createEOfficialMobileEvents = function (res) {const $blankBox = document.createElement('div');$blankBox.className = 'blank-box';$('#epartnerOSMobileMenu').append($blankBox);$('#epartnerOSMobileMenu>.epartner-m-menu-header').on('click', '.mobile-home-close', () => {$('#epartnerOSMobileMenu').hide();$('.epartner-m-os-new-menu-level2-page').hide();$('.epartner-m-new-menu-page').show();$('#epartnerOSMobLangMenuTitle').removeClass('active');$('#epartnerOSMobLangMenu').hide();$('#epartnerOSMobQuickMenuTitle').removeClass('active');$('#epartnerOSMobQuickMenu').hide();});$('#epartnerOSMobQuickMenu').on('click', '.m-menu-close', () => {$('#epartnerOSMobQuickMenuTitle').removeClass('active');$('#epartnerOSMobQuickMenu').hide();});$('#epartnerOSMobileMenu #epartnerOSMobLangMenu .epartner-m-menu-header').on('click', '.mobile-lang-close', () => {$('#epartnerOSMobLangMenuTitle').removeClass('active');$('#epartnerOSMobLangMenu').hide();});this.$container.on('click', '.epartner-home-menu-mobile', () => {$('#epartnerOSMobileMenu').show();$('.icon-yewu').off('click');$('.icon-diqiu2').off('click');$('.person-logIn').off('click');$('.person-logOut').off('click');$('.icon-yewu').on('click', () => {$('#epartnerOSMobLangMenuTitle').removeClass('active');$('#epartnerOSMobLangMenu').hide();$('#epartnerOSMobQuickMenuTitle').toggleClass('active');$('#epartnerOSMobQuickMenu').toggle();if ($('#epartnerOSMobQuickMenuTitle').hasClass('active') || $('#epartnerOSMobLangMenuTitle').hasClass('active')) {$('.epartner-m-menu-header').addClass('border-none');} else {$('.epartner-m-menu-header').removeClass('border-none');}});$('.person-logIn').on('click', () => {goUniPortalLogin(getHomeUrl());});$('.icon-diqiu2').on('click', () => {this.menuSwitch();});$('.person-logOut').on('click', () => {logOut();});});};epartnerPageTopNav.prototype.menuSwitch = function () {$('#epartnerOSMobLangMenuTitle').toggleClass('active');$('#epartnerOSMobLangMenu').toggle();$('#epartnerOSMobQuickMenuTitle').removeClass('active');$('#epartnerOSMobQuickMenu').hide();if ($('#epartnerOSMobQuickMenuTitle').hasClass('active') || $('#epartnerOSMobLangMenuTitle').hasClass('active')) {$('.epartner-m-menu-header').addClass('border-none');} else {$('.epartner-m-menu-header').removeClass('border-none');}};epartnerPageMenuHorizontal.prototype.menuSwitch = epartnerPageTopNav.prototype.menuSwitch;epartnerPageMenuHorizontal.prototype.createMobileEOfficialMenuLevel2 = function (level1Item) {const $content = $('#epartnerOSMobileMenuContent');const $level2Page = document.createElement('div');$level2Page.className = 'epartner-m-os-new-menu-level2-page small-scrollbar';if (level1Item.id) {$level2Page.setAttribute('data-parent', level1Item.id);}const $header = this.createMobileEOfficialMenuLevel2Header(level1Item);const $level2Content = document.createElement('div');$level2Content.className = 'epartner-m-os-new-menu-level2-content';const $level2MenuWrapper = document.createElement('div');$level2Title = document.createElement('h3');$level2Title.className = 'title';$level2Title.innerText = level1Item.name;const $level2List = this.createEOfficialMenuList(level1Item,{ul: 'epartner-m-os-new-menu-level2-list',li: 'epartner-m-os-new-menu-level2-item',parentId: level1Item.id,},this.createEOfficialMenuList,{ul: 'epartner-m-os-new-menu-level3-list',li: 'epartner-m-os-new-menu-level3-item',});$level2MenuWrapper.append($level2Title);$level2MenuWrapper.append($level2List);$level2Content.append($level2MenuWrapper);const $btnWrapper = this.createMobileEOfficialMenuMoreBtn(level1Item.name);if ($btnWrapper) {$level2Content.append($btnWrapper);}$level2Page.append($header);$level2Page.append($level2Content);$content.append($level2Page);};epartnerPageMenuHorizontal.prototype.createMobileEOfficialMenuMoreBtn = function (name) {const btns = newMenuBtnMap[name];if (!btns) return;const $btnWrapper = document.createElement('div');$btnWrapper.className = 'epartner-m-os-new-menu-level2-more-btn';for (let i = 0; i < btns.length; i++) {const item = btns[i];const $btn = document.createElement('button');const link = document.createElement('a');link.setAttribute('target', '_blank');link.setAttribute('href', new originCnReplace().replaceSingeOrigin(item.url));link.setAttribute('ref', 'noopener noreferrer');link.innerText = item.label;const $icon = this.cloneNodeByTemplate(item.icon, `${item.iconClass} icon-gray`);link.append($icon);$btn.append(link);$btnWrapper.append($btn);}return $btnWrapper;};epartnerPageMenuHorizontal.prototype.createMobileEOfficialMenuLevel2Header = function (level1Item) {const $header = document.createElement('header');$header.className = 'header back';const $icon = this.cloneNodeByTemplate('#iconDown svg', 'rotate-90');const $title = document.createElement('h3');$title.innerText = 'Back Menu';$header.append($icon);$header.append($title);return $header;};epartnerPageMenuHorizontal.prototype.createMobileEOfficialMenuFooterLogin = function () {const $heaMobBtns = document.createElement('div');$heaMobBtns.className = 'hea-mob-btns';const $wapFirst = document.createElement('div');$wapFirst.className = 'wap-first';const $eCisternl = document.createElement('div');$eCisternl.className = 'e-cistern-l';for (let i = 0; i < 3; i++) {const heaBtn = document.createElement('div');heaBtn.className = 'hea-btn';const $iconYewu = document.createElement('span');$iconYewu.className = 'iconfont icon-yewu';const $pDom = document.createElement('p');if (i === 0) {$pDom.innerText = 'Enterprise';$iconYewu.className = 'iconfont icon-yewu';} else if (i === 1) {$pDom.innerText = 'Worldwide';$iconYewu.className = 'iconfont icon-diqiu2';} else if (i === 2) {$pDom.innerText = this.loginFlag ? 'Logout' : 'Login';$iconYewu.className = this.loginFlag ? 'iconfont person-logOut icon-denglu' : 'iconfont person-logIn icon-denglu';}heaBtn.append($iconYewu);heaBtn.append($pDom);$heaMobBtns.append(heaBtn);}$eCisternl.append($heaMobBtns);return $eCisternl;};epartnerPageMenuHorizontal.prototype.createEOfficialMenuList = function (data, classMap, generateChildrenMethod, childrenClassMap) {const list = data.children || [];const $list = document.createElement('ul');$list.className = classMap['ul'];if (data.title === 'How to Buy') {$list.className += ' how-to-buy';}for (let i = 0; i < list.length; i++) {const item = list[i];const $level = document.createElement('li');$level.className = classMap['li'];if (item.id) {$level.setAttribute('id', item.id);}const $wrapper = document.createElement('div');$wrapper.className = 'epartner-m-os-new-menu-level-item-wrapper';this.createMenuItem($wrapper, item);$level.append($wrapper);if (item.children && item.children.length && generateChildrenMethod) {const $children = generateChildrenMethod.call(this, item, childrenClassMap, this.createMobileEOfficialMenuLevel4);$level.append($children);const homeBtns = this.addMobileLevel2HomeBtn(data, item, $children);homeBtns && $level.append(homeBtns);}$list.append($level);}return $list;};epartnerPageMenuHorizontal.prototype.addMobileLevel2HomeBtn = function (parentData, curData, dom) {if (dom.className.indexOf('') === -1 || parentData.title !== 'How to Buy') {return '';}const btnList = level2MenuBtnMap[curData.title];const btnDom = document.createElement('div');btnDom.className = 'epartner-m-os-menu-level2-btn';for (let i = 0; i < btnList.length; i++) {const item = btnList[i];const $link = document.createElement('a');$link.innerText = `${item.label} Home`;$link.setAttribute('href', new originCnReplace().replaceSingeOrigin(item.url));$link.setAttribute('target', '_blank');$link.setAttribute('ref', 'noopener noreferrer');$link.className = 'forwarding-home';const $icon = this.cloneNodeByTemplate('#iconDown svg', 'rotate--90 icon-red');$link.append($icon);btnDom.append($link);}return btnDom;};epartnerPageMenuHorizontal.prototype.createMobileEOfficialMenuLevel4 = function (data) {const list = data.children || [];const $content = document.createElement('div');$content.className = 'epartner-m-os-new-menu-level4-wrapper';const $levelList = document.createElement('ul');$levelList.className = 'epartner-m-os-new-menu-level4-list small-scrollbar';for (let i = 0; i < list.length; i++) {const item = list[i];const level4 = document.createElement('li');level4.className = 'epartner-m-os-new-menu-level4-item';const $p = document.createElement('p');const $link = document.createElement('a');$link.setAttribute('href', new originCnReplace().replaceSingeOrigin(item.url));$link.innerText = item.name;$p.append($link);level4.append($p);$levelList.append(level4);}$content.append($levelList);if (data.url) {const $link = document.createElement('a');$link.innerText = `${data.name} Home`;$link.setAttribute('href', new originCnReplace().replaceSingeOrigin(data.url));$link.className = 'forwarding-home';const $icon = this.cloneNodeByTemplate('#iconDown svg', 'rotate--90 icon-red');$link.append($icon);$content.append($link);}return $content;};epartnerPageMenuHorizontal.prototype.createMenuItem = function ($wrapper, item) {const setText = text => {const $text = document.createElement('span');$text.innerText = text;$wrapper.append($text);};if (item.children && item.children.length) {setText(item.name);const $icon = this.cloneNodeByTemplate('#iconDown svg');$wrapper.append($icon);} else if (item.url) {const link = document.createElement('a');link.setAttribute('href', new originCnReplace().replaceSingeOrigin(item.url));link.innerText = item.name;$wrapper.append(link);} else {setText(item.name);}return $wrapper;};epartnerPageMenuHorizontal.prototype.createLevel1EOfficialMenu = function () {$('.e-cistern-buy .level-one-li').on('click', e => {$(e.currentTarget).find('svg').toggleClass('rotate-180');$(e.currentTarget).siblings().find('.wap-item-list2').removeClass('showDom');$(e.currentTarget).find('.wap-item-list2').toggleClass('showDom');});$('.e-cistern-buy .e-link-box').on('click', e => {e.stopPropagation();});const $level1List = document.createElement('div');$level1List.className = 'epartner-home-official-menu flex-x-center';const $level2Wrapper = document.createElement('div');$level2Wrapper.className = 'epartner-home-official-menu-level1-wrapper';for (let i = 0; i < this.data.length; i++) {const item = this.data[i];const $level1 = document.createElement('div');$level1.className = `epartner-home-official-menu-level1 hand-cursor`;const $a = document.createElement('a');$a.className = 'epartner-home-official-menu-level1-link';$a.innerText = item.title;if (item.link) {$($a).attr({href: new originCnReplace().replaceSingeOrigin(item.link),target: item.targetBlank ? '_blank' : '_self',rel: item.targetBlank ? 'noopener noreferrer' : '',});}$level1.append($a);$level2Wrapper.append(this.createNewLevel2Menu(item));$level1List.append($level1);}const $level2Mask = document.createElement('div');$level2Mask.className = 'epartner-home-official-menu-level1-mask';$('#epartnerPageMenuNav').append($level2Wrapper);$('#epartnerPageMenuNav').append($level2Mask);$('#epartnerPageMenuNav').append($level1List);};epartnerPageMenuHorizontal.prototype.createNewLevel2Menu = function (level1Data) {const $level2Content = document.createElement('div');$level2Content.className = 'epartner-home-official-menu-level1-content';$level2List = document.createElement('div');$level2List.className = 'epartner-home-official-menu-level1-list';for (let i = 0; level1Data.children && level1Data.children.length && i < level1Data.children.length; i++) {const item = level1Data.children[i];const $level2 = document.createElement('div');const isPanelStyle = this.EOfficialMenuIsPanelStyle(item);const extraClass = isPanelStyle ? 'panel-bg' : 'common-bg';$level2.className = `epartner-home-official-menu-level2 ${extraClass}`;const $title = this.createEOfficialMenuTitle(item);$level2.append($title);let $level3 = isPanelStyle ? this.createNewPanelLevel3Menu(item) : this.createNewCommonLevel3Menu(item);$level2.append($level3);if (level1Data.title === 'How to Buy') {$level2.className += ' how-to-buy-pc';const level2Btns = this.createLevel2Btn(item.name);level2Btns && $level2.append(level2Btns);}$level2List.append($level2);}$level2Content.append($level2List);const $btns = this.EOfficialMenuMoreBtn(level1Data.name);$btns && $level2Content.append($btns);return $level2Content;};epartnerPageMenuHorizontal.prototype.createLevel2Btn = function (name) {const btnList = level2MenuBtnMap[name];if (!btnList) return null;const $btnWrapper = document.createElement('div');$btnWrapper.className = 'epartner-home-official-menu-more-btn-wrapper epartner-horizontal-level2-menu-more-btn-wrapper';for (let i = 0; i < btnList.length; i++) {const item = btnList[i];const btnDom = document.createElement('div');btnDom.className = 'btn';const linkDom = document.createElement('a');linkDom.setAttribute('href', new originCnReplace().replaceSingeOrigin(item.url));linkDom.setAttribute('target', '_blank');linkDom.setAttribute('ref', 'noopener noreferrer');const $text = document.createElement('span');$text.innerText = item.label;const $icon = this.cloneNodeByTemplate(item.icon, `${item.iconClass} icon-red`);linkDom.append($text);linkDom.append($icon);btnDom.append(linkDom);$btnWrapper.append(btnDom);}return $btnWrapper;};epartnerPageMenuHorizontal.prototype.EOfficialMenuMoreBtn = function (name) {const btns = newMenuBtnMap[name];if (!btns) return null;const $btnWrapper = document.createElement('div');$btnWrapper.className = 'epartner-home-official-menu-more-btn-wrapper';for (let i = 0; i < btns.length; i++) {const item = btns[i];const $btn = document.createElement('div');$btn.className = 'btn';const link = document.createElement('a');link.setAttribute('href', new originCnReplace().replaceSingeOrigin(item.url));link.setAttribute('target', '_blank');link.setAttribute('ref', 'noopener noreferrer');const $text = document.createElement('span');$text.innerText = item.label;const $icon = this.cloneNodeByTemplate(item.icon, `${item.iconClass} icon-red`);link.append($text);link.append($icon);$btn.append(link);$btnWrapper.append($btn);}return $btnWrapper;};epartnerPageMenuHorizontal.prototype.cloneNodeByTemplate = function (selector, className) {const $template = document.querySelector(selector);const $dom = $template.cloneNode(true);if (className) {$dom.setAttribute('class', className);}return $dom;};epartnerPageMenuHorizontal.prototype.createNewCommonLevel3Menu = function (level2Data) {const $level3List = document.createElement('ul');const extraClass = level2Data?.children?.length > 9 ? 'flex-row flex-wrap' : 'flex-column';$level3List.className = `epartner-home-new-common-menu-level3-list ${extraClass}`;for (let i = 0; level2Data.children && level2Data.children.length && i < level2Data.children.length; i++) {const item = level2Data.children[i];const $level3 = document.createElement('li');$level3.className = 'epartner-home-new-common-menu-level3-item';if (i === 0) {$level3.className = `${$level3.className} active`;}const $content = document.createElement('a');if (item.url) {$content.setAttribute('href', new originCnReplace().replaceSingeOrigin(item.url));}$content.innerHTML = item.name;if (item.url) {$content.innerHTML += `Created with Pixso. `;}$level3.append($content);$level3List.append($level3);}return $level3List;};epartnerPageMenuHorizontal.prototype.createEOfficialMenuTitle = function (item) {const $title = document.createElement('h3');$title.className = 'epartner-header-new-menu-subtile';if (item.url) {const link = document.createElement('a');link.className = 'flex-v-center';link.setAttribute('href', new originCnReplace().replaceSingeOrigin(item.url));const $icon = this.cloneNodeByTemplate('#iconDown svg', 'icon-red rotate--90');link.append(item.name);link.append($icon);$title.append(link);} else {$title.innerHTML = item.name;}return $title;};epartnerPageMenuHorizontal.prototype.createNewPanelLevel3Menu = function (level2Data) {const level3List = document.createElement('ul');level3List.className = 'epartner-home-new-panel-menu-level3-list';for (let i = 0; level2Data.children && level2Data.children.length && i < level2Data.children.length; i++) {const item = level2Data.children[i];const level3 = document.createElement('li');level3.className = 'epartner-home-new-panel-menu-level3-item';if (i === 0) {level3.className = `${level3.className} active`;}const $content = document.createElement('p');$content.innerText = item.name;level3.append($content);level3.append(this.createNewPanelLevel4Menu(i, item));level3List.append(level3);}return level3List;};epartnerPageMenuHorizontal.prototype.createNewPanelLevel4Menu = function (index, level2Data) {const content = document.createElement('div');content.className = 'epartner-home-new-panel-menu-level4-wrapper';content.className = index === 0 ? `${content.className} flex` : content.className;const level4List = document.createElement('ul');level4List.className = 'epartner-home-new-panel-menu-level4-list';for (let i = 0; level2Data.children && level2Data.children.length && i < level2Data.children.length; i++) {const item = level2Data.children[i];const level4 = document.createElement('li');level4.className = 'epartner-home-new-panel-menu-level4-item';const $content = document.createElement('a');$content.setAttribute('href', new originCnReplace().replaceSingeOrigin(item.url));$content.innerText = item.name;level4.append($content);level4List.append(level4);}content.append(level4List);if (level2Data.url) {const link = document.createElement('a');link.innerText = `${level2Data.name} Home`;link.setAttribute('href', new originCnReplace().replaceSingeOrigin(level2Data.url));link.setAttribute('target', '_blank');link.setAttribute('ref', 'noopener noreferrer');link.className = 'forwarding-home';const $icon = this.cloneNodeByTemplate('#iconDown svg', 'rotate--90 icon-red');link.append($icon);content.append(link);}return content;};epartnerPageMenuHorizontal.prototype.EOfficialMenuIsPanelStyle = function (level1Data) {return level1Data?.children?.some(v => v.children?.length);};epartnerPageMenuHorizontal.prototype.getResData = function (res) {if ((res.menuDataList && res.menuDataList.length) || (res.menuData && res.menuData.length)) {const dataList = res.menuDataList || res.menuData;dataList.forEach(item => {item.levelOne = true;item.children = item.items;setMenuData(item);});}menuDataReplaceUrl(res);};epartnerPageMenuHorizontal.prototype.createLevel1Menu = function () {const $level1List = document.createElement('div');$level1List.className = 'epartner-home-menu flex-v-center';for (let i = 0; i < this.data.length; i++) {const item = this.data[i];if (!showLevel1MenuFlag(item)) {continue;}const $level1 = document.createElement('div');$level1.className = `epartner-home-menu-level1-${this.cssSuffix} hand-cursor`;if (!this.loginFlag) {$($level1).on('click', () => {$(`.epartner-home-menu-v-level1`).removeClass('active');$(`.epartner-home-menu-v-level1:nth-child(${i + 1})`).addClass('active');$('#epartnerPageMenuVertical').slideDown();});}const $a = document.createElement('a');$a.innerText = item.title;if (item.link) {$($a).attr({href: new originCnReplace().replaceSingeOrigin(item.link),target: item.targetBlank ? '_blank' : '_self',rel: item.targetBlank ? 'noopener noreferrer' : '',});}$level1.append($a);$level1.append(this.createLevel2Menu(item));$level1List.append($level1);}$('#epartnerPageMenuNav').append($level1List);$('#epartnerPageMenuNav').on('mouseover', '.epartner-home-menu-level1-login', () => {$('#epartnerPageMenuVertical').hide();});};epartnerPageMenuHorizontal.prototype.createLevel2Menu = function (level1Data) {const $level2List = document.createElement('div');$level2List.className = 'epartner-home-menu-level1-content small-scrollbar';for (let i = 0; i < level1Data.items.length; i++) {const item = level1Data.items[i];if (!showLevel2MenuFlag(item)) {continue;}const $level2 = document.createElement('dl');$level2.className = 'epartner-home-menu-level2';const $title = document.createElement('dt');$title.innerText = item.title;$level2.append($title);$level2.append(...this.createLevel3Menu(item));$level2List.append($level2);}return $level2List;};epartnerPageMenuHorizontal.prototype.createLevel3Menu = function (level2Data) {let level3List = [];for (let i = 0; i < level2Data.items.length; i++) {const item = level2Data.items[i];if (!showLevel3MenuFlag(item)) {continue;}const $level3 = document.createElement('dd');$level3.className = 'epartner-home-menu-level3-title hand-cursor flex-v-center';const $level3Title = document.createElement('span');$level3Title.innerText = item.title;$level3.append($level3Title);if (item.isLock === 'true') {const $lock = document.createElement('span');$lock.className = 'menu-lock';$lock.innerHTML = `🔒`;$level3.append($lock);const $lockTips = document.createElement('div');$lockTips.className = 'menu-lock-tips';$lockTips.innerHTML = 'No function right, Please click Apply to gain access.';$lock.append($lockTips);}$level3.onclick = () => openMenuPage(item, this.loginFlag, this.newStyle);level3List.push($level3);}return level3List;};epartnerPageMenuHorizontal.prototype.gotoHomePage = function () {let link = isHomeLink(getCurrentLanguage());if (link) {window.location.href = new originCnReplace().replaceSingeOrigin(link);setTimeout(() => {window.location.reload();}, DELAY_TIME);}};epartnerPageMenuHorizontal.prototype.createEvents = function () {$('#epartnerPageMenu').on('click', '.epartner-home-menu-logo', () => {this.gotoHomePage();});$('#epartnerOSMobileMenu').on('click', '.m-menu-logo', () => {this.gotoHomePage();});$('#epartnerPageMenuVertical').on('click', '.epartner-home-menu-v-level1-bottom', () => {let that = window.location.href;let lang = 'en';if (that.indexOf('/ru/') > -1) {lang = 'ru';} else if (that.indexOf('/cn/') > -1) {lang = 'cn';} else if (that.indexOf('/es/') > -1) {lang = 'es';} else if (that.indexOf('/pt/') > -1) {lang = 'pt';} else if (that.indexOf('/jp/') > -1) {lang = 'jp';}window.open(DOMPurify.sanitize('/eplus/#/' + lang + '/group/login-page'));});$('.epartner-home-official-menu-level1').on('mouseover', function (event) {$('.epartner-home-official-menu-level1-mask').show();const index = $(this).index();$('.epartner-home-official-menu-level1-content').eq(index).show().siblings().hide();$('.epartner-home-official-menu-level1-wrapper').slideDown();const $activePanel4 = $('.epartner-home-official-menu-level1-content').eq(index).find('.epartner-home-new-panel-menu-level3-item.active');const $panel = $('.epartner-home-official-menu-level1-content').eq(index).find('.epartner-home-new-panel-menu-level3-item');if ($panel?.length && !$activePanel4?.length) {$('.epartner-home-official-menu-level1-content').eq(index).find('.epartner-home-official-menu-level2.panel-bg .epartner-home-new-panel-menu-level3-item:first-child').trigger('click');}});$('.epartner-home-official-menu-level1-content').on('mouseover', function () {const index = $(this).index();$('.epartner-home-official-menu-level1-link').removeClass('active');$('.epartner-home-official-menu-level1-link').eq(index).addClass('active');});$('.epartner-home-official-menu-level1-content').on('mouseleave', function () {$('.epartner-home-official-menu-level1-link').removeClass('active');});$('#epartnerPageMenuNav').on('mouseleave', function () {$('.epartner-home-official-menu-level1-wrapper').slideUp();$('.epartner-home-official-menu-level1-mask').fadeOut();});$('.epartner-home-official-menu-level1-mask').on('mouseover', function (event) {$('.epartner-home-official-menu-level1-wrapper').slideUp();$('.epartner-home-official-menu-level1-mask').fadeOut();});$('.epartner-home-new-panel-menu-level3-item').on('click', function (event) {$('.epartner-home-new-panel-menu-level3-item').removeClass('active');$(event.currentTarget).addClass('active');$('.epartner-home-new-panel-menu-level4-wrapper').removeClass('flex');$(event.currentTarget).find('.epartner-home-new-panel-menu-level4-wrapper').toggleClass('flex');});};epartnerPageMenuHorizontal.prototype.createMobileContent = function () {const $content = $('#epartnerOSMobileMenuContent');let menuList = [];const _loginFlag = this.loginFlag;const createLevel = function (_data, deep, parentIndex) {let $levelPage;if (menuList.length > deep) {$levelPage = menuList[deep];} else {$levelPage = document.createElement('div');$levelPage.className = `epartner-m-menu-level-page`;$($levelPage).attr({ 'data-deep': deep });menuList.push($levelPage);$content.append($levelPage);}const $levelList = document.createElement('ul');$levelList.className = `epartner-m-menu-level small-scrollbar ${deep === 0 ? '' : 'list-hide'}`;$($levelList).attr('data-parent-index', parentIndex);for (let index = 0; index < _data.length; index++) {const levelData = _data[index];if (deep === 0 && !showLevel1MenuFlag(levelData)) {continue;}if (deep === 1 && !showLevel2MenuFlag(levelData)) {continue;}if (deep === 2 && !showLevel3MenuFlag(levelData)) {continue;}const $level = document.createElement('li');$level.className = 'epartner-m-menu-row flex-v-center';$($level).attr('data-index', index);const $link = document.createElement('a');if (levelData.items && levelData.items.length > 0) {$link.innerHTML = `${levelData.title} `;createLevel(levelData.items, deep + 1, parentIndex + '-' + index);} else {$link.onclick = () => openMenuPage(levelData, _loginFlag, this.newStyle);$link.innerText = levelData.title;}$level.append($link);$levelList.append($level);}$levelPage.append($levelList);};createLevel(this.data, 0, '0');if (this.loginFlag) {const $logOut = document.createElement('div');$logOut.className = 'm-menu-logout-row';const $logOutBtn = document.createElement('button');$logOutBtn.className = 'm-menu-logout-btn';$logOutBtn.innerText = 'Log Out';$logOut.append($logOutBtn);$content.append($logOut);}};epartnerPageMenuHorizontal.prototype.createMobileEvents = function () {const $content = $('#epartnerOSMobileMenuContent');const $menuHeader = $('#epartnerOSMobileMenu .child-menu-header');const $back = $('#epartnerOSMobileMenu .m-menu-back');const $logo = $('#epartnerOSMobileMenu .m-menu-logo');this.$container.on('click', '.epartner-home-menu-mobile', () => {$('#epartnerOSMobileMenu').show();});const backMenu = () => {const lastClickItem = this.mobileMenuPath.pop();if (lastClickItem) {const $nextLevelPage = $(`.epartner-m-menu-level-page[data-deep=${lastClickItem.deep + 1}]`);$nextLevelPage.find('ul').addClass('list-hide');if (this.mobileMenuPath.length === 0) {$back.hide();$logo.show();$menuHeader.text('');} else {$menuHeader.text(this.mobileMenuPath[this.mobileMenuPath.length - 1].currentTitle);}}};$('#epartnerOSMobileMenu').on('click', '.m-menu-back', backMenu);$('#epartnerOSMobileMenu').on('click', '.m-menu-close', e => {$('#epartnerOSMobileMenu').hide();while (this.mobileMenuPath.length > 0) {backMenu();}$('#epartnerOSMobLangMenuTitle').removeClass('active');$('#epartnerOSMobLangMenu').hide();$('#epartnerOSMobQuickMenuTitle').removeClass('active');$('#epartnerOSMobQuickMenu').hide();});$content.on('click', 'li', e => {const $li = $(e.target).closest('li');const $ul = $li.closest('ul');const $page = $li.closest('.epartner-m-menu-level-page');const clickInfo = {parentPath: $ul.data('parent-index'),deep: Number($page.data('deep')),currentIndex: $li.data('index'),nextParentIndex: `${$ul.data('parent-index')}-${$li.data('index')}`,currentTitle: $li.text(),};const $nextLevelPage = $(`.epartner-m-menu-level-page[data-deep=${clickInfo.deep + 1}]`);const $child = $nextLevelPage.find(`ul[data-parent-index=${clickInfo.nextParentIndex}]`);$back.show();$logo.hide();if ($child && $child.length) {this.mobileMenuPath.push(clickInfo);$menuHeader.text(clickInfo.currentTitle);$nextLevelPage.find('ul').addClass('list-hide');$child.removeClass('list-hide');$child.scrollTop(0);}});};const epartnerPageMenuVertical = function ({ loginFlag, data, newStyle }) {this.$container = $('#epartnerPageMenuVertical');this.data = data;this.loginFlag = loginFlag;this.cssSuffix = loginFlag ? 'login' : 'unlogin';this.newStyle = newStyle;};epartnerPageMenuVertical.prototype.init = function () {this.createLevel1Menu();if (!this.loginFlag || (this.loginFlag && !isHW())) {$('#epartnerPageMenuNav').css('display', 'flex');$('#epartnerPageMenuNav').css('justify-content', 'center');} else {$('.epartner-home-menu-level0').css('display', 'flex');}$('.epartner-home-menu-level0').on('click', () => {$(`.epartner-home-menu-v-level1`).removeClass('active');$('.epartner-home-menu-v-level1:first-child').addClass('active');this.$container.slideDown();});this.$container.off('mouseleave');this.$container.on('mouseleave', () => {this.$container.slideUp();});};epartnerPageMenuVertical.prototype.createLevel1Menu = function () {const $level1List = this.$container.find('.menu-v-level1-list');const $level2AllList = this.$container.find('.epartner-home-menu-v-content-list');for (let i = 0; i < this.data.length; i++) {const item = this.data[i];if (!showLevel1MenuFlag(item)) {continue;}const $level1 = document.createElement('div');$level1.className = 'epartner-home-menu-v-level1';$level1.innerHTML = ``;$($level1).on('mouseover', () => {$($level1).addClass('active');}).on('mouseleave', () => {$($level1).removeClass('active');});$level1.append(this.createLevel2Menu(item));$level1List.append($level1);}};epartnerPageMenuVertical.prototype.createLevel2Menu = function (level1Data) {const $level2List = document.createElement('div');$level2List.className = 'epartner-home-menu-v-level2-list small-scrollbar';const $level1TitleRow = document.createElement('div');$level1TitleRow.className = 'epartner-home-menu-v-level1-title-big flex-v-center';const $level1Title = document.createElement('a');$level1Title.innerText = level1Data.title + ' Home';$level1Title.className = 'flex-v-center';if (level1Data.link) {$($level1Title).attr({href: new originCnReplace().replaceSingeOrigin(level1Data.link),target: level1Data.targetBlank ? '_blank' : '_self',rel: level1Data.targetBlank ? 'noopener noreferrer' : '',});}const $icon = document.createElement('img');$icon.className = 'epartner-home-menu-v-level1-title-icon';$icon.src ='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJcAAADlCAIAAADRF/LkAAAIsklEQVR4Ae3dv2tTXRgH8EuwQ+Nyh3SQkKW1s7i5+A+4OBRBlyKIU6tiRxcHQbyzS/8AB5E6WDpIHUVKf4CDWkGhiMWSRTQUWkzknpf73pDG9ObHvXnOOc95zjeDpGnu85zz/eRJ2iYmwR+c3E8gUDi5nwAU3TdUCopQlJCAhD1gFqEoIQEJe8AsQlFCAhL2gFmEooQEJOwBswhFCQlI2ANmEYoSEpCwB8wiFCUkIGEPmEUoSkhAwh4wi1CUkICEPWAWoSghAQl7wCxCUUICEvaAWYSihAQk7AGzCEUJCUjYA2YRihISkLAHzCIUJSQgYQ+YRShKSEDCHjCLUJSQgIQ9YBahKCEBCXvIN4txHP/48ePFixd37ty5evVqzerp/v37QwXiOI6iKBB9mp+fH1Xx+/fvS0tLYRjyCWR+fn6oolJKPORIip8+fbp06RIfvM5KRlQUDzlEsdFoLC4udlLjdmZ0RdmQgxS3trZmZma4yXWvJ5eiYMi+imtra+VyuTsyhufzKkqFzFCM4/j58+elUokhW8+SCiiKhMxQXFlZcYIwCIJiivIgexU3NzdZ/S7RM3w9XxZWFAb5j+Lv378vX77ckxTnL8dRlAR5ohjH8ePHjzmbnV7bmIpiIE8UP378WKlUTifF+ZLxFWVAthXjOF5YWOAMlrk2EkUBkG3Fvb29arWamRTnC6kUXYdsKz579oyzVr+1ESo6DZkotlqtubm5fklxvpxW0V3IRLFer09PT3PW6rc2ckVHIRPFnZ0d/n8yzYTUoegiZKK4urqamRH/CzUpOgeZKC4vL/MHy1yhPkW3IBPFJ0+eZGbE/0Ktig5BQnHIC3eceM0OFIcoOjGRUByuyB8SiiMpMoekVJycnHz9+vWBwdOvX79GRaC4HtvHSErFcrm8s7NDERffGjwhoZj7FsMQEoq5FRk+RkKxiCI3SCgWVFRKffnyhclzQVAsqPj169fZ2Vkmf6SEYhFFVoTpq6vJ/hruw28aSiluhFDMPYgMCaGYT5EnIRRzKLIlhOKoipwJoTiSInNCKA5X5E8IxSGKThBCcZCiK4RQ7KvoECEUsxXdIoRihqJzhFDsVdRHWKvVbty4oek5EDyncQKpj7BSqWxvb+t7qQcU24q6CdM2miChmMRrhlAfJBSNEmqC9F3R5BSmhDogvVa0RUgO6a+iXUJaSE8V9RGGYbi5udl95zn4PMlPrT4q8iGkmkjvFLkRkkD6pciTcHxIjxQ5E44J6Ysif8JxIL1QdIWwMKR8RbcIi0EKV3SRsACkZEWthO/evUvj1vfv6H8QEKvoOmGuiZSpKINwdEiBipIIR4SUpvjz58+LFy/qeJFSGIYGHgv7PcoOfoyUpqiU0vEhS3YJh06kQEWl1Pb2NuEnvHAgHAwpU5EQMgzDN2/e9LujM3955l2rWEUSSG6E/SZSsqJS6v3797VardgPOzwJMyGFKxaG5Ex4GlK+YgFI/oQ9kF4o5oJ0hbAb8ubNm76899Tu7u7QN99zi7AD+fnzZ18UlVKDIV0kTCGVUh4pDoAsl8tra2udUJw745di5v+Qcp3Qu1lMh6z7eQ8BhJ4qdiZSBqG/ikqp/f39jY0N5x4CMxfs3eNiZgquXwhF1wWT9UMRil3PF3jyvuE8zTGLPF3yrQqK+fKiuvbh4SHVx+MdHh5CkcolXx3Cj4NOSlGVw+NiLkaq2IPgf0GqclCEYq4EJFyZangwizZvDVC0mT5VbyhSJWmzDhRtpk/VG4pUSdqsA0Wb6VP1hiJVkjbrQNFm+lS9oUiVpM06ULSZPlVvKFIlabMOFG2mT9UbilRJ2qwDRZvpU/WGIlWSNutA0Wb6VL2hSJWkzTpQtJk+VW8oUiVpsw4UbaZP1RuKVEnarANFm+lT9YYiVZI260DRZvpUvaFIlaTNOlC0mT5VbyhSJWmzDhRtpk/VG4pUSdqsA0Wb6VP1hiJVkjbrQNFm+lS9oUiVpM06TBWDIJiamqrhNFoCZ8+e7XqzoLHOJjcIwhvFWGvBwUUTgGLR5DgdB0VOGkXXAsWiyXE6DoqcNIqu5eXLl8Hq6mrRw3EciwQSwbdv3545c4bFcrCI/Amkb/kV7O/vV6vV/IfjCBYJTE9P1+v14Pj4+MqVKyxWhEXkT2Bubq7VagVKqeSHHJzcTGB5eTl533Cl1IcPH8IwdHMXXq+6Wq3u7e21FVut1vXr173Ow83NLywsxHHcVlRKra+vl0olN/fi6aq735A2uUdVSjWbzWvXrnmah5vbvnfvXjqIJ7OYfvTSuXPn3NyRd6uenZ399u1b5wnS9iymX6+srOB+lf8tolQqvXr1qkP4zywqpeI4jqKI/zY8X2EURZ370tTyn1lMHyBv377teUyct//w4cNms9k9iL2zmH7v6Ojo1q1bnHfi7doyCbMV04l89OiRt2Ex3HipVHr69GnPHWlnInvvUTvfiON4fX29Uqkw3JJvS5qZmdna2urQnD7TVzG9aqPRWFxc9C01PvudmJiIoujo6Oi0XPclQxTTqx4cHCwtLU1OTvLZnviVTE1NRVHUaDS6tfqdH0kxPbjZbG5sbNy9e/f8+fP4tVLHzWhiYuLChQsPHjzY3d39+/dvP7PTl+dQ7Dn4+PiY6rPnUKder5/+/aEn8AFfFlccUBTfMpwAFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEargoFA0HrqUdFLXEarjof17KdqdQxZa+AAAAAElFTkSuQmCC';$level1Title.append($icon);$level1TitleRow.append($level1Title);$level2List.append($level1TitleRow);for (let i = 0; i < level1Data.items.length; i++) {const item = level1Data.items[i];if (!showLevel2MenuFlag(item)) {continue;}const $level2 = document.createElement('div');$level2.className = `epartner-home-menu-v-level2-${this.cssSuffix} `;const $title = document.createElement('div');$title.className = 'epartner-home-menu-v-level2-title ';$title.innerText = item.title;$level2.append($title);$level2.append(this.createLevel3Menu(item));$level2List.append($level2);}return $level2List;};epartnerPageMenuVertical.prototype.createLevel3Menu = function (level2Data) {const $level3List = document.createElement('div');$level3List.className = `epartner-home-menu-v-level3-list-${this.cssSuffix}`;for (let i = 0; i < level2Data.items.length; i++) {const item = level2Data.items[i];if (!showLevel3MenuFlag(item)) {continue;}const $level3 = document.createElement('div');$level3.className = 'epartner-home-menu-v-level3-title hand-cursor';const $level3Title = document.createElement('span');$level3Title.innerText = item.title;$level3.append($level3Title);if (item.isLock === 'true') {const $lock = document.createElement('span');$lock.className = 'menu-lock';$lock.innerHTML = `🔒`;$level3.append($lock);const $lockTips = document.createElement('div');$lockTips.className = 'menu-lock-tips';$lockTips.innerHTML = 'No function right, Please click Apply to gain access.';$lock.append($lockTips);}$level3.onclick = () => openMenuPage(item, this.loginFlag, this.newStyle);$level3List.append($level3);}return $level3List;};function openWindow(item, url) {url = new originCnReplace().replaceSingeOrigin(url);if (item.target === '_blank') {window.open(url);} else {window.location.href = url;setTimeout(() => {window.location.reload();}, DELAY_TIME);}}function openMenuPage(item, loginFlag, newStyle) {const isAssociated = sessionStorage.getItem('epartner-is-associated') === 'true';let url = DOMPurify.sanitize(item.link);if (item.title === 'Permission Management') {url = `${BASE_URL}${url.split('layout=')[1]}`;}if (!loginFlag || url.indexOf('/web/') > -1) {openWindow(item, url);if (url.indexOf('/group/') > -1) {setTimeout(() => {window.location.reload();}, DELAY_TIME);}return;} else if (loginFlag && !isAssociated) {openWindow(item, url);return;}let lang = url.indexOf('/en/') > -1 ? 'en_US' : 'zh_CN';const menuName = item.title;let params = `menuName=${menuName}&w3Account=${getCurrentUserInfo().userAccount}&language=${lang}`;let requestUrl = '';if (newStyle) {requestUrl = `${BASE_URL}${constants.E_PARTNER_SERVICE}/pub/error/v2NoPermission?${params}`;} else {requestUrl = `${BASE_URL}${constants.E_PARTNER_SERVICE}/pub/error/noPermission?${params}`;}$.post(requestUrl, res => {if (res.code === '0' || res.code === '-1') {openWindow(item, url);} else {if (window.location.href.indexOf('/cn/') > -1) {window.location.href = DOMPurify.sanitize(BASE_URL + '/eplus/#/cn/group/err-403?menuName=' + menuName);} else {window.location.href = DOMPurify.sanitize(BASE_URL + '/eplus/#/en/group/err-403-en?menuName=' + menuName);}setTimeout(() => {window.location.reload();}, DELAY_TIME);}});}function expartnerDialog({ loginFlag }) {this.loginFlag = loginFlag;}expartnerDialog.prototype.init = async function () {if (!this.loginFlag) {return;}const isAdmin = await checkUserIsAdmin();if (!isAdmin) {return;}$.ajax({type: 'GET',dataType: 'json',headers: {'x-app-id': 'com.huawei.channelsales.echannel.echannel2.0','x-sub-app-id': 'ePartner_service',},url: `${constants.E_PARTNER_SERVICE}/portal/v1/partner/autoRenewalPop`,success: res => {if (res && res.data && res.data instanceof Array && res.data.length > 0) {res.data.forEach(item => {this.createDialog(item);});}},});};expartnerDialog.prototype.createDialog = function ({ content, title, scena }) {const $dialog = document.createElement('dialog');$dialog.className = 'epartner-dialog';document.body.append($dialog);const $header = document.createElement('div');$header.className = 'epartner-dialog-header';$header.innerText = title;$dialog.append($header);const $closeIcon = document.createElement('div');$closeIcon.className = 'hand-cursor iconfont icon-close';$header.append($closeIcon);const $content = document.createElement('div');$content.className = 'epartner-dialog-content small-scrollbar';$content.innerHTML = content;$dialog.append($content);const $optRow = document.createElement('div');$optRow.className = 'epartner-dialog-opt-row';$dialog.append($optRow);const $okBtn = document.createElement('button');$okBtn.innerText = 'Has been known';$optRow.append($okBtn);const $closeBtn = document.createElement('button');$closeBtn.innerText = 'Close';$optRow.append($closeBtn);const $tipsRow = document.createElement('div');$tipsRow.className = 'epartner-dialog-footer-tips';$tipsRow.innerHTML = '! Reminder: If you select “Has been known”, no dialog box will be displayed for you in the next 7 days. ';$dialog.append($tipsRow);this.createEvents({ cookieKey: `read_Renew_Agreement_${scena}`, $okBtn, $closeBtn, $closeIcon, $dialog, $header, $content });};expartnerDialog.prototype.createEvents = function ({ cookieKey, $okBtn, $closeBtn, $closeIcon, $dialog, $header, $content }) {if (document.cookie.indexOf(cookieKey) > 0) {return;}$dialog.showModal();$($content).scrollTop(0);const closeDialog = () => {$dialog.className = 'epartner-dialog close';setTimeout(() => {$dialog.close();$dialog.removeEventListener('mousedown', startDragging);}, 300);};const startDragging = dialogDragging({ $dialog, $header, closeDialog });$dialog.addEventListener('mousedown', startDragging);$($okBtn).on('click', () => {let date = new Date();date.setTime(date.getTime() + 7 * 24 * 60 * 60 * 1000);document.cookie = cookieKey + '=1' + ';path=/;expires=' + date.toGMTString();closeDialog();});$($closeIcon).on('click', () => {closeDialog();});$($closeBtn).on('click', () => {closeDialog();});};function partnerFooter() {}partnerFooter.prototype.init = function () {this.queryRichText();};partnerFooter.prototype.queryRichText = function () {const href = window.location.href;let footerLang = 'footer-en-meta';if (href.indexOf('/cn/') > -1) {footerLang = 'footer-cn-meta';} else if (href.indexOf('/ru/') > -1) {footerLang = 'footer-ru-meta';} else if (href.indexOf('/jp/') > -1) {footerLang = 'footer-jp-meta';} else if (href.indexOf('/pt/') > -1) {footerLang = 'footer-pt-meta';} else if (href.indexOf('/es/') > -1) {footerLang = 'footer-es-meta';}$.ajax({type: 'get',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/pub/public/getHtmlAreaInfo/MessageTemplateEN/${footerLang}`,success: function (res) {if (res.content) {const str = new originCnReplace().replaceOriginRichtext(res.content);$('#partner-footer').html(str);}},});};function search() {}search.prototype.init = function () {let that = this;$('#epartnerPageMenu .search-btn').on('click', function () {window.hwa && window.hwa('trackPageView', 'P106112FF7A71015');$('#epartnerHomeHeaderSearch').show();$('#epartnerHomeHeaderSearch .searching-tip').show();document.body.style.overflow = 'hidden';let scrollTop = $(window).scrollTop();if (scrollTop > 0 && scrollTop < 42) {$('#epartnerHomeHeaderSearch').attr('style', `top: -${scrollTop}px;`);} else if (scrollTop >= 42) {$('#epartnerHomeHeaderSearch').attr('style', `top: -42px;`);} else if (scrollTop === 0) {$('#epartnerHomeHeaderSearch').attr('style', `top: 0;`);}});$('#epartnerHomeHeaderSearch .close-search').on('click', function () {$('#epartnerHomeHeaderSearch').hide();document.body.style.overflow = 'auto';});$('#epartnerHomeHeaderSearch .search-con-box.searching').on('click.self', function () {$('#epartnerHomeHeaderSearch').hide();document.body.style.overflow = 'auto';});$('#epartnerHomeHeaderSearch #delHistory').on('click', function () {let kwv = JSON.stringify({});Cookies.set('search_history_kw', kwv, { raw: false, expires: Infinity, path: '/', secure: false });that.showOrHiddenTip('search-history', 'hide');});$('#epartnerHomeHeaderSearch .searching-cistern-l').on('click.self', function (event) {event.stopPropagation();$('#epartnerHomeHeaderSearch .searching-tip').hide();});$('#epartnerHomeHeaderSearch .nav-searchbit-box').on('click', function (event) {event.stopPropagation();});let timeout = null;$('#epartnerHomeHeaderSearch #txtSearch_Navigation').on('input', function () {let searchValue = $(this).val();if (searchValue) {clearTimeout(timeout);timeout = setTimeout(() => {that.searchValueFunction(searchValue);that.searchValueFunction2(searchValue);$('#epartnerHomeHeaderSearch .clear-search').show();that.showOrHiddenTip('search-history', 'hide');that.showOrHiddenTip('search-hot', 'hide');}, 600);} else {clearTimeout(timeout);that.initSearchTip();}});$('#epartnerHomeHeaderSearch #txtSearch_Navigation').on('focus', function () {$('#epartnerHomeHeaderSearch .searching-tip').show();});$('#epartnerHomeHeaderSearch #txtSearch_Navigation').on('keydown', function (event) {if (event.keyCode + '' === '13') {that.searchClick();}});$('#epartnerHomeHeaderSearch .clear-search').on('click', function () {$('#epartnerHomeHeaderSearch #txtSearch_Navigation').val('');that.initSearchTip();});$('#epartnerHomeHeaderSearch #searchBtn').on('click', function () {that.searchClick();});this.setHistoryElement();this.getHotWords();};search.prototype.setHistoryElement = function () {let historyData = this.getHistory();let that = this;if (Object.keys(historyData).length > 0) {Object.keys(historyData).forEach(key => {const $a = document.createElement('a');$a.innerText = key;$a.title = key;$a.addEventListener('click', function () {that.searchJumping(key);});$('#epartnerHomeHeaderSearch .search-history').append($a);});} else {that.showOrHiddenTip('search-history', 'hide');}};search.prototype.getHistory = function () {let his = Cookies.get('search_history_kw');if (his) {try {his = JSON.parse(his);} catch {his = {};}} else {his = {};}return his;};search.prototype.setHistory = function (word) {if (!word) {return;}let old = this.getHistory();let now = Number(new Date());old[word] = now;let curt = this.comListHis(old);let newValue = {};curt.forEach(item => {newValue[item.name] = item.t;});let cookieValue = JSON.stringify(newValue);Cookies.set('search_history_kw', cookieValue, {raw: false,expires: Infinity,path: '/',secure: false,});};search.prototype.delHistory = function () {let kwv = JSON.stringify({});Cookies.set('search_history_kw', kwv, { raw: false, expires: Infinity, path: '/', secure: false });this.historyData = this.getHistory();};search.prototype.comListHis = function (obj) {const his = obj || {};let curt = [];Object.keys(his).filter(item => !this.isGarbled(item)).forEach(key => {curt.push({name: key,t: his[key],});});const now = Number(new Date()) - 2592000000;curt = [...curt].filter(item => item.t > now).sort((a, b) => {return b.t - a.t;});curt = curt.splice(0, 5);return curt;};search.prototype.isGarbled = function (word) {const en = /\w/gi;const cn = /[\u4e00-\u9fa5]/g;let enSymbol = '~!@#$%^&*(){}|:"<>?/*-+.`[]\\;\',./=';const cnSymbol = '~!@#¥%……&*()——+{}|”:《》?/*-+.·【】、;’,。、=';const txt = String(word).replaceAll(' ', '');const flag = String(txt).split('').filter(t => Boolean(t)).filter(li => {let curt = !String(li).match(cn) && !String(li).match(en) && enSymbol.indexOf(String(li)) < 0 && cnSymbol.indexOf(String(li)) < 0;return curt === true;});return Boolean(flag.length);};search.prototype.getHotWords = function () {let that = this;let params = {customParams: [{ customParamName: 'language', customParamValue: 'en' },{ customParamName: 'site', customParamValue: 'en' },],};$.ajax({type: 'POST',dataType: 'json',data: JSON.stringify(params),url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/pub/public/getHotWord`,success: function (res) {if (!res.body || !res.body.data || !res.body.data.data) {return;}let hotWordsData = res.body.data.data;hotWordsData.forEach(item => {const $a = document.createElement('a');$a.innerText = item.searchTxt;$a.title = item.searchTxt;$a.addEventListener('click', function () {that.searchJumping(item.searchTxt);});$('#epartnerHomeHeaderSearch .search-hot').append($a);});},});};search.prototype.searchValueFunction = function (value) {let that = this;let params = {queryText: value,customParams: [{ customParamName: 'language', customParamValue: 'en' },{ customParamName: 'site', customParamValue: 'en' },],};$.ajax({type: 'POST',dataType: 'json',data: JSON.stringify(params),url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/pub/public/searchDirectly`,success: function (res) {if (res.body && res.body.data) {$('#epartnerHomeHeaderSearch .search-direct-title').show();$('#epartnerHomeHeaderSearch .search-direct').show();let arr = [];res.body.data.forEach(e => {arr = [...arr, ...e.data];});let searchDirectlyData = arr.slice(0, 5);searchDirectlyData.forEach(item => {const $a = document.createElement('a');$a.innerText = item.itemTitle;$a.title = item.itemTitle;$a.href = new originCnReplace().replaceSingeOrigin(item.itemUrl);$('#epartnerHomeHeaderSearch .search-direct').append($a);});} else {that.showOrHiddenTip('search-direct', 'hide');}},});};search.prototype.searchValueFunction2 = function (value) {let that = this;let params = {queryText: value,customParams: [{ customParamName: 'language', customParamValue: 'en' },{ customParamName: 'site', customParamValue: 'en' },],};$.ajax({dataType: 'json',type: 'POST',data: JSON.stringify(params),url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/pub/public/searchSuggestions`,success: function (res) {that.parseSearchSuggestions(res);},});};search.prototype.parseSearchSuggestions = function (res) {const that = this;if (res.body && res.body.data) {$('#epartnerHomeHeaderSearch .search-suggest-title').show();$('#epartnerHomeHeaderSearch .search-suggest').show();const hotWordsData = res.body.data;hotWordsData.forEach(item => {const a = document.createElement('a');a.innerText = item.suggestword;a.title = item.suggestword;a.addEventListener('click', function () {that.searchJumping(item.suggestword);});$('#epartnerHomeHeaderSearch .search-suggest').append(a);});} else {that.showOrHiddenTip('search-suggest', 'hide');}};search.prototype.searchJumping = function (val) {this.setHistory(val);let url = `${BASE_URL}/eplus/#/en/web/marketingsearch?from=partner&keyword=${val}&lang=en&site=en&filterType=partner`;window.location.href = DOMPurify.sanitize(url);setTimeout(() => {window.location.reload();}, 500);};search.prototype.searchClick = function () {let searchValue = $('#epartnerHomeHeaderSearch #txtSearch_Navigation').val();if (searchValue !== '') {this.setHistory(searchValue);this.searchJumping(searchValue);}};search.prototype.initSearchTip = function () {$('#epartnerHomeHeaderSearch .clear-search').hide();let historyData = this.getHistory();if (Object.keys(historyData).length > 0) {this.showOrHiddenTip('search-history', 'show');} else {this.showOrHiddenTip('search-history', 'hide');}this.showOrHiddenTip('search-hot', 'show');this.showOrHiddenTip('search-direct', 'hide');this.showOrHiddenTip('search-suggest', 'hide');};search.prototype.showOrHiddenTip = function (rowName, type) {if (type === 'show') {$(`#epartnerHomeHeaderSearch .${rowName}-title`).show();$(`#epartnerHomeHeaderSearch .${rowName}`).show();} else if (type === 'hide') {$(`#epartnerHomeHeaderSearch .${rowName}-title`).hide();$(`#epartnerHomeHeaderSearch .${rowName}`).hide();}};function menuHead({ loginFlag, isAssociatedType, isHW }) {this.loginFlag = loginFlag;this.isAssociatedType = isAssociatedType;this.isHW = isHW;}menuHead.prototype.init = async function () {if (this.loginFlag && !this.isAssociatedType && !this.isHW) {$('#menuHead').show();let that = this;$('#menuHead #checkPrivacyStatement').on('click', function () {that.isCertify();return;});$('#menuHead #showPartnerType').on('mouseenter', function () {$('#menuHead .head-tips-ul').show();$('#menuHead .layer').show();});$('#menuHead .layer').on('click', function () {$('#menuHead .head-tips-ul').hide();$('#menuHead .layer').hide();});$('#menuHead .icon-guanbianniu').on('click', function () {$('#menuHead').hide();});$('#menuHead .menu-head-dialog__close').on('click', function () {that.dialogShowAndHide('hide');});$('#menuHead .menu-head-button.yesBtn').on('click', function () {window.open(`/eplus/#/en/web/associate-progress-en`);that.dialogShowAndHide('hide');});$('#menuHead .menu-head-button.noBtn').on('click', function () {that.dialogShowAndHide('hide');});$.ajax({type: 'GET',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/account/findCompanyInfo?xhwId=com.huawei.ebg.epartner.uipm&env=${location.hostname}`,success: function (res) {if (res.content.valid == -1) {that.dialogShowAndHide('show');}},});} else {$('#menuHead').remove();}};menuHead.prototype.dialogShowAndHide = function (type) {let $modal = $('#menuHead #menuHeadModal');let $dialog = $('#menuHead #menuHeadDialog');if (type === 'show') {$modal.removeClass('hidden');$dialog.removeClass('hidden');} else {$modal.addClass('hidden');$dialog.addClass('hidden');}};menuHead.prototype.isCertify = function (type) {let $uncertifiedDialog = $('.epartner-dialog.uncertified-dialog');if ($uncertifiedDialog.length > 0) {$.ajax({type: 'POST',dataType: 'json',data: JSON.stringify({}),url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/control/isRealNameAuthenticationEnabled`,success: function (res) {let isRealName = res.body || '';if (isRealName === 'Y') {$uncertifiedDialog.removeClass('close');$('.epartner-dialog.uncertified-dialog .epartner-dialog-content').html('Associated companies need to complete account authentication. Your account has not yet completed account authentication. Click Next to start authentication. ');$uncertifiedDialog.attr('frome-data', 'beforeApplication');$uncertifiedDialog[0].showModal();} else {window.location.href = `/eplus/#/en/web/associate-company-en`;}},});} else {window.location.href = `/eplus/#/en/web/associate-company-en`;}};function uncertified({ isHW, accountInfo }) {this.isHW = isHW;this.accountInfo = accountInfo;this.isRealName = '';}uncertified.prototype.init = function () {const user = this.accountInfo.user || {};if (user.registerCountry && user.registerCountry === 'CN') {this.isRealNameAuthenticationEnabled();}};uncertified.prototype.isRealNameAuthenticationEnabled = function () {let that = this;$.ajax({type: 'POST',dataType: 'json',data: JSON.stringify({}),url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/control/isRealNameAuthenticationEnabled`,success: function (res) {that.isRealName = res.body || '';that.isCertify();},});};uncertified.prototype.isCertify = function () {if (this.isRealName === 'Y' && !this.isHW) {this.createDialog();}};uncertified.prototype.createDialog = function () {const dialog = document.createElement('dialog');dialog.className = 'epartner-dialog p-dialog uncertified-dialog';dialog.setAttribute('frome-data', 'home');document.body.append(dialog);const header = document.createElement('div');header.className = 'epartner-dialog-header uipm-dialog__title';const headerTitle = document.createElement('div');const icon = document.createElement('span');icon.className = 'uipm-dialog__title_icon icon-solid';icon.innerHTML = 'i';headerTitle.append(icon);headerTitle.append('Account authentication');header.append(headerTitle);const closeIcon = document.createElement('div');closeIcon.className = 'uipm-icom-colse';closeIcon.innerHTML = `Created with Pixso. `;header.append(closeIcon);dialog.append(header);const body = document.createElement('div');body.className = 'epartner-dialog-content uipm-dialog__body popup-content';body.innerHTML = 'Your account has not been verified yet. Click Next to start verification. ';dialog.append(body);const optRow = document.createElement('div');optRow.className = 'epartner-dialog-footer uipm-dialog__footer uipm-button-group';dialog.append(optRow);const closeBtn = document.createElement('button');closeBtn.className = 'uipm-button uipm-button--default';closeBtn.innerText = 'Cancel';optRow.append(closeBtn);const signBtn = document.createElement('button');signBtn.className = 'uipm-button uipm-button--primary';signBtn.innerHTML = 'Next step';optRow.append(signBtn);this.createEvents({ closeBtn, signBtn, closeIcon, dialog, header, body });this.dialog = dialog;};uncertified.prototype.createEvents = function ({ closeBtn, signBtn, closeIcon, dialog, header, body }) {if (this.isTipsTimeout()) {dialog.showModal();}$(body).scrollTop(0);const closeDialog = () => {dialog.className = 'epartner-dialog p-dialog uncertified-dialog close';setTimeout(() => {dialog.close();dialog.removeEventListener('mousedown', startMoving);}, 300);};const startMoving = dialogDragging({ $dialog: dialog, $header: header, closeDialog });dialog.addEventListener('mousedown', startMoving);$(closeBtn).off('click');$(closeBtn).on('click', () => {closeDialog();localStorage.setItem('isShowCertifiedTip', new Date().getTime());});$(signBtn).off('click');$(signBtn).on('click', () => {let formPage = $('.epartner-dialog.uncertified-dialog').attr('frome-data');sessionStorage.setItem('formLoadPersonalInfo', formPage);window.location.href = `/eplus/#/cn/group/personal-information-maintain-certified?menuLeftStyle=true`;});$(closeIcon).off('click');$(closeIcon).on('click', () => {closeDialog();localStorage.setItem('isShowCertifiedTip', new Date().getTime());});};uncertified.prototype.isTipsTimeout = function () {const tipsTime = localStorage.getItem('isShowCertifiedTip') || '';if (tipsTime) {const currentDate = new Date();const year = currentDate.getFullYear();const month = currentDate.getMonth() + 1;const day = currentDate.getDate();let startTime = new Date(`${year}-${month}-${day} 00:00:00`).getTime();let timeDifference = Number(tipsTime) - startTime;return timeDifference < 0 || timeDifference >= 24 * 60 * 60 * 1000;} else {return true;}};function downloadEApp() {}downloadEApp.prototype.init = function () {this.checkShow();this.initEvent();};downloadEApp.prototype.checkShow = function () {const isWeLink = navigator.userAgent.includes('com.huawei.eplus') && navigator.userAgent.includes('HuaWei-AnyOffice');const noAppDownload = getUrlValue('noAppDownload');let isShow = false;if (isWeLink || noAppDownload === 'true') {isShow = false;} else {isShow = /Android|web0s|iPhone|iPad|iPod|BlackBerry|IEMobile|0pera Mini|Phone|Tablet/i.test(navigator.userAgent);}const downloadDom = $('.partner-tenant-meta-app-download');if (isShow && downloadDom) {downloadDom.css('display', 'flex');}};downloadEApp.prototype.initEvent = function () {const downloadDom = $('.partner-tenant-meta-app-download');const openAppDom = $('.partner-tenant-meta-app-download .openApp');const closeDom = $('.partner-tenant-meta-app-download .closeApp');openAppDom.off('click');closeDom.off('click');openAppDom.on('click', function () {let weLinkUrl = `https://app.huawei.com/eplus/front/index.html#/findIndex`;let url = `https://app.huawei.com/eplus/front/download.html?welinkuri=${encodeURIComponent(weLinkUrl)}&welinkscheme=hwwelink://com.huawei.eplus/`;window.location.replace(url);});closeDom.on('click', function () {downloadDom.css('display', 'none');});};function browser() {}browser.prototype.init = function () {if (this.checkBrowserVersion()) {$('.partner-low-version-explore-tips').css('display', 'flex');}$('.partner-low-version-explore-tips .icon-operationFailed').off('click');$('.partner-low-version-explore-tips .icon-operationFailed').on('click', function () {$('.partner-low-version-explore-tips').css('display', 'none');});};browser.prototype.checkBrowserVersion = function () {const sys = {};const userAgent = navigator.userAgent.toLowerCase();const s = userAgent.match(/chrome\/([\d\.]+)/);sys.chrome = s && s[1] ? s[1] : 0;if (sys.chrome) {if (parseInt(s[1]) <= 70) {return true;}} else if (userAgent.indexOf('msie') > -1) {return true;} else {return false;}};function protocolAndWebsite() {this.declarationNo = 'PSTC';this.privacyUrl = '/eplus/#/cn/web/partner-privacy';this.userAgreeUrl = '/eplus/#/cn/web/user-agree';this.acceptMailInfo = false;this.acceptPersonalInfo = false;this.dialogClassName = '';}protocolAndWebsite.prototype.init = function () {this.getEsdDpPrivacyType();};protocolAndWebsite.prototype.getEsdDpPrivacyType = function () {const that = this;$.ajax({type: 'GET',dataType: 'json',url: `${BASE_URL}${constants.COMMON_SERVICE}/common/v1/public/queryLookupList?classifyCode=ESDDP_PRIVACY_TYPE&language=zh`,success: function (resp) {if (!resp || !resp.length) {return;}resp.forEach(item => {if (getCurrentLanguage() == item.itemCode) {that.declarationNo = item.itemName;that.querySignedPrivacyState();}});},});};protocolAndWebsite.prototype.querySignedPrivacyState = function () {$.ajax({type: 'GET',dataType: 'json',url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/privacy/signedPrivacyStatement?declarationNo=${this.declarationNo}`,success: res => {if (res && !res.result) {this.openSignedPrivacyWebsiteDialog();}},});};protocolAndWebsite.prototype.openSignedPrivacyWebsiteDialog = function () {const content = ``;this.openDialog({title: 'Declaration of e+ Partners Official website',content,cancelText: 'Cancel',confirmText: 'Agreed',type: 1,className: 'partner-official-website-dialog',});};protocolAndWebsite.prototype.openNoSignedNoticeDialog = function () {const content = `Since you do not agree on the Privacy Statement , we cannot provide the platform service to you. If you could like to use this platform, please login again and accept the Privacy Statement
`;this.openDialog({ title: 'Notice', content, cancelText: 'return', confirmText: 'Confirm', type: 0, className: 'partner-official-website-dialog' });};protocolAndWebsite.prototype.openDialog = function ({ title, content, cancelText, confirmText, type, width, minWidth, maxWidth, className }) {const dialog = document.createElement('dialog');dialog.className = `epartner-dialog p-dialog ${className}`;this.dialogClassName = dialog.className;if (width) {dialog.style.width = width;}if (minWidth) {dialog.style.minWidth = minWidth;}if (maxWidth) {dialog.style.maxWidth = maxWidth;}document.body.append(dialog);const header = document.createElement('div');header.className = 'epartner-dialog-header p-dialog__header p-dialog__title';if (type !== 1) {const icon = document.createElement('span');icon.className = 'icon-warn';icon.innerHTML = '!';header.append(icon);}header.append(title);dialog.append(header);const body = document.createElement('div');body.className = 'epartner-dialog-content p-dialog__body small-scrollbar';body.innerHTML = content;dialog.append(body);const optRow = document.createElement('div');optRow.className = 'epartner-dialog-opt-row p-dialog__footer p-button-group';dialog.append(optRow);const closeBtn = document.createElement('button');closeBtn.className = 'p-button p-button--default';closeBtn.innerText = cancelText;if (cancelText) {optRow.append(closeBtn);}const okBtn = document.createElement('button');okBtn.className = `p-button p-button--confirm is-plain ${type === 1 && !this.acceptPersonalInfo ? 'is-disabled' : ''}`;okBtn.innerText = confirmText;optRow.append(okBtn);this.createEvents({ okBtn, closeBtn, dialog, header, body, type });};protocolAndWebsite.prototype.createEvents = function ({ okBtn, closeBtn, dialog, header, body, type }) {dialog.showModal();$(body).scrollTop(0);let baseLeft = 0;let baseTop = 0;const closeDialog = () => {dialog.className = `${this.dialogClassName} close`;setTimeout(() => {dialog.close();dialog.removeEventListener('mousedown', startMoving);}, 300);};const startMoving = dialogDragging({ $dialog: dialog, $header: header, closeDialog });dialog.addEventListener('mousedown', startMoving);$('.p-dialog').off('click');$(okBtn).off('click');$(okBtn).on('click', () => {if (type === 1) {if (this.acceptPersonalInfo) {closeDialog();this.signedPrivacy(this.acceptMailInfo);}} else if (!type) {const origin = BASE_URL.split('://')[1];const logoutUrl = replaceOrigin(getLogoOutUrl(), '.huawei.com');window.location.href = `https://${origin}${logoutUrl}`;} else {closeDialog();}});$(closeBtn).off('click');$(closeBtn).on('click', () => {closeDialog();type ? this.openNoSignedNoticeDialog() : this.openSignedPrivacyWebsiteDialog();});$('.p-dialog').on('click', '.checkbox', e => {e.preventDefault();const pCheckbox = $(e.currentTarget).find('.p-checkbox');if (pCheckbox.hasClass('is-checked')) {pCheckbox.find('.p-checkbox__input').removeClass('is-checked');pCheckbox.removeClass('is-checked');this[pCheckbox.hasClass('mail-info') ? 'acceptMailInfo' : 'acceptPersonalInfo'] = false;} else {pCheckbox.find('.p-checkbox__input').addClass('is-checked');pCheckbox.addClass('is-checked');this[pCheckbox.hasClass('mail-info') ? 'acceptMailInfo' : 'acceptPersonalInfo'] = true;}if (this.acceptPersonalInfo) {$('.p-button--confirm.is-plain').removeClass('is-disabled');} else {$('.p-button--confirm.is-plain').addClass('is-disabled');}});$('.p-dialog').on('click', '.personal-privacy', e => {window.open(`/eplus/#/en/web/partner-privacy`);});$('.p-dialog').on('click', '.platform-privacy', e => {window.open(`/eplus/#/en/web/partner-privacy`);});};protocolAndWebsite.prototype.signedPrivacy = function (checkSub) {if (checkSub) {this.createOrCancelTemporarySigning();}const params = {declarationNo: this.declarationNo,};$.ajax({dataType: 'json',type: 'post',data: JSON.stringify(params),url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/privacy/signPrivacyStatement`,error: () => {this.createWarnMessage();},success: res => {if (res && res.result) {this.closeDialog();} else {this.createWarnMessage();}},});};protocolAndWebsite.prototype.createOrCancelTemporarySigning = function () {const params = {isSigned: 'Y',};$.ajax({type: 'post',dataType: 'json',data: JSON.stringify(params),url: `${BASE_URL}${constants.E_PARTNER_SERVICE}/portal/v1/privacy/createOrCancelTemporarySigning`,});};protocolAndWebsite.prototype.createWarnMessage = function () {const content = ``;this.openDialog({ title: 'Notice', content, cancelText: '', confirmText: 'Confirm', type: 3, width: '40%', minWidth: '150px', maxWidth: '400px' });};let env = 'beta';if (isProduction()) {env = 'pro';}let hwaAppKeys = {env: env,appKeys: {beta: '2806bc73dadccef524ed5f58ff569881',pro: '07b478fa338f66d7fc00f4e86dfb41fb',},ABVersion: 'A',platform: 'web',};(function (h, w, f, t) {const myDomain = window.location.origin.indexOf('huawei.cn') > -1 ? 'huawei.cn' : 'huawei.com';try {if (!h[t]) {h.GlobalHwaNamespace = h.GlobalHwaNamespace || [];h.GlobalHwaNamespace.push(t);h[t] = function () {(h[t].q = h[t].q || []).push(arguments);};h.trackerload = function () {(h[t].q = h[t].q && h[t].q.length ? h[t].q : []).unshift(arguments);};h[t].q = h[t].q || [];}let host = f.env == 'pro' ? `hwa.his.${myDomain}` : f.env == 'beta' ? `hwa-beta.his.${myDomain}` : '';let welinkHost = '';if (f.platform == 'welink') {host = f.env == 'pro' ? `w3m.${myDomain}/mcloud/umag` : f.env == 'beta' ? `mcloud-uat.${myDomain}/mcloud/umag` : '';welinkHost = `${host}/ProxyForText/hwa_trackload`;h.hwahost = welinkHost;host = `${host}/fg/ProxyForDownLoad/hwa_f`;}h.aids = f;h.space = t;let ts = String(String(new Date().getFullYear()) + new Date().getMonth()) + new Date().getDate();let script = w.createElement('script');script.id = 'uem_f';script.src = `${(location.protocol == 'https:' ? 'https://' : 'http://') + host}/dist/uem_f.js?v=${ts}`;if (!(f.async == false)) {script.setAttribute('async', '1');}script.setAttribute('style', 'display:none;');let where = w.getElementsByTagName('head')[0].firstChild || w.getElementsByTagName('head')[0].lastChild || w.getElementsByTagName('script')[0];if (where) {where.parentNode.insertBefore(script, where);} else {w.getElementsByTagName('head')[0].appendChild(script);}} catch (e) {if (!h[t]) {h[t] = function () {};}}})(window, document, hwaAppKeys, 'hwa');function originCnReplace() {this.validOrigin = ['com', 'cn'];}originCnReplace.prototype.replaceOrigin = function (url) {if (!url) {return url;}try {const urlObj = new URL(url);const curHost = window.location.host;const curOrigin = curHost.split('.').pop().split(':').shift();const urlHost = urlObj.host;const urlOrigin = urlHost.split('.').pop().split(':').shift();if (!this.validOrigin.includes(curOrigin) || !this.validOrigin.includes(urlOrigin)) {return url;}const host = urlHost.replace(urlOrigin, curOrigin);urlObj.host = host;return urlObj.href;} catch (err) {return url;}};originCnReplace.prototype.replaceSingeOrigin = function (url) {return this.replaceOrigin(url);};originCnReplace.prototype.replaceOriginRichtext = function (text) {const regex = /(https?:\/\/[^\s"']+)/g;const matches = text.match(regex);matches?.forEach(str => {const newText = this.replaceSingeOrigin(str);text = text.replace(str, newText);});return text;};initAjaxSet();initLogin();initHeaderRightUserClickEvent();initRegisterClickEvent();new partnerFooter().init();new browser().init();window.hwa('trackPageView', 'PA60A67B3D600F8');});})(window, jQuery);