{"version":3,"sources":["FieldValue.min__d67acfe80778de2e04cc.js","./src/ui/FieldValue/FieldValue.ts","./src/ui/Facet/FacetUtils.ts","./src/ui/FieldValue/IFieldValueCompatibleFacet.ts"],"names":["webpackJsonpCoveo__temporary","124","module","exports","__webpack_require__","showOnlyWithHelper","helpers","options","__extends","this","extendStatics","Object","setPrototypeOf","__proto__","Array","d","b","p","hasOwnProperty","__","constructor","prototype","create","defineProperty","value","element","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","map","split","separator","v","trim","toString","length","isValueHierarchical","slice","appendValuesToDom","textCaption","prependTextCaptionToDom","getFieldValue","field","isObject","renderOneValue","$$","el","toRender","getCaption","TemplateHelpers","getHelper","call","getHelperOptions","logger","warn","keys","getHelpers","fullDateStr","getFullDate","setAttribute","StringUtils","capitalizeFirstLetter","htmlValue","innerHTML","appendChild","document","createTextNode","bindEventOnValue","getValueContainer","helperOptions","toFilter","toKeep","filter","optionKey","optionDefinition","contains","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","searchInterface","isFacetFieldValueCompatible","disabled","facetsWithMatchingId","id","get","isFieldValueHierarchical","enumerable","configurable","isValueSelected","find","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","Component","Initialization","registerAutoCreateComponent","40","getRegexToUseForFacetSearch","ignoreAccent","RegExp","stringToRegex","getDisplayValueFromValueCaption","valueCaption","returnValue","getValuesToUseForSearchInFacet","original","ret","regex","facetSearchIgnoreAccents","_","chain","pairs","pair","test","match","push","QueryUtils","isStratusAgnosticField","FileTypes","getFileTypeCaptions","range","month","monthToString","substr","buildFacetSearchPattern","escapeRegexCharacter","join","needAnotherFacetSearch","currentSearchLength","newSearchLength","oldSearchLength","desiredSearchLength","addNoStateCssClassToFacetValues","container","getSelected","noStates","findAll","noState","fallbackOnLocalization","found","getFileType","getObjectType","isMonthFieldValue","asInt","isNaN","539"],"mappings":"AAAAA,8BAA8B,KAExBC,IACA,SAAUC,OAAQC,QAASC,qBAEjC,YCsCA,SAASC,oBAAsBC,EAAmBC,GAKhD,MAJe,OAAXA,IACFA,MAEIA,EAASD,QAAUA,EAClBC,EDzCT,GAAIC,WAAaC,MAAQA,KAAKD,WAAc,WACxC,GAAIE,GAAgBC,OAAOC,iBACpBC,uBAA2BC,QAAS,SAAUC,EAAGC,GAAKD,EAAEF,UAAYG,IACvE,SAAUD,EAAGC,GAAK,IAAK,GAAIC,KAAKD,GAAOA,EAAEE,eAAeD,KAAIF,EAAEE,GAAKD,EAAEC,IACzE,OAAO,UAAUF,EAAGC,GAEhB,QAASG,KAAOV,KAAKW,YAAcL,EADnCL,EAAcK,EAAG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YG7iBA,YAA4CiI,GAC1C,QAASA,EAA8B,uBH8iBzC1H,OAAOY,eAAepB,EAAS,cAAgBqB,OAAO,IG/iBtD","file":"FieldValue.min__d67acfe80778de2e04cc.js","sourcesContent":["webpackJsonpCoveo__temporary([40],{\n\n/***/ 124:\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__(135);\nvar TemplateHelpers_1 = __webpack_require__(121);\nvar IFieldValueCompatibleFacet_1 = __webpack_require__(539);\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/***/ 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__(120);\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/***/ 539:\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});\n\n\n// WEBPACK FOOTER //\n// FieldValue.min__d67acfe80778de2e04cc.js","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","/// <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 { 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"],"sourceRoot":""}