if(void 0===Menu||!Menu)var Menu={};Menu={getSelectedNamesArray:function(e){var t=[];return $.each(e,(function(e,n){n.selected()&&t.push(n.name)})),t},getSelectedNames:function(e,t){var n="";return $.each(e,(function(e,t){t.selected()&&(n+=(n.length?", ":"")+t.name)})),n.length?n:t},getSelectedValues:function(e,t){var n=[];return $.each(e,(function(e,o){o.selected()&&("number"==typeof o[t]||"string"==typeof o[t]?n.push(o[t]):$.each(o[t],(function(e,t){n.push(t)})))})),n},JSONMapToMenu:function(e,t){var n=[];return $.each(e,(function(e,o){n.push({name:o,id:e,active:ko.observable(!0),disabled:ko.observable(!1),selected:ko.observable(!!t&&-1!==t.indexOf(e)).extend({rateLimit:{timeout:50,method:"notifyWhenChangesStop"}})})})),n},JSONToMenu:function(e,t,n){return $.map(e,(function(e){return $.extend({},e,{active:ko.observable(!0),disabled:ko.observable(!1),selected:ko.observable(!!t&&-1!==t.indexOf(e[n])).extend({rateLimit:{timeout:50,method:"notifyWhenChangesStop"}})})}))},clone:function(e){return ko.observableArray($.map(e,(function(e){return $.extend({},e,{active:ko.observable(e.active()),disabled:ko.observable(e.disabled()),selected:ko.observable(e.selected()).extend({rateLimit:{timeout:50,method:"notifyWhenChangesStop"}})})})))},sortByName:function(e,t){var n=e.name.toLowerCase(),o=t.name.toLowerCase();return n<o?-1:n>o?1:0},search:function(e,t){var n=t.toLowerCase();$.each(e,(function(e,t){t.name.toLowerCase().indexOf(n)>=0?t.active(!0):t.active(!1)}))},countSelected:function(e){var t=0;return $.each(e,(function(e,n){n.selected()&&t++})),t},countDisabled:function(e){var t=0;return $.each(e,(function(e,n){n.disabled()&&t++})),t},countActive:function(e){var t=0;return $.each(e,(function(e,n){n.active()&&t++})),t},activateAll:function(e){$.each(e,(function(e,t){t.active(!0)}))},deactivateAll:function(e){$.each(e,(function(e,t){t.active(!1)}))},select:function(e,t){$.each(e,(function(e,n){(Array.isArray(t)?-1!==t.indexOf(n.id):"number"==typeof t?n.id===t.toString():n.id===t)?n.selected(!0):n.selected(!1)}))},selectPattern:function(e,t){var n=t.toLowerCase();$.each(e,(function(e,t){t.name.toLowerCase().indexOf(n)>=0?t.selected(!0):t.selected(!1)}))},selectAll:function(e){$.each(e,(function(e,t){t.disabled()||t.selected(!0)}))},unselectAll:function(e){$.each(e,(function(e,t){t.selected(!1)}))},toggleSelection:function(e,t,n){n.stopPropagation(),Menu.countSelected(e)+Menu.countDisabled(e)==e.length?Menu.unselectAll(e):Menu.selectAll(e)}};