\");\n var secondToolbar;\n\n that._processHandlers(defaults);\n that.wrapper.append(toolbar);\n that.toolbar = toolbar;\n\n toolbar.kendoToolBar({\n resizable: false,\n tools: tools,\n defaultTools: defaults,\n parentMessages: options.messages\n });\n\n if (that._isMobile() && (!navigation || navigation.length !== 0)) {\n secondToolbar = $(\"
\");\n that.wrapper.append(secondToolbar);\n that.toolbar = that.toolbar.add(secondToolbar);\n\n secondToolbar.kendoToolBar({\n resizable: false,\n tools: navigation || [...defaultMobileToolsSecond],\n defaultTools: defaults,\n parentMessages: options.messages\n });\n }\n\n that.toolbar.find(\".k-nav-current .k-button-text\").attr('data-' + kendo.ns + 'bind', \"text: formattedDate\");\n that.toolbar.find(\".k-m-date-format\").attr('data-' + kendo.ns + 'bind', \"text: formattedMobileDate\");\n that.toolbar.find(\".k-y-date-format\").attr('data-' + kendo.ns + 'bind', \"text: formattedYear\");\n\n kendo.bind(that.toolbar, that._model);\n\n that.toolbar.find(\".k-scheduler-search-input\").attr({\n placeholder: options.messages.search,\n title: options.messages.search\n });\n\n toolbar.on(\"input\" + NS, \".k-scheduler-search-input\", kendo.throttle(function(e) {\n that.dataSource.filter({\n logic: \"or\",\n filters: [\n { field: \"title\", operator: \"contains\", value: e.target.value },\n { field: \"description\", operator: \"contains\", value: e.target.value }\n ]\n });\n }, 250));\n\n toolbar.on(CHANGE + NS, \".k-views-dropdown, .k-scheduler-mobile-views\", function() {\n var name = this.value;\n\n if (!that.trigger(\"navigate\", { view: name, action: \"changeView\", date: that.date() })) {\n that.view(name);\n }\n });\n\n that._initialSize = true;\n },\n\n _showCalendar: function(targetElm) {\n var that = this,\n target = targetElm || that.toolbar.find(\".k-nav-current\"),\n html = $('
');\n\n if (!that.popup) {\n that.popup = new Popup(html, {\n anchor: target,\n activate: function() {\n if (that.popup && that.calendar) {\n that.popup._toggleResize(false);\n that.calendar.element.find(\"table\").trigger(\"focus\");\n that.popup._toggleResize(true);\n }\n },\n open: function() {\n if (!that.calendar) {\n that.calendar = new Calendar(this.element.find(\".k-scheduler-calendar\"),\n {\n change: function() {\n var date = this.value();\n if (!that.trigger(\"navigate\", { view: that._selectedViewName, action: \"changeDate\", date: date })) {\n that.date(date);\n that.popup.close();\n }\n\n if (!that._isMobile()) {\n that._selectedView.element.trigger(\"focus\");\n that.toolbar.find(\".k-nav-current\").trigger(\"focus\").addClass(FOCUSEDSTATE);\n }\n },\n min: that.options.min,\n max: that.options.max\n });\n }\n that.calendar.element.on(\"keydown\" + NS, function(e) {\n if (e.keyCode === keys.ESC || e.keyCode === keys.TAB) {\n that.popup.close();\n that._selectedView.element.trigger(\"focus\");\n that.toolbar.find(\".k-nav-current\").trigger(\"focus\").addClass(FOCUSEDSTATE);\n }\n });\n\n that.calendar.setOptions({\n start: that._selectedViewName === \"year\" ? \"decade\" : \"month\",\n depth: that._selectedViewName === \"year\" ? \"decade\" : \"month\"\n });\n\n that.calendar.value(that.date());\n },\n copyAnchorStyles: false\n });\n }\n\n that.popup.open();\n },\n\n refresh: function(e) {\n var that = this;\n var view = this.view();\n var preventRefresh = (e && e.action === \"itemchange\" && (this._editor.editable || this._preventRefresh)) ||\n (this.dataSource.options.type === \"signalr\" && this._preventRefresh);\n\n this._progress(false);\n\n e = e || {};\n\n if (!view) {\n return;\n }\n\n if (preventRefresh) { // skip rebinding if editing is in progress\n this._attemptRefresh = true && this.dataSource.options.type === \"signalr\";\n return;\n }\n\n if (this.trigger(\"dataBinding\", { action: e.action || \"rebind\", index: e.index, items: e.items })) {\n return;\n }\n\n if (!(e && e.action === \"resize\") && this._editor) {\n this._editor.close();\n }\n\n this._data = this.dataSource.expand(view.startDate(), view.visibleEndDate());\n\n view.refreshLayout();\n\n view.render(this._data);\n\n this.trigger(\"dataBound\");\n this._attemptRefresh = false;\n },\n\n slotByPosition: function(x, y) {\n var view = this.view();\n\n if (!view._slotByPosition) {\n return null;\n }\n\n var slot = view._slotByPosition(x, y);\n\n if (!slot) {\n return null;\n }\n\n return {\n startDate: slot.startDate(),\n endDate: slot.endDate(),\n groupIndex: slot.groupIndex,\n element: slot.element,\n isDaySlot: slot.isDaySlot\n };\n },\n\n slotByElement: function(element) {\n var el = $(element),\n offset = el.offset(),\n width = el.width(),\n height = el.height(),\n centerX = offset.left + width / 2,\n centerY = offset.top + height / 2,\n offset = $(element).offset();\n\n return this.slotByPosition(centerX, centerY);\n },\n\n resourcesBySlot: function(slot) {\n return this.view()._resourceBySlot(slot);\n }\n });\n\n var defaultViews = {\n day: {\n type: \"kendo.ui.DayView\"\n },\n week: {\n type: \"kendo.ui.WeekView\"\n },\n workWeek: {\n type: \"kendo.ui.WorkWeekView\"\n },\n agenda: {\n type: \"kendo.ui.AgendaView\"\n },\n month: {\n type: \"kendo.ui.MonthView\"\n },\n timeline: {\n type: \"kendo.ui.TimelineView\"\n },\n timelineWeek: {\n type: \"kendo.ui.TimelineWeekView\"\n },\n timelineWorkWeek: {\n type: \"kendo.ui.TimelineWorkWeekView\"\n },\n timelineMonth: {\n type: \"kendo.ui.TimelineMonthView\"\n },\n year: {\n type: \"kendo.ui.YearView\"\n }\n };\n\n ui.plugin(Scheduler);\n\n if (kendo.PDFMixin) {\n kendo.PDFMixin.extend(Scheduler.prototype);\n\n var SCHEDULER_EXPORT = \"k-scheduler-pdf-export\";\n Scheduler.fn._drawPDF = function(progress) {\n var wrapper = this.wrapper;\n var styles = wrapper[0].style.cssText;\n\n wrapper.css({\n width: wrapper.width(),\n height: wrapper.height()\n });\n\n wrapper.addClass(SCHEDULER_EXPORT);\n\n var scheduler = this;\n var promise = new $.Deferred();\n var table = wrapper.find(\".k-scheduler-content\").find(\"table\").css(\"table-layout\", \"auto\");\n\n setTimeout(function() {\n table.css(\"table-layout\", \"fixed\");\n scheduler.resize(true);\n\n scheduler._drawPDFShadow({}, {\n avoidLinks: scheduler.options.pdf.avoidLinks\n })\n .done(function(group) {\n var args = {\n page: group,\n pageNumber: 1,\n progress: 1,\n totalPages: 1\n };\n\n progress.notify(args);\n promise.resolve(args.page);\n })\n .fail(function(err) {\n promise.reject(err);\n })\n .always(function() {\n wrapper[0].style.cssText = styles;\n wrapper.removeClass(SCHEDULER_EXPORT);\n scheduler.resize(true);\n\n //Required because slot.offsetLeft is incorrect after first resize\n scheduler.resize(true);\n });\n });\n\n return promise;\n };\n }\n\n var TimezoneEditor = Widget.extend({\n init: function(element, options) {\n var that = this,\n zones = kendo.timezone.windows_zones;\n\n if (!zones || !kendo.timezone.zones_titles) {\n throw new Error('kendo.timezones.min.js is not included.');\n }\n\n Widget.fn.init.call(that, element, options);\n\n that.wrapper = that.element;\n\n that._zonesQuery = new kendo.data.Query(zones);\n that._zoneTitleId = kendo.guid();\n that._zoneTitlePicker();\n that._zonePicker();\n\n that._zoneTitle.bind(\"cascade\", function() {\n if (!this.value()) {\n that._zone.wrapper.hide();\n }\n });\n\n that._zone.bind(\"cascade\", function() {\n that._value = this.value();\n that.trigger(CHANGE);\n });\n\n that.value(that.options.value);\n },\n options: {\n name: \"TimezoneEditor\",\n value: \"\",\n optionLabel: \"No timezone\"\n },\n events: [ CHANGE ],\n\n _zoneTitlePicker: function() {\n var that = this,\n zoneTitle = $('
').appendTo(that.wrapper);\n\n that._zoneTitle = new kendo.ui.DropDownList(zoneTitle, {\n dataSource: kendo.timezone.zones_titles,\n dataValueField: \"other_zone\",\n dataTextField: \"name\",\n optionLabel: that.options.optionLabel\n });\n },\n\n _zonePicker: function() {\n var that = this,\n zone = $('
').appendTo(this.wrapper);\n\n that._zone = new kendo.ui.DropDownList(zone, {\n dataValueField: \"zone\",\n dataTextField: \"territory\",\n dataSource: that._zonesQuery.data,\n cascadeFrom: that._zoneTitleId,\n dataBound: function() {\n that._value = this.value();\n this.wrapper.toggle(this.dataSource.view().length > 1);\n }\n });\n\n that._zone.wrapper.hide();\n },\n\n destroy: function() {\n Widget.fn.destroy.call(this);\n\n kendo.destroy(this.wrapper);\n },\n\n value: function(value) {\n var that = this,\n zone;\n\n if (value === undefined$1) {\n return that._value;\n }\n\n zone = that._zonesQuery.filter({ field: \"zone\", operator: \"eq\", value: value }).data[0];\n\n if (zone) {\n that._zoneTitle.value(zone.other_zone);\n that._zone.value(zone.zone);\n } else {\n that._zoneTitle.select(0);\n }\n\n }\n });\n\n ui.plugin(TimezoneEditor);\n\n var ZONETITLEOPTIONTEMPLATE = kendo.template(({ name, other_zone }) => `
`);\n var ZONEOPTIONTEMPLATE = kendo.template(({ zone, territory }) => `
`);\n\n var MobileTimezoneEditor = Widget.extend({\n init: function(element, options) {\n var that = this,\n zones = kendo.timezone.windows_zones;\n\n if (!zones || !kendo.timezone.zones_titles) {\n throw new Error('kendo.timezones.min.js is not included.');\n }\n\n Widget.fn.init.call(that, element, options);\n\n that.wrapper = that.element;\n\n that._zonesQuery = new kendo.data.Query(zones);\n that._zoneTitlePicker();\n that._zonePicker();\n\n that.value(that.options.value);\n },\n\n options: {\n name: \"MobileTimezoneEditor\",\n optionLabel: \"No timezone\",\n value: \"\"\n },\n\n events: [ CHANGE ],\n\n _bindZones: function(value) {\n var data = value ? this._filter(value) : [];\n\n this._zone.html(this._options(data, ZONEOPTIONTEMPLATE));\n },\n\n _filter: function(value) {\n return this._zonesQuery.filter({ field: \"other_zone\", operator: \"eq\", value: value }).data;\n },\n\n _options: function(data, template, optionLabel) {\n var idx = 0;\n var html = \"\";\n var length = data.length;\n\n if (optionLabel) {\n html += template({ other_zone: \"\", name: optionLabel });\n }\n\n for (; idx < length; idx++) {\n html += template(data[idx]);\n }\n\n return html;\n },\n\n _zoneTitlePicker: function() {\n var that = this;\n var options = that._options(kendo.timezone.zones_titles, ZONETITLEOPTIONTEMPLATE, that.options.optionLabel);\n\n that._zoneTitle = $('
')\n .appendTo(that.wrapper)\n .on(\"change\", function() {\n var value = this.value;\n var zone = that._zonePickerLabel;\n var zoneSelect = zone.find(\"select\");\n\n that._bindZones(value);\n\n if (value && zoneSelect.children().length > 1) {\n zone.show();\n } else {\n zone.hide();\n }\n\n that._value = that._zone[0].value;\n\n that.trigger(CHANGE);\n });\n },\n\n _zonePicker: function() {\n var that = this;\n\n that._zonePickerLabel = $(\"
\" +\n \"\" +\n \"\").hide();\n\n that._zone = $('
')\n .appendTo(that._zonePickerLabel.find(\"div\"))\n .on(\"change\", function() {\n that._value = this.value;\n\n that.trigger(CHANGE);\n });\n\n this.wrapper.closest(\".k-item\").after(that._zonePickerLabel);\n\n that._bindZones(that._zoneTitle.val());\n that._value = that._zone[0].value;\n },\n\n destroy: function() {\n Widget.fn.destroy.call(this);\n\n kendo.destroy(this.wrapper);\n },\n\n value: function(value) {\n var that = this;\n var zonePicker = that._zone;\n var other_zone = \"\";\n var zone_value = \"\";\n var zone;\n\n if (value === undefined$1) {\n return that._value;\n }\n\n zone = that._zonesQuery.filter({ field: \"zone\", operator: \"eq\", value: value }).data[0];\n\n if (zone) {\n zone_value = zone.zone;\n other_zone = zone.other_zone;\n }\n\n that._zoneTitle.val(other_zone);\n that._bindZones(other_zone);\n\n zonePicker.val(zone_value);\n zone_value = zonePicker[0].value;\n\n if (zone_value && zonePicker.children.length > 1) {\n that._zonePickerLabel.show();\n } else {\n that._zonePickerLabel.hide();\n }\n\n that._value = zone_value;\n }\n });\n\n ui.plugin(MobileTimezoneEditor);\n\n })(window.kendo.jQuery);\n var kendo$1 = kendo;\n\n return kendo$1;\n\n}));\n"]}