coveo-search-ui
Version:
Coveo JavaScript Search Framework
1 lines • 62 kB
JavaScript
webpackJsonpCoveo__temporary([11],{133:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(52),i=n(52);t.notWordStart=" ()[],$@'\"",t.notInWord=" ()[],:",t.Basic={basicExpressions:["Word","DoubleQuoted"],grammars:{DoubleQuoted:'"[NotDoubleQuote]"',NotDoubleQuote:/[^"]*/,SingleQuoted:"'[NotSingleQuote]'",NotSingleQuote:/[^']*/,Number:/-?(0|[1-9]\d*)(\.\d+)?/,Word:function(e,n,r){var o=new RegExp("[^"+t.notWordStart.replace(/(.)/g,"\\$1")+"][^"+t.notInWord.replace(/(.)/g,"\\$1")+"]*"),u=e.match(o);null!=u&&0!=u.index&&(u=null);var a=new s.Result(null!=u?u[0]:null,r,e);return a.isSuccess()&&n&&e.length>a.value.length?new i.EndOfInputResult(a):a}}}},139:function(e,t,n){"use strict";var s=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function s(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(s.prototype=n.prototype,new s)}}();Object.defineProperty(t,"__esModule",{value:!0}),n(566);var i=n(11),r=n(100),o=n(3),u=n(176),a=n(222),l=n(5),c=n(18),p=n(13),h=n(6),g=n(1),d=n(10),f=n(7),y=n(8),v=n(2),m=n(511),b=n(140),x=function(e){function t(n,s,o){var l=e.call(this,n,t.ID,o)||this;l.element=n,l.options=s,l.bindings=o,n instanceof HTMLInputElement&&l.logger.error("Querybox cannot be used on an HTMLInputElement"),l.options=y.ComponentOptions.initComponentOptions(n,t,s),new m.QueryboxOptionsProcessing(l).postProcess(),g.$$(l.element).toggleClass("coveo-query-syntax-disabled",0==l.options.enableQuerySyntax),l.magicBox=a.createMagicBox(n,new u.Grammar("Query",{Query:"[Term*][Spaces?]",Term:"[Spaces?][Word]",Spaces:/ +/,Word:/[^ ]+/}),{inline:!0});var f=g.$$(l.magicBox.element).find("input");return f&&g.$$(f).setAttribute("aria-label",l.options.placeholder||h.l("Search")),l.bind.onRootElement(i.QueryEvents.buildingQuery,function(e){return l.handleBuildingQuery(e)}),l.bind.onRootElement(r.StandaloneSearchInterfaceEvents.beforeRedirect,function(){return l.updateQueryState()}),l.bind.onQueryState(c.MODEL_EVENTS.CHANGE_ONE,p.QUERY_STATE_ATTRIBUTES.Q,function(e){return l.handleQueryStateChanged(e)}),l.options.enableSearchAsYouType&&(g.$$(l.element).addClass("coveo-search-as-you-type"),l.magicBox.onchange=function(){l.searchAsYouType()}),l.magicBox.onsubmit=function(){l.submit()},l.magicBox.onblur=function(){l.updateQueryState()},l.magicBox.onclear=function(){l.updateQueryState(),l.options.triggerQueryOnClear&&(l.usageAnalytics.logSearchEvent(d.analyticsActionCauseList.searchboxClear,{}),l.triggerNewQuery(!1))},l}return s(t,e),t.prototype.submit=function(){this.magicBox.clearSuggestion(),this.updateQueryState(),this.usageAnalytics.logSearchEvent(d.analyticsActionCauseList.searchboxSubmit,{}),this.triggerNewQuery(!1)},t.prototype.setText=function(e){this.magicBox.setText(e),this.updateQueryState()},t.prototype.clear=function(){this.magicBox.clear()},t.prototype.getText=function(){return this.magicBox.getText()},t.prototype.getResult=function(){return this.magicBox.getResult()},t.prototype.getDisplayedResult=function(){return this.magicBox.getDisplayedResult()},t.prototype.getCursor=function(){return this.magicBox.getCursor()},t.prototype.resultAtCursor=function(e){return this.magicBox.resultAtCursor(e)},t.prototype.handleBuildingQuery=function(e){l.Assert.exists(e),l.Assert.exists(e.queryBuilder),this.updateQueryState(),this.lastQuery=this.magicBox.getText(),new b.QueryboxQueryParameters(this.options).addParameters(e.queryBuilder,this.lastQuery)},t.prototype.triggerNewQuery=function(e){clearTimeout(this.searchAsYouTypeTimeout);var t=this.magicBox.getText();this.lastQuery!=t&&null!=t&&(this.lastQuery=t,this.queryController.executeQuery({searchAsYouType:e,logInActionsHistory:!0}))},t.prototype.updateQueryState=function(){this.queryStateModel.set(p.QueryStateModel.attributesEnum.q,this.magicBox.getText())},t.prototype.handleQueryStateChanged=function(e){l.Assert.exists(e);var t=e.value;t!=this.magicBox.getText()&&this.magicBox.setText(t)},t.prototype.searchAsYouType=function(){var e=this;clearTimeout(this.searchAsYouTypeTimeout),this.searchAsYouTypeTimeout=window.setTimeout(function(){e.usageAnalytics.logSearchAsYouType(d.analyticsActionCauseList.searchboxAsYouType,{}),e.triggerNewQuery(!0)},this.options.searchAsYouTypeDelay)},t.ID="Querybox",t.doExport=function(){o.exportGlobally({Querybox:t,QueryboxQueryParameters:b.QueryboxQueryParameters})},t.options={enableSearchAsYouType:y.ComponentOptions.buildBooleanOption({defaultValue:!1,section:"Advanced Options"}),searchAsYouTypeDelay:y.ComponentOptions.buildNumberOption({defaultValue:50,min:0,section:"Advanced Options"}),enableQuerySyntax:y.ComponentOptions.buildBooleanOption({defaultValue:!1,section:"Advanced Options"}),enableWildcards:y.ComponentOptions.buildBooleanOption({defaultValue:!1,section:"Advanced Options"}),enableQuestionMarks:y.ComponentOptions.buildBooleanOption({defaultValue:!1,depend:"enableWildcards"}),enableLowercaseOperators:y.ComponentOptions.buildBooleanOption({defaultValue:!1,depend:"enableQuerySyntax"}),enablePartialMatch:y.ComponentOptions.buildBooleanOption({defaultValue:!1}),partialMatchKeywords:y.ComponentOptions.buildNumberOption({defaultValue:5,min:1,depend:"enablePartialMatch"}),partialMatchThreshold:y.ComponentOptions.buildStringOption({defaultValue:"50%",depend:"enablePartialMatch"}),triggerQueryOnClear:y.ComponentOptions.buildBooleanOption({defaultValue:!1})},t}(f.Component);t.Querybox=x,v.Initialization.registerAutoCreateComponent(x)},176:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(493),i=n(495),r=n(497),o=n(0),u=n(498),a=n(219),l=n(499),c=function(){function e(e,t){void 0===t&&(t={}),this.expressions={},this.start=new s.ExpressionRef(e,null,"start",this),this.addExpressions(t)}return e.prototype.addExpressions=function(e){var t=this;o.each(e,function(e,n){t.addExpression(n,e)})},e.prototype.addExpression=function(t,n){if(t in this.expressions)throw new Error("Grammar already contain the id:"+t);this.expressions[t]=e.buildExpression(n,t,this)},e.prototype.getExpression=function(e){return this.expressions[e]},e.prototype.parse=function(e){return this.start.parse(e,!0)},e.buildExpression=function(e,t,n){if(void 0===e)throw new Error("Invalid Expression: "+e);if(o.isString(e))return this.buildStringExpression(e,t,n);if(o.isArray(e))return new i.ExpressionOptions(o.map(e,function(e,i){return new s.ExpressionRef(e,null,t+"_"+i,n)}),t);if(o.isRegExp(e))return new r.ExpressionRegExp(e,t,n);if(o.isFunction(e))return new u.ExpressionFunction(e,t,n);throw new Error("Invalid Expression: "+e)},e.buildStringExpression=function(t,n,i){var r=e.stringMatch(t,e.spliter),u=o.map(r,function(e,t){if(e[1]){var r=e[1],o=e[3]?Number(e[3]):e[2]||null;return new s.ExpressionRef(r,o,n+"_"+t,i)}return new a.ExpressionConstant(e[4],n+"_"+t)});if(1==u.length){var c=u[0];return c.id=n,c}return new l.ExpressionList(u,n)},e.stringMatch=function(e,t){for(var n=[],s=new RegExp(t.source,"g"),i=s.exec(e);null!==i;)n.push(i),i=s.exec(e);return n},e.spliter=/\[(\w+)(\*|\+|\?|\{([1-9][0-9]*)\})?\]|(.[^\[]*)/,e}();t.Grammar=c},218:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExpressionEndOfInput={id:"end of input",parse:null}},219:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(52),i=n(52),r=function(){function e(e,t){this.value=e,this.id=t}return e.prototype.parse=function(e,t){var n=0==e.indexOf(this.value),r=new s.Result(n?this.value:null,this,e);return n&&t&&e.length>this.value.length?new i.EndOfInputResult(r):r},e.prototype.toString=function(){return this.value},e}();t.ExpressionConstant=r},220:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(133),i=n(501);t.Field={basicExpressions:["FieldSimpleQuery","FieldQuery","Field"],grammars:{FieldQuery:"[Field][OptionalSpaces][FieldQueryOperation]",FieldQueryOperation:["FieldQueryValue","FieldQueryNumeric"],FieldQueryValue:"[FieldOperator][OptionalSpaces][FieldValue]",FieldQueryNumeric:"[FieldOperatorNumeric][OptionalSpaces][FieldValueNumeric]",FieldSimpleQuery:"[FieldName]:[OptionalSpaces][FieldValue]",Field:"@[FieldName]",FieldName:/[a-zA-Z][a-zA-Z0-9\.\_]*/,FieldOperator:/==|=|<>/,FieldOperatorNumeric:/<=|>=|<|>/,FieldValue:["DateRange","NumberRange","DateRelative","Date","Number","FieldValueList","FieldValueString"],FieldValueNumeric:["DateRelative","Date","Number"],FieldValueString:["DoubleQuoted","FieldValueNotQuoted"],FieldValueList:"([FieldValueString][FieldValueStringList*])",FieldValueStringList:"[FieldValueSeparator][FieldValueString]",FieldValueSeparator:/ *, */,FieldValueNotQuoted:/[^ \(\)\[\],]+/,NumberRange:"[Number][Spaces?]..[Spaces?][Number]"},include:[i.Date,s.Basic]}},221:function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(i,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function u(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,u)}a((s=s.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return s([e,t])}}function s(n){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(o=r[2&n[0]?"return":n[0]?"throw":"next"])&&!(o=o.call(r,n[1])).done)return o;switch(r=0,o&&(n=[0,o.value]),n[0]){case 0:case 1:o=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,r=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!(o=o.length>0&&o[o.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){a.label=n[1];break}if(6===n[0]&&a.label<o[1]){a.label=o[1],o=n;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(n);break}o[2]&&a.ops.pop(),a.trys.pop();continue}n=t.call(e,a)}catch(e){n=[6,e],r=0}finally{i=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,r,o,u,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u};Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(0),u=n(34),a=n(7),l=n(1),c=n(564),p=n(505),h=n(21);!function(e){e.Up="Up",e.Down="Down",e.Left="Left",e.Right="Right"}(r=t.Direction||(t.Direction={}));var g=function(){function e(e,t,n,s){var i=this;this.element=e,this.magicBoxContainer=t,this.inputManager=n,this.suggestionListboxID="coveo-magicbox-suggestions-"+h.QueryUtils.createGuid(),this.suggestionListboxClassName="coveo-magicbox-suggestions",this.root=a.Component.resolveRoot(e),this.options=o.defaults(s,{suggestionClass:"magic-box-suggestion",selectedClass:"magic-box-selected"}),void 0==this.options.timeout&&(this.options.timeout=500),l.$$(this.element).on("mouseover",function(e){i.handleMouseOver(e)}),l.$$(this.element).on("mouseout",function(e){i.handleMouseOut(e)}),this.suggestionsProcessor=new p.QueryProcessor({timeout:this.options.timeout}),this.resultPreviewsManager=new c.ResultPreviewsManager(e,{selectedClass:this.options.selectedClass,timeout:this.options.timeout}),this.suggestionsListbox=this.buildSuggestionsContainer(),l.$$(this.element).append(this.suggestionsListbox.el),this.addAccessibilityProperties(),this.appendEmptySuggestionOption()}return Object.defineProperty(e.prototype,"hasSuggestions",{get:function(){return this.currentSuggestions&&this.currentSuggestions.length>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasFocus",{get:function(){return l.$$(this.element).findClass(this.options.selectedClass).length>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasPreviews",{get:function(){return this.resultPreviewsManager.hasPreviews},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"focusedSuggestion",{get:function(){var e=this;return o.find(this.currentSuggestions,function(t){return l.$$(t.dom).hasClass(e.options.selectedClass)||l.$$(t.dom).findClass(e.options.selectedClass).length>0})},enumerable:!0,configurable:!0}),e.prototype.handleMouseOver=function(e){var t=l.$$(e.target),n=t.parents(this.options.suggestionClass);t.hasClass(this.options.suggestionClass)?this.processMouseSelection(t.el):n.length>0&&this.element.contains(n[0])&&this.processMouseSelection(n[0])},e.prototype.handleMouseOut=function(e){var t=l.$$(e.target),n=t.parents(this.options.suggestionClass);if(e.relatedTarget&&l.$$(e.relatedTarget).isValid()){var s=l.$$(e.relatedTarget).parents(this.options.suggestionClass);t.hasClass(this.options.selectedClass)&&!l.$$(e.relatedTarget).hasClass(this.options.suggestionClass)?this.removeSelectedStatus(t.el):0==s.length&&n.length>0&&this.removeSelectedStatus(n[0])}else t.hasClass(this.options.selectedClass)?this.removeSelectedStatus(t.el):n.length>0&&this.removeSelectedStatus(n[0]);l.$$(this.root).trigger(u.OmniboxEvents.querySuggestLoseFocus)},e.prototype.moveDown=function(){return s(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.move(r.Down)];case 1:return e.sent(),[2]}})})},e.prototype.moveUp=function(){return s(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.move(r.Up)];case 1:return e.sent(),[2]}})})},e.prototype.moveLeft=function(){return s(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.move(r.Left)];case 1:return e.sent(),[2]}})})},e.prototype.moveRight=function(){return s(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.move(r.Right)];case 1:return e.sent(),[2]}})})},e.prototype.selectAndReturnKeyboardFocusedElement=function(){var e=this.keyboardFocusedElement;return e&&(l.$$(e).trigger("keyboardSelect"),this.keyboardFocusedElement=null,this.inputManager.blur()),e},e.prototype.clearKeyboardFocusedElement=function(){this.keyboardFocusedElement=null},e.prototype.receiveSuggestions=function(e){return s(this,void 0,void 0,function(){var t,n,s;return i(this,function(i){switch(i.label){case 0:return[4,this.suggestionsProcessor.processQueries(e)];case 1:return t=i.sent(),(n=t.results,s=t.status,s===p.ProcessingStatus.Overriden)?[2,[]]:(this.updateSuggestions(n),[2,n])}})})},e.prototype.clearSuggestions=function(){this.updateSuggestions([])},e.prototype.updateSuggestions=function(e){var t=this;if(this.suggestionsListbox.empty(),this.inputManager.activeDescendant=null,this.currentSuggestions=e,l.$$(this.element).toggleClass("magic-box-hasSuggestion",this.hasSuggestions),this.inputManager.expanded=this.hasSuggestions,this.resultPreviewsManager.displaySearchResultPreviewsForSuggestion(null),!this.hasSuggestions)return this.appendEmptySuggestionOption(),void l.$$(this.root).trigger(u.OmniboxEvents.querySuggestLoseFocus);e.sort(function(e,t){return(t.index||0)-(e.index||0)}).forEach(function(n){var s=n.dom?t.modifyDomFromExistingSuggestion(n.dom):t.createDomFromSuggestion(n);s.setAttribute("id","magic-box-suggestion-"+o.indexOf(e,n)),s.setAttribute("role","option"),s.setAttribute("aria-selected","false"),s.setAttribute("aria-label",s.text()),s.suggestion=n,t.suggestionsListbox.append(s.el)});var n=this.suggestionsListbox.findAll("."+this.options.suggestionClass).length;l.$$(this.root).trigger(u.OmniboxEvents.querySuggestRendered,{numberOfSuggestions:n})},Object.defineProperty(e.prototype,"selectedSuggestion",{get:function(){return this.htmlElementIsSuggestion(this.keyboardFocusedElement)?this.returnMoved(this.keyboardFocusedElement):null},enumerable:!0,configurable:!0}),e.prototype.processKeyboardSelection=function(e){return s(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return this.addSelectedStatus(e),this.keyboardFocusedElement=e,[4,this.updateSelectedSuggestion(this.focusedSuggestion)];case 1:return t.sent(),[2]}})})},e.prototype.processKeyboardPreviewSelection=function(e){this.addSelectedStatus(e),this.keyboardFocusedElement=e},e.prototype.processMouseSelection=function(e){this.addSelectedStatus(e),this.updateSelectedSuggestion(this.focusedSuggestion),this.keyboardFocusedElement=null},e.prototype.buildSuggestionsContainer=function(){return l.$$("div",{className:this.suggestionListboxClassName,id:this.suggestionListboxID,role:"listbox",ariaLabel:"Search Suggestions"})},e.prototype.createDomFromSuggestion=function(e){var t=this,n=l.$$("div",{className:"magic-box-suggestion "+this.options.suggestionClass});if(e.dom=n.el,n.on("click",function(){t.selectSuggestion(e)}),n.on("keyboardSelect",function(){t.selectSuggestion(e)}),e.html)return n.el.innerHTML=e.html,n;if(e.text)return n.text(e.text),n;if(e.separator){n.addClass("magic-box-suggestion-seperator");var s=l.$$("div",{className:"magic-box-suggestion-seperator-label"},e.separator);return n.append(s.el),n}return n},e.prototype.selectSuggestion=function(e){e.onSelect(),l.$$(this.root).trigger(u.OmniboxEvents.querySuggestSelection,{suggestion:e.text})},e.prototype.appendEmptySuggestionOption=function(){this.suggestionsListbox.append(l.$$("div",{role:"option"}).el)},e.prototype.modifyDomFromExistingSuggestion=function(e){this.removeSelectedStatus(e);var t=e.classList.contains(this.options.suggestionClass)?e:l.$$(e).find("."+this.options.suggestionClass);return this.removeSelectedStatus(t),l.$$(e)},e.prototype.move=function(e){return s(this,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return this.resultPreviewsManager.focusedPreviewElement?[4,this.moveWithinPreview(e)]:[3,2];case 1:return n.sent(),[2];case 2:return e!==r.Right&&e!==r.Left||!(t=this.resultPreviewsManager.previewElements[0])?[4,this.moveWithinSuggestion(e)]:(this.processKeyboardPreviewSelection(t),[2]);case 3:return n.sent(),[2]}})})},e.prototype.moveWithinSuggestion=function(e){return s(this,void 0,void 0,function(){var t,n,s,u;return i(this,function(i){switch(i.label){case 0:return t=l.$$(this.element).find("."+this.options.selectedClass),n=l.$$(this.element).findAll("."+this.options.suggestionClass),s=o.indexOf(n,t),u=e===r.Up?s-1:s+1,u=(u+n.length)%n.length,[4,this.selectQuerySuggest(n[u])];case 1:return i.sent(),[2]}})})},e.prototype.selectQuerySuggest=function(e){return s(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return e?[4,this.processKeyboardSelection(e)]:[3,2];case 1:return t.sent(),[3,3];case 2:this.keyboardFocusedElement=null,this.inputManager.input.removeAttribute("aria-activedescendant"),t.label=3;case 3:return[2,e]}})})},e.prototype.moveWithinPreview=function(e){return s(this,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return t=this.resultPreviewsManager.getElementInDirection(e),t?[3,2]:[4,this.selectQuerySuggest(this.resultPreviewsManager.previewsOwner.dom)];case 1:return n.sent(),[2];case 2:return this.processKeyboardPreviewSelection(t),[2]}})})},e.prototype.returnMoved=function(e){if(e){if(e.suggestion)return e.suggestion;if(e["no-text-suggestion"])return null;if(e instanceof HTMLElement)return{text:l.$$(e).text()}}return null},e.prototype.addSelectedStatus=function(e){for(var t=this.element.getElementsByClassName(this.options.selectedClass),n=0;n<t.length;n++){var s=t.item(n);this.removeSelectedStatus(s)}l.$$(e).addClass(this.options.selectedClass),this.updateAreaSelectedIfDefined(e,"true")},e.prototype.updateSelectedSuggestion=function(e){return s(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return l.$$(this.root).trigger(u.OmniboxEvents.querySuggestGetFocus,{suggestion:e.text}),[4,this.resultPreviewsManager.displaySearchResultPreviewsForSuggestion(e)];case 1:return t.sent(),[2]}})})},e.prototype.removeSelectedStatus=function(e){l.$$(e).removeClass(this.options.selectedClass),this.updateAreaSelectedIfDefined(e,"false")},e.prototype.updateAreaSelectedIfDefined=function(e,t){l.$$(e).getAttribute("aria-selected")&&(this.inputManager.activeDescendant=e,l.$$(e).setAttribute("aria-selected",t))},e.prototype.addAccessibilityProperties=function(){this.addAccessibilityPropertiesForMagicBox(),this.addAccessibilityPropertiesForInput()},e.prototype.addAccessibilityPropertiesForMagicBox=function(){var e=l.$$(this.magicBoxContainer);e.setAttribute("role","search"),e.setAttribute("aria-haspopup","listbox")},e.prototype.addAccessibilityPropertiesForInput=function(){var e=l.$$(this.inputManager.input);this.inputManager.activeDescendant=null,this.inputManager.expanded=!1,e.setAttribute("aria-owns",this.suggestionListboxID),e.setAttribute("aria-controls",this.suggestionListboxID)},e.prototype.htmlElementIsSuggestion=function(e){var t=l.$$(this.element).findAll("."+this.options.suggestionClass);return o.indexOf(t,e)>-1},e}();t.SuggestionsManager=g},222:function(e,t,n){"use strict";function s(e,t,n){return new d(e,t,n)}function i(e){return"requestAnimationFrame"in window?window.requestAnimationFrame(e):setTimeout(e)}var r=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(i,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function u(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,u)}a((s=s.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return s([e,t])}}function s(n){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(o=r[2&n[0]?"return":n[0]?"throw":"next"])&&!(o=o.call(r,n[1])).done)return o;switch(r=0,o&&(n=[0,o.value]),n[0]){case 0:case 1:o=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,r=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!(o=o.length>0&&o[o.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){a.label=n[1];break}if(6===n[0]&&a.label<o[1]){a.label=o[1],o=n;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(n);break}o[2]&&a.ops.pop(),a.trys.pop();continue}n=t.call(e,a)}catch(e){n=[6,e],r=0}finally{i=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,r,o,u,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u};Object.defineProperty(t,"__esModule",{value:!0});var u=n(0),a=n(20),l=n(1),c=n(562),p=n(504),h=n(565),g=n(221),d=function(){function e(e,t,n){void 0===n&&(n={});var s=this;this.element=e,this.grammar=t,this.options=n,this.lastSuggestions=[],u.isUndefined(this.options.inline)&&(this.options.inline=!1),l.$$(e).addClass("magic-box"),this.options.inline&&l.$$(e).addClass("magic-box-inline"),this.result=this.grammar.parse(""),this.displayedResult=this.result.clean();var i=l.$$(e).find(".magic-box-input");i||(i=document.createElement("div"),i.className="magic-box-input",e.appendChild(i)),this.inputManager=new p.InputManager(i,function(e,t){t?(s.setText(e),s.onselect&&s.onselect(s.firstSuggestionWithText)):(s.setText(e),s.addSuggestions(),s.onchange&&s.onchange())},this),this.inputManager.ontabpress=function(){s.ontabpress&&s.ontabpress()};var r=this.inputManager.getValue();r&&(this.displayedResult.input=r),this.inputManager.setResult(this.displayedResult);var o=document.createElement("div");o.className="magic-box-suggestions",this.element.appendChild(o),this.suggestionsManager=new g.SuggestionsManager(o,this.element,this.inputManager,{suggestionClass:this.options.selectableSuggestionClass,selectedClass:this.options.selectedSuggestionClass,timeout:this.options.suggestionTimeout}),this.magicBoxClear=new h.MagicBoxClear(this),this.setupHandler()}return Object.defineProperty(e.prototype,"firstSuggestionWithText",{get:function(){return u.find(this.lastSuggestions,function(e){return e.text})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstSuggestionText",{get:function(){var e=this.firstSuggestionWithText;return e?e.text:""},enumerable:!0,configurable:!0}),e.prototype.getResult=function(){return this.result},e.prototype.getDisplayedResult=function(){return this.displayedResult},e.prototype.setText=function(e){l.$$(this.element).toggleClass("magic-box-notEmpty",e.length>0),this.magicBoxClear.toggleTabindexAndAriaHidden(e.length>0),this.result=this.grammar.parse(e),this.displayedResult=this.result.clean(),this.inputManager.setResult(this.displayedResult)},e.prototype.setCursor=function(e){this.inputManager.setCursor(e)},e.prototype.getCursor=function(){return this.inputManager.getCursor()},e.prototype.resultAtCursor=function(e){return this.displayedResult.resultAt(this.getCursor(),e)},e.prototype.setupHandler=function(){var e=this;this.inputManager.onblur=function(){l.$$(e.element).removeClass("magic-box-hasFocus"),e.onblur&&e.onblur(),e.options.inline||e.clearSuggestion()},this.inputManager.onfocus=function(){l.$$(e.element).addClass("magic-box-hasFocus"),e.addSuggestions(),e.onfocus&&e.onfocus()},this.inputManager.onkeydown=function(t){if(e.shouldMoveInSuggestions(t))return!1;if(t===a.KEYBOARD.ENTER){return null==e.suggestionsManager.selectAndReturnKeyboardFocusedElement()&&e.onsubmit&&e.onsubmit(),!1}return t===a.KEYBOARD.ESCAPE?(e.clearSuggestion(),e.blur()):e.suggestionsManager.clearKeyboardFocusedElement(),!0},this.inputManager.onchangecursor=function(){e.addSuggestions()},this.inputManager.onkeyup=function(t){if(e.onmove&&e.onmove(),!e.shouldMoveInSuggestions(t))return!0;switch(t){case a.KEYBOARD.UP_ARROW:e.suggestionsManager.moveUp();break;case a.KEYBOARD.DOWN_ARROW:e.suggestionsManager.moveDown();break;case a.KEYBOARD.LEFT_ARROW:e.suggestionsManager.moveLeft();break;case a.KEYBOARD.RIGHT_ARROW:e.suggestionsManager.moveRight()}return e.suggestionsManager.selectedSuggestion&&e.focusOnSuggestion(e.suggestionsManager.selectedSuggestion),e.onchange&&e.onchange(),!1}},e.prototype.addSuggestions=function(){return r(this,void 0,void 0,function(){var e;return o(this,function(t){switch(t.label){case 0:return[4,this.suggestionsManager.receiveSuggestions(null!=this.getSuggestions?this.getSuggestions():[])];case 1:return e=t.sent(),this.addSelectEventHandlers(e),this.inputManager.setWordCompletion(this.firstSuggestionText),this.onSuggestions(e),[2]}})})},e.prototype.shouldMoveInSuggestions=function(e){switch(e){case a.KEYBOARD.UP_ARROW:case a.KEYBOARD.DOWN_ARROW:return!0;case a.KEYBOARD.LEFT_ARROW:case a.KEYBOARD.RIGHT_ARROW:if(this.suggestionsManager.hasFocus&&this.suggestionsManager.hasPreviews)return!0}return!1},e.prototype.addSelectEventHandlers=function(e){var t=this;u.each(e,function(e){null==e.onSelect&&null!=e.text&&(e.onSelect=function(){t.setText(e.text),t.onselect&&t.onselect(e)})})},e.prototype.focus=function(){l.$$(this.element).addClass("magic-box-hasFocus"),this.inputManager.focus()},e.prototype.blur=function(){this.inputManager.blur()},e.prototype.clearSuggestion=function(){return r(this,void 0,void 0,function(){return o(this,function(e){return this.inputManager.setWordCompletion(null),this.suggestionsManager.clearSuggestions(),this.onSuggestions([]),[2]})})},e.prototype.focusOnSuggestion=function(e){null==e||null==e.text?this.inputManager.setResult(this.displayedResult,this.firstSuggestionText):this.inputManager.setResult(this.grammar.parse(e.text).clean(),e.text)},e.prototype.getText=function(){return this.inputManager.getValue()},e.prototype.getWordCompletion=function(){return this.inputManager.getWordCompletion()},e.prototype.clear=function(){this.setText(""),this.clearSuggestion(),this.focus(),this.onclear&&this.onclear()},e.prototype.hasSuggestions=function(){return this.suggestionsManager.hasSuggestions},e}();t.MagicBoxInstance=d,t.createMagicBox=s,t.requestAnimationFrame=i,c.doMagicBoxExport()},223:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),i=function(){function e(){}return e.escapeRegExp=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},e.highlightText=function(e,t,n,s,i){var r=this;if(void 0===n&&(n=!1),void 0===s&&(s="magic-box-hightlight"),void 0===i&&(i=""),0==t.length)return e;var o=this.escapeRegExp(t),u="("+o+")|(.*?(?="+o+")|.+)",a=new RegExp(u,n?"gi":"g");return e.replace(a,function(e,t,n){return r.escapeText(null!=t?s:i,e)})},e.escapeText=function(e,t){return'<span class="'+e+'">'+s.escape(t)+"</span>"},e}();t.MagicBoxUtils=i},493:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(52),i=n(494),r=n(218),o=n(0),u=function(){function e(e,t,n,s){this.ref=e,this.occurrence=t,this.id=n,this.grammar=s}return e.prototype.parse=function(e,t){var n=this.grammar.getExpression(this.ref);if(null==n)throw new Error("Expression not found:"+this.ref);return"?"==this.occurrence||null==this.occurrence?this.parseOnce(e,t,n):this.parseMany(e,t,n)},e.prototype.parseOnce=function(e,t,n){var u=n.parse(e,t),a=u.isSuccess();return a||"?"!=this.occurrence?new i.RefResult([u],this,e,a?null:u):t?0==e.length?new i.RefResult([],this,e,u):o.all(u.getBestExpect(),function(e){return e.expression==r.ExpressionEndOfInput})?new i.RefResult([new s.Result(null,r.ExpressionEndOfInput,e)],this,e,u):u:new i.RefResult([],this,e,null)},e.prototype.parseMany=function(e,t,n){var u,a,l=[],c=e;do{u=n.parse(c,!1),(a=u.isSuccess())&&(l.push(u),c=c.substr(u.getLength()))}while(a&&u.input!=c);var p=o.isNumber(this.occurrence)?this.occurrence:"+"==this.occurrence?1:0;if(l.length<p)l.push(u);else if(t)if(l.length>0){var h=o.last(l);u=n.parse(h.input,!0),u.isSuccess()?l[l.length-1]=u:(l.push(new s.Result(null,r.ExpressionEndOfInput,h.input.substr(h.getLength()))),u=n.parse(h.input.substr(h.getLength()),!0))}else if(0!=e.length){var g=new s.Result(null,r.ExpressionEndOfInput,e);return new i.RefResult([g],this,e,u)}return new i.RefResult(l,this,e,u)},e.prototype.toString=function(){return this.id},e}();t.ExpressionRef=u},494:function(e,t,n){"use strict";var s=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function s(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(s.prototype=n.prototype,new s)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(52),r=n(0),o=function(e){function t(t,n,s,i){var o=e.call(this,t,n,s)||this;return o.expression=n,o.input=s,r.last(t)!=i&&(o.failAttempt=i,null!=o.failAttempt&&(o.failAttempt.parent=o)),o}return s(t,e),t.prototype.getExpect=function(){var t=e.prototype.getExpect.call(this);return null!=this.failAttempt?t.concat(this.failAttempt.getExpect()):t},t.prototype.clean=function(t){if(null!=this.failAttempt&&(null!=t||!this.isSuccess())){t=t||r.last(this.getBestExpect()).path(this);var n=r.first(t);if(null!=n&&n==this.failAttempt){var s=r.last(this.subResults),o=r.map(null!=s&&s.isSuccess()?this.subResults:r.initial(this.subResults),function(e){return e.clean()});return o.push(n.clean(r.rest(t))),new i.Result(o,this.expression,this.input)}}return e.prototype.clean.call(this,t)},t}(i.Result);t.RefResult=o},495:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(496),i=function(){function e(e,t){this.parts=e,this.id=t}return e.prototype.parse=function(e,t){for(var n=[],i=0;i<this.parts.length;i++){var r=this.parts[i].parse(e,t);if(r.isSuccess())return new s.OptionResult(r,this,e,n);n.push(r)}return new s.OptionResult(null,this,e,n)},e.prototype.toString=function(){return this.id},e}();t.ExpressionOptions=i},496:function(e,t,n){"use strict";var s=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function s(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(s.prototype=n.prototype,new s)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(52),r=n(0),o=function(e){function t(t,n,s,i){var o=e.call(this,null!=t?[t]:null,n,s)||this;return o.result=t,o.expression=n,o.input=s,o.failAttempt=i,r.forEach(o.failAttempt,function(e){e.parent=o}),o}return s(t,e),t.prototype.getExpect=function(){var e=this,t=[];return null!=this.result&&(t=this.result.getExpect()),t=r.reduce(this.failAttempt,function(e,t){return e.concat(t.getExpect())},t),t.length>0&&r.all(t,function(t){return t.input==e.input})?[this]:t},t.prototype.clean=function(e){if(null!=e||!this.isSuccess()){e=r.rest(e||r.last(this.getBestExpect()).path(this));var t=r.first(e);return null==t?new i.Result(null,this.expression,this.input):new i.Result([t.clean(r.rest(e))],this.expression,this.input)}return new i.Result(r.map(this.result.subResults,function(e){return e.clean()}),this.expression,this.input)},t}(i.Result);t.OptionResult=o},497:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(52),i=n(52),r=function(){function e(e,t,n){this.value=e,this.id=t}return e.prototype.parse=function(e,t){var n=e.match(this.value);null!=n&&0!=n.index&&(n=null);var r=new s.Result(null!=n?n[0]:null,this,e);return r.isSuccess()&&t&&e.length>r.value.length?new i.EndOfInputResult(r):r},e.prototype.toString=function(){return this.id},e}();t.ExpressionRegExp=r},498:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t,n){this.func=e,this.id=t,this.grammar=n}return e.prototype.parse=function(e,t){return this.func(e,t,this)},e.prototype.toString=function(){return this.id},e}();t.ExpressionFunction=s},499:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(52),i=function(){function e(e,t){if(this.parts=e,this.id=t,0==e.length)throw new Error(JSON.stringify(t)+" should have at least 1 parts")}return e.prototype.parse=function(e,t){for(var n,i=[],r=e,o=0;o<this.parts.length;o++){if(n=this.parts[o].parse(r,t&&o==this.parts.length-1),i.push(n),!n.isSuccess())break;r=r.substr(n.getLength())}return new s.Result(i,this,e)},e.prototype.toString=function(){return this.id},e}();t.ExpressionList=i},500:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(220);t.NestedQuery={basicExpressions:["NestedQuery"],grammars:{NestedQuery:"[[NestedField][OptionalSpaces][Expressions]]",NestedField:"[[Field]]",FieldValue:["NestedQuery"]},include:[s.Field]}},501:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(133);t.Date={grammars:{Date:"[DateYear]/[DateMonth]/[DateDay]",DateYear:/([0-9]{4})/,DateMonth:/(1[0-2]|0?[1-9])/,DateDay:/([1-2][0-9]|3[0-1]|0?[1-9])/,DateRange:"[Date][Spaces?]..[Spaces?][Date]",DateRelative:["DateRelativeNegative","DateRelativeTerm"],DateRelativeTerm:/now|today|yesterday/,DateRelativeNegative:"[DateRelativeTerm][DateRelativeNegativeRef]",DateRelativeNegativeRef:/([\-\+][0-9]+(s|m|h|d|mo|y))/},include:[s.Basic]}},502:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(133);t.QueryExtension={basicExpressions:["QueryExtension"],grammars:{QueryExtension:"$[QueryExtensionName]([QueryExtensionArguments])",QueryExtensionName:/\w+/,QueryExtensionArguments:"[QueryExtensionArgumentList*][QueryExtensionArgument]",QueryExtensionArgumentList:"[QueryExtensionArgument][Spaces?],[Spaces?]",QueryExtensionArgument:"[QueryExtensionArgumentName]:[Spaces?][QueryExtensionArgumentValue]",QueryExtensionArgumentName:/\w+/,QueryExtensionArgumentValue:["SingleQuoted","Expressions"]},include:[s.Basic]}},503:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SubExpression={basicExpressions:["SubExpression"],grammars:{SubExpression:"([Expressions])"}}},504:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),i=n(20),r=n(6),o=n(1),u=n(25),a=function(){function e(e,t,n){this.onchange=t,this.magicBox=n,this.hasFocus=!1,this.root=i.Component.resolveRoot(e),this.underlay=document.createElement("div"),this.underlay.className="magic-box-underlay",this.highlightContainer=document.createElement("span"),this.highlightContainer.className="magic-box-highlight-container",this.underlay.appendChild(this.highlightContainer),this.ghostTextContainer=document.createElement("span"),this.ghostTextContainer.className="magic-box-ghost-text",this.underlay.appendChild(this.ghostTextContainer),this.input=o.$$(e).find("input"),this.input?e.insertBefore(this.underlay,this.input):(this.input=document.createElement("input"),e.appendChild(this.underlay),e.appendChild(this.input)),this.setupHandler(),this.addAccessibilitiesProperties()}return Object.defineProperty(e.prototype,"expanded",{set:function(e){this.input.setAttribute("aria-expanded",e.toString())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeDescendant",{set:function(e){e?this.input.setAttribute("aria-activedescendant",e.id):this.input.removeAttribute("aria-activedescendant")},enumerable:!0,configurable:!0}),e.prototype.updateInput=function(){this.input.value!=this.result.input&&(this.input.value=this.result.input,this.hasFocus&&this.setCursor(this.getValue().length))},e.prototype.updateHighlight=function(){o.$$(this.highlightContainer).empty(),this.highlightContainer.appendChild(this.result.toHtmlElement())},e.prototype.updateWordCompletion=function(){o.$$(this.ghostTextContainer).empty(),this.ghostTextContainer.innerHTML="",null!=this.wordCompletion&&this.ghostTextContainer.appendChild(document.createTextNode(this.wordCompletion.substr(this.result.input.length)))},e.prototype.setResult=function(e,t){this.result=e,this.updateInput(),this.updateHighlight(),s.isUndefined(t)&&null!=this.wordCompletion&&0==this.wordCompletion.indexOf(this.result.input)?this.updateWordCompletion():this.setWordCompletion(t),this.updateScroll()},e.prototype.setWordCompletion=function(e){null!=e&&0!=e.toLowerCase().indexOf(this.result.input.toLowerCase())&&(e=null),this.wordCompletion=e,this.updateWordCompletion(),this.updateScroll()},e.prototype.setCursor=function(e){if(this.input.focus(),this.input.createTextRange){var t=this.input.createTextRange();t.move("character",e),t.select()}else null!=this.input.selectionStart&&(this.input.focus(),this.input.setSelectionRange(e,e))},e.prototype.getCursor=function(){return this.input.selectionStart},e.prototype.updateScroll=function(e){var t=this;void 0===e&&(e=!0);var n=function(){t.underlay.clientWidth<t.underlay.scrollWidth&&(t.underlay.style.visibility="hidden",t.underlay.scrollLeft=t.input.scrollLeft,t.underlay.scrollTop=t.input.scrollTop,t.underlay.style.visibility="visible"),t.updateScrollDefer=null,t.hasFocus&&t.updateScroll()};e?null==this.updateScrollDefer&&(this.updateScrollDefer=requestAnimationFrame(n)):n()},e.prototype.setupHandler=function(){var e=this;this.input.onblur=function(){e.hasFocus=!1,setTimeout(function(){e.hasFocus||e.onblur&&e.onblur()},300),e.updateScroll()},this.input.onfocus=function(){e.hasFocus||(e.hasFocus=!0,e.updateScroll(),e.onfocus&&e.onfocus())},this.input.onkeydown=function(t){e.keydown(t)},this.input.onkeyup=function(t){e.keyup(t)},this.input.oncut=function(){setTimeout(function(){e.onInputChange()})},this.input.onpaste=function(){setTimeout(function(){e.onInputChange()})}},e.prototype.addAccessibilitiesProperties=function(){this.input.setAttribute("autocomplete","off"),this.input.setAttribute("type","text"),this.input.setAttribute("role","combobox"),this.input.setAttribute("form","coveo-dummy-form"),this.input.setAttribute("aria-autocomplete","list"),this.input.setAttribute("title",r.l("InsertAQuery")+". "+r.l("PressEnterToSend"))},e.prototype.focus=function(){var e=this;setTimeout(function(){e.input.focus(),e.setCursor(e.getValue().length)})},e.prototype.blur=function(){this.hasFocus&&this.input.blur()},e.prototype.keydown=function(e){var t=this;switch(e.keyCode||e.which){case u.KEYBOARD.TAB:this.tabPress(),this.magicBox.clearSuggestion();break;default:e.stopPropagation(),null==this.onkeydown||this.onkeydown(e.keyCode||e.which)?requestAnimationFrame(function(){t.onInputChange()}):e.preventDefault()}},e.prototype.keyup=function(e){switch(e.keyCode||e.which){case u.KEYBOARD.LEFT_ARROW:case u.KEYBOARD.RIGHT_ARROW:this.handleLeftRightArrow(e);break;default:null==this.onkeydown||this.onkeyup(e.keyCode||e.which)?this.onInputChange():e.preventDefault()}},e.prototype.handleLeftRightArrow=function(e){o.$$(this.root).find("."+i.Component.computeCssClassNameForType("QuerySuggestPreview"))||this.onchangecursor(),null==this.onkeydown||this.onkeyup(e.keyCode||e.which)?this.onInputChange():e.preventDefault()},e.prototype.tabPress=function(){this.ontabpress&&this.ontabpress(),this.onblur&&this.onblur()},e.prototype.onInputChange=function(){this.result.input!=this.input.value&&this.onchange(this.input.value,!1)},e.prototype.getValue=function(){return this.input.value},e.prototype.getWordCompletion=function(){return this.wordCompletion},e}();t.InputManager=a},505:function(e,t,n){"use strict";function s(e){return new Promise(function(t,n){return e.forEach(function(e){return Promise.resolve(e).then(t,n)})})}var i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},r=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(i,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function u(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,u)}a((s=s.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return s([e,t])}}function s(n){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(o=r[2&n[0]?"return":n[0]?"throw":"next"])&&!(o=o.call(r,n[1])).done)return o;switch(r=0,o&&(n=[0,o.value]),n[0]){case 0:case 1:o=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,r=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!(o=o.length>0&&o[o.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){a.label=n[1];break}if(6===n[0]&&a.label<o[1]){a.label=o[1],o=n;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(n);break}o[2]&&a.ops.pop(),a.trys.pop();continue}n=t.call(e,a)}catch(e){n=[6,e],r=0}finally{i=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,r,o,u,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u};Object.defineProperty(t,"__esModule",{value:!0});var u,a=n(0);!function(e){e[e.Finished=0]="Finished",e[e.TimedOut=1]="TimedOut",e[e.Overriden=2]="Overriden"}(u=t.ProcessingStatus||(t.ProcessingStatus={}));var l=function(){function e(e){void 0===e&&(e={}),this.options=i({timeout:500},e)}return e.prototype.processQueries=function(e){return r(this,void 0,void 0,function(){var t,n=this;return o(this,function(i){return this.overrideIfProcessing(),this.processedResults=new Array(e.length),t=e.map(function(e){return e instanceof Promise?e:Promise.resolve(e)}),[2,s([this.accumulateResultsChronologically(t).then(function(){return n.buildProcessResults(u.Finished)}),this.waitForOverride().then(function(){return n.buildProcessResults(u.Overriden)}),this.waitForTimeout().then(function(){return n.buildProcessResults(u.TimedOut)})])]})})},e.prototype.overrideIfProcessing=function(){return r(this,void 0,void 0,function(){return o(this,function(e){return this.override&&this.override(),[2]})})},Object.defineProperty(e.prototype,"orderedResults",{get:function(){return a.flatten(this.processedResults.filter(function(e){return!!e}),!0)},enumerable:!0,configurable:!0}),e.prototype.buildProcessResults=function(e){return{status:e,results:e!==u.Overriden?this.orderedResults:[]}},e.prototype.accumulateResultsChronologically=function(e){return r(this,void 0,void 0,function(){var t;return o(this,function(n){switch(n.label){case 0:return t=this.processedResults,[4,Promise.all(e.map(function(e,n){return e.then(function(e){return t[n]=e})}))];case 1:return n.sent(),[2]}})})},e.prototype.waitForOverride=function(){var e=this;return new Promise(function(t){e.override=function(){e.override=null,t()}})},e.prototype.waitForTimeout=function(){var e=this;return new Promise(function(t){return setTimeout(function(){return t()},e.options.timeout)})},e}();t.QueryProcessor=l},508:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(500),i=n(502),r=n(133),o=n(220),u=n(503);t.Complete={include:[s.NestedQuery,i.QueryExtension,u.SubExpression,o.Field,r.Basic]}},509:function(e,t,n){"use strict";function s(e,t,n,s){u.each(s.expressions,function(t){u.contains(e,t)||e.push(t)}),u.each(s.basicExpressions,function(e){u.contains(t,e)||t.push(e)}),u.each(s.grammars,function(e,t){if(t in n){if(!u.isArray(n[t])||!u.isArray(e))throw u.each(e,function(e){n[t].push(e)}),new Error("Can not merge "+t+"("+JSON.stringify(e)+" => "+JSON.stringify(n[t])+")");u.each(e,function(e){n[t].push(e)})}else n[t]=e})}function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=[],i=[],r={Start:["Expressions","Empty"],Expressions:"[OptionalSpaces][Expression][ExpressionsList*][OptionalSpaces]",ExpressionsList:"[Spaces][Expression]",Expression:n,BasicExpression:i,OptionalSpaces:/ */,Spaces:/ +/,Empty:/(?!.)/},o=0;o<e.length;o++)s(n,i,r,e[o]),u.each(e[o].include,function(t){u.contains(e,t)||e.push(t)});return n.push("BasicExpression"),{start:"Start",expressions:r}}function r(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=i.apply(this,e);return new o.Grammar(n.start,n.expressions)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(176),u=n(0);t.Expressions=i,t.ExpressionsGrammar=r},510:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(){}return e.buildingResultPreviewsQuery="buildingResultPreviewsQuery",e.updateResultPreviewsManagerOptions="updateResultPreviewsManagerOptions",e.populateSearchResultPreviews="populateSearchResultPreviews",e}();t.ResultPreviewsManagerEvents=s},511:function(e,t,n){"use strict";var s=this&&this.__assign||Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e};Object.defineProperty(t,"__esModule",{value:!0});var i=n(28),r=function(){function e(e){this.owner=e}return Object.defineProperty(e.prototype,"options",{get:function(){return this.owner.options},set:function(e){this.owner.options=e},enumerable:!0,configurable:!0}),e.prototype.postProcess=function(){this.options=s({},this.options,this.owner.componentOptionsModel.get(i.ComponentOptionsModel.attributesEnum.searchBox)),this.processQueryOnClearVersusEmptyQuery(),this.processQueryOnClearVersusSearchAsYouType()},e.prototype.processQueryOnClearVersusEmptyQuery=function(){this.options.triggerQueryOnClear&&!1===this.owner.searchInterface.options.allowQueriesWithoutKeywords&&(this.owner.logger.warn('Forcing option triggerQueryOnClear to false, as it is not supported when the search interface is configured to not allow queries without keywords (data-allow-queries-without-keywords="false")',this.owner),this.options.triggerQueryOnClear=!1)},e.prototype.processQueryOnClearVersusSearchAsYouType=function(){!0===this.owner.searchInterface.options.allowQueriesWithoutKeywords&&!1===this.options.triggerQueryOnClear&&!0===this.options.enableSearchAsYouType&&(this.owner.logger.warn("Forcing option triggerQueryOnClear to true, since search-as-you-type is enabled",this.owner),this.options.triggerQueryOnClear=!0)},e}();t.QueryboxOptionsProcessing=r},52:function(e,t,n){"use strict";var s=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function s(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(s.prototype=n.prototype,new s)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(218),r=n(219),o=n(0),u=function(){function e(e,t,n){var s=this;this.expression=t,this.input=n,o.isString(e)?this.value=e:o.isArray(e)&&(this.subResults=e,o.forEach(this.subResults,function(e){e.parent=s}))}return e.prototype.isSuccess=function(){return null!=this.value||null!=this.subResults&&o.all(this.subResults,function(e){return e.isSuccess()})},e.prototype.path=function(e){var t=null!=this.parent&&this.parent!=e?this.parent.path(e):[];return t.push(this),t},e.prototype.findParent=function(e){for(var t=this,n=o.isString(e)?function(t){return e==t.expression.id}:e;null!=t&&!n(t);)t=t.parent;return t},e.prototype.find=function(e){var t=o.isString(e)?function(t){return e==t.expression.id}:e;if(t(this))return this;if(this.subResults)for(var n=0;n<this.subResults.length;n++){var s=this.subResults[n].find(t);if(s)return s}return null},e.prototype.findAll=function(e){var t=[],n=o.isString(e)?function(t){return e==t.expression.id}:e;return n(this)&&t.push(this),this.subResults&&(t=o.reduce(this.subResults,function(e,t){return e.concat(t.findAll(n))},t)),t},e.prototype.resultAt=function(e,t){if(e<0||e>this.getLength())return[];if(null!=t){if(o.isString(t)){if(t==this.expression.id)return[this]}else if(t(this))return[this]}else{if(null!=(null==this.value&&null==this.subResults?this.input:this.value))return[this]}if(null!=this.subResults){for(var n=[],s=0;s<this.subResults.length;s++){var i=this.subResults[s];if(n=n.concat(i.resultAt(e,t)),(e-=i.getLength())<0)break}return n}return[]},e.prototype.getExpect=function(){return null==this.value&&null==this.subResults?[this]:null!=this.subResults?o.reduce(this.subResults,function(e,t){return e.concat(t.getExpect())},[]):[]},e.prototype.getBestExpect=function(){var e=this.getExpect()