{"version":3,"sources":["QuerySuggestPreview.min__4e9032d9a7117b17aab0.js","./src/utils/ResultListUtils.ts","./src/ui/FieldValue/FieldValue.ts","./src/ui/FieldImage/ImageFieldValue.ts","./src/ui/ResultList/ResultListRenderer.ts","./src/ui/QuerySuggestPreview/QuerySuggestPreview.ts","./src/ui/Facet/FacetUtils.ts","./src/ui/Templates/TableTemplate.ts","./src/ui/Templates/DefaultRecommendationTemplate.ts","./src/ui/Templates/TemplateToHtml.ts","./src/ui/Templates/CoreHelpers.ts","./src/ui/ResultLink/ResultLinkCommon.ts","./src/events/ResultPreviewsManagerEvents.ts","./src/ui/ResponsiveComponents/ResponsiveDefaultResultTemplate.ts","./src/ui/ResultList/ResultContainer.ts","./src/ui/ResultList/ResultListCardRenderer.ts","./src/ui/ResultList/ResultListTableRenderer.ts","./src/ui/FieldValue/IFieldValueCompatibleFacet.ts","./src/ui/ResultLink/ResultLink.ts","./src/ui/ResultList/ResultList.ts"],"names":["webpackJsonpCoveo__temporary","118","module","exports","__webpack_require__","Object","defineProperty","value","hideIfInfiniteScrollEnabled","cmp","ResultListUtils","isInfiniteScrollEnabled","searchInterface","element","disable","$$","hide","warnIfComponentNotNeeded","enable","unhide","root","resultList","getMainResultList","options","enableInfiniteScroll","scrollToTop","Logger","this","warn","window","scrollTo","searchInterfacePosition","getBoundingClientRect","top","pageYOffset","resultLists","getResultLists","find","isRecInterface","classList","contains","disabled","findAll","cssClass","map","el","Component","get","ResultList","computeCssClassName","allResultListsUseInfiniteScroll","notNeededComponentWarning","filter","length","cmpCssClass","computeCssClassNameForType","type","message","125","showOnlyWithHelper","helpers","__extends","extendStatics","setPrototypeOf","__proto__","Array","d","b","p","hasOwnProperty","__","constructor","prototype","create","bindings","result","fieldValueClassId","FieldValue","ID","ComponentOptions","initOptions","simpleOptions","helper","normalizeHelperAndOptions","resolveResult","Assert","exists","TemplateFieldsEvaluator","evaluateFieldsToMatch","conditions","Utils","isNullOrUndefined","getValue","initialize","parentElement","removeChild","_this","values","loadedValueFromComponent","isArray","splitValues","isString","split","separator","v","trim","toString","isValueHierarchical","slice","appendValuesToDom","textCaption","prependTextCaptionToDom","getFieldValue","field","isObject","renderOneValue","toRender","getCaption","TemplateHelpers","getHelper","call","getHelperOptions","logger","keys","getHelpers","fullDateStr","getFullDate","setAttribute","StringUtils","capitalizeFirstLetter","htmlValue","innerHTML","appendChild","document","createTextNode","bindEventOnValue","getValueContainer","helperOptions","toFilter","toKeep","optionKey","optionDefinition","omit","key","inlineOptions","loadStringOption","isNonEmptyString","extend","eval","date","fullDateOptions","useLongDateFormat","useTodayYesterdayAndTomorrow","useWeekdayIfThisWeek","omitYearIfCurrentOne","DateUtils","dateToString","Date","parseInt","dateTimeToString","each","index","undefined","displaySeparator","renderTextCaption","className","escape","elem","prepend","addClass","originalFacetValue","renderedFacetValue","bindFacets","getFacets","facet","caption","getCaptionForStringValue","FacetUtils","tryToGetTranslatedCaption","facets","ComponentsTypes","getAllFacetsFromSearchInterface","isFacetFieldValueCompatible","facetsWithMatchingId","id","isFieldValueHierarchical","enumerable","configurable","isValueSelected","hasSelectedValue","selectAction","handleFacetSelection","buildClickableElement","isSelected","label","l","AccessibleButton","withTitle","withElement","withSelectAction","build","forEach","deselectValue","selectValue","executeQuery","queryController","deferExecuteQuery","beforeExecuteQuery","usageAnalytics","logSearchEvent","analyticsActionCauseList","documentField","facetId","facetField","facetValue","toLowerCase","doExport","exportGlobally","buildFieldOption","defaultValue","required","buildStringOption","postProcessing","buildBooleanOption","depend","buildHelperOption","buildObjectOption","subOptions","text","target","class","format","decimals","buildNumberOption","min","symbol","includeTimeIfToday","includeTimeIfThisWeek","alwaysIncludeTime","predefinedFormat","companyDomain","me","lengthLimit","truncateName","alt","height","width","srcTemplate","precision","base","isMilliseconds","buildLocalizedStringOption","buildFieldConditionOption","Initialization","registerAutoCreateComponent","197","ImageFieldValue","initComponentOptions","fieldValueOption","title","215","resultListOptions","autoCreateComponentsFn","renderResults","resultElements","append","resultDisplayedCallback","Promise","all","getStartFragment","getEndFragment","then","startFrag","endFrag","resultsFragment","createDocumentFragment","_","resultElement","getResult","resultsContainer","resolve","ResultListRenderer","296","__assign","assign","t","s","i","n","arguments","__awaiter","thisArg","_arguments","P","generator","reject","fulfilled","step","next","e","rejected","done","apply","__generator","body","verb","op","f","TypeError","y","ops","pop","trys","push","g","sent","throw","return","Symbol","iterator","QuerySuggestPreview","resultTemplate","buildDefaultSearchResultPreviewTemplate","bind","onRootElement","ResultPreviewsManagerEvents","updateResultPreviewsManagerOptions","args","displayAfterDuration","Math","max","executeQueryDelay","populateSearchResultPreviews","omniboxAnalytics","getOmniboxAnalytics","HtmlTemplate","ResultLink","templateToHtmlArgs","queryStateModel","TemplateToHtml","previewsQueries","fetchSearchResultPreviews","suggestion","query","results","_a","buildQuery","logShowQuerySuggestPreview","getEndpoint","search","buildResultsPreview","buildDefaultQuery","trigger","buildingResultPreviewsQuery","searchHub","pipeline","tab","locale","timezone","context","cq","firstResult","numberOfResults","numberOfPreviewResults","q","dom","innerText","advancedQuery","aq","buildResults","templateToHtml","buildResultPreview","rank","add","resultLink","querySelector","computeSelectorForType","textContent","removeAttribute","onSelect","handleSelect","logClickQuerySuggestPreview","link","openLinkAsConfigured","openLink","showQuerySuggestPreview","buildCustomDataForPartialQueries","displayedRank","logCustomEvent","clickQuerySuggestPreview","TemplateComponentOptions","buildTemplateOption","40","getRegexToUseForFacetSearch","ignoreAccent","RegExp","stringToRegex","getDisplayValueFromValueCaption","valueCaption","returnValue","getValuesToUseForSearchInFacet","original","ret","regex","facetSearchIgnoreAccents","chain","pairs","pair","test","match","QueryUtils","isStratusAgnosticField","FileTypes","getFileTypeCaptions","range","month","monthToString","substr","buildFacetSearchPattern","escapeRegexCharacter","join","needAnotherFacetSearch","currentSearchLength","newSearchLength","oldSearchLength","desiredSearchLength","addNoStateCssClassToFacetValues","container","getSelected","noStates","noState","fallbackOnLocalization","found","getFileType","getObjectType","isMonthFieldValue","asInt","isNaN","470","defaultTemplate","defaultRoledTemplates","instantiateRoleToString","role","roledTemplate","templates","instantiateToString","instantiateRoleToElement","instantiateToElement","tmpl","Template","layout","getFallbackTemplate","hasTemplateWithRole","TemplateList","TableTemplate","472","_super","object","div","createElement","DefaultRecommendationTemplate","473","currentlyDisplayedResults","res","resultsPromises","buildResult","idx","resultCurrentlyBeingRendered","pluck","sortBy","setStateObjectOnQueryResult","setSearchInterfaceObjectOnQueryResult","createHtmlElement","bindResultToElement","autoCreateComponentsInsideResult","initResult","verifyChildren","automaticallyCreateComponentsInsideResult","wrapInDiv","checkCondition","currentLayout","responsiveComponents","474","resolveQueryResult","getComponentRef","quickview","resolveTermsToHighlight","currentQueryResult","termsToHighlight","resolvePhrasesToHighlight","phrasesToHighlight","termsToHighlightAreDefined","isNonEmptyArray","exportAllHelpersGlobally","scope","name","CoreHelpers","registerFieldHelper","javascriptEncode","executeShorten","content","strAndHoles","StringAndHoles","shortenString","highlights","HighlightUtils","highlightString","holes","registerTemplateHelper","executeShortenPath","shortenPath","executeShortenUri","shortenUri","executeHighlight","executeHighlightStreamText","StreamHighlightUtils","highlightStreamText","opts","mergedOptions","executeHighlightStreamHTML","highlightStreamHTML","numberValue","Number","htmlEncode","Globalize","convertFromJsonDateIfNeeded","timeToString","defaultOptions","optionsToUse","CurrencyUtils","currencyToString","TimeSpan","getHHMMSS","listOfAddresses","EmailUtils","splitSemicolonSeparatedListOfEmailAddresses","emailAddressesToHyperlinks","removeClass","hasClass","siblings","sibling","href","AnchorUtils","buildAnchor","src","ImageUtils","buildImage","buildStringTemplateFromResult","endpoint","hasThumbnail","buildImageFromResult","SearchEndpoint","endpoints","icon","createIcon","outerHTML","replace","templatesToLoad","once","defaultTmpl","data","atLeastOneWasLoaded","toLoad","obj","condition","byteMeasure","size","floor","pow","TemplateCache","getTemplate","encodeCarriageReturn","DeviceUtils","isMobileDevice","getDeviceName","count","plural","singular","475","logAnalytics","executeOnlyOnce","on","longPressTimer","setTimeout","clearTimeout","510","528","529","530","531","coveoRoot","responsiveDropdown","SearchInterface","currentMode","init","component","trace","ResponsiveComponentsManager","register","ResponsiveDefaultResultTemplate","registerComponent","accept","handleResizeEvent","lastResults","getLastResults","needSmallMode","elements","getSmallScreenWidth","532","resultContainer","resultContainerElement","empty","detachComponentsInside","classToAdd","isEmpty","hideChildren","children","child","getResultElements","ResultContainer","533","needToBeRemoved","toRemove","remove","times","ResultListCardRenderer","534","shouldDisplayHeader","shouldDisplayFooter","renderRoledTemplate","frag","ResultListTableRenderer","535","540","703","71","os","debounce","saveLastQuery","documentURL","getAttribute","escapedClickUri","logDocumentOpen","Defer","flush","globalOptions","originalOptionsObject","initialOptions","resultLinkOptions","componentOptionsModel","ComponentOptionsModel","attributesEnum","openQuickview","raw","hasAttribute","quickviewShouldBeOpened","bindAnalyticsToLink","renderUri","bindEventToOpen","getDisplayedTitle","titleAsText","getDisplayedTitleAsText","location","getResultUri","openLinkInNewWindow","open","openLinkInOutlook","hasOutlookField","toExecuteOnOpen","bindOnClickIfNotUndefined","bindOpenQuickviewIfNotUndefined","setHrefIfNotAlready","openLinkThatIsNotAnAnchor","titleTemplate","newTitle","titleHighlights","setHtml","clickUri","onClick","withLabel","ResultListEvents","preventDefault","elementIsAnAnchor","alwaysOpenInNewWindow","openInOutlook","logClickEvent","documentOpen","documentTitle","author","filterProtocol","uri","isAbsolute","isRelative","hrefTemplate","setField","tagName","OSUtils","OS_NAME","MACOSX","WINDOWS","isUriThatMustBeOpenedInQuickview","indexOf","hasHTMLVersion","buildCustomOption","93","elementClassId","reachedTheEndOfResults","disableLayoutChange","successiveScrollCount","infiniteScrollContainer","showOrHideElementsDependingOnState","addListeners","initResultContainer","initWaitAnimationContainer","waitAnimationContainer","setupTemplatesVersusLayouts","ResultLayoutEvents","populateResultLayout","layouts","setupRenderer","makeElementFocusable","ensureHasId","getDefaultTemplate","template","loadTemplatesFromCache","Coveo","DefaultResultTemplate","pageTemplateNames","getResultListTemplateNames","compact","templateName","QueryEvents","newQuery","handleNewQuery","buildingQuery","handleBuildingQuery","querySuccess","handleQuerySuccess","fetchMoreSuccess","handleFetchMoreSuccess","duringQuery","handleDuringQuery","queryError","handleQueryError","changeLayout","handleChangeLayout","addInfiniteScrollListeners","addPagerListeners","handleScrollOfResultList","deferredQuerySuccess","scrollToTopIfEnabled","onQueryState","MODEL_EVENTS","CHANGE_ONE","QUERY_STATE_ATTRIBUTES","FIRST","oneRootElement","getAutoSelectedFieldsToInclude","getFields","concat","getMinimalFieldsToInclude","unique","layoutClassToAdd","renderer","triggerNewResultDisplayed","triggerNewResultsDisplayed","displayMoreResults","isLargerOrEqualsThan","isCurrentlyFetchingMoreResults","hasPotentiallyMoreResultsToDisplay","enableInfiniteScrollWaitingAnimation","showWaitingAnimationForInfiniteScrolling","fetchAndRenderMoreResults","getDisplayedResults","getDisplayedResultsElements","resultLayoutSelectors","enableBasedOnActiveLayouts","otherLayoutsStillActive","otherResultLists","otherResultList","resultLayoutSelector","disableLayouts","item","newResultDisplayed","newResultsDisplayed","e_1","fetchingMoreResults","fetchMore","pagerScrolling","renderNewResults","resetStateAfterFetchingMoreResults","_b","hideWaitingAnimationForInfiniteScrolling","defer","MAX_AMOUNT_OF_SUCESSIVE_REQUESTS","info","cancelFetchingMoreResultsIfNeeded","showWaitingAnimation","hideWaitingAnimation","mobileScrollContainer","scrollTop","queryBuilder","handleQueryOrFetchMoreSuccess","firstResultOfNextPage","totalCountFiltered","isScrollingOfResultListAlmostAtTheBottom","infiniteScrollPageSize","enableScrollToTop","allResultLists","getComponents","without","fieldsToInclude","addFieldsToInclude","autoSelectFieldsToInclude","otherFields","flatten","addRequiredFields","includeRequiredFields","InitializationPlaceholder","withVisibleRootElement","withPlaceholderForResultList","isWindow","Window","isScrollAtBottomForWindowElement","isScrollAtBottomForHtmlElement","win","Win","windowHeight","scrollY","Doc","elementHeight","clientHeight","scrollHeight","hasQuery","hasResults","showIfQuery","showIfNoQuery","showIfResults","showIfNoResults","toggle","waitAnimation","DomUtils","getBasicLoadingAnimation","spinner","detach","getLoadingSpinner","previousSpinnerContainer","previousSpinner","spinnerContainer","spinners","containers","elemType","initResultContainerAddToDom","initParameters","automaticallyCreateComponentsInside","uniqueId","activeLayouts","activeLayout","activeLayoutKey","enableLayouts","buildChildHtmlElementOption","alias","defaultFunction","findParentScrolling","buildSelectorOption","buildFieldsOption","includeInResults"],"mappings":"AAAAA,8BAA8B,GAAG,GAAG,GAAG,GAAG,KAEpCC,IACA,SAAUC,EAAQC,EAASC,GAEjC,YAEAC,QAAOC,eAAeH,EAAS,cAAgBI,OAAO,GCPtD,YACA,QACA,OACA,OACA,OAEA,2BA0EA,MAzEgB,GAAAC,4BAAd,SAA0CC,GACVC,EAAgBC,wBAAwBF,EAAIG,gBAAgBC,UAGxFJ,EAAIK,UACJ,EAAAC,GAAGN,EAAII,SAASG,OAChBN,EAAgBO,yBAAyBR,KAEzCA,EAAIS,SACJ,EAAAH,GAAGN,EAAII,SAASM,WAIN,EAAAR,wBAAd,SAAsCS,GACpC,GAAMC,GAAaX,EAAgBY,kBAAkBF,EACrD,SAAOC,KAAeA,EAAWE,QAAQC,sBAG7B,EAAAC,YAAd,SAA0BL,GACxB,GAAMC,GAAaX,EAAgBY,kBAAkBF,EACrD,KAAKC,EAEH,MADA,IAAI,GAAAK,OAAOC,MAAMC,KAAK,4DACfC,OAAOC,SAAS,EAAG,EAG5B,IAAMC,GAA0BV,EAAWT,gBAAgBC,QAAQmB,wBAAwBC,GACvFF,GAA0B,GAI9BF,OAAOC,SAAS,EAAGD,OAAOK,YAAcH,IAG3B,EAAAT,kBAAf,SAAiCF,GAC/B,GAAMe,GAAczB,EAAgB0B,eAAehB,EACnD,OAAO,GAAAiB,KAAKF,EAAa,SAAAd,GACvB,GAAMiB,GAAiBjB,EAAWT,gBAAgBC,QAAQ0B,UAAUC,SAAS,sBAC7E,QAAQnB,EAAWoB,WAAaH,KAIrB,EAAAF,eAAf,SAA8BhB,GAC5B,MAAO,GAAAL,GAAGK,GACPsB,QAAQ,I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B,UAAnB,GAAAE,aAyzBb,EAAA6M,eAAeC,4BAA4B9M","file":"QuerySuggestPreview.min__4e9032d9a7117b17aab0.js","sourcesContent":["webpackJsonpCoveo__temporary([12,19,32,40,42],{\n\n/***/ 118:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Component_1 = __webpack_require__(7);\nvar ResultList_1 = __webpack_require__(93);\nvar Dom_1 = __webpack_require__(1);\nvar underscore_1 = __webpack_require__(0);\nvar Logger_1 = __webpack_require__(9);\nvar ResultListUtils = /** @class */ (function () {\n    function ResultListUtils() {\n    }\n    ResultListUtils.hideIfInfiniteScrollEnabled = function (cmp) {\n        var infiniteScrollEnabled = ResultListUtils.isInfiniteScrollEnabled(cmp.searchInterface.element);\n        if (infiniteScrollEnabled) {\n            cmp.disable();\n            Dom_1.$$(cmp.element).hide();\n            ResultListUtils.warnIfComponentNotNeeded(cmp);\n        }\n        else {\n            cmp.enable();\n            Dom_1.$$(cmp.element).unhide();\n        }\n    };\n    ResultListUtils.isInfiniteScrollEnabled = function (root) {\n        var resultList = ResultListUtils.getMainResultList(root);\n        return resultList ? !!resultList.options.enableInfiniteScroll : false;\n    };\n    ResultListUtils.scrollToTop = function (root) {\n        var resultList = ResultListUtils.getMainResultList(root);\n        if (!resultList) {\n            new Logger_1.Logger(this).warn('No active ResultList, scrolling to the top of the Window');\n            return window.scrollTo(0, 0);\n        }\n        var searchInterfacePosition = resultList.searchInterface.element.getBoundingClientRect().top;\n        if (searchInterfacePosition > 0) {\n            return;\n        }\n        window.scrollTo(0, window.pageYOffset + searchInterfacePosition);\n    };\n    ResultListUtils.getMainResultList = function (root) {\n        var resultLists = ResultListUtils.getResultLists(root);\n        return underscore_1.find(resultLists, function (resultList) {\n            var isRecInterface = resultList.searchInterface.element.classList.contains('CoveoRecommendation');\n            return !resultList.disabled && !isRecInterface;\n        });\n    };\n    ResultListUtils.getResultLists = function (root) {\n        return Dom_1.$$(root)\n            .findAll(\".\" + ResultListUtils.cssClass())\n            .map(function (el) { return Component_1.Component.get(el, ResultList_1.ResultList); });\n    };\n    ResultListUtils.cssClass = function () {\n        return Component_1.Component.computeCssClassName(ResultList_1.ResultList);\n    };\n    ResultListUtils.warnIfComponentNotNeeded = function (cmp) {\n        var root = cmp.searchInterface.root;\n        var allListsUseInfiniteScroll = ResultListUtils.allResultListsUseInfiniteScroll(root);\n        allListsUseInfiniteScroll && ResultListUtils.notNeededComponentWarning(cmp);\n    };\n    ResultListUtils.allResultListsUseInfiniteScroll = function (root) {\n        var listsWithInfiniteScrollDisabled = ResultListUtils.getResultLists(root).filter(function (resultList) { return !resultList.options.enableInfiniteScroll; });\n        return listsWithInfiniteScrollDisabled.length === 0;\n    };\n    ResultListUtils.notNeededComponentWarning = function (cmp) {\n        var cmpCssClass = Component_1.Component.computeCssClassNameForType(cmp.type);\n        var message = \"The \" + cmpCssClass + \" component is not needed because all \" + ResultListUtils.cssClass() + \" components have enableInfiniteScroll set to 'true'.\\n    For the best performance, remove the \" + cmpCssClass + \" component from your search page.\";\n        new Logger_1.Logger(cmp).warn(message);\n    };\n    return ResultListUtils;\n}());\nexports.ResultListUtils = ResultListUtils;\n\n\n/***/ }),\n\n/***/ 125:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = Object.setPrototypeOf ||\n        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar underscore_1 = __webpack_require__(0);\nvar GlobalExports_1 = __webpack_require__(3);\nvar Assert_1 = __webpack_require__(5);\nvar Strings_1 = __webpack_require__(6);\nvar AccessibleButton_1 = __webpack_require__(15);\nvar DateUtils_1 = __webpack_require__(33);\nvar Dom_1 = __webpack_require__(1);\nvar StringUtils_1 = __webpack_require__(22);\nvar Utils_1 = __webpack_require__(4);\nvar AnalyticsActionListMeta_1 = __webpack_require__(10);\nvar Component_1 = __webpack_require__(7);\nvar ComponentOptions_1 = __webpack_require__(8);\nvar Initialization_1 = __webpack_require__(2);\nvar FacetUtils_1 = __webpack_require__(40);\nvar TemplateFieldsEvaluator_1 = __webpack_require__(136);\nvar TemplateHelpers_1 = __webpack_require__(122);\nvar IFieldValueCompatibleFacet_1 = __webpack_require__(540);\nvar ComponentsTypes_1 = __webpack_require__(47);\nfunction showOnlyWithHelper(helpers, options) {\n    if (options == null) {\n        options = {};\n    }\n    options.helpers = helpers;\n    return options;\n}\n/**\n * The FieldValue component displays the value of a field associated to its parent search result. It is normally usable\n * within a {@link FieldTable}.\n *\n * This component is a result template component (see [Result Templates](https://docs.coveo.com/en/413/)).\n *\n * A common use of this component is to display a specific field value which also happens to be an existing\n * {@link Facet.options.field}. When the user clicks on the FieldValue component, it activates the corresponding Facet.\n */\nvar FieldValue = /** @class */ (function (_super) {\n    __extends(FieldValue, _super);\n    /**\n     * Creates a new FieldValue.\n     * @param element The HTMLElement on which to instantiate the component.\n     * @param options The options for the FieldValue component.\n     * @param bindings The bindings that the component requires to function normally. If not set, these will be\n     * automatically resolved (with a slower execution time).\n     * @param result The result to associate the component with.\n     */\n    function FieldValue(element, options, bindings, result, fieldValueClassId) {\n        if (fieldValueClassId === void 0) { fieldValueClassId = FieldValue.ID; }\n        var _this = _super.call(this, element, fieldValueClassId, bindings) || this;\n        _this.element = element;\n        _this.options = options;\n        _this.result = result;\n        _this.options = ComponentOptions_1.ComponentOptions.initOptions(element, FieldValue.simpleOptions, options, FieldValue.ID);\n        if (_this.options.helper != null) {\n            _this.normalizeHelperAndOptions();\n        }\n        _this.result = _this.result || _this.resolveResult();\n        Assert_1.Assert.exists(_this.result);\n        if (TemplateFieldsEvaluator_1.TemplateFieldsEvaluator.evaluateFieldsToMatch(_this.options.conditions, _this.result) && !Utils_1.Utils.isNullOrUndefined(_this.getValue())) {\n            _this.initialize();\n        }\n        else if (_this.element.parentElement != null) {\n            _this.element.parentElement.removeChild(_this.element);\n        }\n        return _this;\n    }\n    FieldValue.prototype.initialize = function () {\n        var loadedValueFromComponent = this.getValue();\n        var values;\n        if (underscore_1.isArray(loadedValueFromComponent)) {\n            values = loadedValueFromComponent;\n        }\n        else if (this.options.splitValues) {\n            if (underscore_1.isString(loadedValueFromComponent)) {\n                values = underscore_1.map(loadedValueFromComponent.split(this.options.separator), function (v) {\n                    return v.trim();\n                });\n            }\n        }\n        else {\n            loadedValueFromComponent = loadedValueFromComponent.toString();\n            values = [loadedValueFromComponent];\n        }\n        if (values.length > 1 && this.isValueHierarchical) {\n            values = values.slice(-1);\n        }\n        this.appendValuesToDom(values);\n        if (this.options.textCaption != null) {\n            this.prependTextCaptionToDom();\n        }\n    };\n    /**\n     * Gets the current FieldValue from the current {@link IQueryResult}.\n     *\n     * @returns {any} The current FieldValue or `null` if value is and `Object`.\n     */\n    FieldValue.prototype.getValue = function () {\n        var value = Utils_1.Utils.getFieldValue(this.result, this.options.field);\n        if (!underscore_1.isArray(value) && underscore_1.isObject(value)) {\n            value = null;\n        }\n        return value;\n    };\n    /**\n     * Renders a value to HTML using all of the current FieldValue component options.\n     * @param value The value to render.\n     * @returns {HTMLElement} The element containing the rendered value.\n     */\n    FieldValue.prototype.renderOneValue = function (value) {\n        var element = Dom_1.$$('span').el;\n        var toRender = this.getCaption(value);\n        if (this.options.helper) {\n            // Try to resolve and execute version 2 of each helper function if available\n            var helper = TemplateHelpers_1.TemplateHelpers.getHelper(this.options.helper + \"v2\") || TemplateHelpers_1.TemplateHelpers.getHelper(\"\" + this.options.helper);\n            if (Utils_1.Utils.exists(helper)) {\n                toRender = helper.call(this, value, this.getHelperOptions(), this.result);\n            }\n            else {\n                this.logger.warn(\"Helper \" + this.options.helper + \" is not found in available helpers. The list of supported helpers is :\", underscore_1.keys(TemplateHelpers_1.TemplateHelpers.getHelpers()));\n            }\n            var fullDateStr = this.getFullDate(value, this.options.helper);\n            if (fullDateStr) {\n                element.setAttribute('title', fullDateStr);\n            }\n            if (this.options.helper == 'date' || this.options.helper == 'dateTime' || this.options.helper == 'emailDateTime') {\n                toRender = StringUtils_1.StringUtils.capitalizeFirstLetter(toRender);\n            }\n        }\n        if (this.options.htmlValue) {\n            element.innerHTML = toRender;\n        }\n        else {\n            element.appendChild(document.createTextNode(toRender));\n        }\n        this.bindEventOnValue(element, value, toRender);\n        return element;\n    };\n    FieldValue.prototype.getValueContainer = function () {\n        return this.element;\n    };\n    FieldValue.prototype.normalizeHelperAndOptions = function () {\n        var _this = this;\n        this.options = ComponentOptions_1.ComponentOptions.initOptions(this.element, FieldValue.helperOptions, this.options, FieldValue.ID);\n        var toFilter = underscore_1.keys(FieldValue.options.helperOptions['subOptions']);\n        var toKeep = underscore_1.filter(toFilter, function (optionKey) {\n            var optionDefinition = FieldValue.options.helperOptions['subOptions'][optionKey];\n            if (optionDefinition) {\n                var helpers = optionDefinition.helpers;\n                return helpers != null && underscore_1.contains(helpers, _this.options.helper);\n            }\n            return false;\n        });\n        this.options.helperOptions = underscore_1.omit(this.options.helperOptions, function (value, key) {\n            return !underscore_1.contains(toKeep, key);\n        });\n    };\n    FieldValue.prototype.getHelperOptions = function () {\n        var inlineOptions = ComponentOptions_1.ComponentOptions.loadStringOption(this.element, 'helperOptions', {});\n        if (Utils_1.Utils.isNonEmptyString(inlineOptions)) {\n            return underscore_1.extend({}, this.options.helperOptions, eval('(' + inlineOptions + ')'));\n        }\n        return this.options.helperOptions;\n    };\n    FieldValue.prototype.getFullDate = function (date, helper) {\n        var fullDateOptions = {\n            useLongDateFormat: true,\n            useTodayYesterdayAndTomorrow: false,\n            useWeekdayIfThisWeek: false,\n            omitYearIfCurrentOne: false\n        };\n        if (helper == 'date') {\n            return DateUtils_1.DateUtils.dateToString(new Date(parseInt(date)), fullDateOptions);\n        }\n        else if (helper == 'dateTime' || helper == 'emailDateTime') {\n            return DateUtils_1.DateUtils.dateTimeToString(new Date(parseInt(date)), fullDateOptions);\n        }\n        return '';\n    };\n    FieldValue.prototype.appendValuesToDom = function (values) {\n        var _this = this;\n        underscore_1.each(values, function (value, index) {\n            if (value != undefined) {\n                _this.getValueContainer().appendChild(_this.renderOneValue(value));\n                if (index !== values.length - 1) {\n                    _this.getValueContainer().appendChild(document.createTextNode(_this.options.displaySeparator));\n                }\n            }\n        });\n    };\n    FieldValue.prototype.renderTextCaption = function () {\n        var element = Dom_1.$$('span', { className: 'coveo-field-caption' }, underscore_1.escape(this.options.textCaption));\n        return element.el;\n    };\n    FieldValue.prototype.prependTextCaptionToDom = function () {\n        var elem = this.getValueContainer();\n        Dom_1.$$(elem).prepend(this.renderTextCaption());\n        // Add a class to the container so the value and the caption wrap together.\n        Dom_1.$$(elem).addClass('coveo-with-label');\n    };\n    FieldValue.prototype.bindEventOnValue = function (element, originalFacetValue, renderedFacetValue) {\n        this.bindFacets(element, originalFacetValue, renderedFacetValue);\n    };\n    FieldValue.prototype.getCaption = function (value) {\n        for (var _i = 0, _a = this.getFacets(); _i < _a.length; _i++) {\n            var facet = _a[_i];\n            var caption = facet.getCaptionForStringValue(value);\n            if (caption) {\n                return caption;\n            }\n        }\n        return FacetUtils_1.FacetUtils.tryToGetTranslatedCaption(this.options.field, value);\n    };\n    FieldValue.prototype.getFacets = function () {\n        var _this = this;\n        var facets = ComponentsTypes_1.ComponentsTypes.getAllFacetsFromSearchInterface(this.searchInterface)\n            .filter(IFieldValueCompatibleFacet_1.isFacetFieldValueCompatible)\n            .filter(function (facet) { return !facet.disabled; });\n        var facetsWithMatchingId = facets.filter(function (facet) { return facet.options.id === _this.options.facet; });\n        if (facetsWithMatchingId.length) {\n            return facetsWithMatchingId;\n        }\n        return facets.filter(function (facet) { return facet.options.field === _this.options.field; });\n    };\n    Object.defineProperty(FieldValue.prototype, \"isValueHierarchical\", {\n        get: function () {\n            for (var _i = 0, _a = this.getFacets(); _i < _a.length; _i++) {\n                var facet = _a[_i];\n                if (facet.isFieldValueHierarchical) {\n                    return true;\n                }\n            }\n            return false;\n        },\n        enumerable: true,\n        configurable: true\n    });\n    FieldValue.prototype.bindFacets = function (element, originalFacetValue, renderedFacetValue) {\n        var _this = this;\n        var facets = this.getFacets();\n        if (!facets.length) {\n            return;\n        }\n        var isValueSelected = !!underscore_1.find(facets, function (facet) { return facet.hasSelectedValue(originalFacetValue); });\n        var selectAction = function () { return _this.handleFacetSelection(isValueSelected, facets, originalFacetValue); };\n        this.buildClickableElement(element, isValueSelected, renderedFacetValue, selectAction);\n    };\n    FieldValue.prototype.buildClickableElement = function (element, isSelected, value, selectAction) {\n        var label = isSelected ? Strings_1.l('RemoveFilterOn', value) : Strings_1.l('FilterOn', value);\n        new AccessibleButton_1.AccessibleButton().withTitle(label).withElement(element).withSelectAction(selectAction).build();\n        if (isSelected) {\n            Dom_1.$$(element).addClass('coveo-selected');\n        }\n        Dom_1.$$(element).addClass('coveo-clickable');\n    };\n    FieldValue.prototype.handleFacetSelection = function (isValueSelected, facets, value) {\n        facets.forEach(function (facet) {\n            isValueSelected ? facet.deselectValue(value) : facet.selectValue(value);\n        });\n        this.executeQuery(value);\n    };\n    FieldValue.prototype.executeQuery = function (value) {\n        var _this = this;\n        this.queryController.deferExecuteQuery({\n            beforeExecuteQuery: function () {\n                return _this.usageAnalytics.logSearchEvent(AnalyticsActionListMeta_1.analyticsActionCauseList.documentField, {\n                    facetId: _this.options.facet,\n                    facetField: _this.options.field.toString(),\n                    facetValue: value.toLowerCase()\n                });\n            }\n        });\n    };\n    FieldValue.ID = 'FieldValue';\n    FieldValue.doExport = function () {\n        GlobalExports_1.exportGlobally({\n            FieldValue: FieldValue\n        });\n    };\n    /**\n     * The options for the component\n     * @componentOptions\n     */\n    FieldValue.options = {\n        /**\n         * Specifies the field that the FieldValue should display.\n         *\n         * Specifying a value for this parameter is required in order for the FieldValue component to work.\n         */\n        field: ComponentOptions_1.ComponentOptions.buildFieldOption({ defaultValue: '@field', required: true }),\n        /**\n         * Specifies the {@link Facet} component to toggle when the end user clicks the FieldValue.\n         *\n         * Default value is the value of {@link FieldValue.options.field}.\n         *\n         * **Note:**\n         * > If the target {@link Facet.options.id} is is not the same as its {@link Facet.options.field}), you must specify\n         * > this option manually in order to link to the correct Facet.\n         */\n        facet: ComponentOptions_1.ComponentOptions.buildStringOption({ postProcessing: function (value, options) { return value || options.field; } }),\n        /**\n         * Specifies whether the content to display is an HTML element.\n         *\n         * Default value is `false`.\n         */\n        htmlValue: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: false }),\n        /**\n         * Specifies whether to split the FieldValue at each {@link FieldValue.options.separator}.\n         *\n         * This is useful for splitting groups using a {@link Facet.options.field}.\n         *\n         * When this option is `true`, the displayed values are split by the {@link FieldValue.options.displaySeparator}.\n         *\n         * Default value is `false`.\n         */\n        splitValues: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: false }),\n        /**\n         * If {@link FieldValue.options.splitValues} is `true`, specifies the separator string which separates multi-value\n         * fields in the index.\n         *\n         * See {@link FieldValue.options.displaySeparator}.\n         *\n         * Default value is `\";\"`.\n         */\n        separator: ComponentOptions_1.ComponentOptions.buildStringOption({ depend: 'splitValues', defaultValue: ';' }),\n        /**\n         * If {@link FieldValue.options.splitValues} is `true`, specifies the string to use when displaying multi-value\n         * fields in the UI.\n         *\n         * The component will insert this string between each value it displays from a multi-value field.\n         *\n         * See also {@link FieldValue.options.separator}.\n         *\n         * Default value is `\", \"`.\n         */\n        displaySeparator: ComponentOptions_1.ComponentOptions.buildStringOption({ depend: 'splitValues', defaultValue: ', ' }),\n        /**\n         * Specifies the helper that the FieldValue should use to display its content.\n         *\n         * While several helpers exist by default (see {@link ICoreHelpers}), it is also possible for you to create your own\n         * custom helpers (see {@link TemplateHelpers}).\n         */\n        helper: ComponentOptions_1.ComponentOptions.buildHelperOption(),\n        /**\n         * Specifies the options to call on the specified helper.\n         */\n        helperOptions: ComponentOptions_1.ComponentOptions.buildObjectOption({\n            subOptions: {\n                text: ComponentOptions_1.ComponentOptions.buildStringOption(showOnlyWithHelper(['anchor'])),\n                target: ComponentOptions_1.ComponentOptions.buildStringOption(showOnlyWithHelper(['anchor'])),\n                class: ComponentOptions_1.ComponentOptions.buildStringOption(showOnlyWithHelper(['anchor'])),\n                format: ComponentOptions_1.ComponentOptions.buildStringOption(showOnlyWithHelper(['number'])),\n                decimals: ComponentOptions_1.ComponentOptions.buildNumberOption(showOnlyWithHelper(['currency'], { min: 0 })),\n                symbol: ComponentOptions_1.ComponentOptions.buildStringOption(showOnlyWithHelper(['currency'])),\n                useTodayYesterdayAndTomorrow: ComponentOptions_1.ComponentOptions.buildBooleanOption(showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'], { defaultValue: true })),\n                useWeekdayIfThisWeek: ComponentOptions_1.ComponentOptions.buildBooleanOption(showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'], { defaultValue: true })),\n                omitYearIfCurrentOne: ComponentOptions_1.ComponentOptions.buildBooleanOption(showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'], { defaultValue: true })),\n                useLongDateFormat: ComponentOptions_1.ComponentOptions.buildBooleanOption(showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'], { defaultValue: false })),\n                includeTimeIfToday: ComponentOptions_1.ComponentOptions.buildBooleanOption(showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'], { defaultValue: true })),\n                includeTimeIfThisWeek: ComponentOptions_1.ComponentOptions.buildBooleanOption(showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'], { defaultValue: true })),\n                alwaysIncludeTime: ComponentOptions_1.ComponentOptions.buildBooleanOption(showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'], { defaultValue: false })),\n                predefinedFormat: ComponentOptions_1.ComponentOptions.buildStringOption(showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'])),\n                companyDomain: ComponentOptions_1.ComponentOptions.buildStringOption(showOnlyWithHelper(['email'])),\n                me: ComponentOptions_1.ComponentOptions.buildStringOption(showOnlyWithHelper(['email'])),\n                lengthLimit: ComponentOptions_1.ComponentOptions.buildNumberOption(showOnlyWithHelper(['email'], { min: 1 })),\n                truncateName: ComponentOptions_1.ComponentOptions.buildBooleanOption(showOnlyWithHelper(['email'])),\n                alt: ComponentOptions_1.ComponentOptions.buildStringOption(showOnlyWithHelper(['image'])),\n                height: ComponentOptions_1.ComponentOptions.buildStringOption(showOnlyWithHelper(['image'])),\n                width: ComponentOptions_1.ComponentOptions.buildStringOption(showOnlyWithHelper(['image'])),\n                srcTemplate: ComponentOptions_1.ComponentOptions.buildStringOption(showOnlyWithHelper(['image'])),\n                precision: ComponentOptions_1.ComponentOptions.buildNumberOption(showOnlyWithHelper(['size'], { min: 0, defaultValue: 2 })),\n                base: ComponentOptions_1.ComponentOptions.buildNumberOption(showOnlyWithHelper(['size'], { min: 0, defaultValue: 0 })),\n                isMilliseconds: ComponentOptions_1.ComponentOptions.buildBooleanOption(showOnlyWithHelper(['timeSpan'])),\n                length: ComponentOptions_1.ComponentOptions.buildNumberOption(showOnlyWithHelper(['shorten', 'shortenPath', 'shortenUri'], { defaultValue: 200 }))\n            }\n        }),\n        /**\n         * Specifies a caption to display before the value.\n         *\n         * Default value is `undefined`.\n         *\n         * @availablesince [January 2017 Release (v1.1865.9)](https://docs.coveo.com/en/396/#january-2017-release-v118659)\n         */\n        textCaption: ComponentOptions_1.ComponentOptions.buildLocalizedStringOption(),\n        /**\n         * A field-based condition that must be satisfied by the query result item for the component to be rendered.\n         *\n         * Note: This option uses a distinctive markup configuration syntax allowing multiple conditions to be expressed. Its underlying logic is the same as that of the field value conditions mechanism used by result templates.\n         *\n         * **Examples:**\n         * Render the component if the query result item's @documenttype field value is Article or Documentation.\n         * ```html\n         * <div class=\"CoveoFieldValue\" data-field=\"@author\" data-condition-field-documenttype=\"Article, Documentation\"></div>\n         * ```\n         * Render the component if the query result item's @documenttype field value is anything but Case.\n         * ```html\n         * <div class=\"CoveoFieldValue\" data-field=\"@author\" data-condition-field-not-documenttype=\"Case\"></div>\n         * ```\n         * Render the component if the query result item's @documenttype field value is Article, and if its @author field value is anything but Anonymous.\n         * ```html\n         * <div class=\"CoveoFieldValue\" data-field=\"@author\" data-condition-field-documenttype=\"Article\" data-condition-field-not-author=\"Anonymous\"></div>\n         * ```\n         * Default value is `undefined`.\n         */\n        conditions: ComponentOptions_1.ComponentOptions.buildFieldConditionOption()\n    };\n    FieldValue.simpleOptions = underscore_1.omit(FieldValue.options, 'helperOptions');\n    FieldValue.helperOptions = {\n        helperOptions: FieldValue.options.helperOptions\n    };\n    return FieldValue;\n}(Component_1.Component));\nexports.FieldValue = FieldValue;\nInitialization_1.Initialization.registerAutoCreateComponent(FieldValue);\n\n\n/***/ }),\n\n/***/ 197:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = Object.setPrototypeOf ||\n        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Core_1 = __webpack_require__(20);\nvar GlobalExports_1 = __webpack_require__(3);\nvar ComponentOptions_1 = __webpack_require__(8);\nvar FieldValue_1 = __webpack_require__(125);\n/**\n * This component renders an image from a URL retrieved in a given [`field`]{@link ImageFieldValue.options.field}.\n *\n * A typical use case of this component is to display product images in the context of commerce.\n *\n * @isresulttemplatecomponent\n * @availablesince [September 2019 Release (v2.7023)](https://docs.coveo.com/en/2990/)\n */\nvar ImageFieldValue = /** @class */ (function (_super) {\n    __extends(ImageFieldValue, _super);\n    /**\n     * Creates a new ImageFieldValue.\n     * @param element The HTMLElement on which to instantiate the component.\n     * @param options The options for the ImageFieldValue component.\n     * @param bindings The bindings that the component requires to function normally. If not set, these will be\n     * automatically resolved (with a slower execution time).\n     * @param result The result to associate the component with.\n     */\n    function ImageFieldValue(element, options, bindings, result) {\n        var _this = _super.call(this, element, ImageFieldValue.ID, bindings) || this;\n        _this.element = element;\n        _this.options = options;\n        _this.result = result;\n        _this.options = ComponentOptions_1.ComponentOptions.initComponentOptions(element, ImageFieldValue, options);\n        var fieldValueOption = {\n            field: _this.options.field,\n            helper: 'image',\n            htmlValue: true,\n            helperOptions: {\n                height: _this.options.height,\n                width: _this.options.width,\n                alt: result.title,\n                srcTemplate: _this.options.srcTemplate\n            }\n        };\n        new FieldValue_1.FieldValue(element, fieldValueOption, bindings, result);\n        return _this;\n    }\n    ImageFieldValue.ID = 'ImageFieldValue';\n    ImageFieldValue.doExport = function () {\n        GlobalExports_1.exportGlobally({\n            ImageFieldValue: ImageFieldValue\n        });\n    };\n    /**\n     * The options for the component\n     * @componentOptions\n     */\n    ImageFieldValue.options = {\n        /**\n         * **Required**. The name of a field whose value is the URL of the image to display.\n         *\n         * **Note:** The component uses the value of this field to set the `src` attribute of the [`img`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) HTML tag it generates.\n         */\n        field: ComponentOptions_1.ComponentOptions.buildFieldOption({ required: true }),\n        /**\n         * The width of the image (in pixels).\n         *\n         * **Note:** The component uses this value to set the `width` attribute of the [`img`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) HTML tag it generates.\n         */\n        width: ComponentOptions_1.ComponentOptions.buildNumberOption(),\n        /**\n         * The height of the image (in pixels).\n         *\n         * **Note:** The component uses this value to set the `height` attribute of the [`img`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) HTML tag it generates.\n         */\n        height: ComponentOptions_1.ComponentOptions.buildNumberOption(),\n        /**\n         * A [template literal](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals)\n         * from which to generate the `img` tag's `src` attribute value.\n         *\n         * This option overrides the [`field`]{@link ImageFieldValue.options.field} option value.\n         *\n         * The template literal can reference any number of fields from the parent result. It can also reference global\n         * scope properties.\n         *\n         * **Examples:**\n         *\n         * - The following markup generates an `src` value such as `http://uri.com?id=itemTitle`:\n         *\n         * ```html\n         * <a class='CoveoImageFieldValue' data-src-template='${clickUri}?id=${raw.title}'></a>\n         * ```\n         *\n         * - The following markup generates an `src` value such as `localhost/fooBar`:\n         *\n         * ```html\n         * <a class='CoveoImageFieldValue' data-src-template='${window.location.hostname}/{Foo.Bar}'></a>\n         * ```\n         *\n         * Default value is `undefined`.\n         */\n        srcTemplate: ComponentOptions_1.ComponentOptions.buildStringOption()\n    };\n    return ImageFieldValue;\n}(Core_1.Component));\nexports.ImageFieldValue = ImageFieldValue;\nCore_1.Initialization.registerAutoCreateComponent(ImageFieldValue);\n\n\n/***/ }),\n\n/***/ 215:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Component_1 = __webpack_require__(7);\nvar _ = __webpack_require__(0);\nvar ResultListRenderer = /** @class */ (function () {\n    function ResultListRenderer(resultListOptions, autoCreateComponentsFn) {\n        this.resultListOptions = resultListOptions;\n        this.autoCreateComponentsFn = autoCreateComponentsFn;\n    }\n    ResultListRenderer.prototype.renderResults = function (resultElements, append, resultDisplayedCallback) {\n        var _this = this;\n        if (append === void 0) { append = false; }\n        return Promise.all([this.getStartFragment(resultElements, append), this.getEndFragment(resultElements, append)]).then(function (_a) {\n            var startFrag = _a[0], endFrag = _a[1];\n            var resultsFragment = document.createDocumentFragment();\n            if (startFrag) {\n                resultsFragment.appendChild(startFrag);\n            }\n            _.each(resultElements, function (resultElement) {\n                resultsFragment.appendChild(resultElement);\n                resultDisplayedCallback(Component_1.Component.getResult(resultElement), resultElement);\n            });\n            if (endFrag) {\n                resultsFragment.appendChild(endFrag);\n            }\n            _this.resultListOptions.resultsContainer.appendChild(resultsFragment);\n        });\n    };\n    ResultListRenderer.prototype.getStartFragment = function (resultElements, append) {\n        return Promise.resolve(document.createDocumentFragment());\n    };\n    ResultListRenderer.prototype.getEndFragment = function (resultElements, append) {\n        return Promise.resolve(document.createDocumentFragment());\n    };\n    return ResultListRenderer;\n}());\nexports.ResultListRenderer = ResultListRenderer;\n\n\n/***/ }),\n\n/***/ 296:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = Object.setPrototypeOf ||\n        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n    for (var s, i = 1, n = arguments.length; i < n; i++) {\n        s = arguments[i];\n        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n            t[p] = s[p];\n    }\n    return t;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n    return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n    function verb(n) { return function (v) { return step([n, v]); }; }\n    function step(op) {\n        if (f) throw new TypeError(\"Generator is already executing.\");\n        while (_) try {\n            if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n            if (y = 0, t) op = [0, t.value];\n            switch (op[0]) {\n                case 0: case 1: t = op; break;\n                case 4: _.label++; return { value: op[1], done: false };\n                case 5: _.label++; y = op[1]; op = [0]; continue;\n                case 7: op = _.ops.pop(); _.trys.pop(); continue;\n                default:\n                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n                    if (t[2]) _.ops.pop();\n                    _.trys.pop(); continue;\n            }\n            op = body.call(thisArg, _);\n        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n    }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar GlobalExports_1 = __webpack_require__(3);\nvar Core_1 = __webpack_require__(20);\n__webpack_require__(703);\nvar TemplateComponentOptions_1 = __webpack_require__(63);\nvar TemplateToHtml_1 = __webpack_require__(473);\nvar ResultLink_1 = __webpack_require__(71);\nvar AnalyticsActionListMeta_1 = __webpack_require__(10);\nvar ImageFieldValue_1 = __webpack_require__(197);\nvar ResultPreviewsManagerEvents_1 = __webpack_require__(510);\n/**\n * This component renders previews of the top query results matching the currently focused query suggestion in the search box.\n *\n * As such, this component only works when the search interface can\n * [provide Coveo Machine Learning query suggestions](https://docs.coveo.com/en/340/#providing-coveo-machine-learning-query-suggestions).\n *\n * This component should be initialized on a `div` which can be nested anywhere inside the root element of your search interface.\n *\n * See [Rendering Query Suggestion Result Previews](https://docs.coveo.com/en/340/#rendering-query-suggestion-result-previews).\n *\n * @availablesince [December 2019 Release (v2.7610)](https://docs.coveo.com/en/3142/)\n */\nvar QuerySuggestPreview = /** @class */ (function (_super) {\n    __extends(QuerySuggestPreview, _super);\n    /**\n     * Creates a new QuerySuggestPreview component.\n     * @param element The HTMLElement on which to instantiate the component.\n     * @param options The options for the QuerySuggestPreview component.\n     * @param bindings The bindings that the component requires to function normally. If not set, these will be\n     * automatically resolved (with a slower execution time).\n     */\n    function QuerySuggestPreview(element, options, bindings) {\n        var _this = _super.call(this, element, QuerySuggestPreview.ID, bindings) || this;\n        _this.element = element;\n        _this.options = options;\n        _this.bindings = bindings;\n        _this.options = Core_1.ComponentOptions.initComponentOptions(element, QuerySuggestPreview, options);\n        if (!_this.options.resultTemplate) {\n            _this.logger.warn(\"No template was provided for \" + QuerySuggestPreview.ID + \", a default template was used instead.\");\n            _this.options.resultTemplate = _this.buildDefaultSearchResultPreviewTemplate();\n        }\n        _this.bind.onRootElement(ResultPreviewsManagerEvents_1.ResultPreviewsManagerEvents.updateResultPreviewsManagerOptions, function (args) {\n            return (args.displayAfterDuration = Math.max(args.displayAfterDuration || 0, _this.options.executeQueryDelay));\n        });\n        _this.bind.onRootElement(ResultPreviewsManagerEvents_1.ResultPreviewsManagerEvents.populateSearchResultPreviews, function (args) {\n            return _this.populateSearchResultPreviews(args);\n        });\n        _this.omniboxAnalytics = _this.searchInterface.getOmniboxAnalytics();\n        return _this;\n    }\n    QuerySuggestPreview.prototype.buildDefaultSearchResultPreviewTemplate = function () {\n        return Core_1.HtmlTemplate.create(Core_1.$$('div', { className: 'result-template' }, Core_1.$$('div', { className: 'coveo-result-frame coveo-default-result-preview' }, Core_1.$$('div', { className: Core_1.Component.computeCssClassName(ImageFieldValue_1.ImageFieldValue), 'data-field': '@image' }), Core_1.$$('a', { className: Core_1.Component.computeCssClassName(ResultLink_1.ResultLink) }))).el);\n    };\n    Object.defineProperty(QuerySuggestPreview.prototype, \"templateToHtml\", {\n        get: function () {\n            var templateToHtmlArgs = {\n                searchInterface: this.searchInterface,\n                queryStateModel: this.queryStateModel,\n                resultTemplate: this.options.resultTemplate\n            };\n            return new TemplateToHtml_1.TemplateToHtml(templateToHtmlArgs);\n        },\n        enumerable: true,\n        configurable: true\n    });\n    QuerySuggestPreview.prototype.populateSearchResultPreviews = function (args) {\n        args.previewsQueries.push(this.fetchSearchResultPreviews(args.suggestion));\n    };\n    QuerySuggestPreview.prototype.fetchSearchResultPreviews = function (suggestion) {\n        return __awaiter(this, void 0, void 0, function () {\n            var query, results;\n            return __generator(this, function (_a) {\n                switch (_a.label) {\n                    case 0:\n                        query = this.buildQuery(suggestion);\n                        this.logShowQuerySuggestPreview();\n                        return [4 /*yield*/, this.queryController.getEndpoint().search(query)];\n                    case 1:\n                        results = _a.sent();\n                        if (!results) {\n                            return [2 /*return*/, []];\n                        }\n                        return [2 /*return*/, this.buildResultsPreview(suggestion, results)];\n                }\n            });\n        });\n    };\n    QuerySuggestPreview.prototype.buildQuery = function (suggestion) {\n        var query = this.buildDefaultQuery(suggestion);\n        Core_1.$$(this.root).trigger(ResultPreviewsManagerEvents_1.ResultPreviewsManagerEvents.buildingResultPreviewsQuery, { query: query });\n        return query;\n    };\n    QuerySuggestPreview.prototype.buildDefaultQuery = function (suggestion) {\n        var _a = this.queryController.getLastQuery(), searchHub = _a.searchHub, pipeline = _a.pipeline, tab = _a.tab, locale = _a.locale, timezone = _a.timezone, context = _a.context, cq = _a.cq;\n        return __assign({ firstResult: 0, searchHub: searchHub,\n            pipeline: pipeline,\n            tab: tab,\n            locale: locale,\n            timezone: timezone,\n            context: context,\n            cq: cq, numberOfResults: this.options.numberOfPreviewResults, q: suggestion.text || suggestion.dom.innerText }, (suggestion.advancedQuery && { aq: suggestion.advancedQuery }));\n    };\n    QuerySuggestPreview.prototype.buildResultsPreview = function (suggestion, results) {\n        return __awaiter(this, void 0, void 0, function () {\n            var _this = this;\n            var buildResults;\n            return __generator(this, function (_a) {\n                switch (_a.label) {\n                    case 0: return [4 /*yield*/, this.templateToHtml.buildResults(results, 'preview', [])];\n                    case 1:\n                        buildResults = _a.sent();\n                        if (!(buildResults.length > 0)) {\n                            return [2 /*return*/, []];\n                        }\n                        return [2 /*return*/, buildResults.map(function (element, index) { return _this.buildResultPreview(suggestion, element, index); })];\n                }\n            });\n        });\n    };\n    QuerySuggestPreview.prototype.buildResultPreview = function (suggestion, element, rank) {\n        var _this = this;\n        element.classList.add('coveo-preview-selectable');\n        var resultLink = element.querySelector(Core_1.Component.computeSelectorForType(ResultLink_1.ResultLink.ID));\n        if (resultLink) {\n            element.setAttribute('aria-label', resultLink.textContent);\n            resultLink.setAttribute('role', 'link');\n            resultLink.removeAttribute('aria-level');\n        }\n        return {\n            element: element,\n            onSelect: function () { return _this.handleSelect(suggestion, element, rank); }\n        };\n    };\n    QuerySuggestPreview.prototype.handleSelect = function (suggestion, element, rank) {\n        this.logClickQuerySuggestPreview(suggestion, rank, element);\n        var link = Core_1.$$(element).find(\".\" + Core_1.Component.computeCssClassNameForType('ResultLink'));\n        if (link) {\n            var resultLink = Core_1.Component.get(link);\n            resultLink.openLinkAsConfigured();\n            resultLink.openLink();\n        }\n    };\n    QuerySuggestPreview.prototype.logShowQuerySuggestPreview = function () {\n        this.usageAnalytics.logSearchEvent(AnalyticsActionListMeta_1.analyticsActionCauseList.showQuerySuggestPreview, this.omniboxAnalytics.buildCustomDataForPartialQueries());\n    };\n    QuerySuggestPreview.prototype.logClickQuerySuggestPreview = function (suggestion, displayedRank, element) {\n        this.usageAnalytics.logCustomEvent(AnalyticsActionListMeta_1.analyticsActionCauseList.clickQuerySuggestPreview, {\n            suggestion: suggestion.text || suggestion.dom.innerText,\n            displayedRank: displayedRank\n        }, element);\n    };\n    QuerySuggestPreview.ID = 'QuerySuggestPreview';\n    QuerySuggestPreview.doExport = function () {\n        GlobalExports_1.exportGlobally({\n            QuerySuggestPreview: QuerySuggestPreview\n        });\n    };\n    /**\n     * The options for the component\n     * @componentOptions\n     */\n    QuerySuggestPreview.options = {\n        /**\n         * The HTML `id` attribute value, or CSS selector of the previously registered\n         * [result template](https://docs.coveo.com/413/) to apply when rendering the\n         * query suggestion result previews.\n         *\n         * **Examples**\n         * * Specifying the `id` attribute of the target result template:\n         * ```html\n         * <div class=\"CoveoQuerySuggestPreview\" data-result-template-id=\"myTemplateId\"></div>\n         * ```\n         * * Specifying an equivalent CSS selector:\n         * ```html\n         * <div class=\"CoveoQuerySuggestPreview\" data-result-template-selector=\"#myTemplateId\"></div>\n         * ```\n         *\n         * If you specify no previously registered template through this option, the component uses its default template.\n         */\n        resultTemplate: TemplateComponentOptions_1.TemplateComponentOptions.buildTemplateOption(),\n        /**\n         * The maximum number of query results to render in the preview.\n         */\n        numberOfPreviewResults: Core_1.ComponentOptions.buildNumberOption({\n            defaultValue: 4,\n            min: 1,\n            max: 6\n        }),\n        /**\n         *  The amount of focus time (in milliseconds) required on a query suggestion before requesting a preview of its top results.\n         */\n        executeQueryDelay: Core_1.ComponentOptions.buildNumberOption({ defaultValue: 200 })\n    };\n    return QuerySuggestPreview;\n}(Core_1.Component));\nexports.QuerySuggestPreview = QuerySuggestPreview;\nCore_1.Initialization.registerAutoCreateComponent(QuerySuggestPreview);\n\n\n/***/ }),\n\n/***/ 40:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/// <reference path='Facet.ts' />\nvar StringUtils_1 = __webpack_require__(22);\nvar QueryUtils_1 = __webpack_require__(21);\nvar FileTypes_1 = __webpack_require__(121);\nvar DateUtils_1 = __webpack_require__(33);\nvar Utils_1 = __webpack_require__(4);\nvar Dom_1 = __webpack_require__(1);\nvar _ = __webpack_require__(0);\nvar Strings_1 = __webpack_require__(6);\nvar FacetUtils = /** @class */ (function () {\n    function FacetUtils() {\n    }\n    FacetUtils.getRegexToUseForFacetSearch = function (value, ignoreAccent) {\n        return new RegExp(StringUtils_1.StringUtils.stringToRegex(value, ignoreAccent), 'i');\n    };\n    FacetUtils.getDisplayValueFromValueCaption = function (value, field, valueCaption) {\n        var returnValue = this.tryToGetTranslatedCaption(field, value, false);\n        return valueCaption[value] || returnValue;\n    };\n    FacetUtils.getValuesToUseForSearchInFacet = function (original, facet) {\n        var ret = [original];\n        var regex = this.getRegexToUseForFacetSearch(original, facet.options.facetSearchIgnoreAccents);\n        if (facet.options.valueCaption) {\n            _.chain(facet.options.valueCaption)\n                .pairs()\n                .filter(function (pair) {\n                return regex.test(pair[1]);\n            })\n                .each(function (match) {\n                ret.push(match[0]);\n            });\n            if (QueryUtils_1.QueryUtils.isStratusAgnosticField(facet.options.field, '@objecttype') ||\n                QueryUtils_1.QueryUtils.isStratusAgnosticField(facet.options.field, '@filetype')) {\n                _.each(FileTypes_1.FileTypes.getFileTypeCaptions(), function (value, key) {\n                    if (!(key in facet.options.valueCaption) && regex.test(value)) {\n                        ret.push(key);\n                    }\n                });\n            }\n        }\n        else if (QueryUtils_1.QueryUtils.isStratusAgnosticField(facet.options.field, '@objecttype') ||\n            QueryUtils_1.QueryUtils.isStratusAgnosticField(facet.options.field, '@filetype')) {\n            _.each(_.filter(_.pairs(FileTypes_1.FileTypes.getFileTypeCaptions()), function (pair) {\n                return regex.test(pair[1]);\n            }), function (match) {\n                ret.push(match[0]);\n            });\n        }\n        else if (QueryUtils_1.QueryUtils.isStratusAgnosticField(facet.options.field, '@month')) {\n            _.each(_.range(1, 13), function (month) {\n                if (regex.test(DateUtils_1.DateUtils.monthToString(month - 1))) {\n                    ret.push(('0' + month.toString()).substr(-2));\n                }\n            });\n        }\n        return ret;\n    };\n    FacetUtils.buildFacetSearchPattern = function (values) {\n        values = _.map(values, function (value) {\n            return Utils_1.Utils.escapeRegexCharacter(value);\n        });\n        values[0] = '.*' + values[0] + '.*';\n        return values.join('|');\n    };\n    FacetUtils.needAnotherFacetSearch = function (currentSearchLength, newSearchLength, oldSearchLength, desiredSearchLength) {\n        // Something was removed (currentSearch < newSearch)\n        // && we might want to display more facet search result(currentSearch < desiredSearch)\n        // && the new query returned more stuff than the old one so there's still more results(currentSearchLength > oldLength)\n        return currentSearchLength < newSearchLength && currentSearchLength < desiredSearchLength && currentSearchLength > oldSearchLength;\n    };\n    FacetUtils.addNoStateCssClassToFacetValues = function (facet, container) {\n        // This takes care of adding the correct css class on each facet value checkbox (empty white box) if at least one value is selected in that facet\n        if (facet.values.getSelected().length != 0) {\n            var noStates = Dom_1.$$(container).findAll('li:not(.coveo-selected)');\n            _.each(noStates, function (noState) {\n                Dom_1.$$(noState).addClass('coveo-no-state');\n            });\n        }\n    };\n    FacetUtils.tryToGetTranslatedCaption = function (field, value, fallbackOnLocalization) {\n        if (fallbackOnLocalization === void 0) { fallbackOnLocalization = true; }\n        var found;\n        if (QueryUtils_1.QueryUtils.isStratusAgnosticField(field.toLowerCase(), '@filetype')) {\n            found = FileTypes_1.FileTypes.getFileType(value, fallbackOnLocalization).caption;\n        }\n        else if (QueryUtils_1.QueryUtils.isStratusAgnosticField(field.toLowerCase(), '@objecttype')) {\n            found = FileTypes_1.FileTypes.getObjectType(value, fallbackOnLocalization).caption;\n        }\n        else if (FacetUtils.isMonthFieldValue(field, value)) {\n            var month = parseInt(value, 10);\n            found = DateUtils_1.DateUtils.monthToString(month - 1);\n        }\n        else if (fallbackOnLocalization) {\n            found = Strings_1.l(value);\n        }\n        return found != undefined && Utils_1.Utils.isNonEmptyString(found) ? found : value;\n    };\n    FacetUtils.isMonthFieldValue = function (field, value) {\n        if (!QueryUtils_1.QueryUtils.isStratusAgnosticField(field.toLowerCase(), '@month')) {\n            return false;\n        }\n        var asInt = parseInt(value, 10);\n        if (isNaN(asInt)) {\n            return false;\n        }\n        if (asInt < 1 || asInt > 12) {\n            return false;\n        }\n        return true;\n    };\n    return FacetUtils;\n}());\nexports.FacetUtils = FacetUtils;\n\n\n/***/ }),\n\n/***/ 470:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = Object.setPrototypeOf ||\n        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Template_1 = __webpack_require__(27);\nvar TemplateList_1 = __webpack_require__(96);\nvar _ = __webpack_require__(0);\nvar TableTemplate = /** @class */ (function (_super) {\n    __extends(TableTemplate, _super);\n    function TableTemplate() {\n        var _this = _super !== null && _super.apply(this, arguments) || this;\n        _this.defaultTemplate = \"<td><a class=\\\"CoveoResultLink\\\"></a></td>\\n                             <td><span class=\\\"CoveoExcerpt\\\"></span></td>\\n                             <td><span class=\\\"CoveoFieldValue\\\" data-field=\\\"@date\\\" data-helper=\\\"date\\\"></span></td>\";\n        _this.defaultRoledTemplates = {\n            'table-header': \"<th style=\\\"width: 40%\\\">Link</th>\\n                     <th>Excerpt</th>\\n                     <th style=\\\"width: 20%\\\"\\n                         class=\\\"CoveoSort coveo-table-header-sort\\\"\\n                         data-sort-criteria=\\\"date ascending,date descending\\\"\\n                         data-display-unselected-icon=\\\"false\\\">Date</th>\",\n            'table-footer': \"<th>Link</th>\\n                     <th>Excerpt</th>\\n                     <th>Date</th>\"\n        };\n        return _this;\n    }\n    TableTemplate.prototype.instantiateRoleToString = function (role) {\n        var roledTemplate = _.find(this.templates, function (t) { return t.role === role; });\n        if (roledTemplate) {\n            return roledTemplate.instantiateToString(undefined, {});\n        }\n        else {\n            return this.defaultRoledTemplates[role];\n        }\n    };\n    TableTemplate.prototype.instantiateRoleToElement = function (role) {\n        var _this = this;\n        var roledTemplate = _.find(this.templates, function (t) { return t.role === role; });\n        if (roledTemplate) {\n            return roledTemplate.instantiateToElement(undefined, {});\n        }\n        else {\n            var tmpl = new Template_1.Template(function () { return _this.defaultRoledTemplates[role]; });\n            tmpl.layout = 'table';\n            return tmpl.instantiateToElement(undefined);\n        }\n    };\n    TableTemplate.prototype.getFallbackTemplate = function () {\n        var _this = this;\n        return new Template_1.Template(function () { return _this.defaultTemplate; });\n    };\n    TableTemplate.prototype.hasTemplateWithRole = function (role) {\n        return _.find(this.templates, function (t) { return t.role === role; });\n    };\n    return TableTemplate;\n}(TemplateList_1.TemplateList));\nexports.TableTemplate = TableTemplate;\n\n\n/***/ }),\n\n/***/ 472:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = Object.setPrototypeOf ||\n        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Template_1 = __webpack_require__(27);\nvar DefaultRecommendationTemplate = /** @class */ (function (_super) {\n    __extends(DefaultRecommendationTemplate, _super);\n    function DefaultRecommendationTemplate() {\n        return _super !== null && _super.apply(this, arguments) || this;\n    }\n    DefaultRecommendationTemplate.prototype.instantiateToString = function (object) {\n        var template = \"<div class=\\\"coveo-result-frame\\\">\\n        <div class=\\\"coveo-result-row\\\">\\n          <div class=\\\"coveo-result-cell\\\" style=\\\"width:40px;text-align:center;vertical-align:middle;\\\">\\n            <span class=\\\"CoveoIcon\\\" data-small=\\\"true\\\" data-with-label=\\\"false\\\">\\n            </span>\\n          </div>\\n          <div class=\\\"coveo-result-cell\\\" style=\\\"padding:0 0 3px 5px;vertical-align:middle\\\">\\n            <div class=\\\"coveo-result-row\\\">\\n              <div class=\\\"coveo-result-cell\\\" style=\\\"font-size:10pt;\\\">\\n                <a class=\\\"CoveoResultLink\\\" style=\\\"display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis\\\">\\n                </a>\\n              </div>\\n            </div>\\n          </div>\\n        </div>\\n      </div>\";\n        return template;\n    };\n    DefaultRecommendationTemplate.prototype.instantiateToElement = function (object) {\n        var _this = this;\n        return new Promise(function (resolve, reject) {\n            var div = document.createElement('div');\n            div.innerHTML = _this.instantiateToString(object);\n            resolve(div);\n        });\n    };\n    return DefaultRecommendationTemplate;\n}(Template_1.Template));\nexports.DefaultRecommendationTemplate = DefaultRecommendationTemplate;\n\n\n/***/ }),\n\n/***/ 473:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n    return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n    function verb(n) { return function (v) { return step([n, v]); }; }\n    function step(op) {\n        if (f) throw new TypeError(\"Generator is already executing.\");\n        while (_) try {\n            if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n            if (y = 0, t) op = [0, t.value];\n            switch (op[0]) {\n                case 0: case 1: t = op; break;\n                case 4: _.label++; return { value: op[1], done: false };\n                case 5: _.label++; y = op[1]; op = [0]; continue;\n                case 7: op = _.ops.pop(); _.trys.pop(); continue;\n                default:\n                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n                    if (t[2]) _.ops.pop();\n                    _.trys.pop(); continue;\n            }\n            op = body.call(thisArg, _);\n        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n    }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Core_1 = __webpack_require__(20);\nvar ResultList_1 = __webpack_require__(93);\nvar underscore_1 = __webpack_require__(0);\nvar Dom_1 = __webpack_require__(1);\nvar Logger_1 = __webpack_require__(9);\nvar TemplateToHtml = /** @class */ (function () {\n    function TemplateToHtml(args) {\n        this.args = args;\n    }\n    TemplateToHtml.prototype.buildResults = function (results, layout, currentlyDisplayedResults) {\n        return __awaiter(this, void 0, void 0, function () {\n            var _this = this;\n            var res, resultsPromises;\n            return __generator(this, function (_a) {\n                res = [];\n                resultsPromises = underscore_1.map(results.results, function (result, index) {\n                    return _this.buildResult(result, layout, currentlyDisplayedResults).then(function (resultElement) {\n                        if (resultElement != null) {\n                            res.push({ elem: resultElement, idx: index });\n                        }\n                        ResultList_1.ResultList.resultCurrentlyBeingRendered = null;\n                        return resultElement;\n                    });\n                });\n                // We need to sort by the original index order, because in lazy loading mode, it's possible that results does not gets rendered\n                // in the correct order returned by the index, depending on the time it takes to load all the results component for a given result template\n                return [2 /*return*/, Promise.all(resultsPromises).then(function () {\n                        return underscore_1.pluck(underscore_1.sortBy(res, 'idx'), 'elem');\n                    })];\n            });\n        });\n    };\n    TemplateToHtml.prototype.buildResult = function (result, layout, currentlyDisplayedResults) {\n        return __awaiter(this, void 0, void 0, function () {\n            var resultElement;\n            return __generator(this, function (_a) {\n                switch (_a.label) {\n                    case 0:\n                        Core_1.Assert.exists(result);\n                        Core_1.QueryUtils.setStateObjectOnQueryResult(this.args.queryStateModel.get(), result);\n                        Core_1.QueryUtils.setSearchInterfaceObjectOnQueryResult(this.args.searchInterface, result);\n                        ResultList_1.ResultList.resultCurrentlyBeingRendered = result;\n                        return [4 /*yield*/, this.createHtmlElement(result, layout)];\n                    case 1:\n                        resultElement = _a.sent();\n                        if (resultElement != null) {\n                            Core_1.Component.bindResultToElement(resultElement, result);\n                        }\n                        currentlyDisplayedResults.push(result);\n                        return [4 /*yield*/, this.autoCreateComponentsInsideResult(resultElement, result).initResult];\n                    case 2:\n                        _a.sent();\n                        this.verifyChildren(resultElement);\n                        return [2 /*return*/, resultElement];\n                }\n            });\n        });\n    };\n    TemplateToHtml.prototype.autoCreateComponentsInsideResult = function (element, result) {\n        Core_1.Assert.exists(element);\n        return Core_1.Initialization.automaticallyCreateComponentsInsideResult(element, result);\n    };\n    TemplateToHtml.prototype.createHtmlElement = function (result, layout) {\n        return this.args.resultTemplate.instantiateToElement(result, {\n            wrapInDiv: true,\n            checkCondition: true,\n            currentLayout: layout,\n            responsiveComponents: this.args.searchInterface.responsiveComponents\n        });\n    };\n    TemplateToHtml.prototype.verifyChildren = function (element) {\n        var containsResultLink = !!Dom_1.$$(element).find('.CoveoResultLink');\n        if (containsResultLink) {\n            return;\n        }\n        var msg = \"Result does not contain a \\\"CoveoResultLink\\\" component, please verify the result template\";\n        new Logger_1.Logger(element).warn(msg, this.args.resultTemplate);\n    };\n    return TemplateToHtml;\n}());\nexports.TemplateToHtml = TemplateToHtml;\n\n\n/***/ }),\n\n/***/ 474:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n    for (var s, i = 1, n = arguments.length; i < n; i++) {\n        s = arguments[i];\n        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n            t[p] = s[p];\n    }\n    return t;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar TemplateHelpers_1 = __webpack_require__(122);\nvar HighlightUtils_1 = __webpack_require__(69);\nvar DateUtils_1 = __webpack_require__(33);\nvar CurrencyUtils_1 = __webpack_require__(134);\nvar HtmlUtils_1 = __webpack_require__(179);\nvar Utils_1 = __webpack_require__(4);\nvar StringUtils_1 = __webpack_require__(22);\nvar TimeSpanUtils_1 = __webpack_require__(73);\nvar EmailUtils_1 = __webpack_require__(178);\nvar QueryUtils_1 = __webpack_require__(21);\nvar DeviceUtils_1 = __webpack_require__(24);\nvar Dom_1 = __webpack_require__(1);\nvar SearchEndpoint_1 = __webpack_require__(53);\nvar StreamHighlightUtils_1 = __webpack_require__(120);\nvar FacetUtils_1 = __webpack_require__(40);\nvar Globalize = __webpack_require__(23);\nvar _ = __webpack_require__(0);\nvar Component_1 = __webpack_require__(7);\nvar TemplateCache_1 = __webpack_require__(68);\nvar CoreHelpers = /** @class */ (function () {\n    function CoreHelpers() {\n    }\n    /**\n     * For backward compatibility reason, the \"global\" template helper should be available under the\n     * coveo namespace.\n     * @param scope\n     */\n    CoreHelpers.exportAllHelpersGlobally = function (scope) {\n        _.each(TemplateHelpers_1.TemplateHelpers.getHelpers(), function (helper, name) {\n            if (scope[name] == undefined) {\n                scope[name] = helper;\n            }\n        });\n    };\n    return CoreHelpers;\n}());\nexports.CoreHelpers = CoreHelpers;\nTemplateHelpers_1.TemplateHelpers.registerFieldHelper('javascriptEncode', function (value) {\n    return Utils_1.Utils.exists(value) ? StringUtils_1.StringUtils.javascriptEncode(value) : undefined;\n});\nvar executeShorten = function (content, options) {\n    var strAndHoles = HighlightUtils_1.StringAndHoles.shortenString(content, options.length, '...');\n    if (Utils_1.Utils.exists(options.highlights)) {\n        return HighlightUtils_1.HighlightUtils.highlightString(strAndHoles.value, options.highlights, strAndHoles.holes, options.cssClass || 'highlight');\n    }\n    else {\n        return strAndHoles.value;\n    }\n};\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('shorten', function (content, length, highlights, cssClass) {\n    return executeShorten(content, {\n        length: length,\n        highlights: highlights,\n        cssClass: cssClass\n    });\n});\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('shortenv2', function (content, options) {\n    return executeShorten(content, options);\n});\nvar executeShortenPath = function (content, options) {\n    var strAndHoles = HighlightUtils_1.StringAndHoles.shortenPath(content, options.length);\n    if (Utils_1.Utils.exists(options.highlights)) {\n        return HighlightUtils_1.HighlightUtils.highlightString(strAndHoles.value, options.highlights, strAndHoles.holes, options.cssClass || 'highlight');\n    }\n    else {\n        return strAndHoles.value;\n    }\n};\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('shortenPath', function (content, length, highlights, cssClass) {\n    return executeShortenPath(content, {\n        length: length,\n        highlights: highlights,\n        cssClass: cssClass\n    });\n});\nTemplateHelpers_1.TemplateHelpers.registerFieldHelper('shortenPathv2', function (content, options) {\n    return executeShortenPath(content, options);\n});\nvar executeShortenUri = function (content, options) {\n    var strAndHoles = HighlightUtils_1.StringAndHoles.shortenUri(content, options.length);\n    if (Utils_1.Utils.exists(options.highlights)) {\n        return HighlightUtils_1.HighlightUtils.highlightString(strAndHoles.value, options.highlights, strAndHoles.holes, options.cssClass || 'highlight');\n    }\n    else {\n        return strAndHoles.value;\n    }\n};\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('shortenUri', function (content, length, highlights, cssClass) {\n    return executeShortenUri(content, {\n        length: length,\n        highlights: highlights,\n        cssClass: cssClass\n    });\n});\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('shortenUriv2', function (content, options) {\n    return executeShortenUri(content, options);\n});\nvar executeHighlight = function (content, options) {\n    if (Utils_1.Utils.exists(content)) {\n        if (Utils_1.Utils.exists(options.highlights)) {\n            return HighlightUtils_1.HighlightUtils.highlightString(content, options.highlights, null, options.cssClass || 'highlight');\n        }\n        else {\n            return content;\n        }\n    }\n    else {\n        return undefined;\n    }\n};\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('highlight', function (content, highlights, cssClass) {\n    return executeHighlight(content, {\n        highlights: highlights,\n        cssClass: cssClass\n    });\n});\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('highlightv2', function (content, options) {\n    return executeHighlight(content, options);\n});\nvar executeHighlightStreamText = function (content, options) {\n    if (Utils_1.Utils.exists(content) && Utils_1.Utils.exists(options.termsToHighlight) && Utils_1.Utils.exists(options.phrasesToHighlight)) {\n        if (termsToHighlightAreDefined(options.termsToHighlight, options.phrasesToHighlight)) {\n            return StreamHighlightUtils_1.StreamHighlightUtils.highlightStreamText(content, options.termsToHighlight, options.phrasesToHighlight, options.opts);\n        }\n        else {\n            return content;\n        }\n    }\n    else {\n        return undefined;\n    }\n};\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('highlightStreamText', function (content, termsToHighlight, phrasesToHighlight, opts) {\n    if (termsToHighlight === void 0) { termsToHighlight = resolveTermsToHighlight(); }\n    if (phrasesToHighlight === void 0) { phrasesToHighlight = resolvePhrasesToHighlight(); }\n    return executeHighlightStreamText(content, {\n        termsToHighlight: termsToHighlight,\n        phrasesToHighlight: phrasesToHighlight,\n        opts: opts\n    });\n});\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('highlightStreamTextv2', function (content, options) {\n    var mergedOptions = __assign({ termsToHighlight: resolveTermsToHighlight(), phrasesToHighlight: resolvePhrasesToHighlight() }, options);\n    return executeHighlightStreamText(content, mergedOptions);\n});\nvar executeHighlightStreamHTML = function (content, options) {\n    if (Utils_1.Utils.exists(content) && Utils_1.Utils.exists(options.termsToHighlight) && Utils_1.Utils.exists(options.phrasesToHighlight)) {\n        if (termsToHighlightAreDefined(options.termsToHighlight, options.phrasesToHighlight)) {\n            return StreamHighlightUtils_1.StreamHighlightUtils.highlightStreamHTML(content, options.termsToHighlight, options.phrasesToHighlight, options.opts);\n        }\n        else {\n            return content;\n        }\n    }\n    else {\n        return undefined;\n    }\n};\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('highlightStreamHTML', function (content, termsToHighlight, phrasesToHighlight, opts) {\n    if (termsToHighlight === void 0) { termsToHighlight = resolveTermsToHighlight(); }\n    if (phrasesToHighlight === void 0) { phrasesToHighlight = resolvePhrasesToHighlight(); }\n    return executeHighlightStreamHTML(content, {\n        termsToHighlight: termsToHighlight,\n        phrasesToHighlight: phrasesToHighlight,\n        opts: opts\n    });\n});\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('highlightStreamHTMLv2', function (content, options) {\n    var mergedOptions = __assign({ termsToHighlight: resolveTermsToHighlight(), phrasesToHighlight: resolvePhrasesToHighlight() }, options);\n    return executeHighlightStreamHTML(content, mergedOptions);\n});\nTemplateHelpers_1.TemplateHelpers.registerFieldHelper('number', function (value, options) {\n    if (!Utils_1.Utils.exists(value)) {\n        return undefined;\n    }\n    var numberValue = Number(value);\n    var format = _.isString(options) ? options : options && options.format;\n    if (!format) {\n        return StringUtils_1.StringUtils.htmlEncode(numberValue.toString());\n    }\n    return StringUtils_1.StringUtils.htmlEncode(Globalize.format(numberValue, format));\n});\nTemplateHelpers_1.TemplateHelpers.registerFieldHelper('date', function (value, options) {\n    return DateUtils_1.DateUtils.dateToString(DateUtils_1.DateUtils.convertFromJsonDateIfNeeded(value), options);\n});\nTemplateHelpers_1.TemplateHelpers.registerFieldHelper('time', function (value, options) {\n    return DateUtils_1.DateUtils.timeToString(DateUtils_1.DateUtils.convertFromJsonDateIfNeeded(value), options);\n});\nTemplateHelpers_1.TemplateHelpers.registerFieldHelper('dateTime', function (value, options) {\n    return DateUtils_1.DateUtils.dateTimeToString(DateUtils_1.DateUtils.convertFromJsonDateIfNeeded(value), options);\n});\nTemplateHelpers_1.TemplateHelpers.registerFieldHelper('emailDateTime', function (value, options) {\n    var defaultOptions = {};\n    defaultOptions.includeTimeIfThisWeek = true;\n    var optionsToUse = _.extend(options, defaultOptions);\n    return value ? DateUtils_1.DateUtils.dateTimeToString(DateUtils_1.DateUtils.convertFromJsonDateIfNeeded(value), optionsToUse) : undefined;\n});\nTemplateHelpers_1.TemplateHelpers.registerFieldHelper('currency', function (value, options) {\n    return CurrencyUtils_1.CurrencyUtils.currencyToString(value, options);\n});\nTemplateHelpers_1.TemplateHelpers.registerFieldHelper('timeSpan', function (value, options) {\n    if (options === void 0) { options = { isMilliseconds: false }; }\n    return new TimeSpanUtils_1.TimeSpan(value, options.isMilliseconds).getHHMMSS();\n});\nTemplateHelpers_1.TemplateHelpers.registerFieldHelper('email', function (value) {\n    var args = [];\n    for (var _i = 1; _i < arguments.length; _i++) {\n        args[_i - 1] = arguments[_i];\n    }\n    // support old arguments (value: any, companyDomain: string, me: string, lengthLimit = 2, truncateName = false)\n    var companyDomain;\n    var me;\n    var lengthLimit;\n    var truncateName;\n    if (_.isObject(args[0])) {\n        companyDomain = args[0]['companyDomain'];\n        me = args[0]['me'];\n        lengthLimit = args[0]['lengthLimit'];\n        truncateName = args[0]['truncateName'];\n    }\n    else {\n        companyDomain = args[0];\n        me = args[1];\n        lengthLimit = args[2];\n        truncateName = args[3];\n    }\n    if (lengthLimit == undefined) {\n        lengthLimit = 2;\n    }\n    if (truncateName == undefined) {\n        truncateName = false;\n    }\n    if (_.isString(value)) {\n        var listOfAddresses = EmailUtils_1.EmailUtils.splitSemicolonSeparatedListOfEmailAddresses(value);\n        return EmailUtils_1.EmailUtils.emailAddressesToHyperlinks(listOfAddresses, companyDomain, me, lengthLimit, truncateName);\n    }\n    else if (_.isArray(value)) {\n        return EmailUtils_1.EmailUtils.emailAddressesToHyperlinks(value, companyDomain, me, lengthLimit, truncateName);\n    }\n    else {\n        return undefined;\n    }\n});\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('excessEmailToggle', function (target) {\n    Dom_1.$$(target).removeClass('coveo-active');\n    if (Dom_1.$$(target).hasClass('coveo-emails-excess-collapsed')) {\n        _.each(Dom_1.$$(target).siblings('.coveo-emails-excess-expanded'), function (sibling) {\n            Dom_1.$$(sibling).addClass('coveo-active');\n        });\n    }\n    else if (Dom_1.$$(target).hasClass('coveo-hide-expanded')) {\n        Dom_1.$$(target.parentElement).addClass('coveo-inactive');\n        _.each(Dom_1.$$(target.parentElement).siblings('.coveo-emails-excess-collapsed'), function (sibling) {\n            Dom_1.$$(sibling).addClass('coveo-active');\n        });\n    }\n    return undefined;\n});\nTemplateHelpers_1.TemplateHelpers.registerFieldHelper('anchor', function (href, options) {\n    return HtmlUtils_1.AnchorUtils.buildAnchor(href, options);\n});\nTemplateHelpers_1.TemplateHelpers.registerFieldHelper('image', function (src, options, result) {\n    if (result === void 0) { result = resolveQueryResult(); }\n    if (options && options.srcTemplate) {\n        return HtmlUtils_1.ImageUtils.buildImage(StringUtils_1.StringUtils.buildStringTemplateFromResult(options.srcTemplate, result), {\n            alt: options.alt,\n            height: options.height,\n            width: options.width\n        });\n    }\n    return HtmlUtils_1.ImageUtils.buildImage(src, options);\n});\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('thumbnail', function (result, endpoint, options) {\n    if (result === void 0) { result = resolveQueryResult(); }\n    if (endpoint === void 0) { endpoint = 'default'; }\n    if (QueryUtils_1.QueryUtils.hasThumbnail(result)) {\n        return HtmlUtils_1.ImageUtils.buildImageFromResult(result, SearchEndpoint_1.SearchEndpoint.endpoints[endpoint], options);\n    }\n});\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('fromFileTypeToIcon', function (result, options) {\n    if (result === void 0) { result = resolveQueryResult(); }\n    if (options === void 0) { options = {}; }\n    var icon = Component_1.Component.getComponentRef('Icon');\n    if (icon) {\n        return icon.createIcon(result, options).outerHTML;\n    }\n});\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('attrEncode', function (value) {\n    return ('' + value) /* Forces the conversion to string. */\n        .replace(/&/g, '&amp;') /* This MUST be the 1st replacement. */\n        .replace(/'/g, '&apos;') /* The 4 other predefined entities, required. */\n        .replace(/'/g, '&quot;')\n        .replace(/</g, '&lt;')\n        .replace(/>/g, '&gt;');\n});\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('loadTemplates', function (templatesToLoad, once) {\n    if (once === void 0) { once = true; }\n    var ret = '';\n    var data = resolveQueryResult();\n    var atLeastOneWasLoaded = false;\n    var toLoad = templatesToLoad;\n    var defaultTmpl;\n    _.each(templatesToLoad, function (value, key, obj) {\n        if (value == 'default') {\n            defaultTmpl = key;\n        }\n    });\n    if (defaultTmpl != undefined) {\n        toLoad = _.omit(templatesToLoad, defaultTmpl);\n    }\n    _.each(toLoad, function (condition, id, obj) {\n        if (!atLeastOneWasLoaded || !once) {\n            atLeastOneWasLoaded = atLeastOneWasLoaded || condition;\n            ret += TemplateHelpers_1.TemplateHelpers.getHelper('loadTemplate')(id, condition, data);\n        }\n    });\n    if (!atLeastOneWasLoaded && defaultTmpl != undefined) {\n        ret += TemplateHelpers_1.TemplateHelpers.getHelper('loadTemplate')(defaultTmpl, true, data);\n    }\n    return ret;\n});\nvar byteMeasure = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'];\nTemplateHelpers_1.TemplateHelpers.registerFieldHelper('size', function (value, options) {\n    var size = parseInt(value, 10);\n    var precision = options != null && options.precision != null ? options.precision : 2;\n    var base = options != null && options.base != null ? options.base : 0;\n    while (size > 1024 && base + 1 < byteMeasure.length) {\n        size /= 1024;\n        base++;\n    }\n    size = Math.floor(size * Math.pow(10, precision)) / Math.pow(10, precision);\n    return size + ' ' + byteMeasure[base];\n});\nTemplateHelpers_1.TemplateHelpers.registerFieldHelper('translatedCaption', function (value) {\n    return FacetUtils_1.FacetUtils.tryToGetTranslatedCaption('@filetype', value);\n});\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('loadTemplate', function (id, condition, data) {\n    if (condition === void 0) { condition = true; }\n    if (Utils_1.Utils.isNullOrUndefined(data)) {\n        data = resolveQueryResult();\n    }\n    if (condition) {\n        return TemplateCache_1.TemplateCache.getTemplate(id).instantiateToString(data, {\n            checkCondition: false\n        });\n    }\n    return '';\n});\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('encodeCarriageReturn', function (data) {\n    if (Utils_1.Utils.isNullOrUndefined(data)) {\n        return undefined;\n    }\n    else {\n        return StringUtils_1.StringUtils.encodeCarriageReturn(data);\n    }\n});\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('isMobileDevice', function () {\n    return DeviceUtils_1.DeviceUtils.isMobileDevice() ? DeviceUtils_1.DeviceUtils.getDeviceName() : null;\n});\nTemplateHelpers_1.TemplateHelpers.registerTemplateHelper('pluralHelper', function (count, options) {\n    return count > 1 ? options.plural : options.singular;\n});\nfunction resolveQueryResult() {\n    var found;\n    var resultList = Component_1.Component.getComponentRef('ResultList');\n    if (resultList) {\n        found = resultList.resultCurrentlyBeingRendered;\n    }\n    if (!found) {\n        var quickview = Component_1.Component.getComponentRef('Quickview');\n        if (quickview) {\n            found = quickview.resultCurrentlyBeingRendered;\n        }\n    }\n    return found;\n}\nfunction resolveTermsToHighlight() {\n    var currentQueryResult = resolveQueryResult();\n    if (currentQueryResult) {\n        return currentQueryResult.termsToHighlight;\n    }\n}\nfunction resolvePhrasesToHighlight() {\n    var currentQueryResult = resolveQueryResult();\n    if (currentQueryResult) {\n        return currentQueryResult.phrasesToHighlight;\n    }\n}\nfunction termsToHighlightAreDefined(termsToHighlight, phrasesToHighlight) {\n    return Utils_1.Utils.isNonEmptyArray(_.keys(termsToHighlight)) || Utils_1.Utils.isNonEmptyArray(_.keys(phrasesToHighlight));\n}\n\n\n/***/ }),\n\n/***/ 475:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar underscore_1 = __webpack_require__(0);\nvar Dom_1 = __webpack_require__(1);\nfunction bindAnalyticsToLink(element, logAnalytics) {\n    var executeOnlyOnce = underscore_1.once(function () { return logAnalytics(); });\n    Dom_1.$$(element).on(['contextmenu', 'click', 'mousedown', 'mouseup'], executeOnlyOnce);\n    var longPressTimer;\n    Dom_1.$$(element).on('touchstart', function () {\n        longPressTimer = window.setTimeout(executeOnlyOnce, 1000);\n    });\n    Dom_1.$$(element).on('touchend', function () {\n        if (longPressTimer) {\n            clearTimeout(longPressTimer);\n        }\n    });\n}\nexports.bindAnalyticsToLink = bindAnalyticsToLink;\n\n\n/***/ }),\n\n/***/ 510:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * Those are the string definitions of events for ResultPreviewsManager.\n *\n * Those events should be bound to the element returned by `resolveRoot`.\n */\nvar ResultPreviewsManagerEvents = /** @class */ (function () {\n    function ResultPreviewsManagerEvents() {\n    }\n    /**\n     * Executed when building a query to fetch result previews.\n     * This always receives {@link IBuildingResultPreviewsQueryEventArgs} as arguments.\n     */\n    ResultPreviewsManagerEvents.buildingResultPreviewsQuery = 'buildingResultPreviewsQuery';\n    /**\n     * Executed when a {@link Suggestion} is focused before {@link PopulateSearchResultPreviews} is called to fetch more options.\n     * This always receives {@link IUpdateResultPreviewsManagerOptionsEventArgs} as arguments.\n     */\n    ResultPreviewsManagerEvents.updateResultPreviewsManagerOptions = 'updateResultPreviewsManagerOptions';\n    /**\n     * Executed when a {@link Suggestion} is focused and waiting for search result previews.\n     * This always receives {@link IPopulateSearchResultPreviewsEventArgs} as arguments.\n     */\n    ResultPreviewsManagerEvents.populateSearchResultPreviews = 'populateSearchResultPreviews';\n    return ResultPreviewsManagerEvents;\n}());\nexports.ResultPreviewsManagerEvents = ResultPreviewsManagerEvents;\n\n\n/***/ }),\n\n/***/ 528:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ }),\n\n/***/ 529:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ }),\n\n/***/ 530:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ }),\n\n/***/ 531:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ResponsiveComponentsManager_1 = __webpack_require__(62);\nvar SearchInterface_1 = __webpack_require__(19);\nvar ResultList_1 = __webpack_require__(93);\nvar Dom_1 = __webpack_require__(1);\nvar Component_1 = __webpack_require__(7);\nvar Logger_1 = __webpack_require__(9);\nvar ResponsiveDefaultResultTemplate = /** @class */ (function () {\n    function ResponsiveDefaultResultTemplate(coveoRoot, ID, options, responsiveDropdown) {\n        this.coveoRoot = coveoRoot;\n        this.ID = ID;\n        this.searchInterface = Component_1.Component.get(this.coveoRoot.el, SearchInterface_1.SearchInterface, false);\n        this.currentMode = 'large';\n    }\n    ResponsiveDefaultResultTemplate.init = function (root, component, options) {\n        if (!Dom_1.$$(root).find(\".\" + Component_1.Component.computeCssClassName(ResultList_1.ResultList))) {\n            var logger = new Logger_1.Logger('ResponsiveDefaultResultTemplate');\n            logger.trace('No ResultLayout component found : Cannot instantiate ResponsiveResultLayout');\n            return;\n        }\n        ResponsiveComponentsManager_1.ResponsiveComponentsManager.register(ResponsiveDefaultResultTemplate, Dom_1.$$(root), ResultList_1.ResultList.ID, component, options);\n    };\n    ResponsiveDefaultResultTemplate.prototype.registerComponent = function (accept) {\n        if (accept instanceof ResultList_1.ResultList) {\n            this.resultList = accept;\n            return true;\n        }\n        return false;\n    };\n    ResponsiveDefaultResultTemplate.prototype.handleResizeEvent = function () {\n        var _this = this;\n        var lastResults = this.resultList.queryController.getLastResults();\n        if (this.needSmallMode()) {\n            Dom_1.$$(this.resultList.options.resultsContainer).addClass('coveo-card-layout-container');\n            Dom_1.$$(this.resultList.options.resultsContainer).removeClass(\"coveo-list-layout-container\");\n            if (this.currentMode != 'small') {\n                if (lastResults) {\n                    this.resultList.buildResults(lastResults).then(function (elements) {\n                        _this.resultList.renderResults(elements);\n                    });\n                }\n                this.currentMode = 'small';\n            }\n        }\n        else {\n            Dom_1.$$(this.resultList.options.resultsContainer).removeClass('coveo-card-layout-container');\n            Dom_1.$$(this.resultList.options.resultsContainer).addClass(\"coveo-list-layout-container\");\n            if (this.currentMode != 'large') {\n                if (lastResults) {\n                    this.resultList.buildResults(lastResults).then(function (elements) {\n                        _this.resultList.renderResults(elements);\n                    });\n                }\n                this.currentMode = 'large';\n            }\n        }\n    };\n    ResponsiveDefaultResultTemplate.prototype.needSmallMode = function () {\n        return this.coveoRoot.width() <= this.searchInterface.responsiveComponents.getSmallScreenWidth();\n    };\n    return ResponsiveDefaultResultTemplate;\n}());\nexports.ResponsiveDefaultResultTemplate = ResponsiveDefaultResultTemplate;\n\n\n/***/ }),\n\n/***/ 532:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Dom_1 = __webpack_require__(1);\nvar ResultContainer = /** @class */ (function () {\n    function ResultContainer(resultContainer, searchInterface) {\n        this.searchInterface = searchInterface;\n        this.resultContainerElement = Dom_1.$$(resultContainer);\n    }\n    ResultContainer.prototype.empty = function () {\n        this.searchInterface.detachComponentsInside(this.resultContainerElement.el);\n        Dom_1.$$(this.resultContainerElement).empty();\n    };\n    ResultContainer.prototype.addClass = function (classToAdd) {\n        this.resultContainerElement.addClass(classToAdd);\n    };\n    ResultContainer.prototype.isEmpty = function () {\n        return this.resultContainerElement.isEmpty();\n    };\n    ResultContainer.prototype.hideChildren = function () {\n        this.resultContainerElement.children().forEach(function (child) { return Dom_1.$$(child).hide(); });\n    };\n    ResultContainer.prototype.getResultElements = function () {\n        return this.resultContainerElement.findAll('.CoveoResult');\n    };\n    Object.defineProperty(ResultContainer.prototype, \"el\", {\n        get: function () {\n            return this.resultContainerElement.el;\n        },\n        enumerable: true,\n        configurable: true\n    });\n    ResultContainer.resultCurrentlyBeingRendered = null;\n    return ResultContainer;\n}());\nexports.ResultContainer = ResultContainer;\n\n\n/***/ }),\n\n/***/ 533:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = Object.setPrototypeOf ||\n        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ResultListRenderer_1 = __webpack_require__(215);\nvar Dom_1 = __webpack_require__(1);\nvar _ = __webpack_require__(0);\nvar ResultListCardRenderer = /** @class */ (function (_super) {\n    __extends(ResultListCardRenderer, _super);\n    function ResultListCardRenderer() {\n        return _super !== null && _super.apply(this, arguments) || this;\n    }\n    ResultListCardRenderer.prototype.getEndFragment = function (resultElements) {\n        var _this = this;\n        return new Promise(function (resolve) {\n            if (!_.isEmpty(resultElements)) {\n                // with infinite scrolling, we want the additional results to append at the end of the previous query.\n                // For this, we need to remove the padding.\n                if (_this.resultListOptions.enableInfiniteScroll) {\n                    var needToBeRemoved = Dom_1.$$(_this.resultListOptions.resultsContainer).findAll('.coveo-card-layout-padding');\n                    _.each(needToBeRemoved, function (toRemove) { return Dom_1.$$(toRemove).remove(); });\n                }\n                // Used to prevent last card from spanning the grid's whole width\n                var emptyCards_1 = document.createDocumentFragment();\n                _.times(3, function () { return emptyCards_1.appendChild(Dom_1.$$('div', { className: 'coveo-card-layout coveo-card-layout-padding' }).el); });\n                resolve(emptyCards_1);\n            }\n            resolve(null);\n        });\n    };\n    return ResultListCardRenderer;\n}(ResultListRenderer_1.ResultListRenderer));\nexports.ResultListCardRenderer = ResultListCardRenderer;\n\n\n/***/ }),\n\n/***/ 534:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = Object.setPrototypeOf ||\n        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n    return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n    function verb(n) { return function (v) { return step([n, v]); }; }\n    function step(op) {\n        if (f) throw new TypeError(\"Generator is already executing.\");\n        while (_) try {\n            if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n            if (y = 0, t) op = [0, t.value];\n            switch (op[0]) {\n                case 0: case 1: t = op; break;\n                case 4: _.label++; return { value: op[1], done: false };\n                case 5: _.label++; y = op[1]; op = [0]; continue;\n                case 7: op = _.ops.pop(); _.trys.pop(); continue;\n                default:\n                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n                    if (t[2]) _.ops.pop();\n                    _.trys.pop(); continue;\n            }\n            op = body.call(thisArg, _);\n        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n    }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ResultListRenderer_1 = __webpack_require__(215);\nvar TableTemplate_1 = __webpack_require__(470);\nvar Dom_1 = __webpack_require__(1);\nvar _ = __webpack_require__(0);\nvar ResultListTableRenderer = /** @class */ (function (_super) {\n    __extends(ResultListTableRenderer, _super);\n    function ResultListTableRenderer(resultListOptions, autoCreateComponentsFn) {\n        var _this = _super.call(this, resultListOptions, autoCreateComponentsFn) || this;\n        _this.resultListOptions = resultListOptions;\n        _this.autoCreateComponentsFn = autoCreateComponentsFn;\n        _this.shouldDisplayHeader = true;\n        _this.shouldDisplayFooter = false;\n        if (_this.resultListOptions.resultTemplate instanceof TableTemplate_1.TableTemplate) {\n            if (_this.resultListOptions.resultTemplate.hasTemplateWithRole('table-footer')) {\n                _this.shouldDisplayFooter = true;\n            }\n            // If custom templates are defined but no header template, do not display it.\n            if (_this.resultListOptions.resultTemplate.templates.length !== 0 &&\n                !_this.resultListOptions.resultTemplate.hasTemplateWithRole('table-header')) {\n                _this.shouldDisplayHeader = false;\n            }\n        }\n        return _this;\n    }\n    ResultListTableRenderer.prototype.getStartFragment = function (resultElements, append) {\n        if (!append && !_.isEmpty(resultElements) && this.shouldDisplayHeader) {\n            return this.renderRoledTemplate('table-header');\n        }\n    };\n    ResultListTableRenderer.prototype.getEndFragment = function (resultElements, append) {\n        if (!append && !_.isEmpty(resultElements) && this.shouldDisplayFooter) {\n            return this.renderRoledTemplate('table-footer');\n        }\n    };\n    ResultListTableRenderer.prototype.renderRoledTemplate = function (role) {\n        return __awaiter(this, void 0, void 0, function () {\n            var elem, frag;\n            return __generator(this, function (_a) {\n                switch (_a.label) {\n                    case 0: return [4 /*yield*/, this.resultListOptions.resultTemplate.instantiateRoleToElement(role)];\n                    case 1:\n                        elem = _a.sent();\n                        Dom_1.$$(elem).addClass(\"coveo-result-list-\" + role);\n                        this.autoCreateComponentsFn(elem, undefined);\n                        frag = document.createDocumentFragment();\n                        frag.appendChild(elem);\n                        return [2 /*return*/, frag];\n                }\n            });\n        });\n    };\n    return ResultListTableRenderer;\n}(ResultListRenderer_1.ResultListRenderer));\nexports.ResultListTableRenderer = ResultListTableRenderer;\n\n\n/***/ }),\n\n/***/ 535:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ }),\n\n/***/ 540:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction isFacetFieldValueCompatible(facet) {\n    return !!facet['isFieldValueCompatible'];\n}\nexports.isFacetFieldValueCompatible = isFacetFieldValueCompatible;\n\n\n/***/ }),\n\n/***/ 703:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ }),\n\n/***/ 71:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = Object.setPrototypeOf ||\n        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n    for (var s, i = 1, n = arguments.length; i < n; i++) {\n        s = arguments[i];\n        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n            t[p] = s[p];\n    }\n    return t;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Component_1 = __webpack_require__(7);\nvar ComponentOptions_1 = __webpack_require__(8);\nvar ComponentOptionsModel_1 = __webpack_require__(28);\nvar AnalyticsActionListMeta_1 = __webpack_require__(10);\nvar ResultListEvents_1 = __webpack_require__(29);\nvar HighlightUtils_1 = __webpack_require__(69);\nvar DeviceUtils_1 = __webpack_require__(24);\nvar OSUtils_1 = __webpack_require__(181);\nvar Initialization_1 = __webpack_require__(2);\nvar QueryUtils_1 = __webpack_require__(21);\nvar Assert_1 = __webpack_require__(5);\nvar Utils_1 = __webpack_require__(4);\nvar Defer_1 = __webpack_require__(31);\nvar Dom_1 = __webpack_require__(1);\nvar StreamHighlightUtils_1 = __webpack_require__(120);\nvar StringUtils_1 = __webpack_require__(22);\nvar underscore_1 = __webpack_require__(0);\nvar GlobalExports_1 = __webpack_require__(3);\n__webpack_require__(535);\nvar AccessibleButton_1 = __webpack_require__(15);\nvar ResultLinkCommon_1 = __webpack_require__(475);\n/**\n * The `ResultLink` component automatically transform a search result title into a clickable link pointing to the\n * original item.\n *\n * This component is a result template component (see [Result Templates](https://docs.coveo.com/en/413/)).\n */\nvar ResultLink = /** @class */ (function (_super) {\n    __extends(ResultLink, _super);\n    /**\n     * Creates a new `ResultLink` component.\n     * @param element The HTMLElement on which to instantiate the component.\n     * @param options The options for the `ResultLink` component.\n     * @param bindings The bindings that the component requires to function normally. If not set, these will be\n     * automatically resolved (with a slower execution time).\n     * @param result The result to associate the component with.\n     * @param os\n     */\n    function ResultLink(element, options, bindings, result, os) {\n        var _this = _super.call(this, element, ResultLink.ID, bindings) || this;\n        _this.element = element;\n        _this.options = options;\n        _this.bindings = bindings;\n        _this.result = result;\n        _this.os = os;\n        _this.logAnalytics = underscore_1.debounce(function () {\n            _this.queryController.saveLastQuery();\n            var documentURL = Dom_1.$$(_this.element).getAttribute('href');\n            if (documentURL == undefined || documentURL == '') {\n                documentURL = _this.escapedClickUri;\n            }\n            if (_this.options.logAnalytics) {\n                _this.options.logAnalytics(documentURL);\n            }\n            else {\n                _this.logDocumentOpen(documentURL);\n            }\n            Defer_1.Defer.flush();\n        }, 1500, true);\n        var globalOptions = _this.searchInterface.options.originalOptionsObject[ResultLink.ID] || {};\n        var initialOptions = ComponentOptions_1.ComponentOptions.initComponentOptions(element, ResultLink, __assign({}, globalOptions, options));\n        var resultLinkOptions = _this.componentOptionsModel.get(ComponentOptionsModel_1.ComponentOptionsModel.attributesEnum.resultLink);\n        _this.options = underscore_1.extend({}, initialOptions, resultLinkOptions);\n        _this.result = result || _this.resolveResult();\n        if (_this.options.openQuickview == null) {\n            _this.options.openQuickview = result.raw['connectortype'] == 'ExchangeCrawler' && DeviceUtils_1.DeviceUtils.isMobileDevice();\n        }\n        if (!_this.element.hasAttribute('tabindex')) {\n            _this.element.setAttribute('tabindex', '0');\n        }\n        Assert_1.Assert.exists(_this.componentOptionsModel);\n        Assert_1.Assert.exists(_this.result);\n        if (!_this.quickviewShouldBeOpened()) {\n            // Bind on multiple \"click\" or \"mouse\" events.\n            // Create a function that will be executed only once, so as not to log multiple events\n            // Once a result link has been opened, and that we log at least one analytics event,\n            // it should not matter if the end user open the same link multiple times with different methods.\n            // It's still only one \"click\" event as far as UA is concerned.\n            // Also need to handle \"longpress\" on mobile (the contextual menu), which we assume to be 1 s long.\n            ResultLinkCommon_1.bindAnalyticsToLink(element, function () { return _this.logAnalytics(); });\n        }\n        _this.renderUri(element, result);\n        _this.bindEventToOpen();\n        return _this;\n    }\n    ResultLink.prototype.renderUri = function (element, result) {\n        if (/^\\s*$/.test(this.element.innerHTML)) {\n            var title = this.getDisplayedTitle();\n            this.element.innerHTML = title;\n            var titleAsText = this.getDisplayedTitleAsText();\n            if (!this.element.hasAttribute('aria-label')) {\n                this.element.setAttribute('aria-label', titleAsText);\n            }\n            if (!this.element.title) {\n                this.element.title = titleAsText;\n            }\n        }\n    };\n    /**\n     * Opens the result in the same window, no matter how the actual component is configured for the end user.\n     * @param logAnalytics Specifies whether the method should log an analytics event.\n     */\n    ResultLink.prototype.openLink = function (logAnalytics) {\n        if (logAnalytics === void 0) { logAnalytics = true; }\n        if (logAnalytics) {\n            this.logAnalytics();\n        }\n        window.location.href = this.getResultUri();\n    };\n    /**\n     * Opens the result in a new window, no matter how the actual component is configured for the end user.\n     * @param logAnalytics Specifies whether the method should log an analytics event.\n     */\n    ResultLink.prototype.openLinkInNewWindow = function (logAnalytics) {\n        if (logAnalytics === void 0) { logAnalytics = true; }\n        if (logAnalytics) {\n            this.logAnalytics();\n        }\n        window.open(this.getResultUri(), '_blank');\n    };\n    /**\n     * Tries to open the result in Microsoft Outlook if the result has an `outlookformacuri` or `outlookuri` field.\n     *\n     * Normally, this implies the result should be a link to an email.\n     *\n     * If the needed fields are not present, this method does nothing.\n     * @param logAnalytics Specifies whether the method should log an analytics event.\n     */\n    ResultLink.prototype.openLinkInOutlook = function (logAnalytics) {\n        if (logAnalytics === void 0) { logAnalytics = true; }\n        if (this.hasOutlookField()) {\n            if (logAnalytics) {\n                this.logAnalytics();\n            }\n            this.openLink();\n        }\n    };\n    /**\n     * Opens the link in the same manner the end user would.\n     *\n     * This essentially simulates a click on the result link.\n     *\n     * @param logAnalytics Specifies whether the method should log an analytics event.\n     */\n    ResultLink.prototype.openLinkAsConfigured = function (logAnalytics) {\n        if (logAnalytics === void 0) { logAnalytics = true; }\n        if (this.toExecuteOnOpen) {\n            if (logAnalytics) {\n                this.logAnalytics();\n            }\n            this.toExecuteOnOpen();\n        }\n    };\n    ResultLink.prototype.bindEventToOpen = function () {\n        return (this.bindOnClickIfNotUndefined() ||\n            this.bindOpenQuickviewIfNotUndefined() ||\n            this.setHrefIfNotAlready() ||\n            this.openLinkThatIsNotAnAnchor());\n    };\n    ResultLink.prototype.getDisplayedTitle = function () {\n        if (!this.options.titleTemplate) {\n            return this.result.title\n                ? HighlightUtils_1.HighlightUtils.highlightString(this.result.title, this.result.titleHighlights, null, 'coveo-highlight')\n                : this.escapedClickUri;\n        }\n        else {\n            var newTitle = StringUtils_1.StringUtils.buildStringTemplateFromResult(this.options.titleTemplate, this.result);\n            return newTitle\n                ? StreamHighlightUtils_1.StreamHighlightUtils.highlightStreamText(newTitle, this.result.termsToHighlight, this.result.phrasesToHighlight)\n                : this.escapedClickUri;\n        }\n    };\n    ResultLink.prototype.getDisplayedTitleAsText = function () {\n        var container = Dom_1.$$('div');\n        container.setHtml(this.getDisplayedTitle());\n        return container.text();\n    };\n    Object.defineProperty(ResultLink.prototype, \"escapedClickUri\", {\n        get: function () {\n            return underscore_1.escape(this.result.clickUri);\n        },\n        enumerable: true,\n        configurable: true\n    });\n    ResultLink.prototype.bindOnClickIfNotUndefined = function () {\n        var _this = this;\n        if (this.options.onClick != undefined) {\n            this.toExecuteOnOpen = function (e) {\n                _this.options.onClick.call(_this, e, _this.result);\n            };\n            new AccessibleButton_1.AccessibleButton()\n                .withElement(this.element)\n                .withLabel(this.result.title)\n                .withSelectAction(function (e) { return _this.toExecuteOnOpen(e); })\n                .build();\n            return true;\n        }\n        else {\n            return false;\n        }\n    };\n    ResultLink.prototype.bindOpenQuickviewIfNotUndefined = function () {\n        var _this = this;\n        if (this.quickviewShouldBeOpened()) {\n            this.toExecuteOnOpen = function () {\n                Dom_1.$$(_this.bindings.resultElement).trigger(ResultListEvents_1.ResultListEvents.openQuickview);\n            };\n            Dom_1.$$(this.element).on('click', function (e) {\n                e.preventDefault();\n                _this.toExecuteOnOpen();\n            });\n            return true;\n        }\n        else {\n            return false;\n        }\n    };\n    ResultLink.prototype.openLinkThatIsNotAnAnchor = function () {\n        var _this = this;\n        if (!this.elementIsAnAnchor()) {\n            this.toExecuteOnOpen = function () {\n                if (_this.options.alwaysOpenInNewWindow) {\n                    if (_this.options.openInOutlook) {\n                        _this.openLinkInOutlook();\n                    }\n                    else {\n                        _this.openLinkInNewWindow();\n                    }\n                }\n                else {\n                    _this.openLink();\n                }\n            };\n            Dom_1.$$(this.element).on('click', function () {\n                _this.toExecuteOnOpen();\n            });\n            return true;\n        }\n        return false;\n    };\n    ResultLink.prototype.setHrefIfNotAlready = function () {\n        // Do not erase any value put in href by the template, etc. Allows\n        // using custom click urls while still keeping analytics recording\n        // and other behavior brought by the component.\n        if (this.elementIsAnAnchor() && !Utils_1.Utils.isNonEmptyString(Dom_1.$$(this.element).getAttribute('href'))) {\n            Dom_1.$$(this.element).setAttribute('href', this.getResultUri());\n            if (this.options.alwaysOpenInNewWindow && !(this.options.openInOutlook && this.hasOutlookField())) {\n                Dom_1.$$(this.element).setAttribute('target', '_blank');\n            }\n            return true;\n        }\n        else {\n            return false;\n        }\n    };\n    ResultLink.prototype.logDocumentOpen = function (href) {\n        this.usageAnalytics.logClickEvent(AnalyticsActionListMeta_1.analyticsActionCauseList.documentOpen, {\n            documentURL: href,\n            documentTitle: this.result.title,\n            author: Utils_1.Utils.getFieldValue(this.result, 'author')\n        }, this.result, this.root);\n    };\n    ResultLink.prototype.filterProtocol = function (uri) {\n        var isAbsolute = /^(https?|ftp|file|mailto|tel|sip):/i.test(uri);\n        var isRelative = /^(\\/|\\.\\/|\\.\\.\\/)/.test(uri);\n        return isAbsolute || isRelative ? uri : '';\n    };\n    ResultLink.prototype.getResultUri = function () {\n        if (this.options.hrefTemplate) {\n            var uri = StringUtils_1.StringUtils.buildStringTemplateFromResult(this.options.hrefTemplate, this.result);\n            return this.filterProtocol(uri);\n        }\n        if (this.options.field == undefined && this.options.openInOutlook) {\n            this.setField();\n        }\n        if (this.options.field != undefined) {\n            return this.filterProtocol(Utils_1.Utils.getFieldValue(this.result, this.options.field));\n        }\n        return this.filterProtocol(this.result.clickUri);\n    };\n    ResultLink.prototype.elementIsAnAnchor = function () {\n        return this.element.tagName == 'A';\n    };\n    ResultLink.prototype.setField = function () {\n        var os = Utils_1.Utils.exists(this.os) ? this.os : OSUtils_1.OSUtils.get();\n        if (os == OSUtils_1.OS_NAME.MACOSX && this.hasOutlookField()) {\n            this.options.field = '@outlookformacuri';\n        }\n        else if (os == OSUtils_1.OS_NAME.WINDOWS && this.hasOutlookField()) {\n            this.options.field = '@outlookuri';\n        }\n    };\n    ResultLink.prototype.hasOutlookField = function () {\n        var os = Utils_1.Utils.exists(this.os) ? this.os : OSUtils_1.OSUtils.get();\n        if (os == OSUtils_1.OS_NAME.MACOSX && this.result.raw['outlookformacuri'] != undefined) {\n            return true;\n        }\n        else if (os == OSUtils_1.OS_NAME.WINDOWS && this.result.raw['outlookuri'] != undefined) {\n            return true;\n        }\n        return false;\n    };\n    ResultLink.prototype.isUriThatMustBeOpenedInQuickview = function () {\n        return this.escapedClickUri.toLowerCase().indexOf('ldap://') == 0;\n    };\n    ResultLink.prototype.quickviewShouldBeOpened = function () {\n        return (this.options.openQuickview || this.isUriThatMustBeOpenedInQuickview()) && QueryUtils_1.QueryUtils.hasHTMLVersion(this.result);\n    };\n    ResultLink.ID = 'ResultLink';\n    ResultLink.doExport = function () {\n        GlobalExports_1.exportGlobally({\n            ResultLink: ResultLink\n        });\n    };\n    /**\n     * The options for the ResultLink\n     * @componentOptions\n     */\n    ResultLink.options = {\n        /**\n         * Specifies the field to use to output the component `href` attribute value.\n         *\n         * **Tip:**\n         * > Instead of specifying a value for the `field` option, you can directly add an `href` attribute to the\n         * > `ResultLink` HTML element. Then, you can use a custom script to generate the `href` value.\n         *\n         * **Examples:**\n         * - With the following markup, the `ResultLink` outputs its `href` value using the `@uri` field (rather than the\n         * default field):\n         *\n         * ```html\n         * <a class=\"CoveoResultLink\" data-field=\"@uri\"></a>\n         * ```\n         *\n         * - In the following result template, the custom `getMyKBUri()` function provides the `href` value:\n         *\n         * ```html\n         * <script id=\"KnowledgeArticle\" type=\"text/underscore\" class=\"result-template\">\n         *   <div class='CoveoIcon>'></div>\n         *   <a class=\"CoveoResultLink\" href=\"<%= getMyKBUri(raw) %>\"></a>\n         *   <div class=\"CoveoExcerpt\"></div>\n         * </script>\n         * ```\n         *\n         * See also [`hrefTemplate`]{@link ResultLink.options.hrefTemplate}, which can override this option.\n         *\n         * By default, the component uses the `@clickUri` field of the item to output the value of its `href` attribute.\n         */\n        field: ComponentOptions_1.ComponentOptions.buildFieldOption(),\n        /**\n         * Specifies whether the component should try to open its link in Microsoft Outlook.\n         *\n         * Setting this option to `true` is normally useful for `ResultLink` instances related to Microsoft Exchange emails.\n         *\n         * If this option is `true`, clicking the `ResultLink` calls the\n         * [`openLinkInOutlook`]{@link ResultLink.openLinkInOutlook} method instead of the\n         * [`openLink`]{@link ResultLink.openLink} method.\n         *\n         * Default value is `false`.\n         */\n        openInOutlook: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: false }),\n        /**\n         * Specifies whether the component should open its link in the [`Quickview`]{@link Quickview} component rather than\n         * loading through the original URL.\n         *\n         * Default value is `false`.\n         */\n        openQuickview: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: false }),\n        /**\n         * Specifies whether the component should open its link in a new window instead of opening it in the current\n         * context.\n         *\n         * If this option is `true`, clicking the `ResultLink` calls the\n         * [`openLinkInNewWindow`]{@link ResultLink.openLinkInNewWindow} method instead of the\n         * [`openLink`]{@link ResultLink.openLink} method.\n         *\n         * **Note:**\n         * > If a search page contains a [`ResultPreferences`]{@link ResultsPreferences} component whose\n         * > [`enableOpenInNewWindow`]{@link ResultsPreferences.options.enableOpenInNewWindow} option is `true`, and the end\n         * > user checks the <b>Always open results in new window</b> box, `ResultLink` components in this page will always\n         * > open their links in a new window when the end user clicks them, no matter what the value of their\n         * > `alwaysOpenInNewWindow` option is.\n         *\n         * Default value is `false`.\n         */\n        alwaysOpenInNewWindow: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: false }),\n        /**\n         * Specifies a template literal from which to generate the `ResultLink` `href` attribute value (see\n         * [Template literals](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals)).\n         *\n         * This option overrides the [`field`]{@link ResultLink.options.field} option value.\n         *\n         * The template literal can reference any number of fields from the parent result. It can also reference global\n         * scope properties.\n         *\n         * **Examples:**\n         *\n         * - The following markup generates an `href` value such as `http://uri.com?id=itemTitle`:\n         *\n         * ```html\n         * <a class='CoveoResultLink' data-href-template='${clickUri}?id=${raw.title}'></a>\n         * ```\n         *\n         * - The following markup generates an `href` value such as `localhost/fooBar`:\n         *\n         * ```html\n         * <a class='CoveoResultLink' data-href-template='${window.location.hostname}/{Foo.Bar}'></a>\n         * ```\n         *\n         * Default value is `undefined`.\n         */\n        hrefTemplate: ComponentOptions_1.ComponentOptions.buildStringOption(),\n        /**\n         * Specifies a template literal from which to generate the `ResultLink` display title (see\n         * [Template literals](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals)).\n         *\n         * This option overrides the default `ResultLink` display title behavior.\n         *\n         * The template literal can reference any number of fields from the parent result. However, if the template literal\n         * references a key whose value is undefined in the parent result fields, the `ResultLink` title displays the\n         * name of this key instead.\n         *\n         * This option is ignored if the `ResultLink` innerHTML contains any value.\n         *\n         * **Examples:**\n         *\n         * - The following markup generates a `ResultLink` display title such as `Case number: 123456` if both the\n         * `raw.objecttype` and `raw.objectnumber` keys are defined in the parent result fields:\n         *\n         * ```html\n         * <a class=\"CoveoResultLink\" data-title-template=\"${raw.objecttype} number: ${raw.objectnumber}\"></a>\n         * ```\n         *\n         * - The following markup generates `${myField}` as a `ResultLink` display title if the `myField` key is undefined\n         * in the parent result fields:\n         *\n         * ```html\n         * <a class=\"CoveoResultLink\" data-title-template=\"${myField}\"></a>\n         * ```\n         *\n         * - The following markup generates `Foobar` as a `ResultLink` display title, because the `ResultLink` innterHTML is\n         * not empty:\n         *\n         * ```html\n         * <a class=\"CoveoResultLink\" data-title-template=\"${will} ${be} ${ignored}\">Foobar</a>\n         * ```\n         *\n         * Default value is `undefined`.\n         *\n         * @availablesince [January 2017 Release (v1.1865.9)](https://docs.coveo.com/en/396/#january-2017-release-v118659)\n         */\n        titleTemplate: ComponentOptions_1.ComponentOptions.buildStringOption(),\n        /**\n         * Specifies an event handler function to execute when the user clicks the `ResultLink` component.\n         *\n         * The handler function takes a JavaScript [`Event`](https://developer.mozilla.org/en/docs/Web/API/Event) object and\n         * an [`IQueryResult`]{@link IQueryResult} as its parameters.\n         *\n         * Overriding the default behavior of the `onClick` event can allow you to execute specific code instead.\n         *\n         * **Note:**\n         * > You cannot set this option directly in the component markup as an HTML attribute. You must either set it in the\n         * > [`init`]{@link init} call of your search interface (see\n         * > [Passing Component Options in the init Call](https://docs.coveo.com/en/346/#passing-component-options-in-the-init-call)),\n         * > or before the `init` call, using the `options` top-level function (see\n         * > [Passing Component Options Before the init Call](https://docs.coveo.com/en/346/#passing-component-options-before-the-init-call)).\n         *\n         * **Example:**\n         * ```javascript\n         * // You can set the option in the 'init' call:\n         * Coveo.init(document.querySelector(\"#search\"), {\n         *   ResultLink : {\n         *     onClick : function(e, result) {\n         *       e.preventDefault();\n         *       // Custom code to execute with the item URI and title.\n         *       openUriInASpecialTab(result.clickUri, result.title);\n         *     }\n         *   }\n         * });\n         *\n         * // Or before the 'init' call, using the 'options' top-level function:\n         * // Coveo.options(document.querySelector('#search'), {\n         * //   ResultLink : {\n         * //     onClick : function(e, result) {\n         * //       e.preventDefault();\n         * //       // Custom code to execute with the item URI and title.\n         * //       openUriInASpecialTab(result.clickUri, result.title);\n         * //     }\n         * //   }\n         * // });\n         * ```\n         */\n        onClick: ComponentOptions_1.ComponentOptions.buildCustomOption(function () {\n            return null;\n        }),\n        /**\n         * Specify this option to log additional analytics when this result link is pressed.\n         *\n         * **Example:**\n         * ```javascript\n         * const resultLink = new Coveo.ResultLink(\n         *   linkElement,\n         *   {\n         *     logAnalytics: (href) => Coveo.logCustomEvent(\n         *         Coveo.analyticsActionCauseList.openSmartSnippetSource,\n         *         {\n         *           searchQueryUid: searchInterface.queryController.lastSearchUid,\n         *           documentTitle: result.title,\n         *           author: Utils.getFieldValue(result, 'author'),\n         *           documentURL: href\n         *         },\n         *         element\n         *       )\n         *   },\n         *   searchInterface.getBindings(),\n         *   result\n         * )\n         * ```\n         */\n        logAnalytics: ComponentOptions_1.ComponentOptions.buildCustomOption(function () { return null; })\n    };\n    return ResultLink;\n}(Component_1.Component));\nexports.ResultLink = ResultLink;\nInitialization_1.Initialization.registerAutoCreateComponent(ResultLink);\n\n\n/***/ }),\n\n/***/ 93:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = Object.setPrototypeOf ||\n        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n    return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n    function verb(n) { return function (v) { return step([n, v]); }; }\n    function step(op) {\n        if (f) throw new TypeError(\"Generator is already executing.\");\n        while (_) try {\n            if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n            if (y = 0, t) op = [0, t.value];\n            switch (op[0]) {\n                case 0: case 1: t = op; break;\n                case 4: _.label++; return { value: op[1], done: false };\n                case 5: _.label++; y = op[1]; op = [0]; continue;\n                case 7: op = _.ops.pop(); _.trys.pop(); continue;\n                default:\n                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n                    if (t[2]) _.ops.pop();\n                    _.trys.pop(); continue;\n            }\n            op = body.call(thisArg, _);\n        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n    }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__webpack_require__(528);\n__webpack_require__(529);\n__webpack_require__(530);\nvar underscore_1 = __webpack_require__(0);\nvar QueryEvents_1 = __webpack_require__(11);\nvar ResultLayoutEvents_1 = __webpack_require__(133);\nvar ResultListEvents_1 = __webpack_require__(29);\nvar GlobalExports_1 = __webpack_require__(3);\nvar Assert_1 = __webpack_require__(5);\nvar Defer_1 = __webpack_require__(31);\nvar Model_1 = __webpack_require__(18);\nvar QueryStateModel_1 = __webpack_require__(13);\nvar DeviceUtils_1 = __webpack_require__(24);\nvar Dom_1 = __webpack_require__(1);\nvar DomUtils_1 = __webpack_require__(97);\nvar Utils_1 = __webpack_require__(4);\nvar AnalyticsActionListMeta_1 = __webpack_require__(10);\nvar Component_1 = __webpack_require__(7);\nvar ComponentOptions_1 = __webpack_require__(8);\nvar Initialization_1 = __webpack_require__(2);\nvar InitializationPlaceholder_1 = __webpack_require__(177);\nvar TemplateComponentOptions_1 = __webpack_require__(63);\nvar ResponsiveDefaultResultTemplate_1 = __webpack_require__(531);\nvar CoreHelpers_1 = __webpack_require__(474);\nvar DefaultRecommendationTemplate_1 = __webpack_require__(472);\nvar DefaultResultTemplate_1 = __webpack_require__(123);\nvar TableTemplate_1 = __webpack_require__(470);\nvar TemplateCache_1 = __webpack_require__(68);\nvar TemplateList_1 = __webpack_require__(96);\nvar ResultContainer_1 = __webpack_require__(532);\nvar ResultListCardRenderer_1 = __webpack_require__(533);\nvar ResultListRenderer_1 = __webpack_require__(215);\nvar ResultListTableRenderer_1 = __webpack_require__(534);\nvar ResultListUtils_1 = __webpack_require__(118);\nvar TemplateToHtml_1 = __webpack_require__(473);\nCoreHelpers_1.CoreHelpers.exportAllHelpersGlobally(window['Coveo']);\n/**\n * The `ResultList` component is responsible for displaying query results by applying one or several result templates\n * (see [Result Templates](https://docs.coveo.com/en/413/)).\n *\n * It is possible to include multiple `ResultList` components along with a single `ResultLayout`\n * component in a search page to provide different result layouts (see\n * [Result Layouts](https://docs.coveo.com/en/360/)).\n *\n * This component supports infinite scrolling (see the\n * [`enableInfiniteScroll`]{@link ResultList.options.enableInfiniteScroll} option).\n */\nvar ResultList = /** @class */ (function (_super) {\n    __extends(ResultList, _super);\n    /**\n     * Creates a new `ResultList` component. Binds various event related to queries (e.g., on querySuccess ->\n     * renderResults). Binds scroll event if the [`enableInfiniteScroll`]{@link ResultList.options.enableInfiniteScroll}\n     * option is `true`.\n     * @param element The HTMLElement on which to instantiate the component.\n     * @param options The options for the `ResultList` component.\n     * @param bindings The bindings that the component requires to function normally. If not set, these will be\n     * automatically resolved (with a slower execution time).\n     * @param elementClassId The class that this component should instantiate. Components that extend the base ResultList\n     * use this. Default value is `CoveoResultList`.\n     */\n    function ResultList(element, options, bindings, elementClassId) {\n        if (elementClassId === void 0) { elementClassId = ResultList.ID; }\n        var _this = _super.call(this, element, elementClassId, bindings) || this;\n        _this.element = element;\n        _this.options = options;\n        _this.bindings = bindings;\n        _this.currentlyDisplayedResults = [];\n        _this.reachedTheEndOfResults = false;\n        _this.disableLayoutChange = false;\n        // This variable serves to block some setup where the framework fails to correctly identify the \"real\" scrolling container.\n        // Since it's not technically feasible to correctly identify the scrolling container in every possible scenario without some very complex logic, we instead try to add some kind of mechanism to\n        // block runaway requests where UI will keep asking more results in the index, eventually bringing the browser to it's knee.\n        // Those successive request are needed in \"displayMoreResults\" to ensure we fill the scrolling container correctly.\n        // Since the container is not identified correctly, it is never \"full\", so we keep asking for more.\n        // It is reset every time the user actually scroll the container manually.\n        _this.successiveScrollCount = 0;\n        _this.options = ComponentOptions_1.ComponentOptions.initComponentOptions(element, ResultList, options);\n        Assert_1.Assert.exists(element);\n        Assert_1.Assert.exists(_this.options);\n        Assert_1.Assert.exists(_this.options.resultTemplate);\n        Assert_1.Assert.exists(_this.options.infiniteScrollContainer);\n        _this.showOrHideElementsDependingOnState(false, false);\n        _this.addListeners();\n        _this.resultContainer = _this.initResultContainer();\n        Assert_1.Assert.exists(_this.options.resultsContainer);\n        _this.initWaitAnimationContainer();\n        Assert_1.Assert.exists(_this.options.waitAnimationContainer);\n        _this.setupTemplatesVersusLayouts();\n        Dom_1.$$(_this.root).on(ResultLayoutEvents_1.ResultLayoutEvents.populateResultLayout, function (e, args) {\n            return args.layouts.push(_this.options.layout);\n        });\n        _this.setupRenderer();\n        _this.makeElementFocusable();\n        _this.ensureHasId();\n        return _this;\n    }\n    ResultList.getDefaultTemplate = function (e) {\n        var template = ResultList.loadTemplatesFromCache();\n        if (template != null) {\n            return template;\n        }\n        var component = Component_1.Component.get(e);\n        if (Coveo['Recommendation'] && component.searchInterface instanceof Coveo['Recommendation']) {\n            return new DefaultRecommendationTemplate_1.DefaultRecommendationTemplate();\n        }\n        return new DefaultResultTemplate_1.DefaultResultTemplate();\n    };\n    ResultList.loadTemplatesFromCache = function () {\n        var pageTemplateNames = TemplateCache_1.TemplateCache.getResultListTemplateNames();\n        if (pageTemplateNames.length > 0) {\n            return new TemplateList_1.TemplateList(underscore_1.compact(underscore_1.map(pageTemplateNames, function (templateName) { return TemplateCache_1.TemplateCache.getTemplate(templateName); })));\n        }\n        return null;\n    };\n    ResultList.prototype.addListeners = function () {\n        var _this = this;\n        this.bind.onRootElement(QueryEvents_1.QueryEvents.newQuery, function (args) { return _this.handleNewQuery(); });\n        this.bind.onRootElement(QueryEvents_1.QueryEvents.buildingQuery, function (args) {\n            return _this.handleBuildingQuery(args);\n        });\n        this.bind.onRootElement(QueryEvents_1.QueryEvents.querySuccess, function (args) {\n            return _this.handleQuerySuccess(args);\n        });\n        this.bind.onRootElement(QueryEvents_1.QueryEvents.fetchMoreSuccess, function (args) {\n            return _this.handleFetchMoreSuccess(args);\n        });\n        this.bind.onRootElement(QueryEvents_1.QueryEvents.duringQuery, function (args) { return _this.handleDuringQuery(); });\n        this.bind.onRootElement(QueryEvents_1.QueryEvents.queryError, function (args) { return _this.handleQueryError(); });\n        Dom_1.$$(this.root).on(ResultListEvents_1.ResultListEvents.changeLayout, function (e, args) { return _this.handleChangeLayout(args); });\n        if (this.options.enableInfiniteScroll) {\n            this.addInfiniteScrollListeners();\n        }\n        else {\n            this.addPagerListeners();\n        }\n    };\n    ResultList.prototype.addInfiniteScrollListeners = function () {\n        var _this = this;\n        this.bind.on(this.options.infiniteScrollContainer, 'scroll', function () {\n            _this.successiveScrollCount = 0;\n            _this.handleScrollOfResultList();\n        });\n        this.bind.onRootElement(QueryEvents_1.QueryEvents.deferredQuerySuccess, function () {\n            setTimeout(function () {\n                _this.scrollToTopIfEnabled();\n            }, 0);\n        });\n    };\n    ResultList.prototype.addPagerListeners = function () {\n        var _this = this;\n        this.bind.onQueryState(Model_1.MODEL_EVENTS.CHANGE_ONE, QueryStateModel_1.QUERY_STATE_ATTRIBUTES.FIRST, function () {\n            _this.bind.oneRootElement(QueryEvents_1.QueryEvents.deferredQuerySuccess, function () {\n                setTimeout(function () {\n                    _this.scrollToTopIfEnabled();\n                }, 0);\n            });\n        });\n    };\n    /**\n     * Get the fields needed to be automatically included in the query for this result list.\n     * @returns {string[]}\n     */\n    ResultList.prototype.getAutoSelectedFieldsToInclude = function () {\n        return underscore_1.chain(this.options.resultTemplate.getFields()).concat(this.getMinimalFieldsToInclude()).compact().unique().value();\n    };\n    ResultList.prototype.setupTemplatesVersusLayouts = function () {\n        var _this = this;\n        var layoutClassToAdd = \"coveo-\" + this.options.layout + \"-layout-container\";\n        this.resultContainer.addClass(layoutClassToAdd);\n        if (this.options.layout === 'table') {\n            this.options.resultTemplate = new TableTemplate_1.TableTemplate(this.options.resultTemplate.templates || []);\n        }\n        // A TemplateList is the scenario where the result template are directly embedded inside the ResultList\n        // This is the typical scenario when a page gets created by the interface editor, for example.\n        // In that case, we try to stick closely that what is actually configured inside the page, and do no \"special magic\".\n        // Stick to the \"hardcoded\" configuration present in the page.\n        // We only add the correct layout options if it has not been set manually.\n        if (this.options.resultTemplate instanceof TemplateList_1.TemplateList) {\n            underscore_1.each(this.options.resultTemplate.templates, function (tmpl) {\n                if (!tmpl.layout) {\n                    tmpl.layout = _this.options.layout;\n                }\n            });\n        }\n        else if (this.options.resultTemplate instanceof DefaultResultTemplate_1.DefaultResultTemplate && this.options.layout == 'list') {\n            ResponsiveDefaultResultTemplate_1.ResponsiveDefaultResultTemplate.init(this.root, this, {});\n        }\n    };\n    /**\n     * Empties the current result list content and appends the given array of HTMLElement.\n     *\n     * Can append to existing elements in the result list, or replace them.\n     *\n     * Triggers the `newResultsDisplayed` and `newResultDisplayed` events.\n     * @param resultsElement\n     * @param append\n     */\n    ResultList.prototype.renderResults = function (resultElements, append) {\n        var _this = this;\n        if (append === void 0) { append = false; }\n        if (!append) {\n            this.resultContainer.empty();\n        }\n        return this.renderer\n            .renderResults(resultElements, append, this.triggerNewResultDisplayed.bind(this))\n            .then(function () { return _this.triggerNewResultsDisplayed(); });\n    };\n    /**\n     * Builds and returns an array of HTMLElement with the given result set.\n     * @param results the result set to build an array of HTMLElement from.\n     */\n    ResultList.prototype.buildResults = function (results) {\n        var layout = this.options.layout;\n        return this.templateToHtml.buildResults(results, layout, this.currentlyDisplayedResults);\n    };\n    /**\n     * Builds and returns an HTMLElement for the given result.\n     * @param result the result to build an HTMLElement from.\n     * @returns {HTMLElement}\n     */\n    ResultList.prototype.buildResult = function (result) {\n        var layout = this.options.layout;\n        return this.templateToHtml.buildResult(result, layout, this.currentlyDisplayedResults);\n    };\n    /**\n     * Executes a query to fetch new results. After the query returns, renders the new results.\n     *\n     * Asserts that there are more results to display by verifying whether the last query has returned as many results as\n     * requested.\n     *\n     * Asserts that the `ResultList` is not currently fetching results.\n     * @param count The number of results to fetch and display.\n     */\n    ResultList.prototype.displayMoreResults = function (count) {\n        Assert_1.Assert.isLargerOrEqualsThan(1, count);\n        if (this.isCurrentlyFetchingMoreResults()) {\n            this.logger.warn(\"Ignoring request to display more results since we're already doing so\");\n            return;\n        }\n        if (!this.hasPotentiallyMoreResultsToDisplay()) {\n            this.logger.warn(\"Ignoring request to display more results since we know there aren't more to display\");\n            return;\n        }\n        if (this.options.enableInfiniteScrollWaitingAnimation) {\n            this.showWaitingAnimationForInfiniteScrolling();\n        }\n        return this.fetchAndRenderMoreResults(count);\n    };\n    Object.defineProperty(ResultList.prototype, \"templateToHtml\", {\n        get: function () {\n            var templateToHtmlArgs = {\n                resultTemplate: this.options.resultTemplate,\n                searchInterface: this.searchInterface,\n                queryStateModel: this.queryStateModel\n            };\n            return new TemplateToHtml_1.TemplateToHtml(templateToHtmlArgs);\n        },\n        enumerable: true,\n        configurable: true\n    });\n    /**\n     * Gets the list of currently displayed result.\n     * @returns {IQueryResult[]}\n     */\n    ResultList.prototype.getDisplayedResults = function () {\n        return this.currentlyDisplayedResults;\n    };\n    /**\n     * Gets the list of currently displayed result HTMLElement.\n     * @returns {HTMLElement[]}\n     */\n    ResultList.prototype.getDisplayedResultsElements = function () {\n        return this.resultContainer.getResultElements();\n    };\n    ResultList.prototype.enable = function () {\n        this.disableLayoutChange = false;\n        if (this.resultLayoutSelectors.length > 0) {\n            this.enableBasedOnActiveLayouts();\n        }\n        else {\n            _super.prototype.enable.call(this);\n            Dom_1.$$(this.element).removeClass('coveo-hidden');\n        }\n    };\n    ResultList.prototype.disable = function () {\n        var _this = this;\n        _super.prototype.disable.call(this);\n        var otherLayoutsStillActive = underscore_1.map(this.otherResultLists, function (otherResultList) { return otherResultList.options.layout; });\n        if (!underscore_1.contains(otherLayoutsStillActive, this.options.layout) && !this.disableLayoutChange) {\n            underscore_1.each(this.resultLayoutSelectors, function (resultLayoutSelector) {\n                resultLayoutSelector.disableLayouts([_this.options.layout]);\n            });\n        }\n        this.disableLayoutChange = false;\n        Dom_1.$$(this.element).addClass('coveo-hidden');\n    };\n    ResultList.prototype.autoCreateComponentsInsideResult = function (element, result) {\n        return this.templateToHtml.autoCreateComponentsInsideResult(element, result);\n    };\n    ResultList.prototype.triggerNewResultDisplayed = function (result, resultElement) {\n        var args = {\n            result: result,\n            item: resultElement\n        };\n        Dom_1.$$(this.element).trigger(ResultListEvents_1.ResultListEvents.newResultDisplayed, args);\n    };\n    ResultList.prototype.triggerNewResultsDisplayed = function () {\n        var args = {\n            isInfiniteScrollEnabled: this.options.enableInfiniteScroll\n        };\n        Dom_1.$$(this.element).trigger(ResultListEvents_1.ResultListEvents.newResultsDisplayed, args);\n    };\n    ResultList.prototype.fetchAndRenderMoreResults = function (count) {\n        return __awaiter(this, void 0, void 0, function () {\n            var data, e_1;\n            return __generator(this, function (_a) {\n                switch (_a.label) {\n                    case 0:\n                        this.fetchingMoreResults = this.queryController.fetchMore(count);\n                        _a.label = 1;\n                    case 1:\n                        _a.trys.push([1, 3, , 4]);\n                        return [4 /*yield*/, this.fetchingMoreResults];\n                    case 2:\n                        data = _a.sent();\n                        Assert_1.Assert.exists(data);\n                        this.usageAnalytics.logCustomEvent(AnalyticsActionListMeta_1.analyticsActionCauseList.pagerScrolling, {}, this.element);\n                        this.renderNewResults(data);\n                        this.resetStateAfterFetchingMoreResults();\n                        return [2 /*return*/, data];\n                    case 3:\n                        e_1 = _a.sent();\n                        this.resetStateAfterFetchingMoreResults();\n                        return [2 /*return*/, Promise.reject(e_1)];\n                    case 4: return [2 /*return*/];\n                }\n            });\n        });\n    };\n    ResultList.prototype.renderNewResults = function (data) {\n        return __awaiter(this, void 0, void 0, function () {\n            var elements, _a;\n            return __generator(this, function (_b) {\n                switch (_b.label) {\n                    case 0: return [4 /*yield*/, this.buildResults(data)];\n                    case 1:\n                        elements = _b.sent();\n                        this.renderResults(elements, true);\n                        (_a = this.currentlyDisplayedResults).push.apply(_a, data.results);\n                        return [2 /*return*/];\n                }\n            });\n        });\n    };\n    ResultList.prototype.resetStateAfterFetchingMoreResults = function () {\n        var _this = this;\n        this.hideWaitingAnimationForInfiniteScrolling();\n        this.fetchingMoreResults = undefined;\n        Defer_1.Defer.defer(function () {\n            _this.successiveScrollCount++;\n            if (_this.successiveScrollCount <= ResultList.MAX_AMOUNT_OF_SUCESSIVE_REQUESTS) {\n                _this.handleScrollOfResultList();\n            }\n            else {\n                _this.logger.info(\"Result list has triggered 5 consecutive queries to try and fill up the scrolling container, but it is still unable to do so.\\n          Try explicitly setting the 'data-infinite-scroll-container-selector' option on the result list. See: https://coveo.github.io/search-ui/components/resultlist.html#options.infinitescrollcontainer\");\n            }\n        });\n    };\n    ResultList.prototype.handleDuringQuery = function () {\n        this.logger.trace('Emptying the result container');\n        this.cancelFetchingMoreResultsIfNeeded();\n        this.showWaitingAnimation();\n        this.showOrHideElementsDependingOnState(false, false);\n    };\n    ResultList.prototype.handleQueryError = function () {\n        this.hideWaitingAnimation();\n        this.resultContainer.empty();\n        this.currentlyDisplayedResults = [];\n        this.reachedTheEndOfResults = true;\n    };\n    ResultList.prototype.handleQuerySuccess = function (data) {\n        var _this = this;\n        Assert_1.Assert.exists(data);\n        Assert_1.Assert.exists(data.results);\n        var results = data.results;\n        this.logger.trace('Received query results from new query', results);\n        this.hideWaitingAnimation();\n        ResultList.resultCurrentlyBeingRendered = undefined;\n        this.currentlyDisplayedResults = [];\n        this.buildResults(data.results).then(function (elements) { return __awaiter(_this, void 0, void 0, function () {\n            return __generator(this, function (_a) {\n                switch (_a.label) {\n                    case 0: return [4 /*yield*/, this.renderResults(elements)];\n                    case 1:\n                        _a.sent();\n                        this.showOrHideElementsDependingOnState(true, this.currentlyDisplayedResults.length != 0);\n                        if (DeviceUtils_1.DeviceUtils.isMobileDevice() && this.options.mobileScrollContainer != undefined) {\n                            this.options.mobileScrollContainer.scrollTop = 0;\n                        }\n                        if (this.options.enableInfiniteScroll && results.results.length == data.queryBuilder.numberOfResults) {\n                            // This will check right away if we need to add more results to make the scroll container full & scrolling.\n                            this.scrollToTopIfEnabled();\n                            this.handleScrollOfResultList();\n                        }\n                        return [2 /*return*/];\n                }\n            });\n        }); });\n        this.handleQueryOrFetchMoreSuccess(data.query, results);\n    };\n    ResultList.prototype.handleFetchMoreSuccess = function (data) {\n        this.handleQueryOrFetchMoreSuccess(data.query, data.results);\n    };\n    ResultList.prototype.handleQueryOrFetchMoreSuccess = function (query, results) {\n        var firstResultOfNextPage = (query.firstResult || 0) + results.results.length;\n        this.reachedTheEndOfResults = firstResultOfNextPage >= results.totalCountFiltered;\n    };\n    ResultList.prototype.handleScrollOfResultList = function () {\n        if (this.isCurrentlyFetchingMoreResults() || !this.options.enableInfiniteScroll) {\n            return;\n        }\n        if (this.isScrollingOfResultListAlmostAtTheBottom() && this.hasPotentiallyMoreResultsToDisplay()) {\n            this.displayMoreResults(this.options.infiniteScrollPageSize);\n        }\n    };\n    ResultList.prototype.scrollToTopIfEnabled = function () {\n        if (!this.options.enableScrollToTop) {\n            return;\n        }\n        ResultListUtils_1.ResultListUtils.scrollToTop(this.root);\n    };\n    ResultList.prototype.handleNewQuery = function () {\n        Dom_1.$$(this.element).removeClass('coveo-hidden');\n        ResultList.resultCurrentlyBeingRendered = undefined;\n    };\n    Object.defineProperty(ResultList.prototype, \"otherResultLists\", {\n        get: function () {\n            var allResultLists = this.searchInterface.getComponents(ResultList.ID);\n            return underscore_1.without(allResultLists, this);\n        },\n        enumerable: true,\n        configurable: true\n    });\n    Object.defineProperty(ResultList.prototype, \"resultLayoutSelectors\", {\n        get: function () {\n            return this.searchInterface.getComponents('ResultLayoutSelector');\n        },\n        enumerable: true,\n        configurable: true\n    });\n    ResultList.prototype.handleBuildingQuery = function (args) {\n        if (this.options.fieldsToInclude != null) {\n            // remove the @\n            args.queryBuilder.addFieldsToInclude(underscore_1.map(this.options.fieldsToInclude, function (field) { return field.substr(1); }));\n        }\n        if (this.options.autoSelectFieldsToInclude) {\n            var otherFields = underscore_1.flatten(underscore_1.map(this.otherResultLists, function (otherResultList) {\n                return otherResultList.getAutoSelectedFieldsToInclude();\n            }));\n            args.queryBuilder.addRequiredFields(underscore_1.unique(otherFields.concat(this.getAutoSelectedFieldsToInclude())));\n            args.queryBuilder.includeRequiredFields = true;\n        }\n    };\n    ResultList.prototype.handleChangeLayout = function (args) {\n        var _this = this;\n        if (args.layout === this.options.layout) {\n            this.disableLayoutChange = false;\n            this.enable();\n            this.options.resultTemplate.layout = this.options.layout;\n            if (args.results) {\n                // Prevent flickering when switching to a new layout that is empty\n                // add a temporary placeholder, the same that is used on initialization\n                if (this.resultContainer.isEmpty()) {\n                    new InitializationPlaceholder_1.InitializationPlaceholder(this.root).withVisibleRootElement().withPlaceholderForResultList();\n                }\n                Defer_1.Defer.defer(function () { return __awaiter(_this, void 0, void 0, function () {\n                    var elements;\n                    return __generator(this, function (_a) {\n                        switch (_a.label) {\n                            case 0: return [4 /*yield*/, this.buildResults(args.results)];\n                            case 1:\n                                elements = _a.sent();\n                                this.renderResults(elements);\n                                this.showOrHideElementsDependingOnState(true, this.currentlyDisplayedResults.length !== 0);\n                                return [2 /*return*/];\n                        }\n                    });\n                }); });\n            }\n        }\n        else {\n            this.disableLayoutChange = true;\n            this.disable();\n            this.resultContainer.empty();\n        }\n    };\n    ResultList.prototype.isCurrentlyFetchingMoreResults = function () {\n        return Utils_1.Utils.exists(this.fetchingMoreResults);\n    };\n    ResultList.prototype.getMinimalFieldsToInclude = function () {\n        // these fields are needed for analytics click event\n        return ['author', 'language', 'urihash', 'objecttype', 'collection', 'source', 'language', 'permanentid'];\n    };\n    ResultList.prototype.isScrollingOfResultListAlmostAtTheBottom = function () {\n        // this is in a try catch because the unit test fail otherwise (Window does not exist for phantom js in the console)\n        var isWindow;\n        try {\n            isWindow = this.options.infiniteScrollContainer instanceof Window;\n        }\n        catch (e) {\n            isWindow = false;\n        }\n        return isWindow ? this.isScrollAtBottomForWindowElement() : this.isScrollAtBottomForHtmlElement();\n    };\n    ResultList.prototype.isScrollAtBottomForWindowElement = function () {\n        var win = new Dom_1.Win(window);\n        var windowHeight = win.height();\n        var scrollTop = win.scrollY();\n        var bodyHeight = new Dom_1.Doc(document).height();\n        return bodyHeight - (windowHeight + scrollTop) < windowHeight / 2;\n    };\n    ResultList.prototype.isScrollAtBottomForHtmlElement = function () {\n        var el = this.options.infiniteScrollContainer;\n        var elementHeight = el.clientHeight;\n        var scrollHeight = el.scrollHeight;\n        var bottomPosition = el.scrollTop + elementHeight;\n        return scrollHeight - bottomPosition < elementHeight / 2;\n    };\n    ResultList.prototype.hasPotentiallyMoreResultsToDisplay = function () {\n        return this.currentlyDisplayedResults.length > 0 && !this.reachedTheEndOfResults;\n    };\n    ResultList.prototype.cancelFetchingMoreResultsIfNeeded = function () {\n        if (this.isCurrentlyFetchingMoreResults()) {\n            this.logger.trace('Cancelling fetching more results');\n            Promise.reject(this.fetchingMoreResults);\n            this.fetchingMoreResults = undefined;\n        }\n    };\n    ResultList.prototype.showOrHideElementsDependingOnState = function (hasQuery, hasResults) {\n        var showIfQuery = Dom_1.$$(this.element).findAll('.coveo-show-if-query');\n        var showIfNoQuery = Dom_1.$$(this.element).findAll('.coveo-show-if-no-query');\n        var showIfResults = Dom_1.$$(this.element).findAll('.coveo-show-if-results');\n        var showIfNoResults = Dom_1.$$(this.element).findAll('.coveo-show-if-no-results');\n        underscore_1.each(showIfQuery, function (s) {\n            Dom_1.$$(s).toggle(hasQuery);\n        });\n        underscore_1.each(showIfNoQuery, function (s) {\n            Dom_1.$$(s).toggle(!hasQuery);\n        });\n        underscore_1.each(showIfResults, function (s) {\n            Dom_1.$$(s).toggle(hasQuery && hasResults);\n        });\n        underscore_1.each(showIfNoResults, function (s) {\n            Dom_1.$$(s).toggle(hasQuery && !hasResults);\n        });\n    };\n    Object.defineProperty(ResultList.prototype, \"waitAnimation\", {\n        get: function () {\n            return this.options.waitAnimation.toLowerCase();\n        },\n        enumerable: true,\n        configurable: true\n    });\n    ResultList.prototype.showWaitingAnimation = function () {\n        switch (this.waitAnimation) {\n            case 'fade':\n                Dom_1.$$(this.options.waitAnimationContainer).addClass('coveo-fade-out');\n                break;\n            case 'spinner':\n                this.resultContainer.hideChildren();\n                if (Dom_1.$$(this.options.waitAnimationContainer).find('.coveo-wait-animation') == undefined) {\n                    this.options.waitAnimationContainer.appendChild(DomUtils_1.DomUtils.getBasicLoadingAnimation());\n                }\n                break;\n        }\n    };\n    ResultList.prototype.hideWaitingAnimation = function () {\n        switch (this.waitAnimation) {\n            case 'fade':\n                Dom_1.$$(this.options.waitAnimationContainer).removeClass('coveo-fade-out');\n                break;\n            case 'spinner':\n                var spinner = Dom_1.$$(this.options.waitAnimationContainer).find('.coveo-loading-spinner');\n                if (spinner) {\n                    Dom_1.$$(spinner).detach();\n                }\n                break;\n        }\n    };\n    ResultList.prototype.showWaitingAnimationForInfiniteScrolling = function () {\n        var spinner = DomUtils_1.DomUtils.getLoadingSpinner();\n        if (this.options.layout == 'card' && this.options.enableInfiniteScroll) {\n            var previousSpinnerContainer = Dom_1.$$(this.options.waitAnimationContainer).findAll('.coveo-loading-spinner-container');\n            underscore_1.each(previousSpinnerContainer, function (previousSpinner) { return Dom_1.$$(previousSpinner).remove(); });\n            var spinnerContainer = Dom_1.$$('div', {\n                className: 'coveo-loading-spinner-container'\n            });\n            spinnerContainer.append(spinner);\n            this.options.waitAnimationContainer.appendChild(spinnerContainer.el);\n        }\n        else {\n            this.options.waitAnimationContainer.appendChild(DomUtils_1.DomUtils.getLoadingSpinner());\n        }\n    };\n    ResultList.prototype.hideWaitingAnimationForInfiniteScrolling = function () {\n        var spinners = Dom_1.$$(this.options.waitAnimationContainer).findAll('.coveo-loading-spinner');\n        var containers = Dom_1.$$(this.options.waitAnimationContainer).findAll('.coveo-loading-spinner-container');\n        underscore_1.each(spinners, function (spinner) { return Dom_1.$$(spinner).remove(); });\n        underscore_1.each(containers, function (container) { return Dom_1.$$(container).remove(); });\n    };\n    ResultList.prototype.initResultContainer = function () {\n        if (!this.options.resultsContainer) {\n            var elemType = this.options.layout === 'table' ? 'table' : 'div';\n            this.options.resultsContainer = Dom_1.$$(elemType, { className: 'coveo-result-list-container' }).el;\n            this.initResultContainerAddToDom();\n        }\n        return new ResultContainer_1.ResultContainer(this.options.resultsContainer, this.searchInterface);\n    };\n    ResultList.prototype.initResultContainerAddToDom = function () {\n        this.element.appendChild(this.options.resultsContainer);\n    };\n    ResultList.prototype.initWaitAnimationContainer = function () {\n        if (!this.options.waitAnimationContainer) {\n            this.options.waitAnimationContainer = this.resultContainer.el;\n        }\n    };\n    ResultList.prototype.setupRenderer = function () {\n        var initParameters = {\n            options: this.searchInterface.options.originalOptionsObject,\n            bindings: this.bindings\n        };\n        var autoCreateComponentsFn = function (elem) { return Initialization_1.Initialization.automaticallyCreateComponentsInside(elem, initParameters); };\n        switch (this.options.layout) {\n            case 'card':\n                this.renderer = new ResultListCardRenderer_1.ResultListCardRenderer(this.options, autoCreateComponentsFn);\n                break;\n            case 'table':\n                this.renderer = new ResultListTableRenderer_1.ResultListTableRenderer(this.options, autoCreateComponentsFn);\n                break;\n            case 'list':\n            default:\n                this.renderer = new ResultListRenderer_1.ResultListRenderer(this.options, autoCreateComponentsFn);\n                break;\n        }\n    };\n    ResultList.prototype.makeElementFocusable = function () {\n        Dom_1.$$(this.element).setAttribute('tabindex', '-1');\n    };\n    ResultList.prototype.ensureHasId = function () {\n        var currentId = this.element.id;\n        if (currentId === '') {\n            this.element.id = underscore_1.uniqueId('coveo-result-list');\n        }\n    };\n    ResultList.prototype.enableBasedOnActiveLayouts = function () {\n        var _this = this;\n        // We should try to enable a result list only when the result layout selector currently allow that result list layout to be displayed.\n        underscore_1.each(this.resultLayoutSelectors, function (resultLayoutSelector) {\n            var found = underscore_1.find(resultLayoutSelector.activeLayouts, function (activeLayout, activeLayoutKey) { return activeLayoutKey == _this.options.layout; });\n            if (found) {\n                _super.prototype.enable.call(_this);\n                resultLayoutSelector.enableLayouts([_this.options.layout]);\n                Dom_1.$$(_this.element).removeClass('coveo-hidden');\n            }\n        });\n    };\n    ResultList.ID = 'ResultList';\n    ResultList.doExport = function () {\n        GlobalExports_1.exportGlobally({\n            ResultList: ResultList\n        });\n    };\n    /**\n     * The options for the ResultList\n     * @componentOptions\n     */\n    ResultList.options = {\n        /**\n         * The element inside which to insert the rendered result templates.\n         *\n         * Performing a new query clears the content of this element.\n         *\n         * You can change the container by specifying its selector (e.g.,\n         * `data-result-container-selector='#someCssSelector'`).\n         *\n         * If you specify no value for this option, a `div` element will be dynamically created and appended to the result\n         * list. This element will then be used as a result container.\n         */\n        resultsContainer: ComponentOptions_1.ComponentOptions.buildChildHtmlElementOption({ alias: 'resultContainerSelector' }),\n        resultTemplate: TemplateComponentOptions_1.TemplateComponentOptions.buildTemplateOption({ defaultFunction: ResultList.getDefaultTemplate }),\n        /**\n         * The type of animation to display while waiting for a query to return.\n         *\n         * The possible values are:\n         * - `fade`: Fades out the current list of results while the query is executing.\n         * - `spinner`: Shows a spinning animation while the query is executing.\n         * - `none`: Use no animation during queries.\n         *\n         * See also the [`waitAnimationContainer`]{@link ResultList.options.waitAnimationContainer} option.\n         *\n         * @examples spinner\n         */\n        waitAnimation: ComponentOptions_1.ComponentOptions.buildStringOption({ defaultValue: 'none' }),\n        /**\n         * The element inside which to display the [`waitAnimation`]{@link ResultList.options.waitAnimation}.\n         *\n         * You can change this by specifying a CSS selector (e.g.,\n         * `data-wait-animation-container-selector='#someCssSelector'`).\n         *\n         * Defaults to the value of the [`resultsContainer`]{@link ResultList.options.resultsContainer} option.\n         */\n        waitAnimationContainer: ComponentOptions_1.ComponentOptions.buildChildHtmlElementOption({\n            postProcessing: function (value, options) { return value || options.resultsContainer; }\n        }),\n        /**\n         * Whether to automatically retrieve an additional page of results and append it to the\n         * results that the `ResultList` is currently displaying when the user scrolls down to the bottom of the\n         * [`infiniteScrollContainer`]{@link ResultList.options.infiniteScrollContainer}.\n         *\n         * See also the [`infiniteScrollPageSize`]{@link ResultList.options.infiniteScrollPageSize} and\n         * [`enableInfiniteScrollWaitingAnimation`]{@link ResultList.options.enableInfiniteScrollWaitingAnimation} options.\n         *\n         * It is important to specify the `infiniteScrollContainer` option manually if you want the scrolling element to be\n         * something else than the default `window` element. Otherwise, you might find yourself in a strange state where the\n         * framework rapidly triggers multiple successive query.\n         */\n        enableInfiniteScroll: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: false }),\n        /**\n         * The number of additional results to fetch when the user scrolls down to the bottom of the\n         * [`infiniteScrollContainer`]{@link ResultList.options.infiniteScrollContainer}.\n         *\n         * @examples 5\n         */\n        infiniteScrollPageSize: ComponentOptions_1.ComponentOptions.buildNumberOption({\n            defaultValue: 10,\n            min: 1,\n            depend: 'enableInfiniteScroll'\n        }),\n        /**\n         * The element that triggers fetching additional results when the end user scrolls down to its bottom.\n         *\n         * You can change the container by specifying its selector (e.g.,\n         * `data-infinite-scroll-container-selector='#someCssSelector'`).\n         *\n         * By default, the framework uses the first vertically scrollable parent element it finds, starting from the\n         * `ResultList` element itself. A vertically scrollable element is an element whose CSS `overflow-y` attribute is\n         * `scroll`.\n         *\n         * This implies that if the framework can find no scrollable parent, it uses the `window` itself as a scrollable\n         * container.\n         *\n         * This heuristic is not perfect, for technical reasons. There are always some corner case CSS combination which the\n         * framework will not be able to correctly detect as 'scrollable'.\n         *\n         * It is highly recommended that you manually set this option if you wish something else than the `window` to be the\n         * scrollable element.\n         */\n        infiniteScrollContainer: ComponentOptions_1.ComponentOptions.buildChildHtmlElementOption({\n            depend: 'enableInfiniteScroll',\n            defaultFunction: function (element) { return ComponentOptions_1.ComponentOptions.findParentScrolling(element); }\n        }),\n        /**\n         * Whether to display the [`waitingAnimation`]{@link ResultList.options.waitAnimation} while fetching additional\n         * results.\n         */\n        enableInfiniteScrollWaitingAnimation: ComponentOptions_1.ComponentOptions.buildBooleanOption({\n            depend: 'enableInfiniteScroll',\n            defaultValue: true\n        }),\n        mobileScrollContainer: ComponentOptions_1.ComponentOptions.buildSelectorOption({\n            defaultFunction: function () { return document.querySelector('.coveo-results-column'); }\n        }),\n        /**\n         * Whether the `ResultList` should scan its result templates to discover which fields it must request to\n         * be able to render all results.\n         *\n         * Setting this option to `true` ensures that the Coveo Search API does not return fields that are unnecessary for\n         * the UI to function.\n         *\n         * If you set this option to `true`, the fields referenced in your result folding templates won't be automatically resolved.\n         * In such a case, you must manually specify those fields using the [`fieldsToInclude`]{@link ResultList.options.fieldsToInclude} option.\n         *\n         * **Notes:**\n         *\n         * - Many interfaces created with the JavaScript Search Interface Editor explicitly set this option to `true`.\n         * - You cannot set this option to `true` in the Coveo for Sitecore integration.\n         */\n        autoSelectFieldsToInclude: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: false }),\n        /**\n         * A list of fields to include in the query results.\n         *\n         * If you set the [`autoSelectFieldsToInclude`]{@link ResultList.options.autoSelectFieldsToInclude} option to\n         * `true`, the Coveo Search API returns the fields you specify for this option (if those fields are available) in\n         * addition to the fields which the `ResultList` automatically requests. Note that the `autoSelectFieldsToInclude`\n         * option doesn't automatically request fields for folding templates; in such a case, you must manually specify\n         * fields using this option to avoid empty results.\n         *\n         * If you set the [`autoSelectFieldsToInclude`]{@link ResultList.options.autoSelectFieldsToInclude} option to\n         * `false`, the Coveo Search API only returns the fields you specify for this option (if those fields are\n         * available).\n         *\n         * If you set the [`autoSelectFieldsToInclude`]{@link ResultList.options.autoSelectFieldsToInclude} option to\n         * `false` and leave this option undefined, the Coveo Search API returns all available fields.\n         */\n        fieldsToInclude: ComponentOptions_1.ComponentOptions.buildFieldsOption({ includeInResults: true }),\n        /**\n         * Specifies the layout to use when displaying results in this `ResultList` (see\n         * [Result Layouts](https://docs.coveo.com/en/360/)). Specifying a value for this option automatically\n         * populates a [`ResultLayout`]{@link ResultLayout} component with a switcher for the layout.\n         *\n         * For example, if there are two `ResultList` components in the page, one with its `layout` set to `list` and the\n         * other with the same option set to `card`, then the `ResultLayout` component will render two buttons respectively\n         * entitled **List** and **Card**.\n         *\n         * See the [`ValidLayout`]{@link ValidLayout} type for the list of possible values.\n         *\n         * @examples card\n         */\n        layout: ComponentOptions_1.ComponentOptions.buildStringOption({\n            defaultValue: 'list',\n            required: true\n        }),\n        /**\n         * Whether to scroll back to the top of the page when the end-user:\n         *  - interacts with a facet when [`infiniteScrollContainer`]{@link ResultList.options.infiniteScrollContainer} is set to `true`\n         *  - interacts with the [`Pager`]{@link Pager} component when [`infiniteScrollContainer`]{@link ResultList.options.infiniteScrollContainer} is set to `false`\n         *\n         * **Note:** Setting this option to `false` has no effect on dynamic facets. To disable this behavior on a `DynamicFacet` component, you must set its own [`enableScrollToTop`]{@link DynamicFacet.options.enableScrollToTop} option to `false`.\n         *\n         * @availablesince [July 2019 Release (v2.6459)](https://docs.coveo.com/en/2938/)\n         */\n        enableScrollToTop: ComponentOptions_1.ComponentOptions.buildBooleanOption({\n            defaultValue: true\n        })\n    };\n    ResultList.resultCurrentlyBeingRendered = null;\n    ResultList.MAX_AMOUNT_OF_SUCESSIVE_REQUESTS = 5;\n    return ResultList;\n}(Component_1.Component));\nexports.ResultList = ResultList;\nInitialization_1.Initialization.registerAutoCreateComponent(ResultList);\n\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// QuerySuggestPreview.min__4e9032d9a7117b17aab0.js","import { Component } from '../ui/Base/Component';\nimport { ResultList } from '../ui/ResultList/ResultList';\nimport { $$ } from './Dom';\nimport { find } from 'underscore';\nimport { Logger } from '../misc/Logger';\n\nexport class ResultListUtils {\n  public static hideIfInfiniteScrollEnabled(cmp: Component) {\n    const infiniteScrollEnabled = ResultListUtils.isInfiniteScrollEnabled(cmp.searchInterface.element);\n\n    if (infiniteScrollEnabled) {\n      cmp.disable();\n      $$(cmp.element).hide();\n      ResultListUtils.warnIfComponentNotNeeded(cmp);\n    } else {\n      cmp.enable();\n      $$(cmp.element).unhide();\n    }\n  }\n\n  public static isInfiniteScrollEnabled(root: HTMLElement) {\n    const resultList = ResultListUtils.getMainResultList(root);\n    return resultList ? !!resultList.options.enableInfiniteScroll : false;\n  }\n\n  public static scrollToTop(root: HTMLElement) {\n    const resultList = ResultListUtils.getMainResultList(root);\n    if (!resultList) {\n      new Logger(this).warn('No active ResultList, scrolling to the top of the Window');\n      return window.scrollTo(0, 0);\n    }\n\n    const searchInterfacePosition = resultList.searchInterface.element.getBoundingClientRect().top;\n    if (searchInterfacePosition > 0) {\n      return;\n    }\n\n    window.scrollTo(0, window.pageYOffset + searchInterfacePosition);\n  }\n\n  private static getMainResultList(root: HTMLElement) {\n    const resultLists = ResultListUtils.getResultLists(root);\n    return find(resultLists, resultList => {\n      const isRecInterface = resultList.searchInterface.element.classList.contains('CoveoRecommendation');\n      return !resultList.disabled && !isRecInterface;\n    });\n  }\n\n  private static getResultLists(root: HTMLElement) {\n    return $$(root)\n      .findAll(`.${ResultListUtils.cssClass()}`)\n      .map(el => <ResultList>Component.get(el, ResultList));\n  }\n\n  private static cssClass() {\n    return Component.computeCssClassName(ResultList);\n  }\n\n  private static warnIfComponentNotNeeded(cmp: Component) {\n    const root = cmp.searchInterface.root;\n    const allListsUseInfiniteScroll = ResultListUtils.allResultListsUseInfiniteScroll(root);\n\n    allListsUseInfiniteScroll && ResultListUtils.notNeededComponentWarning(cmp);\n  }\n\n  private static allResultListsUseInfiniteScroll(root: HTMLElement) {\n    const listsWithInfiniteScrollDisabled = ResultListUtils.getResultLists(root).filter(\n      resultList => !resultList.options.enableInfiniteScroll\n    );\n\n    return listsWithInfiniteScrollDisabled.length === 0;\n  }\n\n  private static notNeededComponentWarning(cmp: Component) {\n    const cmpCssClass = Component.computeCssClassNameForType(cmp.type);\n    const message = `The ${cmpCssClass} component is not needed because all ${ResultListUtils.cssClass()} components have enableInfiniteScroll set to 'true'.\n    For the best performance, remove the ${cmpCssClass} component from your search page.`;\n\n    new Logger(cmp).warn(message);\n  }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils/ResultListUtils.ts","import { contains, each, escape, extend, filter, find, isArray, isObject, isString, keys, map, omit } from 'underscore';\nimport { exportGlobally } from '../../GlobalExports';\nimport { Assert } from '../../misc/Assert';\nimport { IQueryResult } from '../../rest/QueryResult';\nimport { l } from '../../strings/Strings';\nimport { AccessibleButton } from '../../utils/AccessibleButton';\nimport { DateUtils, IDateToStringOptions } from '../../utils/DateUtils';\nimport { $$ } from '../../utils/Dom';\nimport { StringUtils } from '../../utils/StringUtils';\nimport { Utils } from '../../utils/Utils';\nimport { analyticsActionCauseList } from '../Analytics/AnalyticsActionListMeta';\nimport { Component } from '../Base/Component';\nimport { IComponentBindings } from '../Base/ComponentBindings';\nimport { ComponentOptions } from '../Base/ComponentOptions';\nimport { IComponentOptionsObjectOptionArgs, IFieldConditionOption, IFieldOption } from '../Base/IComponentOptions';\nimport { Initialization } from '../Base/Initialization';\nimport { FacetUtils } from '../Facet/FacetUtils';\nimport { TemplateFieldsEvaluator } from '../Templates/TemplateFieldsEvaluator';\nimport { TemplateHelpers } from '../Templates/TemplateHelpers';\nimport { IFieldValueCompatibleFacet, isFacetFieldValueCompatible } from './IFieldValueCompatibleFacet';\nimport { ComponentsTypes } from '../../utils/ComponentsTypes';\n\nexport interface IFieldValueOptions {\n  field?: IFieldOption;\n  facet?: string;\n  dynamicFacet?: string;\n  htmlValue?: boolean;\n  helper?: string;\n  helperOptions?: { [key: string]: any };\n  splitValues?: boolean;\n  separator?: string;\n  displaySeparator?: string;\n  textCaption?: string;\n  conditions?: IFieldConditionOption[];\n}\n\nexport interface IAnalyticsFieldValueMeta {\n  facetId: string;\n  facetField: string;\n  facetValue?: string;\n  facetTitle?: string;\n}\n\nfunction showOnlyWithHelper<T>(helpers: string[], options?: T): T {\n  if (options == null) {\n    options = <any>{};\n  }\n  (<any>options).helpers = helpers;\n  return options;\n}\n\n/**\n * The FieldValue component displays the value of a field associated to its parent search result. It is normally usable\n * within a {@link FieldTable}.\n *\n * This component is a result template component (see [Result Templates](https://docs.coveo.com/en/413/)).\n *\n * A common use of this component is to display a specific field value which also happens to be an existing\n * {@link Facet.options.field}. When the user clicks on the FieldValue component, it activates the corresponding Facet.\n */\nexport class FieldValue extends Component {\n  static ID = 'FieldValue';\n\n  static doExport = () => {\n    exportGlobally({\n      FieldValue: FieldValue\n    });\n  };\n\n  /**\n   * The options for the component\n   * @componentOptions\n   */\n  static options: IFieldValueOptions = {\n    /**\n     * Specifies the field that the FieldValue should display.\n     *\n     * Specifying a value for this parameter is required in order for the FieldValue component to work.\n     */\n    field: ComponentOptions.buildFieldOption({ defaultValue: '@field', required: true }),\n\n    /**\n     * Specifies the {@link Facet} component to toggle when the end user clicks the FieldValue.\n     *\n     * Default value is the value of {@link FieldValue.options.field}.\n     *\n     * **Note:**\n     * > If the target {@link Facet.options.id} is is not the same as its {@link Facet.options.field}), you must specify\n     * > this option manually in order to link to the correct Facet.\n     */\n    facet: ComponentOptions.buildStringOption({ postProcessing: (value, options) => value || options.field }),\n\n    /**\n     * Specifies whether the content to display is an HTML element.\n     *\n     * Default value is `false`.\n     */\n    htmlValue: ComponentOptions.buildBooleanOption({ defaultValue: false }),\n\n    /**\n     * Specifies whether to split the FieldValue at each {@link FieldValue.options.separator}.\n     *\n     * This is useful for splitting groups using a {@link Facet.options.field}.\n     *\n     * When this option is `true`, the displayed values are split by the {@link FieldValue.options.displaySeparator}.\n     *\n     * Default value is `false`.\n     */\n    splitValues: ComponentOptions.buildBooleanOption({ defaultValue: false }),\n\n    /**\n     * If {@link FieldValue.options.splitValues} is `true`, specifies the separator string which separates multi-value\n     * fields in the index.\n     *\n     * See {@link FieldValue.options.displaySeparator}.\n     *\n     * Default value is `\";\"`.\n     */\n    separator: ComponentOptions.buildStringOption({ depend: 'splitValues', defaultValue: ';' }),\n\n    /**\n     * If {@link FieldValue.options.splitValues} is `true`, specifies the string to use when displaying multi-value\n     * fields in the UI.\n     *\n     * The component will insert this string between each value it displays from a multi-value field.\n     *\n     * See also {@link FieldValue.options.separator}.\n     *\n     * Default value is `\", \"`.\n     */\n    displaySeparator: ComponentOptions.buildStringOption({ depend: 'splitValues', defaultValue: ', ' }),\n\n    /**\n     * Specifies the helper that the FieldValue should use to display its content.\n     *\n     * While several helpers exist by default (see {@link ICoreHelpers}), it is also possible for you to create your own\n     * custom helpers (see {@link TemplateHelpers}).\n     */\n    helper: ComponentOptions.buildHelperOption(),\n\n    /**\n     * Specifies the options to call on the specified helper.\n     */\n    helperOptions: ComponentOptions.buildObjectOption(<IComponentOptionsObjectOptionArgs>{\n      subOptions: {\n        text: ComponentOptions.buildStringOption(showOnlyWithHelper(['anchor'])),\n        target: ComponentOptions.buildStringOption(showOnlyWithHelper(['anchor'])),\n        class: ComponentOptions.buildStringOption(showOnlyWithHelper(['anchor'])),\n\n        format: ComponentOptions.buildStringOption(showOnlyWithHelper(['number'])),\n\n        decimals: ComponentOptions.buildNumberOption(showOnlyWithHelper(['currency'], { min: 0 })),\n        symbol: ComponentOptions.buildStringOption(showOnlyWithHelper(['currency'])),\n\n        useTodayYesterdayAndTomorrow: ComponentOptions.buildBooleanOption(\n          showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'], { defaultValue: true })\n        ),\n        useWeekdayIfThisWeek: ComponentOptions.buildBooleanOption(\n          showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'], { defaultValue: true })\n        ),\n        omitYearIfCurrentOne: ComponentOptions.buildBooleanOption(\n          showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'], { defaultValue: true })\n        ),\n        useLongDateFormat: ComponentOptions.buildBooleanOption(\n          showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'], { defaultValue: false })\n        ),\n        includeTimeIfToday: ComponentOptions.buildBooleanOption(\n          showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'], { defaultValue: true })\n        ),\n        includeTimeIfThisWeek: ComponentOptions.buildBooleanOption(\n          showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'], { defaultValue: true })\n        ),\n        alwaysIncludeTime: ComponentOptions.buildBooleanOption(\n          showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'], { defaultValue: false })\n        ),\n        predefinedFormat: ComponentOptions.buildStringOption(showOnlyWithHelper(['date', 'dateTime', 'emailDateTime', 'time'])),\n\n        companyDomain: ComponentOptions.buildStringOption(showOnlyWithHelper(['email'])),\n        me: ComponentOptions.buildStringOption(showOnlyWithHelper(['email'])),\n        lengthLimit: ComponentOptions.buildNumberOption(showOnlyWithHelper(['email'], { min: 1 })),\n        truncateName: ComponentOptions.buildBooleanOption(showOnlyWithHelper(['email'])),\n\n        alt: ComponentOptions.buildStringOption(showOnlyWithHelper(['image'])),\n        height: ComponentOptions.buildStringOption(showOnlyWithHelper(['image'])),\n        width: ComponentOptions.buildStringOption(showOnlyWithHelper(['image'])),\n        srcTemplate: ComponentOptions.buildStringOption(showOnlyWithHelper(['image'])),\n\n        precision: ComponentOptions.buildNumberOption(showOnlyWithHelper(['size'], { min: 0, defaultValue: 2 })),\n        base: ComponentOptions.buildNumberOption(showOnlyWithHelper(['size'], { min: 0, defaultValue: 0 })),\n        isMilliseconds: ComponentOptions.buildBooleanOption(showOnlyWithHelper(['timeSpan'])),\n\n        length: ComponentOptions.buildNumberOption(showOnlyWithHelper(['shorten', 'shortenPath', 'shortenUri'], { defaultValue: 200 }))\n      }\n    }),\n\n    /**\n     * Specifies a caption to display before the value.\n     *\n     * Default value is `undefined`.\n     *\n     * @availablesince [January 2017 Release (v1.1865.9)](https://docs.coveo.com/en/396/#january-2017-release-v118659)\n     */\n    textCaption: ComponentOptions.buildLocalizedStringOption(),\n\n    /**\n     * A field-based condition that must be satisfied by the query result item for the component to be rendered.\n     *\n     * Note: This option uses a distinctive markup configuration syntax allowing multiple conditions to be expressed. Its underlying logic is the same as that of the field value conditions mechanism used by result templates.\n     *\n     * **Examples:**\n     * Render the component if the query result item's @documenttype field value is Article or Documentation.\n     * ```html\n     * <div class=\"CoveoFieldValue\" data-field=\"@author\" data-condition-field-documenttype=\"Article, Documentation\"></div>\n     * ```\n     * Render the component if the query result item's @documenttype field value is anything but Case.\n     * ```html\n     * <div class=\"CoveoFieldValue\" data-field=\"@author\" data-condition-field-not-documenttype=\"Case\"></div>\n     * ```\n     * Render the component if the query result item's @documenttype field value is Article, and if its @author field value is anything but Anonymous.\n     * ```html\n     * <div class=\"CoveoFieldValue\" data-field=\"@author\" data-condition-field-documenttype=\"Article\" data-condition-field-not-author=\"Anonymous\"></div>\n     * ```\n     * Default value is `undefined`.\n     */\n    conditions: ComponentOptions.buildFieldConditionOption()\n  };\n\n  static simpleOptions = omit(FieldValue.options, 'helperOptions');\n\n  static helperOptions = <any>{\n    helperOptions: FieldValue.options.helperOptions\n  };\n\n  /**\n   * Creates a new FieldValue.\n   * @param element The HTMLElement on which to instantiate the component.\n   * @param options The options for the FieldValue component.\n   * @param bindings The bindings that the component requires to function normally. If not set, these will be\n   * automatically resolved (with a slower execution time).\n   * @param result The result to associate the component with.\n   */\n  constructor(\n    public element: HTMLElement,\n    public options: IFieldValueOptions,\n    bindings?: IComponentBindings,\n    public result?: IQueryResult,\n    fieldValueClassId: string = FieldValue.ID\n  ) {\n    super(element, fieldValueClassId, bindings);\n\n    this.options = ComponentOptions.initOptions(element, FieldValue.simpleOptions, options, FieldValue.ID);\n\n    if (this.options.helper != null) {\n      this.normalizeHelperAndOptions();\n    }\n\n    this.result = this.result || this.resolveResult();\n    Assert.exists(this.result);\n\n    if (TemplateFieldsEvaluator.evaluateFieldsToMatch(this.options.conditions, this.result) && !Utils.isNullOrUndefined(this.getValue())) {\n      this.initialize();\n    } else if (this.element.parentElement != null) {\n      this.element.parentElement.removeChild(this.element);\n    }\n  }\n\n  private initialize() {\n    let loadedValueFromComponent = this.getValue();\n    let values: string[];\n\n    if (isArray(loadedValueFromComponent)) {\n      values = loadedValueFromComponent;\n    } else if (this.options.splitValues) {\n      if (isString(loadedValueFromComponent)) {\n        values = map(loadedValueFromComponent.split(this.options.separator), (v: string) => {\n          return v.trim();\n        });\n      }\n    } else {\n      loadedValueFromComponent = loadedValueFromComponent.toString();\n      values = [loadedValueFromComponent];\n    }\n    if (values.length > 1 && this.isValueHierarchical) {\n      values = values.slice(-1);\n    }\n    this.appendValuesToDom(values);\n    if (this.options.textCaption != null) {\n      this.prependTextCaptionToDom();\n    }\n  }\n\n  /**\n   * Gets the current FieldValue from the current {@link IQueryResult}.\n   *\n   * @returns {any} The current FieldValue or `null` if value is and `Object`.\n   */\n  public getValue() {\n    let value = Utils.getFieldValue(this.result, <string>this.options.field);\n    if (!isArray(value) && isObject(value)) {\n      value = null;\n    }\n    return value;\n  }\n\n  /**\n   * Renders a value to HTML using all of the current FieldValue component options.\n   * @param value The value to render.\n   * @returns {HTMLElement} The element containing the rendered value.\n   */\n  public renderOneValue(value: string): HTMLElement {\n    const element = $$('span').el;\n    let toRender = this.getCaption(value);\n\n    if (this.options.helper) {\n      // Try to resolve and execute version 2 of each helper function if available\n      const helper = TemplateHelpers.getHelper(`${this.options.helper}v2`) || TemplateHelpers.getHelper(`${this.options.helper}`);\n\n      if (Utils.exists(helper)) {\n        toRender = helper.call(this, value, this.getHelperOptions(), this.result);\n      } else {\n        this.logger.warn(\n          `Helper ${this.options.helper} is not found in available helpers. The list of supported helpers is :`,\n          keys(TemplateHelpers.getHelpers())\n        );\n      }\n\n      const fullDateStr = this.getFullDate(value, this.options.helper);\n      if (fullDateStr) {\n        element.setAttribute('title', fullDateStr);\n      }\n      if (this.options.helper == 'date' || this.options.helper == 'dateTime' || this.options.helper == 'emailDateTime') {\n        toRender = StringUtils.capitalizeFirstLetter(toRender);\n      }\n    }\n\n    if (this.options.htmlValue) {\n      element.innerHTML = toRender;\n    } else {\n      element.appendChild(document.createTextNode(toRender));\n    }\n    this.bindEventOnValue(element, value, toRender);\n    return element;\n  }\n\n  protected getValueContainer() {\n    return this.element;\n  }\n\n  private normalizeHelperAndOptions() {\n    this.options = ComponentOptions.initOptions(this.element, FieldValue.helperOptions, this.options, FieldValue.ID);\n    const toFilter = keys(FieldValue.options.helperOptions['subOptions']);\n    const toKeep = filter(toFilter, optionKey => {\n      const optionDefinition = FieldValue.options.helperOptions['subOptions'][optionKey];\n      if (optionDefinition) {\n        const helpers = optionDefinition.helpers;\n        return helpers != null && contains(helpers, this.options.helper);\n      }\n      return false;\n    });\n    this.options.helperOptions = omit(this.options.helperOptions, (value, key) => {\n      return !contains(toKeep, key);\n    });\n  }\n\n  private getHelperOptions() {\n    const inlineOptions = ComponentOptions.loadStringOption(this.element, 'helperOptions', {});\n    if (Utils.isNonEmptyString(inlineOptions)) {\n      return extend({}, this.options.helperOptions, eval('(' + inlineOptions + ')'));\n    }\n    return this.options.helperOptions;\n  }\n\n  private getFullDate(date: string, helper: string) {\n    const fullDateOptions: IDateToStringOptions = {\n      useLongDateFormat: true,\n      useTodayYesterdayAndTomorrow: false,\n      useWeekdayIfThisWeek: false,\n      omitYearIfCurrentOne: false\n    };\n\n    if (helper == 'date') {\n      return DateUtils.dateToString(new Date(parseInt(date)), fullDateOptions);\n    } else if (helper == 'dateTime' || helper == 'emailDateTime') {\n      return DateUtils.dateTimeToString(new Date(parseInt(date)), fullDateOptions);\n    }\n    return '';\n  }\n\n  private appendValuesToDom(values: string[]): void {\n    each(values, (value, index) => {\n      if (value != undefined) {\n        this.getValueContainer().appendChild(this.renderOneValue(value));\n        if (index !== values.length - 1) {\n          this.getValueContainer().appendChild(document.createTextNode(this.options.displaySeparator));\n        }\n      }\n    });\n  }\n\n  private renderTextCaption(): HTMLElement {\n    const element = $$('span', { className: 'coveo-field-caption' }, escape(this.options.textCaption));\n    return element.el;\n  }\n\n  protected prependTextCaptionToDom(): void {\n    const elem = this.getValueContainer();\n    $$(elem).prepend(this.renderTextCaption());\n    // Add a class to the container so the value and the caption wrap together.\n    $$(elem).addClass('coveo-with-label');\n  }\n\n  private bindEventOnValue(element: HTMLElement, originalFacetValue: string, renderedFacetValue: string) {\n    this.bindFacets(element, originalFacetValue, renderedFacetValue);\n  }\n\n  private getCaption(value: string) {\n    for (let facet of this.getFacets()) {\n      const caption = facet.getCaptionForStringValue(value);\n      if (caption) {\n        return caption;\n      }\n    }\n    return FacetUtils.tryToGetTranslatedCaption(this.options.field as string, value);\n  }\n\n  private getFacets() {\n    const facets = ComponentsTypes.getAllFacetsFromSearchInterface(this.searchInterface)\n      .filter(isFacetFieldValueCompatible)\n      .filter(facet => !facet.disabled);\n\n    const facetsWithMatchingId = facets.filter(facet => facet.options.id === this.options.facet);\n    if (facetsWithMatchingId.length) {\n      return facetsWithMatchingId;\n    }\n    return facets.filter(facet => facet.options.field === this.options.field);\n  }\n\n  private get isValueHierarchical() {\n    for (let facet of this.getFacets()) {\n      if (facet.isFieldValueHierarchical) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  private bindFacets(element: HTMLElement, originalFacetValue: string, renderedFacetValue: string) {\n    const facets = this.getFacets();\n\n    if (!facets.length) {\n      return;\n    }\n\n    const isValueSelected = !!find(facets, facet => facet.hasSelectedValue(originalFacetValue));\n    const selectAction = () => this.handleFacetSelection(isValueSelected, facets, originalFacetValue);\n    this.buildClickableElement(element, isValueSelected, renderedFacetValue, selectAction);\n  }\n\n  private buildClickableElement(element: HTMLElement, isSelected: boolean, value: string, selectAction: () => void) {\n    const label = isSelected ? l('RemoveFilterOn', value) : l('FilterOn', value);\n    new AccessibleButton().withTitle(label).withElement(element).withSelectAction(selectAction).build();\n\n    if (isSelected) {\n      $$(element).addClass('coveo-selected');\n    }\n    $$(element).addClass('coveo-clickable');\n  }\n\n  private handleFacetSelection(isValueSelected: boolean, facets: IFieldValueCompatibleFacet[], value: string) {\n    facets.forEach(facet => {\n      isValueSelected ? facet.deselectValue(value) : facet.selectValue(value);\n    });\n\n    this.executeQuery(value);\n  }\n\n  private executeQuery(value: string) {\n    this.queryController.deferExecuteQuery({\n      beforeExecuteQuery: () =>\n        this.usageAnalytics.logSearchEvent<IAnalyticsFieldValueMeta>(analyticsActionCauseList.documentField, {\n          facetId: this.options.facet,\n          facetField: this.options.field.toString(),\n          facetValue: value.toLowerCase()\n        })\n    });\n  }\n}\n\nInitialization.registerAutoCreateComponent(FieldValue);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/FieldValue/FieldValue.ts","import { Component, Initialization } from '../../Core';\nimport { exportGlobally } from '../../GlobalExports';\nimport { IQueryResult } from '../../rest/QueryResult';\nimport { IComponentBindings } from '../Base/ComponentBindings';\nimport { ComponentOptions } from '../Base/ComponentOptions';\nimport { IFieldOption } from '../Base/IComponentOptions';\nimport { FieldValue, IFieldValueOptions } from '../FieldValue/FieldValue';\n\nexport interface IImageFieldValue {\n  field?: IFieldOption;\n  width?: number;\n  height?: number;\n  alt?: string;\n  srcTemplate?: string;\n}\n\n/**\n * This component renders an image from a URL retrieved in a given [`field`]{@link ImageFieldValue.options.field}.\n *\n * A typical use case of this component is to display product images in the context of commerce.\n *\n * @isresulttemplatecomponent\n * @availablesince [September 2019 Release (v2.7023)](https://docs.coveo.com/en/2990/)\n */\nexport class ImageFieldValue extends Component {\n  static ID = 'ImageFieldValue';\n  static doExport = () => {\n    exportGlobally({\n      ImageFieldValue: ImageFieldValue\n    });\n  };\n\n  /**\n   * The options for the component\n   * @componentOptions\n   */\n  static options: IImageFieldValue = {\n    /**\n     * **Required**. The name of a field whose value is the URL of the image to display.\n     *\n     * **Note:** The component uses the value of this field to set the `src` attribute of the [`img`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) HTML tag it generates.\n     */\n    field: ComponentOptions.buildFieldOption({ required: true }),\n    /**\n     * The width of the image (in pixels).\n     *\n     * **Note:** The component uses this value to set the `width` attribute of the [`img`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) HTML tag it generates.\n     */\n    width: ComponentOptions.buildNumberOption(),\n    /**\n     * The height of the image (in pixels).\n     *\n     * **Note:** The component uses this value to set the `height` attribute of the [`img`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) HTML tag it generates.\n     */\n    height: ComponentOptions.buildNumberOption(),\n    /**\n     * A [template literal](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals)\n     * from which to generate the `img` tag's `src` attribute value.\n     *\n     * This option overrides the [`field`]{@link ImageFieldValue.options.field} option value.\n     *\n     * The template literal can reference any number of fields from the parent result. It can also reference global\n     * scope properties.\n     *\n     * **Examples:**\n     *\n     * - The following markup generates an `src` value such as `http://uri.com?id=itemTitle`:\n     *\n     * ```html\n     * <a class='CoveoImageFieldValue' data-src-template='${clickUri}?id=${raw.title}'></a>\n     * ```\n     *\n     * - The following markup generates an `src` value such as `localhost/fooBar`:\n     *\n     * ```html\n     * <a class='CoveoImageFieldValue' data-src-template='${window.location.hostname}/{Foo.Bar}'></a>\n     * ```\n     *\n     * Default value is `undefined`.\n     */\n    srcTemplate: ComponentOptions.buildStringOption()\n  };\n\n  /**\n   * Creates a new ImageFieldValue.\n   * @param element The HTMLElement on which to instantiate the component.\n   * @param options The options for the ImageFieldValue component.\n   * @param bindings The bindings that the component requires to function normally. If not set, these will be\n   * automatically resolved (with a slower execution time).\n   * @param result The result to associate the component with.\n   */\n  constructor(public element: HTMLElement, public options: IImageFieldValue, bindings?: IComponentBindings, public result?: IQueryResult) {\n    super(element, ImageFieldValue.ID, bindings);\n\n    this.options = ComponentOptions.initComponentOptions(element, ImageFieldValue, options);\n\n    const fieldValueOption: IFieldValueOptions = {\n      field: this.options.field,\n      helper: 'image',\n      htmlValue: true,\n      helperOptions: {\n        height: this.options.height,\n        width: this.options.width,\n        alt: result.title,\n        srcTemplate: this.options.srcTemplate\n      }\n    };\n    new FieldValue(element, fieldValueOption, bindings, result);\n  }\n}\n\nInitialization.registerAutoCreateComponent(ImageFieldValue);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/FieldImage/ImageFieldValue.ts","import { IQueryResult } from '../../rest/QueryResult';\nimport { Component } from '../Base/Component';\nimport { IResultListOptions } from './ResultListOptions';\nimport _ = require('underscore');\n\nexport class ResultListRenderer {\n  constructor(protected resultListOptions: IResultListOptions, protected autoCreateComponentsFn: Function) {}\n\n  renderResults(\n    resultElements: HTMLElement[],\n    append = false,\n    resultDisplayedCallback: (result: IQueryResult, resultElem: HTMLElement) => any\n  ) {\n    return Promise.all([this.getStartFragment(resultElements, append), this.getEndFragment(resultElements, append)]).then(\n      ([startFrag, endFrag]) => {\n        const resultsFragment = document.createDocumentFragment();\n        if (startFrag) {\n          resultsFragment.appendChild(startFrag);\n        }\n        _.each(resultElements, resultElement => {\n          resultsFragment.appendChild(resultElement);\n          resultDisplayedCallback(Component.getResult(resultElement), resultElement);\n        });\n        if (endFrag) {\n          resultsFragment.appendChild(endFrag);\n        }\n        this.resultListOptions.resultsContainer.appendChild(resultsFragment);\n      }\n    );\n  }\n\n  protected getStartFragment(resultElements: HTMLElement[], append: boolean): Promise<DocumentFragment> {\n    return Promise.resolve(document.createDocumentFragment());\n  }\n\n  protected getEndFragment(resultElements: HTMLElement[], append: boolean): Promise<DocumentFragment> {\n    return Promise.resolve(document.createDocumentFragment());\n  }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/ResultList/ResultListRenderer.ts","import { IComponentBindings } from '../Base/ComponentBindings';\nimport { exportGlobally } from '../../GlobalExports';\nimport { ComponentOptions, Initialization, $$, Component, HtmlTemplate } from '../../Core';\nimport { IQueryResults } from '../../rest/QueryResults';\nimport 'styling/_QuerySuggestPreview';\nimport { Template } from '../Templates/Template';\nimport { TemplateComponentOptions } from '../Base/TemplateComponentOptions';\nimport { ITemplateToHtml, TemplateToHtml } from '../Templates/TemplateToHtml';\nimport { ResultLink } from '../ResultLink/ResultLink';\nimport { OmniboxAnalytics } from '../Omnibox/OmniboxAnalytics';\nimport {\n  IAnalyticsOmniboxSuggestionMeta,\n  analyticsActionCauseList,\n  IAnalyticsClickQuerySuggestPreviewMeta\n} from '../Analytics/AnalyticsActionListMeta';\nimport { ISearchResultPreview } from '../../magicbox/ResultPreviewsManager';\nimport { ImageFieldValue } from '../FieldImage/ImageFieldValue';\nimport {\n  ResultPreviewsManagerEvents,\n  IPopulateSearchResultPreviewsEventArgs,\n  IUpdateResultPreviewsManagerOptionsEventArgs,\n  IBuildingResultPreviewsQueryEventArgs\n} from '../../events/ResultPreviewsManagerEvents';\nimport { IQuery } from '../../rest/Query';\nimport { Suggestion } from '../../magicbox/SuggestionsManager';\n\nexport interface IQuerySuggestPreview {\n  numberOfPreviewResults?: number;\n  resultTemplate?: Template;\n  executeQueryDelay?: number;\n}\n\n/**\n * This component renders previews of the top query results matching the currently focused query suggestion in the search box.\n *\n * As such, this component only works when the search interface can\n * [provide Coveo Machine Learning query suggestions](https://docs.coveo.com/en/340/#providing-coveo-machine-learning-query-suggestions).\n *\n * This component should be initialized on a `div` which can be nested anywhere inside the root element of your search interface.\n *\n * See [Rendering Query Suggestion Result Previews](https://docs.coveo.com/en/340/#rendering-query-suggestion-result-previews).\n *\n * @availablesince [December 2019 Release (v2.7610)](https://docs.coveo.com/en/3142/)\n */\nexport class QuerySuggestPreview extends Component implements IComponentBindings {\n  static ID = 'QuerySuggestPreview';\n\n  static doExport = () => {\n    exportGlobally({\n      QuerySuggestPreview: QuerySuggestPreview\n    });\n  };\n\n  /**\n   * The options for the component\n   * @componentOptions\n   */\n  static options: IQuerySuggestPreview = {\n    /**\n     * The HTML `id` attribute value, or CSS selector of the previously registered\n     * [result template](https://docs.coveo.com/413/) to apply when rendering the\n     * query suggestion result previews.\n     *\n     * **Examples**\n     * * Specifying the `id` attribute of the target result template:\n     * ```html\n     * <div class=\"CoveoQuerySuggestPreview\" data-result-template-id=\"myTemplateId\"></div>\n     * ```\n     * * Specifying an equivalent CSS selector:\n     * ```html\n     * <div class=\"CoveoQuerySuggestPreview\" data-result-template-selector=\"#myTemplateId\"></div>\n     * ```\n     *\n     * If you specify no previously registered template through this option, the component uses its default template.\n     */\n    resultTemplate: TemplateComponentOptions.buildTemplateOption(),\n    /**\n     * The maximum number of query results to render in the preview.\n     */\n    numberOfPreviewResults: ComponentOptions.buildNumberOption({\n      defaultValue: 4,\n      min: 1,\n      max: 6\n    }),\n    /**\n     *  The amount of focus time (in milliseconds) required on a query suggestion before requesting a preview of its top results.\n     */\n    executeQueryDelay: ComponentOptions.buildNumberOption({ defaultValue: 200 })\n  };\n\n  private omniboxAnalytics: OmniboxAnalytics;\n\n  /**\n   * Creates a new QuerySuggestPreview component.\n   * @param element The HTMLElement on which to instantiate the component.\n   * @param options The options for the QuerySuggestPreview component.\n   * @param bindings The bindings that the component requires to function normally. If not set, these will be\n   * automatically resolved (with a slower execution time).\n   */\n  constructor(public element: HTMLElement, public options?: IQuerySuggestPreview, public bindings?: IComponentBindings) {\n    super(element, QuerySuggestPreview.ID, bindings);\n\n    this.options = ComponentOptions.initComponentOptions(element, QuerySuggestPreview, options);\n\n    if (!this.options.resultTemplate) {\n      this.logger.warn(`No template was provided for ${QuerySuggestPreview.ID}, a default template was used instead.`);\n      this.options.resultTemplate = this.buildDefaultSearchResultPreviewTemplate();\n    }\n\n    this.bind.onRootElement(\n      ResultPreviewsManagerEvents.updateResultPreviewsManagerOptions,\n      (args: IUpdateResultPreviewsManagerOptionsEventArgs) =>\n        (args.displayAfterDuration = Math.max(args.displayAfterDuration || 0, this.options.executeQueryDelay))\n    );\n\n    this.bind.onRootElement(ResultPreviewsManagerEvents.populateSearchResultPreviews, (args: IPopulateSearchResultPreviewsEventArgs) =>\n      this.populateSearchResultPreviews(args)\n    );\n\n    this.omniboxAnalytics = this.searchInterface.getOmniboxAnalytics();\n  }\n\n  private buildDefaultSearchResultPreviewTemplate() {\n    return HtmlTemplate.create(\n      $$(\n        'div',\n        { className: 'result-template' },\n        $$(\n          'div',\n          { className: 'coveo-result-frame coveo-default-result-preview' },\n          $$('div', { className: Component.computeCssClassName(ImageFieldValue), 'data-field': '@image' }),\n          $$('a', { className: Component.computeCssClassName(ResultLink) })\n        )\n      ).el\n    );\n  }\n\n  private get templateToHtml() {\n    const templateToHtmlArgs: ITemplateToHtml = {\n      searchInterface: this.searchInterface,\n      queryStateModel: this.queryStateModel,\n      resultTemplate: this.options.resultTemplate\n    };\n    return new TemplateToHtml(templateToHtmlArgs);\n  }\n\n  private populateSearchResultPreviews(args: IPopulateSearchResultPreviewsEventArgs) {\n    args.previewsQueries.push(this.fetchSearchResultPreviews(args.suggestion));\n  }\n\n  private async fetchSearchResultPreviews(suggestion: Suggestion) {\n    const query = this.buildQuery(suggestion);\n    this.logShowQuerySuggestPreview();\n    const results = await this.queryController.getEndpoint().search(query);\n    if (!results) {\n      return [];\n    }\n    return this.buildResultsPreview(suggestion, results);\n  }\n\n  private buildQuery(suggestion: Suggestion) {\n    const query = this.buildDefaultQuery(suggestion);\n    $$(this.root).trigger(ResultPreviewsManagerEvents.buildingResultPreviewsQuery, <IBuildingResultPreviewsQueryEventArgs>{ query });\n    return query;\n  }\n\n  private buildDefaultQuery(suggestion: Suggestion): IQuery {\n    const { searchHub, pipeline, tab, locale, timezone, context, cq } = this.queryController.getLastQuery();\n    return {\n      firstResult: 0,\n      searchHub,\n      pipeline,\n      tab,\n      locale,\n      timezone,\n      context,\n      cq,\n      numberOfResults: this.options.numberOfPreviewResults,\n      q: suggestion.text || suggestion.dom.innerText,\n      ...(suggestion.advancedQuery && { aq: suggestion.advancedQuery })\n    };\n  }\n\n  private async buildResultsPreview(suggestion: Suggestion, results: IQueryResults) {\n    const buildResults = await this.templateToHtml.buildResults(results, 'preview', []);\n    if (!(buildResults.length > 0)) {\n      return [];\n    }\n    return buildResults.map((element, index) => this.buildResultPreview(suggestion, element, index));\n  }\n\n  private buildResultPreview(suggestion: Suggestion, element: HTMLElement, rank: number): ISearchResultPreview {\n    element.classList.add('coveo-preview-selectable');\n    const resultLink = element.querySelector(Component.computeSelectorForType(ResultLink.ID)) as HTMLElement;\n    if (resultLink) {\n      element.setAttribute('aria-label', resultLink.textContent);\n      resultLink.setAttribute('role', 'link');\n      resultLink.removeAttribute('aria-level');\n    }\n    return {\n      element,\n      onSelect: () => this.handleSelect(suggestion, element, rank)\n    };\n  }\n\n  private handleSelect(suggestion: Suggestion, element: HTMLElement, rank: number) {\n    this.logClickQuerySuggestPreview(suggestion, rank, element);\n    const link = $$(element).find(`.${Component.computeCssClassNameForType('ResultLink')}`);\n    if (link) {\n      const resultLink = <ResultLink>Component.get(link);\n      resultLink.openLinkAsConfigured();\n      resultLink.openLink();\n    }\n  }\n\n  private logShowQuerySuggestPreview() {\n    this.usageAnalytics.logSearchEvent<IAnalyticsOmniboxSuggestionMeta>(\n      analyticsActionCauseList.showQuerySuggestPreview,\n      this.omniboxAnalytics.buildCustomDataForPartialQueries()\n    );\n  }\n\n  private logClickQuerySuggestPreview(suggestion: Suggestion, displayedRank: number, element: HTMLElement) {\n    this.usageAnalytics.logCustomEvent<IAnalyticsClickQuerySuggestPreviewMeta>(\n      analyticsActionCauseList.clickQuerySuggestPreview,\n      {\n        suggestion: suggestion.text || suggestion.dom.innerText,\n        displayedRank\n      },\n      element\n    );\n  }\n}\n\nInitialization.registerAutoCreateComponent(QuerySuggestPreview);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/QuerySuggestPreview/QuerySuggestPreview.ts","/// <reference path='Facet.ts' />\nimport { StringUtils } from '../../utils/StringUtils';\nimport { QueryUtils } from '../../utils/QueryUtils';\nimport { FileTypes } from '../Misc/FileTypes';\nimport { DateUtils } from '../../utils/DateUtils';\nimport { Utils } from '../../utils/Utils';\nimport { $$ } from '../../utils/Dom';\nimport * as _ from 'underscore';\nimport FacetModuleDefinition = require('./Facet');\nimport { l } from '../../strings/Strings';\n\nexport class FacetUtils {\n  static getRegexToUseForFacetSearch(value: string, ignoreAccent: boolean) {\n    return new RegExp(StringUtils.stringToRegex(value, ignoreAccent), 'i');\n  }\n\n  static getDisplayValueFromValueCaption(value: string, field: string, valueCaption: Record<string, string>) {\n    const returnValue = this.tryToGetTranslatedCaption(field, value, false);\n    return valueCaption[value] || returnValue;\n  }\n\n  static getValuesToUseForSearchInFacet(original: string, facet: FacetModuleDefinition.Facet): string[] {\n    let ret = [original];\n    let regex = this.getRegexToUseForFacetSearch(original, facet.options.facetSearchIgnoreAccents);\n    if (facet.options.valueCaption) {\n      _.chain(facet.options.valueCaption)\n        .pairs()\n        .filter(pair => {\n          return regex.test(pair[1]);\n        })\n        .each(match => {\n          ret.push(match[0]);\n        });\n      if (\n        QueryUtils.isStratusAgnosticField(<string>facet.options.field, '@objecttype') ||\n        QueryUtils.isStratusAgnosticField(<string>facet.options.field, '@filetype')\n      ) {\n        _.each(FileTypes.getFileTypeCaptions(), (value: string, key: string) => {\n          if (!(key in facet.options.valueCaption) && regex.test(value)) {\n            ret.push(key);\n          }\n        });\n      }\n    } else if (\n      QueryUtils.isStratusAgnosticField(<string>facet.options.field, '@objecttype') ||\n      QueryUtils.isStratusAgnosticField(<string>facet.options.field, '@filetype')\n    ) {\n      _.each(\n        _.filter(_.pairs(FileTypes.getFileTypeCaptions()), pair => {\n          return regex.test(pair[1]);\n        }),\n        match => {\n          ret.push(match[0]);\n        }\n      );\n    } else if (QueryUtils.isStratusAgnosticField(<string>facet.options.field, '@month')) {\n      _.each(_.range(1, 13), month => {\n        if (regex.test(DateUtils.monthToString(month - 1))) {\n          ret.push(('0' + month.toString()).substr(-2));\n        }\n      });\n    }\n    return ret;\n  }\n\n  static buildFacetSearchPattern(values: string[]) {\n    values = _.map(values, value => {\n      return Utils.escapeRegexCharacter(value);\n    });\n    values[0] = '.*' + values[0] + '.*';\n    return values.join('|');\n  }\n\n  static needAnotherFacetSearch(\n    currentSearchLength: number,\n    newSearchLength: number,\n    oldSearchLength: number,\n    desiredSearchLength: number\n  ) {\n    // Something was removed (currentSearch < newSearch)\n    // && we might want to display more facet search result(currentSearch < desiredSearch)\n    // && the new query returned more stuff than the old one so there's still more results(currentSearchLength > oldLength)\n    return currentSearchLength < newSearchLength && currentSearchLength < desiredSearchLength && currentSearchLength > oldSearchLength;\n  }\n\n  static addNoStateCssClassToFacetValues(facet: FacetModuleDefinition.Facet, container: HTMLElement) {\n    // This takes care of adding the correct css class on each facet value checkbox (empty white box) if at least one value is selected in that facet\n    if (facet.values.getSelected().length != 0) {\n      let noStates = $$(container).findAll('li:not(.coveo-selected)');\n      _.each(noStates, noState => {\n        $$(noState).addClass('coveo-no-state');\n      });\n    }\n  }\n\n  static tryToGetTranslatedCaption(field: string, value: string, fallbackOnLocalization = true) {\n    let found: string;\n\n    if (QueryUtils.isStratusAgnosticField(field.toLowerCase(), '@filetype')) {\n      found = FileTypes.getFileType(value, fallbackOnLocalization).caption;\n    } else if (QueryUtils.isStratusAgnosticField(field.toLowerCase(), '@objecttype')) {\n      found = FileTypes.getObjectType(value, fallbackOnLocalization).caption;\n    } else if (FacetUtils.isMonthFieldValue(field, value)) {\n      const month = parseInt(value, 10);\n      found = DateUtils.monthToString(month - 1);\n    } else if (fallbackOnLocalization) {\n      found = l(value);\n    }\n    return found != undefined && Utils.isNonEmptyString(found) ? found : value;\n  }\n\n  static isMonthFieldValue(field: string, value: string) {\n    if (!QueryUtils.isStratusAgnosticField(field.toLowerCase(), '@month')) {\n      return false;\n    }\n\n    const asInt = parseInt(value, 10);\n\n    if (isNaN(asInt)) {\n      return false;\n    }\n\n    if (asInt < 1 || asInt > 12) {\n      return false;\n    }\n\n    return true;\n  }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/Facet/FacetUtils.ts","import { Template, TemplateRole } from './Template';\nimport { TemplateList } from './TemplateList';\nimport _ = require('underscore');\n\nexport class TableTemplate extends TemplateList {\n  instantiateRoleToString(role: TemplateRole) {\n    const roledTemplate = _.find(this.templates, t => t.role === role);\n    if (roledTemplate) {\n      return roledTemplate.instantiateToString(undefined, {});\n    } else {\n      return this.defaultRoledTemplates[role];\n    }\n  }\n  instantiateRoleToElement(role: TemplateRole) {\n    const roledTemplate = _.find(this.templates, t => t.role === role);\n    if (roledTemplate) {\n      return roledTemplate.instantiateToElement(undefined, {});\n    } else {\n      const tmpl = new Template(() => this.defaultRoledTemplates[role]);\n      tmpl.layout = 'table';\n      return tmpl.instantiateToElement(undefined);\n    }\n  }\n\n  private defaultTemplate = `<td><a class=\"CoveoResultLink\"></a></td>\n                             <td><span class=\"CoveoExcerpt\"></span></td>\n                             <td><span class=\"CoveoFieldValue\" data-field=\"@date\" data-helper=\"date\"></span></td>`;\n\n  private defaultRoledTemplates = {\n    'table-header': `<th style=\"width: 40%\">Link</th>\n                     <th>Excerpt</th>\n                     <th style=\"width: 20%\"\n                         class=\"CoveoSort coveo-table-header-sort\"\n                         data-sort-criteria=\"date ascending,date descending\"\n                         data-display-unselected-icon=\"false\">Date</th>`,\n    'table-footer': `<th>Link</th>\n                     <th>Excerpt</th>\n                     <th>Date</th>`\n  };\n\n  protected getFallbackTemplate(): Template {\n    return new Template(() => this.defaultTemplate);\n  }\n\n  hasTemplateWithRole(role: TemplateRole) {\n    return _.find(this.templates, t => t.role === role);\n  }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/Templates/TableTemplate.ts","import { Template } from './Template';\nimport { IQueryResult } from '../../rest/QueryResult';\n\nexport class DefaultRecommendationTemplate extends Template {\n  instantiateToString(object?: IQueryResult): string {\n    var template = `<div class=\"coveo-result-frame\">\n        <div class=\"coveo-result-row\">\n          <div class=\"coveo-result-cell\" style=\"width:40px;text-align:center;vertical-align:middle;\">\n            <span class=\"CoveoIcon\" data-small=\"true\" data-with-label=\"false\">\n            </span>\n          </div>\n          <div class=\"coveo-result-cell\" style=\"padding:0 0 3px 5px;vertical-align:middle\">\n            <div class=\"coveo-result-row\">\n              <div class=\"coveo-result-cell\" style=\"font-size:10pt;\">\n                <a class=\"CoveoResultLink\" style=\"display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis\">\n                </a>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>`;\n    return template;\n  }\n\n  instantiateToElement(object?: IQueryResult): Promise<HTMLElement> {\n    return new Promise((resolve, reject) => {\n      var div = document.createElement('div');\n      div.innerHTML = this.instantiateToString(object);\n      resolve(div);\n    });\n  }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/Templates/DefaultRecommendationTemplate.ts","import { IQueryResults } from '../../rest/QueryResults';\nimport { IQueryResult } from '../../rest/QueryResult';\nimport { Assert, QueryUtils, Component, Initialization, QueryStateModel } from '../../Core';\nimport { IInitResult } from '../Base/Initialization';\nimport { Template } from './Template';\nimport { SearchInterface } from '../../ui/SearchInterface/SearchInterface';\nimport { ResultList } from '../ResultList/ResultList';\nimport { RendererValidLayout } from '../ResultLayoutSelector/ValidLayout';\nimport { pluck, sortBy, map } from 'underscore';\nimport { $$ } from '../../utils/Dom';\nimport { Logger } from '../../misc/Logger';\n\nexport interface ITemplateToHtml {\n  resultTemplate: Template;\n  queryStateModel: QueryStateModel;\n  searchInterface: SearchInterface;\n}\n\nexport class TemplateToHtml {\n  constructor(public args: ITemplateToHtml) {}\n\n  public async buildResults(\n    results: IQueryResults,\n    layout: RendererValidLayout,\n    currentlyDisplayedResults: IQueryResult[]\n  ): Promise<HTMLElement[]> {\n    const res: { elem: HTMLElement; idx: number }[] = [];\n    const resultsPromises = map(results.results, (result: IQueryResult, index: number) => {\n      return this.buildResult(result, layout, currentlyDisplayedResults).then((resultElement: HTMLElement) => {\n        if (resultElement != null) {\n          res.push({ elem: resultElement, idx: index });\n        }\n        ResultList.resultCurrentlyBeingRendered = null;\n        return resultElement;\n      });\n    });\n\n    // We need to sort by the original index order, because in lazy loading mode, it's possible that results does not gets rendered\n    // in the correct order returned by the index, depending on the time it takes to load all the results component for a given result template\n    return Promise.all(resultsPromises).then(() => {\n      return pluck(sortBy(res, 'idx'), 'elem');\n    });\n  }\n\n  public async buildResult(\n    result: IQueryResult,\n    layout: RendererValidLayout,\n    currentlyDisplayedResults: IQueryResult[]\n  ): Promise<HTMLElement> {\n    Assert.exists(result);\n    QueryUtils.setStateObjectOnQueryResult(this.args.queryStateModel.get(), result);\n    QueryUtils.setSearchInterfaceObjectOnQueryResult(this.args.searchInterface, result);\n    ResultList.resultCurrentlyBeingRendered = result;\n    const resultElement = await this.createHtmlElement(result, layout);\n\n    if (resultElement != null) {\n      Component.bindResultToElement(resultElement, result);\n    }\n    currentlyDisplayedResults.push(result);\n\n    await this.autoCreateComponentsInsideResult(resultElement, result).initResult;\n\n    this.verifyChildren(resultElement);\n    return resultElement;\n  }\n\n  public autoCreateComponentsInsideResult(element: HTMLElement, result: IQueryResult): IInitResult {\n    Assert.exists(element);\n    return Initialization.automaticallyCreateComponentsInsideResult(element, result);\n  }\n\n  private createHtmlElement(result: IQueryResult, layout: RendererValidLayout) {\n    return this.args.resultTemplate.instantiateToElement(result, {\n      wrapInDiv: true,\n      checkCondition: true,\n      currentLayout: layout,\n      responsiveComponents: this.args.searchInterface.responsiveComponents\n    });\n  }\n\n  private verifyChildren(element: HTMLElement) {\n    const containsResultLink = !!$$(element).find('.CoveoResultLink');\n    if (containsResultLink) {\n      return;\n    }\n\n    const msg = `Result does not contain a \"CoveoResultLink\" component, please verify the result template`;\n    new Logger(element).warn(msg, this.args.resultTemplate);\n  }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/Templates/TemplateToHtml.ts","import { TemplateHelpers, ITemplateHelperFunction } from './TemplateHelpers';\nimport { IHighlight, IHighlightPhrase, IHighlightTerm } from '../../rest/Highlight';\nimport { HighlightUtils, StringAndHoles } from '../../utils/HighlightUtils';\nimport { IStreamHighlightOptions } from '../../utils/StreamHighlightUtils';\nimport { IDateToStringOptions, DateUtils } from '../../utils/DateUtils';\nimport { ICurrencyToStringOptions, CurrencyUtils } from '../../utils/CurrencyUtils';\nimport { IAnchorUtilsOptions, IImageUtilsOptions, AnchorUtils, ImageUtils } from '../../utils/HtmlUtils';\nimport { IQueryResult } from '../../rest/QueryResult';\nimport { Utils } from '../../utils/Utils';\nimport { StringUtils } from '../../utils/StringUtils';\nimport { TimeSpan, ITimeSpanUtilsOptions } from '../../utils/TimeSpanUtils';\nimport { EmailUtils } from '../../utils/EmailUtils';\nimport { QueryUtils } from '../../utils/QueryUtils';\nimport { DeviceUtils } from '../../utils/DeviceUtils';\nimport { $$ } from '../../utils/Dom';\nimport { SearchEndpoint } from '../../rest/SearchEndpoint';\nimport { StreamHighlightUtils } from '../../utils/StreamHighlightUtils';\nimport { FacetUtils } from '../Facet/FacetUtils';\nimport * as Globalize from 'globalize';\nimport { IStringMap } from '../../rest/GenericParam';\nimport * as _ from 'underscore';\nimport { Component } from '../Base/Component';\nimport { TemplateCache } from './TemplateCache';\nimport { INumberFormatOptions } from '../../utils/NumberUtils';\n\n/**\n * The core template helpers provided by default.\n *\n * **Examples:**\n *\n * **HTML**\n *\n * ```html\n * <div class=\"CoveoFieldValue\" data-field=\"@videoduration\" data-helper=\"timeSpan\" data-helper-options-is-milliseconds=\"false\"></div>\n * ```\n *\n * **Underscore**\n *\n * ```erb\n * <%= timeSpan(raw.videoduration, { isMilliseconds: false }) %>\n * ```\n */\nexport interface ICoreHelpers {\n  /**\n   * Shortens a string so that its length does not exceed a specific number of\n   * characters. An ellipsis is appended to the string if it exceeds the\n   * maximum length.\n   *\n   * - `content`: The string to shorten.\n   * - `length`: The maximum length of the resulting string.\n   * - `highlights`: Optional. If provided, the string will be highlighted\n   *   using this highlight information.\n   * - `cssClass`: Optional. When highlighting, the name of the CSS class to use.\n   */\n  shorten: (content: string, length: number, highlights?: IHighlight[], cssClass?: string) => string;\n  /**\n   * Shortens a string using an algorithm suitable for file paths. The helper\n   * will insert an ellipsis in the string where text has been removed when\n   * the path exceeds the maximum length.\n   *\n   * - `content`: The path to shorten.\n   * - `length`: The maximum length of the resulting string.\n   * - `highlights`: Optional. If provided, the string will be highlighted using\n   *   this highlight information.\n   * - `cssClass`: Optional. When highlighting, the name of the CSS class to use.\n   */\n  shortenPath: (content: string, length: number, highlights?: IHighlight[], cssClass?: string) => string;\n  /**\n   * Shortens a string using an algorithm suitable for URIs. The helper will\n   * insert an ellipsis in the string where text has been removed when the URI\n   * exceeds the maximum length.\n   *\n   * - `content`: The URI to shorten.\n   * - `length`: The maximum length of the resulting string.\n   * - `highlights`: Optional. If provided, the string will be highlighted\n   *   using this highlight information.\n   * - `cssClass`: Optional. When highlighting, the name of the CSS class to use.\n   */\n  shortenUri: (content: string, length: number, highlights?: IHighlight[], cssClass?: string) => string;\n  /**\n   * Highlights a string using the provided highlight information.\n   *\n   * - `content`: The URI to shorten.\n   * - `highlights`: Optional. The highlight information to use.\n   * - `cssClass`: Optional. The name of the CSS class to use for highlighting.\n   */\n  highlight: (content: string, highlights?: IHighlight[], cssClass?: string) => string;\n  /**\n   * Highlights the provided terms in a given string.<br/>\n   * By default, the terms to highlight are the current query and the\n   * associated stemming words from the index.\n   * The only required parameter is the content, which specify the string that needs to be highlighted.\n   * The other parameters will normally be automatically resolved for you from the current result object.\n   *\n   * - `content`: The string content to highlight\n   * - `termsToHighlight`: The terms to highlight (see {@link IHighlightTerm})\n   * - `phraseToHighlight`: The phrases to highlight (see {@link IHighlightPhrase})\n   * - `options`: Optional. The options defined below as {@link IStreamHighlightOptions}\n   *\n   * **Note:**\n   * > `highlightStreamText` should only be used for very particular/specific use cases (e.g., augmenting the result template with additional information rather than the typical excerpt/title), and is not a proper replacement for actually having the correct title and excerpt on your results.\n   * >\n   * > Using incorrect result titles or excerpts on your search interface also causes relevancy to suffer greatly, as the index uses the title and excerpt to find relevant results. Consequently, end users are more likely to see results whose titles do not match their query.\n   * >\n   * > Moreover, the recommended method to implement simple title and/or excerpt highlighting is to simply use the {@link Excerpt} and {@link ResultLink} components.\n   */\n  highlightStreamText: (\n    content: string,\n    termsToHighlight: IHighlightTerm,\n    phrasesToHighlight: IHighlightPhrase,\n    options?: IStreamHighlightOptions\n  ) => string;\n  /**\n   * This helper operates exactly like the {@link highlightStreamText} helper, except\n   * that it should be used to highlight HTML content. The helper takes care\n   * of not highlighting the HTML markup.\n   *\n   * - `content`: The string content to highlight\n   * - `termsToHighlight`: The terms to highlight (see {@link IHighlightTerm})\n   * - `phraseToHighlight`: The phrases to highlight (see {@link IHighlightPhrase})\n   * - `options`: Optional. The options defined below as {@link IStreamHighlightOptions}\n   *\n   * **Note:**\n   * > `highlightStreamHTML` should only be used for very particular/specific use cases (e.g., augmenting the result template with additional information rather than the typical excerpt/title), and is not a proper replacement for actually having the correct title and excerpt on your results.\n   * >\n   * > Using incorrect result titles or excerpts on your search interface also causes relevancy to suffer greatly, as the index uses the title and excerpt to find relevant results. Consequently, end users are more likely to see results whose titles do not match their query.\n   * >\n   * > Moreover, the recommended method to implement simple title and/or excerpt highlighting is to simply use the {@link Excerpt} and {@link ResultLink} components.\n   */\n  highlightStreamHTML: (\n    content: string,\n    termsToHighlight: IHighlightTerm,\n    phrasesToHighlight: IHighlightPhrase,\n    options?: IStreamHighlightOptions\n  ) => string;\n  /**\n   * Formats a numeric value using the format string.\n   *\n   * - `content`: The numeric value to format.\n   * - `format` Optional. The string format to use. See the <a href=\"https://github.com/klaaspieter/jquery-global#numbers\" target=\"_blank\">Globalize</a> library for the list of available formats.\n   *\n   * When the helper is used in a [`FieldValue`]{@link FieldValue} component, this value is automatically retrieved from the specified [`field`]{@link FieldValue.options.field}.\n   *\n   * **Example:**\n   *\n   *  ```html\n   *  <div class=\"CoveoFieldValue\" data-field=\"@viewcount\" data-text-caption=\"Views\" data-helper=\"number\" data-helper-options-format=\"n0\"></div>\n   *  ```\n   */\n  number: (content: string, format: string | INumberFormatOptions) => string;\n  /**\n   * Formats a date value to a date-only string using the specified options.\n   *\n   * - `content`: The Date value to format.\n   * - `options`: Optional. The options to use (see {@link IDateToStringOptions}).\n   */\n  date: (content: any, options?: IDateToStringOptions) => string;\n  /**\n   * Formats a date value to a time-only string using the specified options.\n   *\n   * - `content`: The Date value to format.\n   * - `options`: Optional. The options to use (see {@link IDateToStringOptions}).\n   */\n  time: (content: any, options?: IDateToStringOptions) => string;\n  /**\n   * Formats a date value to a date and time string using the specified\n   * options.\n   *\n   * - `content`: The Date value to format.\n   * - `options`: Optional. The options to use (see {@link IDateToStringOptions}).\n   */\n  dateTime: (content: any, options?: IDateToStringOptions) => string;\n  /**\n   * Formats a currency value to a string using the specified options.\n   *\n   * - `content`: The number value to format.\n   * - `options`: Optional. The options to use (see {@link ICurrencyToStringOptions}).\n   */\n  currency: (content: any, options?: ICurrencyToStringOptions) => string;\n  /**\n   * Formats a date value to a date and time string using options suitable for\n   * email dates\n   *\n   * - `content`: The Date value to format.\n   * - `options`: Optional. The options to use (see {@link IDateToStringOptions}).\n   */\n  emailDateTime: (content: any, options?: IDateToStringOptions) => string;\n  /**\n   * Renders one or several email values in `mailto:` hyperlinks.\n   *\n   * - `value`: The string or array of strings that contains a list of semicolon-separated email\n   *   values. When multiple values are passed, each value is displayed in a\n   *   separate hyperlink.\n   * - `companyDomain`: Optional. The string that contains your own domain (e.g.:\n   *   coveo.com). When specified, this parameter allows email addresses\n   *   coming from your own domain to be displayed in a shortened format\n   *   (e.g.: Full Name), whereas email addresses coming from an external\n   *   domain will be displayed in an extended format (e.g.: Full Name\n   *   (domain.com)). If this parameter is not specified, then the shortened\n   *   format will automatically be used.\n   * - `me`: Optional. The string that contains the current username. If it is\n   *   specified, then the email address containing the current username will\n   *   be replaced by the localized string 'Me'.\n   * - `lengthLimit`: Optional. The number of email addresses that you want to display\n   *   before an ellipse is added (e.g.: 'From Joe, John and 5 others').<br/>\n   *   The default value is 2.\n   * - `truncateName`: Optional. When the username is available from the email address,\n   *   then you can specify if you want to truncate the full name. (e.g.:\n   *   'John S.' instead of 'John Smith').<br/>\n   *   The default value is `false`.\n   */\n  email: (value: string | string[], companyDomain?: string, me?: string, lengthLimit?: number, truncateName?: boolean) => string;\n  /**\n   * Formats a clickable HTML link (`<a>`).\n   *\n   * - `href`: The link URI\n   * - `options`: Optional. The options to use (see {@link IAnchorUtilsOptions})\n   */\n  anchor: (href: string, options?: IAnchorUtilsOptions) => string;\n  /**\n   * Formats an HTML image tag (`<img>`).\n   *\n   * - `src`: The image source URI\n   * - `options`: Optional. The options to use (see {@link IImageUtilsOptions})\n   */\n  image: (src: string, options?: IImageUtilsOptions) => string;\n  /**\n   * Formats an HTML image tag (`<img>`), and automatically uses the result\n   * object to query the REST API to get the thumbnail for this result. For\n   * example, this can be used to great effect when designing a template\n   * showing users or previews of files.\n   * - `result`: Optional. The current result object inside your template. In\n   *   underscore, it is referenced as `obj`. By default, the result\n   *   will be resolved automatically from your current template function (\n   *   Meaning the nearest result in the current call stack execution inside\n   *   your template)\n   * - `endpoint`: Optional. The name of the endpoint to use for your\n   *   thumbnail. Default is default.\n   * - `options`: Optional. The options to use (see {@link IImageUtilsOptions}).\n   */\n  thumbnail: (result?: IQueryResult, endpoint?: string, options?: IImageUtilsOptions) => string;\n  /**\n   * Generates an icon based on the file type of the current result. The icon\n   * will be contained inside a `<span>` element with the appropriate CSS\n   * class.\n   *\n   * - `result`: Optional. The current result object inside your template. In\n   *   underscore, it is referenced as `obj`. By default, the result\n   *   will be resolved automatically from your current template function (\n   *   Meaning the nearest result in the current call stack execution inside\n   *   your template)\n   * - `options`: Optional. The options to use (see {@link IIconOptions}).\n   */\n  fromFileTypeToIcon: (result?: IQueryResult, options?: any) => string;\n  /**\n   * Loads a partial template in the current template, by passing the ID of\n   * the template to load, the condition for which this template should be\n   * loaded, and the context object (the object that the loaded template will\n   * use as its data). By default, the context object will be the same as the\n   * template that called this helper function. So, for example, in a\n   * ResultList Component, the contextObject would, by default, be the Query\n   * Results.\n   *\n   * - `templateId`: The ID of the template to load.\n   * - `condition`: Optional. The boolean condition to determine if this template should\n   *   load for this result set. Most of the time this would be a condition of\n   *   the type if raw.somefield == 'something'.\n   * - `contextObject`: Optional. The object that should be used by the loaded template\n   *   as its contextObject.\n   */\n  loadTemplate: (templateId: string, condition?: boolean, contextObject?: any) => string;\n  /**\n   * Given a number, either in millisecond or second, convert to a HH:MM:SS format.\n   *\n   * **Examples**\n   *\n   * >`timeSpan(1, {isMilliseconds: false}) => '00:01'`\n   * >\n   * >`timeSpan(1000, {isMilliseconds: true}) => '00:01'`\n   *\n   * - `value`: The number to convert to a timespan\n   * - `options` : The options to use (see {@link ITimeSpanUtilsOptions})\n   */\n  timeSpan: (value: number, options: ITimeSpanUtilsOptions) => string;\n  /**\n   * Formats a number, which represents a file size in bytes, into a logical unit size.\n   *\n   * **Examples:**\n   *\n   * >`size(1024) => 1024 B`\n   * >\n   * >`size(1025) => 1 KB`\n   * >\n   * >`size(10240) => 10 KB`\n   *\n   * **Examples:**\n   *\n   * >**HTML**\n   * >\n   * > ```html\n   * > <div class=\"CoveoFieldValue\" data-field='@size' data-helper=\"size\" data-helper-options-base=\"1\"></div>\n   * > ```\n   *\n   * >**Underscore**\n   * >\n   * > ```erb\n   * > <%= size(raw.size, {base: 0, precision: 2}) %>\n   * > ```\n   *\n   * - `value`: The number to format\n   * - `options` : The options to use (see {@link ISizeOptions})\n   */\n  size: (value: number, options?: ISizeOptions) => string;\n  /**\n   * Given a filetype value, try to return a translated and human readable version.\n   *\n   * If the filetype is known and recognized by the framework, a translated value will be returned.\n   *\n   * **Examples**\n   *\n   * >`translatedCaption('doc') => Document`\n   * >\n   * >`translatedCaption('xls') => Spreadsheet Document`\n   *\n   * - `value`: The string value to translate\n   */\n  translatedCaption: (value: string) => string;\n  /**\n   * Replace all carriage return in a string by a &lt;br /&gt; tag\n   *\n   * - `value`: The string value to replace the carriage returns in.\n   */\n  encodeCarriageReturn: (value: string) => string;\n  /**\n   * Detect if the results is being rendered in a mobile device.\n   *\n   * If it's not a mobile device, the helper return null ;\n   *\n   * If it's a mobile device, return the type of device (Android, iPhone, iPad) etc.\n   */\n  isMobileDevice: () => string;\n}\n\n/**\n * Available options for the size templateHelpers.\n *\n * Example:\n * <div class=\"CoveoFieldValue\" data-helper=\"helperName\" data-helper-options-optionName=\"option-value\"></div>\n */\nexport interface ISizeOptions {\n  /**\n   * The base into which to format the value.\n   *\n   * Formula: value * 10^(3 * base)\n   *\n   * **Examples:**\n   * > **Base 0:**\n   * >\n   * > 1 => 1B\n   * >\n   * > 1000 => 1KB\n   *\n   * > **Base 1:**\n   * >\n   * > 1 => 1KB\n   * >\n   * > 1000 => 1MB\n   */\n  base?: number;\n  /**\n   * The precision to use to format the size (i.e., the number of digits to display after the decimal)\n   *\n   * **Examples:**\n   * > **Precision 0:**\n   * >\n   * > 1.0 => 1\n   * >\n   * > 1.85 => 1\n   *\n   * > **Precision 1:**\n   * >\n   * > 1.0 => 1.0\n   * >\n   * > 1.85 => 1.8\n   */\n\n  precision?: number;\n}\n\nexport interface IShortenOptions {\n  length: number;\n  highlights?: IHighlight[];\n  cssClass?: string;\n}\n\nexport interface IHighlightsOptions {\n  highlights: IHighlight[];\n  cssClass?: string;\n}\n\nexport interface IHelperStreamHighlightOptions {\n  termsToHighlight: IHighlightTerm;\n  phrasesToHighlight: IHighlightPhrase;\n  opts?: IStreamHighlightOptions;\n}\n\nexport interface IPluralOptions {\n  singular: string;\n  plural: string;\n}\n\nexport class CoreHelpers {\n  public constructor() {}\n\n  /**\n   * For backward compatibility reason, the \"global\" template helper should be available under the\n   * coveo namespace.\n   * @param scope\n   */\n  public static exportAllHelpersGlobally(scope: IStringMap<any>) {\n    _.each(TemplateHelpers.getHelpers(), (helper: ITemplateHelperFunction, name: string) => {\n      if (scope[name] == undefined) {\n        scope[name] = helper;\n      }\n    });\n  }\n}\n\nTemplateHelpers.registerFieldHelper('javascriptEncode', (value: string) => {\n  return Utils.exists(value) ? StringUtils.javascriptEncode(value) : undefined;\n});\n\nconst executeShorten = (content: string, options: IShortenOptions) => {\n  const strAndHoles = StringAndHoles.shortenString(content, options.length, '...');\n  if (Utils.exists(options.highlights)) {\n    return HighlightUtils.highlightString(strAndHoles.value, options.highlights, strAndHoles.holes, options.cssClass || 'highlight');\n  } else {\n    return strAndHoles.value;\n  }\n};\n\nTemplateHelpers.registerTemplateHelper('shorten', (content: string, length: number, highlights?: IHighlight[], cssClass?: string) => {\n  return executeShorten(content, {\n    length,\n    highlights,\n    cssClass\n  });\n});\n\nTemplateHelpers.registerTemplateHelper('shortenv2', (content: string, options: IShortenOptions) => {\n  return executeShorten(content, options);\n});\n\nconst executeShortenPath = (content: string, options: IShortenOptions) => {\n  const strAndHoles = StringAndHoles.shortenPath(content, options.length);\n  if (Utils.exists(options.highlights)) {\n    return HighlightUtils.highlightString(strAndHoles.value, options.highlights, strAndHoles.holes, options.cssClass || 'highlight');\n  } else {\n    return strAndHoles.value;\n  }\n};\n\nTemplateHelpers.registerTemplateHelper('shortenPath', (content: string, length: number, highlights?: IHighlight[], cssClass?: string) => {\n  return executeShortenPath(content, {\n    length,\n    highlights,\n    cssClass\n  });\n});\n\nTemplateHelpers.registerFieldHelper('shortenPathv2', (content: string, options: IShortenOptions) => {\n  return executeShortenPath(content, options);\n});\n\nconst executeShortenUri = (content: string, options: IShortenOptions) => {\n  const strAndHoles = StringAndHoles.shortenUri(content, options.length);\n\n  if (Utils.exists(options.highlights)) {\n    return HighlightUtils.highlightString(strAndHoles.value, options.highlights, strAndHoles.holes, options.cssClass || 'highlight');\n  } else {\n    return strAndHoles.value;\n  }\n};\n\nTemplateHelpers.registerTemplateHelper('shortenUri', (content: string, length: number, highlights?: IHighlight[], cssClass?: string) => {\n  return executeShortenUri(content, {\n    length,\n    highlights,\n    cssClass\n  });\n});\n\nTemplateHelpers.registerTemplateHelper('shortenUriv2', (content: string, options: IShortenOptions) => {\n  return executeShortenUri(content, options);\n});\n\nconst executeHighlight = (content: string, options: IHighlightsOptions) => {\n  if (Utils.exists(content)) {\n    if (Utils.exists(options.highlights)) {\n      return HighlightUtils.highlightString(content, options.highlights, null, options.cssClass || 'highlight');\n    } else {\n      return content;\n    }\n  } else {\n    return undefined;\n  }\n};\n\nTemplateHelpers.registerTemplateHelper('highlight', (content: string, highlights: IHighlight[], cssClass?: string) => {\n  return executeHighlight(content, {\n    highlights,\n    cssClass\n  });\n});\n\nTemplateHelpers.registerTemplateHelper('highlightv2', (content: string, options: IHighlightsOptions) => {\n  return executeHighlight(content, options);\n});\n\nconst executeHighlightStreamText = (content: string, options: IHelperStreamHighlightOptions) => {\n  if (Utils.exists(content) && Utils.exists(options.termsToHighlight) && Utils.exists(options.phrasesToHighlight)) {\n    if (termsToHighlightAreDefined(options.termsToHighlight, options.phrasesToHighlight)) {\n      return StreamHighlightUtils.highlightStreamText(content, options.termsToHighlight, options.phrasesToHighlight, options.opts);\n    } else {\n      return content;\n    }\n  } else {\n    return undefined;\n  }\n};\n\nTemplateHelpers.registerTemplateHelper(\n  'highlightStreamText',\n  (\n    content: string,\n    termsToHighlight = resolveTermsToHighlight(),\n    phrasesToHighlight = resolvePhrasesToHighlight(),\n    opts?: IStreamHighlightOptions\n  ) => {\n    return executeHighlightStreamText(content, {\n      termsToHighlight,\n      phrasesToHighlight,\n      opts\n    });\n  }\n);\n\nTemplateHelpers.registerTemplateHelper('highlightStreamTextv2', (content: string, options: IHelperStreamHighlightOptions) => {\n  const mergedOptions = {\n    termsToHighlight: resolveTermsToHighlight(),\n    phrasesToHighlight: resolvePhrasesToHighlight(),\n    ...options\n  };\n  return executeHighlightStreamText(content, mergedOptions);\n});\n\nconst executeHighlightStreamHTML = (content: string, options: IHelperStreamHighlightOptions) => {\n  if (Utils.exists(content) && Utils.exists(options.termsToHighlight) && Utils.exists(options.phrasesToHighlight)) {\n    if (termsToHighlightAreDefined(options.termsToHighlight, options.phrasesToHighlight)) {\n      return StreamHighlightUtils.highlightStreamHTML(content, options.termsToHighlight, options.phrasesToHighlight, options.opts);\n    } else {\n      return content;\n    }\n  } else {\n    return undefined;\n  }\n};\n\nTemplateHelpers.registerTemplateHelper(\n  'highlightStreamHTML',\n  (\n    content: string,\n    termsToHighlight = resolveTermsToHighlight(),\n    phrasesToHighlight = resolvePhrasesToHighlight(),\n    opts?: IStreamHighlightOptions\n  ) => {\n    return executeHighlightStreamHTML(content, {\n      termsToHighlight,\n      phrasesToHighlight,\n      opts\n    });\n  }\n);\n\nTemplateHelpers.registerTemplateHelper('highlightStreamHTMLv2', (content: string, options: IHelperStreamHighlightOptions) => {\n  const mergedOptions = {\n    termsToHighlight: resolveTermsToHighlight(),\n    phrasesToHighlight: resolvePhrasesToHighlight(),\n    ...options\n  };\n  return executeHighlightStreamHTML(content, mergedOptions);\n});\n\nTemplateHelpers.registerFieldHelper('number', (value: any, options?: INumberFormatOptions | string) => {\n  if (!Utils.exists(value)) {\n    return undefined;\n  }\n\n  const numberValue = Number(value);\n  const format = _.isString(options) ? options : options && options.format;\n  if (!format) {\n    return StringUtils.htmlEncode(numberValue.toString());\n  }\n\n  return StringUtils.htmlEncode(Globalize.format(numberValue, <string>format));\n});\n\nTemplateHelpers.registerFieldHelper('date', (value: any, options?: IDateToStringOptions) => {\n  return DateUtils.dateToString(DateUtils.convertFromJsonDateIfNeeded(value), options);\n});\n\nTemplateHelpers.registerFieldHelper('time', (value: any, options?: IDateToStringOptions) => {\n  return DateUtils.timeToString(DateUtils.convertFromJsonDateIfNeeded(value), options);\n});\n\nTemplateHelpers.registerFieldHelper('dateTime', (value: any, options?: IDateToStringOptions) => {\n  return DateUtils.dateTimeToString(DateUtils.convertFromJsonDateIfNeeded(value), options);\n});\n\nTemplateHelpers.registerFieldHelper('emailDateTime', (value: any, options?: IDateToStringOptions) => {\n  var defaultOptions = <IDateToStringOptions>{};\n  defaultOptions.includeTimeIfThisWeek = true;\n  var optionsToUse = <IDateToStringOptions>_.extend(options, defaultOptions);\n  return value ? DateUtils.dateTimeToString(DateUtils.convertFromJsonDateIfNeeded(value), optionsToUse) : undefined;\n});\n\nTemplateHelpers.registerFieldHelper('currency', (value: any, options?: ICurrencyToStringOptions) => {\n  return CurrencyUtils.currencyToString(value, options);\n});\n\nTemplateHelpers.registerFieldHelper('timeSpan', (value: any, options: ITimeSpanUtilsOptions = { isMilliseconds: false }) => {\n  return new TimeSpan(value, options.isMilliseconds).getHHMMSS();\n});\n\nTemplateHelpers.registerFieldHelper('email', (value: string | string[], ...args: any[]) => {\n  // support old arguments (value: any, companyDomain: string, me: string, lengthLimit = 2, truncateName = false)\n  var companyDomain: string;\n  var me: string;\n  var lengthLimit: number;\n  var truncateName: boolean;\n  if (_.isObject(args[0])) {\n    companyDomain = args[0]['companyDomain'];\n    me = args[0]['me'];\n    lengthLimit = args[0]['lengthLimit'];\n    truncateName = args[0]['truncateName'];\n  } else {\n    companyDomain = args[0];\n    me = args[1];\n    lengthLimit = args[2];\n    truncateName = args[3];\n  }\n  if (lengthLimit == undefined) {\n    lengthLimit = 2;\n  }\n  if (truncateName == undefined) {\n    truncateName = false;\n  }\n  if (_.isString(value)) {\n    var listOfAddresses = EmailUtils.splitSemicolonSeparatedListOfEmailAddresses(<string>value);\n    return EmailUtils.emailAddressesToHyperlinks(listOfAddresses, companyDomain, me, lengthLimit, truncateName);\n  } else if (_.isArray(value)) {\n    return EmailUtils.emailAddressesToHyperlinks(<string[]>value, companyDomain, me, lengthLimit, truncateName);\n  } else {\n    return undefined;\n  }\n});\n\nTemplateHelpers.registerTemplateHelper('excessEmailToggle', (target: HTMLElement) => {\n  $$(target).removeClass('coveo-active');\n  if ($$(target).hasClass('coveo-emails-excess-collapsed')) {\n    _.each($$(target).siblings('.coveo-emails-excess-expanded'), sibling => {\n      $$(sibling).addClass('coveo-active');\n    });\n  } else if ($$(target).hasClass('coveo-hide-expanded')) {\n    $$(target.parentElement).addClass('coveo-inactive');\n    _.each($$(target.parentElement).siblings('.coveo-emails-excess-collapsed'), sibling => {\n      $$(sibling).addClass('coveo-active');\n    });\n  }\n  return undefined;\n});\n\nTemplateHelpers.registerFieldHelper('anchor', (href: string, options?: IAnchorUtilsOptions) => {\n  return AnchorUtils.buildAnchor(href, options);\n});\n\nTemplateHelpers.registerFieldHelper('image', (src: string, options?: IImageUtilsOptions, result: IQueryResult = resolveQueryResult()) => {\n  if (options && options.srcTemplate) {\n    return ImageUtils.buildImage(StringUtils.buildStringTemplateFromResult(options.srcTemplate, result), {\n      alt: options.alt,\n      height: options.height,\n      width: options.width\n    });\n  }\n  return ImageUtils.buildImage(src, options);\n});\n\nTemplateHelpers.registerTemplateHelper(\n  'thumbnail',\n  (result: IQueryResult = resolveQueryResult(), endpoint: string = 'default', options?: IImageUtilsOptions) => {\n    if (QueryUtils.hasThumbnail(result)) {\n      return ImageUtils.buildImageFromResult(result, SearchEndpoint.endpoints[endpoint], options);\n    }\n  }\n);\n\nTemplateHelpers.registerTemplateHelper('fromFileTypeToIcon', (result: IQueryResult = resolveQueryResult(), options = {}) => {\n  let icon = Component.getComponentRef('Icon');\n  if (icon) {\n    return icon.createIcon(result, options).outerHTML;\n  }\n});\n\nTemplateHelpers.registerTemplateHelper('attrEncode', (value: string) => {\n  return ('' + value) /* Forces the conversion to string. */\n    .replace(/&/g, '&amp;') /* This MUST be the 1st replacement. */\n    .replace(/'/g, '&apos;') /* The 4 other predefined entities, required. */\n    .replace(/'/g, '&quot;')\n    .replace(/</g, '&lt;')\n    .replace(/>/g, '&gt;');\n});\n\nTemplateHelpers.registerTemplateHelper('loadTemplates', (templatesToLoad: { [id: string]: any }, once = true) => {\n  var ret = '';\n  var data = resolveQueryResult();\n  var atLeastOneWasLoaded = false;\n  var toLoad = templatesToLoad;\n  var defaultTmpl;\n  _.each(templatesToLoad, (value, key?, obj?) => {\n    if (value == 'default') {\n      defaultTmpl = key;\n    }\n  });\n  if (defaultTmpl != undefined) {\n    toLoad = _.omit(templatesToLoad, defaultTmpl);\n  }\n  _.each(toLoad, (condition, id?, obj?) => {\n    if (!atLeastOneWasLoaded || !once) {\n      atLeastOneWasLoaded = atLeastOneWasLoaded || condition;\n      ret += TemplateHelpers.getHelper('loadTemplate')(id, condition, data);\n    }\n  });\n  if (!atLeastOneWasLoaded && defaultTmpl != undefined) {\n    ret += TemplateHelpers.getHelper('loadTemplate')(defaultTmpl, true, data);\n  }\n  return ret;\n});\n\nconst byteMeasure = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'];\n\nTemplateHelpers.registerFieldHelper('size', (value: any, options?: ISizeOptions) => {\n  var size = parseInt(value, 10);\n  var precision = options != null && options.precision != null ? options.precision : 2;\n  var base = options != null && options.base != null ? options.base : 0;\n  while (size > 1024 && base + 1 < byteMeasure.length) {\n    size /= 1024;\n    base++;\n  }\n  size = Math.floor(size * Math.pow(10, precision)) / Math.pow(10, precision);\n  return size + ' ' + byteMeasure[base];\n});\n\nTemplateHelpers.registerFieldHelper('translatedCaption', (value: string) => {\n  return FacetUtils.tryToGetTranslatedCaption('@filetype', value);\n});\n\nTemplateHelpers.registerTemplateHelper('loadTemplate', (id: string, condition: boolean = true, data?: any) => {\n  if (Utils.isNullOrUndefined(data)) {\n    data = resolveQueryResult();\n  }\n  if (condition) {\n    return TemplateCache.getTemplate(id).instantiateToString(data, {\n      checkCondition: false\n    });\n  }\n  return '';\n});\n\nTemplateHelpers.registerTemplateHelper('encodeCarriageReturn', (data: string) => {\n  if (Utils.isNullOrUndefined(data)) {\n    return undefined;\n  } else {\n    return StringUtils.encodeCarriageReturn(data);\n  }\n});\n\nTemplateHelpers.registerTemplateHelper('isMobileDevice', () => {\n  return DeviceUtils.isMobileDevice() ? DeviceUtils.getDeviceName() : null;\n});\n\nTemplateHelpers.registerTemplateHelper('pluralHelper', (count: number, options: IPluralOptions) =>\n  count > 1 ? options.plural : options.singular\n);\n\nfunction resolveQueryResult(): IQueryResult {\n  let found;\n  let resultList = Component.getComponentRef('ResultList');\n  if (resultList) {\n    found = resultList.resultCurrentlyBeingRendered;\n  }\n  if (!found) {\n    let quickview = Component.getComponentRef('Quickview');\n    if (quickview) {\n      found = quickview.resultCurrentlyBeingRendered;\n    }\n  }\n  return found;\n}\n\nfunction resolveTermsToHighlight(): IHighlightTerm {\n  let currentQueryResult = resolveQueryResult();\n  if (currentQueryResult) {\n    return currentQueryResult.termsToHighlight;\n  }\n}\n\nfunction resolvePhrasesToHighlight(): IHighlightPhrase {\n  let currentQueryResult = resolveQueryResult();\n  if (currentQueryResult) {\n    return currentQueryResult.phrasesToHighlight;\n  }\n}\n\nfunction termsToHighlightAreDefined(termsToHighlight, phrasesToHighlight) {\n  return Utils.isNonEmptyArray(_.keys(termsToHighlight)) || Utils.isNonEmptyArray(_.keys(phrasesToHighlight));\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/Templates/CoreHelpers.ts","import { once } from 'underscore';\nimport { $$ } from '../../utils/Dom';\n\nexport function bindAnalyticsToLink(element: HTMLElement, logAnalytics: () => void) {\n  const executeOnlyOnce = once(() => logAnalytics());\n\n  $$(element).on(['contextmenu', 'click', 'mousedown', 'mouseup'], executeOnlyOnce);\n  let longPressTimer: number;\n  $$(element).on('touchstart', () => {\n    longPressTimer = window.setTimeout(executeOnlyOnce, 1000);\n  });\n  $$(element).on('touchend', () => {\n    if (longPressTimer) {\n      clearTimeout(longPressTimer);\n    }\n  });\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/ResultLink/ResultLinkCommon.ts","import { ISearchResultPreview } from '../magicbox/ResultPreviewsManager';\nimport { Suggestion } from '../magicbox/SuggestionsManager';\nimport { IQuery } from '../rest/Query';\n\nexport interface IBuildingResultPreviewsQueryEventArgs {\n  /**\n   * The query to be sent to Search API.\n   */\n  query: IQuery;\n}\n\n/**\n * Executed when a {@link Suggestion} is focused before {@link PopulateSearchResultPreviews} is called to fetch more options.\n */\nexport interface IUpdateResultPreviewsManagerOptionsEventArgs {\n  /**\n   * How many milliseconds should a {@link Suggestion} be focused for before {@link PopulateSearchResultPreviews} is called.\n   *\n   * If this is not defined, it will default to 200ms.\n   */\n  displayAfterDuration?: number;\n}\n\n/**\n * Executed when a {@link Suggestion} is focused and waiting for search result previews.\n */\nexport interface IPopulateSearchResultPreviewsEventArgs {\n  /**\n   * The suggestion to look up search result previews for.\n   */\n  suggestion: Suggestion;\n  /**\n   * The result previews query. This must be set synchronously before the event resolves.\n   * Setting this to a non-empty array will display the given search result previews.\n   */\n  previewsQueries: (ISearchResultPreview[] | Promise<ISearchResultPreview[]>)[];\n}\n\n/**\n * Those are the string definitions of events for ResultPreviewsManager.\n *\n * Those events should be bound to the element returned by `resolveRoot`.\n */\nexport class ResultPreviewsManagerEvents {\n  /**\n   * Executed when building a query to fetch result previews.\n   * This always receives {@link IBuildingResultPreviewsQueryEventArgs} as arguments.\n   */\n  public static buildingResultPreviewsQuery = 'buildingResultPreviewsQuery';\n  /**\n   * Executed when a {@link Suggestion} is focused before {@link PopulateSearchResultPreviews} is called to fetch more options.\n   * This always receives {@link IUpdateResultPreviewsManagerOptionsEventArgs} as arguments.\n   */\n  public static updateResultPreviewsManagerOptions = 'updateResultPreviewsManagerOptions';\n  /**\n   * Executed when a {@link Suggestion} is focused and waiting for search result previews.\n   * This always receives {@link IPopulateSearchResultPreviewsEventArgs} as arguments.\n   */\n  public static populateSearchResultPreviews = 'populateSearchResultPreviews';\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/events/ResultPreviewsManagerEvents.ts","import { IResponsiveComponent, IResponsiveComponentOptions, ResponsiveComponentsManager } from './ResponsiveComponentsManager';\nimport { SearchInterface } from '../SearchInterface/SearchInterface';\nimport { ResultList } from '../ResultList/ResultList';\nimport { $$, Dom } from '../../utils/Dom';\nimport { Component } from '../Base/Component';\nimport { Logger } from '../../misc/Logger';\nimport { ResponsiveDropdown } from './ResponsiveDropdown/ResponsiveDropdown';\n\nexport class ResponsiveDefaultResultTemplate implements IResponsiveComponent {\n  private searchInterface: SearchInterface;\n  private resultList: ResultList;\n\n  private currentMode: string;\n\n  public static init(root: HTMLElement, component: ResultList, options: IResponsiveComponentOptions) {\n    if (!$$(root).find(`.${Component.computeCssClassName(ResultList)}`)) {\n      let logger = new Logger('ResponsiveDefaultResultTemplate');\n      logger.trace('No ResultLayout component found : Cannot instantiate ResponsiveResultLayout');\n      return;\n    }\n    ResponsiveComponentsManager.register(ResponsiveDefaultResultTemplate, $$(root), ResultList.ID, component, options);\n  }\n\n  constructor(public coveoRoot: Dom, public ID: string, options: IResponsiveComponentOptions, responsiveDropdown?: ResponsiveDropdown) {\n    this.searchInterface = <SearchInterface>Component.get(this.coveoRoot.el, SearchInterface, false);\n    this.currentMode = 'large';\n  }\n\n  public registerComponent(accept: ResultList) {\n    if (accept instanceof ResultList) {\n      this.resultList = accept;\n      return true;\n    }\n    return false;\n  }\n\n  public handleResizeEvent() {\n    let lastResults = this.resultList.queryController.getLastResults();\n    if (this.needSmallMode()) {\n      $$(this.resultList.options.resultsContainer).addClass('coveo-card-layout-container');\n      $$(this.resultList.options.resultsContainer).removeClass(`coveo-list-layout-container`);\n      if (this.currentMode != 'small') {\n        if (lastResults) {\n          this.resultList.buildResults(lastResults).then((elements: HTMLElement[]) => {\n            this.resultList.renderResults(elements);\n          });\n        }\n        this.currentMode = 'small';\n      }\n    } else {\n      $$(this.resultList.options.resultsContainer).removeClass('coveo-card-layout-container');\n      $$(this.resultList.options.resultsContainer).addClass(`coveo-list-layout-container`);\n      if (this.currentMode != 'large') {\n        if (lastResults) {\n          this.resultList.buildResults(lastResults).then((elements: HTMLElement[]) => {\n            this.resultList.renderResults(elements);\n          });\n        }\n        this.currentMode = 'large';\n      }\n    }\n  }\n\n  private needSmallMode(): boolean {\n    return this.coveoRoot.width() <= this.searchInterface.responsiveComponents.getSmallScreenWidth();\n  }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/ResponsiveComponents/ResponsiveDefaultResultTemplate.ts","import { IQueryResult } from '../../rest/QueryResult';\nimport { $$, Dom } from '../../utils/Dom';\nimport { Component } from '../Base/Component';\nimport { SearchInterface } from '../SearchInterface/SearchInterface';\n\nexport interface ResultToRender {\n  resultElement: HTMLElement;\n  componentsInside: Component[];\n}\n\nexport class ResultContainer {\n  public static resultCurrentlyBeingRendered: IQueryResult = null;\n\n  public resultContainerElement: Dom;\n\n  constructor(resultContainer: HTMLElement, private searchInterface: SearchInterface) {\n    this.resultContainerElement = $$(resultContainer);\n  }\n\n  public empty() {\n    this.searchInterface.detachComponentsInside(this.resultContainerElement.el);\n    $$(this.resultContainerElement).empty();\n  }\n\n  public addClass(classToAdd: string) {\n    this.resultContainerElement.addClass(classToAdd);\n  }\n\n  public isEmpty() {\n    return this.resultContainerElement.isEmpty();\n  }\n\n  public hideChildren() {\n    this.resultContainerElement.children().forEach(child => $$(child).hide());\n  }\n\n  public getResultElements() {\n    return this.resultContainerElement.findAll('.CoveoResult');\n  }\n\n  public get el() {\n    return this.resultContainerElement.el;\n  }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/ResultList/ResultContainer.ts","import { ResultListRenderer } from './ResultListRenderer';\nimport { $$ } from '../../utils/Dom';\nimport _ = require('underscore');\n\nexport class ResultListCardRenderer extends ResultListRenderer {\n  getEndFragment(resultElements: HTMLElement[]) {\n    return new Promise<DocumentFragment>(resolve => {\n      if (!_.isEmpty(resultElements)) {\n        // with infinite scrolling, we want the additional results to append at the end of the previous query.\n        // For this, we need to remove the padding.\n        if (this.resultListOptions.enableInfiniteScroll) {\n          const needToBeRemoved = $$(this.resultListOptions.resultsContainer).findAll('.coveo-card-layout-padding');\n          _.each(needToBeRemoved, toRemove => $$(toRemove).remove());\n        }\n        // Used to prevent last card from spanning the grid's whole width\n        const emptyCards = document.createDocumentFragment();\n        _.times(3, () => emptyCards.appendChild($$('div', { className: 'coveo-card-layout coveo-card-layout-padding' }).el));\n        resolve(emptyCards);\n      }\n      resolve(null);\n    });\n  }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/ResultList/ResultListCardRenderer.ts","import { IResultListOptions } from './ResultListOptions';\nimport { ResultListRenderer } from './ResultListRenderer';\nimport { TemplateRole } from '../Templates/Template';\nimport { TableTemplate } from '../Templates/TableTemplate';\nimport { $$ } from '../../utils/Dom';\nimport _ = require('underscore');\n\nexport class ResultListTableRenderer extends ResultListRenderer {\n  private shouldDisplayHeader: boolean = true;\n  private shouldDisplayFooter: boolean = false;\n\n  constructor(protected resultListOptions: IResultListOptions, protected autoCreateComponentsFn: Function) {\n    super(resultListOptions, autoCreateComponentsFn);\n    if (this.resultListOptions.resultTemplate instanceof TableTemplate) {\n      if (this.resultListOptions.resultTemplate.hasTemplateWithRole('table-footer')) {\n        this.shouldDisplayFooter = true;\n      }\n      // If custom templates are defined but no header template, do not display it.\n      if (\n        this.resultListOptions.resultTemplate.templates.length !== 0 &&\n        !this.resultListOptions.resultTemplate.hasTemplateWithRole('table-header')\n      ) {\n        this.shouldDisplayHeader = false;\n      }\n    }\n  }\n\n  getStartFragment(resultElements: HTMLElement[], append: boolean): Promise<DocumentFragment> {\n    if (!append && !_.isEmpty(resultElements) && this.shouldDisplayHeader) {\n      return this.renderRoledTemplate('table-header');\n    }\n  }\n\n  getEndFragment(resultElements: HTMLElement[], append: boolean): Promise<DocumentFragment> {\n    if (!append && !_.isEmpty(resultElements) && this.shouldDisplayFooter) {\n      return this.renderRoledTemplate('table-footer');\n    }\n  }\n\n  private async renderRoledTemplate(role: TemplateRole) {\n    const elem = await (<TableTemplate>this.resultListOptions.resultTemplate).instantiateRoleToElement(role);\n    $$(elem).addClass(`coveo-result-list-${role}`);\n    this.autoCreateComponentsFn(elem, undefined);\n    const frag = document.createDocumentFragment();\n    frag.appendChild(elem);\n    return frag;\n  }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/ResultList/ResultListTableRenderer.ts","import { Component } from '../Base/Component';\n\nexport function isFacetFieldValueCompatible(facet: Component): facet is IFieldValueCompatibleFacet {\n  return !!facet['isFieldValueCompatible'];\n}\n\nexport interface IFieldValueCompatibleFacet extends Component {\n  isFieldValueCompatible: boolean;\n  isFieldValueHierarchical: boolean;\n  hasSelectedValue(value: string): boolean;\n  selectValue(value: string): void;\n  deselectValue(value: string): void;\n  getCaptionForStringValue(value: string): string;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/FieldValue/IFieldValueCompatibleFacet.ts","import { Component } from '../Base/Component';\nimport { ComponentOptions } from '../Base/ComponentOptions';\nimport { ComponentOptionsModel } from '../../models/ComponentOptionsModel';\nimport { IResultsComponentBindings } from '../Base/ResultsComponentBindings';\nimport { analyticsActionCauseList } from '../Analytics/AnalyticsActionListMeta';\nimport { IResultLinkOptions } from './ResultLinkOptions';\nimport { ResultListEvents } from '../../events/ResultListEvents';\nimport { HighlightUtils } from '../../utils/HighlightUtils';\nimport { IQueryResult } from '../../rest/QueryResult';\nimport { DeviceUtils } from '../../utils/DeviceUtils';\nimport { OS_NAME, OSUtils } from '../../utils/OSUtils';\nimport { Initialization } from '../Base/Initialization';\nimport { QueryUtils } from '../../utils/QueryUtils';\nimport { Assert } from '../../misc/Assert';\nimport { Utils } from '../../utils/Utils';\nimport { Defer } from '../../misc/Defer';\nimport { $$ } from '../../utils/Dom';\nimport { StreamHighlightUtils } from '../../utils/StreamHighlightUtils';\nimport { StringUtils } from '../../utils/StringUtils';\nimport { debounce, extend, escape } from 'underscore';\nimport { exportGlobally } from '../../GlobalExports';\n\nimport 'styling/_ResultLink';\nimport { AccessibleButton } from '../../utils/AccessibleButton';\nimport { bindAnalyticsToLink } from './ResultLinkCommon';\n\n/**\n * The `ResultLink` component automatically transform a search result title into a clickable link pointing to the\n * original item.\n *\n * This component is a result template component (see [Result Templates](https://docs.coveo.com/en/413/)).\n */\nexport class ResultLink extends Component {\n  static ID = 'ResultLink';\n\n  static doExport = () => {\n    exportGlobally({\n      ResultLink: ResultLink\n    });\n  };\n\n  /**\n   * The options for the ResultLink\n   * @componentOptions\n   */\n  static options: IResultLinkOptions = {\n    /**\n     * Specifies the field to use to output the component `href` attribute value.\n     *\n     * **Tip:**\n     * > Instead of specifying a value for the `field` option, you can directly add an `href` attribute to the\n     * > `ResultLink` HTML element. Then, you can use a custom script to generate the `href` value.\n     *\n     * **Examples:**\n     * - With the following markup, the `ResultLink` outputs its `href` value using the `@uri` field (rather than the\n     * default field):\n     *\n     * ```html\n     * <a class=\"CoveoResultLink\" data-field=\"@uri\"></a>\n     * ```\n     *\n     * - In the following result template, the custom `getMyKBUri()` function provides the `href` value:\n     *\n     * ```html\n     * <script id=\"KnowledgeArticle\" type=\"text/underscore\" class=\"result-template\">\n     *   <div class='CoveoIcon>'></div>\n     *   <a class=\"CoveoResultLink\" href=\"<%= getMyKBUri(raw) %>\"></a>\n     *   <div class=\"CoveoExcerpt\"></div>\n     * </script>\n     * ```\n     *\n     * See also [`hrefTemplate`]{@link ResultLink.options.hrefTemplate}, which can override this option.\n     *\n     * By default, the component uses the `@clickUri` field of the item to output the value of its `href` attribute.\n     */\n    field: ComponentOptions.buildFieldOption(),\n\n    /**\n     * Specifies whether the component should try to open its link in Microsoft Outlook.\n     *\n     * Setting this option to `true` is normally useful for `ResultLink` instances related to Microsoft Exchange emails.\n     *\n     * If this option is `true`, clicking the `ResultLink` calls the\n     * [`openLinkInOutlook`]{@link ResultLink.openLinkInOutlook} method instead of the\n     * [`openLink`]{@link ResultLink.openLink} method.\n     *\n     * Default value is `false`.\n     */\n    openInOutlook: ComponentOptions.buildBooleanOption({ defaultValue: false }),\n\n    /**\n     * Specifies whether the component should open its link in the [`Quickview`]{@link Quickview} component rather than\n     * loading through the original URL.\n     *\n     * Default value is `false`.\n     */\n    openQuickview: ComponentOptions.buildBooleanOption({ defaultValue: false }),\n\n    /**\n     * Specifies whether the component should open its link in a new window instead of opening it in the current\n     * context.\n     *\n     * If this option is `true`, clicking the `ResultLink` calls the\n     * [`openLinkInNewWindow`]{@link ResultLink.openLinkInNewWindow} method instead of the\n     * [`openLink`]{@link ResultLink.openLink} method.\n     *\n     * **Note:**\n     * > If a search page contains a [`ResultPreferences`]{@link ResultsPreferences} component whose\n     * > [`enableOpenInNewWindow`]{@link ResultsPreferences.options.enableOpenInNewWindow} option is `true`, and the end\n     * > user checks the <b>Always open results in new window</b> box, `ResultLink` components in this page will always\n     * > open their links in a new window when the end user clicks them, no matter what the value of their\n     * > `alwaysOpenInNewWindow` option is.\n     *\n     * Default value is `false`.\n     */\n    alwaysOpenInNewWindow: ComponentOptions.buildBooleanOption({ defaultValue: false }),\n\n    /**\n     * Specifies a template literal from which to generate the `ResultLink` `href` attribute value (see\n     * [Template literals](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals)).\n     *\n     * This option overrides the [`field`]{@link ResultLink.options.field} option value.\n     *\n     * The template literal can reference any number of fields from the parent result. It can also reference global\n     * scope properties.\n     *\n     * **Examples:**\n     *\n     * - The following markup generates an `href` value such as `http://uri.com?id=itemTitle`:\n     *\n     * ```html\n     * <a class='CoveoResultLink' data-href-template='${clickUri}?id=${raw.title}'></a>\n     * ```\n     *\n     * - The following markup generates an `href` value such as `localhost/fooBar`:\n     *\n     * ```html\n     * <a class='CoveoResultLink' data-href-template='${window.location.hostname}/{Foo.Bar}'></a>\n     * ```\n     *\n     * Default value is `undefined`.\n     */\n    hrefTemplate: ComponentOptions.buildStringOption(),\n\n    /**\n     * Specifies a template literal from which to generate the `ResultLink` display title (see\n     * [Template literals](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals)).\n     *\n     * This option overrides the default `ResultLink` display title behavior.\n     *\n     * The template literal can reference any number of fields from the parent result. However, if the template literal\n     * references a key whose value is undefined in the parent result fields, the `ResultLink` title displays the\n     * name of this key instead.\n     *\n     * This option is ignored if the `ResultLink` innerHTML contains any value.\n     *\n     * **Examples:**\n     *\n     * - The following markup generates a `ResultLink` display title such as `Case number: 123456` if both the\n     * `raw.objecttype` and `raw.objectnumber` keys are defined in the parent result fields:\n     *\n     * ```html\n     * <a class=\"CoveoResultLink\" data-title-template=\"${raw.objecttype} number: ${raw.objectnumber}\"></a>\n     * ```\n     *\n     * - The following markup generates `${myField}` as a `ResultLink` display title if the `myField` key is undefined\n     * in the parent result fields:\n     *\n     * ```html\n     * <a class=\"CoveoResultLink\" data-title-template=\"${myField}\"></a>\n     * ```\n     *\n     * - The following markup generates `Foobar` as a `ResultLink` display title, because the `ResultLink` innterHTML is\n     * not empty:\n     *\n     * ```html\n     * <a class=\"CoveoResultLink\" data-title-template=\"${will} ${be} ${ignored}\">Foobar</a>\n     * ```\n     *\n     * Default value is `undefined`.\n     *\n     * @availablesince [January 2017 Release (v1.1865.9)](https://docs.coveo.com/en/396/#january-2017-release-v118659)\n     */\n    titleTemplate: ComponentOptions.buildStringOption(),\n\n    /**\n     * Specifies an event handler function to execute when the user clicks the `ResultLink` component.\n     *\n     * The handler function takes a JavaScript [`Event`](https://developer.mozilla.org/en/docs/Web/API/Event) object and\n     * an [`IQueryResult`]{@link IQueryResult} as its parameters.\n     *\n     * Overriding the default behavior of the `onClick` event can allow you to execute specific code instead.\n     *\n     * **Note:**\n     * > You cannot set this option directly in the component markup as an HTML attribute. You must either set it in the\n     * > [`init`]{@link init} call of your search interface (see\n     * > [Passing Component Options in the init Call](https://docs.coveo.com/en/346/#passing-component-options-in-the-init-call)),\n     * > or before the `init` call, using the `options` top-level function (see\n     * > [Passing Component Options Before the init Call](https://docs.coveo.com/en/346/#passing-component-options-before-the-init-call)).\n     *\n     * **Example:**\n     * ```javascript\n     * // You can set the option in the 'init' call:\n     * Coveo.init(document.querySelector(\"#search\"), {\n     *   ResultLink : {\n     *     onClick : function(e, result) {\n     *       e.preventDefault();\n     *       // Custom code to execute with the item URI and title.\n     *       openUriInASpecialTab(result.clickUri, result.title);\n     *     }\n     *   }\n     * });\n     *\n     * // Or before the 'init' call, using the 'options' top-level function:\n     * // Coveo.options(document.querySelector('#search'), {\n     * //   ResultLink : {\n     * //     onClick : function(e, result) {\n     * //       e.preventDefault();\n     * //       // Custom code to execute with the item URI and title.\n     * //       openUriInASpecialTab(result.clickUri, result.title);\n     * //     }\n     * //   }\n     * // });\n     * ```\n     */\n    onClick: ComponentOptions.buildCustomOption<(e: Event, result: IQueryResult) => any>(() => {\n      return null;\n    }),\n\n    /**\n     * Specify this option to log additional analytics when this result link is pressed.\n     *\n     * **Example:**\n     * ```javascript\n     * const resultLink = new Coveo.ResultLink(\n     *   linkElement,\n     *   {\n     *     logAnalytics: (href) => Coveo.logCustomEvent(\n     *         Coveo.analyticsActionCauseList.openSmartSnippetSource,\n     *         {\n     *           searchQueryUid: searchInterface.queryController.lastSearchUid,\n     *           documentTitle: result.title,\n     *           author: Utils.getFieldValue(result, 'author'),\n     *           documentURL: href\n     *         },\n     *         element\n     *       )\n     *   },\n     *   searchInterface.getBindings(),\n     *   result\n     * )\n     * ```\n     */\n    logAnalytics: ComponentOptions.buildCustomOption<(href: string) => void>(() => null)\n  };\n\n  private toExecuteOnOpen: (e?: Event) => void;\n\n  /**\n   * Creates a new `ResultLink` component.\n   * @param element The HTMLElement on which to instantiate the component.\n   * @param options The options for the `ResultLink` component.\n   * @param bindings The bindings that the component requires to function normally. If not set, these will be\n   * automatically resolved (with a slower execution time).\n   * @param result The result to associate the component with.\n   * @param os\n   */\n  constructor(\n    public element: HTMLElement,\n    public options: IResultLinkOptions,\n    public bindings?: IResultsComponentBindings,\n    public result?: IQueryResult,\n    public os?: OS_NAME\n  ) {\n    super(element, ResultLink.ID, bindings);\n\n    const globalOptions = this.searchInterface.options.originalOptionsObject[ResultLink.ID] || {};\n    const initialOptions = ComponentOptions.initComponentOptions(element, ResultLink, { ...globalOptions, ...options });\n    const resultLinkOptions = this.componentOptionsModel.get(ComponentOptionsModel.attributesEnum.resultLink);\n    this.options = extend({}, initialOptions, resultLinkOptions);\n\n    this.result = result || this.resolveResult();\n\n    if (this.options.openQuickview == null) {\n      this.options.openQuickview = result.raw['connectortype'] == 'ExchangeCrawler' && DeviceUtils.isMobileDevice();\n    }\n    if (!this.element.hasAttribute('tabindex')) {\n      this.element.setAttribute('tabindex', '0');\n    }\n\n    Assert.exists(this.componentOptionsModel);\n    Assert.exists(this.result);\n\n    if (!this.quickviewShouldBeOpened()) {\n      // Bind on multiple \"click\" or \"mouse\" events.\n      // Create a function that will be executed only once, so as not to log multiple events\n      // Once a result link has been opened, and that we log at least one analytics event,\n      // it should not matter if the end user open the same link multiple times with different methods.\n      // It's still only one \"click\" event as far as UA is concerned.\n      // Also need to handle \"longpress\" on mobile (the contextual menu), which we assume to be 1 s long.\n\n      bindAnalyticsToLink(element, () => this.logAnalytics());\n    }\n    this.renderUri(element, result);\n    this.bindEventToOpen();\n  }\n  public renderUri(element: HTMLElement, result?: IQueryResult) {\n    if (/^\\s*$/.test(this.element.innerHTML)) {\n      const title = this.getDisplayedTitle();\n      this.element.innerHTML = title;\n\n      const titleAsText = this.getDisplayedTitleAsText();\n      if (!this.element.hasAttribute('aria-label')) {\n        this.element.setAttribute('aria-label', titleAsText);\n      }\n\n      if (!this.element.title) {\n        this.element.title = titleAsText;\n      }\n    }\n  }\n  /**\n   * Opens the result in the same window, no matter how the actual component is configured for the end user.\n   * @param logAnalytics Specifies whether the method should log an analytics event.\n   */\n  public openLink(logAnalytics = true) {\n    if (logAnalytics) {\n      this.logAnalytics();\n    }\n    window.location.href = this.getResultUri();\n  }\n\n  /**\n   * Opens the result in a new window, no matter how the actual component is configured for the end user.\n   * @param logAnalytics Specifies whether the method should log an analytics event.\n   */\n  public openLinkInNewWindow(logAnalytics = true) {\n    if (logAnalytics) {\n      this.logAnalytics();\n    }\n    window.open(this.getResultUri(), '_blank');\n  }\n\n  /**\n   * Tries to open the result in Microsoft Outlook if the result has an `outlookformacuri` or `outlookuri` field.\n   *\n   * Normally, this implies the result should be a link to an email.\n   *\n   * If the needed fields are not present, this method does nothing.\n   * @param logAnalytics Specifies whether the method should log an analytics event.\n   */\n  public openLinkInOutlook(logAnalytics = true) {\n    if (this.hasOutlookField()) {\n      if (logAnalytics) {\n        this.logAnalytics();\n      }\n      this.openLink();\n    }\n  }\n\n  /**\n   * Opens the link in the same manner the end user would.\n   *\n   * This essentially simulates a click on the result link.\n   *\n   * @param logAnalytics Specifies whether the method should log an analytics event.\n   */\n  public openLinkAsConfigured(logAnalytics = true) {\n    if (this.toExecuteOnOpen) {\n      if (logAnalytics) {\n        this.logAnalytics();\n      }\n      this.toExecuteOnOpen();\n    }\n  }\n\n  protected bindEventToOpen(): boolean {\n    return (\n      this.bindOnClickIfNotUndefined() ||\n      this.bindOpenQuickviewIfNotUndefined() ||\n      this.setHrefIfNotAlready() ||\n      this.openLinkThatIsNotAnAnchor()\n    );\n  }\n\n  private getDisplayedTitle() {\n    if (!this.options.titleTemplate) {\n      return this.result.title\n        ? HighlightUtils.highlightString(this.result.title, this.result.titleHighlights, null, 'coveo-highlight')\n        : this.escapedClickUri;\n    } else {\n      let newTitle = StringUtils.buildStringTemplateFromResult(this.options.titleTemplate, this.result);\n      return newTitle\n        ? StreamHighlightUtils.highlightStreamText(newTitle, this.result.termsToHighlight, this.result.phrasesToHighlight)\n        : this.escapedClickUri;\n    }\n  }\n\n  private getDisplayedTitleAsText() {\n    const container = $$('div');\n    container.setHtml(this.getDisplayedTitle());\n    return container.text();\n  }\n\n  private get escapedClickUri() {\n    return escape(this.result.clickUri);\n  }\n\n  private bindOnClickIfNotUndefined() {\n    if (this.options.onClick != undefined) {\n      this.toExecuteOnOpen = (e: MouseEvent) => {\n        this.options.onClick.call(this, e, this.result);\n      };\n\n      new AccessibleButton()\n        .withElement(this.element)\n        .withLabel(this.result.title)\n        .withSelectAction((e: Event) => this.toExecuteOnOpen(e))\n        .build();\n\n      return true;\n    } else {\n      return false;\n    }\n  }\n\n  private bindOpenQuickviewIfNotUndefined() {\n    if (this.quickviewShouldBeOpened()) {\n      this.toExecuteOnOpen = () => {\n        $$(this.bindings.resultElement).trigger(ResultListEvents.openQuickview);\n      };\n\n      $$(this.element).on('click', (e: Event) => {\n        e.preventDefault();\n        this.toExecuteOnOpen();\n      });\n\n      return true;\n    } else {\n      return false;\n    }\n  }\n\n  private openLinkThatIsNotAnAnchor() {\n    if (!this.elementIsAnAnchor()) {\n      this.toExecuteOnOpen = () => {\n        if (this.options.alwaysOpenInNewWindow) {\n          if (this.options.openInOutlook) {\n            this.openLinkInOutlook();\n          } else {\n            this.openLinkInNewWindow();\n          }\n        } else {\n          this.openLink();\n        }\n      };\n\n      $$(this.element).on('click', () => {\n        this.toExecuteOnOpen();\n      });\n\n      return true;\n    }\n    return false;\n  }\n\n  private setHrefIfNotAlready() {\n    // Do not erase any value put in href by the template, etc. Allows\n    // using custom click urls while still keeping analytics recording\n    // and other behavior brought by the component.\n    if (this.elementIsAnAnchor() && !Utils.isNonEmptyString($$(this.element).getAttribute('href'))) {\n      $$(this.element).setAttribute('href', this.getResultUri());\n      if (this.options.alwaysOpenInNewWindow && !(this.options.openInOutlook && this.hasOutlookField())) {\n        $$(this.element).setAttribute('target', '_blank');\n      }\n      return true;\n    } else {\n      return false;\n    }\n  }\n\n  private logDocumentOpen(href: string) {\n    this.usageAnalytics.logClickEvent(\n      analyticsActionCauseList.documentOpen,\n      {\n        documentURL: href,\n        documentTitle: this.result.title,\n        author: Utils.getFieldValue(this.result, 'author')\n      },\n      this.result,\n      this.root\n    );\n  }\n\n  private logAnalytics = debounce(\n    () => {\n      this.queryController.saveLastQuery();\n      let documentURL = $$(this.element).getAttribute('href');\n      if (documentURL == undefined || documentURL == '') {\n        documentURL = this.escapedClickUri;\n      }\n      if (this.options.logAnalytics) {\n        this.options.logAnalytics(documentURL);\n      } else {\n        this.logDocumentOpen(documentURL);\n      }\n      Defer.flush();\n    },\n    1500,\n    true\n  );\n\n  private filterProtocol(uri: string) {\n    const isAbsolute = /^(https?|ftp|file|mailto|tel|sip):/i.test(uri);\n    const isRelative = /^(\\/|\\.\\/|\\.\\.\\/)/.test(uri);\n\n    return isAbsolute || isRelative ? uri : '';\n  }\n\n  private getResultUri(): string {\n    if (this.options.hrefTemplate) {\n      const uri = StringUtils.buildStringTemplateFromResult(this.options.hrefTemplate, this.result);\n      return this.filterProtocol(uri);\n    }\n\n    if (this.options.field == undefined && this.options.openInOutlook) {\n      this.setField();\n    }\n\n    if (this.options.field != undefined) {\n      return this.filterProtocol(Utils.getFieldValue(this.result, <string>this.options.field));\n    }\n\n    return this.filterProtocol(this.result.clickUri);\n  }\n\n  private elementIsAnAnchor() {\n    return this.element.tagName == 'A';\n  }\n\n  private setField() {\n    let os = Utils.exists(this.os) ? this.os : OSUtils.get();\n    if (os == OS_NAME.MACOSX && this.hasOutlookField()) {\n      this.options.field = '@outlookformacuri';\n    } else if (os == OS_NAME.WINDOWS && this.hasOutlookField()) {\n      this.options.field = '@outlookuri';\n    }\n  }\n\n  private hasOutlookField() {\n    let os = Utils.exists(this.os) ? this.os : OSUtils.get();\n    if (os == OS_NAME.MACOSX && this.result.raw['outlookformacuri'] != undefined) {\n      return true;\n    } else if (os == OS_NAME.WINDOWS && this.result.raw['outlookuri'] != undefined) {\n      return true;\n    }\n    return false;\n  }\n\n  private isUriThatMustBeOpenedInQuickview(): boolean {\n    return this.escapedClickUri.toLowerCase().indexOf('ldap://') == 0;\n  }\n\n  private quickviewShouldBeOpened() {\n    return (this.options.openQuickview || this.isUriThatMustBeOpenedInQuickview()) && QueryUtils.hasHTMLVersion(this.result);\n  }\n}\n\nInitialization.registerAutoCreateComponent(ResultLink);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/ResultLink/ResultLink.ts","import 'styling/_Result';\nimport 'styling/_ResultFrame';\nimport 'styling/_ResultList';\nimport { chain, compact, contains, each, flatten, map, unique, without, uniqueId, find } from 'underscore';\nimport {\n  IBuildingQueryEventArgs,\n  IDuringQueryEventArgs,\n  IFetchMoreSuccessEventArgs,\n  INewQueryEventArgs,\n  IQueryErrorEventArgs,\n  IQuerySuccessEventArgs,\n  QueryEvents\n} from '../../events/QueryEvents';\nimport { IResultLayoutPopulateArgs, ResultLayoutEvents } from '../../events/ResultLayoutEvents';\nimport {\n  IChangeLayoutEventArgs,\n  IDisplayedNewResultEventArgs,\n  IDisplayedNewResultsEventArgs,\n  ResultListEvents\n} from '../../events/ResultListEvents';\nimport { exportGlobally } from '../../GlobalExports';\nimport { Assert } from '../../misc/Assert';\nimport { Defer } from '../../misc/Defer';\nimport { MODEL_EVENTS } from '../../models/Model';\nimport { QUERY_STATE_ATTRIBUTES } from '../../models/QueryStateModel';\nimport { IQueryResult } from '../../rest/QueryResult';\nimport { IQueryResults } from '../../rest/QueryResults';\nimport { DeviceUtils } from '../../utils/DeviceUtils';\nimport { $$, Doc, Win } from '../../utils/Dom';\nimport { DomUtils } from '../../utils/DomUtils';\nimport { Utils } from '../../utils/Utils';\nimport { analyticsActionCauseList, IAnalyticsNoMeta } from '../Analytics/AnalyticsActionListMeta';\nimport { Component } from '../Base/Component';\nimport { IComponentBindings } from '../Base/ComponentBindings';\nimport { ComponentOptions } from '../Base/ComponentOptions';\nimport { IInitializationParameters, IInitResult, Initialization } from '../Base/Initialization';\nimport { InitializationPlaceholder } from '../Base/InitializationPlaceholder';\nimport { TemplateComponentOptions } from '../Base/TemplateComponentOptions';\nimport { ResponsiveDefaultResultTemplate } from '../ResponsiveComponents/ResponsiveDefaultResultTemplate';\nimport { ValidLayout, RendererValidLayout } from '../ResultLayoutSelector/ValidLayout';\nimport { CoreHelpers } from '../Templates/CoreHelpers';\nimport { DefaultRecommendationTemplate } from '../Templates/DefaultRecommendationTemplate';\nimport { DefaultResultTemplate } from '../Templates/DefaultResultTemplate';\nimport { TableTemplate } from '../Templates/TableTemplate';\nimport { Template } from '../Templates/Template';\nimport { TemplateCache } from '../Templates/TemplateCache';\nimport { TemplateList } from '../Templates/TemplateList';\nimport { ResultContainer } from './ResultContainer';\nimport { ResultListCardRenderer } from './ResultListCardRenderer';\nimport { ResultListRenderer } from './ResultListRenderer';\nimport { ResultListTableRenderer } from './ResultListTableRenderer';\nimport ResultLayoutSelectorModule = require('../ResultLayoutSelector/ResultLayoutSelector');\nimport { IResultListOptions } from './ResultListOptions';\nimport { ResultListUtils } from '../../utils/ResultListUtils';\nimport { TemplateToHtml, ITemplateToHtml } from '../Templates/TemplateToHtml';\nimport { IQuery } from '../../rest/Query';\n\nCoreHelpers.exportAllHelpersGlobally(window['Coveo']);\n\ntype WaitAnimation = 'fade' | 'spinner' | 'none';\n\n/**\n * The `ResultList` component is responsible for displaying query results by applying one or several result templates\n * (see [Result Templates](https://docs.coveo.com/en/413/)).\n *\n * It is possible to include multiple `ResultList` components along with a single `ResultLayout`\n * component in a search page to provide different result layouts (see\n * [Result Layouts](https://docs.coveo.com/en/360/)).\n *\n * This component supports infinite scrolling (see the\n * [`enableInfiniteScroll`]{@link ResultList.options.enableInfiniteScroll} option).\n */\nexport class ResultList extends Component {\n  private static getDefaultTemplate(e: HTMLElement): Template {\n    const template = ResultList.loadTemplatesFromCache();\n    if (template != null) {\n      return template;\n    }\n\n    const component = <ResultList>Component.get(e);\n    if (Coveo['Recommendation'] && component.searchInterface instanceof Coveo['Recommendation']) {\n      return new DefaultRecommendationTemplate();\n    }\n    return new DefaultResultTemplate();\n  }\n\n  private static loadTemplatesFromCache(): Template {\n    var pageTemplateNames = TemplateCache.getResultListTemplateNames();\n    if (pageTemplateNames.length > 0) {\n      return new TemplateList(compact(map(pageTemplateNames, templateName => TemplateCache.getTemplate(templateName))));\n    }\n\n    return null;\n  }\n\n  static ID = 'ResultList';\n\n  static doExport = () => {\n    exportGlobally({\n      ResultList: ResultList\n    });\n  };\n\n  /**\n   * The options for the ResultList\n   * @componentOptions\n   */\n  static options: IResultListOptions = {\n    /**\n     * The element inside which to insert the rendered result templates.\n     *\n     * Performing a new query clears the content of this element.\n     *\n     * You can change the container by specifying its selector (e.g.,\n     * `data-result-container-selector='#someCssSelector'`).\n     *\n     * If you specify no value for this option, a `div` element will be dynamically created and appended to the result\n     * list. This element will then be used as a result container.\n     */\n    resultsContainer: ComponentOptions.buildChildHtmlElementOption({ alias: 'resultContainerSelector' }),\n    resultTemplate: TemplateComponentOptions.buildTemplateOption({ defaultFunction: ResultList.getDefaultTemplate }),\n\n    /**\n     * The type of animation to display while waiting for a query to return.\n     *\n     * The possible values are:\n     * - `fade`: Fades out the current list of results while the query is executing.\n     * - `spinner`: Shows a spinning animation while the query is executing.\n     * - `none`: Use no animation during queries.\n     *\n     * See also the [`waitAnimationContainer`]{@link ResultList.options.waitAnimationContainer} option.\n     *\n     * @examples spinner\n     */\n    waitAnimation: ComponentOptions.buildStringOption<WaitAnimation>({ defaultValue: 'none' }),\n\n    /**\n     * The element inside which to display the [`waitAnimation`]{@link ResultList.options.waitAnimation}.\n     *\n     * You can change this by specifying a CSS selector (e.g.,\n     * `data-wait-animation-container-selector='#someCssSelector'`).\n     *\n     * Defaults to the value of the [`resultsContainer`]{@link ResultList.options.resultsContainer} option.\n     */\n    waitAnimationContainer: ComponentOptions.buildChildHtmlElementOption({\n      postProcessing: (value, options: IResultListOptions) => value || options.resultsContainer\n    }),\n\n    /**\n     * Whether to automatically retrieve an additional page of results and append it to the\n     * results that the `ResultList` is currently displaying when the user scrolls down to the bottom of the\n     * [`infiniteScrollContainer`]{@link ResultList.options.infiniteScrollContainer}.\n     *\n     * See also the [`infiniteScrollPageSize`]{@link ResultList.options.infiniteScrollPageSize} and\n     * [`enableInfiniteScrollWaitingAnimation`]{@link ResultList.options.enableInfiniteScrollWaitingAnimation} options.\n     *\n     * It is important to specify the `infiniteScrollContainer` option manually if you want the scrolling element to be\n     * something else than the default `window` element. Otherwise, you might find yourself in a strange state where the\n     * framework rapidly triggers multiple successive query.\n     */\n    enableInfiniteScroll: ComponentOptions.buildBooleanOption({ defaultValue: false }),\n\n    /**\n     * The number of additional results to fetch when the user scrolls down to the bottom of the\n     * [`infiniteScrollContainer`]{@link ResultList.options.infiniteScrollContainer}.\n     *\n     * @examples 5\n     */\n    infiniteScrollPageSize: ComponentOptions.buildNumberOption({\n      defaultValue: 10,\n      min: 1,\n      depend: 'enableInfiniteScroll'\n    }),\n\n    /**\n     * The element that triggers fetching additional results when the end user scrolls down to its bottom.\n     *\n     * You can change the container by specifying its selector (e.g.,\n     * `data-infinite-scroll-container-selector='#someCssSelector'`).\n     *\n     * By default, the framework uses the first vertically scrollable parent element it finds, starting from the\n     * `ResultList` element itself. A vertically scrollable element is an element whose CSS `overflow-y` attribute is\n     * `scroll`.\n     *\n     * This implies that if the framework can find no scrollable parent, it uses the `window` itself as a scrollable\n     * container.\n     *\n     * This heuristic is not perfect, for technical reasons. There are always some corner case CSS combination which the\n     * framework will not be able to correctly detect as 'scrollable'.\n     *\n     * It is highly recommended that you manually set this option if you wish something else than the `window` to be the\n     * scrollable element.\n     */\n    infiniteScrollContainer: ComponentOptions.buildChildHtmlElementOption({\n      depend: 'enableInfiniteScroll',\n      defaultFunction: element => ComponentOptions.findParentScrolling(element)\n    }),\n\n    /**\n     * Whether to display the [`waitingAnimation`]{@link ResultList.options.waitAnimation} while fetching additional\n     * results.\n     */\n    enableInfiniteScrollWaitingAnimation: ComponentOptions.buildBooleanOption({\n      depend: 'enableInfiniteScroll',\n      defaultValue: true\n    }),\n    mobileScrollContainer: ComponentOptions.buildSelectorOption({\n      defaultFunction: () => <HTMLElement>document.querySelector('.coveo-results-column')\n    }),\n\n    /**\n     * Whether the `ResultList` should scan its result templates to discover which fields it must request to\n     * be able to render all results.\n     *\n     * Setting this option to `true` ensures that the Coveo Search API does not return fields that are unnecessary for\n     * the UI to function.\n     *\n     * If you set this option to `true`, the fields referenced in your result folding templates won't be automatically resolved.\n     * In such a case, you must manually specify those fields using the [`fieldsToInclude`]{@link ResultList.options.fieldsToInclude} option.\n     *\n     * **Notes:**\n     *\n     * - Many interfaces created with the JavaScript Search Interface Editor explicitly set this option to `true`.\n     * - You cannot set this option to `true` in the Coveo for Sitecore integration.\n     */\n    autoSelectFieldsToInclude: ComponentOptions.buildBooleanOption({ defaultValue: false }),\n\n    /**\n     * A list of fields to include in the query results.\n     *\n     * If you set the [`autoSelectFieldsToInclude`]{@link ResultList.options.autoSelectFieldsToInclude} option to\n     * `true`, the Coveo Search API returns the fields you specify for this option (if those fields are available) in\n     * addition to the fields which the `ResultList` automatically requests. Note that the `autoSelectFieldsToInclude`\n     * option doesn't automatically request fields for folding templates; in such a case, you must manually specify\n     * fields using this option to avoid empty results.\n     *\n     * If you set the [`autoSelectFieldsToInclude`]{@link ResultList.options.autoSelectFieldsToInclude} option to\n     * `false`, the Coveo Search API only returns the fields you specify for this option (if those fields are\n     * available).\n     *\n     * If you set the [`autoSelectFieldsToInclude`]{@link ResultList.options.autoSelectFieldsToInclude} option to\n     * `false` and leave this option undefined, the Coveo Search API returns all available fields.\n     */\n    fieldsToInclude: ComponentOptions.buildFieldsOption({ includeInResults: true }),\n\n    /**\n     * Specifies the layout to use when displaying results in this `ResultList` (see\n     * [Result Layouts](https://docs.coveo.com/en/360/)). Specifying a value for this option automatically\n     * populates a [`ResultLayout`]{@link ResultLayout} component with a switcher for the layout.\n     *\n     * For example, if there are two `ResultList` components in the page, one with its `layout` set to `list` and the\n     * other with the same option set to `card`, then the `ResultLayout` component will render two buttons respectively\n     * entitled **List** and **Card**.\n     *\n     * See the [`ValidLayout`]{@link ValidLayout} type for the list of possible values.\n     *\n     * @examples card\n     */\n    layout: ComponentOptions.buildStringOption<ValidLayout>({\n      defaultValue: 'list',\n      required: true\n    }),\n\n    /**\n     * Whether to scroll back to the top of the page when the end-user:\n     *  - interacts with a facet when [`infiniteScrollContainer`]{@link ResultList.options.infiniteScrollContainer} is set to `true`\n     *  - interacts with the [`Pager`]{@link Pager} component when [`infiniteScrollContainer`]{@link ResultList.options.infiniteScrollContainer} is set to `false`\n     *\n     * **Note:** Setting this option to `false` has no effect on dynamic facets. To disable this behavior on a `DynamicFacet` component, you must set its own [`enableScrollToTop`]{@link DynamicFacet.options.enableScrollToTop} option to `false`.\n     *\n     * @availablesince [July 2019 Release (v2.6459)](https://docs.coveo.com/en/2938/)\n     */\n    enableScrollToTop: ComponentOptions.buildBooleanOption({\n      defaultValue: true\n    })\n  };\n\n  public static resultCurrentlyBeingRendered: IQueryResult = null;\n  public currentlyDisplayedResults: IQueryResult[] = [];\n  private fetchingMoreResults: Promise<IQueryResults>;\n  private reachedTheEndOfResults = false;\n  private disableLayoutChange = false;\n  private renderer: ResultListRenderer;\n  private resultContainer: ResultContainer;\n\n  // This variable serves to block some setup where the framework fails to correctly identify the \"real\" scrolling container.\n  // Since it's not technically feasible to correctly identify the scrolling container in every possible scenario without some very complex logic, we instead try to add some kind of mechanism to\n  // block runaway requests where UI will keep asking more results in the index, eventually bringing the browser to it's knee.\n  // Those successive request are needed in \"displayMoreResults\" to ensure we fill the scrolling container correctly.\n  // Since the container is not identified correctly, it is never \"full\", so we keep asking for more.\n  // It is reset every time the user actually scroll the container manually.\n  private successiveScrollCount = 0;\n  private static MAX_AMOUNT_OF_SUCESSIVE_REQUESTS = 5;\n\n  /**\n   * Creates a new `ResultList` component. Binds various event related to queries (e.g., on querySuccess ->\n   * renderResults). Binds scroll event if the [`enableInfiniteScroll`]{@link ResultList.options.enableInfiniteScroll}\n   * option is `true`.\n   * @param element The HTMLElement on which to instantiate the component.\n   * @param options The options for the `ResultList` component.\n   * @param bindings The bindings that the component requires to function normally. If not set, these will be\n   * automatically resolved (with a slower execution time).\n   * @param elementClassId The class that this component should instantiate. Components that extend the base ResultList\n   * use this. Default value is `CoveoResultList`.\n   */\n  constructor(\n    public element: HTMLElement,\n    public options?: IResultListOptions,\n    public bindings?: IComponentBindings,\n    elementClassId: string = ResultList.ID\n  ) {\n    super(element, elementClassId, bindings);\n    this.options = ComponentOptions.initComponentOptions(element, ResultList, options);\n\n    Assert.exists(element);\n    Assert.exists(this.options);\n    Assert.exists(this.options.resultTemplate);\n    Assert.exists(this.options.infiniteScrollContainer);\n\n    this.showOrHideElementsDependingOnState(false, false);\n\n    this.addListeners();\n\n    this.resultContainer = this.initResultContainer();\n    Assert.exists(this.options.resultsContainer);\n\n    this.initWaitAnimationContainer();\n    Assert.exists(this.options.waitAnimationContainer);\n\n    this.setupTemplatesVersusLayouts();\n    $$(this.root).on(ResultLayoutEvents.populateResultLayout, (e, args: IResultLayoutPopulateArgs) =>\n      args.layouts.push(this.options.layout)\n    );\n    this.setupRenderer();\n    this.makeElementFocusable();\n    this.ensureHasId();\n  }\n\n  private addListeners() {\n    this.bind.onRootElement<INewQueryEventArgs>(QueryEvents.newQuery, (args: INewQueryEventArgs) => this.handleNewQuery());\n    this.bind.onRootElement<IBuildingQueryEventArgs>(QueryEvents.buildingQuery, (args: IBuildingQueryEventArgs) =>\n      this.handleBuildingQuery(args)\n    );\n    this.bind.onRootElement<IQuerySuccessEventArgs>(QueryEvents.querySuccess, (args: IQuerySuccessEventArgs) =>\n      this.handleQuerySuccess(args)\n    );\n    this.bind.onRootElement<IFetchMoreSuccessEventArgs>(QueryEvents.fetchMoreSuccess, (args: IFetchMoreSuccessEventArgs) =>\n      this.handleFetchMoreSuccess(args)\n    );\n    this.bind.onRootElement<IDuringQueryEventArgs>(QueryEvents.duringQuery, (args: IDuringQueryEventArgs) => this.handleDuringQuery());\n    this.bind.onRootElement<IQueryErrorEventArgs>(QueryEvents.queryError, (args: IQueryErrorEventArgs) => this.handleQueryError());\n    $$(this.root).on(ResultListEvents.changeLayout, (e: Event, args: IChangeLayoutEventArgs) => this.handleChangeLayout(args));\n\n    if (this.options.enableInfiniteScroll) {\n      this.addInfiniteScrollListeners();\n    } else {\n      this.addPagerListeners();\n    }\n  }\n\n  private addInfiniteScrollListeners() {\n    this.bind.on(<HTMLElement>this.options.infiniteScrollContainer, 'scroll', () => {\n      this.successiveScrollCount = 0;\n      this.handleScrollOfResultList();\n    });\n    this.bind.onRootElement(QueryEvents.deferredQuerySuccess, () => {\n      setTimeout(() => {\n        this.scrollToTopIfEnabled();\n      }, 0);\n    });\n  }\n\n  private addPagerListeners() {\n    this.bind.onQueryState(MODEL_EVENTS.CHANGE_ONE, QUERY_STATE_ATTRIBUTES.FIRST, () => {\n      this.bind.oneRootElement(QueryEvents.deferredQuerySuccess, () => {\n        setTimeout(() => {\n          this.scrollToTopIfEnabled();\n        }, 0);\n      });\n    });\n  }\n\n  /**\n   * Get the fields needed to be automatically included in the query for this result list.\n   * @returns {string[]}\n   */\n  public getAutoSelectedFieldsToInclude(): string[] {\n    return chain(this.options.resultTemplate.getFields()).concat(this.getMinimalFieldsToInclude()).compact().unique().value();\n  }\n\n  private setupTemplatesVersusLayouts() {\n    const layoutClassToAdd = `coveo-${this.options.layout}-layout-container`;\n    this.resultContainer.addClass(layoutClassToAdd);\n\n    if (this.options.layout === 'table') {\n      this.options.resultTemplate = new TableTemplate((<TemplateList>this.options.resultTemplate).templates || []);\n    }\n\n    // A TemplateList is the scenario where the result template are directly embedded inside the ResultList\n    // This is the typical scenario when a page gets created by the interface editor, for example.\n    // In that case, we try to stick closely that what is actually configured inside the page, and do no \"special magic\".\n    // Stick to the \"hardcoded\" configuration present in the page.\n    // We only add the correct layout options if it has not been set manually.\n    if (this.options.resultTemplate instanceof TemplateList) {\n      each((<TemplateList>this.options.resultTemplate).templates, (tmpl: Template) => {\n        if (!tmpl.layout) {\n          tmpl.layout = <ValidLayout>this.options.layout;\n        }\n      });\n    } else if (this.options.resultTemplate instanceof DefaultResultTemplate && this.options.layout == 'list') {\n      ResponsiveDefaultResultTemplate.init(this.root, this, {});\n    }\n  }\n\n  /**\n   * Empties the current result list content and appends the given array of HTMLElement.\n   *\n   * Can append to existing elements in the result list, or replace them.\n   *\n   * Triggers the `newResultsDisplayed` and `newResultDisplayed` events.\n   * @param resultsElement\n   * @param append\n   */\n  public renderResults(resultElements: HTMLElement[], append = false): Promise<void> {\n    if (!append) {\n      this.resultContainer.empty();\n    }\n\n    return this.renderer\n      .renderResults(resultElements, append, this.triggerNewResultDisplayed.bind(this))\n      .then(() => this.triggerNewResultsDisplayed());\n  }\n\n  /**\n   * Builds and returns an array of HTMLElement with the given result set.\n   * @param results the result set to build an array of HTMLElement from.\n   */\n  public buildResults(results: IQueryResults): Promise<HTMLElement[]> {\n    const layout = <RendererValidLayout>this.options.layout;\n    return this.templateToHtml.buildResults(results, layout, this.currentlyDisplayedResults);\n  }\n\n  /**\n   * Builds and returns an HTMLElement for the given result.\n   * @param result the result to build an HTMLElement from.\n   * @returns {HTMLElement}\n   */\n  public buildResult(result: IQueryResult): Promise<HTMLElement> {\n    const layout = <RendererValidLayout>this.options.layout;\n    return this.templateToHtml.buildResult(result, layout, this.currentlyDisplayedResults);\n  }\n\n  /**\n   * Executes a query to fetch new results. After the query returns, renders the new results.\n   *\n   * Asserts that there are more results to display by verifying whether the last query has returned as many results as\n   * requested.\n   *\n   * Asserts that the `ResultList` is not currently fetching results.\n   * @param count The number of results to fetch and display.\n   */\n  public displayMoreResults(count: number) {\n    Assert.isLargerOrEqualsThan(1, count);\n\n    if (this.isCurrentlyFetchingMoreResults()) {\n      this.logger.warn(\"Ignoring request to display more results since we're already doing so\");\n      return;\n    }\n    if (!this.hasPotentiallyMoreResultsToDisplay()) {\n      this.logger.warn(\"Ignoring request to display more results since we know there aren't more to display\");\n      return;\n    }\n\n    if (this.options.enableInfiniteScrollWaitingAnimation) {\n      this.showWaitingAnimationForInfiniteScrolling();\n    }\n\n    return this.fetchAndRenderMoreResults(count);\n  }\n\n  public get templateToHtml() {\n    const templateToHtmlArgs: ITemplateToHtml = {\n      resultTemplate: this.options.resultTemplate,\n      searchInterface: this.searchInterface,\n      queryStateModel: this.queryStateModel\n    };\n    return new TemplateToHtml(templateToHtmlArgs);\n  }\n\n  /**\n   * Gets the list of currently displayed result.\n   * @returns {IQueryResult[]}\n   */\n  public getDisplayedResults(): IQueryResult[] {\n    return this.currentlyDisplayedResults;\n  }\n\n  /**\n   * Gets the list of currently displayed result HTMLElement.\n   * @returns {HTMLElement[]}\n   */\n  public getDisplayedResultsElements(): HTMLElement[] {\n    return this.resultContainer.getResultElements();\n  }\n\n  public enable(): void {\n    this.disableLayoutChange = false;\n    if (this.resultLayoutSelectors.length > 0) {\n      this.enableBasedOnActiveLayouts();\n    } else {\n      super.enable();\n      $$(this.element).removeClass('coveo-hidden');\n    }\n  }\n\n  public disable(): void {\n    super.disable();\n    const otherLayoutsStillActive = map(this.otherResultLists, otherResultList => otherResultList.options.layout);\n    if (!contains(otherLayoutsStillActive, this.options.layout) && !this.disableLayoutChange) {\n      each(this.resultLayoutSelectors, resultLayoutSelector => {\n        resultLayoutSelector.disableLayouts([this.options.layout] as ValidLayout[]);\n      });\n    }\n    this.disableLayoutChange = false;\n    $$(this.element).addClass('coveo-hidden');\n  }\n\n  protected autoCreateComponentsInsideResult(element: HTMLElement, result: IQueryResult): IInitResult {\n    return this.templateToHtml.autoCreateComponentsInsideResult(element, result);\n  }\n\n  protected triggerNewResultDisplayed(result: IQueryResult, resultElement: HTMLElement) {\n    const args: IDisplayedNewResultEventArgs = {\n      result: result,\n      item: resultElement\n    };\n    $$(this.element).trigger(ResultListEvents.newResultDisplayed, args);\n  }\n\n  protected triggerNewResultsDisplayed() {\n    const args: IDisplayedNewResultsEventArgs = {\n      isInfiniteScrollEnabled: this.options.enableInfiniteScroll\n    };\n    $$(this.element).trigger(ResultListEvents.newResultsDisplayed, args);\n  }\n\n  private async fetchAndRenderMoreResults(count: number): Promise<IQueryResults> {\n    this.fetchingMoreResults = this.queryController.fetchMore(count);\n\n    try {\n      const data = await this.fetchingMoreResults;\n      Assert.exists(data);\n      this.usageAnalytics.logCustomEvent<IAnalyticsNoMeta>(analyticsActionCauseList.pagerScrolling, {}, this.element);\n\n      this.renderNewResults(data);\n\n      this.resetStateAfterFetchingMoreResults();\n\n      return data;\n    } catch (e) {\n      this.resetStateAfterFetchingMoreResults();\n      return Promise.reject(e);\n    }\n  }\n\n  private async renderNewResults(data: IQueryResults) {\n    const elements = await this.buildResults(data);\n    this.renderResults(elements, true);\n    this.currentlyDisplayedResults.push(...data.results);\n  }\n\n  private resetStateAfterFetchingMoreResults() {\n    this.hideWaitingAnimationForInfiniteScrolling();\n    this.fetchingMoreResults = undefined;\n    Defer.defer(() => {\n      this.successiveScrollCount++;\n      if (this.successiveScrollCount <= ResultList.MAX_AMOUNT_OF_SUCESSIVE_REQUESTS) {\n        this.handleScrollOfResultList();\n      } else {\n        this.logger.info(\n          `Result list has triggered 5 consecutive queries to try and fill up the scrolling container, but it is still unable to do so.\n          Try explicitly setting the 'data-infinite-scroll-container-selector' option on the result list. See: https://coveo.github.io/search-ui/components/resultlist.html#options.infinitescrollcontainer`\n        );\n      }\n    });\n  }\n\n  private handleDuringQuery() {\n    this.logger.trace('Emptying the result container');\n    this.cancelFetchingMoreResultsIfNeeded();\n    this.showWaitingAnimation();\n    this.showOrHideElementsDependingOnState(false, false);\n  }\n\n  private handleQueryError() {\n    this.hideWaitingAnimation();\n    this.resultContainer.empty();\n    this.currentlyDisplayedResults = [];\n    this.reachedTheEndOfResults = true;\n  }\n\n  private handleQuerySuccess(data: IQuerySuccessEventArgs) {\n    Assert.exists(data);\n    Assert.exists(data.results);\n    const results = data.results;\n    this.logger.trace('Received query results from new query', results);\n    this.hideWaitingAnimation();\n\n    ResultList.resultCurrentlyBeingRendered = undefined;\n\n    this.currentlyDisplayedResults = [];\n    this.buildResults(data.results).then(async (elements: HTMLElement[]) => {\n      await this.renderResults(elements);\n\n      this.showOrHideElementsDependingOnState(true, this.currentlyDisplayedResults.length != 0);\n\n      if (DeviceUtils.isMobileDevice() && this.options.mobileScrollContainer != undefined) {\n        this.options.mobileScrollContainer.scrollTop = 0;\n      }\n\n      if (this.options.enableInfiniteScroll && results.results.length == data.queryBuilder.numberOfResults) {\n        // This will check right away if we need to add more results to make the scroll container full & scrolling.\n        this.scrollToTopIfEnabled();\n        this.handleScrollOfResultList();\n      }\n    });\n    this.handleQueryOrFetchMoreSuccess(data.query, results);\n  }\n\n  private handleFetchMoreSuccess(data: IFetchMoreSuccessEventArgs) {\n    this.handleQueryOrFetchMoreSuccess(data.query, data.results);\n  }\n\n  private handleQueryOrFetchMoreSuccess(query: IQuery, results: IQueryResults) {\n    const firstResultOfNextPage = (query.firstResult || 0) + results.results.length;\n    this.reachedTheEndOfResults = firstResultOfNextPage >= results.totalCountFiltered;\n  }\n\n  private handleScrollOfResultList() {\n    if (this.isCurrentlyFetchingMoreResults() || !this.options.enableInfiniteScroll) {\n      return;\n    }\n    if (this.isScrollingOfResultListAlmostAtTheBottom() && this.hasPotentiallyMoreResultsToDisplay()) {\n      this.displayMoreResults(this.options.infiniteScrollPageSize);\n    }\n  }\n\n  private scrollToTopIfEnabled() {\n    if (!this.options.enableScrollToTop) {\n      return;\n    }\n\n    ResultListUtils.scrollToTop(this.root);\n  }\n\n  private handleNewQuery() {\n    $$(this.element).removeClass('coveo-hidden');\n    ResultList.resultCurrentlyBeingRendered = undefined;\n  }\n\n  private get otherResultLists() {\n    const allResultLists = this.searchInterface.getComponents(ResultList.ID) as ResultList[];\n    return without(allResultLists, this);\n  }\n\n  private get resultLayoutSelectors() {\n    return this.searchInterface.getComponents('ResultLayoutSelector') as ResultLayoutSelectorModule.ResultLayoutSelector[];\n  }\n\n  protected handleBuildingQuery(args: IBuildingQueryEventArgs) {\n    if (this.options.fieldsToInclude != null) {\n      // remove the @\n      args.queryBuilder.addFieldsToInclude(map(this.options.fieldsToInclude, field => field.substr(1)));\n    }\n    if (this.options.autoSelectFieldsToInclude) {\n      const otherFields = flatten(\n        map(this.otherResultLists, otherResultList => {\n          return otherResultList.getAutoSelectedFieldsToInclude();\n        })\n      );\n\n      args.queryBuilder.addRequiredFields(unique(otherFields.concat(this.getAutoSelectedFieldsToInclude())));\n      args.queryBuilder.includeRequiredFields = true;\n    }\n  }\n\n  protected handleChangeLayout(args: IChangeLayoutEventArgs) {\n    if (args.layout === this.options.layout) {\n      this.disableLayoutChange = false;\n      this.enable();\n      this.options.resultTemplate.layout = <ValidLayout>this.options.layout;\n      if (args.results) {\n        // Prevent flickering when switching to a new layout that is empty\n        // add a temporary placeholder, the same that is used on initialization\n        if (this.resultContainer.isEmpty()) {\n          new InitializationPlaceholder(this.root).withVisibleRootElement().withPlaceholderForResultList();\n        }\n        Defer.defer(async () => {\n          const elements = await this.buildResults(args.results);\n          this.renderResults(elements);\n          this.showOrHideElementsDependingOnState(true, this.currentlyDisplayedResults.length !== 0);\n        });\n      }\n    } else {\n      this.disableLayoutChange = true;\n      this.disable();\n      this.resultContainer.empty();\n    }\n  }\n\n  private isCurrentlyFetchingMoreResults(): boolean {\n    return Utils.exists(this.fetchingMoreResults);\n  }\n\n  private getMinimalFieldsToInclude() {\n    // these fields are needed for analytics click event\n    return ['author', 'language', 'urihash', 'objecttype', 'collection', 'source', 'language', 'permanentid'];\n  }\n\n  private isScrollingOfResultListAlmostAtTheBottom(): boolean {\n    // this is in a try catch because the unit test fail otherwise (Window does not exist for phantom js in the console)\n    let isWindow;\n    try {\n      isWindow = this.options.infiniteScrollContainer instanceof Window;\n    } catch (e) {\n      isWindow = false;\n    }\n    return isWindow ? this.isScrollAtBottomForWindowElement() : this.isScrollAtBottomForHtmlElement();\n  }\n\n  private isScrollAtBottomForWindowElement() {\n    const win = new Win(window);\n    const windowHeight = win.height();\n    const scrollTop = win.scrollY();\n    const bodyHeight = new Doc(document).height();\n    return bodyHeight - (windowHeight + scrollTop) < windowHeight / 2;\n  }\n\n  private isScrollAtBottomForHtmlElement() {\n    const el = <HTMLElement>this.options.infiniteScrollContainer;\n    const elementHeight = el.clientHeight;\n    const scrollHeight = el.scrollHeight;\n    const bottomPosition = el.scrollTop + elementHeight;\n    return scrollHeight - bottomPosition < elementHeight / 2;\n  }\n\n  public hasPotentiallyMoreResultsToDisplay(): boolean {\n    return this.currentlyDisplayedResults.length > 0 && !this.reachedTheEndOfResults;\n  }\n\n  private cancelFetchingMoreResultsIfNeeded() {\n    if (this.isCurrentlyFetchingMoreResults()) {\n      this.logger.trace('Cancelling fetching more results');\n      Promise.reject(this.fetchingMoreResults);\n      this.fetchingMoreResults = undefined;\n    }\n  }\n\n  private showOrHideElementsDependingOnState(hasQuery: boolean, hasResults: boolean) {\n    const showIfQuery = $$(this.element).findAll('.coveo-show-if-query');\n    const showIfNoQuery = $$(this.element).findAll('.coveo-show-if-no-query');\n    const showIfResults = $$(this.element).findAll('.coveo-show-if-results');\n    const showIfNoResults = $$(this.element).findAll('.coveo-show-if-no-results');\n\n    each(showIfQuery, (s: HTMLElement) => {\n      $$(s).toggle(hasQuery);\n    });\n    each(showIfNoQuery, (s: HTMLElement) => {\n      $$(s).toggle(!hasQuery);\n    });\n    each(showIfResults, (s: HTMLElement) => {\n      $$(s).toggle(hasQuery && hasResults);\n    });\n    each(showIfNoResults, (s: HTMLElement) => {\n      $$(s).toggle(hasQuery && !hasResults);\n    });\n  }\n\n  private get waitAnimation() {\n    return this.options.waitAnimation.toLowerCase() as WaitAnimation;\n  }\n\n  private showWaitingAnimation() {\n    switch (this.waitAnimation) {\n      case 'fade':\n        $$(this.options.waitAnimationContainer).addClass('coveo-fade-out');\n        break;\n      case 'spinner':\n        this.resultContainer.hideChildren();\n        if ($$(this.options.waitAnimationContainer).find('.coveo-wait-animation') == undefined) {\n          this.options.waitAnimationContainer.appendChild(DomUtils.getBasicLoadingAnimation());\n        }\n        break;\n    }\n  }\n\n  private hideWaitingAnimation() {\n    switch (this.waitAnimation) {\n      case 'fade':\n        $$(this.options.waitAnimationContainer).removeClass('coveo-fade-out');\n        break;\n      case 'spinner':\n        const spinner = $$(this.options.waitAnimationContainer).find('.coveo-loading-spinner');\n        if (spinner) {\n          $$(spinner).detach();\n        }\n        break;\n    }\n  }\n\n  private showWaitingAnimationForInfiniteScrolling() {\n    const spinner = DomUtils.getLoadingSpinner();\n    if (this.options.layout == 'card' && this.options.enableInfiniteScroll) {\n      const previousSpinnerContainer = $$(this.options.waitAnimationContainer).findAll('.coveo-loading-spinner-container');\n      each(previousSpinnerContainer, previousSpinner => $$(previousSpinner).remove());\n      const spinnerContainer = $$('div', {\n        className: 'coveo-loading-spinner-container'\n      });\n      spinnerContainer.append(spinner);\n      this.options.waitAnimationContainer.appendChild(spinnerContainer.el);\n    } else {\n      this.options.waitAnimationContainer.appendChild(DomUtils.getLoadingSpinner());\n    }\n  }\n\n  private hideWaitingAnimationForInfiniteScrolling() {\n    const spinners = $$(this.options.waitAnimationContainer).findAll('.coveo-loading-spinner');\n    const containers = $$(this.options.waitAnimationContainer).findAll('.coveo-loading-spinner-container');\n    each(spinners, spinner => $$(spinner).remove());\n    each(containers, container => $$(container).remove());\n  }\n\n  private initResultContainer(): ResultContainer {\n    if (!this.options.resultsContainer) {\n      const elemType = this.options.layout === 'table' ? 'table' : 'div';\n      this.options.resultsContainer = $$(elemType, { className: 'coveo-result-list-container' }).el;\n      this.initResultContainerAddToDom();\n    }\n    return new ResultContainer(this.options.resultsContainer, this.searchInterface);\n  }\n\n  protected initResultContainerAddToDom() {\n    this.element.appendChild(this.options.resultsContainer);\n  }\n\n  private initWaitAnimationContainer() {\n    if (!this.options.waitAnimationContainer) {\n      this.options.waitAnimationContainer = this.resultContainer.el;\n    }\n  }\n\n  private setupRenderer() {\n    const initParameters: IInitializationParameters = {\n      options: this.searchInterface.options.originalOptionsObject,\n      bindings: this.bindings\n    };\n\n    const autoCreateComponentsFn = (elem: HTMLElement) => Initialization.automaticallyCreateComponentsInside(elem, initParameters);\n\n    switch (this.options.layout) {\n      case 'card':\n        this.renderer = new ResultListCardRenderer(this.options, autoCreateComponentsFn);\n        break;\n      case 'table':\n        this.renderer = new ResultListTableRenderer(this.options, autoCreateComponentsFn);\n        break;\n      case 'list':\n      default:\n        this.renderer = new ResultListRenderer(this.options, autoCreateComponentsFn);\n        break;\n    }\n  }\n\n  private makeElementFocusable() {\n    $$(this.element).setAttribute('tabindex', '-1');\n  }\n\n  private ensureHasId() {\n    const currentId = this.element.id;\n    if (currentId === '') {\n      this.element.id = uniqueId('coveo-result-list');\n    }\n  }\n\n  private enableBasedOnActiveLayouts() {\n    // We should try to enable a result list only when the result layout selector currently allow that result list layout to be displayed.\n    each(this.resultLayoutSelectors, resultLayoutSelector => {\n      const found = find(resultLayoutSelector.activeLayouts, (activeLayout, activeLayoutKey) => activeLayoutKey == this.options.layout);\n      if (found) {\n        super.enable();\n        resultLayoutSelector.enableLayouts([this.options.layout] as ValidLayout[]);\n        $$(this.element).removeClass('coveo-hidden');\n      }\n    });\n  }\n}\n\nInitialization.registerAutoCreateComponent(ResultList);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/ResultList/ResultList.ts"],"sourceRoot":""}