text: /**
   * @license
   * Copyright (c) 2014, 2020, Oracle and/or its affiliates.
   * Licensed under The Universal Permissive License (UPL), Version 1.0
   * as shown at https://oss.oracle.com/licenses/upl/
   * @ignore
   */
  define(["ojs/ojcore","jquery","ojs/ojcontext","ojs/ojlistdataproviderview","ojs/ojtreedataproviderview","ojs/ojthemeutils","ojs/ojtimerutils","ojs/ojcomponentcore","ojs/ojlogger","ojs/ojeditablevalue","ojs/ojoptgroup","ojs/ojoption","ojs/ojhighlighttext"],function(e,t,i,s,o,n,a,l,r){"use strict";var h,c,u={properties:{asyncValidators:{type:"Array<Object>",value:[]},converter:{type:"object"},describedBy:{type:"string"},disabled:{type:"boolean",value:!1},displayOptions:{type:"object",properties:{converterHint:{type:"Array<string>|string",value:["placeholder","notewindow"]},helpInstruction:{type:"Array<string>|string",value:["notewindow"]},messages:{type:"Array<string>|string",value:["inline"]},validatorHint:{type:"Array<string>|string",value:["notewindow"]}}},help:{type:"object",properties:{instruction:{type:"string",value:""}}},helpHints:{type:"object",properties:{definition:{type:"string",value:""},source:{type:"string",value:""}}},labelEdge:{type:"string",enumValues:["inside","none","provided"]},labelHint:{type:"string",value:""},labelledBy:{type:"string"},maximumResultCount:{type:"number",value:15},messagesCustom:{type:"Array<Object>",writeback:!0,value:[]},minLength:{type:"number",value:0},optionRenderer:{type:"function"},options:{type:"Array<Object>|object"},optionsKeys:{type:"object",properties:{childKeys:{type:"object",properties:{label:{type:"string"},value:{type:"string"},children:{type:"string"},childKeys:{type:"object",properties:{label:{type:"string"},value:{type:"string"},children:{type:"string"},childKeys:{type:"object"}}}}},children:{type:"string"},label:{type:"string"},value:{type:"string"}}},pickerAttributes:{type:"object",properties:{style:{type:"string"},class:{type:"string"}}},placeholder:{type:"string"},rawValue:{type:"Array<string>",writeback:!0,readOnly:!0},readonly:{type:"boolean",value:!1},required:{type:"boolean",value:!1},translations:{type:"object",value:{},properties:{filterFurther:{type:"string"},moreMatchesFound:{type:"string"},noMatchesFound:{type:"string"},oneMatchesFound:{type:"string"},required:{type:"object",properties:{hint:{type:"string"},messageDetail:{type:"string"},messageSummary:{type:"string"}}}}},userAssistanceDensity:{type:"string",enumValues:["compact","efficient","reflow"],value:"reflow"},valid:{type:"string",writeback:!0,enumValues:["invalidHidden","invalidShown","pending","valid"],readOnly:!0},validators:{type:"Array",value:[]},value:{type:"Array<any>",writeback:!0},valueOptions:{type:"Array<Object>",writeback:!0}},methods:{refresh:{},validate:{},reset:{},showMessages:{},setProperty:{},getProperty:{},setProperties:{},getNodeBySubId:{},getSubIdByNode:{}},events:{ojAnimateStart:{},ojAnimateEnd:{}},extension:{}},d={properties:{asyncValidators:{type:"Array<Object>",value:[]},converter:{type:"object"},describedBy:{type:"string"},disabled:{type:"boolean",value:!1},displayOptions:{type:"object",properties:{converterHint:{type:"Array<string>|string",value:["placeholder","notewindow"]},helpInstruction:{type:"Array<string>|string",value:["notewindow"]},messages:{type:"Array<string>|string",value:["inline"]},validatorHint:{type:"Array<string>|string",value:["notewindow"]}}},filterOnOpen:{type:"string",enumValues:["none","rawValue"],value:"none"},help:{type:"object",properties:{instruction:{type:"string",value:""}}},helpHints:{type:"object",properties:{definition:{type:"string",value:""},source:{type:"string",value:""}}},labelEdge:{type:"string",enumValues:["inside","none","provided"]},labelHint:{type:"string",value:""},labelledBy:{type:"string"},maximumResultCount:{type:"number",value:15},messagesCustom:{type:"Array<Object>",writeback:!0,value:[]},minLength:{type:"number",value:0},optionRenderer:{type:"function"},options:{type:"Array<Object>|object"},optionsKeys:{type:"object",properties:{childKeys:{type:"object",properties:{label:{type:"string"},value:{type:"string"},children:{type:"string"},childKeys:{type:"object",properties:{label:{type:"string"},value:{type:"string"},children:{type:"string"},childKeys:{type:"object"}}}}},children:{type:"string"},label:{type:"string"},value:{type:"string"}}},pickerAttributes:{type:"object",properties:{style:{type:"string"},class:{type:"string"}}},placeholder:{type:"string"},rawValue:{type:"string",writeback:!0,readOnly:!0},readonly:{type:"boolean",value:!1},required:{type:"boolean",value:!1},translations:{type:"object",value:{},properties:{filterFurther:{type:"string"},moreMatchesFound:{type:"string"},noMatchesFound:{type:"string"},oneMatchesFound:{type:"string"},required:{type:"object",properties:{hint:{type:"string"},messageDetail:{type:"string"},messageSummary:{type:"string"}}}}},userAssistanceDensity:{type:"string",enumValues:["compact","efficient","reflow"],value:"reflow"},valid:{type:"string",writeback:!0,enumValues:["invalidHidden","invalidShown","pending","valid"],readOnly:!0},validators:{type:"Array",value:[]},value:{type:"any",writeback:!0},valueOption:{type:"object",writeback:!0,properties:{value:{type:"any"},label:{type:"string"}}}},methods:{refresh:{},validate:{},reset:{},showMessages:{},setProperty:{},getProperty:{},setProperties:{},getNodeBySubId:{},getSubIdByNode:{}},events:{ojValueUpdated:{},ojAnimateStart:{},ojAnimateEnd:{}},extension:{}},p={properties:{describedBy:{type:"string"},disabled:{type:"boolean",value:!1},displayOptions:{type:"object",properties:{converterHint:{type:"Array<string>|string",value:["placeholder","notewindow"]},helpInstruction:{type:"Array<string>|string",value:["notewindow"]},messages:{type:"Array<string>|string",value:["inline"]},validatorHint:{type:"Array<string>|string",value:["notewindow"]}}},help:{type:"object",properties:{instruction:{type:"string",value:""}}},helpHints:{type:"object",properties:{definition:{type:"string",value:""},source:{type:"string",value:""}}},labelEdge:{type:"string",enumValues:["inside","none","provided"]},labelHint:{type:"string",value:""},labelledBy:{type:"string"},maximumResultCount:{type:"number",value:15},messagesCustom:{type:"Array<Object>",writeback:!0,value:[]},minimumResultsForSearch:{type:"number",value:15},optionRenderer:{type:"function"},options:{type:"Array<Object>|object"},optionsKeys:{type:"object",properties:{childKeys:{type:"object",properties:{label:{type:"string"},value:{type:"string"},children:{type:"string"},childKeys:{type:"object"}}},children:{type:"string"},label:{type:"string"},value:{type:"string"}}},pickerAttributes:{type:"object",properties:{style:{type:"string"},class:{type:"string"}}},placeholder:{type:"string"},readonly:{type:"boolean",value:!1},renderMode:{type:"string",enumValues:["jet","native"]},required:{type:"boolean",value:!1},translations:{type:"object",value:{},properties:{filterFurther:{type:"string"},moreMatchesFound:{type:"string"},noMatchesFound:{type:"string"},oneMatchesFound:{type:"string"},required:{type:"object",properties:{hint:{type:"string"},messageDetail:{type:"string"},messageSummary:{type:"string"}}},searchField:{type:"string"}}},userAssistanceDensity:{type:"string",enumValues:["compact","efficient","reflow"],value:"reflow"},valid:{type:"string",writeback:!0,enumValues:["invalidHidden","invalidShown","pending","valid"],readOnly:!0},value:{type:"Array<any>",writeback:!0},valueOptions:{type:"Array<Object>",writeback:!0}},methods:{refresh:{},validate:{},reset:{},showMessages:{},setProperty:{},getProperty:{},setProperties:{},getNodeBySubId:{},getSubIdByNode:{}},events:{ojAnimateStart:{},ojAnimateEnd:{}},extension:{}},f={properties:{describedBy:{type:"string"},disabled:{type:"boolean",value:!1},displayOptions:{type:"object",properties:{converterHint:{type:"Array<string>|string",value:["placeholder","notewindow"]},helpInstruction:{type:"Array<string>|string",value:["notewindow"]},messages:{type:"Array<string>|string",value:["inline"]},validatorHint:{type:"Array<string>|string",value:["notewindow"]}}},help:{type:"object",properties:{instruction:{type:"string",value:""}}},helpHints:{type:"object",properties:{definition:{type:"string",value:""},source:{type:"string",value:""}}},labelEdge:{type:"string",enumValues:["inside","none","provided"]},labelHint:{type:"string",value:""},labelledBy:{type:"string"},maximumResultCount:{type:"number",value:15},messagesCustom:{type:"Array<Object>",writeback:!0,value:[]},minimumResultsForSearch:{type:"number",value:15},optionRenderer:{type:"function"},options:{type:"Array<Object>|object"},optionsKeys:{type:"object",properties:{childKeys:{type:"object",properties:{label:{type:"string"},value:{type:"string"},children:{type:"string"},childKeys:{type:"object"}}},children:{type:"string"},label:{type:"string"},value:{type:"string"}}},pickerAttributes:{type:"object",properties:{style:{type:"string"},class:{type:"string"}}},placeholder:{type:"string"},readonly:{type:"boolean",value:!1},renderMode:{type:"string",enumValues:["jet","native"]},required:{type:"boolean",value:!1},translations:{type:"object",value:{},properties:{filterFurther:{type:"string"},moreMatchesFound:{type:"string"},noMatchesFound:{type:"string"},oneMatchesFound:{type:"string"},required:{type:"object",properties:{hint:{type:"string"},messageDetail:{type:"string"},messageSummary:{type:"string"}}},searchField:{type:"string"}}},userAssistanceDensity:{type:"string",enumValues:["compact","efficient","reflow"],value:"reflow"},valid:{type:"string",writeback:!0,enumValues:["invalidHidden","invalidShown","pending","valid"],readOnly:!0},value:{type:"any",writeback:!0},valueOption:{type:"object",writeback:!0,properties:{value:{type:"any"},label:{type:"string"}}}},methods:{refresh:{},validate:{},reset:{},showMessages:{},setProperty:{},getProperty:{},setProperties:{},getNodeBySubId:{},getSubIdByNode:{}},events:{ojAnimateStart:{},ojAnimateEnd:{}},extension:{}},v={GENERATED_OPTIONS_SELECTOR:"oj-select-options-generated",KEY:{TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isControl:function(e){switch(e.which){case v.KEY.SHIFT:case v.KEY.CTRL:case v.KEY.ALT:return!0;default:return!!e.metaKey}},isFunctionKey:function(e){var t=e.which?e.which:e;return t>=112&&t<=123}},DEFAULT_FETCH_SIZE:15,DEFAULT_FETCH_ALL_SIZE:-1,FILTERING_FETCH_SIZE_MIN:100,FILTERING_FETCH_SIZE_MAX:500,FILTERING_FETCH_SIZE_MRC_TIMES:7,DEFAULT_QUERY_DELAY:70,ValueChangeTriggerTypes:{ENTER_PRESSED:"enter_pressed",OPTION_SELECTED:"option_selected",BLUR:"blur",SEARCH_ICON_CLICKED:"search_icon_clicked"},lastMousePosition:{x:0,y:0},nextUid:(h=1,function(){var e=h;return h+=1,e}),scrollBarDimensions:null,each2:function(e,i){for(var s=t.isFunction(e[0])?t(e[0]()):t(e[0]),o=-1,n=e.length;++o<n&&(s.context=s[0]=t.isFunction(e[0])?e[o]():e[o])&&!1!==i.call(s[0],o,s););return e},measureScrollbar:function(){var e=t("<div class='oj-listbox-measure-scrollbar'></div>");e.appendTo("body");var i={width:e.width()-e[0].clientWidth,height:e.height()-e[0].clientHeight};return e.remove(),i},splitVal:function(e,i){var s,o,n;if(null===e||e.length<1)return[];for(o=0,n=(s=e.split(i)).length;o<n;o++)s[o]=t.trim(s[o]);return s},getSideBorderPadding:function(e){return e.outerWidth(!1)-e.width()},installKeyUpChangeEvent:function(e){var i="keyup-change-value";e.on("keydown",function(){void 0===t.data(e,i)&&t.data(e,i,e.val())}),e.on("keyup",function(s){if(s.which!==v.KEY.ENTER){var o=t.data(e,i);void 0!==o&&e.val()!==o&&(t.removeData(e,i),e.trigger("keyup-change"))}else s.preventDefault()})},getSearchText:function(e){var t,i=e.which||e.keyCode;return e&&"keydown"===e.type&&(32===i||i>47&&i<58||i>64&&i<91||i>95&&i<112||i>185&&i<193||i>218&&i<223)&&(null!=e.key?t=e.key:(i>=96&&i<=105&&(i-=48),t=String.fromCharCode(i),e.shiftKey||(t=t.toLowerCase())),e.preventDefault()),t},escapeRegExp:function(e){return e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")},installFilteredMouseMove:function(e){e.on("mousemove",function(e){var i=v.lastMousePosition;void 0!==i&&i.x===e.pageX&&i.y===e.pageY||(t(e.target).trigger("mousemove-filtered",e),v.lastMousePosition.x=e.pageX,v.lastMousePosition.y=e.pageY)})},thunk:function(e){var t,i=!1;return function(){return!1===i&&(t=e(),i=!0),t}},_focus:function(e,t){if(t[0]!==document.activeElement){var i=v._addBusyState(e.container,"setting focus");a.getTimer(40).getPromise().then(function(){var e,s=t[0],o=t.val().length;t.focus(),t.is(":visible")&&s===document.activeElement&&(s.setSelectionRange?s.setSelectionRange(o,o):s.createTextRange&&((e=s.createTextRange()).collapse(!1),e.select())),i()})}},getCursorInfo:function(e){var i=t(e)[0],s=0,o=0;if("selectionStart"in i)s=i.selectionStart,o=i.selectionEnd-s;else if("selection"in document){i.focus();var n=document.selection.createRange();o=document.selection.createRange().text.length,n.moveStart("character",-i.value.length),s=n.text.length-o}return{offset:s,length:o}},killEvent:function(e){e.preventDefault()},local:function(e,i){var s,o,n=e,a=function(e){return""+e.label};t.isArray(n)&&(n={results:o=n}),!1===t.isFunction(n)&&(o=n,n=function(){return o});var l=n();return l&&l.text&&(a=l.text,t.isFunction(a)||(s=l.text,a=function(e){return e[s]})),function(e){var s=e.term,o={results:[]};""!==s||i?(n()&&v.each2(t(n().results),function(t,s){v._processData(e,s,o.results,i,!0,a)}),e.callback(o)):e.callback(n())}},createOptionTag:function(e,i,s,o){var n=t("<option>");return n.addClass("oj-listbox-result oj-listbox-result-selectable oj-listbox-results-depth-"+e),n.attr("role","option"),n.attr("id","oj-listbox-result-label-"+v.nextUid()),n.text(o(s)),n.attr("value",i),n},createOptgroupTag:function(e,i,s){var o=t("<optgroup>");return o.addClass("oj-listbox-results-sub"),o.attr("label",s(i)),e.addClass("oj-listbox-result-with-children"),o},listPopulateResults:function(e,i,s){!function e(i,o,n){var a,l,r,h;o.each(function(){(l=t(this)).is("li")&&(l.children("ul").length>0?(r=l.contents().filter(function(){return 1!==this.nodeType||"ul"!==this.tagName.toLowerCase()}).text(),a=v.createOptgroupTag(i,r,s),h=l.children("ul"),e(a,h.children(),n+1)):a=v.createOptionTag(n,l.attr("oj-data-value"),l.text(),s),a.appendTo(i))})}(e,i,0)},ojOptionPopulateResults:function(e,i,s){!function e(i,o,n){var a,l,r;o.each(function(){(l=t(this)).is("oj-option")?(r=l.text()||l.attr("label"),a=v.createOptionTag(n,l.prop("value"),r,s)):l.is("oj-optgroup")?(r=l.text()||l.attr("label"),a=v.createOptgroupTag(i,r,s),e(a,l.children(),n+1)):l.is("option")&&(a=l),a.appendTo(i)})}(e,i,0)},lookupOptionKeys:function(e,t,i){return e[t[i]||i]},arrayPopulateResults:function(e,t,i,s){!function e(t,s,o,n){for(var a,l,r,h,c,u=0,d=s.length;u<d;u++)a=s[u],r=v.lookupOptionKeys(a,n,"children"),h=v.lookupOptionKeys(a,n,"label"),r&&r.length>0?e(l=v.createOptgroupTag(t,h,i),r,o+1,n.childKeys||{}):(c=v.lookupOptionKeys(a,n,"value"),l=v.createOptionTag(o,c,h,i)),l.appendTo(t)}(e,t,0,s||{})},cleanupResults:function(e){e.children().not("oj-option, oj-optgroup").remove(),e.removeClass("oj-listbox-result-with-children")},_addBusyState:function(e,t){var s={description:"The component identified by '"+e.attr("id")+"' "+t};return i.getContext(e[0]).getBusyContext().addBusyState(s)},_clearBusyState:function(e){e&&e()},isDataProvider:function(t){return!(!t||!e.DataProviderFeatureChecker)&&e.DataProviderFeatureChecker.isDataProvider(t)},isTreeDataProvider:function(t){return!(!t||!e.DataProviderFeatureChecker)&&e.DataProviderFeatureChecker.isTreeDataProvider(t)},getDataProvider:function(e){if(e){var t=e._dataProvider||e.options;if(v.isDataProvider(t))return t}return null},clearDataProviderWrapper:function(e){e.options._dataProvider=null},_findOption:function(t,i){if(e.Object.compareValues(i,t.value))return t;if(t.children)for(var s,o=t.children,n=0;n<o.length;n++)if(s=v._findOption(o[n],i))return s;return null},findOption:function(e,t){if(Array.isArray(e)){for(var i=0,s=e.length;i<s;i++){var o=v._findOption(e[i],t);if(o)return o}return null}return v._findOption(e,t)},findOptions:function(e,t){for(var i=[],s=0;s<t.length;s++){var o=v.findOption(e,t[s]);o&&i.push(o)}return i},findOptionFromResult:function(e,t,i){var s,o=v.getLastQueryResult(e);if(o&&(s=v.findOption(o,t)),e.ojContext.multiple&&!s&&(s=v.getSelectedOptionData(e,t)),s){var n={value:t,label:s.label};return s.data&&s.metadata&&(n.data=s.data,n.metadata=s.metadata),n}return i},mergeValueAndValueOptions:function(e){var t=e.options.value,i=!1;if(e.multiple){var s,o=e.options.valueOptions;if(t&&t.length>0)o&&o.length&&(s=v.findOptions(o,t)),s&&s.length===o.length||(i=!0);else o&&v.syncValueWithValueOptions(e,o,t,null)}else{var n,a=e.options.valueOption;if(null!=t)a&&(n=v.findOption(a,t)),n||(i=!0);else a&&v.syncValueWithValueOption(e,a,t,null)}return i},syncValueWithValueOption:function(i,s,o,n){var a,l=!0;if(v.isValueOptionsForPlaceholder(!1,s)?v.isValueForPlaceholder(!1,o)?(a=o,l=!1):a=null:a=s?s.value:null,e.Object.compareValues(a,o)){if(!0===n){var r=i.element[0];t(r.options[r.selectedIndex]).text(v.getLabel(s))}else if(!1===n){var h=i.select||i.combobox;h&&l&&h._updateSelection(s)}}else v._forceSetValue(i,a)},syncValueWithValueOptions:function(i,s,o,n){var a,l=!0;if(v.isValueOptionsForPlaceholder(!0,s))v.isValueForPlaceholder(!0,o)?(a=o,l=!1):a=v.getValueForPlaceholder(!0),e.Object.compareValues(a,o)||v._forceSetValue(i,a);else if(s){a=[];for(var r=0;r<s.length;r++)a.push(s[r].value);if(e.Object.compareValues(a,o)){if(!0===n){var h=0;i.element.find("option").each(function(){if(this.selected){var e=v.getLabel(s[h]);this.text!=e&&t(this).text(e),h+=1}})}else if(!1===n){var c=i.select||i.combobox;c&&l&&c._updateSelection(s)}}else v._forceSetValue(i,a)}},_forceSetValue:function(e,t){var i=e;i.forceCanSetValue=!0;try{i._SetValue(t,null,{doValueChangeCheck:!1,_context:{internalSet:!0,writeback:!0}})}finally{delete i.forceCanSetValue}},isPlaceholderSpecified:function(e){return"string"==typeof e.placeholder},getFixupValueOptionsForPlaceholder:function(e){return e?[]:{value:null,label:null}},isValueOptionsForPlaceholder:function(t,i){return null==i||!t&&null==i.value||e.Object.compareValues(i,v.getFixupValueOptionsForPlaceholder(t))},getValueOptionsForPlaceholder:function(e,t){var i=e.multiple;return e._IsCustomElement()&&v.isPlaceholderSpecified(e.options)&&v.isValueOptionsForPlaceholder(i,t)&&(t=v.getFixupValueOptionsForPlaceholder(i)),t},getValueForPlaceholder:function(e){return e?[]:""},isValueForPlaceholder:function(t,i){return null==i||e.Object.compareValues(i,v.getValueForPlaceholder(t))},setValueOptions:function(e,t){var i,s={internalSet:!0,changed:!0,writeback:!0},o=v.getOpts(e),n=!!o&&v.isDataProvider(o.options);if(e.multiple){var a=[],l=[];if(t&&t.length){i=[];for(var r=0;r<t.length;r++)i.push({value:t[r].value,label:t[r].label}),n&&(a.push(t[r].data),l.push(t[r].metadata))}else i=t;s=v.getContextWithExtraData(s,o,a,l),e.option("valueOptions",i,{_context:s}),o&&(o.valueOptions=i)}else{var h=t;Array.isArray(t)&&(h=t[0]),h&&(s=v.getContextWithExtraData(s,o,h.data,h.metadata)),h&&!v.isValueOptionsForPlaceholder(e.multiple,h)?(i={value:h.value,label:h.label},e.option("valueOption",{value:h.value,label:h.label},{_context:s})):i=h,e.option("valueOption",i,{_context:s}),o&&(o.valueOption=i)}},updateValueOptions:function(e){if(e){var t=e.datalist?e.datalist:e.opts.element;e.opts.initSelection.call(null,t,function(t){var i=e.ojContext.multiple,s=t;if(null==s&&"oj-combobox"===e._classNm){var o=e.ojContext.options.value;if(i){s=[];for(var n=0;n<o.length;n++)s.push(e.opts.manageNewEntry(o[n]))}else s=e.opts.manageNewEntry(o)}s&&(e.setValOpts(s),i?e._updateSelection(s):e._updateSelectedOption(s))})}},applyValueOptions:function(e,t){if(e&&!e.ojContext._resolveValueOptionsLater&&("oj-combobox"===e._classNm||"oj-select"===e._classNm)){var i=e.ojContext.multiple,s=i?t.valueOptions:t.valueOption;if(v.isValueOptionsForPlaceholder(i,s))return!1;if(s)return e._updateSelection(s),!0}return!1},isValueChanged:function(e){return e._valueHasChanged},setValueChanged:function(e,t){e._valueHasChanged=t},hasInvalidComponentMessages:function(e){return!e.isValid()&&e._hasInvalidComponentMessagesShowing()},wrapDataProviderIfNeeded:function(t,i){var n=t.options,a=n.options;if(v.isDataProvider(a)){var l,r=n.optionsKeys||{},h=v.isTreeDataProvider(a);if(h&&!(a instanceof e.TreeDataProviderView)||!h&&!(a instanceof e.ListDataProviderView)){var c=function(e){for(var t=e.data,i={data:{}},s=Object.keys(t),o=0;o<s.length;o++){var n=s[o],a=t[n];i.data[n]=a}return null!=r.label?i.data.label=String(t[r.label]):null!=t.label&&(i.data.label=String(t.label)),null!=r.value&&(i.data.value=t[r.value]),i.metadata={key:t[r.value||"value"]},i};l=h?new o(a,{dataMapping:{mapFields:c}}):new s(a,{dataMapping:{mapFields:c}})}l&&(n._dataProvider=l,i&&(i._dataProvider=l))}},getLabel:function(e){return null!=e.label?e.label:String(e.value)},_handleDataProviderEvents:function(e,t){if("mutate"===t.type&&null!=t.detail.remove){for(var i=t.detail.remove.data,s=!1,o=[].concat(e.options.value),n=0;n<i.length;n++){var a=o.indexOf(i[n].value);a>=0&&(o.splice(a,1),s=!0)}s&&e._setOption("value",o)}e._setOption("options",e.options.options)},addDataProviderEventListeners:function(e){var t=v.getDataProvider(e.options);if(t){v.removeDataProviderEventListeners(e);var i=v._handleDataProviderEvents.bind(null,e);e._saveDataProviderEH=i,t.addEventListener("mutate",i),t.addEventListener("refresh",i)}},removeDataProviderEventListeners:function(e){var t=v.getDataProvider(e.options),i=e._saveDataProviderEH;null!=t&&i&&(t.removeEventListener("mutate",i),t.removeEventListener("refresh",i),e._saveDataProviderEH=void 0)},addLoadingIndicator:function(e){var i=e;if(void 0===i._loadingIndicatorCount?i._loadingIndicatorCount=1:i._loadingIndicatorCount+=1,null==i._saveLoadingIndicator){var s=t(document.createElement("div"));s.uniqueId().attr("role","presentation").addClass("oj-listbox-loading-icon-container");var o=t(document.createElement("div"));o.addClass("oj-icon oj-listbox-loading-icon"),s.append(o),i.prepend(s),i._saveLoadingIndicator=s}},removeLoadingIndicator:function(e){var t=e;void 0!==t._loadingIndicatorCount&&(1===t._loadingIndicatorCount?(t._loadingIndicatorCount=void 0,null!=t._saveLoadingIndicator&&(t._saveLoadingIndicator.remove(),t._saveLoadingIndicator=void 0)):t._loadingIndicatorCount-=1)},addDropdownMessage:function(e,i,s){if(!e._saveDropdownMessage){var o=t(document.createElement("div"));o.addClass("oj-listbox-filter-message-box");var n=t(document.createElement("div"));n.addClass("oj-listbox-filter-message-text oj-listbox-liveregion"),n.attr({role:"region","aria-live":"polite"});var a=t(document.createElement("div"));a.addClass("oj-listbox-filter-message-separator"),o.append(n),o.append(a),e.prepend(o),n.text(s),e._saveDropdownMessage=o}},removeDropdownMessage:function(e){e._saveDropdownMessage&&(e._saveDropdownMessage.remove(),e._saveDropdownMessage=void 0)},createItemResult:function(e,t){return{label:e.label,value:e.value,disabled:e.disabled,children:e.children,data:e,metadata:t}},fetchFlatData:function(e,t,i,s,o,n){var a=[],l=t.fetchFirst(i)[Symbol.asyncIterator](),r=n>0;return l.next().then(function t(h){if(h){var c=h.value.data,u=h.value.metadata;if(c)for(var d,p,f=0;f<c.length&&(!r||a.length<n);f++)d=c[f],p=u[f],!i.filterCriterion&&s&&s.matcher&&!s.matcher(s.term,v.getLabel(d),d)||a.push(v.createItemResult(d,p));if(o&&v.removeDropdownMessage(o),o&&!h.done&&r&&a.length>=n)v.addDropdownMessage(o,e,e.getTranslatedString("filterFurther")),e._hasMore=!0;else{if(!h.done&&(!r||a.length<n))return l.next().then(t);e._hasMore=!1}}return Promise.resolve(a)})},fetchTreeData:function(e,t,i,s,o,n){var a=n>0,l=i.size;return e._hasMore=!1,o&&v.removeDropdownMessage(o),function t(o){i.size=l;var n=[],r=o.fetchFirst(i)[Symbol.asyncIterator]();return r.next().then(function h(c){var u=c.value.data,d=c.value.metadata,p=function i(s){if(s<u.length){if(l>0||!a){var r=u[s],h=d[s],c=o.getChildDataProvider(r.value);return c?t(c).then(function(e){return f(r,h,e),i(s+1)}):(f(r,h,[]),i(s+1))}e._hasMore=!0}return Promise.resolve(n)}(0);return p.then(function(){if(a){if(c.done||l<=0)return c.done||(e._hasMore=!0),Promise.resolve(n)}else if(c.done)return Promise.resolve(n);return r.next().then(h)});function f(e,t,r){var h=!s||!s.matcher||i.filterCriterion||s.matcher(s.term,v.getLabel(e),e),c=null==o.getChildDataProvider(e.value);if(c||(h=!1),h&&0===r.length&&a&&(l-=1),h||r.length>0){var u=v.createItemResult(e,t);e.disabled&&(u.disabled=!0),c&&!u.disabled||(u._jetUnSelectable=!0),r.length>0&&(u.children=r),n.push(u)}}})}(t).then(function(t){return e._hasMore&&o&&v.addDropdownMessage(o,e,e.getTranslatedString("filterFurther")),t})},fetchFilteredData:function(t,i,s,o,n){var a=v.getDataProvider(t.options),l={size:i},r=a.getCapability("filter"),h=e.AttributeFilterOperator.AttributeOperator.$co,c=e.AttributeFilterOperator.AttributeOperator.$regex,u=!1,d=!1;if(r){var p=r.operators;p&&p.length>0&&(p.indexOf(h)>=0||p.indexOf(c)>=0)&&(u=!0,p.indexOf(c)>=0&&(d=!0))}var f=v.isTreeDataProvider(a);if(o&&o.term)if(u){var m,_=t.options.optionsKeys;if(m=_&&_.label?_.label:"label",d){var b=v.escapeRegExp(o.term);l.filterCriterion={op:c,attribute:m,value:new RegExp(b,"i")}}else l.filterCriterion={op:h,attribute:m,value:o.term}}else if(!f)if(s>0){var g=s*v.FILTERING_FETCH_SIZE_MRC_TIMES;g>v.FILTERING_FETCH_SIZE_MAX?g=v.FILTERING_FETCH_SIZE_MAX:g<v.FILTERING_FETCH_SIZE_MIN&&(g=v.FILTERING_FETCH_SIZE_MAX),l.size=g}else l.size=s;return f?v.fetchTreeData(t,a,l,o,n,s):v.fetchFlatData(t,a,l,o,n,s)},rejectedError:{},fetchFromDataProvider:function(e,t,i,s){var o=e.ojContext;o._fetchResolveFunc||(o._fetchResolveFunc=v._addBusyState(e.container,"fetching data")),o._saveRejectFunc&&o._saveRejectFunc(v.rejectedError);var n=new Promise(function(e,t){o._saveRejectFunc=t});e.selection&&"init"===t.fetchType&&!o._spinnerContainer&&(o._spinnerContainer=e.selection,v.addLoadingIndicator(o._spinnerContainer),t.fetchType=null);var a=v._getMaxItems(t),l=s||t.fetchSize||a,r=v.fetchFilteredData(o,l,a,i,e.dropdown).then(function(e){return o._resultCount=e?e.length:0,e});Promise.race([n,r]).then(function(t){o._saveRejectFunc=null,o._spinnerContainer&&(v.removeLoadingIndicator(o._spinnerContainer),o._spinnerContainer=void 0),o._resolveSearchBoxLater&&e._showSearchBox(""),i.callback({results:t}),o._fetchResolveFunc&&(o._fetchResolveFunc(),o._fetchResolveFunc=null)},function(e){e!==v.rejectedError&&o._fetchResolveFunc&&(i.callback(),o._fetchResolveFunc(),o._fetchResolveFunc=null)})},fetchFirstBlockFromDataProvider:function(e,t,i){var s=v.getDataProvider(t),o=v._addBusyState(e,"fetching selected data"),n=v._getMaxItems(t),a={size:i||n};return v.isTreeDataProvider(s)?v.fetchTreeData({},s,a,null,null,n).then(function(e){if(1===i&&e&&e.length>0){for(var t=e[0];t.children;)t=t.children[0];e=[t]}return v._clearBusyState(o),e},function(){return v._clearBusyState(o),null}):s.fetchFirst(a)[Symbol.asyncIterator]().next().then(function(e){return v._clearBusyState(o),e.value.data},function(){return v._clearBusyState(o),null})},duringFetchByKey:function(e){return e._fetchByKeys},fetchByKeyFromDataProvider:function(t,i,s){var o,n=v.getDataProvider(i),a=t&&t.selection?t.container:t,l=v._addBusyState(a,"fetching selected data");t&&t.selection&&("init"!==t.opts.fetchType||a._spinnerContainer||(a._spinnerContainer=t.selection,v.addLoadingIndicator(a._spinnerContainer))),a._fetchByKeys&&a._fetchByKeys.promise&&e.Object.compareValues(s.value,a._fetchByKeys.key)?o=a._fetchByKeys.promise:(o=n.fetchByKeys({keys:s.value}),a._fetchByKeys={key:s.value,promise:o}),o.then(function(e){a._fetchByKeys=void 0,a._spinnerContainer&&(v.removeLoadingIndicator(a._spinnerContainer),a._spinnerContainer=void 0);var t=[];e.results.forEach(function(e){t.push(v.createItemResult(e.data,e.metadata))}),s.callback({results:t}),v._clearBusyState(l)},function(){a._fetchByKeys=void 0,s.callback(),v._clearBusyState(l)})},validateFromDataProvider:function(e,t,i){return new Promise(function(s,o){v.fetchByKeyFromDataProvider(e,t,{value:Array.isArray(i)?i:[i],callback:function(e){var t=null;if(e&&e.results.length){(t={}).value=[],t.valueOptions=[];for(var i=0;i<e.results.length;i++)t.valueOptions.push(e.results[i]),t.value.push(e.results[i].value)}s(t)}})})},isReadonly:function(e){return e._IsCustomElement()&&(e.options.readOnly||"loading"===e.options.loading)},_getMaxItems:function(e){var t;return void 0!==e.maximumResultCount&&null!==e.maximumResultCount?(t=e.maximumResultCount)<1&&(t=v.DEFAULT_FETCH_ALL_SIZE):t=v.DEFAULT_FETCH_SIZE,t},remote:function(e,i){return function(s){var o={component:this.ojContext};s.value?o.value=s.value:o.term=s.term||"",e(o).then(function(e){var o={results:[]};e&&v.each2(t(e),function(e,t){v._processData(s,t,o.results,i,!1)}),s.callback(o)})}},_processData:function(e,i,s,o,n,a){var l,r=i[0];if(!r.label&&o&&o.label&&(r.label=r[o.label]),!r.value&&o&&o.value&&(r.value=r[o.value]),!r.children&&o&&o.children&&(r.children=r[o.children],delete r[o.children]),r.children){l={};for(var h=Object.keys(r),c=0;c<h.length;c++){var u=h[c];l[u]=r[u]}l.children=[],v.each2(t(r.children),function(t,i){v._processData(e,i,l.children,o&&o.childKeys?o.childKeys:null,n,a)}),(!n||e.matcher(e.term,a(l),r)||l.children.length)&&s.push(l)}else n&&!e.matcher(e.term,a(r),r)||s.push(r)},checkFormatter:function(e,i,s){if(t.isFunction(i))return!0;if(!i)return!1;throw new Error(s+" must be a function or a false value")},clazz:function(i,s){var o=function(){};return e.Object.createSubclass(o,i,""),o.prototype=t.extend(o.prototype,s),o},LAST_QUERY_RESULT:"last-query-result",getLastQueryResult:function(e){return t.data(e.container,e._classNm+"-"+v.LAST_QUERY_RESULT)},saveLastQueryResult:function(e,i){t.data(e.container,e._classNm+"-"+v.LAST_QUERY_RESULT,i)},getSelectedOptionData:function(i,s){if(i.ojContext.multiple&&i.selection)for(var o,n,a=i.selection.find("."+i._classNm+"-selected-choice"),l=0;l<a.length;l++)if(o=a.get(l),n=t(o).data(i._elemNm),e.Object.compareValues(s,n.value))return n},getContextWithExtraData:function(e,i,s,o){return!(!!i&&v.isDataProvider(i.options))||null==s||Array.isArray(s)&&0===s.length?e:t.extend(e||{},{extraData:{data:s,metadata:o}})},getOpts:function(e){var t;return e&&(e.combobox&&e.combobox.opts?t=e.combobox.opts:e.select&&e.select.opts&&(t=e.select.opts)),t}},m={closeOnSelect:!0,openOnEnter:!0,formatNoMatches:function(e){return e.getTranslatedString("noMatchesFound")},formatMoreMatches:function(e,t){return 1===t?e.getTranslatedString("oneMatchesFound"):e.getTranslatedString("moreMatchesFound",{num:""+t})},id:function(e){return e.id},matcher:function(e,t){return(""+t).toUpperCase().indexOf((""+e).toUpperCase())>=0},separator:","},_=v.clazz(Object,{_bind:function(e){var t=this;return function(){return e.apply(t,arguments)}},_customOptionRenderer:function(e){var i,s=this;e.each(function(){(i=t(this)).is("oj-option")?i.wrap("<li></li>"):i.is("oj-optgroup")&&(i.wrap("<li></li>"),s._customOptionRenderer(i.children()),i.children().wrapAll("<ul class='oj-listbox-result-sub' role='group'></ul>"))})},_init:function(e){var i,s,o=this._classNm,n=this._elemNm;this.ojContext=e.ojContext;var a=this._prepareOpts(e);this.opts=a,this.id=a.id,this.headerInitialized=!1,this.isOjOption=this.ojContext._IsCustomElement()&&!a.options&&a.element.find("oj-option").length>0,void 0!==a.element.data(n)&&null!==a.element.data(n)&&a.element.data(n)._destroy(),this._prepareContainer(),this.body=v.thunk(function(){return a.element.closest("body")}),this.dropdown=this.container.find(".oj-listbox-drop"),this.dropdown.data("ojlistbox",this),this._setPickerAttributes(a.pickerAttributes);var l=this.containerId;this.dropdown.attr("data-oj-containerid",l),i=this.container.find(".oj-listbox-results"),this.results=i,this.results.on("click",v.killEvent);var r=this._getTransferredAttribute("aria-label");if(null!=r&&this.results.attr("aria-label",r),a.list&&t("#"+a.list).is("ul")){var h=t("#"+a.list);this.dropdownListParent=h.parent(),h.addClass("oj-listbox-results").attr("role","listbox"),this.results.replaceWith(h),i=this.container.find(".oj-listbox-results"),this.results=i,this.results.css("display","")}if(this.isOjOption){var c=a.element.children();this._customOptionRenderer(c),this.results.append(a.element.children()),this.datalist=this.results}s="oj-select"===o?this.container.find("input.oj-listbox-input"):this.container.find("input."+o+"-input"),this.search=s,this.queryCount=0,this.resultsPage=0,this.context=null,this._ariaDescribedByAdded=[],this._initContainer(),this.container.on("click",v.killEvent),v.installFilteredMouseMove(this.results),this.elementTabIndex&&("oj-select"===o?this.selection.attr("tabindex",this.elementTabIndex):this.search.attr("tabindex",this.elementTabIndex)),this._boundHighlightUnderEvent=this._bind(this._highlightUnderEvent),this.ojContext._IsCustomElement()?(this._delegatedDropdownTouchStartListener=function(e){var i=e.currentTarget,s=e.target.closest(".oj-listbox-results");s&&i.contains(s)&&this._boundHighlightUnderEvent(t.Event(e,{currentTarget:s}))}.bind(this),this.dropdown.on("mousemove-filtered touchmove touchend",".oj-listbox-results",this._boundHighlightUnderEvent),this.dropdown[0].addEventListener("touchstart",this._delegatedDropdownTouchStartListener,{passive:!0})):this.dropdown.on("mousemove-filtered touchstart touchmove touchend",".oj-listbox-results",this._boundHighlightUnderEvent),t(this.container).on("change","."+o+"-input",function(e){e.stopPropagation()}),t(this.dropdown).on("change","."+o+"-input",function(e){e.stopPropagation()});var u=this;if(v.installKeyUpChangeEvent(s),s.on("keyup-change input paste",this._bind(this._updateResults)),s.on("focus",function(){s.addClass(o+"-focused"),"oj-select"!==o&&u.container.addClass("oj-focus"),u.isSearchFocused=!0}),s.on("blur",function(){s.removeClass(o+"-focused"),"oj-select"!==o&&u.container.removeClass("oj-focus"),u.isSearchFocused=!1}),this.dropdown.on("mouseup",".oj-listbox-results",this._bind(function(e){t(e.target).closest(".oj-listbox-result-selectable").length>0&&(this._highlightUnderEvent(e),this._selectHighlighted(null,e))})),this.dropdown.on("click mouseup mousedown",function(e){e.stopPropagation()}),t.isFunction(this.opts.initSelection)){this.opts.fetchType="init";var d=this.getValOpts();(!this.ojContext.multiple||d&&0!==d.length)&&(this.ojContext.multiple||d)||(d=null),this._initSelection(d)}var p=a.element.prop("readonly");void 0===p&&(p=!1),this._readonly(p);var f=a.element.prop("disabled");if(void 0===f&&(f=!1),this._enable(!f),p){var m=this.container.find(".oj-combobox-input");this.ojContext._createOrUpdateReadonlyDiv(m[0])}v.scrollBarDimensions=v.scrollBarDimensions||v.measureScrollbar(),this.autofocus=a.element.prop("autofocus"),a.element.prop("autofocus",!1),this.autofocus&&this._focus(),v.addDataProviderEventListeners(a.ojContext),this.applyReadonlyState()},_CreateContentElements:function(){return null},_ConfigureSlots:function(){},_RestoreSlots:function(){},_createContainerForWidget:function(){var e=t(document.createElement("div")),i=this._CreateContentElements();return e.attr("class",this._COMPONENT_CLASSLIST),e.append(i),e},_prepareContainer:function(){var e,t,i,s,o;(e=this.ojContext._IsCustomElement()?this._prepareContainerForCustomElement():this._prepareContainerForWidget()).find(".oj-listbox-drop").css("display","none"),i="#"+(t=this._getOrCreateContainerId(e)).replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),o=this.opts.element.attr("tabindex"),s=this._elemNm,this.opts.element.data(s,this).attr("tabindex","-1"),e.data(s,this),this.container=e,this.containerId=t,this.containerSelector=i,this.elementTabIndex=o,this._ConfigureSlots()},_prepareContainerForCustomElement:function(){var e,i=this.ojContext.OuterWrapper,s=this._CreateContentElements(),o=this._COMPONENT_CLASSLIST;return(e=t(i)).addClass(o),e.prepend(s),e},_prepareContainerForWidget:function(){var e,t=this.opts.element,i=this._createContainerForWidget();return t.before(i),i.append(t),(e=this._getAttribute("style"))&&i.attr("style",e),i},_getOrCreateContainerId:function(e){var t;if(this.ojContext._IsCustomElement())(t=this._getAttribute("id"))||(t=this._classNm+"-"+v.nextUid(),e.attr("id",t));else{var i=this.opts.rootAttributes;t=i&&i.id?i.id:"ojChoiceId_"+(this._getAttribute("id")||this._classNm+v.nextUid()),e.attr("id",t)}return t},applyReadonlyState:function(){var t=this.ojContext._GetContentElement();if(v.isReadonly(this.ojContext)){if(this.container.addClass("oj-read-only"),"oj-combobox"===this._classNm)if(this.ojContext.multiple){if(t=null,this.search.removeAttr("tabindex"),this.selection.attr("tabindex",this.elementTabIndex||"0"),this.ojContext.options.labelledBy){var i=this.uuid+"_Label",s=e.EditableValueUtils._getOjLabelAriaLabelledBy(this.ojContext.options.labelledBy,i);s&&this.selection.attr("aria-labelledby",s)}}else t.attr("readonly",!0),this.ojContext._createOrUpdateReadonlyDiv(t[0]);else"oj-select"===this._classNm&&t.attr("aria-readonly","true");t&&(t.removeAttr("role"),t.removeAttr("aria-expanded"))}else this.container.removeClass("oj-read-only"),"oj-combobox"===this._classNm?this.ojContext.multiple?(t=null,null!=this.elementTabIndex&&this.search.attr("tabindex",this.elementTabIndex),this.selection.removeAttr("tabindex"),this.selection.removeAttr("aria-labelledby")):t.removeAttr("readonly",!0):"oj-select"===this._classNm&&t.removeAttr("aria-readonly"),t&&(t.attr("role","combobox"),t.attr("aria-expanded","false"));this._enableInterface()},updateAriaLabelIfNeeded:function(){if(this.ojContext._IsCustomElement()){var e=this._contentElement.attr("aria-label");e?this.results.attr("aria-label",e):this.results.removeAttr("aria-label")}},_clickAwayHandler:function(e){var i=this.dropdown;t(e.target).closest(i).length||t(e.target).closest("#"+t.escapeSelector(i.attr("data-oj-containerid"))).length||i.length>0&&i.data("ojlistbox").close(e)},_surrogateRemoveHandler:function(){this.dropdown&&this.dropdown.remove()},_destroy:function(){var e=this._closeDelayTimer;isNaN(e)||(delete this._closeDelayTimer,window.clearTimeout(e));var t=this.opts.element,i=t.data(this._elemNm);this.close(),this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.opts.list&&this.results?(this._cleanupList(this.results),this.dropdownListParent&&this.dropdownListParent.append(this.results)):this.isOjOption&&this.results&&(this._unwrapOjOptions(this.results),this.opts.element.append(this.results.children())),void 0!==i&&(this.ojContext._IsCustomElement()?this._cleanUpContainerForCustomElement():this._cleanUpContainerForWidget(),t.removeAttr("aria-hidden").removeData(this._elemNm).off("."+this._classNm).prop("autofocus",this.autofocus||!1),this.elementTabIndex?t.attr({tabindex:this.elementTabIndex}):t.removeAttr("tabindex"),t.show())},_cleanUpContainerForWidget:function(){var e=this.opts.element,t=e.data(this._elemNm);t.container.after(e),t.container.remove(),t.dropdown.remove()},_cleanUpContainerForCustomElement:function(){var e=this.opts.element,t=e.data(this._elemNm);t.dropdown[0].removeEventListener("touchstart",this._delegatedDropdownTouchStartListener,{passive:!0}),delete this._delegatedDropdownTouchStartListener,t.container.empty(),t.container.off("click"),t.container.append(e),this._RestoreSlots()},_unwrapOjOptions:function(e){var i,s=e.children(),o=this;s.each(function(){(i=t(this)).is("li")&&(i.hasClass("oj-listbox-result-with-children")||i.children("oj-optgroup").length>0?(i.hasClass("oj-listbox-result-with-children")&&i.children(".oj-listbox-result-label").remove(),o._unwrapOjOptions(i.find("oj-optgroup").children()),i.find("oj-optgroup").children().children().unwrap(),i.find("oj-optgroup").unwrap()):i.hasClass("oj-listbox-result")?i.find("oj-option").unwrap().unwrap():i.find("oj-option").unwrap())})},_cleanupList:function(e){if(e&&e.is("ul")){e.removeClass("oj-listbox-results oj-listbox-result-sub"),e.removeAttr("role");for(var i=e.children().length-1;i>=0;i--)this._cleanupList(t(e.children()[i]))}else if(e.is("li")){(e.hasClass("oj-listbox-placeholder")||e.hasClass("oj-listbox-no-results"))&&e.remove(),e.attr("class")&&e.attr("class",e.attr("class").replace(/oj-listbox-\S+/g,""));var s=e.children(".oj-listbox-result-label");s&&s.contents().unwrap(),"none"===e.css("display")&&e.css("display",""),this._cleanupList(e.children("ul"))}},_optionToData:function(e){if(e.is("option")||e.is("oj-option"))return{value:e.prop("value")||e.attr("value"),label:e.text().trim()||e.attr("label"),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:"locked"===e.attr("locked")||!0===e.data("locked")};if(e.is("optgroup")||e.is("oj-optgroup"))return{label:e.prop("label")||e.attr("label"),disabled:e.prop("disabled"),children:[],element:e.get(),css:e.attr("class")};if(e.is("li")){var t,i,s,o=null,n=e.children();if(n&&n.length>0&&n.is("ul"))t=e.attr("oj-data-label")?e.attr("oj-data-label"):e.clone().children().remove().end().text().trim(),i=e.attr("oj-data-value"),o=[];else if(n&&n.length>0&&n.is("oj-optgroup"))t=n.prop("label"),s=n.prop("disabled"),o=[];else{var a=e.find("oj-option");t=e.attr("oj-data-label")?e.attr("oj-data-label"):e.text().trim(),i=a.length>0?a.prop("value"):e.attr("oj-data-value"),s=a.length>0?a.prop("disabled"):void 0}return{value:i,label:t,disabled:s,element:e.get(),css:e.attr("class"),children:o}}},_prepareOpts:function(e){var i,s,o=e,n=this;o.options&&Array.isArray(o.options)&&o.optionsKeys&&(o.options=t.extend(!0,[],o.options));var a=(i=o.element).get(0).tagName.toLowerCase();if(o.ojContext._IsCustomElement()?!o.options&&o.element.children().length>0&&(s=t(i),this.datalist=s):"input"===a&&i.attr("list")?(s=t("#"+i.attr("list")),this.datalist=s):"select"===a&&i.children().length>0?(s=i,this.datalist=s):o.list&&(s=t("#"+o.list),this.datalist=s),(o=t.extend({},{populateResults:function(e,i,s,l){var r,h=this.opts.id,c=v.isTreeDataProvider(v.getDataProvider(this.opts)),u=this.opts.optionRenderer;if("function"!=typeof u&&(u=null),this.opts.ojContext._IsCustomElement()&&u){var d=u;u=function(e){var t=d(e);return!t||"OJ-OPTION"!==t.tagName&&"OJ-OPTGROUP"!==t.tagName?t&&t.insert?t.insert:null:(t.hasAttribute("data-oj-binding-provider")||t.setAttribute("data-oj-binding-provider","none"),t)}}(r=function(e,i,l,d,p){var f,m,_,b,g,y,j,x,C=function(e,i){if(i.children&&i.children.length>0){var s=i.element&&t(i.element[0]).is("li")&&t(i.element[0]).children("ul"),o=s?t(i.element[0]).children("ul"):t("<ul></ul>");o.hasClass("oj-listbox-result-sub")||o.addClass("oj-listbox-result-sub"),o.attr("role","group"),r(i,i.children,o,d+1,!1),s||e.append(o)}},O=function(e,i){e.length&&i&&i.length&&e.each(function(){!function e(i,s){var o=t(i).is("OJ-HIGHLIGHT-TEXT"),n=3===i.nodeType;if(o)i.setAttribute("match-text",s);else if(n){var a=i.data;if(""!==a.trim()){var l=document.createElement("oj-highlight-text");l.setAttribute("text",a),l.setAttribute("match-text",s),l.setAttribute("data-oj-internal",""),l.setAttribute("data-oj-binding-provider","none"),i.parentNode.replaceChild(l,i)}}else if(1===i.nodeType&&i.childNodes&&!/(script|style)/i.test(i.tagName))for(var r=0;r<i.childNodes.length;r++)e(i.childNodes[r],s)}(this,i.toUpperCase())})},S=function(e){if(o.highlightTermInOptions(s)){var t=e.find(".oj-listbox-highlighter-section");t.length||(t=e),O(t,s.term)}},E=function(t,i){var s;if(u){var n=v.isDataProvider(o.options)?i.data:i,a={index:f,depth:d,leaf:!i.children,parent:e,data:n,component:o.ojContext,parentElement:t.get(0)};o.ojContext._FixRendererContext&&(a=o.ojContext._FixRendererContext(a));var l=u.call(o.ojContext,a);null!==l&&(null===l.parentNode||l.parentNode instanceof DocumentFragment)&&(t.get(0).appendChild(l),s=l)}else void 0!==(x=o.formatResult(i))&&(t.text(x),t.attr("aria-label",x));return S(t),s},V=n._getPlaceholder();for(p&&null!==V&&!s.term&&l.find(".oj-listbox-placeholder").length<=0&&("select"!==a||!n.ojContext._IsRequired())&&(_={value:"",label:V},(y=t("<li></li>")).addClass("oj-listbox-placeholder oj-listbox-results-depth-0 oj-listbox-result oj-listbox-result-selectable"),y.attr("role","presentation"),(j=t(document.createElement("div"))).addClass("oj-listbox-result-label"),j.attr("id","oj-listbox-result-label-"+v.nextUid()),j.attr("role","option"),void 0!==(x=o.formatResult(_))&&j.text(x),j.attr("aria-label",x),y.append(j),y.data(n._elemNm,_),l.prepend(y)),f=0,m=i.length;f<m;f++){g=!0===(_=i[f]).disabled,b=c?!_._jetUnSelectable:!g&&null!=h(_)&&null==_.children;var I=_.element&&t(_.element[0]).is("li");if((y=t(I?_.element[0]:"<li></li>")).hasClass("oj-listbox-result"))_.children&&_.children.length>0&&C(y,_),S(t(_.element[0]).children("div")),t(_.element[0]).css("display","");else{y.addClass("oj-listbox-results-depth-"+d),y.addClass("oj-listbox-result"),y.addClass(b?"oj-listbox-result-selectable":"oj-listbox-result-unselectable"),g&&y.addClass("oj-disabled"),_.children&&y.addClass("oj-listbox-result-with-children"),y.attr("role","presentation");var A="oj-listbox-result-label-"+v.nextUid();if((j=t(document.createElement("div"))).addClass("oj-listbox-result-label"),j.attr("id",A),j.attr("role","option"),g&&j.attr("aria-disabled","true"),e&&e.ariaLabelledById?_.ariaLabelledById=e.ariaLabelledById+" "+A:_.ariaLabelledById=A,!I){var P=E(j,_);if(y.append(j),P&&("OJ-OPTION"===P.tagName||"OJ-OPTGROUP"===P.tagName)&&(P.getAttribute("disabled")&&(y.removeClass("oj-listbox-result-selectable"),y.addClass("oj-listbox-result-unselectable oj-disabled"),j.attr("aria-disabled","true")),"OJ-OPTGROUP"===P.tagName&&P.hasAttribute("label"))){var w=P.getAttribute("label"),N=document.createTextNode(w);P.insertBefore(N,P.firstChild)}}if(_.children&&_.children.length>0&&C(y,_),y.data(n._elemNm,_),I){var T=t(_.element[0]);if(T.children("oj-optgroup").length>0){var D=T.children("oj-optgroup").prop("label")+"";T.prepend(j.text(D))}else T.children("oj-option").length>0?T.contents().wrapAll(j):T.contents().filter(function(){return"UL"!==this.tagName}).wrapAll(j);S(T.children("div")),T.css("display","")}else l.append(y)}}})(null,i,e,0,l)},highlightTermInOptions:function(e){return!(!0===e.initial)}},m,o)).id=function(e){return e.value},o.formatResult=function(e){var t=v.getLabel(e);return isNaN(t)?t:this.ojContext._formatValue(t)},o.formatSelection=function(e){var t=v.getLabel(e);if(null!=e&&null!=t)return isNaN(t)?t:this.ojContext._formatValue(t)},"select"!==a&&null!==o.manageNewEntry&&(o.manageNewEntry=function(e){var i={};return i.label=t.trim(e),i.value=i.label,i}),this.datalist)o.query=this._bind(function(e){var t,i,s={results:[],more:!1},o=e.term;i=function(t,s){var a,l,r=t.children()&&t.children().length>0&&(t.children().is("ul")||t.children().is("oj-optgroup"));t.is("option")||t.is("oj-option")||t.is("li")&&!r?e.matcher(o,t.text()||t.attr("label"),t)&&s.push(n._optionToData(t)):(t.is("optgroup")||t.is("oj-optgroup")||t.is("li")&&r)&&(a=n._optionToData(t),t.is("optgroup")||t.is("oj-optgroup")?l=t.children():t.children("oj-optgroup")?l=t.children().children("ul").children():t.children("ul").children(),v.each2(l,function(e,t){i(t,a.children)}),a.children.length>0&&s.push(a))},t=this.datalist.children(),void 0!==this._getPlaceholder()&&t.length>0&&""===t.first().attr("value")&&(t=t.slice(1)),v.each2(t,function(e,t){i(t,s.results)}),e.callback(s)});else if("options"in o){var l=o.options;v.getDataProvider(o)?o.query=function(e){e.value?v.fetchByKeyFromDataProvider(n,o,e):v.fetchFromDataProvider(n,o,e)}:t.isFunction(l)?o.query=v.remote(l,o.optionsKeys?o.optionsKeys:null):o.query=v.local(l,o.optionsKeys?o.optionsKeys:null)}return o},_createHeader:function(){var e=this.opts.element.find(".oj-listbox-header");if(e.length){this.header=t("<li>",{class:"oj-listbox-result-header oj-listbox-result-unselectable",role:"presentation"}),this.header.append(e.children()),this._initializeHeaderItems();var i=t("<ul>",{class:"oj-listbox-results-with-header",role:"listbox"});i.append(this.header),i.appendTo(this.results.parent());var s=t("<li>",{role:"presentation"});i.append(s),this.results.attr("role","presentation"),this.results.appendTo(s)}this.headerInitialized=!0},_initializeHeaderItems:function(){this.headerItems=this.header.find("li[role='option'], li:not([role])"),this.headerItems.uniqueId(),this.header.find("ul").attr("role","presentation"),this.header.find("li:not([role])").attr("role","option");this.header.find("a, input, select, textarea, button, object, .oj-component-initnode").each(function(){t(this).attr("tabIndex",-1)})},_isHeaderItem:function(e){var i=!1;return this.headerItems.each(function(){return t(this).attr("id")!==e||(i=!0,!1)}),i},_getNextHeaderItem:function(e){if(!this.headerItems)return null;if(!e)return this.headerItems.first();var i=!1,s=null;return this.headerItems.each(function(){return i?(s=t(this),!1):(i=t(this).attr("id")===e,!0)}),s},_getPreviousHeaderItem:function(e){if(!this.headerItems)return null;var i=null;return this.headerItems.each(function(){return t(this).attr("id")!==e&&(i=t(this),!0)}),i},_setFocusOnHeaderItem:function(e){var t=e.find(".oj-component .oj-enabled").first();if(0===t.length){0===(t=e.find("a, input, select, textarea, button, object, .oj-component-initnode").first()).length&&(t=e.children().first())}t&&t.addClass("oj-focus oj-focus-highlight oj-focus-only")},_removeHighlightFromHeaderItems:function(){this.headerItems&&this.headerItems.find(".oj-focus").removeClass("oj-focus oj-focus-highlight oj-focus-only")},_triggerSelect:function(e){var i=t.Event(this._elemNm+"-selecting",{val:this.id(e),object:e});return this.opts.element.trigger(i),!i.isDefaultPrevented()},_isInterfaceEnabled:function(){return!0===this.enabledInterface},_enableInterface:function(){var e=this._enabled&&!(v.isReadonly(this.ojContext)||this._readonly);return e!==this.enabledInterface&&(v.isReadonly(this.ojContext)||this.container.toggleClass("oj-disabled",!e),this.close(),this.enabledInterface=e,!0)},_enable:function(e){var t=e;void 0===t&&(t=!0),this._enabled!==t&&(this._enabled=t,this.opts.element.prop("disabled",!(t||v.isReadonly(this.ojContext))),this.container.toggleClass("oj-enabled",t),this._enableInterface())},_disable:function(){this._enable(!1)},_readonly:function(e){var t=e;return void 0===t&&(t=!1),this._readonly!==t&&(this._readonly=t,this.opts.element.prop("readonly",t),this._enableInterface(),!0)},_opened:function(){return this.container.hasClass("oj-listbox-dropdown-open")},_getDropdownPositionElement:function(){return this.container[0].querySelector(".oj-text-field-container")},_usingHandler:function(i,s){if(e.PositionUtils.isAligningPositionClipped(s)){var o=v._addBusyState(this.container,"closing popup");this._closeDelayTimer=window.setTimeout(function(){t.proxy(this.close,this),o()},1)}else{var n=this.container,a=s.element.element;a.css(i),"bottom"===s.vertical?(n.addClass("oj-listbox-drop-above"),a.addClass("oj-listbox-drop-above")):(n.removeClass("oj-listbox-drop-above"),a.removeClass("oj-listbox-drop-above"))}},_getDropdownPosition:function(){var i={my:"start top",at:"start bottom",of:this._getDropdownPositionElement(),collision:"flip",using:t.proxy(this._usingHandler,this)},s="rtl"===e.DomUtils.getReadingDirection();return e.PositionUtils.normalizeHorizontalAlignment(i,s)},_positionDropdown:function(){var e=this.dropdown,t=this._getDropdownPosition(),i=this.container;e.css("width",i.outerWidth()),e.position(t)},_shouldOpen:function(e){if(this._opened())return!1;if(!1===this._enabled||v.isReadonly(this.ojContext)||!0===this._readonly)return!1;var t={component:this.opts.element};return this.ojContext._trigger("beforeExpand",e,t)},_clearDropdownAlignmentPreference:function(){this.container.removeClass("oj-listbox-drop-above"),this.dropdown.removeClass("oj-listbox-drop-above")},open:function(e,t){return!!this._shouldOpen(e)&&(this._opening(e,t),!0)},_opening:function(){this.headerInitialized||this._createHeader(),this.container.addClass("oj-listbox-dropdown-open")},_showDropDown:function(){if(this._opened()&&"true"!==this._getActiveContainer().attr("aria-expanded")){this._clearDropdownAlignmentPreference();var i=this.dropdown.parent();if("oj-select"===this._classNm&&!0!==this.opts.multiple&&i&&i.hasClass("oj-listbox-drop-layer"))e.PopupService.getInstance().triggerOnDescendents(i,e.PopupService.EVENT.POPUP_REFRESH);else{this.dropdown[0]!==this.body().children().last()[0]&&this.dropdown.detach().appendTo(this.body()),this.dropdown.appendTo(this.body()),this.header&&(this.dropdown.find(".oj-listbox-results-with-header").prepend(this.header),this.header.show());var s={};s[e.PopupService.EVENT.POPUP_CLOSE]=t.proxy(this.close,this),s[e.PopupService.EVENT.POPUP_REMOVE]=t.proxy(this._surrogateRemoveHandler,this),s[e.PopupService.EVENT.POPUP_AUTODISMISS]=t.proxy(this._clickAwayHandler,this),s[e.PopupService.EVENT.POPUP_REFRESH]=t.proxy(this._positionDropdown,this);var o={};o[e.PopupService.OPTION.POPUP]=this.dropdown,o[e.PopupService.OPTION.LAUNCHER]=this.opts.element,o[e.PopupService.OPTION.EVENTS]=s,o[e.PopupService.OPTION.POSITION]=this._getDropdownPosition(),o[e.PopupService.OPTION.LAYER_SELECTORS]="oj-listbox-drop-layer",o[e.PopupService.OPTION.CUSTOM_ELEMENT]=this.ojContext._IsCustomElement(),e.PopupService.getInstance().open(o),t("#oj-listbox-drop").removeAttr("id"),this.dropdown.attr("id","oj-listbox-drop");var n=this.containerId;this.dropdown.attr("data-oj-containerid",n)}this._positionDropdown(),this._getActiveContainer().attr("aria-expanded",!0)}},close:function(i,s){if(this.shouldReopenOnNewData=!0===s,this._opened()){this.container.removeClass("oj-listbox-dropdown-open");var o=this._getActiveContainer().attr("aria-expanded");if(delete this.ojContext._resolveSearchBoxLater,o&&"false"!==o){var n=this.containerId,a="scroll."+n,l="resize."+n,r="orientationchange."+n;this.container.parents().add(window).each(function(){t(this).off(a).off(l).off(r)}),this._clearDropdownAlignmentPreference();var h={};h[e.PopupService.OPTION.POPUP]=this.dropdown,e.PopupService.getInstance().close(h),this.header&&(this.header.hide(),this.header.appendTo(this.container)),this.dropdown.removeAttr("data-oj-containerid"),this.dropdown.removeAttr("id"),this.opts.list||this.isOjOption?this._removeHighlight():(this.dropdown.detach(),this.results.empty()),this.dropdown.appendTo(this.container),this._getActiveContainer().attr("aria-expanded",!1),"ojcombobox"===this._elemNm&&this._getActiveContainer().removeAttr("aria-activedescendant"),t.removeData(this.container,this._classNm+"-last-term")}}},_setPickerAttributes:function(t){e.EditableValueUtils.setPickerAttributes(this.dropdown,t)},_clearSearch:function(){},_ensureHighlightVisible:function(){var e,i,s,o,n,a,l=this.results,r=this._highlight();r<0||(e=this._findHighlightableChoices(),s=(i=t(e[r])).offset().top+i.outerHeight(!0),r===e.length-1&&(a=l.find("li.oj-listbox-more-results")).length>0&&(s=a.offset().top+a.outerHeight(!0)),s>(o=l.offset().top+l.outerHeight(!0))&&l.scrollTop(l.scrollTop()+(s-o)),(n=i.offset().top-l.offset().top)<0&&"none"!==i.css("display")&&l.scrollTop(l.scrollTop()+n))},_findHighlightableChoices:function(){return this.results.find(".oj-listbox-result-selectable:not(.oj-disabled, .oj-selected)").filter(function(){return"none"!==t(this).css("display")})},_moveHighlight:function(e){var i=this._findHighlightableChoices(),s=this._highlight();if(this.header&&(s<=0||s===i.length-1)){var o=this._getActiveContainer().attr("aria-activedescendant"),n=this._isHeaderItem(o);n||(o=null);var a=null;if(e>0&&(s<0||s===i.length-1)?a=this._getNextHeaderItem(o):e<0&&(n&&s<0||0===s)&&(a=this._getPreviousHeaderItem(o)),a)return this._removeHighlight(),this._setFocusOnHeaderItem(a),void this._getActiveContainer().attr("aria-activedescendant",a.attr("id"));n&&e<0&&(s=0)}for(;s>=-1&&s<i.length;){(s+=e)===i.length?s=0:-1===s&&(s=i.length-1);var l=t(i[s]);if(l.hasClass("oj-listbox-result-selectable")&&!l.hasClass("oj-disabled")&&!l.hasClass("oj-selected")){this._highlight(s);break}}},_highlight:function(e){var i,s=e,o=this._findHighlightableChoices();if(0===arguments.length){var n=o.filter(".oj-hover");return n.length||(n=o.children(".oj-hover").closest(".oj-listbox-result")),this._updateMatchesCount(n.text()),o.get().indexOf(n[0])}if(s>=o.length&&(s=o.length-1),s<0&&(s=0),this._removeHighlight(),(i=t(o[s])).hasClass("oj-listbox-result-with-children")){var a=i.children(".oj-listbox-result-label");a.addClass("oj-hover"),this._updateMatchesCount(a.text())}else i.addClass("oj-hover"),this._updateMatchesCount(i.text());return this._getActiveContainer().attr("aria-activedescendant",i.find(".oj-listbox-result-label").attr("id")),this._ensureHighlightVisible(),0},_removeHighlight:function(){this.results.find(".oj-hover").removeClass("oj-hover"),this._removeHighlightFromHeaderItems(),"ojcombobox"===this._elemNm&&this._getActiveContainer().removeAttr("aria-activedescendant")},_highlightUnderEvent:function(e){var i=t(e.target).closest(".oj-listbox-result-selectable");if(i.length>0&&!i.is(".oj-hover")){var s=this._findHighlightableChoices();this._highlight(s.index(i))}else 0===i.length&&this._removeHighlight()},_updateMatchesCount:function(e){if(!this.dropdown.find(".oj-listbox-filter-message-text").length){var t=this.container.find(".oj-listbox-liveregion");t.length&&t.text(e)}},_updateResults:function(e,i){var s=this.search,o=this,n=s.val(),l=t.data(this.container,this._classNm+"-last-term");if((!0===e||!l||n!==l||!0===this.opts.multiple||i)&&(l||n||!e||"input"!==e.type)){t.data(this.container,this._classNm+"-last-term",n);var r=this.opts.minLength||0;n.length>=r?(this._queryTimer&&this._queryTimer.clear(),e&&!0!==e?(this._queryResolveBusyState=v._addBusyState(this.container,"query results"),this._queryTimer=a.getTimer(v.DEFAULT_QUERY_DELAY),this._queryTimer.getPromise().then(function(t){t&&o._queryResults(e)}).then(this._queryResolveBusyState)):this._queryResults(e)):this.close()}},_queryResults:function(e){var t,i,s=this.search,o=this.results,n=this.opts,a=this,l=s.val();function r(){if(a._positionDropdown(),a.header&&a.headerItems.length){var e=a._findHighlightableChoices(),t=a.headerItems.length+e.length;if(a.headerItems.attr("aria-setsize",t),e.length){var i=e.children("[role='option']");i.attr("aria-setsize",t),i.first().attr("aria-posinset",a.headerItems.length+1)}}}(n.minLength||0)>l.length?this.close():(this.open(null,!0),this.queryCount+=1,i=this.queryCount,this._removeHighlight(),l=null!=(t=this.search.val())&&(!0!==e||n.inputSearch||"rawValue"===n.filterOnOpen||n.minLength>0)?t:"",this.resultsPage=1,n.query({element:n.element,term:l,page:this.resultsPage,context:null,matcher:n.matcher,callback:this._bind(function(t){if(i===this.queryCount&&this._opened())if(n.ojContext._hasMore||v.removeDropdownMessage(a.dropdown),this.context=t&&void 0!==t.context?t.context:null,(!t||t.results&&0===t.results.length||this._isDataSelected(t)&&this.ojContext.isValid())&&v.checkFormatter(a.ojContext,n.formatNoMatches,"formatNoMatches")){var l=n.formatNoMatches(a.ojContext,s.val());if("oj-select"===this._classNm||this.header){if(this._showDropDown(),this._preprocessResults(o),r(),v.addDropdownMessage(a.dropdown,a.ojContext,l),!this._hasSearchBox()){var h=a.dropdown.find(".oj-listbox-filter-message-separator");h.length&&h.css("display","none")}}else this.close(null,!0);this._updateMatchesCount(l)}else v.saveLastQueryResult(this,t.results),this._showDropDown(),this._preprocessResults(o),a.opts.populateResults.call(this,o,t.results,{term:s.val(),page:this.resultsPage,context:null,initial:e},this._showPlaceholder()),this._postprocessResults(t,e),r(),this._updateMatchesCount(n.formatMoreMatches(a.ojContext,this._findHighlightableChoices().length))})}))},_preprocessResults:function(e){if(this.opts.list||this.isOjOption){var t=e.children();this._hideResultList(t)}else e.empty()},_processAriaLabelForHierarchy:function(){var e=this.results.find(".oj-listbox-result-with-children");if(0!==e.length){var i=this,s=function(e){var t=e.find(".oj-listbox-result-label"),s=e.data(i._elemNm).ariaLabelledById;s&&t&&t.attr("aria-labelledby",s)};v.each2(e,function(e,i){var o=i.find(".oj-listbox-result-selectable:visible");o&&o.length>0&&(s(t(o[0])),o.length>1&&s(t(o[o.length-1])))})}},_normalizeHighlighterLabel:function(e){var t;if((t=e.children("div").children("oj-option").length>0?e.children("div").children("oj-option").find("oj-highlight-text"):e.children("div").children("oj-highlight-text")).length>0)for(var i=0;i<t.length;i++){var s=t[i],o=s.getAttribute("text")||"",n=document.createTextNode(o);s.parentElement.replaceChild(n,s)}},_hideResultList:function(e){for(var i=0;i<e.length;i++){var s,o=t(e[i]);o.is("LI")&&((o.hasClass("oj-listbox-no-results")||o.hasClass("oj-listbox-placeholder"))&&o.remove(),o.css("display","none"),o.hasClass("oj-selected")&&o.removeClass("oj-selected"),this._normalizeHighlighterLabel(o)),(s=o.children("oj-optgroup")?o.children("oj-optgroup").children("ul"):o.children("ul"))&&s.children()&&this._hideResultList(s.children())}},_cancel:function(e){this.close(e)},_focusSearch:function(){v._focus(this,this.search)},_selectHighlighted:function(e,i){var s=e;if(this.header){var o=this._getActiveContainer().attr("aria-activedescendant");if(this._isHeaderItem(o)){var n=t("#"+o),a=n.find("a, input, select, textarea, button, object").first();return 0===a.length&&(a=n.children()),a.length&&a[0].click(),void this.close(i)}}var l=this._highlight(),r=this.results.find(".oj-hover").closest(".oj-listbox-result").data(this._elemNm);if(r){this._highlight(l);var h=this.getVal();(s=s||{}).trigger=v.ValueChangeTriggerTypes.OPTION_SELECTED;var c=this._onSelect(r,s,i);c instanceof Promise?c.then(this._bind(function(e){e&&(this._triggerUpdateEvent(r,s,i),this._triggerValueUpdatedEvent(r,h))})):!1!==c&&(this._triggerUpdateEvent(r,s,i),this._triggerValueUpdatedEvent(r,h)),i&&"keydown"===i.type&&(this.enterKeyEventHandled=!0)}},_getPlaceholder:function(){return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder},_setPlaceholder:function(){var e=this._getPlaceholder();if(this.ojContext.multiple&&"oj-select"===this._classNm){var t=this.selection.find(".oj-select-default");t.length>0?t.text(e):this._clearSearch()}else e?this.search.attr("placeholder",e):this.search.removeAttr("placeholder")},_initContainerWidth:function(){var e=function(){var e,t,i,s,o;if(null!=(e=this._getAttribute("style")))for(s=0,o=(t=e.split(";")).length;s<o;s++)if(null!==(i=t[s].replace(/\s/g,"").match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i))&&i.length>=1)return i[1];return null}.call(this);null!==e&&this.container.css("width",e)},valHasChanged:function(){var e=this.container;if(v.duringFetchByKey(e)){v.setValueChanged(this.ojContext,!0);var t=this.selection;t._saveLoadingIndicator&&!this.ojContext.multiple&&v.removeLoadingIndicator(t)}},getVal:function(){return this.ojContext.option("value")},getRawValue:function(){return this.ojContext.option("rawValue")},setVal:function(t,i,s){this.valHasChanged();var o={doValueChangeCheck:!1};s&&(o._context=s);var n=this.ojContext.multiple;if(!this._skipSetValueOptions)if(v.isValueForPlaceholder(n,t)&&null!==this._getPlaceholder())this.setValOpts(v.getFixupValueOptionsForPlaceholder(n));else{var a,l=v.getLastQueryResult(this);l&&(a=n?v.findOptions(l,t):v.findOption(l,t)),a?this.setValOpts(a):"oj-combobox"===this._classNm?this.ojContext._resolveValueOptionsLater=null!=v.findOption(this.getValOpts(),t):this.ojContext._resolveValueOptionsLater=!0}var r=this.getVal(),h=null;return Array.isArray(t)||this.ojContext._IsCustomElement()?!e.Object.compareValues(r,t)||v.hasInvalidComponentMessages(this.ojContext)?h=this.ojContext._SetValue(t,i,o):"oj-combobox"!==this._classNm||n||this.ojContext._SetDisplayValue(t):!e.Object.compareValues(r,[t])||v.hasInvalidComponentMessages(this.ojContext)?h=this.ojContext._SetValue([t],i,o):"oj-combobox"!==this._classNm||n||this.ojContext._SetDisplayValue([t]),h},getValOpts:function(){var e=this.ojContext;return e.multiple?e.option("valueOptions"):e.option("valueOption")},setValOpts:function(t){var i=this.ojContext,s=i.multiple,o=v.getFixupValueOptionsForPlaceholder(s),n=s?i.options.valueOptions:i.options.valueOption;v.isValueOptionsForPlaceholder(s,t)&&v.isValueOptionsForPlaceholder(s,n)&&v.isPlaceholderSpecified(i.options)?s?i.options.valueOptions=o:i.options.valueOption=o:e.Object.compareValues(t,this.getValOpts())||v.setValueOptions(i,t),s?this.opts.valueOptions=t:this.opts.valueOption=t},_triggerUpdateEvent:function(e,t,i){},_triggerValueUpdatedEvent:function(e,t){},_showPlaceholder:function(){return!1},_getActiveContainer:function(){return this.search},_getAttribute:function(e){return this.opts.ojContext._IsCustomElement()?this.opts.ojContext.OuterWrapper.getAttribute(e):this.opts.element.attr(e)},_getTransferredAttribute:function(e){return this.opts.element.attr(e)},_showSearchBox:function(e){var i=!1,s=this.dropdown.find(".oj-listbox-search");if(s&&(this._hasSearchBox()?(this.dropdown.find(".oj-listbox-search-wrapper").removeClass("oj-helper-hidden-accessible"),t(s).removeAttr("aria-hidden"),this.search.val(e),i=!0):(this.dropdown.find(".oj-listbox-search-wrapper").addClass("oj-helper-hidden-accessible"),t(s).attr("aria-hidden","true"))),v._focus(this,i?this.search:this.selection),i){var o=this;s.find(".oj-listbox-spyglass-box").on("mouseup click",function(e){o.search.focus(),e.preventDefault()})}},_hasSearchBox:function(){if(this._userTyping)return!0;var e,i=this.opts.minimumResultsForSearch;return this.opts.list?e=t("#"+this.opts.list).find("li").length:v.isDataProvider(this.opts.options)?void 0===this.ojContext._resultCount?(e=i+1,this.ojContext._resolveSearchBoxLater=!0):(e=this.ojContext._resultCount,delete this.ojContext._resolveSearchBoxLater):this.datalist?e=this.ojContext._IsCustomElement()?this.datalist.children().find("oj-option").length:this.datalist[0].length:this.opts.options&&(e=this.opts.options.length),e>i},_isDataSelected:function(e){return!1},_findItem:function(e,i){for(var s=0;s<e.length;s++)if(t(e[s]).data(this._elemNm).value===i)return e[s];return null}}),b=v.clazz(_,{_enableInterface:function(){b.superclass._enableInterface.apply(this,arguments)&&this.search.prop("disabled",!(this._isInterfaceEnabled()||v.isReadonly(this.ojContext)))},_focus:function(){this.close()},_destroy:function(){t("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),b.superclass._destroy.apply(this,arguments)},_clear:function(e){if(this.selection.data(this._elemNm)){e||r.warn("Event should not be null when user modified the value in UI");var t=this.ojContext._IsCustomElement()?"":[];"oj-select"===this._classNm&&this.ojContext._IsRequired()||this.setVal(t,e),this.search.val(""),this.selection.removeData(this._elemNm)}this._setPlaceholder()},_initSelection:function(){if(!v.applyValueOptions(this,this.opts)){var e=this.datalist?this.datalist:this.opts.element;this.opts.initSelection.call(null,e,this._bind(this._updateSelectedOption))}},_containerKeydownHandler:function(e){if(this._isInterfaceEnabled())if(e.which!==v.KEY.PAGE_UP&&e.which!==v.KEY.PAGE_DOWN){switch(e.which){case v.KEY.UP:case v.KEY.DOWN:return this._opened()?this._moveHighlight(e.which===v.KEY.UP?-1:1):this.open(e),void e.preventDefault();case v.KEY.ENTER:return this._opened()&&e.stopPropagation(),this._selectHighlighted(null,e),e.preventDefault(),void(this._opened()||(this._userTyping=!1));case v.KEY.TAB:return this.close(e),void(this._userTyping=!1);case v.KEY.ESC:return this._opened()&&e.preventDefault(),this._cancel(e),void(this._userTyping=!1)}this._userTyping=!0}else e.preventDefault()},_containerKeyupHandler:function(e){this._isInterfaceEnabled()&&(this._opened()||this.open(e))},_initContainer:function(){var e=this.container,i=this.opts.rootAttributes,s=i&&i.id?i.id:this._getAttribute("id")||v.nextUid(),o=this._getTransferredAttribute("aria-label"),n=this._getTransferredAttribute("aria-controls"),a=e.find("."+this._classNm+"-choice");this.selection=a,this._contentElement="ojcombobox"===this._elemNm?this.search:this.selection,a.attr("id",this._classNm+"-choice-"+s),a.find("."+this._classNm+"-input").attr("id",this._classNm+"-input-"+s),this.results.attr("id")||this.results.attr("id","oj-listbox-results-"+s);var l=e.find(".oj-listbox-liveregion");if(l.length&&l.attr("id","oj-listbox-live-"+s),"oj-select"!==this._classNm&&this.search.attr("aria-owns",this.results.attr("id")),!this.ojContext._IsCustomElement()){var r=t("label[for='"+this._getAttribute("id")+"']");r.attr("id")||r.attr("id",this._classNm+"-label-"+s),this.search.attr("aria-labelledby",r.attr("id")),this.opts.element.attr("aria-labelledby",r.attr("id")),this.search.attr("id")&&r.attr("for",this.search.attr("id"))}o&&this.search.attr("aria-label",o),n&&this.search.attr("aria-controls",n),a.on("keydown",this._bind(this._containerKeydownHandler)),a.on("mousedown",this._bind(function(e){if(!("end"===e.target.getAttribute("slot")||t(this._endSlot).find(e.target).length>0)&&this._isInterfaceEnabled()){this.opts.element.prop("disabled")&&v.killEvent(e),a.removeClass("oj-focus-highlight"),this._opened()?this.close(e):this._isInterfaceEnabled()&&this.open(e);var i=this.search.parent().attr("aria-hidden");i&&"true"===i?this.selection.focus():this.search.focus(),t(e.target).hasClass("oj-combobox-open-icon")&&v.killEvent(e),this.container.addClass("oj-active")}})),a.on("mouseup",this._bind(function(){this.container.removeClass("oj-active")})),a.on("focus",this._bind(function(e){v.killEvent(e)})),this.search.on("compositionstart",this._bind(function(){this.ojContext._isComposing=!0})),this.search.on("compositionend",this._bind(function(e){this.ojContext._isComposing=!1,this._onSearchInputHandler(e)})),this.search.on("input",this._bind(function(e){this.ojContext._isComposing||this._onSearchInputHandler(e)})),this.search.on("focus",this._bind(function(){this._previousDisplayValue=this.search.val()})),this.search.on("blur keyup",this._bind(function(e){if("keyup"!==e.type||10===e.keyCode||13===e.keyCode){if(void 0!==this.search.val()&&this.results.find(".oj-hover").length<=0&&("keyup"!==e.type||!this.enterKeyEventHandled))if(this.opts.manageNewEntry){var t=this.search.val(),i=this.opts.manageNewEntry(t),s={trigger:"blur"===e.type?v.ValueChangeTriggerTypes.BLUR:v.ValueChangeTriggerTypes.ENTER_PRESSED},o=this.selection.data(this._elemNm),n=this.getVal();if(!o&&""!==t||o&&o.label!==t||!this.ojContext.isValid()&&t!==this._previousDisplayValue){var a=this._onSelect(i,s,e);"blur"!==e.type&&(a instanceof Promise?a.then(this._bind(function(t){t&&(this._triggerUpdateEvent(i,s,e),this._triggerValueUpdatedEvent(i,n))})):!1!==a&&(this._triggerUpdateEvent(i,s,e),this._triggerValueUpdatedEvent(i,n)))}else"keyup"===e.type&&(o&&o.label===t&&(i=o),this.close(e),this._triggerUpdateEvent(i,s,e),this._triggerValueUpdatedEvent(i,n))}else if(null==this.opts.manageNewEntry){var l=this.selection.data(this._elemNm);if(""===this.search.val())"oj-select"!==this._classNm&&this._clear(e);else if(l||""===this.search.val()){if("oj-select"!==this._classNm){var r=this.opts.formatSelection(l);void 0!==r&&this.search.val(r)}}else this._clearSearch()}"blur"===e.type&&(this.search.removeClass(this._classNm+"-focused"),this.container.removeClass("oj-focus")),this.enterKeyEventHandled=!1}})),this._initContainerWidth(),this.opts.element.hide().attr("aria-hidden",!0),this._setPlaceholder()},_onSearchInputHandler:function(e){"oj-combobox"===this._classNm&&(this.hasUncommittedValue=!0),this.ojContext._SetRawValue(this.search.val(),e)},_prepareOpts:function(){var i=b.superclass._prepareOpts.apply(this,arguments),s=this,o=i.element.get(0).tagName.toLowerCase();if("input"===o&&i.element.attr("list")||"select"===o&&i.element.children().length>0||i.ojContext._IsCustomElement()&&!i.options||i.list){var n=i.list?"li":"option";i.ojContext._IsCustomElement()&&(n="oj-option"),i.initSelection=function(a,l){var r,h=s.getVal();Array.isArray(h)&&!i.ojContext._IsCustomElement()&&(h=h[0]),null!=h&&(r=s._optionToData(a.find(n).filter(function(){var t;return"li"===n?t=this.getAttribute("oj-data-value"):"option"!==n&&"oj-option"!==n||(t=this.value),e.Object.compareValues(t,h)})),"select"===o&&void 0===r&&(h=null)),null==h&&(r=s._optionToData(a.find(n).filter(function(){return"li"===n?!0===this.getAttribute("oj-data-selected"):"option"===n&&this.selected})),"oj-select"===s._classNm&&void 0===r&&i.ojContext._IsCustomElement()&&(r=s._optionToData(t(a.find(n)[0])),e.Logger.info("Select identified by "+s.container.attr("id")+" defaults to first option because the value is not set."))),l(r)},i.validate=function(t,i){var o;return null!=i&&(o=s._optionToData(t.find(n).filter(function(){var t;return"li"===n?t=this.getAttribute("oj-data-value"):"option"!==n&&"oj-option"!==n||(t=this.value),e.Object.compareValues(t,i)}))),!!o}}else("options"in i||this.getVal()&&this.getVal().length>0)&&(v.isDataProvider(i.options)||t.isFunction(i.options)?i.initSelection=function(n,a){var l=function t(s,o){for(var n=0,a=s.length;n<a;n++){var l=s[n];if(e.Object.compareValues(o,i.id(l)))return l;if(l.children){var r=t(l.children,o);if(r)return r}}return null},r=s._getValueItem(),h=null;if(null!=r){var c=v.getLastQueryResult(s);if(c&&(h=l(c,r)),!h){var u=s.currentItem;u&&u.length&&e.Object.compareValues(r,i.id(u[0]))&&(h=u[0],e.Logger.info("Select identified by "+s.container.attr("id")+" defaults to first option due to invalid value."))}h||s.valueChangeTrigger?a(h):i.query({value:[r],callback:t.isFunction(a)?function(t){(!v.isDataProvider(i.options)||e.Object.compareValues(r,s.getVal())&&!v.isValueChanged(s.ojContext))&&(t&&t.results&&(h=l(t.results,r)),a(h),v.setValueChanged(s.ojContext,void 0))}:t.noop})}else{var d=s.ojContext.options.optionsKeys;"select"!==o||s.ojContext._HasPlaceholderSet()||d&&(d.value||d.label)?a(h):v.fetchFirstBlockFromDataProvider(s.container,i,1).then(function(t){t&&t.length>0&&(a(t[0]),e.Logger.info("Select identified by "+s.container.attr("id")+" defaults to first option because the value is not set."))})}}:(i.initSelection=function(n,a){var l=s._getValueItem(),r="select"===o&&s.ojContext._HasPlaceholderSet()&&!s.ojContext._IsRequired(),h=r?s._getPlaceholder():null,c=null;i.query({matcher:function(t,s,o){var n=e.Object.compareValues(l,i.id(o));return n&&(c=o),null==h&&(h=o),n},callback:t.isFunction(a)?function(){c||"select"!==o||s.ojContext._isOptionDataPending()||(c=h,e.Logger.info("Select identified by "+s.container.attr("id")+" defaults to "+(r?"placeholder":"first option")+" due to invalid value.")),a(c)}:t.noop})},i.validate=function(s,o){var n=o,a=null;return i.query({matcher:function(t,s,o){var l=e.Object.compareValues(n,i.id(o));return l&&(a=o),l},callback:t.noop}),!!a}));return i},_postprocessResults:function(t,i,s){var o,n=-1,a=this;o=this._findHighlightableChoices(),v.each2(o,function(t,i){var s=a._getValueItem();return null==s||!e.Object.compareValues(s,a.id(i.data(a._elemNm)))||(n=t,!1)}),!1!==s&&!0===i&&n>=0&&this._highlight(n),this._processAriaLabelForHierarchy()},_onSelect:function(e,t,i){if(!this._triggerSelect(e))return!1;var s,o,n=v.getOpts(this.ojContext);t&&t.trigger&&(s={optionMetadata:{trigger:t.trigger}}),s=v.getContextWithExtraData(s,n,e.data,e.metadata),this.close(i);var a=e,l=this.hasUncommittedValue,r=null,h=null;if(0===this.id(e).length?(o=this.ojContext._IsCustomElement()?v.getValueForPlaceholder(!1):[],a=v.getFixupValueOptionsForPlaceholder(!1)):o=this.id(e),"oj-combobox"!==this._classNm&&"oj-select"!==this._classNm||(this._skipSetValueOptions=!0,this.setValOpts(v.findOptionFromResult(this,o,a))),this.hasUncommittedValue=!1,(r=this.setVal(o,i,s))instanceof Promise)h=r.then(this._bind(function(e){return this._onSelectAfterSetVal(e,l),e}));else{var c=!1!==r;this._onSelectAfterSetVal(c,l),h=r}return"blur"!==i.type&&this._focusSearch(),h},_onSelectAfterSetVal:function(e,t){!1===e&&(this.hasUncommittedValue=t),this._skipSetValueOptions=!1},_clearSearch:function(){this.search.val("")},_getValueItem:function(){var e=null,t=this.getVal();return null!=t&&(e=!this.ojContext._IsCustomElement()&&t.length?t[0]:t),e},_getSelectionData:function(){return this.selection.data(this._elemNm)},_GetContentWrapper:function(){return this.container[0].querySelector(".oj-text-field-middle")}}),g=v.clazz(b,{_elemNm:"ojcombobox",_classNm:"oj-combobox",_COMPONENT_CLASSLIST:"oj-combobox oj-component",_CreateContentElements:function(){return t(["<div class='oj-text-field-container' role='presentation'>","  <div class='oj-combobox-choice' tabindex='-1' role='presentation'>","   <div class='oj-text-field-middle'>","     <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off'","       spellcheck='false' class='oj-combobox-input' role='combobox' aria-expanded='false' aria-autocomplete='list' />","   </div>","   <abbr class='oj-combobox-clear-entry' role='presentation'></abbr>","   <span class='oj-combobox-divider' role='presentation'></span>","   <a class='oj-combobox-arrow oj-combobox-icon oj-component-icon oj-clickable-icon-nocontext oj-combobox-open-icon'","       role='button' aria-label='expand'></a>","  </div>","</div>","<div class='oj-listbox-drop' role='presentation'>","   <ul class='oj-listbox-results' role='listbox'>","   </ul>","</div>","<div class='oj-helper-hidden-accessible oj-listbox-liveregion' aria-live='polite'></div>"].join(""))},_ConfigureSlots:function(){if(null!=this.container&&this.ojContext._IsCustomElement()){var t=this.container,i=e.BaseCustomElementBridge.getSlotMap(t[0]).end;i&&(t.find(".oj-combobox-divider").remove(),t.find(".oj-combobox-arrow").remove(),t.find(".oj-combobox-choice").append(i),this._endSlot=i)}},_RestoreSlots:function(){var e=this._endSlot;null!=e&&null!=this.container&&this.ojContext._IsCustomElement()&&this.container.append(e),this._endSlot=null},_triggerValueUpdatedEvent:function(e,t){if(this.ojContext._IsCustomElement()){var i=this.id(e);if(null==i&&(i=e.label?e.label:""),this.ojContext.isValid()){var s={},o=this.ojContext.OuterWrapper;s.value=i,s.previousValue=t;var n=new CustomEvent("ojValueUpdated",{detail:s});o.dispatchEvent(n)}}},_enable:function(e){g.superclass._enable.apply(this,arguments),this._enabled?this.container.find(".oj-combobox-arrow").removeClass("oj-disabled"):this.container.find(".oj-combobox-arrow").addClass("oj-disabled")},_opening:function(e,t){g.superclass._opening.apply(this,arguments),this._focusSearch(),t||this._updateResults(!0)},_containerKeydownHandler:function(e){"end"===e.target.getAttribute("slot")||t(this._endSlot).find(e.target).length>0||v.KEY.isControl(e)||v.KEY.isFunctionKey(e)||g.superclass._containerKeydownHandler.apply(this,arguments)},_updateSelection:function(e){var t,i,s=[];if(this.selection.data(this._elemNm,e),null!==e&&0!==e.length?(void 0!==(t=this.opts.formatSelection(e))&&this.search.val()!==t&&this.search.val(t),this.search.removeClass(this._classNm+"-default"),s.push(e),i=t):(this.search.val(""),this._setPlaceholder(),i=""),this.ojContext.options.readOnly){var o=this.ojContext._getReadonlyDiv();o&&(o.textContent=i)}this.currentItem=s},_updateSelectedOption:function(e){if(null!=e)this._updateSelection(e),this.setValOpts(e);else{var t,i=this.getVal();t=null==i?null:Array.isArray(i)?i.length?{label:i[0]}:null:{label:i},this._updateSelection(t),!e&&i?this.setValOpts({value:i,label:v.getLabel({value:i})}):this.setValOpts(e)}}}),y=v.clazz(b,{_elemNm:"ojselect",_classNm:"oj-select",_userTyping:!1,_COMPONENT_CLASSLIST:"oj-select oj-component",_CreateContentElements:function(){return t(["<div class='oj-text-field-container' role='presentation'>","  <div class='oj-select-choice' tabindex='0' role='combobox' ","     aria-autocomplete='none' aria-expanded='false'>","   <div class='oj-text-field-middle'>","      <span class='oj-select-chosen'></span>","   </div>","    <abbr class='oj-select-search-choice-close' role='presentation'></abbr>","    <a class='oj-select-arrow oj-component-icon oj-clickable-icon-nocontext oj-select-open-icon' role='presentation'>","    </a>","  </div>","</div>","<div class='oj-listbox-drop' role='dialog'>","  <div class='oj-listbox-search-wrapper'>","  <div class='oj-listbox-search'>","    <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off'","           spellcheck='false' class='oj-listbox-input' title='Search field' ","           role='combobox' aria-expanded='false' aria-autocomplete='list' />","    <span class='oj-listbox-spyglass-box'>","      <span class='oj-component-icon oj-listbox-search-icon' role='presentation'>","       <b role='presentation'></b></span>","    </span>","  </div>","  </div>","   <ul class='oj-listbox-results' role='listbox'>","   </ul>","</div>","<div class='oj-helper-hidden-accessible oj-listbox-liveregion' aria-live='polite'></div>"].join(""))},_enable:function(e){if(y.superclass._enable.apply(this,arguments),this._enabled){var t=this.elementTabIndex?this.elementTabIndex:"0";this.selection.attr("tabindex",t),this.container.find(".oj-select-arrow").removeClass("oj-disabled")}else this.selection.attr("tabindex","-1"),this.container.find(".oj-select-arrow").addClass("oj-disabled")},close:function(e){if(this._opened()){var t=e?e.originalEvent:null,i=t instanceof MouseEvent||t instanceof FocusEvent,s=e&&(!i||e.target===this.selection||e.target===this.search||this.dropdown.has(e.target).length>0);y.superclass.close.apply(this,arguments),this.selection.attr("aria-expanded",!1).removeAttr("aria-haspopup").removeAttr("aria-owns"),this.search.attr("aria-expanded",!1).removeAttr("aria-controls"),this._testClear(e)||this._clearSearch(),this.ojContext.hasAfterToggleHandlerAddedFocusClass&&!s&&(this.ojContext._getRootElement().classList.remove("oj-focus"),this.ojContext.hasAfterToggleHandlerAddedFocusClass=!1),s&&v._focus(this,this.selection),this.container.find(".oj-listbox-spyglass-box").off("mouseup click")}},_opening:function(e,t){y.superclass._opening.apply(this,arguments),this._showDropDown();var i=v.getSearchText(e);this._showSearchBox(i),t||(i?this._updateResults():this._updateResults(!0))},_showDropDown:function(){if(this._opened()){var e="true"!==this.selection.attr("aria-expanded");y.superclass._showDropDown.apply(this,arguments),e&&(this.selection.attr("aria-expanded",!0).attr("aria-haspopup","dialog").attr("aria-owns",this.results.attr("id")),this.search.attr("aria-expanded",!0).attr("aria-controls",this.results.attr("id")+" "+this.container.find(".oj-listbox-liveregion").attr("id")))}},_initContainer:function(){var e=this.containerId+"_selected";this.text=this.container.find(".oj-select-chosen").attr("id",e),y.superclass._initContainer.apply(this,arguments),this.selection.attr({"aria-labelledby":this.search.attr("aria-labelledby"),"aria-describedby":e});var t=this._getTransferredAttribute("aria-label");t&&this.selection.attr("aria-label",t),this.search.on("keydown",this._bind(this._containerKeydownHandler)),this.search.on("keyup-change input",this._bind(this._containerKeyupHandler)),this.search.attr("title",this.ojContext.getTranslatedString("searchField"));var i=this;this.selection.on("blur",function(e){i._testClear(e)})},_initSelection:function(){this._isPlaceholderOptionSelected()?(this._updateSelection(null),this.close(),this._setPlaceholder()):y.superclass._initSelection.apply(this,arguments)},_updateSelectedOption:function(t){if(null!=t){var i,s=this.getVal();Array.isArray(s)&&!this.ojContext._IsCustomElement()&&(s=s[0]),void 0===(i=this.opts.id(t))&&(i=null),e.Object.compareValues(s,i)||this.ojContext._setInitialSelectedValue(i),this.setValOpts(t),this._updateSelection(t),this.close()}else this.setValOpts(null)},_updateSelection:function(e){this.selection.data(this._elemNm,e),null!==e&&this.text.text("string"==typeof e?e:v.getLabel(e)),e&&""!==e.id&&this.text.removeClass(this._classNm+"-default")},_getActiveContainer:function(){return this.search.attr("aria-expanded")&&this._hasSearchBox()?this.search:this.selection},_isPlaceholderOptionSelected:function(){if(null===this._getPlaceholder())return!1;var e=this.getVal();return e=Array.isArray(e)?e[0]:e,v.isValueForPlaceholder(!1,e)},_getPlaceholder:function(){return this.opts.placeholder},_showPlaceholder:function(){return this.opts.placeholder=this.ojContext.options.placeholder,!0},_setPlaceholder:function(){var e=this._getPlaceholder();this._isPlaceholderOptionSelected()&&void 0!==e&&this.text.text(e).addClass(this._classNm+"-default")},setVal:function(e,t,i){var s=y.superclass.setVal.call(this,e,t,i);return s instanceof Promise?s.then(this._bind(function(t){!1!==t&&this.selection.data("selectVal",e)})):(!1!==s&&this.selection.data("selectVal",e),s)},_containerKeydownHandler:function(e){if(!(v.KEY.isControl(e)&&e.which!==v.KEY.SHIFT||e.which===v.KEY.SHIFT||v.KEY.isFunctionKey(e))){switch(e.which){case v.KEY.TAB:return this.close(e),this.selection.focus(),void this._testClear(e);case v.KEY.ENTER:if(e.target===this.selection[0]&&!this._opened())return this.open(e),void e.preventDefault()}if(y.superclass._containerKeydownHandler.apply(this,arguments),this._userTyping&&(this.open(e),this._opened())){var i=this.dropdown.find(".oj-listbox-search");if("true"===t(i).attr("aria-hidden")){var s=v.getSearchText(e);s&&(this._showSearchBox(s),this._updateResults())}}}},_testClear:function(e){return""===this.text.text()&&(!(this.datalist&&this.selection.data(this._elemNm)&&this.selection.data(this._elemNm).value||!v.isValueForPlaceholder(!1,this.ojContext.options.value))&&(this._clear(e),!0))}}),j=v.clazz(_,{_prepareOpts:function(){var i=j.superclass._prepareOpts.apply(this,arguments),s=this,o=i.element.get(0).tagName.toLowerCase();if("input"===o&&i.element.attr("list")||"select"===o&&i.element.children().length>0||i.ojContext._IsCustomElement()&&!i.options||i.list){var n=i.list?"li":"option";i.ojContext._IsCustomElement()&&(n="oj-option"),i.initSelection=function(t,i){var a,l=[];if(s.getVal())for(var r=s.getVal(),h=0;h<r.length;h++){var c=r[h];(a=t.find(n).filter(function(){var t;return"li"===n?t=this.getAttribute("oj-data-value"):"option"!==n&&"oj-option"!==n||(t=this.value),e.Object.compareValues(t,c)}))&&a.length?l.push(s._optionToData(a)):"ojcombobox"===s._elemNm&&l.push({value:c,label:c})}else"select"!==o&&(a=t.find(n).filter(function(){return"option"===n?this.selected:"li"===n?!0===this.getAttribute("oj-data-selected"):"oj-option"===n&&!0===this.getAttribute("selected")}),v.each2(a,function(e,t){l.push(s._optionToData(t))}));i(l)}}else"options"in i&&(v.isDataProvider(i.options)||t.isFunction(i.options)?i.initSelection=function(o,n){var a=function e(s,o){for(var n=[],a=0,l=s.length;a<l;a++){var r=s[a];if(o.indexOf(i.id(r))>=0&&n.push(r),r.children){var h=e(r.children,o);h&&h.length&&t.merge(n,h)}}return n},l=s.getVal(),r=[],h=v.getLastQueryResult(s);h&&(r=a(h,l));var c=function(){for(var t=[],o=0;o<l.length;o++){for(var a=l[o],h=!1,c=0;c<r.length;c++){var u=r[c];if(e.Object.compareValues(a,i.id(u))){t.push(u),r.splice(c,1),h=!0;break}}if(!h){var d=s.currentItem;if(d&&d.length)for(var p=0;p<d.length;p++)if(e.Object.compareValues(a,i.id(d[p]))){t.push(d[p]),h=!0;break}h||"ojcombobox"!==s._elemNm||t.push({value:a,label:a})}}n(t)};s.valueChangeTrigger?c():i.query({value:l,callback:function(o){if(o&&o.results){var n=a(o.results,l);if(n&&n.length){var h=n;if(v.isDataProvider(i.options)){h=[];var u=s.getVal();if(e.Object.compareValues(l,u)&&!v.isValueChanged(s.ojContext))h=n;else{var d,p,f=s.getValOpts();u.forEach(function(t){for(p=!1,d=0;d<f.length;d++)if(e.Object.compareValues(f[d].value,t)){p=!0,h.push(f[d]);break}if(!p)for(d=0;d<n.length;d++)if(e.Object.compareValues(n[d].value,t)){h.push({value:n[d].value,label:n[d].label});break}}),l=u,v.setValueOptions(s.ojContext,h)}}t.merge(r,h)}}v.setValueChanged(s.ojContext,void 0),c()}})}:i.initSelection=function(o,n){var a=s.getVal();if(a&&0!==a.length){var l=[];i.query({matcher:function(s,o,n){var r=t.grep(a,function(t){return e.Object.compareValues(t,i.id(n))}).length;return r&&l.push(n),r},callback:t.isFunction(n)?function(){for(var t=[],o=0;o<a.length;o++){for(var r=a[o],h=!1,c=0;c<l.length;c++){var u=l[c];if(e.Object.compareValues(r,i.id(u))){t.push(u),l.splice(c,1),h=!0;break}}h||"ojcombobox"!==s._elemNm||t.push({value:r,label:r})}n(t)}:t.noop})}});return i},_selectChoice:function(e){var t=this.container.find("."+this._classNm+"-selected-choice.oj-focus"),i=t&&t.length>0,s=e&&e.length>0;(!i&&s||i&&!s||i&&s&&e[0]!==t[0])&&(i&&(this.opts.element.trigger("choice-deselected",t),t.removeClass("oj-focus")),s&&(this.close(),e.addClass("oj-focus"),this.container.find("."+this._classNm+"-description").text(e.attr("valueText")+". Press back space to delete.").attr("aria-live","assertive"),this.opts.element.trigger("choice-selected",e)))},_destroy:function(){t("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.ojContext._IsCustomElement()&&(this.container[0].removeEventListener("touchstart",this._delegatedContainerTouchStartListener,{passive:!1}),delete this._delegatedContainerTouchStartListener,this.container.off("click touchstart")),j.superclass._destroy.apply(this,arguments)},_initContainer:function(){var e,i="."+this._classNm+"-choices",s=v.nextUid(),o=this._getTransferredAttribute("aria-label"),n=this._getTransferredAttribute("aria-controls");this.searchContainer=this.container.find("."+this._classNm+"-search-field");var a=this.container.find(i);this.selection=a;var l=this;this.selection.on("click","."+this._classNm+"-selected-choice:not(."+this._classNm+"-locked)",function(){"ojcombobox"===l._elemNm&&l.search[0].focus(),l._selectChoice(t(this))}),"ojselect"===this._elemNm&&this.selection.on("blur",function(){l._selectChoice(null)}),this._contentElement="ojcombobox"===this._elemNm?this.search:this.selection,a.find("."+this._classNm+"-input").attr("id",this._classNm+"-input-"+s),this.results.attr("id")||this.results.attr("id","oj-listbox-results-"+s),this._contentElement.attr("aria-owns",this.results.attr("id")),this.ojContext._IsCustomElement()||((e=t("label[for='"+this._getAttribute("id")+"']")).attr("id")||e.attr("id",this._classNm+"-label-"+s),this._contentElement.attr("aria-labelledby",e.attr("id")),this.opts.element.attr("aria-labelledby",e.attr("id")),this.search.attr("id")&&e.attr("for",this.search.attr("id"))),o&&this._contentElement.attr("aria-label",o),n&&this._contentElement.attr("aria-controls",n),this.elementTabIndex&&this._contentElement.attr("tabindex",this.elementTabIndex),this.keydowns=0,"ojselect"===this._elemNm&&(this.selection.on("keydown",this._bind(this._containerKeydownHandler)),this.selection.on("keyup",this._bind(function(){this.keydowns=0}))),this.search.on("keydown",this._bind(this._containerKeydownHandler)),this.search.on("keyup",this._bind(function(){this.keydowns=0})),this.search.on("compositionstart",this._bind(function(){this.ojContext._isComposing=!0})),this.search.on("compositionend",this._bind(function(e){this.ojContext._isComposing=!1,this._onSearchInputHandler(e)})),this.search.on("input",this._bind(function(e){this.ojContext._isComposing||this._onSearchInputHandler(e)})),this.search.on("blur keyup",this._bind(function(e){if("keyup"!==e.type||10===e.keyCode||13===e.keyCode){if(this.opts.manageNewEntry&&this.search.val()&&this.results.find(".oj-hover").length<=0){var t=this.opts.manageNewEntry(this.search.val()),i={trigger:"blur"===e.type?v.ValueChangeTriggerTypes.BLUR:v.ValueChangeTriggerTypes.ENTER_PRESSED},s=this._onSelect(t,i,e);s instanceof Promise?s.then(this._bind(this._clearSearchOnBlur)):this._clearSearchOnBlur()}this._selectChoice(null),"blur"===e.type&&(this.isSearchFocused=!1,this.search.removeClass(this._classNm+"-focused"),this.container.removeClass("oj-focus")),e.stopImmediatePropagation()}})),this._containerClickAndTouchStartListener=this._bind(function(e){this._isInterfaceEnabled()&&(t(e.target).closest("."+this._classNm+"-selected-choice").length>0||(this._selectChoice(null),this._opened()?this.close(e):(this.open(e),("ojcombobox"===this._elemNm||this._hasSearchBox())&&this._focusSearch()),e.preventDefault()))}),this.ojContext._IsCustomElement()?(this._delegatedContainerTouchStartListener=function(e){var s=e.currentTarget,o=e.target.closest(i);o&&s.contains(o)&&this._containerClickAndTouchStartListener(t.Event(e,{currentTarget:o}))}.bind(this),this.container.on("click",i,this._containerClickAndTouchStartListener),this.container[0].addEventListener("touchstart",this._delegatedContainerTouchStartListener,{passive:!1})):this.container.on("click touchstart",i,this._containerClickAndTouchStartListener),this._initContainerWidth(),this.opts.element.hide().attr("aria-hidden",!0),this._clearSearch()},_onSearchInputHandler:function(e){var t=(this.getValOpts()||[]).slice(0),i=this.search.val(),s=t.map(function(e){return e.label});""!==i&&s.push(i),"oj-combobox"===this._classNm&&(this.hasUncommittedValue=!0),this.ojContext._SetRawValue(s,e)},_containerKeydownHandler:function(e){if(this._isInterfaceEnabled()){this.keydowns+=1;var t=this.selection.find("."+this._classNm+"-selected-choice.oj-focus"),i=t.prev("."+this._classNm+"-selected-choice:not(."+this._classNm+"-locked)"),s=t.next("."+this._classNm+"-selected-choice:not(."+this._classNm+"-locked)"),o="ojselect"!==this._elemNm||this._userTyping?v.getCursorInfo(this.search):v.getCursorInfo(this.selection);if(t.length&&(e.which===v.KEY.LEFT||e.which===v.KEY.RIGHT||e.which===v.KEY.BACKSPACE||e.which===v.KEY.DELETE||e.which===v.KEY.ENTER)){var n=t;return e.which===v.KEY.LEFT&&i.length?n=i:e.which===v.KEY.RIGHT?n=s.length?s:null:e.which===v.KEY.BACKSPACE?(this._unselect(t.first(),e),this._resetSearchWidth(),n=i.length?i:s):e.which===v.KEY.DELETE?(this._unselect(t.first(),e),this._resetSearchWidth(),n=s.length?s:null):e.which===v.KEY.ENTER&&(n=null),this._selectChoice(n),e.preventDefault(),void(n&&n.length||this.open(e))}if(this._isBackNavAllowed()&&0===o.offset&&!o.length&&(e.which===v.KEY.BACKSPACE&&1===this.keydowns||e.which===v.KEY.LEFT))return this._selectChoice(this.selection.find("."+this._classNm+"-selected-choice:not(."+this._classNm+"-locked)").last()),void e.preventDefault();if(this._selectChoice(null),!v.KEY.isControl(e)&&!v.KEY.isFunctionKey(e)){switch(e.which){case v.KEY.UP:case v.KEY.DOWN:return this._opened()?this._moveHighlight(e.which===v.KEY.UP?-1:1):this.open(e),void e.preventDefault();case v.KEY.PAGE_UP:case v.KEY.PAGE_DOWN:return void e.preventDefault();case v.KEY.ENTER:return this._opened()&&(this._selectHighlighted(null,e),e.stopPropagation()),void e.preventDefault();case v.KEY.TAB:return void this.close(e);case v.KEY.ESC:return this._cancel(e),void e.preventDefault()}this._opened()&&!1===this._userTyping&&(this._userTyping=!0,this.close()),this._userTyping=!0}}},_isBackNavAllowed:function(){return"ojselect"!==this._elemNm||document.activeElement!==this.search[0]},_enableInterface:function(){j.superclass._enableInterface.apply(this,arguments)&&this.search.prop("disabled",!(this._isInterfaceEnabled()||v.isReadonly(this.ojContext)))},_initSelection:function(e){var t=this.getVal();if(null!==t&&0!==t.length||"oj-select"!==this._classNm&&""!==this.opts.element.text().trim()||(this._updateSelection(e||[]),this.close(),this._clearSearch()),this.datalist||null!==this.getVal()&&this.getVal().length){var i,s=this;i=this.datalist?this.datalist:this.opts.element,v.applyValueOptions(this,this.opts)||this.opts.initSelection.call(null,i,function(e){null!=e&&0!==e.length&&(s._updateSelection(e),s.close(),s._clearSearch())})}},_focus:function(){this.close(),this.search.focus()},_updateSelection:function(e){var i=[],s=[],o=this;t(e).each(function(){i.indexOf(o.id(this))<0&&(i.push(o.id(this)),s.push(this))}),s&&s.length>0&&("oj-combobox"===this._classNm||"oj-select"===this._classNm)&&("init"!==this.opts.fetchType&&this._skipSetValueOptions?v.isDataProvider(this.opts.options)&&(s=v.findOptions(this.opts.valueOptions,i)):this.setValOpts(s)),this.selection.find("."+this._classNm+"-selected-choice").remove(),this.selection.find(".oj-select-default").remove(),this._updateAriaDescribedBy(null,!0),t(s).each(function(){o._addSelectedChoice(this)}),this.currentItem=s,this.currentValue=i,o._postprocessResults()},_updateAriaDescribedBy:function(e,t){var i=this._contentElement,s=this.selection,o=i.attr("aria-describedby")||"",n=!1,a=o;t&&(this._ariaDescribedByAdded.forEach(function(e){a=a.replace(e,""),n=!0}),a=a.trim().replace(/\s\s+/g," "),this._ariaDescribedByAdded=[]),e&&(a=(a+" "+e).trim(),this._ariaDescribedByAdded.push(e),n=!0),n&&(i.attr("aria-describedby",a),"oj-combobox"===this._classNm&&s.attr("aria-describedby",a))},_onSelect:function(e,i,s){if(!this._triggerSelect(e))return!1;var o;i&&i.trigger&&(o={optionMetadata:{trigger:i.trigger}});var n=this.getVal()?this.getVal().slice(0):[],a=this.getValOpts()?this.getValOpts().slice(0):[],l=a.slice(0),r="oj-combobox"===this._classNm||"oj-select"===this._classNm;this.ojContext.isValid()||(n=this.currentValue.slice(0),l=this.currentItem.slice(0));var h,c,u=this,d=[],p=[],f=v.getOpts(this.ojContext),m=!!f&&v.isDataProvider(f.options),_=null,b=null,g=this.hasUncommittedValue;if(m)for(var y=0;y<l.length;y++)c=l[y],h=this.id(c),l[y]=v.findOptionFromResult(u,h,c),d.push(l[y].data),p.push(l[y].metadata);if(h=this.id(e),t(e).each(function(t){n.indexOf(h)<0&&""!==h&&(n.push(h),r&&(c=Array.isArray(e)?v.findOptionFromResult(u,h,e[t]):v.findOptionFromResult(u,h,e),l.push(c),m&&(d.push(c.data),p.push(c.metadata))))}),r&&(this._skipSetValueOptions=!0,this.setValOpts(l)),o=v.getContextWithExtraData(o,f,d,p),this.hasUncommittedValue=!1,(_=this.setVal(n,s,o))instanceof Promise)b=_.then(this._bind(function(t){return this._afterOnSelectSetVal(t,e,a,g),t}));else{var j=!1!==_;this._afterOnSelectSetVal(j,e,a,g),b=_}return this.opts.closeOnSelect&&this.close(s),i&&i.trigger===v.ValueChangeTriggerTypes.BLUR||"ojcombobox"!==this._elemNm||this._focusSearch(),b},_afterOnSelectSetVal:function(e,t,i,s){var o="oj-combobox"===this._classNm||"oj-select"===this._classNm;!1===e&&(this.hasUncommittedValue=s,o&&!this.ojContext.isValid()&&this.setValOpts(i)),this._skipSetValueOptions=!1,!this.select&&this.opts.closeOnSelect||this._postprocessResults(t,!1,!0===this.opts.closeOnSelect),this.opts.closeOnSelect&&this.ojContext.isValid()&&this._resetSearchWidth()},_cancel:function(e){this.close(e),"ojcombobox"===this._elemNm&&this._focusSearch()},_addSelectedChoice:function(e){var i,s=!e.locked,o=t("<li class='"+this._classNm+"-selected-choice'>    <div></div>    <a href='#' onclick='return false;' role='button' aria-label='remove' class='"+this._classNm+"-clear-entry       oj-component-icon oj-clickable-icon-nocontext "+this._classNm+"-clear-entry-icon' tabindex='-1'>    </a></li>"),n=t("<li class='"+this._classNm+"-selected-choice "+this._classNm+"-locked'><div></div></li>"),a=s?o:n;if(void 0!==(i=this.opts.formatSelection(e))){var l=this._classNm+"-selected-choice-label-"+v.nextUid();a.find("div").addClass(this._classNm+"-selected-choice-label").text(i).attr("id",l),a.find("."+this._classNm+"-clear-entry").attr("aria-label",i+" remove"),a.attr("valueText",i),this._updateAriaDescribedBy(l,!1)}s&&a.find("."+this._classNm+"-clear-entry").on("mousedown",v.killEvent).on("click dblclick",this._bind(function(e){this._isInterfaceEnabled()&&(t(e.target).closest("."+this._classNm+"-selected-choice").fadeOut("fast",this._bind(function(){this._unselect(t(e.target),e),this.selection.find("."+this._classNm+"-selected-choice.oj-focus").removeClass("oj-focus"),this.close(e),"ojcombobox"===this._elemNm&&this._focusSearch()})).dequeue(),v.killEvent(e),e.stopPropagation())})),a.data(this._elemNm,e),"ojcombobox"===this._elemNm?a.insertBefore(this.searchContainer):this.selection.append(a)},_syncValueOptions:function(t,i,s){var o,n=[],a=[],l=[],r=v.getOpts(this.ojContext),h=!!r&&v.isDataProvider(r.options);if(i&&s){for(var c=0;c<i.length;c++)for(var u=0;u<s.length;u++){var d=s[u];e.Object.compareValues(d.value,i[c])&&(h&&(o=this.id(d),d=v.findOptionFromResult(this,o,d),a.push(d.data),l.push(d.metadata)),n.push(d))}v.setValueOptions(t,n),this.currentItem=n}return v.getContextWithExtraData(null,r,a,l)},_unselect:function(e,t){var i=this.getVal()?this.getVal().slice(0):[],s=e.closest("."+this._classNm+"-selected-choice");if(0===s.length)throw new Error("Invalid argument: "+s+". Must be ."+this._classNm+"-selected-choice");var o=s.data(this._elemNm);if(o){var n,a,l;this.ojContext.isValid()?n=(this.getValOpts()||[]).slice(0):(i=this.currentValue.slice(0),n=this.currentItem.slice(0));var r=i.indexOf(this.id(o));-1!==r&&(i.splice(r,1),a=this._syncValueOptions(this.ojContext,i,n),this._skipSetValueOptions=!0,(l=this.setVal(i,t,a))instanceof Promise?l.then(this._bind(function(e){this._afterUnselectSetValue(e,s)})):this._afterUnselectSetValue(l,s))}},_afterUnselectSetValue:function(e,t){this._skipSetValueOptions=!1,!1!==e&&this.select&&this._postprocessResults(),t.remove()},_postprocessResults:function(e,t,i){if(this.ojContext.isValid()){var s=this.getVal(),o=this.results.find(".oj-listbox-result"),n=this.results.find(".oj-listbox-result-with-children"),a=this;v.each2(o,function(e,t){var i=a.id(t.data(a._elemNm));s&&s.indexOf(i)>=0&&(t.addClass("oj-selected"),t.find(".oj-listbox-result-selectable").addClass("oj-selected"))}),v.each2(n,function(e,t){t.is(".oj-listbox-result-selectable")||0!==t.find(".oj-listbox-result-selectable:not(.oj-selected)").length||t.addClass("oj-selected")}),this._processAriaLabelForHierarchy(),!o.filter(".oj-listbox-result:not(.oj-selected)").length>0&&"oj-select"!==this._classNm&&this.close(null,!0)}},_isDataSelected:function(e){var t=this.getVal();if(!t||0===t.length)return!1;for(var i=e.results,s=0;s<i.length;s++)if(-1===t.indexOf(this.id(i[s])))return!1;return!0},_resetSearchWidth:function(){},setVal:function(t,i,s){var o=[],n=t;this.valHasChanged(),"string"==typeof t&&(n=v.splitVal(t,this.opts.separator));for(var a=0;a<n.length;a++)o.indexOf(n[a])<0&&o.push(n[a]);var l={doValueChangeCheck:!1};if(s&&(l._context=s),!this._skipSetValueOptions){var r,h=v.getLastQueryResult(this);h&&(r=v.findOptions(h,n)),r&&r.length&&v.setValueOptions(this.ojContext,r)}var c=this.getVal(),u=null;return e.Object.compareValues(c,o)&&!v.hasInvalidComponentMessages(this.ojContext)||(u=this.ojContext._SetValue(o,i,l)),u instanceof Promise?u.then(this._bind(function(e){this._afterSetValue(o)})):(this._afterSetValue(o),u)},_afterSetValue:function(e){(this.ojContext.isValid()||0===e.length)&&(this.currentValue=e),this.search.attr("aria-activedescendant",this.opts.element.attr("id"))},_getSelectionData:function(){var e=null,i=this,s=null,o=this.container.find("."+this._classNm+"-selected-choice");return o&&(e=[],o.each(function(){null!=(s=t(this).data(i._elemNm))&&e.push(s)})),e},_clearSearchOnBlur:function(){!this._opened()&&"oj-select"!==this._classNm&&this.ojContext.isValid()&&this._clearSearch()},_GetContentWrapper:function(){return this.container[0].querySelector(".oj-text-field-container")}}),x=v.clazz(j,{_elemNm:"ojcombobox",_classNm:"oj-combobox",_COMPONENT_CLASSLIST:"oj-combobox oj-combobox-multi oj-component",_CreateContentElements:function(){return t(["<div class='oj-text-field-container' role='presentation'> ","<ul class='oj-combobox-choices'>","  <li class='oj-combobox-search-field'><span class='oj-helper-hidden'>&nbsp;</span>","    <input type='text' role='combobox' aria-expanded='false' aria-autocomplete='list' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='oj-combobox-input'>","  </li>","</ul>","</div>","<div class='oj-combobox-description oj-helper-hidden-accessible'></div>","<div class='oj-listbox-drop oj-listbox-drop-multi'>","   <ul class='oj-listbox-results' role='listbox'>","   </ul>","</div>","<div class='oj-helper-hidden-accessible oj-listbox-liveregion' aria-live='polite'></div>"].join(""))},_opening:function(e,t){this._resizeSearch(),x.superclass._opening.apply(this,arguments),this._focusSearch(),t||this._updateResults(!0),this.search.focus()},_clearSearch:function(){var e=this._getPlaceholder(),t=this._getMaxSearchWidth();null!=e&&v.isValueForPlaceholder(!0,this.getVal())&&v.isValueOptionsForPlaceholder(!0,this.getValOpts())?(this.search.attr("placeholder",e),this.search.val("").width(t>0?t:this.container.css("width")),this.searchContainer.width("100%")):(this.search.attr("placeholder",""),this.search.val("").width(10),this.searchContainer.width("auto"))},_resetSearchWidth:function(){this.search.width(10)},_getMaxSearchWidth:function(){return this.selection.width()-v.getSideBorderPadding(this.search)},_textWidth:function(e){var i=document.createElement("span"),s=document.createTextNode(e);i.style.display="none",i.appendChild(s),t("body").append(i);var o=t("body").find("span:last").width();return t("body").find("span:last").remove(),o},_resizeSearch:function(){var e,t,i,s,o=v.getSideBorderPadding(this.search);e=this._textWidth(this.search.val())+10,t=this.search.offset().left,(s=(i=this.selection.width())-(t-this.selection.offset().left)-o)<e&&(s=i-o),s<40&&(s=i-o),s<=0&&(s=e),this.search.width(Math.floor(s))}}),C=v.clazz(j,{_elemNm:"ojselect",_classNm:"oj-select",_userTyping:!1,_COMPONENT_CLASSLIST:"oj-select oj-select-multi oj-component",_CreateContentElements:function(){return t(["<div class='oj-text-field-container' role='presentation'>","<ul class='oj-select-choices' tabindex='0' role='combobox' ","  aria-autocomplete='none' aria-expanded='false'>","</ul>","</div>","<div class='oj-select-description oj-helper-hidden-accessible'></div>","<div class='oj-listbox-drop' role='dialog'>","  <div class='oj-listbox-search-wrapper'>","  <div class='oj-listbox-search'>","    <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off'","           spellcheck='false' class='oj-listbox-input' title='Search field' ","           role='combobox' aria-expanded='false' aria-autocomplete='list' />","    <span class='oj-listbox-spyglass-box'>","      <span class='oj-component-icon oj-listbox-search-icon' role='presentation'>","       <b role='presentation'></b></span>","    </span>","  </div>","  </div>","   <ul class='oj-listbox-results' role='listbox'>","   </ul>","</div>","<div class='oj-helper-hidden-accessible oj-listbox-liveregion' aria-live='polite'></div>"].join(""))},_enable:function(e){if(C.superclass._enable.apply(this,arguments),this._enabled){var t=this.elementTabIndex?this.elementTabIndex:"0";this.selection.attr("tabindex",t)}else this.selection.attr("tabindex","-1")},_containerKeydownHandler:function(e){C.superclass._containerKeydownHandler.apply(this,arguments),this._userTyping&&!this._opened()&&this.open(e)},_opening:function(e,t){C.superclass._opening.apply(this,arguments),this._showDropDown();var i=v.getSearchText(e);this._showSearchBox(i),t||(i?this._updateResults():this._updateResults(!0))},close:function(e){!0===this._userTyping&&(this._userTyping=!1);var t=e?e.originalEvent:null,i=t instanceof MouseEvent||t instanceof FocusEvent,s=e&&(!i||e.target===this.selection||e.target===this.search||this.dropdown.has(e.target).length>0);C.superclass.close.apply(this,arguments),this.ojContext.hasAfterToggleHandlerAddedFocusClass&&!s&&(this.ojContext._getRootElement().classList.remove("oj-focus"),this.ojContext.hasAfterToggleHandlerAddedFocusClass=!1),s&&v._focus(this,this.selection)},_clearSearch:function(){var e=this._getPlaceholder();if(null!=e&&v.isValueForPlaceholder(!0,this.getVal())&&v.isValueOptionsForPlaceholder(!0,this.getValOpts())){var i=t("<li></li>");i.addClass("oj-select-default"),i.text(e),this.selection.append(i)}}}),O=v.clazz(g,{_elemNm:"ojinputsearch",_classNm:"oj-inputsearch",_COMPONENT_CLASSLIST:"oj-inputsearch oj-component",_getDropdownPositionElement:function(){return this.container.children().first()},_CreateContentElements:function(){var e=t(["<div class='oj-inputsearch-choice' tabindex='-1' role='presentation'>","   <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off'","       spellcheck='false' class='oj-inputsearch-input' role='combobox' aria-expanded='false' aria-autocomplete='list' />","   <a class='oj-inputsearch-search-button oj-inputsearch-search-icon oj-component-icon oj-clickable-icon-nocontext'","       role='button' aria-label='search'></a>","</div>","<div class='oj-listbox-drop' role='presentation'>","   <ul class='oj-listbox-results' role='listbox'>","   </ul>","</div>","<div role='region' class='oj-helper-hidden-accessible oj-listbox-liveregion' aria-live='polite'></div>"].join("")),i=e.find(".oj-inputsearch-search-button");return this._attachSearchIconClickHandler(i),e},_attachSearchIconClickHandler:function(e){var t=this;e.on("click",function(e){if(t._isInterfaceEnabled()){if(t.opts.manageNewEntry){var i=t.search.val(),s=t.opts.manageNewEntry(i),o={trigger:v.ValueChangeTriggerTypes.SEARCH_ICON_CLICKED},n=t.selection.data(t._elemNm);!n&&""!==i||n&&n.label!==i||!t.ojContext.isValid()&&i!==t._previousDisplayValue?(t._onSelect(s,o,e),t._triggerUpdateEvent(s,o,e)):(n&&n.label===i&&(s=n),t._triggerUpdateEvent(s,o,e))}return!1}}).on("mousedown",function(e){return e.stopPropagation(),!1})},_enable:function(e){O.superclass._enable.apply(this,arguments),this._enabled?this.container.find(".oj-inputsearch-search-button").removeClass("oj-disabled"):this.container.find(".oj-inputsearch-search-button").addClass("oj-disabled")},_triggerUpdateEvent:function(e,t,i){var s;t&&(s=t.trigger);var o={_context:{optionMetadata:{trigger:s}}},n=this.id(e);if(n&&0!==n.length||(n=e.label?e.label:[]),void 0!==this.ojContext._AsyncValidate(n,i,o)&&this.ojContext.isValid()){"string"==typeof n&&(n=[n]);var a={value:n,optionMetadata:{trigger:s}};this.ojContext._trigger("update",i,a)}},_prepareOpts:function(e){var t=O.superclass._prepareOpts.apply(this,arguments);return t.highlightTermInOptions=function(){return!0},t}});e.__registerWidget("oj.ojCombobox",t.oj.editableValue,{defaultElement:"<input>",widgetEventPrefix:"oj",options:{asyncValidators:[],converter:null,filterOnOpen:"none",labelledBy:null,placeholder:null,options:null,optionsKeys:{},pickerAttributes:null,optionRenderer:null,minLength:0,maximumResultCount:15,rawValue:null,required:!1,readOnly:!1,validators:[],valueOption:null,valueOptions:null,valueUpdated:null},widget:function(){return this.combobox.container},_ComponentCreate:function(){this._super(),v.wrapDataProviderIfNeeded(this,null),this._setup()},_AfterCreate:function(){if(this._super(),this._IsCustomElement()){this._initInputIdLabelForConnection(this._GetContentElement()[0],this.OuterWrapper.id,this.options.labelledBy);var e=this._getRootElement();this._focusable({element:e,applyHighlight:!1,afterToggle:this._handleAfterFocusToggle.bind(this,e)}),this.combobox&&"none"===this.options.labelEdge&&this.combobox.updateAriaLabelIfNeeded()}},_handleAfterFocusToggle:function(e,t){"focusout"===t&&(this._getDropdown()&&e.classList.add("oj-focus"))},_InitOptions:function(t,i){if(this._super(t,i),e.EditableValueUtils.initializeOptionsFromDom([{attribute:"disabled",validateOption:!0},{attribute:"placeholder"},{attribute:"required",coerceDomValue:!0,validateOption:!0},{attribute:"title"}],i,this),this.multiple=this._IsCustomElement()?"OJ-COMBOBOX-MANY"===this.OuterWrapper.nodeName:this.options.multiple,void 0===this.options.value)this._IsCustomElement()||(this.options.value=void 0!==this.element.attr("value")?v.splitVal(this.element.val(),","):null);else{var s=this.options.value;Array.isArray(s)?this._IsCustomElement()||(s=s.slice(0)):"string"==typeof s&&(!0===this.multiple?s=v.splitVal(s,","):this._IsCustomElement()||(s=[s])),this.options.value=s}},_IsRequired:function(){return this.options.required},_labelledByUpdatedForInputComp:function(t,i){if(e.EditableValueUtils._labelledByUpdatedForInputComp.apply(this,arguments),null!=this.combobox.results){var s=this.uuid+"_Label",o=e.EditableValueUtils._getOjLabelAriaLabelledBy(t,s);this.combobox.results.attr("aria-labelledby",o)}},_initInputIdLabelForConnection:e.EditableValueUtils._initInputIdLabelForConnection,_linkLabelForInputComp:e.EditableValueUtils._linkLabelForInputComp,_createOrUpdateReadonlyDiv:e.EditableValueUtils._createOrUpdateReadonlyDiv,_AfterSetOptionRequired:e.EditableValueUtils._AfterSetOptionRequired,_AfterSetOptionValidators:e.EditableValueUtils._AfterSetOptionValidators,_AfterSetOptionAsyncValidators:e.EditableValueUtils._AfterSetOptionAsyncValidators,_AfterSetOptionConverter:e.EditableValueUtils._AfterSetOptionConverter,_ResetConverter:e.EditableValueUtils._ResetConverter,_GetConverter:e.EditableValueUtils._GetConverter,_GetNormalizedValidatorsFromOption:e.EditableValueUtils._GetNormalizedValidatorsFromOption,_GetNormalizedAsyncValidatorsFromOption:e.EditableValueUtils._GetNormalizedAsyncValidatorsFromOption,_setup:function(){var e={},i=this.multiple;e.element=this.element,e.ojContext=this,v.isValueForPlaceholder(i,this.options.value)&&(i?this.options.valueOptions=v.getValueOptionsForPlaceholder(this,this.options.valueOptions):this.options.valueOption=v.getValueOptionsForPlaceholder(this,this.options.valueOption)),e=t.extend(this.options,e),this.combobox=i?new x:new g,this.combobox._init(e),this._refreshRequired(this.options.required),this._resolveValueOptionsLater=v.mergeValueAndValueOptions(this)},_refreshRequired:e.EditableValueUtils._refreshRequired,_AriaRequiredUnsupported:function(){return!1},_destroy:function(){this.combobox._destroy(),this._super()},_IsTextFieldComponent:function(){return!0},_GetContentWrapper:function(){if(this._IsCustomElement())return this.combobox._GetContentWrapper()},refresh:function(){this._super(),this.combobox._destroy(),this._setup(),this._SetRootAttributes(),this._initComponentMessaging()},_setOption:function(e,t,i){var s=t,o=this.multiple;if("value"===e&&(Array.isArray(s)?this._IsCustomElement()||(s=s.slice(0)):"string"==typeof s&&(!0===o?s=v.splitVal(s,","):this._IsCustomElement()||(s=[s])),i&&i._context&&i._context.optionMetadata?this.combobox.valueChangeTrigger=i._context.optionMetadata.trigger:this.combobox.valueChangeTrigger=null,"string"==typeof this.options.placeholder&&(null==s||s&&0===s.length||this._IsCustomElement()&&v.isValueForPlaceholder(o,s))))return v.setValueOptions(this,v.getFixupValueOptionsForPlaceholder(o)),void this._super(e,s,i);if("options"===e?(v.removeDataProviderEventListeners(this),v.clearDataProviderWrapper(this)):"optionsKeys"===e?v.clearDataProviderWrapper(this):"valueOption"===e&&!0!==o?(s=v.getValueOptionsForPlaceholder(this,s),this.combobox.opts.valueOption=s):"valueOptions"===e&&!0===o&&(s=v.getValueOptionsForPlaceholder(this,s),this.combobox.opts.valueOptions=s),this._super(e,s,i),"valueOption"===e&&!0!==o)v.syncValueWithValueOption(this,s,this.options.value,!1);else if("valueOptions"===e&&!0===o)v.syncValueWithValueOptions(this,s,this.options.value,!1);else if("value"===e)v.updateValueOptions(this.combobox);else if("options"===e)v.isDataProvider(s)&&(v.wrapDataProviderIfNeeded(this,this.combobox?this.combobox.opts:null),v.addDataProviderEventListeners(this)),this.combobox.opts.options=s,this.combobox.opts=this.combobox._prepareOpts(this.combobox.opts),(this.combobox.isSearchFocused&&this.combobox.shouldReopenOnNewData||this.combobox._opened())&&this.combobox._updateResults(!1,!0);else if("optionsKeys"===e)v.wrapDataProviderIfNeeded(this,this.combobox?this.combobox.opts:null);else if("disabled"===e)s?this.combobox._disable():this.combobox._enable();else if("readOnly"===e)this.combobox.applyReadonlyState();else if("labelledBy"===e){if(this.options.labelledBy){var n=this._GetContentElement()[0].id;this._labelledByUpdatedForInputComp(this.options.labelledBy,n)}}else"maximumResultCount"===e&&(this.combobox.opts.maximumResultCount=s)},_AfterSetOption:function(e,t,i){switch(this._superApply(arguments),e){case"required":this._AfterSetOptionRequired(e);break;case"validators":this._AfterSetOptionValidators(e);break;case"converter":this._AfterSetOptionConverter(e);break;case"asyncValidators":this._AfterSetOptionAsyncValidators(e);break;case"labelHint":case"labelEdge":this.combobox&&this.combobox.updateAriaLabelIfNeeded()}},_NotifyDetached:function(){this._superApply(arguments),this.combobox.close()},_NotifyHidden:function(){this._superApply(arguments),this.combobox.close()},_VerifyConnectedForSetup:function(){return!0},_SetDisplayValue:function(e){v.applyValueOptions(this.combobox,this.options)?this.multiple&&this.combobox._clearSearch():this.combobox._initSelection(),this._resolveValueOptionsLater=!1},_GetDisplayValue:function(){var e=null,t=v.getOpts(this),i=this.combobox._getSelectionData();if(null!=i)if(this.multiple)if(e=[],Array.isArray(i))for(var s=0;s<i.length;s++)e.push(t.formatSelection(i[s]));else e.push(t.formatSelection(i));else e=Array.isArray(i)&&i.length>0?t.formatSelection(i[0]):t.formatSelection(i);else e=this._super();return e},_SetPlaceholder:function(e){this.combobox&&(this.combobox.opts.placeholder=e,this.combobox._setPlaceholder&&this.combobox._setPlaceholder())},_parseValue:function(e){var t,i=e;if("string"==typeof i&&(!0===this.multiple?i=v.splitVal(i,","):this._IsCustomElement()||(i=[i])),Array.isArray(i)){t=[];for(var s=0;s<i.length;s++){var o=this._super(i[s]);t.push(o)}}else t=this._super(i);return t},_GetMessagingLauncherElement:function(){return this.combobox.search},_NotifyContextMenuGesture:function(e,t,i){var s=this._GetMessagingLauncherElement();this._OpenContextMenu(t,i,{launcher:s})},_GetContentElement:function(){return this.combobox.search},_GetAriaLabelElement:function(){return this._GetContentElement()[0]},_GetDefaultStyleClass:function(){return"oj-combobox"},_SetLoading:function(){this._super(),this.combobox.applyReadonlyState()},_ClearLoading:function(){this._super(),this.combobox.applyReadonlyState()},validate:function(){var e,t,i=this._getDisplayValueForSetValue(),s=this.combobox,o=i;if(s.hasUncommittedValue){var n=null;if(this.multiple){var a=i[i.length-1],l=(s.getVal()||[]).slice(0),r=this._getValueOptionCandidateFromRawValue(a),h=s.id(r),c=(s.getValOpts()||[]).slice(0);n=c.slice(0),-1===l.indexOf(h)&&(n.push(r),l.push(h),e=c),o=l}else n=this._getValueOptionCandidateFromRawValue(i),o=s.id(n);s._skipSetValueOptions=!0,s.setValOpts(n),s.hasUncommittedValue=!1}return t=this._SetValue(o,null,this._VALIDATE_METHOD_OPTIONS),this._IsCustomElement()&&(t instanceof Promise?t=t.then(function(t){return s._skipSetValueOptions=!1,!t&&e&&(s.setValOpts(e),s.hasUncommittedValue=!0),Promise.resolve(t?"valid":"invalid")}):(s._skipSetValueOptions=!1,!t&&e&&(s.setValOpts(e),s.hasUncommittedValue=!0),t=Promise.resolve(t?"valid":"invalid"))),t},_SetValue:function(t,i,s){var o=this._super(t,i,s);(!o||o instanceof Promise)&&((this._IsCustomElement()?v.isValueForPlaceholder(this.multiple,t):null==t||""===t||e.Object.compareValues(t,[]))||s===this._VALIDATE_METHOD_OPTIONS||this._SetDisplayValue(t));return o},_CanSetValue:function(){return!!this.forceCanSetValue||this._super()},_getValueOptionCandidateFromRawValue:function(e){var t=this.combobox.opts.manageNewEntry(e);return v.findOptionFromResult(this.combobox,e,t)},_getDisplayValueForSetValue:function(){var e=null,t=null,i=this.combobox.hasUncommittedValue;if(!0!==this.multiple)e=i?this.combobox.getRawValue():this.combobox.getValOpts()?this.combobox.getValOpts().value:null,t=this._IsCustomElement()?e:null==e||""===e?[]:[e];else{var s=this.combobox.currentValue?this.combobox.currentValue.slice(0):[];null==(e=this.combobox.search.val())||""===e?t=s:(s.push(e),t=s)}return t},_getDropdown:function(){if(this.combobox&&this.combobox._opened())for(var e=t(".oj-listbox-drop"),i=0;i<e.length;i++)if("oj-listbox-drop"===t(e[i]).attr("id")&&t(e[i]).attr("data-oj-containerid")===this.combobox.containerId)return t(e[i]);return null},_findItem:function(e,i){for(var s=0;s<e.length;s++)if(t(e[s]).data("ojcombobox").value===i)return e[s];return null},getNodeBySubId:function(e){var i,s=null;if(null==e)return this.combobox.container?this.combobox.container[0]:null;if(!(s=this._super(e))){"oj-combobox-drop"===(i=e.subId)&&(i="oj-listbox-drop"),"oj-combobox-results"===i&&(i="oj-listbox-results"),"oj-combobox-selection"===i&&(i="oj-combobox-selected-choice");var o=this._getDropdown();switch(i){case"oj-combobox-input":case"oj-combobox-arrow":s=this.widget().find("."+i)[0];break;case"oj-listitem":if(o){var n=o.find(".oj-listbox-result");s=this._findItem(n,e.value)}break;case"oj-combobox-remove":var a=this.widget().find(".oj-combobox-selected-choice"),l=this._findItem(a,e.value);s=l?t(l).find(".oj-combobox-clear-entry-icon")[0]:null;break;case"oj-listbox-drop":o&&(s=o[0]);break;case"oj-listbox-results":o&&(s=o.find("."+i)[0]);break;case"oj-combobox-selected-choice":s=this.widget().find("."+i).toArray()}}return s||null},getSubIdByNode:function(e){var i=null;if(null!=e){var s=t(e);i=s.hasClass("oj-combobox-input")?{subId:"oj-combobox-input"}:s.hasClass("oj-combobox-arrow")?{subId:"oj-combobox-arrow"}:s.hasClass("oj-listbox-result")?{subId:"oj-listitem",value:s.data("ojcombobox").value}:s.hasClass("oj-combobox-clear-entry-icon")?{subId:"oj-combobox-remove",value:s.closest(".oj-combobox-selected-choice").data("ojcombobox").value}:this._super(e)}return i}}),e.__registerWidget("oj.ojInputSearch",t.oj.editableValue,{defaultElement:"<input>",widgetEventPrefix:"oj",options:{placeholder:void 0,required:!1,list:void 0,options:null,optionsKeys:null,pickerAttributes:null,optionRenderer:null,minLength:0,beforeExpand:null,rawValue:void 0,optionChange:null,update:null,validators:void 0},widget:function(){return this.inputSearch.container},_ComponentCreate:function(){this._super(),this._setup()},_InitOptions:function(t,i){if(this._super(t,i),e.EditableValueUtils.initializeOptionsFromDom([{attribute:"disabled",validateOption:!0},{attribute:"placeholder"},{attribute:"required",coerceDomValue:!0,validateOption:!0},{attribute:"title"}],i,this),void 0===this.options.value)this.options.value=void 0!==this.element.attr("value")?v.splitVal(this.element.val(),","):null;else{var s=this.options.value;Array.isArray(s)?s=s.slice(0):"string"==typeof s&&(s=[s]),this.options.value=s}},_AfterSetOption:function(e,t,i){switch(this._superApply(arguments),e){case"required":this._AfterSetOptionRequired(e);break;case"validators":this._AfterSetOptionValidators(e)}},_IsRequired:function(){return this.options.required},_AfterSetOptionRequired:e.EditableValueUtils._AfterSetOptionRequired,_AfterSetOptionValidators:e.EditableValueUtils._AfterSetOptionValidators,_refreshRequired:e.EditableValueUtils._refreshRequired,_GetNormalizedValidatorsFromOption:e.EditableValueUtils._GetNormalizedValidatorsFromOption,_AriaRequiredUnsupported:function(){return!1},_setup:function(){var e={};e.element=this.element,e.ojContext=this,e.inputSearch=!0,e=t.extend(this.options,e),this.inputSearch=new O,this.inputSearch._init(e),this._refreshRequired(this.options.required)},_destroy:function(){this.inputSearch._destroy(),this._super()},refresh:function(){this._super(),this.inputSearch._destroy(),this._setup(),this._SetRootAttributes()},_setOption:function(e,t,i){var s=t;"value"===e&&(null!=s&&(Array.isArray(s)?s=s.slice(0):"string"==typeof s?s=[s]:r.error("ojInputSearch value has to be an array of string or a string.")),i&&i._context&&i._context.optionMetadata?this.inputSearch.valueChangeTrigger=i._context.optionMetadata.trigger:this.inputSearch.valueChangeTrigger=null),this._super(e,s,i),"options"===e&&(this.inputSearch.opts.options=s,this.inputSearch.opts=this.inputSearch._prepareOpts(this.inputSearch.opts)),"disabled"===e&&(s?this.inputSearch._disable():this.inputSearch._enable())},_NotifyDetached:function(){this._superApply(arguments),this.inputSearch.close()},_NotifyHidden:function(){this._superApply(arguments),this.inputSearch.close()},_SetDisplayValue:function(e){this.inputSearch._initSelection()},_SetPlaceholder:function(e){this.inputSearch&&(this.inputSearch.opts.placeholder=e,this.inputSearch._setPlaceholder&&this.inputSearch._setPlaceholder())},validate:function(){var e=this.inputSearch.search.val(),t=null,i=[];return this.isValid()&&(i=this.inputSearch.getVal()),t=null==e||""===e?i:[e],this._SetValue(t,null,this._VALIDATE_METHOD_OPTIONS)},_parseValue:function(e){var t,i=[];if(null==e)return i;if(Array.isArray(e))for(var s=0;s<e.length;s++)t=this._super(e[s]),i.push(t.toString());else"string"==typeof e?(t=this._super(e),i.push(t.toString())):r.error("ojInputSearch value has to be an array of string or a string.");return i},_GetMessagingLauncherElement:function(){return this.inputSearch.search},_GetContentElement:function(){return this.inputSearch.search},_GetDefaultStyleClass:function(){return"oj-inputsearch"},_getDropdown:function(){if(this.inputSearch&&this.inputSearch._opened())for(var e=t(".oj-listbox-drop"),i=0;i<e.length;i++)if("oj-listbox-drop"===t(e[i]).attr("id")&&t(e[i]).attr("data-oj-containerid")===this.inputSearch.containerId)return t(e[i]);return null},expand:function(){this.inputSearch.open()},collapse:function(){this.inputSearch.close()},getNodeBySubId:function(e){var t,i=null;if(null===e)return this.inputSearch.container?this.inputSearch.container[0]:null;if(!(i=this._super(e)))switch("oj-inputsearch-search"===(t=e.subId)&&(t="oj-inputsearch-search-button"),t){case"oj-inputsearch-input":case"oj-inputsearch-search-button":i=this.widget().find("."+t)[0];break;case"oj-listitem":var s=this._getDropdown();if(s){var o=s.find(".oj-listbox-result");i=this.inputSearch._findItem(o,e.value)}}return i||null},getSubIdByNode:function(e){var i=null;if(null!=e){var s=t(e);i=s.hasClass("oj-inputsearch-input")?{subId:"oj-inputsearch-input"}:s.hasClass("oj-inputsearch-search-button")?{subId:"oj-inputsearch-search"}:s.hasClass("oj-listbox-result")?{subId:"oj-listitem",value:s.data("ojinputsearch").value}:this._super(e)}return i}}),e.__registerWidget("oj.ojSelect",t.oj.editableValue,{defaultElement:"<select>",widgetEventPrefix:"oj",options:{labelledBy:null,maximumResultCount:15,minimumResultsForSearch:15,placeholder:null,optionRenderer:null,options:null,optionsKeys:{},pickerAttributes:null,required:!1,readOnly:!1,renderMode:"jet",valueOption:null,valueOptions:null},widget:function(){return this.select?this.select.container:this.element.parent().parent()},_ComponentCreate:function(){this._super(),v.wrapDataProviderIfNeeded(this,null),this._setup()},_AfterCreate:function(){var t;if(this._super(),this._IsCustomElement()){if(this.options.labelledBy){var i=this.uuid+"_Label";!(t=e.EditableValueUtils._getOjLabelAriaLabelledBy(this.options.labelledBy,i))||this.multiple&&v.isReadonly(this)||this._GetContentElement().attr("aria-labelledby",t),this._IsRequired()&&this.options.translations.required&&(this._implicitReqValidator=null,this._getImplicitRequiredValidator())}var s=this._getRootElement();this._focusable({element:s,applyHighlight:!1,afterToggle:this._handleAfterFocusToggle.bind(this,s)}),this.select&&"none"===this.options.labelEdge&&this.select.updateAriaLabelIfNeeded()}},_handleAfterFocusToggle:function(e,t){(this.hasAfterToggleHandlerAddedFocusClass=!1,"focusout"===t)&&(this._getDropdown()&&(e.classList.add("oj-focus"),this.hasAfterToggleHandlerAddedFocusClass=!0))},_AfterSetOption:function(e,t,i){switch(this._superApply(arguments),e){case"required":this._AfterSetOptionRequired(e);break;case"labelHint":case"labelEdge":this.select&&this.select.updateAriaLabelIfNeeded()}},_IsRequired:function(){return this.options.required},_AfterSetOptionRequired:e.EditableValueUtils._AfterSetOptionRequired,_nativeSetDisabled:function(e){e?(this.element.attr("disabled",""),this.element.parent().parent().addClass("oj-disabled").removeClass("oj-enabled")):(this.element.removeAttr("disabled"),this.element.parent().parent().removeClass("oj-disabled").addClass("oj-enabled"))},_nativeChangeHandler:function(e){var i=[],s=[],o=!this._IsRequired()&&this._HasPlaceholderSet();t(e.target).find("option").each(function(){this.selected&&(this.value||o&&""===this.value)&&(i.push(this.value),s.push({value:this.value,label:this.text}))}),v.duringFetchByKey(this.element)&&v.setValueChanged(this,!0),this._IsCustomElement()&&!0!==this.multiple?(this._SetValue(i[0],e,{doValueChangeCheck:!1,_context:{internalSet:!0}}),v.setValueOptions(this,s[0])):(this._SetValue(i,e,{doValueChangeCheck:!1,_context:{internalSet:!0}}),v.setValueOptions(this,s))},_nativeQueryCallback:function(e){if(e){var t=this.element;v.arrayPopulateResults(t,e,this._formatValue.bind(this),v.isDataProvider(this.options.options)?null:this.options.optionsKeys),t.addClass(v.GENERATED_OPTIONS_SELECTOR)}},_nativeSetSelected:function(e){var t=null;if(e)t=e;else if(this._HasPlaceholderSet()&&(this.options.required&&(t=this._nativeFindFirstEnabledOptionValue()),this._SetPlaceholder(this.options.placeholder)),null===t){var i=this._nativeFindFirstEnabledOption();t=this._nativeFindFirstEnabledOptionValue(i),v.setValueOptions(this,{value:t,label:i.text()})}this._setInitialSelectedValue(t)},_nativeFetchFromDataProvider:function(){var e=this;v.fetchFirstBlockFromDataProvider(this.element,e.options).then(function(t){if(e._nativeQueryCallback(t),t.length){var i=e.options.value;i?v.validateFromDataProvider(e.element,e.options,i).then(function(t){var i,s;if(v.isValueChanged(e)&&!1===e.multiple)v.setValueChanged(e,void 0);else if(v.isValueChanged(e)&&e.multiple&&(s=e.options.valueOptions,i=e.options.value,v.setValueChanged(e,void 0)),t){var o=t.valueOptions;Array.isArray(o)&&o.length&&v.setValueOptions(e,s?o.concat(s):o);var n=t.value;if(Array.isArray(n)&&n.length){i=i?n.concat(i):n;var a=e.multiple?i:n[0];e._nativeSetSelected(a),e.multiple&&1!==a.length||(e.element[0].value=a)}}}):e._nativeSetSelected()}})},_nativeSetup:function(){var e=this.element;if(this._IsCustomElement()?t(this.OuterWrapper).addClass("oj-select-native oj-component oj-select oj-form-control"):e.wrap("<div>").parent().addClass("oj-select-native oj-component oj-select oj-form-control"),e.addClass("oj-select-select oj-component-initnode"),e.wrap('<div class="oj-text-field-container" role="presentation">'),this.multiple?(e[0].multiple||(e[0].multiple=!0),e.parent().prepend("<a class='oj-select-arrow oj-component-icon oj-clickable-icon-nocontext oj-select-multiple-open-icon' role='presentation'></a>")):e.parent().prepend("<a class='oj-select-arrow oj-component-icon oj-clickable-icon-nocontext oj-select-open-icon' role='presentation'></a>"),this._nativeSetDisabled(this.options.disabled),this.options.list)v.listPopulateResults(e,t("#"+this.options.list).children(),this._formatValue.bind(this)),e.addClass(v.GENERATED_OPTIONS_SELECTOR);else if(this.options.options)v.getDataProvider(this.options)?this._nativeFetchFromDataProvider():this._nativeQueryCallback(this.options.options);else if(this._IsCustomElement()){var i=e.children();1===i.length&&i.hasClass("oj-listbox-placeholder")||(v.ojOptionPopulateResults(e,i,this._formatValue.bind(this)),e.addClass(v.GENERATED_OPTIONS_SELECTOR))}this._focusable({element:e,applyHighlight:!0}),this.options.value||this._HasPlaceholderSet()||v.getDataProvider(this.options)||this._setInitialSelectedValue(this._nativeFindFirstEnabledOptionValue()),e.change(this._nativeChangeHandler.bind(this)),v.addDataProviderEventListeners(this),"top"===this._ResolveLabelEdgeStrategyType()&&this._initComponentMessaging()},_ResolveLabelEdgeStrategyType:function(){var e=this._superApply(arguments);return this._IsCustomElement()&&this._isNative()&&"inside"===e&&(e="top"),e},_jetSetup:function(){var e={};e.element=this.element,e.ojContext=this,e=t.extend(this.options,e),this.select=this.multiple?new C:new y,this.select._init(e),this.select.container.addClass("oj-select-jet oj-form-control"),this._focusable({element:this.select.selection,applyHighlight:!0})},_setInitialSelectedValue:function(e){var t;t=this._IsCustomElement()?e:Array.isArray(e)?e:[e],this._SetValue(t,null,{doValueChangeCheck:!1,_context:{internalSet:!0,writeback:!0},changed:!0})},_setup:function(){v.isValueForPlaceholder(this.multiple,this.options.value)&&(this.multiple?this.options.valueOptions=v.getValueOptionsForPlaceholder(this,this.options.valueOptions):this.options.valueOption=v.getValueOptionsForPlaceholder(this,this.options.valueOption)),this._resolveValueOptionsLater=v.mergeValueAndValueOptions(this),this._isNative()?this._nativeSetup():this._jetSetup(),this._refreshRequired(this.options.required)},_IsTextFieldComponent:function(){return!0},_GetContentWrapper:function(){if(this._IsCustomElement())return this.select._GetContentWrapper()},refresh:function(){this._super(),this._cleanup(),this._setup(),this._isNative()&&this.options.value&&this.element.val(this.options.value),this._SetRootAttributes(),this._initComponentMessaging()},_refreshRequired:e.EditableValueUtils._refreshRequired,_AriaRequiredUnsupported:function(){return!1},_destroy:function(){this._cleanup(),this._super()},_NotifyDetached:function(){this._superApply(arguments),this.select&&this.select.close()},_NotifyHidden:function(){this._superApply(arguments),this.select&&this.select.close()},_VerifyConnectedForSetup:function(){return!0},_SetPlaceholder:function(e){if(this._isNative()&&null!=e){var i=t(this.element.children("option:first-child"));i&&""===i.attr("value")?(i.text(this.options.placeholder),i.attr("value","")):((i=v.createOptionTag(0,"",e,this._formatValue.bind(this))).addClass("oj-listbox-placeholder"),this._hidePlaceholder(i,this._IsRequired()),i.prependTo(this.element))}else if(this.select){var s=e;"inside"===this.options.labelEdge&&(s=e||""),this.select.opts.placeholder=s,this.select._setPlaceholder()}},_HasPlaceholderSet:function(){return v.isPlaceholderSpecified(this.options)},_ClearPlaceholder:function(){this._SetPlaceholderOption(null),this._SetPlaceholder(null)},_InitOptions:function(t,i){if(this._super(t,i),e.EditableValueUtils.initializeOptionsFromDom([{attribute:"disabled",validateOption:!0},{attribute:"placeholder"},{attribute:"required",coerceDomValue:!0,validateOption:!0},{attribute:"title"}],i,this),this.multiple=this._IsCustomElement()?"OJ-SELECT-MANY"===this.OuterWrapper.nodeName:this.options.multiple,void 0===this.options.value)this._IsCustomElement()?this.options.value=null:this.options.value=void 0!==this.element.attr("value")?v.splitVal(this.element.val(),","):null;else{var s=this.options.value;Array.isArray(s)&&(this._IsCustomElement()||(s=s.slice(0))),this.options.value=s}},_SetDisplayValue:function(e){if(this.select)v.applyValueOptions(this.select,this.options)||this.select._initSelection(),this._resolveValueOptionsLater=!1;else{var t;if(this._setPlaceholderStyle(e)&&(this.element[0].selectedIndex=0),null==e)this._resolveValueOptionsLater&&v.setValueOptions(this,v.getFixupValueOptionsForPlaceholder(this.multiple));else{var i,s=!1,o=e;if(this.multiple||(Array.isArray(e)&&(o=e[0]),null===(i=this._nativeFindLabel(o))&&(r.warn("JET select: selected value not found"),this.element[0].options&&this.element[0].options.length>0?(this.element[0].selectedIndex=0,o=this.element[0].value,i=this.element[0].text,s=!0):i=String(e))),s||this.element.val(e),e=o,this._resolveValueOptionsLater){if(this.multiple){var n=0;t=[],this.element.find("option").each(function(){this.selected&&(t.push({value:e[n],label:this.text}),n+=1)})}else t={value:e,label:i};v.setValueOptions(this,t)}}this._resolveValueOptionsLater=!1}},_GetDisplayValue:function(){var e=null;if(this.select){var t=v.getOpts(this),i=this.select._getSelectionData();if(null!=i)if(this.multiple)if(e=[],Array.isArray(i))for(var s=0;s<i.length;s++)e.push(t.formatSelection(i[s]));else e.push(t.formatSelection(i));else e=Array.isArray(i)&&i.length>0?t.formatSelection(i[0]):t.formatSelection(i);else e=this._super()}else e=this._super();return e},validate:function(){var e,t=null;if(this.select)if(!0===this.multiple){var i=this.select.search.val(),s=this.select.getVal()?this.select.getVal():[];null==i||""===i?t=s:(s.push(i),t=s)}else t=this.select.getVal();else this._isNative()&&(t=this.options.value);return e=this._SetValue(t,null,this._VALIDATE_METHOD_OPTIONS),this._IsCustomElement()&&(e=Promise.resolve(e?"valid":"invalid")),e},_CanSetValue:function(){return!!this.forceCanSetValue||this._super()},_nativeFindFirstEnabledOption:function(){var e=this.element.find("option:not(:disabled)");return e.length>0?t(e[0]):null},_nativeFindFirstEnabledOptionValue:function(e){return e||(e=this._nativeFindFirstEnabledOption()),e?this._IsCustomElement()?e.attr("value"):[e.attr("value")]:null},_nativeSetOptions:function(e){var t=this.options.value,i=this.element;if(i.hasClass(v.GENERATED_OPTIONS_SELECTOR))v.cleanupResults(i);else{var s=i.children();s.length>0&&s.remove()}if(v.isDataProvider(e))this._nativeFetchFromDataProvider();else{v.arrayPopulateResults(i,e,this._formatValue.bind(this),this.options.optionsKeys);var o=null;this._HasPlaceholderSet()&&(this.options.required&&(o=this._nativeFindFirstEnabledOptionValue()),this._SetPlaceholder()),null===o&&(o=this._nativeFindFirstEnabledOptionValue()),this.options.value=o,this.option("value",t)}i.addClass(v.GENERATED_OPTIONS_SELECTOR)},_removePlaceholderInMultiValues:function(e){for(var t,i=[],s=0;s<e.length;s++)null!=(t=e[s])&&(t.length>0?(1===i.length&&""===i[0]&&i.pop(),i.push(t)):0===i.length&&i.push(t));return i},_nativeFindLabel:function(e){var i=this.element[0].options;if(i&&i.length>0)for(var s=0;s<i.length;s++)if(i[s].value===e)return t(i[s]).text();return null},_setPlaceholderStyle:function(e){var t=this.multiple;return(null==e||""===e)&&this._HasPlaceholderSet()||!this._IsCustomElement()&&Array.isArray(e)&&1===e.length&&""===e[0]||this._IsCustomElement()&&this._HasPlaceholderSet()&&v.isValueForPlaceholder(t,e)?(this.element.addClass("oj-select-default"),!0):(this.element.removeClass("oj-select-default"),!1)},_setOption:function(i,s,o){var n,a,l=s,r=this,h=this._super,c=this.multiple,u=!1;if("value"!==i)if("placeholder"===i?this.select?(this.select.opts.placeholder=l,v.isValueForPlaceholder(c,this.options.value)&&this.select._setPlaceholder()):(n=this.options.value)&&0!==n.length&&n[0]||(this.element[0].selectedIndex=0):"maximumResultCount"===i?this.select?this.select.opts.maximumResultCount=l:u=!0:"minimumResultsForSearch"===i?this.select&&(this.select.opts.minimumResultsForSearch=l):"renderMode"===i&&(this._cleanup(),u=!0),"options"===i?(v.removeDataProviderEventListeners(this),v.clearDataProviderWrapper(this)):"optionsKeys"===i?v.clearDataProviderWrapper(this):"valueOption"===i&&!0!==c?(l=v.getValueOptionsForPlaceholder(this,l),this.select&&(this.select.opts.valueOption=l)):"valueOptions"===i&&!0===c&&(l=v.getValueOptionsForPlaceholder(this,l),this.select&&(this.select.opts.valueOptions=l)),this._super(i,l,o),u&&this.refresh(),"disabled"===i)this.select?l?this.select._disable():this.select._enable():this._nativeSetDisabled(l);else if("readOnly"===i)this.select&&this.select.applyReadonlyState(),"native"===this.options.renderMode&&this.refresh();else if("valueOption"===i&&!0!==c)v.syncValueWithValueOption(this,l,this.options.value,this._isNative());else if("valueOptions"===i&&!0===c)v.syncValueWithValueOptions(this,l,this.options.value,this._isNative());else if("options"===i)v.isDataProvider(l)&&(v.wrapDataProviderIfNeeded(this,this.select?this.select.opts:null),v.addDataProviderEventListeners(this)),this.select?(n=this.select.getVal(),a=c?n&&0!==n.length:this._IsCustomElement()?null!=n:n&&null!=n[0],v.getDataProvider(this.options)&&a?v.applyValueOptions(this.select,this.options)?(this.select.opts.options=l,this.select.opts=r.select._prepareOpts(this.select.opts)):v.validateFromDataProvider(this.select.container,this.options,this.options.value).then(function(e){var t=e?e.value:null;if(t){var i=e.valueOptions;Array.isArray(i)&&i.length&&v.setValueOptions(r,i),Array.isArray(t)&&t.length&&h.call(r,"value",c?t:t[0])}else r.options.placeholder?c||r.select._updateSelectedOption(r.options.placeholder):c?h.call(r,"value",null):v.fetchFirstBlockFromDataProvider(r.select.container,r.options,1).then(function(e){e&&e.length>0&&n===r.select.getVal()?r.select._updateSelectedOption(e[0]):(h.call(r,"value",null),r.select.text.text(""))});r.select.opts.options=l,r.select.opts=r.select._prepareOpts(r.select.opts)}):(this.select.opts.options=l,this.select.opts=this.select._prepareOpts(this.select.opts),c&&!a||(this.select.setValOpts(null),this._super("value",n)))):this._nativeSetOptions(l);else if("optionsKeys"===i)v.wrapDataProviderIfNeeded(this,this.select?this.select.opts:null);else if("required"===i&&this._isNative()){var d=t(this.element.find(".oj-listbox-placeholder"));d&&""===d.attr("value")&&this._hidePlaceholder(d,l)}else if("multiple"!==i||this._IsCustomElement()){if("labelledBy"===i&&this.options.labelledBy){var p=this.uuid+"_Label",f=e.EditableValueUtils._getOjLabelAriaLabelledBy(this.options.labelledBy,p);!f||this.multiple&&v.isReadonly(this)||this._GetContentElement().attr("aria-labelledby",f),null!=this.select&&null!=this.select.results&&this.select.results.attr("aria-labelledby",f),this._IsRequired()&&this.options.translations.required&&(this._implicitReqValidator=null,this._getImplicitRequiredValidator())}}else this.multiple=l;else{if((this._HasPlaceholderSet()||c)&&(null!=l&&0===l.length||this._IsCustomElement()&&v.isValueForPlaceholder(c,l)))return v.setValueOptions(this,v.getFixupValueOptionsForPlaceholder(c)),void this._super(i,l,o);var m;this.select&&((m=this.select.datalist)||(m=this.select.opts.element));var _=this._IsCustomElement()&&!c;if(Array.isArray(l)||_||(l=[l]),this._isNative()&&(_||(l=this._removePlaceholderInMultiValues(l)),this._setPlaceholderStyle(l)),v.getDataProvider(this.options)&&l)return this.select&&(this.select.opts.options=this.options.options),void v.validateFromDataProvider(this._isNative()?this.element:this.select.container,this.options,l).then(function(e){if(e){var t=e.valueOptions;Array.isArray(t)&&t.length&&v.setValueOptions(r,t);var s=e.value;if(Array.isArray(s)&&s.length){var o=c?s:s[0];h.call(r,i,o),r._isNative()&&(r.element[0].value=o)}}});if(!_){for(var b=[],g=0;g<l.length;g++)this.select?(!this.select.opts.validate||this.select.opts.validate(m,l[g])||this._isOptionDataPending())&&b.push(l[g]):this.element.find("option[value='"+l[g]+"']").length>0&&b.push(l[g]);return void((b.length>0||c)&&(this._isNative()?this._nativeSetSelected(b):(this._super(i,b,o),v.updateValueOptions(this.select))))}this.select&&this.select.opts.validate&&!this.select.opts.validate(m,l)&&!this._isOptionDataPending()||(this._super(i,l,o),v.updateValueOptions(this.select))}},_isOptionDataPending:function(){var e=this.options.options,t=this.select.datalist;if(t){if(0===t.children().length)return!0}else{if(v.isDataProvider(e))return!0;if(!e||0===e.length)return!0}return!1},_getDropdown:function(){if(this.select&&this.select._opened()){var e=this.select.dropdown;if(e&&e.attr("data-oj-containerid")===this.select.containerId)return e}return null},_hidePlaceholder:function(e,t){t?(e.attr("disabled",""),e.attr("hidden","")):(e.removeAttr("disabled"),e.removeAttr("hidden"))},_isNative:function(){return"native"===this.options.renderMode&&!v.isReadonly(this)},_cleanup:function(){this.element.parent().parent().hasClass("oj-select-native")?(this.element.off("change"),this.element.hasClass(v.GENERATED_OPTIONS_SELECTOR)&&v.cleanupResults(this.element),this.element.parent().hasClass("oj-text-field-container")&&this.element.unwrap(),this.element.parent().children(".oj-select-arrow").remove(),this._IsCustomElement()||this.element.unwrap(),this.element.removeClass("oj-select-select oj-component-initnode"),this.element.attr({"aria-labelledby":""})):this.select&&(this.select._destroy(),this.select=void 0)},getNodeBySubId:function(e){var i,s=null;if(null==e){var o=this.widget();return o?o[0]:null}if(this._isNative())return null;if(!(s=this._super(e))){var n=this._getDropdown();switch(i=e.subId){case"oj-select-drop":n&&(s=n[0]);break;case"oj-select-results":n&&(s=n.find(".oj-listbox-results")[0]);break;case"oj-select-search":n&&(s=n.find(".oj-listbox-search")[0]);break;case"oj-select-input":case"oj-listbox-input":n&&(s=n.find(".oj-listbox-input")[0]);break;case"oj-select-choice":case"oj-select-chosen":case"oj-select-arrow":s=this.widget().find("."+i)[0];break;case"oj-listitem":if(n){var a=n.find(".oj-listbox-result");s=this.select._findItem(a,e.value)}break;case"oj-select-remove":var l=this.widget().find(".oj-select-selected-choice"),r=this.select._findItem(l,e.value);s=r?t(r).find(".oj-select-clear-entry-icon")[0]:null;break;case"oj-listbox-result-label":if(n){var h=t("#"+this.select.results.attr("id")).children(),c=e.index;h.length&&c<h.length&&(s=h.eq(c).find("."+i)[0])}}}return s||null},getSubIdByNode:function(e){if(this._isNative())return this._super(e);var i=null;if(null!=e){var s=t(e);i=s.hasClass("oj-listbox-input")?{subId:"oj-select-input"}:s.hasClass("oj-select-arrow")?{subId:"oj-select-arrow"}:s.hasClass("oj-listbox-result")?{subId:"oj-listitem",value:s.data("ojselect").value}:s.hasClass("oj-select-clear-entry-icon")?{subId:"oj-select-remove",value:s.closest(".oj-select-selected-choice").data("ojselect").value}:this._super(e)}return i},_GetDefaultStyleClass:function(){return"oj-select"},_GetMessagingLauncherElement:function(){return this.select?this.select.selection:this.element},_GetContentElement:function(){return this.select?this.select.selection:this.element},_GetAriaLabelElement:function(){return this._GetContentElement()[0]}}),l.setDefaultOptions({ojSelect:{displayOptions:{converterHint:["none"]},renderMode:l.createDynamicPropertyGetter(function(){return(n.parseJSONFromFontFamily("oj-select-option-defaults")||{}).renderMode})}}),c={properties:{readonly:{binding:{consume:{name:"readonly"}}},userAssistanceDensity:{binding:{consume:{name:"userAssistanceDensity"}}}}},d.extension._WIDGET_NAME="ojCombobox",d.extension._INNER_ELEM="input",d.extension._GLOBAL_TRANSFER_ATTRS=["aria-controls","aria-label","tabindex"],d.extension._ALIASED_PROPS={readonly:"readOnly"},e.CustomElementBridge.register("oj-combobox-one",{metadata:e.CollectionUtils.mergeDeep(d,c)}),u.extension._WIDGET_NAME="ojCombobox",u.extension._INNER_ELEM="input",u.extension._GLOBAL_TRANSFER_ATTRS=["aria-controls","aria-label","tabindex"],u.extension._ALIASED_PROPS={readonly:"readOnly"},e.CustomElementBridge.register("oj-combobox-many",{metadata:e.CollectionUtils.mergeDeep(u,c)}),f.extension._WIDGET_NAME="ojSelect",f.extension._INNER_ELEM="select",f.extension._GLOBAL_TRANSFER_ATTRS=["aria-controls","aria-label","tabindex"],f.extension._ALIASED_PROPS={readonly:"readOnly"},e.CustomElementBridge.register("oj-select-one",{metadata:e.CollectionUtils.mergeDeep(f,c)}),p.extension._WIDGET_NAME="ojSelect",p.extension._INNER_ELEM="select",p.extension._GLOBAL_TRANSFER_ATTRS=["aria-controls","aria-label","tabindex"],p.extension._ALIASED_PROPS={readonly:"readOnly"},e.CustomElementBridge.register("oj-select-many",{metadata:e.CollectionUtils.mergeDeep(p,c)})});