var __values=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],i=0;return e?e.call(t):{next:function(){return{value:(t=t&&i>=t.length?void 0:t)&&t[i++],done:!t}}}},__read=this&&this.__read||function(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,s,o=i.call(t),r=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)r.push(n.value)}catch(t){s={error:t}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(s)throw s.error}}return r},__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}}(),__assign=this&&this.__assign||Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var s in e=arguments[i])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},__spread=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(__read(arguments[e]));return t},__awaiter=this&&this.__awaiter||function(o,r,a,l){return new(a=a||Promise)(function(t,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function n(t){try{s(l.throw(t))}catch(t){e(t)}}function s(e){e.done?t(e.value):new a(function(t){t(e.value)}).then(i,n)}s((l=l.apply(o,r||[])).next())})},__generator=this&&this.__generator||function(i,n){var s,o,r,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,o&&(r=2&e[0]?o.return:e[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,e[1])).done)return r;switch(o=0,(e=r?[2&e[0],r.value]:e)[0]){case 0:case 1:r=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,o=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(r=0<(r=a.trys).length&&r[r.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!r||e[1]>r[0]&&e[1]<r[3])){a.label=e[1];break}if(6===e[0]&&a.label<r[1]){a.label=r[1],r=e;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(e);break}r[2]&&a.ops.pop(),a.trys.pop();continue}e=n.call(i,a)}catch(t){e=[6,t],o=0}finally{s=r=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}},DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM,DotVVM;Array.prototype.equals||(Array.prototype.equals=function(t){if(!t||this.length!==t.length)return!1;for(var e=0,i=this.length;e<i;e++)if(this[e]instanceof Array&&t[e]instanceof Array){if(!this[e].equals(t[e]))return!1}else if(this[e]!==t[e])return!1;return!0},Object.defineProperty(Array.prototype,"equals",{enumerable:!1})),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var i=Object(this),n=i.length>>>0;if(0==n)return!1;var s,o,e=0|e,r=Math.max(0<=e?e:n-Math.abs(e),0);for(;r<n;){if((s=i[r])===(o=t)||"number"==typeof s&&"number"==typeof o&&isNaN(s)&&isNaN(o))return!0;r++}return!1}}),Array.from||(Array.from=function(){function l(t){return"function"==typeof t||"[object Function]"===e.call(t)}function u(t){return t=function(t){t=Number(t);return isNaN(t)?0:0!==t&&isFinite(t)?(0<t?1:-1)*Math.floor(Math.abs(t)):t}(t),Math.min(Math.max(t,0),i)}var e=Object.prototype.toString,i=Math.pow(2,53)-1;return function(t){var e=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var i,n=1<arguments.length?arguments[1]:void 0;if(void 0!==n){if(!l(n))throw new TypeError("Array.from: when provided, the second argument must be a function");2<arguments.length&&(i=arguments[2])}for(var s,o=u(e.length),r=l(this)?Object(new this(o)):new Array(o),a=0;a<o;)s=e[a],r[a]=n?void 0===i?n(s,a):n.call(i,s,a):s,a+=1;return r.length=o,r}}()),$.Event.prototype.stopPropagationAndPreventDefault||($.Event.prototype.stopPropagationAndPreventDefault=function(){this.stopPropagation(),this.preventDefault()}),$.fn.visible||($.fn.visible=function(t){var e=this,i="visible-interval",n=this.data(i);return this.is(":visible")?t():(this.one("visible",t),n||(n=setInterval(function(){e.is(":visible")&&(clearInterval(n),e.data(i,n=null),e.trigger("visible"))},300),this.data(i,n))),this}),$.fn.input||($.fn.input=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.unshift("input"),this.on.apply(this,t)}),String.prototype.startsWith||(String.prototype.startsWith=function(t,e){return this.substr(e||0,t.length)===t}),String.prototype.endsWith||(String.prototype.endsWith=function(t,e){var i=this.toString();("number"!=typeof e||!isFinite(e)||Math.floor(e)!==e||e>i.length)&&(e=i.length),e-=t.length;t=i.indexOf(t,e);return-1!==t&&t===e}),String.prototype.padStart||(String.prototype.padStart=function(t,e){return t>>=0,e=String(e||" "),this.length>t?String(this):((t-=this.length)>e.length&&(e+=e.repeat(t/e.length)),e.slice(0,t)+String(this))}),String.prototype.padEnd||(String.prototype.padEnd=function(t,e){return t>>=0,e=String(e||" "),this.length>t?String(this):((t-=this.length)>e.length&&(e+=e.repeat(t/e.length)),String(this)+e.slice(0,t))}),String.prototype.repeat||(String.prototype.repeat=function(t){var e=""+this;if((t=+t)<0)throw new RangeError("Repeat count must be non-negative.");if(t===1/0)throw new RangeError("Repeat count must be less than infinity.");if(t=Math.floor(t),0===e.length||0===t)return"";if(e.length*t>=1<<28)throw new RangeError("Repeat count must not overflow maximum string size.");for(var i="";1==(1&t)&&(i+=e),0!==(t>>>=1);)e+=e;return i}),function(t){(t=(t=t.BusinessPack||(t.BusinessPack={})).RgbaChannel||(t.RgbaChannel={}))[t.Red=0]="Red",t[t.Green=1]="Green",t[t.Blue=2]="Blue",t[t.Alpha=3]="Alpha"}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e=(i.control="dotvvm-bp-control",i.alert="dotvvm-bp-alert",i.autoComplete="dotvvm-bp-auto-complete",i.button="dotvvm-bp-button",i.calendar="dotvvm-bp-calendar",i.carousel="dotvvm-bp-carousel",i.checkBox="dotvvm-bp-check-box",i.checkBoxList="dotvvm-bp-check-box-list",i.colorPicker="dotvvm-bp-color-picker",i.comboBox="dotvvm-bp-combo-box",i.copyButton="dotvvm-bp-copy-button",i.dataPager="dotvvm-bp-data-pager",i.datePicker="dotvvm-bp-date-picker",i.dateRangePicker="dotvvm-bp-date-range-picker",i.dateTimePicker="dotvvm-bp-date-time-picker",i.dateTimeRangePicker="dotvvm-bp-date-time-range-picker",i.dialog="dotvvm-bp-dialog",i.draggableList="dotvvm-bp-draggable-list",i.dropDownButton="dotvvm-bp-drop-down-button",i.dropDownList="dotvvm-bp-drop-down-list",i.editableLiteral="dotvvm-bp-editable-literal",i.fileUpload="dotvvm-bp-file-upload",i.filterBuilder="dotvvm-bp-filter-builder",i.filterEditor="dotvvm-bp-filter-editor",i.formItem="dotvvm-bp-form-item",i.gridView="dotvvm-bp-grid-view",i.gridViewRowSelectColumn="dotvvm-bp-grid-view-row-select-column",i.gridViewUserSettingsEditor="dotvvm-bp-grid-view-user-settings-editor",i.icon="dotvvm-bp-icon",i.imageCrop="dotvvm-bp-image-crop",i.listView="dotvvm-bp-list-view",i.maskedTextBox="dotvvm-bp-masked-text-box",i.modalDialog="dotvvm-bp-modal-dialog",i.multiSelect="dotvvm-bp-multi-select",i.numericUpDown="dotvvm-bp-numeric-up-down",i.panel="dotvvm-bp-panel",i.radioButton="dotvvm-bp-radio-button",i.radioButtonList="dotvvm-bp-radio-button-list",i.rangeCalendar="dotvvm-bp-range-calendar",i.rangeSlider="dotvvm-bp-range-slider",i.rating="dotvvm-bp-rating",i.richTextBox="dotvvm-bp-rich-text-box",i.slider="dotvvm-bp-slider",i.switchButton="dotvvm-bp-switch-button",i.tabControl="dotvvm-bp-tab-control",i.text="dotvvm-bp-text",i.textBox="dotvvm-bp-text-box",i.timePicker="dotvvm-bp-time-picker",i.timeRangePicker="dotvvm-bp-time-range-picker",i.toggleButton="dotvvm-bp-toggle-button",i.toolbar="dotvvm-bp-toolbar",i.toolbarButton="dotvvm-bp-toolbar-button",i.tooltip="dotvvm-bp-tooltip",i.treeView="dotvvm-bp-tree-view",i.textView="dotvvm-bp-text-view",i.window="dotvvm-bp-window",i.flagAnimated="dotvvm-bp-flag_animated",i.flagAutoFocusable="dotvvm-bp-flag_auto-focusable",i.flagCustomAllowed="dotvvm-bp-flag_custom-allowed",i.flagDismissible="dotvvm-bp-flag_dismissible",i.flagExpandable="dotvvm-bp-flag_expandable",i.flagFocusPrevented="dotvvm-bp-flag_focus-prevented",i.flagInline="dotvvm-bp-flag_inline",i.flagMultiline="dotvvm-bp-flag_multiline",i.flagOverflowHidden="dotvvm-bp-flag_overflow-hidden",i.flagUnselectAllowed="dotvvm-bp-flag_unselect-allowed",i.flagRounded="dotvvm-bp-flag_rounded",i.flagWithList="dotvvm-bp-flag_with-list",i.flagIe="dotvvm-bp-flag_ie",i.flagDefaultTemplate="dotvvm-bp-flag_default-template",i.stateActive="dotvvm-bp-state_active",i.stateBusy="dotvvm-bp-state_busy",i.stateChecked="dotvvm-bp-state_checked",i.stateDataEmpty="dotvvm-bp-state_data-empty",i.stateDisabled="dotvvm-bp-state_disabled",i.stateDragover="dotvvm-bp-state_dragover",i.stateError="dotvvm-bp-state_error",i.stateExpanded="dotvvm-bp-state_expanded",i.stateFocused="dotvvm-bp-state_focused",i.stateHalfSelected="dotvvm-bp-state_half-selected",i.stateHidden="dotvvm-bp-state_hidden",i.stateHiding="dotvvm-bp-state_hiding",i.stateIndeterminate="dotvvm-bp-state_indeterminate",i.stateLoading="dotvvm-bp-state_loading",i.stateMoving="dotvvm-bp-state_moving",i.stateOpened="dotvvm-bp-state_opened",i.stateResizing="dotvvm-bp-state_resizing",i.stateSelected="dotvvm-bp-state_selected",i.stateSemiDisabled="dotvvm-bp-state_semi-disabled",i.stateShowing="dotvvm-bp-state_showing",i.stateSortedAsc="dotvvm-bp-state_sorted-asc",i.stateSortedDesc="dotvvm-bp-state_sorted-desc",i.stateValueEmpty="dotvvm-bp-state_value-empty",i.primitiveBody="dotvvm-bp-primitive_body",i.primitiveButton="dotvvm-bp-primitive_button",i.primitiveButtonGroup="dotvvm-bp-primitive_button-group",i.primitiveButtonIcon="dotvvm-bp-primitive_button-icon",i.primitiveButtonNav="dotvvm-bp-primitive_button-nav",i.primitiveCheckBox="dotvvm-bp-primitive_check-box",i.primitiveCheckerboard="dotvvm-bp-primitive_checkerboard",i.primitiveContainer="dotvvm-bp-primitive_container",i.primitiveContents="dotvvm-bp-primitive_contents",i.primitiveDropDown="dotvvm-bp-primitive_drop-down",i.primitiveDropZone="dotvvm-bp-primitive_drop-zone",i.primitiveEditor="dotvvm-bp-primitive_editor",i.primitiveErrorMessage="dotvvm-bp-primitive_error-message",i.primitiveFooter="dotvvm-bp-primitive_footer",i.primitiveGrip="dotvvm-bp-primitive_grip",i.primitiveGripE="dotvvm-bp-primitive_grip-e",i.primitiveGripN="dotvvm-bp-primitive_grip-n",i.primitiveGripNE="dotvvm-bp-primitive_grip-ne",i.primitiveGripNW="dotvvm-bp-primitive_grip-nw",i.primitiveGripS="dotvvm-bp-primitive_grip-s",i.primitiveGripSE="dotvvm-bp-primitive_grip-se",i.primitiveGripSW="dotvvm-bp-primitive_grip-sw",i.primitiveGripW="dotvvm-bp-primitive_grip-w",i.primitiveGroup="dotvvm-bp-primitive_group",i.primitiveHeader="dotvvm-bp-primitive_header",i.primitiveInput="dotvvm-bp-primitive_input",i.primitiveInputGroup="dotvvm-bp-primitive_input-group",i.primitiveItem="dotvvm-bp-primitive_item",i.primitiveLabel="dotvvm-bp-primitive_label",i.primitiveLine="dotvvm-bp-primitive_line",i.primitiveList="dotvvm-bp-primitive_list",i.primitiveNav="dotvvm-bp-primitive_nav",i.primitiveOverlay="dotvvm-bp-primitive_overlay",i.primitivePicker="dotvvm-bp-primitive_picker",i.primitivePlaceholder="dotvvm-bp-primitive_placeholder",i.primitivePoint="dotvvm-bp-primitive_point",i.primitivePopup="dotvvm-bp-primitive_popup",i.primitiveProgressBar="dotvvm-bp-primitive_progress-bar",i.primitiveRadioButton="dotvvm-bp-primitive_radio-button",i.primitiveRows="dotvvm-bp-primitive_rows",i.primitiveSelectionBox="dotvvm-bp-primitive_selection-box",i.primitiveSeparator="dotvvm-bp-primitive_separator",i.primitiveSide="dotvvm-bp-primitive_side",i.primitiveSlider="dotvvm-bp-primitive_slider",i.primitiveSwitchButton="dotvvm-bp-primitive_switch-button",i.primitiveTable="dotvvm-bp-primitive_table",i.primitiveTemplate="dotvvm-bp-primitive_template",i.primitiveText="dotvvm-bp-primitive_text",i.primitiveTextArea="dotvvm-bp-primitive_text-area",i.primitiveTextBox="dotvvm-bp-primitive_text-box",i.primitiveTitlebar="dotvvm-bp-primitive_titlebar",i.primitiveToolbar="dotvvm-bp-primitive_toolbar",i.primitiveValue="dotvvm-bp-primitive_value",i.positionEnd="dotvvm-bp-position_end",i.positionStart="dotvvm-bp-position_start",i.displayFlex1="dotvvm-bp-display_flex-1",i.displayFlex0="dotvvm-bp-display_flex-0",i.alignCenter="dotvvm-bp-align_center",i.alignLeft="dotvvm-bp-align_left",i.alignRight="dotvvm-bp-align_right",i.commandAdd="dotvvm-bp-command_add",i.commandAddFilter="dotvvm-bp-command_add-filter",i.commandAddGroup="dotvvm-bp-command_add-group",i.commandClose="dotvvm-bp-command_close",i.commandCancel="dotvvm-bp-command_cancel",i.commandCollapse="dotvvm-bp-command_collapse",i.commandConfirm="dotvvm-bp-command_confirm",i.commandDecrease="dotvvm-bp-command_decrease",i.commandDelete="dotvvm-bp-command_delete",i.commandExpand="dotvvm-bp-command_expand",i.commandIncrease="dotvvm-bp-command_increase",i.commandMaximize="dotvvm-bp-command_maximize",i.commandNext="dotvvm-bp-command_next",i.commandOpen="dotvvm-bp-command_open",i.commandPrev="dotvvm-bp-command_prev",i.commandReset="dotvvm-bp-command_reset",i.commandRestore="dotvvm-bp-command_restore",i.commandRotateLeft="dotvvm-bp-command_rotate-left",i.commandRotateRight="dotvvm-bp-command_rotate-right",i.commandSwitch="dotvvm-bp-command_switch",i.commandSelectFiles="dotvvm-bp-command_select-files",i.commandToggle="dotvvm-bp-command_toggle",i.commandUnselect="dotvvm-bp-command_unselect",i.commandZoomIn="dotvvm-bp-command_zoom-in",i.commandZoomOut="dotvvm-bp-command_zoom-out",i.postbackPending="dotvvm-bp-postback_pending",i.postbackSuccess="dotvvm-bp-position_success",i.postbackFail="dotvvm-bp-position_fail",i.alertTypeIcon="dotvvm-bp-alert_type-icon",i.alertTypePrefix="dotvvm-bp-alert_",i.buttonTypePrefix="dotvvm-bp-button_",i.buttonOutline="dotvvm-bp-button_outline",i.calendarDay="dotvvm-bp-calendar_day",i.calendarDayHeader="dotvvm-bp-calendar_day-header",i.calendarDecadeView="dotvvm-bp-calendar_decade-view",i.calendarLeap="dotvvm-bp-calendar_leap",i.calendarMonth="dotvvm-bp-calendar_month",i.calendarMonthView="dotvvm-bp-calendar_month-view",i.calendarOther="dotvvm-bp-calendar_other",i.calendarToday="dotvvm-bp-calendar_today",i.calendarWeek="dotvvm-bp-calendar_week",i.calendarWeekHeader="dotvvm-bp-calendar_week-header",i.calendarWeekNumber="dotvvm-bp-calendar_week-number",i.calendarYear="dotvvm-bp-calendar_year",i.calendarYearView="dotvvm-bp-calendar_year-view",i.calendarDateSelector="dotvvm-bp-calendar_date-selector",i.calendarHourSelector="dotvvm-bp-calendar_hour-selector",i.calendarMain="dotvvm-bp-calendar_main",i.calendarMinuteSelector="dotvvm-bp-calendar_minute-selector",i.calendarMonthSelector="dotvvm-bp-calendar_month-selector",i.calendarOtherMonth="dotvvm-bp-calendar_other-month",i.calendarSelector="dotvvm-bp-calendar_selector",i.calendarSelectorEnd="dotvvm-bp-calendar_selector-end",i.calendarSelectorStart="dotvvm-bp-calendar_selector-start",i.calendarSelectionEnd="dotvvm-bp-calendar_selection-end",i.calendarSelectionStart="dotvvm-bp-calendar_selection-start",i.calendarTable="dotvvm-bp-calendar_table",i.calendarUpperRow="dotvvm-bp-calendar_upper-row",i.calendarWeekend="dotvvm-bp-calendar_weekend",i.calendarYearSelector="dotvvm-bp-calendar_year-selector",i.colorPickerAlphaEditor="dotvvm-bp-color-picker_alpha-editor",i.colorPickerAlphaSlider="dotvvm-bp-color-picker_alpha-slider",i.colorPickerAlphaWrapper="dotvvm-bp-color-picker_alpha-wrapper",i.colorPickerBlueEditor="dotvvm-bp-color-picker_blue-editor",i.colorPickerEditor="dotvvm-bp-color-picker_editor",i.colorPickerGreenEditor="dotvvm-bp-color-picker_green-editor",i.colorPickerHexEditor="dotvvm-bp-color-picker_hex-editor",i.colorPickerHueSlider="dotvvm-bp-color-picker_hue-slider",i.colorPickerPalette="dotvvm-bp-color-picker_palette",i.colorPickerPredefinedColors="dotvvm-bp-color-picker_predefined-colors",i.colorPickerPreview="dotvvm-bp-color-picker_preview",i.colorPickerRedEditor="dotvvm-bp-color-picker_red-editor",i.colorPickerRgbaEditor="dotvvm-bp-color-picker_rgba-editor",i.colorPickerRgbEditor="dotvvm-bp-color-picker_rgb-editor",i.colorPickerSliders="dotvvm-bp-color-picker_sliders",i.colorPickerSpectrum="dotvvm-bp-color-picker_spectrum",i.dateTimeToolbar="dotvvm-bp-date-time_toolbar",i.dialogBase="dotvvm-bp-dialog_base",i.dialogGrip="dotvvm-bp-dialog_grip",i.windowMovable="dotvvm-bp-window-movable",i.dialogHorizontalAlignCenter="dotvvm-bp-dialog-horizontal-align_center",i.dialogHorizontalAlignLeft="dotvvm-bp-dialog-horizontal-align_left",i.dialogHorizontalAlignRight="dotvvm-bp-dialog-horizontal-align_right",i.dialogVerticalAlignCenter="dotvvm-bp-dialog-vertical-align_center",i.dialogVerticalAlignTop="dotvvm-bp-dialog-vertical-align_top",i.dialogVerticalAlignBottom="dotvvm-bp-dialog-vertical-align_bottom",i.dialogCloseButton="dotvvm-bp-dialog_close-button",i.fileUploadFiles="dotvvm-bp-file-upload_files",i.fileUploadPanel="dotvvm-bp-file-upload_panel",i.filterEditorOperatorEditor="dotvvm-bp-filter-editor_operator-editor",i.filterEditorValueEditor="dotvvm-bp-filter-editor_value-editor",i.formItemAfterControlTemplateWrapper="dotvvm-bp-form-item_after-control-template-wrapper",i.formItemBeforeControlTemplateWrapper="dotvvm-bp-form-item_before-control-template-wrapper",i.formItemControl="dotvvm-bp-form-item_control",i.formItemLabel="dotvvm-bp-form-item_label",i.formItemHint="dotvvm-bp-form-item_hint",i.formItemValidatorPositionAfter="dotvvm-bp-form-item-validator-position-after",i.formItemValidatorPositionBefore="dotvvm-bp-form-item-validator-position-before",i.formItemValidation="dotvvm-bp-form-item_validation",i.formItemValidationIcon="dotvvm-bp-form-item_validation_icon",i.gridViewColumnFooterRow="dotvvm-bp-grid-view_footer-row",i.gridViewColumnHeaderRow="dotvvm-bp-grid-view_column-header-row",i.gridViewEmptyRow="dotvvm-bp-grid-view_empty-row",i.gridViewFilterRow="dotvvm-bp-grid-view_filter-row",i.gridViewFooterRow="dotvvm-bp-grid-view_column-footer-row",i.gridViewHeaderRow="dotvvm-bp-grid-view_header-row",i.gridViewHeaderItem="dotvvm-bp-grid-view_header-item",i.gridViewFixedHeaderRow="dotvvm-bp-grid-view_fixed-header-row",i.gridViewSortButton="dotvvm-bp-grid-view_sort-button",i.gridViewHeaderValue="dotvvm-bp-grid-view_header-value",i.gridViewPlaceholder="dotvvm-bp-grid-view_placeholder",i.gridViewSelectedRow="dotvvm-bp-state_selected",i.gridViewStateDragged="dotvvm-bp_state-dragged",i.gridViewColumnResizeGrip="dotvvm-bp-grid-view_column-resize-grip",i.imageCropCropCanvas="dotvvm-bp-image-crop_crop-canvas",i.imageCropCropCanvasDisabled="dotvvm-bp-image-crop_crop-canvas_disabled",i.imageCropImageCanvas="dotvvm-bp-image-crop_image-canvas",i.listViewDisplayModeList="dotvvm-bp-list-view_display-mode-list",i.listViewDisplayModeTiles="dotvvm-bp-list-view_display-mode-tiles",i.ratingHalfFill="dotvvm-bp-rating_half-fill",i.richTextBoxParagraphStyleList="dotvvm-bp-rich-text-box_paragraph-style-list",i.sliderMaxGrip="dotvvm-bp-slider_max-grip",i.sliderMinGrip="dotvvm-bp-slider_min-grip",i.switchButtonToggle="dotvvm-bp-switch-button_toggle",i.tabControlNav="dotvvm-bp-tab-control_nav",i.tabControlItem="dotvvm-bp-tab-control_item",i.tabControlContent="dotvvm-bp-tab-control_content",i.tabControlNavItem="dotvvm-bp-tab_nav-item",i.timePickerHour="dotvvm-bp-time-picker_hour",i.timePickerHourDial="dotvvm-bp-time-picker_hour-dial",i.timePickerMinute="dotvvm-bp-time-picker_minute",i.timePickerMinuteDial="dotvvm-bp-time-picker_minute-dial",i.timePickerSecond="dotvvm-bp-time-picker_second",i.timePickerSecondDial="dotvvm-bp-time-picker_second-dial",i.timePickerDesignator="dotvvm-bp-time-picker_designator",i.timePickerDesignatorDial="dotvvm-bp-time-picker_designator-dial",i.timePickerTimeDial="dotvvm-bp-time-picker_time-dial",i.timePickerNow="dotvvm-bp-time-picker_now",i.timePickerSeparator="dotvvm-bp-time-picker_separator",i.toggleButtonPrefix="dotvvm-bp-toggle-button_",i.toggleButtonTypeToggle="dotvvm-bp-toggle-button_toggle",i.toggleButtonTypeSwitch="dotvvm-bp-toggle-button_switch",i.treeViewList="dotvvm-bp-treeview_list",i.treeViewListItem="dotvvm-bp-treeview_list-item",i.treeViewListButtons="dotvvm-bp-treeview_list-buttons",i.treeViewLabel="dotvvm-bp-treeview_label",i);function i(){}t.BusinessPackCss=e}(t.BusinessPack||(t.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e=(i.left=1,i.middle=2,i.right=3,i);function i(){}t.MouseButtons=e}(t.BusinessPack||(t.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e=(i.isWhiteSpace=function(t){return t===i.spacebar||i.isEnter(t)},i.isUpOrDown=function(t){return t===i.up||t===i.down},i.isLeftOrRight=function(t){return t===i.left||t===i.right},i.isArrow=function(t){return this.isUpOrDown(t)||this.isLeftOrRight(t)},i.isEnter=function(t){return t===i.enter||t===i.numpadEnter},i.isDeleteOrBackspace=function(t){return this.isBackspace(t)||this.isDelete(t)},i.isBackspace=function(t){return t===i.backspace},i.isDelete=function(t){return t===i.delete},i.isEscape=function(t){return t===i.esc},i.a=65,i.b=66,i.c=67,i.d=68,i.e=69,i.f=70,i.g=71,i.h=72,i.i=73,i.j=74,i.k=75,i.l=76,i.m=77,i.n=78,i.o=79,i.p=80,i.q=81,i.r=82,i.s=83,i.t=84,i.u=85,i.v=86,i.w=87,i.x=88,i.y=89,i.z=90,i.num0=48,i.num1=49,i.num2=50,i.num3=51,i.num4=52,i.num5=53,i.num6=54,i.num7=55,i.num8=56,i.num9=57,i.numpadZero=96,i.numpadOne=97,i.numpadTwo=98,i.numpadThree=99,i.numpadFour=100,i.numpadFive=101,i.numpadSix=102,i.numpadSeven=103,i.numpadEight=104,i.numpadNine=105,i.numpadMultiply=106,i.numpadAdd=107,i.numpadEnter=108,i.numpadSubtract=109,i.numpadDecimal=110,i.numpadDivide=111,i.f1=112,i.f2=113,i.f3=114,i.f4=115,i.f5=116,i.f6=117,i.f7=118,i.f8=119,i.f9=120,i.f10=121,i.f11=122,i.f12=123,i.f13=124,i.f14=125,i.f15=126,i.colon=186,i.equals=187,i.underscore=189,i.questionMark=191,i.tilde=192,i.openBracket=219,i.backwardSlash=220,i.closeBracket=221,i.quotes=222,i.lessThan=188,i.greaterThan=190,i.backspace=8,i.tab=9,i.clear=12,i.enter=13,i.shift=16,i.control=17,i.alt=18,i.capsLock=20,i.esc=27,i.spacebar=32,i.pageUp=33,i.pageDown=34,i.end=35,i.home=36,i.left=37,i.up=38,i.right=39,i.down=40,i.insert=45,i.delete=46,i.help=47,i.numLock=144,i);function i(){}t.KeyboardKeys=e}(t.BusinessPack||(t.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e=(Object.defineProperty(i,"isIe",{get:function(){return"Microsoft Internet Explorer"===navigator.appName||!!/\bTrident\b/.test(this.userAgent)},enumerable:!0,configurable:!0}),Object.defineProperty(i,"isEdge",{get:function(){return/webkit\W.*(edge)\W/i.test(this.userAgent)},enumerable:!0,configurable:!0}),Object.defineProperty(i,"isChrome",{get:function(){return/webkit\W.*(chrome|chromium)\W/i.test(this.userAgent)},enumerable:!0,configurable:!0}),Object.defineProperty(i,"isGecko",{get:function(){return/mozilla(?!.*webkit).*\Wgecko\W/i.test(this.userAgent)},enumerable:!0,configurable:!0}),Object.defineProperty(i,"isFirefox",{get:function(){return/mozilla.*\Wfirefox\W/i.test(this.userAgent)},enumerable:!0,configurable:!0}),Object.defineProperty(i,"isSafari",{get:function(){return/webkit\W(?!.*chrome).*safari\W/i.test(this.userAgent)},enumerable:!0,configurable:!0}),Object.defineProperty(i,"isMobileOrTablet",{get:function(){return/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i.test(this.userAgent)},enumerable:!0,configurable:!0}),i.userAgent=window.navigator&&navigator.userAgent||"",i);function i(){}t.Browser=e}(t.BusinessPack||(t.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){var e;function d(t){void 0===t&&(t=[]),this.a=t,Object.defineProperty(this,"a",{value:t,writable:!1})}e=t.BusinessPack||(t.BusinessPack={}),d.prototype.aggregate=function(t){var e;if(0===(e=this.a).length)throw"Aggregate of empty array";for(var i=e[0],n=1,s=e.length;n<s;++n)i=t(i,e[n]);return i},d.prototype.all=function(t){for(var e=this.a,i=0,n=e.length;i<n;++i)if(!t(e[i]))return!1;return!0},d.prototype.any=function(t){var e=this.a;if(!t)return 0<e.length;for(var i=0,n=e.length;i<n;++i)if(t(e[i]))return!0;return!1},d.prototype.average=function(t){var e=this.a;t=t||function(t){return t};for(var i=0,n=e.length,s=0;s<n;++s)i+=t(e[s]);return i/n},d.prototype.concat=function(t){return new d(this.a.concat(t))},d.prototype.contains=function(e,i){return i?this.any(function(t){return i.equals(t,e)}):this.any(function(t){return t===e})},d.prototype.count=function(t){return t?this.where(t).count():this.a.length},d.prototype.distinct=function(t){return this.distinctBy(function(t){return t},t)},d.prototype.distinctBy=function(t,e){for(var i=this.a,n=[],s=[],o=0,r=i.length;o<r;++o){var a,l=t(a=i[o]);n.asLinq().contains(l,e)||(n.push(l),s.push(a))}return new d(s)},d.prototype.elementAt=function(t){if(t<0||t>=this.a.length)throw"Index was out of range. Must be non-negative and less than the size of the collection.";return this.a[t]},d.prototype.elementAtOrDefault=function(t,e){return void 0===e&&(e=null),t>=this.a.length||t<0?e:this.a[t]},d.prototype.except=function(t,e){for(var i,n=this.a,s=[],o={},r=e?e.getHashCode:function(t){return Object.getHashCode(t)},a=0,l=t.length;a<l;++a)o[r(t[a])]=1;for(a=0,l=n.length;a<l;++a)o[r(i=n[a])]||s.push(i);return new d(s)},d.prototype.first=function(t){if(0===this.a.length)throw"Enumeration does not contain elements";if(!t)return this.a[0];t=this.where(t);if(0===t.count())throw"Enumeration does not contain elements";return t.elementAt(0)},d.prototype.firstOrDefault=function(t,e){return void 0===e&&(e=null),t?this.where(t).elementAtOrDefault(0,e):0<this.a.length?this.a[0]:e},d.prototype.forEach=function(t){for(var e=this.a,i=0,n=e.length;i<n&&!1!==t(e[i],i);++i);},d.prototype.groupBy=function(t,e,i){e=e||function(t){return t},i=i||{equals:function(t,e){return t==e},getHashCode:function(t){return Object.getHashCode(t)}};for(var n,s,o,r=this.a,a={},l=0,u=r.length;l<u;++l)o=void 0,n=t(r[l]),a[s=void 0!==(o=void 0!==a[s=i.getHashCode(n)]?i.equals(n,a[s].key)?s:s+l:o)&&o!==s?o:s]=a[s]||{Key:n,Elements:[]},a[s].elements.push(e(r[l]));for(var c=Object.keys(a),h=[],l=0,u=c.length;l<u;++l)h.push(a[c[l]]);return new d(h)},d.prototype.indexOf=function(t,e){var i=this.a;if(e)for(var n=0,s=i.length;n<s;++n){var o=i[n];if(e.equals(o,t))return n}else for(n=0,s=i.length;n<s;++n)if(i[n]===t)return n;return-1},d.prototype.intersect=function(t,e){for(var i=[],n=0,s=t.length;n<s;++n)this.contains(t[n],e)&&i.push(t[n]);return new d(i)},d.prototype.join=function(t,e,i,n,s){for(var o=[],r=this.select(e),a=t.asLinq().select(i),l=0,u=r.count();l<u;++l){var c=r.elementAt(l),h=-1;-1!=(h=a.indexOf(c,s))&&(h=a.elementAt(h),o.push(n(c,h)))}return new d(o)},d.prototype.last=function(t){if(0===this.a.length)throw"Enumeration does not contain elements";if(!t)return this.a[this.a.length-1];t=this.where(t);if(0===t.count())throw"Enumeration does not contain elements";return t.last()},d.prototype.lastOrDefault=function(t,e){if(void 0===e&&(e=null),0===this.a.length)return e;if(!t)return this.a[this.a.length-1];t=this.where(t);return 0===t.count()?e:t.lastOrDefault(null,e)},d.prototype.max=function(t){var e=this.a;if(0===e.length)throw"Sequence contains no elements.";for(var i=(t=t||function(t){return t})(e[0]),n=0,s=e.length;n<s;++n){var o=t(e[n]);i<o&&(i=o)}return i},d.prototype.min=function(t){var e=this.a;if(0===e.length)throw"Sequence contains no elements.";for(var i=(t=t||function(t){return t})(e[0]),n=0,s=e.length;n<s;++n){var o=t(e[n]);o<i&&(i=o)}return i},d.prototype.orderBy=function(i,n){return n=n||function(t,e){return e<t?1:-1},this.a.sort(function(t,e){return n(i(t),i(e))}),this},d.prototype.orderByDescending=function(i,n){var s;return s=n=n||function(t,e){return e<t?1:-1},n=function(t,e){return-s(t,e)},this.a.sort(function(t,e){return n(i(t),i(e))}),this},d.prototype.reverse=function(){for(var t=this.a.length-1,e=0;e<t;++e,--t){var i=this.a[e];this.a[e]=this.a[t],this.a[t]=i}return this},d.prototype.select=function(t){for(var e=this.a,i=[],n=0,s=e.length;n<s;++n)i.push(t(e[n],n));return new d(i)},d.prototype.selectMany=function(t,e){for(var i=this.a,n=[],s=0,o=i.length;s<o;++s)n=n.concat(t(i[s]));return e?n.asLinq().select(e):n.asLinq()},d.prototype.sequenceEqual=function(t,e){var i=this.a;if(void 0===i||void 0===t)throw"Do not pass null values to arrays.";if(i===t)return!0;if(i.length!==t.length)return!1;if(e){for(var n=0,s=i.length;n<s;n++)if(!e(i[n],t[n]))return!1}else for(n=0,s=i.length;n<s;n++)if(i[n]!==t[n])return!1;return!0},d.prototype.single=function(t){var e=this.a;if(!t){if(1!=e.length)throw"Source has none or more than one element";return e[0]}for(var i=null,n=0,s=e.length;n<s;++n)if(t(e[n])){if(null!=i)throw"Source has more than one element";i=e[n]}return i},d.prototype.singleOrDefault=function(t,e){void 0===e&&(e=null);var i=this.a;if(!t)return 1!=i.length?e:i[0];for(var n=null,s=0,o=i.length;s<o;++s)if(t(i[s])){if(null!=n)return e;n=i[s]}return n},d.prototype.skip=function(t){return new d(this.a.slice(t))},d.prototype.skipWhile=function(t){for(var e=this.a,i=0,n=e.length;i<n&&!1!==t(e[i]);++i);return new d(e.slice(i))},d.prototype.sum=function(t){var e=this.a,i=0;if(t)for(var n=0,s=e.length;n<s;++n)i+=t(e[n]);else for(n=0,s=e.length;n<s;++n)i+=e[n];return i},d.prototype.take=function(t){for(var e=this.a,i=[],n=t>(n=e.length)?n:t,s=0;s<n;++s)i.push(e[s]);return new d(i)},d.prototype.takeWhile=function(t){for(var e,i=this.a,n=[],s=0,o=i.length;s<o&&t(e=i[s]);++s)n.push(e);return new d(n)},d.prototype.union=function(t,e){for(var i,n,s=this.a,o=[],r={},a=e?e.getHashCode:function(t){return Object.getHashCode(t)},l=0,u=s.length;l<u;++l)r[n=a(i=s[l])]||(r[n]=i,o.push(i));for(l=0,u=t.length;l<u;++l)r[n=a(i=t[l])]||(r[n]=i,o.push(i));return new d(o)},d.prototype.where=function(t){for(var e,i=this.a,n=[],s=0,o=i.length;s<o;++s)t(e=i[s])&&n.push(e);return new d(n)},d.prototype.zip=function(t,e){for(var i=this.a,n=[],s=0,o=(i.length>t.length?t:i).length;s<o;++s)n.push(e(i[s],t[s]));return new d(n)},d.prototype.toArray=function(){return this.a},t=d,e.Linq=t}(DotVVM=DotVVM||{}),Array.prototype.asLinq=function(){return new DotVVM.BusinessPack.Linq(this)},Object.getHashCode=function(t){if(t instanceof Number)return Number.getHashCode(t);var e=t instanceof Object?JSON.stringifyNonCircular(t):t.toString(),i=0;if(0===e.length)return i;for(var n=0;n<e.length;++n)i=(i<<5)-i+e.charCodeAt(n);return i},Number.getHashCode=function(t){return t.valueOf()},Object.isPlain=function(t){return!("object"!=typeof t||t.nodeType||t instanceof Window||t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))},JSON.stringifyNonCircular=function(t){var e,i=i||"";for(e in t){var n=t[e];n&&(n instanceof Array||n.IsPlain())?i+=e+":"+JSON.stringify(n):i+=n&&"object"==typeof n?e+":$ref#"+n:e+":"+n}return i},function(t){var e;function u(){}e=t.BusinessPack||(t.BusinessPack={}),Object.defineProperty(u,"isDebugModeEnabled",{get:function(){return!!dotvvm.resourceSigns["dotvvm.debug"]},enumerable:!0,configurable:!0}),u.warnInDebugMode=function(t){this.isDebugModeEnabled&&console.warn(t+"\nTHIS WARNING IS DISPLAYED ONLY IN DEBUG MODE")},u.installBindingHandler=function(a,l){ko.bindingHandlers["dotvvm-businesspack-"+a]={init:function(t,e,i,n,s){var o=$(t),e=u.getExtendedBinding(o,e,i),r=new l(o,e,i,s),i=((i={})["$bp"+a]=r,i.$bpControl=r,i);return o.data(a,r),r.initialize(),ko.applyBindingsToDescendants(s.extend(i),t),ko.utils.domNodeDisposal.addDisposeCallback(t,function(){return r.dispose()}),{controlsDescendantBindings:!0}}}},u.getExtendedBinding=function(t,e,i){e=ko.unwrap(e());return e.visible=i.get("visible"),null==e.tabIndex&&(t=Number(t.attr("tabindex")),e.tabIndex=isNaN(t)?null:t),e},u.bindDragEvents=function(t,e,i){function n(){100<+new Date-+o&&(i(),clearInterval(s),s=null)}var s,o;t.on("dragenter",function(t){e(t),o=new Date,s=s||setInterval(n,100)}).on("dragover",function(){return o=new Date})},u.isObservableArray=function(t){return ko.isComputed(t)?Array.isArray(t.peek()):!!ko.isObservable(t)&&"push"in t},u.deepClone=function(t){var e=ko.unwrap(t);if(null==e)return ko.isObservable(t)?ko.observable(null):null;if(Array.isArray(e))for(var i=[],n=0;n<e.length;n++)i[n]=u.deepClone(e[n]);else if("object"==typeof e)for(var s in i={},e)e.hasOwnProperty(s)&&(i[s]=u.deepClone(e[s]));else i=e;return u.isObservableArray(t)?ko.observableArray(i):ko.isObservable(t)?ko.observable(i):i},u.deepObservable=function(t){var e=ko.toJS(t);if(null==e)return ko.observable(null);if(Array.isArray(e)){for(var i=0;i<e.length;i++)e[i]=u.deepObservable(e[i]);return ko.observableArray(e)}if("object"==typeof e)for(var n in e)e.hasOwnProperty(n)&&(e[n]=u.deepObservable(e[n]));return ko.observable(e)},u.clearObservableArray=function(t){t&&t().length&&t.removeAll()},u.ensureObservable=function(t){return ko.isObservable(t)?t:t?ko.observable(t):ko.observable()},u.ensureObservableArray=function(t){return ko.isObservable(t)?t:t?ko.observableArray(t):ko.observableArray()},u.isDataAccessor=function(t){try{return"data"===t("data")}catch(t){return!1}},u.getDataSourceItems=function(t){if(this.isObservableArray(t))return t;t=ko.unwrap(t);return t&&t.Items?t.Items:ko.observableArray()},u.concatMany=function(t){var e,i,n=[];try{for(var s=__values(t),o=s.next();!o.done;o=s.next())var r=o.value,n=n.concat(r)}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}return n},u.pushAll=function(t,e){ko.utils.arrayPushAll(t,e)},u.htmlEncode=function(t){return $("<div/>").text(t).html()},u.normalizeSpaces=function(t){return t&&t.replace(new RegExp(this.nonBreakingSpace,"g")," ").replace(new RegExp(u.zeroWidthSpace,"g"),"")},u.createGuid=function(t){void 0===t&&(t=!0);for(var e="",i=0;i<32;i++){var n=16*Math.random()|0;!t||8!==i&&12!==i&&16!==i&&20!==i||(e+="-"),e+=(12===i?4:16===i?3&n|8:n).toString(16)}return e},u.convertTouchToMouseEvent=function(t){var e=t.type;switch(e){case"touchstart":e="mousedown";break;case"touchmove":e="mousemove";break;case"touchend":e="mouseup";break;case"mousedown":case"mousemove":case"mouseup":return t;default:return this.warnInDebugMode("The '"+e+"' event is not a supported touch event."),null}var i=t.originalEvent;if(1<i.touches.length)return this.warnInDebugMode("Multi touch events are not supported."),null;var n=i.changedTouches[0],n=$.Event(e,{altKey:i.altKey,ctrlKey:i.ctrlKey,metaKey:i.metaKey,shiftKey:i.shiftKey,clientX:n.clientX,clientY:n.clientY,bubbles:t.bubbles,cancelable:t.cancelable,screenX:n.screenX,screenY:n.screenY});return n.originalEvent=t,n},u.closeOnOutsideClick=function(i,n){$(document).mouseup(function(t){var e=i;e.is(t.target)||0!==e.has(t.target).length||n(i,t)})},u.fixNumberOverflow=function(t,e){return t<0?t+e:e<=t?t-e:t},u.whenAsync=function(e){var i;return new Promise(function(t){i=setInterval(function(){e()&&(clearInterval(i),t())},10)})},u.zeroWidthSpace=String.fromCharCode(65279),u.nonBreakingSpace=String.fromCharCode(160),t=u,e.Utils=t}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e=(i.copy=function(t){if(null==t)return!1;t=$("<textarea>").val(t.toString()).css({position:"fixed",top:0,left:0,clip:"rect(0 0 0 0)",border:0,width:"1px",height:"1px",overflow:"hidden",padding:0});t.appendTo(document.body).select();try{return document.execCommand("copy")}catch(t){return!1}finally{t.remove()}},i);function i(){}t.Clipboard=e}(t.BusinessPack||(t.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e=(i.compare=function(t,e){var i;if(0===t.length)return e.length;if(0===e.length)return t.length;t.length>e.length&&(t=(i=__read([e,t],2))[0],e=i[1]);for(var n=new Array(t.length+1),s=0;s<=t.length;s++)n[s]=s;for(s=1;s<=e.length;s++){for(var o=s,r=void 0,a=1;a<=t.length;a++)r=e[s-1]===t[a-1]?n[a-1]:Math.min(n[a-1]+1,Math.min(o+1,n[a]+1)),n[a-1]=o,o=r;n[t.length]=o}return n[t.length]},i);function i(){}t.Levenshtein=e}(t.BusinessPack||(t.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e=(i.urlOrEmail=function(t){return new RegExp("(\\b(?:(?:https?://|www\\.)[^/ -\\.]{1}[^\\s\\(\\)\\<\\>]+)\\b(?:[^\\.\\,)]??[/]*))(?=[\\s]*)|(@??\\b[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\b)",t)},i.twoLineBreaks=function(t){return new RegExp("(?:\\r\\n){2}|\\n\\n",t)},i.lineBreak=function(t){return new RegExp("(\\n|\\r\\n)",t)},i.hex8Color=function(t){return new RegExp("^#?([A-Fa-f0-9]{3}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$",t)},i.hex6Color=function(t){return new RegExp("^#?([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$",t)},i.mimeTypeSecondPart=function(t){return new RegExp("/.*$",t)},i.wildcardMimeType=function(t){return new RegExp("/*$",t)},i.getLastMatch=function(t,e,i){for(var n,s=[];n=t.exec(e);)s.push(n);if(s.length){if(0<=i)for(;n=s.pop();)if(n.index<i)return n;return s.pop()}return null},i);function i(){}t.RegexUtils=e}(t.BusinessPack||(t.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){!function(n){"use strict";var t=(e.createRgbaColor=function(t,e,i,n){return void 0===n&&(n=1),{Red:ko.observable(Math.round(t)),Green:ko.observable(Math.round(e)),Blue:ko.observable(Math.round(i)),Alpha:ko.observable(n)}},e.createHsvaColor=function(t,e,i,n){return void 0===n&&(n=1),{Hue:ko.observable(t),Saturation:ko.observable(e),Value:ko.observable(i),Alpha:ko.observable(n)}},e.areRgbaColorsEqual=function(t,e){return null==t&&null==e||!(!t||!e)&&(t.Red()===e.Red()&&t.Green()===e.Green()&&t.Blue()===e.Blue()&&t.Alpha()===e.Alpha())},e.rgbaToCssColor=function(t){return t?t.Alpha()<1?"rgba("+t.Red()+", "+t.Green()+", "+t.Blue()+", "+t.Alpha()+")":this.rgbaToHexColor(t):"none"},e.updateHueOfRgba=function(t,e){t=this.rgbaToHsvaColor(t),t=this.createHsvaColor(e,t.Saturation(),t.Value(),t.Alpha());return this.hsvaToRgbaColor(t)},e.updateChannelOfRgba=function(t,e,i){switch(e){case n.RgbaChannel.Red:return this.createRgbaColor(i,t.Green(),t.Blue(),t.Alpha());case n.RgbaChannel.Green:return this.createRgbaColor(t.Red(),i,t.Blue(),t.Alpha());case n.RgbaChannel.Blue:return this.createRgbaColor(t.Red(),t.Green(),i,t.Alpha());default:return this.createRgbaColor(t.Red(),t.Green(),t.Blue(),i)}},e.rgbaToHsvaColor=function(t){var e,i=t.Red()/255,n=t.Green()/255,s=t.Blue()/255,o=t.Alpha(),r=Math.max(i,n,s),a=Math.min(i,n,s),l=r-a,u=100*(0===r?0:l/r),t=100*r;if(r===a)e=0;else{switch(r){case i:e=(n-s)/l+(n<s?6:0);break;case n:e=(s-i)/l+2;break;default:e=(i-n)/l+4}e=e/6*360}return this.createHsvaColor(e,u,t,o)},e.hueToCssColor=function(t,e){void 0===e&&(e=1);e=this.hueToRgbaColor(t,e);return this.rgbaToCssColor(e)},e.hueToRgbaColor=function(t,e){void 0===e&&(e=1);e=this.createHsvaColor(t,100,100,e);return this.hsvaToRgbaColor(e)},e.hsvaToRgbaColor=function(t){var e=t.Hue()/360,i=t.Saturation()/100,n=t.Value()/100,s=t.Alpha(),t=Math.floor(6*e),e=6*e-t,o=n*(1-i),r=n*(1-e*i),a=n*(1-(1-e)*i),l=255,u=255,c=255;switch(t%6){case 0:l*=n,u*=a,c*=o;break;case 1:l*=r,u*=n,c*=o;break;case 2:l*=o,u*=n,c*=a;break;case 3:l*=o,u*=r,c*=n;break;case 4:l*=a,u*=o,c*=n;break;default:l*=n,u*=o,c*=r}return this.createRgbaColor(l,u,c,s)},e.rgbaToHexColor=function(t){var e="#";return e+=t.Red().toString(16).padStart(2,"0"),e+=t.Green().toString(16).padStart(2,"0"),e+=t.Blue().toString(16).padStart(2,"0"),t.Alpha()<1&&(e+=Math.round(255*t.Alpha()).toString(16).padStart(2,"0")),e.toUpperCase()},e.parseHexColor=function(t,e){void 0===e&&(e=!0);var i=__read(this.tryParseHexColor(t,e),2),n=i[0],i=i[1];if(n)return i;throw Error("The value '"+(t||"null")+"' must be a valid "+(e?"8-char":"6-char")+" HEX color!")},e.tryParseHexColor=function(t,e){void 0===e&&(e=!0),t=t&&t.trim();e=e?n.RegexUtils.hex8Color():n.RegexUtils.hex6Color();if(t&&e.test(t)){e=(t=t.startsWith("#")?t.substring(1):t).split("");3===e.length?e=[e[0],e[0],e[1],e[1],e[2],e[2]]:4===e.length&&(e=[e[0],e[0],e[1],e[1],e[2],e[2],e[3],e[3]]);t=this.createRgbaColor(parseInt(e[0]+e[1],16),parseInt(e[2]+e[3],16),parseInt(e[4]+e[5],16));return 8===e.length&&t.Alpha(parseFloat((parseInt(e[6]+e[7],16)/255).toFixed(2))),[!0,t]}return[!1,null]},e);function e(){}n.ColorUtils=t}(t.BusinessPack||(t.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){!function(r){"use strict";var n=["B","KB","MB","GB","TB"],a=(t.filesToArray=function(t){for(var e=[],i=0;i<t.length;i++)e.push(t[i]);return e},t.getFileName=function(t){return t.replace(/^.*[\\\/]/,"")},t.getExtension=function(t){return t.slice(1+(t.lastIndexOf(".")-1>>>0))},t.formatSize=function(t){for(var e=0,i=t;1024<=i&&e<n.length-1;)e++,i=Math.floor(i/1024);return e<=2?dotvvm.globalize.formatString("0.##",i)+" "+n[e]:dotvvm.globalize.formatString("0.#",i)+" "+n[e]},t.isImageFile=function(t){return t&&0===t.type.toUpperCase().indexOf("IMAGE/")},t.getFiles=function(t){return this.hasEntries(t)?function(t){for(var i=$.Deferred(),e=[],n=t.items,s=0;s<n.length;s++){var o=a.getEntry(n[s]);e.push(l(o))}return $.when.apply($,e).done(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];i.resolve(r.Utils.concatMany(t))}),i.promise()}(t):$.Deferred().resolve(this.filesToArray(t.files))},t.hasEntries=function(t){return!(!t.items||!t.items.length)&&null!=this.getEntry(t.items[0])},t.getEntry=function(t){return"getAsEntry"in t?t.getAsEntry():"webkitGetAsEntry"in t?t.webkitGetAsEntry():null},t);function t(){}function l(t){var i,n,e,s,o=$.Deferred();return t.isFile?(e=t,s=$.Deferred(),e.file(s.resolve),s.promise().done(function(t){return o.resolve([t])})):t.isDirectory&&(t=t,i=$.Deferred(),n=[],t.createReader().readEntries(function(t){for(var e=0;e<t.length;e++)n.push(l(t[e]));$.when.apply($,n).done(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];i.resolve(r.Utils.concatMany(t))})}),i.promise().done(o.resolve)),o.promise()}r.FileUtils=a}(t.BusinessPack||(t.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){!function(i){"use strict";var t=(o.getNode=function(t){return $(t)[0]||null},o.isElement=function(t){return t&&t.nodeType===Node.ELEMENT_NODE},o.isText=function(t){return t&&t.nodeType===Node.TEXT_NODE},o.isWhitespace=function(t){return this.isText(t)&&0===i.Utils.normalizeSpaces(t.nodeValue).trim().length},o.splitText=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];for(var n=[],s=1;s<=e.length;s++){var o=e[s-1];t=t.splitText(o),n.push(t.previousSibling),s===e.length&&n.push(t)}return n},o.isInAnchor=function(t){return $(t).parent().is("a")},o.isLast=function(t){t=this.getNode(t);return t&&!t.nextSibling},o.isLastOrFalsy=function(t){t=this.getNode(t);return!t||!t.nextSibling},o.isEmpty=function(t){var e=this.getNode(t);return!$(t).is(this.emptySelector)&&(e.hasChildNodes()?1===e.childNodes.length&&this.isEmpty(e.firstChild):0===i.Utils.normalizeSpaces(e.textContent).length)},o.isInlineContent=function(t){var e=this.getNode(t);return this.isText(e)||$(t).is(this.inlineSelector)},o.getInlineContents=function(t){var i=this;return t.contents().filter(function(t,e){return i.isInlineContent(e)})},o.getWithNextInlineContents=function(t){var e=this.getNextInlineContents(t);return t.add(e)},o.getNextInlineContents=function(t){var e=$([]);if(t.length)for(var i=t[0].nextSibling;this.isInlineContent(i);)e=e.add(i),i=i.nextSibling;return e},o.getNextAllInlineContents=function(t){var e=$([]);if(t.length)for(var i=t[0].nextSibling;i;)this.isInlineContent(i)&&(e=e.add(i)),i=i.nextSibling;return e},o.getWithNextContents=function(t){var e=this.getNextContents(t);return t.add(e)},o.getNextNode=function(t){if(t.hasChildNodes())return t.firstChild;for(;t&&!t.nextSibling;)t=t.parentNode;return t?t.nextSibling:null},o.getNextText=function(t){t=t.nextSibling;if(t){if(this.isText(t))return t;t=t.firstChild;if(t&&this.isText(t))return t}return null},o.getNextContents=function(t){var e=$([]);if(t.length)for(var i=t[0].nextSibling;i;)e=e.add(i),i=i.nextSibling;return e},o.removeEmptyText=function(t){if(t.length){for(var e=[],i=this.createTreeWalker(t[0],NodeFilter.SHOW_TEXT,function(t){return!t.nodeValue.length});i.nextNode();)e.push(i.currentNode);$(e).remove()}},o.hasOnlyOneRow=function(t){return 1===t.find("> thead > tr, > tbody > tr, > tr").length},o.hasOnlyOneColumn=function(t){return 1===t.find("> thead > tr, > tbody > tr, > tr").first().children().length},o.reverse=function(t){for(var e=$([]),i=t.length;i--;)e=e.add(t[i]);return e},o.clone=function(t,e){var i,n,s=$([]);try{for(var o=__values(t.get()),r=o.next();!r.done;r=o.next())var a=r.value,s=s.add($(a.cloneNode(e)))}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},o.cloneAs=function(t,e,i){var n,s,o=$([]);try{for(var r=__values(t.get()),a=r.next();!a.done;a=r.next()){for(var l=a.value.cloneNode(i),u=document.createElement(e),c=0,h=l.attributes.length;c<h;++c){var d=l.attributes.item(c).nodeName,p=l.attributes.item(c).nodeValue;u.setAttribute(d,p)}$(u).append($(l).contents()),o=o.add(u)}}catch(t){n={error:t}}finally{try{a&&!a.done&&(s=r.return)&&s.call(r)}finally{if(n)throw n.error}}return o},o.getPath=function(t,e){return t.is(e)?[]:e.parentsUntil(t).addBack().get().map(this.getOffset)},o.fromPath=function(t,e){var i,n,s=t[0];try{for(var o=__values(e),r=o.next();!r.done;r=o.next())var a=r.value,s=s.childNodes.length<=a?s.childNodes[s.childNodes.length-1]:s.childNodes[a]}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return $(s)},o.closestUntil=function(t,e,i){t=$(t);return t.is(e)?$([]):t.is(i)?t:t.parentsUntil(e,i).first()},o.canMerge=function(t,e){var n=this.getNode(t),s=this.getNode(e);return!(!this.isElement(n)||!this.isElement(s))&&(n.tagName===s.tagName&&n.className===s.className&&n.attributes.length===s.attributes.length&&function(){for(var t=0;t<n.attributes.length;t++){var e=n.attributes.item(t),i=s.attributes.getNamedItem(e.name);if(!i||e.value!==i.value)return!1}return!0}())},o.getOffset=function(t){for(var e=0;t=t.previousSibling;)e+=1;return e},o.trim=function(t){for(var e=t[0],i=e.childNodes.length-1;0<=i;i--){var n=e.childNodes[i],s=$(n);o.isText(n)?o.isEmpty(n)?s.remove():o.isWhitespace(n)&&t.before(s):(this.trim(s),this.isEmpty(n)&&s.remove())}return t},o.createTreeWalker=function(t,e,i){e=e||NodeFilter.SHOW_ALL,i=i||function(){return!0};function n(t){return i(t)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}return n.acceptNode=n,document.createTreeWalker(t,e,n,!1)},o.inlineSelector="a,abbr,acronym,b,bdo,big,br,button,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,img,input,kbd,li,label,map,object,q,samp,select,small,span,strikeout,strong,sub,sup,textarea,time,tt,u,var",o.emptySelector="area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed",o.blockSelector=":not("+o.inlineSelector+")",o);function o(){}i.DomUtils=t}(t.BusinessPack||(t.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){!function(e){"use strict";var t=(i.autoFocus=function(t){(t=void 0===t?$(document):t).find(":input:enabled[autofocus],[tabindex]."+e.BusinessPackCss.flagAutoFocusable).first().focus().select()},i);function i(){}e.FocusManager=t,dotvvm.events.initCompleted.subscribe(function(){return t.autoFocus()})}(t.BusinessPack||(t.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){!function(m){"use strict";var y;(t=y=m.DayOfWeek||(m.DayOfWeek={}))[t.Sunday=0]="Sunday",t[t.Monday=1]="Monday",t[t.Tuesday=2]="Tuesday",t[t.Wednesday=3]="Wednesday",t[t.Thursday=4]="Thursday",t[t.Friday=5]="Friday",t[t.Saturday=6]="Saturday";var t=(e.addDays=function(t,e){return(t=new Date(t)).setDate(t.getDate()+e),t},e.addHours=function(t,e){return(t=new Date(t)).setHours(t.getHours()+e),t},e.addMiliseconds=function(t,e){return(t=new Date(t)).setMilliseconds(t.getMilliseconds()+e),t},e.addMinutes=function(t,e){return(t=new Date(t)).setMinutes(t.getMinutes()+e),t},e.addMonths=function(t,e){var i=t.getMonth()+e,e=this.getDaysInMonth(t.getFullYear(),i);return(t=new Date(t)).setDate(Math.min(e,t.getDate())),t.setMonth(i),t},e.addSeconds=function(t,e){return(t=new Date(t)).setSeconds(t.getSeconds()+e),t},e.addYears=function(t,e){return(t=new Date(t)).setFullYear(t.getFullYear()+e),t},e.getStartOfDay=function(t){return(t=new Date(t)).setHours(0,0,0,0),t},e.getEndOfDay=function(t){return(t=new Date(t)).setHours(23,59,59,999),t},e.getMonthDates=function(t,e){for(var i=[],n=new Date(t,e,1);n.getMonth()===e;)i.push(new Date(n)),n.setDate(n.getDate()+1);return i},e.getDaysInMonth=function(t,e){return new Date(t,e+1,0).getDate()},e.getMonthWeeks=function(t,e,i){var n,s;void 0===i&&(i=y.Sunday);var o=[],r=this.getMonthDates(t,e),e=m.Utils.fixNumberOverflow(i-1,7),a=r[0],l=m.Utils.fixNumberOverflow(a.getDay()-i,7),u=r[r.length-1],c=m.Utils.fixNumberOverflow(e-u.getDay(),7),h=[];if(0<l)for(var d=1;d<=l;d++)r.unshift(new Date(a.getFullYear(),a.getMonth(),a.getDate()-d));else for(d=1;d<=7;d++)r.unshift(new Date(a.getFullYear(),a.getMonth(),a.getDate()-d));if(0<c)for(d=1;d<=c;d++)r.push(new Date(u.getFullYear(),u.getMonth(),u.getDate()+d));if(r.length<42)for(d=1;d<=7;d++)r.push(new Date(u.getFullYear(),u.getMonth(),u.getDate()+c+d));try{for(var p=__values(r),g=p.next();!g.done;g=p.next()){var f=g.value;h.push(f),7===h.length&&o.push(h.splice(0,7))}}catch(t){n={error:t}}finally{try{g&&!g.done&&(s=p.return)&&s.call(p)}finally{if(n)throw n.error}}return o},e.getWeekNumber=function(t,e){e=(e=void 0===e?y.Sunday:e)+3;(t=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()))).setUTCDate(t.getUTCDate()+e-t.getUTCDay());e=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((+t-+e)/864e5+1)/7)},e.isLeapMonth=function(t,e){return 1===e&&29===new Date(t,e,29).getDate()},e.unwrapDate=function(t){return"string"==typeof(t=ko.unwrap(t))?dotvvm.serialization.parseDate(t):t||null},e);function e(){}m.DateUtils=t}(t.BusinessPack||(t.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){var e;e=t.BusinessPack||(t.BusinessPack={}),function(){"use strict";function t(t){if(this.$element=t,this.$window=$(window),this.$document=$(document),1!==t.length)throw Error("UI primitives can only be initialized using JQuery objects containing exactly one element.")}(e.Controls||(e.Controls={})).PrimitiveBase=t}()}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var n,e=(n=t.PrimitiveBase,__extends(i,n),Object.defineProperty(i.prototype,"isOpened",{get:function(){return this.$element.hasClass(s.BusinessPackCss.stateOpened)},enumerable:!0,configurable:!0}),i.prototype.toggle=function(t){(t=void 0===t?!this.isOpened:t)?this.isOpened?this.update():this.open():this.close()},i.prototype.open=function(t){var e=this;"function"==typeof t?this.$element.on("open",t):this.isOpened||(this.$element.addClass(s.BusinessPackCss.stateOpened),this.updateInterval=setInterval(function(){return e.update()},10),window.addEventListener("scroll",this.scrollHandler,!0),this.update(),this.$element.trigger("open"))},i.prototype.close=function(t){"function"==typeof t?this.$element.on("close",t):this.isOpened&&(this.$element.removeClass(s.BusinessPackCss.stateOpened),window.removeEventListener("scroll",this.scrollHandler,!0),clearInterval(this.updateInterval),this.$element.trigger("close"))},i.prototype.update=function(){var t,e,i,n,s,o,r,a,l,u;this.isOpened&&(t=this.$parent.outerWidth(),a=this.$parent.outerHeight(),e=this.$parent.offset(),i=this.$element.outerWidth(),n=this.$element.outerHeight(),l=parseFloat(this.$element.css("margin-top")),s=i-t,o=this.$document.scrollTop(),u=this.$document.scrollLeft(),r=e.top+a-o,a=e.left-u,r+n>window.innerHeight&&(0<=(l=e.top-n-o-2*l)&&(r=l)),a+i>window.innerWidth&&0<s&&(0<=(u=e.left-s-u)&&(a=u)),this.$element.css({top:r,left:a}),this.hasExplicitWidth||this.$element.css({minWidth:"14em",maxWidth:t}))},i.prototype.onScroll=function(t){},i);function i(t,e){void 0===e&&(e=!1);var i=n.call(this,t)||this;return i.hasExplicitWidth=e,i.$parent=t.parent(),i.scrollHandler=function(t){return i.onScroll(t)},i}t.PopupPanel=e}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var n,e=(n=t.PrimitiveBase,__extends(i,n),i.prototype.update=function(t){"function"==typeof t?this.$element.on("update",t):this.$element.trigger("update")},i.prototype.change=function(t){"function"==typeof t?this.$element.on("change",t):this.$element.trigger("change")},i.prototype.onElementMousedown=function(t){t.stopPropagationAndPreventDefault(),this.initialX=t.pageX,this.initialY=t.pageY,this.$document.mousemove(this.onDocumentMousemoveHandler),this.$document.mouseup(this.onDocumentMouseupHandler)},i.prototype.onDocumentMousemove=function(t){t.stopPropagationAndPreventDefault();var e=this.calculatePageX(t),i=this.calculatePageY(t),n=this.calculateLeft(e),t=this.calculateTop(i);this.hasUpdated=!0,this.$element.css({left:Math.round(n),top:Math.round(t)}),this.update(),this.initialX=e,this.initialY=i},i.prototype.onDocumentMouseup=function(t){this.$document.off("mousemove",this.onDocumentMousemoveHandler),this.$document.off("mouseup",this.onDocumentMouseupHandler),this.hasUpdated&&(this.change(),this.hasUpdated=!1),this.initialX=null,this.initialY=null},i.prototype.calculatePageX=function(t){var e,i=t.pageX;return this.restrictToParent&&(e=this.$parent.offset(),t=this.$parent.outerWidth(),i<e.left?i=e.left:i>e.left+t&&(i=e.left+t)),i},i.prototype.calculatePageY=function(t){var e,i=t.pageY;return this.restrictToParent&&(e=this.$parent.offset(),t=this.$parent.outerHeight(),i<e.top?i=e.top:i>e.top+t&&(i=e.top+t)),i},i.prototype.calculateLeft=function(t){var e,i=this.$element.position().left+(t-this.initialX);return this.restrictToParent&&(e=this.$element.outerWidth(),t=this.$parent.outerWidth(),i<0?i=0:t<i+e&&(i=t-e)),i},i.prototype.calculateTop=function(t){var e,i=this.$element.position().top+(t-this.initialY);return this.restrictToParent&&(e=this.$element.outerHeight(),t=this.$parent.outerHeight(),i<0?i=0:t<i+e&&(i=t-e)),i},i);function i(t,e){void 0===e&&(e=!1);var i=n.call(this,t)||this;return i.restrictToParent=e,i.hasUpdated=!1,i.$parent=t.parent(),t.mousedown(i.onElementMousedown.bind(i)).css("cursor","move"),i.onDocumentMousemoveHandler=i.onDocumentMousemove.bind(i),i.onDocumentMouseupHandler=i.onDocumentMouseup.bind(i),i}t.Movable=e}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var n,e=(n=t.PrimitiveBase,__extends(i,n),i.prototype.update=function(t){"function"==typeof t?this.$element.on("update",t):this.$element.trigger("update")},i.prototype.change=function(t){"function"==typeof t?this.$element.on("change",t):this.$element.trigger("change")},i.prototype.reset=function(){this.$element.css({left:this.initialX,top:this.initialY}).width(0).height(0).hide()},i.prototype.getSelectedItems=function(){var i=this,t=this.options.itemSelector,n=[];return t&&this.$trigger.find(t).each(function(t,e){i.doesItemCollide($(e))&&n.push(e)}),n},i.prototype.getDefaultOptions=function(){return{itemSelector:"."+s.BusinessPackCss.primitiveItem,restrictToParent:!1,minWidth:0,minHeight:0}},i.prototype.onTriggerMousedown=function(t){var e;this.shouldStartSelection(t)&&(t.stopPropagationAndPreventDefault(),e=this.$parent.offset(),this.initialX=t.pageX-e.left,this.initialY=t.pageY-e.top,this.$document.mousemove(this.onDocumentMousemoveHandler),this.$document.mouseup(this.onDocumentMouseupHandler))},i.prototype.onDocumentMousemove=function(t){t.stopPropagationAndPreventDefault();var e=this.options,i=e.aspectRatio,n=e.tempAspectRatio,s=e.restrictToParent,o=e.minWidth,r=e.minHeight;!i&&n&&t.shiftKey&&(i=n);var a=this.calculatePageX(t),l=this.calculatePageY(t),e=Math.abs(this.initialX-a),n=Math.abs(this.initialY-l);i?(c=n*i,u=e/i,this.lockX||e<c?e=c:n=u):this.lockX?e=this.$element.width():this.lockY&&(n=this.$element.height());var u,t=this.calculateLeft(a,l,e),c=this.calculateTop(a,l,n);i&&s&&(u=this.$parent.outerWidth(),a=this.$parent.outerHeight(),l=this.$element.position(),0<(s=t+e-u)&&(t-=s),0<(s=c+n-a)&&(c-=s),t=Math.max(0,t),c=Math.max(0,c),a<n&&(e=(n=a)*i,t=l.left),u<e&&(n=(e=u)/i,c=l.top)),o<=e||r<=n?(this.isActive=!0,this.hasUpdated=!0,this.$element.width(Math.round(e)).height(Math.round(n)).css({top:Math.round(c),left:Math.round(t)}).show(),this.update()):this.refreshContents()},i.prototype.onDocumentMouseup=function(t){this.$document.off("mousemove",this.onDocumentMousemoveHandler),this.$document.off("mouseup",this.onDocumentMouseupHandler),this.hasUpdated&&(this.change(),this.hasUpdated=!1),this.isActive=!1,this.initialX=null,this.initialY=null,this.lockX=!1,this.lockY=!1},i.prototype.shouldStartSelection=function(t){return!t.ctrlKey&&this.$trigger.is(t.target)},i.prototype.calculatePageX=function(t){var e=this.$parent.offset(),t=t.pageX-e.left;return this.options.restrictToParent&&(e=this.$parent.outerWidth(),t<0?t=0:e<t&&(t=e)),t},i.prototype.calculatePageY=function(t){var e=this.$parent.offset(),t=t.pageY-e.top;return this.options.restrictToParent&&(e=this.$parent.outerHeight(),t<0?t=0:e<t&&(t=e)),t},i.prototype.calculateLeft=function(t,e,i){return t<=this.initialX&&e>=this.initialY||!(t>=this.initialX&&e<=this.initialY)&&t<this.initialX&&e<this.initialY?this.lockX?this.initialX-i/2:this.initialX-i:this.lockX?this.initialX-i/2:this.initialX},i.prototype.calculateTop=function(t,e,i){return!(t<=this.initialX&&e>=this.initialY)&&(t>=this.initialX&&e<=this.initialY||t<this.initialX&&e<this.initialY)?this.lockY?this.initialY-i/2:this.initialY-i:this.lockY?this.initialY-i/2:this.initialY},i.prototype.doesItemCollide=function(t){var e=this.$element.offset().top,i=this.$element.offset().left,n=t.offset().top,s=t.offset().left;return!(e+this.$element.height()<n||e>n+t.height()||i+this.$element.width()<s||i>s+t.width())},i.prototype.refreshContents=function(){},i);function i(t,e){var i=n.call(this,t)||this;return i.isActive=!1,i.hasUpdated=!1,i.options=__assign({},i.getDefaultOptions(),e),i.$parent=t.parent(),i.$trigger=i.options.$trigger||i.$parent,i.onDocumentMousemoveHandler=i.onDocumentMousemove.bind(i),i.onDocumentMouseupHandler=i.onDocumentMouseup.bind(i),i.$trigger.mousedown(i.onTriggerMousedown.bind(i)),i.update(function(){return i.refreshContents()}),i.reset(),i}t.SelectionBox=e}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var i;!function(t){"use strict";var e=(a.watch=function(t,e){var i=!1;return ko.isObservable(t)?new a(t,function(){ko.delaySync.isPaused?i||(i=!0,ko.delaySync.run(function(){e(t.peek()),i=!1})):e(t.peek())}):null},a.prototype.onArrayChange=function(t){var e,i;try{for(var n=__values(t),s=n.next();!s.done;s=n.next()){var o=s.value,r=o.status,o=o.value;ko.isObservable(o)&&("added"===r?this.watchers.push(new a(o,this.runCallback)):"deleted"!==r||(o=this.findWatcher(o))&&(o.dispose(),this.watchers.splice(this.watchers.indexOf(o),1)))}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}this.runCallback()},a.prototype.watchArray=function(t){var e,i;if(t)try{for(var n=__values(t),s=n.next();!s.done;s=n.next()){var o=s.value;ko.isObservable(o)&&this.watchers.push(new a(o,this.runCallback))}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}},a.prototype.onObjectChange=function(t){for(;this.watchers.length;)this.watchers.pop().dispose();this.watchObject(t),this.runCallback()},a.prototype.watchObject=function(t){for(var e in t)!t.hasOwnProperty(e)||e.startsWith("$")||e.endsWith("$options")||(e=t[e],ko.isObservable(e)&&this.watchers.push(new a(e,this.runCallback)))},a.prototype.findWatcher=function(t){var e,i;try{for(var n=__values(this.watchers),s=n.next();!s.done;s=n.next()){var o=s.value;if(o.observable===t)return o}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}return null},a.prototype.dispose=function(){for(this.subscription&&(this.subscription.dispose(),this.subscription=null);this.watchers.length;)this.watchers.pop().dispose()},a);function a(t,e){this.observable=t,this.runCallback=e,this.watchers=[],i.Utils.isObservableArray(t)?(this.subscription=t.subscribe(this.onArrayChange,this,"arrayChange"),this.watchArray(t.peek())):(this.subscription=t.subscribe(this.onObjectChange,this),this.watchObject(t.peek()))}t.ObservableWatcher=e}((i=t.BusinessPack||(t.BusinessPack={})).Controls||(i.Controls={}))}(DotVVM=DotVVM||{}),function(t){var i;!function(s){"use strict";var t=(e.prototype.on=function(t,e){return t&&e&&(this.events[t]=this.events[t]||[],this.events[t].push(e)),this},e.prototype.off=function(t,e){if(t){if(this.events.hasOwnProperty(t))if(e)for(var i=this.events[t],n=i.length;n--;)i[n][0]===e&&i.splice(n,1);else delete this.events[t]}else this.events={}},e.prototype.trigger=function(t){for(var e,i,n,s,o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];try{for(var a=__values(t.split(" ")),l=a.next();!l.done;l=a.next()){var u=l.value;if(this.events.hasOwnProperty(u)){var c=this.events[u];try{for(var h=__values(c),d=h.next();!d.done;d=h.next())d.value.apply(null,o)}catch(t){n={error:t}}finally{try{d&&!d.done&&(s=h.return)&&s.call(h)}finally{if(n)throw n.error}}}}}catch(t){e={error:t}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}},e.prototype.disposing=function(t){return this.on("disposing",t)},e.prototype.dispose=function(){this.trigger("disposing"),this.$window.off(this.eventNs),this.$document.off(this.eventNs),this.off()},e.prototype.subscribe=function(t,e){var i,n;void 0!==t&&(i=e.bind(this),ko.delaySync.run(function(){return i(ko.unwrap(t),!0)}),ko.isObservable(t)&&(n=t.subscribe(function(t){return ko.delaySync.run(function(){return i(t,!1)})}),this.disposing(function(){return n.dispose()})))},e.prototype.watch=function(t,e){var i,n;void 0!==t&&(i=e.bind(this),ko.delaySync.run(function(){return i(ko.unwrap(t),!0)}),ko.isObservable(t)&&(n=s.ObservableWatcher.watch(t,function(t){return i(t,!1)}),this.disposing(function(){return n.dispose()})))},e);function e(){this.$window=$(window),this.$document=$(document),this.eventNs="."+i.Utils.createGuid(!1),this.events={}}s.ReactiveBase=t}((i=t.BusinessPack||(t.BusinessPack={})).Controls||(i.Controls={}))}(DotVVM=DotVVM||{}),function(t){var r;!function(t){"use strict";var o,e=(o=t.ReactiveBase,__extends(i,o),Object.defineProperty(i.prototype,"isEnabled",{get:function(){var t=ko.unwrap(this.binding.enabled);return void 0===t||t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bindingProvider",{get:function(){return ko.bindingProvider.instance},enumerable:!0,configurable:!0}),i.prototype.initialize=function(){this.subscribe(this.binding.visible,this.onVisibleChange),this.subscribe(this.binding.enabled,this.onEnabledChange)},i.prototype.show=function(t,i){var n,s=this;void 0===t&&(t=!1),!1!==ko.unwrap(this.binding.visible)&&(t?(this.$element.removeClass(r.BusinessPackCss.stateHidden),i&&i()):(this.originalStyleHeight=this.originalStyleHeight||this.getInlineStyleHeight(),this.originalStyleHeight?(n=this.originalStyleHeight,this.$element.addClass(r.BusinessPackCss.stateShowing).removeClass(r.BusinessPackCss.stateHidden)):(n=this.$element.addClass(r.BusinessPackCss.stateShowing).removeClass(r.BusinessPackCss.stateHidden).height(),this.$element.height(0)),window.requestAnimationFrame(function(){s.$element.height(n);var t=s.getAnimationDuration(),e=setTimeout(function(){s.$element.css("height",s.originalStyleHeight).removeClass(r.BusinessPackCss.stateShowing),s.originalStyleHeight=void 0,i&&i(),window.clearTimeout(e)},t)})))},i.prototype.hide=function(t,i){var n=this;(t=void 0===t?!1:t)?(this.$element.addClass(r.BusinessPackCss.stateHidden),i&&i()):(this.originalStyleHeight=this.originalStyleHeight||this.getInlineStyleHeight(),this.$element.height(this.$element.height()),window.requestAnimationFrame(function(){n.$element.addClass(r.BusinessPackCss.stateHiding);var t=n.getAnimationDuration(),e=setTimeout(function(){n.$element.addClass(r.BusinessPackCss.stateHidden).removeClass(r.BusinessPackCss.stateHiding).css("height",n.originalStyleHeight),n.originalStyleHeight=void 0,i&&i(),window.clearTimeout(e)},t)}))},i.prototype.toggle=function(t,e,i){void 0===e&&(e=!1),t?this.show(e,i):this.hide(e,i)},i.prototype.outside=function(e,i){function t(t){return t=$.Event(e,t),n.isOutsideOfTree(t.target)?i(t):void 0}var n=this;this.disposing(function(){return document.removeEventListener(e,t,!0)}),document.addEventListener(e,t,!0)},i.prototype.updateTemplate=function(t,e){var i=this.getTemplateId(t);i&&(t=this.$element.children("script[id='"+i()+"']"),e(e=$("<div>").append(t.text())),t.text(e.html()),i.valueHasMutated())},i.prototype.getTemplateId=function(t){if(this._templateIds.hasOwnProperty(t))return this._templateIds[t];var e=this.$element.children("script[id$='."+t+"'][type='text/html']");return e.length?this._templateIds[t]=ko.observable(e.attr("id")):null},i.prototype.onVisibleChange=function(t,e){void 0!==t&&this.toggle(!!t,e)},i.prototype.onEnabledChange=function(){this.$element.toggleClass(r.BusinessPackCss.stateDisabled,!this.isEnabled),null!=this.binding.tabIndex&&this.toggleTabIndex()},i.prototype.toggleTabIndex=function(){this.isEnabled?this.$element.attr("tabindex",this.binding.tabIndex):this.$element.removeAttr("tabindex")},i.prototype.isOutsideOfTree=function(t){return!t||!this.$element.is(t)&&0===this.$element.find($(t)).length},i.prototype.postback=function(t){return t?t():void 0},i.prototype.emptyPostback=function(){dotvvm.postbackScript("null")("root",this.$element[0],[],"",!0,"$root",null,null)},i);function i(t,e,i,n){var s=o.call(this)||this;return s.$element=t,s.binding=e,s.allBindings=i,s.bindingContext=n,s._templateIds={},s.getAnimationDuration=function(){return Math.max(s.getTimeInMiliseconds(s.$element.css("transition-duration")),s.getTimeInMiliseconds(s.$element.css("animation-duration")),0)},s.getTimeInMiliseconds=function(t){var e=parseFloat(t);return isNaN(e)?0:t.endsWith("s")?1e3*e:e},s.getInlineStyleHeight=function(){return s.$element[0].style.height},s}t.ControlBase=e}((r=t.BusinessPack||(t.BusinessPack={})).Controls||(r.Controls={}))}(DotVVM=DotVVM||{}),function(t){var e,i;function n(){return null!==i&&i.apply(this,arguments)||this}t=(e=t.BusinessPack||(t.BusinessPack={})).Controls||(e.Controls={}),i=t.ControlBase,__extends(n,i),n.prototype.isFilterCondition=function(t){return"FilterCondition"===ko.unwrap(t).Type()},n.prototype.isFilterGroup=function(t){return"FilterGroup"===ko.unwrap(t).Type()},e=n,t.FilterControlBase=e}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),n);function n(){return null!==e&&e.apply(this,arguments)||this}t.EditorBase=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),Object.defineProperty(n.prototype,"items",{get:function(){return s.Utils.getDataSourceItems(this.binding.dataSource)},enumerable:!0,configurable:!0}),n.prototype.getItemKey=function(t){var e=ko.unwrap(t),i=this.getItemKeyBinding();if(null==e)throw Error("The unique key can't be resolved for null or undefined.");if("object"==typeof(e=i?ko.unwrap(i(t)):e)&&null!=e)throw Error("The unique key can't be resolved. Is KeyBinding property missing?");return e},n.prototype.findItemByKey=function(e){var i=this;return e=ko.unwrap(e),this.findItem(function(t){return i.getItemKey(t)===e})},n.prototype.getItemValueCopy=function(t){return s.Utils.deepClone(this.getItemValue(t))},n.prototype.getItemValue=function(t){var e=ko.unwrap(t),i=this.getItemValueBinding();if(null==e)throw Error("The value can't be resolved for null or undefined.");return e=i?ko.unwrap(i(t)):e},n.prototype.isValueOfItem=function(t,e){t=ko.unwrap(t);var i=this.getItemValueBinding();return s.Utils.isDataAccessor(i)?this.getItemKey(t)===this.getItemKey(e):t===this.getItemValue(e)},n.prototype.findItemByValue=function(e){var i=this;e=ko.unwrap(e);var t=this.getItemValueBinding();if(null!=e&&s.Utils.isDataAccessor(t)){var n=this.getItemKey(e);return this.findItem(function(t){return i.getItemKey(t)===n})}return this.findItem(function(t){return i.getItemValue(t)===e})},n.prototype.getItemText=function(t){var e=ko.unwrap(t),i=this.getItemTextBinding();if(null==e)throw Error("The text can't be resolved for null or undefined.");if("object"==typeof(e=i&&null==(e=ko.unwrap(i(t)))?"":e))throw Error("The text can't be resolved. Is ItemTextBinding property missing?");return e},n.prototype.createItemFromText=function(t){var e=this.getItemTextBinding();if(!s.Utils.isDataAccessor(e))throw Error("The item can't be created. The ItemTextBinding must not be set.");return t},n.prototype.findItemByText=function(e){var i=this;return this.findItem(function(t){return i.getItemText(t)===e})},n.prototype.findItemInDataSourceOrAdd=function(t){var e=this,i=this.items(),n=this.getItemKey(t),i=i.asLinq().firstOrDefault(function(t){return e.getItemKey(t)===n});return i||(i=s.Utils.ensureObservable(t),this.items.push(i)),i},n.prototype.findItem=function(t){return this.getAllItems().asLinq().firstOrDefault(t)},n.prototype.removeAllItemsExcept=function(e){var i=this;this.items.remove(function(t){return e.indexOf(i.getItemKey(t))<0})},n.prototype.warnThatKeyWasNotFound=function(t){console.warn("An item with key equal to '"+t+"' couldn't be found in the DataSource.")},n.prototype.warnThatValueWasNotFound=function(t){t=ko.unwrap(t),console.warn("object"==typeof t?"An item with key equal to '"+this.getItemKey(t)+"' couldn't be found in the DataSource. This issue can be also caused by a known bug and it's required that the name of the DataSource property has to come first in alphabetical order with the name of the SelectedValue / SelectedValues property.":"An item with value equal to '"+t+"' couldn't be found in the DataSource. This issue can be also caused by a known bug and it's required that the name of the DataSource property has to come first in alphabetical order with the name of the SelectedValue / SelectedValues property.")},n.prototype.getAllItems=function(){return this.items()},n.prototype.getItemKeyBinding=function(){return null},n.prototype.getItemValueBinding=function(){return null},n.prototype.getItemTextBinding=function(){return null},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.ItemsControlBase=i}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var u;!function(t){"use strict";var e,i=(e=t.ItemsControlBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.watch(this.binding.dataSource,this.onDataSourceChange)},n.prototype.isRootItem=function(t){var e=this,i=this.items(),n=this.getItemKey(t);return i.asLinq().any(function(t){return e.getItemKey(t)===n})},n.prototype.hasChildren=function(t){var e=this.binding.itemChildrenBinding;if(e){t=ko.unwrap(e(t));return t&&!!t.length}return!1},n.prototype.getChildren=function(t){var e=this.binding.itemChildrenBinding;return e&&ko.unwrap(e(t))||[]},n.prototype.getParent=function(t){var e=this,i=this.getAllItems(),n=this.getItemKey(t);return i.asLinq().where(function(t){return e.getItemKey(t)===n}).select(function(t){return t.$parent}).singleOrDefault()},n.prototype.getAllItems=function(){return ko.unwrap(this.allItems)},n.prototype.onDataSourceChange=function(){this.allItems(this.getItemsRecursively(null,this.items()))},n.prototype.getItemsRecursively=function(t,e){var i,n,s=[];try{for(var o=__values(e),r=o.next();!r.done;r=o.next()){var a=r.value;a.$parent=t,s.push(a);var l=this.getChildren(a);l.length&&u.Utils.pushAll(s,this.getItemsRecursively(a,l))}}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},n);function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.allItems=ko.observableArray(),t}t.HierarchyItemsControlBase=i}((u=t.BusinessPack||(t.BusinessPack={})).Controls||(u.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ItemsControlBase,__extends(n,e),n.prototype.canBeChecked=function(t){var e=this.binding.itemEnabledBinding;return!!this.isEnabled&&(!e||ko.unwrap(e(t)))},n.prototype.getItemKeyBinding=function(){return this.binding.itemKeyBinding||this.getItemValueBinding()},n.prototype.getItemValueBinding=function(){return this.binding.itemValueBinding},n.prototype.getItemStyle=function(t){t=ko.unwrap(t);var e={};return e[s.BusinessPackCss.stateChecked]=this.isSelected(t),e},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.CheckableControlListBase=i}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(e){"use strict";var i,t=(i=e.ItemsControlBase,__extends(n,i),n.prototype.initialize=function(){i.prototype.initialize.call(this),this.searchEngine=this.createSearchEngine(),this.watch(this.binding.dataSource,this.onDataSourceChange)},n.prototype.hasBeenFound=function(t){var e=this;if(null==(t=ko.unwrap(t)))return!1;var i=this.getItemKey(t);return this.searchResults().asLinq().any(function(t){return e.getItemKey(t)===i})},n.prototype.search=function(t){var r=this;this.searchEngine.search(t).then(function(t){var e,i;try{for(var n=__values(t),s=n.next();!s.done;s=n.next()){var o=s.value;r.findItemInDataSourceOrAdd(o)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}r.searchResults(t)})},n.prototype.onDataSourceChange=function(){this.searchEngine.clear(),this.searchEngine.preload(this.items())},n.prototype.createSearchEngine=function(){var t=this.binding.loadItems;return new e.SearchEngine({getItemKey:this.getItemKey.bind(this),getItemText:this.getItemText.bind(this),loadItems:t})},n.prototype.getItemKeyBinding=function(){return this.binding.itemTextBinding},n.prototype.getItemValueBinding=function(){return this.binding.itemTextBinding},n.prototype.getItemTextBinding=function(){return this.binding.itemTextBinding},n);function n(){var t=null!==i&&i.apply(this,arguments)||this;return t.searchResults=ko.observableArray(),t.selectedValues=ko.observableArray(),t}e.ItemsEditorBase=t}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.ItemsEditorBase,__extends(n,e),n.prototype.isItemEnabled=function(t){var e=this.binding.itemEnabledBinding;return!!this.isEnabled&&(!e||ko.unwrap(e(t)))},n.prototype.search=function(t){null==t?(this.searchResults(this.items()),this.searchEngine.cancel()):e.prototype.search.call(this,t)},n.prototype.onDataSourceChange=function(){e.prototype.onDataSourceChange.call(this),this.searchResults(this.items())},n.prototype.getItemKeyBinding=function(){return this.binding.itemKeyBinding||this.getItemValueBinding()},n.prototype.getItemValueBinding=function(){return this.binding.itemValueBinding},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.SelectorBase=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var i,e=(i=t.ControlBase,__extends(n,i),n.prototype.initialize=function(){var e=this;i.prototype.initialize.call(this),this.$element.focusin(function(t){return e.onElementFocusin(t)}),this.$element.focusout(function(t){return e.onElementFocusout(t)}),this.setDisabledAttribute()},n.prototype.onEnabledChange=function(){i.prototype.onEnabledChange.call(this),this.setDisabledAttribute()},n.prototype.onElementFocusin=function(t){this.isEnabled&&this.$element.addClass(s.BusinessPackCss.stateFocused)},n.prototype.onElementFocusout=function(t){this.$element.removeClass(s.BusinessPackCss.stateFocused)},n.prototype.setDisabledAttribute=function(){0==this.isEnabled?this.$element.attr("disabled","true"):this.$element.removeAttr("disabled")},n);function n(){return null!==i&&i.apply(this,arguments)||this}t.ButtonBase=e}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.ReactiveBase,__extends(n,e),Object.defineProperty(n.prototype,"isEmpty",{get:function(){return!this.stack.length},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"canRedo",{get:function(){return this.stack.length-1>this.stackOffset},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"canUndo",{get:function(){return 0<this.stackOffset},enumerable:!0,configurable:!0}),n.prototype.apply=function(t){this.on("apply",t)},n.prototype.record=function(t){this.stackOffset++,this.stack.length>this.stackOffset&&(this.stack=this.stack.slice(0,this.stackOffset)),this.stack.push(t)},n.prototype.rewind=function(){this.stack.length&&this.trigger("apply",this.stack[0])},n.prototype.redo=function(){this.canRedo&&this.trigger("apply",this.stack[++this.stackOffset])},n.prototype.undo=function(){this.canUndo&&this.trigger("apply",this.stack[--this.stackOffset])},n.prototype.reset=function(){this.stack=[],this.stackOffset=-1},n);function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.stack=[],t.stackOffset=-1,t}t.UndoManager=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var h;!function(t){"use strict";var e=(Object.defineProperty(i.prototype,"isRunning",{get:function(){return null!=this.timeout},enumerable:!0,configurable:!0}),i.prototype.search=function(s){var o=this;this.cancel(),s=s?s.trim():"";var t=this.options,r=t.getItemText,a=t.loadItems;return new Promise(function(n,e){o.timeout=setTimeout(function(){var i,t=o.getFromCache(s);t?n(t):(i=o.options.discardLocalItemsBeforeSearch?[]:o.items.filter(function(t){return o.match(r(t),s)}),a?a(s).then(function(t){var e=t.commandResult,t=o.sort(o.union(i,e),s);o.preload(e,!1),o.pushToCache(s,t),n(t)}).catch(e):(t=o.sort(i,s),o.pushToCache(s,t),n(t))),o.timeout=null},100)})},i.prototype.preload=function(t,e){void 0===e&&(e=!0),this.items=this.sort(this.union(this.items,t)),e&&(this.cache={})},i.prototype.cancel=function(){this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},i.prototype.clear=function(){this.items.length=0,this.cache={}},i.prototype.getFromCache=function(t){if(t in this.cache){var e=this.cache[t];if(!(4e3<Date.now()-e.dateTime))return e.results;delete this.cache[t]}return null},i.prototype.pushToCache=function(t,e){this.cache[t]={dateTime:Date.now(),results:e}},i.prototype.match=function(t,e){return t=t.toUpperCase(),e=e.toUpperCase(),t.startsWith(e)||0<=t.indexOf(e)},i.prototype.sort=function(t,i){void 0===i&&(i="");var n=this.options.getItemText;return i=i.toUpperCase(),t.sort(function(t,e){t=n(t).toUpperCase(),e=n(e).toUpperCase();return i?h.Levenshtein.compare(t,i)-h.Levenshtein.compare(e,i):0})},i.prototype.union=function(t,e){var i,n,s=this.options.getItemKey,o=[],r=[];try{for(var a=__values(t.concat(e)),l=a.next();!l.done;l=a.next()){var u=l.value,c=s(u);r.indexOf(c)<0&&(o.push(ko.isObservable(u)?u:h.Utils.deepObservable(u)),r.push(c))}}catch(t){i={error:t}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o},i);function i(t){void 0===t&&(t={}),this.options=t,this.items=[],this.cache={},t.getItemKey||(t.getItemKey=function(t){return ko.unwrap(t)}),t.getItemText||(t.getItemText=function(t){return ko.unwrap(t)})}t.SearchEngine=e}((h=t.BusinessPack||(t.BusinessPack={})).Controls||(h.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(n){"use strict";var t=(Object.defineProperty(e,"isMobileOrTablet",{get:function(){return n.Browser.isMobileOrTablet},enumerable:!0,configurable:!0}),e.addMobileOrTabletProp=function(t,e,i){n.Browser.isMobileOrTablet&&t.prop(e,i)},e);function e(){}n.DeviceUtils=t}(t.BusinessPack||(t.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e=(n.FromObject=function(t){var e,i=[];for(e in t)t.hasOwnProperty(e)&&i.push({Key:e,Value:t[e]});return new n(i)},n.prototype.get=function(t){t=this.findItem(t);return t&&t.Value},n.prototype.set=function(t,e){var i=this.findItem(t);i&&(i.Value=e),this.items.push({Key:t,Value:e})},n.prototype.findItem=function(e){return this.items.asLinq().firstOrDefault(function(t){return t.Key===e})},n);function n(t){if(this.items=t,!Array.isArray(t))throw"Parameter items of KeyValuePair<TKey, TValue> constructor has to be instance of array."}t.KeyValueList=e}(t.BusinessPack||(t.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){var a;!function(t){"use strict";var n,e=(n=t.ControlBase,__extends(i,n),Object.defineProperty(i.prototype,"isDisplayed",{get:function(){var t=ko.unwrap(this.binding.isDisplayed);return null==t||t},set:function(t){var e=this.binding.isDisplayed;ko.isWriteableObservable(e)&&e(null!=t?t:null)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"autoHideTimeoutMs",{get:function(){return 1e3*ko.unwrap(this.binding.autoHideTimeout)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"iconTypeSource",{get:function(){var t=this.binding.type;return null!=t?t:null},enumerable:!0,configurable:!0}),i.prototype.initialize=function(){var e=this;n.prototype.initialize.call(this),this.$dismissButton=this.$element.children("."+a.BusinessPackCss.commandClose),this.alertTypes=["success","info","warning","danger"],this.$element.mouseenter(function(){return e.stopTimer()}),this.$element.mouseleave(function(){return e.startTimer()}),this.$dismissButton.click(function(t){return e.onDismissButtonClick(t)}),this.subscribe(this.binding.type,this.onTypeChange),null!=this.binding.isDisplayed?this.subscribe(this.binding.isDisplayed,this.onIsDisplayedChange):null!=this.binding.text?this.subscribe(this.binding.text,this.onTextChange):this.onIsDisplayedChange(this.isDisplayed,!0)},i.prototype.show=function(t,e){var i=this;void 0===t&&(t=!1),n.prototype.show.call(this,t,function(){i.startTimer(),i.isDisplayed=!0,e&&e()})},i.prototype.hide=function(t,e){var i=this;void 0===t&&(t=!1),n.prototype.hide.call(this,t,function(){i.stopTimer(),i.isDisplayed=!1,e&&e()})},i.prototype.startTimer=function(){var t=this,e=this.autoHideTimeoutMs;e&&!this.autoHideTimer&&(this.autoHideTimer=setTimeout(function(){return t.hide()},e))},i.prototype.stopTimer=function(){this.autoHideTimer&&(clearTimeout(this.autoHideTimer),this.autoHideTimer=null)},i.prototype.onDismissButtonClick=function(t){var e=this;this.hide(!1,function(){e.postback(e.binding.dismissed)})},i.prototype.onVisibleChange=function(t,e){void 0!==t&&this.toggle(!1!==this.isDisplayed&&t,e)},i.prototype.onTypeChange=function(t){var e,i;t=t.toLowerCase();var n=a.BusinessPackCss.alertTypePrefix;try{for(var s=__values(this.alertTypes),o=s.next();!o.done;o=s.next()){var r=o.value;r!==t&&this.$element.removeClass(n+r)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}this.$element.addClass(n+t)},i.prototype.onIsDisplayedChange=function(t,e){void 0!==t&&this.toggle(t,e)},i.prototype.onTextChange=function(t,e){this.toggle(!!t,e)},i);function i(){return null!==n&&n.apply(this,arguments)||this}t.Alert=e,a.Utils.installBindingHandler("Alert",e)}((a=t.BusinessPack||(t.BusinessPack={})).Controls||(a.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(e){"use strict";var i,t=(i=e.ItemsEditorBase,__extends(n,i),Object.defineProperty(n.prototype,"isOpened",{get:function(){return this.popupPanel.isOpened},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hasValue",{get:function(){var t=ko.unwrap(this.binding.text);return null!=t&&t.length},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"resultsView",{get:function(){return this.$resultsView.data("ListView")},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){var t=this;i.prototype.initialize.call(this),this.$textBox=this.$element.children("."+s.BusinessPackCss.primitiveTextBox),this.$popup=this.$element.children("."+s.BusinessPackCss.primitivePopup),this.$resultsView=this.$popup.children("."+s.BusinessPackCss.listView),this.popupPanel=new e.PopupPanel(this.$popup),this.$element.keydown(this.onElementKeydown.bind(this)),this.$textBox.focus(this.onTextBoxFocus.bind(this)),this.$textBox.blur(this.onTextBoxBlur.bind(this)),this.$textBox.keydown(this.onTextBoxKeydown.bind(this)),this.$textBox.input(this.onTextBoxInput.bind(this)),this.$textBox.change(this.onTextBoxChange.bind(this)),this.$popup.mousedown(function(t){return t.preventDefault()}),this.outside("mousedown",function(){return t.togglePopup(!1)}),this.subscribe(this.searchResults,this.onSearchResultsChange)},n.prototype.togglePopup=function(t){var e=(t=void 0===t?!this.isOpened:t)&&this.isEnabled,t=e!==this.isOpened;this.popupPanel.toggle(e),this.resultsView&&(e||this.resultsView.unfocusAllItems(),t&&(this.resultsView.unfocusAllItems(),this.selectedValues([])))},n.prototype.updatePropertyFromText=function(){var t=this.binding.text;ko.isWriteableObservable(t)&&t(this.$textBox.val())},n.prototype.selectFocusedItem=function(){if(this.resultsView){var t=this.resultsView.getFocusedItems();if(this.isOpened&&t.length)return this.resultsView.selectFocusedItems();this.togglePopup(!1)}},n.prototype.selectFocusedItemOrFirstResult=function(){if(this.resultsView){var t=this.resultsView.getFocusedItems();if(this.isOpened&&t.length)return this.resultsView.selectFocusedItems();1===(ko.unwrap(this.resultsView.items)||[]).length&&this.resultsView.selectFirstItem(),this.togglePopup(!1)}},n.prototype.onElementKeydown=function(t){this.isEnabled&&this.isOpened&&(s.KeyboardKeys.isEscape(t.which)?(t.stopPropagation(),this.togglePopup(!1)):s.KeyboardKeys.isEnter(t.which)?(t.stopPropagationAndPreventDefault(),this.selectFocusedItemOrFirstResult()):t.which===s.KeyboardKeys.tab?(t.stopPropagation(),this.selectFocusedItem()):t.which===s.KeyboardKeys.down?(t.stopPropagation(),this.resultsView.focusNextItem()):t.which===s.KeyboardKeys.up&&(t.stopPropagation(),this.resultsView.focusPrevItem()))},n.prototype.onTextBoxFocus=function(){this.$element.addClass(s.BusinessPackCss.stateFocused),this.resultsView.hasFocus(!0)},n.prototype.onTextBoxBlur=function(){this.$element.removeClass(s.BusinessPackCss.stateFocused),this.resultsView.hasFocus(!1),this.togglePopup(!1)},n.prototype.onTextBoxKeydown=function(t){this.isOpened&&s.KeyboardKeys.isUpOrDown(t.which)&&t.preventDefault()},n.prototype.onTextBoxInput=function(t){var e=this.$textBox.val(),i=ko.unwrap(this.binding.updateTextOnInput);t.stopPropagation(),this.shouldPostbackOnChange=!0,i&&this.updatePropertyFromText(),this.search(e)},n.prototype.onTextBoxChange=function(t){var e=this.binding.changed;ko.unwrap(this.binding.updateTextOnInput)||(t.stopPropagation(),this.updatePropertyFromText()),this.shouldPostbackOnChange&&(t.stopPropagation(),this.postback(e))},n.prototype.onDataSourceChange=function(){i.prototype.onDataSourceChange.call(this),this.searchResults([])},n.prototype.onSearchResultsChange=function(t){var e=this.$textBox.val();this.togglePopup(e&&0<t.length)},n.prototype.onSearchResultSelected=function(){var t=this.binding,e=t.text,i=t.changed,t=this.resultsView.getSelectedItems()[0]();if(this.shouldPostbackOnChange=!1,"string"!=typeof t&&(t=this.getItemText(t)),this.togglePopup(!1),t===ko.unwrap(e))ko.isObservable(e)&&e.notifySubscribers();else if(ko.isWriteableObservable(e)&&e(t),i)return i();return Promise.resolve()},n);function n(){var t=null!==i&&i.apply(this,arguments)||this;return t.shouldPostbackOnChange=!0,t}e.AutoComplete=t,s.Utils.installBindingHandler("AutoComplete",t)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var a;!function(t){"use strict";var i,e=(i=t.ButtonBase,__extends(n,i),n.prototype.initialize=function(){var e=this;i.prototype.initialize.call(this),this.$element.click(function(t){return e.onElementClick(t)}),this.subscribe(this.binding.type,this.onTypeChange),this.subscribe(this.binding.outline,this.onOutlineChange)},n.prototype.onElementClick=function(t){this.isEnabled&&(t.stopPropagationAndPreventDefault(),this.postback(this.binding.click))},n.prototype.onTypeChange=function(t){var e,i;t=t&&t.toLowerCase();var n=a.BusinessPackCss.buttonTypePrefix;try{for(var s=__values(this.buttonTypes),o=s.next();!o.done;o=s.next()){var r=o.value;r!==t&&this.$element.removeClass(n+r)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}t&&this.$element.addClass(n+t)},n.prototype.onOutlineChange=function(t){t?this.$element.addClass(a.BusinessPackCss.buttonOutline):this.$element.removeClass(a.BusinessPackCss.buttonOutline)},n);function n(){var t=null!==i&&i.apply(this,arguments)||this;return t.buttonTypes=["default","primary","secondary","success","info","warning","danger"],t}t.Button=e,a.Utils.installBindingHandler("Button",e),a.Utils.installBindingHandler("ButtonItem",e)}((a=t.BusinessPack||(t.BusinessPack={})).Controls||(a.Controls={}))}(DotVVM=DotVVM||{}),function(t){var y;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(m,e),m.prototype.initialize=function(){e.prototype.initialize.call(this),this.$decadeView=this.$element.children("."+y.BusinessPackCss.calendarDecadeView),this.$yearView=this.$element.children("."+y.BusinessPackCss.calendarYearView),this.$monthView=this.$element.children("."+y.BusinessPackCss.calendarMonthView),this.yearSource=this.getYearSource(),this.monthSource=this.getMonthSource(),this.weekSource=this.getWeekSource(),this.titleSource=this.getTitleSource(),this.today.setHours(0,0,0,0),this.binding.activeDate||(this.binding.activeDate=ko.observable(new Date))},Object.defineProperty(m.prototype,"activeDate",{get:function(){return y.DateUtils.unwrapDate(this.binding.activeDate)},set:function(t){this.binding.activeDate(t)},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"$activeView",{get:function(){return this.isDecadeViewActive?this.$decadeView:this.isYearViewActive?this.$yearView:this.$monthView},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"firstDayOfWeek",{get:function(){return y.DayOfWeek[this.binding.firstDayOfWeek]},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"isDecadeViewActive",{get:function(){return"Decade"===ko.unwrap(this.binding.view)},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"isYearViewActive",{get:function(){return"Year"===ko.unwrap(this.binding.view)},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"isMonthViewActive",{get:function(){return"Month"===ko.unwrap(this.binding.view)},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"decadeStart",{get:function(){var t=this.activeDate.getFullYear();return new Date(t-t%10,0,1)},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"decadeEnd",{get:function(){var t=this.activeDate.getFullYear();return new Date(t-t%10+9,11,31)},enumerable:!0,configurable:!0}),m.isDateRangeRestriction=function(t){return"DateRangeRestriction"===t.Type()},m.isDayOfWeekRestriction=function(t){return"DayOfWeekRestriction"===t.Type()},m.isTimeRangeRestriction=function(t){return"TimeRangeRestriction"===t.Type()},m.isDateWeekend=function(t){t=t.getDay();return[0,6].includes(t)},m.prototype.findYearItems=function(e){return this.findItems(function(t){return t.getFullYear()===e})},m.prototype.findMonthItems=function(e,i){return this.findItems(function(t){return t.getFullYear()===e&&t.getMonth()===i})},m.prototype.findDayItems=function(e){return this.findItems(function(t){return t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()})},m.prototype.findItems=function(e){var t=ko.unwrap(this.binding.dataSource),i=this.binding.itemDateBinding;return t?t.filter(function(t){return e(y.DateUtils.unwrapDate(i(t)))}).sort(function(t,e){return+y.DateUtils.unwrapDate(i(t))-+y.DateUtils.unwrapDate(i(e))}):[]},m.prototype.getYearSource=function(){var o=this;return ko.pureComputed(function(){for(var t=o.activeDate.getFullYear(),e=t-t%10,i=[],n=-1;n<11;n++){var s=e+n,s={FirstDate:ko.observable(new Date(s,0,1)),LastDate:ko.observable(new Date(s,11,31)),IsLeapYear:ko.observable(y.DateUtils.isLeapMonth(s,1)),IsOtherDecade:ko.observable(-1===n||10===n),IsToday:ko.observable(s===o.today.getFullYear()),Items:ko.observableArray(o.findYearItems(s))};i.push(ko.observable(s))}return i})},m.prototype.getMonthSource=function(){var s=this;return ko.pureComputed(function(){for(var t=s.activeDate.getFullYear(),e=[],i=0;i<12;i++){var n={FirstDate:ko.observable(new Date(t,i,1)),LastDate:ko.observable(new Date(t,i+1,0)),IsLeapMonth:ko.observable(y.DateUtils.isLeapMonth(t,i)),IsToday:ko.observable(t===s.today.getFullYear()&&i===s.today.getMonth()),Items:ko.observableArray(s.findMonthItems(t,i))};e.push(ko.observable(n))}return e})},m.prototype.getWeekSource=function(){var f=this;return ko.pureComputed(function(){var e,t,i,n,s=f.activeDate,o=s.getFullYear(),r=s.getMonth(),a=[];try{for(var l=__values(y.DateUtils.getMonthWeeks(o,r,f.firstDayOfWeek)),u=l.next();!u.done;u=l.next()){var c=u.value,h={Number:ko.observable(y.DateUtils.getWeekNumber(c[0],f.firstDayOfWeek)),Days:ko.observableArray()};a.push(ko.observable(h));try{for(var d=__values(c),p=d.next();!p.done;p=d.next()){var g=p.value;h.Days.push(ko.observable({Date:ko.observable(g),IsOtherMonth:ko.observable(g.getMonth()!==r),IsToday:ko.observable(+g==+f.today),IsWeekend:ko.observable(m.isDateWeekend(g)),Items:ko.observableArray(f.findDayItems(g))}))}}catch(t){i={error:t}}finally{try{p&&!p.done&&(n=d.return)&&n.call(d)}finally{if(i)throw i.error}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}return a})},m.prototype.getTitleSource=function(){var i=this;return ko.pureComputed(function(){function t(t,e){return dotvvm.globalize.formatString.call(dotvvm.globalize,t,e)}var e=i.activeDate;return i.isDecadeViewActive?t("yyyy",i.decadeStart)+" - "+t("yyyy",i.decadeEnd):i.isYearViewActive?t("yyyy",e):t("MMMM yyyy",e)})},m);function m(){var t=null!==e&&e.apply(this,arguments)||this;return t.today=new Date,t}t.Calendar=i,y.Utils.installBindingHandler("Calendar",i)}((y=t.BusinessPack||(t.BusinessPack={})).Controls||(y.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.activeItemIndex=ko.observable(0),this.subscribe(this.activeItemIndex,this.onActiveItemIndexChange),this.subscribe(this.binding.items,this.onItemsChange),setInterval(this.onTimerTick.bind(this),1e3)},n.prototype.getActiveItem=function(){return this.binding.items().asLinq().firstOrDefault(function(t){return t().IsActive()})},n.prototype.onItemsChange=function(){var t;this.binding.items().asLinq().any(function(t){return t().IsActive()})?(t=this.getActiveItem())&&this.activeItemIndex(this.binding.items().asLinq().indexOf(t)):this.activeItemIndex(0)},n.prototype.onActiveItemIndexChange=function(t){var e;this.binding&&(e=this.binding.items(),this.activeItem&&this.activeItem().IsActive(!1),(e=e.asLinq().elementAt(t))().IsActive(!0),this.activeItem=e,s.Utils.warnInDebugMode(t))},n.prototype.onTimerTick=function(){this.activeItemIndex()==this.binding.items().length-1?this.activeItemIndex(0):this.activeItemIndex(this.activeItemIndex()+1),s.Utils.warnInDebugMode(this.activeItemIndex())},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.Carousel=i,s.Utils.installBindingHandler("Carousel",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var a;!function(t){"use strict";var e,i=(e=t.CheckableControlListBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.$element.on("change","[type=checkbox]",this.onInputChange.bind(this)),this.binding.selectedValues&&this.watch(this.binding.selectedValues,this.onSelectedValuesChange)},n.prototype.toggleItem=function(t){this.isSelected(t)?this.unselectItem(t):this.selectItem(t)},n.prototype.selectItem=function(t){this.isSelected(t)||(t=this.getItemValueCopy(t),this.binding.selectedValues.push(ko.observable(t)),this.postback(this.binding.changed))},n.prototype.unselectItem=function(e){var i=this;this.isSelected(e)&&(this.binding.selectedValues.remove(function(t){return i.isValueOfItem(t,e)}),this.postback(this.binding.changed))},n.prototype.isSelected=function(t){if(!this.binding.selectedValues)return ko.unwrap(this.binding.itemCheckedBinding(t));t=this.getItemKey(t);return this.selectedItemsKeys().asLinq().contains(t)},n.prototype.onInputChange=function(t){t.stopPropagation(),this.binding.selectedValues?this.toggleItem(ko.dataFor(t.target)):this.postback(this.binding.changed)},n.prototype.onSelectedValuesChange=function(t){var e,i;a.Utils.clearObservableArray(this.selectedItemsKeys);try{for(var n=__values(t),s=n.next();!s.done;s=n.next()){var o=s.value,r=this.findItemByValue(o);r?this.selectedItemsKeys.push(this.getItemKey(r)):this.warnThatValueWasNotFound(o)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}},n);function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.selectedItemsKeys=ko.observableArray(),t}t.CheckBoxList=i,a.Utils.installBindingHandler("CheckBoxList",i)}((a=t.BusinessPack||(t.BusinessPack={})).Controls||(a.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),n.prototype.initialize=function(){var t=this;e.prototype.initialize.call(this),this.$input=this.$element.children("input"),this.$svg=this.$element.children("svg"),this.$element.mousedown(this.onElementMousedown.bind(this)),this.$input.focus(this.onInputFocus.bind(this)),this.$input.blur(this.onInputBlur.bind(this)),this.$element.click(this.onInputClick.bind(this)),this.checkInterval=setInterval(function(){return t.updateCheckState()},100),this.disposing(function(){return clearInterval(t.checkInterval)})},n.prototype.onElementMousedown=function(t){this.$input.focus()},n.prototype.onInputFocus=function(){this.$element.addClass(s.BusinessPackCss.stateFocused)},n.prototype.onInputBlur=function(){this.$element.removeClass(s.BusinessPackCss.stateFocused)},n.prototype.onInputClick=function(t){this.isEnabled&&t.target instanceof HTMLInputElement&&(this.postback(this.binding.changed),this.updateCheckState())},n.prototype.updateCheckState=function(){var t=this.getCheckState();this.$element.toggleClass(s.BusinessPackCss.stateIndeterminate,null==t),this.$element.toggleClass(s.BusinessPackCss.stateChecked,null!=t&&t)},n.prototype.getCheckState=function(){return!!this.$input.is(":checked")||!(!this.$input.is(":checkbox")||!this.$input.prop("indeterminate"))&&null},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.CheckableControl=i,s.Utils.installBindingHandler("CheckBox",i),s.Utils.installBindingHandler("RadioButton",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(i){"use strict";var n,t=(n=i.EditorBase,__extends(e,n),Object.defineProperty(e.prototype,"isOpened",{get:function(){return!!this.popupPanel&&this.popupPanel.isOpened},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isInline",{get:function(){return 0===this.$popup.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isPreviewingColor",{get:function(){return this.previewColor()!==this.nullColor},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasValue",{get:function(){return null!=this.getSelectedColor()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"canUnselectValue",{get:function(){var t=ko.unwrap(this.binding.allowUnselect);return(null==t||t)&&this.hasValue},enumerable:!0,configurable:!0}),e.prototype.initialize=function(){var e=this;n.prototype.initialize.call(this),this.$value=this.$element.children("."+s.BusinessPackCss.primitiveValue),this.$colorPreview=this.$value.find("."+s.BusinessPackCss.colorPickerPreview),this.$unselectButton=this.$element.children("."+s.BusinessPackCss.commandUnselect),this.$toggleButton=this.$element.children("."+s.BusinessPackCss.commandToggle),this.$popup=this.$element.children("."+s.BusinessPackCss.primitivePopup);var t=this.isInline?this.$element:this.$popup;this.$colorSpectrum=t.children("."+s.BusinessPackCss.colorPickerSpectrum),this.$colorGrip=this.$colorSpectrum.children("."+s.BusinessPackCss.primitiveGrip),this.$hueSlider=t.find("."+s.BusinessPackCss.colorPickerSliders+" > ."+s.BusinessPackCss.colorPickerHueSlider),this.$hueSliderGrip=this.$hueSlider.find("."+s.BusinessPackCss.primitiveGrip),this.$alphaSlider=t.find("."+s.BusinessPackCss.colorPickerSliders+" ."+s.BusinessPackCss.colorPickerAlphaSlider),this.$alphaSliderGrip=this.$alphaSlider.find("."+s.BusinessPackCss.primitiveGrip),this.$colorEditorSwitch=t.find("."+s.BusinessPackCss.colorPickerEditor+" > ."+s.BusinessPackCss.primitiveSwitchButton),this.$hexColorInput=t.find("."+s.BusinessPackCss.colorPickerEditor+" ."+s.BusinessPackCss.colorPickerHexEditor+" > input"),this.$redChannelInput=t.find("."+s.BusinessPackCss.colorPickerEditor+" ."+s.BusinessPackCss.colorPickerRedEditor+" > input"),this.$greenChannelInput=t.find("."+s.BusinessPackCss.colorPickerEditor+" ."+s.BusinessPackCss.colorPickerGreenEditor+" > input"),this.$blueChannelInput=t.find("."+s.BusinessPackCss.colorPickerEditor+" ."+s.BusinessPackCss.colorPickerBlueEditor+" > input"),this.$alphaChannelInput=t.find("."+s.BusinessPackCss.colorPickerEditor+" ."+s.BusinessPackCss.colorPickerAlphaEditor+" > input"),this.$predefinedColors=t.children("."+s.BusinessPackCss.colorPickerPredefinedColors),this.$popup.length&&(this.popupPanel=new i.PopupPanel(this.$popup,!0)),this.$element.focusin(this.onElementFocusin.bind(this)),this.$element.focusout(this.onElementFocusout.bind(this)),this.$element.keydown(this.onElementKeydown.bind(this)),this.$value.click(this.onToggleButtonClick.bind(this)),this.$value.keydown(function(t){return e.onValueKeydown(t)}),this.$value.keyup(function(t){return e.onValueKeyup(t)}),this.$value.blur(this.onValueBlur.bind(this)),this.$unselectButton.click(this.onUnselectButtonClick.bind(this)),this.$toggleButton.click(this.onToggleButtonClick.bind(this)),this.$toggleButton.mousedown(function(t){return t.stopPropagationAndPreventDefault()}),this.$popup.mousedown(function(t){return e.onPopupMousedown(t)}),this.$colorSpectrum.mousedown(this.onColorSpectrumMousedown.bind(this)),this.$colorGrip.keydown(function(t){return e.onValueKeydown(t)}),this.$colorGrip.keyup(function(t){return e.onValueKeyup(t)}),this.$colorGrip.focus(function(t){return e.onColorGripFocus(t)}),this.$colorGrip.blur(function(t){return e.onColorGripBlur(t)}),this.$colorEditorSwitch.click(this.onColorEditorSwitchClick.bind(this)),this.$hexColorInput.keydown(this.onHexColorInputKeydown.bind(this)),this.$hexColorInput.on("input change",this.onHexColorInputChange.bind(this)),this.$redChannelInput.on("input change",function(t){return e.onChannelInputChange(s.RgbaChannel.Red,t)}),this.$greenChannelInput.on("input change",function(t){return e.onChannelInputChange(s.RgbaChannel.Green,t)}),this.$blueChannelInput.on("input change",function(t){return e.onChannelInputChange(s.RgbaChannel.Blue,t)}),this.$alphaChannelInput.on("input change",function(t){return e.onChannelInputChange(s.RgbaChannel.Alpha,t)}),this.$predefinedColors.on("click","."+s.BusinessPackCss.primitiveItem,this.onPredefinedColorClick.bind(this)),this.outside("mousedown",function(t){return e.onOutsideMousedown(t)}),this.watch(this.binding.selectedColor,this.onSelectedColorChange),this.watch(this.binding.selectedRgbaColor,this.onSelectedRgbaColorChange),this.subscribe(this.previewColor,this.onPreviewColorChange),this.subscribe(this.hue,this.onHueChange),this.subscribe(this.alpha,this.onAlphaChange),this.subscribe(this.binding.enabled,this.onIsEnabledChange)},e.prototype.onIsEnabledChange=function(t){t=t?0:-1;this.$element.find("[tabindex]").attr("tabindex",t)},e.prototype.togglePopup=function(t){void 0===t&&(t=!this.isOpened),this.popupPanel&&((t=t&&this.isEnabled)&&this.setColorEditorValues(this.previewColor()),this.popupPanel.toggle(t))},e.prototype.selectColor=function(t){var e,i;this.isSelected(t)||(e=(i=this.binding).selectedColor,i=i.selectedRgbaColor,ko.isWriteableObservable(e)?e(s.ColorUtils.rgbaToHexColor(t)):ko.isWriteableObservable(i)&&i(s.Utils.deepClone(t)),this.postback(this.binding.changed))},e.prototype.isSelected=function(t){return s.ColorUtils.areRgbaColorsEqual(t,this.getSelectedColor())},e.prototype.getSelectedColor=function(){var t=this.binding,e=t.selectedColor,i=t.selectedRgbaColor,t=t.allowAlphaChannel;return null!=e?s.ColorUtils.tryParseHexColor(ko.unwrap(e),t)[1]:i()},e.prototype.unselectColor=function(){var t,e;this.hasValue&&(t=(e=this.binding).selectedColor,e=e.selectedRgbaColor,ko.isWriteableObservable(t)?t(null):ko.isWriteableObservable(e)&&e(null),this.postback(this.binding.changed))},e.prototype.onElementFocusin=function(t){this.isEnabled&&(this.$element.addClass(s.BusinessPackCss.stateFocused),this.isInline&&this.unblockChildFocus())},e.prototype.onValueBlur=function(t){this.$element.removeClass(s.BusinessPackCss.stateFocused)},e.prototype.onElementFocusout=function(t){null!=t.relatedTarget&&this.isOutsideOfTree(t.relatedTarget)&&(this.closeAndBlur(),t.stopPropagation())},e.prototype.onColorGripFocus=function(t){this.$colorGrip.addClass(s.BusinessPackCss.stateFocused)},e.prototype.onColorGripBlur=function(t){this.$colorGrip.removeClass(s.BusinessPackCss.stateFocused)},e.prototype.onOutsideMousedown=function(t){this.closeAndBlur()},e.prototype.closeAndBlur=function(){this.togglePopup(!1),this.$element.removeClass(s.BusinessPackCss.stateFocused),this.isInline&&this.blockChildFocus()},e.prototype.onElementKeydown=function(t){if(this.isEnabled){if(this.isInline&&(this.isFocusInside()?s.KeyboardKeys.isEscape(t.which)&&(this.$element.focus(),t.stopPropagationAndPreventDefault()):(t.which===s.KeyboardKeys.spacebar&&(t.stopPropagationAndPreventDefault(),this.$colorGrip.focus()),t.which===s.KeyboardKeys.tab&&this.blockChildFocus())),s.KeyboardKeys.isDelete(t.which)&&!this.isInput(t.target))return this.unselectColor(),void t.stopPropagation();this.isOpened?s.KeyboardKeys.isEscape(t.which)?(t.stopPropagation(),this.togglePopup(!1),this.$value.focus()):!s.KeyboardKeys.isEnter(t.which)||this.isButton(t.target)||this.isInput(t.target)||t.preventDefault():t.altKey&&t.which===s.KeyboardKeys.down&&(t.stopPropagation(),this.togglePopup(!0))}},e.prototype.blockChildFocus=function(){this.$element.find("input, button, [tabindex]").attr("tabindex",-1)},e.prototype.unblockChildFocus=function(){var t=this.$element.find("[tabindex]");t.attr("tabindex",0),(t=this.$element.find("input, button")).removeAttr("tabindex")},e.prototype.isFocusInside=function(){return 0<this.$element.find("."+s.BusinessPackCss.stateFocused).length},e.prototype.isButton=function(t){return t.classList.contains(s.BusinessPackCss.primitiveButton)},e.prototype.isInput=function(t){return"input"===t.tagName.toLowerCase()},e.prototype.onValueKeydown=function(t){if(this.isEnabled&&(this.isInline||t.which!==s.KeyboardKeys.spacebar||(t.stopPropagationAndPreventDefault(),this.togglePopupAndFocus()),(this.isOpened||this.isInline)&&s.KeyboardKeys.isArrow(t.which))){this.isChangingColor=!0;var e=this.$colorGrip.offset();e.left+=this.$colorGrip.outerWidth()/2,e.top+=this.$colorGrip.outerHeight()/2;switch(t.which){case s.KeyboardKeys.left:this.moveColorGripToPosition(e.left-2,e.top);break;case s.KeyboardKeys.right:this.moveColorGripToPosition(e.left+2,e.top);break;case s.KeyboardKeys.up:this.moveColorGripToPosition(e.left,e.top-2);break;case s.KeyboardKeys.down:this.moveColorGripToPosition(e.left,e.top+2)}t.stopPropagationAndPreventDefault()}},e.prototype.onValueKeyup=function(t){this.isEnabled&&this.isChangingColor&&(this.selectPreviewColor(),this.isChangingColor=!1)},e.prototype.onUnselectButtonClick=function(t){this.isEnabled&&(t.stopPropagation(),this.unselectColor())},e.prototype.onToggleButtonClick=function(t){this.isEnabled&&(t.stopPropagation(),this.togglePopupAndFocus())},e.prototype.togglePopupAndFocus=function(){this.togglePopup(),(this.popupPanel.isOpened?this.$colorGrip:this.$value).focus()},e.prototype.onPopupMousedown=function(t){t.stopPropagation();var e=$(t.target),i=!!s.DomUtils.closestUntil(e,this.$popup,":input,[tabindex]").length;!e.is(this.$popup)&&i||(t.preventDefault(),this.$element.focus())},e.prototype.onColorSpectrumMousedown=function(t){this.isEnabled&&(t.stopPropagationAndPreventDefault(),this.isChangingColor=!0,this.$document.on("mousemove"+this.eventNs,this.onColorSpectrumMousemove.bind(this)),this.$document.on("mouseup"+this.eventNs,this.onColorSpectrumMouseup.bind(this)),this.moveColorGripToPosition(t.pageX,t.pageY),this.$colorGrip.focus())},e.prototype.onColorSpectrumMousemove=function(t){this.isEnabled&&this.moveColorGripToPosition(t.pageX,t.pageY)},e.prototype.onColorSpectrumMouseup=function(t){this.isEnabled&&(this.$document.off("mousemove"+this.eventNs+" mouseup"+this.eventNs),this.selectPreviewColor(),this.isChangingColor=!1)},e.prototype.onAlphaHueSliderChange=function(){this.selectPreviewColor()},e.prototype.onColorEditorSwitchClick=function(t){this.isEnabled&&(t.stopPropagation(),this.isHexEditorActive(!this.isHexEditorActive()))},e.prototype.onHexColorInputKeydown=function(t){var e,i=this.$hexColorInput.val().trim();4!==i.length&&5!==i.length||!s.KeyboardKeys.isEnter(t.which)||(e=this.binding.allowAlphaChannel,e=(i=__read(s.ColorUtils.tryParseHexColor(i,e),2))[0],i=i[1],e&&(t.stopPropagation(),this.selectColor(i)))},e.prototype.onHexColorInputChange=function(t){var e,i=this.$hexColorInput.val().trim();7!==i.length&&9!==i.length||(e=this.binding.allowAlphaChannel,e=(i=__read(s.ColorUtils.tryParseHexColor(i,e),2))[0],i=i[1],e&&(t.stopPropagation(),"change"===t.type?this.selectColor(i):this.previewColor(i)))},e.prototype.onChannelInputChange=function(t,e){var i,n=$(e.target),n=parseInt(n.val().trim());t===s.RgbaChannel.Alpha?0<=n&&n<=100&&(i=s.ColorUtils.updateChannelOfRgba(this.previewColor(),t,n/100)):0<=n&&n<=255&&(i=s.ColorUtils.updateChannelOfRgba(this.previewColor(),t,n)),i&&(e.stopPropagation(),"change"===e.type?this.selectColor(i):this.previewColor(i))},e.prototype.onPredefinedColorClick=function(t){var e;this.isEnabled&&(e=this.binding.allowAlphaChannel,t.stopPropagation(),this.selectColor(s.ColorUtils.parseHexColor(ko.dataFor(t.currentTarget),e)))},e.prototype.onSelectedColorChange=function(t){var e=this.binding.allowAlphaChannel;this.onSelectedRgbaColorChange(s.ColorUtils.tryParseHexColor(t,e)[1])},e.prototype.onSelectedRgbaColorChange=function(t){if(!this.binding.allowAlphaChannel&&t&&t.Alpha()<1)throw Error("The SelectedRgbaColor.Alpha channel must be equal to 1 when Alpha channel is not allowed. The current value is '"+t.Alpha()+"'.");this.$element.toggleClass(s.BusinessPackCss.stateValueEmpty,!t),this.previewColor(t||this.nullColor)},e.prototype.onPreviewColorChange=function(t){this.$colorPreview.css("background",s.ColorUtils.rgbaToCssColor(t)),this.$alphaSlider.css("background-image",this.getAlphaGradient(t));var e=s.ColorUtils.rgbaToCssColor(s.ColorUtils.updateChannelOfRgba(t,s.RgbaChannel.Alpha,1));this.$hueSliderGrip.css("color",e),this.$alphaSliderGrip.css("color",e),this.isChangingColor||(e=s.ColorUtils.rgbaToHsvaColor(t),this.isLoadingColor=!0,this.setColorGripPosition(e),this.alpha(e.Alpha()),this.hue(e.Hue()),this.isLoadingColor=!1),this.setColorEditorValues(t)},e.prototype.onHueChange=function(t,e){var i=s.ColorUtils.hueToCssColor(t);this.$colorSpectrum.css("background",this.getColorSpectrumGradient(i)),this.isLoadingColor||e||(this.isChangingColor=!0,this.previewColor(s.ColorUtils.updateHueOfRgba(this.previewColor(),t)),this.isChangingColor=!1)},e.prototype.onAlphaChange=function(t,e){this.isLoadingColor||e||(this.isChangingColor=!0,this.previewColor(s.ColorUtils.updateChannelOfRgba(this.previewColor(),s.RgbaChannel.Alpha,t)),this.isChangingColor=!1)},e.prototype.moveColorGripToPosition=function(t,e){var i=this.$colorSpectrum.offset(),n=this.$colorSpectrum.width(),s=this.$colorSpectrum.height(),t=t-i.left,i=e-i.top;t<0?t=0:n<t&&(t=n),i<0?i=0:s<i&&(i=s),t-=this.$colorGrip.outerWidth()/2,i-=this.$colorGrip.outerHeight()/2,this.$colorGrip.css({left:t,top:i}),this.previewColorFromColorGrip()},e.prototype.getColorSpectrumGradient=function(t){return"linear-gradient(to top, #000, rgba(0, 0, 0, 0)), linear-gradient(to right, #FFF, rgba(255, 255, 255, 0)), linear-gradient("+t+", "+t+")"},e.prototype.getAlphaGradient=function(t){return"linear-gradient(to right, "+("rgba("+(t=s.ColorUtils.updateChannelOfRgba(t,s.RgbaChannel.Alpha,1)).Red()+", "+t.Green()+", "+t.Blue()+", 0)")+", "+s.ColorUtils.rgbaToCssColor(t)+")"},e.prototype.previewColorFromColorGrip=function(){var t=this.$colorGrip.position(),e=this.$colorSpectrum.width(),i=this.$colorSpectrum.height(),e=100*(t.left+this.$colorGrip.outerWidth()/2)/e,i=100*(i-(t.top+this.$colorGrip.outerHeight()/2))/i,i=s.ColorUtils.createHsvaColor(this.hue(),e,i,this.alpha()),i=s.ColorUtils.hsvaToRgbaColor(i);this.previewColor(i)},e.prototype.setColorGripPosition=function(t){var e=this.$colorSpectrum.width(),i=this.$colorSpectrum.height(),e=t.Saturation()*e/100,i=i-t.Value()*i/100;e-=this.$colorGrip.outerWidth()/2,i-=this.$colorGrip.outerHeight()/2,this.$colorGrip.css({left:e,top:i})},e.prototype.setColorEditorValues=function(t){this.$hexColorInput.val(s.ColorUtils.rgbaToHexColor(t)),this.$redChannelInput.val(t.Red()),this.$greenChannelInput.val(t.Green()),this.$blueChannelInput.val(t.Blue()),this.$alphaChannelInput.val((100*t.Alpha()).toFixed(0))},e.prototype.getColorButtonCssClasses=function(t){var e=this.binding.allowAlphaChannel,t=s.ColorUtils.parseHexColor(t,e),e={};return e[s.BusinessPackCss.stateSelected]=this.isSelected(t),e},e.prototype.getColorButtonCssStyle=function(t){var e=this.binding.allowAlphaChannel,e=s.ColorUtils.parseHexColor(t,e);return{"background-color":s.ColorUtils.rgbaToCssColor(e)}},e.prototype.selectPreviewColor=function(){this.selectColor(this.previewColor())},e);function e(){var t=null!==n&&n.apply(this,arguments)||this;return t.hue=ko.observable(0),t.alpha=ko.observable(1),t.previewColor=ko.observable(),t.isHexEditorActive=ko.observable(!0),t.nullColor=s.ColorUtils.createRgbaColor(0,0,0),t.isLoadingColor=!1,t.isChangingColor=!1,t}i.ColorPicker=t,s.Utils.installBindingHandler("ColorPicker",t),s.Utils.installBindingHandler("ColorPickerItem",t)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var r;!function(i){"use strict";var e,t=(e=i.SelectorBase,__extends(n,e),n.prototype.initialize=function(){var t=this;e.prototype.initialize.call(this),this.binding.text=r.Utils.ensureObservable(this.binding.text),this.$textBox=this.$element.children("."+r.BusinessPackCss.primitiveTextBox),this.$unselectButton=this.$element.children("."+r.BusinessPackCss.commandUnselect),this.$toggleButton=this.$element.children("."+r.BusinessPackCss.commandToggle),this.$popup=this.$element.children("."+r.BusinessPackCss.primitivePopup),this.popupPanel=new i.PopupPanel(this.$popup),this.$element.keydown(this.onElementKeydown.bind(this)),this.$textBox.focus(this.onTextBoxFocus.bind(this)),this.$textBox.blur(this.onTextBoxBlur.bind(this)),this.$textBox.keydown(this.onTextBoxKeydown.bind(this)),this.$textBox.input(this.onTextBoxInput.bind(this)),this.$popup.mousedown(function(t){return t.preventDefault()}),this.$unselectButton.mousedown(function(t){return t.preventDefault()}),this.$unselectButton.click(this.onUnselectButtonClick.bind(this)),this.$toggleButton.mousedown(function(t){return t.preventDefault()}),this.$toggleButton.click(this.onToggleButtonClick.bind(this)),this.outside("mousedown",function(){return t.togglePopup(!1)}),this.subscribe(this.binding.text,this.onTextChange),this.watch(this.binding.selectedValue,this.onSelectedValueChange),this.subscribe(this.searchResults,this.onSearchResultsChange)},Object.defineProperty(n.prototype,"$resultsView",{get:function(){var t=this.$popup.children("."+r.BusinessPackCss.listView);return t.on("selectedItemClick",this.onResultsViewSelectedItemClick.bind(this)),t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isOpened",{get:function(){return this.popupPanel.isOpened},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hasValue",{get:function(){var t=ko.unwrap(this.binding.text);return null!=ko.unwrap(this.binding.selectedValue)||!!t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"canUnselectValue",{get:function(){return ko.unwrap(this.binding.allowUnselect)&&this.hasValue},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"resultsView",{get:function(){return this.$resultsView.data("ListView")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"allowNewItems",{get:function(){return ko.unwrap(this.binding.allowNewItems)},enumerable:!0,configurable:!0}),n.prototype.togglePopup=function(t){var e=(t=void 0===t?!this.isOpened:t)&&this.isEnabled;e&&this.isRendered(!0),e&&!this.isOpened&&(this.search(null),0<(t=this.resultsView.getSelectedItems()).length&&this.resultsView.focusItems(t)),this.popupPanel.toggle(e),e||this.resetText()},n.prototype.selectFocusedItemOrCurrentText=function(){var t=this.resultsView.getFocusedItems();if(this.isOpened&&t.length)return this.resultsView.selectFocusedItems();this.selectCurrentText()},n.prototype.selectCurrentText=function(){var t=this.$textBox.val(),e=ko.unwrap(this.binding.allowUnselect),i=ko.unwrap(this.binding.allowNewItems),n=this.findItemByText(t);if(null==n)if(this.togglePopup(!1),t.trim().length)if(i){var s=this.binding,o=s.itemValueBinding,s=s.itemTextBinding;if(!r.Utils.isDataAccessor(o)||!r.Utils.isDataAccessor(s))throw Error("New item can't be created when the ItemValueBinding or ItemTextBinding property is set.");o=this.findItemInDataSourceOrAdd(this.createItemFromText(t));this.resultsView.selectItem(o,!0)}else this.resetText();else{s=this.binding,t=s.text,o=s.selectedValue,s=ko.unwrap(o);e&&null!==s?(ko.isWriteableObservable(o)&&o(null),ko.isWriteableObservable(t)&&t(""),this.postback(this.binding.changed)):this.resetText()}else this.resultsView.selectItem(n,!0)},n.prototype.createSearchEngine=function(){var t=this.binding.loadItems,e=ko.unwrap(this.binding.loadItemsMode);return new i.SearchEngine({getItemKey:this.getItemKey.bind(this),getItemText:this.getItemText.bind(this),loadItems:t,discardLocalItemsBeforeSearch:"Replace"===e})},n.prototype.onElementKeydown=function(t){this.isEnabled&&(this.isRendered(!0),this.isOpened?r.KeyboardKeys.isEscape(t.which)?(t.stopPropagation(),this.togglePopup(!1)):r.KeyboardKeys.isEnter(t.which)?t.stopPropagationAndPreventDefault():t.which===r.KeyboardKeys.tab?t.stopPropagation():t.which===r.KeyboardKeys.down?(t.stopPropagation(),this.resultsView.focusNextItem()):t.which===r.KeyboardKeys.up&&(t.stopPropagation(),this.resultsView.focusPrevItem()):t.which===r.KeyboardKeys.down?(t.stopPropagation(),0<this.resultsView.getSelectedItems().length||t.altKey||this.resultsView.selectFirstItem(),this.togglePopup(!0)):t.which===r.KeyboardKeys.up&&(t.stopPropagation(),this.resultsView.selectPrevItem(!1)),this.searchEngine.isRunning||!r.KeyboardKeys.isEnter(t.which)&&t.which!==r.KeyboardKeys.tab||this.selectFocusedItemOrCurrentText())},n.prototype.onTextBoxFocus=function(){this.$textBox.select(),this.$element.addClass(r.BusinessPackCss.stateFocused),this.isRendered(!0),this.resultsView.hasFocus(!0)},n.prototype.onTextBoxBlur=function(){this.isRendered(!0),this.selectCurrentText(),this.$element.removeClass(r.BusinessPackCss.stateFocused),this.resultsView.hasFocus(!1),this.togglePopup(!1)},n.prototype.onTextBoxKeydown=function(t){this.isOpened&&r.KeyboardKeys.isUpOrDown(t.which)&&t.preventDefault()},n.prototype.onTextBoxInput=function(t){var e=this.$textBox.val();t.stopPropagation(),!e&&r.KeyboardKeys.isDeleteOrBackspace(t.which)||this.togglePopup(!0),this.search(e),this.autoFocusItem()},n.prototype.onUnselectButtonClick=function(t){this.isEnabled&&(this.isRendered(!0),t.stopPropagation(),this.hasValue&&(this.$textBox.val(""),this.selectCurrentText()),this.search(null),this.$textBox.focus())},n.prototype.onToggleButtonClick=function(t){this.isEnabled&&(this.isRendered(!0),t.stopPropagation(),this.$textBox.focus(),this.togglePopup())},n.prototype.autoFocusItem=function(){var t=ko.unwrap(this.searchResults),e=this.$textBox.val();this.resultsView&&t.length&&(this.allowNewItems?t[0]().toString().toLowerCase()!==e.toLowerCase()?this.resultsView.unfocusAllItems():this.resultsView.focusItem(t[0]):this.resultsView.focusFirstItem())},n.prototype.onTextChange=function(t){this.$element.toggleClass(r.BusinessPackCss.stateValueEmpty,!t)},n.prototype.onDataSourceChange=function(){e.prototype.onDataSourceChange.call(this),this.onSelectedValueChange(ko.unwrap(this.binding.selectedValue))},n.prototype.onSelectedValueChange=function(t){var e=this.findItemByValue(t);this.$element.toggleClass(r.BusinessPackCss.stateValueEmpty,null==t),e?(this.selectedItem(ko.unwrap(e)),this.selectedValues([ko.observable(t)]),ko.isWriteableObservable(this.binding.text)&&this.binding.text(this.getItemText(e))):(null!=t&&this.warnThatValueWasNotFound(t),this.selectedItem(null),this.selectedValues([]),ko.isWriteableObservable(this.binding.text)&&this.binding.text(""))},n.prototype.onSearchResultsChange=function(t){var e=this;"Replace"===ko.unwrap(this.binding.loadItemsMode)&&this.resultsView&&(t=t.map(function(t){return e.getItemKey(t)}),this.removeAllItemsExcept(t)),this.autoFocusItem()},n.prototype.onSearchResultSelected=function(){var t=this.binding,e=t.selectedValue,i=t.changed,t=this.selectedValues();return ko.isWriteableObservable(e)&&e(t.length?t[0]():null),this.togglePopup(!1),i?i():Promise.resolve()},n.prototype.onResultsViewSelectedItemClick=function(t){this.popupPanel.close()},n.prototype.resetText=function(){var t=this.selectedItem(),e=ko.unwrap(this.binding.allowNewItems);ko.isWriteableObservable(this.binding.text)&&(t?this.binding.text(this.getItemText(t)):e||this.binding.text("")),this.autoFocusItem()},n);function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.selectedItem=ko.observable(),t.isRendered=ko.observable(!1),t}i.ComboBox=t,r.Utils.installBindingHandler("ComboBox",t)}((r=t.BusinessPack||(t.BusinessPack={})).Controls||(r.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.$document.on("keydown"+this.eventNs,this.onDocumentKeydown.bind(this)),this.$document.on("keyup"+this.eventNs,this.onDocumentKeyup.bind(this))},n.prototype.onDocumentKeydown=function(t){this.isEnabled&&this.wasShortcutPressed(t)&&(t.preventDefault(),this.shortcutHits<3?this.shortcutHits++:(this.postback(this.binding.command),this.shortcutHits=0))},n.prototype.onDocumentKeyup=function(t){this.shortcutHits=3},n.prototype.wasShortcutPressed=function(t){return t.ctrlKey===ko.unwrap(this.binding.ctrl)&&t.altKey===ko.unwrap(this.binding.alt)&&t.shiftKey===ko.unwrap(this.binding.shift)&&t.which===ko.unwrap(this.binding.key)},n);function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.shortcutHits=3,t}t.CommandShortcut=i,s.Utils.installBindingHandler("CommandShortcut",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ButtonBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.$element.click(this.onElementClick.bind(this))},n.prototype.onElementClick=function(t){var e;this.isEnabled&&(e=ko.unwrap(this.binding.valueToCopy),t.stopPropagationAndPreventDefault(),s.Clipboard.copy(e)&&this.postback(this.binding.click),this.$element.focus())},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.CopyButton=i,s.Utils.installBindingHandler("CopyButton",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var p;!function(d){"use strict";var t,e=(t=d.ControlBase,__extends(i,t),i.prototype.initialize=function(){var e=this;t.prototype.initialize.call(this),this.$unselectButton=this.$element.children("."+p.BusinessPackCss.commandUnselect),this.$toggleButton=this.$element.children("."+p.BusinessPackCss.commandToggle),this.$popup=this.$element.children("."+p.BusinessPackCss.primitivePopup),this.hasPopup&&(this.popupPanel=new d.PopupPanel(this.$popup,!0),this.$confirmButton=this.$popup.find("."+p.BusinessPackCss.commandConfirm),this.$popup.mousedown(function(t){return t.preventDefault()}),this.$confirmButton.mousedown(function(t){return t.preventDefault()}),this.$confirmButton.click(function(t){return e.onConfirmButtonClick(t)})),this.$element.keydown(function(t){return e.onElementKeydown(t)}),this.$element.focusin(function(t){return e.onElementFocusin(t)}),this.$element.focusout(function(t){return e.onElementFocusout(t)}),this.$unselectButton.click(function(t){return e.onUnselectButtonClick(t)}),this.$toggleButton.click(function(t){return e.onToggleButtonClick(t)}),this.outside("mousedown",function(){return e.togglePopup(!1)})},Object.defineProperty(i.prototype,"isOpened",{get:function(){return!this.popupPanel||this.popupPanel.isOpened},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"hasPopup",{get:function(){return this.$popup.length},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"hasFocus",{get:function(){return this.$element.hasClass(p.BusinessPackCss.stateFocused)},enumerable:!0,configurable:!0}),i.prototype.onElementFocusin=function(t){this.hasFocus||this.$element.addClass(p.BusinessPackCss.stateFocused)},i.prototype.onElementFocusout=function(t){this.isOutsideOfTree(t.relatedTarget)&&(this.$element.removeClass(p.BusinessPackCss.stateFocused),this.togglePopup(!1),this.applyChanges())},i.prototype.onUnselectButtonClick=function(t){this.isEnabled&&(t.stopPropagation(),this.unselectDateOrTime(),this.togglePopup(!1))},i.prototype.onToggleButtonClick=function(t){this.isEnabled&&(t.stopPropagation(),this.togglePopup())},i.prototype.onElementKeydown=function(t){this.isEnabled&&(this.isOpened?p.KeyboardKeys.isEscape(t.which)?(t.stopPropagation(),this.togglePopup(!1)):t.altKey&&t.which===p.KeyboardKeys.up&&this.togglePopup(!1):t.altKey&&(t.stopPropagationAndPreventDefault(),t.which===p.KeyboardKeys.down&&this.togglePopup(!0)))},i.prototype.onConfirmButtonClick=function(t){this.togglePopup(!1)},i.prototype.selectionChanged=function(){this.hasPendingChange=!0},i.prototype.applyChanges=function(){this.hasPendingChange&&this.binding.changed&&(this.hasPendingChange=!1,this.binding.isNested?this.binding.changed():this.postback(this.binding.changed))},i.prototype.onTextBoxChange=function(t){this.selectionChanged(),this.applyChanges()},i.prototype.togglePopup=function(t){void 0===t&&(t=!this.isOpened),this.popupPanel&&(t&&this.isEnabled?(this.popupPanel.toggle(!0),this.onPopupOpen()):(this.popupPanel.toggle(!1),this.onPopupClose()))},i.prototype.onPopupOpen=function(){},i.prototype.onPopupClose=function(){},i.prototype.isDateTimeLowerThanMin=function(t,e,i){void 0===i&&(i=this.floorDate);e=p.DateUtils.unwrapDate(e);return e&&i(t)<i(e)},i.prototype.isDateTimeHigherThanMax=function(t,e,i){void 0===i&&(i=this.floorDate);e=p.DateUtils.unwrapDate(e);return e&&i(t)>i(e)},i.prototype.isDateTimeRestricted=function(t,e,i){var n,s;if(void 0===i&&(i=this.floorDate),!e)return!1;var o=!1,r=i(t);try{for(var a=__values(e),l=a.next();!l.done;l=a.next()){var u=l.value;if(d.Calendar.isDateRangeRestriction(u)){var c=p.DateUtils.unwrapDate(u.StartDate),h=p.DateUtils.unwrapDate(u.EndDate);c&&(o=r>=i(c)),h&&(o=o&&r<i(h))}else if(d.Calendar.isDayOfWeekRestriction(u))o=t.getDay()===p.DayOfWeek[u.DayOfWeek()];else{if(!d.Calendar.isTimeRangeRestriction(u))return console.error("Unsupported restriction type."),!0;h=p.DateUtils.unwrapDate(u.StartTime),u=p.DateUtils.unwrapDate(u.EndTime);h&&(o=r>=this.floorDate(h)),u&&(o=o&&r<i(u)||u.getTime()===p.DateUtils.getEndOfDay(u).getTime()&&r===i(u))}if(o)return!0}}catch(t){n={error:t}}finally{try{l&&!l.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}return!1},i);function i(){return null!==t&&t.apply(this,arguments)||this}d.DateOrTimePickerBase=e}((p=t.BusinessPack||(t.BusinessPack={})).Controls||(p.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.DateOrTimePickerBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this)},n.prototype.floorDate=function(t){return s.DateUtils.getStartOfDay(t).getTime()},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.DatePickerBase=i}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var r;!function(t){"use strict";var i,e=(i=t.DatePickerBase,__extends(n,i),n.prototype.initialize=function(){var e=this;i.prototype.initialize.call(this),this.$textBox=this.$element.children("."+r.BusinessPackCss.primitiveTextBox),this.$popup.length?this.$calendar=this.$popup.find("."+r.BusinessPackCss.calendar):this.$calendar=this.$element.children("."+r.BusinessPackCss.calendar),this.$header=this.$calendar.children("."+r.BusinessPackCss.primitiveHeader),this.$switchButton=this.$header.children("."+r.BusinessPackCss.commandSwitch),this.$prevButton=this.$header.children("."+r.BusinessPackCss.commandPrev),this.$nextButton=this.$header.children("."+r.BusinessPackCss.commandNext),this.$textBox.keydown(function(t){return e.onTextBoxKeydown(t)}),this.$textBox.change(function(t){return e.onTextBoxChange(t)}),this.$switchButton.click(function(t){return e.onSwitchButtonClick(t)}),this.$prevButton.click(function(t){return e.onPrevButtonClick(t)}),this.$nextButton.click(function(t){return e.onNextButtonClick(t)}),this.$calendar.on("click","."+r.BusinessPackCss.calendarYear+":not(."+r.BusinessPackCss.stateDisabled+")",function(t){return e.onYearItemClick(t)}),this.$calendar.on("click","."+r.BusinessPackCss.calendarMonth+":not(."+r.BusinessPackCss.stateDisabled+")",function(t){return e.onMonthItemClick(t)}),this.$calendar.on("click","."+r.BusinessPackCss.calendarDay+":not(."+r.BusinessPackCss.stateDisabled+")",function(t){return e.onDayItemClick(t)}),this.watch(this.binding.selectedDate,this.onSelectedDateChange),r.DeviceUtils.addMobileOrTabletProp(this.$textBox,"readonly",!0)},Object.defineProperty(n.prototype,"selectedDate",{get:function(){var t=ko.unwrap(this.binding.selectedDate);return r.DateUtils.unwrapDate(t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"minDate",{get:function(){var t=ko.unwrap(this.binding.minDate);return r.DateUtils.unwrapDate(t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"maxDate",{get:function(){var t=ko.unwrap(this.binding.maxDate);return r.DateUtils.unwrapDate(t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"calendar",{get:function(){return this.$calendar.data("Calendar")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"restrictions",{get:function(){return ko.unwrap(this.binding.restrictions)?new r.Linq(ko.unwrap(this.binding.restrictions)).select(function(t){return ko.unwrap(t)}).toArray():null},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"canUnselectDateOrTime",{get:function(){return ko.unwrap(this.binding.allowUnselect)&&(!!this.selectedDate||!!this.$textBox.val())},enumerable:!0,configurable:!0}),n.prototype.unselectDateOrTime=function(){this.selectDate(null),this.$textBox.val(""),this.$textBox.focus()},n.prototype.onToggleButtonClick=function(t){i.prototype.onToggleButtonClick.call(this,t),this.$textBox.focus()},n.prototype.onElementKeydown=function(t){i.prototype.onElementKeydown.call(this,t),this.isOpened&&(r.KeyboardKeys.isEnter(t.which)||t.which===r.KeyboardKeys.tab?this.selectFocusedItem():t.which===r.KeyboardKeys.right?t.ctrlKey?this.focusItemOnNextPage():this.focusNextItem():t.which===r.KeyboardKeys.down?t.ctrlKey?this.focusItemOnNextPage():this.focusItemBelow():t.which===r.KeyboardKeys.left?t.ctrlKey?this.focusItemOnPrevPage():this.focusPrevItem():t.which===r.KeyboardKeys.up&&(t.ctrlKey?this.focusItemOnPrevPage():this.focusItemAbove()))},n.prototype.onTextBoxKeydown=function(t){this.isOpened&&r.KeyboardKeys.isArrow(t.which)&&t.preventDefault()},n.prototype.onSwitchButtonClick=function(t){this.isEnabled&&(this.calendar.isMonthViewActive?this.viewSource("Year"):this.calendar.isYearViewActive&&this.viewSource("Decade"))},n.prototype.onPrevButtonClick=function(t){this.isEnabled&&this.focusItemOnPrevPage()},n.prototype.onNextButtonClick=function(t){this.isEnabled&&this.focusItemOnNextPage()},n.prototype.onYearItemClick=function(t){this.isEnabled&&(t=ko.dataFor(t.target).FirstDate(),t=this.findNextEnabledDate(t,!1)||t,this.isYearFocused(t)||this.focusDate(t),this.selectFocusedItem())},n.prototype.onMonthItemClick=function(t){this.isEnabled&&(t=ko.dataFor(t.target).FirstDate(),t=this.findNextEnabledDate(t,!1)||t,this.isMonthFocused(t)||this.focusDate(t),this.selectFocusedItem())},n.prototype.onDayItemClick=function(t){this.isEnabled&&(this.focusDate(ko.dataFor(t.target).Date()),this.selectFocusedItem())},n.prototype.onSelectedDateChange=function(t){t=r.DateUtils.unwrapDate(t);this.$element.toggleClass(r.BusinessPackCss.stateValueEmpty,null==t),this.$textBox.length&&this.$element.toggleClass(r.BusinessPackCss.stateError,null!=this.$textBox[0].attributes["data-invalid-value"]),this.focusDate(t)},n.prototype.selectFocusedItem=function(){this.calendar.isDecadeViewActive?this.viewSource("Year"):this.calendar.isYearViewActive?this.viewSource("Month"):this.selectDate(this.focusedDateSource())},n.prototype.selectDate=function(t){var e=this.selectedDate,t=t?new Date(t):null;t&&e&&(t.setHours(e.getHours()),t.setMinutes(e.getMinutes()),t.setSeconds(e.getSeconds()),t.setMilliseconds(e.getMilliseconds())),this.binding.selectedDate(dotvvm.serialization.serializeDate(t,!1)),+t!=+e&&(this.selectionChanged(),this.binding.isNested&&this.applyChanges()),this.togglePopup(!1),this.focusDate(t)},n.prototype.isDateFocused=function(t){var e=this.focusedDateSource();return!!e&&(t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate())},n.prototype.isDateSelected=function(t){var e=this.selectedDate;return!!e&&(t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate())},n.prototype.isYearFocused=function(t){var e=this.focusedDateSource();return!!e&&t.getFullYear()===e.getFullYear()},n.prototype.isYearSelected=function(t){var e=this.selectedDate;return!!e&&t.getFullYear()===e.getFullYear()},n.prototype.isMonthFocused=function(t){var e=this.focusedDateSource();return!!e&&(t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth())},n.prototype.isMonthSelected=function(t){var e=this.selectedDate;return!!e&&(t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth())},n.prototype.focusDate=function(t){t&&(this.isDateFocused(t)||(this.activeDateSource(new Date(t)),this.focusedDateSource(new Date(t))))},n.prototype.focusPrevItem=function(){var t=this.focusedDateSource(),e=!0;this.calendar.isDecadeViewActive?t=r.DateUtils.addYears(t,-1):this.calendar.isYearViewActive?t=r.DateUtils.addMonths(t,-1):this.calendar.isMonthViewActive&&(t=r.DateUtils.addDays(t,-1),e=!1),(t=this.findPrevEnabledDate(t,e))&&this.focusDate(t)},n.prototype.focusItemOnPrevPage=function(){var t=this.focusedDateSource(),t=this.calendar.isDecadeViewActive?r.DateUtils.addYears(t,-10):this.calendar.isYearViewActive?r.DateUtils.addYears(t,-1):r.DateUtils.addMonths(t,-1);(t=this.findPrevEnabledDate(t,!0))&&this.focusDate(t)},n.prototype.focusItemAbove=function(){var t=this.focusedDateSource();this.calendar.isDecadeViewActive?t=r.DateUtils.addYears(t,-3):this.calendar.isYearViewActive?t=r.DateUtils.addMonths(t,-3):this.calendar.isMonthViewActive&&(t=r.DateUtils.addDays(t,-7)),(t=this.findPrevEnabledDate(t,!1))&&this.focusDate(t)},n.prototype.focusNextItem=function(){var t=this.focusedDateSource(),e=!0;this.calendar.isDecadeViewActive?t=r.DateUtils.addYears(t,1):this.calendar.isYearViewActive?t=r.DateUtils.addMonths(t,1):this.calendar.isMonthViewActive&&(t=r.DateUtils.addDays(t,1),e=!1),(t=this.findNextEnabledDate(t,e))&&this.focusDate(t)},n.prototype.focusItemOnNextPage=function(){var t=this.focusedDateSource(),t=this.calendar.isDecadeViewActive?r.DateUtils.addYears(t,10):this.calendar.isYearViewActive?r.DateUtils.addYears(t,1):r.DateUtils.addMonths(t,1);(t=this.findNextEnabledDate(t,!0))&&this.focusDate(t)},n.prototype.focusItemBelow=function(){var t=this.focusedDateSource();this.calendar.isDecadeViewActive?t=r.DateUtils.addYears(t,3):this.calendar.isYearViewActive?t=r.DateUtils.addMonths(t,3):this.calendar.isMonthViewActive&&(t=r.DateUtils.addDays(t,7)),(t=this.findNextEnabledDate(t,!1))&&this.focusDate(t)},n.prototype.isDateEnabled=function(t){return!this.isDateTimeLowerThanMin(t,this.binding.minDate)&&!this.isDateTimeHigherThanMax(t,this.binding.maxDate)&&!this.isDateTimeRestricted(t,this.restrictions)},n.prototype.isDateRangeEnabled=function(t,e,i){return!this.isDateTimeLowerThanMin(t,this.binding.minDate,i)&&(!this.isDateTimeHigherThanMax(e,this.binding.maxDate,i)&&this.isAnyDateInDateRangeEnabled(t,e))},n.prototype.isMonthRangeEnabled=function(t,e){return this.isDateRangeEnabled(t,e,function(t){return t.getMonth()})},n.prototype.isYearRangeEnabled=function(t,e){return this.isDateRangeEnabled(t,e,function(t){return t.getFullYear()})},n.prototype.isAnyDateInDateRangeEnabled=function(t,e){if(!this.restrictions)return!0;for(var i=this.minDate?this.minDate.getTime():null,n=this.maxDate?this.maxDate.getTime():null,s=i&&i>t.getTime()?new Date(i):t,o=n&&n<e.getTime()?n:e.getTime();s.getTime()<=o;){if(!this.isDateTimeRestricted(s,this.restrictions))return!0;s=r.DateUtils.addDays(s,1)}return!1},n.prototype.toRestrictionsObservable=function(t){var e=this;return ko.computed(function(){return e.binding.restrictions&&e.binding.restrictions(),t},this)()},n.prototype.findPrevEnabledDate=function(t,e){for(var i=t;!this.isDateEnabled(i);){if(this.isDateTimeLowerThanMin(i,this.binding.minDate))return e?this.findNextEnabledDate(t,!1):null;i=r.DateUtils.addDays(i,-1)}return i},n.prototype.findNextEnabledDate=function(t,e){for(var i=t;!this.isDateEnabled(i);){if(this.isDateTimeHigherThanMax(i,this.binding.maxDate))return e?this.findPrevEnabledDate(t,!1):null;i=r.DateUtils.addDays(i,1)}return i},n);function n(){var t=null!==i&&i.apply(this,arguments)||this;return t.activeDateSource=ko.observable(new Date),t.viewSource=ko.observable("Month"),t.focusedDateSource=ko.observable(new Date),t}t.DatePicker=e,r.Utils.installBindingHandler("DatePicker",e)}((r=t.BusinessPack||(t.BusinessPack={})).Controls||(r.Controls={}))}(DotVVM=DotVVM||{}),function(t){var n,s;function o(){return i().cultures[dotvvm.getCulture()]}function i(){return window.Globalize||window.dotvvm_Globalize}function r(t,e){t=(0<=o().calendars.standard.patterns.t.indexOf("tt")?(t+11)%12+1:t).toString();return t+":"+(e<10?"0"+e.toString():e.toString())}function a(t,e){var i=o();return-1===i.calendars.standard.patterns.t.indexOf("tt")?null:(t<12?i.calendars.standard.AM:i.calendars.standard.PM)[0]}function l(t,e){var i=new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes()),e=new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes()+1);return i<=t&&t<e}function u(t,e){var i=new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours()),e=new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours()+1);return i<=t&&t<e}function c(t,e){var i=new Date(e.getFullYear(),e.getMonth(),e.getDate()),e=new Date(e.getFullYear(),e.getMonth(),e.getDate()+1);return i<=t&&t<e}function h(t,e){var i=new Date(e.getFullYear(),e.getMonth(),1),e=new Date(e.getFullYear(),e.getMonth()+1,1);return i<=t&&t<e}function d(t,e){var i=new Date(e.getFullYear(),0,1),e=new Date(e.getFullYear()+1,0,1);return i<=t&&t<e}n=t.BusinessPack||(t.BusinessPack={}),s=n.Controls||(n.Controls={}),(t=s.DateHelper||(s.DateHelper={})).getCulture=o,t.getGlobalizeLibrary=i,t.convertStringDayOfWeekToNumber=function(t){switch(t){case"Sunday":return 0;case"Monday":return 1;case"Tuesday":return 2;case"Wednesday":return 3;case"Thursday":return 4;case"Friday":return 5;case"Saturday":return 6;default:return}},t.parseDate=function(t){if("string"!=typeof t||0===t.length)return null;var e=dotvvm.serialization.parseDate(t);return e=null==(e=null==e?i().parseDate(t,null,o()):e)?new Date(t):e},t.buildFullTimeText=function(t,e){var i=r(t,e);return null==(e=a(t))?i:i+" "+e},t.buildShortTimeText=r,t.buildAmPmString=a,t.getTotalCountOfElapsedMsInDay=function(t){return 36e5*t.getHours()+6e4*t.getMinutes()+1e3*t.getSeconds()+t.getMilliseconds()},t.getStartAndEndOfTheDateInMs=function(t,e){var i,n;switch(e){case s.DateRangeType.Year:i=new Date(t.getFullYear(),0,1,0,0,0).getTime(),n=new Date(t.getFullYear()+1,0,1,0,0,0).getTime()-1;break;case s.DateRangeType.Month:i=new Date(t.getFullYear(),t.getMonth(),1,0,0,0).getTime(),n=new Date(t.getFullYear(),t.getMonth()+1,1,0,0,0).getTime()-1;break;case s.DateRangeType.Date:i=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0).getTime(),n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,0,0,0).getTime()-1;break;case s.DateRangeType.Hour:i=new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),0,0).getTime(),n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours()+1,0,0).getTime()-1;break;case s.DateRangeType.Minute:i=new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes()).getTime(),n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes()+1).getTime()-1;break;default:i=t.getTime(),n=t.getTime()}return{start:i,end:n}},t.createCopy=function(t){return null==t?null:new Date(t.getTime())},t.areDatesEqual=function(t,e){return t===e||(null==e||null==t?e===t:null!=e&&null!=t&&e.getTime()===t.getTime())},t.isWeekend=function(t){return 0===t.getDay()||6===t.getDay()},t.isDateInGivenMinute=l,t.isDateInDateRangeOfCell=function(t,e,i){switch(i){case s.DateRangeType.Year:return d(t,e);case s.DateRangeType.Month:return h(t,e);case s.DateRangeType.Date:return c(t,e);case s.DateRangeType.Hour:return u(t,e);case s.DateRangeType.Minute:return l(t,e)}},t.isDateInGivenHour=u,t.isDateInGivenDay=c,t.isDateInGivenMonth=h,t.isDateInGivenYear=d,t.getNextOccurrenceOfDayOfWeek=function(t,e){(6<e||e<0)&&n.Utils.warnInDebugMode("Given day of week is invalid!");var i=new Date(t.getFullYear(),t.getMonth(),t.getDate());return i.setDate(t.getDate()+(7+e-t.getDay())%7),i}}(DotVVM=DotVVM||{}),function(t){var p;!function(d){"use strict";var t=(Object.defineProperty(e.prototype,"currentlyDisplayedDate",{get:function(){return this._currentlyDisplayedDate},set:function(t){this._currentlyDisplayedDate=d.DateHelper.createCopy(t)},enumerable:!0,configurable:!0}),e.prototype.getCurrentlyDisplayedDate=function(){return d.DateHelper.createCopy(this.currentlyDisplayedDate)},e.prototype.setCurrentlyDisplayedDate=function(t){this.currentlyDisplayedDate=this.getFirstPossibleDateToShow(t)},Object.defineProperty(e.prototype,"currentlyDisplayedYear",{get:function(){return this.currentlyDisplayedDate.getFullYear()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentlyDisplayedMonth",{get:function(){return this.currentlyDisplayedDate.getMonth()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentlyDisplayedDay",{get:function(){return this.currentlyDisplayedDate.getDate()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentlyDisplayedHour",{get:function(){return this.currentlyDisplayedDate.getHours()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentlyDisplayedMinute",{get:function(){return this.currentlyDisplayedDate.getMinutes()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentViewType",{get:function(){return this._currentViewType},set:function(t){this._currentViewType=t},enumerable:!0,configurable:!0}),e.prototype.getCurrentViewType=function(){return this._currentViewType},e.prototype.setCurrentViewType=function(t){if(null==this._currentViewType||null==t)switch(this.calendarType){case d.CalendarMode.Year:this._currentViewType=d.DateRangeType.Year;break;case d.CalendarMode.Month:this._currentViewType=d.DateRangeType.Month;break;case d.CalendarMode.Time:this._currentViewType=d.DateRangeType.Hour;break;default:this._currentViewType=d.DateRangeType.Date}this.calendarType!==d.CalendarMode.Time||t!==d.DateRangeType.Date&&t!==d.DateRangeType.Month&&t!==d.DateRangeType.Year?this.calendarType!==d.CalendarMode.Date||t!==d.DateRangeType.Hour&&t!==d.DateRangeType.Minute?this.calendarType!==d.CalendarMode.Month||t!==d.DateRangeType.Date&&t!==d.DateRangeType.Hour&&t!==d.DateRangeType.Minute?this.calendarType===d.CalendarMode.Year&&t!==d.DateRangeType.Year?this._currentViewType=d.DateRangeType.Year:null!=t&&(this._currentViewType=t):this._currentViewType=d.DateRangeType.Month:this._currentViewType=d.DateRangeType.Date:this._currentViewType=d.DateRangeType.Hour},Object.defineProperty(e.prototype,"canGoToThePreviousPage",{get:function(){return 0!==this.$element.find("th."+p.BusinessPackCss.commandPrev).length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"canGoToTheNextPage",{get:function(){return 0!==this.$element.find("th."+p.BusinessPackCss.commandNext).length},enumerable:!0,configurable:!0}),e.prototype.getCalendarType=function(){return this.calendarType},e.prototype.setCalendarType=function(t){this.calendarType=t,this.setCurrentViewType(this.currentViewType)},e.prototype.subscribe=function(t){this.observers.push(t)},e.prototype.unsubscribe=function(t){t=this.observers.indexOf(t,0);-1<t&&this.observers.splice(t,1)},e.prototype.notifyObservers=function(e){void 0===e&&(e=d.ChangeType.Complete);for(var i=[],t=1;t<arguments.length;t++)i[t-1]=arguments[t];this.observers.forEach(function(t){return t.notify.apply(t,__spread([e],i))})},e.prototype.render=function(t,e,i){this.globalizeLibrary=d.DateHelper.getGlobalizeLibrary(),this.culture=d.DateHelper.getCulture(),null!=i&&this.setCurrentViewType(i),null!=e&&this.setCurrentlyDisplayedDate(e),this.$element=$(t),this.createCalendar(),this.initCalendarControls()},e.prototype.initCalendarControls=function(){var e=this;this.$element.bind("mousewheel DOMMouseScroll",function(t){0<t.originalEvent.wheelDelta||t.originalEvent.detail<0?e.canGoToThePreviousPage&&e.changePage(-1):e.canGoToTheNextPage&&e.changePage(1)});function i(t){$(t.target).is("input")||("ArrowLeft"===t.key&&e.canGoToThePreviousPage&&e.changePage(-1),"ArrowRight"===t.key&&e.canGoToTheNextPage&&e.changePage(1))}this.$element.mouseenter(function(t){$(document).on("keydown",i)}),this.$element.mouseleave(function(t){$(document).off("keydown",i)})},e.prototype.update=function(){null!=this.$element&&this.createCalendar()},e.prototype.getFirstPossibleDateToShow=function(t){if(null!=t&&this.dateValidator.isDateInValidRange(t))return t;if(null!=this.currentlyDisplayedDate&&this.dateValidator.isDateInValidRange(this.currentlyDisplayedDate))return this.currentlyDisplayedDate;var e=new Date;return this.dateValidator.isDateInValidRange(e)||(t=this.dateValidator.findFirstDateThatPassesRestrictions(e,d.DateRangeType.Year,e).date,e=d.DateHelper.createCopy(null!=t?t:new Date)),e},e.prototype.createCalendar=function(){switch(null==this.currentlyDisplayedDate&&this.setCurrentlyDisplayedDate(null),this.currentViewType){case d.DateRangeType.Year:this.initYearSelector();break;case d.DateRangeType.Month:this.initMonthSelector();break;case d.DateRangeType.Date:this.initDateSelector();break;case d.DateRangeType.Hour:this.initHourSelector();break;case d.DateRangeType.Minute:this.initMinuteSelector()}},e.prototype.updateCalendarTable=function(t){var e=$(":focus");this.$element.empty(),this.$element.append(t),0==$(":focus").length&&e.parents("."+p.BusinessPackCss.calendarTable)&&this.$element.focus(),this.calendarRendered()},e.prototype.initMinuteSelector=function(){var t=this;this._currentViewType=d.DateRangeType.Minute;var e=this.createTable().addClass(""+p.BusinessPackCss.calendarMinuteSelector),i=this.createTableThead(),n=this.createTableTbody(),s=new Date(this.currentlyDisplayedYear,this.currentlyDisplayedMonth,this.currentlyDisplayedDay,this.currentlyDisplayedHour-1),o=!(this.calendarType===d.CalendarMode.Time&&this.currentlyDisplayedDay!==s.getDate())&&this.dateValidator.isHourInValidRange(s),r=new Date(this.currentlyDisplayedYear,this.currentlyDisplayedMonth,this.currentlyDisplayedDay,this.currentlyDisplayedHour+1),s=!(this.calendarType===d.CalendarMode.Time&&this.currentlyDisplayedDay!==r.getDate())&&this.dateValidator.isHourInValidRange(r),r=this.createRow();o?r.append(this.createPrevLinkCell(function(){return t.changeMinutesPage(-1)})):r.append(r.append(this.createHeaderCell("").addClass(p.BusinessPackCss.stateDataEmpty))),r.append(this.createLinkCell(d.DateHelper.buildFullTimeText(this.currentlyDisplayedHour,0),function(){return t.initHourSelector()},!1,!s&&!o,!1,!0).attr("colspan",2)),s?r.append(this.createNextLinkCell(function(){return t.changeMinutesPage(1)})):r.append(r.append(this.createHeaderCell("").addClass(p.BusinessPackCss.stateDataEmpty))),r.addClass(""+p.BusinessPackCss.primitiveHeader),i.append(r),e.append(i);for(var a,l=0;l<6;l++){for(var u=this.createRow(),c=0;c<2;c++)a=5*(2*l+c),u.append(t.createMinuteCell(new Date(t.currentlyDisplayedYear,t.currentlyDisplayedMonth,t.currentlyDisplayedDay,t.currentlyDisplayedHour,a,0,0)).attr("colspan",2));n.append(u)}e.append(n),this.updateCalendarTable(e)},e.prototype.initHourSelector=function(){var t=this;this._currentViewType=d.DateRangeType.Hour;var e,i,n,s=this.createTable().addClass(""+p.BusinessPackCss.calendarHourSelector),o=this.createTableThead(),r=this.createTableTbody();this.calendarType!==d.CalendarMode.Time&&(e=this.dateValidator.isDayInValidRange(new Date(this.currentlyDisplayedYear,this.currentlyDisplayedMonth,this.currentlyDisplayedDay-1)),i=this.dateValidator.isDayInValidRange(new Date(this.currentlyDisplayedYear,this.currentlyDisplayedMonth,this.currentlyDisplayedDay+1)),n=this.createRow(),e?n.append(this.createPrevLinkCell(function(){return t.changeHoursPage(-1)})):n.append(n.append(this.createHeaderCell("").addClass(p.BusinessPackCss.stateDataEmpty))),n.append(this.createLinkCell(dotvvm.globalize.formatString("d",this.currentlyDisplayedDate),function(){return t.initDateSelector()},!1,!i&&!e,!1,!0).attr("colspan",2)),i?n.append(this.createNextLinkCell(function(){return t.changeHoursPage(1)})):n.append(n.append(this.createHeaderCell("").addClass(p.BusinessPackCss.stateDataEmpty))),n.addClass(""+p.BusinessPackCss.primitiveHeader),o.append(n),s.append(o));for(var a,l=0;l<6;l++){for(var u=this.createRow(),c=0;c<4;c++)a=4*l+c,u.append(t.createHourCell(new Date(t.currentlyDisplayedYear,t.currentlyDisplayedMonth,t.currentlyDisplayedDay,a,0,0,0)));r.append(u)}s.append(r),this.updateCalendarTable(s)},e.prototype.initDateSelector=function(){var t=this;this._currentViewType=d.DateRangeType.Date;var e=this.createTable().addClass(""+p.BusinessPackCss.calendarDateSelector),i=this.createTableThead(),n=this.createTableTbody(),s=this.dateValidator.isMonthInValidRange(new Date(this.currentlyDisplayedYear,this.currentlyDisplayedMonth-1,1)),o=this.dateValidator.isMonthInValidRange(new Date(this.currentlyDisplayedYear,this.currentlyDisplayedMonth+1,1)),r=this.createRow();s?r.append(this.createPrevLinkCell(function(){return t.changeDatesPage(-1)})):r.append(r.append(this.createHeaderCell("").addClass(p.BusinessPackCss.stateDataEmpty))),r.append(this.createLinkCell(dotvvm.globalize.formatString("MMMM yyyy",new Date(this.currentlyDisplayedYear,this.currentlyDisplayedMonth,1)),function(){return t.initMonthSelector()},!1,!o&&!s,!1,!0).attr("colspan",5)),o?r.append(this.createNextLinkCell(function(){return t.changeDatesPage(1)})):r.append(r.append(this.createHeaderCell("").addClass(p.BusinessPackCss.stateDataEmpty))),r.addClass(""+p.BusinessPackCss.primitiveHeader),i.append(r);for(var a=this.createRow(),l=0;l<7;l++){var u=this.culture.calendars.standard.days.namesShort[(this.culture.calendars.standard.firstDay+l)%7];a.append(this.createHeaderCell(u))}a.addClass(""+p.BusinessPackCss.calendarMonth),i.append(a),e.append(i);for(var c=new Date(this.currentlyDisplayedYear,this.currentlyDisplayedMonth,1);c.getDay()!==this.culture.calendars.standard.firstDay;)c=new Date(c.getFullYear(),c.getMonth(),c.getDate()-1);do{for(var h=this.createRow(),l=0;l<7;l++)h.append(t.createDateCell(c)),c=new Date(c.getFullYear(),c.getMonth(),c.getDate()+1)}while(n.append(h),c.getMonth()===this.currentlyDisplayedMonth);e.append(n),this.updateCalendarTable(e)},e.prototype.initMonthSelector=function(){var t=this;this._currentViewType=d.DateRangeType.Month;var e=this.createTable().addClass(""+p.BusinessPackCss.calendarMonthSelector),i=this.createTableThead(),n=this.createTableTbody(),s=this.dateValidator.isYearInValidRange(new Date(this.currentlyDisplayedYear-1,0,1)),o=this.dateValidator.isYearInValidRange(new Date(this.currentlyDisplayedYear+1,0,1)),r=this.createRow();s?r.append(this.createPrevLinkCell(function(){return t.changeMonthsPage(-1)})):r.append(r.append(this.createHeaderCell("").addClass(p.BusinessPackCss.stateDataEmpty))),r.append(this.createLinkCell(this.currentlyDisplayedYear.toString(),function(){return t.initYearSelector()},!1,!o&&!s,!1,!0).attr("colspan",4)),o?r.append(this.createNextLinkCell(function(){return t.changeMonthsPage(1)})):r.append(r.append(this.createHeaderCell("").addClass(p.BusinessPackCss.stateDataEmpty))),r.addClass(""+p.BusinessPackCss.primitiveHeader),i.append(r),e.append(i);for(var a,l=0;l<4;l++){for(var u=this.createRow(),c=0;c<3;c++)a=3*l+c,u.append(t.createMonthCell(new Date(t.currentlyDisplayedYear,a,1,0,0,0,0)).attr("colspan",2));n.append(u)}e.append(n),this.updateCalendarTable(e)},e.prototype.initYearSelector=function(){var t=this;this._currentViewType=d.DateRangeType.Year;var e=this.createTable().addClass(""+p.BusinessPackCss.calendarYearSelector),i=this.createTableThead(),n=this.createTableTbody(),s=16*Math.floor(this.currentlyDisplayedYear/16),o=this.createRow();this.dateValidator.isYearInValidRange(new Date(s-1,0,1))?o.append(this.createPrevLinkCell(function(){return t.changeYearsPage(-1)})):o.append(o.append(this.createHeaderCell("").addClass(p.BusinessPackCss.stateDataEmpty))),o.append(this.createHeaderCell("").attr("colspan",2).addClass(p.BusinessPackCss.stateDataEmpty)),this.dateValidator.isYearInValidRange(new Date(16+s,0,1))?o.append(this.createNextLinkCell(function(){return t.changeYearsPage(1)})):o.append(this.createHeaderCell("").addClass(p.BusinessPackCss.stateDataEmpty)),o.addClass(""+p.BusinessPackCss.primitiveHeader),i.append(o),e.append(i);for(var r,a=0;a<4;a++){for(var l=this.createRow(),u=0;u<4;u++)r=s+4*a+u,l.append(t.createYearCell(new Date(r,0,1,0,0,0,0)));n.append(l)}e.append(n),this.updateCalendarTable(e)},e.prototype.calendarRendered=function(){},e.prototype.createYearCell=function(t,e){var i=this;void 0===e&&(e=!1);var n=this.dateValidator.isYearInValidRange(t),s=n&&!this.dateValidator.doesDatePassAllRestrictions(t,d.DateRangeType.Year).doesDatePassRestrictions;return this.createLinkCell(t.getFullYear().toString(),function(){i.currentlyDisplayedDate=t,i.selectYear(t)},e,!n||s&&this.calendarType===d.CalendarMode.Year,s)},e.prototype.createMonthCell=function(t,e){var i=this;void 0===e&&(e=!1);var n=this.culture.calendars.standard.months.names[t.getMonth()],s=this.dateValidator.isMonthInValidRange(t),o=s&&!this.dateValidator.doesDatePassAllRestrictions(t,d.DateRangeType.Month).doesDatePassRestrictions;return this.createLinkCell(n,function(){i.currentlyDisplayedDate=t,i.selectMonth(t)},e,!s||o&&this.calendarType===d.CalendarMode.Month,o)},e.prototype.createDateCell=function(t,e){var i=this;void 0===e&&(e=!1);var n=this.dateValidator.isDayInValidRange(t),s=n&&!this.dateValidator.doesDatePassAllRestrictions(t,d.DateRangeType.Date).doesDatePassRestrictions,o=this.currentlyDisplayedMonth!==t.getMonth(),s=this.createLinkCell(t.getDate().toString(),function(){o&&i.calendarType===d.CalendarMode.Date||(i.currentlyDisplayedDate=t),i.selectDay(t)},e,!n||s&&this.calendarType===d.CalendarMode.Date,s);return o&&s.addClass(""+p.BusinessPackCss.calendarOtherMonth),d.DateHelper.isWeekend(t)&&s.addClass(""+p.BusinessPackCss.calendarWeekend),s},e.prototype.changeMinutesPage=function(t){this.currentlyDisplayedDate.setHours(this.currentlyDisplayedHour+t,0,0,0),this.initMinuteSelector()},e.prototype.changeHoursPage=function(t){this.currentlyDisplayedDate.setDate(this.currentlyDisplayedDay+t),this.initHourSelector()},e.prototype.changeDatesPage=function(t){this.currentlyDisplayedDate.setMonth(this.currentlyDisplayedMonth+t,1),this.initDateSelector()},e.prototype.changeMonthsPage=function(t){this.currentlyDisplayedDate.setFullYear(this.currentlyDisplayedYear+t,0,1),this.initMonthSelector()},e.prototype.changeYearsPage=function(t){this.currentlyDisplayedDate.setFullYear(this.currentlyDisplayedYear+16*t,0,1),this.initYearSelector()},e.prototype.changePage=function(t){switch(this._currentViewType){case d.DateRangeType.Year:this.changeYearsPage(t);break;case d.DateRangeType.Month:this.changeMonthsPage(t);break;case d.DateRangeType.Date:this.changeDatesPage(t);break;case d.DateRangeType.Hour:this.changeHoursPage(t);break;case d.DateRangeType.Minute:this.changeMinutesPage(t)}},e.prototype.createHourCell=function(t,e){var i=this;void 0===e&&(e=!1);var n=d.DateHelper.buildShortTimeText(t.getHours(),t.getMinutes()),s=d.DateHelper.buildAmPmString(t.getHours(),t.getMinutes()),o=this.dateValidator.isHourInValidRange(t),r=o&&!this.dateValidator.doesDatePassAllRestrictions(t,d.DateRangeType.Hour).doesDatePassRestrictions,o=this.createLinkCell("",function(){i.currentlyDisplayedDate=t,i.selectHour(t)},e,!o,r),r=$("<span></span>").text(n),n=o.children("a");return(n=0==n.length?o.children("span"):n).append(r),null!=s&&(s=$("<span></span>").text(s),n.append(s),o.addClass("double-line")),o},e.prototype.createMinuteCell=function(t,e){var i=this;void 0===e&&(e=!1);var n=d.DateHelper.buildShortTimeText(t.getHours(),t.getMinutes()),s=d.DateHelper.buildAmPmString(t.getHours(),t.getMinutes()),o=this.dateValidator.isMinuteInValidRange(t),r=o&&!this.dateValidator.doesDatePassAllRestrictions(t,d.DateRangeType.Minute).doesDatePassRestrictions,o=this.createLinkCell("",function(){i.currentlyDisplayedDate=t,i.selectMinute(t)},e,!o,r),r=$("<span></span>").text(n),n=o.children("a");return(n=0==n.length?o.children("span"):n).append(r),null!=s&&(s=$("<span></span>").text(s),n.append(s),o.addClass("double-line")),o},e.prototype.createCell=function(t){return $("<td></td>").append($("<span></span>").text(t))},e.prototype.createHeaderCell=function(t){return $("<th></th>").append($("<span></span>").text(t))},e.prototype.createLinkCell=function(t,e,i,n,s,o){return void 0===i&&(i=!1),void 0===s&&(s=!1),void 0===o&&(o=!1),e=(n=void 0===n?!1:n)||!this.enabled?$("<span></span>").text(t):this.createLink(t,e),o=o?$("<th></th>"):$("<td></td>"),!n&&this.enabled||o.addClass(p.BusinessPackCss.stateDisabled),s&&o.addClass(p.BusinessPackCss.stateSemiDisabled),i&&o.addClass(p.BusinessPackCss.stateActive),o.append(e),o},e.prototype.createPrevLinkCell=function(t){return $("<th></th>").append(this.createEmptyLink(t).append($("<span></span>").addClass("fa fa-arrow-left"))).addClass(""+p.BusinessPackCss.commandPrev)},e.prototype.createNextLinkCell=function(t){return $("<th></th>").append(this.createEmptyLink(t).append($("<span></span>").addClass("fa fa-arrow-right"))).addClass(""+p.BusinessPackCss.commandNext)},e.prototype.createLink=function(t,e){return this.createEmptyLink(e).text(t)},e.prototype.createEmptyLink=function(e){var t=$("<a></a>");return this.enabled&&t.attr({href:"javascript:;",tabindex:-1}).on("click",function(t){e(),t.stopPropagation()}),t},e.prototype.createRow=function(){return $("<tr></tr>")},e.prototype.createTable=function(){return $("<table></table>").addClass(p.BusinessPackCss.calendarTable)},e.prototype.createTableThead=function(){return $("<thead></thead>")},e.prototype.createTableTbody=function(){return $("<tbody></tbody>")},e);function e(t,e){this.enabled=!0,this.dateValidator=t,this.observers=new Array,this.calendarType=e,this.setCurrentViewType(null)}d.CalendarBase=t}((p=t.BusinessPack||(t.BusinessPack={})).Controls||(p.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(i){"use strict";var e,t=(e=i.CalendarBase,__extends(n,e),Object.defineProperty(n.prototype,"selectedDate",{get:function(){return this._selectedDate},set:function(t){this.setSelectedDate(t),this.notifyObservers(i.ChangeType.Complete,this._selectedDate)},enumerable:!0,configurable:!0}),n.prototype.getSelectedDate=function(){return i.DateHelper.createCopy(this.selectedDate)},n.prototype.setSelectedDate=function(t){if(t=i.DateHelper.createCopy(t),this._selectedDate=this.moveDateToValidRangeIfNessesary(t),null==this._selectedDate&&this.calendarType===i.CalendarMode.Date&&this.currentViewType===i.DateRangeType.Date)return this.dateValidator.findFirstDateThatPassesRestrictions(t,i.DateRangeType.Date,t).date;i.DateHelper.areDatesEqual(t,this._selectedDate)||(s.Utils.warnInDebugMode("Changed selected date to be valid."),this.notifyObservers(i.ChangeType.Complete,this.selectedDate))},n.prototype.checkSelectedValue=function(){this.setSelectedDate(this.selectedDate)},n.prototype.moveDateToValidRangeIfNessesary=function(t){return null==t?t:this.dateValidator.minDate>t?this.dateValidator.minDate:this.dateValidator.maxDate<t?this.dateValidator.maxDate:this.dateValidator.isThereAnyValidPartInDate(t,null)?t:this.dateValidator.findFirstDateThatPassesRestrictions(t,this.currentViewType,t).date},n.prototype.getFirstPossibleDateToShow=function(t){if(null!=t&&this.dateValidator.isDateInValidRange(t))return t;if(null!=this.currentlyDisplayedDate&&this.dateValidator.isDateInValidRange(this.currentlyDisplayedDate))return this.currentlyDisplayedDate;if(null!=this.selectedDate&&this.dateValidator.isDateInValidRange(this.selectedDate))return i.DateHelper.createCopy(this.selectedDate);var e=new Date;return this.dateValidator.isDateInValidRange(e)||(t=this.dateValidator.findFirstDateThatPassesRestrictions(e,i.DateRangeType.Year,e).date,e=i.DateHelper.createCopy(null!=t?t:new Date)),e},n.prototype.createCalendar=function(){e.prototype.createCalendar.call(this)},n.prototype.createYearCell=function(t){return e.prototype.createYearCell.call(this,t,i.DateHelper.isDateInDateRangeOfCell(this.selectedDate,t,i.DateRangeType.Year))},n.prototype.createMonthCell=function(t){return e.prototype.createMonthCell.call(this,t,i.DateHelper.isDateInDateRangeOfCell(this.selectedDate,t,i.DateRangeType.Month))},n.prototype.createDateCell=function(t){return e.prototype.createDateCell.call(this,t,i.DateHelper.isDateInDateRangeOfCell(this.selectedDate,t,i.DateRangeType.Date))},n.prototype.createHourCell=function(t){return e.prototype.createHourCell.call(this,t,i.DateHelper.isDateInDateRangeOfCell(this.selectedDate,t,i.DateRangeType.Hour))},n.prototype.createMinuteCell=function(t){return e.prototype.createMinuteCell.call(this,t,i.DateHelper.isDateInDateRangeOfCell(this.selectedDate,t,i.DateRangeType.Minute)&&null!=this.dateValidator.findFirstDateThatPassesRestrictions(t,i.DateRangeType.Minute,t))},n.prototype.selectMinute=function(t){this.selectedDate=t,this.update()},n.prototype.selectHour=function(t){for(var e=0,i=0;i<60;)this.dateValidator.isMinuteInValidRange(new Date(this.currentlyDisplayedYear,this.currentlyDisplayedMonth,this.currentlyDisplayedDay,this.currentlyDisplayedHour,i,0))&&e++,i+=5;this.dateValidator.isMinuteInValidRange(new Date(this.currentlyDisplayedYear,this.currentlyDisplayedMonth,this.currentlyDisplayedDay,this.currentlyDisplayedHour,0,0))&&1===e?this.selectMinute(new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),0,0,0)):this.initMinuteSelector()},n.prototype.selectMonth=function(t){this.calendarType===i.CalendarMode.Month?(this.selectedDate=t,this.update()):this.initDateSelector()},n.prototype.selectYear=function(t){this.calendarType===i.CalendarMode.Year?(this.selectedDate=t,this.update()):this.initMonthSelector()},n.prototype.selectDay=function(t){this.calendarType===i.CalendarMode.DateTime?this.initHourSelector():(this.selectedDate=t,this.update())},n);function n(){return null!==e&&e.apply(this,arguments)||this}i.CalendarN=t}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var o;!function(t){"use strict";var e=(i.prototype.getCurrentlyDisplayedDate=function(){return t.DateHelper.createCopy(this.currentlyDisplayedDate)},i.prototype.setCurrentlyDisplayedDate=function(t){this.currentlyDisplayedDate=t},Object.defineProperty(i.prototype,"enabled",{get:function(){return this.mainCalendar.enabled},set:function(t){this.mainCalendar.enabled=t,this.sideCalendar.enabled=t},enumerable:!0,configurable:!0}),i.prototype.getCalendarType=function(){return t.CalendarMode.DateTime},i.prototype.subscribe=function(t){this.observers.push(t)},i.prototype.unsubscribe=function(t){t=this.observers.indexOf(t,0);-1<t&&this.observers.splice(t,1)},i.prototype.notifyObservers=function(e){void 0===e&&(e=t.ChangeType.Complete),this.observers.forEach(function(t){return t.notify(e)})},i.prototype.checkSelectedValue=function(){this.mainCalendar.checkSelectedValue()},i.prototype.update=function(){this.updateSidePanel(),this.mainCalendar.update(),this.sideCalendar.update()},i.prototype.createButton=function(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=!1);var s=$("<div></div>"),e=n?$("<span></span>").text(t):$("<a>"+t+"</a>").attr({href:"javascript:;"}).on("click",e);return s.append(e),i&&s.addClass(""+o.BusinessPackCss.stateActive),s},i);function i(t){this.dateValidator=t,this.observers=new Array,this.$main=$("<div></div>").addClass(o.BusinessPackCss.calendarMain),this.$side=$("<div></div>").addClass(o.BusinessPackCss.primitiveSide)}t.CalendarExtendedModeBase=e}((o=t.BusinessPack||(t.BusinessPack={})).Controls||(o.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(i){"use strict";var n,t=(n=i.CalendarExtendedModeBase,__extends(e,n),e.prototype.setSelectedDate=function(t){this.mainCalendar.setSelectedDate(t),this.sideCalendar.setSelectedDate(t),this.mainCalendar.setCurrentlyDisplayedDate(t),this.sideCalendar.setCurrentlyDisplayedDate(t),this.update()},e.prototype.getSelectedDate=function(){return this.mainCalendar.getSelectedDate()},e.prototype.notify=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];this.mainCalendar.setSelectedDate(e[0]),this.sideCalendar.setSelectedDate(e[0]),this.setCurrentViewType(null),this.notifyObservers(t),this.updateSidePanel()},e.prototype.getCurrentViewType=function(){return this.mainCalendar.getCurrentViewType()},e.prototype.setCurrentViewType=function(t){this.mainCalendar.setCurrentViewType(t)},e.prototype.getCalendarType=function(){return this.mainCalendar.getCalendarType()},e.prototype.render=function(t,e,i){this.$element=$(t),this.mainCalendar.render(this.$main[0]),this.sideCalendar.render(this.$sideCalendar[0]),this.mainCalendar.setCurrentlyDisplayedDate(e),this.mainCalendar.setCurrentViewType(i),this.sideCalendar.setCurrentlyDisplayedDate(e),this.sideCalendar.setCurrentViewType(i),this.$element.append(this.$main),this.$element.append(this.$side),this.updateSidePanel()},e.prototype.updateSidePanel=function(){var t=this.mainCalendar.getSelectedDate();null!=t&&this.enabled?(this.$side.show(),this.$sideUpperRow.empty(),this.$sideUpperRow.append($("<span></span>").text(i.DateHelper.buildFullTimeText(t.getHours(),t.getMinutes()))),this.sideCalendar.setSelectedDate(t),this.sideCalendar.setCurrentViewType(null),this.sideCalendar.setCurrentlyDisplayedDate(t),this.sideCalendar.update()):this.$side.hide()},Object.defineProperty(e.prototype,"currentlyDisplayedDate",{get:function(){return this.mainCalendar.getCurrentlyDisplayedDate()},set:function(t){this.mainCalendar.setCurrentlyDisplayedDate(t),this.sideCalendar.setCurrentlyDisplayedDate(t)},enumerable:!0,configurable:!0}),e);function e(t){var e=n.call(this,t)||this;return e.mainCalendar=new i.CalendarN(t,i.CalendarMode.Date),e.mainCalendar.subscribe(e),e.sideCalendar=new i.CalendarN(t,i.CalendarMode.Time),e.sideCalendar.subscribe(e),e.setCurrentViewType(i.DateRangeType.Date),e.$sideUpperRow=$("<div></div>").addClass(s.BusinessPackCss.calendarUpperRow),e.$side.append(e.$sideUpperRow),e.$sideCalendar=$("<div></div>"),e.$side.append(e.$sideCalendar),e}i.CalendarExtended=t}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var r;!function(s){"use strict";var i,t=(i=s.CalendarExtendedModeBase,__extends(e,i),e.prototype.notify=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var n=t===s.ChangeType.Complete&&void 0!==e[0]&&void 0!==e[1]||t===s.ChangeType.Partial;n&&t===s.ChangeType.Partial?this.putSideCalendarInStartMode():n&&t===s.ChangeType.Complete?this.putSideCalendarInEndMode():!n&&this.isSideCalendarInStartMode?this.setSelectedStartDate(e[0]):!n&&this.putSideCalendarInEndMode&&this.setSelectedEndDate(e[0]),this.update(),this.notifyObservers(t)},e.prototype.updateSidePanel=function(){null!=this.getSelectedStartDate()&&this.enabled?(this.$side.show(),this.isSideCalendarInStartMode&&!this.isSideCalendarInEndMode?this.putSideCalendarInStartMode():!this.isSideCalendarInStartMode&&this.isSideCalendarInEndMode?this.putSideCalendarInEndMode():null!=this.getSelectedStartDate()&&null==this.getSelectedEndDate()?this.putSideCalendarInStartMode():null!=this.getSelectedStartDate()&&null==this.getSelectedEndDate()&&this.putSideCalendarInEndMode(),this.buildSideCalendarSelector()):this.$side.hide()},e.prototype.getCurrentViewType=function(){return this.mainCalendar.getCurrentViewType()},e.prototype.setCurrentViewType=function(t){this.mainCalendar.setCurrentViewType(t)},e.prototype.render=function(t,e,i){this.$element=$(t),this.setCurrentlyDisplayedDate(e),this.setCurrentViewType(i),this.mainCalendar.render(this.$main[0]),this.sideCalendar.render(this.$sideCalendar[0]),this.$element.append(this.$main),this.$element.append(this.$side),this.update()},e.prototype.setSelectedRange=function(t,e){this.mainCalendar.setSelectedRange(t,e)},e.prototype.setSelectedStartDate=function(t){this.mainCalendar.setSelectedStartDate(t)},e.prototype.setSelectedEndDate=function(t){this.mainCalendar.setSelectedEndDate(t)},e.prototype.getSelectedStartDate=function(){return this.mainCalendar.getSelectedStartDate()},e.prototype.getSelectedEndDate=function(){return this.mainCalendar.getSelectedEndDate()},e.prototype.setDisplayedDateToStartDate=function(){this.mainCalendar.setDisplayedDateToStartDate(),this.putSideCalendarInStartMode()},e.prototype.setDisplayedDateToEndDate=function(){this.mainCalendar.setDisplayedDateToEndDate(),this.putSideCalendarInEndMode()},Object.defineProperty(e.prototype,"currentlyDisplayedDate",{get:function(){return this.mainCalendar.getCurrentlyDisplayedDate()},set:function(t){this.mainCalendar.setCurrentlyDisplayedDate(t)},enumerable:!0,configurable:!0}),e.prototype.buildSideCalendarSelector=function(t){var e=this;void 0===t&&(t=!0),null==this.$sideCalendarSelector&&(this.$sideCalendarSelector=$("<div></div>").addClass(r.BusinessPackCss.calendarUpperRow).addClass(r.BusinessPackCss.calendarSelector)),this.$sideCalendarSelector.empty();var i=this.isSideCalendarInStartMode?function(){}:function(){e.putSideCalendarInStartMode(),e.buildSideCalendarSelector(!0),e.sideCalendar.update()},n=this.isSideCalendarInEndMode?function(){}:function(){e.putSideCalendarInEndMode(),e.buildSideCalendarSelector(!0),e.sideCalendar.update()};t&&(s=null!=this.getSelectedStartDate()?dotvvm.globalize.formatString("g",this.getSelectedStartDate()):"",o=null!=this.getSelectedEndDate()?dotvvm.globalize.formatString("g",this.getSelectedEndDate()):"");var s=this.createButton(t?""+s:"",i,this.isSideCalendarInStartMode,null==this.getSelectedStartDate()),i=this.createButton(t?""+o:"",n,this.isSideCalendarInEndMode,null==this.getSelectedEndDate());s.addClass(r.BusinessPackCss.calendarSelectorStart),i.addClass(r.BusinessPackCss.calendarSelectorEnd);var o=s.find("a"),n=i.find("a");this.$sideCalendarSelector.append(s),this.$sideCalendarSelector.append(i);i=0!==o.length&&o[0].scrollWidth>s.innerWidth()||0!==n.length&&i[0].scrollWidth>i.innerWidth();t&&i&&this.buildSideCalendarSelector(!1)},e.prototype.putSideCalendarInStartMode=function(){this.isSideCalendarInStartMode=!0,this.isSideCalendarInEndMode=!1;var t=this.getSelectedStartDate();this.sideCalendar.setCurrentlyDisplayedDate(t),this.sideCalendar.setSelectedDate(t),this.sideCalendar.setCurrentViewType(s.DateRangeType.Hour),this.setCurrentViewType(s.DateRangeType.Hour)},e.prototype.putSideCalendarInEndMode=function(){this.isSideCalendarInStartMode=!1,this.isSideCalendarInEndMode=!0;var t=this.getSelectedEndDate();this.sideCalendar.setCurrentlyDisplayedDate(t),this.sideCalendar.setSelectedDate(t),this.sideCalendar.setCurrentViewType(s.DateRangeType.Hour),this.setCurrentViewType(s.DateRangeType.Hour)},e);function e(t){var e=i.call(this,t)||this;return e.isSideCalendarInStartMode=!1,e.isSideCalendarInEndMode=!1,e.mainCalendar=new s.RangeSelection(t,s.CalendarMode.Date),e.mainCalendar.subscribe(e),e.sideCalendar=new s.CalendarN(t,s.CalendarMode.Time),e.sideCalendar.subscribe(e),e.buildSideCalendarSelector(),e.$sideCalendar=$("<div></div>"),e.$side.append(e.$sideCalendarSelector),e.$side.append(e.$sideCalendar),e}s.RangeCalendarExtended=t}((r=t.BusinessPack||(t.BusinessPack={})).Controls||(r.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(i){"use strict";var n,t=(n=i.CalendarBase,__extends(e,n),Object.defineProperty(e.prototype,"selectedStartDate",{get:function(){return this._selectedStartDate},set:function(t){t=new Date(t.getTime());var e=!i.DateHelper.areDatesEqual(t,this.selectedStartDate);this._selectedStartDate=t,e&&this.notifyObservers(i.ChangeType.Partial,this._selectedStartDate)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedEndDate",{get:function(){return this._selectedEndDate},set:function(t){t=i.DateHelper.createCopy(t);var e=!i.DateHelper.areDatesEqual(t,this.selectedEndDate);null!=t&&!this.dateValidator.isRangeValid(this.selectedStartDate,t)||(this._selectedEndDate=t,e&&this.notifyObservers(i.ChangeType.Complete,this._selectedStartDate,this._selectedEndDate))},enumerable:!0,configurable:!0}),e.prototype.setSelectedRange=function(t,e){t=i.DateHelper.createCopy(t),e=i.DateHelper.createCopy(e),this._selectedStartDate=t,this._selectedEndDate=e,this.checkSelectedValue()},e.prototype.setSelectedStartDate=function(t){this.setSelectedRange(t,this._selectedEndDate)},e.prototype.setSelectedEndDate=function(t){this.setSelectedRange(this._selectedStartDate,t)},e.prototype.getSelectedStartDate=function(){return null==this._selectedStartDate?null:i.DateHelper.createCopy(this._selectedStartDate)},e.prototype.getSelectedEndDate=function(){return null==this._selectedEndDate?null:i.DateHelper.createCopy(this._selectedEndDate)},e.prototype.changeRangeToBeValidIfNessesary=function(t,e){return null==t&&null==e?[t,e]:null==t&&null!=e?[null,null]:(this.dateValidator.minDate>t&&(t=i.DateHelper.createCopy(this.dateValidator.minDate)),this.dateValidator.maxDate<e&&(e=i.DateHelper.createCopy(this.dateValidator.maxDate)),[t,e=!this.dateValidator.isRangeValid(t,e)?null:e])},e.prototype.getFirstPossibleDateToShow=function(t){return null==t&&(t=this.selectedStartDate),n.prototype.getFirstPossibleDateToShow.call(this,t)},e.prototype.isAnyItemInCurrentRangeDisabledOrPartiallyDisabled=function(){for(var t=this.$element.find("."+s.BusinessPackCss.stateSelected),e=t.length,i=0;i<e;i++){var n=t[i];if($(n).hasClass(s.BusinessPackCss.stateDisabled)||$(n).hasClass(s.BusinessPackCss.stateSemiDisabled))return!0}return!1},e.prototype.createCalendar=function(){n.prototype.createCalendar.call(this)},e.prototype.checkSelectedValue=function(){var t=this.changeRangeToBeValidIfNessesary(this.selectedStartDate,this.selectedEndDate);i.DateHelper.areDatesEqual(this.selectedStartDate,t[0])&&i.DateHelper.areDatesEqual(this.selectedEndDate,t[1])?(this._selectedStartDate=t[0],this._selectedEndDate=t[1]):(s.Utils.warnInDebugMode("Changed selected range to be valid."),this._selectedStartDate=t[0],this._selectedEndDate=t[1],this.notifyObservers(i.ChangeType.Complete,this._selectedStartDate,this._selectedEndDate))},e.prototype.setDisplayedDateToStartDate=function(){var t=this.selectedStartDate;null==t&&(t=this.getFirstPossibleDateToShow(t)),this.setCurrentlyDisplayedDate(t)},e.prototype.setDisplayedDateToEndDate=function(){var t=this.selectedEndDate;null==(t=null==t?this.selectedStartDate:t)&&(t=this.getFirstPossibleDateToShow(t)),this.setCurrentlyDisplayedDate(t)},e.prototype.selectMinute=function(t){this.isAnyItemInCurrentRangeDisabledOrPartiallyDisabled()||this.selectStartOrEndDate(t)},e.prototype.selectHour=function(t){for(var e=0,i=0;i<60;)this.dateValidator.isMinuteInValidRange(new Date(this.currentlyDisplayedYear,this.currentlyDisplayedMonth,this.currentlyDisplayedDay,this.currentlyDisplayedHour,i,0))&&e++,i+=5;this.dateValidator.isMinuteInValidRange(new Date(this.currentlyDisplayedYear,this.currentlyDisplayedMonth,this.currentlyDisplayedDay,this.currentlyDisplayedHour,0,0))&&1===e?this.selectMinute(new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),0,0,0)):this.isAnyItemInCurrentRangeDisabledOrPartiallyDisabled()||this.initMinuteSelector()},e.prototype.selectMonth=function(t){this.calendarType===i.CalendarMode.Month?this.selectStartOrEndDate(t):this.isAnyItemInCurrentRangeDisabledOrPartiallyDisabled()||this.initDateSelector()},e.prototype.selectYear=function(t){this.calendarType===i.CalendarMode.Year?this.selectStartOrEndDate(t):this.isAnyItemInCurrentRangeDisabledOrPartiallyDisabled()||this.initMonthSelector()},e.prototype.selectDay=function(t){this.calendarType!==i.CalendarMode.DateTime||this.isAnyItemInCurrentRangeDisabledOrPartiallyDisabled()?this.selectStartOrEndDate(t):this.initHourSelector()},e.prototype.selectStartOrEndDate=function(t){null==this.selectedStartDate||null==this.selectedEndDate&&this.selectedStartDate>t?this.selectedStartDate=t:null==this.selectedEndDate&&this.selectedStartDate<=t?this.selectedEndDate=t:(this.setSelectedEndDate(null),this.selectedStartDate=t),this.setCurrentViewType(null),this.update()},e.prototype.createYearCell=function(t){var e=n.prototype.createYearCell.call(this,t);return this.addCssClasses(e,t),e},e.prototype.createMonthCell=function(t){var e=n.prototype.createMonthCell.call(this,t);return this.addCssClasses(e,t),e},e.prototype.createDateCell=function(t){var e=n.prototype.createDateCell.call(this,t);return this.addCssClasses(e,t),e},e.prototype.createHourCell=function(t){var e=n.prototype.createHourCell.call(this,t);return this.addCssClasses(e,t),e},e.prototype.createMinuteCell=function(t){var e=n.prototype.createMinuteCell.call(this,t);return this.addCssClasses(e,t),e},e.prototype.addCssClasses=function(t,e){i.DateHelper.isDateInDateRangeOfCell(this.selectedStartDate,e,this.currentViewType)&&t.addClass(""+s.BusinessPackCss.calendarSelectionStart),i.DateHelper.isDateInDateRangeOfCell(this.selectedEndDate,e,this.currentViewType)?t.addClass(""+s.BusinessPackCss.calendarSelectionEnd):this.selectedEndDate&&this.selectedStartDate<e&&this.selectedEndDate>e&&t.addClass(""+s.BusinessPackCss.stateSelected),this.selectedStartDate&&!this.selectedEndDate&&e>this.selectedStartDate&&t.attr("data-possible-end-date",this.dateValidator.isRangeValid(this.selectedStartDate,e))},e.prototype.calendarRendered=function(){var e=this;n.prototype.calendarRendered.call(this);var i=this.$element.find("td[data-possible-end-date]");i.mouseover(function(t){return e.changeClasesOnHover(t.target)}),i.mouseleave(function(){i.removeClass(""+s.BusinessPackCss.stateSelected),i.removeClass(""+s.BusinessPackCss.calendarSelectionEnd)}),null!=this.selectedStartDate&&null==this.selectedEndDate&&setTimeout(function(){var t=i.find(":hover");null!=t[0]&&e.changeClasesOnHover(t[0])},25)},e.prototype.changeClasesOnHover=function(t){"a"!==t.tagName.toLowerCase()&&"span"!==t.tagName.toLowerCase()||(t=$(t).closest("td")[0]);for(var e=this.$element.find("td[data-possible-end-date]"),i=0;i<e.length&&e[i]!==t;)$(e[i]).addClass(""+s.BusinessPackCss.stateSelected),i++;$(t).addClass(""+s.BusinessPackCss.calendarSelectionEnd)},e);function e(){return null!==n&&n.apply(this,arguments)||this}i.RangeSelection=t}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(i){"use strict";var e,t=(e=i.ControlBase,__extends(n,e),Object.defineProperty(n.prototype,"displayMode",{get:function(){if(null==this.binding.displayMode)return i.DisplayMode.Standard;var t=ko.unwrap(this.binding.displayMode);return i.DisplayMode[t]},enumerable:!0,configurable:!0}),n.prototype.getElement=function(){return this.element[0]},n.prototype.initialize=function(){var t=this;e.prototype.initialize.call(this),this.element=this.$element[0],this.setMinAndMaxDate(),this.subscribe(this.binding.restrictions,function(){t.calendar&&t.calendar.checkSelectedValue()}),this.initializeCalendar(),this.onEnabledChange()},n.prototype.onEnabledChange=function(){e.prototype.onEnabledChange.call(this),void 0!==this.binding.enabled&&this.calendar&&(this.calendar.enabled=ko.unwrap(this.binding.enabled),this.calendar.update())},n.prototype.getViewType=function(){var t=this.$element.attr("data-dotvvm-businesspack-dateTimeControl-viewtype"),e=i.CalendarMode.Date;return"Time"===t?e=i.CalendarMode.Time:"DateTime"===t?e=i.CalendarMode.DateTime:"Month"===t?e=i.CalendarMode.Month:"Year"===t&&(e=i.CalendarMode.Year),e},n.prototype.setMinAndMaxDate=function(){var t=this;this.subscribe(this.binding.minDate,function(){t.calendar&&t.calendar.checkSelectedValue()}),this.subscribe(this.binding.maxDate,function(){t.calendar&&t.calendar.checkSelectedValue()})},n.prototype.fireChangedEvent=function(){this.binding.selectionCompleted&&this.binding.selectionCompleted()},n);function n(){return null!==e&&e.apply(this,arguments)||this}i.CalendarControlBase=t}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(e){"use strict";var i,t=(i=e.CalendarControlBase,__extends(n,i),Object.defineProperty(n.prototype,"selectedDate",{get:function(){return e.DateHelper.parseDate(ko.unwrap(this.binding.selectedDate))},set:function(t){var e=!0;null==t||null==this.selectedDate?e=t!=this.selectedDate:null!=t&&null!=this.selectedDate&&(e=t.getTime()!=this.selectedDate.getTime()),e&&(e=this.binding.selectedDate,ko.isWriteableObservable(e)&&e(t?dotvvm.serialization.serializeDate(t,!1):null),this.fireChangedEvent())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"selectedYear",{get:function(){return this.selectedDate.getFullYear()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"selectedMonth",{get:function(){return this.selectedDate.getMonth()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"selectedDay",{get:function(){return this.selectedDate.getDate()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"selectedHour",{get:function(){return this.selectedDate.getHours()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"selectedMinute",{get:function(){return this.selectedDate.getMinutes()},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){var t=this;i.prototype.initialize.call(this),this.subscribe(this.binding.selectedDate,function(){return t.updateSelectedDateInCalendar()})},n.prototype.initializeCalendar=function(){var t=new e.DateValidator(this.binding.minDate,this.binding.maxDate,this.binding.restrictions);switch(this.displayMode){case e.DisplayMode.Standard:this.calendar=new e.CalendarN(t,this.getViewType());break;case e.DisplayMode.Extended:this.calendar=new e.CalendarExtended(t);break;default:console.error("Unsuported calendar mode!")}this.calendar.subscribe(this),this.calendar.setSelectedDate(this.selectedDate),this.calendar.render(this.$element[0])},n.prototype.notify=function(){this.selectedDate=this.calendar.getSelectedDate(),this.calendar.setCurrentViewType(null)},n.prototype.updateSelectedDateInCalendar=function(){e.DateHelper.areDatesEqual(this.selectedDate,this.calendar.getSelectedDate())||(this.calendar.setSelectedDate(this.selectedDate),this.calendar.setCurrentlyDisplayedDate(this.selectedDate),this.calendar.update())},n);function n(){return null!==i&&i.apply(this,arguments)||this}e.CalendarControl=t}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(s){"use strict";var e,t=(e=s.CalendarControlBase,__extends(i,e),Object.defineProperty(i.prototype,"selectedStartDate",{get:function(){return s.DateHelper.parseDate(ko.unwrap(this.binding.selectedStartDate))},set:function(t){var e=this.binding.selectedStartDate;ko.isWriteableObservable(e)&&e(t?dotvvm.serialization.serializeDate(t,!1):null)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedEndDate",{get:function(){return s.DateHelper.parseDate(ko.unwrap(this.binding.selectedEndDate))},set:function(t){var e=this.binding.selectedEndDate;ko.isWriteableObservable(e)&&e(t?dotvvm.serialization.serializeDate(t,!1):null)},enumerable:!0,configurable:!0}),i.prototype.notify=function(t){this.selectedStartDate=this.calendar.getSelectedStartDate(),this.selectedEndDate=this.calendar.getSelectedEndDate(),t!==s.ChangeType.Partial&&(null!=this.selectedStartDate&&null==this.selectedEndDate||this.fireChangedEvent(),this.calendar.setCurrentViewType(null))},i.prototype.initializeCalendar=function(){var t=this,e=new s.DateRangeValidator(this.binding.minDate,this.binding.maxDate,this.binding.restrictions);switch(this.displayMode){case s.DisplayMode.Standard:this.calendar=new s.RangeSelection(e,this.getViewType());break;case s.DisplayMode.Extended:this.calendar=new s.RangeCalendarExtended(e);break;default:console.error("Unsuported calendar mode!")}this.calendar.subscribe(this),this.calendar.setSelectedRange(this.selectedStartDate,this.selectedEndDate),dotvvm.events.init.subscribe(function(){t.calendar.render(t.$element[0])})},i.prototype.updateSelectedDatesInCalendar=function(){function t(){return!s.DateHelper.areDatesEqual(i.selectedStartDate,i.calendar.getSelectedStartDate())}function e(){return!s.DateHelper.areDatesEqual(i.selectedEndDate,i.calendar.getSelectedEndDate())}var i=this,n=!t()&&!e();this.updateAllreadySchedulled||n||(this.updateAllreadySchedulled=!0,setTimeout(function(){t()&&e()?i.calendar.setSelectedRange(i.selectedStartDate,i.selectedEndDate):t()?i.calendar.setSelectedStartDate(i.selectedStartDate):e()&&i.calendar.setSelectedEndDate(i.selectedEndDate),i.calendar.update(),i.updateAllreadySchedulled=!1},100))},i.prototype.initialize=function(){var t=this;e.prototype.initialize.call(this),this.subscribe(this.binding.selectedStartDate,function(){t.updateSelectedDatesInCalendar()}),this.subscribe(this.binding.selectedEndDate,function(){t.updateSelectedDatesInCalendar()})},i);function i(){return null!==e&&e.apply(this,arguments)||this}s.RangeCalendarControl=t}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var o;!function(i){"use strict";var n,t=(n=i.CalendarControlBase,__extends(s,n),s.prototype.destroy=function(){window.removeEventListener("scroll",this.scrollHandler,!0),this.popupElement&&(this.popupElement.remove(),this.popupElement=null,this.calendar.setCurrentViewType(null))},s.destroyActivePopup=function(){s.activePopup&&(s.activePopup.destroy(),s.activePopup=null),s.unregisterGlobalEvent()},s.destroyActivePopupOnEsc=function(t){27===t.keyCode&&(s.destroyActivePopup(),t.stopPropagation())},s.registerGlobalEvent=function(){var t=this;$(document).on("keyup",s.destroyActivePopupOnEsc),this.poopupUpdateHandle=setInterval(function(){return t.updatePopupPosition()},10)},s.unregisterGlobalEvent=function(){$(document).off("keyup",s.destroyActivePopupOnEsc),clearInterval(this.poopupUpdateHandle),this.poopupUpdateHandle=null},s.prototype.hideCalendarOnTab=function(t){9===t.keyCode&&this.destroy()},s.prototype.initialize=function(){var e=this;this.$element.on("keyup",function(){clearTimeout(e.typingTimer),e.typingTimer=setTimeout(function(){return e.updateDateFromTextbox()},e.doneTypingInterval)}),this.$element.on("keydown",function(){clearTimeout(e.typingTimer)}),this.$element.on("keydown",function(t){return e.hideCalendarOnTab(t)}),this.$element.find("a").on("click",function(){return null==e.popupElement?e.showPopup():e.destroy()}),this.$element.focusin(function(){return e.$element.addClass(o.BusinessPackCss.stateFocused)}),this.$element.focusout(function(){return e.$element.removeClass(o.BusinessPackCss.stateFocused)}),this.scrollHandler=function(t){return e.onScroll(t)},n.prototype.initialize.call(this)},s.prototype.updateDateinTextBox=function(t,e,i){void 0===i&&(i=!1);e=dotvvm.globalize.formatString(this.binding.formatString,e);dotvvm.globalize.formatString(this.binding.formatString,this.getCurrentDateFromInput(t))===e&&!i||t.val(e)},s.prototype.getCurrentDateFromInput=function(t){return""===t.val()?null:dotvvm.globalize.parseDate(t.val(),this.binding.formatString)},s.prototype.onScroll=function(t){t=$(t.target);this.$element.is(t)||this.$element.find(t).length||this.destroy()},s.prototype.showPopup=function(t){var e=this;if(void 0===this.binding.enabled||ko.unwrap(this.binding.enabled)){if(s.activePopup!==this)s.destroyActivePopup(),s.activePopup=this;else{if(null!=this.popupElement)return this.calendar.setCurrentlyDisplayedDate(t),this.calendar.setCurrentViewType(i.DateRangeType.Date),void this.calendar.update();this.destroy()}window.addEventListener("scroll",this.scrollHandler,!0),this.popupElement=$("<div></div>").addClass(""+o.BusinessPackCss.primitivePopup),this.popupElement.attr("tabindex",-1),this.outside("click",function(t){null!=e.popupElement&&s.destroyActivePopup()}),s.registerGlobalEvent(),this.calendar.setCurrentlyDisplayedDate(t),this.calendar.render(this.popupElement[0]),this.$element.append(this.popupElement),this.popupElement.keydown(function(t){return e.hideCalendarOnTab(t)}),s.updatePopupPosition()}},s.updatePopupPosition=function(){var t,e,i;s.activePopup&&s.activePopup.popupElement&&(t=s.activePopup.$element.find("."+o.BusinessPackCss.primitiveInputGroup),(e=s.activePopup.$element.offset()).top+300>$(document).height()&&300<e.top?(s.activePopup.popupElement.css({left:e.left,top:null,bottom:$(window).height()-(e.top-$(document).scrollTop())}),(i=e.top-$(document).scrollTop())<0&&$(document).scrollTop($(document).scrollTop()-i)):s.activePopup.popupElement.css({left:e.left,top:e.top-$(document).scrollTop()+t.outerHeight(),bottom:null}))},s);function s(){var t=null!==n&&n.apply(this,arguments)||this;return t.doneTypingInterval=2e3,t}i.CalendarPopup=t}((o=t.BusinessPack||(t.BusinessPack={})).Controls||(o.Controls={}))}(DotVVM=DotVVM||{}),function(t){var a;!function(r){"use strict";var e,t=(e=r.CalendarPopup,__extends(i,e),Object.defineProperty(i.prototype,"selectedStartDate",{get:function(){return r.DateHelper.parseDate(ko.unwrap(this.binding.selectedStartDate))},set:function(t){var e=this.binding.selectedStartDate;ko.isWriteableObservable(e)&&(this.updateDateinTextBox(this.inputStart,t),e(t?dotvvm.serialization.serializeDate(t,!1):null))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedEndDate",{get:function(){return r.DateHelper.parseDate(ko.unwrap(this.binding.selectedEndDate))},set:function(t){var e=this.binding.selectedEndDate;ko.isWriteableObservable(e)&&(this.updateDateinTextBox(this.inputEnd,t),e(t?dotvvm.serialization.serializeDate(t,!1):null))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"inputs",{get:function(){return this.$element.find("input")},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"inputStart",{get:function(){return $(this.inputs[0])},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"inputEnd",{get:function(){return $(this.inputs[1])},enumerable:!0,configurable:!0}),i.prototype.notify=function(t){this.selectedStartDate=this.calendar.getSelectedStartDate(),this.selectedEndDate=this.calendar.getSelectedEndDate(),null!=this.selectedStartDate&&null==this.selectedEndDate||t===r.ChangeType.Partial||this.fireChangedEvent(),t!==r.ChangeType.Partial&&(!ko.unwrap(this.binding.closePopupOnSelectionComplete)||this.calendar instanceof r.CalendarExtendedModeBase||this.destroy(),this.calendar.setCurrentViewType(null))},i.prototype.initializeCalendar=function(){switch(this.validator=new r.DateRangeValidator(this.binding.minDate,this.binding.maxDate,this.binding.restrictions),this.displayMode){case r.DisplayMode.Standard:this.calendar=new r.RangeSelection(this.validator,this.getViewType());break;case r.DisplayMode.Extended:this.calendar=new r.RangeCalendarExtended(this.validator);break;default:console.error("Unsuported calendar mode!")}this.calendar.subscribe(this),this.calendar.setSelectedRange(this.selectedStartDate,this.selectedEndDate)},i.prototype.updateSelectedDatesInCalendar=function(){function t(){return!r.DateHelper.areDatesEqual(i.selectedStartDate,i.calendar.getSelectedStartDate())}function e(){return!r.DateHelper.areDatesEqual(i.selectedEndDate,i.calendar.getSelectedEndDate())}var i=this,n=!t()&&!e();this.updateAllreadySchedulled||n||(this.updateAllreadySchedulled=!0,setTimeout(function(){t()&&e()?i.calendar.setSelectedRange(i.selectedStartDate,i.selectedEndDate):t()?i.calendar.setSelectedStartDate(i.selectedStartDate):e()&&i.calendar.setSelectedEndDate(i.selectedEndDate),i.updateAllreadySchedulled=!1},50))},i.prototype.initialize=function(){var t=this;e.prototype.initialize.call(this),this.subscribe(this.binding.selectedStartDate,function(){t.updateSelectedDatesInCalendar(),t.updateDateinTextBox(t.inputStart,t.selectedStartDate)}),this.subscribe(this.binding.selectedEndDate,function(){t.updateSelectedDatesInCalendar(),t.updateDateinTextBox(t.inputEnd,t.selectedEndDate)}),this.inputStart.focus(function(){t.showPopup(t.selectedStartDate),t.lastActiveInput=0}),this.inputEnd.focus(function(){t.showPopup(t.selectedEndDate),t.lastActiveInput=1}),this.inputStart.change(function(){t.$element.removeClass(a.BusinessPackCss.stateError),t.updateDateFromTextbox(!0),t.updateDateinTextBox(t.inputStart,t.selectedStartDate,!0)}),this.inputEnd.change(function(){t.$element.removeClass(a.BusinessPackCss.stateError),t.updateDateFromTextbox(!0),t.updateDateinTextBox(t.inputEnd,t.selectedEndDate,!0)}),this.updateDateinTextBox(this.inputStart,this.selectedStartDate),this.updateDateinTextBox(this.inputEnd,this.selectedEndDate),this.element.dotvvmDatePickerCalendarPopup=this},i.prototype.updateDateFromTextbox=function(t){void 0===t&&(t=!1);var e,i,n,s=this.getCurrentDateFromInput(this.inputStart),o=this.getCurrentDateFromInput(this.inputEnd);this.calendar.getCalendarType()===r.CalendarMode.Time&&(s=new Date(this.selectedStartDate.getFullYear(),this.selectedStartDate.getMonth(),this.selectedStartDate.getDate(),s.getHours(),s.getMinutes()),o=new Date(this.selectedEndDate.getFullYear(),this.selectedEndDate.getMonth(),this.selectedEndDate.getDate(),o.getHours(),o.getMinutes())),r.DateHelper.areDatesEqual(s,this.calendar.getSelectedStartDate())&&r.DateHelper.areDatesEqual(o,this.calendar.getSelectedEndDate())||(n=i=e=!1,null==s&&""!==this.inputStart.val()&&(e=!0,a.Utils.warnInDebugMode("Invalid start date entered!")),null==o&&""!==this.inputEnd.val()&&(i=!0,a.Utils.warnInDebugMode("Invalid end date entered!")),null==s||null==o||this.validator.isRangeValid(s,o)?this.$element.removeClass(a.BusinessPackCss.stateError):(this.$element.addClass(a.BusinessPackCss.stateError),n=!0,a.Utils.warnInDebugMode("Invalid range entered!")),e||i||n?t&&(this.calendar.setSelectedRange(s,o),this.selectedStartDate=this.calendar.getSelectedStartDate(),this.selectedEndDate=this.calendar.getSelectedEndDate(),this.$element.removeClass(a.BusinessPackCss.stateError)):(this.calendar.getCalendarType()===r.CalendarMode.Time&&(s.setDate(this.selectedStartDate.getDate()),s.setMonth(this.selectedStartDate.getMonth()),s.setFullYear(this.selectedStartDate.getFullYear()),o.setDate(this.selectedEndDate.getDate()),o.setMonth(this.selectedEndDate.getMonth()),o.setFullYear(this.selectedEndDate.getFullYear())),this.selectedStartDate=s,this.selectedEndDate=o,this.calendar.setSelectedRange(s,o),0===this.lastActiveInput?this.calendar.setDisplayedDateToStartDate():this.calendar.setDisplayedDateToEndDate(),this.calendar.update(),this.fireChangedEvent()))},i.prototype.destroy=function(){this.validator.isRangeValid(this.selectedStartDate,this.selectedEndDate)?this.$element.removeClass(a.BusinessPackCss.stateError):this.$element.addClass(a.BusinessPackCss.stateError),e.prototype.destroy.call(this)},i.prototype.showPopup=function(t){null!=this.binding.enabled&&!ko.unwrap(this.binding.enabled)||(e.prototype.showPopup.call(this,t),this.popupElement.addClass(""+a.BusinessPackCss.dateTimeRangePicker))},i);function i(){return null!==e&&e.apply(this,arguments)||this}r.DateTimeRangePickerControl=t,a.Utils.installBindingHandler("DateTimeRangePicker",t)}((a=t.BusinessPack||(t.BusinessPack={})).Controls||(a.Controls={}))}(DotVVM=DotVVM||{}),function(t){(t=(t=(t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={})).CalendarMode||(t.CalendarMode={}))[t.Year=0]="Year",t[t.Month=1]="Month",t[t.Date=2]="Date",t[t.DateTime=3]="DateTime",t[t.Time=4]="Time"}(DotVVM=DotVVM||{}),function(t){(t=(t=(t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={})).ChangeType||(t.ChangeType={}))[t.Complete=0]="Complete",t[t.Partial=1]="Partial"}(DotVVM=DotVVM||{}),function(t){(t=(t=(t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={})).DateRangeType||(t.DateRangeType={}))[t.Year=0]="Year",t[t.Month=1]="Month",t[t.Date=2]="Date",t[t.Hour=3]="Hour",t[t.Minute=4]="Minute"}(DotVVM=DotVVM||{}),function(t){(t=(t=(t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={})).DisplayMode||(t.DisplayMode={}))[t.Standard=0]="Standard",t[t.Extended=1]="Extended"}(DotVVM=DotVVM||{}),function(t){var e;function i(t,e,i){this.minDateSource=t,this.maxDateSource=e,this.restrictions=i}t=t.BusinessPack||(t.BusinessPack={}),e=t.Controls||(t.Controls={}),Object.defineProperty(i.prototype,"minDate",{get:function(){return this.minDateSource&&null!=ko.unwrap(this.minDateSource)?e.DateHelper.parseDate(ko.unwrap(this.minDateSource)):new Date(-8e15)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxDate",{get:function(){return this.maxDateSource&&null!=ko.unwrap(this.maxDateSource)?e.DateHelper.parseDate(ko.unwrap(this.maxDateSource)):new Date(8e15)},enumerable:!0,configurable:!0}),i.prototype.isDayOfWeekRestriction=function(t){return"DayOfWeekRestriction"===t.Type()},i.prototype.isDateRangeRestriction=function(t){return"DateRangeRestriction"===t.Type()},t=i,e.DateValidatorBase=t}(DotVVM=DotVVM||{}),function(t){var u,e;function i(){return null!==e&&e.apply(this,arguments)||this}t=t.BusinessPack||(t.BusinessPack={}),u=t.Controls||(t.Controls={}),e=u.DateValidatorBase,__extends(i,e),i.prototype.findFirstDateThatPassesRestrictions=function(t,e,i){function n(t,e){return Math.abs(i.getTime()-t.getTime())-Math.abs(i.getTime()-e.getTime())}var s,o,r,a;if(null==t)return{date:null,dateType:null};var l=this.doesDatePassAllRestrictions(t,e);if(null==l.undecidedRestrictions||0===l.undecidedRestrictions.length)return l.doesDatePassRestrictions?{date:t,dateType:e}:{date:null,dateType:e};var u=this.splitDateInParts(t,e),c=new Array;try{for(var h=__values(u.Dates.sort(n)),d=h.next();!d.done;d=h.next()){var p=d.value,g=this.doesDatePassAllRestrictions(p,u.dateType);if(g.doesDatePassRestrictions&&(null==g.undecidedRestrictions||0===g.undecidedRestrictions.length))return{date:p,dateType:u.dateType};null!=g.undecidedRestrictions&&0!==g.undecidedRestrictions.length&&c.push(p)}}catch(t){s={error:t}}finally{try{d&&!d.done&&(o=h.return)&&o.call(h)}finally{if(s)throw s.error}}try{for(var f=__values(c.sort().sort(n)),m=f.next();!m.done;m=f.next()){var y=m.value,y=this.findFirstDateThatPassesRestrictions(y,u.dateType,i);if(null!=y)return y}}catch(t){r={error:t}}finally{try{m&&!m.done&&(a=f.return)&&a.call(f)}finally{if(r)throw r.error}}return{date:null,dateType:null}},i.prototype.isThereAnyValidPartInDate=function(t,e){return null!=this.findFirstDateThatPassesRestrictions(t,e,t).date},i.prototype.doesDatePassAllRestrictions=function(t,e){var i,n;if(null==ko.unwrap(this.restrictions)||0===this.restrictions().length)return{doesDatePassRestrictions:!0,undecidedRestrictions:null};var s=new Array;try{for(var o=__values(this.restrictions()),r=o.next();!r.done;r=o.next()){var a=r.value,l=this.doesDatePassRestriction(t,a(),e);if(!1===l)return{doesDatePassRestrictions:!1,undecidedRestrictions:null};void 0===l&&s.push(a)}}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return null!=e&&e!==u.DateRangeType.Minute||0===s.length?0===s.length?{doesDatePassRestrictions:!0,undecidedRestrictions:null}:{doesDatePassRestrictions:!1,undecidedRestrictions:s}:{doesDatePassRestrictions:!1,undecidedRestrictions:null}},i.prototype.doesDatePassRestriction=function(t,e,i){return!0},i.prototype.isNumericRange1SubsetOfNumericRange=function(t,e,i,n){return i<=t&&e<=n},i.prototype.doesNumericRangesOverloap=function(t,e,i,n){return t<=n&&i<=e},i.prototype.splitDateInParts=function(t,e){var i,n=[];switch(e){case u.DateRangeType.Year:for(var s=u.DateRangeType.Month,o=0;o<12;o++)n.push(new Date(t.getFullYear(),o++,1));break;case u.DateRangeType.Month:s=u.DateRangeType.Date;for(o=1;;){if((i=new Date(t.getFullYear(),t.getMonth(),o++)).getMonth()!==t.getMonth())break;n.push(i)}break;case u.DateRangeType.Date:s=u.DateRangeType.Hour;for(o=0;o<24;o++)n.push(new Date(t.getFullYear(),t.getMonth(),t.getDate(),o,0,0,0));break;case u.DateRangeType.Hour:s=u.DateRangeType.Minute;for(o=0;o<60;o+=5)n.push(new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),o,0,0))}return{Dates:n,dateType:s}},i.prototype.isYearInValidRange=function(t){var e=new Date(this.minDate.getFullYear(),0,1,0,0,0),i=new Date(this.maxDate.getFullYear()+1,0,1,0,0,0);return e<=t&&t<i&&this.isThereAnyValidPartInDate(t,u.DateRangeType.Year)},i.prototype.isMonthInValidRange=function(t){var e=new Date(this.minDate.getFullYear(),this.minDate.getMonth(),1,0,0,0),i=new Date(this.maxDate.getFullYear(),this.maxDate.getMonth()+1,1,0,0,0);return e<=t&&t<i&&this.isThereAnyValidPartInDate(t,u.DateRangeType.Month)},i.prototype.isDayInValidRange=function(t){var e=new Date(this.minDate.getFullYear(),this.minDate.getMonth(),this.minDate.getDate(),0,0,0),i=new Date(this.maxDate.getFullYear(),this.maxDate.getMonth(),this.maxDate.getDate()+1,0,0,0);return e<=t&&t<i&&this.isThereAnyValidPartInDate(t,u.DateRangeType.Date)},i.prototype.isHourInValidRange=function(t){var e=new Date(this.minDate.getFullYear(),this.minDate.getMonth(),this.minDate.getDate(),this.minDate.getHours(),0,0),i=new Date(this.maxDate.getFullYear(),this.maxDate.getMonth(),this.maxDate.getDate(),this.maxDate.getHours()+1,0,0);return e<=t&&t<i&&this.isThereAnyValidPartInDate(t,u.DateRangeType.Hour)},i.prototype.isMinuteInValidRange=function(t){var e=new Date(this.minDate.getFullYear(),this.minDate.getMonth(),this.minDate.getDate(),this.minDate.getHours(),this.minDate.getMinutes(),0),i=new Date(this.maxDate.getFullYear(),this.maxDate.getMonth(),this.maxDate.getDate(),this.maxDate.getHours(),this.maxDate.getMinutes()+1,0);return e<=t&&t<i&&this.isThereAnyValidPartInDate(t,u.DateRangeType.Minute)},i.prototype.isDateInValidRange=function(t){var e=new Date(this.minDate),i=new Date(this.maxDate);return e.setMilliseconds(0),i.setMilliseconds(999),e<=t&&t<i&&this.isThereAnyValidPartInDate(t,null)},t=i,u.DateValidator=t}(DotVVM=DotVVM||{}),function(t){var n,e,i;function s(){return null!==i&&i.apply(this,arguments)||this}n=t.BusinessPack||(t.BusinessPack={}),e=n.Controls||(n.Controls={}),i=e.DateValidator,__extends(s,i),s.prototype.isRangeValid=function(t,e){var i,n;if(null==t||null==e)return!1;if(t.getTime()>e.getTime())return!1;if(null!=ko.unwrap(this.restrictions)&&0!==this.restrictions().length)try{for(var s=__values(this.restrictions()),o=s.next();!o.done;o=s.next()){var r=o.value;if(!this.doesRangePassRestriction(t,e,r()))return!1}}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return!0},s.prototype.doesRangePassRestriction=function(t,e,i){return this.isDayOfWeekRestriction(i)?this.doesRangePassDayRestriction(t,e,i):this.isDateRangeRestriction(i)?this.doesRangePassRangeRestriction(t,e,i):(n.Utils.warnInDebugMode("Restriction type "+typeof i+" is not supported."),!1)},s.prototype.doesRangePassRangeRestriction=function(t,e,i){return!0},s.prototype.doesRangePassDayRestriction=function(t,e,i){return!0},t=s,e.DateRangeValidator=t}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.DateOrTimePickerBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this)},n.prototype.floorDate=function(t){return t.getTime()},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.DateTimePickerBase=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var u;!function(l){"use strict";var i,t=(i=l.DateTimePickerBase,__extends(e,i),e.prototype.initialize=function(){var e=this;i.prototype.initialize.call(this),this.$textBox=this.$element.children("."+u.BusinessPackCss.primitiveTextBox),this.hasPopup?(this.$datePicker=this.$popup.find("."+u.BusinessPackCss.datePicker),this.$timePicker=this.$popup.find("."+u.BusinessPackCss.timePicker)):(this.$datePicker=this.$element.children("."+u.BusinessPackCss.datePicker),this.$timePicker=this.$element.children("."+u.BusinessPackCss.timePicker)),this.$textBox.keydown(function(t){return e.onTextBoxKeydown(t)}),this.$textBox.change(function(t){return e.onTextBoxChange(t)}),this.$textBox.focus(function(t){return e.$datePicker.addClass(u.BusinessPackCss.stateFocused)}),this.$datePicker.mouseover(function(t){return e.focusDatePicker()}),this.$timePicker.mouseover(function(t){return e.focusTimePicker()}),this.$timePicker.focus(function(t){return e.$datePicker.removeClass(u.BusinessPackCss.stateFocused)}),this.watch(this.binding.selectedDateTime,this.onSelectedDateTimeChange),this.subscribe(this.binding.restrictions,this.filterRestrictions),u.DeviceUtils.addMobileOrTabletProp(this.$textBox,"readonly",!0)},Object.defineProperty(e.prototype,"selectedDateTime",{get:function(){var t=ko.unwrap(this.binding.selectedDateTime);return u.DateUtils.unwrapDate(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"date",{get:function(){var t=ko.unwrap(this.selectedDate);return u.DateUtils.unwrapDate(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"time",{get:function(){var t=ko.unwrap(this.selectedTime);return u.DateUtils.unwrapDate(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minDateTime",{get:function(){var t=ko.unwrap(this.binding.minDateTime);return u.DateUtils.unwrapDate(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDateTime",{get:function(){var t=ko.unwrap(this.binding.maxDateTime);return u.DateUtils.unwrapDate(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"canUnselectDateOrTime",{get:function(){return ko.unwrap(this.binding.allowUnselect)&&(!!this.selectedDateTime||!!this.$textBox.val())},enumerable:!0,configurable:!0}),e.prototype.unselectDateOrTime=function(){this.selectedDate(null),this.selectedTime(null),this.selectDateTime(null),this.$textBox.val(""),this.$textBox.focus()},e.prototype.onElementKeydown=function(t){i.prototype.onElementKeydown.call(this,t),this.isOpened&&(u.KeyboardKeys.isEnter(t.which)?this.$timePicker.hasClass(u.BusinessPackCss.stateFocused)?(this.togglePopup(!1),this.$textBox.focus()):this.focusTimePicker():t.which===u.KeyboardKeys.tab?t.shiftKey&&this.$datePicker.hasClass(u.BusinessPackCss.stateFocused)&&(t.stopPropagation(),this.$datePicker.removeClass(u.BusinessPackCss.stateFocused),this.$textBox.focus(),this.$textBox.trigger(t)):t.shiftKey||t.ctrlKey||u.KeyboardKeys.isArrow(t.which)||(this.$textBox.focus(),this.$textBox.trigger(t)))},e.prototype.onTextBoxKeydown=function(t){this.isOpened&&(u.KeyboardKeys.isEnter(t.which)?(this.focusDatePicker(),this.$datePicker.trigger(t),t.stopPropagation(),this.focusTimePicker()):t.which===u.KeyboardKeys.tab?t.shiftKey?t.stopPropagation():(t.preventDefault(),this.focusDatePicker(),this.$datePicker.trigger(t),this.focusTimePicker()):u.KeyboardKeys.isArrow(t.which)?(t.preventDefault(),this.focusDatePicker(),this.$datePicker.trigger(t)):(t.stopPropagation(),u.KeyboardKeys.isEscape(t.which)&&this.togglePopup(!1)))},e.prototype.onToggleButtonClick=function(t){i.prototype.onToggleButtonClick.call(this,t),this.$textBox.focus()},e.prototype.focusDatePicker=function(){this.hasFocus&&!this.$datePicker.hasClass(u.BusinessPackCss.stateFocused)&&this.$datePicker.focus()},e.prototype.focusTimePicker=function(){this.hasFocus&&!this.$timePicker.hasClass(u.BusinessPackCss.stateFocused)&&this.$timePicker.focus()},e.prototype.onSelectedDateTimeChange=function(t){t=u.DateUtils.unwrapDate(t);this.selectedDate(t),this.selectedTime(t)},e.prototype.selectDateTime=function(t){this.binding.selectedDateTime(dotvvm.serialization.serializeDate(t,!1)),this.selectionChanged()},e.prototype.dateChanged=function(){this.onDateOrTimeChange(),this.filterTimeRestrictions()},e.prototype.timeChanged=function(){this.onDateOrTimeChange()},e.prototype.onDateOrTimeChange=function(){var t=this.date,e=this.time;t&&e?((t=t).setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),this.selectDateTime(t)):this.selectedDateTime||this.selectDateTime(null)},e.prototype.filterRestrictions=function(){this.filterDateRestrictions(),this.filterTimeRestrictions()},e.prototype.filterDateRestrictions=function(){var e,t;if(this.dateRestrictions.removeAll(),this.binding.restrictions)try{for(var i=__values(ko.unwrap(this.binding.restrictions)),n=i.next();!n.done;n=i.next()){var s=n.value,o=ko.unwrap(s);l.Calendar.isDateRangeRestriction(o)?this.dateRestrictions.push(ko.observable(this.trimRestrictionStartDate(o))):l.Calendar.isDayOfWeekRestriction(o)&&this.dateRestrictions.push(s)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},e.prototype.trimRestrictionStartDate=function(t){var e=u.DateUtils.unwrapDate(t.StartDate),i=u.DateUtils.getStartOfDay(e).getTime();if(e.getTime()>i){i=this.getNewDateRangeRestriction();return e.setDate(e.getDate()+1),i.StartDate=ko.observable(e),i.EndDate=t.EndDate,i}return t},e.prototype.filterTimeRestrictions=function(){var e,t;if(this.timeRestrictions.removeAll(),this.binding.restrictions){try{for(var i=__values(ko.unwrap(this.binding.restrictions)),n=i.next();!n.done;n=i.next()){var s,o=n.value,r=ko.unwrap(o);l.Calendar.isDateRangeRestriction(r)?(s=this.trimRestrictionTimeRange(r))&&this.timeRestrictions.push(ko.observable(s)):l.Calendar.isTimeRangeRestriction(r)&&this.timeRestrictions.push(o)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}var a=u.DateUtils.getStartOfDay(this.selectedDateTime).getTime();this.minDateTime&&a===u.DateUtils.getStartOfDay(this.minDateTime).getTime()?this.minTime(this.minDateTime):this.minTime(null),this.maxDateTime&&a===u.DateUtils.getStartOfDay(this.maxDateTime).getTime()?this.maxTime(this.maxDateTime):this.maxTime(null)}},e.prototype.trimRestrictionTimeRange=function(t){if(!this.selectedDateTime)return null;var e=u.DateUtils.getStartOfDay(u.DateUtils.unwrapDate(t.StartDate)).getTime(),i=u.DateUtils.getStartOfDay(u.DateUtils.unwrapDate(t.EndDate)).getTime(),n=u.DateUtils.getStartOfDay(this.selectedDateTime).getTime(),s=this.getNewTimeRangeRestriction();if(s.Type=ko.observable("TimeRangeRestriction"),e===n&&(s.StartTime=t.StartDate),i===n&&(s.EndTime=t.EndDate),s.StartTime&&s.EndTime)return s;if(!s.StartTime&&s.EndTime)s.StartTime=ko.observable(new Date(n));else{if(!s.StartTime||s.EndTime)return null;s.EndTime=ko.observable(u.DateUtils.getEndOfDay(new Date(n)))}return s},e.prototype.getNewDateRangeRestriction=function(){var t={};return t.Type=ko.observable("DateRangeRestriction"),t},e.prototype.getNewTimeRangeRestriction=function(){var t={};return t.Type=ko.observable("TimeRangeRestriction"),t},e);function e(){var t=null!==i&&i.apply(this,arguments)||this;return t.selectedDate=ko.observable(),t.selectedTime=ko.observable(),t.minTime=ko.observable(),t.maxTime=ko.observable(),t.dateRestrictions=ko.observableArray(),t.timeRestrictions=ko.observableArray(),t}l.DateTimePicker=t,u.Utils.installBindingHandler("DateTimePicker",t)}((u=t.BusinessPack||(t.BusinessPack={})).Controls||(u.Controls={}))}(DotVVM=DotVVM||{}),function(DotVVM){var BusinessPack;!function(BusinessPack){var Controls;!function(Controls){"use strict";var DraggableList=function(_super){function DraggableList(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(DraggableList,_super),DraggableList.prototype.initialize=function(){var e=this;_super.prototype.initialize.call(this),this.$element.on("dragover",function(t){return e.onDragOver(t)}),this.$element.on("drop",function(t){return e.onDrop(t)}),document.addEventListener("DOMNodeInserted",function(t){1===t.target.nodeType&&t.target.parentElement===e.$element[0]&&e.initChildEvents(t.target)})},DraggableList.prototype.initChildEvents=function(t){var e=this;$(t).attr("draggable","true").off("drag").on("drag",function(t){return e.onDrag(t)})},DraggableList.prototype.onDragOver=function(t){0<ko.unwrap(this.binding.maxItemsCount)&&this.$element.children().length>=ko.unwrap(this.binding.maxItemsCount)||DraggableList.draggedItemGroupName===ko.unwrap(this.binding.groupName)&&(t.preventDefault(),DraggableList.dragLeaving=!1,t=this.findChildByY(t.originalEvent.pageY),this.createDragPositionIndicator(t))},DraggableList.prototype.onDrop=function(e){DraggableList.dragConfirmed=!0,e.preventDefault();var data=this.findChildByY(e.originalEvent.pageY),draggedItem=ko.unwrap(DraggableList.draggedItemSourceCollection)[DraggableList.draggedItemIndex];DraggableList.draggedItemSourceCollection.splice(DraggableList.draggedItemIndex,1),data.index<=DraggableList.draggedItemIndex?this.getDataSource().splice(data.index,0,draggedItem):data.index>DraggableList.draggedItemIndex&&(DraggableList.draggedItemSourceCollection===this.getDataSource()&&data.index--,this.getDataSource().splice(data.index,0,draggedItem)),ko.unwrap(this.binding.itemDragged)&&eval(ko.unwrap(this.binding.itemDragged)),DraggableList.onDragLeave(e)},DraggableList.removeDragPositionIndicator=function(){DraggableList.dragPositionIndicator&&(DraggableList.dragPositionIndicator.remove(),DraggableList.dragPositionIndicator=null)},DraggableList.prototype.createDragPositionIndicator=function(t){var e=this,i=!1;DraggableList.dragPositionIndicator||(DraggableList.dragPositionIndicator=$(""),i=!0),null==t.child?this.$element.append(DraggableList.dragPositionIndicator):t.append?DraggableList.dragPositionIndicator.insertAfter(t.child):DraggableList.dragPositionIndicator.insertBefore(t.child),i&&DraggableList.dragPositionIndicator.on("dragover",function(t){return e.onDragOver(t)})},DraggableList.prototype.getDataSource=function(){return this.allBindings.get("foreach")},DraggableList.prototype.getChildren=function(){return $("")},DraggableList.prototype.findChildByY=function(t){for(var e=this.getChildren(),i={left:0,top:0},n=100,s=0,o=0;o<e.length;o++)if(i=$(e[o]).offset(),n=$(e[o]).outerWidth(),s=$(e[o]).outerHeight(),t<i.top+s/2)return{index:o,child:$(e[o]),append:!1,x:i.left,width:n,y:i.top};return{index:e.length,child:0<e.length?$(e[e.length-1]):null,append:!0,x:i.left,width:n,y:i.top+s}},DraggableList.prototype.onDrag=function(t){DraggableList.draggedItemIndex=ko.contextFor(t.target).$index(),DraggableList.draggedItemSourceCollection=this.getDataSource(),DraggableList.draggedItemGroupName=ko.unwrap(this.binding.groupName),DraggableList.dragConfirmed=!1},DraggableList.getDataSourceFromExpression=function(t){var e=ko.unwrap(t);return null==e?ko.observableArray([]):e.Items||t},DraggableList.onDragLeave=function(t){DraggableList.draggedItemGroupName="",DraggableList.draggedItemIndex=-1,DraggableList.draggedItemSourceCollection=null,DraggableList.dragConfirmed=!1,DraggableList.removeDragPositionIndicator()},DraggableList.onDragLeaveCore=function(t){DraggableList.dragLeaving=!0,window.setTimeout(function(){DraggableList.dragLeaving&&(DraggableList.onDragLeave(t),DraggableList.dragLeaving=!1)},500)},DraggableList}(Controls.ControlBase);Controls.DraggableList=DraggableList;var IndicatorPlacement=function(){};BusinessPack.Utils.installBindingHandler("DraggableList",DraggableList),$(document).on("dragleave",function(t){return DraggableList.onDragLeaveCore(t)})}(Controls=BusinessPack.Controls||(BusinessPack.Controls={}))}(BusinessPack=DotVVM.BusinessPack||(DotVVM.BusinessPack={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var i,e=(i=t.ControlBase,__extends(n,i),Object.defineProperty(n.prototype,"isOpened",{get:function(){return this.popupPanel.isOpened},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){var e=this;this.$toggleButton=this.$element.children("."+s.BusinessPackCss.commandToggle),this.$popupPanel=this.$element.children("."+s.BusinessPackCss.primitivePopup),this.popupPanel=new t.PopupPanel(this.$popupPanel,!0),i.prototype.initialize.call(this),this.$element.focus(this.onElementFocus.bind(this)),this.$element.focusout(this.onElementFocusout.bind(this)),this.$toggleButton.focus(this.onToggleButtonFocus.bind(this)),this.$toggleButton.blur(this.onToggleButtonBlur.bind(this)),this.$toggleButton.mousedown(this.onToggleButtonMousedown.bind(this)),this.$toggleButton.click(this.onToggleButtonClick.bind(this)),this.$popupPanel.mousedown(function(t){return e.onPopupPanelMousedown(t)}),this.outside("mousedown",function(){return e.togglePopup(!1)})},n.prototype.togglePopup=function(t){t=(t=void 0===t?!this.isOpened:t)&&this.isEnabled;this.$toggleButton.toggleClass(s.BusinessPackCss.stateActive,t),this.popupPanel.toggle(t)},n.prototype.onElementFocus=function(t){this.$toggleButton.focus()},n.prototype.onElementFocusout=function(t){this.isOutsideOfTree(t.relatedTarget)&&this.togglePopup(!1)},n.prototype.onToggleButtonFocus=function(t){this.$element.attr("tabindex","-1"),this.$element.hasClass(s.BusinessPackCss.flagFocusPrevented)||this.$toggleButton.addClass(s.BusinessPackCss.stateFocused)},n.prototype.onToggleButtonBlur=function(t){this.$element.attr("tabindex",this.binding.tabIndex),this.$toggleButton.removeClass(s.BusinessPackCss.stateFocused)},n.prototype.onToggleButtonMousedown=function(t){t.stopPropagation(),this.$toggleButton.focus()},n.prototype.onToggleButtonClick=function(t){this.isEnabled&&(t.stopPropagationAndPreventDefault(),this.togglePopup())},n.prototype.onPopupPanelMousedown=function(t){var e,i;t.stopPropagation(),s.Browser.isGecko&&(e=$(t.target),i=!!s.DomUtils.closestUntil(e,this.$popupPanel,":input,[tabindex]").length,!e.is(this.$popupPanel)&&i||(t.preventDefault(),this.$toggleButton.focus()))},n.prototype.onEnabledChange=function(){this.$toggleButton.toggleClass(s.BusinessPackCss.stateDisabled,!this.isEnabled),i.prototype.onEnabledChange.call(this)},n);function n(){return null!==i&&i.apply(this,arguments)||this}t.DropDownButton=e,s.Utils.installBindingHandler("DropDownButton",e),s.Utils.installBindingHandler("DropDownButtonItem",e)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(e){"use strict";var i,t=(i=e.SelectorBase,__extends(n,i),Object.defineProperty(n.prototype,"isOpened",{get:function(){return this.popupPanel.isOpened},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hasValue",{get:function(){return null!=ko.unwrap(this.binding.selectedValue)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"canUnselectValue",{get:function(){var t=ko.unwrap(this.binding.allowUnselect);return(null==t||t)&&this.hasValue},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"resultsView",{get:function(){return this.$resultsView.data("ListView")},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){var t=this;i.prototype.initialize.call(this),this.$value=this.$element.children("."+s.BusinessPackCss.primitiveValue),this.$unselectButton=this.$element.children("."+s.BusinessPackCss.commandUnselect),this.$toggleButton=this.$element.children("."+s.BusinessPackCss.commandToggle),this.$popup=this.$element.children("."+s.BusinessPackCss.primitivePopup),this.$resultsView=this.$popup.children("."+s.BusinessPackCss.listView),this.popupPanel=new e.PopupPanel(this.$popup),this.$element.focusin(this.onElementFocusin.bind(this)),this.$element.focusout(this.onElementFocusout.bind(this)),this.$element.keydown(this.onElementKeydown.bind(this)),this.$value.click(this.onToggleButtonClick.bind(this)),this.$popup.mousedown(function(t){return t.preventDefault()}),this.$unselectButton.click(this.onUnselectButtonClick.bind(this)),this.$toggleButton.click(this.onToggleButtonClick.bind(this)),this.outside("mousedown",function(){return t.togglePopup(!1)}),this.watch(this.binding.selectedValue,this.onSelectedValueChange)},n.prototype.togglePopup=function(t){t=(t=void 0===t?!this.isOpened:t)&&this.isEnabled;t&&!this.isOpened&&this.search(null),this.popupPanel.toggle(t)},n.prototype.selectFocusedItem=function(){if(this.resultsView){var t=this.resultsView.getFocusedItems();if(this.isOpened&&t.length)return this.resultsView.selectFocusedItems();this.togglePopup(!1)}},n.prototype.onElementFocusin=function(t){this.$element.addClass(s.BusinessPackCss.stateFocused),this.resultsView.hasFocus(!0)},n.prototype.onElementFocusout=function(t){this.$element.removeClass(s.BusinessPackCss.stateFocused),this.resultsView.hasFocus(!1),this.isOutsideOfTree(t.relatedTarget)&&this.togglePopup(!1)},n.prototype.onElementKeydown=function(t){this.isEnabled&&(this.isOpened?s.KeyboardKeys.isEscape(t.which)?(t.stopPropagation(),this.togglePopup(!1)):s.KeyboardKeys.isEnter(t.which)?(t.stopPropagationAndPreventDefault(),this.selectFocusedItem()):t.which===s.KeyboardKeys.tab?(t.stopPropagation(),this.selectFocusedItem()):t.which===s.KeyboardKeys.down?(t.stopPropagationAndPreventDefault(),this.resultsView.focusNextItem()):t.which===s.KeyboardKeys.up&&(t.stopPropagationAndPreventDefault(),this.resultsView.focusPrevItem()):t.which===s.KeyboardKeys.down?(t.stopPropagationAndPreventDefault(),t.altKey?this.togglePopup(!0):this.resultsView.selectNextItem(!1)):t.which===s.KeyboardKeys.up&&(t.stopPropagationAndPreventDefault(),this.resultsView.selectPrevItem(!1)))},n.prototype.onUnselectButtonClick=function(t){this.isEnabled&&(t.stopPropagation(),this.hasValue&&(ko.isWriteableObservable(this.binding.selectedValue)&&this.binding.selectedValue(null),this.postback(this.binding.changed)))},n.prototype.onToggleButtonClick=function(t){this.isEnabled&&(t.stopPropagation(),this.togglePopup())},n.prototype.onDataSourceChange=function(){i.prototype.onDataSourceChange.call(this),this.onSelectedValueChange(ko.unwrap(this.binding.selectedValue))},n.prototype.onSelectedValueChange=function(t){var e=this.findItemByValue(t);this.$element.toggleClass(s.BusinessPackCss.stateValueEmpty,!t),e?(this.selectedItem(ko.unwrap(e)),this.selectedValues([ko.observable(t)])):(null!=t&&this.warnThatValueWasNotFound(t),this.selectedItem(null),this.selectedValues([]))},n.prototype.onSearchResultSelected=function(){var t=this.binding,e=t.selectedValue,i=t.changed,t=this.selectedValues();return ko.isWriteableObservable(e)&&e(t.length?t[0]():null),this.togglePopup(!1),i?i():Promise.resolve()},n);function n(){var t=null!==i&&i.apply(this,arguments)||this;return t.selectedItem=ko.observable(),t}e.DropDownList=t,s.Utils.installBindingHandler("DropDownList",t),s.Utils.installBindingHandler("DropDownListItem",t)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var o;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.$spanElement=this.$element.children("span"),this.$spanElement.on("click",this.divClicked.bind(this))},n.prototype.keyAction=function(t){var e;o.KeyboardKeys.isEnter(t.which)&&(e=t.target.value.replace(/\n|\r\n/gi,""),this.binding.text(e),$(t.target).remove(),this.$spanElement.show()),o.KeyboardKeys.isEscape(t.which)&&($(t.target).remove(),this.$spanElement.show())},n.prototype.onKeyDown=function(t){o.KeyboardKeys.isEnter(t.which)&&t.preventDefault()},n.prototype.divClicked=function(){this.$spanElement.hide();var e=$("<textarea />");e.html(this.binding.text()),e.addClass(o.BusinessPackCss.primitivePicker),e.addClass(o.BusinessPackCss.primitiveTextBox),e.css("min-height",this.$spanElement.height()),e.keydown(this.onKeyDown.bind(this)),e.keyup(this.keyAction.bind(this)),$(this.$element).append(e),e.focusin(function(t){e.addClass(o.BusinessPackCss.stateFocused)}),e.focusout(function(t){e.removeClass(o.BusinessPackCss.stateFocused)}),e.each(function(){s(this)}).on("input",function(){s(this)}),e.focus()},n);function n(){return null!==e&&e.apply(this,arguments)||this}function s(t){$(t).css({"overflow-y":"hidden"})}t.EditableLiteral=i,o.Utils.installBindingHandler("EditableLiteral",i)}((o=t.BusinessPack||(t.BusinessPack={})).Controls||(o.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var i,e=(i=t.ReactiveBase,__extends(n,i),n.prototype.start=function(t){return this.on("start",t)},n.prototype.progress=function(t){return this.on("progress",t)},n.prototype.complete=function(t){return this.on("complete",t)},n.prototype.error=function(t){return this.on("error",t)},n.prototype.processResponse=function(t){try{return JSON.parse(t)}catch(t){return null}},n);function n(t){var e=i.call(this)||this;return e.uploadUrl=t,e}t.UploaderBase=e}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.UploaderBase,__extends(n,e),n.prototype.upload=function(t){var e,i,n=new FormData;if(t&&t.length){try{for(var s=__values(t),o=s.next();!o.done;o=s.next()){var r=o.value;n.append("upload",r)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}this.trigger("start",t),this.sendForm(n)}},n.prototype.sendForm=function(t){var i=this,n=this.getXHR();n.open("POST",this.uploadUrl,!0),n.setRequestHeader("X-DotVVM-AsyncUpload","true"),n.upload.onprogress=function(t){t.lengthComputable&&i.trigger("progress",100*t.loaded/t.total)},n.onload=function(t){var e=i.processResponse(n.responseText);200!==n.status?i.trigger("error","string"==typeof e?e:null):i.trigger("complete",e.result)},n.onabort=function(t){i.trigger("error",null)},n.onerror=function(t){i.trigger("error",null)},n.send(t)},n.prototype.getXHR=function(){return XMLHttpRequest?new XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP")},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.FormDataUploader=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var u;!function(t){"use strict";var i,e=(i=t.ControlBase,__extends(n,i),Object.defineProperty(n.prototype,"uploadData",{get:function(){return this.binding.data()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"uploadUrl",{get:function(){return this.binding.uploadUrl},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"areMultipleFilesAllowed",{get:function(){var t=this.binding.allowMultipleFiles;return void 0===t||t},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){var e=this;i.prototype.initialize.call(this),this.$input=this.$element.children("input[type='file']"),this.uploader=new t.FormDataUploader(this.uploadUrl),u.Utils.bindDragEvents(this.$element,function(){return e.onElementDragenter()},function(){return e.onElementDragleave()}),this.$element.on("click","."+u.BusinessPackCss.commandSelectFiles,function(t){return e.onSelectFilesClick(t)}).on("click","."+u.BusinessPackCss.commandDelete,function(t){return e.onDeleteFileClick(t)}).on("dragenter drop",function(t){return t.stopPropagationAndPreventDefault()}).on("dragover",function(t){return t.preventDefault()}).on("drop",function(t){return e.onElementDrop(t)}),this.uploader.start(function(t){return e.onUploadStart(t)}).progress(function(t){return e.onUploadProgress(t)}).complete(function(t){return e.onUploadComplete(t)}).error(function(t){return e.onUploadError(t)}),this.$input.change(function(t){return e.onInputChange(t)}),this.disposing(function(){return e.uploader.dispose()})},n.prototype.onSelectFilesClick=function(t){this.isEnabled&&!this.uploadData.IsBusy()&&(t.stopPropagation(),this.$input.click())},n.prototype.onDeleteFileClick=function(t){var e,i,n=ko.dataFor(t.target).FileId.state;this.isEnabled&&n&&(t.stopPropagation(),i=(e=__spread(this.uploadData.Files.state)).findIndex(function(t){return t.FileId===n}),(t=(t=e[i])&&t.PreviewUrl)&&this.revokePreviewUrl(t),e.splice(i,1),this.uploadData.Files.setState(e))},n.prototype.onInputChange=function(t){var e=this.$input[0];this.isEnabled&&!this.uploadData.IsBusy()&&(t.stopPropagation(),this.uploadFiles(e.files))},n.prototype.onElementDragenter=function(){this.isEnabled&&this.$element.addClass(u.BusinessPackCss.stateDragover)},n.prototype.onElementDragleave=function(){this.$element.removeClass(u.BusinessPackCss.stateDragover)},n.prototype.onElementDrop=function(t){var e=this,t=t.originalEvent.dataTransfer;this.isEnabled&&!this.uploadData.IsBusy()&&u.FileUtils.getFiles(t).done(function(t){return e.uploadFiles(t)})},n.prototype.onEnabledChange=function(){i.prototype.onEnabledChange.call(this),this.$element.find("."+u.BusinessPackCss.commandSelectFiles).toggleClass(u.BusinessPackCss.stateDisabled,!this.isEnabled)},n.prototype.onUploadStart=function(t){var e,i,n=[];try{for(var s=__values(t),o=s.next();!o.done;o=s.next()){var r=o.value,r=this.createUploadFile(r);n.push(r)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}var a=this.uploadData.Files.state;this.uploadData.Files.setState(__spread(a,n)),this.$element.addClass(u.BusinessPackCss.stateBusy),this.$element.removeClass(u.BusinessPackCss.stateError),this.uploadData.Progress(0),this.uploadData.IsBusy(!0),this.uploadData.ErrorMessage(null)},n.prototype.onUploadProgress=function(t){this.uploadData.Progress(t)},n.prototype.onUploadComplete=function(t){var e,i,n=this.uploadData.Files().asLinq();try{for(var s=__values(t),o=s.next();!o.done;o=s.next())!function(t){var e=u.FileUtils.getFileName(t.FileName),i=n.firstOrDefault(function(t){return t.state.FileName===e});i?i.setState({FileId:t.FileId,FileName:t.FileName,FileSize:{Bytes:t.FileSize.Bytes,FormattedText:t.FileSize.FormattedText},IsFileTypeAllowed:t.IsFileTypeAllowed,IsMaxSizeExceeded:t.IsMaxSizeExceeded,IsAllowed:t.IsAllowed,IsUploaded:!0}):u.Utils.warnInDebugMode("Matching file was not found.")}(o.value)}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}this.isEnabled&&this.postback(this.binding.uploadCompleted),this.$element.removeClass(u.BusinessPackCss.stateBusy),this.$element.removeClass(u.BusinessPackCss.stateError),this.uploadData.Progress(0),this.uploadData.IsBusy(!1),this.uploadData.ErrorMessage(null),this.$input.val("")},n.prototype.onUploadError=function(t){this.$element.removeClass(u.BusinessPackCss.stateBusy),this.$element.addClass(u.BusinessPackCss.stateError),this.uploadData.Progress(0),this.uploadData.IsBusy(!1),this.uploadData.ErrorMessage(t||this.binding.genericErrorText),this.$input.val("")},n.prototype.uploadFiles=function(t){var e,i;t.length&&(Array.isArray(t)||(t=u.FileUtils.filesToArray(t)),this.areMultipleFilesAllowed||(t=t.slice(0,1)),e=(i=__read(this.validateFiles(t),2))[0],t=i[1],!this.areMultipleFilesAllowed&&this.uploadData.Files().length&&this.clearFiles(),t&&0<t.length&&(i=this.uploadData.Files.state,this.uploadData.Files.setState(__spread(i,t))),this.uploader.upload(e))},n.prototype.validateFiles=function(t){var e,i,n=[],s=[];try{for(var o=__values(t),r=o.next();!r.done;r=o.next()){var a=r.value,l=this.isFileTypeAllowed(a),u=this.isMaxSizeExceeded(a);u||!l?(u=this.createUploadFile(a,l,u),s.push(u)):n.push(a)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}return[n,s]},n.prototype.isFileTypeAllowed=function(t){var e,i,n=this.binding.allowedFileTypes,s=t.type.replace(u.RegexUtils.mimeTypeSecondPart(),""),o=u.FileUtils.getExtension(t.name);if(!n)return!0;try{for(var r=__values(n.split(",")),a=r.next();!a.done;a=r.next()){var l=a.value;if((l=l.trim()).startsWith(".")){if(l.toUpperCase()===o.toUpperCase())return!0}else{if(!t.type)return!0;if(u.RegexUtils.wildcardMimeType().exec(l))if(s===l.replace(u.RegexUtils.mimeTypeSecondPart(),""))return!0;if(t.type===l)return!0}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}return!1},n.prototype.isMaxSizeExceeded=function(t){var e=this.binding.maxFileSize;if(e){e=1024*e*1024;return t.size>e}return!1},n.prototype.createUploadFile=function(t,e,i){void 0===i&&(i=!1);var n=(e=void 0===e?!0:e)&&!i;return{FileId:u.Utils.createGuid(!0),FileName:t.name,FileSize:{Bytes:t.size,FormattedText:u.FileUtils.formatSize(t.size)},PreviewUrl:this.createPreviewUrl(t),IsUploaded:!1,IsFileTypeAllowed:e,IsMaxSizeExceeded:i,IsAllowed:n}},n.prototype.createPreviewUrl=function(t){if(!u.FileUtils.isImageFile(t))return null;t=URL.createObjectURL(t);return this.previewUrls.push(t),t},n.prototype.revokePreviewUrl=function(t){var e=this.previewUrls.indexOf(t);0<=e&&(this.previewUrls.splice(e,1),URL.revokeObjectURL(t))},n.prototype.clearFiles=function(){var e,t;try{for(var i=__values(this.previewUrls),n=i.next();!n.done;n=i.next()){var s=n.value;URL.revokeObjectURL(s)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}this.previewUrls=[],this.uploadData.Files([])},n.prototype.getFileStyle=function(t){var e={};return e[u.BusinessPackCss.stateError]=!ko.unwrap(t.IsAllowed),e},n);function n(){var t=null!==i&&i.apply(this,arguments)||this;return t.previewUrls=[],t}t.FileUpload=e,u.Utils.installBindingHandler("FileUpload",e)}((u=t.BusinessPack||(t.BusinessPack={})).Controls||(u.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ButtonBase,__extends(n,e),n);function n(){return null!==e&&e.apply(this,arguments)||this}t.SelectFilesButton=i,s.Utils.installBindingHandler("SelectFilesButton",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.$element.on("click","."+s.BusinessPackCss.commandAddGroup,this.onAddGroupClick.bind(this)),this.$element.on("click","."+s.BusinessPackCss.commandAddFilter,this.onAddFilterClick.bind(this)),this.$element.on("click","."+s.BusinessPackCss.commandDelete,this.onDeleteFilterClick.bind(this))},n.prototype.getFieldsSource=function(){return s.Utils.deepObservable(this.binding.fields)},n.prototype.getLogicsSource=function(){var t=[{Type:"And",DisplayName:this.binding.andLogicText},{Type:"NotAnd",DisplayName:this.binding.notAndLogicText},{Type:"Or",DisplayName:this.binding.orLogicText},{Type:"NotOr",DisplayName:this.binding.notOrLogicText}];return s.Utils.deepObservable(t)},n.prototype.findFieldByName=function(e){return this.binding.fields.asLinq().singleOrDefault(function(t){return t.Name===e})},n.prototype.onAddGroupClick=function(t){var e=ko.dataFor(t.target).group,t={Type:ko.observable("FilterGroup"),Logic:ko.observable(e.Logic()),Filters:ko.observableArray()};e.Filters.push(ko.observable(t))},n.prototype.onAddFilterClick=function(t){var e=this.binding.fields[0],t=ko.dataFor(t.target).group,e={Type:ko.observable("FilterCondition"),FieldName:ko.observable(e.Name),FieldDisplayName:ko.observable(e.DisplayName),Operator:ko.observable(null),FormatString:ko.observable(null),Value:ko.observable(null)};t.Filters.push(ko.observable(e))},n.prototype.onDeleteFilterClick=function(t){var e=ko.dataFor(t.target);ko.contextFor(t.target).$parent.group.Filters.remove(function(t){return t()===e})},n.prototype.onFieldNameChange=function(t){var e=this.findFieldByName(t.FieldName());t.FieldDisplayName(e.DisplayName),t.FormatString(e.FormatString),t.Value(null),this.postback(this.binding.changed)},n.prototype.onFilterChange=function(){this.postback(this.binding.changed)},n.prototype.canAddNestedGroup=function(t){var e=this.binding.maxOperatorDepth;return 0===e||t+1<e},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.FilterBuilder=i,s.Utils.installBindingHandler("FilterBuilder",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var u;!function(t){"use strict";var e,i=(e=t.FilterControlBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.binding.filterGroup?this.watch(this.binding.filterGroup,this.onFilterChange):this.watch(this.binding.filter,this.onFilterChange),this.setIsValueRequired()},Object.defineProperty(n.prototype,"isOperatorSet",{get:function(){return null!=this.filter.Operator()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isValueSet",{get:function(){return null!=this.filter.Value()&&""!==this.filter.Value()},enumerable:!0,configurable:!0}),n.prototype.applyFilter=function(){var t,e=this.findActiveFilter();this.isChanging=!0,e?(e.Operator(this.filter.Operator()),e.Value(this.filter.Value())):this.binding.filterGroup&&(t=this.binding.filterGroup(),e=u.Utils.deepObservable(this.filter),t.Filters.push(e)),this.isChanging=!1,this.postback(this.binding.changed)},n.prototype.resetFilter=function(t){void 0===t&&(t=!0);var e=this.findActiveFilter();this.isChanging=!0,this.filter.Value(null),t&&this.filter.Operator(this.getDefaultOperator());var i,n=e&&e.Value()!==this.filter.Value();e&&(this.binding.filterGroup?(t=(i=this.binding.filterGroup.state).Filters.filter(function(t){return t.FieldName!==e.FieldName()}),t=__assign({},i,{Filters:t}),this.binding.filterGroup.setState(t)):(e.Operator(this.filter.Operator()),e.FieldDisplayName(null),e.Value(null))),this.isChanging=!1,!n&&this.wasValueRequired||this.postback(this.binding.changed)},n.prototype.onFilterChange=function(){var t;this.isChanging||(t=this.findActiveFilter(),this.isChanging=!0,t?(t.Operator(this.getDefaultOperatorIfNotAvailable(t.Operator())),this.filter.FieldName(t.FieldName()),this.filter.Operator(t.Operator()),this.filter.Value(t.Value())):(this.filter.Operator(this.getDefaultOperator()),this.filter.Value(null)),this.isChanging=!1)},n.prototype.onOperatorChange=function(){this.setIsValueRequired(),this.isOperatorSet?this.isValueRequired()?this.onValueChange():this.applyFilter():this.resetFilter()},n.prototype.onValueChange=function(){this.isValueSet?this.applyFilter():this.resetFilter(!1)},n.prototype.getOperatorsSource=function(){var e,t,i=this.binding,n=i.allowNull,s=i.operators;if(!n){var o=(s=s.slice()).filter(function(t){return t.Type.endsWith("Null")});try{for(var r=__values(o),a=r.next();!a.done;a=r.next()){var l=a.value;s.splice(s.indexOf(l),1)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}}return u.Utils.deepObservable(s)},n.prototype.createFilter=function(){var t=this.binding,e=t.fieldName,i=t.fieldDisplayName,n=t.operators,t=t.formatString;return{Type:ko.observable("FilterCondition"),FieldName:ko.observable(e),FieldDisplayName:ko.observable(i),Operator:ko.observable(n[0].Type),FormatString:ko.observable(t),Value:ko.observable(null)}},n.prototype.findActiveFilter=function(){var e,t;if(this.binding.filter)return this.binding.filter();var i=this.binding.filterGroup(),n=this.binding.fieldName;try{for(var s=__values(i.Filters()),o=s.next();!o.done;o=s.next()){var r=o.value;if(this.isFilterCondition(r)&&r().FieldName()===n)return r()}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return null},n.prototype.setIsValueRequired=function(){var e=this,t=this.binding.operators.asLinq().firstOrDefault(function(t){return t.Type===e.filter.Operator()});this.wasValueRequired=this.isValueRequired(),this.isValueRequired(!!t&&t.IsValueRequired)},n.prototype.getDefaultOperatorIfNotAvailable=function(e){var t=this.binding.operators.asLinq().firstOrDefault(function(t){return t.Type===e});return t?t.Type:this.getDefaultOperator()},n.prototype.getDefaultOperator=function(){var t=this.binding,e=t.dataType,t=t.operators;return"Boolean"!==e?t[0].Type:null},n);function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.isValueRequired=ko.observable(!0),t.isChanging=!1,t.filter=t.createFilter(),t}t.FilterEditor=i,u.Utils.installBindingHandler("FilterEditor",i)}((u=t.BusinessPack||(t.BusinessPack={})).Controls||(u.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e;(e=t.DefaultGridViewRowClickDecorator||(t.DefaultGridViewRowClickDecorator={})).selectedRowIndex=ko.observable(),e.clickRow=function(t){t=ko.unwrap(t),e.selectedRowIndex(t)}}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var o;!function(t){"use strict";var e,i=(e=t.ItemsControlBase,__extends(n,e),n.prototype.initialize=function(){var t=this;e.prototype.initialize.call(this),this.$table=this.$element.children("."+o.BusinessPackCss.primitiveTable),this.$columnHeaderRow=this.$table.find("."+o.BusinessPackCss.gridViewColumnHeaderRow),this.$colgroup=this.$table.find("colgroup"),this.sortColumnsSettings(),this.subscribe(this.binding.allowReorderColumns,this.onAllowReorderColumnsChange),this.watch(this.binding.userSettings,this.onUserSettingsChange),this.disposing(function(){return t.disableColumnReordering()}),this.setupColumnResizing(),o.Browser.isIe&&this.$table.addClass(o.BusinessPackCss.flagIe)},Object.defineProperty(n.prototype,"filterGroup",{get:function(){var t=this.binding.dataSource();if(t){t=t.FilteringOptions();if(t)return t.FilterGroup}return null},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isDataSourceEmpty",{get:function(){var t=this.binding.dataSource();if(t){if(t.Items().length)return!1;t=t.RowInsertOptions();if(t)if(null!=t.InsertedRow())return!1}return!0},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isAnyFilterApplied",{get:function(){var t=this.filterGroup;return!!t&&0<t().Filters().length},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isNotFilteredDataSourceEmpty",{get:function(){return this.isDataSourceEmpty&&!this.isAnyFilterApplied},enumerable:!0,configurable:!0}),n.prototype.getInsertedRow=function(){var t=this.binding.dataSource();if(t){t=t.RowInsertOptions();if(t)return t.InsertedRow||null}return null},n.prototype.isCellVisible=function(t){var e=$(t),t=this.$columnHeaderRow.children("th,td")[e.index()],e=ko.contextFor(t);if(e){e=this.bindingProvider.getBindingAccessors(t,e);if(null!=e){e=e.visible;if(null!=e)return ko.unwrap(e())}}return!0},n.prototype.isColumnVisible=function(t,e){var i,n;e=ko.unwrap(e);var s=this.binding.userSettings();if(!s)return e;if(e){var o=s.ColumnsSettings();try{for(var r=__values(o),a=r.next();!a.done;a=r.next()){var l=a.value;if(l().ColumnName()===t)return l().Visible()}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return!0}return!1},n.prototype.getHeaderText=function(t,e){if(ko.unwrap(this.binding.userSettings)){t=this.getColumnSettingsByName(t);if(t&&t.DisplayText){t=ko.unwrap(t.DisplayText);if(null!=t)return t}}return ko.unwrap(e)},n.prototype.getColumnWidth=function(t,e){e=ko.unwrap(e);t=this.getColumnSettingsByName(t);if(t&&ko.unwrap(t.Width))return ko.unwrap(t.Width)+"px";return e||""},n.prototype.isDataSourceSortedBy=function(t,e){var i=this.binding.dataSource();if(!i)return!1;i=i.SortingOptions();return!!i&&(i.SortExpression()===t&&i.SortDescending()===e)},n.prototype.isItemInEditMode=function(t){var e=this.binding.dataSource(),i=this.binding.inlineEditMode;if(e){e=e.RowEditOptions();if(!e||"Disabled"===i)return!1;i=e.EditRowId(),e=e.PrimaryKeyPropertyName();if(null!=i&&e)return ko.unwrap(t[e])==i}return!1},n.prototype.getColumnSettingsByName=function(t){var e,i,n=ko.unwrap(this.binding.userSettings);if(!n)return null;try{for(var s=__values(n.ColumnsSettings()),o=s.next();!o.done;o=s.next()){var r=o.value;if(r().ColumnName()===t)return ko.unwrap(r)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}return null},n.prototype.onAllowReorderColumnsChange=function(t){t&&this.enableColumnReordering()},n.prototype.onUserSettingsChanged=function(){this.postback(this.binding.userSettingsChanged)},n.prototype.onUserSettingsChange=function(){this.sortColumnsByDisplayOrder()},n.prototype.enableColumnReordering=function(){var o,r=this;this.$columnHeaderRow.sortable({containerSelector:"tr",itemSelector:"th",placeholder:'<th class="placeholder"></th>',vertical:!1,onDragStart:function(t,e,i){o=t.index(),t.appendTo(t.parent()),i(t,e)},onDrag:function(t,e,i,n){e&&(e.left=Math.max(e.left,0),e.top=Math.max(e.top,0),e.left=Math.min(e.left,r.$table.width()-t.width()-r.ColumnReorderingFixingOffset),e.top=Math.min(e.top,r.$table.height()-t.height()),i(t,e,i,n))},onDrop:function(t,e,i){var n=t.index(),s=!1;n!==o&&(r.moveColumnInRows(o,n,!0),s=!0),i(t,e),r.updateSettingsFromColumns(),s&&r.onUserSettingsChanged()}})},n.prototype.disableColumnReordering=function(){ko.unwrap(this.binding.allowReorderColumns)&&this.$columnHeaderRow.sortable("destroy")},n.prototype.sortColumnsSettings=function(){var t=ko.unwrap(this.binding.userSettings);t&&t.ColumnsSettings.sort(function(t,e){return t().DisplayOrder()>e().DisplayOrder()?1:-1})},n.prototype.sortColumnsByDisplayOrder=function(){var e,t,i=ko.unwrap(this.binding.userSettings);if(i)try{for(var n=__values(i.ColumnsSettings()),s=n.next();!s.done;s=n.next()){var o=s.value,r=o().ColumnName(),r=this.$columnHeaderRow.children("th[data-column='"+r+"']");r.length&&((r=r.index())!==(o=o().DisplayOrder())&&this.moveColumnInRows(r,o))}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},n.prototype.updateSettingsFromColumns=function(){var n,s=this,t=ko.unwrap(this.binding.userSettings);t&&(n=[],this.$columnHeaderRow.children().each(function(t,e){var i=$(e),e=i.attr("data-column"),e=o.Utils.deepClone(s.getColumnSettingsByName(e));e.DisplayOrder(i.index()),n.push(ko.observable(e))}),t.ColumnsSettings(n),this.sortColumnsSettings())},n.prototype.moveColumnInRows=function(i,n,s){var o=this;void 0===s&&(s=!1),this.moveColumnInColgroup(i,n),this.$table.find("tr").each(function(t,e){if(!s||!o.$columnHeaderRow.is(e))return o.moveColumnInRow($(e),i,n)}),this.updateTemplate("InsertRowTemplate",function(t){return o.moveColumnInRow(t,i,n)}),this.updateTemplate("RowTemplate",function(t){return o.moveColumnInRow(t,i,n)}),this.updateTemplate("EditRowTemplate",function(t){return o.moveColumnInRow(t,i,n)})},n.prototype.moveColumnInRow=function(t,e,i){i<e?t.children().eq(i).before(t.children()[e]):e<i&&t.children().eq(i).after(t.children()[e])},n.prototype.moveColumnInColgroup=function(t,e){e<t?this.$colgroup.children().eq(e).before(this.$colgroup.children()[t]):t<e&&this.$colgroup.children().eq(e).after(this.$colgroup.children()[t])},n.prototype.setupColumnResizing=function(){var i,n,s,e=this,t=this.$columnHeaderRow.find("."+o.BusinessPackCss.gridViewColumnResizeGrip);0!=t.length&&(t.mousedown(function(t){var e=$(t.target).parent().parent();e.is(":last-child")||(i=e.data("column"),n=e.get(0).offsetWidth,s=t.pageX,t.preventDefault(),t.stopPropagation())}),this.$document.mousemove(function(t){i&&(t=t.pageX-s,e.setColumnWidth(i,n+t))}),this.$document.mouseup(function(){i&&e.onUserSettingsChanged(),s=n=i=null}))},n.prototype.setColumnWidth=function(t,e){var i=this.getColumnSettingsByName(t);i&&i.Width(e),this.$colgroup.children().filter('[data-column="'+t+'"]').first().width(e+"px")},n);function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.ColumnReorderingFixingOffset=30,t}t.GridView=i,o.Utils.installBindingHandler("GridView",i)}((o=t.BusinessPack||(t.BusinessPack={})).Controls||(o.Controls={}))}(DotVVM=DotVVM||{}),function(t){var a;!function(t){"use strict";var o;(n=o=o||{})[n.None=0]="None",n[n.ArrowUp=38]="ArrowUp",n[n.ArrowDown=40]="ArrowDown",n[n.Home=36]="Home",n[n.End=35]="End";var r=ko.observable(o.None);function e(t){var e=(t=t||window.event).keyCode||t.which;e!==o.ArrowUp&&e!==o.ArrowDown&&e!==o.Home&&e!==o.End||(r(e),t.preventDefault())}var i,n=(i=t.ControlBase,__extends(s,i),s.prototype.initialize=function(){i.prototype.initialize.call(this),document.onkeydown=e,this.subscribe(r,this.onKeyboardActionChange)},s.prototype.onKeyboardActionChange=function(t){if(ko.unwrap(this.binding.actionEnabled)&&t!==o.None){var e=ko.unwrap(this.binding.rowElementSelector),i=$(e);if(i.length)switch(t){case o.ArrowUp:var n=i.first().prev();n.length&&n.click();break;case o.ArrowDown:n=i.first().next();n.length&&n.click();break;case o.Home:var s=i.first().prevAll();s.length&&s.last().click();break;case o.End:s=i.first().nextAll();s.length&&s.last().click()}}r(o.None)},s);function s(){return null!==i&&i.apply(this,arguments)||this}t.GridViewKeyboardActionsDecorator=n,a.Utils.installBindingHandler("GridViewKeyboardActionsDecorator",n)}((a=t.BusinessPack||(t.BusinessPack={})).Controls||(a.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ItemsControlBase,__extends(n,e),n.prototype.initialize=function(){this.$literal=this.$element.children("."+s.BusinessPackCss.primitiveText),this.watch(this.binding.selectedValue,this.onSelectedValueChanged)},n.prototype.getItemKeyBinding=function(){return this.binding.itemKeyBinding},n.prototype.getItemValueBinding=function(){return this.binding.itemValueBinding},n.prototype.getItemTextBinding=function(){return this.binding.itemTextBinding},n.prototype.onSelectedValueChanged=function(t){t=this.findItemByValue(t);t?this.$literal.text(this.getItemText(t)):this.$literal.text("")},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.ReadonlySelector=i,s.Utils.installBindingHandler("ReadonlySelector",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),Object.defineProperty(n.prototype,"columnsSettings",{get:function(){return this.binding.userSettings().ColumnsSettings},enumerable:!0,configurable:!0}),n);function n(){return null!==e&&e.apply(this,arguments)||this}t.GridViewUserSettingsEditor=i,s.Utils.installBindingHandler("GridViewUserSettingsEditor",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var i,e=(i=t.HierarchyItemsControlBase,__extends(n,i),n.prototype.initialize=function(){i.prototype.initialize.call(this);var t=this.binding.dataSource,e=this.bindingContext.extend(((e={}).$foreachCollectionSymbol=t.data,e));this.$element.innerBindingContext=e,ko.applyBindingsToDescendants(e,this.$element)},n);function n(){return null!==i&&i.apply(this,arguments)||this}t.HierarchyRepeater=e,s.Utils.installBindingHandler("HierarchyRepeater",e),ko.virtualElements.allowedBindings["dotvvm-SSR-index"]=!0,ko.bindingHandlers["dotvvm-SSR-index"]={init:function(t,e,i,n,s){if(!s)throw new Error;var o=e(),s=(s.$foreachCollectionSymbol,s.extend({$index:ko.pureComputed(function(){return o})}));return t.innerBindingContext=s,ko.applyBindingsToDescendants(s,t),{controlsDescendantBindings:!0}}}}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var n;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(l,e),l.prototype.initialize=function(){e.prototype.initialize.call(this),this.subscribe(this.binding.icon,this.onIconChange)},l.prototype.onIconChange=function(t){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,this.ensureSpriteIsCached()];case 1:return t.sent(),this.refreshSvgIcon(),[2]}})})},l.prototype.ensureSpriteIsCached=function(){var e=this,t=this.binding.spriteUrl;return l.loadingSprites.includes(t)?n.Utils.whenAsync(function(){return l.cachedSprites.includes(t)}):l.cachedSprites.includes(t)?Promise.resolve():(l.loadingSprites.push(t),fetch(this.binding.spriteUrl).then(function(t){return t.text()}).then(function(t){return(new DOMParser).parseFromString(t,"image/svg+xml")}).then(function(t){return e.cacheSymbolsFromSprite(t)}))},l.prototype.refreshSvgIcon=function(){var e,t,i=ko.unwrap(this.binding.icon),i=this.getCacheKey(i);this.$element.empty();try{for(var n=__values(this.previousAttributes),s=n.next();!s.done;s=n.next()){var o=s.value;this.$element.removeAttr(o)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}if(l.symbolCache.hasOwnProperty(i)){for(var r=l.symbolCache[i].cloneNode(!0),a=this.previousAttributes.length=0;a<r.attributes.length;a++)"id"!=(o=r.attributes[a]).name&&"class"!=o.name&&(this.$element.attr(o.name,o.value),this.previousAttributes.push(o.name));for(a=r.childNodes.length-1;0<=a;a--)this.$element.prepend(r.childNodes[a])}},l.prototype.cacheSymbolsFromSprite=function(t){for(var e=this.binding.spriteUrl,i=t.getElementsByTagName("symbol"),n=0;n<i.length;n++)l.symbolCache[this.getCacheKey(this.getIconType(i[n]))]=i[n];l.cachedSprites.push(e);e=l.loadingSprites.indexOf(e);l.loadingSprites.splice(e,1)},l.prototype.getIconType=function(t){return t.getAttribute("id")},l.prototype.getCacheKey=function(t){return this.binding.spriteUrl+"#"+t},l.cachedSprites=[],l.loadingSprites=[],l.symbolCache={},l);function l(){var t=null!==e&&e.apply(this,arguments)||this;return t.previousAttributes=[],t}t.SvgIconBase=i}((n=t.BusinessPack||(t.BusinessPack={})).Controls||(n.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.SvgIconBase,__extends(n,e),n);function n(){return null!==e&&e.apply(this,arguments)||this}t.FAIcon=i,s.Utils.installBindingHandler("FAIcon",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.SvgIconBase,__extends(n,e),n);function n(){return null!==e&&e.apply(this,arguments)||this}t.Icon=i,s.Utils.installBindingHandler("Icon",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var o;!function(n){"use strict";var s,t=(s=n.SelectionBox,__extends(e,s),Object.defineProperty(e.prototype,"hasForcedSize",{get:function(){return null!==this.getForcedSize()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasForcedRadius",{get:function(){return!!this.options.forcedRadius},enumerable:!0,configurable:!0}),e.prototype.reset=function(){var t,e,i;this.loadRadius(null),this.hasForcedSize?(t=this.getForcedSize(),e=(this.$parent.width()-t.width)/2,i=(this.$parent.height()-t.height)/2,this.$element.width(t.width).height(t.height).css({left:Math.round(e),top:Math.round(i)}).show()):s.prototype.reset.call(this)},e.prototype.getCropRectangle=function(){var t=this.$element[0].getBoundingClientRect(),e=this.$originalImage[0].getBoundingClientRect();return this.$element.is(":visible")?{Left:ko.observable(Math.round(t.left-e.left)),Top:ko.observable(Math.round(t.top-e.top)),Width:ko.observable(this.$element.width()),Height:ko.observable(this.$element.height())}:null},e.prototype.loadCropRectangle=function(t){var e=t.Left,i=t.Top,n=t.Width,s=t.Height,o=this.$parent.offset(),t=this.$originalImage[0].getBoundingClientRect();e&&i&&n&&s&&this.$element.width(n()).height(s()).css({left:t.left+e()-o.left,top:t.top+i()-o.top}).show()},e.prototype.loadRadius=function(t){(t=this.hasForcedRadius?this.options.forcedRadius:t)?(this.$element.css("border-radius",t+"%"),this.$element.addClass(o.BusinessPackCss.flagRounded)):(this.$element.css("border-radius",""),this.$element.removeClass(o.BusinessPackCss.flagRounded))},e.prototype.getDefaultOptions=function(){return{tempAspectRatio:1,restrictToParent:!0,$imageCanvas:null,minWidth:5,minHeight:5}},e.prototype.onResizeGripMousedown=function(t){t.stopPropagationAndPreventDefault();var e=$(t.target),i=this.$element.position(),n=this.$element.width(),t=this.$element.height();e.hasClass(o.BusinessPackCss.primitiveGripN)?(this.initialX=i.left+n/2,this.initialY=i.top+t,this.lockX=!0):e.hasClass(o.BusinessPackCss.primitiveGripNE)?(this.initialX=i.left,this.initialY=i.top+t):e.hasClass(o.BusinessPackCss.primitiveGripE)?(this.initialX=i.left,this.initialY=i.top+t/2,this.lockY=!0):e.hasClass(o.BusinessPackCss.primitiveGripSE)?(this.initialX=i.left,this.initialY=i.top):e.hasClass(o.BusinessPackCss.primitiveGripS)?(this.initialX=i.left+n/2,this.initialY=i.top,this.lockX=!0):e.hasClass(o.BusinessPackCss.primitiveGripSW)?(this.initialX=i.left+n,this.initialY=i.top):e.hasClass(o.BusinessPackCss.primitiveGripW)?(this.initialX=i.left+n,this.initialY=i.top+t/2,this.lockY=!0):e.hasClass(o.BusinessPackCss.primitiveGripNW)&&(this.initialX=i.left+n,this.initialY=i.top+t),this.$document.mousemove(this.onDocumentMousemoveHandler),this.$document.mouseup(this.onDocumentMouseupHandler)},e.prototype.shouldStartSelection=function(t){return!this.hasForcedSize&&s.prototype.shouldStartSelection.call(this,t)},e.prototype.refreshContents=function(){var t=this.$element.offset(),e=this.options.$imageCanvas.offset();this.$imagePreview.prop("src")!==this.$originalImage.prop("src")&&this.$imagePreview.prop("src",this.$originalImage.prop("src")),this.$imagePreview.width(this.$originalImage.width()),this.$imagePreview.css("transform",this.$originalImage.css("transform")),this.$imagePreview.css({left:-(t.left-e.left),top:-(t.top-e.top)}),s.prototype.refreshContents.call(this)},e.prototype.getForcedSize=function(){var t=this.options,e=t.aspectRatio,i=t.forcedWidth,t=t.forcedHeight,e=e||1;return i?{width:i,height:t||i/e}:t?{width:t*e,height:t}:null},e);function e(t,e){var i=s.call(this,t,e)||this;return i.$imagePreview=t.find("img"),i.$originalImage=e.$imageCanvas.children("img"),i.$resizeGrips=$('<div class="'+o.BusinessPackCss.primitiveGrip+" "+o.BusinessPackCss.primitiveGripN+'" />').add('<div class="'+o.BusinessPackCss.primitiveGrip+" "+o.BusinessPackCss.primitiveGripNE+'" />').add('<div class="'+o.BusinessPackCss.primitiveGrip+" "+o.BusinessPackCss.primitiveGripE+'" />').add('<div class="'+o.BusinessPackCss.primitiveGrip+" "+o.BusinessPackCss.primitiveGripSE+'" />').add('<div class="'+o.BusinessPackCss.primitiveGrip+" "+o.BusinessPackCss.primitiveGripS+'" />').add('<div class="'+o.BusinessPackCss.primitiveGrip+" "+o.BusinessPackCss.primitiveGripSW+'" />').add('<div class="'+o.BusinessPackCss.primitiveGrip+" "+o.BusinessPackCss.primitiveGripW+'" />').add('<div class="'+o.BusinessPackCss.primitiveGrip+" "+o.BusinessPackCss.primitiveGripNW+'" />'),i.hasForcedSize?i.$element.mousedown(function(t){return t.stopPropagationAndPreventDefault()}):(e=i.options.restrictToParent,i.elementMovable=new n.Movable(i.$element,e),i.$parent.css("cursor","crosshair"),i.$resizeGrips.mousedown(i.onResizeGripMousedown.bind(i)),i.$element.append(i.$resizeGrips)),i}n.CropBox=t}((o=t.BusinessPack||(t.BusinessPack={})).Controls||(o.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var i,e=(i=t.ControlBase,__extends(n,i),n.prototype.initialize=function(){var e=this;i.prototype.initialize.call(this),this.$imageCanvas=this.$element.find("."+s.BusinessPackCss.imageCropImageCanvas),this.$image=this.$imageCanvas.children("img"),this.$cropCanvas=this.$element.find("."+s.BusinessPackCss.imageCropCropCanvas),this.$cropOverlay=this.$cropCanvas.children("."+s.BusinessPackCss.primitiveOverlay),this.$cropBox=this.$cropCanvas.find("."+s.BusinessPackCss.primitiveSelectionBox),this.$toolbar=this.$element.children("."+s.BusinessPackCss.primitiveToolbar),this.$toggle=this.$toolbar.children("."+s.BusinessPackCss.commandToggle),this.$rotateLeft=this.$toolbar.children("."+s.BusinessPackCss.commandRotateLeft),this.$rotateRight=this.$toolbar.children("."+s.BusinessPackCss.commandRotateRight),this.$zoomIn=this.$toolbar.children("."+s.BusinessPackCss.commandZoomIn),this.$zoomOut=this.$toolbar.children("."+s.BusinessPackCss.commandZoomOut),this.$reset=this.$toolbar.children("."+s.BusinessPackCss.commandReset),this.imageCanvasMovable=new t.Movable(this.$imageCanvas),this.crop=new t.CropBox(this.$cropBox,{$imageCanvas:this.$imageCanvas,forcedWidth:this.binding.forcedCropWidth,forcedHeight:this.binding.forcedCropHeight,forcedRadius:this.binding.forcedCropRadius,aspectRatio:this.getAspectRatio()}),this.$window.on("resize"+this.eventNs,this.onWindowResize.bind(this)),this.$element.on("mousewheel",this.onElementMousewheel.bind(this)),this.imageCanvasMovable.update(function(){return e.crop.update()}),this.imageCanvasMovable.change(function(){return e.postback(e.binding.changed)}),this.$image.on("load",this.onImageLoad.bind(this)),this.$cropOverlay.mousedown(function(t){return t.preventDefault()}),this.$toggle.click(this.onToggleButtonClick.bind(this)),this.$rotateLeft.click(function(t){return e.onRotateButtonClick(-45,t)}),this.$rotateRight.click(function(t){return e.onRotateButtonClick(45,t)}),this.$zoomIn.click(function(t){return e.onZoomButtonClick(1.4,t)}),this.$zoomOut.click(function(t){return e.onZoomButtonClick(-1.4,t)}),this.$reset.click(this.onResetClick.bind(this)),this.crop.update(this.onCropUpdate.bind(this)),this.crop.change(this.onCropChange.bind(this))},n.prototype.rotate=function(t){var e=this.binding.changed,i=ko.unwrap(this.binding.operations),t=(360+(i.Rotate()+t))%360;i.Rotate(t||null),this.postback(e),this.$image.css("transform",t?"rotate("+t+"deg)":"none"),this.crop.update()},n.prototype.zoom=function(t,e){var i=this.binding.operations(),n=i.Resize();this.applyZoom(t,e),n!==i.Resize()&&this.postback(this.binding.changed)},n.prototype.onWindowResize=function(t){this.isSafeToFitAndCenterImage()&&this.fitAndCenterImage(!0)},n.prototype.onElementMousewheel=function(t){var e,i=this;t.ctrlKey&&(e=t.originalEvent,t.preventDefault(),clearTimeout(this.zoomTimeoutId),this.applyZoom(0<e.wheelDelta?.7:-.7,{left:t.pageX,top:t.pageY}),this.zoomTimeoutId=setTimeout(function(){i.postback(i.binding.changed),clearTimeout(i.zoomTimeoutId)},200))},n.prototype.onImageLoad=function(t){var e=this;t.stopPropagation(),this.$image.css({width:"auto"}),this.$image.visible(function(){e.zoomStep=e.$image.width()/100,e.loadOperations()})},n.prototype.onToggleButtonClick=function(t){t.stopPropagation(),this.isCroppingEnabled()?(this.isCroppingEnabled(!1),this.$cropCanvas.addClass(s.BusinessPackCss.imageCropCropCanvasDisabled)):(this.isCroppingEnabled(!0),this.crop.update(),this.$cropCanvas.removeClass(s.BusinessPackCss.imageCropCropCanvasDisabled))},n.prototype.onRotateButtonClick=function(t,e){e.stopPropagation(),this.rotate(t)},n.prototype.onZoomButtonClick=function(t,e){e.stopPropagation(),this.zoom(t)},n.prototype.onResetClick=function(t){var e=this.binding.changed,i=ko.unwrap(this.binding.operations),n=this.binding.forcedCropRadius;t.stopPropagation(),i.Resize(null),i.Rotate(null),this.$image.css("transform","none"),this.fitAndCenterImage(!1),i.Crop(null),i.Round(n||null),this.crop.reset(),this.postback(e)},n.prototype.onCropUpdate=function(){var t=ko.unwrap(this.binding.operations),e=this.crop.getCropRectangle();t.Crop(e)},n.prototype.onCropChange=function(){this.postback(this.binding.changed)},n.prototype.loadOperations=function(){var t=!1,e=ko.unwrap(this.binding.operations),i=this.binding.forcedCropRadius,n=ko.unwrap(e.Resize),s=ko.unwrap(e.Rotate),o=ko.unwrap(e.Crop),r=ko.unwrap(e.Round);n&&(this.$image.width(n),this.$imageCanvas.css({left:(this.$element.width()-this.$image.width())/2,top:(this.$element.height()-this.$image.height())/2}),t=!0),s&&(this.$image.css("transform",0<s?"rotate("+s+"deg)":"none"),t=!0),o&&(this.crop.loadCropRectangle(o),t=!0),r?(this.crop.loadRadius(r),e.Round(i||r),t=!0):e.Round(i),t?this.crop.update():this.fitAndCenterImage(!0)},n.prototype.getAspectRatio=function(){var t=this.binding.aspectRatio;if(t){t=t.split(":");return Number(t[0])/Number(t[1])}return null},n.prototype.fitAndCenterImage=function(t){this.$image.css("width","auto"),this.doesImageFit()||this.fitImage(t),this.$imageCanvas.css({left:(this.$element.width()-this.$image.width())/2,top:(this.$element.height()-this.$image.height())/2}),this.crop.update()},n.prototype.isSafeToFitAndCenterImage=function(){return!this.binding.operations().Crop()},n.prototype.fitImage=function(t){var e,i,n=this.binding.changed,s=ko.unwrap(this.binding.operations).Resize;this.$image.width()>this.$element.width()&&this.$image.width(e=Math.round(this.$element.width())),this.$image.height()>this.$element.height()&&(i=this.$element.height()/this.$image.height(),this.$image.width(e=Math.round(this.$image.width()*i))),e!==s()&&(s(e),t&&this.postback(n))},n.prototype.doesImageFit=function(){return this.$image.width()<=this.$element.width()&&this.$image.height()<=this.$element.height()},n.prototype.applyZoom=function(t,e){var i=this.$image.width(),n=this.$image.height(),s=this.$imageCanvas.position(),o=this.$imageCanvas.offset(),r=ko.unwrap(this.binding.operations),t=Math.round(i+t*this.zoomStep);50<t&&(r.Resize(t),this.$image.width(t),r=this.$image.height(),e?this.$imageCanvas.css({left:s.left-(t-i)*((e.left-o.left)/i),top:s.top-(r-n)*((e.top-o.top)/n)}):this.$imageCanvas.css({left:s.left-(t-i)/2,top:s.top-(r-n)/2})),this.crop.update()},n);function n(){var t=null!==i&&i.apply(this,arguments)||this;return t.isCroppingEnabled=ko.observable(!0),t}t.ImageCrop=e,s.Utils.installBindingHandler("ImageCrop",e)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var a;!function(t){"use strict";var e,i=(e=t.ItemsControlBase,__extends(n,e),Object.defineProperty(n.prototype,"hasValue",{get:function(){return!!this.binding.selectedValues().length},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isTilesView",{get:function(){return"Tiles"===ko.unwrap(this.binding.displayMode)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isListView",{get:function(){return"List"===ko.unwrap(this.binding.displayMode)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"columnLength",{get:function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+":first-child");return Math.floor(this.$list.innerHeight()/t.outerHeight(!0))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"rowLength",{get:function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+":first-child");return Math.floor(this.$list.width()/t.outerWidth(!0))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"pageSize",{get:function(){return this.columnLength*this.rowLength},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.$list=this.$element.children("."+a.BusinessPackCss.primitiveList),this.$selectionBox=this.$element.children("."+a.BusinessPackCss.primitiveSelectionBox),this.$element.focusin(this.onElementFocusin.bind(this)),this.$element.focusout(this.onElementFocusout.bind(this)),this.$element.keydown(this.onElementKeydown.bind(this)),this.$element.keyup(this.onElementKeyup.bind(this)),this.$list.on("click","."+a.BusinessPackCss.primitiveItem+":not(."+a.BusinessPackCss.stateDisabled+")",this.onItemClick.bind(this)),this.$selectionBox.length&&(this.selection=new t.SelectionBox(this.$selectionBox,{$trigger:this.$list}),this.selection.update(this.onSelectionUpdate.bind(this)),this.selection.change(this.onSelectionChange.bind(this))),this.watch(this.binding.dataSource,this.onDataSourceChange),this.watch(this.binding.selectedValues,this.onSelectedValuesChange)},n.prototype.focusItems=function(t){var e=this;this.focusedItemsKeys(t.map(function(t){return e.getItemKey(t)}))},n.prototype.focusItem=function(t,e){(e=void 0===e?!0:e)?this.focusedItemsKeys([this.getItemKey(t)]):this.focusedItemsKeys.push(this.getItemKey(t))},n.prototype.isFocused=function(t){t=this.getItemKey(t);return this.focusedItemsKeys().asLinq().contains(t)},n.prototype.getFocusedItems=function(){var e=this;return this.focusedItemsKeys().map(function(t){return e.findItemByKey(t)})},n.prototype.getSelectedItems=function(){var e=this;return this.selectedItemsKeys().map(function(t){return e.findItemByKey(t)})},n.prototype.toggleItem=function(t){this.isSelected(t)?this.unselectItem(t):this.selectItem(t,1==this.binding.maxSelectedValues)},n.prototype.selectItems=function(t,e){var i=this,n=this.binding.maxSelectedValues;t=t.filter(function(t){return i.isItemEnabled(t)});n=(t=n?t.slice(0,n):t).asLinq().all(function(t){return i.isSelected(t)});this.binding.selectedValues(t.map(function(t){return ko.observable(i.getItemValueCopy(t))})),n?1===t.length&&this.$element.trigger("selectedItemClick",this.getSelectedItems()[0]):this.postback(this.binding.changed),e?this.focusItem(t.pop()):this.focusItem(t[0])},n.prototype.selectItem=function(t,e){var i;void 0===e&&(e=!1),t&&this.isItemEnabled(t)&&(i=ko.observable(this.getItemValueCopy(t)),this.canBeItemAddedToSelectedValues(t,e)?(e&&this.binding.selectedValues([]),this.binding.selectedValues.push(i),this.postback(this.binding.changed),this.focusItem(t,e)):this.isSelected(t)&&this.$element.trigger("selectedItemClick",t))},n.prototype.canBeItemAddedToSelectedValues=function(t,e){var i=this.binding.maxSelectedValues,t=!this.isSelected(t)&&this.isItemEnabled(t);return t=t&&i?(e?0:this.selectedItemsKeys().length)<i:t},n.prototype.isSelected=function(t){t=this.getItemKey(t);return this.selectedItemsKeys().asLinq().contains(t)},n.prototype.unselectItem=function(e){var t,i,n=this;this.isSelected(e)&&(this.binding.selectedValues.setState?(i=(t=__spread(this.binding.selectedValues.state)).findIndex(function(t){return n.isValueOfItem(t,e)}),t.splice(i,1),this.binding.selectedValues.setState(t)):this.binding.selectedValues.remove(function(t){return n.isValueOfItem(t,e)}),this.postback(this.binding.changed),this.focusItem(e))},n.prototype.unselectAllItems=function(){this.hasValue&&(this.binding.selectedValues.removeAll(),this.postback(this.binding.changed))},n.prototype.unfocusAllItems=function(){this.focusedItemsKeys([])},n.prototype.onElementFocusin=function(t){this.$element.addClass(a.BusinessPackCss.stateFocused),this.hasFocus(!0)},n.prototype.onElementFocusout=function(t){this.$element.removeClass(a.BusinessPackCss.stateFocused),this.hasFocus(!1)},n.prototype.onElementKeydown=function(t){if(!this.selection||!this.selection.isActive){if(a.KeyboardKeys.isArrow(t.which)){if(t.stopPropagationAndPreventDefault(),this.arrowHits<3)return void this.arrowHits++;this.arrowHits=0}t.which===a.KeyboardKeys.right?this.isTilesView&&this.focusOrSelectNextItem(t):t.which===a.KeyboardKeys.down?this.isTilesView?this.focusOrSelectItemBelow(t):this.focusOrSelectNextItem(t):t.which===a.KeyboardKeys.left?this.isTilesView&&this.focusOrSelectPrevItem(t):t.which===a.KeyboardKeys.up?this.isTilesView?this.focusOrSelectItemAbove(t):this.focusOrSelectPrevItem(t):t.which===a.KeyboardKeys.home?this.focusOrSelectFirstItem(t):t.ctrlKey||t.which!==a.KeyboardKeys.pageUp?t.which===a.KeyboardKeys.end?this.focusOrSelectLastItem(t):t.ctrlKey||t.which!==a.KeyboardKeys.pageDown?t.ctrlKey&&t.which===a.KeyboardKeys.spacebar&&(t.stopPropagation(),this.toggleFocusedItem()):this.selectItemOnOrUntilNextPage(t):this.selectItemOnOrUntilPrevPage(t)}},n.prototype.onElementKeyup=function(t){this.arrowHits=3},n.prototype.onItemClick=function(t){var e=$(t.currentTarget);e.parent().is(this.$list)&&(t.stopPropagation(),this.scrollToItem(e),t.ctrlKey?this.toggleItem(ko.dataFor(t.currentTarget)):t.shiftKey?this.selectItemsUntil(t.currentTarget):ko.unwrap(this.binding.toggleSelectionOnClick)?this.toggleItem(ko.dataFor(t.currentTarget)):this.selectItem(ko.dataFor(t.currentTarget),!0))},n.prototype.onSelectionUpdate=function(){var t=this.selection.getSelectedItems();this.focusItems(t.map(ko.dataFor)),this.unselectAllItems()},n.prototype.onSelectionChange=function(){this.selection.getSelectedItems().length?this.selectFocusedItems():(this.ensureFocusedItem(),this.unselectAllItems()),this.selection.reset()},n.prototype.onDataSourceChange=function(){var e=this,t=this.focusedItemsKeys().filter(function(t){return null!=e.findItemByKey(t)});!t.length&&this.binding.autoFocusFirstItem?this.focusFirstItem():this.focusedItemsKeys(t),this.onSelectedValuesChange(ko.unwrap(this.binding.selectedValues))},n.prototype.onSelectedValuesChange=function(t){var e,i;a.Utils.clearObservableArray(this.selectedItemsKeys),this.$element.toggleClass(a.BusinessPackCss.stateValueEmpty,0===t.length);try{for(var n=__values(t),s=n.next();!s.done;s=n.next()){var o=s.value,r=this.findItemByValue(o);r?this.selectedItemsKeys.push(this.getItemKey(r)):this.warnThatValueWasNotFound(o)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}},n.prototype.focusOrSelectPrevItem=function(t){t.ctrlKey?this.focusPrevItem():t.shiftKey?this.selectItemsUntilPrev():this.selectPrevItem(!0)},n.prototype.focusPrevItem=function(){var t=this.$list.children("."+a.BusinessPackCss.stateFocused).prevAll(":not(."+a.BusinessPackCss.stateDisabled+"):first");t.length&&(this.scrollToItem(t),this.focusItem(ko.dataFor(t[0])))},n.prototype.focusOrSelectNextItem=function(t){t.ctrlKey?this.focusNextItem():t.shiftKey?this.selectItemsUntilNext():this.selectNextItem(!0)},n.prototype.focusNextItem=function(){var t=this.$list.children("."+a.BusinessPackCss.stateFocused),e=t.nextAll(":not(."+a.BusinessPackCss.stateDisabled+"):first");(e=!e.length&&!t.length?this.$list.children(":not(."+a.BusinessPackCss.stateDisabled+"):first"):e).length&&(this.scrollToItem(e),this.focusItem(ko.dataFor(e[0])))},n.prototype.focusOrSelectItemAbove=function(t){t.ctrlKey?this.focusItemAbove():t.shiftKey?this.selectItemsUntilAbove():this.selectItemAbove()},n.prototype.focusItemAbove=function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+"."+a.BusinessPackCss.stateFocused),t=this.findElementAbove(t);t&&(this.scrollToItem($(t)),this.focusItem(ko.dataFor(t)))},n.prototype.focusOrSelectItemBelow=function(t){t.ctrlKey?this.focusItemBelow():t.shiftKey?this.selectItemsUntilBelow():this.selectItemBelow()},n.prototype.focusItemBelow=function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+"."+a.BusinessPackCss.stateFocused),t=this.findElementBelow(t);t&&(this.scrollToItem($(t)),this.focusItem(ko.dataFor(t)))},n.prototype.focusOrSelectFirstItem=function(t){t.preventDefault(),t.ctrlKey?this.focusFirstItem():t.shiftKey?this.selectItemsUntilFirst():this.selectFirstItem()},n.prototype.focusFirstItem=function(){var t=this.items(),e=this.$list.children("."+a.BusinessPackCss.primitiveItem+":first-child");t.length?(this.scrollToItem(e),this.focusItem(t[0])):this.focusedItemsKeys([])},n.prototype.selectItemOnOrUntilPrevPage=function(t){t.preventDefault(),t.shiftKey||this.selectItemOnPrevPage()},n.prototype.focusOrSelectLastItem=function(t){t.preventDefault(),t.ctrlKey?this.focusLastItem():t.shiftKey?this.selectItemsUntilLast():this.selectLastItem()},n.prototype.focusLastItem=function(){var t=this.items(),e=this.$list.children("."+a.BusinessPackCss.primitiveItem+":last-child");t.length&&(this.scrollToItem(e),this.focusItem(t[t.length-1]))},n.prototype.selectItemOnOrUntilNextPage=function(t){t.preventDefault(),t.shiftKey||this.selectItemOnNextPage()},n.prototype.ensureFocusedItem=function(){!this.focusedItemsKeys().length&&this.binding.autoFocusFirstItem&&this.focusFirstItem()},n.prototype.selectItemsUntilPrev=function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+"."+a.BusinessPackCss.stateFocused).prevAll(":not(."+a.BusinessPackCss.stateDisabled+"):first");t.length&&this.selectItemsUntil(t[0])},n.prototype.selectPrevItem=function(t){t=this.$list.children("."+(t?a.BusinessPackCss.stateFocused:a.BusinessPackCss.stateSelected)).prevAll(":not(."+a.BusinessPackCss.stateDisabled+"):first");t.length&&(this.scrollToItem(t),this.selectItem(ko.dataFor(t[0]),!0))},n.prototype.selectItemsUntilNext=function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+"."+a.BusinessPackCss.stateFocused).nextAll(":not(."+a.BusinessPackCss.stateDisabled+"):first");t.length&&this.selectItemsUntil(t[0])},n.prototype.selectNextItem=function(t){var e=this.$list.children("."+(t?a.BusinessPackCss.stateFocused:a.BusinessPackCss.stateSelected)),t=e.nextAll(":not(."+a.BusinessPackCss.stateDisabled+"):first");(t=!t.length&&!e.length?this.$list.children(":not(."+a.BusinessPackCss.stateDisabled+"):first"):t).length&&(this.scrollToItem(t),this.selectItem(ko.dataFor(t[0]),!0))},n.prototype.selectItemsUntilAbove=function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+"."+a.BusinessPackCss.stateFocused),t=this.findElementAbove(t);t&&this.selectItemsUntil(t)},n.prototype.isItemEnabled=function(t){var e=this.binding.itemEnabledBinding;return!!this.isEnabled&&(!e||ko.unwrap(e(t)))},n.prototype.selectItemAbove=function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+"."+a.BusinessPackCss.stateFocused),t=this.findElementAbove(t);t&&(this.scrollToItem($(t)),this.selectItem(ko.dataFor(t),!0))},n.prototype.selectItemOnPrevPage=function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+"."+a.BusinessPackCss.stateFocused),t=this.findElementOnPrevPage(t);t&&(this.scrollToItem($(t)),this.selectItem(ko.dataFor(t),!0))},n.prototype.selectItemsUntilBelow=function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+"."+a.BusinessPackCss.stateFocused),t=this.findElementBelow(t);t&&this.selectItemsUntil(t)},n.prototype.selectItemBelow=function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+"."+a.BusinessPackCss.stateFocused),t=this.findElementBelow(t);t&&(this.scrollToItem($(t)),this.selectItem(ko.dataFor(t),!0))},n.prototype.selectItemOnNextPage=function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+"."+a.BusinessPackCss.stateFocused),t=this.findElementOnNextPage(t);t&&(this.scrollToItem($(t)),this.selectItem(ko.dataFor(t),!0))},n.prototype.selectItemsUntilFirst=function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+":first-child")[0];t&&this.selectItemsUntil(t)},n.prototype.selectFirstItem=function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+":first-child")[0];t&&(this.scrollToItem($(t)),this.selectItem(ko.dataFor(t),!0))},n.prototype.selectItemsUntilLast=function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+":last-child")[0];t&&this.selectItemsUntil(t)},n.prototype.selectLastItem=function(){var t=this.$list.children("."+a.BusinessPackCss.primitiveItem+":last-child")[0];t&&(this.scrollToItem($(t)),this.selectItem(ko.dataFor(t),!0))},n.prototype.toggleFocusedItem=function(){this.toggleItem(this.getFocusedItems()[0])},n.prototype.selectItemsUntil=function(t){var e=$(t).closest("."+a.BusinessPackCss.primitiveItem),i=this.$list.children("."+a.BusinessPackCss.primitiveItem+"."+a.BusinessPackCss.stateSelected),n=this.$list.children("."+a.BusinessPackCss.primitiveItem+"."+a.BusinessPackCss.stateFocused).first(),s=!0;this.scrollToItem($(t)),i=0===i.not(n).length?n:n.index()<i.last().index()?i.last():i.first(),e.index()<i.index()&&(i=(o=__read([e,i],2))[0],e=o[1],s=!1);var o=i.toArray();i.is(e)||(o=i.nextUntil(e).add(i).add(e).toArray()),this.selectItems(o.map(ko.dataFor),s)},n.prototype.selectFocusedItems=function(){this.selectItems(this.getFocusedItems(),!0)},n.prototype.findElementAbove=function(t){var e=t.index()-this.rowLength,t=this.$list.children("."+a.BusinessPackCss.primitiveItem);return e<0?null:t[e]},n.prototype.findElementOnPrevPage=function(t){var e,i=t.index(),n=this.$list.children("."+a.BusinessPackCss.primitiveItem),t=(i+this.pageSize)%this.pageSize;return t<this.rowLength?(e=i-this.rowLength*this.columnLength)<0?n[0]:n[e]:n[e=i-Math.floor(t/this.rowLength)*this.rowLength]},n.prototype.findElementBelow=function(t){var e=t.index()+this.rowLength,i=this.$list.children("."+a.BusinessPackCss.primitiveItem),n=i.length-1;return n<e?this.isOnLastLine(t)?null:i[n]:i[e]},n.prototype.findElementOnNextPage=function(t){var e,i=t.index(),n=this.$list.children("."+a.BusinessPackCss.primitiveItem),s=(i+this.pageSize)%this.pageSize,o=this.rowLength*(this.columnLength-1),t=n.length-1;return o<=s?t<(e=i+this.rowLength*this.columnLength)?n[t]:n[e]:n[e=i+Math.floor((this.pageSize-1-s)/this.rowLength)*this.rowLength]},n.prototype.scrollToItem=function(t){var e,i,n,s,o;t.length&&(e=this.$list.innerHeight(),i=parseInt(this.$list.css("padding-top")),s=parseInt(this.$list.css("padding-bottom")),n=parseInt(t.css("margin-top")),o=parseInt(t.css("margin-bottom")),i=this.isOnFirstLine(t)?i:n,n=this.isOnLastLine(t)?s:o,o=(s=t.position().top)+t.outerHeight(!0),t=this.$list.scrollTop(),e<o?this.$list.scrollTop(t+(o-e)+n):s<0&&this.$list.scrollTop(t+s-i))},n.prototype.isOnFirstLine=function(t){return t.index()<this.rowLength},n.prototype.isOnLastLine=function(t){var e=this.$list.children("."+a.BusinessPackCss.primitiveItem),i=e.length%this.rowLength,i=e.length-(i||this.rowLength);return t.index()>=i},n.prototype.getItemKeyBinding=function(){return this.binding.itemKeyBinding||this.getItemValueBinding()},n.prototype.getItemValueBinding=function(){return this.binding.itemValueBinding},n.prototype.getItemStyle=function(t){var e;return t=ko.unwrap(t),(e={})[a.BusinessPackCss.stateSelected]=this.isSelected(t),e[a.BusinessPackCss.stateDisabled]=!this.isItemEnabled(t),e[a.BusinessPackCss.stateFocused]=this.hasFocus()&&this.isFocused(t),e},n);function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.focusedItemsKeys=ko.observableArray(),t.selectedItemsKeys=ko.observableArray(),t.arrowHits=3,t.hasFocus=ko.observable(!1),t}t.ListView=i,a.Utils.installBindingHandler("ListView",i)}((a=t.BusinessPack||(t.BusinessPack={})).Controls||(a.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e=(i.prototype.insert=function(t,e){if(!t||e<0||e>=this.mask.length)return!1;if(!this.patterns.get(this.mask[e]))return t===this.mask[e];if(!this.patterns.get(this.mask[e]).test(t))return!1;if(!this.buffer[e])return this.buffer[e]=t,!0;var i=this.getEmptyRight(e);if(i<0||i>=this.buffer.length)return!1;for(var n=i-1;e<=n;n--)if(this.patterns.get(this.mask[n]))if(!this.patterns.get(this.mask[this.getEmptyRight(n)]).test(this.buffer[n]))return!1;for(n=i-1;e<=n;n--)this.patterns.get(this.mask[n])&&(this.buffer[this.getEmptyRight(n)]=this.buffer[n],this.buffer[n]=null);return this.buffer[e]=t,!0},i.prototype.remove=function(t){if(t<0||t>=this.mask.length||!this.buffer[t]||!this.patterns.get(this.mask[t]))return!1;this.buffer[t]=null;for(var e=t+1;e<this.mask.length&&this.buffer[e];e++)if(this.patterns.get(this.mask[e])&&!this.patterns.get(this.mask[this.getEmptyLeft(e)]).test(this.buffer[e]))return!0;for(e=t+1;e<this.mask.length&&this.buffer[e];e++)this.patterns.get(this.mask[e])&&(this.buffer[this.getEmptyLeft(e)]=this.buffer[e],this.buffer[e]=null);return!0},i.prototype.clear=function(){this.buffer=this.mask.split("");for(var t=0;t<this.mask.length;t++)this.patterns.get(this.mask[t])&&(this.buffer[t]=null)},i.prototype.isEmpty=function(){for(var t=0,e=0;e<this.buffer.length;e++)this.buffer[e]||t++;return t===this.placeholderCount},i.prototype.isFull=function(){return-1===this.buffer.indexOf(null)},i.prototype.pushMany=function(t){if(t)for(var e=0;e<t.length;e++)this.insert(t[e],this.getFirstEmpty())},i.prototype.parse=function(t){if(this.clear(),t){for(var e=0;e<this.mask.length;e++)if("_"!==t[e]){var i=this.patterns.get(this.mask[e]);if(i&&!i.test(t[e])||!i&&t[e]!==this.mask[e])break;this.buffer[e]=t[e]}this.pushMany(t.substring(e))}},i.prototype.toString=function(){for(var t="",e=0;e<this.buffer.length;e++)this.buffer[e]?t+=this.buffer[e]:t+="_";return t},i.prototype.getFirstEmpty=function(){for(var t=0;t<this.mask.length;t++)if(this.patterns.get(this.mask[t])&&!this.buffer[t])return t;return this.mask.length},i.prototype.getRight=function(t){for(var e=t+1;e<this.mask.length;e++)if(this.patterns.get(this.mask[e]))return e;return this.mask.length},i.prototype.getLeft=function(t){for(var e=t-1;0<=e;e--)if(this.patterns.get(this.mask[e]))return e;return-1},i.prototype.getThisOrRight=function(t){for(var e=t;e<this.mask.length;e++)if(this.patterns.get(this.mask[e]))return e;return this.mask.length},i.prototype.getThisOrLeft=function(t){for(var e=t;0<=e;e--)if(this.patterns.get(this.mask[e]))return e;return-1},i.prototype.getEmptyRight=function(t){for(var e=t+1;e<this.buffer.length;e++)if(!this.buffer[e])return e;return this.buffer.length},i.prototype.getEmptyLeft=function(t){for(var e=t-1;0<=e;e--)if(!this.buffer[e])return e;return-1},i);function i(t,e){this.patterns=t,this.mask=e,this.clear();for(var i=this.placeholderCount=0;i<this.buffer.length;i++)this.buffer[i]||this.placeholderCount++}t.MaskedTextArray=e}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var f;!function(p){"use strict";var g,t=(g=p.ControlBase,__extends(e,g),e.prototype.initialize=function(){var e,t,i,n,a=this;g.prototype.initialize.call(this),this.$input=this.$element.find("input");var s=ko.isObservable(this.binding.patterns)?new f.KeyValueList(this.binding.patterns.state):this.createDefaultPatterns(),o=new f.KeyValueList([]);try{for(var r=__values(s.items),l=r.next();!l.done;l=r.next())(c=l.value)&&c.Value.ClientRegex&&o.set(c.Key,new RegExp(c.Value.ClientRegex))}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}if(this.binding.additionalPatterns){var u=this.binding.additionalPatterns.state;if(u&&Array.isArray(u)&&0<u.length)try{for(var c,h=__values(u),d=h.next();!d.done;d=h.next())(c=d.value)&&c.Value.ClientRegex&&o.set(c.Key,new RegExp(c.Value.ClientRegex))}catch(t){i={error:t}}finally{try{d&&!d.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}}this.array=new p.MaskedTextArray(o,this.binding.mask),this.lastPostbackValue=ko.isObservable(this.binding.text)?this.binding.text():this.binding.text,this.subscribe(this.binding.text,function(t){a.shouldIgnoreChange?a.shouldIgnoreChange=!1:(a.array.parse(t),a.array.isEmpty()?a.$input.val(null):a.$input.val(a.array.toString()))}),this.$input.focus(function(t){a.$element.addClass(f.BusinessPackCss.stateFocused),a.updateText(a.array.isEmpty()?null:a.array.toString()),a.setCaret(a.array.getFirstEmpty()),a.shouldSetCaretOnMouseup=!0}),this.$input.blur(function(t){a.$element.removeClass(f.BusinessPackCss.stateFocused),a.array.isEmpty()&&a.updateText(null);var e=a.array.toString();e!=a.lastPostbackValue&&(a.postback(a.binding.changed),a.lastPostbackValue=e)}),this.$input.on("paste",function(t){var e;f.Browser.isIe||a.hasSelection()||(e=t.originalEvent.clipboardData.getData("Text"),a.array.pushMany(e),a.updateText(a.array.toString()),a.setCaret(a.array.getFirstEmpty()),t.preventDefault())}),this.$input.on("keydown keypress keyup",function(t){a.oldCaret=a.$input.get(0).selectionStart}),this.$input.mouseup(function(t){return a.shouldSetCaretOnMouseup?(a.shouldSetCaretOnMouseup=!1,void a.setCaret(a.array.getFirstEmpty())):void(a.oldCaret=a.$input.get(0).selectionStart)}),this.$input.input(function(t){var e=a.$input.val(),i=a.oldValue?e.length-a.oldValue.length:1/0;if(1!==Math.abs(i))return a.array.parse(e),a.updateText(a.array.toString()),void a.setCaret(a.array.getFirstEmpty());var n=a.$input.get(0).selectionStart;if(0<i&&n===a.oldCaret+1){var s=a.oldCaret;return(r=a.array.insert(e[a.oldCaret],s))||(s=a.array.getThisOrRight(s),r=a.array.insert(e[a.oldCaret],s)),a.updateText(a.array.toString()),void a.setCaret(r?a.array.getRight(s):a.oldCaret)}if(i<0&&n===a.oldCaret-1){var o=a.array.getThisOrLeft(n),r=a.array.remove(o);return a.updateText(a.array.toString()),void a.setCaret(r?o:a.oldCaret)}if(i<0&&n===a.oldCaret){o=a.array.getThisOrRight(a.oldCaret),r=a.array.remove(o);return a.updateText(a.array.toString()),void a.setCaret(r?o:a.oldCaret)}throw a.updateText(a.oldValue),a.setCaret(a.oldCaret),new Error("An unrecognized input change occurred. Maybe value or caret retention is broken.")})},e.prototype.setCaret=function(t,e){void 0===e&&(e=!1);var i=this.$input.get(0);!e&&i.selectionStart!=i.selectionEnd||(this.oldCaret=t,i.selectionStart=t,i.selectionEnd=t)},e.prototype.updateText=function(t){ko.isWriteableObservable(this.binding.text)&&(this.shouldIgnoreChange=!0,this.binding.text(t)),this.oldValue=t,this.$input.val(t)},e.prototype.hasSelection=function(){var t=this.$input.get(0);return t.selectionStart!=t.selectionEnd},e.prototype.createDefaultPatterns=function(){return f.KeyValueList.FromObject({0:{ClientRegex:"\\d"},9:{ClientRegex:"\\d|\\s"},"#":{ClientRegex:"\\d|\\+|-|\\s"},L:{ClientRegex:"[a-zA-Z]"},"?":{ClientRegex:"[a-zA-Z]|\\s"},"&":{ClientRegex:"\\S"},C:{ClientRegex:"."},A:{ClientRegex:"[a-zA-Z]|\\d"},a:{ClientRegex:"[a-zA-Z]|\\d|\\s"}})},e);function e(){var t=null!==g&&g.apply(this,arguments)||this;return t.shouldIgnoreChange=!1,t.shouldSetCaretOnMouseup=!1,t}p.MaskedTextBox=t,f.Utils.installBindingHandler("MaskedTextBox",t)}((f=t.BusinessPack||(t.BusinessPack={})).Controls||(f.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var i,e=(i=t.ButtonBase,__extends(n,i),n.prototype.initialize=function(){var e=this;i.prototype.initialize.call(this),this.$element.click(function(t){return e.onElementClick(t)})},Object.defineProperty(n.prototype,"dialog",{get:function(){return ko.contextFor(this.$element[0].parentNode).$bpControl},enumerable:!0,configurable:!0}),n.prototype.onElementClick=function(t){this.isEnabled&&(t.stopPropagationAndPreventDefault(),this.onClickAction())},n);function n(){return null!==i&&i.apply(this,arguments)||this}t.DialogButtonBase=e}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.DialogButtonBase,__extends(n,e),n.prototype.onClickAction=function(){this.dialog.isDisplayed=!1},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.CloseDialogButton=i,s.Utils.installBindingHandler("CloseDialogButton",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var d;!function(t){"use strict";var i,e=(i=t.ControlBase,__extends(h,i),Object.defineProperty(h.prototype,"isDisplayed",{get:function(){return null!=this.binding.isDisplayed&&ko.unwrap(this.binding.isDisplayed)},set:function(t){t?this.open():this.close();var e=this.binding.isDisplayed,i=ko.unwrap(e);ko.isWriteableObservable(e)&&e(t||!1),i&&!t?this.fireClosedEvent():t&&this.fireDisplayedEvent()},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"closeOnOutsideClick",{get:function(){return ko.unwrap(this.binding.closeOnOutsideClick)},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"closeOnEscape",{get:function(){return ko.unwrap(this.binding.closeOnEscape)},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"overlay",{get:function(){if(null!=this._overlay)return this._overlay;var t=document.createElement("div");return t.classList.add(d.BusinessPackCss.primitiveOverlay),t.classList.add(d.BusinessPackCss.control),this.element&&this.element.parentElement&&(this.element.parentElement.insertBefore(t,this.element),this._overlay=t),t},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"showOverlay",{get:function(){return ko.unwrap(this.binding.showOverlay)},enumerable:!0,configurable:!0}),h.prototype.isOverlayVisible=function(){return!!this.overlay&&"none"!==this.overlay.style.display},Object.defineProperty(h.prototype,"isTopMostOpenedDialog",{get:function(){return h.topMostOppenedDialog===this},enumerable:!0,configurable:!0}),Object.defineProperty(h,"topMostOppenedDialog",{get:function(){return h.openedDialogs[h.openedDialogs.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"$dialog",{get:function(){return this.$element},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"element",{get:function(){return this.$element.get(0)},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"dialog",{get:function(){return this.$dialog.get(0)},enumerable:!0,configurable:!0}),h.prototype.initialize=function(){var e=this;i.prototype.initialize.call(this),this.disposing(function(){return e.dispose}),this.$element.focusin(function(){return e.focusInside=!0}),this.$element.focusout(function(){return e.focusInside=!1}),this.$element.mousedown(function(t){$(t.target).closest("."+d.BusinessPackCss.dialog)[0]===e.$element[0]&&e.bringToFront()}),this.outside("mousedown",function(t){e.outsideClickDetected(t)}),this.$element.mousedown(function(t){t=t.target;e.closeOnOutsideClick&&e.isOutsideDialogElement(t)&&(e.isDisplayed=!1)}),h.escapeEventRegistered||(h.escapeEventRegistered=!0,$(document).on("keydown",function(t){d.KeyboardKeys.isEscape(t.which)&&(h.escapePressDetected(),t.stopPropagation())})),this.subscribe(this.binding.isDisplayed,function(t){null!=t&&(e.isDisplayed=t)})},h.prototype.isOutsideDialogElement=function(t){return!t||!this.$dialog.is(t)&&0===this.$dialog.find($(t)).length},h.prototype.dispose=function(){0===h.openedDialogs.indexOf(this)&&this.setOverflow(!1)},h.escapePressDetected=function(){var t;0===this.openedDialogs.length||(t=this.openedDialogs[this.openedDialogs.length-1]).closeOnEscape&&(t.isDisplayed=!1)},h.prototype.outsideClickDetected=function(t){this.closeOnOutsideClick&&this.isTopMostOpenedDialog&&(this.isDisplayed=!1)},h.prototype.close=function(){this.changeVisibility(!1);var t=h.openedDialogs.indexOf(this);-1!==t&&h.openedDialogs.splice(t,1),this.showOverlay&&(this.hideOverlay(),this.showOverlayOfTopMostOppenedDialog())},h.prototype.fireClosedEvent=function(){this.postback(this.binding.closed)},h.prototype.fireDisplayedEvent=function(){this.postback(this.binding.displayed)},h.prototype.showOverlayOfTopMostOppenedDialog=function(){for(var t=h.openedDialogs.length-1;0<=t;){if(h.openedDialogs[t].showOverlay)return void h.openedDialogs[t].showShowOverlay();t--}},h.prototype.open=function(){this.changeVisibility(!0),-1===h.openedDialogs.indexOf(this)&&h.openedDialogs.push(this),this.bringToFront(),d.FocusManager.autoFocus(this.$dialog),this.showOverlay&&(h.hideAllOverlays(),this.showShowOverlay())},h.hideAllOverlays=function(){var e,t;try{for(var i=__values(h.openedDialogs),n=i.next();!n.done;n=i.next())n.value.hideOverlay()}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},h.prototype.hideOverlay=function(){this.showOverlay&&this.isOverlayVisible()&&(this.overlay.style.display="none",this.setOverflow(!1))},h.prototype.setOverflow=function(t){var e=$("body");t?e.css("overflow","hidden"):e.css("overflow","")},h.prototype.showShowOverlay=function(){this.overlay.style.zIndex=String(parseInt(this.element.style.zIndex)-1),this.overlay.style.display="block",this.dialog.classList.add(d.BusinessPackCss.stateOpened),this.element.classList.add(d.BusinessPackCss.stateOpened),this.setOverflow(!0)},h.prototype.bringToFront=function(){var e,t,i,n,s=h.openedDialogs.indexOf(this);s===h.openedDialogs.length-1&&(this.focusInside||this.dialog.focus()),-1!==s&&h.openedDialogs.splice(s,1),h.openedDialogs.push(this),$($.map(h.openedDialogs,function(t){return t.$element})).removeClass(d.BusinessPackCss.stateActive);var o=1e3;try{for(var r=__values(h.openedDialogs),a=r.next();!a.done;a=r.next())(l=a.value).element.style.zIndex=String(o+1),l.overlay.style.zIndex=String(o),o+=10}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}o*=h.openedDialogs.length,this.element.style.zIndex=String(o+1),this.overlay.style.zIndex=String(o);try{for(var l,u=__values(h.openedDialogs),c=u.next();!c.done;c=u.next())!function(t){var i=Number(t.$element.css("z-index"));t.$element.parents("."+d.BusinessPackCss.dialog).each(function(t,e){return i+=Number($(e).css("z-index"))}),t.element.style.zIndex=String(i+1),t.overlay.style.zIndex=String(i)}(l=c.value)}catch(t){i={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}h.openedDialogs.sort(function(t,e){return+(Number(t.$element.css("z-index"))>Number(e.$element.css("z-index")))||+(Number(t.$element.css("z-index"))===Number(e.$element.css("z-index"))-1)});s=h.openedDialogs[h.openedDialogs.length-1];s.$element.addClass(d.BusinessPackCss.stateActive),s.focusInside||s.$element.focus()},h.prototype.changeVisibility=function(t){null!=t&&(t?(this.bringToFront(),this.dialog.style.display="flex",this.dialog.classList.add(d.BusinessPackCss.stateOpened),this.element.classList.add(d.BusinessPackCss.stateOpened)):(this.dialog.style.display="none",this.dialog.classList.remove(d.BusinessPackCss.stateOpened),this.element.classList.remove(d.BusinessPackCss.stateOpened)))},h.prototype.checkIfDialogIsNotOutsideOfViewport=function(){var t=this.getOnScreenPosition(this.$dialog);return t.left>this.$window.innerWidth()||t.top>this.$window.innerHeight()},h.prototype.getOnScreenPosition=function(t){t=t.offset();return{top:t.top-$(window).scrollTop(),left:t.left-$(window).scrollLeft()}},h.prototype.pauseEvent=function(t){return t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.cancelBubble=!0,t.returnValue=!1},h.prototype.isInlineHeightSet=function(){return null!=this.dialog.style.height},h.prototype.isInlineWidthSet=function(){return null!=this.dialog.style.width},h.prototype.setInlineHeight=function(t){this.dialog.style.height=t},h.prototype.setInlineWidth=function(t){this.dialog.style.width=t},h.openedDialogs=new Array,h.escapeEventRegistered=!1,h);function h(){var t=null!==i&&i.apply(this,arguments)||this;return t.focusInside=!1,t}t.DialogBase=e}((d=t.BusinessPack||(t.BusinessPack={})).Controls||(d.Controls={}))}(DotVVM=DotVVM||{}),function(t){(t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={})}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";(t=t.HorizontalAlignment||(t.HorizontalAlignment={})).Left="Left",t.Center="Center",t.Right="Right"}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.DialogButtonBase,__extends(n,e),n.prototype.onClickAction=function(){this.dialog.windowState=t.WindowState.Maximized},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.MaximizeDialogButton=i,s.Utils.installBindingHandler("MaximizeDialogButton",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.DialogBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.initSize(),this.updatePositioning(),this.subscribe(this.binding.horizontalAlignment,this.updateHorizontalPositioning.bind(this)),this.subscribe(this.binding.verticalAlignment,this.updateVerticalPositioning.bind(this)),this.subscribe(this.binding.widthRequest,this.updateWidth.bind(this)),this.subscribe(this.binding.heightRequest,this.updateHeight.bind(this))},n.prototype.initSize=function(){this.updateWidth(),this.updateHeight(),window.addEventListener("resize",this.onWindowResize.bind(this))},n.prototype.dispose=function(){e.prototype.dispose.call(this),window.removeEventListener("resize",this.onWindowResize.bind(this))},Object.defineProperty(n.prototype,"$dialog",{get:function(){return this.$element.children("."+s.BusinessPackCss.dialog)},enumerable:!0,configurable:!0}),n.prototype.onWindowResize=function(t){this.updateWidth(),this.updateHeight()},n.prototype.getHorizontalMargin=function(){if(window.getComputedStyle){var t=window.getComputedStyle(this.dialog),e=t.getPropertyValue("margin-left"),t=t.getPropertyValue("margin-right");return parseInt(e,10)+parseInt(t,10)}if(this.dialog.currentStyle){e=this.dialog.currentStyle.marginLeft,t=this.dialog.currentStyle.marginRight;return parseInt(e,10)+parseInt(t,10)}return 0},n.prototype.updateWidth=function(){var t,e=ko.unwrap(this.binding.widthRequest);e?(t=window.innerWidth-this.getHorizontalMargin(),e=Math.min(t,Number(e)),e=this.addUnitOfMeasurement(e),this.setInlineWidth(e)):this.isInlineWidthSet()&&this.setInlineWidth(null)},n.prototype.getVerticalMargin=function(){if(window.getComputedStyle){var t=window.getComputedStyle(this.dialog),e=t.getPropertyValue("margin-top"),t=t.getPropertyValue("margin-bottom");return parseInt(e,10)+parseInt(t,10)}if(this.dialog.currentStyle){e=this.dialog.currentStyle.marginTop,t=this.dialog.currentStyle.marginBottom;return parseInt(e,10)+parseInt(t,10)}return 0},n.prototype.updateHeight=function(){var t,e=ko.unwrap(this.binding.heightRequest);e?(t=window.innerHeight-this.getVerticalMargin(),e=Math.min(t,Number(e)),e=this.addUnitOfMeasurement(e),this.setInlineHeight(e)):this.isInlineHeightSet()&&this.setInlineHeight(null)},n.prototype.addUnitOfMeasurement=function(t){return t+"px"},n.prototype.updatePositioning=function(){this.updateVerticalPositioning(),this.updateHorizontalPositioning()},n.prototype.updateVerticalPositioning=function(){switch(this.removeVerticalPositioning(),ko.unwrap(this.binding.verticalAlignment)){case t.VerticalAlignment.Top:this.element.classList.add(s.BusinessPackCss.dialogVerticalAlignTop);break;case t.VerticalAlignment.Center:this.element.classList.add(s.BusinessPackCss.dialogVerticalAlignCenter);break;case t.VerticalAlignment.Bottom:this.element.classList.add(s.BusinessPackCss.dialogVerticalAlignBottom)}},n.prototype.removeVerticalPositioning=function(){this.element.classList.remove(s.BusinessPackCss.dialogVerticalAlignTop),this.element.classList.remove(s.BusinessPackCss.dialogVerticalAlignCenter),this.element.classList.remove(s.BusinessPackCss.dialogVerticalAlignBottom)},n.prototype.updateHorizontalPositioning=function(){switch(this.removeHorizontalPositioning(),ko.unwrap(this.binding.horizontalAlignment)){case t.HorizontalAlignment.Left:this.element.classList.add(s.BusinessPackCss.dialogHorizontalAlignLeft);break;case t.HorizontalAlignment.Center:this.element.classList.add(s.BusinessPackCss.dialogHorizontalAlignCenter);break;case t.HorizontalAlignment.Right:this.element.classList.add(s.BusinessPackCss.dialogHorizontalAlignRight)}},n.prototype.removeHorizontalPositioning=function(){this.element.classList.remove(s.BusinessPackCss.dialogHorizontalAlignLeft),this.element.classList.remove(s.BusinessPackCss.dialogHorizontalAlignCenter),this.element.classList.remove(s.BusinessPackCss.dialogHorizontalAlignRight)},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.ModalDialog=i,s.Utils.installBindingHandler("ModalDialog",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){(t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={})}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.DialogButtonBase,__extends(n,e),n.prototype.onClickAction=function(){this.dialog.windowState=t.WindowState.Normal},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.RestoreDialogButton=i,s.Utils.installBindingHandler("RestoreDialogButton",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";(t=t.VerticalAlignment||(t.VerticalAlignment={})).Top="Top",t.Center="Center",t.Bottom="Bottom"}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(n){var d;!function(h){"use strict";var i,t=(i=h.DialogBase,__extends(e,i),Object.defineProperty(e.prototype,"width",{get:function(){return ko.unwrap(this.binding.width)},set:function(t){var e=this.binding.width;ko.isWriteableObservable(e)&&e(t||null)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return ko.unwrap(this.binding.height)},set:function(t){var e=this.binding.height;ko.isWriteableObservable(e)&&e(t||null)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"allowResize",{get:function(){return null!=this.binding.allowResize&&ko.unwrap(this.binding.allowResize)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"deathZoneSize",{get:function(){return null==this.binding.deathZoneSize?0:ko.unwrap(this.binding.deathZoneSize)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"initialPositionLeft",{get:function(){var t=this.binding.initialPositionLeft;return null==t?null:isNaN(Number(t))?t:t+"px"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"initialPositionTop",{get:function(){var t=this.binding.initialPositionTop;return null==t?null:isNaN(Number(t))?t:t+"px"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"initialPositionBottom",{get:function(){var t=this.binding.initialPositionBottom;return null==t?null:isNaN(Number(t))?t:t+"px"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"initialPositionRight",{get:function(){var t=this.binding.initialPositionRight;return null==t?null:isNaN(Number(t))?t:t+"px"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"allowMove",{get:function(){return ko.unwrap(this.binding.allowMove)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"windowState",{get:function(){return h.WindowState[ko.unwrap(this.binding.windowState)]},set:function(t){var e=t!==this.windowState;switch(t){case h.WindowState.Maximized:!e&&null!=this.sizeBeforeMaximize&&null!=this.possitionBeforeMaximize||(this.sizeBeforeMaximize={height:this.$element.css("height"),width:this.$element.css("width")},this.possitionBeforeMaximize={x:this.$element.css("left"),y:this.$element.css("top")}),this.applyDialogTransformations(this.deathZoneSize,this.deathZoneSize,$(window).width()-2*this.deathZoneSize,$(window).height()-2*this.deathZoneSize);break;case h.WindowState.Normal:e&&(this.applyDialogTransformations(this.possitionBeforeMaximize.x,this.possitionBeforeMaximize.y,this.sizeBeforeMaximize.width,this.sizeBeforeMaximize.height),this.possitionBeforeMaximize=null,this.sizeBeforeMaximize=null)}this.toogleResizeHandles(t!==h.WindowState.Maximized),e&&this.binding.windowState(h.WindowState[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isMaximized",{get:function(){return this.windowState===h.WindowState.Maximized},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isMooving",{get:function(){return this.$element.hasClass(d.BusinessPackCss.stateMoving)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isResizing",{get:function(){return this.$element.hasClass(d.BusinessPackCss.stateResizing)},enumerable:!0,configurable:!0}),e.prototype.initialize=function(){var e=this;i.prototype.initialize.call(this),this.$header.on("touchstart mousedown",function(t){return e.allowMove&&!e.isMouseCursorOverDialogButton(t)&&e.startMoveDrag(n.BusinessPack.Utils.convertTouchToMouseEvent(t))}),this.allowResize&&this.initResizing(),$(window).on("orientationchange",function(){e.$element.is(":hidden")||e.checkIfDialogIsNotOutsideOfViewport()&&e.moveToInitialPosition(!0)}),this.applyDialogTransformations(void 0,void 0,this.width,this.height),$(window).resize(function(){return e.initSizeLimits()}),this.initSizeLimits(),this.initSize(),ko.isObservable(this.binding.windowState)||(this.binding.windowState=ko.observable(this.binding.windowState)),this.subscribe(this.binding.width,function(){return e.setElementWidth()}),this.subscribe(this.binding.height,function(){return e.setElementHeight()}),this.subscribe(this.binding.windowState,function(){return e.windowState=e.windowState}),this.subscribe(this.binding.allowMove,function(t){return t?e.$header.addClass(d.BusinessPackCss.windowMovable):e.$header.removeClass(d.BusinessPackCss.windowMovable)});function t(){e.isDisplayed&&e.windowState===h.WindowState.Maximized&&(e.windowState=h.WindowState.Maximized)}$(document).on("scroll",t),$(window).on("resize",t)},e.prototype.isMouseCursorOverDialogButton=function(t){return this.isTargetElementDialogButton(t)||this.isTargetElementInsideDialogButton(t)},e.prototype.isTargetElementDialogButton=function(t){return t.target.classList.contains(d.BusinessPackCss.primitiveButton)},e.prototype.isTargetElementInsideDialogButton=function(t){return $(t.target).parentsUntil(d.BusinessPackCss.primitiveContainer).toArray().asLinq().any(function(t){return t.classList.contains(d.BusinessPackCss.primitiveButton)})},e.prototype.initSize=function(){this.setElementWidth(),this.setElementHeight()},e.prototype.setElementWidth=function(){if(null!=this.width){var t=ko.unwrap(this.width),e="";switch(typeof t){case"number":e=t+"px";break;case"string":e=t}this.setInlineWidth(e)}},e.prototype.setElementHeight=function(){if(null!=this.height){var t=ko.unwrap(this.height),e="";switch(typeof t){case"number":e=t+"px";break;case"string":e=t}this.setInlineHeight(e)}},e.prototype.moveToInitialPosition=function(t){var e,i,n,s,o,r=this;!(t=void 0===t?!1:t)&&this.wasMoved||(e=this.initialPositionLeft,i=this.initialPositionTop,n=this.initialPositionBottom,s=this.initialPositionRight,t=this.calculateInitialPosition(),null!=e?(this.$element.css("right",""),this.$element.css("left",e)):null!=s?(this.$element.css("left",""),this.$element.css("right",s)):(this.$element.css("right",""),this.$element.css("left",t.x)),null!=i?(this.$element.css("bottom",""),this.$element.css("top",i)):null!=n?(this.$element.css("top",""),this.$element.css("bottom",n)):(this.$element.css("bottom",""),this.$element.css("top",t.y)),o=this.$element,(o=(o="function"==typeof jQuery&&o instanceof jQuery?o[0]:o).getBoundingClientRect()).bottom>$(window).height()&&r.$element.css("top",$(window).height()-o.height),o.right>$(window).width()&&r.$element.css("left",$(window).width()-o.width))},e.prototype.changeVisibility=function(t){i.prototype.changeVisibility.call(this,t),t&&(this.windowState=this.windowState,this.wasEverDisplayed||this.moveToInitialPosition(),this.wasEverDisplayed=!0)},e.prototype.outsideClickDetected=function(t){this.isMooving||this.isResizing||i.prototype.outsideClickDetected.call(this,t)},e.prototype.calculateInitialPosition=function(){var t=$("."+d.BusinessPackCss.window+":visible"),e=0<t.length-2?t.length-2:0,e=e==(1<t.length?1+e:e)?this.getNewCoordinatesForFirstWindow():this.getNewCoordinatesForAnotherWindow(t[e]);return{x:e.newX,y:e.newY}},e.prototype.getNewCoordinatesForFirstWindow=function(){return{newX:$(window).width()/2-this.$element.width()/2,newY:$(window).height()/20}},e.prototype.getNewCoordinatesForAnotherWindow=function(t){return{newX:t.offsetLeft+50,newY:t.offsetTop+50}},e.prototype.startMoveDrag=function(t){var e=this;this.bringToFront();var i=this.$element[0].getBoundingClientRect(),n=this.getOffsetTop(this.$element.get(0));this.mousePositionOnMoveStarted={x:t.clientX-i.left,y:t.clientY-i.top};i=Math.max($(window).width(),$(document).width())-this.$element.width()-this.deathZoneSize-n.left,n=Math.max($(window).height(),$(document).height())-this.$element.height()-this.deathZoneSize-n.top;this.maxCoordinatesOnMoveStarted={x:i,y:n},this.mousePositionOnLastDragUpdate={x:t.clientX,y:t.clientY};function s(t){return e.moveDrag(d.Utils.convertTouchToMouseEvent(t))}this.$element.addClass(d.BusinessPackCss.stateMoving),this.pauseEvent(t),$(document).on("mouseup touchend",function(t){$(document).off("mousemove touchmove",s),setTimeout(function(){return e.$element.removeClass(d.BusinessPackCss.stateMoving)},1)}),$(document).on("mousemove touchmove",s)},e.prototype.moveDrag=function(t){var e,i,n,s;this.windowState!==h.WindowState.Maximized&&(this.wasMoved=!0,e=this.getOffsetTop(this.$element.get(0)),i=t.clientX+$(window).scrollLeft()-e.left-this.mousePositionOnMoveStarted.x,n=t.clientY+$(window).scrollTop()-e.top-this.mousePositionOnMoveStarted.y,s=this.maxCoordinatesOnMoveStarted.x,t=this.maxCoordinatesOnMoveStarted.y,i!==(s=this.constrain(i,+this.deathZoneSize-e.left,s-this.deathZoneSize))&&(i=s),n!==(t=this.constrain(n,+this.deathZoneSize-e.top,t-this.deathZoneSize))&&(n=t),this.applyDialogTransformations(i,n,void 0,void 0))},e.prototype.initSizeLimits=function(){var t=parseInt(this.$element.css("min-width").replace("px","")),e=parseInt(this.$element.css("min-height").replace("px",""));this.sizeLimits={minWidth:this.binding.minWidth>t?this.binding.minWidth:t,maxWidth:$(window).width()-this.deathZoneSize,minHeight:this.binding.minHeight>e?this.binding.minHeight:e,maxHeight:$(window).height()-this.deathZoneSize},this.sizeLimits.maxHeight<this.$element.height()&&(this.sizeLimits.maxHeight=this.$element.height()),this.sizeLimits.maxWidth<this.$element.width()&&(this.sizeLimits.maxWidth=this.$element.width()),this.$element.css("max-width",this.sizeLimits.maxWidth||""),this.$element.css("max-height",this.sizeLimits.maxHeight||"")},e.prototype.initResizing=function(){var e=this;$(document).on("keyup keydown",function(t){e.shiftKeyPressed=t.shiftKey});var t=this.$element.children("."+d.BusinessPackCss.primitiveContainer);t.children("."+d.BusinessPackCss.primitiveGripN).on("touchstart mousedown",function(t){return e.startResizeDragDrag(d.Utils.convertTouchToMouseEvent(t),"n")}),t.children("."+d.BusinessPackCss.primitiveGripNE).on("touchstart mousedown",function(t){return e.startResizeDragDrag(d.Utils.convertTouchToMouseEvent(t),"ne")}),t.children("."+d.BusinessPackCss.primitiveGripE).on("touchstart mousedown",function(t){return e.startResizeDragDrag(d.Utils.convertTouchToMouseEvent(t),"e")}),t.children("."+d.BusinessPackCss.primitiveGripSE).on("touchstart mousedown",function(t){return e.startResizeDragDrag(d.Utils.convertTouchToMouseEvent(t),"se")}),t.children("."+d.BusinessPackCss.primitiveGripS).on("touchstart mousedown",function(t){return e.startResizeDragDrag(d.Utils.convertTouchToMouseEvent(t),"s")}),t.children("."+d.BusinessPackCss.primitiveGripSW).on("touchstart mousedown",function(t){return e.startResizeDragDrag(d.Utils.convertTouchToMouseEvent(t),"sw")}),t.children("."+d.BusinessPackCss.primitiveGripW).on("touchstart mousedown",function(t){return e.startResizeDragDrag(d.Utils.convertTouchToMouseEvent(t),"w")}),t.children("."+d.BusinessPackCss.primitiveGripNW).on("touchstart mousedown",function(t){return e.startResizeDragDrag(d.Utils.convertTouchToMouseEvent(t),"nw")})},e.prototype.startResizeDragDrag=function(t,e){var i=this;this.wasResized=!0,this.bringToFront(),this.mousePositionOnLastDragUpdate={x:t.clientX,y:t.clientY},this.aspectRatio=this.$element.height()/this.$element.width();function n(t){return i.resizeDrag(d.Utils.convertTouchToMouseEvent(t),e)}this.$element.addClass(d.BusinessPackCss.stateResizing),this.pauseEvent(t),$(document).on("mouseup touchend",function(t){$(document).off("mousemove touchmove",n),setTimeout(function(){return i.$element.removeClass(d.BusinessPackCss.stateResizing)},1)}),$(document).on("mousemove touchmove",n)},e.prototype.constrain=function(t,e,i){return i<t?i:t<e?e:t},e.prototype.resizeDrag=function(t,e,i){var n,s,o,r,a,l,u,c;void 0===i&&(i=!1),this.windowState!==h.WindowState.Maximized&&(this.pauseEvent(t),this.allowResize&&(u=this.mousePositionOnLastDragUpdate.y-t.clientY,c=t.clientY-this.mousePositionOnLastDragUpdate.y,n=t.clientX-this.mousePositionOnLastDragUpdate.x,s=this.mousePositionOnLastDragUpdate.x-t.clientX,i&&(n*=2,s*=2),0<=e.indexOf("e")?o=this.$element.width()+n:0<=e.indexOf("w")&&(a=this.$element.position().left-s,o=this.$element.width()+s),this.shiftKeyPressed&&2<=e.length?r=o*this.aspectRatio|0:0<=e.indexOf("s")?r=this.$element.height()+c:0<=e.indexOf("n")&&(l=this.$element.position().top-u,r=this.$element.height()+u),c=t.clientX<this.deathZoneSize||t.clientX>$(window).width()-this.deathZoneSize,e=t.clientY<this.deathZoneSize||t.clientY>$(window).height()-this.deathZoneSize,u=this.constrain(r,this.sizeLimits.minHeight,this.sizeLimits.maxHeight),c=this.constrain(o,this.sizeLimits.minWidth,this.sizeLimits.maxWidth)===o&&!c,null!=r&&(u===r&&!e)?this.mousePositionOnLastDragUpdate.y=t.clientY:null!=r&&(l=r=void 0,d.Utils.warnInDebugMode("MAX / MIN height exceeded")),null!=o&&c?this.mousePositionOnLastDragUpdate.x=t.clientX:null!=o&&(a=o=void 0,d.Utils.warnInDebugMode("MAX / MIN width exceeded")),this.applyDialogTransformations(a,l,o,r)))},e.prototype.getOffsetTop=function(t){if(!t)return{left:0,top:0};for(var e={left:0,top:0},i=t;i.offsetParent;)"relative"===window.getComputedStyle(i.offsetParent).position&&(e.top+=i.offsetParent.offsetTop,e.left+=i.offsetParent.offsetLeft),i=i.offsetParent;return e},e.prototype.applyDialogTransformations=function(t,e,i,n){if(null!=t){var s=void 0;switch(typeof t){case"number":s=t+"px";break;case"string":s=t}this.$element.css("left",s)}if(null!=e){var o=void 0;switch(typeof e){case"number":o=e+"px";break;case"string":o=e}this.$element.css("top",o)}if(null!=i)if("auto"!=i){var r="";switch(typeof i){case"number":r=i+"px";break;case"string":r=i}this.setInlineWidth(r),this.width=r}else this.$element.css("width",null),this.width=null;if(null!=n)if("auto"!=n){var a="";switch(typeof n){case"number":a=n+"px";break;case"string":a=n}this.setInlineHeight(a),this.height=a}else this.$element.css("height",null),this.height=null},e.prototype.toogleResizeHandles=function(t){var e=this.$element.find("."+d.BusinessPackCss.primitiveGrip);(t=null==t?e.is(":visible"):t)?e.show():e.hide()},e);function e(){var t=null!==i&&i.apply(this,arguments)||this;return t.$header=t.$element.children("."+d.BusinessPackCss.primitiveContainer).children("."+d.BusinessPackCss.primitiveHeader),t.wasEverDisplayed=!1,t}h.Window=t,d.Utils.installBindingHandler("Window",t)}((d=n.BusinessPack||(n.BusinessPack={})).Controls||(d.Controls={}))}(DotVVM=DotVVM||{}),function(t){(t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={})}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";(t=t.WindowState||(t.WindowState={}))[t.Normal=0]="Normal",t[t.Maximized=1]="Maximized"}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var u;!function(e){"use strict";var i,t=(i=e.SelectorBase,__extends(n,i),n.prototype.initialize=function(){var t=this;i.prototype.initialize.call(this),this.$textBox=this.$element.children("."+u.BusinessPackCss.primitiveTextBox),this.$popup=this.$element.children("."+u.BusinessPackCss.primitivePopup),this.$resultsView=this.$popup.children("."+u.BusinessPackCss.listView),this.popupPanel=new e.PopupPanel(this.$popup),this.$element.mousedown(this.onElementMousedown.bind(this)),this.$element.keydown(this.onElementKeydown.bind(this)),this.$element.keyup(this.onElementKeyup.bind(this)),this.$element.on("mousedown","."+u.BusinessPackCss.primitiveValue,function(t){return t.preventDefault()}),this.$element.on("click","."+u.BusinessPackCss.primitiveValue+" ."+u.BusinessPackCss.commandUnselect,this.onUnselectButtonClick.bind(this)),this.$textBox.focus(this.onTextBoxFocus.bind(this)),this.$textBox.blur(this.onTextBoxBlur.bind(this)),this.$textBox.mousedown(function(t){return t.stopPropagation()}),this.$textBox.keydown(this.onTextBoxKeydown.bind(this)),this.$textBox.input(this.onTextBoxInput.bind(this)),this.$popup.mousedown(function(t){return t.preventDefault()}),this.outside("mousedown",function(){return t.togglePopup(!1)}),this.watch(this.binding.selectedValues,this.onSelectedValuesChange),this.subscribe(this.searchResults,this.onSearchResultsChange),this.binding.allowNewItems||u.DeviceUtils.addMobileOrTabletProp(this.$textBox,"readonly",!0)},Object.defineProperty(n.prototype,"isOpened",{get:function(){return this.popupPanel.isOpened},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hasValue",{get:function(){return!!this.binding.selectedValues().length},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"resultsView",{get:function(){return this.$resultsView.data("ListView")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"allowNewItems",{get:function(){return ko.unwrap(this.binding.allowNewItems)},enumerable:!0,configurable:!0}),n.prototype.togglePopup=function(t){t=(t=void 0===t?!this.isOpened:t)&&this.isEnabled;t&&!this.isOpened&&this.search(null),this.popupPanel.toggle(t),t||this.allowNewItems||this.resetText()},n.prototype.toggleFocusedItemOrCurrentText=function(){var t=this.resultsView.getFocusedItems();this.isOpened&&t.length?(this.resultsView.toggleFocusedItem(),this.resetText()):this.selectCurrentText()},n.prototype.selectCurrentText=function(){var t=this.$textBox.val(),e=this.findItemByText(t);if(null==e){if(t.trim().length&&this.allowNewItems){var i=this.binding,n=i.itemValueBinding,i=i.itemTextBinding;if(!u.Utils.isDataAccessor(n)||!u.Utils.isDataAccessor(i))throw Error("New items can't be created when the ItemValueBinding or ItemTextBinding property is set.");t=this.findItemInDataSourceOrAdd(this.createItemFromText(t));this.resultsView.selectItem(t,!1),this.postback(this.binding.newItemAdded)}}else this.resultsView.selectItem(e,!1);this.resetText()},n.prototype.unselectLastItem=function(){this.isEnabled&&this.binding.selectedValues().length&&(this.binding.selectedValues.pop(),this.postback(this.binding.changed))},n.prototype.onElementMousedown=function(t){this.$textBox.focus(),t.preventDefault()},n.prototype.onElementKeydown=function(t){this.isEnabled&&(this.isOpened?u.KeyboardKeys.isEscape(t.which)?(t.stopPropagation(),this.togglePopup(!1)):u.KeyboardKeys.isEnter(t.which)?t.stopPropagationAndPreventDefault():t.which===u.KeyboardKeys.tab?t.stopPropagation():t.which===u.KeyboardKeys.down?(t.stopPropagation(),this.resultsView.focusNextItem()):t.which===u.KeyboardKeys.up&&(t.stopPropagation(),this.resultsView.focusPrevItem()):t.altKey&&t.which===u.KeyboardKeys.down&&(t.stopPropagation(),this.togglePopup(!0)),t.which!==u.KeyboardKeys.backspace||this.$textBox.val()||(t.stopPropagationAndPreventDefault(),this.backspaceHits<3?this.backspaceHits++:(this.backspaceHits=0,this.unselectLastItem())),this.searchEngine.isRunning||u.KeyboardKeys.isEnter(t.which)&&this.toggleFocusedItemOrCurrentText())},n.prototype.onElementKeyup=function(t){this.backspaceHits=3},n.prototype.onUnselectButtonClick=function(t){this.isEnabled&&(t.stopPropagation(),this.resultsView.unselectItem(ko.dataFor(t.target)),this.resetText())},n.prototype.onTextBoxFocus=function(){this.$element.addClass(u.BusinessPackCss.stateFocused),this.resultsView.hasFocus(!0),this.togglePopup(!0)},n.prototype.onTextBoxBlur=function(){this.$element.removeClass(u.BusinessPackCss.stateFocused),this.resultsView.hasFocus(!1),this.togglePopup(!1)},n.prototype.onTextBoxKeydown=function(t){this.isOpened&&u.KeyboardKeys.isUpOrDown(t.which)&&t.preventDefault()},n.prototype.onTextBoxInput=function(t){var e=this.$textBox.val();(e||this.isOpened)&&(t.stopPropagation(),this.togglePopup(!0),this.$textBox.attr("size",e.length||0),this.search(e),this.autoFocusItem())},n.prototype.onDataSourceChange=function(){i.prototype.onDataSourceChange.call(this)},n.prototype.onSelectedValuesChange=function(t){var e,i,n=[],s=[];t.length?(this.$textBox.removeAttr("placeholder"),this.$element.removeClass(u.BusinessPackCss.stateValueEmpty)):(this.$textBox.attr("placeholder",this.binding.placeholder),this.$element.addClass(u.BusinessPackCss.stateValueEmpty));try{for(var o=__values(t),r=o.next();!r.done;r=o.next()){var a=r.value,l=this.findItemByValue(a);l?(n.push(l),s.push(a)):this.warnThatValueWasNotFound(a)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}this.selectedItems(n),this.selectedValues(s),this.popupPanel.update(),this.resetText()},n.prototype.onSearchResultsChange=function(t){var e=this,i=ko.unwrap(this.binding.loadItemsMode);this.$textBox.val();"Replace"===i&&this.resultsView&&(t=t.map(function(t){return e.getItemKey(t)}),this.removeAllItemsExcept(t.concat(this.resultsView.selectedItemsKeys()))),this.autoFocusItem()},n.prototype.autoFocusItem=function(){var t=ko.unwrap(this.searchResults),e=this.$textBox.val();this.resultsView&&t.length&&(this.allowNewItems?t[0]().toString().toLowerCase()!==e.toLowerCase()?this.resultsView.unfocusAllItems():this.resultsView.focusItem(t[0]):this.resultsView.focusFirstItem())},n.prototype.getSelectedItemStyle=function(t){t=ko.unwrap(t);var e={};return e[u.BusinessPackCss.stateDisabled]=!this.isItemEnabled(t),e},n.prototype.onSearchResultSelected=function(){var t=this.binding.changed;return this.binding.selectedValues(this.selectedValues().slice()),t?t():Promise.resolve()},n.prototype.resetText=function(){this.$textBox.val(""),this.$textBox.attr("size",0),this.search(null),this.autoFocusItem()},n);function n(){var t=null!==i&&i.apply(this,arguments)||this;return t.selectedItems=ko.observableArray(),t.backspaceHits=3,t}e.MultiSelect=t,u.Utils.installBindingHandler("MultiSelect",t)}((u=t.BusinessPack||(t.BusinessPack={})).Controls||(u.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),Object.defineProperty(n.prototype,"value",{get:function(){return ko.unwrap(this.binding.value)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hasValue",{get:function(){return null!=this.value},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){var t=this;e.prototype.initialize.call(this),this.$textBox=this.$element.children("."+s.BusinessPackCss.primitiveTextBox),this.$increaseButton=this.$element.find("."+s.BusinessPackCss.commandIncrease),this.$decreaseButton=this.$element.find("."+s.BusinessPackCss.commandDecrease),this.$element.mousedown(this.onElementMousedown.bind(this)),this.$element.keydown(this.onElementKeydown.bind(this)),this.$textBox.focus(this.onTextBoxFocus.bind(this)),this.$textBox.blur(this.onTextBoxBlur.bind(this)),this.$textBox.keydown(this.onTextBoxKeydown.bind(this)),this.$textBox.change(this.onTextBoxChange.bind(this)),this.$increaseButton.mousedown(this.onIncreaseButtonMousedown.bind(this)),this.$decreaseButton.mousedown(this.onDecreaseButtonMousedown.bind(this)),this.subscribe(this.binding.value,this.onValueChange.bind(this)),this.subscribe(this.binding.maxValue,function(){return t.validateValue()}),this.subscribe(this.binding.minValue,function(){return t.validateValue()})},n.prototype.increase=function(){this.applyIncrease(1),this.postbackChangesIfPending()},n.prototype.decrease=function(){this.applyDecrease(1),this.postbackChangesIfPending()},n.prototype.onElementMousedown=function(){this.$textBox.focus()},n.prototype.onElementKeydown=function(t){this.isEnabled&&s.KeyboardKeys.isUpOrDown(t.which)&&(t.stopPropagation(),this.setKeydownTimeout(t.which===s.KeyboardKeys.up,t.ctrlKey))},n.prototype.onTextBoxFocus=function(){this.$element.addClass(s.BusinessPackCss.stateFocused)},n.prototype.onTextBoxBlur=function(){this.$element.removeClass(s.BusinessPackCss.stateFocused)},n.prototype.onTextBoxKeydown=function(t){s.KeyboardKeys.isUpOrDown(t.which)&&t.preventDefault()},n.prototype.onTextBoxChange=function(t){t.stopPropagation(),this.updateValueFromTextBox(),this.postbackChangesIfPending()},n.prototype.onIncreaseButtonMousedown=function(t){this.isEnabled&&(t.stopPropagationAndPreventDefault(),this.setMousedownTimeout(this.applyIncrease.bind(this)),this.$textBox.focus())},n.prototype.onDecreaseButtonMousedown=function(t){this.isEnabled&&(t.stopPropagationAndPreventDefault(),this.setMousedownTimeout(this.applyDecrease.bind(this)),this.$textBox.focus())},n.prototype.onValueChange=function(t){this.validateValue(),this.$element.toggleClass(s.BusinessPackCss.stateValueEmpty,null==t),this.textBoxValue(t)},n.prototype.setKeydownTimeout=function(t,e){var i=this,n=e?10:1,e=null==this.holdTimeoutId?600:200;clearTimeout(this.holdTimeoutId),t?this.applyIncrease(n):this.applyDecrease(n),this.holdTimeoutId=setTimeout(function(){i.clearTimeoutsAndIntervals(),i.postbackChangesIfPending()},e)},n.prototype.setMousedownTimeout=function(t){var e=this;clearTimeout(this.holdTimeoutId),t(1),this.holdTimeoutId=setTimeout(function(){e.changeIntervalId=setInterval(t,50,1)},600),this.$document.one("mouseup",function(){e.clearTimeoutsAndIntervals(),e.postbackChangesIfPending()})},n.prototype.applyIncrease=function(t){this.updateValueFromTextBox();t=this.computeValue(t);this.changeValue(t)},n.prototype.applyDecrease=function(t){this.updateValueFromTextBox();t=this.computeValue(-t);this.changeValue(t)},n.prototype.updateValueFromTextBox=function(){var t=this.$textBox.val().trim(),t=dotvvm.globalize.parseNumber(t);this.textBoxValue.valueHasMutated(),this.changeValue(isNaN(t)?null:t)},n.prototype.computeValue=function(t){var e=ko.unwrap(this.binding.value),i=ko.unwrap(this.binding.step)*t,t=this.getNumberOfDecimals();return Number((null==e?i:e+i).toFixed(t))},n.prototype.changeValue=function(t){var e=ko.unwrap(this.binding.value),i=ko.unwrap(this.binding.maxValue),n=ko.unwrap(this.binding.minValue);null!=t||this.binding.isValueNullable||(t=0),null!=n&&t<n&&(t=n),(t=null!=i&&i<t?i:t)!==e&&(ko.isWriteableObservable(this.binding.value)&&this.binding.value(t),this.hasPendingChanges=!0)},n.prototype.clearTimeoutsAndIntervals=function(){clearTimeout(this.holdTimeoutId),this.holdTimeoutId=null,clearInterval(this.changeIntervalId),this.changeIntervalId=null},n.prototype.getNumberOfDecimals=function(){var t=ko.unwrap(this.binding.value),e=ko.unwrap(this.binding.step),e=Math.floor(e)!==e&&e.toString().split(".")[1].length||0;if(null==t)return e;t=Math.floor(t)!==t&&t.toString().split(".")[1].length||0;return Math.max(e,t)},n.prototype.postbackChangesIfPending=function(){this.hasPendingChanges&&(this.postback(this.binding.changed),this.hasPendingChanges=!1)},n.prototype.validateValue=function(){var t=ko.unwrap(this.binding.value),e=ko.unwrap(this.binding.maxValue),i=ko.unwrap(this.binding.minValue);if(null!=e&&null!=i&&e<i)throw new Error("The MinValue must be less than MaxValue.");if(null!=t){if(null!=e&&e<t)throw new Error("The Value must be less than or equal to MaxValue.");if(null!=i&&t<i)throw new Error("The Value must be greater than or equal to MinValue.")}},n);function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.textBoxValue=ko.observable(),t.holdTimeoutId=null,t.changeIntervalId=null,t.hasPendingChanges=!1,t}t.NumericUpDown=i,s.Utils.installBindingHandler("NumericUpDown",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ButtonBase,__extends(n,e),n);function n(){return null!==e&&e.apply(this,arguments)||this}t.ButtonPrimitive=i,s.Utils.installBindingHandler("ButtonPrimitive",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.CheckableControlListBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.$element.on("change","[type=radio]",this.onInputChange.bind(this)),this.watch(this.binding.selectedValue,this.onSelectedValueChange)},n.prototype.selectItem=function(t){this.isSelected(t)||(ko.isWriteableObservable(this.binding.selectedValue)&&this.binding.selectedValue(this.getItemValueCopy(t)),this.postback(this.binding.changed))},n.prototype.isSelected=function(t){return this.getItemKey(t)===this.selectedItemKey()},n.prototype.onInputChange=function(t){t.stopPropagation(),this.selectItem(ko.dataFor(t.target))},n.prototype.onSelectedValueChange=function(t){var e=this.findItemByValue(t);e?this.selectedItemKey(this.getItemKey(e)):(null!=t&&this.warnThatValueWasNotFound(t),this.selectedItemKey(null))},n);function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.selectedItemKey=ko.observable(null),t}t.RadioButtonList=i,s.Utils.installBindingHandler("RadioButtonList",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var i,e=(i=t.ControlBase,__extends(n,i),Object.defineProperty(n.prototype,"value",{get:function(){var t=ko.unwrap(this.binding.value);return void 0===t?null:t},set:function(t){var e=this.binding.value;ko.isWriteableObservable(e)&&e(t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isPreviewOnHoverEnabled",{get:function(){return this.isEnabled&&ko.unwrap(this.binding.allowPreviewOnHover)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isPreviewingValue",{get:function(){return null!=this.previewValue()},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){var e=this;i.prototype.initialize.call(this),this.$element.mouseleave(function(t){return e.onElementMouseleave(t)}),this.$element.on("mousemove","."+s.BusinessPackCss.primitivePoint,function(t){return e.onPointMousemove(t)}),this.$element.on("click","."+s.BusinessPackCss.primitivePoint,function(t){return e.onPointClick(t)}),this.$element.focus(function(t){return e.onHandleFocus(t)}),this.$element.blur(function(t){return e.onHandleBlur(t)}),this.$element.keydown(function(t){return e.onHandleKeydown(t)}),this.subscribe(this.binding.maxValue,this.onMaxValueChange)},n.prototype.onMaxValueChange=function(t){this.value<=t||this.setValue(t)},n.prototype.onElementMouseleave=function(t){this.previewValue(null)},n.prototype.onPointMousemove=function(t){this.isPreviewOnHoverEnabled&&this.previewValue(this.getValueFromOffset(t))},n.prototype.onPointClick=function(t){this.isEnabled&&this.setValue(this.getValueFromOffset(t))},n.prototype.getValueFromOffset=function(t){var e=$(t.currentTarget),i=ko.unwrap(this.binding.allowHalfPoints),n=ko.dataFor(t.currentTarget);return 1==n&&t.offsetX<=e.width()/5?n=0:i&&t.offsetX<=e.width()/2&&(n-=.5),n},n.prototype.onHandleFocus=function(t){this.$element.addClass(s.BusinessPackCss.stateFocused)},n.prototype.onHandleBlur=function(t){this.$element.removeClass(s.BusinessPackCss.stateFocused)},n.prototype.onHandleKeydown=function(t){var e,i;this.isEnabled&&(s.KeyboardKeys.isArrow(t.which)&&(t.stopPropagation(),null==this.previewValue()&&this.previewValue(this.value),e=ko.unwrap(this.binding.allowHalfPoints)?.5:1,i=this.previewValue(),t.keyCode===s.KeyboardKeys.up||t.keyCode===s.KeyboardKeys.right?i<ko.unwrap(this.binding.maxValue)&&(i+=e):t.keyCode!==s.KeyboardKeys.down&&t.keyCode!==s.KeyboardKeys.left||e<=i&&(i-=e),this.previewValue(i)),!s.KeyboardKeys.isEnter(t.which)&&t.keyCode!==s.KeyboardKeys.tab||(t.stopPropagation(),null==this.previewValue()&&this.previewValue(this.value),this.setValue(this.previewValue()),this.previewValue(null)))},n.prototype.getPointStyle=function(t){var e=ko.unwrap(this.binding.allowHalfPoints),i=this.isPreviewingValue?this.previewValue():this.value,i=e?Math.round(2*i)/2:Math.round(i),e=t<=Math.floor(i),t=!e&&t<=Math.ceil(i),i={};return i[s.BusinessPackCss.stateSelected]=e,i[s.BusinessPackCss.stateHalfSelected]=t,i},n.prototype.getPoints=function(){var t=ko.unwrap(this.binding.maxValue);return Array.from(new Array(t),function(t,e){return ko.observable(e+1)})},n.prototype.setValue=function(t){t!==this.value&&(this.value=t,this.postback(this.binding.changed))},n);function n(){var t=null!==i&&i.apply(this,arguments)||this;return t.previewValue=ko.observable(),t.pointsSource=ko.pureComputed(function(){return t.getPoints()}),t}t.Rating=e,s.Utils.installBindingHandler("Rating",e)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var r;!function(t){"use strict";var e=(Object.defineProperty(i.prototype,"isCollapsed",{get:function(){return this.range.collapsed},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"startOffset",{get:function(){return this.range.startOffset},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"startContainer",{get:function(){return $(this.range.startContainer)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"startNode",{get:function(){var t=this.range.startContainer;return r.DomUtils.isText(t)?$(t):$(t.childNodes[this.startOffset])},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"startChar",{get:function(){var t=this.startContainer[0],e=this.startNode[0];return r.DomUtils.isText(t)?t.nodeValue[this.startOffset]||null:r.DomUtils.isText(e)&&e.nodeValue[0]||null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"endOffset",{get:function(){return this.range.endOffset},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"endContainer",{get:function(){return $(this.range.endContainer)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"endNode",{get:function(){var t=this.range.endContainer;return r.DomUtils.isText(t)?$(t):$(t.childNodes[this.endOffset])},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"endChar",{get:function(){var t=this.endContainer[0],e=this.endNode[0];return r.DomUtils.isText(t)?t.nodeValue[this.endOffset]||null:r.DomUtils.isText(e)&&e.nodeValue[0]||null},enumerable:!0,configurable:!0}),i.get=function(){var t=document.getSelection();return 0<t.rangeCount?new i(t.getRangeAt(0)):null},i.create=function(){return new i(document.createRange())},i.restore=function(t){return!(!$.contains(document.documentElement,t.startContainer[0])||!$.contains(document.documentElement,t.endContainer[0]))&&(this.create().startOn(t.startContainer,t.startOffset).endOn(t.endContainer,t.endOffset).apply(),!0)},i.getLength=function(){var t=this.get();return t?t.getLength():0},i.deleteContents=function(){var t=this.get();t&&t.deleteContents()},i.isInList=function(){var t=this.get();return!!t&&t.isInList()},i.isInTableCell=function(){var t=this.get();return!!t&&t.isInTableCell()},i.isInAnchor=function(){var t=this.get();return!!t&&t.isInAnchor()},i.toString=function(){var t=this.get();return t?t.toString():""},i.prototype.save=function(){return{startContainer:this.startContainer,startOffset:this.startOffset,endContainer:this.endContainer,endOffset:this.endOffset}},i.prototype.commonAncestor=function(t){var e=$(this.range.commonAncestorContainer);return t&&!e.is(t)?e.parentsUntil("[contenteditable=true]",t).first():e.not("[contenteditable=true]")},i.prototype.startAncestor=function(t){var e=$(this.range.startContainer);return t&&!e.is(t)?e.parentsUntil("[contenteditable=true]",t).first():e.not("[contenteditable=true]")},i.prototype.endAncestor=function(t){var e=$(this.range.endContainer);return t&&!e.is(t)?e.parentsUntil("[contenteditable=true]",t).first():e.not("[contenteditable=true]")},i.prototype.singleAncestor=function(t){var e=this.startAncestor(t),t=this.endAncestor(t);return e.is(t)?e:$([])},i.prototype.deleteContents=function(){return this.range.deleteContents(),this},i.prototype.extractContents=function(){return $(this.range.extractContents())},i.prototype.splitOnEdges=function(){var t,e,i,n,s,o;return this.isCollapsed||(o=(t=this).startOffset,e=t.startContainer[0],s=t.endOffset,i=t.endContainer[0],r.DomUtils.isText(e)&&0<o&&(n=e.splitText(o),t.startOn(n,0),i===e&&t.endOn(n,s-o)),s=(n=this).endOffset,o=n.endNode[0],r.DomUtils.isText(o)&&s<o.nodeValue.length&&(s=o.splitText(s).previousSibling,n.endOn(s,s.nodeValue.length))),this},i.prototype.insert=function(t){return this.range.insertNode(r.DomUtils.getNode(t)),$(t)},i.prototype.wrapContents=function(t){return this.range.surroundContents(r.DomUtils.getNode(t)),$(t)},i.prototype.select=function(t){return this.range.selectNode(r.DomUtils.getNode(t)),this},i.prototype.selectContents=function(t){return this.range.selectNodeContents(r.DomUtils.getNode(t)),this},i.prototype.selectWord=function(t){return this.selectContents(t.container)},i.prototype.startOn=function(t,e){return this.range.setStart(r.DomUtils.getNode(t),e),this},i.prototype.startBefore=function(t){return this.range.setStartBefore(r.DomUtils.getNode(t)),this},i.prototype.startAfter=function(t){return this.range.setStartAfter(r.DomUtils.getNode(t)),this},i.prototype.startOnWord=function(t){return this.startOn(t.container,t.offset)},i.prototype.endOn=function(t,e){return this.range.setEnd(r.DomUtils.getNode(t),e),this},i.prototype.endBefore=function(t){return this.range.setEndBefore(r.DomUtils.getNode(t)),this},i.prototype.endAfter=function(t){return this.range.setEndAfter(r.DomUtils.getNode(t)),this},i.prototype.endOnWord=function(t){return this.endOn(t.container,t.offset)},i.prototype.collapseToStart=function(){return this.range.collapse(!0),this},i.prototype.collapseToEnd=function(){return this.range.collapse(!1),this},i.prototype.apply=function(){var t=document.getSelection();t.removeAllRanges(),t.addRange(this.range)},i.prototype.isInList=function(){return!!this.singleAncestor("ul,ol").length},i.prototype.isInTableCell=function(){return!!this.singleAncestor("td,th").length},i.prototype.isInAnchor=function(){return!!this.singleAncestor("a").length},i.prototype.isOnText=function(){return r.DomUtils.isText(this.range.startContainer)&&r.DomUtils.isText(this.range.endContainer)},i.prototype.getWordRange=function(){var t=this.endNode[0];if(!this.isCollapsed||!t)return null;var e=r.Utils.normalizeSpaces(t.nodeValue),i=r.Utils.normalizeSpaces(this.endChar);if(!i)return this.getNextWordRange();if(r.DomUtils.isText(t)&&" "!==i){var n=$(t.previousSibling).is("br"),s=e.lastIndexOf(" ",this.endOffset-1),o=$(t.nextSibling).is("br"),i=e.indexOf(" ",this.endOffset);if(!(n||0<=s||o||0<=i))return{container:this.endContainer,offset:this.endOffset};s=0<=s?s+1:0,i=(0<=i?i:e.length)-s,e=this.endOffset-s;if(0<i){i=r.DomUtils.splitText(t,s,i);return{container:$(i[1]),offset:e}}}return null},i.prototype.getNextWordRange=function(){var t=this.endNode[0];if(!this.isCollapsed||!t)return null;t=r.DomUtils.getNextText(t);return t?(this.startOn(t,0).collapseToStart(),this.getWordRange()):null},i.prototype.getNextContents=function(){var t=this.endOffset,e=this.range.endContainer,i=this.endNode;if(r.DomUtils.isText(e)){if(0===t)return r.DomUtils.getWithNextContents($(e));if(t<e.nodeValue.length){t=e.splitText(t);return r.DomUtils.getWithNextContents($(t))}return r.DomUtils.getNextContents($(e))}return r.DomUtils.getWithNextContents(i)},i.prototype.getNodes=function(){var t=this.startContainer[0],e=this.endContainer[0],i=this.commonAncestor()[0],n=t;if(n===e)return $(n).is("[contenteditable=true]")?[]:[n];for(var s=[];n&&n!==e;)n=r.DomUtils.getNextNode(n),s.push(n);for(n=t;n&&n!==i&&!$(n).is("[contenteditable=true]");)s.unshift(n),n=n.parentNode;return s},i.prototype.getTexts=function(){var e,t,i=[];try{for(var n=__values(this.getNodes()),s=n.next();!s.done;s=n.next()){var o=s.value;r.DomUtils.isText(o)&&i.push(o)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return i},i.prototype.getLength=function(){return this.toString().length},i.prototype.toString=function(){return this.range.toString()},i.prototype.clone=function(){return new i(this.range.cloneRange())},i);function i(t){this.range=t.cloneRange(),(t=this).isCollapsed||(function(t){var e,i,n=t.getTexts();n.length&&(e=t.startOffset,i=t.startContainer[0],r.DomUtils.isText(i)&&(e!==i.nodeValue.length||0<=(i=n.indexOf(i))&&((i=n[i+1])&&t.startOn(i,0))))}(t),function(t){var e,i,n=t.getTexts();n.length&&(e=t.endOffset,i=t.endContainer[0],r.DomUtils.isText(i)&&(0!==e||0<=(i=n.indexOf(i))&&((i=n[i-1])&&t.endOn(i,i.nodeValue.length))))}(t))}t.TextRange=e}((r=t.BusinessPack||(t.BusinessPack={})).Controls||(r.Controls={}))}(DotVVM=DotVVM||{}),function(t){var r;!function(s){"use strict";var t=(o.save=function(t){var e,i={path:[],offset:0},n={path:[],offset:0};return o.isInEditor(t)&&(e=s.TextRange.get(),i.path=r.DomUtils.getPath(t,e.startContainer),i.offset=e.startOffset,n.path=r.DomUtils.getPath(t,e.endContainer),n.offset=e.endOffset),{start:i,end:n}},o.restore=function(t,e){var i=e.start,e=e.end;s.TextRange.create().startOn(r.DomUtils.fromPath(t,i.path),i.offset).endOn(r.DomUtils.fromPath(t,e.path),e.offset).apply()},o.isInEditor=function(t){var e=s.TextRange.get();return!!e&&((t.is(e.startContainer)||t.find(e.startContainer).length)&&(t.is(e.endContainer)||t.find(e.endContainer).length))},o);function o(){}s.TextSelection=t}((r=t.BusinessPack||(t.BusinessPack={})).Controls||(r.Controls={}))}(DotVVM=DotVVM||{}),function(t){var d;!function(l){"use strict";var t=(e.prototype.getState=function(t){var e,i,n=!1,s=!0;try{for(var o=__values(t),r=o.next();!r.done;r=o.next()){var a=r.value;if(!this.shouldSkip(a)){a=this.getNodeState(a);if(!a)return!1;if(s)n=a,s=!1;else if(a!==n)return!1}}}catch(t){e={error:t}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}return n},e.prototype.getNodeState=function(t){return this.isSuitableWrapper(t)||this.isFormatted(t)},e.prototype.toggle=function(t,e){this.areFormatted(t,e)?this.remove(t,e):this.apply(t,e)},e.prototype.toggleAfter=function(t,e){return this.isFormatted(t,e)?this.removeAfter(t,e):this.applyAfter(t,e)},e.prototype.apply=function(t,e){var i,n;try{for(var s=__values(t),o=s.next();!o.done;o=s.next()){var r,a,l,u=o.value;this.shouldSkip(u)||this.isFormatted(u,e)||(r=$(u),a=$(u.previousSibling),l=$(u.nextSibling),this.isSuitableWrapper(a,e)?(a.append(r),this.isSuitableWrapper(l,e)&&(a.append(l.contents()),l.remove())):this.isSuitableWrapper(l,e)?l.prepend(r):this.wrap(u,e))}}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}},e.prototype.applyAfter=function(t,e){var i,n=this.createWrapper(e),s=document.createTextNode(d.Utils.zeroWidthSpace),o=l.TextRange.get();return t?(i=$(t),e=!t.previousSibling&&!t.nextSibling,t=d.Utils.normalizeSpaces(t.nodeValue),e&&i.is("br")||0===t.length?i.replaceWith(n.append(s)):i.after(n.append(s))):o.insert(n).append(s),s},e.prototype.remove=function(t,e){var i,n;this.splitWrappers(t,e);try{for(var s=__values(t),o=s.next();!o.done;o=s.next()){var r=o.value;!this.shouldSkip(r)&&this.isFormatted(r,e)&&(r=this.findWrapper(r,e),this.unwrap(r))}}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}},e.prototype.removeAfter=function(t,e){t=this.findWrapper(t,e),e=null;return t.length&&(d.DomUtils.isEmpty(t)?t.remove():(e=document.createTextNode(d.Utils.zeroWidthSpace),t.after(e))),e},e.prototype.shouldSkip=function(t){return!d.DomUtils.isInlineContent(t)},e.prototype.areFormatted=function(t,e){var i,n;try{for(var s=__values(t),o=s.next();!o.done;o=s.next()){var r=o.value;if(!this.shouldSkip(r)&&!this.isFormatted(r,e))return!1}}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return!0},e.prototype.isFormatted=function(t,e){return!!t&&!!this.findWrapper(t,e).length},e.prototype.isSuitableWrapper=function(t,e){e=this.createWrapper(e);return d.DomUtils.canMerge(e,t)},e.prototype.findWrapper=function(t,e){return d.DomUtils.closestUntil(t,"[contenteditable=true]",this.mergeWrapperSelectors(e))},e.prototype.splitWrappers=function(t,e){var i,n;try{for(var s=__values(t),o=s.next();!o.done;o=s.next()){var r,a=o.value;this.isFormatted(a,e)&&(r=this.findWrapper(a,e),a=void 0,(r=r).length&&(function(t,e){t=t.clone().collapseToStart().startBefore(e).extractContents(),t=d.DomUtils.trim(t),$(e).before(t)}(a=l.TextRange.get(),r),function(t,e){t=t.clone().collapseToEnd().endAfter(e).extractContents(),t=d.DomUtils.trim(t),$(e).after(t)}(a,r)))}}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}},e.prototype.mergeWrapperSelectors=function(t){var e,i,n=this.getWrapperSelector(t);try{for(var s=__values(this.alternatives),o=s.next();!o.done;o=s.next())n+=","+o.value.getWrapperSelector(t)}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}return n},e.prototype.wrap=function(t,e){$(t).wrap(this.createWrapper(e))},e.prototype.unwrap=function(t){for(var e=t[0];e.firstChild;)t.before($(e.firstChild));t.remove()},e);function e(t){void 0===t&&(t=[]),this.alternatives=t}l.InlineFormatBase=t;var i,n=(__extends(s,i=t),s.prototype.getWrapperSelector=function(){return this.tagName},s.prototype.createWrapper=function(){return $("<"+this.tagName+">")},s);function s(t,e){void 0===e&&(e=[]);e=i.call(this,e)||this;return e.tagName=t,e}l.TagInlineFormat=n;var o,n=(__extends(r,o=t),r.prototype.getWrapperSelector=function(){return this.tagName+"."+this.className},r.prototype.createWrapper=function(){return $("<"+this.tagName+">").addClass(this.className)},r);function r(t,e,i){void 0===i&&(i=[]);i=o.call(this,i)||this;return i.tagName=t,i.className=e,i}l.ClassInlineFormat=n;var a,t=(__extends(u,a=t),u.prototype.getNodeState=function(t){var e=this.tagName+"[style*='"+this.styleName+":']",e=d.DomUtils.closestUntil(t,"[contenteditable=true]",e);return!!e.length&&e.css(this.styleName)},u.prototype.getWrapperSelector=function(t){return this.tagName+"[style*='"+this.styleName+":"+t+";'],"+this.tagName+"[style$='"+this.styleName+":"+t+"'],"+this.tagName+"[style*='"+this.styleName+": "+t+";'],"+this.tagName+"[style$='"+this.styleName+": "+t+"']"},u.prototype.createWrapper=function(t){return $("<"+this.tagName+">").css(this.styleName,t)},u);function u(t,e,i){void 0===i&&(i=[]);i=a.call(this,i)||this;return i.tagName=t,i.styleName=e,i}l.StyleInlineFormat=t;var c,t=(__extends(h,c=t),h.prototype.getNodeState=function(t){return this.isFormatted(t)},h.prototype.getWrapperSelector=function(){return c.prototype.getWrapperSelector.call(this,this.styleValue)},h.prototype.createWrapper=function(){return c.prototype.createWrapper.call(this,this.styleValue)},h);function h(t,e,i,n){void 0===n&&(n=[]);n=c.call(this,t,e,n)||this;return n.styleValue=i,n}l.StyleValueInlineFormat=t}((d=t.BusinessPack||(t.BusinessPack={})).Controls||(d.Controls={}))}(DotVVM=DotVVM||{}),function(t){var k;!function(b){"use strict";var i,t=(i=b.ReactiveBase,__extends(e,i),Object.defineProperty(e.prototype,"html",{get:function(){return function(t){t=t.$input.clone();return k.DomUtils.removeEmptyText(t),function(t){for(var e,i,n,s,o,r,a=[],l=1;l<arguments.length;l++)a[l-1]=arguments[l];try{for(var u=__values(a),c=u.next();!c.done;c=u.next()){var h=c.value;try{for(var d=__values(t.find(h).get()),p=d.next();!p.done;p=d.next()){for(var g=p.value,f=void 0,m=g.tagName;(f=g.nextSibling)&&k.DomUtils.canMerge(g,f);)$(g).append($(f).contents()),$(f).remove();try{for(var y=__values($(g).find(m).get()),v=y.next();!v.done;v=y.next()){var b=v.value;k.DomUtils.canMerge(g,b)&&$(b).replaceWith($(b).contents())}}catch(t){o={error:t}}finally{try{v&&!v.done&&(r=y.return)&&r.call(y)}finally{if(o)throw o.error}}}}catch(t){n={error:t}}finally{try{p&&!p.done&&(s=d.return)&&s.call(d)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(e)throw e.error}}}(t,"big","code","em","small","span","strikeout","strong","sub","sup","u"),function(t){var e,i;try{for(var n=__values(t.find("p:empty").get()),s=n.next();!s.done;s=n.next()){var o=s.value;$(o).remove()}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}}(t),o(t),k.Utils.normalizeSpaces(t.html())}(this)},set:function(t){t!==this.html?(this.$input.html(t),this.oldSelection=null,this.recordUndo()):this.history.isEmpty&&this.recordUndo()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this.$input.is("[contenteditable]")},enumerable:!0,configurable:!0}),e.prototype.enable=function(){this.$input.prop("contenteditable",!0)},e.prototype.disable=function(){this.$input.prop("contenteditable",!1)},e.prototype.change=function(t){this.on("change",t)},e.prototype.update=function(t){t?this.on("update",t):(this.trigger("update"),this.oldHtml!==this.html&&(this.recordUndo(),this.oldHtml=this.html,this.trigger("change")))},e.prototype.undo=function(){this.history.undo()},e.prototype.recordUndo=function(){this.history.record({contents:this.$input.contents().clone(),selection:b.TextSelection.save(this.$input)})},e.prototype.redo=function(){this.history.redo()},e.prototype.cut=function(){this.$input.focus(),n("cut")},e.prototype.copy=function(){this.$input.focus(),n("copy")},e.prototype.paste=function(){this.$input.focus(),n("paste")},e.prototype.formatInline=function(t,e){var i,n,s;t in this.inlineFormats&&(this.$input.focus(),C(this),i=b.TextRange.get(),n=this.inlineFormats[t],(t=i.getWordRange())&&i.selectWord(t).apply(),i.splitOnEdges(),i.isCollapsed?(s=i.endNode[0],(s=n.toggleAfter(s,e))&&i.startOn(s,1).collapseToEnd().apply()):(s=i.save(),n.toggle(i.getNodes(),e),t?i.startOnWord(t).collapseToStart().apply():b.TextRange.restore(s)),this.update())},e.prototype.bold=function(){this.formatInline("bold")},e.prototype.italic=function(){this.formatInline("italic")},e.prototype.underline=function(){this.formatInline("underline")},e.prototype.strikethrough=function(){this.formatInline("strikethrough")},e.prototype.subscript=function(){this.formatInline("subscript")},e.prototype.superscript=function(){this.formatInline("superscript")},e.prototype.backColor=function(t){this.formatInline("backColor",t)},e.prototype.foreColor=function(t){this.formatInline("foreColor",t)},e.prototype.fontName=function(t){this.formatInline("fontName",t)},e.prototype.fontSize=function(t){this.formatInline("fontSize",t+"pt")},e.prototype.formatBlock=function(t){var e,i,n,s;if(t){this.$input.focus(),D(this,!0),C(this);var o=b.TextRange.get(),r=o.save(),a=o.startNode,l=o.endNode,u=$([]);a.is(k.DomUtils.blockSelector)||(a=o.startAncestor(k.DomUtils.blockSelector)),l.is(k.DomUtils.blockSelector)||(l=o.endAncestor(k.DomUtils.blockSelector)),u=u.add(a),a.is(l)||(u=u.add(a.nextUntil(l,k.DomUtils.blockSelector)).add(l));try{for(var c=__values(u.get()),h=c.next();!h.done;h=c.next()){var d=h.value,d=$(d),p=k.DomUtils.cloneAs(d,t);if(d.is("ol,ul")){var g=d.children("li"),f=!0;try{for(var m=__values(g.get()),y=m.next();!y.done;y=m.next()){var v=y.value,v=$(v);f||p.append("<br>"),p.append(v.text()),f=!1}}catch(t){n={error:t}}finally{try{y&&!y.done&&(s=m.return)&&s.call(m)}finally{if(n)throw n.error}}}else p.append(d.contents());d.replaceWith(p)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(i=c.return)&&i.call(c)}finally{if(e)throw e.error}}b.TextRange.restore(r),this.update()}},e.prototype.align=function(t){t&&(this.$input.focus(),D(this,!0),C(this),n("justify"+t),this.update())},e.prototype.alignLeft=function(){this.align("Left")},e.prototype.alignCenter=function(){this.align("Center")},e.prototype.alignRight=function(){this.align("Right")},e.prototype.alignJustify=function(){this.align("Full")},e.prototype.indent=function(){var t,e,i,n,s,o;this.$input.focus(),b.TextRange.isInList()?(s=(o=b.TextRange.get()).save(),e=(t=o.singleAncestor("li")).parent(),(i=t.prev()).length&&((n=!(n=i.children("ol,ul").last()).length?k.DomUtils.clone(e).appendTo(i):n).append(t),b.TextRange.restore(s),this.update())):(D(this,!0),(s=(o=b.TextRange.get()).singleAncestor(k.DomUtils.blockSelector)).length&&(o=parseInt(s.css("margin-left"))+25,s.css("margin-left",o+"px"),this.update()))},e.prototype.outdent=function(){var t,e,i,n,s,o;this.$input.focus(),b.TextRange.isInList()?(s=(o=b.TextRange.get()).save(),e=(t=o.singleAncestor("li")).parent(),i=t.parents("li").first(),n=t.nextAll(),i.length&&(n.length&&k.DomUtils.clone(e).append(n).appendTo(t),i.after(t),e.children().length||e.remove(),b.TextRange.restore(s),this.update())):(D(this,!0),(s=(o=b.TextRange.get()).singleAncestor(k.DomUtils.blockSelector)).length&&(o=parseInt(s.css("margin-left"))-25,s.css("margin-left",0<o?o+"px":""),this.update()))},e.prototype.nextTableCell=function(){this.$input.focus();var t=b.TextRange.get(),e=t.endAncestor("td,th").next();(e=!(e=!e.length?t.endAncestor("tr").next().children().first():e).length?t.endAncestor("thead").next().children("tr").first().children().first():e).length?t.startOn(e,0).collapseToStart().apply():(this.insertTableRow(),this.nextTableCell())},e.prototype.prevTableCell=function(){this.$input.focus();var t=b.TextRange.get(),e=t.startAncestor("td,th").prev();(e=!(e=!e.length?t.startAncestor("tr").prev().children().last():e).length?t.endAncestor("tbody").prev().children("tr").last().children().last():e).length&&t.startOn(e,0).collapseToStart().apply()},e.prototype.insertLine=function(){this.$input.focus(),b.TextRange.get().deleteContents(),C(this);var t=b.TextRange.get(),e=t.getNextContents(),i=$("<br>");e.length?e.detach():k.DomUtils.isLastOrFalsy(t.endNode)&&(e=$("<br>")),t.insert(i).after(e),t.startAfter(i).collapseToStart().apply(),this.update()},e.prototype.insertBlock=function(){b.TextRange.isInList()?this.insertListItem():this.insertParagraph()},e.prototype.toggleList=function(t){if(t){this.$input.focus(),D(this,!0),C(this);var e=b.TextRange.get(),i=e.save();if(b.TextRange.isInList()){var n,s,o,r,a,l=e.singleAncestor("li"),u=l.parent();if(!l.length)return;u.is(t)?(n=l.children("ol,ul").last(),s=k.DomUtils.reverse(l.prevAll().detach()),o=l.nextAll().detach(),r=$("<p><br></p>"),a=$([]),l.is(":empty")||r.empty().append(l.contents()),k.DomUtils.isLast(n)&&(o=n.children().add(o),n.remove()),s.length&&(c=k.DomUtils.clone(u).append(s),a=a.add(c)),a=a.add(r),o.length&&(h=k.DomUtils.clone(u).append(o),a=a.add(h)),u.replaceWith(a),(a=(o=r).children(k.DomUtils.blockSelector).first()).length&&(p(k.DomUtils.getNextAllInlineContents(a).filter(function(t,e){return!k.DomUtils.isWhitespace(e)}).first()),o.after(a.nextAll().addBack())),b.TextRange.restore(i)||e.startOn(r,0).collapseToStart().apply()):(d=u.children(),u.replaceWith($("<"+t+">").append(d)),b.TextRange.restore(i))}else{var u=e.singleAncestor(k.DomUtils.blockSelector),c=u.prev("ol,ul"),h=u.next("ol,ul"),d=$("<li>");c.length||u.before(c=$("<"+t+">")),d.append(u.contents()).appendTo(c),u.remove(),h.length&&(c.append(h.children()),h.remove()),b.TextRange.restore(i)||e.startOn(d,0).collapseToStart().apply()}this.update()}},e.prototype.toggleOrderedList=function(){this.toggleList("ol")},e.prototype.toggleUnorderedList=function(){this.toggleList("ul")},e.prototype.autoInsertList=function(){if(this.$input.focus(),b.TextRange.isInList())return!1;C(this);var t=b.TextRange.get(),e=t.singleAncestor(k.DomUtils.blockSelector),i=this.$input[0].childNodes;if(1===(i=e.length?e[0].childNodes:i).length){var n=i[0],s=n.nodeValue;if(k.DomUtils.isText(n)){i=void 0;if(s.match(/^\s*-$/g)?i=$("<ul>"):s.match(/^\s*1[\.\)]$/g)?i=$("<ol>").css("list-style-type","decimal"):s.match(/^\s*a[\.\)]$/g)&&(i=$("<ol>").css("list-style-type","lower-alpha")),i){s=$("<li>").appendTo(i);return(e.not("td,th").length?e:$(n)).replaceWith(i),t.startOn(s,0).apply(),this.update(),!0}}}return!1},e.prototype.insertListItem=function(){var t,e,i,n,s,o,r;this.$input.focus(),b.TextRange.isInList()&&(b.TextRange.deleteContents(),C(this),(r=(t=b.TextRange.get()).singleAncestor("li")).is(":empty")?(e=r.parent(),n=k.DomUtils.reverse(r.prevAll().detach()),o=r.nextAll().detach(),i=$("<p><br></p>"),s=$([]),n.length&&(n=k.DomUtils.clone(e).append(n),s=s.add(n)),s=s.add(i),o.length&&(o=k.DomUtils.clone(e).append(o),s=s.add(o)),e.replaceWith(s),t.startOn(i,0).collapseToStart().apply()):(r=$("<li>").append(t.getNextContents()).insertAfter(r),t.startOn(r,0).collapseToStart().apply()),this.update())},e.prototype.insertParagraph=function(){var t,e,i,n;this.$input.focus(),b.TextRange.isInList()||(b.TextRange.deleteContents(),D(this),C(this),n=(t=b.TextRange.get()).startAncestor(k.DomUtils.blockSelector),e=t.getNextContents(),i=$("<p><br></p>"),e.length&&i.empty().append(e),n.length?n.after(i):t.insert(i),n=(n=i).prev(k.DomUtils.blockSelector),k.DomUtils.removeEmptyText(n),n.is(":empty")&&n.html("<br>"),t.startOn(i,0).collapseToStart().apply(),this.update())},e.prototype.insertTable=function(t,e){if(this.$input.focus(),t&&e&&!b.TextRange.isInTableCell()){b.TextRange.deleteContents(),C(this);for(var i=b.TextRange.get(),n=i.endAncestor("p"),s=$("<thead><tr></tr></thead>"),o=$("<tbody>"),r=$([]),a=0;a<e;a++)r=$("<th>"),s.children("tr").prepend(r);for(var l=0;l<t-1;l++){for(var u=$("<tr>"),a=0;a<e;a++)u.append("<td>");o.append(u)}var c=$("<table>").append(s).append(o);n.length?n.after(c):i.insert(c),i.startOn(r,0).collapseToStart().apply(),this.update()}},e.prototype.deleteTable=function(){this.$input.focus();var t=b.TextRange.get(),e=t.singleAncestor("table");e.length&&((e.next().length?t.startAfter(e):t.startBefore(e)).collapseToStart().apply(),e.remove(),this.update())},e.prototype.insertTableRow=function(t){this.$input.focus();var e=b.TextRange.get(),i=e.singleAncestor("table"),n=e.singleAncestor("tr");if(n.length){for(var e=n.parent("thead"),s=n.children().length,o=k.DomUtils.clone(n);s--;)o.prepend("<td>");t?e.length||n.before(o):e.length?i.children("tbody").prepend(o):n.after(o),this.update()}},e.prototype.deleteTableRow=function(){this.$input.focus();var t,e,i,n=b.TextRange.get(),s=n.singleAncestor("table"),o=n.singleAncestor("tr");k.DomUtils.hasOnlyOneRow(s)?this.deleteTable():o.length&&(t=$([]),e=o.prev(),i=o.next(),s=n.endAncestor("td,th").index()+1,i.length?t=i.children(":nth-child("+s+")"):e.length&&(t=e.children(":nth-child("+s+")")),(o.siblings().length?o:o.parent()).remove(),t.length&&n.startOn(t,0).collapseToStart().apply(),this.update())},e.prototype.insertTableColumn=function(t){var e,i;this.$input.focus();var n=b.TextRange.get(),s=n.singleAncestor("table"),n=n.singleAncestor("td,th"),o=n.index()+1;if(n.length){var r=s.find("> thead > tr, > tbody > tr, > tr");try{for(var a=__values(r.get()),l=a.next();!l.done;l=a.next()){var u=l.value,u=$(u).children(":nth-child("+o+")");t?u.before(k.DomUtils.clone(u)):u.after(k.DomUtils.clone(u))}}catch(t){e={error:t}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}this.update()}},e.prototype.deleteTableColumn=function(){var e,t;this.$input.focus();var i=b.TextRange.get(),n=i.singleAncestor("table"),s=i.singleAncestor("td,th"),o=s.index()+1;if(k.DomUtils.hasOnlyOneColumn(n))this.deleteTable();else if(s.length){var r=s.next(),a=n.find("> thead > tr, > tbody > tr, > tr");r.length||(r=s.prev());try{for(var l=__values(a.get()),u=l.next();!u.done;u=l.next()){var c=u.value;$(c).children(":nth-child("+o+")").remove()}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}r.length&&i.startOn(r,0).collapseToStart().apply(),this.update()}},e.prototype.insertImage=function(t,e,i,n){var s;void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null),this.$input.focus(),t&&(b.TextRange.deleteContents(),s=b.TextRange.get(),t=$("<img>").attr("src",t),e&&t.attr("title",e).attr("alt",e),i&&t.attr("width",i),n&&t.attr("height",n),s.insert(t),s.startAfter(t).collapseToStart().apply(),this.update())},e.prototype.insertLink=function(t,e){var i,n,s;void 0===e&&(e=null),this.$input.focus(),t&&(e=e||b.TextRange.toString()||t,b.TextRange.deleteContents(),i=b.TextRange.get(),s=k.RegexUtils.urlOrEmail("i").exec(t),(n=i.singleAncestor("a")).length||(n=$("<a>").text(e)),s?(s=(e=__read(s,3))[1],e=e[2],s?n.attr("href",s.startsWith("www")?"http://"+s:s).attr("rel","nofollow"):n.attr("href","mailto:"+e)):n.attr("href",t),n.parent().length||(i.insert(n),i.startAfter(n).collapseToStart().apply()),this.update())},e.prototype.getLinkUri=function(){var t=b.TextRange.get().singleAncestor("a");if(t.length){t=t.attr("href").toLowerCase();return t=t.startsWith("mailto:")?t.substring(7):t}return null},e.prototype.removeLink=function(){this.$input.focus();var t,e,i=b.TextRange.get(),n=i.singleAncestor("a");n.length&&(t=i.save(),e=n.contents(),n.replaceWith(e),b.TextRange.restore(t)||i.startAfter(e.last()).collapseToStart().apply())},e.prototype.autoInsertLink=function(){this.$input.focus();var t=b.TextRange.get(),e=k.RegexUtils.urlOrEmail("gi"),i=t.endNode[0];if(k.DomUtils.isText(i)&&!k.DomUtils.isInAnchor(i)){var n=i.nodeValue,s=k.RegexUtils.getLastMatch(e,n,t.endOffset);if(s){var o=__read(s,3),e=o[0],n=o[1],o=o[2],s=k.DomUtils.splitText(i,s.index,e.length)[1],e=$("<a>");return n?e.attr("href",n.startsWith("www")?"http://"+n:n).attr("rel","nofollow"):e.attr("href","mailto:"+o),e=$(s).wrap(e).parent(),t.isOnText()||t.startAfter(e).collapseToStart().apply(),this.update(),!0}}return!1},e.prototype.insertText=function(t){t&&(this.$input.focus(),n("insertText",t),this.update())},e.prototype.clearFormatting=function(){this.$input.focus(),n("removeFormat"),this.update()},e.prototype.selectAll=function(){this.$input.focus(),n("selectAll")},e.prototype.delete=function(){this.$input.focus(),n("delete"),this.update()},e.prototype.isCommandEnabled=function(t){return"undo"===t?this.history.canUndo:"redo"===t?this.history.canRedo:"clearFormatting"===t?0<b.TextRange.getLength():"insertTable"===t?!b.TextRange.isInTableCell():0<t.indexOf("Table")?b.TextRange.isInTableCell():"insertLink"===t?!b.TextRange.isInAnchor():"removeLink"!==t||b.TextRange.isInAnchor()},e.prototype.isCommandVisible=function(t){return"insertTable"===t?!b.TextRange.isInTableCell():0<t.indexOf("Table")?b.TextRange.isInTableCell():"insertLink"===t?!b.TextRange.isInAnchor():"removeLink"!==t||b.TextRange.isInAnchor()},e.prototype.getCommandState=function(t){var e=b.TextRange.get();if(!e||!this.$input.is(":focus"))return null;if(t in this.inlineFormats)return this.inlineFormats[t].getState(e.getNodes());if(t.startsWith("align"))return function(t){try{return document.queryCommandState(s(t))}catch(t){return!1}}(t);if("numberedList"===t)return e.singleAncestor("ol,ul").is("ol");if("bulletedList"===t)return e.singleAncestor("ol,ul").is("ul");e=function(t){try{return document.queryCommandValue(s(t))}catch(t){return null}}(t);return e?"formatBlock"!==t||"Normal"!==e?e:"p":null},e.prototype.registerInlineFormats=function(){this.inlineFormats.bold=new b.TagInlineFormat("strong",[new b.TagInlineFormat("b"),new b.StyleValueInlineFormat("span","font-weight","bold")]),this.inlineFormats.italic=new b.TagInlineFormat("em",[new b.TagInlineFormat("i"),new b.StyleValueInlineFormat("span","font-style","italic")]),this.inlineFormats.underline=new b.TagInlineFormat("u",[new b.StyleValueInlineFormat("span","text-decoration","underline")]),this.inlineFormats.strikethrough=new b.TagInlineFormat("strike",[new b.StyleValueInlineFormat("span","text-decoration","line-through")]),this.inlineFormats.subscript=new b.TagInlineFormat("sub"),this.inlineFormats.superscript=new b.TagInlineFormat("sup"),this.inlineFormats.backColor=new b.StyleInlineFormat("span","background-color"),this.inlineFormats.foreColor=new b.StyleInlineFormat("span","color"),this.inlineFormats.fontName=new b.StyleInlineFormat("span","font-family"),this.inlineFormats.fontSize=new b.StyleInlineFormat("span","font-size"),this.inlineFormats.code=new b.TagInlineFormat("code"),this.inlineFormats.big=new b.TagInlineFormat("big"),this.inlineFormats.small=new b.TagInlineFormat("small"),this.inlineFormats.marker=new b.ClassInlineFormat("span","marker")},e.prototype.onDocumentSelectionChange=function(){b.TextSelection.isInEditor(this.$input)&&this.update()},e.prototype.onInputFocus=function(){this.oldHtml=this.html,null!=this.oldSelection&&(b.TextSelection.restore(this.$input,this.oldSelection),this.oldSelection=null),n("styleWithCSS",!1),n("enableInlineTableEditing",!1),n("enableObjectResizing",!1),n("respectVisibilityInDesign",!0),n("autoUrlDetect",!1),n("defaultParagraphSeparator","p"),n("insertBrOnReturn",!1)},e.prototype.onInputBlur=function(){this.oldSelection=b.TextSelection.save(this.$input),this.update()},e.prototype.onInputKeydown=function(t){var e=!0;k.KeyboardKeys.isWhiteSpace(t.which)&&this.autoInsertLink(),k.KeyboardKeys.isEnter(t.which)?t.shiftKey?this.insertLine():this.insertBlock():t.which===k.KeyboardKeys.spacebar?e=this.autoInsertList():t.which===k.KeyboardKeys.tab?t.shiftKey?b.TextRange.isInTableCell()?this.prevTableCell():this.outdent():b.TextRange.isInTableCell()?this.nextTableCell():this.indent():t.ctrlKey&&t.which===k.KeyboardKeys.z?this.undo():t.ctrlKey&&t.which===k.KeyboardKeys.y?this.redo():t.ctrlKey&&t.which===k.KeyboardKeys.b?this.bold():t.ctrlKey&&t.which===k.KeyboardKeys.i?this.italic():t.ctrlKey&&t.which===k.KeyboardKeys.u?this.underline():e=!1,e&&t.stopPropagationAndPreventDefault()},e.prototype.onInputKeyup=function(){var t,e;(e=b.TextRange.get())&&e.isCollapsed&&(t=e.endContainer[0],e=e.save(),k.DomUtils.isText(t)&&1<t.nodeValue.length&&t.nodeValue.startsWith(k.Utils.zeroWidthSpace)&&(t.nodeValue=t.nodeValue.substr(1),e.startOffset=--e.endOffset,b.TextRange.restore(e)))},e.prototype.onInputPaste=function(t){var o=this,e=t.originalEvent.clipboardData;this.isEnabled&&e&&e.files.length&&(t.preventDefault(),k.FileUtils.getFiles(e).done(function(t){var e,i;try{for(var n=__values(t),s=n.next();!s.done;s=n.next())!function(t){var e;k.FileUtils.isImageFile(t)&&((e=new FileReader).onload=function(){o.insertImage(e.result)},e.readAsDataURL(t))}(s.value)}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}}))},e.prototype.onInputDrop=function(t){var o=this,e=t.originalEvent.dataTransfer;this.isEnabled&&e&&k.FileUtils.hasEntries(e)&&(t.preventDefault(),k.FileUtils.getFiles(e).done(function(t){var e,i;try{for(var n=__values(t),s=n.next();!s.done;s=n.next())!function(t){var e;k.FileUtils.isImageFile(t)&&((e=new FileReader).onload=function(){o.insertImage(e.result,t.name)},e.readAsDataURL(t))}(s.value)}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}}))},e.prototype.onHistoryApply=function(t){this.$input.focus(),this.$input.empty().append(t.contents.clone()),this.oldHtml=this.html,b.TextSelection.restore(this.$input,t.selection),this.trigger("change")},e);function e(t){var e=i.call(this)||this;return e.$input=t,e.inlineFormats={},e.history=new b.UndoManager,e.registerInlineFormats(),e.history.apply(e.onHistoryApply.bind(e)),e.$document.on("selectionchange"+e.eventNs,e.onDocumentSelectionChange.bind(e)),t.focus(e.onInputFocus.bind(e)),t.blur(e.onInputBlur.bind(e)),t.keydown(e.onInputKeydown.bind(e)),t.keyup(e.onInputKeyup.bind(e)),t.on("keyup input",function(){return e.update()}),"FileReader"in window&&e.$input.on("paste",e.onInputPaste.bind(e)).on("dragenter drop",function(t){return t.stopPropagation()}).on("drop",e.onInputDrop.bind(e)),e.enable(),e}function n(t,e){try{document.execCommand(s(t),!1,e)}catch(t){}}function s(t){return t.startsWith("align")?t.replace("Justify","Full").replace("align","justify"):t.startsWith("toggle")?t.replace("toggle","insert"):t}function C(t){var e=b.TextRange.get().singleAncestor(k.DomUtils.blockSelector);e.length?(k.DomUtils.removeEmptyText(e),o(e)):(k.DomUtils.removeEmptyText(t.$input),o(t.$input))}function D(t,e){void 0===e&&(e=!1);var i=b.TextRange.get(),n=i.save(),i=(i.isInTableCell()?k.DomUtils.getInlineContents(i.singleAncestor("td,th")).filter(function(t,e){return!k.DomUtils.isWhitespace(e)}):k.DomUtils.getInlineContents(t.$input).filter(function(t,e){return!k.DomUtils.isWhitespace(e)})).first();i.length?(p(i),b.TextRange.restore(n)):e&&t.$input.is(":empty")&&t.insertParagraph()}function p(t){t.length&&(t=k.DomUtils.getWithNextInlineContents(t).wrapAll("<p/>").parent(),p(k.DomUtils.getNextAllInlineContents(t).filter(function(t,e){return!k.DomUtils.isWhitespace(e)}).first()))}function o(t){var e,i;try{for(var n=__values(t.find("br:last-child").get()),s=n.next();!s.done;s=n.next()){var o=s.value;!o.nextSibling&&1<o.parentNode.childNodes.length&&$(o).remove()}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}}b.ContentEditable=t}((k=t.BusinessPack||(t.BusinessPack={})).Controls||(k.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(e){"use strict";var i,t=(i=e.ControlBase,__extends(n,i),n.prototype.initialize=function(){var t=this;this.$toolbar=this.$element.find("."+s.BusinessPackCss.primitiveToolbar),this.$editor=this.$element.find("."+s.BusinessPackCss.primitiveEditor),this.editor=new e.ContentEditable(this.$editor),i.prototype.initialize.call(this),this.$element.mousedown(this.onElementMousedown.bind(this)),this.$element.focusin(this.onElementFocusin.bind(this)),this.$element.focusout(this.onElementFocusout.bind(this)),this.$toolbar.on("mousedown",this.onToolbarMousedown.bind(this)),this.editor.change(this.onEditorChange.bind(this)),this.editor.update(this.onEditorUpdate.bind(this)),this.subscribe(this.binding.html,this.onHtmlChange),this.disposing(function(){return t.editor.dispose()})},n.prototype.onElementMousedown=function(){this.$editor.focus()},n.prototype.onElementFocusin=function(){this.$element.addClass(s.BusinessPackCss.stateFocused)},n.prototype.onElementFocusout=function(){this.$element.removeClass(s.BusinessPackCss.stateFocused)},n.prototype.onToolbarMousedown=function(t){t.preventDefault()},n.prototype.onEditorChange=function(){ko.isWriteableObservable(this.binding.html)&&this.binding.html(this.editor.html),this.postback(this.binding.onChanged)},n.prototype.onEditorUpdate=function(){this.isUndoEnabled(this.isEnabled&&this.editor.isCommandEnabled("undo")),this.isRedoEnabled(this.isEnabled&&this.editor.isCommandEnabled("redo")),this.isClearFormattingEnabled(this.isEnabled&&this.editor.isCommandEnabled("clearFormatting")),this.isBoldActive(this.editor.getCommandState("bold")||!1),this.isItalicActive(this.editor.getCommandState("italic")||!1),this.isUnderlineActive(this.editor.getCommandState("underline")||!1),this.isStrikethroughActive(this.editor.getCommandState("strikethrough")||!1),this.isSuperscriptActive(this.editor.getCommandState("superscript")||!1),this.isSubscriptActive(this.editor.getCommandState("subscript")||!1),this.isNumberedListActive(this.editor.getCommandState("numberedList")||!1),this.isBulletedListActive(this.editor.getCommandState("bulletedList")||!1),this.hyperlinkUri(this.editor.getLinkUri()),this.isRemoveLinkVisible(this.editor.isCommandVisible("removeLink")),this.imageUri(null),this.imageDescription(null),this.isInsertTableVisible(this.editor.isCommandVisible("insertTable")),this.isAlignLeftActive(this.editor.getCommandState("alignLeft")||!1),this.isAlignCenterActive(this.editor.getCommandState("alignCenter")||!1),this.isAlignRightActive(this.editor.getCommandState("alignRight")||!1),this.isAlignJustifyActive(this.editor.getCommandState("alignJustify")||!1),this.paragraphStyle(this.editor.getCommandState("formatBlock")||"p"),this.fontName(this.editor.getCommandState("fontName")||null)},n.prototype.onParagraphStyleChange=function(){this.editor.formatBlock(this.paragraphStyle())},n.prototype.onFontNameChange=function(){var t=this.fontName(),e=this.editor.getCommandState("fontName");t!==e&&(e&&this.editor.fontName(e),this.editor.fontName(t))},n.prototype.onSaveHyperlinkClick=function(){this.editor.insertLink(this.hyperlinkUri())},n.prototype.onSaveImageClick=function(){this.editor.insertImage(this.imageUri(),this.imageDescription())},n.prototype.onSaveTableClick=function(){this.editor.insertTable(this.tableRows(),this.tableColumns())},n.prototype.onEnabledChange=function(){i.prototype.onEnabledChange.call(this),this.isEnabled?this.editor.enable():this.editor.disable()},n.prototype.toggleTabIndex=function(){this.isEnabled?this.$editor.attr("tabindex",this.binding.tabIndex):this.$editor.removeAttr("tabindex")},n.prototype.onHtmlChange=function(t){this.editor.html=t},n);function n(){var t=null!==i&&i.apply(this,arguments)||this;return t.isUndoEnabled=ko.observable(!1),t.isRedoEnabled=ko.observable(!1),t.isClearFormattingEnabled=ko.observable(!1),t.isBoldActive=ko.observable(!1),t.isItalicActive=ko.observable(!1),t.isUnderlineActive=ko.observable(!1),t.isStrikethroughActive=ko.observable(!1),t.isSuperscriptActive=ko.observable(!1),t.isSubscriptActive=ko.observable(!1),t.isNumberedListActive=ko.observable(!1),t.isBulletedListActive=ko.observable(!1),t.hyperlinkUri=ko.observable(null),t.isRemoveLinkVisible=ko.observable(!1),t.imageUri=ko.observable(null),t.imageDescription=ko.observable(null),t.isInsertTableVisible=ko.observable(!0),t.tableColumns=ko.observable(5),t.tableRows=ko.observable(4),t.isAlignLeftActive=ko.observable(!1),t.isAlignCenterActive=ko.observable(!1),t.isAlignRightActive=ko.observable(!1),t.isAlignJustifyActive=ko.observable(!1),t.paragraphStyle=ko.observable("p"),t.fontName=ko.observable(null),t}e.RichTextBox=t,s.Utils.installBindingHandler("RichTextBox",t)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var i;!function(r){"use strict";var t=(e.prototype.load=function(t){this._document=i.Utils.deepClone(t),this.reload()},e.prototype.loadHtml=function(t){this._document.Contents=this._htmlLoader.loadContents(t),this.reload()},e.prototype.save=function(){return i.Utils.deepClone(this._document)},e.prototype.saveHtml=function(){var t=this._document.Contents;return this._htmlBuilder.buildHtml(t)},e.prototype.reload=function(){var t=this._document.Contents,t=this._htmlBuilder.buildDom(t,!0);this._htmlObserver.disconnect(),this.$element.empty().append(t),this._htmlObserver.observe()},e.prototype.htmlChanged=function(t){var e=this._document.Contents;this._document.Contents=this._htmlLoader.updateContents(e,t),this.$element.trigger("input"),this.reload()},e);function e(t,e){var i,n;this.$element=t,this._document={Contents:[]},this._schema=new r.RichTextSchema,this._htmlLoader=new r.RichTextHtmlLoader(this._schema),this._htmlObserver=new r.RichTextHtmlObserver(t,this.htmlChanged.bind(this)),this._htmlBuilder=new r.RichTextHtmlBuilder(this._schema);try{for(var s=__values(e),o=s.next();!o.done;o=s.next())o.value.initialize(this._schema)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}this.loadHtml(t.contents())}r.RichTextEngine=t}((i=t.BusinessPack||(t.BusinessPack={})).Controls||(i.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e=(i.prototype.buildHtml=function(t,e){var i,n;void 0===e&&(e=!1);var s="";try{for(var o=__values(this.buildDom(t,e).get()),r=o.next();!r.done;r=o.next())s+=r.value.outerHTML}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},i.prototype.buildDom=function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i="");for(var n=$([]),s=0;s<t.length;++s){var o,r=t[s],a=this.schema.getContentType(r.Type);null!=a&&(o=e?i+s.toString():null,n=a.builder.addElement(o,r,n))}return n},i);function i(t){this.schema=t}t.RichTextHtmlBuilder=e}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var l;!function(t){"use strict";var e=(i.prototype.loadContents=function(t){var e=[],t=this.getHtmlContainer(t),i=l.DomUtils.createTreeWalker(t[0],NodeFilter.SHOW_ELEMENT),n=!0,s=[];for(i.firstChild();n||i.nextSibling();){var n=!1,o=$(i.currentNode),r=this.schema.findContentTypeFor(o),a=!!o.children().length;if(null!=r?(e.push(r.loader.loadContent(o)),a&&r.isHierarchical&&(n=!0,s.push(i.currentNode),i.firstChild())):a&&this.schema.isAllowedContentWrapper(o)&&(n=!0,s.push(i.currentNode),i.firstChild()),!n)for(;!i.currentNode.nextSibling&&s.length;)i.currentNode=s.pop()}return e},i.prototype.updateContents=function(t,e){var i,n,s,o,r,a,l,u,c,h,d,p,g={},f={},m={};try{for(var y=__values(e),v=y.next();!v.done;v=y.next()){var b=v.value,C=$(b.target).closest("[data-cid]");C.length&&(delete g[I=C.data("cid")],delete f[I],m[I]=C);try{for(var D=__values(this.findContents(b.removedNodes)),k=D.next();!k.done;k=D.next()){var w=k.value;(I=(B=$(w)).data("cid"))in g?(delete g[I],m[I]=B):(delete m[I],f[I]=B)}}catch(t){s={error:t}}finally{try{k&&!k.done&&(o=D.return)&&o.call(D)}finally{if(s)throw s.error}}try{for(var P=__values(this.findContents(b.addedNodes)),V=P.next();!V.done;V=P.next()){var B,w=V.value;(I=(B=$(w)).data("cid"))in f?(delete f[I],m[I]=B):(delete m[I],g[I]=B)}}catch(t){r={error:t}}finally{try{V&&!V.done&&(a=P.return)&&a.call(P)}finally{if(r)throw r.error}}}}catch(t){i={error:t}}finally{try{v&&!v.done&&(n=y.return)&&n.call(y)}finally{if(i)throw i.error}}try{for(var x=__values(Object.keys(g)),T=x.next();!T.done;T=x.next()){var I=T.value;this.insertContent(I,g[I],t)}}catch(t){l={error:t}}finally{try{T&&!T.done&&(u=x.return)&&u.call(x)}finally{if(l)throw l.error}}try{for(var S=__values(Object.keys(f).reverse()),M=S.next();!M.done;M=S.next()){I=M.value;this.removeContent(I,f[I],t)}}catch(t){c={error:t}}finally{try{M&&!M.done&&(h=S.return)&&h.call(S)}finally{if(c)throw c.error}}try{for(var E=__values(Object.keys(m)),O=E.next();!O.done;O=E.next()){I=O.value;this.replaceContent(I,m[I],t)}}catch(t){d={error:t}}finally{try{O&&!O.done&&(p=E.return)&&p.call(E)}finally{if(d)throw d.error}}return t},i.prototype.replaceContent=function(t,e,i){var n,s=this.schema.findContentTypeFor(e);isNaN(t)&&(t=(n=__read(this.resolveContents(t,i),2))[0],i=n[1]),i[t]=s.loader.loadContent(e)},i.prototype.removeContent=function(t,e,i){var n;isNaN(t)&&(t=(n=__read(this.resolveContents(t,i),2))[0],i=n[1]),i.splice(t,1)},i.prototype.insertContent=function(t,e,i){var n,s=this.schema.findContentTypeFor(e);isNaN(t)&&(t=(n=__read(this.resolveContents(t,i),2))[0],i=n[1]),i.splice(t,0,s.loader.loadContent(e))},i.prototype.resolveContents=function(t,e){for(var i=t.split(/\.|\[|\]\[|\]\./),n=i.length-1,s=e,o=0;o<n;o++)s=s[i[o]];return[Number(i[n]),s.Contents]},i.prototype.findContents=function(t){for(var e=[],i=0;i<t.length;i++){var n=$(t[i]),s=n.find("[data-cid]").get();n.is("[data-cid]")&&e.push(n[0]),l.Utils.pushAll(e,s)}return e},i.prototype.getHtmlContainer=function(t){var e=$("<dom>");return"string"!=typeof t?e.append(t.clone()):e.append(t),e},i);function i(t){this.schema=t}t.RichTextHtmlLoader=e}((l=t.BusinessPack||(t.BusinessPack={})).Controls||(l.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e=(i.prototype.observe=function(){this._observer.observe(this.$element[0],{childList:!0,characterData:!0,subtree:!0})},i.prototype.disconnect=function(){this._observer.disconnect()},i);function i(t,e){this.$element=t,this.callback=e,this._observer=new MutationObserver(e)}t.RichTextHtmlObserver=e}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e=(i.prototype.allowContentType=function(t){(this._allowedContentTypes[t.name]=t).allowedCommands=t.allowedCommands||[],t.isHierarchical=t.isHierarchical||!1},i.prototype.allowAttributeType=function(t){(this._allowedAttributeTypes[t.name]=t).priority=t.priority||0},i.prototype.findContentTypeFor=function(t){var e,i=this._allowedContentTypes;for(e in i)if(i.hasOwnProperty(e)){var n=this.getContentType(e);if("string"==typeof n.elementSelector){if(t.is(n.elementSelector))return n}else if(n.elementSelector(t))return n}return null},i.prototype.findAttributeTypesFor=function(t){var e,i,n=[],s=this._allowedAttributeTypes;for(e in s)s.hasOwnProperty(e)&&("string"==typeof(i=this.getAttributeType(e)).elementSelector?t.is(i.elementSelector)&&n.push(i):i.elementSelector(t)&&n.push(i));return n},i.prototype.isAllowedContentWrapper=function(t){var e,i=this._allowedContentTypes;for(e in i)if(i.hasOwnProperty(e)){var n=this.getContentType(e);if(n.wrapperSelector)if("string"==typeof n.wrapperSelector){if(t.is(n.wrapperSelector))return!0}else if(n.wrapperSelector(t))return!0}return!1},i.prototype.getContentType=function(t){return this._allowedContentTypes[t]||null},i.prototype.getAttributeType=function(t){return this._allowedAttributeTypes[t]||null},i);function i(){this._allowedContentTypes={},this._allowedAttributeTypes={}}t.RichTextSchema=e}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e=(i.prototype.buildElement=function(t){return $("<"+this.getElementName(t)+">")},i);function i(t){this.schema=t}t.AttributeHtmlBuilderBase=e}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var o;!function(t){"use strict";var s,e=(s=t.AttributeHtmlBuilderBase,__extends(i,s),i.prototype.buildElement=function(t){var e,i=s.prototype.buildElement.call(this,t),n=o.RegexUtils.urlOrEmail("i").exec(t.Uri);return n?(n=(e=__read(n,3))[1],e=e[2],n?i.attr("href",n.startsWith("www")?"http://"+n:n).attr("target",t.Target).attr("rel","nofollow"):i.attr("href","mailto:"+e)):i.attr("href",t.Uri),i},i.prototype.getElementName=function(){return"a"},i);function i(){return null!==s&&s.apply(this,arguments)||this}t.HyperlinkAttributeHtmlBuilder=e}((o=t.BusinessPack||(t.BusinessPack={})).Controls||(o.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.AttributeHtmlBuilderBase,__extends(n,e),n.prototype.buildElement=function(t){return e.prototype.buildElement.call(this,t).attr("src",t.Uri).attr("title",t.Description).attr("alt",t.Description)},n.prototype.getElementName=function(){return"img"},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.ImageAttributeHtmlBuilder=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var i,e=(i=t.AttributeHtmlBuilderBase,__extends(n,i),n.prototype.getElementName=function(){return this._elementName},n);function n(t,e){e=i.call(this,e)||this;return e._elementName=t,e}t.InlineFormatAttributeHtmlBuilder=e}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.AttributeHtmlBuilderBase,__extends(n,e),n.prototype.getElementName=function(){return"br"},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.LineBreakAttributeHtmlBuilder=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.AttributeHtmlBuilderBase,__extends(n,e),n.prototype.buildElement=function(t){return e.prototype.buildElement.call(this,t).attr("cite",t.Source)},n.prototype.getElementName=function(){return"q"},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.QuoteAttributeHtmlBuilder=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var e;e=t.BusinessPack||(t.BusinessPack={}),function(){"use strict";function t(t){this.schema=t}(e.Controls||(e.Controls={})).AttributeHtmlLoaderBase=t}()}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.AttributeHtmlLoaderBase,__extends(n,e),n.prototype.loadAttribute=function(t,e){var i=this.getHyperlinkTarget(t),t={Type:"Hyperlink",Uri:this.getHyperlinkUri(t),Start:e,End:e+t.text().length};return i&&(t.Target=i),t},n.prototype.getHyperlinkUri=function(t){t=t.attr("href");return t=t.startsWith("mailto:")?t.substring(7):t},n.prototype.getHyperlinkTarget=function(t){t=t.attr("target");return t&&"_self"!==t?t:null},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.HyperlinkAttributeHtmlLoader=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.AttributeHtmlLoaderBase,__extends(n,e),n.prototype.loadAttribute=function(t,e){var i=this.getImageDescription(t),e={Type:"Image",Uri:this.getImageUri(t),Start:e,End:e};return i&&(e.Description=i),e},n.prototype.getImageUri=function(t){return t.attr("src")},n.prototype.getImageDescription=function(t){var e=t.attr("alt"),t=t.attr("title");return e||t||null},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.ImageAttributeHtmlLoader=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var i,e=(i=t.AttributeHtmlLoaderBase,__extends(n,i),n.prototype.loadAttribute=function(t,e){return{Type:this.attributeType,Start:e,End:e+t.text().length}},n);function n(t,e){e=i.call(this,e)||this;return e.attributeType=t,e}t.InlineFormatAttributeHtmlLoader=e}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.AttributeHtmlLoaderBase,__extends(n,e),n.prototype.loadAttribute=function(t,e){return{Type:"LineBreak",Start:e,End:e}},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.LineBreakAttributeHtmlLoader=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.AttributeHtmlLoaderBase,__extends(n,e),n.prototype.loadAttribute=function(t,e){var i=this.getQuoteSource(t),t={Type:"Quote",Start:e,End:e+t.text().length};return i&&(t.Source=i),t},n.prototype.getQuoteSource=function(t){return t.attr("cite")||null},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.QuoteAttributeHtmlLoader=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e=(i.prototype.addElement=function(t,e,i){return i.add(this.buildElement(t,e))},i.prototype.buildElement=function(t,e){return $("<"+this.getElementName(e)+">").attr("data-cid",t)},i);function i(t){this.schema=t}t.ContentHtmlBuilderBase=e}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var r;!function(t){"use strict";var i,e=(i=t.ContentHtmlBuilderBase,__extends(n,i),n.prototype.buildElement=function(t,e){t=i.prototype.buildElement.call(this,t,e);return e.Attributes&&e.Attributes.length?this.appendFlowContents(t,e):t.text(e.Text),t},n.prototype.appendFlowContents=function(t,e){var i=e.Text,n=r.Utils.deepClone(e.Attributes);n.sort(this.compareAttributes);for(var s=0;s<n.length;s++){var o=n[s];0===s&&t.append(i.substring(0,o.Start)),t.append(this.buildAttributeElement(i,s,n)),s===n.length-1?t.append(i.substring(o.End)):0<s&&t.append(i.substring(o.End,n[s+1].Start))}},n.prototype.buildAttributeElement=function(t,e,i){for(var n,s=i[e],o=this.schema.getAttributeType(s.Type),r=!0,a=null!=o?o.builder.buildElement(s):$("<"+s.Type+">"),l=e+1;l<i.length;l++){var u,c=i[l],h=this.schema.getAttributeType(c.Type);if(this.nextIsNotIntersecting(s,c))break;this.nextIsNested(s,c)?(n=c,r&&(a.append(t.substring(s.Start,c.Start)),r=!1),a.append(this.buildAttributeElement(t,l,i)),i.splice(l--,1)):(u=Math.abs(s.End-c.Start),this.nextHasHigherPriority(o,h)?(i.splice(1+l--,0,__assign({},s,{Start:c.Start,End:s.End})),s.End-=u):(i.splice(l--,0,__assign({},c,{Start:c.Start,End:s.End})),c.Start+=u))}return n?a.append(t.substring(n.End,s.End)):a.append(t.substring(s.Start,s.End)),o?a:a.contents()},n.prototype.nextIsNotIntersecting=function(t,e){return e.Start>=t.End},n.prototype.nextIsNested=function(t,e){return e.End<=t.End},n.prototype.nextHasHigherPriority=function(t,e){return!t||e.priority>t.priority},n.prototype.compareAttributes=function(t,e){return t.Start<e.Start?-1:t.Start===e.Start?e.End-t.End:1},n);function n(){return null!==i&&i.apply(this,arguments)||this}t.FlowContentHtmlBuilderBase=e}((r=t.BusinessPack||(t.BusinessPack={})).Controls||(r.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var i,e=(i=t.FlowContentHtmlBuilderBase,__extends(n,i),n.prototype.buildElement=function(t,e){t=i.prototype.buildElement.call(this,t,e);return e.IndentationLevel&&t.css("margin-left",15*e.IndentationLevel),e.Alignment&&t.css("text-align",e.Alignment),t},n.prototype.getElementName=function(t){return"p"},n);function n(){return null!==i&&i.apply(this,arguments)||this}t.ParagraphContentHtmlBuilder=e}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.ParagraphContentHtmlBuilder,__extends(n,e),n.prototype.addElement=function(t,e,i){var n=i.last();return this.isSuitableBlockquote(e,n)||(n=$("<blockquote>").attr("cite",e.Source),i=i.add(n)),this.buildElement(t,e).appendTo(n),i},n.prototype.isSuitableBlockquote=function(t,e){if(e.is("blockquote")){e=e.attr("cite")||null;return null==t.Source&&null==e?!0:t.Source===e}return!1},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.BlockquoteContentHtmlBuilder=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.FlowContentHtmlBuilderBase,__extends(n,e),n.prototype.getElementName=function(){return"pre"},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.FormattedContentHtmlBuilder=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.ParagraphContentHtmlBuilder,__extends(n,e),n.prototype.getElementName=function(t){return"h"+t.Level},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.HeadingContentHtmlBuilder=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var i,e=(i=t.FlowContentHtmlBuilderBase,__extends(n,i),n.prototype.addElement=function(t,e,i){var n,s=i.last();if(e.IndentationLevel){if(!s.is("ul,ol"))throw Error("The first list item can't be indented.");for(var o=0;o<e.IndentationLevel;o++){if(!(n=s.children("li").last()).length)throw Error("The indentation level must be incremented by 1.");s=n.children("ul,ol")}}return this.isSuitableList(e,s)||(s=$("<"+this._listElementName+">").css("list-style-type",e.Style),n?n.append(s):i=i.add(s)),this.buildElement(t,e).appendTo(s),i},n.prototype.isSuitableList=function(t,e){if(e.is(this._listElementName)){e=e.css("list-style-type")||null;return null==t.Style&&null==e?!0:t.Style===e}return!1},n.prototype.getElementName=function(){return"li"},n);function n(t,e){e=i.call(this,e)||this;return e._listElementName=t,e}t.ListContentHtmlBuilder=e}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(i){"use strict";var o,t=(o=i.ContentHtmlBuilderBase,__extends(e,o),e.prototype.buildElement=function(t,e){var i=o.prototype.buildElement.call(this,t,e),n=$("<tbody>").appendTo(i),s=null;return e.HasHeaderRow&&(s=$("<thead>").prependTo(i)),this.appendCells(t,s,n,e),i},e.prototype.appendCells=function(t,e,i,n){for(var s=0;s<n.Cells.length;s++){for(var o=n.HasHeaderRow&&0===s,r=$("<tr>").attr("data-row",null!=t?s:null),a=0;a<n.Cells[s].length;a++){var l=n.Cells[s][a],u=o?$("<th>"):$("<td>");u.attr("colspan",l.ColSpan).attr("rowspan",l.RowSpan).attr("data-column",null!=t?a:null),"string"==typeof l.Contents?u.text(l.Contents):u.append(this._htmlBuilder.buildDom(l.Contents,null!=t,t+".Cells["+s+"]["+a+"].")),r.append(u)}(o?e:i).append(r)}},e.prototype.getElementName=function(){return"table"},e);function e(t){var e=o.call(this,t)||this;return e._htmlBuilder=new i.RichTextHtmlBuilder(t),e}i.TableContentHtmlBuilder=t}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var e;e=t.BusinessPack||(t.BusinessPack={}),function(){"use strict";function t(t){this.schema=t}(e.Controls||(e.Controls={})).ContentHtmlLoaderBase=t}()}(DotVVM=DotVVM||{}),function(t){var p;!function(t){"use strict";var e,i=(e=t.ContentHtmlLoaderBase,__extends(n,e),n.prototype.loadAttributes=function(t){var e,i,n=[],s=document.createTreeWalker(t[0],NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT),o=!0,r=0,a=[];for(s.firstChild();o||s.nextSibling();){var o=!1,l=$(s.currentNode);if(p.DomUtils.isText(s.currentNode))r+=s.currentNode.length;else{var u=this.schema.findAttributeTypesFor(l);if(u.length){try{for(var c=__values(u),h=c.next();!h.done;h=c.next()){var d=h.value.loader.loadAttribute(l,r);this.mergeWithParent(d,n)||n.push(d)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(i=c.return)&&i.call(c)}finally{if(e)throw e.error}}l.contents().length&&(o=!0,a.push(s.currentNode),s.firstChild())}}if(!o)for(;!s.currentNode.nextSibling&&a.length;)s.currentNode=a.pop()}return n},n.prototype.mergeWithParent=function(t,e){for(var i=0;i<e.length;i++){var n=e[i];if(!(n.End<t.Start)&&(n.Start!==n.End&&this.canBeMerged(t,n)))return n.End>t.End||(n.End+=t.End-n.End),!0}return!1},n.prototype.canBeMerged=function(t,e){for(var i in t)if(t.hasOwnProperty(i)&&"Start"!==i&&"End"!==i&&t[i]!==e[i])return!1;return!0},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.FlowContentHtmlLoaderBase=i}((p=t.BusinessPack||(t.BusinessPack={})).Controls||(p.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.FlowContentHtmlLoaderBase,__extends(n,e),n.prototype.getIndentationLevel=function(t){t=t[0].style.marginLeft;return t?parseInt(t)/15:0},n.prototype.getAlignment=function(t){t=t[0].style.textAlign;return t?t.toLowerCase():null},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.ParagraphContentHtmlLoaderBase=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.ParagraphContentHtmlLoaderBase,__extends(n,e),n.prototype.loadContent=function(t){var e=this.getAlignment(t),i=this.getIndentationLevel(t),n=this.getQuoteSource(t),s=this.loadAttributes(t),t={Type:"Blockquote",Text:t.text()};return e&&(t.Alignment=e),i&&(t.IndentationLevel=i),n&&(t.Source=n),s.length&&(t.Attributes=s),t},n.prototype.getQuoteSource=function(t){return t.parent().attr("cite")||null},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.BlockquoteContentHtmlLoader=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.FlowContentHtmlLoaderBase,__extends(n,e),n.prototype.loadContent=function(t){var e=this.loadAttributes(t),t={Type:"Formatted",Text:t.text()};return e.length&&(t.Attributes=e),t},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.FormattedContentHtmlLoader=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.ParagraphContentHtmlLoaderBase,__extends(n,e),n.prototype.loadContent=function(t){var e=this.getAlignment(t),i=this.getIndentationLevel(t),n=this.loadAttributes(t),t={Type:"Heading",Level:this.getHeadingLevel(t),Text:t.text()};return e&&(t.Alignment=e),i&&(t.IndentationLevel=i),n.length&&(t.Attributes=n),t},n.prototype.getHeadingLevel=function(t){return Number(t[0].tagName.substring(1))},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.HeadingContentHtmlLoader=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.FlowContentHtmlLoaderBase,__extends(n,e),n.prototype.loadContent=function(t){var e=this.getListStyle(t),i=this.getIndentationLevel(t),n=this.loadAttributes(t),t={Type:this.getListType(t),Text:this.getItemText(t)};return e&&(t.Style=e),i&&(t.IndentationLevel=i),n.length&&(t.Attributes=n),t},n.prototype.getListType=function(t){return t.parent().is("ul")?"BulletedList":"NumberedList"},n.prototype.getListStyle=function(t){t=t.parent();if(t.length){t=t[0].style.listStyleType;if(t)return t.toLowerCase()}return null},n.prototype.getIndentationLevel=function(t){var e="."+s.BusinessPackCss.primitiveEditor;return t.parentsUntil(e,"ul,ol").length-1},n.prototype.getItemText=function(t){return t.clone().children().remove().end().text()},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.ListContentHtmlLoader=i}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.ParagraphContentHtmlLoaderBase,__extends(n,e),n.prototype.loadContent=function(t){var e=this.getAlignment(t),i=this.getIndentationLevel(t),n=this.loadAttributes(t),t={Type:"Paragraph",Text:t.text()};return e&&(t.Alignment=e),i&&(t.IndentationLevel=i),n.length&&(t.Attributes=n),t},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.ParagraphContentHtmlLoader=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(i){"use strict";var n,t=(n=i.ContentHtmlLoaderBase,__extends(e,n),e.prototype.loadContent=function(t){var e=t.children("thead"),i=t.children("tbody"),t=e.children("tr").add(i.children("tr")).add(t.children("tr"));return{Type:"Table",HasHeaderRow:this.hasHeaderRow(e,t),Cells:this.getTableCells(t)}},e.prototype.hasHeaderRow=function(t,e){return!!(t.length||e.length&&e.first().children("th").length)},e.prototype.getTableCells=function(t){var e,i,n,s,o=[];try{for(var r=__values(t.get()),a=r.next();!a.done;a=r.next()){var l=a.value,u=$(l),c=[];try{for(var h=__values(u.children("th,td").get()),d=h.next();!d.done;d=h.next()){var p=d.value,g=$(p),p={Contents:this.getCellContents(g)};g.attr("colspan")&&(p.ColSpan=Number(g.attr("colspan"))),g.attr("rowspan")&&(p.RowSpan=Number(g.attr("rowspan"))),c.push(p)}}catch(t){n={error:t}}finally{try{d&&!d.done&&(s=h.return)&&s.call(h)}finally{if(n)throw n.error}}o.push(c)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}return o},e.prototype.getCellContents=function(t){return t.children().length?this._htmlLoader.loadContents(t.contents()):t.text()},e);function e(t){var e=n.call(this,t)||this;return e._htmlLoader=new i.RichTextHtmlLoader(t),e}i.TableContentHtmlLoader=t}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(e){"use strict";var t=(i.prototype.initialize=function(t){t.allowAttributeType({name:"Hyperlink",priority:10,builder:new e.HyperlinkAttributeHtmlBuilder(t),elementSelector:"a[href]",loader:new e.HyperlinkAttributeHtmlLoader(t)})},i);function i(){}e.HyperlinkModule=t}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(e){"use strict";var t=(i.prototype.initialize=function(t){t.allowAttributeType({name:"Image",builder:new e.ImageAttributeHtmlBuilder(t),elementSelector:"img[src]",loader:new e.ImageAttributeHtmlLoader(t)})},i);function i(){}e.ImageModule=t}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(e){"use strict";var t=(i.prototype.initialize=function(t){t.allowAttributeType({name:"Bold",builder:new e.InlineFormatAttributeHtmlBuilder("b",t),elementSelector:this.isBoldAttribute,loader:new e.InlineFormatAttributeHtmlLoader("Bold",t)}),t.allowAttributeType({name:"Italic",builder:new e.InlineFormatAttributeHtmlBuilder("i",t),elementSelector:this.isItalicAttribute,loader:new e.InlineFormatAttributeHtmlLoader("Italic",t)}),t.allowAttributeType({name:"Underline",builder:new e.InlineFormatAttributeHtmlBuilder("u",t),elementSelector:this.isUnderlineAttribute,loader:new e.InlineFormatAttributeHtmlLoader("Underline",t)}),t.allowAttributeType({name:"Strikethrough",builder:new e.InlineFormatAttributeHtmlBuilder("strike",t),elementSelector:this.isStrikethroughAttribute,loader:new e.InlineFormatAttributeHtmlLoader("Strikethrough",t)}),t.allowAttributeType({name:"Subscript",builder:new e.InlineFormatAttributeHtmlBuilder("sub",t),elementSelector:"sub",loader:new e.InlineFormatAttributeHtmlLoader("Subscript",t)}),t.allowAttributeType({name:"Superscript",builder:new e.InlineFormatAttributeHtmlBuilder("sup",t),elementSelector:"sup",loader:new e.InlineFormatAttributeHtmlLoader("Superscript",t)})},i.prototype.isBoldAttribute=function(t){return!!t.is("b,strong")||!(!t.is("span")||"bold"!==t[0].style.fontWeight)},i.prototype.isItalicAttribute=function(t){return!!t.is("i,em")||!(!t.is("span")||"italic"!==t[0].style.fontStyle)},i.prototype.isUnderlineAttribute=function(t){return!!t.is("u")||!(!t.is("span")||"underline"!==t[0].style.textDecoration)},i.prototype.isStrikethroughAttribute=function(t){return!!t.is("strike")||!(!t.is("span")||"line-through"!==t[0].style.textDecoration)},i);function i(){}e.InlineFormatModule=t}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(e){"use strict";var t=(i.prototype.initialize=function(t){t.allowContentType({name:"Heading",builder:new e.HeadingContentHtmlBuilder(t),elementSelector:"h1,h2,h3,h4,h5,h6",loader:new e.HeadingContentHtmlLoader(t)}),t.allowContentType({name:"Paragraph",builder:new e.ParagraphContentHtmlBuilder(t),elementSelector:this.isParagraphContent,loader:new e.ParagraphContentHtmlLoader(t)}),t.allowContentType({name:"Blockquote",builder:new e.BlockquoteContentHtmlBuilder(t),wrapperSelector:"blockquote",elementSelector:this.isBlockquoteContent,loader:new e.BlockquoteContentHtmlLoader(t)}),t.allowContentType({name:"BulletedList",isHierarchical:!0,builder:new e.ListContentHtmlBuilder("ul",t),wrapperSelector:"ul",elementSelector:"li",loader:new e.ListContentHtmlLoader(t)}),t.allowContentType({name:"NumberedList",isHierarchical:!0,builder:new e.ListContentHtmlBuilder("ol",t),wrapperSelector:"ol",elementSelector:"li",loader:new e.ListContentHtmlLoader(t)}),t.allowAttributeType({name:"Quote",builder:new e.QuoteAttributeHtmlBuilder(t),elementSelector:"q",loader:new e.QuoteAttributeHtmlLoader(t)}),t.allowAttributeType({name:"LineBreak",builder:new e.LineBreakAttributeHtmlBuilder(t),elementSelector:"br",loader:new e.LineBreakAttributeHtmlLoader(t)})},i.prototype.isParagraphContent=function(t){return t.is("p")&&!t.parent("blockquote").length},i.prototype.isBlockquoteContent=function(t){return t.is("p")&&!!t.parent("blockquote").length},i);function i(){}e.ParagraphModule=t}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(e){"use strict";var t=(i.prototype.initialize=function(t){t.allowContentType({name:"Formatted",builder:new e.FormattedContentHtmlBuilder(t),elementSelector:"pre",loader:new e.FormattedContentHtmlLoader(t)})},i);function i(){}e.SourceCodeModule=t}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(e){"use strict";var t=(i.prototype.initialize=function(t){t.allowContentType({name:"Table",builder:new e.TableContentHtmlBuilder(t),elementSelector:"table",loader:new e.TableContentHtmlLoader(t)})},i);function i(){}e.TableModule=t}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),n.prototype.getItemValueBinding=function(){return this.binding.itemValueBinding},n.prototype.getItemKeyBinding=function(){return this.binding.itemKeyBinding},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.SelectableBaseCheckbox=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.SelectableBaseCheckbox,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.$element.on("change","[type=checkbox]",this.onInputChange.bind(this)),this.subscribe(this.binding.selectedRows,this.onSelectionRowsChanged.bind(this))},n.prototype.isSelected=function(t){var e,i,n=this.getItemKey(t),s=this.binding.selectedRows();try{for(var o=__values(s),r=o.next();!r.done;r=o.next()){var a=r.value;if(this.getItemKey(a)===n)return ko.observableArray([t])}}catch(t){e={error:t}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}return ko.observableArray()},n.prototype.getItemKey=function(t){var e=ko.unwrap(t),i=this.getItemKeyBinding();if(null==e)throw Error("The unique key can't be resolved for null or undefined.");if("object"==typeof(e=i?ko.unwrap(i(t)):e))throw Error("The unique key can't be resolved. Is KeyBinding property missing?");return e},n.prototype.onSelectionRowsChanged=function(t){var e,i,n,s,o=ko.dataFor(this.$element.get(0)),r=this.binding.selectedRows(),a=!1;if(this.binding.itemKeyBinding){var l=this.getItemKey(o);try{for(var u=__values(r),c=u.next();!c.done;c=u.next()){var h=c.value;if(this.getItemKey(h)===l){a=!0;break}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(e)throw e.error}}}else{var d=this.getItemValueBinding(),p=ko.unwrap(d(o));try{for(var g=__values(r),f=g.next();!f.done;f=g.next()){h=f.value;if(ko.unwrap(h)===p){a=!0;break}}}catch(t){n={error:t}}finally{try{f&&!f.done&&(s=g.return)&&s.call(g)}finally{if(n)throw n.error}}}this.toggleSelectedClass(a)},n.prototype.onInputChange=function(t){this.postback(this.binding.changed)},n.prototype.toggleSelectedClass=function(t){t?this.$element.parents("tr").addClass(s.BusinessPackCss.gridViewSelectedRow):this.$element.parents("tr").removeClass(s.BusinessPackCss.gridViewSelectedRow)},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.SelectableCheckBox=i,s.Utils.installBindingHandler("SelectableCheckBox",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var h;!function(t){"use strict";var e,i=(e=t.SelectableBaseCheckbox,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.inputClickUpdating=!1,this.$element.click(this.onInputClick.bind(this)),this.subscribe(this.binding.selectedRows,this.selectedRowChanged.bind(this)),this.watch(this.getDataSourceItems(),this.dataSourceChanged.bind(this))},n.prototype.dataSourceChanged=function(t,e){this.binding.selectedRows&&this.binding.selectedRows.removeAll()},n.prototype.selectedRowChanged=function(t,e){var i,n,s=ko.unwrap(this.getDataSourceItems());if(!e&&!this.inputClickUpdating&&s){var o=this.getItemValueBinding(),r=this.getItemKeyBinding(),a=new h.Linq(ko.unwrap(this.binding.selectedRows)),l=!1;try{for(var u=__values(s),c=u.next();!c.done;c=u.next())if("break"===function(e){if(!(l=r?a.any(function(t){return ko.unwrap(r(t))===ko.unwrap(r(e))}):a.any(function(t){return ko.unwrap(t)===ko.unwrap(o(e))})))return"break"}(c.value))break}catch(t){i={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}this.$element.children("label").children("input")[0].checked=l}},n.prototype.onInputClick=function(t){var e,i;if(this.isEnabled&&t.target instanceof HTMLInputElement){this.inputClickUpdating=!0;var n=ko.unwrap(this.getDataSourceItems());if(n){var s=new h.Linq(ko.unwrap(this.binding.selectedRows));if(t.target.checked){var o=this.getItemValueBinding(),r=this.getItemKeyBinding(),a=this;try{for(var l=__values(n),u=l.next();!u.done;u=l.next())!function(t){var e,i=ko.unwrap(o(t));r?(e=ko.unwrap(r(t)),s.any(function(t){return ko.unwrap(r(t))===e})||a.binding.selectedRows.push(ko.observable(i))):s.any(function(t){return ko.unwrap(t)===i})||a.binding.selectedRows.push(ko.observable(i))}(u.value)}catch(t){e={error:t}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(e)throw e.error}}}else this.binding.selectedRows.removeAll()}this.postback(this.binding.changed),this.inputClickUpdating=!1}},n.prototype.getDataSourceItems=function(){return h.Utils.getDataSourceItems(this.binding.dataSource)},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.SelectableHeaderCheckBox=i,h.Utils.installBindingHandler("SelectableHeaderCheckBox",i)}((h=t.BusinessPack||(t.BusinessPack={})).Controls||(h.Controls={}))}(DotVVM=DotVVM||{}),function(t){var r;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),Object.defineProperty(n.prototype,"maxValue",{get:function(){return ko.unwrap(this.binding.maxValue)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"minValue",{get:function(){return ko.unwrap(this.binding.minValue)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"enabled",{get:function(){return null==this.binding.enabled||ko.unwrap(this.binding.enabled)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"step",{get:function(){return ko.unwrap(this.binding.step)},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){var t=this;e.prototype.initialize.call(this),this.$lineValue=this.$element.find("."+r.BusinessPackCss.primitiveValue),this.$lineEnd=this.$element.find("."+r.BusinessPackCss.positionEnd),this.subscribe(this.binding.minValue,function(){return t.update(!0)}),this.subscribe(this.binding.maxValue,function(){return t.update(!0)}),this.subscribe(this.binding.step,function(){return t.update(!0)})},n.prototype.startDrag=function(t,e){var i,n,s,o=this;this.enabled&&(e.focus(),i=$(window),n=function(t){return o.handleDraged(r.Utils.convertTouchToMouseEvent(t),e)},i.on("mousemove touchmove",n),s=function(){i.off("mousemove touchmove",n),o.fireChangedEvent(),i.off("mouseup touchend",s)},i.on("mouseup touchend",s),t.preventDefault())},n.prototype.handleDraged=function(t,e){t=t.clientX-this.$element.offset().left;(t=t<0?0:t)>this.$element.innerWidth()&&(t=this.$element.innerWidth());t=this.calculateCurrentValueFromPossition(t);return this.constrain(t,this.minValue,this.maxValue)},n.prototype.constrain=function(t,e,i){return i<t?i:t<e?e:t},n.prototype.getPercentageRepresentationOfValue=function(t){return 100*(t-this.minValue)/(this.maxValue-this.minValue)},n.prototype.getPercentageRepresentationOfWidth=function(t){t=100*t/this.$element.width();return t=t<0?0:t},n.prototype.setWidthOfValueLine=function(t){t=this.getPercentageRepresentationOfValue(t);this.$lineValue.get(0).style.flexGrow=t.toString()},n.prototype.setWidthOfRightLine=function(t){t=this.getPercentageRepresentationOfValue(t);this.$lineEnd.get(0).style.flexGrow=t.toString()},n.prototype.getWidthInPixelsFromValue=function(t){return this.$element.width()/(this.maxValue-this.minValue)*t},n.prototype.moveHandler=function(t,e){},n.prototype.calculateCurrentValueFromPossition=function(t){var e=this.getStepWidth();t=Math.round(t/e)*e;t=this.getPercentageRepresentationOfWidth(t),t=this.minValue+t/100*(this.maxValue-this.minValue);return Number(t.toFixed(5))},n.prototype.getStepWidth=function(){return this.getWidthInPixelsFromValue(this.step)},n.prototype.fireChangedEvent=function(){this.binding.changed&&this.binding.changed()},n);function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.holdTimeoutId=null,t}t.SliderBase=i}((r=t.BusinessPack||(t.BusinessPack={})).Controls||(r.Controls={}))}(DotVVM=DotVVM||{}),function(t){var n;!function(t){"use strict";var o,e=(o=t.SliderBase,__extends(i,o),Object.defineProperty(i.prototype,"selectedStartValue",{get:function(){return ko.unwrap(this.binding.selectedMinValue)},set:function(t){var e=this.binding.selectedMinValue;ko.isWriteableObservable(e)&&e(null!=t?t:null),this.updateHandlesAndSelectedValue(this.selectedStartValue,this.selectedEndValue)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedEndValue",{get:function(){return ko.unwrap(this.binding.selectedMaxValue)},set:function(t){var e=this.binding.selectedMaxValue;ko.isWriteableObservable(e)&&e(null!=t?t:null),this.updateHandlesAndSelectedValue(this.selectedStartValue,this.selectedEndValue)},enumerable:!0,configurable:!0}),i.prototype.update=function(t){var e=this;void 0===t&&(t=!1);var i=!(e.startValueAtLastPostBack===e.selectedStartValue||e.endValueAtLastPostBack===e.selectedEndValue);!t&&(this.updateAllReaduScheduled||i)||(this.updateAllReaduScheduled=!0,setTimeout(function(){e.checkRangeAndRepairItIfNessesary(),e.updateHandlesAndSelectedValue(e.selectedStartValue,e.selectedEndValue),e.updateAllReaduScheduled=!1},100))},i.prototype.checkRangeAndRepairItIfNessesary=function(){var t=!1,e=!1;this.selectedStartValue>this.selectedEndValue&&(n.Utils.warnInDebugMode("Start of the range cannot be after its end."),this.selectedStartValue=this.minValue,t=!0),this.selectedEndValue<this.selectedStartValue&&(n.Utils.warnInDebugMode("End of the range cannot be before its start."),this.selectedEndValue=this.maxValue,e=!0),this.selectedStartValue<this.minValue&&(n.Utils.warnInDebugMode("Start of the range is lower than MIN value. "),this.selectedStartValue=this.minValue,t=!0),this.selectedEndValue>this.maxValue&&(n.Utils.warnInDebugMode("End of the range is higher than MAX value. "),this.selectedEndValue=this.maxValue,e=!0),(t||e)&&this.fireChangedEvent()},i.prototype.initialize=function(){var e=this;this.$handleStart=this.$element.find("."+n.BusinessPackCss.sliderMinGrip),this.$handleEnd=this.$element.find("."+n.BusinessPackCss.sliderMaxGrip),this.$lineStart=this.$element.find("."+n.BusinessPackCss.positionStart),o.prototype.initialize.call(this),this.subscribe(this.binding.selectedMinValue,function(){e.update(!0)}),this.subscribe(this.binding.selectedMaxValue,function(){e.update(!0)}),this.checkRangeAndRepairItIfNessesary(),this.updateHandlesAndSelectedValue(this.selectedStartValue,this.selectedEndValue),this.$handleStart.focus(function(t){return e.onHandleFocus(t)}),this.$handleStart.blur(function(t){return e.onHandleBlur(t)}),this.$handleStart.keydown(function(t){return e.onHandleKeydown(t)}),this.$handleEnd.focus(function(t){return e.onHandleFocus(t)}),this.$handleEnd.blur(function(t){return e.onHandleBlur(t)}),this.$handleEnd.keydown(function(t){return e.onHandleKeydown(t)}),this.$handleStart.on("touchstart mousedown",function(t){return e.startDrag(t,e.$handleStart)}),this.$handleEnd.on("touchstart mousedown",function(t){return e.startDrag(t,e.$handleEnd)}),this.$element.on("click",function(t){return e.moveClosestHandler(t)})},i.prototype.onHandleFocus=function(t){this.$element.addClass(n.BusinessPackCss.stateFocused),$(t.target).addClass(n.BusinessPackCss.stateFocused)},i.prototype.onHandleBlur=function(t){this.$element.removeClass(n.BusinessPackCss.stateFocused),$(t.target).removeClass(n.BusinessPackCss.stateFocused)},i.prototype.onHandleKeydown=function(t){var e=this;this.isEnabled&&n.KeyboardKeys.isLeftOrRight(t.which)&&(t.stopPropagation(),this.$handleStart.is(t.target)?this.setKeydownTimeout(t.which===n.KeyboardKeys.right,this.selectedStartValue,function(t){return t>e.selectedEndValue&&(t=e.selectedEndValue),e.selectedStartValue=t}):this.setKeydownTimeout(t.which===n.KeyboardKeys.right,this.selectedEndValue,function(t){return t<e.selectedStartValue&&(t=e.selectedStartValue),e.selectedEndValue=t}))},i.prototype.moveClosestHandler=function(t){var e,i;this.enabled&&(e=t.clientX-this.$handleStart.offset().left,i=t.clientX-this.$handleEnd.offset().left,t=t.clientX-this.$element.offset().left,Math.abs(e)<=Math.abs(i)?(this.$handleStart.focus(),this.selectedStartValue=this.calculateCurrentValueFromPossition(t)):(this.$handleEnd.focus(),this.selectedEndValue=this.calculateCurrentValueFromPossition(t)),this.fireChangedEvent())},i.prototype.setKeydownTimeout=function(t,e,i){var n=this,s=null==this.holdTimeoutId?600:200,t=e+(t?this.step:-this.step);clearTimeout(this.holdTimeoutId),i(t=this.constrain(t,this.minValue,this.maxValue)),this.holdTimeoutId=setTimeout(function(){clearTimeout(n.holdTimeoutId),n.holdTimeoutId=null,n.fireChangedEvent()},s)},i.prototype.handleDraged=function(t,e){if(!this.enabled)return null;var i,n=e==this.$handleStart,s=e==this.$handleEnd;return n&&(i=o.prototype.handleDraged.call(this,t,e),(n=this.selectedEndValue)<i&&(i=n),this.selectedStartValue=i),s&&((i=o.prototype.handleDraged.call(this,t,e))<(e=this.selectedStartValue)&&(i=e),this.selectedEndValue=i),i},i.prototype.updateHandles=function(){this.moveHandler(this.selectedStartValue,this.$handleStart),this.moveHandler(this.selectedEndValue,this.$handleEnd)},i.prototype.updateHandlesAndSelectedValue=function(t,e){var i=e-t;this.setWidthOfValueLine(this.minValue+i),this.setWidthOfLeftLine(t),this.setWidthOfRightLine(this.maxValue-(this.minValue+t+i)),this.moveHandler(t,this.$handleStart),this.moveHandler(e,this.$handleEnd)},i.prototype.setWidthOfLeftLine=function(t){t=this.getPercentageRepresentationOfValue(t);this.$lineStart.css("flex-grow",t)},i.prototype.fireChangedEvent=function(){var t=!1;this.selectedStartValue!==this.startValueAtLastPostBack&&(this.startValueAtLastPostBack=this.selectedStartValue,t=!0),this.selectedEndValue!==this.endValueAtLastPostBack&&(this.endValueAtLastPostBack=this.selectedEndValue,t=!0),t&&o.prototype.fireChangedEvent.call(this)},i.prototype.toggleTabIndex=function(){this.isEnabled?(this.$handleStart.attr("tabindex",this.binding.tabIndex),this.$handleEnd.attr("tabindex",this.binding.tabIndex)):(this.$handleStart.removeAttr("tabindex"),this.$handleEnd.removeAttr("tabindex"))},i);function i(){return null!==o&&o.apply(this,arguments)||this}t.RangeSlider=e,n.Utils.installBindingHandler("RangeSlider",e)}((n=t.BusinessPack||(t.BusinessPack={})).Controls||(n.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var i,e=(i=t.SliderBase,__extends(n,i),Object.defineProperty(n.prototype,"selectedValue",{get:function(){return ko.unwrap(this.binding.selectedValue)},set:function(t){var e=this.binding.selectedValue;this.updateHandleAndValue(t),ko.isWriteableObservable(e)&&e(null!=t?t:null)},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){var e=this;this.$handle=this.$element.find("."+s.BusinessPackCss.primitiveGrip),i.prototype.initialize.call(this),this.subscribe(this.binding.selectedValue,function(t){return e.updateHandleAndValue(t)}),this.updateHandleAndValue(this.selectedValue),this.$handle.on("touchstart mousedown",function(t){return e.startDrag(t,e.$handle)}),this.$handle.focus(function(t){return e.onHandleFocus(t)}),this.$handle.blur(function(t){return e.onHandleBlur(t)}),this.$handle.keydown(function(t){return e.onHandleKeydown(t)}),this.$element.click(function(t){return e.moveHandleOnClick(t)}),this.valueAtLastPostback=this.selectedValue},n.prototype.onHandleFocus=function(t){this.$element.addClass(s.BusinessPackCss.stateFocused),this.$handle.addClass(s.BusinessPackCss.stateFocused)},n.prototype.onHandleBlur=function(t){this.$element.removeClass(s.BusinessPackCss.stateFocused),this.$handle.removeClass(s.BusinessPackCss.stateFocused)},n.prototype.onHandleKeydown=function(t){this.isEnabled&&s.KeyboardKeys.isLeftOrRight(t.which)&&(t.stopPropagation(),this.setKeydownTimeout(t.which===s.KeyboardKeys.right))},n.prototype.setKeydownTimeout=function(t){var e=this,i=null==this.holdTimeoutId?600:200,t=t?this.step:-this.step,t=this.selectedValue+t;clearTimeout(this.holdTimeoutId),t=this.constrain(t,this.minValue,this.maxValue),this.selectedValue=t,this.holdTimeoutId=setTimeout(function(){clearTimeout(e.holdTimeoutId),e.holdTimeoutId=null,e.fireChangedEvent()},i)},n.prototype.moveHandleOnClick=function(t){this.enabled&&(this.$handle.focus(),t=t.clientX-this.$element.offset().left,this.selectedValue=this.calculateCurrentValueFromPossition(t),this.fireChangedEvent())},n.prototype.update=function(t){var e=this;(t||!this.updateAllReaduScheduled&&e.valueAtLastPostback===e.selectedValue)&&(this.updateAllReaduScheduled=!0,setTimeout(function(){e.checkValueAndRepairItIfNessesary(),e.updateHandleAndValue(e.selectedValue),e.updateAllReaduScheduled=!1},100))},n.prototype.updateHandleAndValue=function(t){this.setWidthOfValueLine(t),this.setWidthOfRightLine(this.minValue+this.maxValue-t),this.moveHandler(this.selectedValue,this.$handle)},n.prototype.handleDraged=function(t,e){e=i.prototype.handleDraged.call(this,t,e);return this.selectedValue=e},n.prototype.fireChangedEvent=function(){this.selectedValue!==this.valueAtLastPostback&&(this.valueAtLastPostback=this.selectedValue,i.prototype.fireChangedEvent.call(this))},n.prototype.checkValueAndRepairItIfNessesary=function(){var t=!1;this.selectedValue>this.maxValue&&(this.selectedValue=this.maxValue,s.Utils.warnInDebugMode("Selected value fixed to match max value."),t=!0),this.selectedValue<this.minValue&&(this.selectedValue=this.maxValue,s.Utils.warnInDebugMode("Selected value fixed to match min value."),t=!0),t&&this.fireChangedEvent()},n.prototype.toggleTabIndex=function(){this.isEnabled?this.$handle.attr("tabindex",this.binding.tabIndex):this.$handle.removeAttr("tabindex")},n);function n(){return null!==i&&i.apply(this,arguments)||this}t.Slider=e,s.Utils.installBindingHandler("Slider",e)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var i,e=(i=t.ButtonBase,__extends(n,i),n.prototype.initialize=function(){var e=this;i.prototype.initialize.call(this),this.$element.click(function(t){return e.onElementClick(t)}),this.subscribe(this.binding.checked,this.onCheckedChange)},n.prototype.onElementClick=function(t){var e=this.binding.checked;this.isEnabled&&(t.stopPropagationAndPreventDefault(),ko.isWriteableObservable(e)&&e(!e()),this.postback(this.binding.click))},n.prototype.onCheckedChange=function(t){this.$element.toggleClass(s.BusinessPackCss.stateChecked,t)},n);function n(){return null!==i&&i.apply(this,arguments)||this}t.SwitchButton=e,s.Utils.installBindingHandler("SwitchButton",e),s.Utils.installBindingHandler("SwitchButtonItem",e)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var i,e=(i=t.ItemsControlBase,__extends(n,i),Object.defineProperty(n.prototype,"activeTabKey",{get:function(){var t=ko.unwrap(this.binding.activeTabKey);return null!=t?t:null},set:function(t){var e=this.binding.activeTabKey;ko.isWriteableObservable(e)&&e(null!=t?t:null)},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){var e=this;i.prototype.initialize.call(this),this.$header=this.$element.children("."+s.BusinessPackCss.primitiveNav),this.$header.on("click","."+s.BusinessPackCss.tabControlNavItem,function(t){return e.onHeaderItemClick(t)}),null==this.binding.activeTabKey&&(this.binding.activeTabKey=ko.observable(null),this.binding.tabIsActiveBinding&&this.watch(this.binding.dataSource,this.onDataSourceChange)),this.binding.dataSource&&this.subscribe(this.binding.activeTabKey,this.onActiveTabKeyChange),ko.unwrap(this.binding.activeTabKey)||this.setFirstTabActive()},n.prototype.isDataSourceEmpty=function(){return!this.binding.dataSource||this.binding.dataSource&&0==ko.unwrap(this.binding.dataSource).length},n.prototype.hasAnyHardCodedTabs=function(){return!this.binding.dataSource&&!this.$element.children("."+s.BusinessPackCss.tabControlItem).empty()},n.prototype.setFirstTabActive=function(){var t;this.isDataSourceEmpty()&&!this.hasAnyHardCodedTabs()||(t=this.$header.children("."+s.BusinessPackCss.tabControlNavItem+":not(."+s.BusinessPackCss.stateDisabled+")").first(),this.setActiveTab(t,this.binding.dataSource()[0]))},n.prototype.onHeaderItemClick=function(t){t=$(t.currentTarget);this.setActiveTab(t,null)},n.prototype.setActiveTab=function(t,e){var i=this.activeTabKey;t.hasClass(s.BusinessPackCss.stateDisabled)||(this.binding.dataSource?this.activeTabKey=this.getItemKey(e||ko.dataFor(t.get(0))):this.activeTabKey=t.data("key"),this.activeTabKey!==i&&this.postback(this.binding.activeTabChanged))},n.prototype.onActiveTabKeyChange=function(t){this.updateTabIsActiveBinding()},n.prototype.onDataSourceChange=function(){var e,t,i=this.binding.tabIsActiveBinding;try{for(var n=__values(this.items()),s=n.next();!s.done;s=n.next()){var o=s.value;if(ko.unwrap(i(o))){this.activeTabKey=this.getItemKey(o);break}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},n.prototype.updateTabIsActiveBinding=function(){var e,t,i=this.binding.tabIsActiveBinding;if(i)try{for(var n=__values(this.getAllItems()),s=n.next();!s.done;s=n.next()){var o=s.value,r=i(o);ko.isWriteableObservable(r)&&r(this.getItemKey(o)===this.activeTabKey)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},n.prototype.isTabActive=function(t){return this.binding.dataSource?this.activeTabKey===ko.unwrap(t):this.activeTabKey==ko.unwrap(t)},n.prototype.getItemKeyBinding=function(){return this.binding.tabKeyBinding},n);function n(){return null!==i&&i.apply(this,arguments)||this}t.TabControl=e,s.Utils.installBindingHandler("TabControl",e)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this);var t=this.$element.children("."+s.BusinessPackCss.primitiveTextBox);t.focus(this.onInputFocus.bind(this)),t.blur(this.onInputBlur.bind(this))},n.prototype.onInputFocus=function(){this.$element.addClass(s.BusinessPackCss.stateFocused)},n.prototype.onInputBlur=function(){this.$element.removeClass(s.BusinessPackCss.stateFocused)},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.TextBox=i,s.Utils.installBindingHandler("TextBox",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.$element.focus(this.onElementFocus.bind(this)),this.$element.blur(this.onElementBlur.bind(this)),this.$element.change(this.onElementChange.bind(this))},n.prototype.onElementFocus=function(){this.binding.AddFocusClass&&this.$element.addClass(s.BusinessPackCss.stateFocused)},n.prototype.onElementBlur=function(){this.binding.AddFocusClass&&this.$element.removeClass(s.BusinessPackCss.stateFocused)},n.prototype.onElementChange=function(t){this.isEnabled&&this.postback(this.binding.changed)},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.TextBoxPrimitive=i,s.Utils.installBindingHandler("TextBoxPrimitive",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var h;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this),this.subscribe(this.binding.text,this.onTextChanged)},n.prototype.onTextChanged=function(t){t=this.generateHtml(t);this.$element.html(t)},n.prototype.generateHtml=function(t){if(!t)return"";t=t.trim(),t=this.generateHtmlLinks(t);return t=this.generateHtmlParagraphs(t),t=this.generateHtmlLineBreaks(t)},n.prototype.generateHtmlLinks=function(t){var e,i,n="",s=h.RegexUtils.urlOrEmail("i"),o=ko.unwrap(this.binding.hyperlinkTarget),r=o||0!==o.length,a=t.split(s);try{for(var l=__values(a),u=l.next();!u.done;u=l.next()){var c=u.value;null!=s.exec(c)?c.startsWith("http")?n+=r?'<a rel="nofollow" href="'+h.Utils.htmlEncode(c)+'" target="'+h.Utils.htmlEncode(o)+'">'+h.Utils.htmlEncode(c)+"</a>":'<a rel="nofollow" href="'+h.Utils.htmlEncode(c)+'">'+h.Utils.htmlEncode(c)+"</a>":c.startsWith("www")?n+=r?'<a rel="nofollow" href="http://'+h.Utils.htmlEncode(c)+'" target="'+h.Utils.htmlEncode(o)+'">'+h.Utils.htmlEncode(c)+"</a>":'<a rel="nofollow" href="http://'+h.Utils.htmlEncode(c)+'">'+h.Utils.htmlEncode(c)+"</a>":c.startsWith("@")?n+=h.Utils.htmlEncode(c):n+='<a href="mailto:'+h.Utils.htmlEncode(c)+'">'+h.Utils.htmlEncode(c)+"</a>":n+=h.Utils.htmlEncode(c)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(e)throw e.error}}return n},n.prototype.generateHtmlParagraphs=function(t){var e,i,n=h.RegexUtils.twoLineBreaks("gi"),s=t.split(n);if(1<s.length){var o="";try{for(var r=__values(s),a=r.next();!a.done;a=r.next())o+="<p>"+a.value+"</p>"}catch(t){e={error:t}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}return o}return t},n.prototype.generateHtmlLineBreaks=function(t){return t.replace(h.RegexUtils.lineBreak("gi"),"<br>")},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.TextView=i,h.Utils.installBindingHandler("TextView",i)}((h=t.BusinessPack||(t.BusinessPack={})).Controls||(h.Controls={}))}(DotVVM=DotVVM||{}),function(t){!function(t){"use strict";var e,i=(e=t.DateOrTimePickerBase,__extends(n,e),n.prototype.initialize=function(){e.prototype.initialize.call(this)},n.prototype.floorDate=function(t){return t.getHours()+t.getMinutes()/60+t.getSeconds()/3600+t.getMilliseconds()/36e5},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.TimePickerBase=i}((t=t.BusinessPack||(t.BusinessPack={})).Controls||(t.Controls={}))}(DotVVM=DotVVM||{}),function(t){var o;!function(t){"use strict";var i,e=(i=t.TimePickerBase,__extends(n,i),n.prototype.initialize=function(){var e=this;i.prototype.initialize.call(this),this.$textBox=this.$element.children("."+o.BusinessPackCss.primitiveTextBox),this.$popup.length?this.$timeDial=this.$popup.find("."+o.BusinessPackCss.timePickerTimeDial):this.$timeDial=this.$element.children("."+o.BusinessPackCss.timePickerTimeDial),this.$dials=this.$timeDial.children("."+o.BusinessPackCss.timePickerHourDial+",\n                ."+o.BusinessPackCss.timePickerMinuteDial+",."+o.BusinessPackCss.timePickerSecondDial+",\n                ."+o.BusinessPackCss.timePickerDesignatorDial),this.$textBox.keydown(function(t){return e.onTextBoxKeydown(t)}),this.$textBox.change(function(t){return e.onTextBoxChange(t)}),this.$dials.on("mousedown",function(t){return e.onDialMousedown(t)}),this.$dials.on("mousemove",function(t){return e.onDialMousemove(t)}),this.$dials.on("mousewheel",function(t){return e.onDialMousewheel(t)}),this.$dials.on("click","."+o.BusinessPackCss.primitiveItem+":not(."+o.BusinessPackCss.stateDisabled+")",function(t){return e.onDialItemClick(t)}),this.watch(this.binding.selectedTime,this.onSelectedTimeChange),this.subscribe(this.binding.restrictions,this.onRestrictionsChange),o.DeviceUtils.addMobileOrTabletProp(this.$textBox,"readonly",!0)},Object.defineProperty(n.prototype,"selectedTime",{get:function(){var t=ko.unwrap(this.binding.selectedTime);return o.DateUtils.unwrapDate(t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"currentEnabledTime",{get:function(){var t=new Date;return t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),this.findEnabledHour(0,1,t)},enumerable:!0,configurable:!0}),n.prototype.isTimeOfNull=function(t){return null===t||t.getTime()-new Date(null).getTime()==0},Object.defineProperty(n.prototype,"canUnselectDateOrTime",{get:function(){return ko.unwrap(this.binding.allowUnselect)&&(!!this.selectedTime||!!this.$textBox.val())},enumerable:!0,configurable:!0}),n.prototype.unselectDateOrTime=function(){this.selectTime(null),this.$textBox.val(""),this.$textBox.focus()},n.prototype.onToggleButtonClick=function(t){i.prototype.onToggleButtonClick.call(this,t),this.$textBox.focus()},n.prototype.onElementFocusin=function(t){i.prototype.onElementFocusin.call(this,t),this.hasPopup||this.selectCurrentEnabledTimeIfNull(),this.focusDial()},n.prototype.focusDial=function(t){void 0===t&&(t=this.$dialToFocus),this.$dials.removeClass(o.BusinessPackCss.stateFocused),(t||this.$dials.first()).addClass(o.BusinessPackCss.stateFocused),this.$dialToFocus=null},n.prototype.toRestrictionsObservable=function(t){var e=this;return ko.computed(function(){return e.binding.restrictions&&e.binding.restrictions(),t},this)()},n.prototype.onElementFocusout=function(t){i.prototype.onElementFocusout.call(this,t),this.$dials.removeClass(o.BusinessPackCss.stateFocused)},n.prototype.onElementKeydown=function(t){i.prototype.onElementKeydown.call(this,t),this.isOpened&&(o.KeyboardKeys.isEnter(t.which)?this.togglePopup(!1):o.KeyboardKeys.isArrow(t.which)&&(t.which===o.KeyboardKeys.right?this.focusNextDial():t.which===o.KeyboardKeys.down?this.selectNextItem():t.which===o.KeyboardKeys.left?this.focusPrevDial():t.which===o.KeyboardKeys.up&&this.selectPrevItem(),t.preventDefault()))},n.prototype.onTextBoxKeydown=function(t){this.isOpened&&o.KeyboardKeys.isArrow(t.which)&&t.preventDefault()},n.prototype.selectTime=function(t){var e;t&&this.isTimeSelected(t)||(e=this.selectedTime,(t=t?new Date(t):null)&&e&&(t.setFullYear(e.getFullYear()),t.setMonth(e.getMonth()),t.setDate(e.getDate())),+t!=+e&&(this.binding.selectedTime(dotvvm.serialization.serializeDate(t,!1)),this.selectionChanged(),this.binding.isNested&&this.applyChanges()))},n.prototype.selectCurrentEnabledTimeIfNull=function(){this.isTimeOfNull(this.selectedTime)&&this.selectTime(this.currentEnabledTime)},n.prototype.isTimeSelected=function(t){var e=this.selectedTime;return!!e&&(t.getHours()===e.getHours()&&t.getMinutes()===e.getMinutes()&&t.getSeconds()===e.getSeconds()&&t.getMilliseconds()===e.getMilliseconds())},n.prototype.getHourItem=function(t,e){return void 0===e&&(e=new Date(this.selectedTime)),(e=this.isTimeOfNull(e)?this.currentEnabledTime:e).setHours(o.Utils.fixNumberOverflow(e.getHours()+t,24)),e},n.prototype.getMinuteItem=function(t,e){return void 0===e&&(e=new Date(this.selectedTime)),(e=this.isTimeOfNull(e)?this.currentEnabledTime:e).setMinutes(o.Utils.fixNumberOverflow(e.getMinutes()+t,60)),e},n.prototype.getSecondItem=function(t,e){return void 0===e&&(e=new Date(this.selectedTime)),(e=this.isTimeOfNull(e)?this.currentEnabledTime:e).setSeconds(o.Utils.fixNumberOverflow(e.getSeconds()+t,60)),e},n.prototype.focusNextDial=function(){var t=this.$dials.filter("."+o.BusinessPackCss.stateFocused),t=t.length?o.Utils.fixNumberOverflow(this.$dials.index(t)+1,this.$dials.length):-1,t=0<=t?this.$dials.eq(t):this.$dials.first();t.length&&(this.$dials.removeClass(o.BusinessPackCss.stateFocused),t.addClass(o.BusinessPackCss.stateFocused))},n.prototype.focusPrevDial=function(){var t=this.$dials.filter("."+o.BusinessPackCss.stateFocused),t=t.length?o.Utils.fixNumberOverflow(this.$dials.index(t)-1,this.$dials.length):-1,t=0<=t?this.$dials.eq(t):this.$dials.last();t.length&&(this.$dials.removeClass(o.BusinessPackCss.stateFocused),t.addClass(o.BusinessPackCss.stateFocused))},n.prototype.selectNextItem=function(){var t=this.$dials.filter("."+o.BusinessPackCss.stateFocused);t.hasClass(o.BusinessPackCss.timePickerHourDial)?this.selectTime(this.findEnabledHour(1,1)):t.hasClass(o.BusinessPackCss.timePickerMinuteDial)?this.selectTime(this.findEnabledMinute(1,1)):t.hasClass(o.BusinessPackCss.timePickerSecondDial)?this.selectTime(this.findEnabledSecond(1,1)):t.hasClass(o.BusinessPackCss.timePickerDesignatorDial)&&this.selectTime(this.findEnabledHour(12,1))},n.prototype.selectPrevItem=function(){var t=this.$dials.filter("."+o.BusinessPackCss.stateFocused);t.hasClass(o.BusinessPackCss.timePickerHourDial)?this.selectTime(this.findEnabledHour(-1,-1)):t.hasClass(o.BusinessPackCss.timePickerMinuteDial)?this.selectTime(this.findEnabledMinute(-1,-1)):t.hasClass(o.BusinessPackCss.timePickerSecondDial)?this.selectTime(this.findEnabledSecond(-1,-1)):t.hasClass(o.BusinessPackCss.timePickerDesignatorDial)&&this.selectTime(this.findEnabledHour(-12,-1))},n.prototype.onDialMousedown=function(t){this.isEnabled&&(this.$element.hasClass(o.BusinessPackCss.stateFocused)||(this.$dialToFocus=$(t.target).closest(this.$dials)))},n.prototype.onDialMousemove=function(t){this.isEnabled&&((t=$(t.target).closest(this.$dials)).hasClass(o.BusinessPackCss.stateFocused)||(this.$dials.removeClass(o.BusinessPackCss.stateFocused),this.$element.hasClass(o.BusinessPackCss.stateFocused)&&t.addClass(o.BusinessPackCss.stateFocused)))},n.prototype.onDialMousewheel=function(t){var e;this.isEnabled&&this.$element.hasClass(o.BusinessPackCss.stateFocused)&&(e=t.originalEvent,t.preventDefault(),0<e.wheelDelta?this.selectPrevItem():this.selectNextItem())},n.prototype.onDialItemClick=function(t){var e,i;this.isEnabled&&(t.stopPropagation(),e=$(t.target).closest(this.$dials),i=$(t.target).closest("."+o.BusinessPackCss.primitiveItem),e.hasClass(o.BusinessPackCss.timePickerHourDial)?i.hasClass(o.BusinessPackCss.commandPrev)?this.selectTime(this.findEnabledHour(-1,-1)):i.hasClass(o.BusinessPackCss.timePickerHour)?this.selectTime(this.findEnabledMinute(0,1,ko.dataFor(t.target))):i.hasClass(o.BusinessPackCss.commandNext)&&this.selectTime(this.findEnabledHour(1,1)):e.hasClass(o.BusinessPackCss.timePickerMinuteDial)?i.hasClass(o.BusinessPackCss.commandPrev)?this.selectTime(this.findEnabledMinute(-1,-1)):i.hasClass(o.BusinessPackCss.timePickerMinute)?this.selectTime(this.findEnabledSecond(0,1,ko.dataFor(t.target))):i.hasClass(o.BusinessPackCss.commandNext)&&this.selectTime(this.findEnabledMinute(1,1)):e.hasClass(o.BusinessPackCss.timePickerSecondDial)?i.hasClass(o.BusinessPackCss.commandPrev)?this.selectTime(this.findEnabledSecond(-1,1)):i.hasClass(o.BusinessPackCss.timePickerSecond)?this.selectTime(ko.dataFor(t.target)):i.hasClass(o.BusinessPackCss.commandNext)&&this.selectTime(this.findEnabledSecond(1,1)):e.hasClass(o.BusinessPackCss.timePickerDesignatorDial)&&(i.hasClass(o.BusinessPackCss.commandPrev)?this.selectTime(this.findEnabledHour(-12,-1)):i.hasClass(o.BusinessPackCss.timePickerDesignator)?this.selectTime(this.findEnabledHour(0,1,ko.dataFor(t.target))):i.hasClass(o.BusinessPackCss.commandNext)&&this.selectTime(this.findEnabledHour(12,1))))},n.prototype.onSelectedTimeChange=function(t){t=o.DateUtils.unwrapDate(t);this.$element.toggleClass(o.BusinessPackCss.stateValueEmpty,null==t),this.$textBox.length&&this.$element.toggleClass(o.BusinessPackCss.stateError,null!=this.$textBox[0].attributes["data-invalid-value"])},n.prototype.onRestrictionsChange=function(t){if(this.restrictions=[],null!==t)for(var e,i=new o.Linq(t).select(function(t){return ko.unwrap(t)}).orderBy(function(t){return o.DateUtils.unwrapDate(t.StartTime)}).toArray(),n=0;n<i.length;n++){var s=i[n];e?o.DateUtils.unwrapDate(e.EndTime)>=o.DateUtils.unwrapDate(s.StartTime)?e.EndTime=s.EndTime:(this.restrictions.push(e),e=null):e=s,n===i.length-1&&this.restrictions.push(e||s)}},n.prototype.isTimeEnabled=function(t,e){var i=this;return void 0===e&&(e=function(t){return i.floorDate(t)}),!this.isDateTimeLowerThanMin(t,this.binding.minTime,e)&&!this.isDateTimeHigherThanMax(t,this.binding.maxTime,e)&&!this.isDateTimeRestricted(t,this.restrictions,e)},n.prototype.isHourEnabled=function(t){return this.isTimeEnabled(t,function(t){return t.getHours()})},n.prototype.isMinuteEnabled=function(t){return this.isTimeEnabled(t,function(t){return t.getHours()+t.getMinutes()/60})},n.prototype.isSecondEnabled=function(t){return this.isTimeEnabled(t,function(t){return t.getHours()+t.getMinutes()/60+t.getSeconds()/3600})},n.prototype.findEnabledTime=function(t,e,i,n,s){for(var o=t,r=0;!e(o)&&r<s;)r++,o=i(n);return r===s?t:o},n.prototype.findEnabledHour=function(t,e,i){var n=this;return void 0===i&&(i=new Date(this.selectedTime)),i=this.findEnabledTime(this.getHourItem(t,i),function(t){return n.isHourEnabled(t)},function(t){return n.getHourItem(t,i)},e,24),i=this.findEnabledMinute(0,e,i)},n.prototype.findEnabledMinute=function(t,e,i){var n=this;return void 0===i&&(i=new Date(this.selectedTime)),i=this.findEnabledTime(this.getMinuteItem(t,i),function(t){return n.isMinuteEnabled(t)},function(t){return n.getMinuteItem(t,i)},e,60),i=this.findEnabledSecond(0,e,i)},n.prototype.findEnabledSecond=function(t,e,i){var n=this;return void 0===i&&(i=new Date(this.selectedTime)),this.findEnabledTime(this.getSecondItem(t,i),function(t){return n.isSecondEnabled(t)},function(t){return n.getSecondItem(t,i)},e,60)},n.prototype.onPopupOpen=function(){i.prototype.onPopupOpen.call(this)},n);function n(){return null!==i&&i.apply(this,arguments)||this}t.TimePicker=e,o.Utils.installBindingHandler("TimePicker",e)}((o=t.BusinessPack||(t.BusinessPack={})).Controls||(o.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var i,e=(i=t.ButtonBase,__extends(n,i),n.prototype.initialize=function(){var e=this;i.prototype.initialize.call(this),this.$element.click(function(t){return e.onElementClick(t)}),this.subscribe(this.binding.checked,this.onCheckedChange)},n.prototype.onElementClick=function(t){var e=this.binding.checked;this.isEnabled&&(t.stopPropagationAndPreventDefault(),ko.isWriteableObservable(e)&&e(!e()),this.postback(this.binding.click))},n.prototype.onCheckedChange=function(t){this.$element.toggleClass(s.BusinessPackCss.stateChecked,t)},n);function n(){return null!==i&&i.apply(this,arguments)||this}t.ToggleButton=e,s.Utils.installBindingHandler("ToggleButton",e),s.Utils.installBindingHandler("ToggleButtonItem",e)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),n.prototype.isGroupVisible=function(t){var e,i,n=$(t).children();try{for(var s=__values(n.get()),o=s.next();!o.done;o=s.next()){var r=o.value,a=ko.contextFor(r)?ko.contextFor(r):ko.contextFor(this.$element.get(0)),a=ko.bindingProvider.instance.getBindings(r,a);if("visible"in a){if(ko.unwrap(a.visible))return!0}else if($(r).is(":visible"))return!0}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}return!1},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.Toolbar=i,s.Utils.installBindingHandler("Toolbar",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var s;!function(t){"use strict";var e,i=(e=t.ControlBase,__extends(n,e),Object.defineProperty(n.prototype,"isDisplayed",{get:function(){return ko.unwrap(this.binding.isDisplayed)||!1},set:function(t){var e=this.binding.isDisplayed;ko.isWriteableObservable(e)&&e(t)},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){var e=this;this.$trigger=this.$document.find(".tooltip-trigger"),this.$trigger.mouseenter(function(t){return e.onTriggerMouseenter(t)}),this.$trigger.mouseleave(function(t){return e.onTriggerMouseleave(t)}),this.disposing(function(){return e.$trigger.off()})},n.prototype.onTriggerMouseenter=function(t){var e=this;this.$element.css({top:t.pageY+5,left:t.pageX-this.$element.outerWidth()/2}),this.$element.stop(!0).show(200,function(){return e.isDisplayed=!0})},n.prototype.onTriggerMouseleave=function(t){var e=this;this.$element.stop(!0).hide(200,function(){return e.isDisplayed=!1})},n);function n(){return null!==e&&e.apply(this,arguments)||this}t.Tooltip=i,s.Utils.installBindingHandler("Tooltip",i)}((s=t.BusinessPack||(t.BusinessPack={})).Controls||(s.Controls={}))}(DotVVM=DotVVM||{}),function(t){var u;!function(t){"use strict";var i,e=(i=t.HierarchyItemsControlBase,__extends(n,i),Object.defineProperty(n.prototype,"hasValue",{get:function(){return!!this.binding.selectedValues&&!!this.binding.selectedValues()&&!!this.binding.selectedValues().length},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){i.prototype.initialize.call(this),this.$element.focusin(this.onElementFocusin.bind(this)),this.$element.focusout(this.onElementFocusout.bind(this)),this.$element.keydown(this.onElementKeydown.bind(this)),this.$element.on("click","."+u.BusinessPackCss.commandExpand,this.onExpandClick.bind(this)),this.$element.on("click","."+u.BusinessPackCss.commandCollapse,this.onCollapseClick.bind(this)),this.$element.on("mousedown","."+u.BusinessPackCss.commandToggle,function(t){return t.preventDefault()}),this.$element.on("change","."+u.BusinessPackCss.commandToggle,this.onCheckBoxChange.bind(this)),this.$element.on("mousedown","."+u.BusinessPackCss.primitiveItem+" > label",this.onLabelMousedown.bind(this)),this.$element.on("click","."+u.BusinessPackCss.primitiveItem+" > label",this.onLabelClick.bind(this)),this.$element.on("dblclick","."+u.BusinessPackCss.primitiveItem+" > label",this.onLabelDblClick.bind(this)),this.binding.selectedValues?this.watch(this.binding.selectedValues,this.onSelectedValuesChange):this.$element.addClass(u.BusinessPackCss.stateValueEmpty)},n.prototype.expandPathToItem=function(t){for(var e=(t=!ko.isObservable(t)?this.findItemByKey(this.getItemKey(t)):t).$parent;e;)this.expandItem(e),e=e.$parent},n.prototype.expandItem=function(e){var i,t,n=this;this.isExpanded(e)||this.isParentLoading(e)||(i=this.getItemKey(e),t=this.binding.itemIsExpandedBinding,this.focusItem(e),t?(t=t(e),ko.isWriteableObservable(t)&&t(!0)):this.expandedItemsKeys.push(i),this.canLoadChildren(e)&&(this.loadingItemsKeys.push(i),this.binding.loadChildren(e).then(function(t){n.populateItem(e,t.commandResult),n.loadingItemsKeys.remove(i)})))},n.prototype.collapseItem=function(t){var e;this.isExpanded(t)&&((e=this.binding.itemIsExpandedBinding)?(e=e(t),ko.isWriteableObservable(e)&&e(!1)):this.expandedItemsKeys.remove(this.getItemKey(t)),this.focusItem(t))},n.prototype.isExpanded=function(t){var e=this.binding.itemIsExpandedBinding;return e?ko.unwrap(e(t)):this.expandedItemsKeys().asLinq().contains(this.getItemKey(t))},n.prototype.isLoading=function(t){var e=this.getItemKey(t);return!!this.loadingItemsKeys().asLinq().contains(e)||!!this.isParentLoading(t)&&this.hasChildren(t)},n.prototype.isParentLoading=function(t){t=this.getParent(t);if(t){t=this.getItemKey(t);if(this.loadingItemsKeys().asLinq().contains(t))return!0}return!1},n.prototype.focusItem=function(t){this.focusedItemKey(this.getItemKey(t))},n.prototype.isFocused=function(t){return this.getItemKey(t)===this.focusedItemKey()},n.prototype.getFocusedItem=function(){return this.findItemByKey(this.focusedItemKey)},n.prototype.toggleItem=function(t){var e=ko.unwrap(this.binding.checkBoxMode);this.isSelected(t)&&this.canBeChecked(t)?this.unselectItem(t):this.selectItem(t,"Hidden"===e)},n.prototype.selectItems=function(t,e){var i,n,s=this;if(this.binding.selectedValues){if(e){var o=t.map(function(t){return ko.observable(s.getItemValueCopy(t))});this.binding.selectedValues(o)}else{o=[];try{for(var r=__values(t),a=r.next();!a.done;a=r.next()){var l=a.value;this.canBeSelected(l)&&o.push(ko.observable(this.getItemValueCopy(l)))}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}u.Utils.pushAll(this.binding.selectedValues,o)}this.postback(this.binding.changed)}},n.prototype.selectItem=function(t,e){var i;this.binding.selectedValues&&t&&(i=ko.observable(this.getItemValueCopy(t)),e&&this.areOtherItemsSelected([t])?(this.binding.selectedValues([i]),this.postback(this.binding.changed)):this.canBeSelected(t)&&(this.binding.selectedValues.push(i),this.postback(this.binding.changed)))},n.prototype.unselectItems=function(t){var i=this;this.binding.selectedValues&&(this.binding.selectedValues.remove(function(e){return t.asLinq().any(function(t){return i.isValueOfItem(e,t)})}),this.postback(this.binding.changed))},n.prototype.unselectItem=function(e){var t,i,n=this;this.binding.selectedValues&&e&&this.isSelected(e)&&(i=(t=__spread(this.binding.selectedValues.state)).findIndex(function(t){return n.isValueOfItem(t,e)}),t.splice(i,1),this.binding.selectedValues.setState(t),this.postback(this.binding.changed))},n.prototype.canBeSelected=function(t){var e=ko.unwrap(this.binding.checkBoxMode),i=!this.isSelected(t);return i=(i=i&&"Hidden"===e?0===this.selectedItemsKeys().length:i)&&"VisibleOnLeafs"===e?!this.hasChildren(t):i},n.prototype.isSelected=function(t){t=this.getItemKey(t);return this.selectedItemsKeys().asLinq().contains(t)},n.prototype.hasChildren=function(t){var e=this.binding.itemHasChildrenBinding;return e?ko.unwrap(e(t)):i.prototype.hasChildren.call(this,t)},n.prototype.onElementFocusin=function(t){this.$element.addClass(u.BusinessPackCss.stateFocused),this.hasFocus(!0)},n.prototype.onElementFocusout=function(t){this.$element.removeClass(u.BusinessPackCss.stateFocused),this.hasFocus(!1)},n.prototype.onElementKeydown=function(t){t.which===u.KeyboardKeys.left?(t.stopPropagationAndPreventDefault(),this.collapseFocusedItemOrFocusOnParentItem()):t.which===u.KeyboardKeys.right?(t.stopPropagationAndPreventDefault(),this.expandFocusedItemOrFocusOnChildItem()):t.which===u.KeyboardKeys.down?(t.stopPropagationAndPreventDefault(),this.focusNextItem()):t.which===u.KeyboardKeys.up?(t.stopPropagationAndPreventDefault(),this.focusPrevItem()):t.which===u.KeyboardKeys.spacebar&&(t.stopPropagation(),this.toggleFocusedItem())},n.prototype.onExpandClick=function(t){t.stopPropagation(),this.scrollToItem($(t.target).closest("."+u.BusinessPackCss.primitiveItem)),this.expandItem(ko.dataFor(t.target))},n.prototype.onCollapseClick=function(t){t.stopPropagation(),this.scrollToItem($(t.target).closest("."+u.BusinessPackCss.primitiveItem)),this.collapseItem(ko.dataFor(t.target))},n.prototype.onCheckBoxChange=function(t){var e,i=$(t.target),n=ko.dataFor(t.target),s=ko.unwrap(this.binding.autoCheckChildren);t.stopPropagation(),this.focusItem(n),i.prop("checked")?s?(e=this.getRelatedItemsToCheck(n),this.selectItems(e)):this.selectItem(n):s?(e=this.getRelatedItemsToCheck(n),this.unselectItems(e)):this.unselectItem(n)},n.prototype.getRelatedItemsToCheck=function(t){var e=[t];return u.Utils.pushAll(e,this.getParentsToCheck(t)),u.Utils.pushAll(e,this.getDescendantsToCheck(t)),e},n.prototype.getParentsToCheck=function(t){var e=[],i=this.getParent(t);return i&&this.areAllOtherChildrenSelected(i,t)&&(e.push(i()),u.Utils.pushAll(e,this.getParentsToCheck(i))),e},n.prototype.getDescendantsToCheck=function(t){var e,i,n=[],s=this.getChildren(t);try{for(var o=__values(s),r=o.next();!r.done;r=o.next()){var a=r.value;n.push(a()),u.Utils.pushAll(n,this.getDescendantsToCheck(a))}}catch(t){e={error:t}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}return n},n.prototype.onLabelMousedown=function(t){this.scrollToItem($(t.target).closest("."+u.BusinessPackCss.primitiveItem)),this.focusItem(ko.dataFor(t.currentTarget))},n.prototype.onLabelClick=function(t){var e=ko.dataFor(t.currentTarget),t=ko.unwrap(this.binding.checkBoxMode);this.binding.selectedValues?"Hidden"===t&&(this.selectItem(e,!0),this.focusItem(e)):this.isExpanded(e)?this.collapseItem(e):this.expandItem(e)},n.prototype.onLabelDblClick=function(t){var e=ko.unwrap(this.binding.checkBoxMode);this.binding.selectedValues&&"Hidden"===e&&(t=ko.dataFor(t.currentTarget),this.isExpanded(t)?this.collapseItem(t):this.expandItem(t))},n.prototype.onDataSourceChange=function(){i.prototype.onDataSourceChange.call(this),this.loadChildrenMode||(this.loadChildrenMode=this.getLoadChildrenMode()),this.findItemByKey(this.focusedItemKey)||this.focusOnFirstItem(),this.onSelectedValuesChange(ko.unwrap(this.binding.selectedValues))},n.prototype.onSelectedValuesChange=function(t){var e,i;if(u.Utils.clearObservableArray(this.selectedItemsKeys),this.$element.toggleClass(u.BusinessPackCss.stateValueEmpty,!this.hasValue),this.hasValue)try{for(var n=__values(t),s=n.next();!s.done;s=n.next()){var o=s.value,r=this.findItemByValue(o);r?(this.selectedItemsKeys.push(this.getItemKey(r)),this.expandPathToItem(r)):this.warnThatValueWasNotFound(o)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}},n.prototype.expandFocusedItemOrFocusOnChildItem=function(){this.$element.children("."+u.BusinessPackCss.primitiveList).find("."+u.BusinessPackCss.primitiveItem+"."+u.BusinessPackCss.stateFocused).hasClass(u.BusinessPackCss.stateExpanded)?this.focusOnChildItem():this.expandFocusedItem()},n.prototype.expandFocusedItem=function(){this.expandItem(this.getFocusedItem())},n.prototype.collapseFocusedItemOrFocusOnParentItem=function(){this.$element.children("."+u.BusinessPackCss.primitiveList).find("."+u.BusinessPackCss.primitiveItem+"."+u.BusinessPackCss.stateFocused).hasClass(u.BusinessPackCss.stateExpanded)?this.collapseFocusedItem():this.focusOnParentItem()},n.prototype.collapseFocusedItem=function(){this.collapseItem(this.getFocusedItem())},n.prototype.focusOnParentItem=function(){var t=this.$element.children("."+u.BusinessPackCss.primitiveList).find("."+u.BusinessPackCss.primitiveItem+"."+u.BusinessPackCss.stateFocused).parents("."+u.BusinessPackCss.primitiveItem);t.length&&(this.scrollToItem($(t[0])),this.focusItem(ko.contextFor(t[0]).$item))},n.prototype.focusPrevItem=function(){var t=this.$element.children("."+u.BusinessPackCss.primitiveList).find("."+u.BusinessPackCss.primitiveItem+"."+u.BusinessPackCss.stateFocused),t=this.findPrevVisibleItem(t);t&&(this.scrollToItem($(t)),this.focusItem(ko.contextFor(t).$item))},n.prototype.focusNextItem=function(){var t=this.$element.children("."+u.BusinessPackCss.primitiveList).find("."+u.BusinessPackCss.primitiveItem+"."+u.BusinessPackCss.stateFocused),t=this.findNextVisibleItem(t);t&&(this.scrollToItem($(t)),this.focusItem(ko.contextFor(t).$item))},n.prototype.focusOnChildItem=function(){var t=this.$element.children("."+u.BusinessPackCss.primitiveList).find("."+u.BusinessPackCss.primitiveItem+"."+u.BusinessPackCss.stateFocused).children("."+u.BusinessPackCss.primitiveList).children("."+u.BusinessPackCss.primitiveItem);t.length&&(this.scrollToItem($(t[0])),this.focusItem(ko.contextFor(t[0]).$item))},n.prototype.focusOnFirstItem=function(){var t=this.items();t.length&&this.focusItem(t[0])},n.prototype.toggleFocusedItem=function(){this.toggleItem(this.getFocusedItem())},n.prototype.canBeChecked=function(t){var e=ko.unwrap(this.binding.checkBoxMode);return"Visible"===e||"VisibleOnLeafs"===e&&!this.hasChildren(t)},n.prototype.areOtherItemsSelected=function(t){var e=this,t=t.map(function(t){return e.getItemKey(t)});return this.selectedItemsKeys().asLinq().except(t).any()},n.prototype.findPrevVisibleItem=function(t){var e=t.prev("."+u.BusinessPackCss.primitiveItem).find("."+u.BusinessPackCss.primitiveItem+":visible:last");return(e=!(e=!e.length?t.prev("."+u.BusinessPackCss.primitiveItem):e).length?t.parents("."+u.BusinessPackCss.primitiveItem):e).length?e[0]:null},n.prototype.findNextVisibleItem=function(t){if(t.hasClass(u.BusinessPackCss.stateExpanded))return t.children("."+u.BusinessPackCss.primitiveList).children("."+u.BusinessPackCss.primitiveItem)[0];var e=t.next("."+u.BusinessPackCss.primitiveItem);return(e=!e.length?t.parents("."+u.BusinessPackCss.primitiveItem).next():e).length?e[0]:null},n.prototype.areAllOtherChildrenSelected=function(t,e){var i,n,s=this.getChildren(t);try{for(var o=__values(s),r=o.next();!r.done;r=o.next()){var a=r.value;if(this.getItemKey(a)!==this.getItemKey(e)&&!this.isSelected(a))return!1}}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return!0},n.prototype.isAnyDescendantSelected=function(t){var e,i,n=this.getChildren(t);try{for(var s=__values(n),o=s.next();!o.done;o=s.next()){var r=o.value;if(this.isSelected(r)||this.isAnyDescendantSelected(r))return!0}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}return!1},n.prototype.canLoadChildren=function(t){return!!this.binding.loadChildren&&this.shouldLoadChildren(t)},n.prototype.shouldLoadChildren=function(t){var e,i;if(!this.hasChildren(t))return!1;var n=this.getChildren(t);if(!n.length)return!0;if("Deep"===this.loadChildrenMode)try{for(var s=__values(n),o=s.next();!o.done;o=s.next()){var r=o.value;if(this.hasChildren(r))return!this.getChildren(r).length}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}return!1},n.prototype.populateItem=function(t,e){var i=this.binding.itemChildrenBinding;i&&(i=i(t),ko.isWriteableObservable(i)&&(i(u.Utils.deepObservable(e)()),e=ko.unwrap(this.binding.autoCheckChildren),this.isSelected(t)&&e&&(t=this.getDescendantsToCheck(t),this.selectItems(t))))},n.prototype.scrollToItem=function(t){var e=this.$element.children("."+u.BusinessPackCss.primitiveList),i=(this.getParentTop(e,t),e.innerHeight()),n=parseInt(e.css("padding-top")),s=parseInt(e.css("padding-bottom")),o=parseInt(t.css("margin-top")),r=parseInt(t.css("margin-bottom")),n=t.parent().is(e)&&t.is(":first-child")?n:o,o=t.parent().is(e)&&t.is(":last-child")?s:r,s=t.position().top,r=s+t.outerHeight(!0),t=e.scrollTop();i<r?e.scrollTop(t+(r-i)+o):s<0&&e.scrollTop(t+s-n)},n.prototype.getParentTop=function(t,e){for(var i=e.parent(),n=0;!i.is(t);)n+=i.position().top,i=i.parent();return n},n.prototype.getItemKeyBinding=function(){return this.binding.itemKeyBinding||this.getItemValueBinding()},n.prototype.getItemValueBinding=function(){return this.binding.itemValueBinding},n.prototype.getCheckState=function(t){return!!this.isSelected(t)||!(!ko.unwrap(this.binding.autoCheckChildren)||!this.isAnyDescendantSelected(t))&&null},n.prototype.getItemStyle=function(t){var e={};return e[u.BusinessPackCss.flagExpandable]=this.hasChildren(t),e[u.BusinessPackCss.stateExpanded]=this.isExpanded(t),e[u.BusinessPackCss.stateLoading]=this.isLoading(t),e[u.BusinessPackCss.stateFocused]=this.hasFocus()&&this.isFocused(t),e[u.BusinessPackCss.stateSelected]=this.isSelected(t),e},n.prototype.getLabelStyle=function(t){var e=this.getCheckState(t),t={};return t[u.BusinessPackCss.stateChecked]=e,t[u.BusinessPackCss.stateIndeterminate]=null===e,t},n.prototype.getLoadChildrenMode=function(){var e,t;if(!this.items().length)return null;try{for(var i=__values(this.items()),n=i.next();!n.done;n=i.next()){var s=n.value;if(this.hasChildren(s))return this.getChildren(s).length?"Deep":"Shallow"}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return"Shallow"},n);function n(){var t=null!==i&&i.apply(this,arguments)||this;return t.focusedItemKey=ko.observable(),t.expandedItemsKeys=ko.observableArray(),t.selectedItemsKeys=ko.observableArray(),t.loadingItemsKeys=ko.observableArray(),t.hasFocus=ko.observable(!1),t}t.TreeView=e,u.Utils.installBindingHandler("TreeView",e)}((u=t.BusinessPack||(t.BusinessPack={})).Controls||(u.Controls={}))}(DotVVM=DotVVM||{}),function(t){var e;e=t.BusinessPack||(t.BusinessPack={}),dotvvm.events.init.subscribe(function(){var u=e.BusinessPackCss.postbackPending,c=e.BusinessPackCss.postbackSuccess,h=e.BusinessPackCss.postbackFail;dotvvm.postBackHandlers["dotvvm-bp-postback-animation"]=function(l){return{execute:function(r,a){var t=this;return new Promise(function(s,o){return __awaiter(t,void 0,void 0,function(){var e,i,n;return __generator(this,function(t){switch(t.label){case 0:e=a.sender,i=function(t){e.classList.remove(u),e.classList.add(t),window.setTimeout(function(){return e.classList.remove(t)},1e3*l.StateDuration)},t.label=1;case 1:return t.trys.push([1,3,,4]),e.classList.add(u),[4,r()];case 2:return n=t.sent(),s(n),i(c),[3,4];case 3:return n=t.sent(),o(n),i(h),[3,4];case 4:return[2]}})})})}}}})}(DotVVM=DotVVM||{});