function ownKeys(n,t){var i,r=Object.keys(n);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(n),t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})),r.push.apply(r,i)),r}function _objectSpread(n){for(var i,t=1;t<arguments.length;t++)i=null!=arguments[t]?arguments[t]:{},t%2?ownKeys(Object(i),!0).forEach(function(t){_defineProperty(n,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(i,t))});return n}function _defineProperty(n,t,i){return t in n?Object.defineProperty(n,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[t]=i,n}function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _defineProperties(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}function _createClass(n,t,i){return t&&_defineProperties(n.prototype,t),i&&_defineProperties(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n}function CreateFieldViewModel(n,t,i){var r,u=typeof t!="undefined"&&t!=null;if(n.SearchUnitType==_enums.SEARCH_UNIT_TYPE.FieldGroup&&n.Type==_enums.RECORD_FIELD_TYPE.ValidationList)r=new ValidationListsGroupViewModel(n.Options.ValidationListsGroupValues);else if(n.SearchUnitType==_enums.SEARCH_UNIT_TYPE.FieldGroup&&n.Type==_enums.RECORD_FIELD_TYPE.Unknown)r=new SearchFieldViewModel;else switch(n.Type){case _enums.RECORD_FIELD_TYPE.Date:r=new DateSearchFieldViewModel;break;case _enums.RECORD_FIELD_TYPE.ValidationList:r=new ValidationListSearchFieldViewModel;break;case _enums.RECORD_FIELD_TYPE.Integer:r=new IntegerSearchFieldViewModel;break;case _enums.RECORD_FIELD_TYPE.Decimal:r=new DecimalSearchFieldViewModel;break;case _enums.RECORD_FIELD_TYPE.Thesaurus:r=new ThesaurusSearchFieldViewModel(this.AutoAddEmptyThesaurusEntry,this.CurrentControlsMode(),i);this.SearchControlsModeChangedEvent.bind(r.SearchControlsModeChangedEventHandler);break;case _enums.RECORD_FIELD_TYPE.ComplexDate:r=new ComplexDateFieldViewModel;break;case _enums.RECORD_FIELD_TYPE.Section:r=new SectionFieldViewModel(this,n,i);break;case _enums.RECORD_FIELD_TYPE.Rating:r=new RatingFieldViewModel;break;default:r=new SearchFieldViewModel}return r.SetDefaults(),r.InSection=u||!1,r.Field=n,r.SetSearchFieldValue(),r.DefaultConditionalOperator=this.Data.ConditionalOperatorsList[0].Key,n.ConditionalOperator=n.ConditionalOperator?n.ConditionalOperator:r.DefaultConditionalOperator,r.ConditionalOperator(n.ConditionalOperator),r.IsTraverseRequired(n.IsTraverseRequired),r.IsTraverseRequiredCheckBoxVisible(n.IsTraverseAllowed),r.IsSearchRelatedTerms(n.IsSearchRelatedTerms),r.IsSearchRelatedTermsCheckBoxVisible(n.IsSearchRelatedTermsAllowed),r.ActionFieldRemoveId="remove-field-action-"+_utilities.getNextUniqueCounter(),r}function CreateFieldViewModelOptions(n){return $.extend({},{ShowThesaurusScopeNote:!1},n)}function SearchFieldViewModel(){var n=this;Object.defineProperty(this,"Field",{get:function(){return this._field},set:function(n){this._field=n}});Object.defineProperty(this,"Value",{get:function(){return this._value},set:function(n){this._value=n}});Object.defineProperty(this,"ConditionalOperator",{get:function(){return this._condition},set:function(n){this._condition=n}});Object.defineProperty(this,"IsFieldShouldHaveData",{get:function(){return this._isFieldShouldHaveData},set:function(n){this._isFieldShouldHaveData=n}});Object.defineProperty(this,"IsFieldShouldNotHaveData",{get:function(){return this._isFieldShouldNotHaveData},set:function(n){this._isFieldShouldNotHaveData=n}});Object.defineProperty(this,"IsTraverseRequired",{get:function(){return this._isTraverseRequired},set:function(n){this._isTraverseRequired=n}});Object.defineProperty(this,"IsSearchRelatedTerms",{get:function(){return this._isSearchRelatedTerms},set:function(n){this._isSearchRelatedTerms=n}});Object.defineProperty(this,"DefaultConditionalOperator",{get:function(){return this._defaultConditionalOperator},set:function(n){this._defaultConditionalOperator=n}});this.GetViewModel=function(){var n=this.GetValue();return{Id:this.Field.Id,Type:this.Field.Type,SearchUnitType:this.Field.SearchUnitType,LocalisedName:this.Field.LocalisedName,Value:n!==null&&n!==undefined?JSON.stringify(n):null,ConditionalOperator:this.ConditionalOperator(),Options:this.Field.Options,IsFieldShouldNotHaveValue:this.IsFieldShouldNotHaveData(),IsFieldShouldHaveValue:this.IsFieldShouldHaveData(),IsTraverseRequired:this.IsTraverseRequired(),IsSearchRelatedTerms:this.IsSearchRelatedTerms(),IsEmpty:this.IsEmpty(),SectionsViewModel:[]}};this.GetValue=function(){return this.Value().Value()};this.ClearValue=function(){n.Value({Value:ko.observable(null)});n.ConditionalOperator(this.DefaultConditionalOperator)};this.IsEmpty=function(){var n=this.GetValue(),t=n===null||n===undefined||n===""||n.Value===null||n.Value==="";return t?this.IsFieldShouldHaveData()===undefined&&this.IsFieldShouldNotHaveData()===undefined?!0:this.IsFieldShouldHaveData()===undefined&&this.IsFieldShouldNotHaveData()===!1?!0:this.IsFieldShouldHaveData()===!1&&this.IsFieldShouldNotHaveData()===undefined?!0:this.IsFieldShouldHaveData()===!1&&this.IsFieldShouldNotHaveData()===!1?!0:!1:!1};this.GetAdvancedViewTemplateName=function(){return"advanced-default-field-template"};this.BorderHighlightClass=function(){try{if(this.IsEmpty())return" border-left-blue"}catch(n){}return" border-left-green"}}function NumbersRangeFieldViewModel(){Object.defineProperty(this,"SpinnerTo",{get:function(){return this.spinnerTo},set:function(n){this.spinnerTo=n}});Object.defineProperty(this,"SpinnerFrom",{get:function(){return this.spinnerFrom},set:function(n){this.spinnerFrom=n}});this.GetSimpleViewTemplateName=function(){return"simple-integer-template"};this.OnSpinnerFromNumberChange=function(n){var t=$(n.spinnerFrom).val();t===""?(this.SpinnerFrom.val(null),this.Value().NumberFrom(null)):_utilities.isPositiveInt(t)?(this.SpinnerFrom.val(t),this.Value().NumberFrom(t),this.Value().SearchSingle()&&this.Value().NumberTo(t)):_utilities.isNegativeInt(t)?(this.SpinnerFrom.val(t),this.Value().NumberFrom(t),this.Value().SearchSingle()&&this.Value().NumberTo(t)):($(this).focus(),this.Value().NumberFrom(null),window._toast.error(commonLocalizations.EnterCorrectNumber))};this.OnSpinnerToNumberChange=function(n){var t=$(n.spinnerTo).val();t===""?(this.Value().NumberTo(null),this.SpinnerTo.val(null)):_utilities.isPositiveInt(t)?(this.Value().NumberTo(t),this.SpinnerTo.val(t)):_utilities.isNegativeInt(t)?(this.Value().NumberTo(t),this.SpinnerTo.val(t)):($(this).focus(),this.Value().NumberTo(null),window._toast.error(commonLocalizations.EnterCorrectNumber))};this.InitSpinnerFrom=function(n){this.Value().SearchSingle.subscribe(function(n){if(n){var i=t.SpinnerFrom.val();t.SpinnerTo[0].disabled=!0;t.SpinnerTo.val(i);t.Value().NumberTo(i)}else t.SpinnerTo[0].disabled=!1;return!0});var t=this,i=_templates.ace_spinner.GetDefaultOptions({allowEmpty:!0,step:t.GetStep(),min:-9999999999999,max:Number.MAX_VALUE});this.SpinnerFrom=$(n).ace_spinner(i);$(n).closest(".ace-spinner").addClass("w-100");$(n).closest(".ace-spinner").bind("changed.fu.spinbox",function(){if(t.Value().SearchSingle())t.SpinnerTo.val(t.SpinnerFrom.val());else{var n=t.Value().NumberTo();n!=null&&n<t.Value().NumberFrom()&&t.Value().NumberTo(t.Value().NumberFrom())}})};this.InitSpinnerTo=function(n){var t=this,i=_templates.ace_spinner.GetDefaultOptions({allowEmpty:!0,step:t.GetStep(),min:-9999999999999,max:Number.MAX_VALUE});this.SpinnerTo=$(n).ace_spinner(i);$(n).closest(".ace-spinner").addClass("w-100");$(n).closest(".ace-spinner").bind("changed.fu.spinbox",function(){var n=t.Value().NumberFrom();n!=null&&t.Value().NumberTo()<t.Value().NumberFrom()&&t.Value().NumberFrom(t.Value().NumberTo())})};this.GetNumberFormat=function(){return""};this.GetDecimals=function(){return 0};this.GetStep=function(){return 1};this.SetSearchFieldValue=function(){var n=null;this.Field&&this.Field.Value&&(n=$.parseJSON(this.Field.Value));var t=n?n.NumberFrom:null,i=n?n.NumberTo:null,r=n?n.SearchSingle:!1;this.Value=ko.observable({NumberFrom:ko.observable(t),NumberTo:ko.observable(i),SearchSingle:ko.observable(r)})};this.SetValue=function(n,t){var i=n[0];if("IsFieldShouldHaveValue"in i&&"IsFieldShouldNotHaveValue"in i){this.IsFieldShouldHaveData(i.IsFieldShouldHaveValue);this.IsFieldShouldNotHaveData(i.IsFieldShouldNotHaveValue);this.ConditionalOperator(t);return}this.Value().NumberFrom(i.NumberFrom);this.Value().NumberTo(i.NumberTo);this.Value().SearchSingle(i.SearchSingle);this.ConditionalOperator(t)};this.GetValue=function(){return this.Value().NumberFrom()===null?null:ko.toJS(this.Value)};this.ClearValue=function(){this.Value().NumberFrom(null);this.Value().NumberTo(null);this.Value().SearchSingle(!1);this.ConditionalOperator(this.DefaultConditionalOperator);this.IsFieldShouldHaveData(!1);this.IsFieldShouldNotHaveData(!1)}}function ThesaurusSearchFieldViewModel(n,t,i){function o(){var n,t;r.ControlsMode=_enums.SEARCH_CONTROLS_MODE.SimpleControls;n=r.Value().valuesArray();r.Value().valueText(e(n));t="#SearchFields_"+r.Field.SearchUnitType+"-"+r.Field.Id+"_Value";r.InitAutocomplete($(t))}function s(){r.ControlsMode=_enums.SEARCH_CONTROLS_MODE.AdvancedControls;var n=r.Value().valueText(),t=h(n);r.Value().valuesArray(t);f()}function e(n){var t="",u=function(n,t){var r=[],f,u,e,i,o;if(!n||n.length==0)return r;for(let s=0;s<n.length;s++)if((f=n[s],f.ConditionalOperator()==t)&&(u=f.TermText().trim(),u)){e=f.ThesaurusSearchType();e&&(e=+e);switch(e){case _enums.THESAURUS_SEARCH_TYPE.AllOfTheseWords:if(i=f.TermText().trim(),i.endsWith("!")&&i.startsWith('"')&&i.trim("!").endsWith('"')){r.push(i);continue}if(i.startsWith('"')&&i.endsWith('"')){r.push(i);continue}if(i.indexOf("OR ")!==-1||i.indexOf("AND ")!==-1||i.indexOf("NOT ")!==-1){i.startsWith("OR ")&&(i=i.substr(3));(i.startsWith("AND ")||i.startsWith("NOT "))&&(i=i.substr(4));r.push(i);continue}o=i.split(" ");for(let n=0;n<o.length;n++)o[n]&&r.push(o[n]);break;case _enums.THESAURUS_SEARCH_TYPE.ExactMatching:r.push('"'+u+'"');break;case _enums.THESAURUS_SEARCH_TYPE.StartWith:u.indexOf(" ")!==-1?u='"'+u+'!"':u+="!";r.push(u)}}return r},o=u(n,_enums.CONDITIONAL_OPERATOR.AND),f=u(n,_enums.CONDITIONAL_OPERATOR.OR),e=u(n,_enums.CONDITIONAL_OPERATOR.NOT),i,r;for(let n=0;n<o.length;n++)t&&(t+=" AND "),t+=o[n];i=!1;!t&&f.length>0&&(t="OR ",i=!0);for(let n=0;n<f.length;n++)!i&&t?t+=" OR ":i=!1,t+=f[n];r=!1;!t&&e.length>0&&(t="NOT ",r=!0);for(let n=0;n<e.length;n++)!r&&t?t+=" NOT ":r=!1,t+=e[n];return t.trim()}function h(n){var u=[],t,r,f,o,s,l;if(!n)return u;n=n.replace(/ AND /gi,"(|) AND ");n=n.replace(/ OR /gi,"(|) OR ");n=n.replace(/ NOT /gi,"(|) NOT ");var a=function(n,t,i){return{Operator:n||_enums.CONDITIONAL_OPERATOR.AND,SearchType:t||_enums.THESAURUS_SEARCH_TYPE.AllOfTheseWords,Value:i||""}},i=[],e=n.split("(|)");if(!e||e.length===0)return u;for(let n=0;n<e.length;n++){t=e[n].trim();r="";(t.startsWith("AND")||t.startsWith("OR")||t.startsWith("NOT"))&&(r=t.substr(0,t.indexOf(" ")));r?(t=t.substr(r.length),t=t.trim()):r="AND";f=_enums.CONDITIONAL_OPERATOR.AND;switch(r){case"AND":f=_enums.CONDITIONAL_OPERATOR.AND;break;case"OR":f=_enums.CONDITIONAL_OPERATOR.OR;break;case"NOT":f=_enums.CONDITIONAL_OPERATOR.NOT;break;default:throw new Error("ThesaurusSearchFieldViewModel/getAdvancedValuesBySimpleCondition: unvalid operatorStr");}o=_enums.THESAURUS_SEARCH_TYPE.AllOfTheseWords;t.endsWith("!")||t.startsWith('"')&&t.endsWith('!"')?(t.endsWith("!")?t=t.substr(0,t.length-1):(t=t.substr(0,t.length-2),t=t.substr(1)),o=_enums.THESAURUS_SEARCH_TYPE.StartWith):t.startsWith('"')&&t.endsWith('"')&&(t=t.substr(0,t.length-1),t=t.substr(1),o=_enums.THESAURUS_SEARCH_TYPE.ExactMatching);i.push(new a(f,o,t))}if(i.length===0)return u;for(let n=0;n<i.length;n++){var h=i[n].Value,v=i[n].Operator,c=i[n].SearchType;if(c===_enums.THESAURUS_SEARCH_TYPE.AllOfTheseWords&&n<i.length-1){s=0;for(let t=n+1;t<i.length;t++){if(i[n].Operator!==i[t].Operator||i[n].SearchType!==i[t].SearchType){s!==0&&(n=n+s);break}s++;h+=" "+i[t].Value;t===i.length-1&&(n=t)}}l=new SelectedTermsModel(null,h,v,c);u.push(l)}return u}function c(n,t){if(!t||!n||n.length==0)return null;for(let r=0;r<n.length;r++){var i=n[r].Values;if(i&&i.length!=0)for(let n=0;n<i.length;n++)if(i[n].Value==t)return i[n].Key}return null}function l(){var t=[],n;for(let i=0;i<r.Value().valuesArray().length;i++)(n=r.Value().valuesArray()[i],n.TermId!=null)&&t.push(n);return t}function f(){var n=!1;ko.utils.arrayForEach(r.Value().valuesArray(),function(t){t.TermId==null&&t.TermText()===""&&(n=!0)});(r.Value().valuesArray().length===0||!n&&r.AutoAddEmptyEntry)&&r.Value().valuesArray.push(u(r.Field.Options.ConditionMatchType))}function u(n){var t=new SelectedTermsModel;return t.ThesaurusSearchType(n),t}var r=this,a=new RegExp(/[$^&_+~=`{}<>\/#*]|(^$)/);this.ControlsMode=t;this.AutoAddEmptyEntry=n;this.ShowThesaurusScopeNote=i.ShowThesaurusScopeNote;this.GetSimpleViewTemplateName=function(){return"simple-thesaurus-template"};this.GetAdvancedViewTemplateName=function(){return"advanced-thesaurus-template"};this.SearchControlsModeChangedEventHandler=function(n){n.mode===_enums.SEARCH_CONTROLS_MODE.SimpleControls&&o();n.mode===_enums.SEARCH_CONTROLS_MODE.AdvancedControls&&s()};this.OpenThesaurus=function(n,t){var i=new ButtonLoadingAndLock($(t.currentTarget)),u=new SelectTermsDialogOptions({Callback:{BeforeLoadLayout:function(){i.Lock()},AfterLoadLayout:function(){i.UnLock()},Success:function(n){var s,h,o,t,i,e,u,c;if(r.Field.Options.MultiValueMode==3){if(s=r.GetValue(),r.ClearValue(),h={Processed:!1,FieldID:r.Field.Id,Terms:n},h.Processed)return;r.SetValue(s)}for(o=[],t=n.length-1;t>=0;t--){for(i=new SelectedTermsModel(n[t].TermId),i.TermText(n[t].TermText().trim()),i.ConditionalOperator(n[t].ConditionalOperator()),i.ThesaurusSearchType(_enums.THESAURUS_SEARCH_TYPE.ExactMatching),r.Value().valuesArray.contains(i)||r.Value().valuesArray.unshift(i),e=r.Value().valuesArray(),u=0;u<e.length;u++)if(e[u].TermId===n[t].TermId&&e[u].ConditionalOperator()!==n[t].ConditionalOperator()){r.Value().valuesArray.remove(r.Value().valuesArray()[u]);r.Value().valuesArray.unshift(i);break}o.push(n[t].TermId)}c=r.Value().valuesArray().slice(0);ko.utils.arrayForEach(c,function(n){n.TermId!=null&&o.indexOf(n.TermId)==-1&&r.Value().valuesArray.remove(n);n.TermId!=null||n.TermText()!==""||r.AutoAddEmptyEntry||r.Value().valuesArray.remove(n)});f()}},SelectedTerms:l(),FieldTitle:r.Field.LocalisedName,ThesaurusId:r.Field.Options.ThesaurusId,ShowConditionalOperators:!0}),e=new SelectTermsDialogUtilities;e.Open(u)};this.InitAutocomplete=function(n,t){if(r.Field.Options.SuggestionEnabled){var i=r.ControlsMode==1?$(t):$(n),u=n,e=r.Field.SearchUnitType==_enums.SEARCH_UNIT_TYPE.Field?r.Field.Id:null,o=_enums.SEARCH_UNIT_TYPE.FieldGroup?r.Field.Id:null,f={search:function(){return _api.getSearchFieldsQuery(f.phrase,e,o)},"used-only":!0,"include-issue":window.soutronContext.Suggest.IncludeIssueRecords,limit:window.soutronContext.Suggest.SuggestionRecords,"ordered-only":!1,lang:window.soutronContext.Lcid,portal:window.soutronContext.OpacId,format:"json"};$(i).typeahead({minLength:2,order:"asc",hint:!0,delay:1e3,maxItem:window.soutronContext.Suggest.SuggestionRecords,dynamic:!0,template:"{{title}}",emptyTemplate:window.commonLocalizations.CannotFind+' "{{query}}", '+window.commonLocalizations.PleaseTryAgain+'."',display:["title","id"],correlativeTemplate:!0,source:{Items:{url:[{url:window.soutronContext.Api.CataloguesSuggestionLink,type:"GET",contentType:"application/json",dataType:"json",cache:!1,data:f,beforeSend:function(n,t){window._controls.typeahead.createLoading(i);n.setRequestHeader("LmsApiToken",window.soutronContext.Api.ProtectToken);t.data=f},callback:{done:function(n){var u,i,t,f,o,e;if(n.items==undefined||n.items.length==0)return[];for(u=[],i=0;i<n.items.length;i++)if(t=n.items[i],t.termId!=""){f=!1;for(let n=0;n<r.Value().valuesArray().length;n++)if(o=r.Value().valuesArray()[n].TermId,o===t.termId){f=!0;break}f||(e=t.title,t.titleAltern&&(e+=" ("+t.titleAltern+")"),u.push({title:e,titleTerm:t.title,id:t.termId}))}return u},complete:function(){window._controls.typeahead.destroyLoading(i)},fail:function(n,t){window._toast.error(t)}}}]}},callback:{onClick:function(n,t,i){u&&(r.ControlsMode==1&&(u.TermId=i.id,u.TermText(i.titleTerm),u.ThesaurusSearchType(_enums.THESAURUS_SEARCH_TYPE.ExactMatching)),r.Value().valueText(i.title))}}});$(i).keyup(function(){f.phrase=$(i).val()});$(i).parent().soutronTooltip("toggle",{placement:"right"})}};this.RemoveTerm=function(n){var t;ko.utils.arrayForEach(r.Value().valuesArray(),function(i){(i.TermId!=null&&i.TermId==n.TermId||i.TermId==null&&i.TermText()==n.TermText())&&(t=i)});ko.utils.arrayRemoveItem(r.Value().valuesArray(),t);r.Value().valuesArray.valueHasMutated();f()};this.AppendEmptyTerm=function(){r.Value().valuesArray.push(u(r.Field.Options.ConditionMatchType))};this.RemovingTermAvailable=function(n,t){return!(n==null&&t()=="")};this.GetAvailableThesaurusSearchTypes=function(n,t){if(t.TermId)return n;return n.slice(0)};this.SetSearchFieldValue=function(){this.Value=ko.observable({valuesArray:ko.observableArray([u(this.Field.Options.ConditionMatchType)]),valueText:ko.observable("")});this.Value().valuesArray.contains=function(n){for(let t=0;t<this().length;t++)if(this()[t].TermId==n.TermId)return!0;return!1}};this.SetValue=function(n,t,i){var f,l,a,v;if(r.ConditionalOperator(t),n.length!==0){if(f=[],i&&i.Items){for(let t=0;t<i.Items.length;t++){var u=i.Items[t],o="",h=_enums.CONDITIONAL_OPERATOR.AND,s=_enums.THESAURUS_SEARCH_TYPE.ExactMatching;if(u.hasOwnProperty("Value")&&u.hasOwnProperty("ThesaurusSearchType")&&u.hasOwnProperty("ConditionalOperator"))o=u.Value||"",h=u.ConditionalOperator,s=u.ThesaurusSearchType;else if(u.hasOwnProperty("Attributes"))for(let n=0;n<u.Attributes.length;n++)switch(u.Attributes[n].Name){case"value":o=u.Attributes[n].Value||"";break;case"type":s=u.Attributes[n].Value;break;case"op":h=u.Attributes[n].Value}else throw new Error("ThesaurusSearchFieldViewModel/SetValue: unvalid thesaurus original condition");l=null;s==_enums.THESAURUS_SEARCH_TYPE.ExactMatching&&(l=c(n,o));a=new SelectedTermsModel(l,o,h,s);f.push(a)}"IsFieldShouldHaveValue"in i&&"IsFieldShouldNotHaveValue"in i&&(r.IsFieldShouldHaveData(i.IsFieldShouldHaveValue),r.IsFieldShouldNotHaveData(i.IsFieldShouldNotHaveValue))}r.Value().valuesArray(f);v=e(f);r.Value().valueText(v)}};this.GetValue=function(){var n=ko.observableArray([]),i,t;switch(this.ControlsMode){case _enums.SEARCH_CONTROLS_MODE.SimpleControls:return(i=r.Value().valueText(),!i)?null:(n.push(new SelectedTermsModel(null,i,_enums.CONDITIONAL_OPERATOR.OR,null)),ko.toJS(n));case _enums.SEARCH_CONTROLS_MODE.AdvancedControls:for(let i=0;i<r.Value().valuesArray().length;i++)t=this.Value().valuesArray()[i],(t.TermId!=null||t.TermText()!=="")&&n.push(t);return n().length<=0?null:ko.toJS(n)}return null};this.ClearValue=function(){r.Value().valuesArray([u(r.Field.Options.ConditionMatchType)]);r.Value().valueText("");r.ConditionalOperator(r.DefaultConditionalOperator);r.IsFieldShouldHaveData(!1);r.IsFieldShouldNotHaveData(!1)}}function DateSearchFieldViewModel(){Object.defineProperty(this,"CurrentDateMode",{get:function(){return this._currentDateMode},set:function(n){this._currentDateMode=n}});Object.defineProperty(this,"SearchDateComponent",{get:function(){return this._searchDateComponent},set:function(n){this._searchDateComponent=n}});var r,t,i,n=this;this.GetDateViewTemplate=function(){switch(n.CurrentDateMode()){case _enums.DATE_MODE.DatesRange:return"datesrange-template";case _enums.DATE_MODE.Period:return"dateperiod-template";default:return"exactdate-template"}};this.GetSimpleViewTemplateName=function(){return"simple-date-template"};this.GetAdvancedViewTemplateName=function(){return"advanced-date-template"};this.SetSearchFieldValue=function(){var t=null,i;this.Field&&this.Field.Value&&(t=$.parseJSON(this.Field.Value));i=t!==null&&t!==undefined&&t.DateMode!==null?t.DateMode:null;this.CurrentDateMode=i!=null?ko.observable(i):this.Field.Options.DateMode!==null?ko.observable(this.Field.Options.DateMode):ko.observable(_enums.DATE_MODE.ExactDate);this.Value=t===null||t===undefined?ko.observable({DateFrom:ko.observable(),DateTo:ko.observable(),DateMode:n.CurrentDateMode(),IsEmpty:function(){return this.DateFrom()===null||this.DateFrom()===undefined}}):ko.observable({DateFrom:ko.observable(t.DateFrom),DateTo:ko.observable(t.DateTo),FrequencyPeriod:ko.observable(t.FrequencyPeriod),PeriodsCount:ko.observable(t.PeriodsCount),DateMode:this.CurrentDateMode(),IsEmpty:function(){return!1}});this.CurrentDateMode.subscribe(function(t){var i=typeof n.Value().DateFrom=="function"?n.Value().DateFrom():null,r=typeof n.Value().DateTo=="function"?n.Value().DateTo():null;switch(t){case _enums.DATE_MODE.DatesRange:r||(i=null,r=null);n.Value=ko.observable({DateFrom:ko.observable(i),DateTo:ko.observable(r),DateMode:t,IsEmpty:function(){return!this.DateFrom()&&!this.DateTo()}});break;case _enums.DATE_MODE.Period:n.Value=ko.observable({FrequencyPeriod:ko.observable(),PeriodsCount:ko.observable(),DateMode:t,IsEmpty:function(){return!1}});break;default:n.Value=ko.observable({DateFrom:ko.observable(i),DateMode:t,IsEmpty:function(){return!this.DateFrom()}})}})};this.Init=function(t){r=$(t).soutronDatepicker({opens:"bottom",containerMode:"input",allowEmpty:!0,startDate:null,endDate:null,change:function(t){n.Value().DateFrom(t)}})};this.InitDatePickerFrom=function(r){t=$(r).soutronDatepicker({opens:"bottom",containerMode:"input",allowEmpty:!0,startDate:null,endDate:null,change:function(t){i&&i.data("daterangepicker")&&i.data("daterangepicker").setMinDate(t);n.Value().DateFrom(t)}})};this.InitDatePickerTo=function(r){i=$(r).soutronDatepicker({opens:"bottom",containerMode:"input",allowEmpty:!0,startDate:null,endDate:null,change:function(i){t&&t.data("daterangepicker")&&t.data("daterangepicker").setMaxDate(i);n.Value().DateTo(i)}})};this.SetValue=function(n,u){var f=n[0],s,e,o;this.CurrentDateMode(f.DateMode);this.CurrentDateMode()==_enums.DATE_MODE.ExactDate?(s=moment(f.Date),this.Value().DateFrom(s),r.data("daterangepicker").setDate(s)):this.CurrentDateMode()==_enums.DATE_MODE.DatesRange?(e=moment(f.DateFrom),o=moment(f.DateTo),this.Value().DateFrom(e),this.Value().DateTo(o),t.data("daterangepicker").setDate(e),t.data("daterangepicker").setMaxDate(o),i.data("daterangepicker").setDate(o),i.data("daterangepicker").setMinDate(e)):this.CurrentDateMode()==_enums.DATE_MODE.Period&&(this.Value().FrequencyPeriod(f.FrequencyPeriod),this.Value().PeriodsCount(f.PeriodsCount));this.ConditionalOperator(u)};this.GetValue=function(){var i,n,t;return this.Value()===null||this.Value().IsEmpty()?null:this.CurrentDateMode()==_enums.DATE_MODE.ExactDate?(i=this.Value().DateFrom(),!i||!i._isValid)?null:ko.toJS({YearFrom:i.year(),MonthFrom:i.month()+1,DayFrom:i.date(),DateMode:this.CurrentDateMode(),IsEmpty:function(){return this.YearFrom!==null||this.YearFrom!==undefined||this.YearFrom!==""?!1:!0}}):this.CurrentDateMode()==_enums.DATE_MODE.DatesRange?(n=this.Value().DateFrom(),t=this.Value().DateTo(),ko.toJS({YearFrom:n?n.year():null,MonthFrom:n?n.month()+1:null,DayFrom:n?n.date():null,YearTo:t?t.year():null,MonthTo:t?t.month()+1:null,DayTo:t?t.date():null,DateMode:this.CurrentDateMode(),IsEmpty:function(){return this.YearFrom!==null&&this.YearFrom!==undefined&&this.YearFrom!==""&&this.YearTo!==null&&this.YearTo!==undefined&&this.YearTo!==""?!1:!0}})):this.CurrentDateMode()==_enums.DATE_MODE.Period?ko.toJS({FrequencyPeriod:this.Value().FrequencyPeriod(),PeriodsCount:this.Value().PeriodsCount(),DateMode:this.CurrentDateMode(),IsEmpty:function(){return!1}}):null};this.IsEmpty=function(){return this.Value()===null||this.Value().IsEmpty()?!0:!1};this.ClearValue=function(){n.ConditionalOperator(n.DefaultConditionalOperator);n.CurrentDateMode(3);r&&r.data("daterangepicker")&&r.data("daterangepicker").setDate(null);t&&t.data("daterangepicker")&&t.data("daterangepicker").setDate(null);i&&i.data("daterangepicker")&&i.data("daterangepicker").setDate(null);n.Value().DateFrom&&n.Value().DateFrom()&&n.Value().DateFrom(null);n.Value().DateTo&&n.Value().DateTo()&&n.Value().DateTo(null)}}function ComplexDateFieldViewModel(){function r(n,t){var u,r,i;if(!n||!t)return e();for(u=new Date(t,n,0).getDate(),r=[],r.push({Key:null,Value:""}),i=1;i<=u;i++)r.push({Key:i,Value:i});return r}function e(){var t=[],n;for(t.push({Key:null,Value:""}),n=1;n<=31;n++)t.push({Key:n,Value:n});return t}function o(){n.Value().DayFrom()>=n.DaysFrom().length&&n.Value().DayFrom(n.DaysFrom()[n.DaysFrom().length-1].Value)}function s(){n.Value().DayTo()>=n.DaysTo().length&&n.Value().DayTo(n.DaysTo()[n.DaysTo().length-1].Value)}function f(n,t,i,r){var u=null;return t&&i&&r?u=moment({year:r,month:i-1,day:t}):i&&r?u=moment({year:r,month:i-1,day:1}):t&&(u=moment({year:r,month:11,day:1})),n&&n.data("daterangepicker")&&n.data("daterangepicker").setViewDate(u),u}function u(){var t=n.Value().DateGroupId();return ko.utils.arrayFirst(n.DateGorupList(),function(n){return n.EntityID===t})}var n=this,i,t;this.DaysFrom=ko.observable();this.DaysTo=ko.observable();this.GetDateViewTemplate=function(){switch(n.CurrentDateMode()){case _enums.DATE_MODE.DatesRange:return"complex-dates-range-template";case _enums.DATE_MODE.Period:return"dateperiod-template";case _enums.DATE_MODE.DateGroup:return"complex-dates-range-template";default:return"complex-exact-date-template"}};this.GetSimpleViewTemplateName=function(){return"simple-date-template"};this.GetAdvancedViewTemplateName=function(){return"advanced-date-complex-template"};this.InitDatePickerFrom=function(u){i=$(u).soutronDatepicker({opens:"left",containerMode:"input",onlyTrigger:!0,focusEl:$(u).closest('[data-soutron="group-controls"]').find('[data-soutron="year"]'),allowEmpty:!0,startDate:null,endDate:null,templates:{templateContainer:"<span><\/span>"},change:function(i){var u=i;if(!u){n.Value().YearFrom("");n.Value().MonthFrom(null);n.Value().DayFrom(null);t&&t.data("daterangepicker")&&t.data("daterangepicker").setMinDate(null);return}var o=u.date(),f=u.month()+1,e=u.year();n.Value().DayFrom(o);n.Value().MonthFrom(f);n.Value().YearFrom(e);n.DaysFrom(r(f,e));n.Value().DateGroupId(null);t&&t.data("daterangepicker")&&t.data("daterangepicker").setMinDate(u)}});var f=n.Value().DayFrom(),o=n.Value().MonthFrom(),s=n.Value().YearFrom();f&&o&&s?i.data("daterangepicker").setViewDate(moment({year:s,month:o-2,day:f})):i.data("daterangepicker").setViewDate(moment());this.DaysFrom(e())};this.InitDatePickerTo=function(u){var f;t=$(u).soutronDatepicker({opens:"left",containerMode:"input",onlyTrigger:!0,focusEl:$(u).closest('[data-soutron="group-controls"]').find('[data-soutron="year"]'),allowEmpty:!0,startDate:null,endDate:null,templates:{templateContainer:"<span><\/span>"},change:function(t){var u;if(i.data("daterangepicker").setMaxDate(t),u=t,!u){n.Value().YearTo("");n.Value().MonthTo(null);n.Value().DayTo(null);i.data("daterangepicker").setMaxDate(null);return}var o=u.date(),f=u.month()+1,e=u.year();n.Value().DayTo(o);n.Value().MonthTo(f);n.Value().YearTo(e);n.DaysTo(r(f,e));n.Value().DateGroupId(null)}});f=i.data("daterangepicker").minDate;t.data("daterangepicker").setMinDate(f);var o=n.Value().DayTo(),s=n.Value().MonthTo(),h=n.Value().YearTo();o&&s&&h?t.data("daterangepicker").setViewDate(moment({year:h,month:s-2,day:o})):t.data("daterangepicker").setViewDate(moment());this.DaysTo(e())};this.SectionFromChanged=function(){var a,s;n.Value().YearFrom()&&(a=/^[0-9]+$/,(!a.test(n.Value().YearFrom())||parseInt(n.Value().YearFrom())<0||parseInt(n.Value().YearFrom())>2100)&&n.Value().YearFrom(""));var c=n.Value().DayFrom(),f=n.Value().MonthFrom(),u=n.Value().YearFrom(),l=n.Value().DayTo(),h=n.Value().MonthTo(),e=n.Value().YearTo();if(c&&l&&f&&h&&u&&e){if(parseInt(u)>parseInt(e)||parseInt(u)==parseInt(e)&&f>h||parseInt(u)==parseInt(e)&&f==h&&c>l){n.Value().YearTo("");n.Value().MonthTo(null);n.Value().DayTo(null);s=moment({year:u,month:f-1,day:c});i.data("daterangepicker").setMaxDate(null);i.data("daterangepicker").setViewDate(s.clone());t&&t.data("daterangepicker")&&(t.data("daterangepicker").setMinDate(s.clone()),t.data("daterangepicker").setViewDate(s.clone()));return}}else if(f&&h&&u&&e){if(parseInt(u)>parseInt(e)||parseInt(u)==parseInt(e)&&f>h){n.Value().YearTo("");n.Value().MonthTo(null);s=moment({year:u,month:f-1,day:1});i.data("daterangepicker").setMaxDate(null);i.data("daterangepicker").setViewDate(s.clone());t&&t.data("daterangepicker")&&(t.data("daterangepicker").setMinDate(s.clone()),t.data("daterangepicker").setViewDate(s.clone()));return}}else if(u&&e&&parseInt(u)>parseInt(e)){n.Value().YearTo("");s=moment({year:u,month:0,day:1});i.data("daterangepicker").setMaxDate(null);i.data("daterangepicker").setViewDate(s.clone());t&&t.data("daterangepicker")&&(t.data("daterangepicker").setMinDate(s.clone()),t.data("daterangepicker").setViewDate(s.clone()));return}if(c&&f&&u){i.data("daterangepicker").setViewDate(moment({year:u,month:f-1,day:c}));t&&t.data("daterangepicker")&&(t.data("daterangepicker").setMinDate(moment({year:u,month:f-1,day:c})),l||h||e||t.data("daterangepicker").setDate(moment({year:u,month:f-1,day:c})));return}if(f&&u){n.DaysFrom(r(f,u));o();i.data("daterangepicker").setViewDate(moment({year:u,month:f-1,day:1}));t&&t.data("daterangepicker")&&t.data("daterangepicker").setMinDate(moment({year:u,month:f-1,day:1}));return}if(u){i.data("daterangepicker").setViewDate(moment({year:u,month:0,day:1}));t&&t.data("daterangepicker")&&t.data("daterangepicker").setMinDate(moment({year:u,month:0,day:1}));return}if(l&&h&&e){i.data("daterangepicker").setMaxDate(moment({year:e,month:h-1,day:l}));t&&t.data("daterangepicker")&&t.data("daterangepicker").setMinDate(null);return}i.data("daterangepicker").setMaxDate(null);t&&t.data("daterangepicker")&&t.data("daterangepicker").setMinDate(null)};this.SectionToChanged=function(){var a,o;n.Value().YearTo()&&(a=/^[0-9]+$/,(!a.test(n.Value().YearTo())||parseInt(n.Value().YearTo())<0||parseInt(n.Value().YearTo())>2100)&&n.Value().YearTo(""));var l=n.Value().DayFrom(),c=n.Value().DayTo(),h=n.Value().MonthFrom(),e=n.Value().YearFrom(),f=n.Value().MonthTo(),u=n.Value().YearTo();if(l&&c&&h&&f&&e&&u){if(parseInt(e)>parseInt(u)||parseInt(e)==parseInt(u)&&h>f||parseInt(e)==parseInt(u)&&h==f&&l>c){n.Value().YearFrom("");n.Value().MonthFrom(null);n.Value().DayFrom(null);o=moment({year:u,month:f-1,day:c});i.data("daterangepicker").setMaxDate(o.clone());i.data("daterangepicker").setViewDate(o.clone());t.data("daterangepicker").setViewDate(o.clone());t.data("daterangepicker").setMinDate(null);return}}else if(h&&f&&e&&u){if(parseInt(e)>parseInt(u)||parseInt(e)==parseInt(u)&&h>f){n.Value().YearFrom("");n.Value().MonthFrom(null);o=moment({year:u,month:f-1,day:1});i.data("daterangepicker").setMaxDate(o.clone());i.data("daterangepicker").setViewDate(o.clone());t.data("daterangepicker").setViewDate(o.clone());t.data("daterangepicker").setMinDate(null);return}}else if(e&&u&&parseInt(e)>parseInt(u)){n.Value().YearFrom("");o=moment({year:u,month:0,day:1});i.data("daterangepicker").setMaxDate(o.clone());i.data("daterangepicker").setViewDate(o.clone());t.data("daterangepicker").setViewDate(o.clone());t.data("daterangepicker").setMinDate(null);return}if(c&&f&&u){t.data("daterangepicker").setViewDate(moment({year:u,month:f-1,day:c}));i.data("daterangepicker").setMaxDate(moment({year:u,month:f-1,day:c}));l||h||e||i.data("daterangepicker").setDate(moment({year:u,month:f-1,day:c}));return}if(f&&u){n.DaysTo(r(f,u));s();t.data("daterangepicker").setViewDate(moment({year:u,month:f-1,day:1}));i.data("daterangepicker").setMaxDate(moment({year:u,month:f-1,day:1}));return}if(u){t.data("daterangepicker").setViewDate(moment({year:u,month:0,day:1}));i.data("daterangepicker").setMaxDate(moment({year:u,month:0,day:1}));return}if(l&&h&&e){t.data("daterangepicker").setMinDate(moment({year:e,month:h-1,day:l}));i.data("daterangepicker").setMaxDate(null);return}i.data("daterangepicker").setMaxDate(null);t.data("daterangepicker").setMinDate(null)};this.DateGroupChanged=function(){var t=u();t&&t.EntityID&&(n.yearFrom=t.StartYear,n.monthFrom=t.StartMonth,n.dayFrom=t.StartDay,n.Value().YearFrom(t.StartYear),n.Value().MonthFrom(t.StartMonth),n.Value().DayFrom(t.StartDay),n.yearTo=t.EndYear,n.monthTo=t.EndMonth,n.dayTo=t.EndDay,n.Value().YearTo(t.EndYear),n.Value().MonthTo(t.EndMonth),n.Value().DayTo(t.EndDay),n.SectionFromChanged(),n.SectionToChanged())};this.SetSearchFieldValue=function(){var i=this,e,f,r,t,o;for(this.CurrentDateMode=ko.observable(this.Field.Options.DateMode!==null?this.Field.Options.DateMode:_enums.DATE_MODE.ExactDate),e=this.Field.Options.MonthNames?this.Field.Options.MonthNames:null,f=[],f.push({Key:null,Value:advancedSearchLocalizations.SelectMonthMsg}),r=0;r<e.length-1;r++)f.push({Key:r+1,Value:e[r]});this.ListOfMonth=ko.observable(f);t=null;this.Field&&this.Field.Value&&(t=$.parseJSON(this.Field.Value));var h=t!==null&&t!==undefined?t.YearFrom:"",c=t!==null&&t!==undefined?t.YearTo:"",l=t!==null&&t!==undefined?t.MonthFrom:null,a=t!==null&&t!==undefined?t.MonthTo:null,v=t!==null&&t!==undefined?t.DayFrom:null,y=t!==null&&t!==undefined?t.DayTo:null,p=t!==null&&t!==undefined?t.FrequencyPeriod:null,w=t!==null&&t!==undefined?t.PeriodsCount:null,s=t!==null&&t!==undefined&&t.DateMode!==null?t.DateMode:null;this.CurrentDateMode=s!=null?ko.observable(s):this.Field.Options.DateMode!==null?ko.observable(this.Field.Options.DateMode):ko.observable(_enums.DATE_MODE.ExactDate);this.DateGorupList=ko.observable([]);o=t!==null&&t!==undefined&&t.SearchDateComponent!==null?t.SearchDateComponent:null;this.SearchDateComponent=o!=null?ko.observable(o):this.Field.Options.SearchDateComponent!==null?ko.observable(this.Field.Options.SearchDateComponent):ko.observable(_enums.SEARCH_DATE_MODE_COMPONENTS.FullDate);$.ajax({url:_utilities.getAbsoluteURL("Search/GetActiveDateGroups"),type:"GET",contentType:"application/json, UTF-8",dataType:"json",cache:!1,async:!1,success:function(n){if(!n){i.DateGorupList([]);return}n.unshift({EntityID:null,Description:""});i.DateGorupList(n)}});this.Value=ko.observable({YearFrom:ko.observable(h),YearTo:ko.observable(c),MonthFrom:ko.observable(l),MonthTo:ko.observable(a),DayFrom:ko.observable(v),DayTo:ko.observable(y),DateGroupId:ko.observable(null),FrequencyPeriod:ko.observable(p),PeriodsCount:ko.observable(w),DateMode:this.CurrentDateMode(),IsDateGroupVisible:ko.computed(function(){return n.CurrentDateMode()==_enums.DATE_MODE.DateGroup&&n.DateGorupList().length>1?!0:!1},this)});this.Value().YearFrom.subscribe(function(n){var t=u();t&&t.StartYear!=n&&i.Value().DateGroupId(null)});this.Value().YearTo.subscribe(function(n){var t=u();t&&t.EndYear!=n&&i.Value().DateGroupId(null)});this.Value().MonthFrom.subscribe(function(n){var t=u();t&&t.StartMonth!=n&&i.Value().DateGroupId(null)});this.Value().MonthTo.subscribe(function(n){var t=u();t&&t.EndMonth!=n&&i.Value().DateGroupId(null)});this.Value().DayFrom.subscribe(function(n){var t=u();t&&t.StartDay!=n&&i.Value().DateGroupId(null)});this.Value().DayTo.subscribe(function(n){var t=u();t&&t.EndDay!=n&&i.Value().DateGroupId(null)})};this.SetValue=function(u,e){var o=u[0],v,c,l,a,s,h,y,p;if("IsFieldShouldHaveValue"in o&&"IsFieldShouldNotHaveValue"in o){n.IsFieldShouldHaveData(o.IsFieldShouldHaveValue);n.IsFieldShouldNotHaveData(o.IsFieldShouldNotHaveValue);n.ConditionalOperator(e);return}this.CurrentDateMode(o.DateMode);o.DateMode==_enums.DATE_MODE.ExactDate&&(a=o.Day?o.Day:null,s=o.Month?o.Month:null,h=o.Year?o.Year:"",this.Value().DayFrom(a),this.Value().MonthFrom(s),this.Value().YearFrom(h),h&&s&&this.DaysFrom(r(s,h)));o.DateMode==_enums.DATE_MODE.DatesRange&&(v=o.DayTo?o.DayTo:null,c=o.MonthTo?o.MonthTo:null,l=o.YearTo?o.YearTo:"",a=o.DayFrom?o.DayFrom:null,s=o.MonthFrom?o.MonthFrom:null,h=o.YearFrom?o.YearFrom:"",this.Value().DayFrom(a),this.Value().MonthFrom(s),this.Value().YearFrom(h),this.Value().DayTo(v),this.Value().MonthTo(c),this.Value().YearTo(l),h&&s&&this.DaysFrom(r(s,h)),l&&c&&n.DaysTo(r(c,l)),y=f(i,a,s,h),p=f(t,v,c,l),y&&t&&t.data("daterangepicker")&&t.data("daterangepicker").setMinDate(y),p&&i&&i.data("daterangepicker")&&i.data("daterangepicker").setMaxDate(p));o.DateMode==_enums.DATE_MODE.Period&&(this.Value().FrequencyPeriod(o.FrequencyPeriod),this.Value().PeriodsCount(o.PeriodsCount));o.DateMode==_enums.DATE_MODE.DateGroup&&(v=o.DayTo?o.DayTo:null,c=o.MonthTo?o.MonthTo:null,l=o.YearTo?o.YearTo:"",a=o.DayFrom?o.DayFrom:null,s=o.MonthFrom?o.MonthFrom:null,h=o.YearFrom?o.YearFrom:"",this.Value().DayFrom(a),this.Value().MonthFrom(s),this.Value().YearFrom(h),this.Value().DayTo(v),this.Value().MonthTo(c),this.Value().YearTo(l),h&&s&&this.DaysFrom(r(s,h)),l&&c&&n.DaysTo(r(c,l)),y=f(i,a,s,h),p=f(t,v,c,l),y&&t&&t.data("daterangepicker")&&t.data("daterangepicker").setMinDate(y),p&&i&&i.data("daterangepicker")&&i.data("daterangepicker").setMaxDate(p),this.Value().DateGroupId(null));n.ConditionalOperator(e)};this.GetValue=function(){return this.Value()===null?null:this.CurrentDateMode()==_enums.DATE_MODE.ExactDate?ko.toJS({YearFrom:this.Value().YearFrom,MonthFrom:this.Value().MonthFrom(),DayFrom:this.Value().DayFrom,DateMode:this.CurrentDateMode(),IsEmpty:function(){return this.YearFrom===null||this.YearFrom===undefined||this.YearFrom===""}}):this.CurrentDateMode()==_enums.DATE_MODE.DatesRange?ko.toJS({YearFrom:this.Value().YearFrom,MonthFrom:this.Value().MonthFrom(),DayFrom:this.Value().DayFrom,YearTo:this.Value().YearTo,MonthTo:this.Value().MonthTo(),DayTo:this.Value().DayTo,DateMode:this.CurrentDateMode(),IsEmpty:function(){var n=this.YearFrom!==null&&this.YearFrom!==undefined&&this.YearFrom!=="",t=this.YearTo!==null&&this.YearTo!==undefined&&this.YearTo!=="";return n||t?!1:!0}}):this.CurrentDateMode()==_enums.DATE_MODE.Period?ko.toJS({FrequencyPeriod:this.Value().FrequencyPeriod(),PeriodsCount:this.Value().PeriodsCount(),DateMode:this.CurrentDateMode(),IsEmpty:function(){return this.FrequencyPeriod!==null&&this.FrequencyPeriod!==undefined&&this.FrequencyPeriod!==""&&this.PeriodsCount!==null&&this.PeriodsCount!==undefined&&this.PeriodsCount!==""?!1:!0}}):this.CurrentDateMode()==_enums.DATE_MODE.DateGroup?ko.toJS({YearFrom:this.Value().YearFrom,MonthFrom:this.Value().MonthFrom(),DayFrom:this.Value().DayFrom,YearTo:this.Value().YearTo,MonthTo:this.Value().MonthTo(),DayTo:this.Value().DayTo,DateGroupId:this.Value().DateGroupId,DateMode:this.CurrentDateMode(),IsEmpty:function(){return this.YearFrom!==null&&this.YearFrom!==undefined&&this.YearFrom!==""||this.YearTo!==null&&this.YearTo!==undefined&&this.YearTo!==""?!1:!0}}):ko.toJS(this.Value)};this.IsEmpty=function(){var t=n.GetValue(),i=t===null||t===undefined||t.IsEmpty();return i?this.IsFieldShouldHaveData()===undefined&&this.IsFieldShouldNotHaveData()===undefined?!0:this.IsFieldShouldHaveData()===undefined&&this.IsFieldShouldNotHaveData()===!1?!0:this.IsFieldShouldHaveData()===!1&&this.IsFieldShouldNotHaveData()===undefined?!0:this.IsFieldShouldHaveData()===!1&&this.IsFieldShouldNotHaveData()===!1?!0:!1:!1};this.ClearValue=function(){n.Value().DayFrom(null);n.Value().MonthFrom(null);n.Value().YearFrom(null);n.Value().DayTo(null);n.Value().MonthTo(null);n.Value().YearTo(null);n.Value().DateGroupId(null);n.ConditionalOperator(n.DefaultConditionalOperator);n.IsFieldShouldHaveData(!1);n.IsFieldShouldNotHaveData(!1)}}function IntegerSearchFieldViewModel(){this.Value=ko.observable({NumberFrom:ko.observable(null),NumberTo:ko.observable(null),SearchSingle:ko.observable(!1)});this.GetSimpleViewTemplateName=function(){return"simple-numbersrange-template"};this.GetAdvancedViewTemplateName=function(){return"advanced-numbersrange-template"}}function DecimalSearchFieldViewModel(){this.Value=ko.observable({NumberFrom:ko.observable(null),NumberTo:ko.observable(null),SearchSingle:ko.observable(!1)});this.GetSimpleViewTemplateName=function(){return"simple-numbersrange-template"};this.GetAdvancedViewTemplateName=function(){return"advanced-numbersrange-template"};this.GetNumberFormat=function(){return"n"};this.GetStep=function(){return 1e-5};this.GetDecimals=function(){return 5};this.OnSpinnerFromNumberChange=function(n){var t=$(n.spinnerFrom).val();t===""?(this.SpinnerFrom.val(null),this.Value().NumberFrom(null)):_utilities.isPositiveFloat(t)?(this.SpinnerFrom.val(t),this.Value().NumberFrom(t),this.Value().SearchSingle()&&this.Value().NumberTo(t)):_utilities.isNegativeFloat(t)?(this.SpinnerFrom.val(t),this.Value().NumberFrom(t),this.Value().SearchSingle()&&this.Value().NumberTo(t)):($(this).focus(),this.Value().NumberFrom(null),window._toast.error(commonLocalizations.EnterCorrectNumber))};this.OnSpinnerToNumberChange=function(n){var t=$(n.spinnerTo).val();t===""?(this.Value().NumberTo(null),this.SpinnerTo.val(null)):_utilities.isPositiveFloat(t)?(this.Value().NumberTo(t),this.SpinnerTo.val(t)):_utilities.isNegativeFloat(t)?(this.Value().NumberTo(t),this.SpinnerTo.val(t)):($(this).focus(),this.Value().NumberTo(null),window._toast.error(commonLocalizations.EnterCorrectNumber))}}function ValidationListSearchFieldViewModel(){var n=this;this.TextBox=null;this.SelectedValues=[];this.GetSimpleViewTemplateName=function(){return"simple-dropdownlist-template"};this.GetAdvancedViewTemplateName=function(){return"advanced-dropdownlist-template"};this.BorderHighlightClass=function(){try{if(n.Value().Value())return" border-left-green"}catch(t){}return" border-left-blue"};this.SetSearchFieldValue=function(){this.SelectedValues=null;this.Field&&this.Field.Value&&(this.SelectedValues=$.parseJSON(this.Field.Value));(this.SelectedValues===null||this.SelectedValues===undefined)&&(this.SelectedValues=[])};this.ValidationListEntryClick=function(t,i){var u=$(n.TextBox).next(),f=u.find('input[type="checkbox"]'),r=[];return n.SelectedValues=[],f.each(function(){$(this).prop("checked")&&(r.push($(this).attr("data-entry-text")),n.SelectedValues.push({Key:parseInt($(this).attr("value")),Value:$(this).attr("data-entry-text")}))}),n.Value().Value(r.join(", ")),i&&i.stopPropagation(),!0};this.IsEntrySelected=function(n){for(var t=0;t<this.SelectedValues.length;t++)if(this.SelectedValues[t].Key==n)return!0;return!1};this.GetValue=function(){return this.SelectedValues.length>0?ko.toJS({Values:this.SelectedValues}):null};this.SetValue=function(t,i){for(var r,e=$(this.TextBox).next(),o=e.find('input[type="checkbox"]'),f=[],u=0;u<t.length;u++)r=t[u],"IsFieldShouldHaveValue"in r&&"IsFieldShouldNotHaveValue"in r?(n.IsFieldShouldHaveData(r.IsFieldShouldHaveValue),n.IsFieldShouldNotHaveData(r.IsFieldShouldNotHaveValue)):o.each(function(){$(this).attr("value")==r.ValidationListEntryId&&($(this).prop("checked",!0),f.push($(this).attr("data-entry-text")),n.SelectedValues.push({Key:r.ValidationListEntryId,Value:r.ValidationListEntryText}))});n.ConditionalOperator(i);n.Value().Value(f.join(", "))};this.ClearValue=function(){n.Value().Value([]);this.SelectedValues=[];var t=$(this.TextBox).next(),i=t.find('input[type="checkbox"]');i.each(function(){$(this).prop("checked",!1)});n.ConditionalOperator(n.DefaultConditionalOperator);n.IsFieldShouldHaveData(!1);n.IsFieldShouldNotHaveData(!1)};this.Init=function(n){var t,i;this.TextBox=$(n);t=$(n).next();$(n).click(function(){t.slideDown("fast",function(){})});i=!0;t.bind("mouseleave",function(){i&&(t.slideUp("fast"),i=!1)});t.bind("mouseenter",function(){i=!0})}}function ValidationListsGroupViewModel(n){var t=this;this.TextBox=null;this.SelectedValues=[];this.groupValues=new ValueForGroupValidationListsViewModel(t,n);this.GetSimpleViewTemplateName=function(){return"simple-dropdownlistsgroup-template"};this.GetAdvancedViewTemplateName=function(){return"advanced-dropdownlistsgroup-template"};this.BorderHighlightClass=function(){try{if(t.Value().Value())return" border-left-green"}catch(n){}return" border-left-blue"};this.GetValue=function(){return this.SelectedValues.length>0?ko.toJS({Values:this.SelectedValues}):null};this.SetValue=function(n,i){for(var r,e=$(this.TextBox).next(),o=e.find('input[type="checkbox"]'),f=[],u=0;u<n.length;u++)r=n[u],"IsFieldShouldHaveValue"in r&&"IsFieldShouldNotHaveValue"in r?(t.IsFieldShouldHaveData(r.IsFieldShouldHaveValue),t.IsFieldShouldNotHaveData(r.IsFieldShouldNotHaveValue)):o.each(function(){$(this).attr("value")==r.ValidationListEntryId&&($(this).prop("checked",!0),f.push($(this).attr("data-entry-text")),t.SelectedValues.push({Key:r.ValidationListEntryId,Value:r.ValidationListEntryText}))});t.ConditionalOperator(i);t.Value().Value(f.join(", "))};this.ClearValue=function(){t.Value().Value([]);this.SelectedValues=[];var n=$(this.TextBox).next(),i=n.find('input[type="checkbox"]');i.each(function(){$(this).prop("checked",!1)});t.ConditionalOperator(t.DefaultConditionalOperator);t.IsFieldShouldHaveData(!1);t.IsFieldShouldNotHaveData(!1)};this.Init=function(n){var t,i;this.TextBox=$(n);t=$(n).next();$(n).click(function(){t.slideDown("fast",function(){})});i=!0;t.bind("mouseleave",function(){i&&(t.slideUp("fast"),i=!1)});t.bind("mouseenter",function(){i=!0})}}function ValueForGroupValidationListsViewModel(n,t){for(var u=n,r=[],i=0;i<t.length;i++)r.push(new ValueForFieldValidationListsViewModel(u,t[i]));return r}function ValueForFieldValidationListsViewModel(n,t){var i=t;return i.SetSearchFieldValue=function(){this.SelectedValues=null;this.Field&&this.Field.Value&&(this.SelectedValues=$.parseJSON(this.Field.Value));(this.SelectedValues===null||this.SelectedValues===undefined)&&(this.SelectedValues=[])},i.ValidationListEntryClick=function(t,i){var u=$(n.TextBox).next(),f=u.find('input[type="checkbox"]'),r=[];return n.SelectedValues=[],f.each(function(){$(this).prop("checked")&&(r.push($(this).attr("data-entry-text")),n.SelectedValues.push({Key:parseInt($(this).attr("value")),Value:$(this).attr("data-entry-text")}))}),n.Value().Value(r.join(", ")),i&&i.stopPropagation(),!0},i.IsEntrySelected=function(t){for(var i=0;i<n.SelectedValues.length;i++)if(n.SelectedValues[i].Key==t)return!0;return!1},i}function RatingFieldViewModel(){function u(t){n&&n.score(t)}function i(){var t=null;return n&&(t=n.score()),t}function r(n){t&&t.score(n)}function f(){var n=null;return t&&(n=t.score()),n}var e=this,n,t;Object.defineProperty(this,"NumberFrom",{get:function(){return this.numberFrom},set:function(n){this.numberFrom=n}});Object.defineProperty(this,"NumberTo",{get:function(){return this.numberTo},set:function(n){this.numberTo=n}});n=null;t=null;this.GetSimpleViewTemplateName=function(){return"simple-rating-template"};this.GetAdvancedViewTemplateName=function(){return"advanced-rating-template"};this.InitMin=function(t){var i={cancel:!1,half:!1,starType:"i",click:function(n){n>f()&&r(n);e.Value().ExistValue(n>0)}};n=new Raty(t,i);n.init();window._html.initTooltips(n.element,{placement:"bottom"})};this.InitMax=function(n){var r={cancel:!1,half:!1,starType:"i",click:function(n){n<i()&&u(n);e.Value().ExistValue(n>0)}};t=new Raty(n,r);t.init();$(t.element).soutronTooltip("title",{placement:"bottom"})};this.SetSearchFieldValue=function(){var f=this,n=null,t,u;this.Field&&this.Field.Value&&(n=$.parseJSON(this.Field.Value));t=n?n.NumberFrom:null;u=n?n.NumberTo:null;this.Value=ko.observable({NumberFrom:ko.observable(t),NumberTo:ko.observable(u),SearchSingle:ko.observable(!1),ExistValue:ko.observable(!1)});f.Value().SearchSingle.subscribe(function(){r(i())})};this.SetValue=function(n,t){var i=n[0],e,f;if("IsFieldShouldHaveValue"in i&&"IsFieldShouldNotHaveValue"in i){this.IsFieldShouldHaveData(i.IsFieldShouldHaveValue);this.IsFieldShouldNotHaveData(i.IsFieldShouldNotHaveValue);this.ConditionalOperator(t);return}e=i.NumberFrom?i.NumberFrom:1;f=i.NumberTo?Math.floor(i.NumberTo):1;this.Value().NumberFrom(e);u(e);this.Value().NumberTo(f);r(f);this.Value().SearchSingle(!f||e==f);this.Value().ExistValue(!f&&!e);this.ConditionalOperator(t)};this.GetValue=function(){var t=i(),n=f();return this.Value().SearchSingle()||t===n?n=t+.99:n&&(n=n+.99),this.Value().NumberFrom(t),this.Value().NumberTo(n),this.Value().NumberFrom()===null?null:ko.toJS(this.Value)};this.ClearValue=function(){this.Value().NumberFrom(null);u(0);this.Value().NumberTo(null);r(0);this.ConditionalOperator(this.DefaultConditionalOperator);this.IsFieldShouldHaveData(!1);this.IsFieldShouldNotHaveData(!1)};this.IsEmpty=function(){var n=!i()&&!f();return n?this.IsFieldShouldHaveData()===undefined&&this.IsFieldShouldNotHaveData()===undefined?!0:this.IsFieldShouldHaveData()===undefined&&this.IsFieldShouldNotHaveData()===!1?!0:this.IsFieldShouldHaveData()===!1&&this.IsFieldShouldNotHaveData()===undefined?!0:this.IsFieldShouldHaveData()===!1&&this.IsFieldShouldNotHaveData()===!1?!0:!1:!1}}function SectionFieldViewModel(n,t,i){function f(){var t=[],o,f;for(t.Index=++e,o=CreateFieldViewModel.bind(n),f=0;f<u.ChildrenFields.length;f++)t.push(o(u.ChildrenFields[f],r,i));return t.length>0&&(t.ConditionalOperator=n.Data.ConditionalOperatorsList[0].Key,t.Id=u.Id,t.ActionSectionRemoveId="remove-section-action-"+_utilities.getNextUniqueCounter(),r.Sections.push(t)),t}function o(){r.Sections().length==0&&f()}var r=this,u=t,e;this.Sections=ko.observableArray([]);e=0;this.GetSimpleViewTemplateName=function(){return"empty-section-template"};this.GetAdvancedViewTemplateName=function(){return"advanced-section-template"};this.appendSection=function(){return f()};this.RemoveSection=function(n){var t;ko.utils.arrayForEach(r.Sections(),function(i){i.Index==n.Index&&(t=i)});ko.utils.arrayRemoveItem(r.Sections(),t);r.Sections.valueHasMutated();o()};this.GetSectionViewModel=function(){var t,e,u,i,n,f,o;if(r._field.ChildrenFields.length==0)return null;for(t=r.GetViewModel(),e=r.Sections().slice(),u=0;u<e.length;u++){for(i=e[u],n={},n.SearchFields=[],n.ConditionalOperator=i.ConditionalOperator,n.ID=i.Id,f=0;f<i.length;f++)o=i[f].GetViewModel(),o.IsEmpty||n.SearchFields.push(o);n.SearchFields.length>0&&t.SectionsViewModel.push(n)}return t.SectionsViewModel.length==0?null:(t.IsEmpty=!1,t)};this.ClearValue=function(){for(var i,t,u,n=0;n<r.Sections().length;n++)for(i=r.Sections()[n],t=0;t<i.length;t++)u=i[t],u.ClearValue()};f()}function AdvancedSearchViewModel(n,t,i){function v(n){var t=p(n),i;t!=null&&(i=o(t,null,s()),r.AdditionalSearchFields.remove(t),r.SelectedAdditionalFields.push(i))}function l(){r.SearchFields.removeAll();r.SelectedAdditionalFields.removeAll();r.AdditionalSearchFields(h())}function s(){return new CreateFieldViewModelOptions({ShowThesaurusScopeNote:n.ShowThesaurusScopeNote})}function y(n,t){var i=n.toString();if(a.hasOwnProperty(i)){t.call(this,a[i]);return}$.ajax({url:_utilities.getAbsoluteURL("Search/GetSearchTemplate"),type:"GET",contentType:"application/json, UTF-8",dataType:"json",cache:!1,data:{contentTypeId:n},success:function(n){a[i]=n;t.call(r,n)},error:function(n,t,i){_message.errorAjax(n,t,i)}})}function p(n){for(let t=0;t<r.Data.AvailableSearchFields.length;t++)if(r.Data.AvailableSearchFields[t].Id==n)return r.Data.AvailableSearchFields[t];return null}function h(){var n=r.Data.AvailableSearchFields.slice(0),t=r.SearchFields(),i,u;if(!t||t.length==0)return n;for(i=0;i<t.length;i++)for(u=0;u<n.length;u++)if(t[i]._field.SearchUnitType!=_enums.SEARCH_UNIT_TYPE.FieldGroup&&t[i]._field.Id==n[u].Id){n.splice(u,1);break}return n}function w(){$("#advansed-search-all-textbox").length>0&&$("#advansed-search-all-textbox")[0].focus()}function b(n,t){var i=String(n.LocalisedName).toUpperCase(),r=String(t.LocalisedName).toUpperCase();return i==r?0:i>r?1:-1}function k(){var n=[];for(let t=0;t<r.Data.DateModesList.length;t++)r.Data.DateModesList[t].Key!=4&&n.push(r.Data.DateModesList[t]);r.Data.DateModesList=n}function d(){n.ExistDateGroups||k();r.Data.DateModesListFromSimple=[];for(let n=0;n<r.Data.DateModesList.length;n++)r.Data.DateModesList[n].Key!=4&&r.Data.DateModesListFromSimple.push(r.Data.DateModesList[n]);for(var i=0;i<r.Data.SearchFields.length;i++)r.SearchFields.push(o(r.Data.SearchFields[i],null,s()));r.AdditionalSearchFields(h());t&&ko.applyBindings(r,$(t)[0]);w()}var o=CreateFieldViewModel.bind(this),r=this;this.Data=n;r.Data.SearchFields||(r.Data.SearchFields=[]);var a={},u=r.Data.SearchFields.slice(0),e=null,c=null,f=null;this.StatusText=ko.observable();this.IsSearching=ko.observable(!1);this.SearchText=ko.observable(this.Data.SearchText);this.ShowButtonPanel=ko.observable(i);this.CurrentControlsMode=ko.observable(this.Data.UseOpacAdvancedModeControls?_enums.SEARCH_CONTROLS_MODE.AdvancedControls:_enums.SEARCH_CONTROLS_MODE.SimpleControls);this.ControlsModeClass=ko.computed(function(){return r.CurrentControlsMode()==_enums.SEARCH_CONTROLS_MODE.AdvancedControls?"advanced-controls-mode-container":"simple-controls-mode-container"});this.SearchControlsModeChangedEvent=Object.create(new CustomEvent);this.AllowCreateSearch=ko.observable(this.Data.AllowCreateSearch);this.AutoAddEmptyThesaurusEntry=this.Data.AutoAddEmptyThesaurusEntry;this.IncludeRecordsWithoutCopies=ko.observable(this.Data.IncludeRecordsWithoutCopies);this.OnlyPublishedRecords=ko.observable(this.Data.OnlyPublishedRecords);this.Data.SearchRecordsWithAttachmentsEnabled&&(this.IncludeRecordsWithAttachments=ko.observable(this.Data.IncludeRecordsWithAttachments));this.Data.SearchIncludeIssuesRecordsEnabled&&(this.IncludeIssuesRecords=ko.observable(this.Data.IncludeIssuesRecords));this.Data.SearchDependentRecordsEnabled&&(this.IncludeDependentRecords=ko.observable(this.Data.IncludeDependentRecords));this.SearchFields=ko.observableArray([]);this.AdditionalSearchFields=ko.observableArray([]);this.SelectedAdditionalFields=ko.observableArray([]);this.SelectedAdditionalField=ko.observable();this.SelectedAdditionalField.subscribe(function(n){v(n)});this.ChangeControlsMode=function(){var n=r.CurrentControlsMode()==_enums.SEARCH_CONTROLS_MODE.SimpleControls?_enums.SEARCH_CONTROLS_MODE.AdvancedControls:_enums.SEARCH_CONTROLS_MODE.SimpleControls;r.SearchControlsModeChangedEvent.fire({mode:n});r.CurrentControlsMode(n)};this.GetControlTemplateName=function(){return r.CurrentControlsMode()==1?"advanced-control-template":"simple-control-template"};this.GetSearchFieldElementId=function(n){return"SearchFields_"+n._field.SearchUnitType+"-"+n._field.Id+"_Value"};this.InitTooltip=function(n){setTimeout(function(){window._html.initTooltips(n,{placement:"right"})},0)};this.LocationsFilterChangedEventHandler=function(n){c=n.filterData};this.ContentFilterChangedEventHandler=function(n){var t,i,c,a;if(f=n.filterData,!f||!f.NodesCollection){l();return}if(f.NodesCollection.length!==1){if(t=r.SearchFields(),i=!1,t.length===u.length){for(let n=0;n<t.length;n++)if(t[n].Field.Id!==u[n].Id){i=!0;break}if(!i)return}if(l(),u){c=[];for(let n=0;n<u.length;n++)c.push(o(u[n],null,s()));r.SearchFields(c)}r.AdditionalSearchFields(h());e&&r.PopulateFields(e);return}a=f.NodesCollection[0].NodeValue;y(a,function(n){if(!n){if(u)for(let n=0;n<u.length;n++)r.SearchFields.push(o(u[n],null,s()));r.AdditionalSearchFields(h());e&&r.PopulateFields(e);return}for(let t=0;t<n.length;t++)r.SearchFields.push(o(n[t],null,s()));r.AdditionalSearchFields(h());e&&r.PopulateFields(e)});l()};this.Search=function(){var n=new ButtonLoadingAndLock($('[data-soutron="button-start-search"]'));return $.ajax({url:_utilities.getAbsoluteURL("Search/AdvancedSearch/?noCache="+(new Date).getTime()+Math.random()),type:"POST",contentType:"application/json, UTF-8",dataType:"json",cache:!1,data:JSON.stringify({viewModel:r.GetViewModel(),isAmendedSearch:!1}),beforeSend:function(){n.Lock();r.IsSearching(!0)},success:function(n){n.IsSuccess?location.href=_utilities.getAbsoluteURL("/SearchResults"):(window._toast.warning(n.StatusText),r.IsSearching(!1))},complete:function(){n.UnLock();r.IsSearching(!1)}}),!1};this.SaveSearch=function(n,t){var i=new ButtonLoadingAndLock($(t.currentTarget)),u=new SavedSearchEditorDialogOptions({Callback:{BeforeLoadLayout:function(){i.Lock()},AfterLoadLayout:function(){i.UnLock()},Success:function(){}},SearchId:null,OwnerCall:1,AdvancedSearchPageModel:r.GetViewModel(),AllowSharingSearch:!0});(new SavedSearchesUtilities).OpenSearchEditorDialog(u)};this.GetViewModel=function(){var n={SearchText:this.SearchText(),IncludeRecordsWithoutCopies:this.IncludeRecordsWithoutCopies?this.IncludeRecordsWithoutCopies():this.Data.IncludeRecordsWithoutCopies,Locations:c,Contents:f,SearchFields:[],SelectedAdditionalFields:[]},u;n.IncludeIssuesRecords=this.IncludeIssuesRecords?this.IncludeIssuesRecords():this.Data.IncludeIssuesRecords;n.IncludeRecordsWithAttachments=this.IncludeRecordsWithAttachments?this.IncludeRecordsWithAttachments():this.Data.IncludeRecordsWithAttachments;n.IncludeDependentRecords=this.IncludeDependentRecords?this.IncludeDependentRecords():this.Data.IncludeDependentRecords;n.OnlyPublishedRecords=this.OnlyPublishedRecords?this.OnlyPublishedRecords():this.Data.OnlyPublishedRecords;var i=r.SearchFields().slice(),e=r.SelectedAdditionalFields().slice(),t=null;for(let r=0;r<i.length;r++)(this.CurrentControlsMode()!=_enums.SEARCH_CONTROLS_MODE.SimpleControls||i[r]._field.Type!==_enums.RECORD_FIELD_TYPE.Section)&&(t=i[r].GetViewModel(),i[r]._field.Type===_enums.RECORD_FIELD_TYPE.Section&&(u=i[r].GetSectionViewModel(),u!=null&&(t=u)),t.IsEmpty||n.SearchFields.push(t));for(let i=0;i<e.length;i++)t=e[i].GetViewModel(),t.IsEmpty||n.SelectedAdditionalFields.push(t);return n};this.GetLocations=function(){return c};this.GetContents=function(){return f};this.PopulateFields=function(n){var i,t,f,u;r.ClearSearchFields();e=n;i=n.CurrentSearchConditions;t=n.CurrentSearchCommonConditions;for(let n=0;n<i.length;n++){f=i[n];for(let n=0;n<r.AdditionalSearchFields().length;n++)u=r.AdditionalSearchFields()[n],u.Id==f.FieldId&&u.SearchUnitType==f.FieldSearchUnitType&&v(u.Id)}setTimeout(function(){var o=!1,f,n,e,u;for(let u=0;u<r.SearchFields().length;u++){f=r.SearchFields()[u];for(let u=0;u<i.length;u++){if(n=i[u],f._field.Id==n.FieldId&&f._field.SearchUnitType==n.FieldSearchUnitType){f.SetValue(n.Values,n.FieldConditionalOperator,n.OriginalCondition);switch(n.FieldType){case _enums.RECORD_FIELD_TYPE.Thesaurus:f.IsTraverseRequired(n.IsTraverseRequired);f.IsSearchRelatedTerms(n.IsSearchRelatedTerms)}}n.FieldId==0&&(o=!0,r.SearchText(t.AllFieldsSearchValue))}}for(let n=0;n<r.SelectedAdditionalFields().length;n++){e=r.SelectedAdditionalFields()[n];for(let n=0;n<i.length;n++)u=i[n],e._field.Id==u.FieldId&&e._field.SearchUnitType==u.FieldSearchUnitType&&e.SetValue(u.Values,u.FieldConditionalOperator,u.OriginalCondition),u.FieldId==0&&(o=!0,r.SearchText(t.AllFieldsSearchValue))}o||r.SearchText(t.AllFieldsSearchValue)},0);this.IncludeRecordsWithAttachments&&this.IncludeRecordsWithAttachments(t.IncludeRecordsWithAttachments);this.IncludeRecordsWithoutCopies(t.IncludeRecordsWithoutCopies);this.IncludeIssuesRecords&&this.IncludeIssuesRecords(t.IncludeIssuesRecords);this.IncludeDependentRecords&&this.IncludeDependentRecords(t.IncludeDependentRecords);this.OnlyPublishedRecords&&this.OnlyPublishedRecords(t.SearchPublished==1)};this.ClearSearchFields=function(){this.SearchText("");for(let n=0;n<this.SearchFields().length;n++)this.SearchFields()[n].ClearValue();for(let n=0;n<this.SelectedAdditionalFields().length;n++)this.SelectedAdditionalFields()[n].ClearValue()};this.RemoveSearchField=function(n,t){return t&&t.type!="click"&&(t.type!="keydown"||t.keyCode!=_enums.KEYBOARD_KEYS.Enter)||(r.AdditionalSearchFields.push(this.Field),r.AdditionalSearchFields.sort(b),r.SelectedAdditionalFields.remove(this),r.SearchFields.remove(this)),!0};this.Update=function(n){u=n||r.Data.SearchFields||[];l();var t=[];for(let n=0;n<u.length;n++)t.push(o(u[n],null,s()));r.SearchFields(t);r.AdditionalSearchFields(h())};this.UpdateLocations=function(n){c=n};this.UpdateContents=function(n){f=n};d()}function FilterViewModel(n,t,i){function o(){var o=[],n=r.get_json(),u,i,t,f,e;for(n.length==1&&n[0].li_attr["data-id"]==-1&&(n=n[0].children),u=0;u<n.length;u++){for(i=n[u],t=[],f=0;f<i.children.length;f++)(e=i.children[f],e.state.selected)&&t.push({NodeValue:parseInt(e.li_attr["data-id"]),IsSelected:!0,HasChild:!1});t.length>0&&o.push({NodeValue:parseInt(i.li_attr["data-id"]),IsSelected:t.length===i.children.length,ChildNodes:t,HasChild:t.length>0})}return{NodesCollection:o}}function s(){$(u).jstree(f._jsTreeOptions).bind("ready.jstree",function(n,i){r||(r=i.instance);t&&r.select_all()}).bind("changed.jstree",function(n,t){(r||(r=t.instance),e)&&f.FilterStateChanged.fire({filterData:o()})});$(u).on("keydown",".jstree-anchor",function(n){if(n.which===13||n.which===32){var t=$(this).closest(".jstree-node"),i=$(t).attr("aria-selected")==="true";i?$(u).jstree("deselect_node",t):$(u).jstree("select_node",t);n.preventDefault()}});ko.cleanNode($(n));$(n).each(function(){ko.applyBindings(f,$(n)[0])});$(n).find(".widget-body").ace_scroll(_templates.ace_scroll.GetDefaultOptions({size:_const.size.SCROLL_WIDGET}));setTimeout(function(){$(u).jstree("close_all")},0);$(i).show();setTimeout(function(){var t=$(n).find("[data-id='-1']");$(u).jstree("open_node",t)},0)}var f=this,u=$(i).find(".jstree"),r=null,e=!0;this.FilterStateChanged=Object.create(new CustomEvent);this.ApplyFilterStateEvent=Object.create(new CustomEvent);this._jsTreeOptions={plugins:["types","html_data","checkbox","dnd"],core:{check_callback:!0}};this.GetViewModel=function(){var n=o();return{Tree:r,SelectedNodes:n?n.NodesCollection:[]}};this.FillTree=function(n){var t,u,i,s,h,c,o,l,a;if(r&&(t=f.GetViewModel().Tree,t)&&(u=t.get_container(),u)){if(e=!1,t.deselect_all(),!n||!n.NodesCollection||n.NodesCollection.length==0){e=!0;return}i=n.NodesCollection;for(let n=0;n<i.length;n++){if(s='.jstree-children > [data-id="'+i[n].NodeValue+'"]',h=$(u).find(s).attr("id"),i[n].IsSelected){t.select_node(h,!0);continue}else if(!i[n].HasChild)continue;c=0;o=i[n].ChildNodes;for(let n=0;n<o.length;n++)o[n].IsSelected&&(c++,l='.jstree-children > [data-id="'+o[n].NodeValue+'"]',a=$(u).find(s+" "+l).attr("id"),t.select_node(a,!0));c==0&&t.close_node(h)}e=!0}};s()}var Raty=function(){function n(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,n);this.element=t;this.opt=_objectSpread(_objectSpread(_objectSpread({},this.defaultOptions()),i),this._parseOptions(t.dataset))}return _createClass(n,[{key:"defaultOptions",value:function(){return{cancelButton:!1,cancelClass:"raty-cancel",cancelHint:"Cancel this rating!",cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:void 0,half:!1,halfShow:!0,hints:["bad","poor","regular","good","gorgeous"],iconRange:void 0,iconRangeSame:!1,mouseout:void 0,mouseover:void 0,noRatedMsg:"Not rated yet!",number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,space:!0,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}},{key:"cancel",value:function(n){this._isReadOnly()||(this[n?"click":"score"](null),this.scoreField.removeAttribute("value"))}},{key:"click",value:function(n){this._isReadOnly()||(n=this._adjustedScore(n),this._apply(n),this.opt.click&&this.opt.click.call(this,n,this.element),this._target(n))}},{key:"move",value:function(n){var t=parseInt(n,10),n=this._getDecimal(n,1),i=(t>=this.opt.number&&(t=this.opt.number-1,n=10),this._getWidth()),t=this.stars[t],i=t.offsetLeft+i/10*n,n=new Event("mousemove");n.pageX=i;this.isMove=!0;t.dispatchEvent(n);this.isMove=!1}},{key:"readOnly",value:function(n){this._isReadOnly()!==n&&(n?this._lock():(this._binds(),this._unlock()),this.element.dataset.readOnly=n)}},{key:"score",value:function(){return arguments.length?this.setScore(arguments[0]):this.getScore()}},{key:"setScore",value:function(n){this._isReadOnly()||(n=this._adjustedScore(n),this._apply(n),this._target(n))}},{key:"getScore",value:function(){var n=[],t=this.scoreField.value;return n.push(t?+t:void 0),1<n.length?n:n[0]}},{key:"init",value:function(){return this._executeCallbacks(),this._adjustNumber(),this._adjustHints(),this.opt.score=this._adjustedScore(this.opt.score),"img"!==this.opt.starType&&this._adjustStarName(),this._setPath(),this._createStars(),this.opt.cancelButton&&this._createCancel(),this.opt.precision&&this._adjustPrecision(),this._createScore(),this._apply(this.opt.score),this._setTitle(this.opt.score),this._target(this.opt.score),this.opt.readOnly?this._lock():(this.element.style.cursor="pointer",this._binds()),this}},{key:"_adjustedScore",value:function(n){if(n||0===n)return this._between(n,0,this.opt.number)}},{key:"_adjustHints",value:function(){var f,t,n,i,u,r;if(this.opt.hints||(this.opt.hints=[]),this.opt.halfShow||this.opt.half)for(f=this.opt.precision?10:2,t=0;t<this.opt.number;t++)for(n=this.opt.hints[t],"[object Array]"!==Object.prototype.toString.call(n)&&(n=[n]),this.opt.hints[t]=[],i=0;i<f;i++)u=n[i],r=n[n.length-1],void 0===r&&(r=null),this.opt.hints[t][i]=void 0===u?r:u}},{key:"_adjustNumber",value:function(){this.opt.number=this._between(this.opt.number,1,this.opt.numberMax)}},{key:"_adjustPrecision",value:function(){this.opt.half=!0}},{key:"_adjustStarName",value:function(){var t=["cancelOff","cancelOn","starHalf","starOff","starOn"],n;for(this.opt.path="",n=0;n<t.length;n++)this.opt[t[n]]=this.opt[t[n]].replace(".","-")}},{key:"_apply",value:function(n){this._fill(n);n&&(0<n&&(this.scoreField.value=n),this._roundStars(n))}},{key:"_attributesForIndex",value:function(n){var i=this._nameForIndex(n),t={alt:n,src:this.opt.path+this.opt[i]};return(t="img"!==this.opt.starType?{"data-alt":n,"class":this.opt[i]}:t).title=this._getHint(n),t}},{key:"_between",value:function(n,t,i){return Math.min(Math.max(parseFloat(n),t),i)}},{key:"_binds",value:function(){this.cancelButton&&(this._bindOverCancel(),this._bindClickCancel(),this._bindOutCancel());this._bindOver();this._bindClick();this._bindOut()}},{key:"_bindClick",value:function(){var n=this;this.stars.forEach(function(t){t.addEventListener("click",function(i){var u,r;n._isReadOnly()||(r=n.opt.half||n.opt.precision?n.element.dataset.score:t.alt||t.dataset.alt,n.opt.half&&!n.opt.precision&&(r=n._roundHalfScore(r)),!(u=n.opt.click?n.opt.click.call(n,+r,n.element,i):u)&&void 0!==u||n._apply(+r))})})}},{key:"_bindClickCancel",value:function(){var n=this;this.cancelButton.addEventListener("click",function(t){n.scoreField.removeAttribute("value");n.opt.click&&n.opt.click.call(n,null,n.element,t)})}},{key:"_bindOut",value:function(){var n=this;this.element.addEventListener("mouseleave",function(t){var i=+n.scoreField.value||void 0;n._apply(i);n._target(i,t);n._resetTitle();n.opt.mouseout&&n.opt.mouseout.call(n,i,n.element,t)})}},{key:"_bindOutCancel",value:function(){var n=this;this.cancelButton.addEventListener("mouseleave",function(t){var i=n.opt.cancelOff;"img"!==n.opt.starType&&(i="".concat(n.opt.cancelClass," ").concat(i));n._setIcon(n.cancelButton,i);n.opt.mouseout&&(i=+n.scoreField.value||void 0,n.opt.mouseout.call(n,i,n.element,t))})}},{key:"_bindOver",value:function(){var n=this,t=this.opt.half?"mousemove":"mouseover";this.stars.forEach(function(i){i.addEventListener(t,function(t){var r=n._getScoreByPosition(t,i);n._fill(r);n.opt.half&&(n._roundStars(r,t),n._setTitle(r,t),n.element.dataset.score=r);n._target(r,t);n.opt.mouseover&&n.opt.mouseover.call(n,r,n.element,t)})})}},{key:"_bindOverCancel",value:function(){var n=this;this.cancelButton.addEventListener("mouseover",function(t){var r,i;n._isReadOnly()||(r=n.opt.path+n.opt.starOff,i=n.opt.cancelOn,"img"===n.opt.starType?n.stars.forEach(function(n){n.src=r}):(i=n.opt.cancelClass+" "+i,n.stars.forEach(function(n){n.className=r})),n._setIcon(n.cancelButton,i),n._target(null,t),n.opt.mouseover&&n.opt.mouseover.call(n,null,n.element,t))})}},{key:"_buildScoreField",value:function(){var n=document.createElement("input");return n.name=this.opt.scoreName,n.type="hidden",this.element.appendChild(n),n}},{key:"_createCancel",value:function(){var n=document.createElement(this.opt.starType),t=this.opt.path+this.opt.cancelOff;n.setAttribute("class",this.opt.cancelClass);n.setAttribute("title",this.opt.cancelHint);"img"===this.opt.starType?(n.setAttribute("alt","x"),n.setAttribute("src",t)):(n.classList.add(t),n.setAttribute("data-alt","x"));"left"===this.opt.cancelPlace?(this.element.prepend(" "),this.element.prepend(n)):(this.element.append(" "),this.element.appendChild(n));this.cancelButton=n}},{key:"_createScore",value:function(){this.scoreField=document.querySelector(this.opt.targetScore)||this._buildScoreField()}},{key:"_createStars",value:function(){for(var t,i,r,n=1;n<=this.opt.number;n++){i=this._attributesForIndex(n);r=document.createElement(this.opt.starType);for(t in i)r.setAttribute(t,i[t]);this.element.appendChild(r);this.opt.space&&n<this.opt.number&&this.element.append(" ")}this.stars=this.element.querySelectorAll(this.opt.starType)}},{key:"_error",value:function(n){throw new Error(n);}},{key:"_executeCallbacks",value:function(){for(var i,t=["number","readOnly","score","scoreName","target","path"],n=0;n<t.length;n++)"function"==typeof this.opt[t[n]]&&((i=this.opt[t[n]].call(this,this.element))?this.opt[t[n]]=i:delete this.opt[t[n]])}},{key:"_fill",value:function(n){var i=0,t;if(this.opt.iconRangeSame&&this.opt.iconRange)for(;i<this.opt.iconRange.length&&this.opt.iconRange[i].range<n;)i++;for(t=1;t<=this.stars.length;t++){var r,f=this.stars[t-1],e=this._turnOn(t,n),u=void 0;this.opt.iconRange&&this.opt.iconRange.length>i?(r=this.opt.iconRange[i],u=this._getRangeIcon(r,e),t<=r.range&&this._setIcon(f,u),t===r.range&&i++):(u=this.opt[e?"starOn":"starOff"],this._setIcon(f,u))}}},{key:"_getDecimal",value:function(n,t){var n=n.toString().split(".")[1],i=0;return n&&(i=parseInt(n.slice(0,t),10),"9999"===n.slice(1,5)&&i++),i}},{key:"_getRangeIcon",value:function(n,t){return t?n.on||this.opt.starOn:n.off||this.opt.starOff}},{key:"_getScoreByPosition",value:function(n,t){var r,i=parseInt(t.alt||t.getAttribute("data-alt"),10);return this.opt.half&&(r=this._getWidth(),i=i-1+parseFloat((n.pageX-t.offsetLeft)/r)),i}},{key:"_getHint",value:function(n,t){var r,i,u;return 0===n||n?(r=Math.ceil(n),r=this.opt.hints[(r||1)-1],t=!t||this.isMove,i=this._getDecimal(n,1),u=r,this.opt.precision?u=r[i=t?0===i?9:i-1:i]:(this.opt.halfShow||this.opt.half)&&(u=r[i=t&&0===i||5<i?1:0]),""===u?"":u||n):this.opt.noRatedMsg}},{key:"_getWidth",value:function(){var n=parseFloat(this.stars[0].offsetWidth)||16;return n||this._error("Could not get the icon width!"),n}},{key:"_isReadOnly",value:function(){return{"true":!0}[this.element.dataset.readOnly]||!1}},{key:"_lock",value:function(){var n=this._getHint(this.scoreField.value);this.element.style.pointerEvents="none";this.element.title=n;this.scoreField.readOnly=!0;this.stars.forEach(function(t){t.title=n});this.cancelButton&&(this.cancelButton.style.display="none");this.element.dataset.readOnly=!0}},{key:"_nameForIndex",value:function(n){return this.opt.score&&this.opt.score>=n?"starOn":"starOff"}},{key:"_resetTitle",value:function(){for(var n=0;n<this.opt.number;n++)this.stars[n].title=this._getHint(n+1)}},{key:"_parseOptions",value:function(n){return Object.keys(n).reduce(function(t,i){var r=null!=(r={"true":!0,"false":!1}[n[i]])?r:n[i];return!isNaN(r)&&Number.isInteger(parseFloat(r))&&(r=Number(r)),t[i]=r,t},{})}},{key:"_roundHalfScore",value:function(n){var t=parseInt(n,10),n=this._getDecimal(n,1);return t+(n=0!==n?5<n?1:.5:n)}},{key:"_roundStars",value:function(n,t){var t=this._starName(n,t);t&&(t=this.opt[t],(n=this.stars[Math.ceil(n)-1])&&this._setIcon(n,t))}},{key:"_setIcon",value:function(n,t){n["img"===this.opt.starType?"src":"className"]=this.opt.path+t}},{key:"_setPath",value:function(){this.opt.path=this.opt.path||"";this.opt.path&&"/"!==this.opt.path.slice(-1)&&(this.opt.path+="/")}},{key:"_setTarget",value:function(n,t){t=t&&this.opt.targetFormat.toString().replace("{score}",t);n instanceof HTMLInputElement||n instanceof HTMLSelectElement?n.value=t:n.textContent=t}},{key:"_setTitle",value:function(n,t){var i;n&&(i=parseInt(Math.ceil(n),10),this.stars[i-1].title=this._getHint(n,t))}},{key:"_starName",value:function(n,t){return n=+(n%1).toFixed(2),t||this.isMove?.5<n?"starOn":"starHalf":n<=this.opt.round.down?void 0:this.opt.halfShow&&n<this.opt.round.up?"starHalf":n<this.opt.round.full?"starOff":"starOn"}},{key:"_target",value:function(n,t){var r,i;this.opt.target&&((r=document.querySelector(this.opt.target))||this._error("Target selector invalid or missing!"),i=t&&"mouseover"===t.type,void 0===n?n=this.opt.targetText:null===n?n=i?this.opt.cancelHint:this.opt.targetText:("hint"===this.opt.targetType?n=this._getHint(n,t):this.opt.precision&&(n=parseFloat(n).toFixed(1)),t=t&&"mousemove"===t.type,i||t||this.opt.targetKeep||(n=this.opt.targetText)),this._setTarget(r,n))}},{key:"_turnOn",value:function(n,t){return this.opt.single?n===t:n<=t}},{key:"_unlock",value:function(){this.element.style.cursor="pointer";this.element.style.pointerEvents="auto";this.element.removeAttribute("title");this.element.dataset.readOnly=!1;this.scoreField.readOnly=!1;this._resetTitle();this.cancelButton&&(this.cancelButton.style.display="")}}]),n}(),advancedSearchLocalizations;SearchFieldViewModel.prototype.SetDefaults=function(){var n=this;this.Value=ko.observable({Value:ko.observable("")});this.ConditionalOperator=ko.observable();this.IsFieldShouldHaveData=ko.observable();n.IsFieldShouldHaveData.subscribe(function(t){t&&n.IsFieldShouldNotHaveData&&n.IsFieldShouldNotHaveData()&&n.IsFieldShouldNotHaveData(!1)});this.IsFieldShouldNotHaveData=ko.observable();n.IsFieldShouldNotHaveData.subscribe(function(t){t&&n.IsFieldShouldHaveData&&n.IsFieldShouldHaveData()&&n.IsFieldShouldHaveData(!1)});this.IsTraverseRequired=ko.observable();this.IsTraverseRequiredCheckBoxVisible=ko.observable();this.IsSearchRelatedTerms=ko.observable();this.IsSearchRelatedTermsCheckBoxVisible=ko.observable();this.InSection=!1;this.UniqueUIid="UniqueUIid-"+_utilities.getNextUniqueCounter()};SearchFieldViewModel.prototype.Init=function(n){if(this.Field.Options.SuggestionEnabled){var r=this,t=$(n),u=this.Field.SearchUnitType==_enums.SEARCH_UNIT_TYPE.Field?this.Field.Id:null,f=this.Field.SearchUnitType==_enums.SEARCH_UNIT_TYPE.FieldGroup?this.Field.Id:null,i={search:function(){return _api.getSearchFieldsQuery(i.search,u,f)},"used-only":!0,"include-issue":window.soutronContext.Suggest.IncludeIssueRecords,limit:window.soutronContext.Suggest.SuggestionRecords,"ordered-only":!1,lang:window.soutronContext.Lcid,portal:window.soutronContext.OpacId,format:"json"};$(t).typeahead({minLength:2,order:"asc",hint:!0,delay:1e3,maxItem:window.soutronContext.Suggest.SuggestionRecords,dynamic:!0,template:"{{title}}",emptyTemplate:window.commonLocalizations.CannotFind+' "{{query}}", '+window.commonLocalizations.PleaseTryAgain+'."',display:["title","id"],correlativeTemplate:!0,source:{Items:{url:[{url:window.soutronContext.Api.CataloguesSuggestionLink,type:"GET",contentType:"application/json",dataType:"json",cache:!1,data:i,beforeSend:function(n,r){window._controls.typeahead.createLoading(t);n.setRequestHeader("LmsApiToken",window.soutronContext.Api.ProtectToken);r.data=i},callback:{done:function(n){var i,t,r;if(n.items==undefined||n.items.length==0)return[];for(i=[],t=0;t<n.items.length;t++)r=n.items[t],r.title!=""&&i.push({title:r.title});return i},complete:function(){window._controls.typeahead.destroyLoading(t)}}}]}},callback:{onClick:function(n,t,i){r.Value().Value(i.title)}}});$(t).keyup(function(){i.search=$(t).val()})}};SearchFieldViewModel.prototype.GetSimpleViewTemplateName=function(){return"simple-default-template"};SearchFieldViewModel.prototype.GetAdvancedViewTemplateName=function(){return"advanced-default-template"};SearchFieldViewModel.prototype.GetFieldNameText=function(){return this.Field.LocalisedName};SearchFieldViewModel.prototype.SetSearchFieldValue=function(){var n=this.Field;this.Value=ko.observable({Value:ko.observable(n!=null?n.Value:"")})};SearchFieldViewModel.prototype.SetValue=function(n,t,i){var r=null,f,u;if(n.length>0&&(this.IsFieldShouldHaveData(n[0].IsFieldShouldHaveValue),this.IsFieldShouldNotHaveData(n[0].IsFieldShouldNotHaveValue)),i){if($.isArray(i.Attributes)&&i.Attributes.length>0)for(let n=0;n<i.Attributes.length;n++){f=i.Attributes[n];switch(f.Name){case"value":r=f.Value||""}}r===null&&i.hasOwnProperty("Value")&&(r=i.Value)}if(r===null)for(let t=0;t<n.length;t++)if(t===0){if(n[0].hasOwnProperty("Value"))r=n[0].Value;else if(n[0].hasOwnProperty("ConditionDisplayText")){n[0].hasOwnProperty("IsFieldShouldNotHaveValue")&&n[0].IsFieldShouldNotHaveValue===!0||n[0].hasOwnProperty("IsFieldShouldHaveValue")&&n[0].IsFieldShouldHaveValue===!0||(r=n[0].ConditionDisplayText);break}else throw new Error("SearchFieldViewModel.prototype.SetValue: Property with value not found");r=r||""}else{if(u="",n[0].hasOwnProperty("Value"))u=n[t].Value;else throw new Error("SearchFieldViewModel.prototype.SetValue: Property with value not found");u=u||"";switch(this.Field.Type){case window._SearchRecords.RECORD_FIELD_TYPE.ISBN:case window._SearchRecords.RECORD_FIELD_TYPE.ISSN:case window._SearchRecords.RECORD_FIELD_TYPE.Frequency:case window._SearchRecords.RECORD_FIELD_TYPE.Incremental:case window._SearchRecords.RECORD_FIELD_TYPE.Rating:r=r+u;break;case window._SearchRecords.RECORD_FIELD_TYPE.Text:r=r+" "+u;break;default:r=r+" "+n[t].ConditionOperatorText+" "+u}}this.Value().Value(r);this.ConditionalOperator(t)};NumbersRangeFieldViewModel.prototype=new SearchFieldViewModel;ThesaurusSearchFieldViewModel.prototype=new SearchFieldViewModel;DateSearchFieldViewModel.prototype=new SearchFieldViewModel;ComplexDateFieldViewModel.prototype=new DateSearchFieldViewModel;IntegerSearchFieldViewModel.prototype=new NumbersRangeFieldViewModel;DecimalSearchFieldViewModel.prototype=new NumbersRangeFieldViewModel;ValidationListSearchFieldViewModel.prototype=new SearchFieldViewModel;ValidationListsGroupViewModel.prototype=new SearchFieldViewModel;RatingFieldViewModel.prototype=new SearchFieldViewModel;SectionFieldViewModel.prototype=new SearchFieldViewModel;advancedSearchLocalizations=window.advancedSearchLocalizations==null||window.advancedSearchLocalizations==undefined?{SelectDateMsg:"Please select a date",SelectMonthMsg:"Please select a month"}:window.advancedSearchLocalizations