1(function webpackUniversalModuleDefinition(root, factory) { 2 if(typeof exports === 'object' && typeof module === 'object') 3 module.exports = factory(); 4 else if(typeof define === 'function' && define.amd) 5 define([], factory); 6 else if(typeof exports === 'object') 7 exports["CoveoExtension"] = factory(); 8 else 9 root["CoveoExtension"] = factory(); 10})(typeof self !== 'undefined' ? self : this, function() { 11return /******/ (function(modules) { // webpackBootstrap 12/******/ // The module cache 13/******/ var installedModules = {}; 14/******/ 15/******/ // The require function 16/******/ function __webpack_require__(moduleId) { 17/******/ 18/******/ // Check if module is in cache 19/******/ if(installedModules[moduleId]) { 20/******/ return installedModules[moduleId].exports; 21/******/ } 22/******/ // Create a new module (and put it into the cache) 23/******/ var module = installedModules[moduleId] = { 24/******/ i: moduleId, 25/******/ l: false, 26/******/ exports: {} 27/******/ }; 28/******/ 29/******/ // Execute the module function 30/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 31/******/ 32/******/ // Flag the module as loaded 33/******/ module.l = true; 34/******/ 35/******/ // Return the exports of the module 36/******/ return module.exports; 37/******/ } 38/******/ 39/******/ 40/******/ // expose the modules object (__webpack_modules__) 41/******/ __webpack_require__.m = modules; 42/******/ 43/******/ // expose the module cache 44/******/ __webpack_require__.c = installedModules; 45/******/ 46/******/ // define getter function for harmony exports 47/******/ __webpack_require__.d = function(exports, name, getter) { 48/******/ if(!__webpack_require__.o(exports, name)) { 49/******/ Object.defineProperty(exports, name, { 50/******/ configurable: false, 51/******/ enumerable: true, 52/******/ get: getter 53/******/ }); 54/******/ } 55/******/ }; 56/******/ 57/******/ // getDefaultExport function for compatibility with non-harmony modules 58/******/ __webpack_require__.n = function(module) { 59/******/ var getter = module && module.__esModule ? 60/******/ function getDefault() { return module['default']; } : 61/******/ function getModuleExports() { return module; }; 62/******/ __webpack_require__.d(getter, 'a', getter); 63/******/ return getter; 64/******/ }; 65/******/ 66/******/ // Object.prototype.hasOwnProperty.call 67/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 68/******/ 69/******/ // __webpack_public_path__ 70/******/ __webpack_require__.p = "/js/"; 71/******/ 72/******/ // Load entry module and return exports 73/******/ return __webpack_require__(__webpack_require__.s = 7); 74/******/ }) 75/************************************************************************/ 76/******/ ([ 77/* 0 */ 78/***/ (function(module, exports, __webpack_require__) { 79 80"use strict"; 81 82Object.defineProperty(exports, "__esModule", { value: true }); 83var MotorolaCDN = /** @class */ (function () { 84 function MotorolaCDN() { 85 } 86 MotorolaCDN.setCDN = function (url) { 87 MotorolaCDN.cdnUrl = url; 88 }; 89 return MotorolaCDN; 90}()); 91exports.MotorolaCDN = MotorolaCDN; 92 93 94/***/ }), 95/* 1 */ 96/***/ (function(module, exports, __webpack_require__) { 97 98"use strict"; 99 100Object.defineProperty(exports, "__esModule", { value: true }); 101var CustomEvents = /** @class */ (function () { 102 function CustomEvents() { 103 } 104 CustomEvents.motorolaCoveoStandaloneSearchBox = 'motorolaCoveoStandaloneSearchBox'; 105 CustomEvents.motorolaCoveoStandaloneSearchBoxBeforeRedirect = 'motorolaCoveoStandaloneSearchBoxBeforeRedirect'; 106 CustomEvents.motorolaHideCoveoStandaloneSearchBox = 'motorolaHideCoveoStandaloneSearchBox'; 107 CustomEvents.motorolaProductCatalogSearch = 'motorolaProductCatalogSearch'; 108 return CustomEvents; 109}()); 110exports.CustomEvents = CustomEvents; 111 112 113/***/ }), 114/* 2 */ 115/***/ (function(module, exports, __webpack_require__) { 116 117"use strict"; 118 119Object.defineProperty(exports, "__esModule", { value: true }); 120var MotorolaHelper = /** @class */ (function () { 121 function MotorolaHelper() { 122 } 123 return MotorolaHelper; 124}()); 125exports.MotorolaHelper = MotorolaHelper; 126 127 128/***/ }), 129/* 3 */ 130/***/ (function(module, exports, __webpack_require__) { 131 132"use strict"; 133 134Object.defineProperty(exports, "__esModule", { value: true }); 135var browser = __webpack_require__(13); 136var MotorolaFacetManager = /** @class */ (function () { 137 function MotorolaFacetManager() { 138 } 139 /** 140 * Add the boolean option `autoCollapse` on the `Facet` component 141 * Override `createDom` prototype on the `Facet` component 142 * 143 * @static 144 * @memberof MotorolaFacetManager 145 */ 146 MotorolaFacetManager.initializeFacetManager = function () { 147 var defaultFacetCreateDom = Coveo.Facet.prototype.createDom; 148 Coveo.Facet.options['autoCollapse'] = Coveo.ComponentOptions.buildBooleanOption({ defaultValue: false }); 149 Coveo.Facet.options['actionPositionCollapse'] = Coveo.ComponentOptions.buildStringOption({ defaultValue: 'top-right' }); 150 Coveo.Facet.options['actionPositionMoreLess'] = Coveo.ComponentOptions.buildStringOption({ defaultValue: 'align' }); 151 Coveo.Facet.prototype.createDom = function () { 152 var self = this; 153 defaultFacetCreateDom.call(self); 154 MotorolaFacetManager.autoCollapse(self); 155 MotorolaFacetManager.setActionPositionCollapse(self); 156 MotorolaFacetManager.setActionPositionMoreLess(self); 157 MotorolaFacetManager.bindCollapseToggleEvent(self); 158 MotorolaFacetManager.displayMoreLessLabels(self); 159 MotorolaFacetManager.autoCollapseOnScreenSize(self); 160 }; 161 }; 162 /** 163 * Set the action position for the collapse/expand of the `Facet` component 164 * 165 * @static 166 * @param {Coveo.Facet} facet 167 * @memberof MotorolaFacetManager 168 */ 169 MotorolaFacetManager.setActionPositionCollapse = function (facet) { 170 Coveo.$$(facet.element).addClass('action-position-collapse-' + facet.options['actionPositionCollapse']); 171 }; 172 /** 173 * Set the action position for the show more/less of the `Facet` component 174 * 175 * @static 176 * @param {Coveo.Facet} facet 177 * @memberof MotorolaFacetManager 178 */ 179 MotorolaFacetManager.setActionPositionMoreLess = function (facet) { 180 Coveo.$$(facet.element).addClass('action-position-more-less-' + facet.options['actionPositionMoreLess']); 181 }; 182 /** 183 * Collapse the `Facet` if the option `autoCollapse` is set to `true` 184 * 185 * @static 186 * @param {Coveo.Facet} facet 187 * @memberof MotorolaFacetManager 188 */ 189 MotorolaFacetManager.autoCollapse = function (facet) { 190 if (facet.options['autoCollapse']) { 191 facet.collapse(); 192 } 193 }; 194 /** 195 * Collapse the `Facet` if the screen size is for mobile 196 * 197 * @static 198 * @param {Coveo.Facet} facet 199 * @memberof MotorolaFacetManager 200 */ 201 MotorolaFacetManager.autoCollapseOnScreenSize = function (facet) { 202 if (window.matchMedia('(max-width: 480px)').matches) { 203 facet.collapse(); 204 } 205 }; 206 /** 207 * Bind the `click` event on the `Facet` title to toggle between expand and collapse action 208 * 209 * @static 210 * @param {Coveo.Facet} facet 211 * @memberof MotorolaFacetManager 212 */ 213 MotorolaFacetManager.bindCollapseToggleEvent = function (facet) { 214 var facetToggleElement = Coveo.$$(facet.element).findClass('coveo-facet-header')[0]; 215 if (facetToggleElement) { 216 var handleFacetToggling = function (event) { 217 if (Coveo.$$(facet.element).hasClass('coveo-facet-collapsed')) { 218 facet.expand(); 219 } 220 else { 221 facet.collapse(); 222 } 223 }; 224 Coveo.$$(facetToggleElement).on('click', handleFacetToggling); 225 } 226 }; 227 /**
228 * Display `ShowMore` and `ShowLess` labels instead of icons 229 * 230 * @static 231 * @param {Coveo.Facet} facet 232 * @memberof MotorolaFacetManager 233 */ 234 MotorolaFacetManager.displayMoreLessLabels = function (facet) { 235 if (facet.options['actionPositionMoreLess'] == 'align') { 236 var facetLessElement = Coveo.$$(facet.element).find('.coveo-facet-less'); 237 var facetMoreElement = Coveo.$$(facet.element).find('.coveo-facet-more'); 238 var newFacetLessButtonElement = Coveo.$$('span', { class: 'coveo-text' }, Coveo.l('ShowLess')).el; 239 var newFacetMoreButtonElement = Coveo.$$('span', { class: 'coveo-text' }, Coveo.l('ShowMore')).el; 240 var newFacetMoreLessSeperator = Coveo.$$('span', { class: 'coveo-more-less-seperator' }, Coveo.l('|')).el; 241 if (facetLessElement) { 242 var facetLessIcon = Coveo.$$(facetLessElement).find('.' + facetLessElement.className + '-icon'); 243 // remove HTMLElement instead of hiding it with CSS 244 if (facetLessIcon) { 245 switch (browser && browser.name) { 246 case 'ie': 247 facetLessIcon.parentNode.removeChild(facetLessIcon); 248 break; 249 default: 250 facetLessIcon.remove(); 251 } 252 } 253 Coveo.$$(facetLessElement).empty(); 254 Coveo.$$(facetLessElement).append(newFacetLessButtonElement); 255 } 256 if (facetMoreElement) { 257 var facetMoreIcon = Coveo.$$(facetMoreElement).find('.' + facetMoreElement.className + '-icon'); 258 // remove HTMLElement instead of hiding it with CSS 259 if (facetMoreIcon) { 260 switch (browser && browser.name) { 261 case 'ie': 262 facetMoreIcon.parentNode.removeChild(facetMoreIcon); 263 break; 264 default: 265 facetMoreIcon.remove(); 266 } 267 } 268 Coveo.$$(facetMoreElement).empty(); 269 Coveo.$$(facetMoreElement).append(newFacetMoreButtonElement); 270 } 271 if (!Coveo.$$(facet.element).find('.coveo-more-less-seperator')) { 272 Coveo.$$(facet.element).find('.coveo-facet-footer').appendChild(newFacetMoreLessSeperator); 273 } 274 } 275 }; 276 return MotorolaFacetManager; 277}()); 278exports.MotorolaFacetManager = MotorolaFacetManager; 279 280 281/***/ }), 282/* 4 */ 283/***/ (function(module, exports, __webpack_require__) { 284 285"use strict"; 286 287Object.defineProperty(exports, "__esModule", { value: true }); 288var MotorolaEndpoints = /** @class */ (function () { 289 function MotorolaEndpoints() { 290 } 291 MotorolaEndpoints.setEndpoints = function (url) { 292 if (MotorolaEndpoints.endpointsUrl != url) { 293 MotorolaEndpoints.endpointsUrl = url; 294 MotorolaEndpoints.setCustomCultureFilesEndpoints(url); 295 } 296 }; 297 MotorolaEndpoints.setCustomCultureFilesEndpoints = function (url) { 298 MotorolaEndpoints.endpoints = { 299 jqxhrSearchDictionary: jQuery.getJSON(url + '/searchdictionary.json'), 300 jqhxrProductCategoryTranslations: (typeof isSRPage === "undefined")?"":jQuery.get({ url: "/bin/productcategorytranslations." + utag_data.locale, dataType: "text" }) 301 }; 302 }; 303 ; 304 return MotorolaEndpoints; 305}()); 306exports.MotorolaEndpoints = MotorolaEndpoints; 307 308 309/***/ }), 310/* 5 */ 311/***/ (function(module, exports, __webpack_require__) { 312 313"use strict"; 314 315Object.defineProperty(exports, "__esModule", { value: true }); 316var MotorolaEndpoints_1 = __webpack_require__(4); 317var MotorolaCDN_1 = __webpack_require__(0); 318var MotorolaLocalization = /** @class */ (function () { 319 function MotorolaLocalization() { 320 } 321 MotorolaLocalization.setUserLocale = function (locale) { 322 if (locale) { 323 MotorolaLocalization.userLocale = locale; 324 this.setSearchInterfaceLanguage(locale.substring(0, locale.indexOf('_'))); 325 } 326 }; 327 MotorolaLocalization.setSearchInterfaceLanguage = function (language) { 328 MotorolaLocalization.searchInterfaceLanguage = language; 329 }; 330 MotorolaLocalization.loadCustomCultureFiles = function () { 331 // Motorola Endpoints 332 var endpoints = MotorolaEndpoints_1.MotorolaEndpoints.endpoints; 333 // Get All language dictionary 334 $.when([endpoints.jqxhrSearchDictionary, endpoints.jqhxrProductCategoryTranslations]).then(function (data) { 335 // Search Dictionary 336 if (data[0]['responseJSON']) { 337 var searchDictionary = data[0]['responseJSON']; 338 var customSearchDictionary = {}; 339 customSearchDictionary[MotorolaLocalization.searchInterfaceLanguage] = searchDictionary[MotorolaLocalization.userLocale];
340 String.toLocaleString(customSearchDictionary); 341 } 342 // Product Category Translations 343 if (data[1] && data[1]['responseText']) { 344 try { 345 var rawProductCategoryTranslationsText = data[1]['responseText']; 346 var decorationCommentIndex = rawProductCategoryTranslationsText.indexOf('<!--'); 347 if (decorationCommentIndex !== -1) { 348 rawProductCategoryTranslationsText = rawProductCategoryTranslationsText.substring(0, decorationCommentIndex); 349 } 350 var productCategoryTranslations = JSON.parse(rawProductCategoryTranslationsText); 351 var customProductCategoryTranslations = {}; 352 customProductCategoryTranslations[MotorolaLocalization.searchInterfaceLanguage] = productCategoryTranslations[MotorolaLocalization.userLocale]; 353 String.toLocaleString(customProductCategoryTranslations); 354 } catch (parseError) { 355 console.log('Issues parsing Product Category Translations ... skipping custom product category translations', parseError); 356 } 357 } 358 // Initialize custom Coveo Search Interface 359 MotorolaLocalization.initCoveo(); 360 }, function (e) { 361 console.log('Issues loading Motorola Custom Culture Files ... cannot initialize Custom Coveo Search Interface', arguments); 362 }); 363 }; 364 MotorolaLocalization.loadCoveoJsUiCultureFile = function () { 365 $.when(jQuery.getScript(MotorolaCDN_1.MotorolaCDN.cdnUrl + '/js/cultures/' + MotorolaLocalization.searchInterfaceLanguage + '.js')).then(function (data) { 366 MotorolaLocalization.loadCustomCultureFiles(); 367 }, function (e) { 368 console.log('Issues loading Coveo Culture File... cannot initialize Custom Coveo Search Interface', arguments); 369 }); 370 }; 371 MotorolaLocalization.loadLocalizationDictionaries = function (initCoveoCallback) { 372 MotorolaLocalization.initCoveo = initCoveoCallback; 373 this.loadCoveoJsUiCultureFile(); 374 }; 375 MotorolaLocalization.getUserLocaleFromQueryStringParameter = function () { 376 var userLocale = null; 377 if (window.location.search) { 378 _.find(window.location.search.slice(1).split('&'), function (param) { 379 var keyValuePair = param.split('='); 380 userLocale = keyValuePair[0] == 'userLocale' ? keyValuePair[1] : null; 381 return userLocale; 382 }); 383 } 384 return userLocale; 385 }; 386 MotorolaLocalization.getUserLocaleFromUrlPath = function () { 387 var urlParts = window.location.pathname.split('/'); 388 return urlParts[urlParts.length - 2]; 389 }; 390 return MotorolaLocalization; 391}()); 392exports.MotorolaLocalization = MotorolaLocalization; 393 394 395/***/ }), 396/* 6 */ 397/***/ (function(module, exports, __webpack_require__) { 398 399"use strict"; 400 401Object.defineProperty(exports, "__esModule", { value: true }); 402var MotorolaCDN_1 = __webpack_require__(0); 403var CustomOmniboxSuggestionsDefaultTemplate = /** @class */ (function () { 404 function CustomOmniboxSuggestionsDefaultTemplate() { 405 } 406 CustomOmniboxSuggestionsDefaultTemplate.instantiateToString = function () { 407 var template = '<div class="custom-suggestion">' + 408 "<div class=\"title\">{{= raw.highlightedTitle }}</div>" + 409 '</div>'; 410 return template; 411 }; 412 CustomOmniboxSuggestionsDefaultTemplate.instantiateToString2 = function () { 413 var template = '<div class="custom-suggestion">' + 414 ("<img src=\"{{- raw.thumbnailUrl }}\" class=\"{{- raw.thumbnailClass }}\" alt=\"Result Thumbnail\" onerror=\"this.src='" + MotorolaCDN_1.MotorolaCDN.cdnUrl + "/vendor/motorola/image/html-icon.svg';this.className='coveo_default_icon'\">") + 415 "<span class=\"title\">{{= raw.highlightedTitle }}</span>" + 416 '</div>'; 417 return template; 418 }; 419 return CustomOmniboxSuggestionsDefaultTemplate; 420}()); 421exports.CustomOmniboxSuggestionsDefaultTemplate = CustomOmniboxSuggestionsDefaultTemplate; 422 423 424/***/ }), 425/* 7 */ 426/***/ (function(module, exports, __webpack_require__) { 427 428module.exports = __webpack_require__(8); 429 430 431/***/ }), 432/* 8 */ 433/***/ (function(module, exports, __webpack_require__) { 434 435"use strict"; 436 437function __export(m) { 438 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 439} 440Object.defineProperty(exports, "__esModule", { value: true }); 441__export(__webpack_require__(9)); 442__export(__webpack_require__(15)); 443__export(__webpack_require__(16)); 444__export(__webpack_require__(2)); 445__export(__webpack_require__(17)); 446var MotorolaCDN_1 = __webpack_require__(0); 447exports.MotorolaCDN = MotorolaCDN_1.MotorolaCDN; 448var MotorolaEndpoints_1 = __webpack_require__(4); 449exports.MotorolaEndpoints = MotorolaEndpoints_1.MotorolaEndpoints; 450var MotorolaLocalization_1 = __webpack_require__(5); 451exports.MotorolaLocalization = MotorolaLocalization_1.MotorolaLocalization; 452var MotorolaResultTemplate_1 = __webpack_require__(19); 453exports.MotorolaResultTemplate = MotorolaResultTemplate_1.MotorolaResultTemplate; 454var MotorolaSecurity_1 = __webpack_require__(20); 455exports.MotorolaSecurity = MotorolaSecurity_1.MotorolaSecurity; 456var CustomEvents_1 = __webpack_require__(1); 457exports.CustomEvents = CustomEvents_1.CustomEvents; 458var CustomResultsPerPage_1 = __webpack_require__(21); 459exports.CustomResultsPerPage = CustomResultsPerPage_1.CustomResultsPerPage; 460var CustomPager_1 = __webpack_require__(23); 461exports.CustomPager = CustomPager_1.CustomPager; 462var CustomQuerySummary_1 = __webpack_require__(24); 463exports.CustomQuerySummary = CustomQuerySummary_1.CustomQuerySummary; 464var CustomFacetsClearAll_1 = __webpack_require__(26); 465exports.CustomFacetsClearAll = CustomFacetsClearAll_1.CustomFacetsClearAll; 466var CustomLocaleBasedTitleDescription_1 = __webpack_require__(27); 467exports.CustomLocaleBasedTitleDescription = CustomLocaleBasedTitleDescription_1.CustomLocaleBasedTitleDescription; 468var CustomTopResults_1 = __webpack_require__(28); 469exports.CustomTopResults = CustomTopResults_1.CustomTopResults; 470var CustomNoResultsFound_1 = __webpack_require__(29); 471exports.CustomNoResultsFound = CustomNoResultsFound_1.CustomNoResultsFound; 472var CustomRelatedSearches_1 = __webpack_require__(30); 473exports.CustomRelatedSearches = CustomRelatedSearches_1.CustomRelatedSearches;
474var CustomYouTubeThumbnail_1 = __webpack_require__(31); 475exports.CustomYouTubeThumbnail = CustomYouTubeThumbnail_1.CustomYouTubeThumbnail; 476var CustomBrightcoveThumbnail_1 = __webpack_require__(32); 477exports.CustomBrightcoveThumbnail = CustomBrightcoveThumbnail_1.CustomBrightcoveThumbnail; 478var CustomSecureContentIcon_1 = __webpack_require__(33); 479exports.CustomSecureContentIcon = CustomSecureContentIcon_1.CustomSecureContentIcon; 480var CustomPrintableUri_1 = __webpack_require__(34); 481exports.CustomPrintableUri = CustomPrintableUri_1.CustomPrintableUri; 482var CustomFacetsToggle_1 = __webpack_require__(38); 483exports.CustomFacetsToggle = CustomFacetsToggle_1.CustomFacetsToggle; 484var CustomResultLayout_1 = __webpack_require__(41); 485exports.CustomResultLayout = CustomResultLayout_1.CustomResultLayout; 486var CustomTealiumLink_1 = __webpack_require__(42); 487exports.CustomTealiumLink = CustomTealiumLink_1.CustomTealiumLink; 488var CustomTooltips_1 = __webpack_require__(43); 489exports.CustomTooltips = CustomTooltips_1.CustomTooltips; 490var CustomBrightcoveVideoPlayer_1 = __webpack_require__(44); 491exports.CustomBrightcoveVideoPlayer = CustomBrightcoveVideoPlayer_1.CustomBrightcoveVideoPlayer; 492var CustomOmniboxSuggestions_1 = __webpack_require__(45); 493exports.CustomOmniboxSuggestions = CustomOmniboxSuggestions_1.CustomOmniboxSuggestions; 494var CustomOmniboxSuggestionsDefaultTemplate_1 = __webpack_require__(6); 495exports.CustomOmniboxSuggestionsDefaultTemplate = CustomOmniboxSuggestionsDefaultTemplate_1.CustomOmniboxSuggestionsDefaultTemplate; 496var CustomHideStandaloneSearchbox_1 = __webpack_require__(47); 497exports.CustomHideStandaloneSearchbox = CustomHideStandaloneSearchbox_1.CustomHideStandaloneSearchbox; 498var CustomProductCatalogSearch_1 = __webpack_require__(49); 499exports.CustomProductCatalogSearch = CustomProductCatalogSearch_1.CustomProductCatalogSearch; 500var CustomContext_1 = __webpack_require__(51); 501exports.CustomContext = CustomContext_1.CustomContext; 502var CustomPipelineContext_1 = __webpack_require__(52); 503exports.CustomPipelineContext = CustomPipelineContext_1.CustomPipelineContext; 504__export(__webpack_require__(53)); 505var SwapVar_1 = __webpack_require__(54); 506SwapVar_1.swapVar(this); 507 508 509/***/ }), 510/* 9 */ 511/***/ (function(module, exports, __webpack_require__) { 512 513"use strict"; 514 515function __export(m) { 516 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 517} 518Object.defineProperty(exports, "__esModule", { value: true }); 519__webpack_require__(10); 520var UrlUtils_1 = __webpack_require__(11); 521exports.UrlUtils = UrlUtils_1.UrlUtils; 522__export(__webpack_require__(12)); 523var CustomEvents_1 = __webpack_require__(1); 524exports.CustomEvents = CustomEvents_1.CustomEvents; 525var MotorolaHelper_1 = __webpack_require__(2); 526exports.MotorolaHelper = MotorolaHelper_1.MotorolaHelper; 527var MotorolaFacetManager_1 = __webpack_require__(3); 528exports.MotorolaFacetManager = MotorolaFacetManager_1.MotorolaFacetManager; 529 530 531/***/ }), 532/* 10 */ 533/***/ (function(module, exports) { 534 535var _this = this; 536String.prototype.getInitials = function (glue) { 537 if (glue === void 0) { glue = true; } 538 var initials = _this.replace(/[^a-zA-Z- ]/g, '').match(/\b\w/g) || []; 539 if (glue) { 540 return initials.join(''); 541 } 542 return initials; 543}; 544String.prototype.capitalize = function () { 545 return this.toLowerCase().replace(/\b\w/g, function (m) { 546 return m.toUpperCase(); 547 }); 548}; 549 550 551/***/ }), 552/* 11 */ 553/***/ (function(module, exports, __webpack_require__) { 554 555"use strict"; 556 557Object.defineProperty(exports, "__esModule", { value: true }); 558var UrlUtils = /** @class */ (function () { 559 function UrlUtils() { 560 } 561 UrlUtils.getUrlParams = function (query) { 562 if (!query) { 563 return {}; 564 } 565 var parser = document.createElement('a'); 566 var search = ''; 567 parser.href = query; 568 var hash = parser.hash.substring(1); 569 if (hash) { 570 var hashParser = document.createElement('a'); 571 hashParser.href = hash; 572 search = hashParser.search.substring(1); 573 } 574 else { 575 search = parser.search.substring(1); 576 } 577 search = search || query; 578 return (/^[?#]/.test(search) ? search.slice(1) : search) 579 .split('&') 580 .reduce(function (params, param) { 581 var _a = param.split('='), key = _a[0], value = _a[1]; 582 params[key] = value ? decodeURIComponent(value.replace(/\+/g, ' ')) : ''; 583 return params; 584 }, {}); 585 }; 586 return UrlUtils; 587}()); 588exports.UrlUtils = UrlUtils; 589; 590 591 592/***/ }), 593/* 12 */ 594/***/ (function(module, exports, __webpack_require__) { 595 596"use strict"; 597 598Object.defineProperty(exports, "__esModule", { value: true }); 599function renewMotorolaAccessToken() { 600 var renewTokenPromise = new Promise(function (resolve, reject) { 601 var xhr = new XMLHttpRequest(); 602 xhr.open('POST', '/renewtoken'); 603 xhr.onreadystatechange = handler; 604 xhr.setRequestHeader('Accept', 'application/text'); 605 xhr.send(); 606 function handler() { 607 if (this.readyState === this.DONE) { 608 if (this.status === 200) { 609 resolve(this.response); 610 } 611 else { 612 reject(new Error('renewtoken failed with status: [' + this.status + ']')); 613 } 614 } 615 } 616 }); 617 return renewTokenPromise; 618}
619exports.renewMotorolaAccessToken = renewMotorolaAccessToken; 620 621 622/***/ }), 623/* 13 */ 624/***/ (function(module, exports, __webpack_require__) { 625 626/* WEBPACK VAR INJECTION */(function(process) {function detect() { 627 if (typeof navigator !== 'undefined') { 628 return parseUserAgent(navigator.userAgent); 629 } 630 631 return getNodeVersion(); 632} 633 634function detectOS(userAgentString) { 635 var rules = getOperatingSystemRules(); 636 var detected = rules.filter(function (os) { 637 return os.rule && os.rule.test(userAgentString); 638 })[0]; 639 640 return detected ? detected.name : null; 641} 642 643function getNodeVersion() { 644 var isNode = typeof process !== 'undefined' && process.version; 645 return isNode && { 646 name: 'node', 647 version: process.version.slice(1), 648 os: process.platform 649 }; 650} 651 652function parseUserAgent(userAgentString) { 653 var browsers = getBrowserRules(); 654 if (!userAgentString) { 655 return null; 656 } 657 658 var detected = browsers.map(function(browser) { 659 var match = browser.rule.exec(userAgentString); 660 var version = match && match[1].split(/[._]/).slice(0,3); 661 662 if (version && version.length < 3) { 663 version = version.concat(version.length == 1 ? [0, 0] : [0]); 664 } 665 666 return match && { 667 name: browser.name, 668 version: version.join('.') 669 }; 670 }).filter(Boolean)[0] || null; 671 672 if (detected) { 673 detected.os = detectOS(userAgentString); 674 } 675 676 if (/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/i.test(userAgentString)) { 677 detected = detected || {}; 678 detected.bot = true; 679 } 680 681 return detected; 682} 683 684function getBrowserRules() { 685 return buildRules([ 686 [ 'aol', /AOLShield\/([0-9\._]+)/ ], 687 [ 'edge', /Edge\/([0-9\._]+)/ ], 688 [ 'yandexbrowser', /YaBrowser\/([0-9\._]+)/ ], 689 [ 'vivaldi', /Vivaldi\/([0-9\.]+)/ ], 690 [ 'kakaotalk', /KAKAOTALK\s([0-9\.]+)/ ], 691 [ 'samsung', /SamsungBrowser\/([0-9\.]+)/ ], 692 [ 'chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/ ], 693 [ 'phantomjs', /PhantomJS\/([0-9\.]+)(:?\s|$)/ ], 694 [ 'crios', /CriOS\/([0-9\.]+)(:?\s|$)/ ], 695 [ 'firefox', /Firefox\/([0-9\.]+)(?:\s|$)/ ], 696 [ 'fxios', /FxiOS\/([0-9\.]+)/ ], 697 [ 'opera', /Opera\/([0-9\.]+)(?:\s|$)/ ], 698 [ 'opera', /OPR\/([0-9\.]+)(:?\s|$)$/ ], 699 [ 'ie', /Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/ ], 700 [ 'ie', /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/ ], 701 [ 'ie', /MSIE\s(7\.0)/ ], 702 [ 'bb10', /BB10;\sTouch.*Version\/([0-9\.]+)/ ], 703 [ 'android', /Android\s([0-9\.]+)/ ], 704 [ 'ios', /Version\/([0-9\._]+).*Mobile.*Safari.*/ ], 705 [ 'safari', /Version\/([0-9\._]+).*Safari/ ], 706 [ 'facebook', /FBAV\/([0-9\.]+)/], 707 [ 'instagram', /Instagram\s([0-9\.]+)/], 708 [ 'ios-webview', /AppleWebKit\/([0-9\.]+).*Mobile/] 709 ]); 710} 711 712function getOperatingSystemRules() { 713 return buildRules([ 714 [ 'iOS', /iP(hone|od|ad)/ ], 715 [ 'Android OS', /Android/ ], 716 [ 'BlackBerry OS', /BlackBerry|BB10/ ], 717 [ 'Windows Mobile', /IEMobile/ ], 718 [ 'Amazon OS', /Kindle/ ], 719 [ 'Windows 3.11', /Win16/ ], 720 [ 'Windows 95', /(Windows 95)|(Win95)|(Windows_95)/ ], 721 [ 'Windows 98', /(Windows 98)|(Win98)/ ], 722 [ 'Windows 2000', /(Windows NT 5.0)|(Windows 2000)/ ], 723 [ 'Windows XP', /(Windows NT 5.1)|(Windows XP)/ ], 724 [ 'Windows Server 2003', /(Windows NT 5.2)/ ], 725 [ 'Windows Vista', /(Windows NT 6.0)/ ], 726 [ 'Windows 7', /(Windows NT 6.1)/ ], 727 [ 'Windows 8', /(Windows NT 6.2)/ ], 728 [ 'Windows 8.1', /(Windows NT 6.3)/ ], 729 [ 'Windows 10', /(Windows NT 10.0)/ ], 730 [ 'Windows ME', /Windows ME/ ], 731 [ 'Open BSD', /OpenBSD/ ], 732 [ 'Sun OS', /SunOS/ ], 733 [ 'Linux', /(Linux)|(X11)/ ], 734 [ 'Mac OS', /(Mac_PowerPC)|(Macintosh)/ ], 735 [ 'QNX', /QNX/ ], 736 [ 'BeOS', /BeOS/ ], 737 [ 'OS/2', /OS\/2/ ], 738 [ 'Search Bot', /(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\/Teoma)|(ia_archiver)/ ] 739 ]); 740} 741 742function buildRules(ruleTuples) { 743 return ruleTuples.map(function(tuple) { 744 return { 745 name: tuple[0], 746 rule: tuple[1] 747 }; 748 }); 749} 750 751module.exports = { 752 detect: detect, 753 detectOS: detectOS, 754 getNodeVersion: getNodeVersion, 755 parseUserAgent: parseUserAgent 756}; 757 758/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(14))) 759 760/***/ }), 761/* 14
vendor: 5,474 bytes, lines 761-951
761 */ 762/***/ (function(module, exports) { 763 764// shim for using process in browser 765var process = module.exports = {}; 766 767// cached from whatever global is present so that test runners that stub it 768// don't break things. But we need to wrap it in a try catch in case it is 769// wrapped in strict mode code which doesn't define any globals. It's inside a 770// function because try/catches deoptimize in certain engines. 771 772var cachedSetTimeout; 773var cachedClearTimeout; 774 775function defaultSetTimout() { 776 throw new Error('setTimeout has not been defined'); 777} 778function defaultClearTimeout () { 779 throw new Error('clearTimeout has not been defined'); 780} 781(function () { 782 try { 783 if (typeof setTimeout === 'function') { 784 cachedSetTimeout = setTimeout; 785 } else { 786 cachedSetTimeout = defaultSetTimout; 787 } 788 } catch (e) { 789 cachedSetTimeout = defaultSetTimout; 790 } 791 try { 792 if (typeof clearTimeout === 'function') { 793 cachedClearTimeout = clearTimeout; 794 } else { 795 cachedClearTimeout = defaultClearTimeout; 796 } 797 } catch (e) { 798 cachedClearTimeout = defaultClearTimeout; 799 } 800} ()) 801function runTimeout(fun) { 802 if (cachedSetTimeout === setTimeout) { 803 //normal enviroments in sane situations 804 return setTimeout(fun, 0); 805 } 806 // if setTimeout wasn't available but was latter defined 807 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 808 cachedSetTimeout = setTimeout; 809 return setTimeout(fun, 0); 810 } 811 try { 812 // when when somebody has screwed with setTimeout but no I.E. maddness 813 return cachedSetTimeout(fun, 0); 814 } catch(e){ 815 try { 816 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 817 return cachedSetTimeout.call(null, fun, 0); 818 } catch(e){ 819 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error 820 return cachedSetTimeout.call(this, fun, 0); 821 } 822 } 823 824 825} 826function runClearTimeout(marker) { 827 if (cachedClearTimeout === clearTimeout) { 828 //normal enviroments in sane situations 829 return clearTimeout(marker); 830 } 831 // if clearTimeout wasn't available but was latter defined 832 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 833 cachedClearTimeout = clearTimeout; 834 return clearTimeout(marker); 835 } 836 try { 837 // when when somebody has screwed with setTimeout but no I.E. maddness 838 return cachedClearTimeout(marker); 839 } catch (e){ 840 try { 841 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 842 return cachedClearTimeout.call(null, marker); 843 } catch (e){ 844 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. 845 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 846 return cachedClearTimeout.call(this, marker); 847 } 848 } 849 850 851 852} 853var queue = []; 854var draining = false; 855var currentQueue; 856var queueIndex = -1; 857 858function cleanUpNextTick() { 859 if (!draining || !currentQueue) { 860 return; 861 } 862 draining = false; 863 if (currentQueue.length) { 864 queue = currentQueue.concat(queue); 865 } else { 866 queueIndex = -1; 867 } 868 if (queue.length) { 869 drainQueue(); 870 } 871} 872 873function drainQueue() { 874 if (draining) { 875 return; 876 } 877 var timeout = runTimeout(cleanUpNextTick); 878 draining = true; 879 880 var len = queue.length; 881 while(len) { 882 currentQueue = queue; 883 queue = []; 884 while (++queueIndex < len) { 885 if (currentQueue) { 886 currentQueue[queueIndex].run(); 887 } 888 } 889 queueIndex = -1; 890 len = queue.length; 891 } 892 currentQueue = null; 893 draining = false; 894 runClearTimeout(timeout); 895} 896 897process.nextTick = function (fun) { 898 var args = new Array(arguments.length - 1); 899 if (arguments.length > 1) { 900 for (var i = 1; i < arguments.length; i++) { 901 args[i - 1] = arguments[i]; 902 } 903 } 904 queue.push(new Item(fun, args)); 905 if (queue.length === 1 && !draining) { 906 runTimeout(drainQueue); 907 } 908}; 909 910// v8 likes predictible objects 911function Item(fun, array) { 912 this.fun = fun; 913 this.array = array; 914} 915Item.prototype.run = function () { 916 this.fun.apply(null, this.array); 917}; 918process.title = 'browser'; 919process.browser = true; 920process.env = {}; 921process.argv = []; 922process.version = ''; // empty string to avoid regexp issues 923process.versions = {}; 924 925function noop() {} 926 927process.on = noop; 928process.addListener = noop; 929process.once = noop; 930process.off = noop; 931process.removeListener = noop; 932process.removeAllListeners = noop; 933process.emit = noop; 934process.prependListener = noop; 935process.prependOnceListener = noop; 936 937process.listeners = function (name) { return [] } 938 939process.binding = function (name) { 940 throw new Error('process.binding is not supported'); 941}; 942 943process.cwd = function () { return '/' }; 944process.chdir = function (dir) { 945 throw new Error('process.chdir is not supported'); 946}; 947process.umask = function() { return 0; }; 948 949 950/***/ }), 951/* 1
9515 */ 952/***/ (function(module, exports, __webpack_require__) { 953 954"use strict"; 955 956Object.defineProperty(exports, "__esModule", { value: true }); 957var $$ = Coveo.$$; 958var MotorolaFacetManager_1 = __webpack_require__(3); 959/** 960 * Required customization specifically applied for Tableau's implementation 961 */ 962var MotorolaCusto = /** @class */ (function () { 963 function MotorolaCusto(searchInterfaceElement, customContext, customDimensions, customDimensionsFields) { 964 var _this = this; 965 this.searchInterfaceElement = searchInterfaceElement; 966 this.rootElement = $$(searchInterfaceElement); 967 this.customContext = customContext; 968 this.customDimensions = customDimensions; 969 this.customDimensionsFields = customDimensionsFields; 970 // Initialization Events 971 this.rootElement.on(Coveo.InitializationEvents.beforeInitialization, function () { return _this.handleBeforeInit(); }); 972 this.rootElement.on(Coveo.InitializationEvents.afterInitialization, function () { return _this.handleAfterInit(); }); 973 this.rootElement.on(Coveo.InitializationEvents.afterComponentsInitialization, function () { return _this.handleAfterComponentsInit(); }); 974 // Query Events 975 this.rootElement.on(Coveo.QueryEvents.newQuery, function (e, data) { return _this.handleNewQuery(e, data); }); 976 this.rootElement.on(Coveo.QueryEvents.buildingQuery, function (e, data) { return _this.handleBuildingQuery(e, data); }); 977 this.rootElement.on(Coveo.QueryEvents.doneBuildingQuery, function (e, data) { return _this.handleDoneBuildingQuery(e, data); }); 978 this.rootElement.on(Coveo.QueryEvents.preprocessResults, function (e, data) { return _this.handlePreprocessResults(e, data); }); 979 this.rootElement.on(Coveo.QueryEvents.querySuccess, function (e, data) { return _this.handleQuerySuccess(e, data); }); 980 this.rootElement.on(Coveo.QueryEvents.noResults, function (e, data) { return _this.handleNoResults(e, data); }); 981 this.rootElement.on(Coveo.ResultListEvents.newResultsDisplayed, function (e, data) { return _this.handleNewResultsDisplayed(e, data); }); 982 // State Events 983 var changeTabEvtName = this.getStateEventName(Coveo.QueryStateModel.eventTypes.changeOne + Coveo.QueryStateModel.attributesEnum.t); 984 var changeAllFacetsEvtNames = _.map(this.rootElement.findAll('.CoveoFacet'), function (el) { 985 return _this.getStateEventName(Coveo.QueryStateModel.eventTypes.changeOne + 'f:' + el.dataset['id']); 986 }); 987 this.rootElement.on(changeAllFacetsEvtNames, function (e, data) { return _this.handleAllFacetsStateChanged(e, data); }); 988 this.rootElement.on(changeTabEvtName, function (e, data) { return _this.handleTabStateChanged(e, data); }); 989 // Analytics Events 990 this.rootElement.on(Coveo.AnalyticsEvents.changeAnalyticsCustomData, function (e, data) { return _this.handleChangeAnalyticsCustomData(e, data); }); 991 // Custom Events 992 // INSERT CODE HERE 993 // Custom Facets 994 if (Coveo.LazyInitialization) { 995 Coveo.load('Facet').then(function () { 996 MotorolaFacetManager_1.MotorolaFacetManager.initializeFacetManager(); 997 }); 998 } 999 else { 1000 MotorolaFacetManager_1.MotorolaFacetManager.initializeFacetManager(); 1001 } 1002 } 1003 MotorolaCusto.prototype.getStateEventName = function (event) { 1004 return Coveo.QueryStateModel.ID + ':' + event; 1005 }; 1006 /** 1007 * Before Initialization 1008 */ 1009 MotorolaCusto.prototype.handleBeforeInit = function () { 1010 }; 1011 /** 1012 * After Initialization 1013 * initializing custom strings during before init event to avoid any issue with SFDC init strings. 1014 */ 1015 MotorolaCusto.prototype.handleAfterInit = function () { 1016 this.initStrings(); 1017 }; 1018 /** 1019 * After Component Initialization 1020 * Registering custom template helper to manage custom icons. see result templates 1021 */ 1022 MotorolaCusto.prototype.handleAfterComponentsInit = function () { 1023 this.searchInterface = Coveo.Component.get(this.rootElement.el, Coveo.SearchInterface); 1024 this.layoutElement = document.getElementsByClassName('coveo-result-layout-section')[0]; 1025 }; 1026 MotorolaCusto.prototype.handleAllFacetsStateChanged = function (evt, args) { 1027 }; 1028 MotorolaCusto.prototype.handleTabStateChanged = function (evt, args) { 1029 // Custom Result Layout behavior
1030 if (args.value == 'Tab_OnlineShop') { 1031 this.layoutElement.style.visibility = 'visible'; 1032 } 1033 else { 1034 this.layoutElement.style.visibility = 'hidden'; 1035 } 1036 }; 1037 /** 1038 * New Query 1039 */ 1040 MotorolaCusto.prototype.handleNewQuery = function (evt, args) { }; 1041 /** 1042 * Building Query 1043 */ 1044 MotorolaCusto.prototype.handleBuildingQuery = function (evt, args) { 1045 args.queryBuilder.addContext(this.customContext); 1046 }; 1047 /** 1048 * Done Building Query 1049 */ 1050 MotorolaCusto.prototype.handleDoneBuildingQuery = function (evt, args) { }; 1051 /** 1052 * Preprocess Results 1053 */ 1054 MotorolaCusto.prototype.handlePreprocessResults = function (evt, args) { 1055 _.each(args.results.results, function (result) { 1056 // Encoded HTML characters like é to é 1057 var resultTitleDom = $$('span'); 1058 resultTitleDom.setHtml(result.title); 1059 result.title = resultTitleDom.text(); 1060 }); 1061 }; 1062 /** 1063 * Query Success 1064 */ 1065 MotorolaCusto.prototype.handleQuerySuccess = function (evt, args) { 1066 if (args.results.totalCount > 0) { 1067 $$(document.body).findId('motorolaRecommendationsInterface').style.display = 'none'; 1068 } 1069 var tabElements = $$(document.getElementById('coveoSearchInterface_main')).findAll('.CoveoTab'); 1070 var locale = args.query.context['locale'].toString(); 1071 for (var i = 0; i < tabElements.length; i++) { 1072 var tabComponent = Coveo.get(tabElements[i]); 1073 var localeMap = MotorolaCusto.tabLocaleMap[locale]; 1074 if (localeMap.indexOf(tabComponent.options['id']) >= 0) { 1075 tabComponent.enable(); 1076 } 1077 else { 1078 tabComponent.disable(); 1079 } 1080 } 1081 }; 1082 /** 1083 * No Results 1084 */ 1085 MotorolaCusto.prototype.handleNoResults = function (evt, data) { 1086 $$(document.body).findId('motorolaRecommendationsInterface').style.display = 'block'; 1087 Coveo.logSearchEvent(document.getElementById('motorolaRecommendationsInterface'), Coveo.analyticsActionCauseList.noResultsBack, {}); 1088 Coveo.executeQuery(document.getElementById('motorolaRecommendationsInterface')); 1089 }; 1090 /** 1091 * New Results Displayed 1092 */ 1093 MotorolaCusto.prototype.handleNewResultsDisplayed = function (evt, data) { }; 1094 /** 1095 * Change Analytics Custom Data 1096 */ 1097 MotorolaCusto.prototype.handleChangeAnalyticsCustomData = function (evt, args) { 1098 args.metaObject = this.flattenAttrExclObjects(args.metaObject, this.customDimensions || {}, 'customDimension'); 1099 if (args.type === 'ClickEvent' || args.type === 'CustomEvent') { 1100 args.metaObject = this.flattenAttrExclObjects(args.metaObject, this.customContext, 'context'); 1101 if (args['resultData']) { 1102 var customDimensionsFields = {}; 1103 _.each(this.customDimensionsFields, function (field) { 1104 if (args['resultData'].raw[field['name']]) { 1105 customDimensionsFields[field['label']] = args['resultData'].raw[field['name']]; 1106 } 1107 }); 1108 args.metaObject = this.flattenAttrExclObjects(args.metaObject, customDimensionsFields, 'customDimensionsFields'); 1109 } 1110 } 1111 }; 1112 /** 1113 * Initialized Custom Strings 1114 */ 1115 MotorolaCusto.prototype.initStrings = function () { 1116 // Custom variable for current application 1117 // String.toLocaleString({ 1118 // 'en': {} 1119 // }); 1120 }; 1121 /** 1122 * Set default options of different UI Components for Motorola. 1123 */ 1124 MotorolaCusto.prototype.getDefaultOptions = function () { 1125 var defaultOptions = {}; 1126 return defaultOptions; 1127 }; 1128 MotorolaCusto.prototype.flattenAttrExclObjects = function (targetobject, sourceobject, sourcename) { 1129 for (var prop in sourceobject) { 1130 var item = sourceobject[prop]; 1131 if (typeof item != 'object') { 1132 targetobject[(sourcename != '' ? sourcename + '_' : '') + prop] = item; 1133 } 1134 else { 1135 targetobject = this.flattenAttrExclObjects(targetobject, item, prop); 1136 } 1137 } 1138 return targetobject; 1139 }; 1140 MotorolaCusto.tabLocaleMap = { 1141 'en_us': ['Tab_All', 'Tab_OnlineShop', 'Tab_PagesDocs', 'Tab_Video', 'Tab_Blog'], 1142 'en_xu': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1143 'en_xl': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1144 'en_xa': ['Tab_All', 'Tab_OnlineShop', 'Tab_PagesDocs', 'Tab_Video'], 1145 'en_xp': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1146 'de_xc': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1147 'fr_fr': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1148 'pl_pl': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1149 'ru_ru': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1150 'he_il': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1151 'zh_tw': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1152 'vi_vn': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1153 'ko_kr': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1154 'ja_jp': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1155 'zh_cn': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1156 'es_xl': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1157 'pt_xl': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1158 'fr_ca': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1159 'en_ca': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1160 'uk_ua': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1161 'it_it': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'], 1162 'ar_sa': ['Tab_All', 'Tab_PagesDocs', 'Tab_Video'] 1163 }; 1164 return MotorolaCusto; 1165}()); 1166exports.MotorolaCusto = MotorolaCusto; 1167; 1168function initMotorolaCusto(element, options, customContext, customDimensions, customDimensionsFields) { 1169 if (options === void 0) { options = {}; } 1170 Coveo.Initialization.initializeFramework(element, options, function () { 1171 var custo = new MotorolaCusto(element, customContext, customDimensions, customDimensionsFields); 1172 custo.initStrings(); 1173 var customOptions = _.extend({}, custo.getDefaultOptions(), options); 1174 return Coveo.Initialization.initSearchInterface(element, customOptions); 1175 }); 1176} 1177exports.initMotorolaCusto = initMotorolaCusto; 1178Coveo.Initialization.registerNamedMethod('initMotorolaCusto', function (element, options, customContext, customDimensions, customDimensionsFields) { 1179 if (options === void 0) { options = {}; } 1180 initMotorolaCusto(element, options, customContext, customDimensions, customDimensionsFields); 1181}); 1182 1183 1184/***/ }), 1185/* 16 */ 1186/***/ (function(module, exports, __webpack_require__) { 1187 1188"use strict"; 1189 1190Object.defineProperty(exports, "__esModule", { value: true }); 1191var $$ = Coveo.$$; 1192/** 1193 * Required customization specifically applied for Tableau's implementation 1194 */ 1195var MotorolaRecommendationsCusto = /** @class */ (function () { 1196 function MotorolaRecommendationsCusto(searchInterfaceElement, customContext, customDimensions, customDimensionsFields) { 1197 var _this = this; 1198 this.searchInterfaceElement = searchInterfaceElement; 1199 this.rootElement = $$(searchInterfaceElement); 1200 this.customContext = customContext; 1201 this.customDimensions = customDimensions; 1202 this.customDimensionsFields = customDimensionsFields; 1203 // Initialization Events 1204 this.rootElement.on(Coveo.InitializationEvents.beforeInitialization, function () { return _this.handleBeforeInit(); }); 1205 this.rootElement.on(Coveo.InitializationEvents.afterInitialization, function () { return _this.handleAfterInit(); }); 1206 this.rootElement.on(Coveo.InitializationEvents.afterComponentsInitialization, function () { return _this.handleAfterComponentsInit(); }); 1207 // Query Events 1208 this.rootElement.on(Coveo.QueryEvents.newQuery, function (e, data) { return _this.handleNewQuery(e, data); }); 1209 this.rootElement.on(Coveo.QueryEvents.buildingQuery, function (e, data) { return _this.handleBuildingQuery(e, data); }); 1210 this.rootElement.on(Coveo.QueryEvents.doneBuildingQuery, function (e, data) { return _this.handleDoneBuildingQuery(e, data); }); 1211 this.rootElement.on(Coveo.QueryEvents.preprocessResults, function (e, data) { return _this.handlePreprocessResults(e, data); }); 1212 this.rootElement.on(Coveo.QueryEvents.querySuccess, function (e, data) { return _this.handleQuerySuccess(e, data); }); 1213 this.rootElement.on(Coveo.QueryEvents.noResults, function (e, data) { return _this.handleNoResults(e, data); }); 1214 this.rootElement.on(Coveo.ResultListEvents.newResultsDisplayed, function (e, data) { return _this.handleNewResultsDisplayed(e, data); }); 1215 // State Events 1216 // INSERT CODE HERE 1217 // Analytics Events 1218 this.rootElement.on(Coveo.AnalyticsEvents.changeAnalyticsCustomData, function (e, data) { return _this.handleChangeAnalyticsCustomData(e, data); }); 1219 // Custom Events 1220 // INSERT CODE HERE 1221 } 1222 MotorolaRecommendationsCusto.prototype.getStateEventName = function (event) { 1223 return Coveo.QueryStateModel.ID + ':' + event; 1224 }; 1225 /** 1226 * Before Initialization 1227 */ 1228 MotorolaRecommendationsCusto.prototype.handleBeforeInit = function () { 1229 }; 1230 /** 1231 * After Initialization 1232 * initializing custom strings during before init event to avoid any issue with SFDC init strings. 1233 */ 1234 MotorolaRecommendationsCusto.prototype.handleAfterInit = function () { 1235 this.initStrings(); 1236 }; 1237 /** 1238 * After Component Initialization 1239 * Registering custom template helper to manage custom icons. see result templates 1240 */ 1241 MotorolaRecommendationsCusto.prototype.handleAfterComponentsInit = function () { 1242 this.searchInterface = Coveo.Component.get(this.rootElement.el, Coveo.SearchInterface); 1243 }; 1244 /** 1245 * New Query 1246 */ 1247 MotorolaRecommendationsCusto.prototype.handleNewQuery = function (evt, args) { }; 1248 /** 1249 * Building Query 1250 */ 1251 MotorolaRecommendationsCusto.prototype.handleBuildingQuery = function (evt, args) { 1252 args.queryBuilder.addContext(this.customContext); 1253 args.queryBuilder.tab = 'Tab_All'; 1254 }; 1255 /** 1256 * Done Building Query 1257 */ 1258 MotorolaRecommendationsCusto.prototype.handleDoneBuildingQuery = function (evt, args) { }; 1259 /** 1260 * Preprocess Results 1261 */ 1262 MotorolaRecommendationsCusto.prototype.handlePreprocessResults = function (evt, args) { 1263 _.each(args.results.results, function (result) { 1264 result['customRankingModifier'] = result.isTopResult ? 'TopResult' : (result.rankingModifier ? result.rankingModifier.replace(' ', '-') : 'NormalResult'); 1265 // Encoded HTML characters like é to é 1266 var resultTitleDom = $$('span'); 1267 resultTitleDom.setHtml(result.title); 1268 result.title = resultTitleDom.text(); 1269 }); 1270 }; 1271 /** 1272 * Query Success 1273 */ 1274 MotorolaRecommendationsCusto.prototype.handleQuerySuccess = function (evt, args) { 1275 }; 1276 MotorolaRecommendationsCusto.prototype.handleNoResults = function (evt, data) { 1277 }; 1278 MotorolaRecommendationsCusto.prototype.handleNewResultsDisplayed = function (evt, data) { 1279 }; 1280 /** 1281 * Change Analytics Custom Data 1282 */ 1283 MotorolaRecommendationsCusto.prototype.handleChangeAnalyticsCustomData = function (evt, args) { 1284 args.metaObject = this.flattenAttrExclObjects(args.metaObject, this.customDimensions || {}, 'customDimension'); 1285 if (args.type === 'ClickEvent' || args.type === 'CustomEvent') { 1286 args.metaObject = this.flattenAttrExclObjects(args.metaObject, this.customContext, 'context'); 1287 if (args['resultData']) { 1288 var customDimensionsFields = {}; 1289 _.each(this.customDimensionsFields, function (field) { 1290 if (args['resultData'].raw[field['name']]) { 1291 customDimensionsFields[field['label']] = args['resultData'].raw[field['name']]; 1292 } 1293 }); 1294 args.metaObject = this.flattenAttrExclObjects(args.metaObject, customDimensionsFields, 'customDimensionsFields'); 1295 } 1296 } 1297 }; 1298 /** 1299 * Initialized Custom Strings 1300 */ 1301 MotorolaRecommendationsCusto.prototype.initStrings = function () { 1302 // Custom variable for current application
1303 // String.toLocaleString({ 1304 // 'en': {} 1305 // }); 1306 }; 1307 /** 1308 * Set default options of different UI Components for Motorola. 1309 */ 1310 MotorolaRecommendationsCusto.prototype.getDefaultOptions = function () { 1311 var defaultOptions = { 1312 SalesforceResultLink: { 1313 alwaysOpenInNewWindow: true 1314 }, 1315 ResultLink: { 1316 alwaysOpenInNewWindow: true 1317 } 1318 }; 1319 return defaultOptions; 1320 }; 1321 MotorolaRecommendationsCusto.prototype.flattenAttrExclObjects = function (targetobject, sourceobject, sourcename) { 1322 for (var prop in sourceobject) { 1323 var item = sourceobject[prop]; 1324 if (typeof item != 'object') { 1325 targetobject[(sourcename != '' ? sourcename + '_' : '') + prop] = item; 1326 } 1327 else { 1328 targetobject = this.flattenAttrExclObjects(targetobject, item, prop); 1329 } 1330 } 1331 return targetobject; 1332 }; 1333 return MotorolaRecommendationsCusto; 1334}()); 1335exports.MotorolaRecommendationsCusto = MotorolaRecommendationsCusto; 1336; 1337function initMotorolaRecommendationsCusto(element, options, customContext, customDimensions, customDimensionsFields) { 1338 if (options === void 0) { options = {}; } 1339 Coveo.Initialization.initializeFramework(element, options, function () { 1340 var custo = new MotorolaRecommendationsCusto(element, customContext, customDimensions, customDimensionsFields); 1341 custo.initStrings(); 1342 var customOptions = _.extend({}, custo.getDefaultOptions(), options); 1343 return Coveo.Initialization.initSearchInterface(element, customOptions); 1344 }); 1345} 1346exports.initMotorolaRecommendationsCusto = initMotorolaRecommendationsCusto; 1347Coveo.Initialization.registerNamedMethod('initMotorolaRecommendationsCusto', function (element, options, customContext, customDimensions, customDimensionsFields) { 1348 if (options === void 0) { options = {}; } 1349 initMotorolaRecommendationsCusto(element, options, customContext, customDimensions, customDimensionsFields); 1350}); 1351 1352 1353/***/ }), 1354/* 17 */ 1355/***/ (function(module, exports, __webpack_require__) { 1356 1357"use strict"; 1358 1359Object.defineProperty(exports, "__esModule", { value: true }); 1360var $$ = Coveo.$$; 1361var MotorolaStandaloneSearchBoxCustoSettings_1 = __webpack_require__(18); 1362var CustomEvents_1 = __webpack_require__(1); 1363/** 1364 * Required customization specifically applied for implementation 1365 */ 1366var MotorolaStandaloneSearchBoxCusto = /** @class */ (function () { 1367 function MotorolaStandaloneSearchBoxCusto(searchInterfaceElement, context) { 1368 var _this = this; 1369 this.searchInterfaceElement = searchInterfaceElement; 1370 this.context = context; 1371 this.rootElement = $$(searchInterfaceElement); 1372 // Initialization Events 1373 this.rootElement.on(Coveo.InitializationEvents.beforeInitialization, function () { return _this.handleBeforeInit(); }); 1374 this.rootElement.on(Coveo.InitializationEvents.afterInitialization, function () { return _this.handleAfterInit(); }); 1375 this.rootElement.on(Coveo.InitializationEvents.afterComponentsInitialization, function () { return _this.handleAfterComponentsInit(); }); 1376 // Query Events 1377 this.rootElement.on(Coveo.QueryEvents.newQuery, function (e, data) { return _this.handleNewQuery(e, data); }); 1378 this.rootElement.on(Coveo.QueryEvents.buildingQuery, function (e, data) { return _this.handleBuildingQuery(e, data); }); 1379 this.rootElement.on(Coveo.QueryEvents.doneBuildingQuery, function (e, data) { return _this.handleDoneBuildingQuery(e, data); }); 1380 this.rootElement.on(Coveo.QueryEvents.preprocessResults, function (e, data) { return _this.handlePreprocessResults(e, data); }); 1381 this.rootElement.on(Coveo.QueryEvents.querySuccess, function (e, data) { return _this.handleQuerySuccess(e, data); }); 1382 this.rootElement.on(Coveo.QueryEvents.deferredQuerySuccess, function (e, data) { return _this.handleDeferredQuerySuccess(e, data); }); 1383 // State Events 1384 // Custom Events 1385 // StandaloneSearchInterface Events 1386 this.rootElement.on(Coveo.StandaloneSearchInterfaceEvents.beforeRedirect, function (e, data) { return MotorolaStandaloneSearchBoxCustoSettings_1.MotorolaStandaloneSearchBoxCustoSettings.handleBeforeRedirect(_this.rootElement, data); }); 1387 } 1388 MotorolaStandaloneSearchBoxCusto.prototype.getStateEventName = function (event) { 1389 return Coveo.QueryStateModel.ID + ':' + event; 1390 }; 1391 /** 1392 * Before Initialization 1393 */ 1394 MotorolaStandaloneSearchBoxCusto.prototype.handleBeforeInit = function () { 1395 }; 1396 /** 1397 * After Initialization 1398 * initializing custom strings during before init event to avoid any issue with SFDC init strings. 1399 */ 1400 MotorolaStandaloneSearchBoxCusto.prototype.handleAfterInit = function () { 1401 this.initStrings(); 1402 }; 1403 /** 1404 * After Component Initialization 1405 * Adding Setting Menu item for Tableau training link 1406 * Registering custom template helper to manage tableau custom icons. see result templates 1407 */ 1408 MotorolaStandaloneSearchBoxCusto.prototype.handleAfterComponentsInit = function () { 1409 this.standaloneSearchInterface = Coveo.Component.get(this.rootElement.el, Coveo.StandaloneSearchInterface); 1410 }; 1411 /** 1412 * New Query 1413 */ 1414 MotorolaStandaloneSearchBoxCusto.prototype.handleNewQuery = function (evt, args) { }; 1415 /** 1416 * Building Query 1417 */ 1418 MotorolaStandaloneSearchBoxCusto.prototype.handleBuildingQuery = function (evt, args) { 1419 args.queryBuilder.context = {}; 1420 for (var val in this.context) { 1421 args.queryBuilder.context[val] = this.context[val]; 1422 } 1423 }; 1424 /** 1425 * Done Building Query 1426 */ 1427 MotorolaStandaloneSearchBoxCusto.prototype.handleDoneBuildingQuery = function (evt, args) { }; 1428 /** 1429 * Preprocess Results 1430 */ 1431 MotorolaStandaloneSearchBoxCusto.prototype.handlePreprocessResults = function (evt, args) { }; 1432 /** 1433 * Query Success 1434 */ 1435 MotorolaStandaloneSearchBoxCusto.prototype.handleQuerySuccess = function (evt, args) { }; 1436 /** 1437 * Deferred Query Success 1438 */ 1439 MotorolaStandaloneSearchBoxCusto.prototype.handleDeferredQuerySuccess = function (evt, args) { 1440 this.rootElement.trigger(CustomEvents_1.CustomEvents.motorolaCoveoStandaloneSearchBox, args); 1441 }; 1442 /** 1443 * Initialized Custom Strings 1444 */ 1445 MotorolaStandaloneSearchBoxCusto.prototype.initStrings = function () { 1446 // Custom variable for current application
1447 String.toLocaleString({ 1448 'en': {}, 1449 'fr': {} 1450 }); 1451 }; 1452 MotorolaStandaloneSearchBoxCusto.prototype.getLocalizationOptions = function () { 1453 var localizationOptions = {}; 1454 return localizationOptions; 1455 }; 1456 /** 1457 * Set default options of different UI Components. 1458 */ 1459 MotorolaStandaloneSearchBoxCusto.prototype.getDefaultOptions = function () { 1460 var defaultOptions = {}; 1461 return defaultOptions; 1462 }; 1463 return MotorolaStandaloneSearchBoxCusto; 1464}()); 1465exports.MotorolaStandaloneSearchBoxCusto = MotorolaStandaloneSearchBoxCusto; 1466; 1467function initMotorolaStandaloneSearchbBoxCusto(element, options, customContext) { 1468 if (options === void 0) { options = {}; } 1469 Coveo.Initialization.initializeFramework(element, options, function () { 1470 var custo = new MotorolaStandaloneSearchBoxCusto(element, customContext); 1471 custo.initStrings(); 1472 var customOptions = _.extend({}, custo.getDefaultOptions(), options); 1473 return Coveo.Initialization.initSearchInterface(element, customOptions); 1474 }); 1475} 1476exports.initMotorolaStandaloneSearchbBoxCusto = initMotorolaStandaloneSearchbBoxCusto; 1477Coveo.Initialization.registerNamedMethod('initMotorolaStandaloneSearchbBoxCusto', function (element, options, customContext) { 1478 if (options === void 0) { options = {}; } 1479 initMotorolaStandaloneSearchbBoxCusto(element, options, customContext); 1480}); 1481 1482 1483/***/ }), 1484/* 18 */ 1485/***/ (function(module, exports, __webpack_require__) { 1486 1487"use strict"; 1488 1489Object.defineProperty(exports, "__esModule", { value: true }); 1490var HashUtils = Coveo.HashUtils; 1491var MotorolaStandaloneSearchBoxCustoSettings = /** @class */ (function () { 1492 function MotorolaStandaloneSearchBoxCustoSettings() { 1493 } 1494 MotorolaStandaloneSearchBoxCustoSettings.handleBeforeRedirect = function (rootElement, data) { 1495 var standaloneSearchInterface = Coveo.Component.get(rootElement.el, Coveo.SearchInterface); 1496 var stateValues = standaloneSearchInterface.queryStateModel.getAttributes(); 1497 var uaCausedBy = standaloneSearchInterface.usageAnalytics.getCurrentEventCause(); 1498 if (uaCausedBy != null) { 1499 // for legacy reason, searchbox submit were always logged a search from link in an external search box. 1500 // transform them if that's what we hit. 1501 if (uaCausedBy == Coveo.analyticsActionCauseList.searchboxSubmit.name) { 1502 uaCausedBy = Coveo.analyticsActionCauseList.searchFromLink.name; 1503 } 1504 stateValues['firstQueryCause'] = uaCausedBy; 1505 } 1506 var uaMeta = standaloneSearchInterface.usageAnalytics.getCurrentEventMeta(); 1507 if (uaMeta != null) { 1508 stateValues['firstQueryMeta'] = uaMeta; 1509 } 1510 window.location.hash = HashUtils.encodeValues(stateValues); 1511 data.cancel = true; 1512 Coveo['customEvents']['motorolaCoveoStandaloneSearchBox'](); 1513 }; 1514 return MotorolaStandaloneSearchBoxCustoSettings; 1515}()); 1516exports.MotorolaStandaloneSearchBoxCustoSettings = MotorolaStandaloneSearchBoxCustoSettings; 1517 1518 1519/***/ }), 1520/* 19 */ 1521/***/ (function(module, exports, __webpack_require__) { 1522 1523"use strict"; 1524 1525Object.defineProperty(exports, "__esModule", { value: true }); 1526var MotorolaResultTemplate = /** @class */ (function () { 1527 function MotorolaResultTemplate() { 1528 } 1529 MotorolaResultTemplate.openLink = function (uri) { 1530 window.location.href = uri; 1531 }; 1532 ; 1533 MotorolaResultTemplate.openLinkInNewWindow = function (uri) { 1534 window.open(uri, '_blank'); 1535 }; 1536 ; 1537 MotorolaResultTemplate.logEventAndOpenWindow = function (queryResult, clickEventCause, newTab) { 1538 var executeOnlyOnce = _.once(function () { return MotorolaResultTemplate.logClickEvent(queryResult, clickEventCause); }); 1539 executeOnlyOnce(); 1540 if (newTab) { 1541 MotorolaResultTemplate.openLinkInNewWindow(queryResult.clickUri); 1542 } 1543 else { 1544 MotorolaResultTemplate.openLink(queryResult.clickUri); 1545 } 1546 }; 1547 MotorolaResultTemplate.openShopLink = function (resultObject, event) { 1548 if (!event.altKey && 1549 event.target.innerText != Coveo.l('Quickview') && 1550 event.target.localName != 'svg' && 1551 event.target.localName != 'path' && 1552 !event.target.classList.contains('CoveoResultLink') && 1553 !event.target.parentElement.classList.contains('CoveoResultLink')) { 1554 event.preventDefault(); 1555 var queryResult = Coveo.result(resultObject); 1556 var clickUri = queryResult.clickUri;
1557 var clickEventCause = { name: 'clickResultItem', type: 'click' }; 1558 if (event.target.className.indexOf('coveo-shop-now-button') != -1) { 1559 clickEventCause.name = 'clickResultItemShopNow'; 1560 } 1561 if (clickUri.indexOf('https://shop.motorolasolutions.com.au/') >= 0 && event.target.className.indexOf('CoveoResultLink') == -1) { 1562 MotorolaResultTemplate.logEventAndOpenWindow(queryResult, clickEventCause, true); 1563 } 1564 else { 1565 MotorolaResultTemplate.logEventAndOpenWindow(queryResult, clickEventCause, false); 1566 } 1567 } 1568 }; 1569 MotorolaResultTemplate.openItem = function (resultObject, event) { 1570 if (event.target.className.indexOf('coveo-youtube-thumbnail-img') == -1 && 1571 event.target.className.indexOf('coveo__main__result__youtube__thumbnail') == -1 && 1572 event.target.className.indexOf('brightcove_thumbnail') == -1 && 1573 event.target.className.indexOf('coveo_thumbnail_play_icon') == -1 && 1574 event.target.className.indexOf('CoveoQuickview') == -1 && 1575 event.target.className.indexOf('coveo-youtube-thumbnail-container') == -1 && 1576 event.target.innerText != Coveo.l('CustomFacetsToggle_label') && 1577 event.target.innerText != Coveo.l('Quickview') && 1578 (!event.target.classList.contains('CoveoResultLink') || (event.target.className.indexOf('coveo-printable-uri-part') > 0 || (event.target.parentElement.classList.contains('coveo__result_item__content_title') && event.target.closest('.CoveoResult').querySelector('a.coveo-printable-uri-part')))) && 1579 !event.target.parentElement.classList.contains('CoveoResultLink') && 1580 !event.altKey) { 1581 event.preventDefault(); 1582 var queryResult = Coveo.result(resultObject); 1583 var clickUri = queryResult.clickUri; 1584 var clickEventCause = { name: 'clickResultItem', type: 'click' }; 1585 if (((clickUri.indexOf('www.motorolasolutions') >= 0 && clickUri.indexOf('dam/') == -1) || 1586 clickUri.indexOf('https://shop.motorolasolutions.com') >= 0 || 1587 clickUri.indexOf('https://blog.motorolasolutions.com') >= 0 || 1588 clickUri.indexOf('https://blog-test.motorolasolutions.com') >= 0 || 1589 clickUri.indexOf('https://www.motorolasolutions.com/en_xu/communities/') >= 0 || 1590 clickUri.indexOf('aem') >= 0 || 1591 (clickUri.indexOf('aem') >= 0 && event.target.localName == 'a') || 1592 (clickUri.indexOf('aem') >= 0 && event.target.localName == 'img')) 1593 && clickUri.indexOf('dam/') == -1) { 1594 MotorolaResultTemplate.logEventAndOpenWindow(queryResult, clickEventCause, false); 1595 return; 1596 } 1597 else if (clickUri.indexOf('https://video.motorolasolutions.com/') >= 0 || 1598 clickUri.indexOf('https://www.youtube.com') >= 0 || 1599 clickUri.indexOf('https://shop.motorolasolutions.com.au/') >= 0 || 1600 clickUri.indexOf('http://smartcom.motorolasolutions.com') >= 0 || 1601 clickUri.indexOf('dam/') >= 0) { 1602 MotorolaResultTemplate.logEventAndOpenWindow(queryResult, clickEventCause, true); 1603 return; 1604 } 1605 else { 1606 MotorolaResultTemplate.logEventAndOpenWindow(queryResult, clickEventCause, true); 1607 return; 1608 } 1609 } 1610 }; 1611 MotorolaResultTemplate.openQuickView = function (e) { 1612 e.stopPropagation(); 1613 }; 1614 MotorolaResultTemplate.logClickEvent = _.debounce(function (queryResult, clickEventCause) { 1615 var rootElement = Coveo.get(document.getElementById('coveoSearchInterface_main'), 'SearchInterface').element; 1616 Coveo.logClickEvent(rootElement, clickEventCause, {}, queryResult); 1617 Coveo.Defer.flush(); 1618 }, 1500, true); 1619 return MotorolaResultTemplate; 1620}()); 1621exports.MotorolaResultTemplate = MotorolaResultTemplate; 1622 1623 1624/***/ }), 1625/* 20 */ 1626/***/ (function(module, exports, __webpack_require__) { 1627 1628"use strict"; 1629 1630Object.defineProperty(exports, "__esModule", { value: true }); 1631var MotorolaSecurity = /** @class */ (function () { 1632 function MotorolaSecurity() { 1633 } 1634 MotorolaSecurity.decipherUserRoles = function (jwtToken) { 1635 try { 1636 var jwtObj = JSON.parse(window.atob(jwtToken.split('.')[1].replace(/-/g, '+').replace(/_/g, '/'))); 1637 if (jwtObj["filter"]) {
1638 var cugExpression = jwtObj["filter"].split(' ').map(function (e) { return e.split('='); }).filter(function (e) { return e.indexOf('@moto_cug_policy') > -1; }).filter(function (e) { return e.length > 1 && e[0] == '@moto_cug_policy'; })[0][1]; 1639 cugExpression = cugExpression.split(',').map(function (e) { return e.replace('(', '').replace(')', '').replace(/["']/g, ""); }); 1640 console.log('CUG Expression : ' + cugExpression); 1641 MotorolaSecurity.userRoles = cugExpression; 1642 } 1643 } 1644 catch (e) { 1645 console.error('Unable to decode JWT Token'); 1646 } 1647 }; 1648 MotorolaSecurity.isUserInGroup = function (group) { 1649 var commonRoles = MotorolaSecurity.userRoles.filter(function (n) { return -1 != group.indexOf(n); }); 1650 if (commonRoles && commonRoles.length < 1) { 1651 return false; 1652 } 1653 return true; 1654 }; 1655 MotorolaSecurity.salesUserRoles = ['moto-aem-insite', 'moto-aem-insite-apme', 'moto-aem-insite-ea', 'moto-aem-insite-latam', 'moto-aem-insite-na']; 1656 MotorolaSecurity.partnersUserRoles = ['pc-namr-mrp-xxxx-xxxxx-xxxx-x-xx', 'pcat-ariz-customer-users', 'pc-namr-var-xxxx-xxxxx-usfa-x-xx', 'pc-namr-var-xxxx-xxxxx-usfo-x-xx', 'pc-namr-mrs-xxxx-xxxxx-xxxx-x-xx', 'dhs-federal-users', 'pc-namr-mrf-xxxx-xxxxx-xxxx-x-xx']; 1657 MotorolaSecurity.userRoles = []; 1658 return MotorolaSecurity; 1659}()); 1660exports.MotorolaSecurity = MotorolaSecurity; 1661 1662 1663/***/ }), 1664/* 21 */ 1665/***/ (function(module, exports, __webpack_require__) { 1666 1667"use strict"; 1668 1669var __extends = (this && this.__extends) || (function () { 1670 var extendStatics = Object.setPrototypeOf || 1671 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 1672 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 1673 return function (d, b) { 1674 extendStatics(d, b); 1675 function __() { this.constructor = d; } 1676 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 1677 }; 1678})(); 1679Object.defineProperty(exports, "__esModule", { value: true }); 1680var Component = Coveo.Component; 1681var Initialization = Coveo.Initialization; 1682var ComponentOptions = Coveo.ComponentOptions; 1683var $$ = Coveo.$$; 1684var QueryEvents = Coveo.QueryEvents; 1685var SVGIcon = __webpack_require__(22); 1686var CustomResultsPerPage = /** @class */ (function (_super) { 1687 __extends(CustomResultsPerPage, _super); 1688 function CustomResultsPerPage(element, options, bindings) { 1689 var _this = _super.call(this, element, CustomResultsPerPage.ID, bindings) || this; 1690 _this.element = element; 1691 _this.options = options; 1692 _this.bindings = bindings; 1693 _this.options = ComponentOptions.initComponentOptions(element, CustomResultsPerPage, options); 1694 _this.currentResultsPerPage = _this.getInitialChoice(); 1695 _this.queryController.options.resultsPerPage = _this.currentResultsPerPage; 1696 _this.bind.onRootElement(QueryEvents.querySuccess, function (args) { return _this.handleQuerySuccess(args); }); 1697 _this.bind.onRootElement(QueryEvents.queryError, function () { return _this.handleQueryError(); }); 1698 _this.bind.onRootElement(QueryEvents.noResults, function (args) { return _this.handleNoResults(); }); 1699 _this.initComponent(element); 1700 return _this; 1701 } 1702 CustomResultsPerPage.prototype.setResultsPerPage = function (resultsPerPage) { 1703 this.searchInterface.resultsPerPage = resultsPerPage; 1704 this.currentResultsPerPage = resultsPerPage; 1705 this.currentText.innerHTML = Coveo.l('CustomResultsPerPage_select', this.currentResultsPerPage.toString()); 1706 Coveo.logCustomEvent(this.root, Coveo.analyticsActionCauseList.pagerResize, { 1707 currentResultsPerPage: this.currentResultsPerPage.toString() 1708 }); 1709 this.queryController.executeQuery(); 1710 }; 1711 CustomResultsPerPage.prototype.getInitialChoice = function () { 1712 var initialChoice = this.options.choicesDisplayed[0]; 1713 if (this.options.initialChoice !== undefined) { 1714 if (this.options.choicesDisplayed.indexOf(this.options.initialChoice) > -1) { 1715 initialChoice = this.options.initialChoice; 1716 } 1717 else { 1718 this.logger.warn('The initial number of results is not within the choices dis
1718played. Consider setting a value that can be selected. The first choice will be selected instead.'); 1719 } 1720 } 1721 return initialChoice; 1722 }; 1723 CustomResultsPerPage.prototype.initComponent = function (element) { 1724 this.pagerText = $$('span', { 1725 className: 'coveo-custom-results-per-page-text' 1726 }, Coveo.l('CustomResultsPerPage')).el; 1727 this.picker = $$('div', { 1728 className: 'coveo-custom-results-per-page-picker' 1729 }).el; 1730 this.currentText = $$('span', { 1731 className: 'coveo-custom-results-per-page-current' 1732 }, Coveo.l('CustomResultsPerPage_select', this.currentResultsPerPage.toString())).el; 1733 this.caret = $$('span', { 1734 className: 'coveo-custom-results-per-page-current-caret' 1735 }, SVGIcon) 1736 .el; 1737 element.appendChild(this.pagerText); 1738 this.picker.appendChild(this.currentText); 1739 this.picker.appendChild(this.caret); 1740 this.list = $$('ul', { 1741 className: 'coveo-custom-results-per-page-list' 1742 }).el; 1743 this.picker.appendChild(this.list); 1744 element.appendChild(this.picker); 1745 }; 1746 CustomResultsPerPage.prototype.render = function () { 1747 var _this = this; 1748 $$(this.element).removeClass('coveo-custom-results-per-page-dropdown-no-results'); 1749 var numResultsList = this.options.choicesDisplayed; 1750 var _loop_1 = function () { 1751 var listItem = $$('li', { 1752 className: 'coveo-custom-results-per-page-list-item', 1753 tabindex: 0 1754 }); 1755 if (numResultsList[i] == this_1.currentResultsPerPage) { 1756 listItem.addClass('coveo-active'); 1757 } 1758 (function (resultsPerPage) { 1759 var clickAction = function () { return _this.handleClickPage(numResultsList[resultsPerPage]); }; 1760 listItem.on('click', clickAction); 1761 })(i); 1762 listItem.el.appendChild($$('a', { 1763 className: 'coveo-custom-results-per-page-list-item-text' 1764 }, Coveo.l('CustomResultsPerPage_select', numResultsList[i].toString())).el); 1765 this_1.list.appendChild(listItem.el); 1766 }; 1767 var this_1 = this; 1768 for (var i = 0; i < numResultsList.length; i++) { 1769 _loop_1(); 1770 } 1771 }; 1772 CustomResultsPerPage.prototype.handleQueryError = function () { 1773 this.reset(); 1774 }; 1775 CustomResultsPerPage.prototype.handleNoResults = function () { 1776 this.reset(); 1777 }; 1778 CustomResultsPerPage.prototype.handleQuerySuccess = function (data) { 1779 if (this.searchInterface.isResultsPerPageModifiedByPipeline) { 1780 this.logger.info('Results per page was modified by backend code (query pipeline). ResultsPerPage component will be hidden', this); 1781 this.reset(); 1782 this.currentResultsPerPage = this.getInitialChoice(); 1783 this.searchInterface.resultsPerPage = this.currentResultsPerPage; 1784 return; 1785 } 1786 if (data.results.results.length != 0) { 1787 this.reset(); 1788 this.render(); 1789 } 1790 }; 1791 CustomResultsPerPage.prototype.handleClickPage = function (resultsPerPage) { 1792 this.setResultsPerPage(resultsPerPage); 1793 }; 1794 CustomResultsPerPage.prototype.reset = function () { 1795 $$(this.element).addClass('coveo-custom-results-per-page-dropdown-no-results'); 1796 $$(this.list).empty(); 1797 }; 1798 CustomResultsPerPage.ID = 'CustomResultsPerPage'; 1799 CustomResultsPerPage.options = { 1800 choicesDisplayed: ComponentOptions.buildCustomListOption(function (list) { 1801 var values = _.map(list, function (value) { 1802 return parseInt(value, 10); 1803 }); 1804 return values.length == 0 ? null : values; 1805 }, { 1806 defaultFunction: function () { 1807 return [50, 100, 150, 200]; 1808 } 1809 }), 1810 initialChoice: Coveo.ComponentOptions.buildNumberOption({ defaultValue: 1, section: 'Common Options' }) 1811 }; 1812 return CustomResultsPerPage; 1813}(Component)); 1814exports.CustomResultsPerPage = CustomResultsPerPage; 1815Initialization.registerAutoCreateComponent(CustomResultsPerPage); 1816 1817 1818/***/ }), 1819/* 22 */
1820/***/ (function(module, exports) { 1821 1822module.exports = "<svg viewBox=\"0 0 10 5\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><title>5F14616B-4827-49FC-B1B8-FC20CF1DC946</title><desc>Created with sketchtool.</desc><g id=\"UI-Desktop\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><g id=\"ALL\" transform=\"translate(-750.000000, -536.000000)\" stroke=\"#111111\"><g id=\"See-Per-Page\" transform=\"translate(570.000000, 528.000000)\"><g id=\"small-down\" transform=\"translate(177.000000, 2.000000)\"><g id=\"Group\" transform=\"translate(3.000000, 6.000000)\"><polyline id=\"Shape\" points=\"0.5 0.5 5 5 9.5 0.5\"></polyline></g></g></g></g></g></svg>" 1823 1824/***/ }), 1825/* 23 */ 1826/***/ (function(module, exports, __webpack_require__) { 1827 1828"use strict"; 1829 1830var __extends = (this && this.__extends) || (function () { 1831 var extendStatics = Object.setPrototypeOf || 1832 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 1833 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 1834 return function (d, b) { 1835 extendStatics(d, b); 1836 function __() { this.constructor = d; } 1837 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 1838 }; 1839})(); 1840Object.defineProperty(exports, "__esModule", { value: true }); 1841var Component = Coveo.Component; 1842var Initialization = Coveo.Initialization; 1843var $$ = Coveo.$$; 1844var CustomPager = /** @class */ (function (_super) { 1845 __extends(CustomPager, _super); 1846 function CustomPager(element, bindings) { 1847 var _this = _super.call(this, element, CustomPager.ID, bindings) || this; 1848 $$(document.getElementById('coveoSearchInterface_main')).on(Coveo.QueryEvents.querySuccess, function (e, data) { return _this.handleQuerySuccess(e, data); }); 1849 $$(document.getElementById('coveoSearchInterface_main')).on(Coveo.ResultListEvents.newResultsDisplayed, function (e, data) { 1850 if (_this.totalPages.valueOf() * _this.perPage.valueOf() <= 1000) { 1851 _this.handleNewResultsDisplayed(e, data); 1852 } 1853 if ($$(document.getElementById('coveoSearchInterface_main')).find('.coveo-pager-previous-icon')) { 1854 $$(document.getElementById('coveoSearchInterface_main')).find('.coveo-pager-previous-icon').innerHTML = '<i class="fa fa-caret-left" aria-hidden="true" style="height: 11px;width:11px;"></i>'; 1855 } 1856 if ($$(document.getElementById('coveoSearchInterface_main')).find('.coveo-pager-next-icon')) { 1857 $$(document.getElementById('coveoSearchInterface_main')).find('.coveo-pager-next-icon').innerHTML = '<i class="fa fa-caret-right" aria-hidden="true" style="height: 11px;width:11px;"></i>'; 1858 } 1859 }); 1860 return _this; 1861 } 1862 CustomPager.prototype.handleQuerySuccess = function (e, data) { 1863 this.perPage = data.query.numberOfResults; 1864 var totalNum = data.results.totalCount; 1865 this.totalPages = Math.ceil(totalNum / this.perPage.valueOf()); 1866 }; 1867 CustomPager.prototype.handleNewResultsDisplayed = function (e, data) { 1868 var pagerList = document.getElementsByClassName('coveo-pager-list'); 1869 if (pagerList != null && pagerList.length > 0 && this.totalPages > 1) { 1870 var pagerElement = pagerList.item(0); 1871 var li = $$('li'); 1872 li.addClass('coveo-pager-list-item'); 1873 var a = $$('a'); 1874 a.addClass('coveo-pager-list-item-text coveo-pager-anchor'); 1875 a.text(this.totalPages.toString()); 1876 li.append(a.el); 1877 li.on('click', function (e) { 1878 // let firstResult = this.perPage * (this.totalPages - 1); 1879 // Coveo.state(document.getElementById('coveoSearchInterface_main'), 'first', firstResult); 1880 var pagerInstance = Coveo.get($$(document.body).find('.CoveoPager')); 1881 var actionCause = { name: 'lastPageSelected', type: 'click' }; 1882 var n = pagerInstance.queryController.getLastQuery().numberOfResults; 1883 var t = pagerInstance.queryController.getLastResults().totalCount; 1884 pagerInstance.setPage((Math.ceil(t / n)), actionCause); 1885 }); 1886 var ellipsis = $$('li'); 1887 ellipsis.text('...'); 1888 ellipsis.addClass('coveo-pager-list-item'); 1889 var flag = false;
1890 for (var i = pagerElement.children.length - 1; i >= 0; i--) { 1891 var c = pagerElement.children.item(i); 1892 if (c.firstElementChild.innerHTML == this.totalPages.toString()) { 1893 flag = true; 1894 break; 1895 } 1896 } 1897 if (!flag) { 1898 pagerElement.insertBefore(li.el, pagerElement.childNodes[pagerElement.childElementCount - 1]); 1899 pagerElement.insertBefore(ellipsis.el, li.el); 1900 } 1901 } 1902 }; 1903 CustomPager.ID = 'CustomPager'; 1904 return CustomPager; 1905}(Component)); 1906exports.CustomPager = CustomPager; 1907Initialization.registerAutoCreateComponent(CustomPager); 1908 1909 1910/***/ }), 1911/* 24 */ 1912/***/ (function(module, exports, __webpack_require__) { 1913 1914"use strict"; 1915 1916var __extends = (this && this.__extends) || (function () { 1917 var extendStatics = Object.setPrototypeOf || 1918 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 1919 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 1920 return function (d, b) { 1921 extendStatics(d, b); 1922 function __() { this.constructor = d; } 1923 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 1924 }; 1925})(); 1926Object.defineProperty(exports, "__esModule", { value: true }); 1927var Component = Coveo.Component; 1928var ComponentOptions = Coveo.ComponentOptions; 1929var Initialization = Coveo.Initialization; 1930// import IDisplayedNewResultEventArgs = Coveo.IDisplayedNewResultEventArgs; 1931var $$ = Coveo.$$; 1932var CustomQuerySummaryUtils_1 = __webpack_require__(25); 1933var CustomQuerySummary = /** @class */ (function (_super) { 1934 __extends(CustomQuerySummary, _super); 1935 function CustomQuerySummary(element, options, bindings) { 1936 var _this = _super.call(this, element, CustomQuerySummary.ID, bindings) || this; 1937 _this.element = element; 1938 _this.options = options; 1939 _this.bindings = bindings; 1940 _this.options = ComponentOptions.initComponentOptions(element, CustomQuerySummary, options); 1941 $$(_this.root).on(Coveo.QueryEvents.querySuccess, function (e, args) { return _this.updateSummary(e, args); }); 1942 return _this; 1943 } 1944 CustomQuerySummary.prototype.updateSummary = function (e, args) { 1945 $$(this.element).setHtml(CustomQuerySummaryUtils_1.CustomQuerySummaryUtils.htmlMessage(this.root, args)); 1946 }; 1947 CustomQuerySummary.ID = 'CustomQuerySummary'; 1948 return CustomQuerySummary; 1949}(Component)); 1950exports.CustomQuerySummary = CustomQuerySummary; 1951Initialization.registerAutoCreateComponent(CustomQuerySummary); 1952 1953 1954/***/ }), 1955/* 25 */ 1956/***/ (function(module, exports, __webpack_require__) { 1957 1958"use strict"; 1959 1960Object.defineProperty(exports, "__esModule", { value: true }); 1961var $$ = Coveo.$$; 1962var CustomQuerySummaryUtils = /** @class */ (function () { 1963 function CustomQuerySummaryUtils() { 1964 } 1965 CustomQuerySummaryUtils.message = function (root, data) { 1966 var messageBuilder = CustomQuerySummaryUtils.messageBuilderForMode(root); 1967 var strings = CustomQuerySummaryUtils.getSummaryStrings(data); 1968 return messageBuilder(data, strings); 1969 }; 1970 CustomQuerySummaryUtils.htmlMessage = function (root, data) { 1971 var messageBuilder = CustomQuerySummaryUtils.messageBuilderForMode(root); 1972 var strings = CustomQuerySummaryUtils.getHtmlSummaryStrings(data); 1973 return messageBuilder(data, strings); 1974 }; 1975 CustomQuerySummaryUtils.replaceQueryTags = function (template, replacement) { 1976 var queryTag = /\$\{query\}/g; 1977 return template ? template.replace(queryTag, replacement) : ''; 1978 }; 1979 CustomQuerySummaryUtils.messageBuilderForMode = function (root) { 1980 return CustomQuerySummaryUtils.buildStandardMessage; 1981 }; 1982 CustomQuerySummaryUtils.buildStandardMessage = function (data, strings) { 1983 var numOfResults = data.results.results.length; 1984 var messages = { 1985 includingQuery: Coveo.l('CustomQuerySummary_ShowingResultsOfWithQuery', strings.totalCount, strings.query, numOfResults), 1986 excludingQuery: Coveo.l('CustomQuerySummary_ShowingResultsOf', strings.totalCount, numOfResults) 1987 }; 1988 return CustomQuerySummaryUtils.buildMessage(data, messages); 1989 }; 1990 CustomQuerySummaryUtils.buildMessage = function (data, message) { 1991 var numOfResults = data.results.results.length; 1992 var sanitizedQuery = CustomQuerySummaryUtils.sanitizeQuery(data.query);
1993 // if (!numOfResults) { 1994 // return ''; 1995 // } 1996 return sanitizedQuery ? message.includingQuery : message.excludingQuery; 1997 }; 1998 CustomQuerySummaryUtils.getHtmlSummaryStrings = function (data) { 1999 var strings = CustomQuerySummaryUtils.getSummaryStrings(data); 2000 return { 2001 totalCount: CustomQuerySummaryUtils.wrapWithSpanTag(strings.totalCount), 2002 query: CustomQuerySummaryUtils.wrapWithSpanTag(strings.query) 2003 }; 2004 }; 2005 CustomQuerySummaryUtils.wrapWithSpanTag = function (word) { 2006 return $$('span', { className: 'coveo-highlight' }, word).el.outerHTML; 2007 }; 2008 CustomQuerySummaryUtils.getSummaryStrings = function (data) { 2009 var queryPerformed = data.query; 2010 var queryResults = data.results; 2011 var totalCount = queryResults.totalCountFiltered.toString(); 2012 var query = CustomQuerySummaryUtils.sanitizeQuery(queryPerformed); 2013 return { totalCount: totalCount, query: query }; 2014 }; 2015 CustomQuerySummaryUtils.sanitizeQuery = function (query) { 2016 return query.q ? _.escape(query.q.trim()) : ''; 2017 }; 2018 return CustomQuerySummaryUtils; 2019}()); 2020exports.CustomQuerySummaryUtils = CustomQuerySummaryUtils; 2021 2022 2023/***/ }), 2024/* 26 */ 2025/***/ (function(module, exports, __webpack_require__) { 2026 2027"use strict"; 2028 2029var __extends = (this && this.__extends) || (function () { 2030 var extendStatics = Object.setPrototypeOf || 2031 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 2032 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 2033 return function (d, b) { 2034 extendStatics(d, b); 2035 function __() { this.constructor = d; } 2036 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2037 }; 2038})(); 2039Object.defineProperty(exports, "__esModule", { value: true }); 2040var Component = Coveo.Component; 2041var Initialization = Coveo.Initialization; 2042var ComponentOptions = Coveo.ComponentOptions; 2043var $$ = Coveo.$$; 2044var CustomFacetsClearAll = /** @class */ (function (_super) { 2045 __extends(CustomFacetsClearAll, _super); 2046 function CustomFacetsClearAll(element, options, bindings) { 2047 var _this = _super.call(this, element, CustomFacetsClearAll.ID, bindings) || this; 2048 _this.element = element; 2049 _this.options = options; 2050 _this.bindings = bindings; 2051 _this.options = ComponentOptions.initComponentOptions(element, CustomFacetsClearAll, options); 2052 _this.render(); 2053 Coveo.$$(_this.root).on(Coveo.QueryEvents.querySuccess, function (e, data) { return _this.handleFilterDisplay(e, data); }); 2054 return _this; 2055 } 2056 CustomFacetsClearAll.prototype.handleFilterDisplay = function (e, data) { 2057 var root = this.root; 2058 var hasSelectedFacet = false; 2059 _.each(document.getElementsByClassName('CoveoFacet'), function (Facet) { 2060 var facet = Coveo.get(Facet, 'Facet'); 2061 if (!facet.disabled && Coveo.state(root, 'f:' + facet.element.id).length > 0) { 2062 hasSelectedFacet = true; 2063 return; 2064 } 2065 }); 2066 /* resolving DT-4267 2067 if (hasSelectedFacet) { 2068 this.element.style.display = 'flex'; 2069 } else { 2070 this.element.style.display = 'none'; 2071 } 2072 */ 2073 this.element.style.display = 'flex'; 2074 }; 2075 CustomFacetsClearAll.prototype.render = function () { 2076 var _this = this; 2077 var componentLabel = $$('h3', {}, Coveo.l('CustomFacetsClearAll_label')); 2078 var resetBtnLabel = $$('span', {}, Coveo.l('CustomFacetsClearAll_tooltip')); 2079 var resetBtn = $$('div', { 'class': 'facetsClearAllButton' }); 2080 resetBtnLabel.on('click', function () { 2081 _this.resetFacets(); 2082 }); 2083 $$(resetBtn).append(resetBtnLabel.el); 2084 $$(this.element).append(componentLabel.el); 2085 $$(this.element).append(resetBtn.el); 2086 }; 2087 CustomFacetsClearAll.prototype.resetFacets = function () { 2088 var _this = this; 2089 _.each(document.getElementsByClassName('CoveoFacet'), function (Facet) { 2090 var facet = Coveo.get(Facet, 'Facet'); 2091 facet.reset(); 2092 }); 2093 _.each(document.getElementsByClassName('CoveoFacetRange'), function (Facet) { 2094 var facetRange = Coveo.get(Facet, 'FacetRange'); 2095 facetRange.reset(); 2096 }); 2097 _.each(document.getElementsByClassName('CoveoFacetSlider'), function (Facet) { 2098 var facetSlider = Coveo.get(Facet, 'FacetSlider'); 2099 facetSlider.reset(); 2100 }); 2101 this.queryController.deferExecuteQuery({
2102 beforeExecuteQuery: function () { 2103 Coveo.logCustomEvent(_this.root, { name: 'facetsClearAll', type: 'facet' }, {}); 2104 } 2105 }); 2106 }; 2107 CustomFacetsClearAll.prototype.handleClick = function (e) { 2108 this.resetFacets(); 2109 }; 2110 ; 2111 CustomFacetsClearAll.ID = 'CustomFacetsClearAll'; 2112 CustomFacetsClearAll.options = {}; 2113 return CustomFacetsClearAll; 2114}(Component)); 2115exports.CustomFacetsClearAll = CustomFacetsClearAll; 2116Initialization.registerAutoCreateComponent(CustomFacetsClearAll); 2117 2118 2119/***/ }), 2120/* 27 */ 2121/***/ (function(module, exports, __webpack_require__) { 2122 2123"use strict"; 2124 2125var __extends = (this && this.__extends) || (function () { 2126 var extendStatics = Object.setPrototypeOf || 2127 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 2128 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 2129 return function (d, b) { 2130 extendStatics(d, b); 2131 function __() { this.constructor = d; } 2132 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2133 }; 2134})(); 2135Object.defineProperty(exports, "__esModule", { value: true }); 2136var Component = Coveo.Component; 2137var Initialization = Coveo.Initialization; 2138var CustomLocaleBasedTitleDescription = /** @class */ (function (_super) { 2139 __extends(CustomLocaleBasedTitleDescription, _super); 2140 function CustomLocaleBasedTitleDescription(element, bindings) { 2141 var _this = _super.call(this, element, CustomLocaleBasedTitleDescription.ID, bindings) || this; 2142 Coveo.$$(_this.root).on(Coveo.QueryEvents.querySuccess, function (e, data) { return _this.localizeQueryResults(e, data); }); 2143 return _this; 2144 } 2145 CustomLocaleBasedTitleDescription.prototype.localizeQueryResults = function (e, data) { 2146 var results = data.results.results; 2147 for (var i = 0; i < results.length; i++) { 2148 if (['MSI.com DAM', 'MSI.com'].indexOf(results[i].raw.source) > -1) { 2149 if (results[i].raw.moto_dc_description_display) { 2150 var descObj = JSON.parse(results[i].raw.moto_dc_description_display); 2151 var localeDesc = descObj[data.query.context['locale'].toString()] != undefined ? descObj[data.query.context['locale'].toString()] : descObj['en_xw']; 2152 if (localeDesc) { 2153 localeDesc.length > 0 ? results[i].excerpt = localeDesc : console.log(results[i].excerpt); 2154 results[i].excerptHighlights = []; 2155 } 2156 } 2157 if (results[i].raw.moto_teaser_description) { 2158 var localeDesc = results[i].raw.moto_teaser_description; 2159 if (localeDesc) { 2160 localeDesc.length > 0 ? results[i].excerpt = localeDesc : console.log(results[i].excerpt); 2161 results[i].excerptHighlights = []; 2162 } 2163 } 2164 if (results[i].raw.moto_dc_title_display) { 2165 var titleObj = JSON.parse(results[i].raw.moto_dc_title_display); 2166 var localeTitle = titleObj[data.query.context['locale'].toString()] != undefined ? titleObj[data.query.context['locale'].toString()] : titleObj['en_xw']; 2167 if (localeTitle && localeTitle.trim()) { 2168 results[i].title.toLowerCase() == 'untitled' || localeTitle.length > 0 ? results[i].title = localeTitle : console.log(results[i].title); 2169 results[i].titleHighlights = []; 2170 } 2171 } 2172 } 2173 } 2174 }; 2175 CustomLocaleBasedTitleDescription.ID = 'CustomLocaleBasedTitleDescription'; 2176 return CustomLocaleBasedTitleDescription; 2177}(Component)); 2178exports.CustomLocaleBasedTitleDescription = CustomLocaleBasedTitleDescription; 2179Initialization.registerAutoCreateComponent(CustomLocaleBasedTitleDescription); 2180 2181 2182/***/ }), 2183/* 28 */ 2184/***/ (function(module, exports, __webpack_require__) { 2185 2186"use strict"; 2187 2188var __extends = (this && this.__extends) || (function () { 2189 var extendStatics = Object.setPrototypeOf || 2190 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 2191 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 2192 return function (d, b) { 2193 extendStatics(d, b); 2194 function __() { this.constructor = d; } 2195 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2196 }; 2197})(); 2198Object.defineProperty(exports, "__esModule", { value: true }); 2199var Component = Coveo.Component; 2200var Initialization = Coveo.Initialization; 2201var ComponentOptions = Coveo.ComponentOptions; 2202var $$ = Coveo.$$; 2203var CustomTopResults = /** @class */ (function (_super) { 2204 __extends(CustomTopResults, _super); 2205 function CustomTopResults(element, options, bindings) { 2206 var _this = _super.call(this, element, CustomTopResults.ID, bindings) || this; 2207 _this.element = element; 2208 _this.options = options; 2209 _this.bindings = bindings; 2210 _this.options = ComponentOptions.initComponentOptions(element, CustomTopResults, options); 2211 Coveo.$$(_this.root).on(Coveo.QueryEvents.preprocessResults, function (e, data) { return _this.handlePreprocessResults(e, data); }); 2212 Coveo.$$(_this.root).on(Coveo.ResultListEvents.newResultsDisplayed, function (e, data) { return _this.handleNewResultsDisplayed(e, data); }); 2213 _this.render(); 2214 return _this; 2215 } 2216 CustomTopResults.prototype.handlePreprocessResults = function (evt, data) { 2217 _.each(data.results.results, function (result) { 2218 result['customRankingModifier'] = result.isTopResult ? 'TopResult' : (result.rankingModifier ? result.rankingModifier.replace(' ', '-') : 'NormalResult'); 2219 }); 2220 }; 2221 CustomTopResults.prototype.handleNewResultsDisplayed = function (evt, data) { 2222 var allTopResultElements = $$(this.root).findAll('.coveo-result-row.TopResult'); 2223 if (Coveo.state(this.root, 't') == 'Tab_All' && allTopResultElements.length > 0) { 2224 allTopResultElements[allTopResultElements.length - 1].parentElement.classList.add('last-TopResult'); 2225 this.enable(); 2226 } 2227 else { 2228 this.disable(); 2229 } 2230 }; 2231 CustomTopResults.prototype.disable = function () { 2232 this.element.classList.add('disabled'); 2233 $$(this.element).hide(); 2234 _super.prototype.disable.call(this); 2235 }; 2236 CustomTopResults.prototype.enable = function () { 2237 this.element.classList.remove('disabled'); 2238 $$(this.element).show(); 2239 _super.prototype.enable.call(this); 2240 }; 2241 CustomTopResults.prototype.render = function () { 2242 var titleTopResults = $$('h3', { 'class': 'title-topResults' }, Coveo.l('CustomTopResults_label')); 2243 $$(this.element).append(titleTopResults.el); 2244 }; 2245 CustomTopResults.ID = 'CustomTopResults'; 2246 CustomTopResults.options = {}; 2247 return CustomTopResults; 2248}(Component)); 2249exports.CustomTopResults = CustomTopResults; 2250Initialization.registerAutoCreateComponent(CustomTopResults); 2251 2252 2253/***/ }), 2254/* 29 */ 2255/***/ (function(module, exports, __webpack_require__) { 2256 2257"use strict"; 2258 2259var __extends = (this && this.__extends) || (function () { 2260 var extendStatics = Object.setPrototypeOf || 2261 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 2262 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 2263 return function (d, b) { 2264 extendStatics(d, b); 2265 function __() { this.constructor = d; } 2266 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2267 }; 2268})(); 2269Object.defineProperty(exports, "__esModule", { value: true }); 2270var Component = Coveo.Component; 2271var Initialization = Coveo.Initialization; 2272var ComponentOptions = Coveo.ComponentOptions; 2273var $$ = Coveo.$$; 2274var MotorolaLocalization_1 = __webpack_require__(5); 2275var CustomNoResultsFound = /** @class */ (function (_super) { 2276 __extends(CustomNoResultsFound, _super); 2277 function CustomNoResultsFound(element, options, bindings) { 2278 var _this = _super.call(this, element, CustomNoResultsFound.ID, bindings) || this; 2279 _this.element = element; 2280 _this.options = options; 2281 _this.bindings = bindings; 2282 _this.options = ComponentOptions.initComponentOptions(element, CustomNoResultsFound, options); 2283 Coveo.$$(_this.root).on(Coveo.QueryEvents.querySuccess, function (e, args) { return _this.handleQuerySuccess(e, args); }); 2284 Coveo.$$(_this.root).on(Coveo.QueryEvents.noResults, function (e, args) { return _this.handleNoResults(e, args); }); 2285 Coveo.$$(_this.root).on(Coveo.ResultListEvents.changeLayout, function (e, data) { 2286 if (data && data.results && data.results.totalCount > 0) { 2287 _this.disable(); 2288 } 2289 }); 2290 _this.render(); 2291 return _this; 2292 } 2293 CustomNoResultsFound.prototype.disable = function () { 2294 this.element.classList.add('disabled'); 2295 this.element.style.display = 'none'; 2296 _super.prototype.disable.call(this); 2297 }; 2298 CustomNoResultsFound.prototype.enable = function () { 2299 this.element.classList.remove('disabled'); 2300 _super.prototype.enable.call(this); 2301 }; 2302 CustomNoResultsFound.prototype.handleQuerySuccess = function (e, args) { 2303 if (args.results.totalCount > 0) { 2304 this.disable(); 2305 } 2306 }; 2307 CustomNoResultsFound.prototype.handleNoResults = function (e, args) { 2308 this.enable(); 2309 }; 2310 CustomNoResultsFound.prototype.htmlSearchTips = function () { 2311 var searchTipsTitle = $$('h4', { 'class': 'search-tips-title' }, Coveo.l('CustomNoResultsFound_SearchTipsTitle')); 2312 var searchTipsList = $$('ul', { 'class': 'search-tips-list' }, $$('li', {}, Coveo.l('CustomNoResultsFound_SearchTips_01')), $$('li', {}, Coveo.l('CustomNoResultsFound_SearchTips_02')), $$('li', {}, Coveo.l('CustomNoResultsFound_SearchTips_03')), $$('li', {}, Coveo.l('CustomNoResultsFound_SearchTips_04'))); 2313 var searchTips = $$('div', { 'class': 'search-tips' }, searchTipsTitle, searchTipsList); 2314 return searchTips.el; 2315 }; 2316 CustomNoResultsFound.prototype.htmlTopSearches = function () { 2317 var token = Coveo.SearchEndpoint.endpoints.default.options.accessToken; 2318 var orgId = Coveo.SearchEndpoint.endpoints.default.options.queryStringArguments.organizationId; 2319 var topSearchesData = []; 2320 $.ajax({ 2321 url: 'https://platform.cloud.coveo.com/rest/search/v2/querySuggest', 2322 type: 'GET', 2323 headers: { 2324 'Authorization': 'Bearer ' + token, 2325 'Accept': 'application/json' 2326 }, 2327 data: { 2328 'count': '3', 2329 'pipeline': 'MotorolaSolutionsSearch', 2330 'locale': MotorolaLocalization_1.MotorolaLocalization.userLocale, 2331 'searchHub': 'motorolasolutions', 2332 'tab': 'Tab_All', 2333 'context': { 'locale': MotorolaLocalization_1.MotorolaLocalization.userLocale }, 2334 'org': orgId 2335 }, 2336 success: function (data, textStatus) { 2337 topSearchesData = data.completions; 2338 }, 2339 async: false 2340 }); 2341 var topSearchesLinks = $$('ul', { 'style': 'list-style-type:none;padding-left:12px' }); 2342 _.each(topSearchesData, function (d) { 2343 var l = $$('li'); 2344 l.append($$('a', { 'href': '#q=' + d['expression'].toString() }, d['expression'].toString()).el); 2345 topSearchesLinks.append(l.el); 2346 }); 2347 var topSearchesTitle = $$('h4', { 'class': 'top-searches-title' }, Coveo.l('CustomNoResultsFound_TopSearchesTitle')); 2348 var topSearchesList = $$('div', { 'class': 'top-searches-list' }, topSearchesLinks); 2349 var topSearches = $$('div', { 'class': 'top-searches' }, topSearchesTitle, topSearchesList); 2350 if (topSearchesData.length == 0) { 2351 topSearches.hide(); 2352 } 2353 return topSearches.el; 2354 }; 2355 CustomNoResultsFound.prototype.htmlComponent = function () { 2356 var mainTitle = $$('h3', { 'class': 'no-results-title' }, Coveo.l('CustomNoResultsFound_Title')); 2357 var mainContainer = $$('div', { 'class': 'custom-coveo-no-results-found' }, mainTitle, this.htmlSearchTips(), this.htmlTopSearches()); 2358 // ,this.htmlTopSearches() 2359 return mainContainer.el; 2360 }; 2361 CustomNoResultsFound.prototype.render = function () { 2362 $$(this.element).addClass('coveo-show-if-no-results'); 2363 $$(this.element).append(this.htmlComponent()); 2364 var initParameters = { 2365 options: {}, 2366 bindings: {} 2367 }; 2368 Initialization.automaticallyCreateComponentsInside(this.element, initParameters); 2369 }; 2370 CustomNoResultsFound.ID = 'CustomNoResultsFound'; 2371 CustomNoResultsFound.options = {}; 2372 return CustomNoResultsFound; 2373}(Component)); 2374exports.CustomNoResultsFound = CustomNoResultsFound; 2375Initialization.registerAutoCreateComponent(CustomNoResultsFound); 2376 2377 2378/***/ }), 2379/* 30 */ 2380/***/ (function(module, exports, __webpack_require__) { 2381 2382"use strict"; 2383 2384var __extends = (this && this.__extends) || (function () { 2385 var extendStatics = Object.setPrototypeOf || 2386 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 2387 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 2388 return function (d, b) { 2389 extendStatics(d, b); 2390 function __() { this.constructor = d; } 2391 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2392 }; 2393})(); 2394Object.defineProperty(exports, "__esModule", { value: true }); 2395var Component = Coveo.Component; 2396var Initialization = Coveo.Initialization; 2397var CustomRelatedSearches = /** @class */ (function (_super) { 2398 __extends(CustomRelatedSearches, _super); 2399 /** 2400 * Create a new CustomRelatedSearches component 2401 * @param element 2402 * @param options 2403 * @param bindings 2404 */ 2405 function CustomRelatedSearches(element, options, bindings) { 2406 var _this = _super.call(this, element, CustomRelatedSearches.ID, bindings) || this; 2407 _this.element = element; 2408 _this.options = options; 2409 _this.bindings = bindings; 2410 _this.relatedSearchesContent = null; 2411 _this.options = Coveo.ComponentOptions.initComponentOptions(element, CustomRelatedSearches, options); 2412 // Query Events 2413 _this.bind.onRootElement(Coveo.QueryEvents.doneBuildingQuery, function (args) { return _this.handleDoneBuildingQuery(args); }); 2414 _this.render(); 2415 return _this; 2416 } 2417 CustomRelatedSearches.prototype.handleDoneBuildingQuery = function (args) { 2418 var _this = this; 2419 this.clearCustomRelatedSearches(); 2420 var query = args.queryBuilder.expression.build(); 2421 if (Coveo.Utils.isNullOrEmptyString(query)) { 2422 Coveo.$$(this.element).hide(); 2423 } 2424 else { 2425 var endpoint = Coveo.SearchEndpoint.endpoints['default']; 2426 var querySuggestRequest = { 2427 q: query, 2428 count: 5 2429 }; 2430 this.promiseQuerySuggestResponse = endpoint.getQuerySuggest(querySuggestRequest); 2431 var that_1 = this; 2432 this.promiseQuerySuggestResponse.then(function (querySuggestResponse) {
2433 // Only display if there are suggestions 2434 // && Coveo.HashUtils.getValue('t', window.location.hash) != 'Cases' 2435 if (querySuggestResponse.completions.length > 0) { 2436 that_1.addCustomRelatedSearches(querySuggestResponse.completions); 2437 that_1.renderCustomRelatedSearches(args); 2438 Coveo.$$(_this.element).show(); 2439 } 2440 else { 2441 Coveo.$$(_this.element).hide(); 2442 } 2443 if (querySuggestResponse.completions.length == 1 && querySuggestResponse.completions && querySuggestResponse.completions[0].expression == query) { 2444 Coveo.$$(_this.element).hide(); 2445 } 2446 }); 2447 } 2448 }; 2449 CustomRelatedSearches.prototype.clearCustomRelatedSearches = function () { 2450 this.relatedSearches = []; 2451 }; 2452 CustomRelatedSearches.prototype.addCustomRelatedSearches = function (completions) { 2453 this.relatedSearches = completions; 2454 }; 2455 CustomRelatedSearches.prototype.renderCustomRelatedSearches = function (args) { 2456 var _this = this; 2457 var that = this; 2458 var count = 0; 2459 this.relatedSearchesContent.innerHTML = ''; 2460 _.each(this.relatedSearches, function (completion) { 2461 if ((args.queryBuilder.expression.build().toLocaleLowerCase() != completion.expression.toLocaleLowerCase()) && count <= 4) { 2462 count++; 2463 var link = window.location.href.replace(/q=.*&/, 'q=' + completion.expression + '&t=' + Coveo.HashUtils.getValue('t', window.location.hash) + '&'); 2464 Coveo.HashUtils.getValue('q', window.location.hash); 2465 var listItemLink = Coveo.$$('a', { href: link }); 2466 if (completion.expression.length > 30) { 2467 listItemLink.setHtml(completion.expression.slice(0, 30) + '...'); 2468 } 2469 else { 2470 listItemLink.setHtml(completion.expression); 2471 } 2472 if (_this.relatedSearches.length != count) { 2473 listItemLink.setHtml(listItemLink.el.innerHTML + ','); 2474 } 2475 var listItem = Coveo.$$('li', {}, listItemLink); 2476 _this.relatedSearchesContent.appendChild(listItem.el); 2477 that.element.appendChild(that.relatedSearchesContent); 2478 listItem.on('click', function () { return _this.handleClick(completion); }); 2479 } 2480 else { 2481 count++; 2482 } 2483 }); 2484 }; 2485 CustomRelatedSearches.prototype.render = function () { 2486 Coveo.$$(this.element).addClass('coveo-custom-related-searches'); 2487 var relatedSearchesLabel = Coveo.$$('span', { class: 'coveo-custom-related-searches-label' }, 'Related Searches :'); 2488 this.relatedSearchesContent = Coveo.$$('ul', { class: 'coveo-custom-related-searches' }).el; 2489 // add related searches links 2490 this.element.appendChild(relatedSearchesLabel.el); 2491 this.element.appendChild(this.relatedSearchesContent); 2492 }; 2493 CustomRelatedSearches.prototype.handleClick = function (completion) { 2494 var state = Coveo.HashUtils.getValue('t', window.location.hash); 2495 Coveo.state(this.root, 'q', completion.expression); 2496 if (typeof state != 'undefined' && !/(InstallationLicensing|WhatsNew|TroubleshootingInformation|VideoLibrary|ApplicationNotes|ErrorMessages|RapidAdoptionKits|Scripts|SkillInformation|ProductExamples|TrainingCatalog|PlatformProductPage|TrainingBytes)/i 2497 .test(state)) { 2498 var standaloneSearchInterace = Coveo.Component.get(document.getElementById('standalonesearchbox'), Coveo.SearchInterface); 2499 Coveo.state(standaloneSearchInterace.element, 'q', completion.expression); 2500 } 2501 Coveo.logCustomEvent(this.root, Coveo.analyticsActionCauseList.searchFromLink, { 2502 relatedSearches: completion.expression 2503 }); 2504 }; 2505 ; 2506 CustomRelatedSearches.ID = 'CustomRelatedSearches'; 2507 CustomRelatedSearches.options = {}; 2508 return CustomRelatedSearches; 2509}(Component)); 2510exports.CustomRelatedSearches = CustomRelatedSearches; 2511; 2512Initialization.registerAutoCreateComponent(CustomRelatedSearches); 2513 2514 2515/***/ }), 2516/* 31 */ 2517/***/ (function(module, exports, __webpack_require__) { 2518 2519"use strict"; 2520 2521var __extends = (this && this.__extends) || (function () { 2522 var extendStatics = Object.setPrototypeOf || 2523 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 2524 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 2525 return function (d, b) { 2526 extendStatics(d, b); 2527 function __() { this.constructor = d; } 2528 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2529 }; 2530})(); 2531Object.defineProperty(exports, "__esModule", { value: true }); 2532var Component = Coveo.Component; 2533var Initialization = Coveo.Initialization; 2534var MotorolaCDN_1 = __webpack_require__(0);
2535var CustomYouTubeThumbnail = /** @class */ (function (_super) { 2536 __extends(CustomYouTubeThumbnail, _super); 2537 function CustomYouTubeThumbnail(element, bindings) { 2538 var _this = _super.call(this, element, CustomYouTubeThumbnail.ID, bindings) || this; 2539 Coveo.$$(_this.root).on(Coveo.ResultListEvents.newResultsDisplayed, function (e, args) { 2540 var resultListElement = e.target; 2541 for (var i = 0; i < resultListElement.lastElementChild.children.length; i++) { 2542 var child = resultListElement.lastElementChild.children[i]; 2543 if (child.getElementsByClassName('coveo__main__result__youtube__thumbnail') != undefined && 2544 child.getElementsByClassName('coveo__main__result__youtube__thumbnail').length > 0) { 2545 var thumbnailContainer = child.getElementsByClassName('coveo__main__result__youtube__thumbnail')[0]; 2546 var playIcon = document.createElement('img'); 2547 playIcon.className = 'coveo_thumbnail_play_icon'; 2548 playIcon.setAttribute('src', MotorolaCDN_1.MotorolaCDN.cdnUrl + '/vendor/motorola/image/light.png'); 2549 $(playIcon).click(child, function (evt) { 2550 var clickedElement = evt.data; 2551 if (clickedElement.getElementsByClassName('coveo-youtube-thumbnail-container') != undefined) { 2552 var thumbnailElement = clickedElement.getElementsByClassName('coveo-youtube-thumbnail-container')[0]; 2553 $(thumbnailElement).click(); 2554 } 2555 }); 2556 thumbnailContainer.appendChild(playIcon); 2557 } 2558 } 2559 }); 2560 return _this; 2561 } 2562 CustomYouTubeThumbnail.ID = 'CustomYouTubeThumbnail'; 2563 return CustomYouTubeThumbnail; 2564}(Component)); 2565exports.CustomYouTubeThumbnail = CustomYouTubeThumbnail; 2566Initialization.registerAutoCreateComponent(CustomYouTubeThumbnail); 2567 2568 2569/***/ }), 2570/* 32 */ 2571/***/ (function(module, exports, __webpack_require__) { 2572 2573"use strict"; 2574 2575var __extends = (this && this.__extends) || (function () { 2576 var extendStatics = Object.setPrototypeOf || 2577 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 2578 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 2579 return function (d, b) { 2580 extendStatics(d, b); 2581 function __() { this.constructor = d; } 2582 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2583 }; 2584})(); 2585Object.defineProperty(exports, "__esModule", { value: true }); 2586var Component = Coveo.Component; 2587var Initialization = Coveo.Initialization; 2588var MotorolaCDN_1 = __webpack_require__(0); 2589var CustomBrightcoveThumbnail = /** @class */ (function (_super) { 2590 __extends(CustomBrightcoveThumbnail, _super); 2591 function CustomBrightcoveThumbnail(element, bindings) { 2592 var _this = _super.call(this, element, CustomBrightcoveThumbnail.ID, bindings) || this; 2593 Coveo.$$(_this.root).on(Coveo.ResultListEvents.newResultsDisplayed, function (e, args) { 2594 var resultListElement = e.target; 2595 for (var i = 0; i < resultListElement.lastElementChild.children.length; i++) { 2596 var child = resultListElement.lastElementChild.children[i]; 2597 if (child.getElementsByClassName('brightcove_thumbnail') != undefined && 2598 child.getElementsByClassName('brightcove_thumbnail').length > 0) { 2599 var thumbnailContainer = child.getElementsByClassName('brightcove_thumbnail')[0].parentElement.parentElement; 2600 var playIcon = document.createElement('img'); 2601 playIcon.className = 'coveo_thumbnail_play_icon'; 2602 playIcon.setAttribute('src', MotorolaCDN_1.MotorolaCDN.cdnUrl + '/vendor/motorola/image/light.png'); 2603 $(playIcon).click(child, function (evt) { 2604 var clickedElement = evt.data; 2605 if (clickedElement.getElementsByClassName('brightcove_thumbnail') != undefined) { 2606 var thumbnailElement = clickedElement.getElementsByClassName('brightcove_thumbnail')[0]; 2607 $(thumbnailElement).click(); 2608 } 2609 }); 2610 thumbnailContainer.appendChild(playIcon); 2611 } 2612 } 2613 }); 2614 return _this; 2615 }
2616 CustomBrightcoveThumbnail.ID = 'CustomBrightcoveThumbnail'; 2617 return CustomBrightcoveThumbnail; 2618}(Component)); 2619exports.CustomBrightcoveThumbnail = CustomBrightcoveThumbnail; 2620Initialization.registerAutoCreateComponent(CustomBrightcoveThumbnail); 2621 2622 2623/***/ }), 2624/* 33 */ 2625/***/ (function(module, exports, __webpack_require__) { 2626 2627"use strict"; 2628 2629var __extends = (this && this.__extends) || (function () { 2630 var extendStatics = Object.setPrototypeOf || 2631 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 2632 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 2633 return function (d, b) { 2634 extendStatics(d, b); 2635 function __() { this.constructor = d; } 2636 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2637 }; 2638})(); 2639Object.defineProperty(exports, "__esModule", { value: true }); 2640var Component = Coveo.Component; 2641var Initialization = Coveo.Initialization; 2642var MotorolaCDN_1 = __webpack_require__(0); 2643var CustomSecureContentIcon = /** @class */ (function (_super) { 2644 __extends(CustomSecureContentIcon, _super); 2645 function CustomSecureContentIcon(element, bindings) { 2646 var _this = _super.call(this, element, CustomSecureContentIcon.ID, bindings) || this; 2647 Coveo.$$(_this.root).on(Coveo.ResultListEvents.newResultsDisplayed, function (e, data) { return _this.handleSecureItems(e, data); }); 2648 return _this; 2649 } 2650 CustomSecureContentIcon.decipherUserRoles = function (jwtToken) { 2651 try { 2652 var jwtObj = JSON.parse(window.atob(jwtToken.split('.')[1].replace(/-/g, '+').replace(/_/g, '/'))); 2653 if (jwtObj["filter"]) { 2654 var cugExpression = jwtObj["filter"].split(' ').map(function (e) { return e.split('='); }).filter(function (e) { return e.indexOf('@moto_cug_policy') > -1; }).filter(function (e) { return e.length > 1 && e[0] == '@moto_cug_policy'; })[0][1]; 2655 cugExpression = cugExpression.split(',').map(function (e) { return e.replace('(', '').replace(')', '').replace(/["']/g, ""); }); 2656 console.log('CUG Expression : ' + cugExpression); 2657 CustomSecureContentIcon.userRoles = cugExpression; 2658 } 2659 } 2660 catch (e) { 2661 console.error('Unable to decode JWT Token'); 2662 console.error(e); 2663 } 2664 }; 2665 CustomSecureContentIcon.showLockIcons = function () { 2666 var commonRoles = CustomSecureContentIcon.userRoles.filter(function (n) { return -1 != CustomSecureContentIcon.salesUserRoles.indexOf(n); }); 2667 if (commonRoles && commonRoles.length < 1) { 2668 return false; 2669 } 2670 return true; 2671 }; 2672 CustomSecureContentIcon.prototype.handleSecureItems = function (e, data) { 2673 if (!CustomSecureContentIcon.showLockIcons()) { 2674 return; 2675 } 2676 var resultListElement = e.target; 2677 for (var i = 0; i < resultListElement.lastElementChild.children.length; i++) { 2678 var child = resultListElement.lastElementChild.children[i]; 2679 var resObj = child['CoveoResult']; 2680 if (resObj && resObj.raw && resObj.raw.moto_show_lock && child.getElementsByClassName('coveo__result_item__content_title')[0]) { 2681 var a = document.createElement('a'); 2682 a.className = 'coveo_secure_content_anchor'; 2683 var lockDiv = document.createElement('img'); 2684 lockDiv.className = 'coveo_secure_content_icon'; 2685 lockDiv.setAttribute('src', MotorolaCDN_1.MotorolaCDN.cdnUrl + '/vendor/motorola/image/lock.svg'); 2686 a.appendChild(lockDiv); 2687 child.getElementsByClassName('coveo__result_item__content_title')[0].appendChild(a); 2688 } 2689 } 2690 }; 2691 CustomSecureContentIcon.ID = 'CustomSecureContentIcon'; 2692 CustomSecureContentIcon.userRoles = []; 2693 CustomSecureContentIcon.salesUserRoles = ['moto-aem-insite', 'moto-aem-insite-apme', 'moto-aem-insite-ea', 'moto-aem-insite-latam', 'moto-aem-insite-na']; 2694 return CustomSecureContentIcon; 2695}(Component)); 2696exports.CustomSecureContentIcon = CustomSecureContentIcon; 2697Initialization.registerAutoCreateComponent(CustomSecureContentIcon); 2698 2699 2700/***/ }), 2701/* 34 */ 2702/***/ (function(module, exports, __webpack_require__) { 2703 2704"use strict"; 2705 2706var __extends = (this && this.__extends) || (function () { 2707 var extendStatics = Object.setPrototypeOf || 2708 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 2709 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 2710 return function (d, b) { 2711 extendStatics(d, b); 2712 function __() { this.constructor = d; } 2713 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2714 }; 2715})(); 2716Object.defineProperty(exports, "__esModule", { value: true }); 2717var ComponentOptions = Coveo.ComponentOptions; 2718var Initialization = Coveo.Initialization; 2719var Utils = Coveo.Utils; 2720var $$ = Coveo.$$; 2721var ResultLink = Coveo.ResultLink; 2722var _ = __webpack_require__(35); 2723var ComponentOptionsModel = Coveo.ComponentOptionsModel; 2724var Component = Coveo.Component; 2725var CustomPrintableUri = /** @class */ (function (_super) { 2726 __extends(CustomPrintableUri, _super); 2727 /** 2728 * Creates a new PrintableUri. 2729 * @param element The HTMLElement on which to instantiate the component. 2730 * @param options The options for the PrintableUri component. 2731 * @param bindings The bindings that the component requires to function normally. If not set, these will be
2732 * automatically resolved (with a slower execution time). 2733 * @param result The result to associate the component with. 2734 */ 2735 function CustomPrintableUri(element, options, bindings, result) { 2736 var _this = _super.call(this, element, CustomPrintableUri.ID, bindings) || this; 2737 _this.element = element; 2738 _this.options = options; 2739 _this.bindings = bindings; 2740 _this.result = result; 2741 _this.links = []; 2742 _this.options = ComponentOptions.initComponentOptions(element, CustomPrintableUri, options); 2743 _this.options = _.extend({}, _this.options, _this.componentOptionsModel.get(ComponentOptionsModel.attributesEnum.resultLink)); 2744 _this.renderUri(_this.element, _this.result); 2745 return _this; 2746 } 2747 /** 2748 * Opens the result in the same window, no matter how the actual component is configured for the end user. 2749 * @param logAnalytics Specifies whether the method should log an analytics event. 2750 */ 2751 CustomPrintableUri.prototype.openLink = function (logAnalytics) { 2752 if (logAnalytics === void 0) { logAnalytics = true; } 2753 _.last(this.links).openLink(logAnalytics); 2754 }; 2755 /** 2756 * Opens the result in a new window, no matter how the actual component is configured for the end user. 2757 * @param logAnalytics Specifies whether the method should log an analytics event. 2758 */ 2759 CustomPrintableUri.prototype.openLinkInNewWindow = function (logAnalytics) { 2760 if (logAnalytics === void 0) { logAnalytics = true; } 2761 _.last(this.links).openLinkInNewWindow(logAnalytics); 2762 }; 2763 /** 2764 * Opens the link in the same manner the end user would. 2765 * 2766 * This essentially simulates a click on the result link. 2767 * 2768 * @param logAnalytics Specifies whether the method should log an analytics event. 2769 */ 2770 CustomPrintableUri.prototype.openLinkAsConfigured = function (logAnalytics) { 2771 if (logAnalytics === void 0) { logAnalytics = true; } 2772 _.last(this.links).openLinkAsConfigured(logAnalytics); 2773 }; 2774 CustomPrintableUri.prototype.renderUri = function (element, result) { 2775 var parentsXml = Utils.getFieldValue(result, 'parents'); 2776 if (parentsXml) { 2777 this.renderParentsXml(element, parentsXml); 2778 } 2779 else if (this.options.titleTemplate) { 2780 var link = new ResultLink(this.buildElementForResultLink(result.printableUri), this.options, this.bindings, this.result); 2781 this.links.push(link); 2782 this.element.appendChild(link.element); 2783 } 2784 else { 2785 this.renderShortenedUri(); 2786 } 2787 }; 2788 CustomPrintableUri.prototype.buildSeparator = function () { 2789 var separator = $$('span', { className: 'coveo-printable-uri-separator' }, ' > '); 2790 return separator.el; 2791 }; 2792 CustomPrintableUri.prototype.buildHtmlToken = function (name, uri) { 2793 var modifiedName = name.charAt(0).toUpperCase() + name.slice(1); 2794 var resultPart = _.extend({}, this.result, { 2795 clickUri: uri, 2796 title: modifiedName, 2797 titleHighlights: this.getModifiedHighlightsForModifiedResultTitle(modifiedName) 2798 }); 2799 var link = new ResultLink(this.buildElementForResultLink(modifiedName), this.options, this.bindings, resultPart); 2800 this.links.push(link); 2801 return link.element; 2802 }; 2803 CustomPrintableUri.prototype.renderParentsXml = function (element, parentsXml) { 2804 var xmlDoc = Utils.parseXml(parentsXml); 2805 var parents = xmlDoc.getElementsByTagName('parent'); 2806 var tokens = []; 2807 var separators = []; 2808 for (var i = 0; i < parents.length; i++) { 2809 if (i > 0) { 2810 var separator = this.buildSeparator(); 2811 separators.push(separator); 2812 element.appendChild(separator); 2813 } 2814 var parent_1 = parents.item(i); 2815 var token = this.buildHtmlToken(parent_1.getAttribute('name'), parent_1.getAttribute('uri')); 2816 tokens.push(token); 2817 element.appendChild(token); 2818 } 2819 }; 2820 CustomPrintableUri.prototype.renderShortenedUri = function () { 2821 var url = new URL(this.result.printableUri); 2822 var printUrl = url.href; 2823 if (printUrl.length > 60) { 2824 printUrl = printUrl.substring(0, 27) + '...' + printUrl.substring(printUrl.length - 30, printUrl.length); 2825 } 2826 var resultPart = _.extend({}, this.result, { 2827 title: printUrl, 2828 titleHighlights: this.getModifiedHighlightsForModifiedResultTitle(printUrl) 2829 }); 2830 var link = new Coveo.ResultLink(this.buildElementForResultLink(this.result.printableUri), this.options, this.bindings, resultPart); 2831 this.links.push(link); 2832 this.element.appendChild(link.element); 2833 this.element.classList.add('CoveoPrintableUri'); 2834 }; 2835 CustomPrintableUri.prototype.buildElementForResultLink = function (title) { 2836 return $$('a', { 2837 className: 'CoveoResultLink coveo-printable-uri-part', 2838 title: title 2839 }).el; 2840 }; 2841 CustomPrintableUri.prototype.getModifiedHighlightsForModifiedResultTitle = function (newTitle) { 2842 return []; 2843 }; 2844 CustomPrintableUri.ID = 'CustomPrintableUri'; 2845 CustomPrintableUri.options = {}; 2846 return CustomPrintableUri; 2847}(Component)); 2848exports.CustomPrintableUri = CustomPrintableUri; 2849Initialization.registerAutoCreateComponent(CustomPrintableUri); 2850 2851 2852/***/ }), 2853/* 35 */ 2854/***/ (function(module, exports, __webpack_require__) { 2855 2856/* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Underscore.js 1.9.1 2857// http://underscorejs.org
2858// (c) 2009-2018 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 2859// Underscore may be freely distributed under the MIT license. 2860 2861(function() { 2862 2863 // Baseline setup 2864 // -------------- 2865 2866 // Establish the root object, `window` (`self`) in the browser, `global` 2867 // on the server, or `this` in some virtual machines. We use `self` 2868 // instead of `window` for `WebWorker` support. 2869 var root = typeof self == 'object' && self.self === self && self || 2870 typeof global == 'object' && global.global === global && global || 2871 this || 2872 {}; 2873 2874 // Save the previous value of the `_` variable. 2875 var previousUnderscore = root._; 2876 2877 // Save bytes in the minified (but not gzipped) version: 2878 var ArrayProto = Array.prototype, ObjProto = Object.prototype; 2879 var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null; 2880 2881 // Create quick reference variables for speed access to core prototypes. 2882 var push = ArrayProto.push, 2883 slice = ArrayProto.slice, 2884 toString = ObjProto.toString, 2885 hasOwnProperty = ObjProto.hasOwnProperty; 2886 2887 // All **ECMAScript 5** native function implementations that we hope to use 2888 // are declared here. 2889 var nativeIsArray = Array.isArray, 2890 nativeKeys = Object.keys, 2891 nativeCreate = Object.create; 2892 2893 // Naked function reference for surrogate-prototype-swapping. 2894 var Ctor = function(){}; 2895 2896 // Create a safe reference to the Underscore object for use below. 2897 var _ = function(obj) { 2898 if (obj instanceof _) return obj; 2899 if (!(this instanceof _)) return new _(obj); 2900 this._wrapped = obj; 2901 }; 2902 2903 // Export the Underscore object for **Node.js**, with 2904 // backwards-compatibility for their old module API. If we're in 2905 // the browser, add `_` as a global object. 2906 // (`nodeType` is checked to ensure that `module` 2907 // and `exports` are not HTML elements.) 2908 if (typeof exports != 'undefined' && !exports.nodeType) { 2909 if (typeof module != 'undefined' && !module.nodeType && module.exports) { 2910 exports = module.exports = _; 2911 } 2912 exports._ = _; 2913 } else { 2914 root._ = _; 2915 } 2916 2917 // Current version. 2918 _.VERSION = '1.9.1'; 2919 2920 // Internal function that returns an efficient (for current engines) version 2921 // of the passed-in callback, to be repeatedly applied in other Underscore 2922 // functions. 2923 var optimizeCb = function(func, context, argCount) { 2924 if (context === void 0) return func; 2925 switch (argCount == null ? 3 : argCount) { 2926 case 1: return function(value) { 2927 return func.call(context, value); 2928 }; 2929 // The 2-argument case is omitted because we’re not using it. 2930 case 3: return function(value, index, collection) { 2931 return func.call(context, value, index, collection); 2932 }; 2933 case 4: return function(accumulator, value, index, collection) { 2934 return func.call(context, accumulator, value, index, collection); 2935 }; 2936 } 2937 return function() { 2938 return func.apply(context, arguments); 2939 }; 2940 }; 2941 2942 var builtinIteratee; 2943 2944 // An internal function to generate callbacks that can be applied to each 2945 // element in a collection, returning the desired result — either `identity`, 2946 // an arbitrary callback, a property matcher, or a property accessor. 2947 var cb = function(value, context, argCount) { 2948 if (_.iteratee !== builtinIteratee) return _.iteratee(value, context); 2949 if (value == null) return _.identity; 2950 if (_.isFunction(value)) return optimizeCb(value, context, argCount); 2951 if (_.isObject(value) && !_.isArray(value)) return _.matcher(value); 2952 return _.property(value); 2953 }; 2954 2955 // External wrapper for our callback generator. Users may customize 2956 // `_.iteratee` if they want additional predicate/iteratee shorthand styles. 2957 // This abstraction hides the internal-only argCount argument. 2958 _.iteratee = builtinIteratee = function(value, context) { 2959 return cb(value, context, Infinity); 2960 }; 2961 2962 // Some functions take a variable number of arguments, or a few expected 2963 // arguments at the beginning and then a variable number of values to operate 2964 // on. This helper accumulates all remaining arguments past the function’s 2965 // argument length (or an explicit `startIndex`), into an array that becomes 2966 // the last argument. Similar to ES6’s "rest parameter". 2967 var restArguments = function(func, startIndex) { 2968 startIndex = startIndex == null ? func.length - 1 : +startIndex; 2969 return function() { 2970 var length = Math.max(arguments.length - startIndex, 0), 2971 rest = Array(length), 2972 index = 0; 2973 for (; index < length; index++) { 2974 rest[index] = arguments[index + startIndex]; 2975 } 2976 switch (startIndex) { 2977 case 0: return func.call(this, rest); 2978 case 1: return func.call(this, arguments[0], rest); 2979 case 2: return func.call(this, arguments[0], arguments[1], rest); 2980 } 2981 var args = Array(startIndex + 1); 2982 for (index = 0; index < startIndex; index++) { 2983 args[index] = arguments[index]; 2984 } 2985 args[startIndex] = rest; 2986 return func.apply(this, args); 2987 }; 2988 }; 2989 2990 // An internal function for creating a new object that inherits from another. 2991 var baseCreate = function(prototype) { 2992 if (!_.isObject(prototype)) return {}; 2993 if (nativeCreate) return nativeCreate(prototype); 2994 Ctor.prototype = prototype; 2995 var result = new Ctor; 2996 Ctor.prototype = null; 2997 return result; 2998 }; 2999 3000 var shallowProperty = function(key) { 3001 return function(obj) { 3002 return obj == null ? void 0 : obj[key]; 3003 }; 3004 }; 3005 3006 var has = function(obj, path) { 3007 return obj != null && hasOwnProperty.call(obj, path); 3008 } 3009 3010 var deepGet = function(obj, path) { 3011 var length = path.length; 3012 for (var i = 0; i < length; i++) { 3013 if (obj == null) return void 0; 3014 obj = obj[path[i]]; 3015 } 3016 return length ? obj : void 0; 3017 }; 3018 3019 // Helper for collection methods to determine whether a collection 3020 // should be iterated as an array or as an object. 3021 // Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength 3022 // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094 3023 var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1; 3024 var getLength = shallowProperty('length'); 3025 var isArrayLike = function(collection) { 3026 var length = getLength(collection); 3027 return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX; 3028 }; 3029 3030 // Collection Functions 3031 // -------------------- 3032 3033 // The cornerstone, an `each` implementation, aka `forEach`. 3034 // Handles raw objects in addition to array-likes. Treats all 3035 // sparse array-likes as if they were dense. 3036 _.each = _.forEach = function(obj, iteratee, context) { 3037 iteratee = optimizeCb(iteratee, context); 3038 var i, length; 3039 if (isArrayLike(obj)) { 3040 for (i = 0, length = obj.length; i < length; i++) { 3041 iteratee(obj[i], i, obj); 3042 } 3043 } else { 3044 var keys = _.keys(obj); 3045 for (i = 0, length = keys.length; i < length; i++) { 3046 iteratee(obj[keys[i]], keys[i], obj); 3047 } 3048 } 3049 return obj; 3050 }; 3051 3052 // Return the results of applying the iteratee to each element. 3053 _.map = _.collect = function(obj, iteratee, context) { 3054 iteratee = cb(iteratee, context); 3055 var keys = !isArrayLike(obj) && _.keys(obj), 3056 length = (keys || obj).length, 3057 results = Array(length); 3058 for (var index = 0; index < length; index++) { 3059 var currentKey = keys ? keys[index] : index; 3060 results[index] = iteratee(obj[currentKey], currentKey, obj); 3061 } 3062 return results; 3063 }; 3064 3065 // Create a reducing function iterating left or right. 3066 var createReduce = function(dir) { 3067 // Wrap code that reassigns argument variables in a separate function than 3068 // the one that accesses `arguments.length` to avoid a perf hit. (#1991) 3069 var reducer = function(obj, iteratee, memo, initial) { 3070 var keys = !isArrayLike(obj) && _.keys(obj), 3071 length = (keys || obj).length, 3072 index = dir > 0 ? 0 : length - 1; 3073 if (!initial) { 3074 memo = obj[keys ? keys[index] : index]; 3075 index += dir; 3076 } 3077 for (; index >= 0 && index < length; index += dir) { 3078 var currentKey = keys ? keys[index] : index; 3079 memo = iteratee(memo, obj[currentKey], currentKey, obj); 3080 } 3081 return memo; 3082 }; 3083 3084 return function(obj, iteratee, memo, context) { 3085 var initial = arguments.length >= 3; 3086 return reducer(obj, optimizeCb(iteratee, context, 4), memo, initial); 3087 }; 3088 }; 3089 3090 // **Reduce** builds up a single result from a list of values, aka `inject`, 3091 // or `foldl`. 3092 _.reduce = _.foldl = _.inject = createReduce(1); 3093 3094 // The right-associative version of reduce, also known as `foldr`. 3095 _.reduceRight = _.foldr = createReduce(-1); 3096 3097 // Return the first value which passes a truth test. Aliased as `detect`. 3098 _.find = _.detect = function(obj, predicate, context) { 3099 var keyFinder = isArrayLike(obj) ? _.findIndex : _.findKey; 3100 var key = keyFinder(obj, predicate, context); 3101 if (key !== void 0 && key !== -1) return obj[key]; 3102 }; 3103 3104 // Return all the elements that pass a truth test. 3105 // Aliased as `select`. 3106 _.filter = _.select = function(obj, predicate, context) { 3107 var results = []; 3108 predicate = cb(predicate, context); 3109 _.each(obj, function(value, index, list) { 3110 if (predicate(value, index, list)) results.push(value); 3111 }); 3112 return results; 3113 }; 3114 3115 // Return all the elements for which a truth test fails. 3116 _.reject = function(obj, predicate, context) { 3117 return _.filter(obj, _.negate(cb(predicate)), context); 3118 }; 3119 3120 // Determine whether all of the elements match a truth test. 3121 // Aliased as `all`. 3122 _.every = _.all = function(obj, predicate, context) { 3123 predicate = cb(predicate, context); 3124 var keys = !isArrayLike(obj) && _.keys(obj), 3125 length = (keys || obj).length; 3126 for (var index = 0; index < length; index++) { 3127 var currentKey = keys ? keys[index] : index; 3128 if (!predicate(obj[currentKey], currentKey, obj)) return false;
3129 } 3130 return true; 3131 }; 3132 3133 // Determine if at least one element in the object matches a truth test. 3134 // Aliased as `any`. 3135 _.some = _.any = function(obj, predicate, context) { 3136 predicate = cb(predicate, context); 3137 var keys = !isArrayLike(obj) && _.keys(obj), 3138 length = (keys || obj).length; 3139 for (var index = 0; index < length; index++) { 3140 var currentKey = keys ? keys[index] : index; 3141 if (predicate(obj[currentKey], currentKey, obj)) return true; 3142 } 3143 return false; 3144 }; 3145 3146 // Determine if the array or object contains a given item (using `===`). 3147 // Aliased as `includes` and `include`. 3148 _.contains = _.includes = _.include = function(obj, item, fromIndex, guard) { 3149 if (!isArrayLike(obj)) obj = _.values(obj); 3150 if (typeof fromIndex != 'number' || guard) fromIndex = 0; 3151 return _.indexOf(obj, item, fromIndex) >= 0; 3152 }; 3153 3154 // Invoke a method (with arguments) on every item in a collection. 3155 _.invoke = restArguments(function(obj, path, args) { 3156 var contextPath, func; 3157 if (_.isFunction(path)) { 3158 func = path; 3159 } else if (_.isArray(path)) { 3160 contextPath = path.slice(0, -1); 3161 path = path[path.length - 1]; 3162 } 3163 return _.map(obj, function(context) { 3164 var method = func; 3165 if (!method) { 3166 if (contextPath && contextPath.length) { 3167 context = deepGet(context, contextPath); 3168 } 3169 if (context == null) return void 0; 3170 method = context[path]; 3171 } 3172 return method == null ? method : method.apply(context, args); 3173 }); 3174 }); 3175 3176 // Convenience version of a common use case of `map`: fetching a property. 3177 _.pluck = function(obj, key) { 3178 return _.map(obj, _.property(key)); 3179 }; 3180 3181 // Convenience version of a common use case of `filter`: selecting only objects 3182 // containing specific `key:value` pairs. 3183 _.where = function(obj, attrs) { 3184 return _.filter(obj, _.matcher(attrs)); 3185 }; 3186 3187 // Convenience version of a common use case of `find`: getting the first object 3188 // containing specific `key:value` pairs. 3189 _.findWhere = function(obj, attrs) { 3190 return _.find(obj, _.matcher(attrs)); 3191 }; 3192 3193 // Return the maximum element (or element-based computation). 3194 _.max = function(obj, iteratee, context) { 3195 var result = -Infinity, lastComputed = -Infinity, 3196 value, computed; 3197 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) { 3198 obj = isArrayLike(obj) ? obj : _.values(obj); 3199 for (var i = 0, length = obj.length; i < length; i++) { 3200 value = obj[i]; 3201 if (value != null && value > result) { 3202 result = value; 3203 } 3204 } 3205 } else { 3206 iteratee = cb(iteratee, context); 3207 _.each(obj, function(v, index, list) { 3208 computed = iteratee(v, index, list); 3209 if (computed > lastComputed || computed === -Infinity && result === -Infinity) { 3210 result = v; 3211 lastComputed = computed; 3212 } 3213 }); 3214 } 3215 return result; 3216 }; 3217 3218 // Return the minimum element (or element-based computation). 3219 _.min = function(obj, iteratee, context) { 3220 var result = Infinity, lastComputed = Infinity, 3221 value, computed; 3222 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) { 3223 obj = isArrayLike(obj) ? obj : _.values(obj); 3224 for (var i = 0, length = obj.length; i < length; i++) { 3225 value = obj[i]; 3226 if (value != null && value < result) { 3227 result = value; 3228 } 3229 } 3230 } else { 3231 iteratee = cb(iteratee, context); 3232 _.each(obj, function(v, index, list) { 3233 computed = iteratee(v, index, list); 3234 if (computed < lastComputed || computed === Infinity && result === Infinity) { 3235 result = v; 3236 lastComputed = computed; 3237 } 3238 }); 3239 } 3240 return result; 3241 }; 3242 3243 // Shuffle a collection. 3244 _.shuffle = function(obj) { 3245 return _.sample(obj, Infinity); 3246 }; 3247 3248 // Sample **n** random values from a collection using the modern version of the 3249 // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle). 3250 // If **n** is not specified, returns a single random element. 3251 // The internal `guard` argument allows it to work with `map`. 3252 _.sample = function(obj, n, guard) { 3253 if (n == null || guard) { 3254 if (!isArrayLike(obj)) obj = _.values(obj); 3255 return obj[_.random(obj.length - 1)]; 3256 } 3257 var sample = isArrayLike(obj) ? _.clone(obj) : _.values(obj); 3258 var length = getLength(sample); 3259 n = Math.max(Math.min(n, length), 0); 3260 var last = length - 1; 3261 for (var index = 0; index < n; index++) { 3262 var rand = _.random(index, last); 3263 var temp = sample[index]; 3264 sample[index] = sample[rand]; 3265 sample[rand] = temp; 3266 } 3267 return sample.slice(0, n); 3268 }; 3269 3270 // Sort the object's values by a criterion produced by an iteratee. 3271 _.sortBy = function(obj, iteratee, context) { 3272 var index = 0; 3273 iteratee = cb(iteratee, context); 3274 return _.pluck(_.map(obj, function(value, key, list) { 3275 return { 3276 value: value, 3277 index: index++, 3278 criteria: iteratee(value, key, list) 3279 }; 3280 }).sort(function(left, right) { 3281 var a = left.criteria; 3282 var b = right.criteria; 3283 if (a !== b) { 3284 if (a > b || a === void 0) return 1; 3285 if (a < b || b === void 0) return -1; 3286 } 3287 return left.index - right.index; 3288 }), 'value'); 3289 }; 3290 3291 // An internal function used for aggregate "group by" operations. 3292 var group = function(behavior, partition) { 3293 return function(obj, iteratee, context) { 3294 var result = partition ? [[], []] : {}; 3295 iteratee = cb(iteratee, context); 3296 _.each(obj, function(value, index) { 3297 var key = iteratee(value, index, obj); 3298 behavior(result, value, key); 3299 }); 3300 return result; 3301 }; 3302 }; 3303 3304 // Groups the object's values by a criterion. Pass either a string attribute 3305 // to group by, or a function that returns the criterion. 3306 _.groupBy = group(function(result, value, key) { 3307 if (has(result, key)) result[key].push(value); else result[key] = [value]; 3308 }); 3309 3310 // Indexes the object's values by a criterion, similar to `groupBy`, but for 3311 // when you know that your index values will be unique. 3312 _.indexBy = group(function(result, value, key) { 3313 result[key] = value; 3314 }); 3315 3316 // Counts instances of an object that group by a certain criterion. Pass 3317 // either a string attribute to count by, or a function that returns the 3318 // criterion. 3319 _.countBy = group(function(result, value, key) { 3320 if (has(result, key)) result[key]++; else result[key] = 1; 3321 }); 3322 3323 var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g; 3324 // Safely create a real, live array from anything iterable. 3325 _.toArray = function(obj) { 3326 if (!obj) return []; 3327 if (_.isArray(obj)) return slice.call(obj); 3328 if (_.isString(obj)) { 3329 // Keep surrogate pair characters together 3330 return obj.match(reStrSymbol); 3331 } 3332 if (isArrayLike(obj)) return _.map(obj, _.identity); 3333 return _.values(obj); 3334 }; 3335 3336 // Return the number of elements in an object. 3337 _.size = function(obj) { 3338 if (obj == null) return 0; 3339 return isArrayLike(obj) ? obj.length : _.keys(obj).length; 3340 }; 3341 3342 // Split a collection into two arrays: one whose elements all satisfy the given 3343 // predicate, and one whose elements all do not satisfy the predicate. 3344 _.partition = group(function(result, value, pass) { 3345 result[pass ? 0 : 1].push(value); 3346 }, true); 3347 3348 // Array Functions 3349 // --------------- 3350 3351 // Get the first element of an array. Passing **n** will return the first N 3352 // values in the array. Aliased as `head` and `take`. The **guard** check 3353 // allows it to work with `_.map`. 3354 _.first = _.head = _.take = function(array, n, guard) { 3355 if (array == null || array.length < 1) return n == null ? void 0 : []; 3356 if (n == null || guard) return array[0]; 3357 return _.initial(array, array.length - n); 3358 }; 3359 3360 // Returns everything but the last entry of the array. Especially useful on 3361 // the arguments object. Passing **n** will return all the values in 3362 // the array, excluding the last N. 3363 _.initial = function(array, n, guard) { 3364 return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n))); 3365 }; 3366 3367 // Get the last element of an array. Passing **n** will return the last N 3368 // values in the array. 3369 _.last = function(array, n, guard) { 3370 if (array == null || array.length < 1) return n == null ? void 0 : []; 3371 if (n == null || guard) return array[array.length - 1]; 3372 return _.rest(array, Math.max(0, array.length - n)); 3373 }; 3374 3375 // Returns everything but the first entry of the array. Aliased as `tail` and `drop`. 3376 // Especially useful on the arguments object. Passing an **n** will return 3377 // the rest N values in the array. 3378 _.rest = _.tail = _.drop = function(array, n, guard) { 3379 return slice.call(array, n == null || guard ? 1 : n); 3380 }; 3381 3382 // Trim out all falsy values from an array.
3383 _.compact = function(array) { 3384 return _.filter(array, Boolean); 3385 }; 3386 3387 // Internal implementation of a recursive `flatten` function. 3388 var flatten = function(input, shallow, strict, output) { 3389 output = output || []; 3390 var idx = output.length; 3391 for (var i = 0, length = getLength(input); i < length; i++) { 3392 var value = input[i]; 3393 if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) { 3394 // Flatten current level of array or arguments object. 3395 if (shallow) { 3396 var j = 0, len = value.length; 3397 while (j < len) output[idx++] = value[j++]; 3398 } else { 3399 flatten(value, shallow, strict, output); 3400 idx = output.length; 3401 } 3402 } else if (!strict) { 3403 output[idx++] = value; 3404 } 3405 } 3406 return output; 3407 }; 3408 3409 // Flatten out an array, either recursively (by default), or just one level. 3410 _.flatten = function(array, shallow) { 3411 return flatten(array, shallow, false); 3412 }; 3413 3414 // Return a version of the array that does not contain the specified value(s). 3415 _.without = restArguments(function(array, otherArrays) { 3416 return _.difference(array, otherArrays); 3417 }); 3418 3419 // Produce a duplicate-free version of the array. If the array has already 3420 // been sorted, you have the option of using a faster algorithm. 3421 // The faster algorithm will not work with an iteratee if the iteratee 3422 // is not a one-to-one function, so providing an iteratee will disable 3423 // the faster algorithm. 3424 // Aliased as `unique`. 3425 _.uniq = _.unique = function(array, isSorted, iteratee, context) { 3426 if (!_.isBoolean(isSorted)) { 3427 context = iteratee; 3428 iteratee = isSorted; 3429 isSorted = false; 3430 } 3431 if (iteratee != null) iteratee = cb(iteratee, context); 3432 var result = []; 3433 var seen = []; 3434 for (var i = 0, length = getLength(array); i < length; i++) { 3435 var value = array[i], 3436 computed = iteratee ? iteratee(value, i, array) : value; 3437 if (isSorted && !iteratee) { 3438 if (!i || seen !== computed) result.push(value); 3439 seen = computed; 3440 } else if (iteratee) { 3441 if (!_.contains(seen, computed)) { 3442 seen.push(computed); 3443 result.push(value); 3444 } 3445 } else if (!_.contains(result, value)) { 3446 result.push(value); 3447 } 3448 } 3449 return result; 3450 }; 3451 3452 // Produce an array that contains the union: each distinct element from all of 3453 // the passed-in arrays. 3454 _.union = restArguments(function(arrays) { 3455 return _.uniq(flatten(arrays, true, true)); 3456 }); 3457 3458 // Produce an array that contains every item shared between all the 3459 // passed-in arrays. 3460 _.intersection = function(array) { 3461 var result = []; 3462 var argsLength = arguments.length; 3463 for (var i = 0, length = getLength(array); i < length; i++) { 3464 var item = array[i]; 3465 if (_.contains(result, item)) continue; 3466 var j; 3467 for (j = 1; j < argsLength; j++) { 3468 if (!_.contains(arguments[j], item)) break; 3469 } 3470 if (j === argsLength) result.push(item); 3471 } 3472 return result; 3473 }; 3474 3475 // Take the difference between one array and a number of other arrays. 3476 // Only the elements present in just the first array will remain. 3477 _.difference = restArguments(function(array, rest) { 3478 rest = flatten(rest, true, true); 3479 return _.filter(array, function(value){ 3480 return !_.contains(rest, value); 3481 }); 3482 }); 3483 3484 // Complement of _.zip. Unzip accepts an array of arrays and groups 3485 // each array's elements on shared indices. 3486 _.unzip = function(array) { 3487 var length = array && _.max(array, getLength).length || 0; 3488 var result = Array(length); 3489 3490 for (var index = 0; index < length; index++) { 3491 result[index] = _.pluck(array, index); 3492 } 3493 return result; 3494 }; 3495 3496 // Zip together multiple lists into a single array -- elements that share 3497 // an index go together. 3498 _.zip = restArguments(_.unzip); 3499 3500 // Converts lists into objects. Pass either a single array of `[key, value]` 3501 // pairs, or two parallel arrays of the same length -- one of keys, and one of 3502 // the corresponding values. Passing by pairs is the reverse of _.pairs. 3503 _.object = function(list, values) { 3504 var result = {}; 3505 for (var i = 0, length = getLength(list); i < length; i++) { 3506 if (values) { 3507 result[list[i]] = values[i]; 3508 } else { 3509 result[list[i][0]] = list[i][1]; 3510 } 3511 } 3512 return result; 3513 }; 3514 3515 // Generator function to create the findIndex and findLastIndex functions. 3516 var createPredicateIndexFinder = function(dir) { 3517 return function(array, predicate, context) { 3518 predicate = cb(predicate, context); 3519 var length = getLength(array); 3520 var index = dir > 0 ? 0 : length - 1; 3521 for (; index >= 0 && index < length; index += dir) { 3522 if (predicate(array[index], index, array)) return index; 3523 } 3524 return -1; 3525 }; 3526 }; 3527 3528 // Returns the first index on an array-like that passes a predicate test. 3529 _.findIndex = createPredicateIndexFinder(1); 3530 _.findLastIndex = createPredicateIndexFinder(-1); 3531 3532 // Use a comparator function to figure out the smallest index at which 3533 // an object should be inserted so as to maintain order. Uses binary search. 3534 _.sortedIndex = function(array, obj, iteratee, context) { 3535 iteratee = cb(iteratee, context, 1); 3536 var value = iteratee(obj); 3537 var low = 0, high = getLength(array); 3538 while (low < high) { 3539 var mid = Math.floor((low + high) / 2); 3540 if (iteratee(array[mid]) < value) low = mid + 1; else high = mid; 3541 } 3542 return low; 3543 }; 3544 3545 // Generator function to create the indexOf and lastIndexOf functions. 3546 var createIndexFinder = function(dir, predicateFind, sortedIndex) { 3547 return function(array, item, idx) { 3548 var i = 0, length = getLength(array); 3549 if (typeof idx == 'number') { 3550 if (dir > 0) { 3551 i = idx >= 0 ? idx : Math.max(idx + length, i); 3552 } else { 3553 length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1; 3554 } 3555 } else if (sortedIndex && idx && length) { 3556 idx = sortedIndex(array, item); 3557 return array[idx] === item ? idx : -1; 3558 } 3559 if (item !== item) { 3560 idx = predicateFind(slice.call(array, i, length), _.isNaN); 3561 return idx >= 0 ? idx + i : -1; 3562 } 3563 for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) { 3564 if (array[idx] === item) return idx; 3565 } 3566 return -1; 3567 }; 3568 }; 3569 3570 // Return the position of the first occurrence of an item in an array, 3571 // or -1 if the item is not included in the array. 3572 // If the array is large and already in sort order, pass `true` 3573 // for **isSorted** to use binary search. 3574 _.indexOf = createIndexFinder(1, _.findIndex, _.sortedIndex); 3575 _.lastIndexOf = createIndexFinder(-1, _.findLastIndex); 3576 3577 // Generate an integer Array containing an arithmetic progression. A port of 3578 // the native Python `range()` function. See 3579 // [the Python documentation](http://docs.python.org/library/functions.html#range). 3580 _.range = function(start, stop, step) { 3581 if (stop == null) { 3582 stop = start || 0; 3583 start = 0; 3584 } 3585 if (!step) { 3586 step = stop < start ? -1 : 1; 3587 } 3588 3589 var length = Math.max(Math.ceil((stop - start) / step), 0); 3590 var range = Array(length); 3591 3592 for (var idx = 0; idx < length; idx++, start += step) { 3593 range[idx] = start; 3594 } 3595 3596 return range; 3597 }; 3598 3599 // Chunk a single array into multiple arrays, each containing `count` or fewer 3600 // items. 3601 _.chunk = function(array, count) { 3602 if (count == null || count < 1) return []; 3603 var result = []; 3604 var i = 0, length = array.length; 3605 while (i < length) { 3606 result.push(slice.call(array, i, i += count)); 3607 } 3608 return result; 3609 }; 3610 3611 // Function (ahem) Functions 3612 // ------------------ 3613 3614 // Determines whether to execute a function as a constructor 3615 // or a normal function with the provided arguments. 3616 var executeBound = function(sourceFunc, boundFunc, context, callingContext, args
3616) { 3617 if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args); 3618 var self = baseCreate(sourceFunc.prototype); 3619 var result = sourceFunc.apply(self, args); 3620 if (_.isObject(result)) return result; 3621 return self; 3622 }; 3623 3624 // Create a function bound to a given object (assigning `this`, and arguments, 3625 // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if 3626 // available. 3627 _.bind = restArguments(function(func, context, args) { 3628 if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function'); 3629 var bound = restArguments(function(callArgs) { 3630 return executeBound(func, bound, context, this, args.concat(callArgs)); 3631 }); 3632 return bound; 3633 }); 3634 3635 // Partially apply a function by creating a version that has had some of its 3636 // arguments pre-filled, without changing its dynamic `this` context. _ acts 3637 // as a placeholder by default, allowing any combination of arguments to be 3638 // pre-filled. Set `_.partial.placeholder` for a custom placeholder argument. 3639 _.partial = restArguments(function(func, boundArgs) { 3640 var placeholder = _.partial.placeholder; 3641 var bound = function() { 3642 var position = 0, length = boundArgs.length; 3643 var args = Array(length); 3644 for (var i = 0; i < length; i++) { 3645 args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i]; 3646 } 3647 while (position < arguments.length) args.push(arguments[position++]); 3648 return executeBound(func, bound, this, this, args); 3649 }; 3650 return bound; 3651 }); 3652 3653 _.partial.placeholder = _; 3654 3655 // Bind a number of an object's methods to that object. Remaining arguments 3656 // are the method names to be bound. Useful for ensuring that all callbacks 3657 // defined on an object belong to it. 3658 _.bindAll = restArguments(function(obj, keys) { 3659 keys = flatten(keys, false, false); 3660 var index = keys.length; 3661 if (index < 1) throw new Error('bindAll must be passed function names'); 3662 while (index--) { 3663 var key = keys[index]; 3664 obj[key] = _.bind(obj[key], obj); 3665 } 3666 }); 3667 3668 // Memoize an expensive function by storing its results. 3669 _.memoize = function(func, hasher) { 3670 var memoize = function(key) { 3671 var cache = memoize.cache; 3672 var address = '' + (hasher ? hasher.apply(this, arguments) : key); 3673 if (!has(cache, address)) cache[address] = func.apply(this, arguments); 3674 return cache[address]; 3675 }; 3676 memoize.cache = {}; 3677 return memoize; 3678 }; 3679 3680 // Delays a function for the given number of milliseconds, and then calls 3681 // it with the arguments supplied.
3682 _.delay = restArguments(function(func, wait, args) { 3683 return setTimeout(function() { 3684 return func.apply(null, args); 3685 }, wait); 3686 }); 3687 3688 // Defers a function, scheduling it to run after the current call stack has 3689 // cleared. 3690 _.defer = _.partial(_.delay, _, 1); 3691 3692 // Returns a function, that, when invoked, will only be triggered at most once 3693 // during a given window of time. Normally, the throttled function will run 3694 // as much as it can, without ever going more than once per `wait` duration; 3695 // but if you'd like to disable the execution on the leading edge, pass 3696 // `{leading: false}`. To disable execution on the trailing edge, ditto. 3697 _.throttle = function(func, wait, options) { 3698 var timeout, context, args, result; 3699 var previous = 0; 3700 if (!options) options = {}; 3701 3702 var later = function() { 3703 previous = options.leading === false ? 0 : _.now(); 3704 timeout = null; 3705 result = func.apply(context, args); 3706 if (!timeout) context = args = null; 3707 }; 3708 3709 var throttled = function() { 3710 var now = _.now(); 3711 if (!previous && options.leading === false) previous = now; 3712 var remaining = wait - (now - previous); 3713 context = this; 3714 args = arguments; 3715 if (remaining <= 0 || remaining > wait) { 3716 if (timeout) { 3717 clearTimeout(timeout); 3718 timeout = null; 3719 } 3720 previous = now; 3721 result = func.apply(context, args); 3722 if (!timeout) context = args = null; 3723 } else if (!timeout && options.trailing !== false) { 3724 timeout = setTimeout(later, remaining); 3725 } 3726 return result; 3727 }; 3728 3729 throttled.cancel = function() { 3730 clearTimeout(timeout); 3731 previous = 0; 3732 timeout = context = args = null; 3733 }; 3734 3735 return throttled; 3736 }; 3737 3738 // Returns a function, that, as long as it continues to be invoked, will not 3739 // be triggered. The function will be called after it stops being called for 3740 // N milliseconds. If `immediate` is passed, trigger the function on the 3741 // leading edge, instead of the trailing. 3742 _.debounce = function(func, wait, immediate) { 3743 var timeout, result; 3744 3745 var later = function(context, args) { 3746 timeout = null; 3747 if (args) result = func.apply(context, args); 3748 }; 3749 3750 var debounced = restArguments(function(args) { 3751 if (timeout) clearTimeout(timeout); 3752 if (immediate) { 3753 var callNow = !timeout; 3754 timeout = setTimeout(later, wait); 3755 if (callNow) result = func.apply(this, args); 3756 } else { 3757 timeout = _.delay(later, wait, this, args); 3758 } 3759 3760 return result; 3761 }); 3762 3763 debounced.cancel = function() { 3764 clearTimeout(timeout); 3765 timeout = null; 3766 }; 3767 3768 return debounced; 3769 }; 3770 3771 // Returns the first function passed as an argument to the second, 3772 // allowing you to adjust arguments, run code before and after, and 3773 // conditionally execute the original function. 3774 _.wrap = function(func, wrapper) { 3775 return _.partial(wrapper, func); 3776 }; 3777
3778 // Returns a negated version of the passed-in predicate. 3779 _.negate = function(predicate) { 3780 return function() { 3781 return !predicate.apply(this, arguments); 3782 }; 3783 }; 3784 3785 // Returns a function that is the composition of a list of functions, each 3786 // consuming the return value of the function that follows. 3787 _.compose = function() { 3788 var args = arguments; 3789 var start = args.length - 1; 3790 return function() { 3791 var i = start; 3792 var result = args[start].apply(this, arguments); 3793 while (i--) result = args[i].call(this, result); 3794 return result; 3795 }; 3796 }; 3797 3798 // Returns a function that will only be executed on and after the Nth call. 3799 _.after = function(times, func) { 3800 return function() { 3801 if (--times < 1) { 3802 return func.apply(this, arguments); 3803 } 3804 }; 3805 }; 3806 3807 // Returns a function that will only be executed up to (but not including) the Nth call. 3808 _.before = function(times, func) { 3809 var memo; 3810 return function() { 3811 if (--times > 0) { 3812 memo = func.apply(this, arguments); 3813 } 3814 if (times <= 1) func = null; 3815 return memo; 3816 }; 3817 }; 3818 3819 // Returns a function that will be executed at most one time, no matter how 3820 // often you call it. Useful for lazy initialization. 3821 _.once = _.partial(_.before, 2); 3822 3823 _.restArguments = restArguments; 3824 3825 // Object Functions 3826 // ---------------- 3827 3828 // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed. 3829 var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString'); 3830 var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString', 3831 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; 3832 3833 var collectNonEnumProps = function(obj, keys) { 3834 var nonEnumIdx = nonEnumerableProps.length; 3835 var constructor = obj.constructor; 3836 var proto = _.isFunction(constructor) && constructor.prototype || ObjProto; 3837 3838 // Constructor is a special case. 3839 var prop = 'constructor';
3840 if (has(obj, prop) && !_.contains(keys, prop)) keys.push(prop); 3841 3842 while (nonEnumIdx--) { 3843 prop = nonEnumerableProps[nonEnumIdx]; 3844 if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) { 3845 keys.push(prop); 3846 } 3847 } 3848 }; 3849 3850 // Retrieve the names of an object's own properties. 3851 // Delegates to **ECMAScript 5**'s native `Object.keys`. 3852 _.keys = function(obj) { 3853 if (!_.isObject(obj)) return []; 3854 if (nativeKeys) return nativeKeys(obj); 3855 var keys = []; 3856 for (var key in obj) if (has(obj, key)) keys.push(key); 3857 // Ahem, IE < 9. 3858 if (hasEnumBug) collectNonEnumProps(obj, keys); 3859 return keys; 3860 }; 3861 3862 // Retrieve all the property names of an object. 3863 _.allKeys = function(obj) { 3864 if (!_.isObject(obj)) return []; 3865 var keys = []; 3866 for (var key in obj) keys.push(key); 3867 // Ahem, IE < 9. 3868 if (hasEnumBug) collectNonEnumProps(obj, keys); 3869 return keys; 3870 }; 3871 3872 // Retrieve the values of an object's properties. 3873 _.values = function(obj) { 3874 var keys = _.keys(obj); 3875 var length = keys.length; 3876 var values = Array(length); 3877 for (var i = 0; i < length; i++) { 3878 values[i] = obj[keys[i]]; 3879 } 3880 return values; 3881 }; 3882 3883 // Returns the results of applying the iteratee to each element of the object. 3884 // In contrast to _.map it returns an object. 3885 _.mapObject = function(obj, iteratee, context) { 3886 iteratee = cb(iteratee, context); 3887 var keys = _.keys(obj), 3888 length = keys.length, 3889 results = {}; 3890 for (var index = 0; index < length; index++) { 3891 var currentKey = keys[index]; 3892 results[currentKey] = iteratee(obj[currentKey], currentKey, obj); 3893 } 3894 return results; 3895 }; 3896 3897 // Convert an object into a list of `[key, value]` pairs. 3898 // The opposite of _.object. 3899 _.pairs = function(obj) { 3900 var keys = _.keys(obj); 3901 var length = keys.length; 3902 var pairs = Array(length); 3903 for (var i = 0; i < length; i++) { 3904 pairs[i] = [keys[i], obj[keys[i]]]; 3905 } 3906 return pairs; 3907 }; 3908 3909 // Invert the keys and values of an object. The values must be serializable. 3910 _.invert = function(obj) { 3911 var result = {}; 3912 var keys = _.keys(obj); 3913 for (var i = 0, length = keys.length; i < length; i++) { 3914 result[obj[keys[i]]] = keys[i]; 3915 } 3916 return result; 3917 }; 3918 3919 // Return a sorted list of the function names available on the object. 3920 // Aliased as `methods`. 3921 _.functions = _.methods = function(obj) { 3922 var names = []; 3923 for (var key in obj) { 3924 if (_.isFunction(obj[key])) names.push(key); 3925 } 3926 return names.sort(); 3927 }; 3928 3929 // An internal function for creating assigner functions. 3930 var createAssigner = function(keysFunc, defaults) { 3931 return function(obj) { 3932 var length = arguments.length; 3933 if (defaults) obj = Object(obj); 3934 if (length < 2 || obj == null) return obj; 3935 for (var index = 1; index < length; index++) { 3936 var source = arguments[index], 3937 keys = keysFunc(source), 3938 l = keys.length; 3939 for (var i = 0; i < l; i++) { 3940 var key = keys[i]; 3941 if (!defaults || obj[key] === void 0) obj[key] = source[key]; 3942 } 3943 } 3944 return obj; 3945 }; 3946 }; 3947 3948 // Extend a given object with all the properties in passed-in object(s). 3949 _.extend = createAssigner(_.allKeys); 3950 3951 // Assigns a given object with all the own properties in the passed-in object(s). 3952 // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) 3953 _.extendOwn = _.assign = createAssigner(_.keys); 3954 3955 // Returns the first key on an object that passes a predicate test. 3956 _.findKey = function(obj, predicate, context) { 3957 predicate = cb(predicate, context); 3958 var keys = _.keys(obj), key; 3959 for (var i = 0, length = keys.length; i < length; i++) { 3960 key = keys[i]; 3961 if (predicate(obj[key], key, obj)) return key; 3962 } 3963 }; 3964 3965 // Internal pick helper function to determine if `obj` has key `key`. 3966 var keyInObj = function(value, key, obj) { 3967 return key in obj; 3968 }; 3969 3970 // Return a copy of the object only containing the whitelisted properties. 3971 _.pick = restArguments(function(obj, keys) { 3972 var result = {}
3972, iteratee = keys[0]; 3973 if (obj == null) return result; 3974 if (_.isFunction(iteratee)) { 3975 if (keys.length > 1) iteratee = optimizeCb(iteratee, keys[1]); 3976 keys = _.allKeys(obj); 3977 } else { 3978 iteratee = keyInObj; 3979 keys = flatten(keys, false, false); 3980 obj = Object(obj); 3981 } 3982 for (var i = 0, length = keys.length; i < length; i++) { 3983 var key = keys[i]; 3984 var value = obj[key]; 3985 if (iteratee(value, key, obj)) result[key] = value; 3986 } 3987 return result; 3988 }); 3989 3990 // Return a copy of the object without the blacklisted properties. 3991 _.omit = restArguments(function(obj, keys) { 3992 var iteratee = keys[0], context; 3993 if (_.isFunction(iteratee)) { 3994 iteratee = _.negate(iteratee); 3995 if (keys.length > 1) context = keys[1]; 3996 } else { 3997 keys = _.map(flatten(keys, false, false), String); 3998 iteratee = function(value, key) { 3999 return !_.contains(keys, key); 4000 }; 4001 } 4002 return _.pick(obj, iteratee, context); 4003 }); 4004 4005 // Fill in a given object with default properties. 4006 _.defaults = createAssigner(_.allKeys, true); 4007 4008 // Creates an object that inherits from the given prototype object. 4009 // If additional properties are provided then they will be added to the 4010 // created object. 4011 _.create = function(prototype, props) { 4012 var result = baseCreate(prototype); 4013 if (props) _.extendOwn(result, props); 4014 return result; 4015 }; 4016 4017 // Create a (shallow-cloned) duplicate of an object. 4018 _.clone = function(obj) { 4019 if (!_.isObject(obj)) return obj; 4020 return _.isArray(obj) ? obj.slice() : _.extend({}, obj); 4021 }; 4022 4023 // Invokes interceptor with the obj, and then returns obj. 4024 // The primary purpose of this method is to "tap into" a method chain, in 4025 // order to perform operations on intermediate results within the chain. 4026 _.tap = function(obj, interceptor) { 4027 interceptor(obj); 4028 return obj; 4029 }; 4030 4031 // Returns whether an object has a given set of `key:value` pairs. 4032 _.isMatch = function(object, attrs) { 4033 var keys = _.keys(attrs), length = keys.length; 4034 if (object == null) return !length; 4035 var obj = Object(object); 4036 for (var i = 0; i < length; i++) { 4037 var key = keys[i]; 4038 if (attrs[key] !== obj[key] || !(key in obj)) return false; 4039 } 4040 return true; 4041 }; 4042 4043 4044 // Internal recursive comparison function for `isEqual`. 4045 var eq, deepEq; 4046 eq = function(a, b, aStack, bStack) { 4047 // Identical objects are equal. `0 === -0`, but they aren't identical. 4048 // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). 4049 if (a === b) return a !== 0 || 1 / a === 1 / b; 4050 // `null` or `undefined` only equal to itself (strict comparison). 4051 if (a == null || b == null) return false; 4052 // `NaN`s are equivalent, but non-reflexive. 4053 if (a !== a) return b !== b; 4054 // Exhaust primitive checks 4055 var type = typeof a; 4056 if (type !== 'function' && type !== 'object' && typeof b != 'object') return false; 4057 return deepEq(a, b, aStack, bStack); 4058 }; 4059 4060 // Internal recursive comparison function for `isEqual`. 4061 deepEq = function(a, b, aStack, bStack) { 4062 // Unwrap any wrapped objects. 4063 if (a instanceof _) a = a._wrapped; 4064 if (b instanceof _) b = b._wrapped; 4065 // Compare `[[Class]]` names. 4066 var className = toString.call(a); 4067 if (className !== toString.call(b)) return false; 4068 switch (className) { 4069 // Strings, numbers, regular expressions, dates, and booleans are compared by value. 4070 case '[object RegExp]': 4071 // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') 4072 case '[object String]': 4073 // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is 4074 // equivalent to `new String("5")`. 4075 return '' + a === '' + b; 4076 case '[object Number]': 4077 // `NaN`s are equivalent, but non-reflexive. 4078 // Object(NaN) is equivalent to NaN. 4079 if (+a !== +a) return +b !== +b; 4080 // An `egal` comparison is performed for other numeric values. 4081 return +a === 0 ? 1 / +a === 1 / b : +a === +b; 4082 case '[object Date]': 4083 case '[object Boolean]': 4084 // Coerce dates and booleans to numeric primitive values. Dates are compared by their 4085 // millisecond representations. Note that invalid dates with millisecond representations 4086 // of `NaN` are not equivalent. 4087 return +a === +b; 4088 case '[object Symbol]': 4089 return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b); 4090 } 4091 4092 var areArrays = className === '[object Array]'; 4093 if (!areArrays) { 4094 if (typeof a != 'object' || typeof b != 'object') return false;
vendor: 5,070 bytes, lines 4095-4239
4095 4096 // Objects with different constructors are not equivalent, but `Object`s or `Array`s 4097 // from different frames are. 4098 var aCtor = a.constructor, bCtor = b.constructor; 4099 if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor && 4100 _.isFunction(bCtor) && bCtor instanceof bCtor) 4101 && ('constructor' in a && 'constructor' in b)) { 4102 return false; 4103 } 4104 } 4105 // Assume equality for cyclic structures. The algorithm for detecting cyclic 4106 // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. 4107 4108 // Initializing stack of traversed objects. 4109 // It's done here since we only need them for objects and arrays comparison. 4110 aStack = aStack || []; 4111 bStack = bStack || []; 4112 var length = aStack.length; 4113 while (length--) { 4114 // Linear search. Performance is inversely proportional to the number of 4115 // unique nested structures. 4116 if (aStack[length] === a) return bStack[length] === b; 4117 } 4118 4119 // Add the first object to the stack of traversed objects. 4120 aStack.push(a); 4121 bStack.push(b); 4122 4123 // Recursively compare objects and arrays. 4124 if (areArrays) { 4125 // Compare array lengths to determine if a deep comparison is necessary. 4126 length = a.length; 4127 if (length !== b.length) return false; 4128 // Deep compare the contents, ignoring non-numeric properties. 4129 while (length--) { 4130 if (!eq(a[length], b[length], aStack, bStack)) return false; 4131 } 4132 } else { 4133 // Deep compare objects. 4134 var keys = _.keys(a), key; 4135 length = keys.length; 4136 // Ensure that both objects contain the same number of properties before comparing deep equality. 4137 if (_.keys(b).length !== length) return false; 4138 while (length--) { 4139 // Deep compare each member 4140 key = keys[length]; 4141 if (!(has(b, key) && eq(a[key], b[key], aStack, bStack))) return false; 4142 } 4143 } 4144 // Remove the first object from the stack of traversed objects. 4145 aStack.pop(); 4146 bStack.pop(); 4147 return true; 4148 }; 4149 4150 // Perform a deep comparison to check if two objects are equal. 4151 _.isEqual = function(a, b) { 4152 return eq(a, b); 4153 }; 4154 4155 // Is a given array, string, or object empty? 4156 // An "empty" object has no enumerable own-properties. 4157 _.isEmpty = function(obj) { 4158 if (obj == null) return true; 4159 if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0; 4160 return _.keys(obj).length === 0; 4161 }; 4162 4163 // Is a given value a DOM element? 4164 _.isElement = function(obj) { 4165 return !!(obj && obj.nodeType === 1); 4166 }; 4167 4168 // Is a given value an array? 4169 // Delegates to ECMA5's native Array.isArray 4170 _.isArray = nativeIsArray || function(obj) { 4171 return toString.call(obj) === '[object Array]'; 4172 }; 4173 4174 // Is a given variable an object? 4175 _.isObject = function(obj) { 4176 var type = typeof obj; 4177 return type === 'function' || type === 'object' && !!obj; 4178 }; 4179 4180 // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError, isMap, isWeakMap, isSet, isWeakSet. 4181 _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error', 'Symbol', 'Map', 'WeakMap', 'Set', 'WeakSet'], function(name) { 4182 _['is' + name] = function(obj) { 4183 return toString.call(obj) === '[object ' + name + ']'; 4184 }; 4185 }); 4186 4187 // Define a fallback version of the method in browsers (ahem, IE < 9), where 4188 // there isn't any inspectable "Arguments" type. 4189 if (!_.isArguments(arguments)) { 4190 _.isArguments = function(obj) { 4191 return has(obj, 'callee'); 4192 }; 4193 } 4194 4195 // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8, 4196 // IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236). 4197 var nodelist = root.document && root.document.childNodes; 4198 if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') { 4199 _.isFunction = function(obj) { 4200 return typeof obj == 'function' || false; 4201 }; 4202 } 4203 4204 // Is a given object a finite number? 4205 _.isFinite = function(obj) { 4206 return !_.isSymbol(obj) && isFinite(obj) && !isNaN(parseFloat(obj)); 4207 }; 4208 4209 // Is the given value `NaN`? 4210 _.isNaN = function(obj) { 4211 return _.isNumber(obj) && isNaN(obj); 4212 }; 4213 4214 // Is a given value a boolean? 4215 _.isBoolean = function(obj) { 4216 return obj === true || obj === false || toString.call(obj) === '[object Boolean]'; 4217 }; 4218 4219 // Is a given value equal to null? 4220 _.isNull = function(obj) { 4221 return obj === null; 4222 }; 4223 4224 // Is a given variable undefined? 4225 _.isUndefined = function(obj) { 4226 return obj === void 0; 4227 }; 4228 4229 // Shortcut function for checking if an object has a given property directly 4230 // on itself (in other words, not on a prototype). 4231 _.has = function(obj, path) { 4232 if (!_.isArray(path)) { 4233 return has(obj, path); 4234 } 4235 var length = path.length; 4236 for (var i = 0; i < length; i++) { 4237 var key = path[i]; 4238 if (obj == null || !hasOwnProperty.call(obj, key)) { 4239 return false;
4240 } 4241 obj = obj[key]; 4242 } 4243 return !!length; 4244 }; 4245 4246 // Utility Functions 4247 // ----------------- 4248 4249 // Run Underscore.js in *noConflict* mode, returning the `_` variable to its 4250 // previous owner. Returns a reference to the Underscore object. 4251 _.noConflict = function() { 4252 root._ = previousUnderscore; 4253 return this; 4254 }; 4255 4256 // Keep the identity function around for default iteratees. 4257 _.identity = function(value) { 4258 return value; 4259 }; 4260 4261 // Predicate-generating functions. Often useful outside of Underscore. 4262 _.constant = function(value) { 4263 return function() { 4264 return value; 4265 }; 4266 }; 4267 4268 _.noop = function(){}; 4269 4270 // Creates a function that, when passed an object, will traverse that object’s 4271 // properties down the given `path`, specified as an array of keys or indexes. 4272 _.property = function(path) { 4273 if (!_.isArray(path)) { 4274 return shallowProperty(path); 4275 } 4276 return function(obj) { 4277 return deepGet(obj, path); 4278 }; 4279 }; 4280 4281 // Generates a function for a given object that returns a given property. 4282 _.propertyOf = function(obj) { 4283 if (obj == null) { 4284 return function(){}; 4285 } 4286 return function(path) { 4287 return !_.isArray(path) ? obj[path] : deepGet(obj, path); 4288 }; 4289 }; 4290 4291 // Returns a predicate for checking whether an object has a given set of 4292 // `key:value` pairs. 4293 _.matcher = _.matches = function(attrs) { 4294 attrs = _.extendOwn({}, attrs); 4295 return function(obj) { 4296 return _.isMatch(obj, attrs); 4297 }; 4298 }; 4299 4300 // Run a function **n** times. 4301 _.times = function(n, iteratee, context) { 4302 var accum = Array(Math.max(0, n)); 4303 iteratee = optimizeCb(iteratee, context, 1); 4304 for (var i = 0; i < n; i++) accum[i] = iteratee(i); 4305 return accum; 4306 }; 4307 4308 // Return a random integer between min and max (inclusive). 4309 _.random = function(min, max) { 4310 if (max == null) { 4311 max = min; 4312 min = 0; 4313 } 4314 return min + Math.floor(Math.random() * (max - min + 1)); 4315 }; 4316 4317 // A (possibly faster) way to get the current timestamp as an integer. 4318 _.now = Date.now || function() { 4319 return new Date().getTime(); 4320 }; 4321 4322 // List of HTML entities for escaping. 4323 var escapeMap = { 4324 '&': '&', 4325 '<': '<', 4326 '>': '>', 4327 '"': '"', 4328 "'": ''', 4329 '`': '`' 4330 }; 4331 var unescapeMap = _.invert(escapeMap); 4332 4333 // Functions for escaping and unescaping strings to/from HTML interpolation. 4334 var createEscaper = function(map) { 4335 var escaper = function(match) { 4336 return map[match]; 4337 }; 4338 // Regexes for identifying a key that needs to be escaped. 4339 var source = '(?:' + _.keys(map).join('|') + ')'; 4340 var testRegexp = RegExp(source); 4341 var replaceRegexp = RegExp(source, 'g'); 4342 return function(string) { 4343 string = string == null ? '' : '' + string; 4344 return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; 4345 }; 4346 }; 4347 _.escape = createEscaper(escapeMap); 4348 _.unescape = createEscaper(unescapeMap); 4349 4350 // Traverses the children of `obj` along `path`. If a child is a function, it 4351 // is invoked with its parent as context. Returns the value of the final 4352 // child, or `fallback` if any child is undefined. 4353 _.result = function(obj, path, fallback) { 4354 if (!_.isArray(path)) path = [path]; 4355 var length = path.length; 4356 if (!length) { 4357 return _.isFunction(fallback) ? fallback.call(obj) : fallback; 4358 } 4359 for (var i = 0; i < length; i++) { 4360 var prop = obj == null ? void 0 : obj[path[i]]; 4361 if (prop === void 0) { 4362 prop = fallback; 4363 i = length; // Ensure we don't continue iterating. 4364 } 4365 obj = _.isFunction(prop) ? prop.call(obj) : prop; 4366 } 4367 return obj; 4368 }; 4369 4370 // Generate a unique integer id (unique within the entire client session). 4371 // Useful for temporary DOM ids. 4372 var idCounter = 0; 4373 _.uniqueId = function(prefix) { 4374 var id = ++idCounter + ''; 4375 return prefix ? prefix + id : id; 4376 }; 4377 4378 // By default, Underscore uses ERB-style template delimiters, change the 4379 // following template settings to use alternative delimiters. 4380 _.templateSettings = { 4381 evaluate: /<%([\s\S]+?)%>/g, 4382 interpolate: /<%=([\s\S]+?)%>/g, 4383 escape: /<%-([\s\S]+?)%>/g 4384 }; 4385 4386 // When customizing `templateSettings`, if you don't want to define an 4387 // interpolation, evaluation or escaping regex, we need one that is 4388 // guaranteed not to match. 4389 var noMatch = /(.)^/; 4390 4391 // Certain characters need to be escaped so that they can be put into a 4392 // string literal. 4393 var escapes = { 4394 "'": "'", 4395 '\\': '\\', 4396 '\r': 'r', 4397 '\n': 'n', 4398 '\u2028': 'u2028', 4399 '\u2029': 'u2029' 4400 }; 4401 4402 var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g; 4403 4404 var escapeChar = function(match) { 4405 return '\\' + escapes[match]; 4406 }; 4407 4408 // JavaScript micro-templating, similar to John Resig's implementation. 4409 // Underscore templating handles arbitrary delimiters, preserves whitespace, 4410 // and correctly escapes quotes within interpolated code. 4411 // NB: `oldSettings` only exists for backwards compatibility. 4412 _.template = function(text, settings, oldSettings) { 4413 if (!settings && oldSettings) settings = oldSettings; 4414 settings = _.defaults({}, settings, _.templateSettings); 4415 4416 // Combine delimiters into one regular expression via alternation. 4417 var matcher = RegExp([
vendor: 4,707 bytes, lines 4418-4553
4418 (settings.escape || noMatch).source, 4419 (settings.interpolate || noMatch).source, 4420 (settings.evaluate || noMatch).source 4421 ].join('|') + '|$', 'g'); 4422 4423 // Compile the template source, escaping string literals appropriately. 4424 var index = 0; 4425 var source = "__p+='"; 4426 text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { 4427 source += text.slice(index, offset).replace(escapeRegExp, escapeChar); 4428 index = offset + match.length; 4429 4430 if (escape) { 4431 source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; 4432 } else if (interpolate) { 4433 source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; 4434 } else if (evaluate) { 4435 source += "';\n" + evaluate + "\n__p+='"; 4436 } 4437 4438 // Adobe VMs need the match returned to produce the correct offset. 4439 return match; 4440 }); 4441 source += "';\n"; 4442 4443 // If a variable is not specified, place data values in local scope. 4444 if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; 4445 4446 source = "var __t,__p='',__j=Array.prototype.join," + 4447 "print=function(){__p+=__j.call(arguments,'');};\n" + 4448 source + 'return __p;\n'; 4449 4450 var render; 4451 try { 4452 render = new Function(settings.variable || 'obj', '_', source); 4453 } catch (e) { 4454 e.source = source; 4455 throw e; 4456 } 4457 4458 var template = function(data) { 4459 return render.call(this, data, _); 4460 }; 4461 4462 // Provide the compiled source as a convenience for precompilation. 4463 var argument = settings.variable || 'obj'; 4464 template.source = 'function(' + argument + '){\n' + source + '}'; 4465 4466 return template; 4467 }; 4468 4469 // Add a "chain" function. Start chaining a wrapped Underscore object. 4470 _.chain = function(obj) { 4471 var instance = _(obj); 4472 instance._chain = true; 4473 return instance; 4474 }; 4475 4476 // OOP 4477 // --------------- 4478 // If Underscore is called as a function, it returns a wrapped object that 4479 // can be used OO-style. This wrapper holds altered versions of all the 4480 // underscore functions. Wrapped objects may be chained. 4481 4482 // Helper function to continue chaining intermediate results. 4483 var chainResult = function(instance, obj) { 4484 return instance._chain ? _(obj).chain() : obj; 4485 }; 4486 4487 // Add your own custom functions to the Underscore object. 4488 _.mixin = function(obj) { 4489 _.each(_.functions(obj), function(name) { 4490 var func = _[name] = obj[name]; 4491 _.prototype[name] = function() { 4492 var args = [this._wrapped]; 4493 push.apply(args, arguments); 4494 return chainResult(this, func.apply(_, args)); 4495 }; 4496 }); 4497 return _; 4498 }; 4499 4500 // Add all of the Underscore functions to the wrapper object. 4501 _.mixin(_); 4502 4503 // Add all mutator Array functions to the wrapper. 4504 _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { 4505 var method = ArrayProto[name]; 4506 _.prototype[name] = function() { 4507 var obj = this._wrapped; 4508 method.apply(obj, arguments); 4509 if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0]; 4510 return chainResult(this, obj); 4511 }; 4512 }); 4513 4514 // Add all accessor Array functions to the wrapper. 4515 _.each(['concat', 'join', 'slice'], function(name) { 4516 var method = ArrayProto[name]; 4517 _.prototype[name] = function() { 4518 return chainResult(this, method.apply(this._wrapped, arguments)); 4519 }; 4520 }); 4521 4522 // Extracts the result from a wrapped and chained object. 4523 _.prototype.value = function() { 4524 return this._wrapped; 4525 }; 4526 4527 // Provide unwrapping proxy for some methods used in engine operations 4528 // such as arithmetic and JSON stringification. 4529 _.prototype.valueOf = _.prototype.toJSON = _.prototype.value; 4530 4531 _.prototype.toString = function() { 4532 return String(this._wrapped); 4533 }; 4534 4535 // AMD registration happens at the end for compatibility with AMD loaders 4536 // that may not enforce next-turn semantics on modules. Even though general 4537 // practice for AMD registration is to be anonymous, underscore registers 4538 // as a named module because, like jQuery, it is a base library that is 4539 // popular enough to be bundled in a third party lib, but not be part of 4540 // an AMD load request. Those cases could generate an error when an 4541 // anonymous define() is called outside of a loader request. 4542 if (true) { 4543 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { 4544 return _; 4545 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 4546 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 4547 } 4548}()); 4549 4550/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(36), __webpack_require__(37)(module))) 4551 4552/***/ }), 4553/* 36 */
4554/***/ (function(module, exports) { 4555 4556var g; 4557 4558// This works in non-strict mode 4559g = (function() { 4560 return this; 4561})(); 4562 4563try { 4564 // This works if eval is allowed (see CSP) 4565 g = g || Function("return this")() || (1,eval)("this"); 4566} catch(e) { 4567 // This works if the window reference is available 4568 if(typeof window === "object") 4569 g = window; 4570} 4571 4572// g can still be undefined, but nothing to do about it... 4573// We return undefined, instead of nothing here, so it's 4574// easier to handle this case. if(!global) { ...} 4575 4576module.exports = g; 4577 4578 4579/***/ }), 4580/* 37 */ 4581/***/ (function(module, exports) { 4582 4583module.exports = function(module) { 4584 if(!module.webpackPolyfill) { 4585 module.deprecate = function() {}; 4586 module.paths = []; 4587 // module.parent = undefined by default 4588 if(!module.children) module.children = []; 4589 Object.defineProperty(module, "loaded", { 4590 enumerable: true, 4591 get: function() { 4592 return module.l; 4593 } 4594 }); 4595 Object.defineProperty(module, "id", { 4596 enumerable: true, 4597 get: function() { 4598 return module.i; 4599 } 4600 }); 4601 module.webpackPolyfill = 1; 4602 } 4603 return module; 4604}; 4605 4606 4607/***/ }), 4608/* 38 */ 4609/***/ (function(module, exports, __webpack_require__) { 4610 4611"use strict"; 4612 4613var __extends = (this && this.__extends) || (function () { 4614 var extendStatics = Object.setPrototypeOf || 4615 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 4616 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 4617 return function (d, b) { 4618 extendStatics(d, b); 4619 function __() { this.constructor = d; } 4620 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4621 }; 4622})(); 4623Object.defineProperty(exports, "__esModule", { value: true }); 4624var Component = Coveo.Component; 4625var Initialization = Coveo.Initialization; 4626var ComponentOptions = Coveo.ComponentOptions; 4627var $$ = Coveo.$$; 4628var SVGCaretCollapsedIcon = __webpack_require__(39); 4629var SVGCaretUnCollapsedIcon = __webpack_require__(40); 4630var CustomFacetsToggle = /** @class */ (function (_super) { 4631 __extends(CustomFacetsToggle, _super); 4632 function CustomFacetsToggle(element, options, bindings) { 4633 var _this = _super.call(this, element, CustomFacetsToggle.ID, bindings) || this; 4634 _this.element = element; 4635 _this.options = options; 4636 _this.bindings = bindings; 4637 _this.componentCaret = null; 4638 _this.options = ComponentOptions.initComponentOptions(element, CustomFacetsToggle, options); 4639 // State Events 4640 var changeTabEvtName = _this.getStateEventName(Coveo.QueryStateModel.eventTypes.changeOne + Coveo.QueryStateModel.attributesEnum.t); 4641 _this.bind.onRootElement(changeTabEvtName, function (args) { return _this.handleTabStateChanged(args); }); 4642 Coveo.$$(_this.root).on(Coveo.QueryEvents.querySuccess, function (e, args) { return _this.handleQuerySuccess(e, args); }); 4643 Coveo.$$(_this.root).on(Coveo.QueryEvents.noResults, function (e, args) { return _this.handleNoResults(e, args); }); 4644 _this.render(); 4645 return _this; 4646 } 4647 CustomFacetsToggle.prototype.render = function () { 4648 var _this = this; 4649 var rootContainer = $$('div', { 'class': 'coveo__main__facet__toggle__mobile' }); 4650 var componentLabel = $$('div', { 'class': 'coveo__main__facets__label' }, Coveo.l('CustomFacetsToggle_label')); 4651 this.componentCaret = $$('div', { 'class': 'coveo__main__facets__caret' }, SVGCaretUnCollapsedIcon); 4652 rootContainer.on('click', function () { 4653 _this.handleClick(); 4654 }); 4655 $$(rootContainer).append(componentLabel.el); 4656 $$(rootContainer).append(this.componentCaret.el); 4657 $$(this.element).append(rootContainer.el); 4658 }; 4659 CustomFacetsToggle.prototype.getStateEventName = function (event) { 4660 return Coveo.QueryStateModel.ID + ':' + event; 4661 }; 4662 CustomFacetsToggle.prototype.handleClick = function () { 4663 this.toggleFacets(); 4664 }; 4665 ; 4666 CustomFacetsToggle.prototype.disable = function () { 4667 this.element.classList.add('disabled'); 4668 $$(this.element).hide(); 4669 _super.prototype.disable.call(this); 4670 }; 4671 CustomFacetsToggle.prototype.enable = function () { 4672 this.element.classList.remove('disabled'); 4673 $$(this.element).show(); 4674 _super.prototype.enable.call(this); 4675 }; 4676 CustomFacetsToggle.prototype.toggleFacets = function () { 4677 var facetColumn = $$(this.root).find('.coveo-facet-column'); 4678 if (facetColumn.style.display === 'none') { 4679 $$(facetColumn).show(); 4680 facetColumn.style.display = 'inline-block'; 4681 this.componentCaret.setHtml(SVGCaretUnCollapsedIcon); 4682 } 4683 else { 4684 $$(facetColumn).hide(); 4685 this.componentCaret.setHtml(SVGCaretCollapsedIcon); 4686 } 4687 }; 4688 CustomFacetsToggle.prototype.handleTabStateChanged = function (args) { 4689 // Custom Facet section collapse 4690 if (window.matchMedia('(max-width: 480px)').matches) { 4691 var facetColumn = $$(this.root).find('.coveo-facet-column'); 4692 $$(facetColumn).hide(); 4693 this.componentCaret.setHtml(SVGCaretCollapsedIcon); 4694 } 4695 }; 4696 CustomFacetsToggle.prototype.handleQuerySuccess = function (e, args) { 4697 if (args.results.totalCount > 0) { 4698 this.enable(); 4699 } 4700 }; 4701 CustomFacetsToggle.prototype.handleNoResults = function (e, args) { 4702 this.disable(); 4703 }; 4704 CustomFacetsToggle.ID = 'CustomFacetsToggle'; 4705 CustomFacetsToggle.options = {}; 4706 return CustomFacetsToggle; 4707}(Component)); 4708exports.CustomFacetsToggle = CustomFacetsToggle; 4709Initialization.registerAutoCreateComponent(CustomFacetsToggle); 4710 4711 4712/***/ }), 4713/* 39 */
4714/***/ (function(module, exports) { 4715 4716module.exports = "<svg viewBox=\"0 0 44 42\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><title>74143A0F-7B9D-424E-AF9A-B0D6F1EF92B9</title><desc>Created with sketchtool.</desc><defs><filter x=\"-15.5%\" y=\"-116.0%\" width=\"130.9%\" height=\"332.0%\" filterUnits=\"objectBoundingBox\" id=\"filter-1\"><feOffset dx=\"0\" dy=\"10\" in=\"SourceAlpha\" result=\"shadowOffsetOuter1\"></feOffset><feGaussianBlur stdDeviation=\"10\" in=\"shadowOffsetOuter1\" result=\"shadowBlurOuter1\"></feGaussianBlur><feColorMatrix values=\"0 0 0 0 0.137254902 0 0 0 0 0.137254902 0 0 0 0 0.137254902 0 0 0 0.08 0\" type=\"matrix\" in=\"shadowBlurOuter1\" result=\"shadowMatrixOuter1\"></feColorMatrix><feMerge><feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode><feMergeNode in=\"SourceGraphic\"></feMergeNode></feMerge></filter></defs><g id=\"UI-Mobile\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" stroke-linecap=\"square\"><g id=\"Filtering-All-(M)\" transform=\"translate(-322.000000, -480.000000)\" stroke=\"#111111\"><g id=\"Drop\" filter=\"url(#filter-1)\" transform=\"translate(0.000000, 466.000000)\"><g id=\"small-down\" transform=\"translate(344.000000, 25.000000) rotate(-180.000000) translate(-344.000000, -25.000000) translate(328.000000, 9.000000)\"><g id=\"Group\" transform=\"translate(16.000000, 16.000000) scale(1, -1) translate(-16.000000, -16.000000) translate(10.000000, 13.000000)\"><polyline id=\"Shape\" points=\"12 0 6 6 0 0\"></polyline></g></g></g></g></g></svg>" 4717 4718/***/ }), 4719/* 40 */ 4720/***/ (function(module, exports) { 4721 4722module.exports = "<svg viewBox=\"0 0 44 42\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><title>15D95B03-62EF-4489-B6C3-B7F6299B80D5</title><desc>Created with sketchtool.</desc><defs><filter x=\"-15.5%\" y=\"-116.0%\" width=\"130.9%\" height=\"332.0%\" filterUnits=\"objectBoundingBox\" id=\"filter-1\"><feOffset dx=\"0\" dy=\"10\" in=\"SourceAlpha\" result=\"shadowOffsetOuter1\"></feOffset><feGaussianBlur stdDeviation=\"10\" in=\"shadowOffsetOuter1\" result=\"shadowBlurOuter1\"></feGaussianBlur><feColorMatrix values=\"0 0 0 0 0.137254902 0 0 0 0 0.137254902 0 0 0 0 0.137254902 0 0 0 0.08 0\" type=\"matrix\" in=\"shadowBlurOuter1\" result=\"shadowMatrixOuter1\"></feColorMatrix><feMerge><feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode><feMergeNode in=\"SourceGraphic\"></feMergeNode></feMerge></filter></defs><g id=\"UI-Mobile\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" stroke-linecap=\"square\"><g id=\"Filter-extended-(M)\" transform=\"translate(-322.000000, -480.000000)\" stroke=\"#111111\"><g id=\"Filters-\" transform=\"translate(0.000000, 466.000000)\"><g id=\"Drop\" filter=\"url(#filter-1)\"><g id=\"small-down\" transform=\"translate(328.000000, 9.000000)\"><g id=\"Group\" transform=\"translate(16.000000, 16.000000) scale(1, -1) translate(-16.000000, -16.000000) translate(10.000000, 13.000000)\"><polyline id=\"Shape\" points=\"12 0 6 6 0 0\"></polyline></g></g></g></g></g></g></svg>" 4723 4724/***/ }), 4725/* 41 */ 4726/***/ (function(module, exports, __webpack_require__) { 4727 4728"use strict"; 4729 4730var __extends = (this && this.__extends) || (function () { 4731 var extendStatics = Object.setPrototypeOf || 4732 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 4733 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 4734 return function (d, b) { 4735 extendStatics(d, b); 4736 function __() { this.constructor = d; } 4737 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4738 }; 4739})(); 4740Object.defineProperty(exports, "__esModule", { value: true }); 4741var Component = Coveo.Component; 4742var Initialization = Coveo.Initialization; 4743var ComponentOptions = Coveo.ComponentOptions; 4744var $$ = Coveo.$$; 4745var CustomResultLayout = /** @class */ (function (_super) { 4746 __extends(CustomResultLayout, _super); 4747 function CustomResultLayout(element, options, bindings) { 4748 var _this = _super.call(this, element, CustomResultLayout.ID, bindings) || this; 4749 _this.element = element; 4750 _this.options = options; 4751 _this.bindings = bindings; 4752 _this.componentCaret = null; 4753 _this.options = ComponentOptions.initComponentOptions(element, CustomResultLayout, options); 4754 _this.render(); 4755 return _this; 4756 } 4757 CustomResultLayout.prototype.render = function () { 4758 var rootContainer = $$('div', { 'class': 'coveo__result__layout__title' }, Coveo.l('CustomResultLayout_label')); 4759 $$(this.element).append(rootContainer.el); 4760 }; 4761 CustomResultLayout.ID = 'CustomResultLayout'; 4762 CustomResultLayout.options = {}; 4763 return CustomResultLayout; 4764}(Component)); 4765exports.CustomResultLayout = CustomResultLayout; 4766Initialization.registerAutoCreateComponent(CustomResultLayout); 4767 4768
4769/***/ }), 4770/* 42 */ 4771/***/ (function(module, exports, __webpack_require__) { 4772 4773"use strict"; 4774 4775var __extends = (this && this.__extends) || (function () { 4776 var extendStatics = Object.setPrototypeOf || 4777 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 4778 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 4779 return function (d, b) { 4780 extendStatics(d, b); 4781 function __() { this.constructor = d; } 4782 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4783 }; 4784})(); 4785Object.defineProperty(exports, "__esModule", { value: true }); 4786var Component = Coveo.Component; 4787var Initialization = Coveo.Initialization; 4788var ComponentOptions = Coveo.ComponentOptions; 4789var $$ = Coveo.$$; 4790var CustomTealiumLink = /** @class */ (function (_super) { 4791 __extends(CustomTealiumLink, _super); 4792 function CustomTealiumLink(element, options, bindings) { 4793 var _this = _super.call(this, element, CustomTealiumLink.ID, bindings) || this; 4794 _this.element = element; 4795 _this.options = options; 4796 _this.bindings = bindings; 4797 _this.options = ComponentOptions.initComponentOptions(element, CustomTealiumLink, options); 4798 // Analytics Events 4799 $$(_this.root).on(Coveo.AnalyticsEvents.changeAnalyticsCustomData, function (e, data) { return _this.handleChangeAnalyticsCustomData(e, data); }); 4800 return _this; 4801 } 4802 CustomTealiumLink.prototype.handleChangeAnalyticsCustomData = function (evt, args) { 4803 // let tealiumDataObject = {}; 4804 // console.log('args.type',args.type); 4805 // console.log('args.actionCause',args.actionCause); 4806 // console.log('args.actionType',args.actionType); 4807 // // Set tealiumDataObject properties 4808 // switch (args.type) { 4809 // case 'SearchEvent': 4810 // // actionCause = searchboxSubmit, interfaceChange, facetSelect 4811 // break; 4812 // case 'ClickEvent': 4813 // // actionCause = documentQuickview 4814 // break; 4815 // case 'CustomEvent': 4816 // // actionCause = pagerResize, pagerNumber 4817 // break; 4818 // default: 4819 // break; 4820 // } 4821 // utag.link(tealiumDataObject); 4822 }; 4823 CustomTealiumLink.ID = 'CustomTealiumLink'; 4824 CustomTealiumLink.options = {}; 4825 return CustomTealiumLink; 4826}(Component)); 4827exports.CustomTealiumLink = CustomTealiumLink; 4828Initialization.registerAutoCreateComponent(CustomTealiumLink); 4829 4830 4831/***/ }), 4832/* 43 */ 4833/***/ (function(module, exports, __webpack_require__) { 4834 4835"use strict"; 4836 4837var __extends = (this && this.__extends) || (function () { 4838 var extendStatics = Object.setPrototypeOf || 4839 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 4840 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 4841 return function (d, b) { 4842 extendStatics(d, b); 4843 function __() { this.constructor = d; } 4844 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4845 }; 4846})(); 4847Object.defineProperty(exports, "__esModule", { value: true }); 4848var Component = Coveo.Component; 4849var Initialization = Coveo.Initialization; 4850var CustomTooltips = /** @class */ (function (_super) { 4851 __extends(CustomTooltips, _super); 4852 function CustomTooltips(element, bindings) { 4853 var _this = _super.call(this, element, CustomTooltips.ID, bindings) || this; 4854 Coveo.$$(_this.root).on(Coveo.ResultListEvents.newResultsDisplayed, function (e, data) { return _this.handleTooltips(e, data); }); 4855 return _this; 4856 } 4857 CustomTooltips.prototype.handleTooltips = function (e, data) { 4858 var listLayoutButton = document.getElementsByClassName('coveo-result-layout-selector coveo-accessible-button')[0]; 4859 var cardLayoutButton = document.getElementsByClassName('coveo-result-layout-selector coveo-accessible-button')[1]; 4860 var searchButton = document.getElementsByClassName('CoveoSearchButton')[0]; 4861 var tooltipList = document.createElement('span'); 4862 tooltipList.className = 'tooltip_list_layout'; 4863 tooltipList.innerHTML = Coveo.l('CustomTooltips_list'); 4864 listLayoutButton.appendChild(tooltipList); 4865 var tooltipCard = document.createElement('span'); 4866 tooltipCard.className = 'tooltip_card_layout'; 4867 tooltipCard.innerHTML = Coveo.l('CustomTooltips_card'); 4868 cardLayoutButton.appendChild(tooltipCard); 4869 var tooltipSearch = document.createElement('span'); 4870 tooltipSearch.className = 'tooltip_search'; 4871 tooltipSearch.innerHTML = Coveo.l('CustomTooltips_search'); 4872 searchButton.appendChild(tooltipSearch); 4873 }; 4874 CustomTooltips.ID = 'CustomTooltips'; 4875 return CustomTooltips; 4876}(Component)); 4877exports.CustomTooltips = CustomTooltips; 4878Initialization.registerAutoCreateComponent(CustomTooltips); 4879 4880 4881/***/ }), 4882/* 44 */ 4883/***/ (function(module, exports, __webpack_require__) { 4884 4885"use strict"; 4886 4887var __extends = (this && this.__extends) || (function () { 4888 var extendStatics = Object.setPrototypeOf || 4889 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 4890 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 4891 return function (d, b) { 4892 extendStatics(d, b); 4893 function __() { this.constructor = d; } 4894 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4895 }; 4896})(); 4897Object.defineProperty(exports, "__esModule", { value: true }); 4898var Component = Coveo.Component; 4899var ComponentOptions = Coveo.ComponentOptions; 4900var $$ = Coveo.$$; 4901var CustomBrightcoveVideoPlayer = /** @class */ (function (_super) { 4902 __extends(CustomBrightcoveVideoPlayer, _super); 4903 function CustomBrightcoveVideoPlayer(element, options, bindings, result) { 4904 var _this = _super.call(this, element, CustomBrightcoveVideoPlayer.ID, bindings) || this; 4905 _this.element = element; 4906 _this.options = options; 4907 _this.bindings = bindings; 4908 _this.result = result; 4909 _this.options = ComponentOptions.initComponentOptions(element, CustomBrightcoveVideoPlayer, options); 4910 var isBrightcoveVideo = _this.result.raw['moto_video_brightcoveaccountid'] && _this.result.raw['moto_video_brightcoveplayerid'] && _this.result.raw['moto_video_brightcovevideoid']; 4911 if (isBrightcoveVideo) { 4912 _this.nukeExistingPlayers(); 4913 _this.buildPlayer(); 4914 } 4915 return _this; 4916 } 4917 CustomBrightcoveVideoPlayer.prototype.nukeExistingPlayers = function () { 4918 if (!(typeof videojs === "undefined")) { 4919 _.each(videojs['players'], function (player) {
4920 player.dispose(); 4921 }); 4922 } 4923 }; 4924 CustomBrightcoveVideoPlayer.prototype.videoCallback = function () { 4925 console.log('$$$$$$$$ Brightcove Video onload callback $$$$$$$$$'); 4926 }; 4927 CustomBrightcoveVideoPlayer.prototype.buildPlayer = function () { 4928 var thevideojs = $$('video-js', { 4929 id: 'customBrightcoveVideoPlayer', 4930 className: 'video-js', 4931 'data-video-id': this.result.raw.moto_video_brightcovevideoid, 4932 'data-account': this.result.raw.moto_video_brightcoveaccountid, 4933 'data-player': this.result.raw.moto_video_brightcoveplayerid, 4934 style: 'width:100%;height:100%', 4935 'data-application-id': '', 4936 'data-embed': 'default', 4937 controls: 'true', 4938 autoplay: 'true', 4939 onload: this.videoCallback() 4940 }); 4941 this.element.appendChild(thevideojs.el); 4942 var myroot = this.root; 4943 var myresultraw = this.result.raw; 4944 $.when(jQuery.getScript("https://players.brightcove.net/" + this.result.raw.moto_video_brightcoveaccountid + "/" + this.result.raw.moto_video_brightcoveplayerid + "_default/index.min.js")).then(function (data) { 4945 videojs['getPlayer']('customBrightcoveVideoPlayer').on('loadstart', function () { 4946 console.log('$$$$$$$ Brightcove Video Event loadstart callback $$$$$$$$'); 4947 Coveo.logCustomEvent(myroot, { name: 'videoLoadStart', type: 'Brightcove' }, myresultraw); 4948 }); 4949 videojs['getPlayer']('customBrightcoveVideoPlayer').on('playing', function () { 4950 console.log('$$$$$$$ Brightcove Video Event playing callback $$$$$$$$'); 4951 Coveo.logCustomEvent(myroot, { name: 'videoPlay', type: 'Brightcove' }, myresultraw); 4952 }); 4953 videojs['getPlayer']('customBrightcoveVideoPlayer').on('ended', function () { 4954 Coveo.logCustomEvent(myroot, { name: 'videoComplete', type: 'Brightcove' }, myresultraw); 4955 }); 4956 videojs['getPlayer']('customBrightcoveVideoPlayer').on('pause', function () { 4957 Coveo.logCustomEvent(myroot, { name: 'videoPause', type: 'Brightcove' }, myresultraw); 4958 }); 4959 }, function (e) { 4960 console.error('$$$$$$$ Brightcove Video Event FAIL callback $$$$$$$$'); 4961 }); 4962 }; 4963 CustomBrightcoveVideoPlayer.ID = 'CustomBrightcoveVideoPlayer'; 4964 CustomBrightcoveVideoPlayer.options = { 4965 solvedCaption: ComponentOptions.buildStringOption() 4966 }; 4967 return CustomBrightcoveVideoPlayer; 4968}(Component)); 4969exports.CustomBrightcoveVideoPlayer = CustomBrightcoveVideoPlayer; 4970Coveo.Initialization.registerAutoCreateComponent(CustomBrightcoveVideoPlayer); 4971 4972 4973/***/ }), 4974/* 45 */ 4975/***/ (function(module, exports, __webpack_require__) { 4976 4977"use strict"; 4978 4979var __extends = (this && this.__extends) || (function () { 4980 var extendStatics = Object.setPrototypeOf || 4981 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 4982 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 4983 return function (d, b) { 4984 extendStatics(d, b); 4985 function __() { this.constructor = d; } 4986 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4987 }; 4988})(); 4989Object.defineProperty(exports, "__esModule", { value: true }); 4990var Component = Coveo.Component; 4991var Initialization = Coveo.Initialization; 4992var ComponentOptions = Coveo.ComponentOptions; 4993var KEYBOARD = Coveo.KEYBOARD; 4994var CustomOmniboxSuggestionsDefaultTemplate_1 = __webpack_require__(6); 4995var CustomOmniboxSuggestionsCache_1 = __webpack_require__(46); 4996var MotorolaCDN_1 = __webpack_require__(0); 4997/** 4998 * This component is meant to be used inside a result template to display the URI or path to access a result. 4999 */ 5000var CustomOmniboxSuggestions = /** @class */ (function (_super) { 5001 __extends(CustomOmniboxSuggestions, _super); 5002 /** 5003 * Create a new OmniboxCustomSuggestions 5004 * @param element 5005 * @param options 5006 * @param bindings 5007 * @param result 5008 */ 5009 function CustomOmniboxSuggestions(element, options, bindings, result) { 5010 var _this = _super.call(this, element, CustomOmniboxSuggestions.ID, bindings) || this; 5011 _this.element = element; 5012 _this.options = options; 5013 _this.result = result; 5014 _this.searchSuggestionsCache = new CustomOmniboxSuggestionsCache_1.CustomOmniboxSuggestionsCache(); 5015 _this.currentSelectedIndex = 0; 5016 _this.currentScrollPageIndex = 0; 5017 _this.lastCustomSuggestionsQueryText = ''; 5018 _this.lastCustomSuggestionsQueryNbResults = 0; 5019 _this.options = ComponentOptions.initComponentOptions(element, CustomOmniboxSuggestions, options); 5020 _this.bind.onRootElement(Coveo.QueryEvents.newQuery, function (args) { return _this.handleCustomSuggestionRedirect(args); }); 5021 _this.bind.onRootElement(Coveo.OmniboxEvents.populateOmniboxSuggestions, function (args) { return _this.handlePopulateOmniboxSuggestions(args); }); 5022 _this.bind.onRootElement(Coveo.InitializationEvents.afterComponentsInitialization, function () { return _this.handleAfterComponentInitialization(); }); 5023 _this.bind.onRootElement(Coveo.ResultListEvents.newResultsDisplayed, function (args) { return _this.handlePopulateOmnibox(args); }); 5024 _this.renderHtml(); 5025 return _this; 5026 } 5027 CustomOmniboxSuggestions.prototype.renderHtml = function () { 5028 var inlineStyling = Coveo.$$('style', {}, ".suggestions-section-separator.base-suggestion::before{display:block;content:\"" + Coveo.l(this.options.baseSuggestionsSectionLabel) + "\";}\n .suggestions-section-separator.custom-suggestion::before{display:block;content:\"" + Coveo.l(this.options.customSuggestionsSectionLabel) + "\";}"); 5029 Coveo.$$(this.element).append(inlineStyling.el); 5030 }; 5031 CustomOmniboxSuggestions.prototype.handlePopulateOmnibox = function (args) { }; 5032 CustomOmniboxSuggestions.prototype.handleAfterComponentInitialization = function () { 5033 var _this = this; 5034 var omniboxInput = document.querySelector('.CoveoOmnibox input'); 5035 if (omniboxInput) { 5036 Coveo.$$(omniboxInput).on('keyup', function (e) { _this.handleScrollThroughCustomSuggestions(e); }); 5037 } 5038 }; 5039 CustomOmniboxSuggestions.prototype.handleScrollThroughCustomSuggestions = function (evt) { 5040 var _this = this; 5041 var currentSelectedHTML = document.querySelector('.magic-box-suggestion.coveo-omnibox-selectable.coveo-omnibox-selected'); 5042 var selectedElements = document.getElementsByClassName('magic-box-suggestion'); 5043 if (currentSelectedHTML) { 5044 var i_1 = 0; 5045 _.each(selectedElements, function (selectedElement) { 5046 if (selectedElement.className == currentSelectedHTML.className) { 5047 _this.currentSelectedIndex = i_1; 5048 return; 5049 } 5050 i_1++; 5051 }); 5052 } 5053 var wrapper = document.querySelector('.magic-box-suggestions.magic-box-hasSuggestion'); 5054 if (wrapper) { 5055 if (evt.keyCode == KEYBOARD.DOWN_ARROW) { 5056 if (this.currentSelectedIndex == selectedElements.length) { 5057 this.currentScrollPageIndex = 0; 5058 } 5059 if (this.currentScrollPageIndex > 11) { 5060 this.currentScrollPageIndex--; 5061 wrapper.scrollTop = (this.currentSelectedIndex - 11) * (23.75); 5062 } 5063 this.currentScrollPageIndex++; 5064 } 5065 else if (evt.keyCode == KEYBOARD.UP_ARROW) { 5066 if (this.currentSelectedIndex == selectedElements.length) { 5067 this.currentScrollPageIndex = 11; 5068 wrapper.scrollTop = selectedElements.length * (23.75); 5069 } 5070 if (this.currentScrollPageIndex == 1) { 5071 this.currentScrollPageIndex++; 5072 wrapper.scrollTop = this.currentSelectedIndex * (23.75); 5073 } 5074 this.currentScrollPageIndex--; 5075 } 5076 } 5077 }; 5078 CustomOmniboxSuggestions.prototype.handleCustomSuggestionRedirect = function (args) { 5079 var searchbox = document.querySelector('.CoveoSearchbox .magic-box-input'); 5080 if(searchbox.textContent != "" && this.firstSuggestion && searchbox.textContent !==this.firstSuggestion.title ){ 5081 $('#nav-search').attr('searched_on_same',true); 5082 }else { 5083 $('#nav-search').attr('searched_on_same',false); 5084 } 5085 if (searchbox.textContent != "" && 5086 this.firstSuggestion // && 5087 ) { 5088 args.cancel = true; 5089 this.onSearchSuggestionsSelection(this.firstSuggestion); 5090 } 5091 }; 5092 CustomOmniboxSuggestions.prototype.addCustomSuggestionsScroll = function () { 5093 var suggestionWrapperEl = document.querySelector('.magic-box-suggestions'); 5094 suggestionWrapperEl && (suggestionWrapperEl.style.maxHeight = '289px'); 5095 suggestionWrapperEl && (suggestionWrapperEl.style.overflowY = 'scroll'); 5096 }; 5097 CustomOmniboxSuggestions.prototype.removeCustomSuggestionsScroll = function () { 5098 var suggestionWrapperEl = document.querySelector('.magic-box-suggestions'); 5099 suggestionWrapperEl && (suggestionWrapperEl.style.maxHeight = 'auto'); 5100 suggestionWrapperEl && (suggestionWrapperEl.style.overflowY = 'hidden'); 5101 }; 5102 CustomOmniboxSuggestions.prototype.handlePopulateOmniboxSuggestions = function (args) { 5103 args.suggestions.push(this.getCustomSuggestions(args.suggestions.pop(), args.omnibox)); 5104 }; 5105 CustomOmniboxSuggestions.prototype.addSectionLabel = function (suggestions, label, className) { 5106 if (suggestions.length > 0 && suggestions[0].text != label && Coveo.l(label)) { 5107 // let baseCustomSuggestionsSeparator: Coveo.Suggestion = {}; 5108 // baseCustomSuggestionsSeparator.text = Coveo.l(label); 5109 // baseCustomSuggestionsSeparator.html = `<div class="suggestions-section-separator ${className} ${(label ? '' : 'disabled')}">${Coveo.l(label)}</div>`; 5110 // baseCustomSuggestionsSeparator.onSelect = () => this.onSuggestionsSectionLabelSelection(); 5111 // suggestions.unshift(baseCustomSuggestionsSeparator); 5112 suggestions[0].html = suggestions[0].html.replace(className, "suggestions-section-separator " + className + " " + (label ? '' : 'disabled')); 5113 } 5114 return suggestions; 5115 }; 5116 CustomOmniboxSuggestions.prototype.formatBaseSuggestions = function (baseSuggestions) { 5117 var _this = this; 5118 _.each(baseSuggestions, function (baseSuggestion) { 5119 if (baseSuggestion.html.indexOf('class="base-suggestion"') < 0 && baseSuggestion.text != Coveo.l(_this.options.baseSuggestionsSectionLabel)) { 5120 baseSuggestion.html = "<span class=\"base-suggestion\">" + baseSuggestion.html + "</span>"; 5121 } 5122 }); 5123 return baseSuggestions; 5124 }; 5125 CustomOmniboxSuggestions.prototype.getCustomSuggestions = function (baseSuggestions, omnibox) { 5126 var _this = this; 5127 return new Promise(function (resolve) { 5128 var shouldGetBaseSuggestions = false;
5129 var shouldGetCustomSuggestions = false; 5130 // input threshold + number of suggestions 5131 if (omnibox.getText().length >= _this.options.inputThresholdBaseSuggestions) { 5132 shouldGetBaseSuggestions = true; 5133 } 5134 if (_this.options.numberOfCustomSuggestions > 0 && omnibox.getText().length >= _this.options.inputThresholdCustomSuggestions) { 5135 shouldGetCustomSuggestions = true; 5136 } 5137 // if (!this.isValidSuggestionsPromise(baseSuggestions)) { 5138 // resolve([]); 5139 // return; 5140 // } 5141 if (!shouldGetBaseSuggestions && !shouldGetCustomSuggestions) { 5142 resolve([]); 5143 return; 5144 } 5145 // Not clean, but necessary to check if baseSuggestions is still a promise or is returned 5146 if (baseSuggestions._result) { 5147 var text = omnibox.getText(); 5148 var mergedSuggestions_1 = []; 5149 if (shouldGetBaseSuggestions) { 5150 var suggestions = baseSuggestions; 5151 suggestions = _this.formatBaseSuggestions(suggestions); 5152 suggestions = _this.addSectionLabel(suggestions, _this.options.baseSuggestionsSectionLabel, 'base-suggestion'); 5153 mergedSuggestions_1 = mergedSuggestions_1.concat(suggestions); 5154 // mergedSuggestions = mergedSuggestions.concat(<Coveo.Suggestion[]>baseSuggestions); 5155 } 5156 if (shouldGetCustomSuggestions) { 5157 _this.searchCustomSuggestions(text).then(function (searchCustomSuggestions) { 5158 searchCustomSuggestions = _this.addSectionLabel(searchCustomSuggestions, _this.options.customSuggestionsSectionLabel, 'custom-suggestion'); 5159 mergedSuggestions_1 = mergedSuggestions_1.concat(searchCustomSuggestions); 5160 if (mergedSuggestions_1.length == 0) { 5161 _this.removeCustomSuggestionsScroll(); 5162 resolve(mergedSuggestions_1 || []); 5163 } 5164 else { 5165 if (mergedSuggestions_1.length > 12) { 5166 _this.addCustomSuggestionsScroll(); 5167 } 5168 else { 5169 _this.removeCustomSuggestionsScroll(); 5170 } 5171 resolve(mergedSuggestions_1 || []); 5172 } 5173 }); 5174 } 5175 else { 5176 if (mergedSuggestions_1.length == 0) { 5177 _this.removeCustomSuggestionsScroll(); 5178 resolve(mergedSuggestions_1 || []); 5179 } 5180 else { 5181 if (mergedSuggestions_1.length > 12) { 5182 _this.addCustomSuggestionsScroll(); 5183 } 5184 else { 5185 _this.removeCustomSuggestionsScroll(); 5186 } 5187 resolve(mergedSuggestions_1 || []); 5188 } 5189 } 5190 } 5191 else { 5192 baseSuggestions.then(function (suggestions) { 5193 var text = omnibox.getText(); 5194 var mergedSuggestions = []; 5195 if (shouldGetBaseSuggestions) { 5196 suggestions = _this.formatBaseSuggestions(suggestions); 5197 suggestions = _this.addSectionLabel(suggestions, _this.options.baseSuggestionsSectionLabel, 'base-suggestion'); 5198 mergedSuggestions = mergedSuggestions.concat(suggestions); 5199 } 5200 if (shouldGetCustomSuggestions) { 5201 _this.searchCustomSuggestions(text).then(function (searchCustomSuggestions) { 5202 searchCustomSuggestions = _this.addSectionLabel(searchCustomSuggestions, _this.options.customSuggestionsSectionLabel, 'custom-suggestion'); 5203 mergedSuggestions = mergedSuggestions.concat(searchCustomSuggestions); 5204 if (mergedSuggestions.length == 0) { 5205 _this.removeCustomSuggestionsScroll(); 5206 resolve(mergedSuggestions || []); 5207 } 5208 else { 5209 if (mergedSuggestions.length > 12) { 5210 _this.addCustomSuggestionsScroll(); 5211 } 5212 else { 5213 _this.removeCustomSuggestionsScroll(); 5214 } 5215 resolve(mergedSuggestions || []); 5216 } 5217 }); 5218 } 5219 else { 5220 if (mergedSuggestions.length == 0) { 5221 _this.removeCustomSuggestionsScroll(); 5222 resolve(mergedSuggestions || []); 5223 } 5224 else { 5225 if (mergedSuggestions.length > 12) { 5226 _this.addCustomSuggestionsScroll(); 5227 } 5228 else { 5229 _this.removeCustomSuggestionsScroll(); 5230 } 5231 resolve(mergedSuggestions || []); 5232 } 5233 } 5234 }); 5235 } 5236 }); 5237 }; 5238 CustomOmniboxSuggestions.prototype.searchCustomSuggestions = function (text) { 5239 var _this = this; 5240 return new Promise(function (resolve) { 5241 try { 5242 if (_this.triggerNextCustomSuggestionsQuery(text)) { 5243 var suggestions = _this.searchSuggestionsCache.getSuggestions(text, function () { return _this.queryForCustomSuggestions(text); }); 5244 suggestions.then(function (queryResults) { 5245 _this.lastCustomSuggestionsQueryText = text; 5246 _this.lastCustomSuggestionsQueryNbResults = queryResults.results.length; 5247 if (queryResults.results.length > 0) { 5248 _this.firstSuggestion = queryResults.results[0]; 5249 var omniboxedSuggestions_1 = new Array(); 5250 _.each(queryResults.results.map(function (result, index) { return _this.mapQueryResult(result, queryResults.results.length - index, text); }), function (suggestion) { 5251 omniboxedSuggestions_1.push(suggestion); 5252 }); 5253 resolve(omniboxedSuggestions_1); 5254 } 5255 else { 5256 resolve([]); 5257 } 5258 }); 5259 } 5260 else { 5261 resolve([]); 5262 } 5263 } 5264 catch (error) { 5265 _this.logger.error(error); 5266 resolve([]); 5267 } 5268 }); 5269 }; 5270 // to-do refactor these conditions... 5271 CustomOmniboxSuggestions.prototype.triggerNextCustomSuggestionsQuery = function (text) { 5272 // if (text.indexOf('"') > -1) { 5273 // return false;
5274 // } else if (this.lastCustomSuggestionsQueryText == '') { 5275 // return true; 5276 // } else if (text.indexOf(this.lastCustomSuggestionsQueryText) > -1 && this.lastCustomSuggestionsQueryNbResults == 0) { 5277 // return false; 5278 // } else { 5279 // return true; 5280 // } 5281 if (text.indexOf('"') > -1) { 5282 return false; 5283 } 5284 else if (this.lastCustomSuggestionsQueryText == '') { 5285 return true; 5286 } 5287 else { 5288 return true; 5289 } 5290 }; 5291 CustomOmniboxSuggestions.prototype.queryForCustomSuggestions = function (text) { 5292 var query = this.buildCustomSuggestionsQuery(text); 5293 var customSuggestions = this.queryController.getEndpoint().search(query); 5294 this.handleSearchSuggestionsAnalytics(query, customSuggestions); 5295 return customSuggestions; 5296 }; 5297 CustomOmniboxSuggestions.prototype.buildCustomSuggestionsQuery = function (q) { 5298 q = q.trim(); 5299 return { 5300 q: q, 5301 cq: this.options.expression, 5302 firstResult: 0, 5303 numberOfResults: this.options.numberOfCustomSuggestions, 5304 searchHub: this.getBindings().componentOptionsModel.get(Coveo.ComponentOptionsModel.attributesEnum.searchHub), 5305 context: this.options.context, 5306 debug: false, 5307 enableQuerySyntax: false, 5308 //wildcards: true, 5309 sortCriteria: 'relevancy', 5310 fieldsToInclude: ['source', 'uriHash', 'title', 'filetype', 'source', 'motoproductthumbnail', 'motopagethumbnail', 'motoimages', 'moto_dc_title', 'moto_dc_title_display', 'moto_page_thumbnail_path','shopresulthumbnail'] 5311 }; 5312 }; 5313 CustomOmniboxSuggestions.prototype.handleSearchSuggestionsAnalytics = function (query, searchPromise) { 5314 if (this.getBindings().usageAnalytics) { 5315 this.getBindings().usageAnalytics.logSearchEvent({ 5316 name: 'omniboxCustomSuggestionsSearch', 5317 type: 'omnibox' 5318 }, { 5319 q: query 5320 }); 5321 Coveo.$$(this.queryController.element).trigger(Coveo.QueryEvents.duringQuery, this.buildDataToSendDuringQuery(query, searchPromise)); 5322 // this.removeResultListAnimation(); 5323 // this.removeFacetAnimation(); 5324 } 5325 }; 5326 CustomOmniboxSuggestions.prototype.buildDataToSendDuringQuery = function (query, searchPromise) { 5327 var searchAsYouType = Coveo.get(document.querySelector('.CoveoSearchbox'), 'Searchbox').options.enableSearchAsYouType; 5328 var qb = new Coveo.QueryBuilder(); 5329 qb.expression.add(query.q); 5330 return { 5331 queryBuilder: qb, 5332 query: query, 5333 searchAsYouType: searchAsYouType || false, 5334 promise: searchPromise 5335 }; 5336 }; 5337 CustomOmniboxSuggestions.prototype.removeFacetAnimation = function () { 5338 var facetElements = document.getElementsByClassName('CoveoFacet'); 5339 _.each(facetElements, function (facetElement) { 5340 Coveo.$$(facetElement).removeClass('coveo-facet-fade'); 5341 }); 5342 var facetRangeElements = document.getElementsByClassName('CoveoFacetRange'); 5343 _.each(facetRangeElements, function (facetRangeElement) { 5344 Coveo.$$(facetRangeElement).removeClass('coveo-facet-fade'); 5345 }); 5346 }; 5347 CustomOmniboxSuggestions.prototype.removeResultListAnimation = function () { 5348 var resultListContainer = document.getElementsByClassName('coveo-result-list-container'); 5349 if (resultListContainer) { 5350 Coveo.$$(resultListContainer[0]).removeClass('coveo-fade-out'); 5351 } 5352 }; 5353 CustomOmniboxSuggestions.prototype.mapQueryResult = function (result, index, text) { 5354 var _this = this; 5355 return { 5356 html: this.buildSearchSuggestionsTemplate(result, text), 5357 text: result.title, 5358 onSelect: function () { return _this.onSearchSuggestionsSelection(result); }, 5359 index: index 5360 }; 5361 }; 5362 CustomOmniboxSuggestions.prototype.formatResultTitle = function (result) { 5363 if (['MSI.com DAM', 'MSI.com'].indexOf(result.raw.source) > -1) { 5364 if (result.raw.moto_dc_title_display) { 5365 var titleObj = JSON.parse(result.raw.moto_dc_title_display); 5366 var localeTitle = titleObj[this.options.context['locale'].toString()] != undefined ? titleObj[this.options.context['locale'].toString()] : titleObj['en_xw']; 5367 if (localeTitle && localeTitle.trim()) { 5368 result.title.toLowerCase() == 'untitled' || localeTitle.length > 0 ? result.title = localeTitle : console.log(result.title); 5369 result.titleHighlights = []; 5370 } 5371 } 5372 } 5373 return result; 5374 }; 5375 CustomOmniboxSuggestions.prototype.formatResultThumbnail = function (result) { 5376 var thumbnailUrl = ''; 5377 var thumbnailClass = ''; 5378 let motoproductthumbnail=result.raw.shopresulthumbnail || result.raw.motoproductthumbnail; 5379 if (motoproductthumbnail) {
5380 var productThumbnailUrl =motoproductthumbnail; 5381 var productThumbnailClass = 'product-thumbnail'; 5382 if (result.raw.motoimages) { 5383 var imgUrls = result.raw.motoimages.split(';'); 5384 for (var i in imgUrls) { 5385 if (imgUrls[i].indexOf('500-500.jpg') > 0) { 5386 productThumbnailUrl = imgUrls[i]; 5387 break; 5388 } 5389 } 5390 } 5391 if (productThumbnailUrl == 'https://shop.motorolasolutions.com') { 5392 productThumbnailUrl = MotorolaCDN_1.MotorolaCDN.cdnUrl + '/vendor/motorola/image/blankProductThumbnail.svg'; 5393 productThumbnailClass = 'coveo_default_icon'; 5394 } 5395 if (productThumbnailUrl == '') { 5396 productThumbnailUrl = MotorolaCDN_1.MotorolaCDN.cdnUrl + '/vendor/motorola/image/html-icon.svg'; 5397 productThumbnailClass = 'coveo_default_icon'; 5398 } 5399 thumbnailUrl = productThumbnailUrl; 5400 thumbnailClass = productThumbnailClass; 5401 } 5402 else if (result.raw.filetype) { 5403 switch (result.raw.filetype) { 5404 case 'html': 5405 var pageThumbnailUrl = ''; 5406 var pageThumbnailClass = 'page-thumbnail'; 5407 var pageImages = []; 5408 if (result.raw.motoimages) { 5409 pageImages = result.raw.motoimages.split(';'); 5410 } 5411 var source = result.raw.source; 5412 if (pageImages && pageImages.length > 0) { 5413 pageThumbnailUrl = pageImages[0]; 5414 if (source == 'NA Blog') { 5415 if (pageThumbnailUrl.indexOf('https://') < 0) { 5416 pageThumbnailUrl = 'https://blog.motorolasolutions.com' + pageThumbnailUrl; 5417 } 5418 if (pageThumbnailUrl.indexOf('linkedin-24.svg') > 0) { 5419 pageThumbnailUrl = ''; 5420 } 5421 } 5422 else if (source == 'EMEA Blog') { 5423 if (pageThumbnailUrl.indexOf('motorolasolutions.com') < 0) { 5424 pageThumbnailUrl = 'https://www.motorolasolutions.com' + pageThumbnailUrl; 5425 } 5426 } 5427 } 5428 if (source == 'MSI.com') { 5429 if (result.raw.moto_page_thumbnail_path) { 5430 pageThumbnailUrl = result.raw.moto_page_thumbnail_path; 5431 } 5432 else if (result.raw.motopagethumbnail != 'https://www.motorolasolutions.com') { 5433 pageThumbnailUrl = result.raw.motopagethumbnail; 5434 } 5435 } 5436 if (pageThumbnailUrl == '') { 5437 pageThumbnailUrl = MotorolaCDN_1.MotorolaCDN.cdnUrl + '/vendor/motorola/image/html-icon.svg'; 5438 pageThumbnailClass = 'coveo_default_icon'; 5439 } 5440 thumbnailUrl = pageThumbnailUrl; 5441 thumbnailClass = pageThumbnailClass; 5442 break; 5443 case 'pdf': 5444 thumbnailUrl = MotorolaCDN_1.MotorolaCDN.cdnUrl + '/vendor/motorola/image/pdf-icon.svg'; 5445 thumbnailClass = 'coveo_default_icon'; 5446 break; 5447 case 'image': 5448 thumbnailUrl = MotorolaCDN_1.MotorolaCDN.cdnUrl + '/vendor/motorola/image/image-icon.svg'; 5449 thumbnailClass = 'coveo_default_icon'; 5450 break; 5451 case 'zip': 5452 thumbnailUrl = MotorolaCDN_1.MotorolaCDN.cdnUrl + '/vendor/motorola/image/zip-icon.svg'; 5453 thumbnailClass = 'coveo_default_icon'; 5454 break; 5455 case 'exe': 5456 thumbnailUrl = MotorolaCDN_1.MotorolaCDN.cdnUrl + '/vendor/motorola/image/exe-icon.svg'; 5457 thumbnailClass = 'coveo_default_icon'; 5458 break; 5459 case 'xls': 5460 thumbnailUrl = MotorolaCDN_1.MotorolaCDN.cdnUrl + '/vendor/motorola/image/excel-icon.svg'; 5461 thumbnailClass = 'coveo_default_icon'; 5462 break; 5463 case 'ppt': 5464 thumbnailUrl = MotorolaCDN_1.MotorolaCDN.cdnUrl + '/vendor/motorola/image/pptx-icon.svg'; 5465 thumbnailClass = 'coveo_default_icon'; 5466 break; 5467 case 'item': 5468 thumbnailUrl = MotorolaCDN_1.MotorolaCDN.cdnUrl + '/vendor/motorola/image/html-icon.svg'; 5469 thumbnailClass = 'coveo_default_icon'; 5470 break; 5471 default: 5472 break; 5473 } 5474 } 5475 result.raw.thumbnailUrl = thumbnailUrl; 5476 result.raw.thumbnailClass = thumbnailClass; 5477 return result; 5478 }; 5479 CustomOmniboxSuggestions.prototype.buildSearchSuggestionsTemplate = function (result, text) { 5480 var omniboxtemplate = this.options.customOmniboxResultTemplate; 5481 result = this.formatResultTitle(result); 5482 result.raw.highlightedTitle = this.getHighlightedTitle(text, result.title); 5483 result = this.formatResultThumbnail(result); 5484 if (omniboxtemplate) { 5485 return omniboxtemplate.instantiateToString(result); 5486 } 5487 else { 5488 var template = _.template(CustomOmniboxSuggestionsDefaultTemplate_1.CustomOmniboxSuggestionsDefaultTemplate.instantiateToString2()); 5489 return template(result); 5490 } 5491 }; 5492 CustomOmniboxSuggestions.prototype.getHighlightedTitle = function (text, resultTitle) { 5493 var title = this.replace(resultTitle, text); 5494 return title; 5495 }; 5496 CustomOmniboxSuggestions.prototype.replace = function (str, find) { 5497 if (str.length == 0 || find.length == 0) { 5498 return str; 5499 } 5500 var terms = find.replace(/\s+/g, '|'); 5501 if (terms == '') { 5502 return str; 5503 } 5504 var replacement = "<span class=\"coveo-omnibox-hightlight\">$&</span>"; 5505 return str.replace(new RegExp(terms, 'ig'), replacement); 5506 }; 5507 CustomOmniboxSuggestions.openLink = function (uri) { 5508 if(!$('#nav-search').attr('searched_on_same')){ 5509 if(uri.indexOf("/content/dam/msi/")!=-1){ 5510 window.open(uri, '_blank'); 5511 } 5512 else{ 5513 window.location.href = uri; 5514 } 5515 } 5516 $('#nav-search').attr('searched_on_same',''); 5517 }; 5518 ; 5519 CustomOmniboxSuggestions.openLinkInNewWindow = function (uri) { 5520 window.open(uri, '_blank'); 5521 }; 5522 ; 5523 CustomOmniboxSuggestions.prototype.onSearchSuggestionsSelection = function (result) { 5524 var executeOnlyOnce = _.once(function () { return CustomOmniboxSuggestions.logClickEvent(result); }); 5525 executeOnlyOnce(); 5526 if (this.options.openNewTab) { 5527 CustomOmniboxSuggestions.openLinkInNewWindow(result.clickUri); 5528 } 5529 else { 5530 CustomOmniboxSuggestions.openLink(result.clickUri); 5531 } 5532 }; 5533 CustomOmniboxSuggestions.prototype.onSuggestionsSectionLabelSelection = function () { 5534 };
5535 CustomOmniboxSuggestions.prototype.isValidSuggestionsPromise = function (suggestions) { 5536 var isValid = true; 5537 _.each(suggestions._result, function (suggestion) { 5538 if (!suggestion) { 5539 isValid = false; 5540 } 5541 }); 5542 return isValid; 5543 }; 5544 CustomOmniboxSuggestions.ID = 'CustomOmniboxSuggestions'; 5545 CustomOmniboxSuggestions.options = { 5546 expression: Coveo.ComponentOptions.buildStringOption({ 5547 defaultValue: '@uri' 5548 }), 5549 inputThresholdBaseSuggestions: Coveo.ComponentOptions.buildNumberOption({ 5550 defaultValue: 1 5551 }), 5552 inputThresholdCustomSuggestions: Coveo.ComponentOptions.buildNumberOption({ 5553 defaultValue: 3 5554 }), 5555 numberOfCustomSuggestions: Coveo.ComponentOptions.buildNumberOption({ 5556 defaultValue: 50 5557 }), 5558 customOmniboxResultTemplate: ComponentOptions.buildTemplateOption({ 5559 idAttr: 'data-template-id' 5560 }), 5561 baseSuggestionsSectionLabel: ComponentOptions.buildStringOption({ 5562 defaultValue: 'Query Suggestions' 5563 }), 5564 customSuggestionsSectionLabel: ComponentOptions.buildStringOption({ 5565 defaultValue: 'Suggested Results' 5566 }), 5567 context: ComponentOptions.buildJsonObjectOption({ 5568 defaultValue: {} 5569 }), 5570 openNewTab: ComponentOptions.buildBooleanOption({ 5571 defaultValue: false 5572 }) 5573 }; 5574 CustomOmniboxSuggestions.logClickEvent = _.debounce(function (queryResult) { 5575 var rootElement = Coveo.get(document.getElementById('coveostandalonesearchbox'), 'SearchInterface').element; 5576 var clickEventCause = { name: 'documentOpenCustomSuggestionsSearch', type: 'document' }; 5577 Coveo.logClickEvent(rootElement, clickEventCause, {}, queryResult); 5578 Coveo.Defer.flush(); 5579 }, 2500, true); 5580 return CustomOmniboxSuggestions; 5581}(Component)); 5582exports.CustomOmniboxSuggestions = CustomOmniboxSuggestions; 5583Initialization.registerAutoCreateComponent(CustomOmniboxSuggestions); 5584 5585 5586/***/ }), 5587/* 46 */ 5588/***/ (function(module, exports, __webpack_require__) { 5589 5590"use strict"; 5591 5592Object.defineProperty(exports, "__esModule", { value: true }); 5593var CustomOmniboxSuggestionsCache = /** @class */ (function () { 5594 function CustomOmniboxSuggestionsCache() { 5595 this.cache = {}; 5596 } 5597 CustomOmniboxSuggestionsCache.prototype.getSuggestions = function (hash, suggestionsFetcher) { 5598 var _this = this; 5599 if (this.cache[hash] != null) { 5600 return this.cache[hash]; 5601 } 5602 var promise = suggestionsFetcher(); 5603 this.cache[hash] = promise; 5604 promise.catch(function () { return _this.clearSuggestion(hash); }); 5605 return this.cache[hash]; 5606 }; 5607 CustomOmniboxSuggestionsCache.prototype.clearSuggestion = function (hash) { 5608 if (!hash || hash.length === 0) { 5609 return null; 5610 } 5611 delete this.cache[hash]; 5612 }; 5613 return CustomOmniboxSuggestionsCache; 5614}()); 5615exports.CustomOmniboxSuggestionsCache = CustomOmniboxSuggestionsCache; 5616 5617 5618/***/ }), 5619/* 47 */ 5620/***/ (function(module, exports, __webpack_require__) { 5621 5622"use strict"; 5623 5624var __extends = (this && this.__extends) || (function () { 5625 var extendStatics = Object.setPrototypeOf || 5626 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5627 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 5628 return function (d, b) { 5629 extendStatics(d, b); 5630 function __() { this.constructor = d; } 5631 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 5632 }; 5633})(); 5634Object.defineProperty(exports, "__esModule", { value: true }); 5635var Component = Coveo.Component; 5636var Initialization = Coveo.Initialization; 5637var ComponentOptions = Coveo.ComponentOptions; 5638var $$ = Coveo.$$; 5639var CustomEvents_1 = __webpack_require__(1); 5640var SVGSimpleRemove = __webpack_require__(48); 5641var CustomHideStandaloneSearchbox = /** @class */ (function (_super) { 5642 __extends(CustomHideStandaloneSearchbox, _super); 5643 function CustomHideStandaloneSearchbox(element, options, bindings) { 5644 var _this = _super.call(this, element, CustomHideStandaloneSearchbox.ID, bindings) || this; 5645 _this.element = element; 5646 _this.options = options; 5647 _this.bindings = bindings; 5648 _this.componentCaret = null; 5649 _this.options = ComponentOptions.initComponentOptions(element, CustomHideStandaloneSearchbox, options); 5650 _this.bind.onRootElement(Coveo.StandaloneSearchInterfaceEvents.beforeRedirect, function (data) { return _this.handleBeforeRedirect(data); }); 5651 _this.render(); 5652 return _this; 5653 } 5654 CustomHideStandaloneSearchbox.prototype.render = function () { 5655 var _this = this; 5656 var rootContainer = $$('div', { 'class': 'custom-hide-standalone-search-box' });
5657 var componentIcon = $$('div', { 'class': 'coveo-custom-icon' }, SVGSimpleRemove); 5658 rootContainer.on('click', function () { 5659 _this.handleClick(); 5660 }); 5661 $$(rootContainer).append(componentIcon.el); 5662 $$(this.element).append(rootContainer.el); 5663 }; 5664 CustomHideStandaloneSearchbox.prototype.handleBeforeRedirect = function (data) { 5665 Coveo.$$(this.root).trigger(CustomEvents_1.CustomEvents.motorolaCoveoStandaloneSearchBoxBeforeRedirect); 5666 }; 5667 CustomHideStandaloneSearchbox.prototype.handleClick = function () { 5668 Coveo.$$(this.root).trigger(CustomEvents_1.CustomEvents.motorolaHideCoveoStandaloneSearchBox); 5669 }; 5670 ; 5671 CustomHideStandaloneSearchbox.prototype.disable = function () { 5672 this.element.classList.add('disabled'); 5673 $$(this.element).hide(); 5674 _super.prototype.disable.call(this); 5675 }; 5676 CustomHideStandaloneSearchbox.prototype.enable = function () { 5677 this.element.classList.remove('disabled'); 5678 $$(this.element).show(); 5679 _super.prototype.enable.call(this); 5680 }; 5681 CustomHideStandaloneSearchbox.ID = 'CustomHideStandaloneSearchbox'; 5682 CustomHideStandaloneSearchbox.options = {}; 5683 return CustomHideStandaloneSearchbox; 5684}(Component)); 5685exports.CustomHideStandaloneSearchbox = CustomHideStandaloneSearchbox; 5686Initialization.registerAutoCreateComponent(CustomHideStandaloneSearchbox); 5687 5688 5689/***/ }), 5690/* 48 */ 5691/***/ (function(module, exports) { 5692 5693module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 22 22\"><g fill=\"none\" fill-rule=\"evenodd\" stroke=\"#FFF\" stroke-linecap=\"square\" stroke-width=\"2\" opacity=\".988\"><path d=\"M19.85 1.65l-18.2 18.2M19.85 19.85L1.65 1.65\"></path></g></svg>" 5694 5695/***/ }), 5696/* 49 */ 5697/***/ (function(module, exports, __webpack_require__) { 5698 5699"use strict"; 5700 5701var __extends = (this && this.__extends) || (function () { 5702 var extendStatics = Object.setPrototypeOf || 5703 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5704 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 5705 return function (d, b) { 5706 extendStatics(d, b); 5707 function __() { this.constructor = d; } 5708 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 5709 }; 5710})(); 5711Object.defineProperty(exports, "__esModule", { value: true }); 5712var Component = Coveo.Component; 5713var Initialization = Coveo.Initialization; 5714var ComponentOptions = Coveo.ComponentOptions; 5715var $$ = Coveo.$$; 5716var CustomEvents_1 = __webpack_require__(1); 5717var SVGRightArrow = __webpack_require__(50); 5718var CustomProductCatalogSearch = /** @class */ (function (_super) { 5719 __extends(CustomProductCatalogSearch, _super); 5720 function CustomProductCatalogSearch(element, options, bindings) { 5721 var _this = _super.call(this, element, CustomProductCatalogSearch.ID, bindings) || this; 5722 _this.element = element; 5723 _this.options = options; 5724 _this.bindings = bindings; 5725 _this.componentCaret = null; 5726 _this.options = ComponentOptions.initComponentOptions(element, CustomProductCatalogSearch, options); 5727 _this.render(); 5728 return _this; 5729 // debugger; 5730 } 5731 CustomProductCatalogSearch.prototype.render = function () { 5732 var _this = this; 5733 var rootContainer = $$('div', { 'class': 'custom-hide-standalone-search-box' }); 5734 var componentLabel = $$('div', { 'class': 'coveo-custom-label' }, Coveo.l('Standalone_SearchBox_productCatalogSearch')); 5735 var componentIcon = $$('div', { 'class': 'coveo-custom-icon' }, SVGRightArrow); 5736 rootContainer.on('click', function () { 5737 _this.handleClick(); 5738 }); 5739 if (!this.options.enable) { 5740 this.disable(); 5741 } 5742 $$(componentLabel).append(componentIcon.el); 5743 $$(rootContainer).append(componentLabel.el); 5744 $$(this.element).append(rootContainer.el); 5745 }; 5746 CustomProductCatalogSearch.openLink = function (uri) { 5747 window.location.href = uri; 5748 }; 5749 ; 5750 CustomProductCatalogSearch.openLinkInNewWindow = function (uri) { 5751 window.open(uri, '_blank'); 5752 }; 5753 ; 5754 CustomProductCatalogSearch.prototype.handleClick = function () { 5755 var executeOnlyOnce = _.once(function () { return CustomProductCatalogSearch.log
5755CustomEvent(); }); 5756 executeOnlyOnce(); 5757 var searchInterface = Coveo.get(this.root, 'SearchInterface'); 5758 var omnibox = Coveo.get(document.querySelector("#" + searchInterface.element.id + " .CoveoOmnibox"), 'Omnibox'); 5759 var query = omnibox.getText(); 5760 if (this.options.openNewTab) { 5761 Coveo.$$(this.root).trigger(CustomEvents_1.CustomEvents.motorolaProductCatalogSearch); 5762 CustomProductCatalogSearch.openLinkInNewWindow($('#nav-search').attr('data-pcatsearchpath')+"?q=" + query); 5763 } 5764 else { 5765 Coveo.$$(this.root).trigger(CustomEvents_1.CustomEvents.motorolaProductCatalogSearch); 5766 CustomProductCatalogSearch.openLink($('#nav-search').attr('data-pcatsearchpath')+"?q=" + query); 5767 } 5768 }; 5769 ; 5770 CustomProductCatalogSearch.prototype.disable = function () { 5771 this.element.classList.add('disabled'); 5772 $$(this.element).hide(); 5773 _super.prototype.disable.call(this); 5774 }; 5775 CustomProductCatalogSearch.prototype.enable = function () { 5776 this.element.classList.remove('disabled'); 5777 $$(this.element).show(); 5778 _super.prototype.enable.call(this); 5779 }; 5780 CustomProductCatalogSearch.prototype.hide = function () { 5781 }; 5782 CustomProductCatalogSearch.ID = 'CustomProductCatalogSearch'; 5783 CustomProductCatalogSearch.options = { 5784 enable: Coveo.ComponentOptions.buildBooleanOption({ 5785 defaultValue: true 5786 }), 5787 openNewTab: ComponentOptions.buildBooleanOption({ 5788 defaultValue: false 5789 }) 5790 }; 5791 CustomProductCatalogSearch.logCustomEvent = _.debounce(function () { 5792 var rootElement = Coveo.get(document.getElementById('coveostandalonesearchbox'), 'SearchInterface').element; 5793 var customEventCause = { name: 'openProductCatalogSearch', type: 'omnibox' }; 5794 Coveo.logCustomEvent(rootElement, customEventCause, {}); 5795 Coveo.Defer.flush(); 5796 }, 2500, true); 5797 return CustomProductCatalogSearch; 5798}(Component)); 5799exports.CustomProductCatalogSearch = CustomProductCatalogSearch; 5800Initialization.registerAutoCreateComponent(CustomProductCatalogSearch); 5801 5802 5803/***/ }), 5804/* 50 */ 5805/***/ (function(module, exports) { 5806 5807module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 8 8\"><g fill=\"none\" fill-rule=\"evenodd\" stroke=\"#FFF\" stroke-width=\".7\"><path stroke-linejoin=\"round\" d=\"M0 3.91h7.467\"></path><path d=\"M4.8 1l2.933 2.91L4.8 6.817\"></path></g></svg>" 5808 5809/***/ }), 5810/* 51 */ 5811/***/ (function(module, exports, __webpack_require__) { 5812 5813"use strict"; 5814 5815var __extends = (this && this.__extends) || (function () { 5816 var extendStatics = Object.setPrototypeOf || 5817 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5818 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 5819 return function (d, b) { 5820 extendStatics(d, b); 5821 function __() { this.constructor = d; } 5822 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 5823 }; 5824})(); 5825Object.defineProperty(exports, "__esModule", { value: true }); 5826var Component = Coveo.Component; 5827var Initialization = Coveo.Initialization; 5828var ComponentOptions = Coveo.ComponentOptions; 5829/** 5830* Required customization specifically applied for your implementation 5831*/ 5832var CustomContext = /** @class */ (function (_super) { 5833 __extends(CustomContext, _super); 5834 function CustomContext(element, options, bindings) { 5835 var _this = _super.call(this, element, CustomContext.ID, bindings) || this; 5836 _this.element = element; 5837 _this.options = options; 5838 _this.bindings = bindings; 5839 _this.options = ComponentOptions.initComponentOptions(element, CustomContext, options); 5840 _this.bind.onRootElement(Coveo.QueryEvents.buildingQuery, function (data) { return _this.handleBuildingQuery(data); }); 5841 return _this; 5842 } 5843 /** 5844 * Building Query 5845 */ 5846 CustomContext.prototype.handleBuildingQuery = function (args) { 5847 var i = this.options.context.length; 5848 while (i--) { 5849 if (this.options.context[i] === "" || this.options.context[i] === null) { 5850 this.options.context.splice(i, 1); 5851 } 5852 } 5853 args.queryBuilder.addContext(this.options.context); 5854 }; 5855 CustomContext.ID = 'CustomContext'; 5856 CustomContext.options = { 5857 context: ComponentOptions.buildJsonObjectOption() 5858 }; 5859 return CustomContext; 5860}(Component)); 5861exports.CustomContext = CustomContext; 5862; 5863Initialization.registerAutoCreateComponent(CustomContext); 5864 5865 5866/***/ }), 5867/* 52 */ 5868/***/ (function(module, exports, __webpack_require__) { 5869 5870"use strict"; 5871 5872var __extends = (this && this.__extends) || (function () { 5873 var extendStatics = Object.setPrototypeOf || 5874 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5875 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 5876 return function (d, b) { 5877 extendStatics(d, b); 5878 function __() { this.constructor = d; } 5879 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 5880 }; 5881})(); 5882Object.defineProperty(exports, "__esModule", { value: true }); 5883var Component = Coveo.Component; 5884var Initialization = Coveo.Initialization; 5885var ComponentOptions = Coveo.ComponentOptions; 5886/** 5887* Required customization specifically applied for your implementation 5888*/ 5889var CustomPipelineContext = /** @class */ (function (_super) { 5890 __extends(CustomPipelineContext, _super); 5891 function CustomPipelineContext(element, options, bindings) { 5892 var _this = _super.call(this, element, CustomPipelineContext.ID, bindings) || this; 5893 _this.element = element; 5894 _this.options = options; 5895 _this.bindings = bindings; 5896 _this.options = ComponentOptions.initComponentOptions(element, CustomPipelineContext, options); 5897 _this.bind.onRootElement(Coveo.InitializationEvents.afterComponentsInitialization, function () { return _this.handleAfterComponentsInit(); }); 5898 return _this; 5899 } 5900 /** 5901 * After Components Init 5902 */ 5903 CustomPipelineContext.prototype.handleAfterComponentsInit = function () { 5904 var pipelineContext = Coveo.get(document.querySelector('.CoveoPipelineContext'), 'PipelineContext'); 5905 pipelineContext.setContext(this.options.context); 5906 }; 5907 CustomPipelineContext.ID = 'CustomPipelineContext'; 5908 CustomPipelineContext.options = { 5909 context: ComponentOptions.buildJsonObjectOption() 5910 }; 5911 return CustomPipelineContext; 5912}(Component)); 5913exports.CustomPipelineContext = CustomPipelineContext; 5914; 5915Initialization.registerAutoCreateComponent(CustomPipelineContext); 5916 5917 5918/***/ }), 5919/* 53 */ 5920/***/ (function(module, exports, __webpack_require__) { 5921 5922"use strict"; 5923 5924Object.defineProperty(exports, "__esModule", { value: true }); 5925var TemplateHelpers = Coveo.TemplateHelpers; 5926var MotoDateHelper = /** @class */ (function () { 5927 function MotoDateHelper() { 5928 } 5929 return MotoDateHelper; 5930}()); 5931exports.MotoDateHelper = MotoDateHelper; 5932TemplateHelpers.registerTemplateHelper('motoDateHelperYT', function (arg1) { 5933 var durationString = ''; 5934 var duration = new Number(arg1).valueOf(); 5935 var min = Math.floor(duration / 60); 5936 var sec = duration % 60; 5937 if (min > 1) { 5938 durationString += min + ' mins '; 5939 } 5940 else if (min == 1) { 5941 durationString += min + ' min '; 5942 } 5943 durationString += sec + ' secs'; 5944 return durationString; 5945}); 5946TemplateHelpers.registerTemplateHelper('motoDateHelperVideo', function (arg1) { 5947 var durationString = ''; 5948 var duration = new String(arg1).split(':'); 5949 var min = new Number(duration[0]); 5950 var sec = new Number(duration[1]); 5951 if (min > 1) { 5952 durationString += min + ' mins '; 5953 } 5954 else if (min == 1) { 5955 durationString += min + ' min '; 5956 } 5957 durationString += sec + ' secs'; 5958 return durationString; 5959}); 5960 5961 5962/***/ }), 5963/* 54 */ 5964/***/ (function(module, exports, __webpack_require__) { 5965 5966"use strict"; 5967 5968// Webpack output a library target with a temporary name. 5969// It does not take care of merging the namespace if the global variable already exists. 5970// If another piece of code in the page use the Coveo namespace (eg: extension), then they get overwritten 5971// This code swap the current module to the "real" Coveo variable, without overwriting the whole global var. 5972// This is to allow end user to put CoveoPSComponents.js before or after the main CoveoJsSearch.js, without breaking 5973Object.defineProperty(exports, "__esModule", { value: true }); 5974function swapVar(scope) { 5975 if (window['Coveo'] == undefined) { 5976 window['Coveo'] = scope; 5977 } 5978 else { 5979 _.each(_.keys(scope), function (k) { 5980 window['Coveo'][k] = scope[k]; 5981 }); 5982 } 5983} 5984exports.swapVar = swapVar; 5985 5986 5987/***/ }) 5988/******/ ]); 5989}); 5990//# sourceMappingURL=Coveo.Motorola.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.