{"version":3,"file":"js/vendors~application~flatpickr-472bae05af00f8a4e970.chunk.js","sources":["webpack:///./node_modules/@stimulus/core/dist/action.js","webpack:///./node_modules/@stimulus/core/dist/action_descriptor.js","webpack:///./node_modules/@stimulus/core/dist/application.js","webpack:///./node_modules/@stimulus/core/dist/binding.js","webpack:///./node_modules/@stimulus/core/dist/binding_observer.js","webpack:///./node_modules/@stimulus/core/dist/blessing.js","webpack:///./node_modules/@stimulus/core/dist/class_map.js","webpack:///./node_modules/@stimulus/core/dist/class_properties.js","webpack:///./node_modules/@stimulus/core/dist/context.js","webpack:///./node_modules/@stimulus/core/dist/controller.js","webpack:///./node_modules/@stimulus/core/dist/data_map.js","webpack:///./node_modules/@stimulus/core/dist/definition.js","webpack:///./node_modules/@stimulus/core/dist/dispatcher.js","webpack:///./node_modules/@stimulus/core/dist/event_listener.js","webpack:///./node_modules/@stimulus/core/dist/guide.js","webpack:///./node_modules/@stimulus/core/dist/index.js","webpack:///./node_modules/@stimulus/core/dist/inheritable_statics.js","webpack:///./node_modules/@stimulus/core/dist/module.js","webpack:///./node_modules/@stimulus/core/dist/router.js","webpack:///./node_modules/@stimulus/core/dist/schema.js","webpack:///./node_modules/@stimulus/core/dist/scope.js","webpack:///./node_modules/@stimulus/core/dist/scope_observer.js","webpack:///./node_modules/@stimulus/core/dist/selectors.js","webpack:///./node_modules/@stimulus/core/dist/string_helpers.js","webpack:///./node_modules/@stimulus/core/dist/target_properties.js","webpack:///./node_modules/@stimulus/core/dist/target_set.js","webpack:///./node_modules/@stimulus/core/dist/value_observer.js","webpack:///./node_modules/@stimulus/core/dist/value_properties.js","webpack:///./node_modules/@stimulus/multimap/dist/index.js","webpack:///./node_modules/@stimulus/multimap/dist/indexed_multimap.js","webpack:///./node_modules/@stimulus/multimap/dist/multimap.js","webpack:///./node_modules/@stimulus/multimap/dist/set_operations.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/attribute_observer.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/element_observer.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/index.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/string_map_observer.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/token_list_observer.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/value_list_observer.js","webpack:///./node_modules/css-loader/dist/runtime/api.js","webpack:///./node_modules/flatpickr/dist/esm/index.js","webpack:///./node_modules/flatpickr/dist/esm/l10n/default.js","webpack:///./node_modules/flatpickr/dist/esm/types/options.js","webpack:///./node_modules/flatpickr/dist/esm/utils/dates.js","webpack:///./node_modules/flatpickr/dist/esm/utils/dom.js","webpack:///./node_modules/flatpickr/dist/esm/utils/formatting.js","webpack:///./node_modules/flatpickr/dist/esm/utils/index.js","webpack:///./node_modules/flatpickr/dist/esm/utils/polyfills.js","webpack:///./node_modules/flatpickr/dist/l10n/es.js","webpack:///./node_modules/stimulus-flatpickr/dist/index.m.js","webpack:///./node_modules/stimulus/index.js","webpack:///./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"],"sourcesContent":["import { parseActionDescriptorString, stringifyEventTarget } from \"./action_descriptor\";\n\nvar Action =\n/** @class */\nfunction () {\n function Action(element, index, descriptor) {\n this.element = element;\n this.index = index;\n this.eventTarget = descriptor.eventTarget || element;\n this.eventName = descriptor.eventName || getDefaultEventNameForElement(element) || error(\"missing event name\");\n this.eventOptions = descriptor.eventOptions || {};\n this.identifier = descriptor.identifier || error(\"missing identifier\");\n this.methodName = descriptor.methodName || error(\"missing method name\");\n }\n\n Action.forToken = function (token) {\n return new this(token.element, token.index, parseActionDescriptorString(token.content));\n };\n\n Action.prototype.toString = function () {\n var eventNameSuffix = this.eventTargetName ? \"@\" + this.eventTargetName : \"\";\n return \"\" + this.eventName + eventNameSuffix + \"->\" + this.identifier + \"#\" + this.methodName;\n };\n\n Object.defineProperty(Action.prototype, \"eventTargetName\", {\n get: function () {\n return stringifyEventTarget(this.eventTarget);\n },\n enumerable: false,\n configurable: true\n });\n return Action;\n}();\n\nexport { Action };\nvar defaultEventNames = {\n \"a\": function (e) {\n return \"click\";\n },\n \"button\": function (e) {\n return \"click\";\n },\n \"form\": function (e) {\n return \"submit\";\n },\n \"input\": function (e) {\n return e.getAttribute(\"type\") == \"submit\" ? \"click\" : \"input\";\n },\n \"select\": function (e) {\n return \"change\";\n },\n \"textarea\": function (e) {\n return \"input\";\n }\n};\nexport function getDefaultEventNameForElement(element) {\n var tagName = element.tagName.toLowerCase();\n\n if (tagName in defaultEventNames) {\n return defaultEventNames[tagName](element);\n }\n}\n\nfunction error(message) {\n throw new Error(message);\n}","// capture nos.: 12 23 4 43 1 5 56 7 768 9 98\nvar descriptorPattern = /^((.+?)(@(window|document))?->)?(.+?)(#([^:]+?))(:(.+))?$/;\nexport function parseActionDescriptorString(descriptorString) {\n var source = descriptorString.trim();\n var matches = source.match(descriptorPattern) || [];\n return {\n eventTarget: parseEventTarget(matches[4]),\n eventName: matches[2],\n eventOptions: matches[9] ? parseEventOptions(matches[9]) : {},\n identifier: matches[5],\n methodName: matches[7]\n };\n}\n\nfunction parseEventTarget(eventTargetName) {\n if (eventTargetName == \"window\") {\n return window;\n } else if (eventTargetName == \"document\") {\n return document;\n }\n}\n\nfunction parseEventOptions(eventOptions) {\n return eventOptions.split(\":\").reduce(function (options, token) {\n var _a;\n\n return Object.assign(options, (_a = {}, _a[token.replace(/^!/, \"\")] = !/^!/.test(token), _a));\n }, {});\n}\n\nexport function stringifyEventTarget(eventTarget) {\n if (eventTarget == window) {\n return \"window\";\n } else if (eventTarget == document) {\n return \"document\";\n }\n}","var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\nvar __generator = this && this.__generator || function (thisArg, body) {\n var _ = {\n label: 0,\n sent: function () {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n};\n\nvar __spreadArrays = this && this.__spreadArrays || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];\n\n return r;\n};\n\nimport { Dispatcher } from \"./dispatcher\";\nimport { Router } from \"./router\";\nimport { defaultSchema } from \"./schema\";\n\nvar Application =\n/** @class */\nfunction () {\n function Application(element, schema) {\n if (element === void 0) {\n element = document.documentElement;\n }\n\n if (schema === void 0) {\n schema = defaultSchema;\n }\n\n this.logger = console;\n this.element = element;\n this.schema = schema;\n this.dispatcher = new Dispatcher(this);\n this.router = new Router(this);\n }\n\n Application.start = function (element, schema) {\n var application = new Application(element, schema);\n application.start();\n return application;\n };\n\n Application.prototype.start = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , domReady()];\n\n case 1:\n _a.sent();\n\n this.dispatcher.start();\n this.router.start();\n return [2\n /*return*/\n ];\n }\n });\n });\n };\n\n Application.prototype.stop = function () {\n this.dispatcher.stop();\n this.router.stop();\n };\n\n Application.prototype.register = function (identifier, controllerConstructor) {\n this.load({\n identifier: identifier,\n controllerConstructor: controllerConstructor\n });\n };\n\n Application.prototype.load = function (head) {\n var _this = this;\n\n var rest = [];\n\n for (var _i = 1; _i < arguments.length; _i++) {\n rest[_i - 1] = arguments[_i];\n }\n\n var definitions = Array.isArray(head) ? head : __spreadArrays([head], rest);\n definitions.forEach(function (definition) {\n return _this.router.loadDefinition(definition);\n });\n };\n\n Application.prototype.unload = function (head) {\n var _this = this;\n\n var rest = [];\n\n for (var _i = 1; _i < arguments.length; _i++) {\n rest[_i - 1] = arguments[_i];\n }\n\n var identifiers = Array.isArray(head) ? head : __spreadArrays([head], rest);\n identifiers.forEach(function (identifier) {\n return _this.router.unloadIdentifier(identifier);\n });\n };\n\n Object.defineProperty(Application.prototype, \"controllers\", {\n // Controllers\n get: function () {\n return this.router.contexts.map(function (context) {\n return context.controller;\n });\n },\n enumerable: false,\n configurable: true\n });\n\n Application.prototype.getControllerForElementAndIdentifier = function (element, identifier) {\n var context = this.router.getContextForElementAndIdentifier(element, identifier);\n return context ? context.controller : null;\n }; // Error handling\n\n\n Application.prototype.handleError = function (error, message, detail) {\n this.logger.error(\"%s\\n\\n%o\\n\\n%o\", message, error, detail);\n };\n\n return Application;\n}();\n\nexport { Application };\n\nfunction domReady() {\n return new Promise(function (resolve) {\n if (document.readyState == \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", resolve);\n } else {\n resolve();\n }\n });\n}","var Binding =\n/** @class */\nfunction () {\n function Binding(context, action) {\n this.context = context;\n this.action = action;\n }\n\n Object.defineProperty(Binding.prototype, \"index\", {\n get: function () {\n return this.action.index;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"eventTarget\", {\n get: function () {\n return this.action.eventTarget;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"eventOptions\", {\n get: function () {\n return this.action.eventOptions;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"identifier\", {\n get: function () {\n return this.context.identifier;\n },\n enumerable: false,\n configurable: true\n });\n\n Binding.prototype.handleEvent = function (event) {\n if (this.willBeInvokedByEvent(event)) {\n this.invokeWithEvent(event);\n }\n };\n\n Object.defineProperty(Binding.prototype, \"eventName\", {\n get: function () {\n return this.action.eventName;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"method\", {\n get: function () {\n var method = this.controller[this.methodName];\n\n if (typeof method == \"function\") {\n return method;\n }\n\n throw new Error(\"Action \\\"\" + this.action + \"\\\" references undefined method \\\"\" + this.methodName + \"\\\"\");\n },\n enumerable: false,\n configurable: true\n });\n\n Binding.prototype.invokeWithEvent = function (event) {\n try {\n this.method.call(this.controller, event);\n } catch (error) {\n var _a = this,\n identifier = _a.identifier,\n controller = _a.controller,\n element = _a.element,\n index = _a.index;\n\n var detail = {\n identifier: identifier,\n controller: controller,\n element: element,\n index: index,\n event: event\n };\n this.context.handleError(error, \"invoking action \\\"\" + this.action + \"\\\"\", detail);\n }\n };\n\n Binding.prototype.willBeInvokedByEvent = function (event) {\n var eventTarget = event.target;\n\n if (this.element === eventTarget) {\n return true;\n } else if (eventTarget instanceof Element && this.element.contains(eventTarget)) {\n return this.scope.containsElement(eventTarget);\n } else {\n return this.scope.containsElement(this.action.element);\n }\n };\n\n Object.defineProperty(Binding.prototype, \"controller\", {\n get: function () {\n return this.context.controller;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"methodName\", {\n get: function () {\n return this.action.methodName;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"scope\", {\n get: function () {\n return this.context.scope;\n },\n enumerable: false,\n configurable: true\n });\n return Binding;\n}();\n\nexport { Binding };","import { Action } from \"./action\";\nimport { Binding } from \"./binding\";\nimport { ValueListObserver } from \"@stimulus/mutation-observers\";\n\nvar BindingObserver =\n/** @class */\nfunction () {\n function BindingObserver(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.bindingsByAction = new Map();\n }\n\n BindingObserver.prototype.start = function () {\n if (!this.valueListObserver) {\n this.valueListObserver = new ValueListObserver(this.element, this.actionAttribute, this);\n this.valueListObserver.start();\n }\n };\n\n BindingObserver.prototype.stop = function () {\n if (this.valueListObserver) {\n this.valueListObserver.stop();\n delete this.valueListObserver;\n this.disconnectAllActions();\n }\n };\n\n Object.defineProperty(BindingObserver.prototype, \"element\", {\n get: function () {\n return this.context.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"identifier\", {\n get: function () {\n return this.context.identifier;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"actionAttribute\", {\n get: function () {\n return this.schema.actionAttribute;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"schema\", {\n get: function () {\n return this.context.schema;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"bindings\", {\n get: function () {\n return Array.from(this.bindingsByAction.values());\n },\n enumerable: false,\n configurable: true\n });\n\n BindingObserver.prototype.connectAction = function (action) {\n var binding = new Binding(this.context, action);\n this.bindingsByAction.set(action, binding);\n this.delegate.bindingConnected(binding);\n };\n\n BindingObserver.prototype.disconnectAction = function (action) {\n var binding = this.bindingsByAction.get(action);\n\n if (binding) {\n this.bindingsByAction.delete(action);\n this.delegate.bindingDisconnected(binding);\n }\n };\n\n BindingObserver.prototype.disconnectAllActions = function () {\n var _this = this;\n\n this.bindings.forEach(function (binding) {\n return _this.delegate.bindingDisconnected(binding);\n });\n this.bindingsByAction.clear();\n }; // Value observer delegate\n\n\n BindingObserver.prototype.parseValueForToken = function (token) {\n var action = Action.forToken(token);\n\n if (action.identifier == this.identifier) {\n return action;\n }\n };\n\n BindingObserver.prototype.elementMatchedValue = function (element, action) {\n this.connectAction(action);\n };\n\n BindingObserver.prototype.elementUnmatchedValue = function (element, action) {\n this.disconnectAction(action);\n };\n\n return BindingObserver;\n}();\n\nexport { BindingObserver };","var __extends = this && this.__extends || function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n };\n\n return extendStatics(d, b);\n };\n\n return function (d, b) {\n extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nvar __spreadArrays = this && this.__spreadArrays || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];\n\n return r;\n};\n\nimport { readInheritableStaticArrayValues } from \"./inheritable_statics\";\n/** @hidden */\n\nexport function bless(constructor) {\n return shadow(constructor, getBlessedProperties(constructor));\n}\n\nfunction shadow(constructor, properties) {\n var shadowConstructor = extend(constructor);\n var shadowProperties = getShadowProperties(constructor.prototype, properties);\n Object.defineProperties(shadowConstructor.prototype, shadowProperties);\n return shadowConstructor;\n}\n\nfunction getBlessedProperties(constructor) {\n var blessings = readInheritableStaticArrayValues(constructor, \"blessings\");\n return blessings.reduce(function (blessedProperties, blessing) {\n var properties = blessing(constructor);\n\n for (var key in properties) {\n var descriptor = blessedProperties[key] || {};\n blessedProperties[key] = Object.assign(descriptor, properties[key]);\n }\n\n return blessedProperties;\n }, {});\n}\n\nfunction getShadowProperties(prototype, properties) {\n return getOwnKeys(properties).reduce(function (shadowProperties, key) {\n var _a;\n\n var descriptor = getShadowedDescriptor(prototype, properties, key);\n\n if (descriptor) {\n Object.assign(shadowProperties, (_a = {}, _a[key] = descriptor, _a));\n }\n\n return shadowProperties;\n }, {});\n}\n\nfunction getShadowedDescriptor(prototype, properties, key) {\n var shadowingDescriptor = Object.getOwnPropertyDescriptor(prototype, key);\n var shadowedByValue = shadowingDescriptor && \"value\" in shadowingDescriptor;\n\n if (!shadowedByValue) {\n var descriptor = Object.getOwnPropertyDescriptor(properties, key).value;\n\n if (shadowingDescriptor) {\n descriptor.get = shadowingDescriptor.get || descriptor.get;\n descriptor.set = shadowingDescriptor.set || descriptor.set;\n }\n\n return descriptor;\n }\n}\n\nvar getOwnKeys = function () {\n if (typeof Object.getOwnPropertySymbols == \"function\") {\n return function (object) {\n return __spreadArrays(Object.getOwnPropertyNames(object), Object.getOwnPropertySymbols(object));\n };\n } else {\n return Object.getOwnPropertyNames;\n }\n}();\n\nvar extend = function () {\n function extendWithReflect(constructor) {\n function extended() {\n var _newTarget = this && this instanceof extended ? this.constructor : void 0;\n\n return Reflect.construct(constructor, arguments, _newTarget);\n }\n\n extended.prototype = Object.create(constructor.prototype, {\n constructor: {\n value: extended\n }\n });\n Reflect.setPrototypeOf(extended, constructor);\n return extended;\n }\n\n function testReflectExtension() {\n var a = function () {\n this.a.call(this);\n };\n\n var b = extendWithReflect(a);\n\n b.prototype.a = function () {};\n\n return new b();\n }\n\n try {\n testReflectExtension();\n return extendWithReflect;\n } catch (error) {\n return function (constructor) {\n return (\n /** @class */\n function (_super) {\n __extends(extended, _super);\n\n function extended() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n return extended;\n }(constructor)\n );\n };\n }\n}();","var ClassMap =\n/** @class */\nfunction () {\n function ClassMap(scope) {\n this.scope = scope;\n }\n\n ClassMap.prototype.has = function (name) {\n return this.data.has(this.getDataKey(name));\n };\n\n ClassMap.prototype.get = function (name) {\n return this.data.get(this.getDataKey(name));\n };\n\n ClassMap.prototype.getAttributeName = function (name) {\n return this.data.getAttributeNameForKey(this.getDataKey(name));\n };\n\n ClassMap.prototype.getDataKey = function (name) {\n return name + \"-class\";\n };\n\n Object.defineProperty(ClassMap.prototype, \"data\", {\n get: function () {\n return this.scope.data;\n },\n enumerable: false,\n configurable: true\n });\n return ClassMap;\n}();\n\nexport { ClassMap };","import { readInheritableStaticArrayValues } from \"./inheritable_statics\";\nimport { capitalize } from \"./string_helpers\";\n/** @hidden */\n\nexport function ClassPropertiesBlessing(constructor) {\n var classes = readInheritableStaticArrayValues(constructor, \"classes\");\n return classes.reduce(function (properties, classDefinition) {\n return Object.assign(properties, propertiesForClassDefinition(classDefinition));\n }, {});\n}\n\nfunction propertiesForClassDefinition(key) {\n var _a;\n\n var name = key + \"Class\";\n return _a = {}, _a[name] = {\n get: function () {\n var classes = this.classes;\n\n if (classes.has(key)) {\n return classes.get(key);\n } else {\n var attribute = classes.getAttributeName(key);\n throw new Error(\"Missing attribute \\\"\" + attribute + \"\\\"\");\n }\n }\n }, _a[\"has\" + capitalize(name)] = {\n get: function () {\n return this.classes.has(key);\n }\n }, _a;\n}","import { BindingObserver } from \"./binding_observer\";\nimport { ValueObserver } from \"./value_observer\";\n\nvar Context =\n/** @class */\nfunction () {\n function Context(module, scope) {\n this.module = module;\n this.scope = scope;\n this.controller = new module.controllerConstructor(this);\n this.bindingObserver = new BindingObserver(this, this.dispatcher);\n this.valueObserver = new ValueObserver(this, this.controller);\n\n try {\n this.controller.initialize();\n } catch (error) {\n this.handleError(error, \"initializing controller\");\n }\n }\n\n Context.prototype.connect = function () {\n this.bindingObserver.start();\n this.valueObserver.start();\n\n try {\n this.controller.connect();\n } catch (error) {\n this.handleError(error, \"connecting controller\");\n }\n };\n\n Context.prototype.disconnect = function () {\n try {\n this.controller.disconnect();\n } catch (error) {\n this.handleError(error, \"disconnecting controller\");\n }\n\n this.valueObserver.stop();\n this.bindingObserver.stop();\n };\n\n Object.defineProperty(Context.prototype, \"application\", {\n get: function () {\n return this.module.application;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"identifier\", {\n get: function () {\n return this.module.identifier;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"schema\", {\n get: function () {\n return this.application.schema;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"dispatcher\", {\n get: function () {\n return this.application.dispatcher;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"parentElement\", {\n get: function () {\n return this.element.parentElement;\n },\n enumerable: false,\n configurable: true\n }); // Error handling\n\n Context.prototype.handleError = function (error, message, detail) {\n if (detail === void 0) {\n detail = {};\n }\n\n var _a = this,\n identifier = _a.identifier,\n controller = _a.controller,\n element = _a.element;\n\n detail = Object.assign({\n identifier: identifier,\n controller: controller,\n element: element\n }, detail);\n this.application.handleError(error, \"Error \" + message, detail);\n };\n\n return Context;\n}();\n\nexport { Context };","import { ClassPropertiesBlessing } from \"./class_properties\";\nimport { TargetPropertiesBlessing } from \"./target_properties\";\nimport { ValuePropertiesBlessing } from \"./value_properties\";\n\nvar Controller =\n/** @class */\nfunction () {\n function Controller(context) {\n this.context = context;\n }\n\n Object.defineProperty(Controller.prototype, \"application\", {\n get: function () {\n return this.context.application;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"scope\", {\n get: function () {\n return this.context.scope;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"identifier\", {\n get: function () {\n return this.scope.identifier;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"targets\", {\n get: function () {\n return this.scope.targets;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"classes\", {\n get: function () {\n return this.scope.classes;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"data\", {\n get: function () {\n return this.scope.data;\n },\n enumerable: false,\n configurable: true\n });\n\n Controller.prototype.initialize = function () {// Override in your subclass to set up initial controller state\n };\n\n Controller.prototype.connect = function () {// Override in your subclass to respond when the controller is connected to the DOM\n };\n\n Controller.prototype.disconnect = function () {// Override in your subclass to respond when the controller is disconnected from the DOM\n };\n\n Controller.blessings = [ClassPropertiesBlessing, TargetPropertiesBlessing, ValuePropertiesBlessing];\n Controller.targets = [];\n Controller.values = {};\n return Controller;\n}();\n\nexport { Controller };","import { dasherize } from \"./string_helpers\";\n\nvar DataMap =\n/** @class */\nfunction () {\n function DataMap(scope) {\n this.scope = scope;\n }\n\n Object.defineProperty(DataMap.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(DataMap.prototype, \"identifier\", {\n get: function () {\n return this.scope.identifier;\n },\n enumerable: false,\n configurable: true\n });\n\n DataMap.prototype.get = function (key) {\n var name = this.getAttributeNameForKey(key);\n return this.element.getAttribute(name);\n };\n\n DataMap.prototype.set = function (key, value) {\n var name = this.getAttributeNameForKey(key);\n this.element.setAttribute(name, value);\n return this.get(key);\n };\n\n DataMap.prototype.has = function (key) {\n var name = this.getAttributeNameForKey(key);\n return this.element.hasAttribute(name);\n };\n\n DataMap.prototype.delete = function (key) {\n if (this.has(key)) {\n var name_1 = this.getAttributeNameForKey(key);\n this.element.removeAttribute(name_1);\n return true;\n } else {\n return false;\n }\n };\n\n DataMap.prototype.getAttributeNameForKey = function (key) {\n return \"data-\" + this.identifier + \"-\" + dasherize(key);\n };\n\n return DataMap;\n}();\n\nexport { DataMap };","import { bless } from \"./blessing\";\n/** @hidden */\n\nexport function blessDefinition(definition) {\n return {\n identifier: definition.identifier,\n controllerConstructor: bless(definition.controllerConstructor)\n };\n}","import { EventListener } from \"./event_listener\";\n\nvar Dispatcher =\n/** @class */\nfunction () {\n function Dispatcher(application) {\n this.application = application;\n this.eventListenerMaps = new Map();\n this.started = false;\n }\n\n Dispatcher.prototype.start = function () {\n if (!this.started) {\n this.started = true;\n this.eventListeners.forEach(function (eventListener) {\n return eventListener.connect();\n });\n }\n };\n\n Dispatcher.prototype.stop = function () {\n if (this.started) {\n this.started = false;\n this.eventListeners.forEach(function (eventListener) {\n return eventListener.disconnect();\n });\n }\n };\n\n Object.defineProperty(Dispatcher.prototype, \"eventListeners\", {\n get: function () {\n return Array.from(this.eventListenerMaps.values()).reduce(function (listeners, map) {\n return listeners.concat(Array.from(map.values()));\n }, []);\n },\n enumerable: false,\n configurable: true\n }); // Binding observer delegate\n\n /** @hidden */\n\n Dispatcher.prototype.bindingConnected = function (binding) {\n this.fetchEventListenerForBinding(binding).bindingConnected(binding);\n };\n /** @hidden */\n\n\n Dispatcher.prototype.bindingDisconnected = function (binding) {\n this.fetchEventListenerForBinding(binding).bindingDisconnected(binding);\n }; // Error handling\n\n\n Dispatcher.prototype.handleError = function (error, message, detail) {\n if (detail === void 0) {\n detail = {};\n }\n\n this.application.handleError(error, \"Error \" + message, detail);\n };\n\n Dispatcher.prototype.fetchEventListenerForBinding = function (binding) {\n var eventTarget = binding.eventTarget,\n eventName = binding.eventName,\n eventOptions = binding.eventOptions;\n return this.fetchEventListener(eventTarget, eventName, eventOptions);\n };\n\n Dispatcher.prototype.fetchEventListener = function (eventTarget, eventName, eventOptions) {\n var eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n var cacheKey = this.cacheKey(eventName, eventOptions);\n var eventListener = eventListenerMap.get(cacheKey);\n\n if (!eventListener) {\n eventListener = this.createEventListener(eventTarget, eventName, eventOptions);\n eventListenerMap.set(cacheKey, eventListener);\n }\n\n return eventListener;\n };\n\n Dispatcher.prototype.createEventListener = function (eventTarget, eventName, eventOptions) {\n var eventListener = new EventListener(eventTarget, eventName, eventOptions);\n\n if (this.started) {\n eventListener.connect();\n }\n\n return eventListener;\n };\n\n Dispatcher.prototype.fetchEventListenerMapForEventTarget = function (eventTarget) {\n var eventListenerMap = this.eventListenerMaps.get(eventTarget);\n\n if (!eventListenerMap) {\n eventListenerMap = new Map();\n this.eventListenerMaps.set(eventTarget, eventListenerMap);\n }\n\n return eventListenerMap;\n };\n\n Dispatcher.prototype.cacheKey = function (eventName, eventOptions) {\n var parts = [eventName];\n Object.keys(eventOptions).sort().forEach(function (key) {\n parts.push(\"\" + (eventOptions[key] ? \"\" : \"!\") + key);\n });\n return parts.join(\":\");\n };\n\n return Dispatcher;\n}();\n\nexport { Dispatcher };","var EventListener =\n/** @class */\nfunction () {\n function EventListener(eventTarget, eventName, eventOptions) {\n this.eventTarget = eventTarget;\n this.eventName = eventName;\n this.eventOptions = eventOptions;\n this.unorderedBindings = new Set();\n }\n\n EventListener.prototype.connect = function () {\n this.eventTarget.addEventListener(this.eventName, this, this.eventOptions);\n };\n\n EventListener.prototype.disconnect = function () {\n this.eventTarget.removeEventListener(this.eventName, this, this.eventOptions);\n }; // Binding observer delegate\n\n /** @hidden */\n\n\n EventListener.prototype.bindingConnected = function (binding) {\n this.unorderedBindings.add(binding);\n };\n /** @hidden */\n\n\n EventListener.prototype.bindingDisconnected = function (binding) {\n this.unorderedBindings.delete(binding);\n };\n\n EventListener.prototype.handleEvent = function (event) {\n var extendedEvent = extendEvent(event);\n\n for (var _i = 0, _a = this.bindings; _i < _a.length; _i++) {\n var binding = _a[_i];\n\n if (extendedEvent.immediatePropagationStopped) {\n break;\n } else {\n binding.handleEvent(extendedEvent);\n }\n }\n };\n\n Object.defineProperty(EventListener.prototype, \"bindings\", {\n get: function () {\n return Array.from(this.unorderedBindings).sort(function (left, right) {\n var leftIndex = left.index,\n rightIndex = right.index;\n return leftIndex < rightIndex ? -1 : leftIndex > rightIndex ? 1 : 0;\n });\n },\n enumerable: false,\n configurable: true\n });\n return EventListener;\n}();\n\nexport { EventListener };\n\nfunction extendEvent(event) {\n if (\"immediatePropagationStopped\" in event) {\n return event;\n } else {\n var stopImmediatePropagation_1 = event.stopImmediatePropagation;\n return Object.assign(event, {\n immediatePropagationStopped: false,\n stopImmediatePropagation: function () {\n this.immediatePropagationStopped = true;\n stopImmediatePropagation_1.call(this);\n }\n });\n }\n}","var Guide =\n/** @class */\nfunction () {\n function Guide(logger) {\n this.warnedKeysByObject = new WeakMap();\n this.logger = logger;\n }\n\n Guide.prototype.warn = function (object, key, message) {\n var warnedKeys = this.warnedKeysByObject.get(object);\n\n if (!warnedKeys) {\n warnedKeys = new Set();\n this.warnedKeysByObject.set(object, warnedKeys);\n }\n\n if (!warnedKeys.has(key)) {\n warnedKeys.add(key);\n this.logger.warn(message, object);\n }\n };\n\n return Guide;\n}();\n\nexport { Guide };","export { Application } from \"./application\";\nexport { Context } from \"./context\";\nexport { Controller } from \"./controller\";\nexport { defaultSchema } from \"./schema\";","export function readInheritableStaticArrayValues(constructor, propertyName) {\n var ancestors = getAncestorsForConstructor(constructor);\n return Array.from(ancestors.reduce(function (values, constructor) {\n getOwnStaticArrayValues(constructor, propertyName).forEach(function (name) {\n return values.add(name);\n });\n return values;\n }, new Set()));\n}\nexport function readInheritableStaticObjectPairs(constructor, propertyName) {\n var ancestors = getAncestorsForConstructor(constructor);\n return ancestors.reduce(function (pairs, constructor) {\n pairs.push.apply(pairs, getOwnStaticObjectPairs(constructor, propertyName));\n return pairs;\n }, []);\n}\n\nfunction getAncestorsForConstructor(constructor) {\n var ancestors = [];\n\n while (constructor) {\n ancestors.push(constructor);\n constructor = Object.getPrototypeOf(constructor);\n }\n\n return ancestors.reverse();\n}\n\nfunction getOwnStaticArrayValues(constructor, propertyName) {\n var definition = constructor[propertyName];\n return Array.isArray(definition) ? definition : [];\n}\n\nfunction getOwnStaticObjectPairs(constructor, propertyName) {\n var definition = constructor[propertyName];\n return definition ? Object.keys(definition).map(function (key) {\n return [key, definition[key]];\n }) : [];\n}","import { Context } from \"./context\";\nimport { blessDefinition } from \"./definition\";\n\nvar Module =\n/** @class */\nfunction () {\n function Module(application, definition) {\n this.application = application;\n this.definition = blessDefinition(definition);\n this.contextsByScope = new WeakMap();\n this.connectedContexts = new Set();\n }\n\n Object.defineProperty(Module.prototype, \"identifier\", {\n get: function () {\n return this.definition.identifier;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Module.prototype, \"controllerConstructor\", {\n get: function () {\n return this.definition.controllerConstructor;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Module.prototype, \"contexts\", {\n get: function () {\n return Array.from(this.connectedContexts);\n },\n enumerable: false,\n configurable: true\n });\n\n Module.prototype.connectContextForScope = function (scope) {\n var context = this.fetchContextForScope(scope);\n this.connectedContexts.add(context);\n context.connect();\n };\n\n Module.prototype.disconnectContextForScope = function (scope) {\n var context = this.contextsByScope.get(scope);\n\n if (context) {\n this.connectedContexts.delete(context);\n context.disconnect();\n }\n };\n\n Module.prototype.fetchContextForScope = function (scope) {\n var context = this.contextsByScope.get(scope);\n\n if (!context) {\n context = new Context(this, scope);\n this.contextsByScope.set(scope, context);\n }\n\n return context;\n };\n\n return Module;\n}();\n\nexport { Module };","import { Module } from \"./module\";\nimport { Multimap } from \"@stimulus/multimap\";\nimport { Scope } from \"./scope\";\nimport { ScopeObserver } from \"./scope_observer\";\n\nvar Router =\n/** @class */\nfunction () {\n function Router(application) {\n this.application = application;\n this.scopeObserver = new ScopeObserver(this.element, this.schema, this);\n this.scopesByIdentifier = new Multimap();\n this.modulesByIdentifier = new Map();\n }\n\n Object.defineProperty(Router.prototype, \"element\", {\n get: function () {\n return this.application.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"schema\", {\n get: function () {\n return this.application.schema;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"logger\", {\n get: function () {\n return this.application.logger;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"controllerAttribute\", {\n get: function () {\n return this.schema.controllerAttribute;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"modules\", {\n get: function () {\n return Array.from(this.modulesByIdentifier.values());\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"contexts\", {\n get: function () {\n return this.modules.reduce(function (contexts, module) {\n return contexts.concat(module.contexts);\n }, []);\n },\n enumerable: false,\n configurable: true\n });\n\n Router.prototype.start = function () {\n this.scopeObserver.start();\n };\n\n Router.prototype.stop = function () {\n this.scopeObserver.stop();\n };\n\n Router.prototype.loadDefinition = function (definition) {\n this.unloadIdentifier(definition.identifier);\n var module = new Module(this.application, definition);\n this.connectModule(module);\n };\n\n Router.prototype.unloadIdentifier = function (identifier) {\n var module = this.modulesByIdentifier.get(identifier);\n\n if (module) {\n this.disconnectModule(module);\n }\n };\n\n Router.prototype.getContextForElementAndIdentifier = function (element, identifier) {\n var module = this.modulesByIdentifier.get(identifier);\n\n if (module) {\n return module.contexts.find(function (context) {\n return context.element == element;\n });\n }\n }; // Error handler delegate\n\n /** @hidden */\n\n\n Router.prototype.handleError = function (error, message, detail) {\n this.application.handleError(error, message, detail);\n }; // Scope observer delegate\n\n /** @hidden */\n\n\n Router.prototype.createScopeForElementAndIdentifier = function (element, identifier) {\n return new Scope(this.schema, element, identifier, this.logger);\n };\n /** @hidden */\n\n\n Router.prototype.scopeConnected = function (scope) {\n this.scopesByIdentifier.add(scope.identifier, scope);\n var module = this.modulesByIdentifier.get(scope.identifier);\n\n if (module) {\n module.connectContextForScope(scope);\n }\n };\n /** @hidden */\n\n\n Router.prototype.scopeDisconnected = function (scope) {\n this.scopesByIdentifier.delete(scope.identifier, scope);\n var module = this.modulesByIdentifier.get(scope.identifier);\n\n if (module) {\n module.disconnectContextForScope(scope);\n }\n }; // Modules\n\n\n Router.prototype.connectModule = function (module) {\n this.modulesByIdentifier.set(module.identifier, module);\n var scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach(function (scope) {\n return module.connectContextForScope(scope);\n });\n };\n\n Router.prototype.disconnectModule = function (module) {\n this.modulesByIdentifier.delete(module.identifier);\n var scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach(function (scope) {\n return module.disconnectContextForScope(scope);\n });\n };\n\n return Router;\n}();\n\nexport { Router };","export var defaultSchema = {\n controllerAttribute: \"data-controller\",\n actionAttribute: \"data-action\",\n targetAttribute: \"data-target\"\n};","var __spreadArrays = this && this.__spreadArrays || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];\n\n return r;\n};\n\nimport { ClassMap } from \"./class_map\";\nimport { DataMap } from \"./data_map\";\nimport { Guide } from \"./guide\";\nimport { attributeValueContainsToken } from \"./selectors\";\nimport { TargetSet } from \"./target_set\";\n\nvar Scope =\n/** @class */\nfunction () {\n function Scope(schema, element, identifier, logger) {\n var _this = this;\n\n this.targets = new TargetSet(this);\n this.classes = new ClassMap(this);\n this.data = new DataMap(this);\n\n this.containsElement = function (element) {\n return element.closest(_this.controllerSelector) === _this.element;\n };\n\n this.schema = schema;\n this.element = element;\n this.identifier = identifier;\n this.guide = new Guide(logger);\n }\n\n Scope.prototype.findElement = function (selector) {\n return this.element.matches(selector) ? this.element : this.queryElements(selector).find(this.containsElement);\n };\n\n Scope.prototype.findAllElements = function (selector) {\n return __spreadArrays(this.element.matches(selector) ? [this.element] : [], this.queryElements(selector).filter(this.containsElement));\n };\n\n Scope.prototype.queryElements = function (selector) {\n return Array.from(this.element.querySelectorAll(selector));\n };\n\n Object.defineProperty(Scope.prototype, \"controllerSelector\", {\n get: function () {\n return attributeValueContainsToken(this.schema.controllerAttribute, this.identifier);\n },\n enumerable: false,\n configurable: true\n });\n return Scope;\n}();\n\nexport { Scope };","import { ValueListObserver } from \"@stimulus/mutation-observers\";\n\nvar ScopeObserver =\n/** @class */\nfunction () {\n function ScopeObserver(element, schema, delegate) {\n this.element = element;\n this.schema = schema;\n this.delegate = delegate;\n this.valueListObserver = new ValueListObserver(this.element, this.controllerAttribute, this);\n this.scopesByIdentifierByElement = new WeakMap();\n this.scopeReferenceCounts = new WeakMap();\n }\n\n ScopeObserver.prototype.start = function () {\n this.valueListObserver.start();\n };\n\n ScopeObserver.prototype.stop = function () {\n this.valueListObserver.stop();\n };\n\n Object.defineProperty(ScopeObserver.prototype, \"controllerAttribute\", {\n get: function () {\n return this.schema.controllerAttribute;\n },\n enumerable: false,\n configurable: true\n }); // Value observer delegate\n\n /** @hidden */\n\n ScopeObserver.prototype.parseValueForToken = function (token) {\n var element = token.element,\n identifier = token.content;\n var scopesByIdentifier = this.fetchScopesByIdentifierForElement(element);\n var scope = scopesByIdentifier.get(identifier);\n\n if (!scope) {\n scope = this.delegate.createScopeForElementAndIdentifier(element, identifier);\n scopesByIdentifier.set(identifier, scope);\n }\n\n return scope;\n };\n /** @hidden */\n\n\n ScopeObserver.prototype.elementMatchedValue = function (element, value) {\n var referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1;\n this.scopeReferenceCounts.set(value, referenceCount);\n\n if (referenceCount == 1) {\n this.delegate.scopeConnected(value);\n }\n };\n /** @hidden */\n\n\n ScopeObserver.prototype.elementUnmatchedValue = function (element, value) {\n var referenceCount = this.scopeReferenceCounts.get(value);\n\n if (referenceCount) {\n this.scopeReferenceCounts.set(value, referenceCount - 1);\n\n if (referenceCount == 1) {\n this.delegate.scopeDisconnected(value);\n }\n }\n };\n\n ScopeObserver.prototype.fetchScopesByIdentifierForElement = function (element) {\n var scopesByIdentifier = this.scopesByIdentifierByElement.get(element);\n\n if (!scopesByIdentifier) {\n scopesByIdentifier = new Map();\n this.scopesByIdentifierByElement.set(element, scopesByIdentifier);\n }\n\n return scopesByIdentifier;\n };\n\n return ScopeObserver;\n}();\n\nexport { ScopeObserver };","/** @hidden */\nexport function attributeValueContainsToken(attributeName, token) {\n return \"[\" + attributeName + \"~=\\\"\" + token + \"\\\"]\";\n}","export function camelize(value) {\n return value.replace(/(?:[_-])([a-z0-9])/g, function (_, char) {\n return char.toUpperCase();\n });\n}\nexport function capitalize(value) {\n return value.charAt(0).toUpperCase() + value.slice(1);\n}\nexport function dasherize(value) {\n return value.replace(/([A-Z])/g, function (_, char) {\n return \"-\" + char.toLowerCase();\n });\n}","import { readInheritableStaticArrayValues } from \"./inheritable_statics\";\nimport { capitalize } from \"./string_helpers\";\n/** @hidden */\n\nexport function TargetPropertiesBlessing(constructor) {\n var targets = readInheritableStaticArrayValues(constructor, \"targets\");\n return targets.reduce(function (properties, targetDefinition) {\n return Object.assign(properties, propertiesForTargetDefinition(targetDefinition));\n }, {});\n}\n\nfunction propertiesForTargetDefinition(name) {\n var _a;\n\n return _a = {}, _a[name + \"Target\"] = {\n get: function () {\n var target = this.targets.find(name);\n\n if (target) {\n return target;\n } else {\n throw new Error(\"Missing target element \\\"\" + this.identifier + \".\" + name + \"\\\"\");\n }\n }\n }, _a[name + \"Targets\"] = {\n get: function () {\n return this.targets.findAll(name);\n }\n }, _a[\"has\" + capitalize(name) + \"Target\"] = {\n get: function () {\n return this.targets.has(name);\n }\n }, _a;\n}","var __spreadArrays = this && this.__spreadArrays || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];\n\n return r;\n};\n\nimport { attributeValueContainsToken } from \"./selectors\";\n\nvar TargetSet =\n/** @class */\nfunction () {\n function TargetSet(scope) {\n this.scope = scope;\n }\n\n Object.defineProperty(TargetSet.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TargetSet.prototype, \"identifier\", {\n get: function () {\n return this.scope.identifier;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TargetSet.prototype, \"schema\", {\n get: function () {\n return this.scope.schema;\n },\n enumerable: false,\n configurable: true\n });\n\n TargetSet.prototype.has = function (targetName) {\n return this.find(targetName) != null;\n };\n\n TargetSet.prototype.find = function () {\n var _this = this;\n\n var targetNames = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n targetNames[_i] = arguments[_i];\n }\n\n return targetNames.reduce(function (target, targetName) {\n return target || _this.findTarget(targetName) || _this.findLegacyTarget(targetName);\n }, undefined);\n };\n\n TargetSet.prototype.findAll = function () {\n var _this = this;\n\n var targetNames = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n targetNames[_i] = arguments[_i];\n }\n\n return targetNames.reduce(function (targets, targetName) {\n return __spreadArrays(targets, _this.findAllTargets(targetName), _this.findAllLegacyTargets(targetName));\n }, []);\n };\n\n TargetSet.prototype.findTarget = function (targetName) {\n var selector = this.getSelectorForTargetName(targetName);\n return this.scope.findElement(selector);\n };\n\n TargetSet.prototype.findAllTargets = function (targetName) {\n var selector = this.getSelectorForTargetName(targetName);\n return this.scope.findAllElements(selector);\n };\n\n TargetSet.prototype.getSelectorForTargetName = function (targetName) {\n var attributeName = \"data-\" + this.identifier + \"-target\";\n return attributeValueContainsToken(attributeName, targetName);\n };\n\n TargetSet.prototype.findLegacyTarget = function (targetName) {\n var selector = this.getLegacySelectorForTargetName(targetName);\n return this.deprecate(this.scope.findElement(selector), targetName);\n };\n\n TargetSet.prototype.findAllLegacyTargets = function (targetName) {\n var _this = this;\n\n var selector = this.getLegacySelectorForTargetName(targetName);\n return this.scope.findAllElements(selector).map(function (element) {\n return _this.deprecate(element, targetName);\n });\n };\n\n TargetSet.prototype.getLegacySelectorForTargetName = function (targetName) {\n var targetDescriptor = this.identifier + \".\" + targetName;\n return attributeValueContainsToken(this.schema.targetAttribute, targetDescriptor);\n };\n\n TargetSet.prototype.deprecate = function (element, targetName) {\n if (element) {\n var identifier = this.identifier;\n var attributeName = this.schema.targetAttribute;\n this.guide.warn(element, \"target:\" + targetName, \"Please replace \" + attributeName + \"=\\\"\" + identifier + \".\" + targetName + \"\\\" with data-\" + identifier + \"-target=\\\"\" + targetName + \"\\\". \" + (\"The \" + attributeName + \" attribute is deprecated and will be removed in a future version of Stimulus.\"));\n }\n\n return element;\n };\n\n Object.defineProperty(TargetSet.prototype, \"guide\", {\n get: function () {\n return this.scope.guide;\n },\n enumerable: false,\n configurable: true\n });\n return TargetSet;\n}();\n\nexport { TargetSet };","import { StringMapObserver } from \"@stimulus/mutation-observers\";\n\nvar ValueObserver =\n/** @class */\nfunction () {\n function ValueObserver(context, receiver) {\n this.context = context;\n this.receiver = receiver;\n this.stringMapObserver = new StringMapObserver(this.element, this);\n this.valueDescriptorMap = this.controller.valueDescriptorMap;\n this.invokeChangedCallbacksForDefaultValues();\n }\n\n ValueObserver.prototype.start = function () {\n this.stringMapObserver.start();\n };\n\n ValueObserver.prototype.stop = function () {\n this.stringMapObserver.stop();\n };\n\n Object.defineProperty(ValueObserver.prototype, \"element\", {\n get: function () {\n return this.context.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ValueObserver.prototype, \"controller\", {\n get: function () {\n return this.context.controller;\n },\n enumerable: false,\n configurable: true\n }); // String map observer delegate\n\n ValueObserver.prototype.getStringMapKeyForAttribute = function (attributeName) {\n if (attributeName in this.valueDescriptorMap) {\n return this.valueDescriptorMap[attributeName].name;\n }\n };\n\n ValueObserver.prototype.stringMapValueChanged = function (attributeValue, name) {\n this.invokeChangedCallbackForValue(name);\n };\n\n ValueObserver.prototype.invokeChangedCallbacksForDefaultValues = function () {\n for (var _i = 0, _a = this.valueDescriptors; _i < _a.length; _i++) {\n var _b = _a[_i],\n key = _b.key,\n name_1 = _b.name,\n defaultValue = _b.defaultValue;\n\n if (defaultValue != undefined && !this.controller.data.has(key)) {\n this.invokeChangedCallbackForValue(name_1);\n }\n }\n };\n\n ValueObserver.prototype.invokeChangedCallbackForValue = function (name) {\n var methodName = name + \"Changed\";\n var method = this.receiver[methodName];\n\n if (typeof method == \"function\") {\n var value = this.receiver[name];\n method.call(this.receiver, value);\n }\n };\n\n Object.defineProperty(ValueObserver.prototype, \"valueDescriptors\", {\n get: function () {\n var valueDescriptorMap = this.valueDescriptorMap;\n return Object.keys(valueDescriptorMap).map(function (key) {\n return valueDescriptorMap[key];\n });\n },\n enumerable: false,\n configurable: true\n });\n return ValueObserver;\n}();\n\nexport { ValueObserver };","import { readInheritableStaticObjectPairs } from \"./inheritable_statics\";\nimport { camelize, capitalize, dasherize } from \"./string_helpers\";\n/** @hidden */\n\nexport function ValuePropertiesBlessing(constructor) {\n var valueDefinitionPairs = readInheritableStaticObjectPairs(constructor, \"values\");\n var propertyDescriptorMap = {\n valueDescriptorMap: {\n get: function () {\n var _this = this;\n\n return valueDefinitionPairs.reduce(function (result, valueDefinitionPair) {\n var _a;\n\n var valueDescriptor = parseValueDefinitionPair(valueDefinitionPair);\n\n var attributeName = _this.data.getAttributeNameForKey(valueDescriptor.key);\n\n return Object.assign(result, (_a = {}, _a[attributeName] = valueDescriptor, _a));\n }, {});\n }\n }\n };\n return valueDefinitionPairs.reduce(function (properties, valueDefinitionPair) {\n return Object.assign(properties, propertiesForValueDefinitionPair(valueDefinitionPair));\n }, propertyDescriptorMap);\n}\n/** @hidden */\n\nexport function propertiesForValueDefinitionPair(valueDefinitionPair) {\n var _a;\n\n var definition = parseValueDefinitionPair(valueDefinitionPair);\n var type = definition.type,\n key = definition.key,\n name = definition.name;\n var read = readers[type],\n write = writers[type] || writers.default;\n return _a = {}, _a[name] = {\n get: function () {\n var value = this.data.get(key);\n\n if (value !== null) {\n return read(value);\n } else {\n return definition.defaultValue;\n }\n },\n set: function (value) {\n if (value === undefined) {\n this.data.delete(key);\n } else {\n this.data.set(key, write(value));\n }\n }\n }, _a[\"has\" + capitalize(name)] = {\n get: function () {\n return this.data.has(key);\n }\n }, _a;\n}\n\nfunction parseValueDefinitionPair(_a) {\n var token = _a[0],\n typeConstant = _a[1];\n var type = parseValueTypeConstant(typeConstant);\n return valueDescriptorForTokenAndType(token, type);\n}\n\nfunction parseValueTypeConstant(typeConstant) {\n switch (typeConstant) {\n case Array:\n return \"array\";\n\n case Boolean:\n return \"boolean\";\n\n case Number:\n return \"number\";\n\n case Object:\n return \"object\";\n\n case String:\n return \"string\";\n }\n\n throw new Error(\"Unknown value type constant \\\"\" + typeConstant + \"\\\"\");\n}\n\nfunction valueDescriptorForTokenAndType(token, type) {\n var key = dasherize(token) + \"-value\";\n return {\n type: type,\n key: key,\n name: camelize(key),\n\n get defaultValue() {\n return defaultValuesByType[type];\n }\n\n };\n}\n\nvar defaultValuesByType = {\n get array() {\n return [];\n },\n\n boolean: false,\n number: 0,\n\n get object() {\n return {};\n },\n\n string: \"\"\n};\nvar readers = {\n array: function (value) {\n var array = JSON.parse(value);\n\n if (!Array.isArray(array)) {\n throw new TypeError(\"Expected array\");\n }\n\n return array;\n },\n boolean: function (value) {\n return !(value == \"0\" || value == \"false\");\n },\n number: function (value) {\n return parseFloat(value);\n },\n object: function (value) {\n var object = JSON.parse(value);\n\n if (object === null || typeof object != \"object\" || Array.isArray(object)) {\n throw new TypeError(\"Expected object\");\n }\n\n return object;\n },\n string: function (value) {\n return value;\n }\n};\nvar writers = {\n default: writeString,\n array: writeJSON,\n object: writeJSON\n};\n\nfunction writeJSON(value) {\n return JSON.stringify(value);\n}\n\nfunction writeString(value) {\n return \"\" + value;\n}","export * from \"./indexed_multimap\";\nexport * from \"./multimap\";\nexport * from \"./set_operations\";","var __extends = this && this.__extends || function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n };\n\n return extendStatics(d, b);\n };\n\n return function (d, b) {\n extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nimport { Multimap } from \"./multimap\";\nimport { add, del } from \"./set_operations\";\n\nvar IndexedMultimap =\n/** @class */\nfunction (_super) {\n __extends(IndexedMultimap, _super);\n\n function IndexedMultimap() {\n var _this = _super.call(this) || this;\n\n _this.keysByValue = new Map();\n return _this;\n }\n\n Object.defineProperty(IndexedMultimap.prototype, \"values\", {\n get: function () {\n return Array.from(this.keysByValue.keys());\n },\n enumerable: false,\n configurable: true\n });\n\n IndexedMultimap.prototype.add = function (key, value) {\n _super.prototype.add.call(this, key, value);\n\n add(this.keysByValue, value, key);\n };\n\n IndexedMultimap.prototype.delete = function (key, value) {\n _super.prototype.delete.call(this, key, value);\n\n del(this.keysByValue, value, key);\n };\n\n IndexedMultimap.prototype.hasValue = function (value) {\n return this.keysByValue.has(value);\n };\n\n IndexedMultimap.prototype.getKeysForValue = function (value) {\n var set = this.keysByValue.get(value);\n return set ? Array.from(set) : [];\n };\n\n return IndexedMultimap;\n}(Multimap);\n\nexport { IndexedMultimap };","import { add, del } from \"./set_operations\";\n\nvar Multimap =\n/** @class */\nfunction () {\n function Multimap() {\n this.valuesByKey = new Map();\n }\n\n Object.defineProperty(Multimap.prototype, \"values\", {\n get: function () {\n var sets = Array.from(this.valuesByKey.values());\n return sets.reduce(function (values, set) {\n return values.concat(Array.from(set));\n }, []);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Multimap.prototype, \"size\", {\n get: function () {\n var sets = Array.from(this.valuesByKey.values());\n return sets.reduce(function (size, set) {\n return size + set.size;\n }, 0);\n },\n enumerable: false,\n configurable: true\n });\n\n Multimap.prototype.add = function (key, value) {\n add(this.valuesByKey, key, value);\n };\n\n Multimap.prototype.delete = function (key, value) {\n del(this.valuesByKey, key, value);\n };\n\n Multimap.prototype.has = function (key, value) {\n var values = this.valuesByKey.get(key);\n return values != null && values.has(value);\n };\n\n Multimap.prototype.hasKey = function (key) {\n return this.valuesByKey.has(key);\n };\n\n Multimap.prototype.hasValue = function (value) {\n var sets = Array.from(this.valuesByKey.values());\n return sets.some(function (set) {\n return set.has(value);\n });\n };\n\n Multimap.prototype.getValuesForKey = function (key) {\n var values = this.valuesByKey.get(key);\n return values ? Array.from(values) : [];\n };\n\n Multimap.prototype.getKeysForValue = function (value) {\n return Array.from(this.valuesByKey).filter(function (_a) {\n var key = _a[0],\n values = _a[1];\n return values.has(value);\n }).map(function (_a) {\n var key = _a[0],\n values = _a[1];\n return key;\n });\n };\n\n return Multimap;\n}();\n\nexport { Multimap };","export function add(map, key, value) {\n fetch(map, key).add(value);\n}\nexport function del(map, key, value) {\n fetch(map, key).delete(value);\n prune(map, key);\n}\nexport function fetch(map, key) {\n var values = map.get(key);\n\n if (!values) {\n values = new Set();\n map.set(key, values);\n }\n\n return values;\n}\nexport function prune(map, key) {\n var values = map.get(key);\n\n if (values != null && values.size == 0) {\n map.delete(key);\n }\n}","import { ElementObserver } from \"./element_observer\";\n\nvar AttributeObserver =\n/** @class */\nfunction () {\n function AttributeObserver(element, attributeName, delegate) {\n this.attributeName = attributeName;\n this.delegate = delegate;\n this.elementObserver = new ElementObserver(element, this);\n }\n\n Object.defineProperty(AttributeObserver.prototype, \"element\", {\n get: function () {\n return this.elementObserver.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(AttributeObserver.prototype, \"selector\", {\n get: function () {\n return \"[\" + this.attributeName + \"]\";\n },\n enumerable: false,\n configurable: true\n });\n\n AttributeObserver.prototype.start = function () {\n this.elementObserver.start();\n };\n\n AttributeObserver.prototype.stop = function () {\n this.elementObserver.stop();\n };\n\n AttributeObserver.prototype.refresh = function () {\n this.elementObserver.refresh();\n };\n\n Object.defineProperty(AttributeObserver.prototype, \"started\", {\n get: function () {\n return this.elementObserver.started;\n },\n enumerable: false,\n configurable: true\n }); // Element observer delegate\n\n AttributeObserver.prototype.matchElement = function (element) {\n return element.hasAttribute(this.attributeName);\n };\n\n AttributeObserver.prototype.matchElementsInTree = function (tree) {\n var match = this.matchElement(tree) ? [tree] : [];\n var matches = Array.from(tree.querySelectorAll(this.selector));\n return match.concat(matches);\n };\n\n AttributeObserver.prototype.elementMatched = function (element) {\n if (this.delegate.elementMatchedAttribute) {\n this.delegate.elementMatchedAttribute(element, this.attributeName);\n }\n };\n\n AttributeObserver.prototype.elementUnmatched = function (element) {\n if (this.delegate.elementUnmatchedAttribute) {\n this.delegate.elementUnmatchedAttribute(element, this.attributeName);\n }\n };\n\n AttributeObserver.prototype.elementAttributeChanged = function (element, attributeName) {\n if (this.delegate.elementAttributeValueChanged && this.attributeName == attributeName) {\n this.delegate.elementAttributeValueChanged(element, attributeName);\n }\n };\n\n return AttributeObserver;\n}();\n\nexport { AttributeObserver };","var ElementObserver =\n/** @class */\nfunction () {\n function ElementObserver(element, delegate) {\n var _this = this;\n\n this.element = element;\n this.started = false;\n this.delegate = delegate;\n this.elements = new Set();\n this.mutationObserver = new MutationObserver(function (mutations) {\n return _this.processMutations(mutations);\n });\n }\n\n ElementObserver.prototype.start = function () {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, {\n attributes: true,\n childList: true,\n subtree: true\n });\n this.refresh();\n }\n };\n\n ElementObserver.prototype.stop = function () {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n };\n\n ElementObserver.prototype.refresh = function () {\n if (this.started) {\n var matches = new Set(this.matchElementsInTree());\n\n for (var _i = 0, _a = Array.from(this.elements); _i < _a.length; _i++) {\n var element = _a[_i];\n\n if (!matches.has(element)) {\n this.removeElement(element);\n }\n }\n\n for (var _b = 0, _c = Array.from(matches); _b < _c.length; _b++) {\n var element = _c[_b];\n this.addElement(element);\n }\n }\n }; // Mutation record processing\n\n\n ElementObserver.prototype.processMutations = function (mutations) {\n if (this.started) {\n for (var _i = 0, mutations_1 = mutations; _i < mutations_1.length; _i++) {\n var mutation = mutations_1[_i];\n this.processMutation(mutation);\n }\n }\n };\n\n ElementObserver.prototype.processMutation = function (mutation) {\n if (mutation.type == \"attributes\") {\n this.processAttributeChange(mutation.target, mutation.attributeName);\n } else if (mutation.type == \"childList\") {\n this.processRemovedNodes(mutation.removedNodes);\n this.processAddedNodes(mutation.addedNodes);\n }\n };\n\n ElementObserver.prototype.processAttributeChange = function (node, attributeName) {\n var element = node;\n\n if (this.elements.has(element)) {\n if (this.delegate.elementAttributeChanged && this.matchElement(element)) {\n this.delegate.elementAttributeChanged(element, attributeName);\n } else {\n this.removeElement(element);\n }\n } else if (this.matchElement(element)) {\n this.addElement(element);\n }\n };\n\n ElementObserver.prototype.processRemovedNodes = function (nodes) {\n for (var _i = 0, _a = Array.from(nodes); _i < _a.length; _i++) {\n var node = _a[_i];\n var element = this.elementFromNode(node);\n\n if (element) {\n this.processTree(element, this.removeElement);\n }\n }\n };\n\n ElementObserver.prototype.processAddedNodes = function (nodes) {\n for (var _i = 0, _a = Array.from(nodes); _i < _a.length; _i++) {\n var node = _a[_i];\n var element = this.elementFromNode(node);\n\n if (element && this.elementIsActive(element)) {\n this.processTree(element, this.addElement);\n }\n }\n }; // Element matching\n\n\n ElementObserver.prototype.matchElement = function (element) {\n return this.delegate.matchElement(element);\n };\n\n ElementObserver.prototype.matchElementsInTree = function (tree) {\n if (tree === void 0) {\n tree = this.element;\n }\n\n return this.delegate.matchElementsInTree(tree);\n };\n\n ElementObserver.prototype.processTree = function (tree, processor) {\n for (var _i = 0, _a = this.matchElementsInTree(tree); _i < _a.length; _i++) {\n var element = _a[_i];\n processor.call(this, element);\n }\n };\n\n ElementObserver.prototype.elementFromNode = function (node) {\n if (node.nodeType == Node.ELEMENT_NODE) {\n return node;\n }\n };\n\n ElementObserver.prototype.elementIsActive = function (element) {\n if (element.isConnected != this.element.isConnected) {\n return false;\n } else {\n return this.element.contains(element);\n }\n }; // Element tracking\n\n\n ElementObserver.prototype.addElement = function (element) {\n if (!this.elements.has(element)) {\n if (this.elementIsActive(element)) {\n this.elements.add(element);\n\n if (this.delegate.elementMatched) {\n this.delegate.elementMatched(element);\n }\n }\n }\n };\n\n ElementObserver.prototype.removeElement = function (element) {\n if (this.elements.has(element)) {\n this.elements.delete(element);\n\n if (this.delegate.elementUnmatched) {\n this.delegate.elementUnmatched(element);\n }\n }\n };\n\n return ElementObserver;\n}();\n\nexport { ElementObserver };","export * from \"./attribute_observer\";\nexport * from \"./element_observer\";\nexport * from \"./string_map_observer\";\nexport * from \"./token_list_observer\";\nexport * from \"./value_list_observer\";","var StringMapObserver =\n/** @class */\nfunction () {\n function StringMapObserver(element, delegate) {\n var _this = this;\n\n this.element = element;\n this.delegate = delegate;\n this.started = false;\n this.stringMap = new Map();\n this.mutationObserver = new MutationObserver(function (mutations) {\n return _this.processMutations(mutations);\n });\n }\n\n StringMapObserver.prototype.start = function () {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, {\n attributes: true\n });\n this.refresh();\n }\n };\n\n StringMapObserver.prototype.stop = function () {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n };\n\n StringMapObserver.prototype.refresh = function () {\n if (this.started) {\n for (var _i = 0, _a = this.knownAttributeNames; _i < _a.length; _i++) {\n var attributeName = _a[_i];\n this.refreshAttribute(attributeName);\n }\n }\n }; // Mutation record processing\n\n\n StringMapObserver.prototype.processMutations = function (mutations) {\n if (this.started) {\n for (var _i = 0, mutations_1 = mutations; _i < mutations_1.length; _i++) {\n var mutation = mutations_1[_i];\n this.processMutation(mutation);\n }\n }\n };\n\n StringMapObserver.prototype.processMutation = function (mutation) {\n var attributeName = mutation.attributeName;\n\n if (attributeName) {\n this.refreshAttribute(attributeName);\n }\n }; // State tracking\n\n\n StringMapObserver.prototype.refreshAttribute = function (attributeName) {\n var key = this.delegate.getStringMapKeyForAttribute(attributeName);\n\n if (key != null) {\n if (!this.stringMap.has(attributeName)) {\n this.stringMapKeyAdded(key, attributeName);\n }\n\n var value = this.element.getAttribute(attributeName);\n\n if (this.stringMap.get(attributeName) != value) {\n this.stringMapValueChanged(value, key);\n }\n\n if (value == null) {\n this.stringMap.delete(attributeName);\n this.stringMapKeyRemoved(key, attributeName);\n } else {\n this.stringMap.set(attributeName, value);\n }\n }\n };\n\n StringMapObserver.prototype.stringMapKeyAdded = function (key, attributeName) {\n if (this.delegate.stringMapKeyAdded) {\n this.delegate.stringMapKeyAdded(key, attributeName);\n }\n };\n\n StringMapObserver.prototype.stringMapValueChanged = function (value, key) {\n if (this.delegate.stringMapValueChanged) {\n this.delegate.stringMapValueChanged(value, key);\n }\n };\n\n StringMapObserver.prototype.stringMapKeyRemoved = function (key, attributeName) {\n if (this.delegate.stringMapKeyRemoved) {\n this.delegate.stringMapKeyRemoved(key, attributeName);\n }\n };\n\n Object.defineProperty(StringMapObserver.prototype, \"knownAttributeNames\", {\n get: function () {\n return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)));\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StringMapObserver.prototype, \"currentAttributeNames\", {\n get: function () {\n return Array.from(this.element.attributes).map(function (attribute) {\n return attribute.name;\n });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StringMapObserver.prototype, \"recordedAttributeNames\", {\n get: function () {\n return Array.from(this.stringMap.keys());\n },\n enumerable: false,\n configurable: true\n });\n return StringMapObserver;\n}();\n\nexport { StringMapObserver };","import { AttributeObserver } from \"./attribute_observer\";\nimport { Multimap } from \"@stimulus/multimap\";\n\nvar TokenListObserver =\n/** @class */\nfunction () {\n function TokenListObserver(element, attributeName, delegate) {\n this.attributeObserver = new AttributeObserver(element, attributeName, this);\n this.delegate = delegate;\n this.tokensByElement = new Multimap();\n }\n\n Object.defineProperty(TokenListObserver.prototype, \"started\", {\n get: function () {\n return this.attributeObserver.started;\n },\n enumerable: false,\n configurable: true\n });\n\n TokenListObserver.prototype.start = function () {\n this.attributeObserver.start();\n };\n\n TokenListObserver.prototype.stop = function () {\n this.attributeObserver.stop();\n };\n\n TokenListObserver.prototype.refresh = function () {\n this.attributeObserver.refresh();\n };\n\n Object.defineProperty(TokenListObserver.prototype, \"element\", {\n get: function () {\n return this.attributeObserver.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TokenListObserver.prototype, \"attributeName\", {\n get: function () {\n return this.attributeObserver.attributeName;\n },\n enumerable: false,\n configurable: true\n }); // Attribute observer delegate\n\n TokenListObserver.prototype.elementMatchedAttribute = function (element) {\n this.tokensMatched(this.readTokensForElement(element));\n };\n\n TokenListObserver.prototype.elementAttributeValueChanged = function (element) {\n var _a = this.refreshTokensForElement(element),\n unmatchedTokens = _a[0],\n matchedTokens = _a[1];\n\n this.tokensUnmatched(unmatchedTokens);\n this.tokensMatched(matchedTokens);\n };\n\n TokenListObserver.prototype.elementUnmatchedAttribute = function (element) {\n this.tokensUnmatched(this.tokensByElement.getValuesForKey(element));\n };\n\n TokenListObserver.prototype.tokensMatched = function (tokens) {\n var _this = this;\n\n tokens.forEach(function (token) {\n return _this.tokenMatched(token);\n });\n };\n\n TokenListObserver.prototype.tokensUnmatched = function (tokens) {\n var _this = this;\n\n tokens.forEach(function (token) {\n return _this.tokenUnmatched(token);\n });\n };\n\n TokenListObserver.prototype.tokenMatched = function (token) {\n this.delegate.tokenMatched(token);\n this.tokensByElement.add(token.element, token);\n };\n\n TokenListObserver.prototype.tokenUnmatched = function (token) {\n this.delegate.tokenUnmatched(token);\n this.tokensByElement.delete(token.element, token);\n };\n\n TokenListObserver.prototype.refreshTokensForElement = function (element) {\n var previousTokens = this.tokensByElement.getValuesForKey(element);\n var currentTokens = this.readTokensForElement(element);\n var firstDifferingIndex = zip(previousTokens, currentTokens).findIndex(function (_a) {\n var previousToken = _a[0],\n currentToken = _a[1];\n return !tokensAreEqual(previousToken, currentToken);\n });\n\n if (firstDifferingIndex == -1) {\n return [[], []];\n } else {\n return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)];\n }\n };\n\n TokenListObserver.prototype.readTokensForElement = function (element) {\n var attributeName = this.attributeName;\n var tokenString = element.getAttribute(attributeName) || \"\";\n return parseTokenString(tokenString, element, attributeName);\n };\n\n return TokenListObserver;\n}();\n\nexport { TokenListObserver };\n\nfunction parseTokenString(tokenString, element, attributeName) {\n return tokenString.trim().split(/\\s+/).filter(function (content) {\n return content.length;\n }).map(function (content, index) {\n return {\n element: element,\n attributeName: attributeName,\n content: content,\n index: index\n };\n });\n}\n\nfunction zip(left, right) {\n var length = Math.max(left.length, right.length);\n return Array.from({\n length: length\n }, function (_, index) {\n return [left[index], right[index]];\n });\n}\n\nfunction tokensAreEqual(left, right) {\n return left && right && left.index == right.index && left.content == right.content;\n}","import { TokenListObserver } from \"./token_list_observer\";\n\nvar ValueListObserver =\n/** @class */\nfunction () {\n function ValueListObserver(element, attributeName, delegate) {\n this.tokenListObserver = new TokenListObserver(element, attributeName, this);\n this.delegate = delegate;\n this.parseResultsByToken = new WeakMap();\n this.valuesByTokenByElement = new WeakMap();\n }\n\n Object.defineProperty(ValueListObserver.prototype, \"started\", {\n get: function () {\n return this.tokenListObserver.started;\n },\n enumerable: false,\n configurable: true\n });\n\n ValueListObserver.prototype.start = function () {\n this.tokenListObserver.start();\n };\n\n ValueListObserver.prototype.stop = function () {\n this.tokenListObserver.stop();\n };\n\n ValueListObserver.prototype.refresh = function () {\n this.tokenListObserver.refresh();\n };\n\n Object.defineProperty(ValueListObserver.prototype, \"element\", {\n get: function () {\n return this.tokenListObserver.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ValueListObserver.prototype, \"attributeName\", {\n get: function () {\n return this.tokenListObserver.attributeName;\n },\n enumerable: false,\n configurable: true\n });\n\n ValueListObserver.prototype.tokenMatched = function (token) {\n var element = token.element;\n var value = this.fetchParseResultForToken(token).value;\n\n if (value) {\n this.fetchValuesByTokenForElement(element).set(token, value);\n this.delegate.elementMatchedValue(element, value);\n }\n };\n\n ValueListObserver.prototype.tokenUnmatched = function (token) {\n var element = token.element;\n var value = this.fetchParseResultForToken(token).value;\n\n if (value) {\n this.fetchValuesByTokenForElement(element).delete(token);\n this.delegate.elementUnmatchedValue(element, value);\n }\n };\n\n ValueListObserver.prototype.fetchParseResultForToken = function (token) {\n var parseResult = this.parseResultsByToken.get(token);\n\n if (!parseResult) {\n parseResult = this.parseToken(token);\n this.parseResultsByToken.set(token, parseResult);\n }\n\n return parseResult;\n };\n\n ValueListObserver.prototype.fetchValuesByTokenForElement = function (element) {\n var valuesByToken = this.valuesByTokenByElement.get(element);\n\n if (!valuesByToken) {\n valuesByToken = new Map();\n this.valuesByTokenByElement.set(element, valuesByToken);\n }\n\n return valuesByToken;\n };\n\n ValueListObserver.prototype.parseToken = function (token) {\n try {\n var value = this.delegate.parseValueForToken(token);\n return {\n value: value\n };\n } catch (error) {\n return {\n error: error\n };\n }\n };\n\n return ValueListObserver;\n}();\n\nexport { ValueListObserver };","\"use strict\";\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\n\nmodule.exports = function (useSourceMap) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = cssWithMappingToString(item, useSourceMap);\n\n if (item[2]) {\n return \"@media \".concat(item[2], \" {\").concat(content, \"}\");\n }\n\n return content;\n }).join('');\n }; // import a list of modules into the list\n // eslint-disable-next-line func-names\n\n\n list.i = function (modules, mediaQuery, dedupe) {\n if (typeof modules === 'string') {\n // eslint-disable-next-line no-param-reassign\n modules = [[null, modules, '']];\n }\n\n var alreadyImportedModules = {};\n\n if (dedupe) {\n for (var i = 0; i < this.length; i++) {\n // eslint-disable-next-line prefer-destructuring\n var id = this[i][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n\n for (var _i = 0; _i < modules.length; _i++) {\n var item = [].concat(modules[_i]);\n\n if (dedupe && alreadyImportedModules[item[0]]) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (mediaQuery) {\n if (!item[2]) {\n item[2] = mediaQuery;\n } else {\n item[2] = \"\".concat(mediaQuery, \" and \").concat(item[2]);\n }\n }\n\n list.push(item);\n }\n };\n\n return list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n var content = item[1] || ''; // eslint-disable-next-line prefer-destructuring\n\n var cssMapping = item[3];\n\n if (!cssMapping) {\n return content;\n }\n\n if (useSourceMap && typeof btoa === 'function') {\n var sourceMapping = toComment(cssMapping);\n var sourceURLs = cssMapping.sources.map(function (source) {\n return \"/*# sourceURL=\".concat(cssMapping.sourceRoot || '').concat(source, \" */\");\n });\n return [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n }\n\n return [content].join('\\n');\n} // Adapted from convert-source-map (MIT)\n\n\nfunction toComment(sourceMap) {\n // eslint-disable-next-line no-undef\n var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n var data = \"sourceMappingURL=data:application/json;charset=utf-8;base64,\".concat(base64);\n return \"/*# \".concat(data, \" */\");\n}","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nvar __spreadArrays = this && this.__spreadArrays || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];\n\n return r;\n};\n\nimport { defaults as defaultOptions, HOOKS } from \"./types/options\";\nimport English from \"./l10n/default\";\nimport { arrayify, debounce, int, pad } from \"./utils\";\nimport { clearNode, createElement, createNumberInput, findParent, toggleClass, getEventTarget } from \"./utils/dom\";\nimport { compareDates, createDateParser, createDateFormatter, duration, isBetween, getDefaultHours, calculateSecondsSinceMidnight, parseSeconds } from \"./utils/dates\";\nimport { tokenRegex, monthToStr } from \"./utils/formatting\";\nimport \"./utils/polyfills\";\nvar DEBOUNCED_CHANGE_MS = 300;\n\nfunction FlatpickrInstance(element, instanceConfig) {\n var self = {\n config: __assign(__assign({}, defaultOptions), flatpickr.defaultConfig),\n l10n: English\n };\n self.parseDate = createDateParser({\n config: self.config,\n l10n: self.l10n\n });\n self._handlers = [];\n self.pluginElements = [];\n self.loadedPlugins = [];\n self._bind = bind;\n self._setHoursFromDate = setHoursFromDate;\n self._positionCalendar = positionCalendar;\n self.changeMonth = changeMonth;\n self.changeYear = changeYear;\n self.clear = clear;\n self.close = close;\n self.onMouseOver = onMouseOver;\n self._createElement = createElement;\n self.createDay = createDay;\n self.destroy = destroy;\n self.isEnabled = isEnabled;\n self.jumpToDate = jumpToDate;\n self.updateValue = updateValue;\n self.open = open;\n self.redraw = redraw;\n self.set = set;\n self.setDate = setDate;\n self.toggle = toggle;\n\n function setupHelperFunctions() {\n self.utils = {\n getDaysInMonth: function (month, yr) {\n if (month === void 0) {\n month = self.currentMonth;\n }\n\n if (yr === void 0) {\n yr = self.currentYear;\n }\n\n if (month === 1 && (yr % 4 === 0 && yr % 100 !== 0 || yr % 400 === 0)) return 29;\n return self.l10n.daysInMonth[month];\n }\n };\n }\n\n function init() {\n self.element = self.input = element;\n self.isOpen = false;\n parseConfig();\n setupLocale();\n setupInputs();\n setupDates();\n setupHelperFunctions();\n if (!self.isMobile) build();\n bindEvents();\n\n if (self.selectedDates.length || self.config.noCalendar) {\n if (self.config.enableTime) {\n setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj : undefined);\n }\n\n updateValue(false);\n }\n\n setCalendarWidth();\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n\n if (!self.isMobile && isSafari) {\n positionCalendar();\n }\n\n triggerEvent(\"onReady\");\n }\n\n function getClosestActiveElement() {\n var _a;\n\n return ((_a = self.calendarContainer) === null || _a === void 0 ? void 0 : _a.getRootNode()).activeElement || document.activeElement;\n }\n\n function bindToInstance(fn) {\n return fn.bind(self);\n }\n\n function setCalendarWidth() {\n var config = self.config;\n\n if (config.weekNumbers === false && config.showMonths === 1) {\n return;\n } else if (config.noCalendar !== true) {\n window.requestAnimationFrame(function () {\n if (self.calendarContainer !== undefined) {\n self.calendarContainer.style.visibility = \"hidden\";\n self.calendarContainer.style.display = \"block\";\n }\n\n if (self.daysContainer !== undefined) {\n var daysWidth = (self.days.offsetWidth + 1) * config.showMonths;\n self.daysContainer.style.width = daysWidth + \"px\";\n self.calendarContainer.style.width = daysWidth + (self.weekWrapper !== undefined ? self.weekWrapper.offsetWidth : 0) + \"px\";\n self.calendarContainer.style.removeProperty(\"visibility\");\n self.calendarContainer.style.removeProperty(\"display\");\n }\n });\n }\n }\n\n function updateTime(e) {\n if (self.selectedDates.length === 0) {\n var defaultDate = self.config.minDate === undefined || compareDates(new Date(), self.config.minDate) >= 0 ? new Date() : new Date(self.config.minDate.getTime());\n var defaults = getDefaultHours(self.config);\n defaultDate.setHours(defaults.hours, defaults.minutes, defaults.seconds, defaultDate.getMilliseconds());\n self.selectedDates = [defaultDate];\n self.latestSelectedDateObj = defaultDate;\n }\n\n if (e !== undefined && e.type !== \"blur\") {\n timeWrapper(e);\n }\n\n var prevValue = self._input.value;\n setHoursFromInputs();\n updateValue();\n\n if (self._input.value !== prevValue) {\n self._debouncedChange();\n }\n }\n\n function ampm2military(hour, amPM) {\n return hour % 12 + 12 * int(amPM === self.l10n.amPM[1]);\n }\n\n function military2ampm(hour) {\n switch (hour % 24) {\n case 0:\n case 12:\n return 12;\n\n default:\n return hour % 12;\n }\n }\n\n function setHoursFromInputs() {\n if (self.hourElement === undefined || self.minuteElement === undefined) return;\n var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24,\n minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60,\n seconds = self.secondElement !== undefined ? (parseInt(self.secondElement.value, 10) || 0) % 60 : 0;\n\n if (self.amPM !== undefined) {\n hours = ampm2military(hours, self.amPM.textContent);\n }\n\n var limitMinHours = self.config.minTime !== undefined || self.config.minDate && self.minDateHasTime && self.latestSelectedDateObj && compareDates(self.latestSelectedDateObj, self.config.minDate, true) === 0;\n var limitMaxHours = self.config.maxTime !== undefined || self.config.maxDate && self.maxDateHasTime && self.latestSelectedDateObj && compareDates(self.latestSelectedDateObj, self.config.maxDate, true) === 0;\n\n if (self.config.maxTime !== undefined && self.config.minTime !== undefined && self.config.minTime > self.config.maxTime) {\n var minBound = calculateSecondsSinceMidnight(self.config.minTime.getHours(), self.config.minTime.getMinutes(), self.config.minTime.getSeconds());\n var maxBound = calculateSecondsSinceMidnight(self.config.maxTime.getHours(), self.config.maxTime.getMinutes(), self.config.maxTime.getSeconds());\n var currentTime = calculateSecondsSinceMidnight(hours, minutes, seconds);\n\n if (currentTime > maxBound && currentTime < minBound) {\n var result = parseSeconds(minBound);\n hours = result[0];\n minutes = result[1];\n seconds = result[2];\n }\n } else {\n if (limitMaxHours) {\n var maxTime = self.config.maxTime !== undefined ? self.config.maxTime : self.config.maxDate;\n hours = Math.min(hours, maxTime.getHours());\n if (hours === maxTime.getHours()) minutes = Math.min(minutes, maxTime.getMinutes());\n if (minutes === maxTime.getMinutes()) seconds = Math.min(seconds, maxTime.getSeconds());\n }\n\n if (limitMinHours) {\n var minTime = self.config.minTime !== undefined ? self.config.minTime : self.config.minDate;\n hours = Math.max(hours, minTime.getHours());\n if (hours === minTime.getHours() && minutes < minTime.getMinutes()) minutes = minTime.getMinutes();\n if (minutes === minTime.getMinutes()) seconds = Math.max(seconds, minTime.getSeconds());\n }\n }\n\n setHours(hours, minutes, seconds);\n }\n\n function setHoursFromDate(dateObj) {\n var date = dateObj || self.latestSelectedDateObj;\n\n if (date && date instanceof Date) {\n setHours(date.getHours(), date.getMinutes(), date.getSeconds());\n }\n }\n\n function setHours(hours, minutes, seconds) {\n if (self.latestSelectedDateObj !== undefined) {\n self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0);\n }\n\n if (!self.hourElement || !self.minuteElement || self.isMobile) return;\n self.hourElement.value = pad(!self.config.time_24hr ? (12 + hours) % 12 + 12 * int(hours % 12 === 0) : hours);\n self.minuteElement.value = pad(minutes);\n if (self.amPM !== undefined) self.amPM.textContent = self.l10n.amPM[int(hours >= 12)];\n if (self.secondElement !== undefined) self.secondElement.value = pad(seconds);\n }\n\n function onYearInput(event) {\n var eventTarget = getEventTarget(event);\n var year = parseInt(eventTarget.value) + (event.delta || 0);\n\n if (year / 1000 > 1 || event.key === \"Enter\" && !/[^\\d]/.test(year.toString())) {\n changeYear(year);\n }\n }\n\n function bind(element, event, handler, options) {\n if (event instanceof Array) return event.forEach(function (ev) {\n return bind(element, ev, handler, options);\n });\n if (element instanceof Array) return element.forEach(function (el) {\n return bind(el, event, handler, options);\n });\n element.addEventListener(event, handler, options);\n\n self._handlers.push({\n remove: function () {\n return element.removeEventListener(event, handler, options);\n }\n });\n }\n\n function triggerChange() {\n triggerEvent(\"onChange\");\n }\n\n function bindEvents() {\n if (self.config.wrap) {\n [\"open\", \"close\", \"toggle\", \"clear\"].forEach(function (evt) {\n Array.prototype.forEach.call(self.element.querySelectorAll(\"[data-\" + evt + \"]\"), function (el) {\n return bind(el, \"click\", self[evt]);\n });\n });\n }\n\n if (self.isMobile) {\n setupMobile();\n return;\n }\n\n var debouncedResize = debounce(onResize, 50);\n self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS);\n if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent)) bind(self.daysContainer, \"mouseover\", function (e) {\n if (self.config.mode === \"range\") onMouseOver(getEventTarget(e));\n });\n bind(self._input, \"keydown\", onKeyDown);\n\n if (self.calendarContainer !== undefined) {\n bind(self.calendarContainer, \"keydown\", onKeyDown);\n }\n\n if (!self.config.inline && !self.config.static) bind(window, \"resize\", debouncedResize);\n if (window.ontouchstart !== undefined) bind(window.document, \"touchstart\", documentClick);else bind(window.document, \"mousedown\", documentClick);\n bind(window.document, \"focus\", documentClick, {\n capture: true\n });\n\n if (self.config.clickOpens === true) {\n bind(self._input, \"focus\", self.open);\n bind(self._input, \"click\", self.open);\n }\n\n if (self.daysContainer !== undefined) {\n bind(self.monthNav, \"click\", onMonthNavClick);\n bind(self.monthNav, [\"keyup\", \"increment\"], onYearInput);\n bind(self.daysContainer, \"click\", selectDate);\n }\n\n if (self.timeContainer !== undefined && self.minuteElement !== undefined && self.hourElement !== undefined) {\n var selText = function (e) {\n return getEventTarget(e).select();\n };\n\n bind(self.timeContainer, [\"increment\"], updateTime);\n bind(self.timeContainer, \"blur\", updateTime, {\n capture: true\n });\n bind(self.timeContainer, \"click\", timeIncrement);\n bind([self.hourElement, self.minuteElement], [\"focus\", \"click\"], selText);\n if (self.secondElement !== undefined) bind(self.secondElement, \"focus\", function () {\n return self.secondElement && self.secondElement.select();\n });\n\n if (self.amPM !== undefined) {\n bind(self.amPM, \"click\", function (e) {\n updateTime(e);\n });\n }\n }\n\n if (self.config.allowInput) {\n bind(self._input, \"blur\", onBlur);\n }\n }\n\n function jumpToDate(jumpDate, triggerChange) {\n var jumpTo = jumpDate !== undefined ? self.parseDate(jumpDate) : self.latestSelectedDateObj || (self.config.minDate && self.config.minDate > self.now ? self.config.minDate : self.config.maxDate && self.config.maxDate < self.now ? self.config.maxDate : self.now);\n var oldYear = self.currentYear;\n var oldMonth = self.currentMonth;\n\n try {\n if (jumpTo !== undefined) {\n self.currentYear = jumpTo.getFullYear();\n self.currentMonth = jumpTo.getMonth();\n }\n } catch (e) {\n e.message = \"Invalid date supplied: \" + jumpTo;\n self.config.errorHandler(e);\n }\n\n if (triggerChange && self.currentYear !== oldYear) {\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n\n if (triggerChange && (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {\n triggerEvent(\"onMonthChange\");\n }\n\n self.redraw();\n }\n\n function timeIncrement(e) {\n var eventTarget = getEventTarget(e);\n if (~eventTarget.className.indexOf(\"arrow\")) incrementNumInput(e, eventTarget.classList.contains(\"arrowUp\") ? 1 : -1);\n }\n\n function incrementNumInput(e, delta, inputElem) {\n var target = e && getEventTarget(e);\n var input = inputElem || target && target.parentNode && target.parentNode.firstChild;\n var event = createEvent(\"increment\");\n event.delta = delta;\n input && input.dispatchEvent(event);\n }\n\n function build() {\n var fragment = window.document.createDocumentFragment();\n self.calendarContainer = createElement(\"div\", \"flatpickr-calendar\");\n self.calendarContainer.tabIndex = -1;\n\n if (!self.config.noCalendar) {\n fragment.appendChild(buildMonthNav());\n self.innerContainer = createElement(\"div\", \"flatpickr-innerContainer\");\n\n if (self.config.weekNumbers) {\n var _a = buildWeeks(),\n weekWrapper = _a.weekWrapper,\n weekNumbers = _a.weekNumbers;\n\n self.innerContainer.appendChild(weekWrapper);\n self.weekNumbers = weekNumbers;\n self.weekWrapper = weekWrapper;\n }\n\n self.rContainer = createElement(\"div\", \"flatpickr-rContainer\");\n self.rContainer.appendChild(buildWeekdays());\n\n if (!self.daysContainer) {\n self.daysContainer = createElement(\"div\", \"flatpickr-days\");\n self.daysContainer.tabIndex = -1;\n }\n\n buildDays();\n self.rContainer.appendChild(self.daysContainer);\n self.innerContainer.appendChild(self.rContainer);\n fragment.appendChild(self.innerContainer);\n }\n\n if (self.config.enableTime) {\n fragment.appendChild(buildTime());\n }\n\n toggleClass(self.calendarContainer, \"rangeMode\", self.config.mode === \"range\");\n toggleClass(self.calendarContainer, \"animate\", self.config.animate === true);\n toggleClass(self.calendarContainer, \"multiMonth\", self.config.showMonths > 1);\n self.calendarContainer.appendChild(fragment);\n var customAppend = self.config.appendTo !== undefined && self.config.appendTo.nodeType !== undefined;\n\n if (self.config.inline || self.config.static) {\n self.calendarContainer.classList.add(self.config.inline ? \"inline\" : \"static\");\n\n if (self.config.inline) {\n if (!customAppend && self.element.parentNode) self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);else if (self.config.appendTo !== undefined) self.config.appendTo.appendChild(self.calendarContainer);\n }\n\n if (self.config.static) {\n var wrapper = createElement(\"div\", \"flatpickr-wrapper\");\n if (self.element.parentNode) self.element.parentNode.insertBefore(wrapper, self.element);\n wrapper.appendChild(self.element);\n if (self.altInput) wrapper.appendChild(self.altInput);\n wrapper.appendChild(self.calendarContainer);\n }\n }\n\n if (!self.config.static && !self.config.inline) (self.config.appendTo !== undefined ? self.config.appendTo : window.document.body).appendChild(self.calendarContainer);\n }\n\n function createDay(className, date, _dayNumber, i) {\n var dateIsEnabled = isEnabled(date, true),\n dayElement = createElement(\"span\", className, date.getDate().toString());\n dayElement.dateObj = date;\n dayElement.$i = i;\n dayElement.setAttribute(\"aria-label\", self.formatDate(date, self.config.ariaDateFormat));\n\n if (className.indexOf(\"hidden\") === -1 && compareDates(date, self.now) === 0) {\n self.todayDateElem = dayElement;\n dayElement.classList.add(\"today\");\n dayElement.setAttribute(\"aria-current\", \"date\");\n }\n\n if (dateIsEnabled) {\n dayElement.tabIndex = -1;\n\n if (isDateSelected(date)) {\n dayElement.classList.add(\"selected\");\n self.selectedDateElem = dayElement;\n\n if (self.config.mode === \"range\") {\n toggleClass(dayElement, \"startRange\", self.selectedDates[0] && compareDates(date, self.selectedDates[0], true) === 0);\n toggleClass(dayElement, \"endRange\", self.selectedDates[1] && compareDates(date, self.selectedDates[1], true) === 0);\n if (className === \"nextMonthDay\") dayElement.classList.add(\"inRange\");\n }\n }\n } else {\n dayElement.classList.add(\"flatpickr-disabled\");\n }\n\n if (self.config.mode === \"range\") {\n if (isDateInRange(date) && !isDateSelected(date)) dayElement.classList.add(\"inRange\");\n }\n\n if (self.weekNumbers && self.config.showMonths === 1 && className !== \"prevMonthDay\" && i % 7 === 6) {\n self.weekNumbers.insertAdjacentHTML(\"beforeend\", \"\" + self.config.getWeek(date) + \"\");\n }\n\n triggerEvent(\"onDayCreate\", dayElement);\n return dayElement;\n }\n\n function focusOnDayElem(targetNode) {\n targetNode.focus();\n if (self.config.mode === \"range\") onMouseOver(targetNode);\n }\n\n function getFirstAvailableDay(delta) {\n var startMonth = delta > 0 ? 0 : self.config.showMonths - 1;\n var endMonth = delta > 0 ? self.config.showMonths : -1;\n\n for (var m = startMonth; m != endMonth; m += delta) {\n var month = self.daysContainer.children[m];\n var startIndex = delta > 0 ? 0 : month.children.length - 1;\n var endIndex = delta > 0 ? month.children.length : -1;\n\n for (var i = startIndex; i != endIndex; i += delta) {\n var c = month.children[i];\n if (c.className.indexOf(\"hidden\") === -1 && isEnabled(c.dateObj)) return c;\n }\n }\n\n return undefined;\n }\n\n function getNextAvailableDay(current, delta) {\n var givenMonth = current.className.indexOf(\"Month\") === -1 ? current.dateObj.getMonth() : self.currentMonth;\n var endMonth = delta > 0 ? self.config.showMonths : -1;\n var loopDelta = delta > 0 ? 1 : -1;\n\n for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) {\n var month = self.daysContainer.children[m];\n var startIndex = givenMonth - self.currentMonth === m ? current.$i + delta : delta < 0 ? month.children.length - 1 : 0;\n var numMonthDays = month.children.length;\n\n for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) {\n var c = month.children[i];\n if (c.className.indexOf(\"hidden\") === -1 && isEnabled(c.dateObj) && Math.abs(current.$i - i) >= Math.abs(delta)) return focusOnDayElem(c);\n }\n }\n\n self.changeMonth(loopDelta);\n focusOnDay(getFirstAvailableDay(loopDelta), 0);\n return undefined;\n }\n\n function focusOnDay(current, offset) {\n var activeElement = getClosestActiveElement();\n var dayFocused = isInView(activeElement || document.body);\n var startElem = current !== undefined ? current : dayFocused ? activeElement : self.selectedDateElem !== undefined && isInView(self.selectedDateElem) ? self.selectedDateElem : self.todayDateElem !== undefined && isInView(self.todayDateElem) ? self.todayDateElem : getFirstAvailableDay(offset > 0 ? 1 : -1);\n\n if (startElem === undefined) {\n self._input.focus();\n } else if (!dayFocused) {\n focusOnDayElem(startElem);\n } else {\n getNextAvailableDay(startElem, offset);\n }\n }\n\n function buildMonthDays(year, month) {\n var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;\n var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12, year);\n var daysInMonth = self.utils.getDaysInMonth(month, year),\n days = window.document.createDocumentFragment(),\n isMultiMonth = self.config.showMonths > 1,\n prevMonthDayClass = isMultiMonth ? \"prevMonthDay hidden\" : \"prevMonthDay\",\n nextMonthDayClass = isMultiMonth ? \"nextMonthDay hidden\" : \"nextMonthDay\";\n var dayNumber = prevMonthDays + 1 - firstOfMonth,\n dayIndex = 0;\n\n for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {\n days.appendChild(createDay(\"flatpickr-day \" + prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));\n }\n\n for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {\n days.appendChild(createDay(\"flatpickr-day\", new Date(year, month, dayNumber), dayNumber, dayIndex));\n }\n\n for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth && (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {\n days.appendChild(createDay(\"flatpickr-day \" + nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));\n }\n\n var dayContainer = createElement(\"div\", \"dayContainer\");\n dayContainer.appendChild(days);\n return dayContainer;\n }\n\n function buildDays() {\n if (self.daysContainer === undefined) {\n return;\n }\n\n clearNode(self.daysContainer);\n if (self.weekNumbers) clearNode(self.weekNumbers);\n var frag = document.createDocumentFragment();\n\n for (var i = 0; i < self.config.showMonths; i++) {\n var d = new Date(self.currentYear, self.currentMonth, 1);\n d.setMonth(self.currentMonth + i);\n frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));\n }\n\n self.daysContainer.appendChild(frag);\n self.days = self.daysContainer.firstChild;\n\n if (self.config.mode === \"range\" && self.selectedDates.length === 1) {\n onMouseOver();\n }\n }\n\n function buildMonthSwitch() {\n if (self.config.showMonths > 1 || self.config.monthSelectorType !== \"dropdown\") return;\n\n var shouldBuildMonth = function (month) {\n if (self.config.minDate !== undefined && self.currentYear === self.config.minDate.getFullYear() && month < self.config.minDate.getMonth()) {\n return false;\n }\n\n return !(self.config.maxDate !== undefined && self.currentYear === self.config.maxDate.getFullYear() && month > self.config.maxDate.getMonth());\n };\n\n self.monthsDropdownContainer.tabIndex = -1;\n self.monthsDropdownContainer.innerHTML = \"\";\n\n for (var i = 0; i < 12; i++) {\n if (!shouldBuildMonth(i)) continue;\n var month = createElement(\"option\", \"flatpickr-monthDropdown-month\");\n month.value = new Date(self.currentYear, i).getMonth().toString();\n month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n);\n month.tabIndex = -1;\n\n if (self.currentMonth === i) {\n month.selected = true;\n }\n\n self.monthsDropdownContainer.appendChild(month);\n }\n }\n\n function buildMonth() {\n var container = createElement(\"div\", \"flatpickr-month\");\n var monthNavFragment = window.document.createDocumentFragment();\n var monthElement;\n\n if (self.config.showMonths > 1 || self.config.monthSelectorType === \"static\") {\n monthElement = createElement(\"span\", \"cur-month\");\n } else {\n self.monthsDropdownContainer = createElement(\"select\", \"flatpickr-monthDropdown-months\");\n self.monthsDropdownContainer.setAttribute(\"aria-label\", self.l10n.monthAriaLabel);\n bind(self.monthsDropdownContainer, \"change\", function (e) {\n var target = getEventTarget(e);\n var selectedMonth = parseInt(target.value, 10);\n self.changeMonth(selectedMonth - self.currentMonth);\n triggerEvent(\"onMonthChange\");\n });\n buildMonthSwitch();\n monthElement = self.monthsDropdownContainer;\n }\n\n var yearInput = createNumberInput(\"cur-year\", {\n tabindex: \"-1\"\n });\n var yearElement = yearInput.getElementsByTagName(\"input\")[0];\n yearElement.setAttribute(\"aria-label\", self.l10n.yearAriaLabel);\n\n if (self.config.minDate) {\n yearElement.setAttribute(\"min\", self.config.minDate.getFullYear().toString());\n }\n\n if (self.config.maxDate) {\n yearElement.setAttribute(\"max\", self.config.maxDate.getFullYear().toString());\n yearElement.disabled = !!self.config.minDate && self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();\n }\n\n var currentMonth = createElement(\"div\", \"flatpickr-current-month\");\n currentMonth.appendChild(monthElement);\n currentMonth.appendChild(yearInput);\n monthNavFragment.appendChild(currentMonth);\n container.appendChild(monthNavFragment);\n return {\n container: container,\n yearElement: yearElement,\n monthElement: monthElement\n };\n }\n\n function buildMonths() {\n clearNode(self.monthNav);\n self.monthNav.appendChild(self.prevMonthNav);\n\n if (self.config.showMonths) {\n self.yearElements = [];\n self.monthElements = [];\n }\n\n for (var m = self.config.showMonths; m--;) {\n var month = buildMonth();\n self.yearElements.push(month.yearElement);\n self.monthElements.push(month.monthElement);\n self.monthNav.appendChild(month.container);\n }\n\n self.monthNav.appendChild(self.nextMonthNav);\n }\n\n function buildMonthNav() {\n self.monthNav = createElement(\"div\", \"flatpickr-months\");\n self.yearElements = [];\n self.monthElements = [];\n self.prevMonthNav = createElement(\"span\", \"flatpickr-prev-month\");\n self.prevMonthNav.innerHTML = self.config.prevArrow;\n self.nextMonthNav = createElement(\"span\", \"flatpickr-next-month\");\n self.nextMonthNav.innerHTML = self.config.nextArrow;\n buildMonths();\n Object.defineProperty(self, \"_hidePrevMonthArrow\", {\n get: function () {\n return self.__hidePrevMonthArrow;\n },\n set: function (bool) {\n if (self.__hidePrevMonthArrow !== bool) {\n toggleClass(self.prevMonthNav, \"flatpickr-disabled\", bool);\n self.__hidePrevMonthArrow = bool;\n }\n }\n });\n Object.defineProperty(self, \"_hideNextMonthArrow\", {\n get: function () {\n return self.__hideNextMonthArrow;\n },\n set: function (bool) {\n if (self.__hideNextMonthArrow !== bool) {\n toggleClass(self.nextMonthNav, \"flatpickr-disabled\", bool);\n self.__hideNextMonthArrow = bool;\n }\n }\n });\n self.currentYearElement = self.yearElements[0];\n updateNavigationCurrentMonth();\n return self.monthNav;\n }\n\n function buildTime() {\n self.calendarContainer.classList.add(\"hasTime\");\n if (self.config.noCalendar) self.calendarContainer.classList.add(\"noCalendar\");\n var defaults = getDefaultHours(self.config);\n self.timeContainer = createElement(\"div\", \"flatpickr-time\");\n self.timeContainer.tabIndex = -1;\n var separator = createElement(\"span\", \"flatpickr-time-separator\", \":\");\n var hourInput = createNumberInput(\"flatpickr-hour\", {\n \"aria-label\": self.l10n.hourAriaLabel\n });\n self.hourElement = hourInput.getElementsByTagName(\"input\")[0];\n var minuteInput = createNumberInput(\"flatpickr-minute\", {\n \"aria-label\": self.l10n.minuteAriaLabel\n });\n self.minuteElement = minuteInput.getElementsByTagName(\"input\")[0];\n self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;\n self.hourElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getHours() : self.config.time_24hr ? defaults.hours : military2ampm(defaults.hours));\n self.minuteElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getMinutes() : defaults.minutes);\n self.hourElement.setAttribute(\"step\", self.config.hourIncrement.toString());\n self.minuteElement.setAttribute(\"step\", self.config.minuteIncrement.toString());\n self.hourElement.setAttribute(\"min\", self.config.time_24hr ? \"0\" : \"1\");\n self.hourElement.setAttribute(\"max\", self.config.time_24hr ? \"23\" : \"12\");\n self.hourElement.setAttribute(\"maxlength\", \"2\");\n self.minuteElement.setAttribute(\"min\", \"0\");\n self.minuteElement.setAttribute(\"max\", \"59\");\n self.minuteElement.setAttribute(\"maxlength\", \"2\");\n self.timeContainer.appendChild(hourInput);\n self.timeContainer.appendChild(separator);\n self.timeContainer.appendChild(minuteInput);\n if (self.config.time_24hr) self.timeContainer.classList.add(\"time24hr\");\n\n if (self.config.enableSeconds) {\n self.timeContainer.classList.add(\"hasSeconds\");\n var secondInput = createNumberInput(\"flatpickr-second\");\n self.secondElement = secondInput.getElementsByTagName(\"input\")[0];\n self.secondElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getSeconds() : defaults.seconds);\n self.secondElement.setAttribute(\"step\", self.minuteElement.getAttribute(\"step\"));\n self.secondElement.setAttribute(\"min\", \"0\");\n self.secondElement.setAttribute(\"max\", \"59\");\n self.secondElement.setAttribute(\"maxlength\", \"2\");\n self.timeContainer.appendChild(createElement(\"span\", \"flatpickr-time-separator\", \":\"));\n self.timeContainer.appendChild(secondInput);\n }\n\n if (!self.config.time_24hr) {\n self.amPM = createElement(\"span\", \"flatpickr-am-pm\", self.l10n.amPM[int((self.latestSelectedDateObj ? self.hourElement.value : self.config.defaultHour) > 11)]);\n self.amPM.title = self.l10n.toggleTitle;\n self.amPM.tabIndex = -1;\n self.timeContainer.appendChild(self.amPM);\n }\n\n return self.timeContainer;\n }\n\n function buildWeekdays() {\n if (!self.weekdayContainer) self.weekdayContainer = createElement(\"div\", \"flatpickr-weekdays\");else clearNode(self.weekdayContainer);\n\n for (var i = self.config.showMonths; i--;) {\n var container = createElement(\"div\", \"flatpickr-weekdaycontainer\");\n self.weekdayContainer.appendChild(container);\n }\n\n updateWeekdays();\n return self.weekdayContainer;\n }\n\n function updateWeekdays() {\n if (!self.weekdayContainer) {\n return;\n }\n\n var firstDayOfWeek = self.l10n.firstDayOfWeek;\n\n var weekdays = __spreadArrays(self.l10n.weekdays.shorthand);\n\n if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {\n weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek));\n }\n\n for (var i = self.config.showMonths; i--;) {\n self.weekdayContainer.children[i].innerHTML = \"\\n \\n \" + weekdays.join(\"\") + \"\\n \\n \";\n }\n }\n\n function buildWeeks() {\n self.calendarContainer.classList.add(\"hasWeeks\");\n var weekWrapper = createElement(\"div\", \"flatpickr-weekwrapper\");\n weekWrapper.appendChild(createElement(\"span\", \"flatpickr-weekday\", self.l10n.weekAbbreviation));\n var weekNumbers = createElement(\"div\", \"flatpickr-weeks\");\n weekWrapper.appendChild(weekNumbers);\n return {\n weekWrapper: weekWrapper,\n weekNumbers: weekNumbers\n };\n }\n\n function changeMonth(value, isOffset) {\n if (isOffset === void 0) {\n isOffset = true;\n }\n\n var delta = isOffset ? value : value - self.currentMonth;\n if (delta < 0 && self._hidePrevMonthArrow === true || delta > 0 && self._hideNextMonthArrow === true) return;\n self.currentMonth += delta;\n\n if (self.currentMonth < 0 || self.currentMonth > 11) {\n self.currentYear += self.currentMonth > 11 ? 1 : -1;\n self.currentMonth = (self.currentMonth + 12) % 12;\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n\n buildDays();\n triggerEvent(\"onMonthChange\");\n updateNavigationCurrentMonth();\n }\n\n function clear(triggerChangeEvent, toInitial) {\n if (triggerChangeEvent === void 0) {\n triggerChangeEvent = true;\n }\n\n if (toInitial === void 0) {\n toInitial = true;\n }\n\n self.input.value = \"\";\n if (self.altInput !== undefined) self.altInput.value = \"\";\n if (self.mobileInput !== undefined) self.mobileInput.value = \"\";\n self.selectedDates = [];\n self.latestSelectedDateObj = undefined;\n\n if (toInitial === true) {\n self.currentYear = self._initialDate.getFullYear();\n self.currentMonth = self._initialDate.getMonth();\n }\n\n if (self.config.enableTime === true) {\n var _a = getDefaultHours(self.config),\n hours = _a.hours,\n minutes = _a.minutes,\n seconds = _a.seconds;\n\n setHours(hours, minutes, seconds);\n }\n\n self.redraw();\n if (triggerChangeEvent) triggerEvent(\"onChange\");\n }\n\n function close() {\n self.isOpen = false;\n\n if (!self.isMobile) {\n if (self.calendarContainer !== undefined) {\n self.calendarContainer.classList.remove(\"open\");\n }\n\n if (self._input !== undefined) {\n self._input.classList.remove(\"active\");\n }\n }\n\n triggerEvent(\"onClose\");\n }\n\n function destroy() {\n if (self.config !== undefined) triggerEvent(\"onDestroy\");\n\n for (var i = self._handlers.length; i--;) {\n self._handlers[i].remove();\n }\n\n self._handlers = [];\n\n if (self.mobileInput) {\n if (self.mobileInput.parentNode) self.mobileInput.parentNode.removeChild(self.mobileInput);\n self.mobileInput = undefined;\n } else if (self.calendarContainer && self.calendarContainer.parentNode) {\n if (self.config.static && self.calendarContainer.parentNode) {\n var wrapper = self.calendarContainer.parentNode;\n wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);\n\n if (wrapper.parentNode) {\n while (wrapper.firstChild) wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);\n\n wrapper.parentNode.removeChild(wrapper);\n }\n } else self.calendarContainer.parentNode.removeChild(self.calendarContainer);\n }\n\n if (self.altInput) {\n self.input.type = \"text\";\n if (self.altInput.parentNode) self.altInput.parentNode.removeChild(self.altInput);\n delete self.altInput;\n }\n\n if (self.input) {\n self.input.type = self.input._type;\n self.input.classList.remove(\"flatpickr-input\");\n self.input.removeAttribute(\"readonly\");\n }\n\n [\"_showTimeInput\", \"latestSelectedDateObj\", \"_hideNextMonthArrow\", \"_hidePrevMonthArrow\", \"__hideNextMonthArrow\", \"__hidePrevMonthArrow\", \"isMobile\", \"isOpen\", \"selectedDateElem\", \"minDateHasTime\", \"maxDateHasTime\", \"days\", \"daysContainer\", \"_input\", \"_positionElement\", \"innerContainer\", \"rContainer\", \"monthNav\", \"todayDateElem\", \"calendarContainer\", \"weekdayContainer\", \"prevMonthNav\", \"nextMonthNav\", \"monthsDropdownContainer\", \"currentMonthElement\", \"currentYearElement\", \"navigationCurrentMonth\", \"selectedDateElem\", \"config\"].forEach(function (k) {\n try {\n delete self[k];\n } catch (_) {}\n });\n }\n\n function isCalendarElem(elem) {\n return self.calendarContainer.contains(elem);\n }\n\n function documentClick(e) {\n if (self.isOpen && !self.config.inline) {\n var eventTarget_1 = getEventTarget(e);\n var isCalendarElement = isCalendarElem(eventTarget_1);\n var isInput = eventTarget_1 === self.input || eventTarget_1 === self.altInput || self.element.contains(eventTarget_1) || e.path && e.path.indexOf && (~e.path.indexOf(self.input) || ~e.path.indexOf(self.altInput));\n var lostFocus = !isInput && !isCalendarElement && !isCalendarElem(e.relatedTarget);\n var isIgnored = !self.config.ignoredFocusElements.some(function (elem) {\n return elem.contains(eventTarget_1);\n });\n\n if (lostFocus && isIgnored) {\n if (self.config.allowInput) {\n self.setDate(self._input.value, false, self.config.altInput ? self.config.altFormat : self.config.dateFormat);\n }\n\n if (self.timeContainer !== undefined && self.minuteElement !== undefined && self.hourElement !== undefined && self.input.value !== \"\" && self.input.value !== undefined) {\n updateTime();\n }\n\n self.close();\n if (self.config && self.config.mode === \"range\" && self.selectedDates.length === 1) self.clear(false);\n }\n }\n }\n\n function changeYear(newYear) {\n if (!newYear || self.config.minDate && newYear < self.config.minDate.getFullYear() || self.config.maxDate && newYear > self.config.maxDate.getFullYear()) return;\n var newYearNum = newYear,\n isNewYear = self.currentYear !== newYearNum;\n self.currentYear = newYearNum || self.currentYear;\n\n if (self.config.maxDate && self.currentYear === self.config.maxDate.getFullYear()) {\n self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);\n } else if (self.config.minDate && self.currentYear === self.config.minDate.getFullYear()) {\n self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);\n }\n\n if (isNewYear) {\n self.redraw();\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n }\n\n function isEnabled(date, timeless) {\n var _a;\n\n if (timeless === void 0) {\n timeless = true;\n }\n\n var dateToCheck = self.parseDate(date, undefined, timeless);\n if (self.config.minDate && dateToCheck && compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0 || self.config.maxDate && dateToCheck && compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0) return false;\n if (!self.config.enable && self.config.disable.length === 0) return true;\n if (dateToCheck === undefined) return false;\n var bool = !!self.config.enable,\n array = (_a = self.config.enable) !== null && _a !== void 0 ? _a : self.config.disable;\n\n for (var i = 0, d = void 0; i < array.length; i++) {\n d = array[i];\n if (typeof d === \"function\" && d(dateToCheck)) return bool;else if (d instanceof Date && dateToCheck !== undefined && d.getTime() === dateToCheck.getTime()) return bool;else if (typeof d === \"string\") {\n var parsed = self.parseDate(d, undefined, true);\n return parsed && parsed.getTime() === dateToCheck.getTime() ? bool : !bool;\n } else if (typeof d === \"object\" && dateToCheck !== undefined && d.from && d.to && dateToCheck.getTime() >= d.from.getTime() && dateToCheck.getTime() <= d.to.getTime()) return bool;\n }\n\n return !bool;\n }\n\n function isInView(elem) {\n if (self.daysContainer !== undefined) return elem.className.indexOf(\"hidden\") === -1 && elem.className.indexOf(\"flatpickr-disabled\") === -1 && self.daysContainer.contains(elem);\n return false;\n }\n\n function onBlur(e) {\n var isInput = e.target === self._input;\n var valueChanged = self._input.value.trimEnd() !== getDateStr();\n\n if (isInput && valueChanged && !(e.relatedTarget && isCalendarElem(e.relatedTarget))) {\n self.setDate(self._input.value, true, e.target === self.altInput ? self.config.altFormat : self.config.dateFormat);\n }\n }\n\n function onKeyDown(e) {\n var eventTarget = getEventTarget(e);\n var isInput = self.config.wrap ? element.contains(eventTarget) : eventTarget === self._input;\n var allowInput = self.config.allowInput;\n var allowKeydown = self.isOpen && (!allowInput || !isInput);\n var allowInlineKeydown = self.config.inline && isInput && !allowInput;\n\n if (e.keyCode === 13 && isInput) {\n if (allowInput) {\n self.setDate(self._input.value, true, eventTarget === self.altInput ? self.config.altFormat : self.config.dateFormat);\n self.close();\n return eventTarget.blur();\n } else {\n self.open();\n }\n } else if (isCalendarElem(eventTarget) || allowKeydown || allowInlineKeydown) {\n var isTimeObj = !!self.timeContainer && self.timeContainer.contains(eventTarget);\n\n switch (e.keyCode) {\n case 13:\n if (isTimeObj) {\n e.preventDefault();\n updateTime();\n focusAndClose();\n } else selectDate(e);\n\n break;\n\n case 27:\n e.preventDefault();\n focusAndClose();\n break;\n\n case 8:\n case 46:\n if (isInput && !self.config.allowInput) {\n e.preventDefault();\n self.clear();\n }\n\n break;\n\n case 37:\n case 39:\n if (!isTimeObj && !isInput) {\n e.preventDefault();\n var activeElement = getClosestActiveElement();\n\n if (self.daysContainer !== undefined && (allowInput === false || activeElement && isInView(activeElement))) {\n var delta_1 = e.keyCode === 39 ? 1 : -1;\n if (!e.ctrlKey) focusOnDay(undefined, delta_1);else {\n e.stopPropagation();\n changeMonth(delta_1);\n focusOnDay(getFirstAvailableDay(1), 0);\n }\n }\n } else if (self.hourElement) self.hourElement.focus();\n\n break;\n\n case 38:\n case 40:\n e.preventDefault();\n var delta = e.keyCode === 40 ? 1 : -1;\n\n if (self.daysContainer && eventTarget.$i !== undefined || eventTarget === self.input || eventTarget === self.altInput) {\n if (e.ctrlKey) {\n e.stopPropagation();\n changeYear(self.currentYear - delta);\n focusOnDay(getFirstAvailableDay(1), 0);\n } else if (!isTimeObj) focusOnDay(undefined, delta * 7);\n } else if (eventTarget === self.currentYearElement) {\n changeYear(self.currentYear - delta);\n } else if (self.config.enableTime) {\n if (!isTimeObj && self.hourElement) self.hourElement.focus();\n updateTime(e);\n\n self._debouncedChange();\n }\n\n break;\n\n case 9:\n if (isTimeObj) {\n var elems = [self.hourElement, self.minuteElement, self.secondElement, self.amPM].concat(self.pluginElements).filter(function (x) {\n return x;\n });\n var i = elems.indexOf(eventTarget);\n\n if (i !== -1) {\n var target = elems[i + (e.shiftKey ? -1 : 1)];\n e.preventDefault();\n\n (target || self._input).focus();\n }\n } else if (!self.config.noCalendar && self.daysContainer && self.daysContainer.contains(eventTarget) && e.shiftKey) {\n e.preventDefault();\n\n self._input.focus();\n }\n\n break;\n\n default:\n break;\n }\n }\n\n if (self.amPM !== undefined && eventTarget === self.amPM) {\n switch (e.key) {\n case self.l10n.amPM[0].charAt(0):\n case self.l10n.amPM[0].charAt(0).toLowerCase():\n self.amPM.textContent = self.l10n.amPM[0];\n setHoursFromInputs();\n updateValue();\n break;\n\n case self.l10n.amPM[1].charAt(0):\n case self.l10n.amPM[1].charAt(0).toLowerCase():\n self.amPM.textContent = self.l10n.amPM[1];\n setHoursFromInputs();\n updateValue();\n break;\n }\n }\n\n if (isInput || isCalendarElem(eventTarget)) {\n triggerEvent(\"onKeyDown\", e);\n }\n }\n\n function onMouseOver(elem, cellClass) {\n if (cellClass === void 0) {\n cellClass = \"flatpickr-day\";\n }\n\n if (self.selectedDates.length !== 1 || elem && (!elem.classList.contains(cellClass) || elem.classList.contains(\"flatpickr-disabled\"))) return;\n var hoverDate = elem ? elem.dateObj.getTime() : self.days.firstElementChild.dateObj.getTime(),\n initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(),\n rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()),\n rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime());\n var containsDisabled = false;\n var minRange = 0,\n maxRange = 0;\n\n for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) {\n if (!isEnabled(new Date(t), true)) {\n containsDisabled = containsDisabled || t > rangeStartDate && t < rangeEndDate;\n if (t < initialDate && (!minRange || t > minRange)) minRange = t;else if (t > initialDate && (!maxRange || t < maxRange)) maxRange = t;\n }\n }\n\n var hoverableCells = Array.from(self.rContainer.querySelectorAll(\"*:nth-child(-n+\" + self.config.showMonths + \") > .\" + cellClass));\n hoverableCells.forEach(function (dayElem) {\n var date = dayElem.dateObj;\n var timestamp = date.getTime();\n var outOfRange = minRange > 0 && timestamp < minRange || maxRange > 0 && timestamp > maxRange;\n\n if (outOfRange) {\n dayElem.classList.add(\"notAllowed\");\n [\"inRange\", \"startRange\", \"endRange\"].forEach(function (c) {\n dayElem.classList.remove(c);\n });\n return;\n } else if (containsDisabled && !outOfRange) return;\n\n [\"startRange\", \"inRange\", \"endRange\", \"notAllowed\"].forEach(function (c) {\n dayElem.classList.remove(c);\n });\n\n if (elem !== undefined) {\n elem.classList.add(hoverDate <= self.selectedDates[0].getTime() ? \"startRange\" : \"endRange\");\n if (initialDate < hoverDate && timestamp === initialDate) dayElem.classList.add(\"startRange\");else if (initialDate > hoverDate && timestamp === initialDate) dayElem.classList.add(\"endRange\");\n if (timestamp >= minRange && (maxRange === 0 || timestamp <= maxRange) && isBetween(timestamp, initialDate, hoverDate)) dayElem.classList.add(\"inRange\");\n }\n });\n }\n\n function onResize() {\n if (self.isOpen && !self.config.static && !self.config.inline) positionCalendar();\n }\n\n function open(e, positionElement) {\n if (positionElement === void 0) {\n positionElement = self._positionElement;\n }\n\n if (self.isMobile === true) {\n if (e) {\n e.preventDefault();\n var eventTarget = getEventTarget(e);\n\n if (eventTarget) {\n eventTarget.blur();\n }\n }\n\n if (self.mobileInput !== undefined) {\n self.mobileInput.focus();\n self.mobileInput.click();\n }\n\n triggerEvent(\"onOpen\");\n return;\n } else if (self._input.disabled || self.config.inline) {\n return;\n }\n\n var wasOpen = self.isOpen;\n self.isOpen = true;\n\n if (!wasOpen) {\n self.calendarContainer.classList.add(\"open\");\n\n self._input.classList.add(\"active\");\n\n triggerEvent(\"onOpen\");\n positionCalendar(positionElement);\n }\n\n if (self.config.enableTime === true && self.config.noCalendar === true) {\n if (self.config.allowInput === false && (e === undefined || !self.timeContainer.contains(e.relatedTarget))) {\n setTimeout(function () {\n return self.hourElement.select();\n }, 50);\n }\n }\n }\n\n function minMaxDateSetter(type) {\n return function (date) {\n var dateObj = self.config[\"_\" + type + \"Date\"] = self.parseDate(date, self.config.dateFormat);\n var inverseDateObj = self.config[\"_\" + (type === \"min\" ? \"max\" : \"min\") + \"Date\"];\n\n if (dateObj !== undefined) {\n self[type === \"min\" ? \"minDateHasTime\" : \"maxDateHasTime\"] = dateObj.getHours() > 0 || dateObj.getMinutes() > 0 || dateObj.getSeconds() > 0;\n }\n\n if (self.selectedDates) {\n self.selectedDates = self.selectedDates.filter(function (d) {\n return isEnabled(d);\n });\n if (!self.selectedDates.length && type === \"min\") setHoursFromDate(dateObj);\n updateValue();\n }\n\n if (self.daysContainer) {\n redraw();\n if (dateObj !== undefined) self.currentYearElement[type] = dateObj.getFullYear().toString();else self.currentYearElement.removeAttribute(type);\n self.currentYearElement.disabled = !!inverseDateObj && dateObj !== undefined && inverseDateObj.getFullYear() === dateObj.getFullYear();\n }\n };\n }\n\n function parseConfig() {\n var boolOpts = [\"wrap\", \"weekNumbers\", \"allowInput\", \"allowInvalidPreload\", \"clickOpens\", \"time_24hr\", \"enableTime\", \"noCalendar\", \"altInput\", \"shorthandCurrentMonth\", \"inline\", \"static\", \"enableSeconds\", \"disableMobile\"];\n\n var userConfig = __assign(__assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig);\n\n var formats = {};\n self.config.parseDate = userConfig.parseDate;\n self.config.formatDate = userConfig.formatDate;\n Object.defineProperty(self.config, \"enable\", {\n get: function () {\n return self.config._enable;\n },\n set: function (dates) {\n self.config._enable = parseDateRules(dates);\n }\n });\n Object.defineProperty(self.config, \"disable\", {\n get: function () {\n return self.config._disable;\n },\n set: function (dates) {\n self.config._disable = parseDateRules(dates);\n }\n });\n var timeMode = userConfig.mode === \"time\";\n\n if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {\n var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaultOptions.dateFormat;\n formats.dateFormat = userConfig.noCalendar || timeMode ? \"H:i\" + (userConfig.enableSeconds ? \":S\" : \"\") : defaultDateFormat + \" H:i\" + (userConfig.enableSeconds ? \":S\" : \"\");\n }\n\n if (userConfig.altInput && (userConfig.enableTime || timeMode) && !userConfig.altFormat) {\n var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaultOptions.altFormat;\n formats.altFormat = userConfig.noCalendar || timeMode ? \"h:i\" + (userConfig.enableSeconds ? \":S K\" : \" K\") : defaultAltFormat + (\" h:i\" + (userConfig.enableSeconds ? \":S\" : \"\") + \" K\");\n }\n\n Object.defineProperty(self.config, \"minDate\", {\n get: function () {\n return self.config._minDate;\n },\n set: minMaxDateSetter(\"min\")\n });\n Object.defineProperty(self.config, \"maxDate\", {\n get: function () {\n return self.config._maxDate;\n },\n set: minMaxDateSetter(\"max\")\n });\n\n var minMaxTimeSetter = function (type) {\n return function (val) {\n self.config[type === \"min\" ? \"_minTime\" : \"_maxTime\"] = self.parseDate(val, \"H:i:S\");\n };\n };\n\n Object.defineProperty(self.config, \"minTime\", {\n get: function () {\n return self.config._minTime;\n },\n set: minMaxTimeSetter(\"min\")\n });\n Object.defineProperty(self.config, \"maxTime\", {\n get: function () {\n return self.config._maxTime;\n },\n set: minMaxTimeSetter(\"max\")\n });\n\n if (userConfig.mode === \"time\") {\n self.config.noCalendar = true;\n self.config.enableTime = true;\n }\n\n Object.assign(self.config, formats, userConfig);\n\n for (var i = 0; i < boolOpts.length; i++) self.config[boolOpts[i]] = self.config[boolOpts[i]] === true || self.config[boolOpts[i]] === \"true\";\n\n HOOKS.filter(function (hook) {\n return self.config[hook] !== undefined;\n }).forEach(function (hook) {\n self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance);\n });\n self.isMobile = !self.config.disableMobile && !self.config.inline && self.config.mode === \"single\" && !self.config.disable.length && !self.config.enable && !self.config.weekNumbers && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n\n for (var i = 0; i < self.config.plugins.length; i++) {\n var pluginConf = self.config.plugins[i](self) || {};\n\n for (var key in pluginConf) {\n if (HOOKS.indexOf(key) > -1) {\n self.config[key] = arrayify(pluginConf[key]).map(bindToInstance).concat(self.config[key]);\n } else if (typeof userConfig[key] === \"undefined\") self.config[key] = pluginConf[key];\n }\n }\n\n if (!userConfig.altInputClass) {\n self.config.altInputClass = getInputElem().className + \" \" + self.config.altInputClass;\n }\n\n triggerEvent(\"onParseConfig\");\n }\n\n function getInputElem() {\n return self.config.wrap ? element.querySelector(\"[data-input]\") : element;\n }\n\n function setupLocale() {\n if (typeof self.config.locale !== \"object\" && typeof flatpickr.l10ns[self.config.locale] === \"undefined\") self.config.errorHandler(new Error(\"flatpickr: invalid locale \" + self.config.locale));\n self.l10n = __assign(__assign({}, flatpickr.l10ns.default), typeof self.config.locale === \"object\" ? self.config.locale : self.config.locale !== \"default\" ? flatpickr.l10ns[self.config.locale] : undefined);\n tokenRegex.D = \"(\" + self.l10n.weekdays.shorthand.join(\"|\") + \")\";\n tokenRegex.l = \"(\" + self.l10n.weekdays.longhand.join(\"|\") + \")\";\n tokenRegex.M = \"(\" + self.l10n.months.shorthand.join(\"|\") + \")\";\n tokenRegex.F = \"(\" + self.l10n.months.longhand.join(\"|\") + \")\";\n tokenRegex.K = \"(\" + self.l10n.amPM[0] + \"|\" + self.l10n.amPM[1] + \"|\" + self.l10n.amPM[0].toLowerCase() + \"|\" + self.l10n.amPM[1].toLowerCase() + \")\";\n\n var userConfig = __assign(__assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {})));\n\n if (userConfig.time_24hr === undefined && flatpickr.defaultConfig.time_24hr === undefined) {\n self.config.time_24hr = self.l10n.time_24hr;\n }\n\n self.formatDate = createDateFormatter(self);\n self.parseDate = createDateParser({\n config: self.config,\n l10n: self.l10n\n });\n }\n\n function positionCalendar(customPositionElement) {\n if (typeof self.config.position === \"function\") {\n return void self.config.position(self, customPositionElement);\n }\n\n if (self.calendarContainer === undefined) return;\n triggerEvent(\"onPreCalendarPosition\");\n var positionElement = customPositionElement || self._positionElement;\n var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, function (acc, child) {\n return acc + child.offsetHeight;\n }, 0),\n calendarWidth = self.calendarContainer.offsetWidth,\n configPos = self.config.position.split(\" \"),\n configPosVertical = configPos[0],\n configPosHorizontal = configPos.length > 1 ? configPos[1] : null,\n inputBounds = positionElement.getBoundingClientRect(),\n distanceFromBottom = window.innerHeight - inputBounds.bottom,\n showOnTop = configPosVertical === \"above\" || configPosVertical !== \"below\" && distanceFromBottom < calendarHeight && inputBounds.top > calendarHeight;\n var top = window.pageYOffset + inputBounds.top + (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);\n toggleClass(self.calendarContainer, \"arrowTop\", !showOnTop);\n toggleClass(self.calendarContainer, \"arrowBottom\", showOnTop);\n if (self.config.inline) return;\n var left = window.pageXOffset + inputBounds.left;\n var isCenter = false;\n var isRight = false;\n\n if (configPosHorizontal === \"center\") {\n left -= (calendarWidth - inputBounds.width) / 2;\n isCenter = true;\n } else if (configPosHorizontal === \"right\") {\n left -= calendarWidth - inputBounds.width;\n isRight = true;\n }\n\n toggleClass(self.calendarContainer, \"arrowLeft\", !isCenter && !isRight);\n toggleClass(self.calendarContainer, \"arrowCenter\", isCenter);\n toggleClass(self.calendarContainer, \"arrowRight\", isRight);\n var right = window.document.body.offsetWidth - (window.pageXOffset + inputBounds.right);\n var rightMost = left + calendarWidth > window.document.body.offsetWidth;\n var centerMost = right + calendarWidth > window.document.body.offsetWidth;\n toggleClass(self.calendarContainer, \"rightMost\", rightMost);\n if (self.config.static) return;\n self.calendarContainer.style.top = top + \"px\";\n\n if (!rightMost) {\n self.calendarContainer.style.left = left + \"px\";\n self.calendarContainer.style.right = \"auto\";\n } else if (!centerMost) {\n self.calendarContainer.style.left = \"auto\";\n self.calendarContainer.style.right = right + \"px\";\n } else {\n var doc = getDocumentStyleSheet();\n if (doc === undefined) return;\n var bodyWidth = window.document.body.offsetWidth;\n var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2);\n var centerBefore = \".flatpickr-calendar.centerMost:before\";\n var centerAfter = \".flatpickr-calendar.centerMost:after\";\n var centerIndex = doc.cssRules.length;\n var centerStyle = \"{left:\" + inputBounds.left + \"px;right:auto;}\";\n toggleClass(self.calendarContainer, \"rightMost\", false);\n toggleClass(self.calendarContainer, \"centerMost\", true);\n doc.insertRule(centerBefore + \",\" + centerAfter + centerStyle, centerIndex);\n self.calendarContainer.style.left = centerLeft + \"px\";\n self.calendarContainer.style.right = \"auto\";\n }\n }\n\n function getDocumentStyleSheet() {\n var editableSheet = null;\n\n for (var i = 0; i < document.styleSheets.length; i++) {\n var sheet = document.styleSheets[i];\n if (!sheet.cssRules) continue;\n\n try {\n sheet.cssRules;\n } catch (err) {\n continue;\n }\n\n editableSheet = sheet;\n break;\n }\n\n return editableSheet != null ? editableSheet : createStyleSheet();\n }\n\n function createStyleSheet() {\n var style = document.createElement(\"style\");\n document.head.appendChild(style);\n return style.sheet;\n }\n\n function redraw() {\n if (self.config.noCalendar || self.isMobile) return;\n buildMonthSwitch();\n updateNavigationCurrentMonth();\n buildDays();\n }\n\n function focusAndClose() {\n self._input.focus();\n\n if (window.navigator.userAgent.indexOf(\"MSIE\") !== -1 || navigator.msMaxTouchPoints !== undefined) {\n setTimeout(self.close, 0);\n } else {\n self.close();\n }\n }\n\n function selectDate(e) {\n e.preventDefault();\n e.stopPropagation();\n\n var isSelectable = function (day) {\n return day.classList && day.classList.contains(\"flatpickr-day\") && !day.classList.contains(\"flatpickr-disabled\") && !day.classList.contains(\"notAllowed\");\n };\n\n var t = findParent(getEventTarget(e), isSelectable);\n if (t === undefined) return;\n var target = t;\n var selectedDate = self.latestSelectedDateObj = new Date(target.dateObj.getTime());\n var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth || selectedDate.getMonth() > self.currentMonth + self.config.showMonths - 1) && self.config.mode !== \"range\";\n self.selectedDateElem = target;\n if (self.config.mode === \"single\") self.selectedDates = [selectedDate];else if (self.config.mode === \"multiple\") {\n var selectedIndex = isDateSelected(selectedDate);\n if (selectedIndex) self.selectedDates.splice(parseInt(selectedIndex), 1);else self.selectedDates.push(selectedDate);\n } else if (self.config.mode === \"range\") {\n if (self.selectedDates.length === 2) {\n self.clear(false, false);\n }\n\n self.latestSelectedDateObj = selectedDate;\n self.selectedDates.push(selectedDate);\n if (compareDates(selectedDate, self.selectedDates[0], true) !== 0) self.selectedDates.sort(function (a, b) {\n return a.getTime() - b.getTime();\n });\n }\n setHoursFromInputs();\n\n if (shouldChangeMonth) {\n var isNewYear = self.currentYear !== selectedDate.getFullYear();\n self.currentYear = selectedDate.getFullYear();\n self.currentMonth = selectedDate.getMonth();\n\n if (isNewYear) {\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n\n triggerEvent(\"onMonthChange\");\n }\n\n updateNavigationCurrentMonth();\n buildDays();\n updateValue();\n if (!shouldChangeMonth && self.config.mode !== \"range\" && self.config.showMonths === 1) focusOnDayElem(target);else if (self.selectedDateElem !== undefined && self.hourElement === undefined) {\n self.selectedDateElem && self.selectedDateElem.focus();\n }\n if (self.hourElement !== undefined) self.hourElement !== undefined && self.hourElement.focus();\n\n if (self.config.closeOnSelect) {\n var single = self.config.mode === \"single\" && !self.config.enableTime;\n var range = self.config.mode === \"range\" && self.selectedDates.length === 2 && !self.config.enableTime;\n\n if (single || range) {\n focusAndClose();\n }\n }\n\n triggerChange();\n }\n\n var CALLBACKS = {\n locale: [setupLocale, updateWeekdays],\n showMonths: [buildMonths, setCalendarWidth, buildWeekdays],\n minDate: [jumpToDate],\n maxDate: [jumpToDate],\n positionElement: [updatePositionElement],\n clickOpens: [function () {\n if (self.config.clickOpens === true) {\n bind(self._input, \"focus\", self.open);\n bind(self._input, \"click\", self.open);\n } else {\n self._input.removeEventListener(\"focus\", self.open);\n\n self._input.removeEventListener(\"click\", self.open);\n }\n }]\n };\n\n function set(option, value) {\n if (option !== null && typeof option === \"object\") {\n Object.assign(self.config, option);\n\n for (var key in option) {\n if (CALLBACKS[key] !== undefined) CALLBACKS[key].forEach(function (x) {\n return x();\n });\n }\n } else {\n self.config[option] = value;\n if (CALLBACKS[option] !== undefined) CALLBACKS[option].forEach(function (x) {\n return x();\n });else if (HOOKS.indexOf(option) > -1) self.config[option] = arrayify(value);\n }\n\n self.redraw();\n updateValue(true);\n }\n\n function setSelectedDate(inputDate, format) {\n var dates = [];\n if (inputDate instanceof Array) dates = inputDate.map(function (d) {\n return self.parseDate(d, format);\n });else if (inputDate instanceof Date || typeof inputDate === \"number\") dates = [self.parseDate(inputDate, format)];else if (typeof inputDate === \"string\") {\n switch (self.config.mode) {\n case \"single\":\n case \"time\":\n dates = [self.parseDate(inputDate, format)];\n break;\n\n case \"multiple\":\n dates = inputDate.split(self.config.conjunction).map(function (date) {\n return self.parseDate(date, format);\n });\n break;\n\n case \"range\":\n dates = inputDate.split(self.l10n.rangeSeparator).map(function (date) {\n return self.parseDate(date, format);\n });\n break;\n\n default:\n break;\n }\n } else self.config.errorHandler(new Error(\"Invalid date supplied: \" + JSON.stringify(inputDate)));\n self.selectedDates = self.config.allowInvalidPreload ? dates : dates.filter(function (d) {\n return d instanceof Date && isEnabled(d, false);\n });\n if (self.config.mode === \"range\") self.selectedDates.sort(function (a, b) {\n return a.getTime() - b.getTime();\n });\n }\n\n function setDate(date, triggerChange, format) {\n if (triggerChange === void 0) {\n triggerChange = false;\n }\n\n if (format === void 0) {\n format = self.config.dateFormat;\n }\n\n if (date !== 0 && !date || date instanceof Array && date.length === 0) return self.clear(triggerChange);\n setSelectedDate(date, format);\n self.latestSelectedDateObj = self.selectedDates[self.selectedDates.length - 1];\n self.redraw();\n jumpToDate(undefined, triggerChange);\n setHoursFromDate();\n\n if (self.selectedDates.length === 0) {\n self.clear(false);\n }\n\n updateValue(triggerChange);\n if (triggerChange) triggerEvent(\"onChange\");\n }\n\n function parseDateRules(arr) {\n return arr.slice().map(function (rule) {\n if (typeof rule === \"string\" || typeof rule === \"number\" || rule instanceof Date) {\n return self.parseDate(rule, undefined, true);\n } else if (rule && typeof rule === \"object\" && rule.from && rule.to) return {\n from: self.parseDate(rule.from, undefined),\n to: self.parseDate(rule.to, undefined)\n };\n\n return rule;\n }).filter(function (x) {\n return x;\n });\n }\n\n function setupDates() {\n self.selectedDates = [];\n self.now = self.parseDate(self.config.now) || new Date();\n var preloadedDate = self.config.defaultDate || ((self.input.nodeName === \"INPUT\" || self.input.nodeName === \"TEXTAREA\") && self.input.placeholder && self.input.value === self.input.placeholder ? null : self.input.value);\n if (preloadedDate) setSelectedDate(preloadedDate, self.config.dateFormat);\n self._initialDate = self.selectedDates.length > 0 ? self.selectedDates[0] : self.config.minDate && self.config.minDate.getTime() > self.now.getTime() ? self.config.minDate : self.config.maxDate && self.config.maxDate.getTime() < self.now.getTime() ? self.config.maxDate : self.now;\n self.currentYear = self._initialDate.getFullYear();\n self.currentMonth = self._initialDate.getMonth();\n if (self.selectedDates.length > 0) self.latestSelectedDateObj = self.selectedDates[0];\n if (self.config.minTime !== undefined) self.config.minTime = self.parseDate(self.config.minTime, \"H:i\");\n if (self.config.maxTime !== undefined) self.config.maxTime = self.parseDate(self.config.maxTime, \"H:i\");\n self.minDateHasTime = !!self.config.minDate && (self.config.minDate.getHours() > 0 || self.config.minDate.getMinutes() > 0 || self.config.minDate.getSeconds() > 0);\n self.maxDateHasTime = !!self.config.maxDate && (self.config.maxDate.getHours() > 0 || self.config.maxDate.getMinutes() > 0 || self.config.maxDate.getSeconds() > 0);\n }\n\n function setupInputs() {\n self.input = getInputElem();\n\n if (!self.input) {\n self.config.errorHandler(new Error(\"Invalid input element specified\"));\n return;\n }\n\n self.input._type = self.input.type;\n self.input.type = \"text\";\n self.input.classList.add(\"flatpickr-input\");\n self._input = self.input;\n\n if (self.config.altInput) {\n self.altInput = createElement(self.input.nodeName, self.config.altInputClass);\n self._input = self.altInput;\n self.altInput.placeholder = self.input.placeholder;\n self.altInput.disabled = self.input.disabled;\n self.altInput.required = self.input.required;\n self.altInput.tabIndex = self.input.tabIndex;\n self.altInput.type = \"text\";\n self.input.setAttribute(\"type\", \"hidden\");\n if (!self.config.static && self.input.parentNode) self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);\n }\n\n if (!self.config.allowInput) self._input.setAttribute(\"readonly\", \"readonly\");\n updatePositionElement();\n }\n\n function updatePositionElement() {\n self._positionElement = self.config.positionElement || self._input;\n }\n\n function setupMobile() {\n var inputType = self.config.enableTime ? self.config.noCalendar ? \"time\" : \"datetime-local\" : \"date\";\n self.mobileInput = createElement(\"input\", self.input.className + \" flatpickr-mobile\");\n self.mobileInput.tabIndex = 1;\n self.mobileInput.type = inputType;\n self.mobileInput.disabled = self.input.disabled;\n self.mobileInput.required = self.input.required;\n self.mobileInput.placeholder = self.input.placeholder;\n self.mobileFormatStr = inputType === \"datetime-local\" ? \"Y-m-d\\\\TH:i:S\" : inputType === \"date\" ? \"Y-m-d\" : \"H:i:S\";\n\n if (self.selectedDates.length > 0) {\n self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);\n }\n\n if (self.config.minDate) self.mobileInput.min = self.formatDate(self.config.minDate, \"Y-m-d\");\n if (self.config.maxDate) self.mobileInput.max = self.formatDate(self.config.maxDate, \"Y-m-d\");\n if (self.input.getAttribute(\"step\")) self.mobileInput.step = String(self.input.getAttribute(\"step\"));\n self.input.type = \"hidden\";\n if (self.altInput !== undefined) self.altInput.type = \"hidden\";\n\n try {\n if (self.input.parentNode) self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);\n } catch (_a) {}\n\n bind(self.mobileInput, \"change\", function (e) {\n self.setDate(getEventTarget(e).value, false, self.mobileFormatStr);\n triggerEvent(\"onChange\");\n triggerEvent(\"onClose\");\n });\n }\n\n function toggle(e) {\n if (self.isOpen === true) return self.close();\n self.open(e);\n }\n\n function triggerEvent(event, data) {\n if (self.config === undefined) return;\n var hooks = self.config[event];\n\n if (hooks !== undefined && hooks.length > 0) {\n for (var i = 0; hooks[i] && i < hooks.length; i++) hooks[i](self.selectedDates, self.input.value, self, data);\n }\n\n if (event === \"onChange\") {\n self.input.dispatchEvent(createEvent(\"change\"));\n self.input.dispatchEvent(createEvent(\"input\"));\n }\n }\n\n function createEvent(name) {\n var e = document.createEvent(\"Event\");\n e.initEvent(name, true, true);\n return e;\n }\n\n function isDateSelected(date) {\n for (var i = 0; i < self.selectedDates.length; i++) {\n var selectedDate = self.selectedDates[i];\n if (selectedDate instanceof Date && compareDates(selectedDate, date) === 0) return \"\" + i;\n }\n\n return false;\n }\n\n function isDateInRange(date) {\n if (self.config.mode !== \"range\" || self.selectedDates.length < 2) return false;\n return compareDates(date, self.selectedDates[0]) >= 0 && compareDates(date, self.selectedDates[1]) <= 0;\n }\n\n function updateNavigationCurrentMonth() {\n if (self.config.noCalendar || self.isMobile || !self.monthNav) return;\n self.yearElements.forEach(function (yearElement, i) {\n var d = new Date(self.currentYear, self.currentMonth, 1);\n d.setMonth(self.currentMonth + i);\n\n if (self.config.showMonths > 1 || self.config.monthSelectorType === \"static\") {\n self.monthElements[i].textContent = monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + \" \";\n } else {\n self.monthsDropdownContainer.value = d.getMonth().toString();\n }\n\n yearElement.value = d.getFullYear().toString();\n });\n self._hidePrevMonthArrow = self.config.minDate !== undefined && (self.currentYear === self.config.minDate.getFullYear() ? self.currentMonth <= self.config.minDate.getMonth() : self.currentYear < self.config.minDate.getFullYear());\n self._hideNextMonthArrow = self.config.maxDate !== undefined && (self.currentYear === self.config.maxDate.getFullYear() ? self.currentMonth + 1 > self.config.maxDate.getMonth() : self.currentYear > self.config.maxDate.getFullYear());\n }\n\n function getDateStr(specificFormat) {\n var format = specificFormat || (self.config.altInput ? self.config.altFormat : self.config.dateFormat);\n return self.selectedDates.map(function (dObj) {\n return self.formatDate(dObj, format);\n }).filter(function (d, i, arr) {\n return self.config.mode !== \"range\" || self.config.enableTime || arr.indexOf(d) === i;\n }).join(self.config.mode !== \"range\" ? self.config.conjunction : self.l10n.rangeSeparator);\n }\n\n function updateValue(triggerChange) {\n if (triggerChange === void 0) {\n triggerChange = true;\n }\n\n if (self.mobileInput !== undefined && self.mobileFormatStr) {\n self.mobileInput.value = self.latestSelectedDateObj !== undefined ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr) : \"\";\n }\n\n self.input.value = getDateStr(self.config.dateFormat);\n\n if (self.altInput !== undefined) {\n self.altInput.value = getDateStr(self.config.altFormat);\n }\n\n if (triggerChange !== false) triggerEvent(\"onValueUpdate\");\n }\n\n function onMonthNavClick(e) {\n var eventTarget = getEventTarget(e);\n var isPrevMonth = self.prevMonthNav.contains(eventTarget);\n var isNextMonth = self.nextMonthNav.contains(eventTarget);\n\n if (isPrevMonth || isNextMonth) {\n changeMonth(isPrevMonth ? -1 : 1);\n } else if (self.yearElements.indexOf(eventTarget) >= 0) {\n eventTarget.select();\n } else if (eventTarget.classList.contains(\"arrowUp\")) {\n self.changeYear(self.currentYear + 1);\n } else if (eventTarget.classList.contains(\"arrowDown\")) {\n self.changeYear(self.currentYear - 1);\n }\n }\n\n function timeWrapper(e) {\n e.preventDefault();\n var isKeyDown = e.type === \"keydown\",\n eventTarget = getEventTarget(e),\n input = eventTarget;\n\n if (self.amPM !== undefined && eventTarget === self.amPM) {\n self.amPM.textContent = self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];\n }\n\n var min = parseFloat(input.getAttribute(\"min\")),\n max = parseFloat(input.getAttribute(\"max\")),\n step = parseFloat(input.getAttribute(\"step\")),\n curValue = parseInt(input.value, 10),\n delta = e.delta || (isKeyDown ? e.which === 38 ? 1 : -1 : 0);\n var newValue = curValue + step * delta;\n\n if (typeof input.value !== \"undefined\" && input.value.length === 2) {\n var isHourElem = input === self.hourElement,\n isMinuteElem = input === self.minuteElement;\n\n if (newValue < min) {\n newValue = max + newValue + int(!isHourElem) + (int(isHourElem) && int(!self.amPM));\n if (isMinuteElem) incrementNumInput(undefined, -1, self.hourElement);\n } else if (newValue > max) {\n newValue = input === self.hourElement ? newValue - max - int(!self.amPM) : min;\n if (isMinuteElem) incrementNumInput(undefined, 1, self.hourElement);\n }\n\n if (self.amPM && isHourElem && (step === 1 ? newValue + curValue === 23 : Math.abs(newValue - curValue) > step)) {\n self.amPM.textContent = self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];\n }\n\n input.value = pad(newValue);\n }\n }\n\n init();\n return self;\n}\n\nfunction _flatpickr(nodeList, config) {\n var nodes = Array.prototype.slice.call(nodeList).filter(function (x) {\n return x instanceof HTMLElement;\n });\n var instances = [];\n\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n\n try {\n if (node.getAttribute(\"data-fp-omit\") !== null) continue;\n\n if (node._flatpickr !== undefined) {\n node._flatpickr.destroy();\n\n node._flatpickr = undefined;\n }\n\n node._flatpickr = FlatpickrInstance(node, config || {});\n instances.push(node._flatpickr);\n } catch (e) {\n console.error(e);\n }\n }\n\n return instances.length === 1 ? instances[0] : instances;\n}\n\nif (typeof HTMLElement !== \"undefined\" && typeof HTMLCollection !== \"undefined\" && typeof NodeList !== \"undefined\") {\n HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {\n return _flatpickr(this, config);\n };\n\n HTMLElement.prototype.flatpickr = function (config) {\n return _flatpickr([this], config);\n };\n}\n\nvar flatpickr = function (selector, config) {\n if (typeof selector === \"string\") {\n return _flatpickr(window.document.querySelectorAll(selector), config);\n } else if (selector instanceof Node) {\n return _flatpickr([selector], config);\n } else {\n return _flatpickr(selector, config);\n }\n};\n\nflatpickr.defaultConfig = {};\nflatpickr.l10ns = {\n en: __assign({}, English),\n default: __assign({}, English)\n};\n\nflatpickr.localize = function (l10n) {\n flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n);\n};\n\nflatpickr.setDefaults = function (config) {\n flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config);\n};\n\nflatpickr.parseDate = createDateParser({});\nflatpickr.formatDate = createDateFormatter({});\nflatpickr.compareDates = compareDates;\n\nif (typeof jQuery !== \"undefined\" && typeof jQuery.fn !== \"undefined\") {\n jQuery.fn.flatpickr = function (config) {\n return _flatpickr(this, config);\n };\n}\n\nDate.prototype.fp_incr = function (days) {\n return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === \"string\" ? parseInt(days, 10) : days));\n};\n\nif (typeof window !== \"undefined\") {\n window.flatpickr = flatpickr;\n}\n\nexport default flatpickr;","export var english = {\n weekdays: {\n shorthand: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n longhand: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"]\n },\n months: {\n shorthand: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n longhand: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"]\n },\n daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n firstDayOfWeek: 0,\n ordinal: function (nth) {\n var s = nth % 100;\n if (s > 3 && s < 21) return \"th\";\n\n switch (s % 10) {\n case 1:\n return \"st\";\n\n case 2:\n return \"nd\";\n\n case 3:\n return \"rd\";\n\n default:\n return \"th\";\n }\n },\n rangeSeparator: \" to \",\n weekAbbreviation: \"Wk\",\n scrollTitle: \"Scroll to increment\",\n toggleTitle: \"Click to toggle\",\n amPM: [\"AM\", \"PM\"],\n yearAriaLabel: \"Year\",\n monthAriaLabel: \"Month\",\n hourAriaLabel: \"Hour\",\n minuteAriaLabel: \"Minute\",\n time_24hr: false\n};\nexport default english;","export var HOOKS = [\"onChange\", \"onClose\", \"onDayCreate\", \"onDestroy\", \"onKeyDown\", \"onMonthChange\", \"onOpen\", \"onParseConfig\", \"onReady\", \"onValueUpdate\", \"onYearChange\", \"onPreCalendarPosition\"];\nexport var defaults = {\n _disable: [],\n allowInput: false,\n allowInvalidPreload: false,\n altFormat: \"F j, Y\",\n altInput: false,\n altInputClass: \"form-control input\",\n animate: typeof window === \"object\" && window.navigator.userAgent.indexOf(\"MSIE\") === -1,\n ariaDateFormat: \"F j, Y\",\n autoFillDefaultTime: true,\n clickOpens: true,\n closeOnSelect: true,\n conjunction: \", \",\n dateFormat: \"Y-m-d\",\n defaultHour: 12,\n defaultMinute: 0,\n defaultSeconds: 0,\n disable: [],\n disableMobile: false,\n enableSeconds: false,\n enableTime: false,\n errorHandler: function (err) {\n return typeof console !== \"undefined\" && console.warn(err);\n },\n getWeek: function (givenDate) {\n var date = new Date(givenDate.getTime());\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);\n var week1 = new Date(date.getFullYear(), 0, 4);\n return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7);\n },\n hourIncrement: 1,\n ignoredFocusElements: [],\n inline: false,\n locale: \"default\",\n minuteIncrement: 5,\n mode: \"single\",\n monthSelectorType: \"dropdown\",\n nextArrow: \"\",\n noCalendar: false,\n now: new Date(),\n onChange: [],\n onClose: [],\n onDayCreate: [],\n onDestroy: [],\n onKeyDown: [],\n onMonthChange: [],\n onOpen: [],\n onParseConfig: [],\n onReady: [],\n onValueUpdate: [],\n onYearChange: [],\n onPreCalendarPosition: [],\n plugins: [],\n position: \"auto\",\n positionElement: undefined,\n prevArrow: \"\",\n shorthandCurrentMonth: false,\n showMonths: 1,\n static: false,\n time_24hr: false,\n weekNumbers: false,\n wrap: false\n};","import { tokenRegex, revFormat, formats } from \"./formatting\";\nimport { defaults } from \"../types/options\";\nimport { english } from \"../l10n/default\";\nexport var createDateFormatter = function (_a) {\n var _b = _a.config,\n config = _b === void 0 ? defaults : _b,\n _c = _a.l10n,\n l10n = _c === void 0 ? english : _c,\n _d = _a.isMobile,\n isMobile = _d === void 0 ? false : _d;\n return function (dateObj, frmt, overrideLocale) {\n var locale = overrideLocale || l10n;\n\n if (config.formatDate !== undefined && !isMobile) {\n return config.formatDate(dateObj, frmt, locale);\n }\n\n return frmt.split(\"\").map(function (c, i, arr) {\n return formats[c] && arr[i - 1] !== \"\\\\\" ? formats[c](dateObj, locale, config) : c !== \"\\\\\" ? c : \"\";\n }).join(\"\");\n };\n};\nexport var createDateParser = function (_a) {\n var _b = _a.config,\n config = _b === void 0 ? defaults : _b,\n _c = _a.l10n,\n l10n = _c === void 0 ? english : _c;\n return function (date, givenFormat, timeless, customLocale) {\n if (date !== 0 && !date) return undefined;\n var locale = customLocale || l10n;\n var parsedDate;\n var dateOrig = date;\n if (date instanceof Date) parsedDate = new Date(date.getTime());else if (typeof date !== \"string\" && date.toFixed !== undefined) parsedDate = new Date(date);else if (typeof date === \"string\") {\n var format = givenFormat || (config || defaults).dateFormat;\n var datestr = String(date).trim();\n\n if (datestr === \"today\") {\n parsedDate = new Date();\n timeless = true;\n } else if (config && config.parseDate) {\n parsedDate = config.parseDate(date, format);\n } else if (/Z$/.test(datestr) || /GMT$/.test(datestr)) {\n parsedDate = new Date(date);\n } else {\n var matched = void 0,\n ops = [];\n\n for (var i = 0, matchIndex = 0, regexStr = \"\"; i < format.length; i++) {\n var token = format[i];\n var isBackSlash = token === \"\\\\\";\n var escaped = format[i - 1] === \"\\\\\" || isBackSlash;\n\n if (tokenRegex[token] && !escaped) {\n regexStr += tokenRegex[token];\n var match = new RegExp(regexStr).exec(date);\n\n if (match && (matched = true)) {\n ops[token !== \"Y\" ? \"push\" : \"unshift\"]({\n fn: revFormat[token],\n val: match[++matchIndex]\n });\n }\n } else if (!isBackSlash) regexStr += \".\";\n }\n\n parsedDate = !config || !config.noCalendar ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) : new Date(new Date().setHours(0, 0, 0, 0));\n ops.forEach(function (_a) {\n var fn = _a.fn,\n val = _a.val;\n return parsedDate = fn(parsedDate, val, locale) || parsedDate;\n });\n parsedDate = matched ? parsedDate : undefined;\n }\n }\n\n if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {\n config.errorHandler(new Error(\"Invalid date provided: \" + dateOrig));\n return undefined;\n }\n\n if (timeless === true) parsedDate.setHours(0, 0, 0, 0);\n return parsedDate;\n };\n};\nexport function compareDates(date1, date2, timeless) {\n if (timeless === void 0) {\n timeless = true;\n }\n\n if (timeless !== false) {\n return new Date(date1.getTime()).setHours(0, 0, 0, 0) - new Date(date2.getTime()).setHours(0, 0, 0, 0);\n }\n\n return date1.getTime() - date2.getTime();\n}\nexport function compareTimes(date1, date2) {\n return 3600 * (date1.getHours() - date2.getHours()) + 60 * (date1.getMinutes() - date2.getMinutes()) + date1.getSeconds() - date2.getSeconds();\n}\nexport var isBetween = function (ts, ts1, ts2) {\n return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);\n};\nexport var calculateSecondsSinceMidnight = function (hours, minutes, seconds) {\n return hours * 3600 + minutes * 60 + seconds;\n};\nexport var parseSeconds = function (secondsSinceMidnight) {\n var hours = Math.floor(secondsSinceMidnight / 3600),\n minutes = (secondsSinceMidnight - hours * 3600) / 60;\n return [hours, minutes, secondsSinceMidnight - hours * 3600 - minutes * 60];\n};\nexport var duration = {\n DAY: 86400000\n};\nexport function getDefaultHours(config) {\n var hours = config.defaultHour;\n var minutes = config.defaultMinute;\n var seconds = config.defaultSeconds;\n\n if (config.minDate !== undefined) {\n var minHour = config.minDate.getHours();\n var minMinutes = config.minDate.getMinutes();\n var minSeconds = config.minDate.getSeconds();\n\n if (hours < minHour) {\n hours = minHour;\n }\n\n if (hours === minHour && minutes < minMinutes) {\n minutes = minMinutes;\n }\n\n if (hours === minHour && minutes === minMinutes && seconds < minSeconds) seconds = config.minDate.getSeconds();\n }\n\n if (config.maxDate !== undefined) {\n var maxHr = config.maxDate.getHours();\n var maxMinutes = config.maxDate.getMinutes();\n hours = Math.min(hours, maxHr);\n if (hours === maxHr) minutes = Math.min(maxMinutes, minutes);\n if (hours === maxHr && minutes === maxMinutes) seconds = config.maxDate.getSeconds();\n }\n\n return {\n hours: hours,\n minutes: minutes,\n seconds: seconds\n };\n}","export function toggleClass(elem, className, bool) {\n if (bool === true) return elem.classList.add(className);\n elem.classList.remove(className);\n}\nexport function createElement(tag, className, content) {\n var e = window.document.createElement(tag);\n className = className || \"\";\n content = content || \"\";\n e.className = className;\n if (content !== undefined) e.textContent = content;\n return e;\n}\nexport function clearNode(node) {\n while (node.firstChild) node.removeChild(node.firstChild);\n}\nexport function findParent(node, condition) {\n if (condition(node)) return node;else if (node.parentNode) return findParent(node.parentNode, condition);\n return undefined;\n}\nexport function createNumberInput(inputClassName, opts) {\n var wrapper = createElement(\"div\", \"numInputWrapper\"),\n numInput = createElement(\"input\", \"numInput \" + inputClassName),\n arrowUp = createElement(\"span\", \"arrowUp\"),\n arrowDown = createElement(\"span\", \"arrowDown\");\n\n if (navigator.userAgent.indexOf(\"MSIE 9.0\") === -1) {\n numInput.type = \"number\";\n } else {\n numInput.type = \"text\";\n numInput.pattern = \"\\\\d*\";\n }\n\n if (opts !== undefined) for (var key in opts) numInput.setAttribute(key, opts[key]);\n wrapper.appendChild(numInput);\n wrapper.appendChild(arrowUp);\n wrapper.appendChild(arrowDown);\n return wrapper;\n}\nexport function getEventTarget(event) {\n try {\n if (typeof event.composedPath === \"function\") {\n var path = event.composedPath();\n return path[0];\n }\n\n return event.target;\n } catch (error) {\n return event.target;\n }\n}","import { int, pad } from \"../utils\";\n\nvar doNothing = function () {\n return undefined;\n};\n\nexport var monthToStr = function (monthNumber, shorthand, locale) {\n return locale.months[shorthand ? \"shorthand\" : \"longhand\"][monthNumber];\n};\nexport var revFormat = {\n D: doNothing,\n F: function (dateObj, monthName, locale) {\n dateObj.setMonth(locale.months.longhand.indexOf(monthName));\n },\n G: function (dateObj, hour) {\n dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour));\n },\n H: function (dateObj, hour) {\n dateObj.setHours(parseFloat(hour));\n },\n J: function (dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n K: function (dateObj, amPM, locale) {\n dateObj.setHours(dateObj.getHours() % 12 + 12 * int(new RegExp(locale.amPM[1], \"i\").test(amPM)));\n },\n M: function (dateObj, shortMonth, locale) {\n dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));\n },\n S: function (dateObj, seconds) {\n dateObj.setSeconds(parseFloat(seconds));\n },\n U: function (_, unixSeconds) {\n return new Date(parseFloat(unixSeconds) * 1000);\n },\n W: function (dateObj, weekNum, locale) {\n var weekNumber = parseInt(weekNum);\n var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);\n date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);\n return date;\n },\n Y: function (dateObj, year) {\n dateObj.setFullYear(parseFloat(year));\n },\n Z: function (_, ISODate) {\n return new Date(ISODate);\n },\n d: function (dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n h: function (dateObj, hour) {\n dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour));\n },\n i: function (dateObj, minutes) {\n dateObj.setMinutes(parseFloat(minutes));\n },\n j: function (dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n l: doNothing,\n m: function (dateObj, month) {\n dateObj.setMonth(parseFloat(month) - 1);\n },\n n: function (dateObj, month) {\n dateObj.setMonth(parseFloat(month) - 1);\n },\n s: function (dateObj, seconds) {\n dateObj.setSeconds(parseFloat(seconds));\n },\n u: function (_, unixMillSeconds) {\n return new Date(parseFloat(unixMillSeconds));\n },\n w: doNothing,\n y: function (dateObj, year) {\n dateObj.setFullYear(2000 + parseFloat(year));\n }\n};\nexport var tokenRegex = {\n D: \"\",\n F: \"\",\n G: \"(\\\\d\\\\d|\\\\d)\",\n H: \"(\\\\d\\\\d|\\\\d)\",\n J: \"(\\\\d\\\\d|\\\\d)\\\\w+\",\n K: \"\",\n M: \"\",\n S: \"(\\\\d\\\\d|\\\\d)\",\n U: \"(.+)\",\n W: \"(\\\\d\\\\d|\\\\d)\",\n Y: \"(\\\\d{4})\",\n Z: \"(.+)\",\n d: \"(\\\\d\\\\d|\\\\d)\",\n h: \"(\\\\d\\\\d|\\\\d)\",\n i: \"(\\\\d\\\\d|\\\\d)\",\n j: \"(\\\\d\\\\d|\\\\d)\",\n l: \"\",\n m: \"(\\\\d\\\\d|\\\\d)\",\n n: \"(\\\\d\\\\d|\\\\d)\",\n s: \"(\\\\d\\\\d|\\\\d)\",\n u: \"(.+)\",\n w: \"(\\\\d\\\\d|\\\\d)\",\n y: \"(\\\\d{2})\"\n};\nexport var formats = {\n Z: function (date) {\n return date.toISOString();\n },\n D: function (date, locale, options) {\n return locale.weekdays.shorthand[formats.w(date, locale, options)];\n },\n F: function (date, locale, options) {\n return monthToStr(formats.n(date, locale, options) - 1, false, locale);\n },\n G: function (date, locale, options) {\n return pad(formats.h(date, locale, options));\n },\n H: function (date) {\n return pad(date.getHours());\n },\n J: function (date, locale) {\n return locale.ordinal !== undefined ? date.getDate() + locale.ordinal(date.getDate()) : date.getDate();\n },\n K: function (date, locale) {\n return locale.amPM[int(date.getHours() > 11)];\n },\n M: function (date, locale) {\n return monthToStr(date.getMonth(), true, locale);\n },\n S: function (date) {\n return pad(date.getSeconds());\n },\n U: function (date) {\n return date.getTime() / 1000;\n },\n W: function (date, _, options) {\n return options.getWeek(date);\n },\n Y: function (date) {\n return pad(date.getFullYear(), 4);\n },\n d: function (date) {\n return pad(date.getDate());\n },\n h: function (date) {\n return date.getHours() % 12 ? date.getHours() % 12 : 12;\n },\n i: function (date) {\n return pad(date.getMinutes());\n },\n j: function (date) {\n return date.getDate();\n },\n l: function (date, locale) {\n return locale.weekdays.longhand[date.getDay()];\n },\n m: function (date) {\n return pad(date.getMonth() + 1);\n },\n n: function (date) {\n return date.getMonth() + 1;\n },\n s: function (date) {\n return date.getSeconds();\n },\n u: function (date) {\n return date.getTime();\n },\n w: function (date) {\n return date.getDay();\n },\n y: function (date) {\n return String(date.getFullYear()).substring(2);\n }\n};","export var pad = function (number, length) {\n if (length === void 0) {\n length = 2;\n }\n\n return (\"000\" + number).slice(length * -1);\n};\nexport var int = function (bool) {\n return bool === true ? 1 : 0;\n};\nexport function debounce(fn, wait) {\n var t;\n return function () {\n var _this = this;\n\n var args = arguments;\n clearTimeout(t);\n t = setTimeout(function () {\n return fn.apply(_this, args);\n }, wait);\n };\n}\nexport var arrayify = function (obj) {\n return obj instanceof Array ? obj : [obj];\n};","\"use strict\";\n\nif (typeof Object.assign !== \"function\") {\n Object.assign = function (target) {\n var args = [];\n\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n\n if (!target) {\n throw TypeError(\"Cannot convert undefined or null to object\");\n }\n\n var _loop_1 = function (source) {\n if (source) {\n Object.keys(source).forEach(function (key) {\n return target[key] = source[key];\n });\n }\n };\n\n for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n var source = args_1[_a];\n\n _loop_1(source);\n }\n\n return target;\n };\n}","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.es = {}));\n})(this, function (exports) {\n 'use strict';\n\n var fp = typeof window !== \"undefined\" && window.flatpickr !== undefined ? window.flatpickr : {\n l10ns: {}\n };\n var Spanish = {\n weekdays: {\n shorthand: [\"Dom\", \"Lun\", \"Mar\", \"Mié\", \"Jue\", \"Vie\", \"Sáb\"],\n longhand: [\"Domingo\", \"Lunes\", \"Martes\", \"Miércoles\", \"Jueves\", \"Viernes\", \"Sábado\"]\n },\n months: {\n shorthand: [\"Ene\", \"Feb\", \"Mar\", \"Abr\", \"May\", \"Jun\", \"Jul\", \"Ago\", \"Sep\", \"Oct\", \"Nov\", \"Dic\"],\n longhand: [\"Enero\", \"Febrero\", \"Marzo\", \"Abril\", \"Mayo\", \"Junio\", \"Julio\", \"Agosto\", \"Septiembre\", \"Octubre\", \"Noviembre\", \"Diciembre\"]\n },\n ordinal: function () {\n return \"º\";\n },\n firstDayOfWeek: 1,\n rangeSeparator: \" a \",\n time_24hr: true\n };\n fp.l10ns.es = Spanish;\n var es = fp.l10ns;\n exports.Spanish = Spanish;\n exports.default = es;\n Object.defineProperty(exports, '__esModule', {\n value: true\n });\n});","import { Controller } from 'stimulus';\nimport flatpickr from 'flatpickr';\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n return function () {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (_isNativeReflectConstruct()) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nconst kebabCase = string => string.replace(/([a-z])([A-Z])/g, \"$1-$2\").replace(/[\\s_]+/g, \"-\").toLowerCase();\n\nconst capitalize = string => {\n return string.charAt(0).toUpperCase() + string.slice(1);\n};\n\nconst booleanOptions = ['allowInput', 'altInput', 'animate', 'clickOpens', 'closeOnSelect', 'disableMobile', 'enableSeconds', 'enableTime', 'inline', 'noCalendar', 'shorthandCurrentMonth', 'static', 'time_24hr', 'weekNumbers', 'wrap'];\nconst stringOptions = ['altInputClass', 'conjunction', 'mode', 'nextArrow', 'position', 'prevArrow', 'monthSelectorType'];\nconst numberOptions = ['defaultHour', 'defaultMinute', 'defaultSeconds', 'hourIncrement', 'minuteIncrement', 'showMonths'];\nconst arrayOptions = ['disable', 'enable', 'disableDaysOfWeek', 'enableDaysOfWeek'];\nconst arrayOrStringOptions = ['defaultDate'];\nconst dateOptions = ['maxDate', 'minDate', 'maxTime', 'minTime', 'now'];\nconst dateFormats = ['altFormat', 'ariaDateFormat', 'dateFormat'];\nconst options = {\n string: stringOptions,\n boolean: booleanOptions,\n date: dateOptions,\n array: arrayOptions,\n number: numberOptions,\n arrayOrString: arrayOrStringOptions\n};\nconst events = ['change', 'open', 'close', 'monthChange', 'yearChange', 'ready', 'valueUpdate', 'dayCreate'];\nconst elements = ['calendarContainer', 'currentYearElement', 'days', 'daysContainer', 'input', 'nextMonthNav', 'monthNav', 'prevMonthNav', 'rContainer', 'selectedDateElem', 'todayDateElem', 'weekdayContainer'];\nconst mapping = {\n '%Y': 'Y',\n '%y': 'y',\n '%C': 'Y',\n '%m': 'm',\n '%-m': 'n',\n '%_m': 'n',\n '%B': 'F',\n '%^B': 'F',\n '%b': 'M',\n '%^b': 'M',\n '%h': 'M',\n '%^h': 'M',\n '%d': 'd',\n '%-d': 'j',\n '%e': 'j',\n '%H': 'H',\n '%k': 'H',\n '%I': 'h',\n '%l': 'h',\n '%-l': 'h',\n '%P': 'K',\n '%p': 'K',\n '%M': 'i',\n '%S': 'S',\n '%A': 'l',\n '%a': 'D',\n '%w': 'w'\n};\nconst strftimeRegex = new RegExp(Object.keys(mapping).join('|').replace(new RegExp('\\\\^', 'g'), '\\\\^'), 'g');\n\nconst convertDateFormat = format => {\n return format.replace(strftimeRegex, match => {\n return mapping[match];\n });\n};\n\nlet StimulusFlatpickr = /*#__PURE__*/function (_Controller) {\n _inherits(StimulusFlatpickr, _Controller);\n\n var _super = _createSuper(StimulusFlatpickr);\n\n function StimulusFlatpickr() {\n _classCallCheck(this, StimulusFlatpickr);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(StimulusFlatpickr, [{\n key: \"initialize\",\n value: function initialize() {\n this.config = {};\n }\n }, {\n key: \"connect\",\n value: function connect() {\n this._initializeEvents();\n\n this._initializeOptions();\n\n this._initializeDateFormats();\n\n this.fp = flatpickr(this.flatpickrElement, _objectSpread2({}, this.config));\n\n this._initializeElements();\n }\n }, {\n key: \"disconnect\",\n value: function disconnect() {\n const value = this.inputTarget.value;\n this.fp.destroy();\n this.inputTarget.value = value;\n }\n }, {\n key: \"_initializeEvents\",\n value: function _initializeEvents() {\n events.forEach(event => {\n if (this[event]) {\n const hook = \"on\".concat(capitalize(event));\n this.config[hook] = this[event].bind(this);\n }\n });\n }\n }, {\n key: \"_initializeOptions\",\n value: function _initializeOptions() {\n Object.keys(options).forEach(optionType => {\n const optionsCamelCase = options[optionType];\n optionsCamelCase.forEach(option => {\n const optionKebab = kebabCase(option);\n\n if (this.data.has(optionKebab)) {\n this.config[option] = this[\"_\".concat(optionType)](optionKebab);\n }\n });\n });\n\n this._handleDaysOfWeek();\n }\n }, {\n key: \"_handleDaysOfWeek\",\n value: function _handleDaysOfWeek() {\n if (this.config.disableDaysOfWeek) {\n this.config.disableDaysOfWeek = this._validateDaysOfWeek(this.config.disableDaysOfWeek);\n this.config.disable = [...(this.config.disable || []), this._disable.bind(this)];\n }\n\n if (this.config.enableDaysOfWeek) {\n this.config.enableDaysOfWeek = this._validateDaysOfWeek(this.config.enableDaysOfWeek);\n this.config.enable = [...(this.config.enable || []), this._enable.bind(this)];\n }\n }\n }, {\n key: \"_validateDaysOfWeek\",\n value: function _validateDaysOfWeek(days) {\n if (Array.isArray(days)) {\n return days.map(day => parseInt(day));\n } else {\n console.error('days of week must be a valid array');\n return [];\n }\n }\n }, {\n key: \"_disable\",\n value: function _disable(date) {\n const disabledDays = this.config.disableDaysOfWeek;\n return disabledDays.includes(date.getDay());\n }\n }, {\n key: \"_enable\",\n value: function _enable(date) {\n const enabledDays = this.config.enableDaysOfWeek;\n return enabledDays.includes(date.getDay());\n }\n }, {\n key: \"_initializeDateFormats\",\n value: function _initializeDateFormats() {\n dateFormats.forEach(dateFormat => {\n if (this.data.has(dateFormat)) {\n this.config[dateFormat] = convertDateFormat(this.data.get(dateFormat));\n }\n });\n }\n }, {\n key: \"_initializeElements\",\n value: function _initializeElements() {\n elements.forEach(element => {\n this[\"\".concat(element, \"Target\")] = this.fp[element];\n });\n }\n }, {\n key: \"_string\",\n value: function _string(option) {\n return this.data.get(option);\n }\n }, {\n key: \"_date\",\n value: function _date(option) {\n return this.data.get(option);\n }\n }, {\n key: \"_boolean\",\n value: function _boolean(option) {\n return !(this.data.get(option) == '0' || this.data.get(option) == 'false');\n }\n }, {\n key: \"_array\",\n value: function _array(option) {\n return JSON.parse(this.data.get(option));\n }\n }, {\n key: \"_number\",\n value: function _number(option) {\n return parseInt(this.data.get(option));\n }\n }, {\n key: \"_arrayOrString\",\n value: function _arrayOrString(option) {\n const val = this.data.get(option);\n\n try {\n return JSON.parse(val);\n } catch (e) {\n return val;\n }\n }\n }, {\n key: \"flatpickrElement\",\n get: function () {\n return this.hasInstanceTarget && this.instanceTarget || this.element;\n }\n }]);\n\n return StimulusFlatpickr;\n}(Controller);\n\n_defineProperty(StimulusFlatpickr, \"targets\", ['instance']);\n\nexport default StimulusFlatpickr;","export * from \"@stimulus/core\";","\"use strict\";\n\nvar isOldIE = function isOldIE() {\n var memo;\n return function memorize() {\n if (typeof memo === 'undefined') {\n // Test for IE <= 9 as proposed by Browserhacks\n // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n // Tests for existence of standard globals is to allow style-loader\n // to operate correctly into non-standard environments\n // @see https://github.com/webpack-contrib/style-loader/issues/177\n memo = Boolean(window && document && document.all && !window.atob);\n }\n\n return memo;\n };\n}();\n\nvar getTarget = function getTarget() {\n var memo = {};\n return function memorize(target) {\n if (typeof memo[target] === 'undefined') {\n var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n\n memo[target] = styleTarget;\n }\n\n return memo[target];\n };\n}();\n\nvar stylesInDom = [];\n\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n\n for (var i = 0; i < stylesInDom.length; i++) {\n if (stylesInDom[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n\n return result;\n}\n\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var index = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3]\n };\n\n if (index !== -1) {\n stylesInDom[index].references++;\n stylesInDom[index].updater(obj);\n } else {\n stylesInDom.push({\n identifier: identifier,\n updater: addStyle(obj, options),\n references: 1\n });\n }\n\n identifiers.push(identifier);\n }\n\n return identifiers;\n}\n\nfunction insertStyleElement(options) {\n var style = document.createElement('style');\n var attributes = options.attributes || {};\n\n if (typeof attributes.nonce === 'undefined') {\n var nonce = typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;\n\n if (nonce) {\n attributes.nonce = nonce;\n }\n }\n\n Object.keys(attributes).forEach(function (key) {\n style.setAttribute(key, attributes[key]);\n });\n\n if (typeof options.insert === 'function') {\n options.insert(style);\n } else {\n var target = getTarget(options.insert || 'head');\n\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n\n target.appendChild(style);\n }\n\n return style;\n}\n\nfunction removeStyleElement(style) {\n // istanbul ignore if\n if (style.parentNode === null) {\n return false;\n }\n\n style.parentNode.removeChild(style);\n}\n/* istanbul ignore next */\n\n\nvar replaceText = function replaceText() {\n var textStore = [];\n return function replace(index, replacement) {\n textStore[index] = replacement;\n return textStore.filter(Boolean).join('\\n');\n };\n}();\n\nfunction applyToSingletonTag(style, index, remove, obj) {\n var css = remove ? '' : obj.media ? \"@media \".concat(obj.media, \" {\").concat(obj.css, \"}\") : obj.css; // For old IE\n\n /* istanbul ignore if */\n\n if (style.styleSheet) {\n style.styleSheet.cssText = replaceText(index, css);\n } else {\n var cssNode = document.createTextNode(css);\n var childNodes = style.childNodes;\n\n if (childNodes[index]) {\n style.removeChild(childNodes[index]);\n }\n\n if (childNodes.length) {\n style.insertBefore(cssNode, childNodes[index]);\n } else {\n style.appendChild(cssNode);\n }\n }\n}\n\nfunction applyToTag(style, options, obj) {\n var css = obj.css;\n var media = obj.media;\n var sourceMap = obj.sourceMap;\n\n if (media) {\n style.setAttribute('media', media);\n } else {\n style.removeAttribute('media');\n }\n\n if (sourceMap && typeof btoa !== 'undefined') {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n } // For old IE\n\n /* istanbul ignore if */\n\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n while (style.firstChild) {\n style.removeChild(style.firstChild);\n }\n\n style.appendChild(document.createTextNode(css));\n }\n}\n\nvar singleton = null;\nvar singletonCounter = 0;\n\nfunction addStyle(obj, options) {\n var style;\n var update;\n var remove;\n\n if (options.singleton) {\n var styleIndex = singletonCounter++;\n style = singleton || (singleton = insertStyleElement(options));\n update = applyToSingletonTag.bind(null, style, styleIndex, false);\n remove = applyToSingletonTag.bind(null, style, styleIndex, true);\n } else {\n style = insertStyleElement(options);\n update = applyToTag.bind(null, style, options);\n\n remove = function remove() {\n removeStyleElement(style);\n };\n }\n\n update(obj);\n return function updateStyle(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {\n return;\n }\n\n update(obj = newObj);\n } else {\n remove();\n }\n };\n}\n\nmodule.exports = function (list, options) {\n options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of