{"version":3,"file":"js/application-9771cc7d17534dca27c0.js","sources":["webpack:///webpack/bootstrap","webpack:////home/deploy/safetymen/shared/node_modules/@glidejs/glide/dist/glide.esm.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/index.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/action.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/action_descriptor.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/application.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/binding.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/binding_observer.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/context.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/controller.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/data_map.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/definition.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/dispatcher.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/event_listener.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/module.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/router.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/schema.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/scope.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/scope_observer.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/selectors.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/target_properties.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/core/dist/src/target_set.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/multimap/dist/index.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/multimap/dist/src/indexed_multimap.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/multimap/dist/src/multimap.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/multimap/dist/src/set_operations.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/mutation-observers/dist/index.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/mutation-observers/dist/src/attribute_observer.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/mutation-observers/dist/src/element_observer.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/mutation-observers/dist/src/token_list_observer.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/mutation-observers/dist/src/value_list_observer.js","webpack:////home/deploy/safetymen/shared/node_modules/@stimulus/webpack-helpers/dist/index.js","webpack:////home/deploy/safetymen/shared/node_modules/activestorage/app/assets/javascripts/activestorage.js","webpack:////home/deploy/safetymen/shared/node_modules/flatpickr/dist/esm/index.js","webpack:////home/deploy/safetymen/shared/node_modules/flatpickr/dist/esm/l10n/default.js","webpack:////home/deploy/safetymen/shared/node_modules/flatpickr/dist/esm/types/options.js","webpack:////home/deploy/safetymen/shared/node_modules/flatpickr/dist/esm/utils/dates.js","webpack:////home/deploy/safetymen/shared/node_modules/flatpickr/dist/esm/utils/dom.js","webpack:////home/deploy/safetymen/shared/node_modules/flatpickr/dist/esm/utils/formatting.js","webpack:////home/deploy/safetymen/shared/node_modules/flatpickr/dist/esm/utils/index.js","webpack:////home/deploy/safetymen/shared/node_modules/flatpickr/dist/esm/utils/polyfills.js","webpack:////home/deploy/safetymen/shared/node_modules/flatpickr/dist/themes/dark.css","webpack:////home/deploy/safetymen/shared/node_modules/rails-ujs/lib/assets/compiled/rails-ujs.js","webpack:////home/deploy/safetymen/shared/node_modules/stimulus-flatpickr/dist/index.m.js","webpack:////home/deploy/safetymen/shared/node_modules/stimulus-rails-nested-form/dist/stimulus-rails-nested-form.es.js","webpack:////home/deploy/safetymen/shared/node_modules/stimulus/index.js","webpack:////home/deploy/safetymen/shared/node_modules/stimulus/webpack-helpers.js","webpack:////home/deploy/safetymen/shared/node_modules/sweet-scroll/sweet-scroll.js","webpack:////home/deploy/safetymen/shared/node_modules/turbolinks/dist/turbolinks.js","webpack:///./app/javascript/controllers sync _controller\\.js$","webpack:///./app/javascript/controllers/autocomplete_controller.js","webpack:///./app/javascript/controllers/booking_controller.js","webpack:///./app/javascript/controllers/clients_slider_controller.js","webpack:///./app/javascript/controllers/courses_slider_controller.js","webpack:///./app/javascript/controllers/draft_controller.js","webpack:///./app/javascript/controllers/filter_controller.js","webpack:///./app/javascript/controllers/flatpickr_controller.js","webpack:///./app/javascript/controllers/index.js","webpack:///./app/javascript/controllers/learner_controller.js","webpack:///./app/javascript/controllers/menu_controller.js","webpack:///./app/javascript/controllers/multi_date_controller.js","webpack:///./app/javascript/controllers/popup_controller.js","webpack:///./app/javascript/controllers/submenu_controller.js","webpack:///./app/javascript/css/application.scss?4759","webpack:///./app/javascript/images sync ^\\.\\/.*$","webpack:///./app/javascript/images/banner-about.png","webpack:///./app/javascript/images/banner.png","webpack:///./app/javascript/images/certificate-lg.png","webpack:///./app/javascript/images/certificate.png","webpack:///./app/javascript/images/cipd.svg","webpack:///./app/javascript/images/citb.svg","webpack:///./app/javascript/images/consultancy-cost-white.svg","webpack:///./app/javascript/images/consultancy-cost.svg","webpack:///./app/javascript/images/consultancy-image.png","webpack:///./app/javascript/images/face-fit.jpg","webpack:///./app/javascript/images/favicon.png","webpack:///./app/javascript/images/hand-arm-and-noise-assessments.jpg","webpack:///./app/javascript/images/iatp.png","webpack:///./app/javascript/images/industrial-workers.png","webpack:///./app/javascript/images/iosh.svg","webpack:///./app/javascript/images/ipaf-poster.jpeg","webpack:///./app/javascript/images/ipaf.svg","webpack:///./app/javascript/images/ipaf_1b.png","webpack:///./app/javascript/images/ipaf_3a.png","webpack:///./app/javascript/images/ipaf_3b.png","webpack:///./app/javascript/images/logo.svg","webpack:///./app/javascript/images/pasma-logo.jpg","webpack:///./app/javascript/images/placeholder-news-image.jpg","webpack:///./app/javascript/images/placeholder-review-avatar.png","webpack:///./app/javascript/images/psma.svg","webpack:///./app/javascript/images/safety-men-hivis.png","webpack:///./app/javascript/images/times.svg","webpack:///./app/javascript/images/training-image.png","webpack:///./app/javascript/packs/application.js","webpack:///./app/javascript/packs/scripts/ga-page-tracking.js"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/packs/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./app/javascript/packs/application.js\");\n","/*!\n * Glide.js v3.6.0\n * (c) 2013-2022 Jędrzej Chałubek (https://github.com/jedrzejchalubek/)\n * Released under the MIT License.\n */\n\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n return _typeof(obj);\n}\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\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}\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\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 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}\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}\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\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 try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\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 return self;\n}\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n return _assertThisInitialized(self);\n}\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n return _possibleConstructorReturn(this, result);\n };\n}\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n return object;\n}\nfunction _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get;\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n return desc.value;\n };\n }\n return _get.apply(this, arguments);\n}\nvar defaults = {\n /**\n * Type of the movement.\n *\n * Available types:\n * `slider` - Rewinds slider to the start/end when it reaches the first or last slide.\n * `carousel` - Changes slides without starting over when it reaches the first or last slide.\n *\n * @type {String}\n */\n type: 'slider',\n /**\n * Start at specific slide number defined with zero-based index.\n *\n * @type {Number}\n */\n startAt: 0,\n /**\n * A number of slides visible on the single viewport.\n *\n * @type {Number}\n */\n perView: 1,\n /**\n * Focus currently active slide at a specified position in the track.\n *\n * Available inputs:\n * `center` - Current slide will be always focused at the center of a track.\n * `0,1,2,3...` - Current slide will be focused on the specified zero-based index.\n *\n * @type {String|Number}\n */\n focusAt: 0,\n /**\n * A size of the gap added between slides.\n *\n * @type {Number}\n */\n gap: 10,\n /**\n * Change slides after a specified interval. Use `false` for turning off autoplay.\n *\n * @type {Number|Boolean}\n */\n autoplay: false,\n /**\n * Stop autoplay on mouseover event.\n *\n * @type {Boolean}\n */\n hoverpause: true,\n /**\n * Allow for changing slides with left and right keyboard arrows.\n *\n * @type {Boolean}\n */\n keyboard: true,\n /**\n * Stop running `perView` number of slides from the end. Use this\n * option if you don't want to have an empty space after\n * a slider. Works only with `slider` type and a\n * non-centered `focusAt` setting.\n *\n * @type {Boolean}\n */\n bound: false,\n /**\n * Minimal swipe distance needed to change the slide. Use `false` for turning off a swiping.\n *\n * @type {Number|Boolean}\n */\n swipeThreshold: 80,\n /**\n * Minimal mouse drag distance needed to change the slide. Use `false` for turning off a dragging.\n *\n * @type {Number|Boolean}\n */\n dragThreshold: 120,\n /**\n * A number of slides moved on single swipe.\n *\n * Available types:\n * `` - Moves slider by one slide per swipe\n * `|` - Moves slider between views per swipe (number of slides defined in `perView` options)\n *\n * @type {String}\n */\n perSwipe: '',\n /**\n * Moving distance ratio of the slides on a swiping and dragging.\n *\n * @type {Number}\n */\n touchRatio: 0.5,\n /**\n * Angle required to activate slides moving on swiping or dragging.\n *\n * @type {Number}\n */\n touchAngle: 45,\n /**\n * Duration of the animation in milliseconds.\n *\n * @type {Number}\n */\n animationDuration: 400,\n /**\n * Allows looping the `slider` type. Slider will rewind to the first/last slide when it's at the start/end.\n *\n * @type {Boolean}\n */\n rewind: true,\n /**\n * Duration of the rewinding animation of the `slider` type in milliseconds.\n *\n * @type {Number}\n */\n rewindDuration: 800,\n /**\n * Easing function for the animation.\n *\n * @type {String}\n */\n animationTimingFunc: 'cubic-bezier(.165, .840, .440, 1)',\n /**\n * Wait for the animation to finish until the next user input can be processed\n *\n * @type {boolean}\n */\n waitForTransition: true,\n /**\n * Throttle costly events at most once per every wait milliseconds.\n *\n * @type {Number}\n */\n throttle: 10,\n /**\n * Moving direction mode.\n *\n * Available inputs:\n * - 'ltr' - left to right movement,\n * - 'rtl' - right to left movement.\n *\n * @type {String}\n */\n direction: 'ltr',\n /**\n * The distance value of the next and previous viewports which\n * have to peek in the current view. Accepts number and\n * pixels as a string. Left and right peeking can be\n * set up separately with a directions object.\n *\n * For example:\n * `100` - Peek 100px on the both sides.\n * { before: 100, after: 50 }` - Peek 100px on the left side and 50px on the right side.\n *\n * @type {Number|String|Object}\n */\n peek: 0,\n /**\n * Defines how many clones of current viewport will be generated.\n *\n * @type {Number}\n */\n cloningRatio: 1,\n /**\n * Collection of options applied at specified media breakpoints.\n * For example: display two slides per view under 800px.\n * `{\n * '800px': {\n * perView: 2\n * }\n * }`\n */\n breakpoints: {},\n /**\n * Collection of internally used HTML classes.\n *\n * @todo Refactor `slider` and `carousel` properties to single `type: { slider: '', carousel: '' }` object\n * @type {Object}\n */\n classes: {\n swipeable: 'glide--swipeable',\n dragging: 'glide--dragging',\n direction: {\n ltr: 'glide--ltr',\n rtl: 'glide--rtl'\n },\n type: {\n slider: 'glide--slider',\n carousel: 'glide--carousel'\n },\n slide: {\n clone: 'glide__slide--clone',\n active: 'glide__slide--active'\n },\n arrow: {\n disabled: 'glide__arrow--disabled'\n },\n nav: {\n active: 'glide__bullet--active'\n }\n }\n};\n\n/**\n * Outputs warning message to the bowser console.\n *\n * @param {String} msg\n * @return {Void}\n */\nfunction warn(msg) {\n console.error(\"[Glide warn]: \".concat(msg));\n}\n\n/**\n * Converts value entered as number\n * or string to integer value.\n *\n * @param {String} value\n * @returns {Number}\n */\nfunction toInt(value) {\n return parseInt(value);\n}\n/**\n * Converts value entered as number\n * or string to flat value.\n *\n * @param {String} value\n * @returns {Number}\n */\n\nfunction toFloat(value) {\n return parseFloat(value);\n}\n/**\n * Indicates whether the specified value is a string.\n *\n * @param {*} value\n * @return {Boolean}\n */\n\nfunction isString(value) {\n return typeof value === 'string';\n}\n/**\n * Indicates whether the specified value is an object.\n *\n * @param {*} value\n * @return {Boolean}\n *\n * @see https://github.com/jashkenas/underscore\n */\n\nfunction isObject(value) {\n var type = _typeof(value);\n return type === 'function' || type === 'object' && !!value; // eslint-disable-line no-mixed-operators\n}\n/**\n * Indicates whether the specified value is a function.\n *\n * @param {*} value\n * @return {Boolean}\n */\n\nfunction isFunction(value) {\n return typeof value === 'function';\n}\n/**\n * Indicates whether the specified value is undefined.\n *\n * @param {*} value\n * @return {Boolean}\n */\n\nfunction isUndefined(value) {\n return typeof value === 'undefined';\n}\n/**\n * Indicates whether the specified value is an array.\n *\n * @param {*} value\n * @return {Boolean}\n */\n\nfunction isArray(value) {\n return value.constructor === Array;\n}\n\n/**\n * Creates and initializes specified collection of extensions.\n * Each extension receives access to instance of glide and rest of components.\n *\n * @param {Object} glide\n * @param {Object} extensions\n *\n * @returns {Object}\n */\n\nfunction mount(glide, extensions, events) {\n var components = {};\n for (var name in extensions) {\n if (isFunction(extensions[name])) {\n components[name] = extensions[name](glide, components, events);\n } else {\n warn('Extension must be a function');\n }\n }\n for (var _name in components) {\n if (isFunction(components[_name].mount)) {\n components[_name].mount();\n }\n }\n return components;\n}\n\n/**\n * Defines getter and setter property on the specified object.\n *\n * @param {Object} obj Object where property has to be defined.\n * @param {String} prop Name of the defined property.\n * @param {Object} definition Get and set definitions for the property.\n * @return {Void}\n */\nfunction define(obj, prop, definition) {\n Object.defineProperty(obj, prop, definition);\n}\n/**\n * Sorts aphabetically object keys.\n *\n * @param {Object} obj\n * @return {Object}\n */\n\nfunction sortKeys(obj) {\n return Object.keys(obj).sort().reduce(function (r, k) {\n r[k] = obj[k];\n return r[k], r;\n }, {});\n}\n/**\n * Merges passed settings object with default options.\n *\n * @param {Object} defaults\n * @param {Object} settings\n * @return {Object}\n */\n\nfunction mergeOptions(defaults, settings) {\n var options = Object.assign({}, defaults, settings); // `Object.assign` do not deeply merge objects, so we\n // have to do it manually for every nested object\n // in options. Although it does not look smart,\n // it's smaller and faster than some fancy\n // merging deep-merge algorithm script.\n\n if (settings.hasOwnProperty('classes')) {\n options.classes = Object.assign({}, defaults.classes, settings.classes);\n if (settings.classes.hasOwnProperty('direction')) {\n options.classes.direction = Object.assign({}, defaults.classes.direction, settings.classes.direction);\n }\n if (settings.classes.hasOwnProperty('type')) {\n options.classes.type = Object.assign({}, defaults.classes.type, settings.classes.type);\n }\n if (settings.classes.hasOwnProperty('slide')) {\n options.classes.slide = Object.assign({}, defaults.classes.slide, settings.classes.slide);\n }\n if (settings.classes.hasOwnProperty('arrow')) {\n options.classes.arrow = Object.assign({}, defaults.classes.arrow, settings.classes.arrow);\n }\n if (settings.classes.hasOwnProperty('nav')) {\n options.classes.nav = Object.assign({}, defaults.classes.nav, settings.classes.nav);\n }\n }\n if (settings.hasOwnProperty('breakpoints')) {\n options.breakpoints = Object.assign({}, defaults.breakpoints, settings.breakpoints);\n }\n return options;\n}\nvar EventsBus = /*#__PURE__*/function () {\n /**\n * Construct a EventBus instance.\n *\n * @param {Object} events\n */\n function EventsBus() {\n var events = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, EventsBus);\n this.events = events;\n this.hop = events.hasOwnProperty;\n }\n /**\n * Adds listener to the specifed event.\n *\n * @param {String|Array} event\n * @param {Function} handler\n */\n\n _createClass(EventsBus, [{\n key: \"on\",\n value: function on(event, handler) {\n if (isArray(event)) {\n for (var i = 0; i < event.length; i++) {\n this.on(event[i], handler);\n }\n return;\n } // Create the event's object if not yet created\n\n if (!this.hop.call(this.events, event)) {\n this.events[event] = [];\n } // Add the handler to queue\n\n var index = this.events[event].push(handler) - 1; // Provide handle back for removal of event\n\n return {\n remove: function remove() {\n delete this.events[event][index];\n }\n };\n }\n /**\n * Runs registered handlers for specified event.\n *\n * @param {String|Array} event\n * @param {Object=} context\n */\n }, {\n key: \"emit\",\n value: function emit(event, context) {\n if (isArray(event)) {\n for (var i = 0; i < event.length; i++) {\n this.emit(event[i], context);\n }\n return;\n } // If the event doesn't exist, or there's no handlers in queue, just leave\n\n if (!this.hop.call(this.events, event)) {\n return;\n } // Cycle through events queue, fire!\n\n this.events[event].forEach(function (item) {\n item(context || {});\n });\n }\n }]);\n return EventsBus;\n}();\nvar Glide$1 = /*#__PURE__*/function () {\n /**\r\n * Construct glide.\r\n *\r\n * @param {String} selector\r\n * @param {Object} options\r\n */\n function Glide(selector) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, Glide);\n this._c = {};\n this._t = [];\n this._e = new EventsBus();\n this.disabled = false;\n this.selector = selector;\n this.settings = mergeOptions(defaults, options);\n this.index = this.settings.startAt;\n }\n /**\r\n * Initializes glide.\r\n *\r\n * @param {Object} extensions Collection of extensions to initialize.\r\n * @return {Glide}\r\n */\n\n _createClass(Glide, [{\n key: \"mount\",\n value: function mount$1() {\n var extensions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this._e.emit('mount.before');\n if (isObject(extensions)) {\n this._c = mount(this, extensions, this._e);\n } else {\n warn('You need to provide a object on `mount()`');\n }\n this._e.emit('mount.after');\n return this;\n }\n /**\r\n * Collects an instance `translate` transformers.\r\n *\r\n * @param {Array} transformers Collection of transformers.\r\n * @return {Void}\r\n */\n }, {\n key: \"mutate\",\n value: function mutate() {\n var transformers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n if (isArray(transformers)) {\n this._t = transformers;\n } else {\n warn('You need to provide a array on `mutate()`');\n }\n return this;\n }\n /**\r\n * Updates glide with specified settings.\r\n *\r\n * @param {Object} settings\r\n * @return {Glide}\r\n */\n }, {\n key: \"update\",\n value: function update() {\n var settings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.settings = mergeOptions(this.settings, settings);\n if (settings.hasOwnProperty('startAt')) {\n this.index = settings.startAt;\n }\n this._e.emit('update');\n return this;\n }\n /**\r\n * Change slide with specified pattern. A pattern must be in the special format:\r\n * `>` - Move one forward\r\n * `<` - Move one backward\r\n * `={i}` - Go to {i} zero-based slide (eq. '=1', will go to second slide)\r\n * `>>` - Rewinds to end (last slide)\r\n * `<<` - Rewinds to start (first slide)\r\n * `|>` - Move one viewport forward\r\n * `|<` - Move one viewport backward\r\n *\r\n * @param {String} pattern\r\n * @return {Glide}\r\n */\n }, {\n key: \"go\",\n value: function go(pattern) {\n this._c.Run.make(pattern);\n return this;\n }\n /**\r\n * Move track by specified distance.\r\n *\r\n * @param {String} distance\r\n * @return {Glide}\r\n */\n }, {\n key: \"move\",\n value: function move(distance) {\n this._c.Transition.disable();\n this._c.Move.make(distance);\n return this;\n }\n /**\r\n * Destroy instance and revert all changes done by this._c.\r\n *\r\n * @return {Glide}\r\n */\n }, {\n key: \"destroy\",\n value: function destroy() {\n this._e.emit('destroy');\n return this;\n }\n /**\r\n * Start instance autoplaying.\r\n *\r\n * @param {Boolean|Number} interval Run autoplaying with passed interval regardless of `autoplay` settings\r\n * @return {Glide}\r\n */\n }, {\n key: \"play\",\n value: function play() {\n var interval = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n if (interval) {\n this.settings.autoplay = interval;\n }\n this._e.emit('play');\n return this;\n }\n /**\r\n * Stop instance autoplaying.\r\n *\r\n * @return {Glide}\r\n */\n }, {\n key: \"pause\",\n value: function pause() {\n this._e.emit('pause');\n return this;\n }\n /**\r\n * Sets glide into a idle status.\r\n *\r\n * @return {Glide}\r\n */\n }, {\n key: \"disable\",\n value: function disable() {\n this.disabled = true;\n return this;\n }\n /**\r\n * Sets glide into a active status.\r\n *\r\n * @return {Glide}\r\n */\n }, {\n key: \"enable\",\n value: function enable() {\n this.disabled = false;\n return this;\n }\n /**\r\n * Adds cuutom event listener with handler.\r\n *\r\n * @param {String|Array} event\r\n * @param {Function} handler\r\n * @return {Glide}\r\n */\n }, {\n key: \"on\",\n value: function on(event, handler) {\n this._e.on(event, handler);\n return this;\n }\n /**\r\n * Checks if glide is a precised type.\r\n *\r\n * @param {String} name\r\n * @return {Boolean}\r\n */\n }, {\n key: \"isType\",\n value: function isType(name) {\n return this.settings.type === name;\n }\n /**\r\n * Gets value of the core options.\r\n *\r\n * @return {Object}\r\n */\n }, {\n key: \"settings\",\n get: function get() {\n return this._o;\n }\n /**\r\n * Sets value of the core options.\r\n *\r\n * @param {Object} o\r\n * @return {Void}\r\n */,\n\n set: function set(o) {\n if (isObject(o)) {\n this._o = o;\n } else {\n warn('Options must be an `object` instance.');\n }\n }\n /**\r\n * Gets current index of the slider.\r\n *\r\n * @return {Object}\r\n */\n }, {\n key: \"index\",\n get: function get() {\n return this._i;\n }\n /**\r\n * Sets current index a slider.\r\n *\r\n * @return {Object}\r\n */,\n\n set: function set(i) {\n this._i = toInt(i);\n }\n /**\r\n * Gets type name of the slider.\r\n *\r\n * @return {String}\r\n */\n }, {\n key: \"type\",\n get: function get() {\n return this.settings.type;\n }\n /**\r\n * Gets value of the idle status.\r\n *\r\n * @return {Boolean}\r\n */\n }, {\n key: \"disabled\",\n get: function get() {\n return this._d;\n }\n /**\r\n * Sets value of the idle status.\r\n *\r\n * @return {Boolean}\r\n */,\n\n set: function set(status) {\n this._d = !!status;\n }\n }]);\n return Glide;\n}();\nfunction Run(Glide, Components, Events) {\n var Run = {\n /**\n * Initializes autorunning of the glide.\n *\n * @return {Void}\n */\n mount: function mount() {\n this._o = false;\n },\n /**\n * Makes glides running based on the passed moving schema.\n *\n * @param {String} move\n */\n make: function make(move) {\n var _this = this;\n if (!Glide.disabled) {\n !Glide.settings.waitForTransition || Glide.disable();\n this.move = move;\n Events.emit('run.before', this.move);\n this.calculate();\n Events.emit('run', this.move);\n Components.Transition.after(function () {\n if (_this.isStart()) {\n Events.emit('run.start', _this.move);\n }\n if (_this.isEnd()) {\n Events.emit('run.end', _this.move);\n }\n if (_this.isOffset()) {\n _this._o = false;\n Events.emit('run.offset', _this.move);\n }\n Events.emit('run.after', _this.move);\n Glide.enable();\n });\n }\n },\n /**\n * Calculates current index based on defined move.\n *\n * @return {Number|Undefined}\n */\n calculate: function calculate() {\n var move = this.move,\n length = this.length;\n var steps = move.steps,\n direction = move.direction; // By default assume that size of view is equal to one slide\n\n var viewSize = 1; // While direction is `=` we want jump to\n // a specified index described in steps.\n\n if (direction === '=') {\n // Check if bound is true, \n // as we want to avoid whitespaces.\n if (Glide.settings.bound && toInt(steps) > length) {\n Glide.index = length;\n return;\n }\n Glide.index = steps;\n return;\n } // When pattern is equal to `>>` we want\n // fast forward to the last slide.\n\n if (direction === '>' && steps === '>') {\n Glide.index = length;\n return;\n } // When pattern is equal to `<<` we want\n // fast forward to the first slide.\n\n if (direction === '<' && steps === '<') {\n Glide.index = 0;\n return;\n } // pagination movement\n\n if (direction === '|') {\n viewSize = Glide.settings.perView || 1;\n } // we are moving forward\n\n if (direction === '>' || direction === '|' && steps === '>') {\n var index = calculateForwardIndex(viewSize);\n if (index > length) {\n this._o = true;\n }\n Glide.index = normalizeForwardIndex(index, viewSize);\n return;\n } // we are moving backward\n\n if (direction === '<' || direction === '|' && steps === '<') {\n var _index = calculateBackwardIndex(viewSize);\n if (_index < 0) {\n this._o = true;\n }\n Glide.index = normalizeBackwardIndex(_index, viewSize);\n return;\n }\n warn(\"Invalid direction pattern [\".concat(direction).concat(steps, \"] has been used\"));\n },\n /**\n * Checks if we are on the first slide.\n *\n * @return {Boolean}\n */\n isStart: function isStart() {\n return Glide.index <= 0;\n },\n /**\n * Checks if we are on the last slide.\n *\n * @return {Boolean}\n */\n isEnd: function isEnd() {\n return Glide.index >= this.length;\n },\n /**\n * Checks if we are making a offset run.\n *\n * @param {String} direction\n * @return {Boolean}\n */\n isOffset: function isOffset() {\n var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;\n if (!direction) {\n return this._o;\n }\n if (!this._o) {\n return false;\n } // did we view to the right?\n\n if (direction === '|>') {\n return this.move.direction === '|' && this.move.steps === '>';\n } // did we view to the left?\n\n if (direction === '|<') {\n return this.move.direction === '|' && this.move.steps === '<';\n }\n return this.move.direction === direction;\n },\n /**\n * Checks if bound mode is active\n *\n * @return {Boolean}\n */\n isBound: function isBound() {\n return Glide.isType('slider') && Glide.settings.focusAt !== 'center' && Glide.settings.bound;\n }\n };\n /**\n * Returns index value to move forward/to the right\n *\n * @param viewSize\n * @returns {Number}\n */\n\n function calculateForwardIndex(viewSize) {\n var index = Glide.index;\n if (Glide.isType('carousel')) {\n return index + viewSize;\n }\n return index + (viewSize - index % viewSize);\n }\n /**\n * Normalizes the given forward index based on glide settings, preventing it to exceed certain boundaries\n *\n * @param index\n * @param length\n * @param viewSize\n * @returns {Number}\n */\n\n function normalizeForwardIndex(index, viewSize) {\n var length = Run.length;\n if (index <= length) {\n return index;\n }\n if (Glide.isType('carousel')) {\n return index - (length + 1);\n }\n if (Glide.settings.rewind) {\n // bound does funny things with the length, therefor we have to be certain\n // that we are on the last possible index value given by bound\n if (Run.isBound() && !Run.isEnd()) {\n return length;\n }\n return 0;\n }\n if (Run.isBound()) {\n return length;\n }\n return Math.floor(length / viewSize) * viewSize;\n }\n /**\n * Calculates index value to move backward/to the left\n *\n * @param viewSize\n * @returns {Number}\n */\n\n function calculateBackwardIndex(viewSize) {\n var index = Glide.index;\n if (Glide.isType('carousel')) {\n return index - viewSize;\n } // ensure our back navigation results in the same index as a forward navigation\n // to experience a homogeneous paging\n\n var view = Math.ceil(index / viewSize);\n return (view - 1) * viewSize;\n }\n /**\n * Normalizes the given backward index based on glide settings, preventing it to exceed certain boundaries\n *\n * @param index\n * @param length\n * @param viewSize\n * @returns {*}\n */\n\n function normalizeBackwardIndex(index, viewSize) {\n var length = Run.length;\n if (index >= 0) {\n return index;\n }\n if (Glide.isType('carousel')) {\n return index + (length + 1);\n }\n if (Glide.settings.rewind) {\n // bound does funny things with the length, therefor we have to be certain\n // that we are on first possible index value before we to rewind to the length given by bound\n if (Run.isBound() && Run.isStart()) {\n return length;\n }\n return Math.floor(length / viewSize) * viewSize;\n }\n return 0;\n }\n define(Run, 'move', {\n /**\n * Gets value of the move schema.\n *\n * @returns {Object}\n */\n get: function get() {\n return this._m;\n },\n /**\n * Sets value of the move schema.\n *\n * @returns {Object}\n */\n set: function set(value) {\n var step = value.substr(1);\n this._m = {\n direction: value.substr(0, 1),\n steps: step ? toInt(step) ? toInt(step) : step : 0\n };\n }\n });\n define(Run, 'length', {\n /**\n * Gets value of the running distance based\n * on zero-indexing number of slides.\n *\n * @return {Number}\n */\n get: function get() {\n var settings = Glide.settings;\n var length = Components.Html.slides.length; // If the `bound` option is active, a maximum running distance should be\n // reduced by `perView` and `focusAt` settings. Running distance\n // should end before creating an empty space after instance.\n\n if (this.isBound()) {\n return length - 1 - (toInt(settings.perView) - 1) + toInt(settings.focusAt);\n }\n return length - 1;\n }\n });\n define(Run, 'offset', {\n /**\n * Gets status of the offsetting flag.\n *\n * @return {Boolean}\n */\n get: function get() {\n return this._o;\n }\n });\n return Run;\n}\n\n/**\n * Returns a current time.\n *\n * @return {Number}\n */\nfunction now() {\n return new Date().getTime();\n}\n\n/**\n * Returns a function, that, when invoked, will only be triggered\n * at most once during a given window of time.\n *\n * @param {Function} func\n * @param {Number} wait\n * @param {Object=} options\n * @return {Function}\n *\n * @see https://github.com/jashkenas/underscore\n */\n\nfunction throttle(func, wait, options) {\n var timeout, context, args, result;\n var previous = 0;\n if (!options) options = {};\n var later = function later() {\n previous = options.leading === false ? 0 : now();\n timeout = null;\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n };\n var throttled = function throttled() {\n var at = now();\n if (!previous && options.leading === false) previous = at;\n var remaining = wait - (at - previous);\n context = this;\n args = arguments;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = at;\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n } else if (!timeout && options.trailing !== false) {\n timeout = setTimeout(later, remaining);\n }\n return result;\n };\n throttled.cancel = function () {\n clearTimeout(timeout);\n previous = 0;\n timeout = context = args = null;\n };\n return throttled;\n}\nvar MARGIN_TYPE = {\n ltr: ['marginLeft', 'marginRight'],\n rtl: ['marginRight', 'marginLeft']\n};\nfunction Gaps(Glide, Components, Events) {\n var Gaps = {\n /**\n * Applies gaps between slides. First and last\n * slides do not receive it's edge margins.\n *\n * @param {HTMLCollection} slides\n * @return {Void}\n */\n apply: function apply(slides) {\n for (var i = 0, len = slides.length; i < len; i++) {\n var style = slides[i].style;\n var direction = Components.Direction.value;\n if (i !== 0) {\n style[MARGIN_TYPE[direction][0]] = \"\".concat(this.value / 2, \"px\");\n } else {\n style[MARGIN_TYPE[direction][0]] = '';\n }\n if (i !== slides.length - 1) {\n style[MARGIN_TYPE[direction][1]] = \"\".concat(this.value / 2, \"px\");\n } else {\n style[MARGIN_TYPE[direction][1]] = '';\n }\n }\n },\n /**\n * Removes gaps from the slides.\n *\n * @param {HTMLCollection} slides\n * @returns {Void}\n */\n remove: function remove(slides) {\n for (var i = 0, len = slides.length; i < len; i++) {\n var style = slides[i].style;\n style.marginLeft = '';\n style.marginRight = '';\n }\n }\n };\n define(Gaps, 'value', {\n /**\n * Gets value of the gap.\n *\n * @returns {Number}\n */\n get: function get() {\n return toInt(Glide.settings.gap);\n }\n });\n define(Gaps, 'grow', {\n /**\n * Gets additional dimensions value caused by gaps.\n * Used to increase width of the slides wrapper.\n *\n * @returns {Number}\n */\n get: function get() {\n return Gaps.value * Components.Sizes.length;\n }\n });\n define(Gaps, 'reductor', {\n /**\n * Gets reduction value caused by gaps.\n * Used to subtract width of the slides.\n *\n * @returns {Number}\n */\n get: function get() {\n var perView = Glide.settings.perView;\n return Gaps.value * (perView - 1) / perView;\n }\n });\n /**\n * Apply calculated gaps:\n * - after building, so slides (including clones) will receive proper margins\n * - on updating via API, to recalculate gaps with new options\n */\n\n Events.on(['build.after', 'update'], throttle(function () {\n Gaps.apply(Components.Html.wrapper.children);\n }, 30));\n /**\n * Remove gaps:\n * - on destroying to bring markup to its inital state\n */\n\n Events.on('destroy', function () {\n Gaps.remove(Components.Html.wrapper.children);\n });\n return Gaps;\n}\n\n/**\n * Finds siblings nodes of the passed node.\n *\n * @param {Element} node\n * @return {Array}\n */\nfunction siblings(node) {\n if (node && node.parentNode) {\n var n = node.parentNode.firstChild;\n var matched = [];\n for (; n; n = n.nextSibling) {\n if (n.nodeType === 1 && n !== node) {\n matched.push(n);\n }\n }\n return matched;\n }\n return [];\n}\n/**\n * Checks if passed node exist and is a valid element.\n *\n * @param {Element} node\n * @return {Boolean}\n */\n\nfunction exist(node) {\n if (node && node instanceof window.HTMLElement) {\n return true;\n }\n return false;\n}\n/**\n * Coerces a NodeList to an Array.\n *\n * @param {NodeList} nodeList\n * @return {Array}\n */\n\nfunction toArray(nodeList) {\n return Array.prototype.slice.call(nodeList);\n}\nvar TRACK_SELECTOR = '[data-glide-el=\"track\"]';\nfunction Html(Glide, Components, Events) {\n var Html = {\n /**\n * Setup slider HTML nodes.\n *\n * @param {Glide} glide\n */\n mount: function mount() {\n this.root = Glide.selector;\n this.track = this.root.querySelector(TRACK_SELECTOR);\n this.collectSlides();\n },\n /**\n * Collect slides\n */\n collectSlides: function collectSlides() {\n this.slides = toArray(this.wrapper.children).filter(function (slide) {\n return !slide.classList.contains(Glide.settings.classes.slide.clone);\n });\n }\n };\n define(Html, 'root', {\n /**\n * Gets node of the glide main element.\n *\n * @return {Object}\n */\n get: function get() {\n return Html._r;\n },\n /**\n * Sets node of the glide main element.\n *\n * @return {Object}\n */\n set: function set(r) {\n if (isString(r)) {\n r = document.querySelector(r);\n }\n if (exist(r)) {\n Html._r = r;\n } else {\n warn('Root element must be a existing Html node');\n }\n }\n });\n define(Html, 'track', {\n /**\n * Gets node of the glide track with slides.\n *\n * @return {Object}\n */\n get: function get() {\n return Html._t;\n },\n /**\n * Sets node of the glide track with slides.\n *\n * @return {Object}\n */\n set: function set(t) {\n if (exist(t)) {\n Html._t = t;\n } else {\n warn(\"Could not find track element. Please use \".concat(TRACK_SELECTOR, \" attribute.\"));\n }\n }\n });\n define(Html, 'wrapper', {\n /**\n * Gets node of the slides wrapper.\n *\n * @return {Object}\n */\n get: function get() {\n return Html.track.children[0];\n }\n });\n /**\n * Add/remove/reorder dynamic slides\n */\n\n Events.on('update', function () {\n Html.collectSlides();\n });\n return Html;\n}\nfunction Peek(Glide, Components, Events) {\n var Peek = {\n /**\n * Setups how much to peek based on settings.\n *\n * @return {Void}\n */\n mount: function mount() {\n this.value = Glide.settings.peek;\n }\n };\n define(Peek, 'value', {\n /**\n * Gets value of the peek.\n *\n * @returns {Number|Object}\n */\n get: function get() {\n return Peek._v;\n },\n /**\n * Sets value of the peek.\n *\n * @param {Number|Object} value\n * @return {Void}\n */\n set: function set(value) {\n if (isObject(value)) {\n value.before = toInt(value.before);\n value.after = toInt(value.after);\n } else {\n value = toInt(value);\n }\n Peek._v = value;\n }\n });\n define(Peek, 'reductor', {\n /**\n * Gets reduction value caused by peek.\n *\n * @returns {Number}\n */\n get: function get() {\n var value = Peek.value;\n var perView = Glide.settings.perView;\n if (isObject(value)) {\n return value.before / perView + value.after / perView;\n }\n return value * 2 / perView;\n }\n });\n /**\n * Recalculate peeking sizes on:\n * - when resizing window to update to proper percents\n */\n\n Events.on(['resize', 'update'], function () {\n Peek.mount();\n });\n return Peek;\n}\nfunction Move(Glide, Components, Events) {\n var Move = {\n /**\n * Constructs move component.\n *\n * @returns {Void}\n */\n mount: function mount() {\n this._o = 0;\n },\n /**\n * Calculates a movement value based on passed offset and currently active index.\n *\n * @param {Number} offset\n * @return {Void}\n */\n make: function make() {\n var _this = this;\n var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n this.offset = offset;\n Events.emit('move', {\n movement: this.value\n });\n Components.Transition.after(function () {\n Events.emit('move.after', {\n movement: _this.value\n });\n });\n }\n };\n define(Move, 'offset', {\n /**\n * Gets an offset value used to modify current translate.\n *\n * @return {Object}\n */\n get: function get() {\n return Move._o;\n },\n /**\n * Sets an offset value used to modify current translate.\n *\n * @return {Object}\n */\n set: function set(value) {\n Move._o = !isUndefined(value) ? toInt(value) : 0;\n }\n });\n define(Move, 'translate', {\n /**\n * Gets a raw movement value.\n *\n * @return {Number}\n */\n get: function get() {\n return Components.Sizes.slideWidth * Glide.index;\n }\n });\n define(Move, 'value', {\n /**\n * Gets an actual movement value corrected by offset.\n *\n * @return {Number}\n */\n get: function get() {\n var offset = this.offset;\n var translate = this.translate;\n if (Components.Direction.is('rtl')) {\n return translate + offset;\n }\n return translate - offset;\n }\n });\n /**\n * Make movement to proper slide on:\n * - before build, so glide will start at `startAt` index\n * - on each standard run to move to newly calculated index\n */\n\n Events.on(['build.before', 'run'], function () {\n Move.make();\n });\n return Move;\n}\nfunction Sizes(Glide, Components, Events) {\n var Sizes = {\n /**\n * Setups dimensions of slides.\n *\n * @return {Void}\n */\n setupSlides: function setupSlides() {\n var width = \"\".concat(this.slideWidth, \"px\");\n var slides = Components.Html.slides;\n for (var i = 0; i < slides.length; i++) {\n slides[i].style.width = width;\n }\n },\n /**\n * Setups dimensions of slides wrapper.\n *\n * @return {Void}\n */\n setupWrapper: function setupWrapper() {\n Components.Html.wrapper.style.width = \"\".concat(this.wrapperSize, \"px\");\n },\n /**\n * Removes applied styles from HTML elements.\n *\n * @returns {Void}\n */\n remove: function remove() {\n var slides = Components.Html.slides;\n for (var i = 0; i < slides.length; i++) {\n slides[i].style.width = '';\n }\n Components.Html.wrapper.style.width = '';\n }\n };\n define(Sizes, 'length', {\n /**\n * Gets count number of the slides.\n *\n * @return {Number}\n */\n get: function get() {\n return Components.Html.slides.length;\n }\n });\n define(Sizes, 'width', {\n /**\n * Gets width value of the slider (visible area).\n *\n * @return {Number}\n */\n get: function get() {\n return Components.Html.track.offsetWidth;\n }\n });\n define(Sizes, 'wrapperSize', {\n /**\n * Gets size of the slides wrapper.\n *\n * @return {Number}\n */\n get: function get() {\n return Sizes.slideWidth * Sizes.length + Components.Gaps.grow + Components.Clones.grow;\n }\n });\n define(Sizes, 'slideWidth', {\n /**\n * Gets width value of a single slide.\n *\n * @return {Number}\n */\n get: function get() {\n return Sizes.width / Glide.settings.perView - Components.Peek.reductor - Components.Gaps.reductor;\n }\n });\n /**\n * Apply calculated glide's dimensions:\n * - before building, so other dimensions (e.g. translate) will be calculated propertly\n * - when resizing window to recalculate sildes dimensions\n * - on updating via API, to calculate dimensions based on new options\n */\n\n Events.on(['build.before', 'resize', 'update'], function () {\n Sizes.setupSlides();\n Sizes.setupWrapper();\n });\n /**\n * Remove calculated glide's dimensions:\n * - on destoting to bring markup to its inital state\n */\n\n Events.on('destroy', function () {\n Sizes.remove();\n });\n return Sizes;\n}\nfunction Build(Glide, Components, Events) {\n var Build = {\n /**\n * Init glide building. Adds classes, sets\n * dimensions and setups initial state.\n *\n * @return {Void}\n */\n mount: function mount() {\n Events.emit('build.before');\n this.typeClass();\n this.activeClass();\n Events.emit('build.after');\n },\n /**\n * Adds `type` class to the glide element.\n *\n * @return {Void}\n */\n typeClass: function typeClass() {\n Components.Html.root.classList.add(Glide.settings.classes.type[Glide.settings.type]);\n },\n /**\n * Sets active class to current slide.\n *\n * @return {Void}\n */\n activeClass: function activeClass() {\n var classes = Glide.settings.classes;\n var slide = Components.Html.slides[Glide.index];\n if (slide) {\n slide.classList.add(classes.slide.active);\n siblings(slide).forEach(function (sibling) {\n sibling.classList.remove(classes.slide.active);\n });\n }\n },\n /**\n * Removes HTML classes applied at building.\n *\n * @return {Void}\n */\n removeClasses: function removeClasses() {\n var _Glide$settings$class = Glide.settings.classes,\n type = _Glide$settings$class.type,\n slide = _Glide$settings$class.slide;\n Components.Html.root.classList.remove(type[Glide.settings.type]);\n Components.Html.slides.forEach(function (sibling) {\n sibling.classList.remove(slide.active);\n });\n }\n };\n /**\n * Clear building classes:\n * - on destroying to bring HTML to its initial state\n * - on updating to remove classes before remounting component\n */\n\n Events.on(['destroy', 'update'], function () {\n Build.removeClasses();\n });\n /**\n * Remount component:\n * - on resizing of the window to calculate new dimensions\n * - on updating settings via API\n */\n\n Events.on(['resize', 'update'], function () {\n Build.mount();\n });\n /**\n * Swap active class of current slide:\n * - after each move to the new index\n */\n\n Events.on('move.after', function () {\n Build.activeClass();\n });\n return Build;\n}\nfunction Clones(Glide, Components, Events) {\n var Clones = {\n /**\n * Create pattern map and collect slides to be cloned.\n */\n mount: function mount() {\n this.items = [];\n if (Glide.isType('carousel')) {\n this.items = this.collect();\n }\n },\n /**\n * Collect clones with pattern.\n *\n * @return {[]}\n */\n collect: function collect() {\n var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var slides = Components.Html.slides;\n var _Glide$settings = Glide.settings,\n perView = _Glide$settings.perView,\n classes = _Glide$settings.classes,\n cloningRatio = _Glide$settings.cloningRatio;\n if (slides.length !== 0) {\n var peekIncrementer = +!!Glide.settings.peek;\n var cloneCount = perView + peekIncrementer + Math.round(perView / 2);\n var append = slides.slice(0, cloneCount).reverse();\n var prepend = slides.slice(cloneCount * -1);\n for (var r = 0; r < Math.max(cloningRatio, Math.floor(perView / slides.length)); r++) {\n for (var i = 0; i < append.length; i++) {\n var clone = append[i].cloneNode(true);\n clone.classList.add(classes.slide.clone);\n items.push(clone);\n }\n for (var _i = 0; _i < prepend.length; _i++) {\n var _clone = prepend[_i].cloneNode(true);\n _clone.classList.add(classes.slide.clone);\n items.unshift(_clone);\n }\n }\n }\n return items;\n },\n /**\n * Append cloned slides with generated pattern.\n *\n * @return {Void}\n */\n append: function append() {\n var items = this.items;\n var _Components$Html = Components.Html,\n wrapper = _Components$Html.wrapper,\n slides = _Components$Html.slides;\n var half = Math.floor(items.length / 2);\n var prepend = items.slice(0, half).reverse();\n var append = items.slice(half * -1).reverse();\n var width = \"\".concat(Components.Sizes.slideWidth, \"px\");\n for (var i = 0; i < append.length; i++) {\n wrapper.appendChild(append[i]);\n }\n for (var _i2 = 0; _i2 < prepend.length; _i2++) {\n wrapper.insertBefore(prepend[_i2], slides[0]);\n }\n for (var _i3 = 0; _i3 < items.length; _i3++) {\n items[_i3].style.width = width;\n }\n },\n /**\n * Remove all cloned slides.\n *\n * @return {Void}\n */\n remove: function remove() {\n var items = this.items;\n for (var i = 0; i < items.length; i++) {\n Components.Html.wrapper.removeChild(items[i]);\n }\n }\n };\n define(Clones, 'grow', {\n /**\n * Gets additional dimensions value caused by clones.\n *\n * @return {Number}\n */\n get: function get() {\n return (Components.Sizes.slideWidth + Components.Gaps.value) * Clones.items.length;\n }\n });\n /**\n * Append additional slide's clones:\n * - while glide's type is `carousel`\n */\n\n Events.on('update', function () {\n Clones.remove();\n Clones.mount();\n Clones.append();\n });\n /**\n * Append additional slide's clones:\n * - while glide's type is `carousel`\n */\n\n Events.on('build.before', function () {\n if (Glide.isType('carousel')) {\n Clones.append();\n }\n });\n /**\n * Remove clones HTMLElements:\n * - on destroying, to bring HTML to its initial state\n */\n\n Events.on('destroy', function () {\n Clones.remove();\n });\n return Clones;\n}\nvar EventsBinder = /*#__PURE__*/function () {\n /**\n * Construct a EventsBinder instance.\n */\n function EventsBinder() {\n var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, EventsBinder);\n this.listeners = listeners;\n }\n /**\n * Adds events listeners to arrows HTML elements.\n *\n * @param {String|Array} events\n * @param {Element|Window|Document} el\n * @param {Function} closure\n * @param {Boolean|Object} capture\n * @return {Void}\n */\n\n _createClass(EventsBinder, [{\n key: \"on\",\n value: function on(events, el, closure) {\n var capture = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n if (isString(events)) {\n events = [events];\n }\n for (var i = 0; i < events.length; i++) {\n this.listeners[events[i]] = closure;\n el.addEventListener(events[i], this.listeners[events[i]], capture);\n }\n }\n /**\n * Removes event listeners from arrows HTML elements.\n *\n * @param {String|Array} events\n * @param {Element|Window|Document} el\n * @param {Boolean|Object} capture\n * @return {Void}\n */\n }, {\n key: \"off\",\n value: function off(events, el) {\n var capture = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n if (isString(events)) {\n events = [events];\n }\n for (var i = 0; i < events.length; i++) {\n el.removeEventListener(events[i], this.listeners[events[i]], capture);\n }\n }\n /**\n * Destroy collected listeners.\n *\n * @returns {Void}\n */\n }, {\n key: \"destroy\",\n value: function destroy() {\n delete this.listeners;\n }\n }]);\n return EventsBinder;\n}();\nfunction Resize(Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n var Resize = {\n /**\n * Initializes window bindings.\n */\n mount: function mount() {\n this.bind();\n },\n /**\n * Binds `rezsize` listener to the window.\n * It's a costly event, so we are debouncing it.\n *\n * @return {Void}\n */\n bind: function bind() {\n Binder.on('resize', window, throttle(function () {\n Events.emit('resize');\n }, Glide.settings.throttle));\n },\n /**\n * Unbinds listeners from the window.\n *\n * @return {Void}\n */\n unbind: function unbind() {\n Binder.off('resize', window);\n }\n };\n /**\n * Remove bindings from window:\n * - on destroying, to remove added EventListener\n */\n\n Events.on('destroy', function () {\n Resize.unbind();\n Binder.destroy();\n });\n return Resize;\n}\nvar VALID_DIRECTIONS = ['ltr', 'rtl'];\nvar FLIPED_MOVEMENTS = {\n '>': '<',\n '<': '>',\n '=': '='\n};\nfunction Direction(Glide, Components, Events) {\n var Direction = {\n /**\n * Setups gap value based on settings.\n *\n * @return {Void}\n */\n mount: function mount() {\n this.value = Glide.settings.direction;\n },\n /**\n * Resolves pattern based on direction value\n *\n * @param {String} pattern\n * @returns {String}\n */\n resolve: function resolve(pattern) {\n var token = pattern.slice(0, 1);\n if (this.is('rtl')) {\n return pattern.split(token).join(FLIPED_MOVEMENTS[token]);\n }\n return pattern;\n },\n /**\n * Checks value of direction mode.\n *\n * @param {String} direction\n * @returns {Boolean}\n */\n is: function is(direction) {\n return this.value === direction;\n },\n /**\n * Applies direction class to the root HTML element.\n *\n * @return {Void}\n */\n addClass: function addClass() {\n Components.Html.root.classList.add(Glide.settings.classes.direction[this.value]);\n },\n /**\n * Removes direction class from the root HTML element.\n *\n * @return {Void}\n */\n removeClass: function removeClass() {\n Components.Html.root.classList.remove(Glide.settings.classes.direction[this.value]);\n }\n };\n define(Direction, 'value', {\n /**\n * Gets value of the direction.\n *\n * @returns {Number}\n */\n get: function get() {\n return Direction._v;\n },\n /**\n * Sets value of the direction.\n *\n * @param {String} value\n * @return {Void}\n */\n set: function set(value) {\n if (VALID_DIRECTIONS.indexOf(value) > -1) {\n Direction._v = value;\n } else {\n warn('Direction value must be `ltr` or `rtl`');\n }\n }\n });\n /**\n * Clear direction class:\n * - on destroy to bring HTML to its initial state\n * - on update to remove class before reappling bellow\n */\n\n Events.on(['destroy', 'update'], function () {\n Direction.removeClass();\n });\n /**\n * Remount component:\n * - on update to reflect changes in direction value\n */\n\n Events.on('update', function () {\n Direction.mount();\n });\n /**\n * Apply direction class:\n * - before building to apply class for the first time\n * - on updating to reapply direction class that may changed\n */\n\n Events.on(['build.before', 'update'], function () {\n Direction.addClass();\n });\n return Direction;\n}\n\n/**\n * Reflects value of glide movement.\n *\n * @param {Object} Glide\n * @param {Object} Components\n * @return {Object}\n */\nfunction Rtl(Glide, Components) {\n return {\n /**\n * Negates the passed translate if glide is in RTL option.\n *\n * @param {Number} translate\n * @return {Number}\n */\n modify: function modify(translate) {\n if (Components.Direction.is('rtl')) {\n return -translate;\n }\n return translate;\n }\n };\n}\n\n/**\n * Updates glide movement with a `gap` settings.\n *\n * @param {Object} Glide\n * @param {Object} Components\n * @return {Object}\n */\nfunction Gap(Glide, Components) {\n return {\n /**\n * Modifies passed translate value with number in the `gap` settings.\n *\n * @param {Number} translate\n * @return {Number}\n */\n modify: function modify(translate) {\n var multiplier = Math.floor(translate / Components.Sizes.slideWidth);\n return translate + Components.Gaps.value * multiplier;\n }\n };\n}\n\n/**\n * Updates glide movement with width of additional clones width.\n *\n * @param {Object} Glide\n * @param {Object} Components\n * @return {Object}\n */\nfunction Grow(Glide, Components) {\n return {\n /**\n * Adds to the passed translate width of the half of clones.\n *\n * @param {Number} translate\n * @return {Number}\n */\n modify: function modify(translate) {\n return translate + Components.Clones.grow / 2;\n }\n };\n}\n\n/**\n * Updates glide movement with a `peek` settings.\n *\n * @param {Object} Glide\n * @param {Object} Components\n * @return {Object}\n */\n\nfunction Peeking(Glide, Components) {\n return {\n /**\n * Modifies passed translate value with a `peek` setting.\n *\n * @param {Number} translate\n * @return {Number}\n */\n modify: function modify(translate) {\n if (Glide.settings.focusAt >= 0) {\n var peek = Components.Peek.value;\n if (isObject(peek)) {\n return translate - peek.before;\n }\n return translate - peek;\n }\n return translate;\n }\n };\n}\n\n/**\n * Updates glide movement with a `focusAt` settings.\n *\n * @param {Object} Glide\n * @param {Object} Components\n * @return {Object}\n */\nfunction Focusing(Glide, Components) {\n return {\n /**\n * Modifies passed translate value with index in the `focusAt` setting.\n *\n * @param {Number} translate\n * @return {Number}\n */\n modify: function modify(translate) {\n var gap = Components.Gaps.value;\n var width = Components.Sizes.width;\n var focusAt = Glide.settings.focusAt;\n var slideWidth = Components.Sizes.slideWidth;\n if (focusAt === 'center') {\n return translate - (width / 2 - slideWidth / 2);\n }\n return translate - slideWidth * focusAt - gap * focusAt;\n }\n };\n}\n\n/**\n * Applies diffrent transformers on translate value.\n *\n * @param {Object} Glide\n * @param {Object} Components\n * @return {Object}\n */\n\nfunction mutator(Glide, Components, Events) {\n /**\n * Merge instance transformers with collection of default transformers.\n * It's important that the Rtl component be last on the list,\n * so it reflects all previous transformations.\n *\n * @type {Array}\n */\n var TRANSFORMERS = [Gap, Grow, Peeking, Focusing].concat(Glide._t, [Rtl]);\n return {\n /**\n * Piplines translate value with registered transformers.\n *\n * @param {Number} translate\n * @return {Number}\n */\n mutate: function mutate(translate) {\n for (var i = 0; i < TRANSFORMERS.length; i++) {\n var transformer = TRANSFORMERS[i];\n if (isFunction(transformer) && isFunction(transformer().modify)) {\n translate = transformer(Glide, Components, Events).modify(translate);\n } else {\n warn('Transformer should be a function that returns an object with `modify()` method');\n }\n }\n return translate;\n }\n };\n}\nfunction Translate(Glide, Components, Events) {\n var Translate = {\n /**\n * Sets value of translate on HTML element.\n *\n * @param {Number} value\n * @return {Void}\n */\n set: function set(value) {\n var transform = mutator(Glide, Components).mutate(value);\n var translate3d = \"translate3d(\".concat(-1 * transform, \"px, 0px, 0px)\");\n Components.Html.wrapper.style.mozTransform = translate3d; // needed for supported Firefox 10-15\n\n Components.Html.wrapper.style.webkitTransform = translate3d; // needed for supported Chrome 10-35, Safari 5.1-8, and Opera 15-22\n\n Components.Html.wrapper.style.transform = translate3d;\n },\n /**\n * Removes value of translate from HTML element.\n *\n * @return {Void}\n */\n remove: function remove() {\n Components.Html.wrapper.style.transform = '';\n },\n /**\n * @return {number}\n */\n getStartIndex: function getStartIndex() {\n var length = Components.Sizes.length;\n var index = Glide.index;\n var perView = Glide.settings.perView;\n if (Components.Run.isOffset('>') || Components.Run.isOffset('|>')) {\n return length + (index - perView);\n } // \"modulo length\" converts an index that equals length to zero\n\n return (index + perView) % length;\n },\n /**\n * @return {number}\n */\n getTravelDistance: function getTravelDistance() {\n var travelDistance = Components.Sizes.slideWidth * Glide.settings.perView;\n if (Components.Run.isOffset('>') || Components.Run.isOffset('|>')) {\n // reverse travel distance so that we don't have to change subtract operations\n return travelDistance * -1;\n }\n return travelDistance;\n }\n };\n /**\n * Set new translate value:\n * - on move to reflect index change\n * - on updating via API to reflect possible changes in options\n */\n\n Events.on('move', function (context) {\n if (!Glide.isType('carousel') || !Components.Run.isOffset()) {\n return Translate.set(context.movement);\n }\n Components.Transition.after(function () {\n Events.emit('translate.jump');\n Translate.set(Components.Sizes.slideWidth * Glide.index);\n });\n var startWidth = Components.Sizes.slideWidth * Components.Translate.getStartIndex();\n return Translate.set(startWidth - Components.Translate.getTravelDistance());\n });\n /**\n * Remove translate:\n * - on destroying to bring markup to its inital state\n */\n\n Events.on('destroy', function () {\n Translate.remove();\n });\n return Translate;\n}\nfunction Transition(Glide, Components, Events) {\n /**\n * Holds inactivity status of transition.\n * When true transition is not applied.\n *\n * @type {Boolean}\n */\n var disabled = false;\n var Transition = {\n /**\n * Composes string of the CSS transition.\n *\n * @param {String} property\n * @return {String}\n */\n compose: function compose(property) {\n var settings = Glide.settings;\n if (!disabled) {\n return \"\".concat(property, \" \").concat(this.duration, \"ms \").concat(settings.animationTimingFunc);\n }\n return \"\".concat(property, \" 0ms \").concat(settings.animationTimingFunc);\n },\n /**\n * Sets value of transition on HTML element.\n *\n * @param {String=} property\n * @return {Void}\n */\n set: function set() {\n var property = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';\n Components.Html.wrapper.style.transition = this.compose(property);\n },\n /**\n * Removes value of transition from HTML element.\n *\n * @return {Void}\n */\n remove: function remove() {\n Components.Html.wrapper.style.transition = '';\n },\n /**\n * Runs callback after animation.\n *\n * @param {Function} callback\n * @return {Void}\n */\n after: function after(callback) {\n setTimeout(function () {\n callback();\n }, this.duration);\n },\n /**\n * Enable transition.\n *\n * @return {Void}\n */\n enable: function enable() {\n disabled = false;\n this.set();\n },\n /**\n * Disable transition.\n *\n * @return {Void}\n */\n disable: function disable() {\n disabled = true;\n this.set();\n }\n };\n define(Transition, 'duration', {\n /**\n * Gets duration of the transition based\n * on currently running animation type.\n *\n * @return {Number}\n */\n get: function get() {\n var settings = Glide.settings;\n if (Glide.isType('slider') && Components.Run.offset) {\n return settings.rewindDuration;\n }\n return settings.animationDuration;\n }\n });\n /**\n * Set transition `style` value:\n * - on each moving, because it may be cleared by offset move\n */\n\n Events.on('move', function () {\n Transition.set();\n });\n /**\n * Disable transition:\n * - before initial build to avoid transitioning from `0` to `startAt` index\n * - while resizing window and recalculating dimensions\n * - on jumping from offset transition at start and end edges in `carousel` type\n */\n\n Events.on(['build.before', 'resize', 'translate.jump'], function () {\n Transition.disable();\n });\n /**\n * Enable transition:\n * - on each running, because it may be disabled by offset move\n */\n\n Events.on('run', function () {\n Transition.enable();\n });\n /**\n * Remove transition:\n * - on destroying to bring markup to its inital state\n */\n\n Events.on('destroy', function () {\n Transition.remove();\n });\n return Transition;\n}\n\n/**\n * Test via a getter in the options object to see\n * if the passive property is accessed.\n *\n * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection\n */\nvar supportsPassive = false;\ntry {\n var opts = Object.defineProperty({}, 'passive', {\n get: function get() {\n supportsPassive = true;\n }\n });\n window.addEventListener('testPassive', null, opts);\n window.removeEventListener('testPassive', null, opts);\n} catch (e) {}\nvar supportsPassive$1 = supportsPassive;\nvar START_EVENTS = ['touchstart', 'mousedown'];\nvar MOVE_EVENTS = ['touchmove', 'mousemove'];\nvar END_EVENTS = ['touchend', 'touchcancel', 'mouseup', 'mouseleave'];\nvar MOUSE_EVENTS = ['mousedown', 'mousemove', 'mouseup', 'mouseleave'];\nfunction Swipe(Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n var swipeSin = 0;\n var swipeStartX = 0;\n var swipeStartY = 0;\n var disabled = false;\n var capture = supportsPassive$1 ? {\n passive: true\n } : false;\n var Swipe = {\n /**\n * Initializes swipe bindings.\n *\n * @return {Void}\n */\n mount: function mount() {\n this.bindSwipeStart();\n },\n /**\n * Handler for `swipestart` event. Calculates entry points of the user's tap.\n *\n * @param {Object} event\n * @return {Void}\n */\n start: function start(event) {\n if (!disabled && !Glide.disabled) {\n this.disable();\n var swipe = this.touches(event);\n swipeSin = null;\n swipeStartX = toInt(swipe.pageX);\n swipeStartY = toInt(swipe.pageY);\n this.bindSwipeMove();\n this.bindSwipeEnd();\n Events.emit('swipe.start');\n }\n },\n /**\n * Handler for `swipemove` event. Calculates user's tap angle and distance.\n *\n * @param {Object} event\n */\n move: function move(event) {\n if (!Glide.disabled) {\n var _Glide$settings = Glide.settings,\n touchAngle = _Glide$settings.touchAngle,\n touchRatio = _Glide$settings.touchRatio,\n classes = _Glide$settings.classes;\n var swipe = this.touches(event);\n var subExSx = toInt(swipe.pageX) - swipeStartX;\n var subEySy = toInt(swipe.pageY) - swipeStartY;\n var powEX = Math.abs(subExSx << 2);\n var powEY = Math.abs(subEySy << 2);\n var swipeHypotenuse = Math.sqrt(powEX + powEY);\n var swipeCathetus = Math.sqrt(powEY);\n swipeSin = Math.asin(swipeCathetus / swipeHypotenuse);\n if (swipeSin * 180 / Math.PI < touchAngle) {\n event.stopPropagation();\n Components.Move.make(subExSx * toFloat(touchRatio));\n Components.Html.root.classList.add(classes.dragging);\n Events.emit('swipe.move');\n } else {\n return false;\n }\n }\n },\n /**\n * Handler for `swipeend` event. Finitializes user's tap and decides about glide move.\n *\n * @param {Object} event\n * @return {Void}\n */\n end: function end(event) {\n if (!Glide.disabled) {\n var _Glide$settings2 = Glide.settings,\n perSwipe = _Glide$settings2.perSwipe,\n touchAngle = _Glide$settings2.touchAngle,\n classes = _Glide$settings2.classes;\n var swipe = this.touches(event);\n var threshold = this.threshold(event);\n var swipeDistance = swipe.pageX - swipeStartX;\n var swipeDeg = swipeSin * 180 / Math.PI;\n this.enable();\n if (swipeDistance > threshold && swipeDeg < touchAngle) {\n Components.Run.make(Components.Direction.resolve(\"\".concat(perSwipe, \"<\")));\n } else if (swipeDistance < -threshold && swipeDeg < touchAngle) {\n Components.Run.make(Components.Direction.resolve(\"\".concat(perSwipe, \">\")));\n } else {\n // While swipe don't reach distance apply previous transform.\n Components.Move.make();\n }\n Components.Html.root.classList.remove(classes.dragging);\n this.unbindSwipeMove();\n this.unbindSwipeEnd();\n Events.emit('swipe.end');\n }\n },\n /**\n * Binds swipe's starting event.\n *\n * @return {Void}\n */\n bindSwipeStart: function bindSwipeStart() {\n var _this = this;\n var _Glide$settings3 = Glide.settings,\n swipeThreshold = _Glide$settings3.swipeThreshold,\n dragThreshold = _Glide$settings3.dragThreshold;\n if (swipeThreshold) {\n Binder.on(START_EVENTS[0], Components.Html.wrapper, function (event) {\n _this.start(event);\n }, capture);\n }\n if (dragThreshold) {\n Binder.on(START_EVENTS[1], Components.Html.wrapper, function (event) {\n _this.start(event);\n }, capture);\n }\n },\n /**\n * Unbinds swipe's starting event.\n *\n * @return {Void}\n */\n unbindSwipeStart: function unbindSwipeStart() {\n Binder.off(START_EVENTS[0], Components.Html.wrapper, capture);\n Binder.off(START_EVENTS[1], Components.Html.wrapper, capture);\n },\n /**\n * Binds swipe's moving event.\n *\n * @return {Void}\n */\n bindSwipeMove: function bindSwipeMove() {\n var _this2 = this;\n Binder.on(MOVE_EVENTS, Components.Html.wrapper, throttle(function (event) {\n _this2.move(event);\n }, Glide.settings.throttle), capture);\n },\n /**\n * Unbinds swipe's moving event.\n *\n * @return {Void}\n */\n unbindSwipeMove: function unbindSwipeMove() {\n Binder.off(MOVE_EVENTS, Components.Html.wrapper, capture);\n },\n /**\n * Binds swipe's ending event.\n *\n * @return {Void}\n */\n bindSwipeEnd: function bindSwipeEnd() {\n var _this3 = this;\n Binder.on(END_EVENTS, Components.Html.wrapper, function (event) {\n _this3.end(event);\n });\n },\n /**\n * Unbinds swipe's ending event.\n *\n * @return {Void}\n */\n unbindSwipeEnd: function unbindSwipeEnd() {\n Binder.off(END_EVENTS, Components.Html.wrapper);\n },\n /**\n * Normalizes event touches points accorting to different types.\n *\n * @param {Object} event\n */\n touches: function touches(event) {\n if (MOUSE_EVENTS.indexOf(event.type) > -1) {\n return event;\n }\n return event.touches[0] || event.changedTouches[0];\n },\n /**\n * Gets value of minimum swipe distance settings based on event type.\n *\n * @return {Number}\n */\n threshold: function threshold(event) {\n var settings = Glide.settings;\n if (MOUSE_EVENTS.indexOf(event.type) > -1) {\n return settings.dragThreshold;\n }\n return settings.swipeThreshold;\n },\n /**\n * Enables swipe event.\n *\n * @return {self}\n */\n enable: function enable() {\n disabled = false;\n Components.Transition.enable();\n return this;\n },\n /**\n * Disables swipe event.\n *\n * @return {self}\n */\n disable: function disable() {\n disabled = true;\n Components.Transition.disable();\n return this;\n }\n };\n /**\n * Add component class:\n * - after initial building\n */\n\n Events.on('build.after', function () {\n Components.Html.root.classList.add(Glide.settings.classes.swipeable);\n });\n /**\n * Remove swiping bindings:\n * - on destroying, to remove added EventListeners\n */\n\n Events.on('destroy', function () {\n Swipe.unbindSwipeStart();\n Swipe.unbindSwipeMove();\n Swipe.unbindSwipeEnd();\n Binder.destroy();\n });\n return Swipe;\n}\nfunction Images(Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n var Images = {\n /**\n * Binds listener to glide wrapper.\n *\n * @return {Void}\n */\n mount: function mount() {\n this.bind();\n },\n /**\n * Binds `dragstart` event on wrapper to prevent dragging images.\n *\n * @return {Void}\n */\n bind: function bind() {\n Binder.on('dragstart', Components.Html.wrapper, this.dragstart);\n },\n /**\n * Unbinds `dragstart` event on wrapper.\n *\n * @return {Void}\n */\n unbind: function unbind() {\n Binder.off('dragstart', Components.Html.wrapper);\n },\n /**\n * Event handler. Prevents dragging.\n *\n * @return {Void}\n */\n dragstart: function dragstart(event) {\n event.preventDefault();\n }\n };\n /**\n * Remove bindings from images:\n * - on destroying, to remove added EventListeners\n */\n\n Events.on('destroy', function () {\n Images.unbind();\n Binder.destroy();\n });\n return Images;\n}\nfunction Anchors(Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n /**\n * Holds detaching status of anchors.\n * Prevents detaching of already detached anchors.\n *\n * @private\n * @type {Boolean}\n */\n\n var detached = false;\n /**\n * Holds preventing status of anchors.\n * If `true` redirection after click will be disabled.\n *\n * @private\n * @type {Boolean}\n */\n\n var prevented = false;\n var Anchors = {\n /**\n * Setups a initial state of anchors component.\n *\n * @returns {Void}\n */\n mount: function mount() {\n /**\n * Holds collection of anchors elements.\n *\n * @private\n * @type {HTMLCollection}\n */\n this._a = Components.Html.wrapper.querySelectorAll('a');\n this.bind();\n },\n /**\n * Binds events to anchors inside a track.\n *\n * @return {Void}\n */\n bind: function bind() {\n Binder.on('click', Components.Html.wrapper, this.click);\n },\n /**\n * Unbinds events attached to anchors inside a track.\n *\n * @return {Void}\n */\n unbind: function unbind() {\n Binder.off('click', Components.Html.wrapper);\n },\n /**\n * Handler for click event. Prevents clicks when glide is in `prevent` status.\n *\n * @param {Object} event\n * @return {Void}\n */\n click: function click(event) {\n if (prevented) {\n event.stopPropagation();\n event.preventDefault();\n }\n },\n /**\n * Detaches anchors click event inside glide.\n *\n * @return {self}\n */\n detach: function detach() {\n prevented = true;\n if (!detached) {\n for (var i = 0; i < this.items.length; i++) {\n this.items[i].draggable = false;\n }\n detached = true;\n }\n return this;\n },\n /**\n * Attaches anchors click events inside glide.\n *\n * @return {self}\n */\n attach: function attach() {\n prevented = false;\n if (detached) {\n for (var i = 0; i < this.items.length; i++) {\n this.items[i].draggable = true;\n }\n detached = false;\n }\n return this;\n }\n };\n define(Anchors, 'items', {\n /**\n * Gets collection of the arrows HTML elements.\n *\n * @return {HTMLElement[]}\n */\n get: function get() {\n return Anchors._a;\n }\n });\n /**\n * Detach anchors inside slides:\n * - on swiping, so they won't redirect to its `href` attributes\n */\n\n Events.on('swipe.move', function () {\n Anchors.detach();\n });\n /**\n * Attach anchors inside slides:\n * - after swiping and transitions ends, so they can redirect after click again\n */\n\n Events.on('swipe.end', function () {\n Components.Transition.after(function () {\n Anchors.attach();\n });\n });\n /**\n * Unbind anchors inside slides:\n * - on destroying, to bring anchors to its initial state\n */\n\n Events.on('destroy', function () {\n Anchors.attach();\n Anchors.unbind();\n Binder.destroy();\n });\n return Anchors;\n}\nvar NAV_SELECTOR = '[data-glide-el=\"controls[nav]\"]';\nvar CONTROLS_SELECTOR = '[data-glide-el^=\"controls\"]';\nvar PREVIOUS_CONTROLS_SELECTOR = \"\".concat(CONTROLS_SELECTOR, \" [data-glide-dir*=\\\"<\\\"]\");\nvar NEXT_CONTROLS_SELECTOR = \"\".concat(CONTROLS_SELECTOR, \" [data-glide-dir*=\\\">\\\"]\");\nfunction Controls(Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n var capture = supportsPassive$1 ? {\n passive: true\n } : false;\n var Controls = {\n /**\n * Inits arrows. Binds events listeners\n * to the arrows HTML elements.\n *\n * @return {Void}\n */\n mount: function mount() {\n /**\n * Collection of navigation HTML elements.\n *\n * @private\n * @type {HTMLCollection}\n */\n this._n = Components.Html.root.querySelectorAll(NAV_SELECTOR);\n /**\n * Collection of controls HTML elements.\n *\n * @private\n * @type {HTMLCollection}\n */\n\n this._c = Components.Html.root.querySelectorAll(CONTROLS_SELECTOR);\n /**\n * Collection of arrow control HTML elements.\n *\n * @private\n * @type {Object}\n */\n\n this._arrowControls = {\n previous: Components.Html.root.querySelectorAll(PREVIOUS_CONTROLS_SELECTOR),\n next: Components.Html.root.querySelectorAll(NEXT_CONTROLS_SELECTOR)\n };\n this.addBindings();\n },\n /**\n * Sets active class to current slide.\n *\n * @return {Void}\n */\n setActive: function setActive() {\n for (var i = 0; i < this._n.length; i++) {\n this.addClass(this._n[i].children);\n }\n },\n /**\n * Removes active class to current slide.\n *\n * @return {Void}\n */\n removeActive: function removeActive() {\n for (var i = 0; i < this._n.length; i++) {\n this.removeClass(this._n[i].children);\n }\n },\n /**\n * Toggles active class on items inside navigation.\n *\n * @param {HTMLElement} controls\n * @return {Void}\n */\n addClass: function addClass(controls) {\n var settings = Glide.settings;\n var item = controls[Glide.index];\n if (!item) {\n return;\n }\n if (item) {\n item.classList.add(settings.classes.nav.active);\n siblings(item).forEach(function (sibling) {\n sibling.classList.remove(settings.classes.nav.active);\n });\n }\n },\n /**\n * Removes active class from active control.\n *\n * @param {HTMLElement} controls\n * @return {Void}\n */\n removeClass: function removeClass(controls) {\n var item = controls[Glide.index];\n if (item) {\n item.classList.remove(Glide.settings.classes.nav.active);\n }\n },\n /**\n * Calculates, removes or adds `Glide.settings.classes.disabledArrow` class on the control arrows\n */\n setArrowState: function setArrowState() {\n if (Glide.settings.rewind) {\n return;\n }\n var next = Controls._arrowControls.next;\n var previous = Controls._arrowControls.previous;\n this.resetArrowState(next, previous);\n if (Glide.index === 0) {\n this.disableArrow(previous);\n }\n if (Glide.index === Components.Run.length) {\n this.disableArrow(next);\n }\n },\n /**\n * Removes `Glide.settings.classes.disabledArrow` from given NodeList elements\n *\n * @param {NodeList[]} lists\n */\n resetArrowState: function resetArrowState() {\n var settings = Glide.settings;\n for (var _len = arguments.length, lists = new Array(_len), _key = 0; _key < _len; _key++) {\n lists[_key] = arguments[_key];\n }\n lists.forEach(function (list) {\n toArray(list).forEach(function (element) {\n element.classList.remove(settings.classes.arrow.disabled);\n });\n });\n },\n /**\n * Adds `Glide.settings.classes.disabledArrow` to given NodeList elements\n *\n * @param {NodeList[]} lists\n */\n disableArrow: function disableArrow() {\n var settings = Glide.settings;\n for (var _len2 = arguments.length, lists = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n lists[_key2] = arguments[_key2];\n }\n lists.forEach(function (list) {\n toArray(list).forEach(function (element) {\n element.classList.add(settings.classes.arrow.disabled);\n });\n });\n },\n /**\n * Adds handles to the each group of controls.\n *\n * @return {Void}\n */\n addBindings: function addBindings() {\n for (var i = 0; i < this._c.length; i++) {\n this.bind(this._c[i].children);\n }\n },\n /**\n * Removes handles from the each group of controls.\n *\n * @return {Void}\n */\n removeBindings: function removeBindings() {\n for (var i = 0; i < this._c.length; i++) {\n this.unbind(this._c[i].children);\n }\n },\n /**\n * Binds events to arrows HTML elements.\n *\n * @param {HTMLCollection} elements\n * @return {Void}\n */\n bind: function bind(elements) {\n for (var i = 0; i < elements.length; i++) {\n Binder.on('click', elements[i], this.click);\n Binder.on('touchstart', elements[i], this.click, capture);\n }\n },\n /**\n * Unbinds events binded to the arrows HTML elements.\n *\n * @param {HTMLCollection} elements\n * @return {Void}\n */\n unbind: function unbind(elements) {\n for (var i = 0; i < elements.length; i++) {\n Binder.off(['click', 'touchstart'], elements[i]);\n }\n },\n /**\n * Handles `click` event on the arrows HTML elements.\n * Moves slider in direction given via the\n * `data-glide-dir` attribute.\n *\n * @param {Object} event\n * @return {void}\n */\n click: function click(event) {\n if (!supportsPassive$1 && event.type === 'touchstart') {\n event.preventDefault();\n }\n var direction = event.currentTarget.getAttribute('data-glide-dir');\n Components.Run.make(Components.Direction.resolve(direction));\n }\n };\n define(Controls, 'items', {\n /**\n * Gets collection of the controls HTML elements.\n *\n * @return {HTMLElement[]}\n */\n get: function get() {\n return Controls._c;\n }\n });\n /**\n * Swap active class of current navigation item:\n * - after mounting to set it to initial index\n * - after each move to the new index\n */\n\n Events.on(['mount.after', 'move.after'], function () {\n Controls.setActive();\n });\n /**\n * Add or remove disabled class of arrow elements\n */\n\n Events.on(['mount.after', 'run'], function () {\n Controls.setArrowState();\n });\n /**\n * Remove bindings and HTML Classes:\n * - on destroying, to bring markup to its initial state\n */\n\n Events.on('destroy', function () {\n Controls.removeBindings();\n Controls.removeActive();\n Binder.destroy();\n });\n return Controls;\n}\nfunction Keyboard(Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n var Keyboard = {\n /**\n * Binds keyboard events on component mount.\n *\n * @return {Void}\n */\n mount: function mount() {\n if (Glide.settings.keyboard) {\n this.bind();\n }\n },\n /**\n * Adds keyboard press events.\n *\n * @return {Void}\n */\n bind: function bind() {\n Binder.on('keyup', document, this.press);\n },\n /**\n * Removes keyboard press events.\n *\n * @return {Void}\n */\n unbind: function unbind() {\n Binder.off('keyup', document);\n },\n /**\n * Handles keyboard's arrows press and moving glide foward and backward.\n *\n * @param {Object} event\n * @return {Void}\n */\n press: function press(event) {\n var perSwipe = Glide.settings.perSwipe;\n if (event.code === 'ArrowRight') {\n Components.Run.make(Components.Direction.resolve(\"\".concat(perSwipe, \">\")));\n }\n if (event.code === 'ArrowLeft') {\n Components.Run.make(Components.Direction.resolve(\"\".concat(perSwipe, \"<\")));\n }\n }\n };\n /**\n * Remove bindings from keyboard:\n * - on destroying to remove added events\n * - on updating to remove events before remounting\n */\n\n Events.on(['destroy', 'update'], function () {\n Keyboard.unbind();\n });\n /**\n * Remount component\n * - on updating to reflect potential changes in settings\n */\n\n Events.on('update', function () {\n Keyboard.mount();\n });\n /**\n * Destroy binder:\n * - on destroying to remove listeners\n */\n\n Events.on('destroy', function () {\n Binder.destroy();\n });\n return Keyboard;\n}\nfunction Autoplay(Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n var Autoplay = {\n /**\n * Initializes autoplaying and events.\n *\n * @return {Void}\n */\n mount: function mount() {\n this.enable();\n this.start();\n if (Glide.settings.hoverpause) {\n this.bind();\n }\n },\n /**\n * Enables autoplaying\n *\n * @returns {Void}\n */\n enable: function enable() {\n this._e = true;\n },\n /**\n * Disables autoplaying.\n *\n * @returns {Void}\n */\n disable: function disable() {\n this._e = false;\n },\n /**\n * Starts autoplaying in configured interval.\n *\n * @param {Boolean|Number} force Run autoplaying with passed interval regardless of `autoplay` settings\n * @return {Void}\n */\n start: function start() {\n var _this = this;\n if (!this._e) {\n return;\n }\n this.enable();\n if (Glide.settings.autoplay) {\n if (isUndefined(this._i)) {\n this._i = setInterval(function () {\n _this.stop();\n Components.Run.make('>');\n _this.start();\n Events.emit('autoplay');\n }, this.time);\n }\n }\n },\n /**\n * Stops autorunning of the glide.\n *\n * @return {Void}\n */\n stop: function stop() {\n this._i = clearInterval(this._i);\n },\n /**\n * Stops autoplaying while mouse is over glide's area.\n *\n * @return {Void}\n */\n bind: function bind() {\n var _this2 = this;\n Binder.on('mouseover', Components.Html.root, function () {\n if (_this2._e) {\n _this2.stop();\n }\n });\n Binder.on('mouseout', Components.Html.root, function () {\n if (_this2._e) {\n _this2.start();\n }\n });\n },\n /**\n * Unbind mouseover events.\n *\n * @returns {Void}\n */\n unbind: function unbind() {\n Binder.off(['mouseover', 'mouseout'], Components.Html.root);\n }\n };\n define(Autoplay, 'time', {\n /**\n * Gets time period value for the autoplay interval. Prioritizes\n * times in `data-glide-autoplay` attrubutes over options.\n *\n * @return {Number}\n */\n get: function get() {\n var autoplay = Components.Html.slides[Glide.index].getAttribute('data-glide-autoplay');\n if (autoplay) {\n return toInt(autoplay);\n }\n return toInt(Glide.settings.autoplay);\n }\n });\n /**\n * Stop autoplaying and unbind events:\n * - on destroying, to clear defined interval\n * - on updating via API to reset interval that may changed\n */\n\n Events.on(['destroy', 'update'], function () {\n Autoplay.unbind();\n });\n /**\n * Stop autoplaying:\n * - before each run, to restart autoplaying\n * - on pausing via API\n * - on destroying, to clear defined interval\n * - while starting a swipe\n * - on updating via API to reset interval that may changed\n */\n\n Events.on(['run.before', 'swipe.start', 'update'], function () {\n Autoplay.stop();\n });\n Events.on(['pause', 'destroy'], function () {\n Autoplay.disable();\n Autoplay.stop();\n });\n /**\n * Start autoplaying:\n * - after each run, to restart autoplaying\n * - on playing via API\n * - while ending a swipe\n */\n\n Events.on(['run.after', 'swipe.end'], function () {\n Autoplay.start();\n });\n /**\n * Start autoplaying:\n * - after each run, to restart autoplaying\n * - on playing via API\n * - while ending a swipe\n */\n\n Events.on(['play'], function () {\n Autoplay.enable();\n Autoplay.start();\n });\n /**\n * Remount autoplaying:\n * - on updating via API to reset interval that may changed\n */\n\n Events.on('update', function () {\n Autoplay.mount();\n });\n /**\n * Destroy a binder:\n * - on destroying glide instance to clearup listeners\n */\n\n Events.on('destroy', function () {\n Binder.destroy();\n });\n return Autoplay;\n}\n\n/**\n * Sorts keys of breakpoint object so they will be ordered from lower to bigger.\n *\n * @param {Object} points\n * @returns {Object}\n */\n\nfunction sortBreakpoints(points) {\n if (isObject(points)) {\n return sortKeys(points);\n } else {\n warn(\"Breakpoints option must be an object\");\n }\n return {};\n}\nfunction Breakpoints(Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n /**\n * Holds reference to settings.\n *\n * @type {Object}\n */\n\n var settings = Glide.settings;\n /**\n * Holds reference to breakpoints object in settings. Sorts breakpoints\n * from smaller to larger. It is required in order to proper\n * matching currently active breakpoint settings.\n *\n * @type {Object}\n */\n\n var points = sortBreakpoints(settings.breakpoints);\n /**\n * Cache initial settings before overwritting.\n *\n * @type {Object}\n */\n\n var defaults = Object.assign({}, settings);\n var Breakpoints = {\n /**\n * Matches settings for currectly matching media breakpoint.\n *\n * @param {Object} points\n * @returns {Object}\n */\n match: function match(points) {\n if (typeof window.matchMedia !== 'undefined') {\n for (var point in points) {\n if (points.hasOwnProperty(point)) {\n if (window.matchMedia(\"(max-width: \".concat(point, \"px)\")).matches) {\n return points[point];\n }\n }\n }\n }\n return defaults;\n }\n };\n /**\n * Overwrite instance settings with currently matching breakpoint settings.\n * This happens right after component initialization.\n */\n\n Object.assign(settings, Breakpoints.match(points));\n /**\n * Update glide with settings of matched brekpoint:\n * - window resize to update slider\n */\n\n Binder.on('resize', window, throttle(function () {\n Glide.settings = mergeOptions(settings, Breakpoints.match(points));\n }, Glide.settings.throttle));\n /**\n * Resort and update default settings:\n * - on reinit via API, so breakpoint matching will be performed with options\n */\n\n Events.on('update', function () {\n points = sortBreakpoints(points);\n defaults = Object.assign({}, settings);\n });\n /**\n * Unbind resize listener:\n * - on destroying, to bring markup to its initial state\n */\n\n Events.on('destroy', function () {\n Binder.off('resize', window);\n });\n return Breakpoints;\n}\nvar COMPONENTS = {\n // Required\n Html: Html,\n Translate: Translate,\n Transition: Transition,\n Direction: Direction,\n Peek: Peek,\n Sizes: Sizes,\n Gaps: Gaps,\n Move: Move,\n Clones: Clones,\n Resize: Resize,\n Build: Build,\n Run: Run,\n // Optional\n Swipe: Swipe,\n Images: Images,\n Anchors: Anchors,\n Controls: Controls,\n Keyboard: Keyboard,\n Autoplay: Autoplay,\n Breakpoints: Breakpoints\n};\nvar Glide = /*#__PURE__*/function (_Core) {\n _inherits(Glide, _Core);\n var _super = _createSuper(Glide);\n function Glide() {\n _classCallCheck(this, Glide);\n return _super.apply(this, arguments);\n }\n _createClass(Glide, [{\n key: \"mount\",\n value: function mount() {\n var extensions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _get(_getPrototypeOf(Glide.prototype), \"mount\", this).call(this, Object.assign({}, COMPONENTS, extensions));\n }\n }]);\n return Glide;\n}(Glide$1);\nexport { Glide as default };","export { Application } from \"./src/application\";\nexport { Context } from \"./src/context\";\nexport { Controller } from \"./src/controller\";\nexport { defaultSchema } from \"./src/schema\";","import { parseDescriptorString, stringifyEventTarget } from \"./action_descriptor\";\nvar Action = /** @class */function () {\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.identifier = descriptor.identifier || error(\"missing identifier\");\n this.methodName = descriptor.methodName || error(\"missing method name\");\n }\n Action.forToken = function (token) {\n return new this(token.element, token.index, parseDescriptorString(token.content));\n };\n Action.prototype.toString = function () {\n var eventNameSuffix = this.eventTargetName ? \"@\" + this.eventTargetName : \"\";\n return \"\" + this.eventName + eventNameSuffix + \"->\" + this.identifier + \"#\" + this.methodName;\n };\n Object.defineProperty(Action.prototype, \"eventTargetName\", {\n get: function () {\n return stringifyEventTarget(this.eventTarget);\n },\n enumerable: true,\n configurable: true\n });\n return Action;\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\" : \"change\";\n },\n \"select\": function (e) {\n return \"change\";\n },\n \"textarea\": function (e) {\n return \"change\";\n }\n};\nexport function getDefaultEventNameForElement(element) {\n var tagName = element.tagName.toLowerCase();\n if (tagName in defaultEventNames) {\n return defaultEventNames[tagName](element);\n }\n}\nfunction error(message) {\n throw new Error(message);\n}","// capture nos.: 12 23 4 43 1 5 56 7 76\nvar descriptorPattern = /^((.+?)(@(window|document))?->)?(.+?)(#(.+))?$/;\nexport function parseDescriptorString(descriptorString) {\n var source = descriptorString.trim();\n var matches = source.match(descriptorPattern) || [];\n return {\n eventTarget: parseEventTarget(matches[4]),\n eventName: matches[2],\n identifier: matches[5],\n methodName: matches[7]\n };\n}\nfunction parseEventTarget(eventTargetName) {\n if (eventTargetName == \"window\") {\n return window;\n } else if (eventTargetName == \"document\") {\n return document;\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 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 function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : new P(function (resolve) {\n resolve(result.value);\n }).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\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 function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\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 if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\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};\nimport { Dispatcher } from \"./dispatcher\";\nimport { Router } from \"./router\";\nimport { defaultSchema } from \"./schema\";\nvar Application = /** @class */function () {\n function Application(element, schema) {\n if (element === void 0) {\n element = document.documentElement;\n }\n if (schema === void 0) {\n schema = defaultSchema;\n }\n this.element = element;\n this.schema = schema;\n this.dispatcher = new Dispatcher(this);\n this.router = new Router(this);\n }\n Application.start = function (element, schema) {\n var application = new Application(element, schema);\n application.start();\n return application;\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 /*yield*/, domReady()];\n case 1:\n _a.sent();\n this.router.start();\n this.dispatcher.start();\n return [2 /*return*/];\n }\n });\n });\n };\n Application.prototype.stop = function () {\n this.router.stop();\n this.dispatcher.stop();\n };\n Application.prototype.register = function (identifier, controllerConstructor) {\n this.load({\n identifier: identifier,\n controllerConstructor: controllerConstructor\n });\n };\n Application.prototype.load = function (head) {\n var _this = this;\n var rest = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n rest[_i - 1] = arguments[_i];\n }\n var definitions = Array.isArray(head) ? head : [head].concat(rest);\n definitions.forEach(function (definition) {\n return _this.router.loadDefinition(definition);\n });\n };\n Application.prototype.unload = function (head) {\n var _this = this;\n var rest = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n rest[_i - 1] = arguments[_i];\n }\n var identifiers = Array.isArray(head) ? head : [head].concat(rest);\n identifiers.forEach(function (identifier) {\n return _this.router.unloadIdentifier(identifier);\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: true,\n configurable: true\n });\n Application.prototype.getControllerForElementAndIdentifier = function (element, identifier) {\n var context = this.router.getContextForElementAndIdentifier(element, identifier);\n return context ? context.controller : null;\n };\n // Error handling\n Application.prototype.handleError = function (error, message, detail) {\n console.error(\"%s\\n\\n%o\\n\\n%o\", message, error, detail);\n };\n return Application;\n}();\nexport { Application };\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 = /** @class */function () {\n function Binding(context, action) {\n this.context = context;\n this.action = action;\n }\n Object.defineProperty(Binding.prototype, \"index\", {\n get: function () {\n return this.action.index;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"eventTarget\", {\n get: function () {\n return this.action.eventTarget;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"identifier\", {\n get: function () {\n return this.context.identifier;\n },\n enumerable: true,\n configurable: true\n });\n Binding.prototype.handleEvent = function (event) {\n if (this.willBeInvokedByEvent(event)) {\n this.invokeWithEvent(event);\n }\n };\n Object.defineProperty(Binding.prototype, \"eventName\", {\n get: function () {\n return this.action.eventName;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"method\", {\n get: function () {\n var method = this.controller[this.methodName];\n if (typeof method == \"function\") {\n return method;\n }\n throw new Error(\"Action \\\"\" + this.action + \"\\\" references undefined method \\\"\" + this.methodName + \"\\\"\");\n },\n enumerable: true,\n configurable: true\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 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 Binding.prototype.willBeInvokedByEvent = function (event) {\n var eventTarget = event.target;\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 true;\n }\n };\n Object.defineProperty(Binding.prototype, \"controller\", {\n get: function () {\n return this.context.controller;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"methodName\", {\n get: function () {\n return this.action.methodName;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"scope\", {\n get: function () {\n return this.context.scope;\n },\n enumerable: true,\n configurable: true\n });\n return Binding;\n}();\nexport { Binding };","import { Action } from \"./action\";\nimport { Binding } from \"./binding\";\nimport { ValueListObserver } from \"@stimulus/mutation-observers\";\nvar BindingObserver = /** @class */function () {\n function BindingObserver(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.bindingsByAction = new Map();\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 BindingObserver.prototype.stop = function () {\n if (this.valueListObserver) {\n this.valueListObserver.stop();\n delete this.valueListObserver;\n this.disconnectAllActions();\n }\n };\n Object.defineProperty(BindingObserver.prototype, \"element\", {\n get: function () {\n return this.context.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"identifier\", {\n get: function () {\n return this.context.identifier;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"actionAttribute\", {\n get: function () {\n return this.schema.actionAttribute;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"schema\", {\n get: function () {\n return this.context.schema;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"bindings\", {\n get: function () {\n return Array.from(this.bindingsByAction.values());\n },\n enumerable: true,\n configurable: true\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 BindingObserver.prototype.disconnectAction = function (action) {\n var binding = this.bindingsByAction.get(action);\n if (binding) {\n this.bindingsByAction.delete(action);\n this.delegate.bindingDisconnected(binding);\n }\n };\n BindingObserver.prototype.disconnectAllActions = function () {\n var _this = this;\n this.bindings.forEach(function (binding) {\n return _this.delegate.bindingDisconnected(binding);\n });\n this.bindingsByAction.clear();\n };\n // Value observer delegate\n BindingObserver.prototype.parseValueForToken = function (token) {\n var action = Action.forToken(token);\n if (action.identifier == this.identifier) {\n return action;\n }\n };\n BindingObserver.prototype.elementMatchedValue = function (element, action) {\n this.connectAction(action);\n };\n BindingObserver.prototype.elementUnmatchedValue = function (element, action) {\n this.disconnectAction(action);\n };\n return BindingObserver;\n}();\nexport { BindingObserver };","import { BindingObserver } from \"./binding_observer\";\nvar Context = /** @class */function () {\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 try {\n this.controller.initialize();\n } catch (error) {\n this.handleError(error, \"initializing controller\");\n }\n }\n Context.prototype.connect = function () {\n this.bindingObserver.start();\n try {\n this.controller.connect();\n } catch (error) {\n this.handleError(error, \"connecting controller\");\n }\n };\n Context.prototype.disconnect = function () {\n try {\n this.controller.disconnect();\n } catch (error) {\n this.handleError(error, \"disconnecting controller\");\n }\n this.bindingObserver.stop();\n };\n Object.defineProperty(Context.prototype, \"application\", {\n get: function () {\n return this.module.application;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"identifier\", {\n get: function () {\n return this.module.identifier;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"schema\", {\n get: function () {\n return this.application.schema;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"dispatcher\", {\n get: function () {\n return this.application.dispatcher;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"parentElement\", {\n get: function () {\n return this.element.parentElement;\n },\n enumerable: true,\n configurable: true\n });\n // Error handling\n Context.prototype.handleError = function (error, message, detail) {\n if (detail === void 0) {\n detail = {};\n }\n var _a = this,\n identifier = _a.identifier,\n controller = _a.controller,\n element = _a.element;\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 return Context;\n}();\nexport { Context };","import { defineTargetProperties } from \"./target_properties\";\nvar Controller = /** @class */function () {\n function Controller(context) {\n this.context = context;\n }\n Controller.bless = function () {\n defineTargetProperties(this);\n };\n Object.defineProperty(Controller.prototype, \"application\", {\n get: function () {\n return this.context.application;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"scope\", {\n get: function () {\n return this.context.scope;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"identifier\", {\n get: function () {\n return this.scope.identifier;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"targets\", {\n get: function () {\n return this.scope.targets;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"data\", {\n get: function () {\n return this.scope.data;\n },\n enumerable: true,\n configurable: true\n });\n Controller.prototype.initialize = function () {\n // Override in your subclass to set up initial controller state\n };\n Controller.prototype.connect = function () {\n // Override in your subclass to respond when the controller is connected to the DOM\n };\n Controller.prototype.disconnect = function () {\n // Override in your subclass to respond when the controller is disconnected from the DOM\n };\n Controller.targets = [];\n return Controller;\n}();\nexport { Controller };","var DataMap = /** @class */function () {\n function DataMap(scope) {\n this.scope = scope;\n }\n Object.defineProperty(DataMap.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DataMap.prototype, \"identifier\", {\n get: function () {\n return this.scope.identifier;\n },\n enumerable: true,\n configurable: true\n });\n DataMap.prototype.get = function (key) {\n key = this.getFormattedKey(key);\n return this.element.getAttribute(key);\n };\n DataMap.prototype.set = function (key, value) {\n key = this.getFormattedKey(key);\n this.element.setAttribute(key, value);\n return this.get(key);\n };\n DataMap.prototype.has = function (key) {\n key = this.getFormattedKey(key);\n return this.element.hasAttribute(key);\n };\n DataMap.prototype.delete = function (key) {\n if (this.has(key)) {\n key = this.getFormattedKey(key);\n this.element.removeAttribute(key);\n return true;\n } else {\n return false;\n }\n };\n DataMap.prototype.getFormattedKey = function (key) {\n return \"data-\" + this.identifier + \"-\" + dasherize(key);\n };\n return DataMap;\n}();\nexport { DataMap };\nfunction dasherize(value) {\n return value.replace(/([A-Z])/g, function (_, char) {\n return \"-\" + char.toLowerCase();\n });\n}","var __extends = this && this.__extends || function () {\n var 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 return function (d, b) {\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n/** @hidden */\nexport function blessDefinition(definition) {\n return {\n identifier: definition.identifier,\n controllerConstructor: blessControllerConstructor(definition.controllerConstructor)\n };\n}\nfunction blessControllerConstructor(controllerConstructor) {\n var constructor = extend(controllerConstructor);\n constructor.bless();\n return constructor;\n}\nvar extend = function () {\n function extendWithReflect(constructor) {\n function Controller() {\n var _newTarget = this && this instanceof Controller ? this.constructor : void 0;\n return Reflect.construct(constructor, arguments, _newTarget);\n }\n Controller.prototype = Object.create(constructor.prototype, {\n constructor: {\n value: Controller\n }\n });\n Reflect.setPrototypeOf(Controller, constructor);\n return Controller;\n }\n function testReflectExtension() {\n var a = function () {\n this.a.call(this);\n };\n var b = extendWithReflect(a);\n b.prototype.a = function () {};\n return new b();\n }\n try {\n testReflectExtension();\n return extendWithReflect;\n } catch (error) {\n return function (constructor) {\n return /** @class */function (_super) {\n __extends(Controller, _super);\n function Controller() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Controller;\n }(constructor);\n };\n }\n}();","import { EventListener } from \"./event_listener\";\nvar Dispatcher = /** @class */function () {\n function Dispatcher(application) {\n this.application = application;\n this.eventListenerMaps = new Map();\n this.started = false;\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 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 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: true,\n configurable: true\n });\n // Binding observer delegate\n /** @hidden */\n Dispatcher.prototype.bindingConnected = function (binding) {\n this.fetchEventListenerForBinding(binding).bindingConnected(binding);\n };\n /** @hidden */\n Dispatcher.prototype.bindingDisconnected = function (binding) {\n this.fetchEventListenerForBinding(binding).bindingDisconnected(binding);\n };\n // Error handling\n Dispatcher.prototype.handleError = function (error, message, detail) {\n if (detail === void 0) {\n detail = {};\n }\n this.application.handleError(error, \"Error \" + message, detail);\n };\n Dispatcher.prototype.fetchEventListenerForBinding = function (binding) {\n var eventTarget = binding.eventTarget,\n eventName = binding.eventName;\n return this.fetchEventListener(eventTarget, eventName);\n };\n Dispatcher.prototype.fetchEventListener = function (eventTarget, eventName) {\n var eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n var eventListener = eventListenerMap.get(eventName);\n if (!eventListener) {\n eventListener = this.createEventListener(eventTarget, eventName);\n eventListenerMap.set(eventName, eventListener);\n }\n return eventListener;\n };\n Dispatcher.prototype.createEventListener = function (eventTarget, eventName) {\n var eventListener = new EventListener(eventTarget, eventName);\n if (this.started) {\n eventListener.connect();\n }\n return eventListener;\n };\n Dispatcher.prototype.fetchEventListenerMapForEventTarget = function (eventTarget) {\n var eventListenerMap = this.eventListenerMaps.get(eventTarget);\n if (!eventListenerMap) {\n eventListenerMap = new Map();\n this.eventListenerMaps.set(eventTarget, eventListenerMap);\n }\n return eventListenerMap;\n };\n return Dispatcher;\n}();\nexport { Dispatcher };","var EventListener = /** @class */function () {\n function EventListener(eventTarget, eventName) {\n this.eventTarget = eventTarget;\n this.eventName = eventName;\n this.unorderedBindings = new Set();\n }\n EventListener.prototype.connect = function () {\n this.eventTarget.addEventListener(this.eventName, this, false);\n };\n EventListener.prototype.disconnect = function () {\n this.eventTarget.removeEventListener(this.eventName, this, false);\n };\n // Binding observer delegate\n /** @hidden */\n EventListener.prototype.bindingConnected = function (binding) {\n this.unorderedBindings.add(binding);\n };\n /** @hidden */\n EventListener.prototype.bindingDisconnected = function (binding) {\n this.unorderedBindings.delete(binding);\n };\n EventListener.prototype.handleEvent = function (event) {\n var extendedEvent = extendEvent(event);\n for (var _i = 0, _a = this.bindings; _i < _a.length; _i++) {\n var binding = _a[_i];\n if (extendedEvent.immediatePropagationStopped) {\n break;\n } else {\n binding.handleEvent(extendedEvent);\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: true,\n configurable: true\n });\n return EventListener;\n}();\nexport { EventListener };\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}","import { Context } from \"./context\";\nimport { blessDefinition } from \"./definition\";\nvar Module = /** @class */function () {\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 Object.defineProperty(Module.prototype, \"identifier\", {\n get: function () {\n return this.definition.identifier;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Module.prototype, \"controllerConstructor\", {\n get: function () {\n return this.definition.controllerConstructor;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Module.prototype, \"contexts\", {\n get: function () {\n return Array.from(this.connectedContexts);\n },\n enumerable: true,\n configurable: true\n });\n Module.prototype.connectContextForScope = function (scope) {\n var context = this.fetchContextForScope(scope);\n this.connectedContexts.add(context);\n context.connect();\n };\n Module.prototype.disconnectContextForScope = function (scope) {\n var context = this.contextsByScope.get(scope);\n if (context) {\n this.connectedContexts.delete(context);\n context.disconnect();\n }\n };\n Module.prototype.fetchContextForScope = function (scope) {\n var context = this.contextsByScope.get(scope);\n if (!context) {\n context = new Context(this, scope);\n this.contextsByScope.set(scope, context);\n }\n return context;\n };\n return Module;\n}();\nexport { Module };","import { Module } from \"./module\";\nimport { Multimap } from \"@stimulus/multimap\";\nimport { ScopeObserver } from \"./scope_observer\";\nvar Router = /** @class */function () {\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 Object.defineProperty(Router.prototype, \"element\", {\n get: function () {\n return this.application.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"schema\", {\n get: function () {\n return this.application.schema;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"controllerAttribute\", {\n get: function () {\n return this.schema.controllerAttribute;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"modules\", {\n get: function () {\n return Array.from(this.modulesByIdentifier.values());\n },\n enumerable: true,\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: true,\n configurable: true\n });\n Router.prototype.start = function () {\n this.scopeObserver.start();\n };\n Router.prototype.stop = function () {\n this.scopeObserver.stop();\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 Router.prototype.unloadIdentifier = function (identifier) {\n var module = this.modulesByIdentifier.get(identifier);\n if (module) {\n this.disconnectModule(module);\n }\n };\n Router.prototype.getContextForElementAndIdentifier = function (element, identifier) {\n var module = this.modulesByIdentifier.get(identifier);\n if (module) {\n return module.contexts.find(function (context) {\n return context.element == element;\n });\n }\n };\n // Error handler delegate\n /** @hidden */\n Router.prototype.handleError = function (error, message, detail) {\n this.application.handleError(error, message, detail);\n };\n // Scope observer delegate\n /** @hidden */\n Router.prototype.scopeConnected = function (scope) {\n this.scopesByIdentifier.add(scope.identifier, scope);\n var module = this.modulesByIdentifier.get(scope.identifier);\n if (module) {\n module.connectContextForScope(scope);\n }\n };\n /** @hidden */\n Router.prototype.scopeDisconnected = function (scope) {\n this.scopesByIdentifier.delete(scope.identifier, scope);\n var module = this.modulesByIdentifier.get(scope.identifier);\n if (module) {\n module.disconnectContextForScope(scope);\n }\n };\n // Modules\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 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 return Router;\n}();\nexport { Router };","export var defaultSchema = {\n controllerAttribute: \"data-controller\",\n actionAttribute: \"data-action\",\n targetAttribute: \"data-target\"\n};","import { DataMap } from \"./data_map\";\nimport { TargetSet } from \"./target_set\";\nimport { attributeValueContainsToken } from \"./selectors\";\nvar Scope = /** @class */function () {\n function Scope(schema, identifier, element) {\n this.schema = schema;\n this.identifier = identifier;\n this.element = element;\n this.targets = new TargetSet(this);\n this.data = new DataMap(this);\n }\n Scope.prototype.findElement = function (selector) {\n return this.findAllElements(selector)[0];\n };\n Scope.prototype.findAllElements = function (selector) {\n var head = this.element.matches(selector) ? [this.element] : [];\n var tail = this.filterElements(Array.from(this.element.querySelectorAll(selector)));\n return head.concat(tail);\n };\n Scope.prototype.filterElements = function (elements) {\n var _this = this;\n return elements.filter(function (element) {\n return _this.containsElement(element);\n });\n };\n Scope.prototype.containsElement = function (element) {\n return element.closest(this.controllerSelector) === this.element;\n };\n Object.defineProperty(Scope.prototype, \"controllerSelector\", {\n get: function () {\n return attributeValueContainsToken(this.schema.controllerAttribute, this.identifier);\n },\n enumerable: true,\n configurable: true\n });\n return Scope;\n}();\nexport { Scope };","import { Scope } from \"./scope\";\nimport { ValueListObserver } from \"@stimulus/mutation-observers\";\nvar ScopeObserver = /** @class */function () {\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 ScopeObserver.prototype.start = function () {\n this.valueListObserver.start();\n };\n ScopeObserver.prototype.stop = function () {\n this.valueListObserver.stop();\n };\n Object.defineProperty(ScopeObserver.prototype, \"controllerAttribute\", {\n get: function () {\n return this.schema.controllerAttribute;\n },\n enumerable: true,\n configurable: true\n });\n // Value observer delegate\n /** @hidden */\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 if (!scope) {\n scope = new Scope(this.schema, identifier, element);\n scopesByIdentifier.set(identifier, scope);\n }\n return scope;\n };\n /** @hidden */\n ScopeObserver.prototype.elementMatchedValue = function (element, value) {\n var referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1;\n this.scopeReferenceCounts.set(value, referenceCount);\n if (referenceCount == 1) {\n this.delegate.scopeConnected(value);\n }\n };\n /** @hidden */\n ScopeObserver.prototype.elementUnmatchedValue = function (element, value) {\n var referenceCount = this.scopeReferenceCounts.get(value);\n if (referenceCount) {\n this.scopeReferenceCounts.set(value, referenceCount - 1);\n if (referenceCount == 1) {\n this.delegate.scopeDisconnected(value);\n }\n }\n };\n ScopeObserver.prototype.fetchScopesByIdentifierForElement = function (element) {\n var scopesByIdentifier = this.scopesByIdentifierByElement.get(element);\n if (!scopesByIdentifier) {\n scopesByIdentifier = new Map();\n this.scopesByIdentifierByElement.set(element, scopesByIdentifier);\n }\n return scopesByIdentifier;\n };\n return ScopeObserver;\n}();\nexport { ScopeObserver };","/** @hidden */\nexport function attributeValueContainsToken(attributeName, token) {\n return \"[\" + attributeName + \"~=\\\"\" + token + \"\\\"]\";\n}","/** @hidden */\nexport function defineTargetProperties(constructor) {\n var prototype = constructor.prototype;\n var targetNames = getTargetNamesForConstructor(constructor);\n targetNames.forEach(function (name) {\n var _a;\n return defineLinkedProperties(prototype, (_a = {}, _a[name + \"Target\"] = {\n get: function () {\n var target = this.targets.find(name);\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 });\n}\nfunction getTargetNamesForConstructor(constructor) {\n var ancestors = getAncestorsForConstructor(constructor);\n return Array.from(ancestors.reduce(function (targetNames, constructor) {\n getOwnTargetNamesForConstructor(constructor).forEach(function (name) {\n return targetNames.add(name);\n });\n return targetNames;\n }, new Set()));\n}\nfunction getAncestorsForConstructor(constructor) {\n var ancestors = [];\n while (constructor) {\n ancestors.push(constructor);\n constructor = Object.getPrototypeOf(constructor);\n }\n return ancestors;\n}\nfunction getOwnTargetNamesForConstructor(constructor) {\n var definition = constructor[\"targets\"];\n return Array.isArray(definition) ? definition : [];\n}\nfunction defineLinkedProperties(object, properties) {\n Object.keys(properties).forEach(function (name) {\n if (!(name in object)) {\n var descriptor = properties[name];\n Object.defineProperty(object, name, descriptor);\n }\n });\n}\nfunction capitalize(name) {\n return name.charAt(0).toUpperCase() + name.slice(1);\n}","import { attributeValueContainsToken } from \"./selectors\";\nvar TargetSet = /** @class */function () {\n function TargetSet(scope) {\n this.scope = scope;\n }\n Object.defineProperty(TargetSet.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TargetSet.prototype, \"identifier\", {\n get: function () {\n return this.scope.identifier;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TargetSet.prototype, \"schema\", {\n get: function () {\n return this.scope.schema;\n },\n enumerable: true,\n configurable: true\n });\n TargetSet.prototype.has = function (targetName) {\n return this.find(targetName) != null;\n };\n TargetSet.prototype.find = function () {\n var targetNames = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n targetNames[_i] = arguments[_i];\n }\n var selector = this.getSelectorForTargetNames(targetNames);\n return this.scope.findElement(selector);\n };\n TargetSet.prototype.findAll = function () {\n var targetNames = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n targetNames[_i] = arguments[_i];\n }\n var selector = this.getSelectorForTargetNames(targetNames);\n return this.scope.findAllElements(selector);\n };\n TargetSet.prototype.getSelectorForTargetNames = function (targetNames) {\n var _this = this;\n return targetNames.map(function (targetName) {\n return _this.getSelectorForTargetName(targetName);\n }).join(\", \");\n };\n TargetSet.prototype.getSelectorForTargetName = function (targetName) {\n var targetDescriptor = this.identifier + \".\" + targetName;\n return attributeValueContainsToken(this.schema.targetAttribute, targetDescriptor);\n };\n return TargetSet;\n}();\nexport { TargetSet };","export * from \"./src/multimap\";\nexport * from \"./src/indexed_multimap\";","var __extends = this && this.__extends || function () {\n var 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 return function (d, b) {\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\nimport { Multimap } from \"./multimap\";\nimport { add, del } from \"./set_operations\";\nvar IndexedMultimap = /** @class */function (_super) {\n __extends(IndexedMultimap, _super);\n function IndexedMultimap() {\n var _this = _super.call(this) || this;\n _this.keysByValue = new Map();\n return _this;\n }\n Object.defineProperty(IndexedMultimap.prototype, \"values\", {\n get: function () {\n return Array.from(this.keysByValue.keys());\n },\n enumerable: true,\n configurable: true\n });\n IndexedMultimap.prototype.add = function (key, value) {\n _super.prototype.add.call(this, key, value);\n add(this.keysByValue, value, key);\n };\n IndexedMultimap.prototype.delete = function (key, value) {\n _super.prototype.delete.call(this, key, value);\n del(this.keysByValue, value, key);\n };\n IndexedMultimap.prototype.hasValue = function (value) {\n return this.keysByValue.has(value);\n };\n IndexedMultimap.prototype.getKeysForValue = function (value) {\n var set = this.keysByValue.get(value);\n return set ? Array.from(set) : [];\n };\n return IndexedMultimap;\n}(Multimap);\nexport { IndexedMultimap };","import { add, del } from \"./set_operations\";\nvar Multimap = /** @class */function () {\n function Multimap() {\n this.valuesByKey = new Map();\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: true,\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: true,\n configurable: true\n });\n Multimap.prototype.add = function (key, value) {\n add(this.valuesByKey, key, value);\n };\n Multimap.prototype.delete = function (key, value) {\n del(this.valuesByKey, key, value);\n };\n Multimap.prototype.has = function (key, value) {\n var values = this.valuesByKey.get(key);\n return values != null && values.has(value);\n };\n Multimap.prototype.hasKey = function (key) {\n return this.valuesByKey.has(key);\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 Multimap.prototype.getValuesForKey = function (key) {\n var values = this.valuesByKey.get(key);\n return values ? Array.from(values) : [];\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 return Multimap;\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 if (!values) {\n values = new Set();\n map.set(key, values);\n }\n return values;\n}\nexport function prune(map, key) {\n var values = map.get(key);\n if (values != null && values.size == 0) {\n map.delete(key);\n }\n}","export * from \"./src/attribute_observer\";\nexport * from \"./src/element_observer\";\nexport * from \"./src/token_list_observer\";\nexport * from \"./src/value_list_observer\";","import { ElementObserver } from \"./element_observer\";\nvar AttributeObserver = /** @class */function () {\n function AttributeObserver(element, attributeName, delegate) {\n this.attributeName = attributeName;\n this.delegate = delegate;\n this.elementObserver = new ElementObserver(element, this);\n }\n Object.defineProperty(AttributeObserver.prototype, \"element\", {\n get: function () {\n return this.elementObserver.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AttributeObserver.prototype, \"selector\", {\n get: function () {\n return \"[\" + this.attributeName + \"]\";\n },\n enumerable: true,\n configurable: true\n });\n AttributeObserver.prototype.start = function () {\n this.elementObserver.start();\n };\n AttributeObserver.prototype.stop = function () {\n this.elementObserver.stop();\n };\n AttributeObserver.prototype.refresh = function () {\n this.elementObserver.refresh();\n };\n Object.defineProperty(AttributeObserver.prototype, \"started\", {\n get: function () {\n return this.elementObserver.started;\n },\n enumerable: true,\n configurable: true\n });\n // Element observer delegate\n AttributeObserver.prototype.matchElement = function (element) {\n return element.hasAttribute(this.attributeName);\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 AttributeObserver.prototype.elementMatched = function (element) {\n if (this.delegate.elementMatchedAttribute) {\n this.delegate.elementMatchedAttribute(element, this.attributeName);\n }\n };\n AttributeObserver.prototype.elementUnmatched = function (element) {\n if (this.delegate.elementUnmatchedAttribute) {\n this.delegate.elementUnmatchedAttribute(element, this.attributeName);\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 return AttributeObserver;\n}();\nexport { AttributeObserver };","var ElementObserver = /** @class */function () {\n function ElementObserver(element, delegate) {\n var _this = this;\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 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 ElementObserver.prototype.stop = function () {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n };\n ElementObserver.prototype.refresh = function () {\n if (this.started) {\n var matches = new Set(this.matchElementsInTree());\n for (var _i = 0, _a = Array.from(this.elements); _i < _a.length; _i++) {\n var element = _a[_i];\n if (!matches.has(element)) {\n this.removeElement(element);\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 };\n // Mutation record processing\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 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 ElementObserver.prototype.processAttributeChange = function (node, attributeName) {\n var element = node;\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 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 if (element) {\n this.processTree(element, this.removeElement);\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 if (element && this.elementIsActive(element)) {\n this.processTree(element, this.addElement);\n }\n }\n };\n // Element matching\n ElementObserver.prototype.matchElement = function (element) {\n return this.delegate.matchElement(element);\n };\n ElementObserver.prototype.matchElementsInTree = function (tree) {\n if (tree === void 0) {\n tree = this.element;\n }\n return this.delegate.matchElementsInTree(tree);\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 ElementObserver.prototype.elementFromNode = function (node) {\n if (node.nodeType == Node.ELEMENT_NODE) {\n return node;\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 };\n // Element tracking\n ElementObserver.prototype.addElement = function (element) {\n if (!this.elements.has(element)) {\n if (this.elementIsActive(element)) {\n this.elements.add(element);\n if (this.delegate.elementMatched) {\n this.delegate.elementMatched(element);\n }\n }\n }\n };\n ElementObserver.prototype.removeElement = function (element) {\n if (this.elements.has(element)) {\n this.elements.delete(element);\n if (this.delegate.elementUnmatched) {\n this.delegate.elementUnmatched(element);\n }\n }\n };\n return ElementObserver;\n}();\nexport { ElementObserver };","import { AttributeObserver } from \"./attribute_observer\";\nimport { Multimap } from \"@stimulus/multimap\";\nvar TokenListObserver = /** @class */function () {\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 Object.defineProperty(TokenListObserver.prototype, \"started\", {\n get: function () {\n return this.attributeObserver.started;\n },\n enumerable: true,\n configurable: true\n });\n TokenListObserver.prototype.start = function () {\n this.attributeObserver.start();\n };\n TokenListObserver.prototype.stop = function () {\n this.attributeObserver.stop();\n };\n TokenListObserver.prototype.refresh = function () {\n this.attributeObserver.refresh();\n };\n Object.defineProperty(TokenListObserver.prototype, \"element\", {\n get: function () {\n return this.attributeObserver.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TokenListObserver.prototype, \"attributeName\", {\n get: function () {\n return this.attributeObserver.attributeName;\n },\n enumerable: true,\n configurable: true\n });\n // Attribute observer delegate\n TokenListObserver.prototype.elementMatchedAttribute = function (element) {\n this.tokensMatched(this.readTokensForElement(element));\n };\n TokenListObserver.prototype.elementAttributeValueChanged = function (element) {\n var _a = this.refreshTokensForElement(element),\n unmatchedTokens = _a[0],\n matchedTokens = _a[1];\n this.tokensUnmatched(unmatchedTokens);\n this.tokensMatched(matchedTokens);\n };\n TokenListObserver.prototype.elementUnmatchedAttribute = function (element) {\n this.tokensUnmatched(this.tokensByElement.getValuesForKey(element));\n };\n TokenListObserver.prototype.tokensMatched = function (tokens) {\n var _this = this;\n tokens.forEach(function (token) {\n return _this.tokenMatched(token);\n });\n };\n TokenListObserver.prototype.tokensUnmatched = function (tokens) {\n var _this = this;\n tokens.forEach(function (token) {\n return _this.tokenUnmatched(token);\n });\n };\n TokenListObserver.prototype.tokenMatched = function (token) {\n this.delegate.tokenMatched(token);\n this.tokensByElement.add(token.element, token);\n };\n TokenListObserver.prototype.tokenUnmatched = function (token) {\n this.delegate.tokenUnmatched(token);\n this.tokensByElement.delete(token.element, token);\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 if (firstDifferingIndex == -1) {\n return [[], []];\n } else {\n return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)];\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 return TokenListObserver;\n}();\nexport { TokenListObserver };\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}\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}\nfunction tokensAreEqual(left, right) {\n return left && right && left.index == right.index && left.content == right.content;\n}","import { TokenListObserver } from \"./token_list_observer\";\nvar ValueListObserver = /** @class */function () {\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 Object.defineProperty(ValueListObserver.prototype, \"started\", {\n get: function () {\n return this.tokenListObserver.started;\n },\n enumerable: true,\n configurable: true\n });\n ValueListObserver.prototype.start = function () {\n this.tokenListObserver.start();\n };\n ValueListObserver.prototype.stop = function () {\n this.tokenListObserver.stop();\n };\n ValueListObserver.prototype.refresh = function () {\n this.tokenListObserver.refresh();\n };\n Object.defineProperty(ValueListObserver.prototype, \"element\", {\n get: function () {\n return this.tokenListObserver.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueListObserver.prototype, \"attributeName\", {\n get: function () {\n return this.tokenListObserver.attributeName;\n },\n enumerable: true,\n configurable: true\n });\n ValueListObserver.prototype.tokenMatched = function (token) {\n var element = token.element;\n var value = this.fetchParseResultForToken(token).value;\n if (value) {\n this.fetchValuesByTokenForElement(element).set(token, value);\n this.delegate.elementMatchedValue(element, value);\n }\n };\n ValueListObserver.prototype.tokenUnmatched = function (token) {\n var element = token.element;\n var value = this.fetchParseResultForToken(token).value;\n if (value) {\n this.fetchValuesByTokenForElement(element).delete(token);\n this.delegate.elementUnmatchedValue(element, value);\n }\n };\n ValueListObserver.prototype.fetchParseResultForToken = function (token) {\n var parseResult = this.parseResultsByToken.get(token);\n if (!parseResult) {\n parseResult = this.parseToken(token);\n this.parseResultsByToken.set(token, parseResult);\n }\n return parseResult;\n };\n ValueListObserver.prototype.fetchValuesByTokenForElement = function (element) {\n var valuesByToken = this.valuesByTokenByElement.get(element);\n if (!valuesByToken) {\n valuesByToken = new Map();\n this.valuesByTokenByElement.set(element, valuesByToken);\n }\n return valuesByToken;\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 return ValueListObserver;\n}();\nexport { ValueListObserver };","export function definitionsFromContext(context) {\n return context.keys().map(function (key) {\n return definitionForModuleWithContextAndKey(context, key);\n }).filter(function (value) {\n return value;\n });\n}\nfunction definitionForModuleWithContextAndKey(context, key) {\n var identifier = identifierForContextKey(key);\n if (identifier) {\n return definitionForModuleAndIdentifier(context(key), identifier);\n }\n}\nfunction definitionForModuleAndIdentifier(module, identifier) {\n var controllerConstructor = module.default;\n if (typeof controllerConstructor == \"function\") {\n return {\n identifier: identifier,\n controllerConstructor: controllerConstructor\n };\n }\n}\nexport function identifierForContextKey(key) {\n var logicalName = (key.match(/^(?:\\.\\/)?(.+)(?:[_-]controller\\..+?)$/) || [])[1];\n if (logicalName) {\n return logicalName.replace(/_/g, \"-\").replace(/\\//g, \"--\");\n }\n}","(function (global, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports) : typeof define === \"function\" && define.amd ? define([\"exports\"], factory) : factory(global.ActiveStorage = {});\n})(this, function (exports) {\n \"use strict\";\n\n function createCommonjsModule(fn, module) {\n return module = {\n exports: {}\n }, fn(module, module.exports), module.exports;\n }\n var sparkMd5 = createCommonjsModule(function (module, exports) {\n (function (factory) {\n {\n module.exports = factory();\n }\n })(function (undefined) {\n var hex_chr = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\"];\n function md5cycle(x, k) {\n var a = x[0],\n b = x[1],\n c = x[2],\n d = x[3];\n a += (b & c | ~b & d) + k[0] - 680876936 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[1] - 389564586 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[2] + 606105819 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[3] - 1044525330 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[4] - 176418897 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[5] + 1200080426 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[6] - 1473231341 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[7] - 45705983 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[8] + 1770035416 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[9] - 1958414417 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[10] - 42063 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[11] - 1990404162 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[12] + 1804603682 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[13] - 40341101 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[14] - 1502002290 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[15] + 1236535329 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & d | c & ~d) + k[1] - 165796510 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[6] - 1069501632 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[11] + 643717713 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[0] - 373897302 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[5] - 701558691 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[10] + 38016083 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[15] - 660478335 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[4] - 405537848 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[9] + 568446438 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[14] - 1019803690 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[3] - 187363961 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[8] + 1163531501 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[13] - 1444681467 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[2] - 51403784 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[7] + 1735328473 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[12] - 1926607734 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b ^ c ^ d) + k[5] - 378558 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[8] - 2022574463 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[11] + 1839030562 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[14] - 35309556 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[1] - 1530992060 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[4] + 1272893353 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[7] - 155497632 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[10] - 1094730640 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[13] + 681279174 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[0] - 358537222 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[3] - 722521979 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[6] + 76029189 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[9] - 640364487 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[12] - 421815835 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[15] + 530742520 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[2] - 995338651 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n x[0] = a + x[0] | 0;\n x[1] = b + x[1] | 0;\n x[2] = c + x[2] | 0;\n x[3] = d + x[3] | 0;\n }\n function md5blk(s) {\n var md5blks = [],\n i;\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);\n }\n return md5blks;\n }\n function md5blk_array(a) {\n var md5blks = [],\n i;\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);\n }\n return md5blks;\n }\n function md51(s) {\n var n = s.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk(s.substring(i - 64, i)));\n }\n s = s.substring(i - 64);\n length = s.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);\n }\n tail[i >> 2] |= 128 << (i % 4 << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(state, tail);\n return state;\n }\n function md51_array(a) {\n var n = a.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk_array(a.subarray(i - 64, i)));\n }\n a = i - 64 < n ? a.subarray(i - 64) : new Uint8Array(0);\n length = a.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= a[i] << (i % 4 << 3);\n }\n tail[i >> 2] |= 128 << (i % 4 << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(state, tail);\n return state;\n }\n function rhex(n) {\n var s = \"\",\n j;\n for (j = 0; j < 4; j += 1) {\n s += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15];\n }\n return s;\n }\n function hex(x) {\n var i;\n for (i = 0; i < x.length; i += 1) {\n x[i] = rhex(x[i]);\n }\n return x.join(\"\");\n }\n if (hex(md51(\"hello\")) !== \"5d41402abc4b2a76b9719d911017c592\") ;\n if (typeof ArrayBuffer !== \"undefined\" && !ArrayBuffer.prototype.slice) {\n (function () {\n function clamp(val, length) {\n val = val | 0 || 0;\n if (val < 0) {\n return Math.max(val + length, 0);\n }\n return Math.min(val, length);\n }\n ArrayBuffer.prototype.slice = function (from, to) {\n var length = this.byteLength,\n begin = clamp(from, length),\n end = length,\n num,\n target,\n targetArray,\n sourceArray;\n if (to !== undefined) {\n end = clamp(to, length);\n }\n if (begin > end) {\n return new ArrayBuffer(0);\n }\n num = end - begin;\n target = new ArrayBuffer(num);\n targetArray = new Uint8Array(target);\n sourceArray = new Uint8Array(this, begin, num);\n targetArray.set(sourceArray);\n return target;\n };\n })();\n }\n function toUtf8(str) {\n if (/[\\u0080-\\uFFFF]/.test(str)) {\n str = unescape(encodeURIComponent(str));\n }\n return str;\n }\n function utf8Str2ArrayBuffer(str, returnUInt8Array) {\n var length = str.length,\n buff = new ArrayBuffer(length),\n arr = new Uint8Array(buff),\n i;\n for (i = 0; i < length; i += 1) {\n arr[i] = str.charCodeAt(i);\n }\n return returnUInt8Array ? arr : buff;\n }\n function arrayBuffer2Utf8Str(buff) {\n return String.fromCharCode.apply(null, new Uint8Array(buff));\n }\n function concatenateArrayBuffers(first, second, returnUInt8Array) {\n var result = new Uint8Array(first.byteLength + second.byteLength);\n result.set(new Uint8Array(first));\n result.set(new Uint8Array(second), first.byteLength);\n return returnUInt8Array ? result : result.buffer;\n }\n function hexToBinaryString(hex) {\n var bytes = [],\n length = hex.length,\n x;\n for (x = 0; x < length - 1; x += 2) {\n bytes.push(parseInt(hex.substr(x, 2), 16));\n }\n return String.fromCharCode.apply(String, bytes);\n }\n function SparkMD5() {\n this.reset();\n }\n SparkMD5.prototype.append = function (str) {\n this.appendBinary(toUtf8(str));\n return this;\n };\n SparkMD5.prototype.appendBinary = function (contents) {\n this._buff += contents;\n this._length += contents.length;\n var length = this._buff.length,\n i;\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));\n }\n this._buff = this._buff.substring(i - 64);\n return this;\n };\n SparkMD5.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n i,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n ret;\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff.charCodeAt(i) << (i % 4 << 3);\n }\n this._finish(tail, length);\n ret = hex(this._hash);\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n this.reset();\n return ret;\n };\n SparkMD5.prototype.reset = function () {\n this._buff = \"\";\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n return this;\n };\n SparkMD5.prototype.getState = function () {\n return {\n buff: this._buff,\n length: this._length,\n hash: this._hash\n };\n };\n SparkMD5.prototype.setState = function (state) {\n this._buff = state.buff;\n this._length = state.length;\n this._hash = state.hash;\n return this;\n };\n SparkMD5.prototype.destroy = function () {\n delete this._hash;\n delete this._buff;\n delete this._length;\n };\n SparkMD5.prototype._finish = function (tail, length) {\n var i = length,\n tmp,\n lo,\n hi;\n tail[i >> 2] |= 128 << (i % 4 << 3);\n if (i > 55) {\n md5cycle(this._hash, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n tmp = this._length * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(this._hash, tail);\n };\n SparkMD5.hash = function (str, raw) {\n return SparkMD5.hashBinary(toUtf8(str), raw);\n };\n SparkMD5.hashBinary = function (content, raw) {\n var hash = md51(content),\n ret = hex(hash);\n return raw ? hexToBinaryString(ret) : ret;\n };\n SparkMD5.ArrayBuffer = function () {\n this.reset();\n };\n SparkMD5.ArrayBuffer.prototype.append = function (arr) {\n var buff = concatenateArrayBuffers(this._buff.buffer, arr, true),\n length = buff.length,\n i;\n this._length += arr.byteLength;\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));\n }\n this._buff = i - 64 < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);\n return this;\n };\n SparkMD5.ArrayBuffer.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n i,\n ret;\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff[i] << (i % 4 << 3);\n }\n this._finish(tail, length);\n ret = hex(this._hash);\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n this.reset();\n return ret;\n };\n SparkMD5.ArrayBuffer.prototype.reset = function () {\n this._buff = new Uint8Array(0);\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n return this;\n };\n SparkMD5.ArrayBuffer.prototype.getState = function () {\n var state = SparkMD5.prototype.getState.call(this);\n state.buff = arrayBuffer2Utf8Str(state.buff);\n return state;\n };\n SparkMD5.ArrayBuffer.prototype.setState = function (state) {\n state.buff = utf8Str2ArrayBuffer(state.buff, true);\n return SparkMD5.prototype.setState.call(this, state);\n };\n SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;\n SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;\n SparkMD5.ArrayBuffer.hash = function (arr, raw) {\n var hash = md51_array(new Uint8Array(arr)),\n ret = hex(hash);\n return raw ? hexToBinaryString(ret) : ret;\n };\n return SparkMD5;\n });\n });\n var classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n };\n var createClass = function () {\n function 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 return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n }();\n var fileSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;\n var FileChecksum = function () {\n createClass(FileChecksum, null, [{\n key: \"create\",\n value: function create(file, callback) {\n var instance = new FileChecksum(file);\n instance.create(callback);\n }\n }]);\n function FileChecksum(file) {\n classCallCheck(this, FileChecksum);\n this.file = file;\n this.chunkSize = 2097152;\n this.chunkCount = Math.ceil(this.file.size / this.chunkSize);\n this.chunkIndex = 0;\n }\n createClass(FileChecksum, [{\n key: \"create\",\n value: function create(callback) {\n var _this = this;\n this.callback = callback;\n this.md5Buffer = new sparkMd5.ArrayBuffer();\n this.fileReader = new FileReader();\n this.fileReader.addEventListener(\"load\", function (event) {\n return _this.fileReaderDidLoad(event);\n });\n this.fileReader.addEventListener(\"error\", function (event) {\n return _this.fileReaderDidError(event);\n });\n this.readNextChunk();\n }\n }, {\n key: \"fileReaderDidLoad\",\n value: function fileReaderDidLoad(event) {\n this.md5Buffer.append(event.target.result);\n if (!this.readNextChunk()) {\n var binaryDigest = this.md5Buffer.end(true);\n var base64digest = btoa(binaryDigest);\n this.callback(null, base64digest);\n }\n }\n }, {\n key: \"fileReaderDidError\",\n value: function fileReaderDidError(event) {\n this.callback(\"Error reading \" + this.file.name);\n }\n }, {\n key: \"readNextChunk\",\n value: function readNextChunk() {\n if (this.chunkIndex < this.chunkCount || this.chunkIndex == 0 && this.chunkCount == 0) {\n var start = this.chunkIndex * this.chunkSize;\n var end = Math.min(start + this.chunkSize, this.file.size);\n var bytes = fileSlice.call(this.file, start, end);\n this.fileReader.readAsArrayBuffer(bytes);\n this.chunkIndex++;\n return true;\n } else {\n return false;\n }\n }\n }]);\n return FileChecksum;\n }();\n function getMetaValue(name) {\n var element = findElement(document.head, 'meta[name=\"' + name + '\"]');\n if (element) {\n return element.getAttribute(\"content\");\n }\n }\n function findElements(root, selector) {\n if (typeof root == \"string\") {\n selector = root;\n root = document;\n }\n var elements = root.querySelectorAll(selector);\n return toArray$1(elements);\n }\n function findElement(root, selector) {\n if (typeof root == \"string\") {\n selector = root;\n root = document;\n }\n return root.querySelector(selector);\n }\n function dispatchEvent(element, type) {\n var eventInit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var disabled = element.disabled;\n var bubbles = eventInit.bubbles,\n cancelable = eventInit.cancelable,\n detail = eventInit.detail;\n var event = document.createEvent(\"Event\");\n event.initEvent(type, bubbles || true, cancelable || true);\n event.detail = detail || {};\n try {\n element.disabled = false;\n element.dispatchEvent(event);\n } finally {\n element.disabled = disabled;\n }\n return event;\n }\n function toArray$1(value) {\n if (Array.isArray(value)) {\n return value;\n } else if (Array.from) {\n return Array.from(value);\n } else {\n return [].slice.call(value);\n }\n }\n var BlobRecord = function () {\n function BlobRecord(file, checksum, url) {\n var _this = this;\n classCallCheck(this, BlobRecord);\n this.file = file;\n this.attributes = {\n filename: file.name,\n content_type: file.type,\n byte_size: file.size,\n checksum: checksum\n };\n this.xhr = new XMLHttpRequest();\n this.xhr.open(\"POST\", url, true);\n this.xhr.responseType = \"json\";\n this.xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n this.xhr.setRequestHeader(\"Accept\", \"application/json\");\n this.xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n this.xhr.setRequestHeader(\"X-CSRF-Token\", getMetaValue(\"csrf-token\"));\n this.xhr.addEventListener(\"load\", function (event) {\n return _this.requestDidLoad(event);\n });\n this.xhr.addEventListener(\"error\", function (event) {\n return _this.requestDidError(event);\n });\n }\n createClass(BlobRecord, [{\n key: \"create\",\n value: function create(callback) {\n this.callback = callback;\n this.xhr.send(JSON.stringify({\n blob: this.attributes\n }));\n }\n }, {\n key: \"requestDidLoad\",\n value: function requestDidLoad(event) {\n if (this.status >= 200 && this.status < 300) {\n var response = this.response;\n var direct_upload = response.direct_upload;\n delete response.direct_upload;\n this.attributes = response;\n this.directUploadData = direct_upload;\n this.callback(null, this.toJSON());\n } else {\n this.requestDidError(event);\n }\n }\n }, {\n key: \"requestDidError\",\n value: function requestDidError(event) {\n this.callback('Error creating Blob for \"' + this.file.name + '\". Status: ' + this.status);\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var result = {};\n for (var key in this.attributes) {\n result[key] = this.attributes[key];\n }\n return result;\n }\n }, {\n key: \"status\",\n get: function get$$1() {\n return this.xhr.status;\n }\n }, {\n key: \"response\",\n get: function get$$1() {\n var _xhr = this.xhr,\n responseType = _xhr.responseType,\n response = _xhr.response;\n if (responseType == \"json\") {\n return response;\n } else {\n return JSON.parse(response);\n }\n }\n }]);\n return BlobRecord;\n }();\n var BlobUpload = function () {\n function BlobUpload(blob) {\n var _this = this;\n classCallCheck(this, BlobUpload);\n this.blob = blob;\n this.file = blob.file;\n var _blob$directUploadDat = blob.directUploadData,\n url = _blob$directUploadDat.url,\n headers = _blob$directUploadDat.headers;\n this.xhr = new XMLHttpRequest();\n this.xhr.open(\"PUT\", url, true);\n this.xhr.responseType = \"text\";\n for (var key in headers) {\n this.xhr.setRequestHeader(key, headers[key]);\n }\n this.xhr.addEventListener(\"load\", function (event) {\n return _this.requestDidLoad(event);\n });\n this.xhr.addEventListener(\"error\", function (event) {\n return _this.requestDidError(event);\n });\n }\n createClass(BlobUpload, [{\n key: \"create\",\n value: function create(callback) {\n this.callback = callback;\n this.xhr.send(this.file.slice());\n }\n }, {\n key: \"requestDidLoad\",\n value: function requestDidLoad(event) {\n var _xhr = this.xhr,\n status = _xhr.status,\n response = _xhr.response;\n if (status >= 200 && status < 300) {\n this.callback(null, response);\n } else {\n this.requestDidError(event);\n }\n }\n }, {\n key: \"requestDidError\",\n value: function requestDidError(event) {\n this.callback('Error storing \"' + this.file.name + '\". Status: ' + this.xhr.status);\n }\n }]);\n return BlobUpload;\n }();\n var id = 0;\n var DirectUpload = function () {\n function DirectUpload(file, url, delegate) {\n classCallCheck(this, DirectUpload);\n this.id = ++id;\n this.file = file;\n this.url = url;\n this.delegate = delegate;\n }\n createClass(DirectUpload, [{\n key: \"create\",\n value: function create(callback) {\n var _this = this;\n FileChecksum.create(this.file, function (error, checksum) {\n if (error) {\n callback(error);\n return;\n }\n var blob = new BlobRecord(_this.file, checksum, _this.url);\n notify(_this.delegate, \"directUploadWillCreateBlobWithXHR\", blob.xhr);\n blob.create(function (error) {\n if (error) {\n callback(error);\n } else {\n var upload = new BlobUpload(blob);\n notify(_this.delegate, \"directUploadWillStoreFileWithXHR\", upload.xhr);\n upload.create(function (error) {\n if (error) {\n callback(error);\n } else {\n callback(null, blob.toJSON());\n }\n });\n }\n });\n });\n }\n }]);\n return DirectUpload;\n }();\n function notify(object, methodName) {\n if (object && typeof object[methodName] == \"function\") {\n for (var _len = arguments.length, messages = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n messages[_key - 2] = arguments[_key];\n }\n return object[methodName].apply(object, messages);\n }\n }\n var DirectUploadController = function () {\n function DirectUploadController(input, file) {\n classCallCheck(this, DirectUploadController);\n this.input = input;\n this.file = file;\n this.directUpload = new DirectUpload(this.file, this.url, this);\n this.dispatch(\"initialize\");\n }\n createClass(DirectUploadController, [{\n key: \"start\",\n value: function start(callback) {\n var _this = this;\n var hiddenInput = document.createElement(\"input\");\n hiddenInput.type = \"hidden\";\n hiddenInput.name = this.input.name;\n this.input.insertAdjacentElement(\"beforebegin\", hiddenInput);\n this.dispatch(\"start\");\n this.directUpload.create(function (error, attributes) {\n if (error) {\n hiddenInput.parentNode.removeChild(hiddenInput);\n _this.dispatchError(error);\n } else {\n hiddenInput.value = attributes.signed_id;\n }\n _this.dispatch(\"end\");\n callback(error);\n });\n }\n }, {\n key: \"uploadRequestDidProgress\",\n value: function uploadRequestDidProgress(event) {\n var progress = event.loaded / event.total * 100;\n if (progress) {\n this.dispatch(\"progress\", {\n progress: progress\n });\n }\n }\n }, {\n key: \"dispatch\",\n value: function dispatch(name) {\n var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n detail.file = this.file;\n detail.id = this.directUpload.id;\n return dispatchEvent(this.input, \"direct-upload:\" + name, {\n detail: detail\n });\n }\n }, {\n key: \"dispatchError\",\n value: function dispatchError(error) {\n var event = this.dispatch(\"error\", {\n error: error\n });\n if (!event.defaultPrevented) {\n alert(error);\n }\n }\n }, {\n key: \"directUploadWillCreateBlobWithXHR\",\n value: function directUploadWillCreateBlobWithXHR(xhr) {\n this.dispatch(\"before-blob-request\", {\n xhr: xhr\n });\n }\n }, {\n key: \"directUploadWillStoreFileWithXHR\",\n value: function directUploadWillStoreFileWithXHR(xhr) {\n var _this2 = this;\n this.dispatch(\"before-storage-request\", {\n xhr: xhr\n });\n xhr.upload.addEventListener(\"progress\", function (event) {\n return _this2.uploadRequestDidProgress(event);\n });\n }\n }, {\n key: \"url\",\n get: function get$$1() {\n return this.input.getAttribute(\"data-direct-upload-url\");\n }\n }]);\n return DirectUploadController;\n }();\n var inputSelector = \"input[type=file][data-direct-upload-url]:not([disabled])\";\n var DirectUploadsController = function () {\n function DirectUploadsController(form) {\n classCallCheck(this, DirectUploadsController);\n this.form = form;\n this.inputs = findElements(form, inputSelector).filter(function (input) {\n return input.files.length;\n });\n }\n createClass(DirectUploadsController, [{\n key: \"start\",\n value: function start(callback) {\n var _this = this;\n var controllers = this.createDirectUploadControllers();\n var startNextController = function startNextController() {\n var controller = controllers.shift();\n if (controller) {\n controller.start(function (error) {\n if (error) {\n callback(error);\n _this.dispatch(\"end\");\n } else {\n startNextController();\n }\n });\n } else {\n callback();\n _this.dispatch(\"end\");\n }\n };\n this.dispatch(\"start\");\n startNextController();\n }\n }, {\n key: \"createDirectUploadControllers\",\n value: function createDirectUploadControllers() {\n var controllers = [];\n this.inputs.forEach(function (input) {\n toArray$1(input.files).forEach(function (file) {\n var controller = new DirectUploadController(input, file);\n controllers.push(controller);\n });\n });\n return controllers;\n }\n }, {\n key: \"dispatch\",\n value: function dispatch(name) {\n var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return dispatchEvent(this.form, \"direct-uploads:\" + name, {\n detail: detail\n });\n }\n }]);\n return DirectUploadsController;\n }();\n var processingAttribute = \"data-direct-uploads-processing\";\n var submitButtonsByForm = new WeakMap();\n var started = false;\n function start() {\n if (!started) {\n started = true;\n document.addEventListener(\"click\", didClick, true);\n document.addEventListener(\"submit\", didSubmitForm);\n document.addEventListener(\"ajax:before\", didSubmitRemoteElement);\n }\n }\n function didClick(event) {\n var target = event.target;\n if ((target.tagName == \"INPUT\" || target.tagName == \"BUTTON\") && target.type == \"submit\" && target.form) {\n submitButtonsByForm.set(target.form, target);\n }\n }\n function didSubmitForm(event) {\n handleFormSubmissionEvent(event);\n }\n function didSubmitRemoteElement(event) {\n if (event.target.tagName == \"FORM\") {\n handleFormSubmissionEvent(event);\n }\n }\n function handleFormSubmissionEvent(event) {\n var form = event.target;\n if (form.hasAttribute(processingAttribute)) {\n event.preventDefault();\n return;\n }\n var controller = new DirectUploadsController(form);\n var inputs = controller.inputs;\n if (inputs.length) {\n event.preventDefault();\n form.setAttribute(processingAttribute, \"\");\n inputs.forEach(disable);\n controller.start(function (error) {\n form.removeAttribute(processingAttribute);\n if (error) {\n inputs.forEach(enable);\n } else {\n submitForm(form);\n }\n });\n }\n }\n function submitForm(form) {\n var button = submitButtonsByForm.get(form) || findElement(form, \"input[type=submit], button[type=submit]\");\n if (button) {\n var _button = button,\n disabled = _button.disabled;\n button.disabled = false;\n button.focus();\n button.click();\n button.disabled = disabled;\n } else {\n button = document.createElement(\"input\");\n button.type = \"submit\";\n button.style.display = \"none\";\n form.appendChild(button);\n button.click();\n form.removeChild(button);\n }\n submitButtonsByForm.delete(form);\n }\n function disable(input) {\n input.disabled = true;\n }\n function enable(input) {\n input.disabled = false;\n }\n function autostart() {\n if (window.ActiveStorage) {\n start();\n }\n }\n setTimeout(autostart, 1);\n exports.start = start;\n exports.DirectUpload = DirectUpload;\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\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 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\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 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 return r;\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;\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 function setupHelperFunctions() {\n self.utils = {\n getDaysInMonth: function (month, yr) {\n if (month === void 0) {\n month = self.currentMonth;\n }\n if (yr === void 0) {\n yr = self.currentYear;\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 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 if (self.selectedDates.length || self.config.noCalendar) {\n if (self.config.enableTime) {\n setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj : undefined);\n }\n updateValue(false);\n }\n setCalendarWidth();\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n if (!self.isMobile && isSafari) {\n positionCalendar();\n }\n triggerEvent(\"onReady\");\n }\n function getClosestActiveElement() {\n var _a;\n return ((_a = self.calendarContainer) === null || _a === void 0 ? void 0 : _a.getRootNode()).activeElement || document.activeElement;\n }\n function bindToInstance(fn) {\n return fn.bind(self);\n }\n function setCalendarWidth() {\n var config = self.config;\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 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 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 if (e !== undefined && e.type !== \"blur\") {\n timeWrapper(e);\n }\n var prevValue = self._input.value;\n setHoursFromInputs();\n updateValue();\n if (self._input.value !== prevValue) {\n self._debouncedChange();\n }\n }\n function ampm2military(hour, amPM) {\n return hour % 12 + 12 * int(amPM === self.l10n.amPM[1]);\n }\n function military2ampm(hour) {\n switch (hour % 24) {\n case 0:\n case 12:\n return 12;\n default:\n return hour % 12;\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 if (self.amPM !== undefined) {\n hours = ampm2military(hours, self.amPM.textContent);\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 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 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 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 setHours(hours, minutes, seconds);\n }\n function setHoursFromDate(dateObj) {\n var date = dateObj || self.latestSelectedDateObj;\n if (date && date instanceof Date) {\n setHours(date.getHours(), date.getMinutes(), date.getSeconds());\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 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 function onYearInput(event) {\n var eventTarget = getEventTarget(event);\n var year = parseInt(eventTarget.value) + (event.delta || 0);\n if (year / 1000 > 1 || event.key === \"Enter\" && !/[^\\d]/.test(year.toString())) {\n changeYear(year);\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 self._handlers.push({\n remove: function () {\n return element.removeEventListener(event, handler, options);\n }\n });\n }\n function triggerChange() {\n triggerEvent(\"onChange\");\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 if (self.isMobile) {\n setupMobile();\n return;\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 if (self.calendarContainer !== undefined) {\n bind(self.calendarContainer, \"keydown\", onKeyDown);\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 if (self.config.clickOpens === true) {\n bind(self._input, \"focus\", self.open);\n bind(self._input, \"click\", self.open);\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 if (self.timeContainer !== undefined && self.minuteElement !== undefined && self.hourElement !== undefined) {\n var selText = function (e) {\n return getEventTarget(e).select();\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 if (self.amPM !== undefined) {\n bind(self.amPM, \"click\", function (e) {\n updateTime(e);\n });\n }\n }\n if (self.config.allowInput) {\n bind(self._input, \"blur\", onBlur);\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 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 if (triggerChange && self.currentYear !== oldYear) {\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n if (triggerChange && (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {\n triggerEvent(\"onMonthChange\");\n }\n self.redraw();\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 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 function build() {\n var fragment = window.document.createDocumentFragment();\n self.calendarContainer = createElement(\"div\", \"flatpickr-calendar\");\n self.calendarContainer.tabIndex = -1;\n if (!self.config.noCalendar) {\n fragment.appendChild(buildMonthNav());\n self.innerContainer = createElement(\"div\", \"flatpickr-innerContainer\");\n if (self.config.weekNumbers) {\n var _a = buildWeeks(),\n weekWrapper = _a.weekWrapper,\n weekNumbers = _a.weekNumbers;\n self.innerContainer.appendChild(weekWrapper);\n self.weekNumbers = weekNumbers;\n self.weekWrapper = weekWrapper;\n }\n self.rContainer = createElement(\"div\", \"flatpickr-rContainer\");\n self.rContainer.appendChild(buildWeekdays());\n if (!self.daysContainer) {\n self.daysContainer = createElement(\"div\", \"flatpickr-days\");\n self.daysContainer.tabIndex = -1;\n }\n buildDays();\n self.rContainer.appendChild(self.daysContainer);\n self.innerContainer.appendChild(self.rContainer);\n fragment.appendChild(self.innerContainer);\n }\n if (self.config.enableTime) {\n fragment.appendChild(buildTime());\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 if (self.config.inline || self.config.static) {\n self.calendarContainer.classList.add(self.config.inline ? \"inline\" : \"static\");\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 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 if (!self.config.static && !self.config.inline) (self.config.appendTo !== undefined ? self.config.appendTo : window.document.body).appendChild(self.calendarContainer);\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 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 if (dateIsEnabled) {\n dayElement.tabIndex = -1;\n if (isDateSelected(date)) {\n dayElement.classList.add(\"selected\");\n self.selectedDateElem = dayElement;\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 if (self.config.mode === \"range\") {\n if (isDateInRange(date) && !isDateSelected(date)) dayElement.classList.add(\"inRange\");\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 triggerEvent(\"onDayCreate\", dayElement);\n return dayElement;\n }\n function focusOnDayElem(targetNode) {\n targetNode.focus();\n if (self.config.mode === \"range\") onMouseOver(targetNode);\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 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 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 return undefined;\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 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 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 self.changeMonth(loopDelta);\n focusOnDay(getFirstAvailableDay(loopDelta), 0);\n return undefined;\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 if (startElem === undefined) {\n self._input.focus();\n } else if (!dayFocused) {\n focusOnDayElem(startElem);\n } else {\n getNextAvailableDay(startElem, offset);\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 for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {\n days.appendChild(createDay(\"flatpickr-day \" + prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));\n }\n for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {\n days.appendChild(createDay(\"flatpickr-day\", new Date(year, month, dayNumber), dayNumber, dayIndex));\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 var dayContainer = createElement(\"div\", \"dayContainer\");\n dayContainer.appendChild(days);\n return dayContainer;\n }\n function buildDays() {\n if (self.daysContainer === undefined) {\n return;\n }\n clearNode(self.daysContainer);\n if (self.weekNumbers) clearNode(self.weekNumbers);\n var frag = document.createDocumentFragment();\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 self.daysContainer.appendChild(frag);\n self.days = self.daysContainer.firstChild;\n if (self.config.mode === \"range\" && self.selectedDates.length === 1) {\n onMouseOver();\n }\n }\n function buildMonthSwitch() {\n if (self.config.showMonths > 1 || self.config.monthSelectorType !== \"dropdown\") return;\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 return !(self.config.maxDate !== undefined && self.currentYear === self.config.maxDate.getFullYear() && month > self.config.maxDate.getMonth());\n };\n self.monthsDropdownContainer.tabIndex = -1;\n self.monthsDropdownContainer.innerHTML = \"\";\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 if (self.currentMonth === i) {\n month.selected = true;\n }\n self.monthsDropdownContainer.appendChild(month);\n }\n }\n function buildMonth() {\n var container = createElement(\"div\", \"flatpickr-month\");\n var monthNavFragment = window.document.createDocumentFragment();\n var monthElement;\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 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 if (self.config.minDate) {\n yearElement.setAttribute(\"min\", self.config.minDate.getFullYear().toString());\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 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 function buildMonths() {\n clearNode(self.monthNav);\n self.monthNav.appendChild(self.prevMonthNav);\n if (self.config.showMonths) {\n self.yearElements = [];\n self.monthElements = [];\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 self.monthNav.appendChild(self.nextMonthNav);\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 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 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 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 return self.timeContainer;\n }\n function buildWeekdays() {\n if (!self.weekdayContainer) self.weekdayContainer = createElement(\"div\", \"flatpickr-weekdays\");else clearNode(self.weekdayContainer);\n for (var i = self.config.showMonths; i--;) {\n var container = createElement(\"div\", \"flatpickr-weekdaycontainer\");\n self.weekdayContainer.appendChild(container);\n }\n updateWeekdays();\n return self.weekdayContainer;\n }\n function updateWeekdays() {\n if (!self.weekdayContainer) {\n return;\n }\n var firstDayOfWeek = self.l10n.firstDayOfWeek;\n var weekdays = __spreadArrays(self.l10n.weekdays.shorthand);\n if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {\n weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek));\n }\n for (var i = self.config.showMonths; i--;) {\n self.weekdayContainer.children[i].innerHTML = \"\\n \\n \" + weekdays.join(\"\") + \"\\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 function changeMonth(value, isOffset) {\n if (isOffset === void 0) {\n isOffset = true;\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 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 buildDays();\n triggerEvent(\"onMonthChange\");\n updateNavigationCurrentMonth();\n }\n function clear(triggerChangeEvent, toInitial) {\n if (triggerChangeEvent === void 0) {\n triggerChangeEvent = true;\n }\n if (toInitial === void 0) {\n toInitial = true;\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 if (toInitial === true) {\n self.currentYear = self._initialDate.getFullYear();\n self.currentMonth = self._initialDate.getMonth();\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 setHours(hours, minutes, seconds);\n }\n self.redraw();\n if (triggerChangeEvent) triggerEvent(\"onChange\");\n }\n function close() {\n self.isOpen = false;\n if (!self.isMobile) {\n if (self.calendarContainer !== undefined) {\n self.calendarContainer.classList.remove(\"open\");\n }\n if (self._input !== undefined) {\n self._input.classList.remove(\"active\");\n }\n }\n triggerEvent(\"onClose\");\n }\n function destroy() {\n if (self.config !== undefined) triggerEvent(\"onDestroy\");\n for (var i = self._handlers.length; i--;) {\n self._handlers[i].remove();\n }\n self._handlers = [];\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 if (wrapper.parentNode) {\n while (wrapper.firstChild) wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);\n wrapper.parentNode.removeChild(wrapper);\n }\n } else self.calendarContainer.parentNode.removeChild(self.calendarContainer);\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 if (self.input) {\n self.input.type = self.input._type;\n self.input.classList.remove(\"flatpickr-input\");\n self.input.removeAttribute(\"readonly\");\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 function isCalendarElem(elem) {\n return self.calendarContainer.contains(elem);\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 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 if (self.timeContainer !== undefined && self.minuteElement !== undefined && self.hourElement !== undefined && self.input.value !== \"\" && self.input.value !== undefined) {\n updateTime();\n }\n self.close();\n if (self.config && self.config.mode === \"range\" && self.selectedDates.length === 1) self.clear(false);\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 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 if (isNewYear) {\n self.redraw();\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n }\n function isEnabled(date, timeless) {\n var _a;\n if (timeless === void 0) {\n timeless = true;\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 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 return !bool;\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 function onBlur(e) {\n var isInput = e.target === self._input;\n var valueChanged = self._input.value.trimEnd() !== getDateStr();\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 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 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 switch (e.keyCode) {\n case 13:\n if (isTimeObj) {\n e.preventDefault();\n updateTime();\n focusAndClose();\n } else selectDate(e);\n break;\n case 27:\n e.preventDefault();\n focusAndClose();\n break;\n case 8:\n case 46:\n if (isInput && !self.config.allowInput) {\n e.preventDefault();\n self.clear();\n }\n break;\n case 37:\n case 39:\n if (!isTimeObj && !isInput) {\n e.preventDefault();\n var activeElement = getClosestActiveElement();\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 break;\n case 38:\n case 40:\n e.preventDefault();\n var delta = e.keyCode === 40 ? 1 : -1;\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 self._debouncedChange();\n }\n break;\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 if (i !== -1) {\n var target = elems[i + (e.shiftKey ? -1 : 1)];\n e.preventDefault();\n (target || self._input).focus();\n }\n } else if (!self.config.noCalendar && self.daysContainer && self.daysContainer.contains(eventTarget) && e.shiftKey) {\n e.preventDefault();\n self._input.focus();\n }\n break;\n default:\n break;\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 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 if (isInput || isCalendarElem(eventTarget)) {\n triggerEvent(\"onKeyDown\", e);\n }\n }\n function onMouseOver(elem, cellClass) {\n if (cellClass === void 0) {\n cellClass = \"flatpickr-day\";\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 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 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 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 [\"startRange\", \"inRange\", \"endRange\", \"notAllowed\"].forEach(function (c) {\n dayElem.classList.remove(c);\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 function onResize() {\n if (self.isOpen && !self.config.static && !self.config.inline) positionCalendar();\n }\n function open(e, positionElement) {\n if (positionElement === void 0) {\n positionElement = self._positionElement;\n }\n if (self.isMobile === true) {\n if (e) {\n e.preventDefault();\n var eventTarget = getEventTarget(e);\n if (eventTarget) {\n eventTarget.blur();\n }\n }\n if (self.mobileInput !== undefined) {\n self.mobileInput.focus();\n self.mobileInput.click();\n }\n triggerEvent(\"onOpen\");\n return;\n } else if (self._input.disabled || self.config.inline) {\n return;\n }\n var wasOpen = self.isOpen;\n self.isOpen = true;\n if (!wasOpen) {\n self.calendarContainer.classList.add(\"open\");\n self._input.classList.add(\"active\");\n triggerEvent(\"onOpen\");\n positionCalendar(positionElement);\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 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 if (dateObj !== undefined) {\n self[type === \"min\" ? \"minDateHasTime\" : \"maxDateHasTime\"] = dateObj.getHours() > 0 || dateObj.getMinutes() > 0 || dateObj.getSeconds() > 0;\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 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 function parseConfig() {\n var boolOpts = [\"wrap\", \"weekNumbers\", \"allowInput\", \"allowInvalidPreload\", \"clickOpens\", \"time_24hr\", \"enableTime\", \"noCalendar\", \"altInput\", \"shorthandCurrentMonth\", \"inline\", \"static\", \"enableSeconds\", \"disableMobile\"];\n var userConfig = __assign(__assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig);\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 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 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 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 var minMaxTimeSetter = function (type) {\n return function (val) {\n self.config[type === \"min\" ? \"_minTime\" : \"_maxTime\"] = self.parseDate(val, \"H:i:S\");\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 if (userConfig.mode === \"time\") {\n self.config.noCalendar = true;\n self.config.enableTime = true;\n }\n Object.assign(self.config, formats, userConfig);\n for (var i = 0; i < boolOpts.length; i++) self.config[boolOpts[i]] = self.config[boolOpts[i]] === true || self.config[boolOpts[i]] === \"true\";\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 for (var i = 0; i < self.config.plugins.length; i++) {\n var pluginConf = self.config.plugins[i](self) || {};\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 if (!userConfig.altInputClass) {\n self.config.altInputClass = getInputElem().className + \" \" + self.config.altInputClass;\n }\n triggerEvent(\"onParseConfig\");\n }\n function getInputElem() {\n return self.config.wrap ? element.querySelector(\"[data-input]\") : element;\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 var userConfig = __assign(__assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {})));\n if (userConfig.time_24hr === undefined && flatpickr.defaultConfig.time_24hr === undefined) {\n self.config.time_24hr = self.l10n.time_24hr;\n }\n self.formatDate = createDateFormatter(self);\n self.parseDate = createDateParser({\n config: self.config,\n l10n: self.l10n\n });\n }\n function positionCalendar(customPositionElement) {\n if (typeof self.config.position === \"function\") {\n return void self.config.position(self, customPositionElement);\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 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 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 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 function getDocumentStyleSheet() {\n var editableSheet = null;\n for (var i = 0; i < document.styleSheets.length; i++) {\n var sheet = document.styleSheets[i];\n if (!sheet.cssRules) continue;\n try {\n sheet.cssRules;\n } catch (err) {\n continue;\n }\n editableSheet = sheet;\n break;\n }\n return editableSheet != null ? editableSheet : createStyleSheet();\n }\n function createStyleSheet() {\n var style = document.createElement(\"style\");\n document.head.appendChild(style);\n return style.sheet;\n }\n function redraw() {\n if (self.config.noCalendar || self.isMobile) return;\n buildMonthSwitch();\n updateNavigationCurrentMonth();\n buildDays();\n }\n function focusAndClose() {\n self._input.focus();\n if (window.navigator.userAgent.indexOf(\"MSIE\") !== -1 || navigator.msMaxTouchPoints !== undefined) {\n setTimeout(self.close, 0);\n } else {\n self.close();\n }\n }\n function selectDate(e) {\n e.preventDefault();\n e.stopPropagation();\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 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 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 if (shouldChangeMonth) {\n var isNewYear = self.currentYear !== selectedDate.getFullYear();\n self.currentYear = selectedDate.getFullYear();\n self.currentMonth = selectedDate.getMonth();\n if (isNewYear) {\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n triggerEvent(\"onMonthChange\");\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 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 if (single || range) {\n focusAndClose();\n }\n }\n triggerChange();\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 self._input.removeEventListener(\"click\", self.open);\n }\n }]\n };\n function set(option, value) {\n if (option !== null && typeof option === \"object\") {\n Object.assign(self.config, option);\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 self.redraw();\n updateValue(true);\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 case \"multiple\":\n dates = inputDate.split(self.config.conjunction).map(function (date) {\n return self.parseDate(date, format);\n });\n break;\n case \"range\":\n dates = inputDate.split(self.l10n.rangeSeparator).map(function (date) {\n return self.parseDate(date, format);\n });\n break;\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 function setDate(date, triggerChange, format) {\n if (triggerChange === void 0) {\n triggerChange = false;\n }\n if (format === void 0) {\n format = self.config.dateFormat;\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 if (self.selectedDates.length === 0) {\n self.clear(false);\n }\n updateValue(triggerChange);\n if (triggerChange) triggerEvent(\"onChange\");\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 return rule;\n }).filter(function (x) {\n return x;\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 function setupInputs() {\n self.input = getInputElem();\n if (!self.input) {\n self.config.errorHandler(new Error(\"Invalid input element specified\"));\n return;\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 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 if (!self.config.allowInput) self._input.setAttribute(\"readonly\", \"readonly\");\n updatePositionElement();\n }\n function updatePositionElement() {\n self._positionElement = self.config.positionElement || self._input;\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 if (self.selectedDates.length > 0) {\n self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);\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 try {\n if (self.input.parentNode) self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);\n } catch (_a) {}\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 function toggle(e) {\n if (self.isOpen === true) return self.close();\n self.open(e);\n }\n function triggerEvent(event, data) {\n if (self.config === undefined) return;\n var hooks = self.config[event];\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 if (event === \"onChange\") {\n self.input.dispatchEvent(createEvent(\"change\"));\n self.input.dispatchEvent(createEvent(\"input\"));\n }\n }\n function createEvent(name) {\n var e = document.createEvent(\"Event\");\n e.initEvent(name, true, true);\n return e;\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 return false;\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 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 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 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 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 function updateValue(triggerChange) {\n if (triggerChange === void 0) {\n triggerChange = true;\n }\n if (self.mobileInput !== undefined && self.mobileFormatStr) {\n self.mobileInput.value = self.latestSelectedDateObj !== undefined ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr) : \"\";\n }\n self.input.value = getDateStr(self.config.dateFormat);\n if (self.altInput !== undefined) {\n self.altInput.value = getDateStr(self.config.altFormat);\n }\n if (triggerChange !== false) triggerEvent(\"onValueUpdate\");\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 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 function timeWrapper(e) {\n e.preventDefault();\n var isKeyDown = e.type === \"keydown\",\n eventTarget = getEventTarget(e),\n input = eventTarget;\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 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 if (typeof input.value !== \"undefined\" && input.value.length === 2) {\n var isHourElem = input === self.hourElement,\n isMinuteElem = input === self.minuteElement;\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 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 input.value = pad(newValue);\n }\n }\n init();\n return self;\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 for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n try {\n if (node.getAttribute(\"data-fp-omit\") !== null) continue;\n if (node._flatpickr !== undefined) {\n node._flatpickr.destroy();\n node._flatpickr = undefined;\n }\n node._flatpickr = FlatpickrInstance(node, config || {});\n instances.push(node._flatpickr);\n } catch (e) {\n console.error(e);\n }\n }\n return instances.length === 1 ? instances[0] : instances;\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 HTMLElement.prototype.flatpickr = function (config) {\n return _flatpickr([this], config);\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};\nflatpickr.defaultConfig = {};\nflatpickr.l10ns = {\n en: __assign({}, English),\n default: __assign({}, English)\n};\nflatpickr.localize = function (l10n) {\n flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n);\n};\nflatpickr.setDefaults = function (config) {\n flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config);\n};\nflatpickr.parseDate = createDateParser({});\nflatpickr.formatDate = createDateFormatter({});\nflatpickr.compareDates = compareDates;\nif (typeof jQuery !== \"undefined\" && typeof jQuery.fn !== \"undefined\") {\n jQuery.fn.flatpickr = function (config) {\n return _flatpickr(this, config);\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};\nif (typeof window !== \"undefined\") {\n window.flatpickr = flatpickr;\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 switch (s % 10) {\n case 1:\n return \"st\";\n case 2:\n return \"nd\";\n case 3:\n return \"rd\";\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 if (config.formatDate !== undefined && !isMobile) {\n return config.formatDate(dateObj, frmt, locale);\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 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 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 if (tokenRegex[token] && !escaped) {\n regexStr += tokenRegex[token];\n var match = new RegExp(regexStr).exec(date);\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 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 if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {\n config.errorHandler(new Error(\"Invalid date provided: \" + dateOrig));\n return undefined;\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 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 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 if (config.minDate !== undefined) {\n var minHour = config.minDate.getHours();\n var minMinutes = config.minDate.getMinutes();\n var minSeconds = config.minDate.getSeconds();\n if (hours < minHour) {\n hours = minHour;\n }\n if (hours === minHour && minutes < minMinutes) {\n minutes = minMinutes;\n }\n if (hours === minHour && minutes === minMinutes && seconds < minSeconds) seconds = config.minDate.getSeconds();\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 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 if (navigator.userAgent.indexOf(\"MSIE 9.0\") === -1) {\n numInput.type = \"number\";\n } else {\n numInput.type = \"text\";\n numInput.pattern = \"\\\\d*\";\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 return event.target;\n } catch (error) {\n return event.target;\n }\n}","import { int, pad } from \"../utils\";\nvar doNothing = function () {\n return undefined;\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 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 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 for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (!target) {\n throw TypeError(\"Cannot convert undefined or null to object\");\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 for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n var source = args_1[_a];\n _loop_1(source);\n }\n return target;\n };\n}","// extracted by mini-css-extract-plugin","/*\nUnobtrusive JavaScript\nhttps://github.com/rails/rails/blob/master/actionview/app/assets/javascripts\nReleased under the MIT license\n */;\n(function () {\n var context = this;\n (function () {\n (function () {\n this.Rails = {\n linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',\n buttonClickSelector: {\n selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])',\n exclude: 'form button'\n },\n inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',\n formSubmitSelector: 'form',\n formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',\n formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',\n formEnableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',\n fileInputSelector: 'input[name][type=file]:not([disabled])',\n linkDisableSelector: 'a[data-disable-with], a[data-disable]',\n buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]'\n };\n }).call(this);\n }).call(context);\n var Rails = context.Rails;\n (function () {\n (function () {\n var nonce;\n nonce = null;\n Rails.loadCSPNonce = function () {\n var ref;\n return nonce = (ref = document.querySelector(\"meta[name=csp-nonce]\")) != null ? ref.content : void 0;\n };\n Rails.cspNonce = function () {\n return nonce != null ? nonce : Rails.loadCSPNonce();\n };\n }).call(this);\n (function () {\n var expando, m;\n m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;\n Rails.matches = function (element, selector) {\n if (selector.exclude != null) {\n return m.call(element, selector.selector) && !m.call(element, selector.exclude);\n } else {\n return m.call(element, selector);\n }\n };\n expando = '_ujsData';\n Rails.getData = function (element, key) {\n var ref;\n return (ref = element[expando]) != null ? ref[key] : void 0;\n };\n Rails.setData = function (element, key, value) {\n if (element[expando] == null) {\n element[expando] = {};\n }\n return element[expando][key] = value;\n };\n Rails.$ = function (selector) {\n return Array.prototype.slice.call(document.querySelectorAll(selector));\n };\n }).call(this);\n (function () {\n var $, csrfParam, csrfToken;\n $ = Rails.$;\n csrfToken = Rails.csrfToken = function () {\n var meta;\n meta = document.querySelector('meta[name=csrf-token]');\n return meta && meta.content;\n };\n csrfParam = Rails.csrfParam = function () {\n var meta;\n meta = document.querySelector('meta[name=csrf-param]');\n return meta && meta.content;\n };\n Rails.CSRFProtection = function (xhr) {\n var token;\n token = csrfToken();\n if (token != null) {\n return xhr.setRequestHeader('X-CSRF-Token', token);\n }\n };\n Rails.refreshCSRFTokens = function () {\n var param, token;\n token = csrfToken();\n param = csrfParam();\n if (token != null && param != null) {\n return $('form input[name=\"' + param + '\"]').forEach(function (input) {\n return input.value = token;\n });\n }\n };\n }).call(this);\n (function () {\n var CustomEvent, fire, matches, preventDefault;\n matches = Rails.matches;\n CustomEvent = window.CustomEvent;\n if (typeof CustomEvent !== 'function') {\n CustomEvent = function (event, params) {\n var evt;\n evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n CustomEvent.prototype = window.Event.prototype;\n preventDefault = CustomEvent.prototype.preventDefault;\n CustomEvent.prototype.preventDefault = function () {\n var result;\n result = preventDefault.call(this);\n if (this.cancelable && !this.defaultPrevented) {\n Object.defineProperty(this, 'defaultPrevented', {\n get: function () {\n return true;\n }\n });\n }\n return result;\n };\n }\n fire = Rails.fire = function (obj, name, data) {\n var event;\n event = new CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail: data\n });\n obj.dispatchEvent(event);\n return !event.defaultPrevented;\n };\n Rails.stopEverything = function (e) {\n fire(e.target, 'ujs:everythingStopped');\n e.preventDefault();\n e.stopPropagation();\n return e.stopImmediatePropagation();\n };\n Rails.delegate = function (element, selector, eventType, handler) {\n return element.addEventListener(eventType, function (e) {\n var target;\n target = e.target;\n while (!(!(target instanceof Element) || matches(target, selector))) {\n target = target.parentNode;\n }\n if (target instanceof Element && handler.call(target, e) === false) {\n e.preventDefault();\n return e.stopPropagation();\n }\n });\n };\n }).call(this);\n (function () {\n var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;\n cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;\n AcceptHeaders = {\n '*': '*/*',\n text: 'text/plain',\n html: 'text/html',\n xml: 'application/xml, text/xml',\n json: 'application/json, text/javascript',\n script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'\n };\n Rails.ajax = function (options) {\n var xhr;\n options = prepareOptions(options);\n xhr = createXHR(options, function () {\n var ref, response;\n response = processResponse((ref = xhr.response) != null ? ref : xhr.responseText, xhr.getResponseHeader('Content-Type'));\n if (Math.floor(xhr.status / 100) === 2) {\n if (typeof options.success === \"function\") {\n options.success(response, xhr.statusText, xhr);\n }\n } else {\n if (typeof options.error === \"function\") {\n options.error(response, xhr.statusText, xhr);\n }\n }\n return typeof options.complete === \"function\" ? options.complete(xhr, xhr.statusText) : void 0;\n });\n if (options.beforeSend != null && !options.beforeSend(xhr, options)) {\n return false;\n }\n if (xhr.readyState === XMLHttpRequest.OPENED) {\n return xhr.send(options.data);\n }\n };\n prepareOptions = function (options) {\n options.url = options.url || location.href;\n options.type = options.type.toUpperCase();\n if (options.type === 'GET' && options.data) {\n if (options.url.indexOf('?') < 0) {\n options.url += '?' + options.data;\n } else {\n options.url += '&' + options.data;\n }\n }\n if (AcceptHeaders[options.dataType] == null) {\n options.dataType = '*';\n }\n options.accept = AcceptHeaders[options.dataType];\n if (options.dataType !== '*') {\n options.accept += ', */*; q=0.01';\n }\n return options;\n };\n createXHR = function (options, done) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.open(options.type, options.url, true);\n xhr.setRequestHeader('Accept', options.accept);\n if (typeof options.data === 'string') {\n xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\n }\n if (!options.crossDomain) {\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n CSRFProtection(xhr);\n }\n xhr.withCredentials = !!options.withCredentials;\n xhr.onreadystatechange = function () {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n return done(xhr);\n }\n };\n return xhr;\n };\n processResponse = function (response, type) {\n var parser, script;\n if (typeof response === 'string' && typeof type === 'string') {\n if (type.match(/\\bjson\\b/)) {\n try {\n response = JSON.parse(response);\n } catch (error) {}\n } else if (type.match(/\\b(?:java|ecma)script\\b/)) {\n script = document.createElement('script');\n script.setAttribute('nonce', cspNonce());\n script.text = response;\n document.head.appendChild(script).parentNode.removeChild(script);\n } else if (type.match(/\\b(xml|html|svg)\\b/)) {\n parser = new DOMParser();\n type = type.replace(/;.+/, '');\n try {\n response = parser.parseFromString(response, type);\n } catch (error) {}\n }\n }\n return response;\n };\n Rails.href = function (element) {\n return element.href;\n };\n Rails.isCrossDomain = function (url) {\n var e, originAnchor, urlAnchor;\n originAnchor = document.createElement('a');\n originAnchor.href = location.href;\n urlAnchor = document.createElement('a');\n try {\n urlAnchor.href = url;\n return !((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host || originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host);\n } catch (error) {\n e = error;\n return true;\n }\n };\n }).call(this);\n (function () {\n var matches, toArray;\n matches = Rails.matches;\n toArray = function (e) {\n return Array.prototype.slice.call(e);\n };\n Rails.serializeElement = function (element, additionalParam) {\n var inputs, params;\n inputs = [element];\n if (matches(element, 'form')) {\n inputs = toArray(element.elements);\n }\n params = [];\n inputs.forEach(function (input) {\n if (!input.name || input.disabled) {\n return;\n }\n if (matches(input, 'select')) {\n return toArray(input.options).forEach(function (option) {\n if (option.selected) {\n return params.push({\n name: input.name,\n value: option.value\n });\n }\n });\n } else if (input.checked || ['radio', 'checkbox', 'submit'].indexOf(input.type) === -1) {\n return params.push({\n name: input.name,\n value: input.value\n });\n }\n });\n if (additionalParam) {\n params.push(additionalParam);\n }\n return params.map(function (param) {\n if (param.name != null) {\n return encodeURIComponent(param.name) + \"=\" + encodeURIComponent(param.value);\n } else {\n return param;\n }\n }).join('&');\n };\n Rails.formElements = function (form, selector) {\n if (matches(form, 'form')) {\n return toArray(form.elements).filter(function (el) {\n return matches(el, selector);\n });\n } else {\n return toArray(form.querySelectorAll(selector));\n }\n };\n }).call(this);\n (function () {\n var allowAction, fire, stopEverything;\n fire = Rails.fire, stopEverything = Rails.stopEverything;\n Rails.handleConfirm = function (e) {\n if (!allowAction(this)) {\n return stopEverything(e);\n }\n };\n allowAction = function (element) {\n var answer, callback, message;\n message = element.getAttribute('data-confirm');\n if (!message) {\n return true;\n }\n answer = false;\n if (fire(element, 'confirm')) {\n try {\n answer = confirm(message);\n } catch (error) {}\n callback = fire(element, 'confirm:complete', [answer]);\n }\n return answer && callback;\n };\n }).call(this);\n (function () {\n var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, matches, setData, stopEverything;\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements;\n Rails.handleDisabledElement = function (e) {\n var element;\n element = this;\n if (element.disabled) {\n return stopEverything(e);\n }\n };\n Rails.enableElement = function (e) {\n var element;\n element = e instanceof Event ? e.target : e;\n if (matches(element, Rails.linkDisableSelector)) {\n return enableLinkElement(element);\n } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {\n return enableFormElement(element);\n } else if (matches(element, Rails.formSubmitSelector)) {\n return enableFormElements(element);\n }\n };\n Rails.disableElement = function (e) {\n var element;\n element = e instanceof Event ? e.target : e;\n if (matches(element, Rails.linkDisableSelector)) {\n return disableLinkElement(element);\n } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) {\n return disableFormElement(element);\n } else if (matches(element, Rails.formSubmitSelector)) {\n return disableFormElements(element);\n }\n };\n disableLinkElement = function (element) {\n var replacement;\n replacement = element.getAttribute('data-disable-with');\n if (replacement != null) {\n setData(element, 'ujs:enable-with', element.innerHTML);\n element.innerHTML = replacement;\n }\n element.addEventListener('click', stopEverything);\n return setData(element, 'ujs:disabled', true);\n };\n enableLinkElement = function (element) {\n var originalText;\n originalText = getData(element, 'ujs:enable-with');\n if (originalText != null) {\n element.innerHTML = originalText;\n setData(element, 'ujs:enable-with', null);\n }\n element.removeEventListener('click', stopEverything);\n return setData(element, 'ujs:disabled', null);\n };\n disableFormElements = function (form) {\n return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);\n };\n disableFormElement = function (element) {\n var replacement;\n replacement = element.getAttribute('data-disable-with');\n if (replacement != null) {\n if (matches(element, 'button')) {\n setData(element, 'ujs:enable-with', element.innerHTML);\n element.innerHTML = replacement;\n } else {\n setData(element, 'ujs:enable-with', element.value);\n element.value = replacement;\n }\n }\n element.disabled = true;\n return setData(element, 'ujs:disabled', true);\n };\n enableFormElements = function (form) {\n return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);\n };\n enableFormElement = function (element) {\n var originalText;\n originalText = getData(element, 'ujs:enable-with');\n if (originalText != null) {\n if (matches(element, 'button')) {\n element.innerHTML = originalText;\n } else {\n element.value = originalText;\n }\n setData(element, 'ujs:enable-with', null);\n }\n element.disabled = false;\n return setData(element, 'ujs:disabled', null);\n };\n }).call(this);\n (function () {\n var stopEverything;\n stopEverything = Rails.stopEverything;\n Rails.handleMethod = function (e) {\n var csrfParam, csrfToken, form, formContent, href, link, method;\n link = this;\n method = link.getAttribute('data-method');\n if (!method) {\n return;\n }\n href = Rails.href(link);\n csrfToken = Rails.csrfToken();\n csrfParam = Rails.csrfParam();\n form = document.createElement('form');\n formContent = \"\";\n if (csrfParam != null && csrfToken != null && !Rails.isCrossDomain(href)) {\n formContent += \"\";\n }\n formContent += '';\n form.method = 'post';\n form.action = href;\n form.target = link.target;\n form.innerHTML = formContent;\n form.style.display = 'none';\n document.body.appendChild(form);\n form.querySelector('[type=\"submit\"]').click();\n return stopEverything(e);\n };\n }).call(this);\n (function () {\n var ajax,\n fire,\n getData,\n isCrossDomain,\n isRemote,\n matches,\n serializeElement,\n setData,\n stopEverything,\n slice = [].slice;\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement;\n isRemote = function (element) {\n var value;\n value = element.getAttribute('data-remote');\n return value != null && value !== 'false';\n };\n Rails.handleRemote = function (e) {\n var button, data, dataType, element, method, url, withCredentials;\n element = this;\n if (!isRemote(element)) {\n return true;\n }\n if (!fire(element, 'ajax:before')) {\n fire(element, 'ajax:stopped');\n return false;\n }\n withCredentials = element.getAttribute('data-with-credentials');\n dataType = element.getAttribute('data-type') || 'script';\n if (matches(element, Rails.formSubmitSelector)) {\n button = getData(element, 'ujs:submit-button');\n method = getData(element, 'ujs:submit-button-formmethod') || element.method;\n url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href;\n if (method.toUpperCase() === 'GET') {\n url = url.replace(/\\?.*$/, '');\n }\n if (element.enctype === 'multipart/form-data') {\n data = new FormData(element);\n if (button != null) {\n data.append(button.name, button.value);\n }\n } else {\n data = serializeElement(element, button);\n }\n setData(element, 'ujs:submit-button', null);\n setData(element, 'ujs:submit-button-formmethod', null);\n setData(element, 'ujs:submit-button-formaction', null);\n } else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) {\n method = element.getAttribute('data-method');\n url = element.getAttribute('data-url');\n data = serializeElement(element, element.getAttribute('data-params'));\n } else {\n method = element.getAttribute('data-method');\n url = Rails.href(element);\n data = element.getAttribute('data-params');\n }\n ajax({\n type: method || 'GET',\n url: url,\n data: data,\n dataType: dataType,\n beforeSend: function (xhr, options) {\n if (fire(element, 'ajax:beforeSend', [xhr, options])) {\n return fire(element, 'ajax:send', [xhr]);\n } else {\n fire(element, 'ajax:stopped');\n return false;\n }\n },\n success: function () {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:success', args);\n },\n error: function () {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:error', args);\n },\n complete: function () {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:complete', args);\n },\n crossDomain: isCrossDomain(url),\n withCredentials: withCredentials != null && withCredentials !== 'false'\n });\n return stopEverything(e);\n };\n Rails.formSubmitButtonClick = function (e) {\n var button, form;\n button = this;\n form = button.form;\n if (!form) {\n return;\n }\n if (button.name) {\n setData(form, 'ujs:submit-button', {\n name: button.name,\n value: button.value\n });\n }\n setData(form, 'ujs:formnovalidate-button', button.formNoValidate);\n setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction'));\n return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));\n };\n Rails.preventInsignificantClick = function (e) {\n var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;\n link = this;\n method = (link.getAttribute('data-method') || 'GET').toUpperCase();\n data = link.getAttribute('data-params');\n metaClick = e.metaKey || e.ctrlKey;\n insignificantMetaClick = metaClick && method === 'GET' && !data;\n nonPrimaryMouseClick = e.button != null && e.button !== 0;\n if (nonPrimaryMouseClick || insignificantMetaClick) {\n return e.stopImmediatePropagation();\n }\n };\n }).call(this);\n (function () {\n var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;\n fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, loadCSPNonce = Rails.loadCSPNonce, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod;\n if (typeof jQuery !== \"undefined\" && jQuery !== null && jQuery.ajax != null) {\n if (jQuery.rails) {\n throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.');\n }\n jQuery.rails = Rails;\n jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {\n if (!options.crossDomain) {\n return CSRFProtection(xhr);\n }\n });\n }\n Rails.start = function () {\n if (window._rails_loaded) {\n throw new Error('rails-ujs has already been loaded!');\n }\n window.addEventListener('pageshow', function () {\n $(Rails.formEnableSelector).forEach(function (el) {\n if (getData(el, 'ujs:disabled')) {\n return enableElement(el);\n }\n });\n return $(Rails.linkDisableSelector).forEach(function (el) {\n if (getData(el, 'ujs:disabled')) {\n return enableElement(el);\n }\n });\n });\n delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);\n delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);\n delegate(document, Rails.linkClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.linkClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.linkClickSelector, 'click', handleConfirm);\n delegate(document, Rails.linkClickSelector, 'click', disableElement);\n delegate(document, Rails.linkClickSelector, 'click', handleRemote);\n delegate(document, Rails.linkClickSelector, 'click', handleMethod);\n delegate(document, Rails.buttonClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.buttonClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);\n delegate(document, Rails.buttonClickSelector, 'click', disableElement);\n delegate(document, Rails.buttonClickSelector, 'click', handleRemote);\n delegate(document, Rails.inputChangeSelector, 'change', handleDisabledElement);\n delegate(document, Rails.inputChangeSelector, 'change', handleConfirm);\n delegate(document, Rails.inputChangeSelector, 'change', handleRemote);\n delegate(document, Rails.formSubmitSelector, 'submit', handleDisabledElement);\n delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm);\n delegate(document, Rails.formSubmitSelector, 'submit', handleRemote);\n delegate(document, Rails.formSubmitSelector, 'submit', function (e) {\n return setTimeout(function () {\n return disableElement(e);\n }, 13);\n });\n delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);\n delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.formInputClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.formInputClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);\n delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);\n document.addEventListener('DOMContentLoaded', refreshCSRFTokens);\n document.addEventListener('DOMContentLoaded', loadCSPNonce);\n return window._rails_loaded = true;\n };\n if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {\n Rails.start();\n }\n }).call(this);\n }).call(this);\n if (typeof module === \"object\" && module.exports) {\n module.exports = Rails;\n } else if (typeof define === \"function\" && define.amd) {\n define(Rails);\n }\n}).call(this);","import { Controller } from 'stimulus';\nimport flatpickr from 'flatpickr';\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\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}\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\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 return obj;\n}\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\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 return keys;\n}\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\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 return target;\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 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}\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}\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\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 try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\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 return self;\n}\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n }\n return _assertThisInitialized(self);\n}\nfunction _createSuper(Derived) {\n return function () {\n var Super = _getPrototypeOf(Derived),\n result;\n if (_isNativeReflectConstruct()) {\n var NewTarget = _getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n return _possibleConstructorReturn(this, result);\n };\n}\nconst kebabCase = string => string.replace(/([a-z])([A-Z])/g, \"$1-$2\").replace(/[\\s_]+/g, \"-\").toLowerCase();\nconst capitalize = string => {\n return string.charAt(0).toUpperCase() + string.slice(1);\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');\nconst convertDateFormat = format => {\n return format.replace(strftimeRegex, match => {\n return mapping[match];\n });\n};\nlet StimulusFlatpickr = /*#__PURE__*/function (_Controller) {\n _inherits(StimulusFlatpickr, _Controller);\n var _super = _createSuper(StimulusFlatpickr);\n function StimulusFlatpickr() {\n _classCallCheck(this, StimulusFlatpickr);\n return _super.apply(this, arguments);\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 this._initializeOptions();\n this._initializeDateFormats();\n this.fp = flatpickr(this.flatpickrElement, _objectSpread2({}, this.config));\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${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 if (this.data.has(optionKebab)) {\n this.config[option] = this[`_${optionType}`](optionKebab);\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 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[`${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 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 return StimulusFlatpickr;\n}(Controller);\n_defineProperty(StimulusFlatpickr, \"targets\", ['instance']);\nexport default StimulusFlatpickr;","import { Controller as e } from \"stimulus\";\nclass t extends e {\n initialize() {\n this.wrapperSelector = this.wrapperSelectorValue || \".nested-form-wrapper\";\n }\n add(e) {\n e.preventDefault();\n const t = this.templateTarget.innerHTML.replace(/NEW_RECORD/g, new Date().getTime().toString());\n this.targetTarget.insertAdjacentHTML(\"beforebegin\", t);\n }\n remove(e) {\n e.preventDefault();\n const t = e.target.closest(this.wrapperSelector);\n if (\"true\" === t.dataset.newRecord) t.remove();else {\n t.style.display = \"none\";\n t.querySelector(\"input[name*='_destroy']\").value = \"1\";\n }\n }\n}\nt.targets = [\"target\", \"template\"], t.values = {\n wrapperSelector: String\n};\nexport default t;","export * from \"@stimulus/core\";","export * from \"@stimulus/webpack-helpers\";","/*! @preserve sweet-scroll v4.0.0 - tsuyoshiwada | MIT License */\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, global.SweetScroll = factory());\n})(this, function () {\n 'use strict';\n\n /*! *****************************************************************************\r\n Copyright (c) Microsoft Corporation. All rights reserved.\r\n Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\n this file except in compliance with the License. You may obtain a copy of the\r\n License at http://www.apache.org/licenses/LICENSE-2.0\r\n THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\n WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\n MERCHANTABLITY OR NON-INFRINGEMENT.\r\n See the Apache Version 2.0 License for specific language governing permissions\r\n and limitations under the License.\r\n ***************************************************************************** */\n var __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n\n // @link https://github.com/JedWatson/exenv/blob/master/index.js\n var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);\n var canUseHistory = !canUseDOM ? false : window.history && 'pushState' in window.history && window.location.protocol !== 'file:';\n var canUsePassiveOption = function () {\n var support = false;\n if (!canUseDOM) {\n return support;\n }\n /* tslint:disable:no-empty */\n try {\n var win = window;\n var opts = Object.defineProperty({}, 'passive', {\n get: function () {\n support = true;\n }\n });\n win.addEventListener('test', null, opts);\n win.removeEventListener('test', null, opts);\n } catch (e) {}\n /* tslint:enable */\n return support;\n }();\n var isString = function (obj) {\n return typeof obj === 'string';\n };\n var isFunction = function (obj) {\n return typeof obj === 'function';\n };\n var isArray = function (obj) {\n return Array.isArray(obj);\n };\n var isNumeric = function (obj) {\n return !isArray(obj) && obj - parseFloat(obj) + 1 >= 0;\n };\n var hasProp = function (obj, key) {\n return obj && obj.hasOwnProperty(key);\n };\n var raf = canUseDOM ? window.requestAnimationFrame.bind(window) : null;\n var caf = canUseDOM ? window.cancelAnimationFrame.bind(window) : null;\n\n /* tslint:disable:curly */\n /* tslint:disable:no-conditional-assignment */\n var cos = Math.cos,\n sin = Math.sin,\n pow = Math.pow,\n sqrt = Math.sqrt,\n PI = Math.PI;\n var easings = {\n linear: function (p) {\n return p;\n },\n easeInQuad: function (_, t, b, c, d) {\n return c * (t /= d) * t + b;\n },\n easeOutQuad: function (_, t, b, c, d) {\n return -c * (t /= d) * (t - 2) + b;\n },\n easeInOutQuad: function (_, t, b, c, d) {\n return (t /= d / 2) < 1 ? c / 2 * t * t + b : -c / 2 * (--t * (t - 2) - 1) + b;\n },\n easeInCubic: function (_, t, b, c, d) {\n return c * (t /= d) * t * t + b;\n },\n easeOutCubic: function (_, t, b, c, d) {\n return c * ((t = t / d - 1) * t * t + 1) + b;\n },\n easeInOutCubic: function (_, t, b, c, d) {\n return (t /= d / 2) < 1 ? c / 2 * t * t * t + b : c / 2 * ((t -= 2) * t * t + 2) + b;\n },\n easeInQuart: function (_, t, b, c, d) {\n return c * (t /= d) * t * t * t + b;\n },\n easeOutQuart: function (_, t, b, c, d) {\n return -c * ((t = t / d - 1) * t * t * t - 1) + b;\n },\n easeInOutQuart: function (_, t, b, c, d) {\n return (t /= d / 2) < 1 ? c / 2 * t * t * t * t + b : -c / 2 * ((t -= 2) * t * t * t - 2) + b;\n },\n easeInQuint: function (_, t, b, c, d) {\n return c * (t /= d) * t * t * t * t + b;\n },\n easeOutQuint: function (_, t, b, c, d) {\n return c * ((t = t / d - 1) * t * t * t * t + 1) + b;\n },\n easeInOutQuint: function (_, t, b, c, d) {\n return (t /= d / 2) < 1 ? c / 2 * t * t * t * t * t + b : c / 2 * ((t -= 2) * t * t * t * t + 2) + b;\n },\n easeInSine: function (_, t, b, c, d) {\n return -c * cos(t / d * (PI / 2)) + c + b;\n },\n easeOutSine: function (_, t, b, c, d) {\n return c * sin(t / d * (PI / 2)) + b;\n },\n easeInOutSine: function (_, t, b, c, d) {\n return -c / 2 * (cos(PI * t / d) - 1) + b;\n },\n easeInExpo: function (_, t, b, c, d) {\n return t === 0 ? b : c * pow(2, 10 * (t / d - 1)) + b;\n },\n easeOutExpo: function (_, t, b, c, d) {\n return t === d ? b + c : c * (-pow(2, -10 * t / d) + 1) + b;\n },\n easeInOutExpo: function (_, t, b, c, d) {\n if (t === 0) return b;\n if (t === d) return b + c;\n if ((t /= d / 2) < 1) return c / 2 * pow(2, 10 * (t - 1)) + b;\n return c / 2 * (-pow(2, -10 * --t) + 2) + b;\n },\n easeInCirc: function (_, t, b, c, d) {\n return -c * (sqrt(1 - (t /= d) * t) - 1) + b;\n },\n easeOutCirc: function (_, t, b, c, d) {\n return c * sqrt(1 - (t = t / d - 1) * t) + b;\n },\n easeInOutCirc: function (_, t, b, c, d) {\n return (t /= d / 2) < 1 ? -c / 2 * (sqrt(1 - t * t) - 1) + b : c / 2 * (sqrt(1 - (t -= 2) * t) + 1) + b;\n }\n };\n var $$ = function (selector) {\n return Array.prototype.slice.call(!selector ? [] : document.querySelectorAll(selector));\n };\n var $ = function (selector) {\n return $$(selector).shift() || null;\n };\n var isElement = function (obj) {\n return obj instanceof Element;\n };\n var isWindow = function ($el) {\n return $el === window;\n };\n var isRootContainer = function ($el) {\n return $el === document.documentElement || $el === document.body;\n };\n var matches = function ($el, selector) {\n if (isElement(selector)) {\n return $el === selector;\n }\n var results = $$(selector);\n var i = results.length;\n // tslint:disable-next-line no-empty\n while (--i >= 0 && results[i] !== $el) {}\n return i > -1;\n };\n var getHeight = function ($el) {\n return Math.max($el.scrollHeight, $el.clientHeight, $el.offsetHeight);\n };\n var getWidth = function ($el) {\n return Math.max($el.scrollWidth, $el.clientWidth, $el.offsetWidth);\n };\n var getSize = function ($el) {\n return {\n width: getWidth($el),\n height: getHeight($el)\n };\n };\n var getViewportAndElementSizes = function ($el) {\n var isRoot = isWindow($el) || isRootContainer($el);\n return {\n viewport: {\n width: isRoot ? Math.min(window.innerWidth, document.documentElement.clientWidth) : $el.clientWidth,\n height: isRoot ? window.innerHeight : $el.clientHeight\n },\n size: isRoot ? {\n width: Math.max(getWidth(document.body), getWidth(document.documentElement)),\n height: Math.max(getHeight(document.body), getHeight(document.documentElement))\n } : getSize($el)\n };\n };\n var directionMethodMap = {\n y: 'scrollTop',\n x: 'scrollLeft'\n };\n var directionPropMap = {\n y: 'pageYOffset',\n x: 'pageXOffset'\n };\n var getScroll = function ($el, direction) {\n return isWindow($el) ? $el[directionPropMap[direction]] : $el[directionMethodMap[direction]];\n };\n var setScroll = function ($el, offset, direction) {\n if (isWindow($el)) {\n var top_1 = direction === 'y';\n $el.scrollTo(!top_1 ? offset : $el.pageXOffset, top_1 ? offset : $el.pageYOffset);\n } else {\n $el[directionMethodMap[direction]] = offset;\n }\n };\n var getOffset = function ($el, $context) {\n var rect = $el.getBoundingClientRect();\n if (rect.width || rect.height) {\n var scroll_1 = {\n top: 0,\n left: 0\n };\n var $ctx = void 0;\n if (isWindow($context) || isRootContainer($context)) {\n $ctx = document.documentElement;\n scroll_1.top = window[directionPropMap.y];\n scroll_1.left = window[directionPropMap.x];\n } else {\n $ctx = $context;\n var cRect = $ctx.getBoundingClientRect();\n scroll_1.top = cRect.top * -1 + $ctx[directionMethodMap.y];\n scroll_1.left = cRect.left * -1 + $ctx[directionMethodMap.x];\n }\n return {\n top: rect.top + scroll_1.top - $ctx.clientTop,\n left: rect.left + scroll_1.left - $ctx.clientLeft\n };\n }\n return rect;\n };\n var wheelEventName = function () {\n if (!canUseDOM) {\n return 'wheel';\n }\n return 'onwheel' in document ? 'wheel' : 'mousewheel';\n }();\n var eventName = function (name) {\n return name === 'wheel' ? wheelEventName : name;\n };\n var apply = function ($el, method, event, listener, passive) {\n event.split(' ').forEach(function (name) {\n $el[method](eventName(name), listener, canUsePassiveOption ? {\n passive: passive\n } : false);\n });\n };\n var addEvent = function ($el, event, listener, passive) {\n return apply($el, 'addEventListener', event, listener, passive);\n };\n var removeEvent = function ($el, event, listener, passive) {\n return apply($el, 'removeEventListener', event, listener, passive);\n };\n var reRelativeToken = /^(\\+|-)=(\\d+(?:\\.\\d+)?)$/;\n var parseCoordinate = function (coordinate, enableVertical) {\n var res = {\n top: 0,\n left: 0,\n relative: false\n };\n // Object ({ top: {n}, left: {n} })\n if (hasProp(coordinate, 'top') || hasProp(coordinate, 'left')) {\n res = __assign({}, res, coordinate);\n // Array ([{n}, [{n}])\n } else if (isArray(coordinate)) {\n if (coordinate.length > 1) {\n res.top = coordinate[0];\n res.left = coordinate[1];\n } else if (coordinate.length === 1) {\n res.top = enableVertical ? coordinate[0] : 0;\n res.left = !enableVertical ? coordinate[0] : 0;\n } else {\n return null;\n }\n // Number\n } else if (isNumeric(coordinate)) {\n if (enableVertical) {\n res.top = coordinate;\n } else {\n res.left = coordinate;\n }\n // String ('+={n}', '-={n}')\n } else if (isString(coordinate)) {\n var m = coordinate.trim().match(reRelativeToken);\n if (!m) {\n return null;\n }\n var op = m[1];\n var val = parseInt(m[2], 10);\n if (op === '+') {\n res.top = enableVertical ? val : 0;\n res.left = !enableVertical ? val : 0;\n } else {\n res.top = enableVertical ? -val : 0;\n res.left = !enableVertical ? -val : 0;\n }\n res.relative = true;\n } else {\n return null;\n }\n return res;\n };\n var defaultOptions = {\n trigger: '[data-scroll]',\n header: '[data-scroll-header]',\n duration: 1000,\n easing: 'easeOutQuint',\n offset: 0,\n vertical: true,\n horizontal: false,\n cancellable: true,\n updateURL: false,\n preventDefault: true,\n stopPropagation: true,\n // Callbacks\n before: null,\n after: null,\n cancel: null,\n complete: null,\n step: null\n };\n var CONTAINER_CLICK_EVENT = 'click';\n var CONTAINER_STOP_EVENT = 'wheel touchstart touchmove';\n var SweetScroll = /** @class */function () {\n /**\r\n * Constructor\r\n */\n function SweetScroll(options, container) {\n var _this = this;\n this.$el = null;\n this.ctx = {\n $trigger: null,\n opts: null,\n progress: false,\n pos: null,\n startPos: null,\n easing: null,\n start: 0,\n id: 0,\n cancel: false,\n hash: null\n };\n /**\r\n * Handle each frame of the animation.\r\n */\n this.loop = function (time) {\n var _a = _this,\n $el = _a.$el,\n ctx = _a.ctx;\n if (!ctx.start) {\n ctx.start = time;\n }\n if (!ctx.progress || !$el) {\n _this.stop();\n return;\n }\n var options = ctx.opts;\n var offset = ctx.pos;\n var start = ctx.start;\n var startOffset = ctx.startPos;\n var easing = ctx.easing;\n var duration = options.duration;\n var directionMap = {\n top: 'y',\n left: 'x'\n };\n var timeElapsed = time - start;\n var t = Math.min(1, Math.max(timeElapsed / duration, 0));\n Object.keys(offset).forEach(function (key) {\n var value = offset[key];\n var initial = startOffset[key];\n var delta = value - initial;\n if (delta !== 0) {\n var val = easing(t, duration * t, 0, 1, duration);\n setScroll($el, Math.round(initial + delta * val), directionMap[key]);\n }\n });\n if (timeElapsed <= duration) {\n _this.hook(options, 'step', t);\n ctx.id = SweetScroll.raf(_this.loop);\n } else {\n _this.stop(true);\n }\n };\n /**\r\n * Handling of container click event.\r\n */\n this.handleClick = function (e) {\n var opts = _this.opts;\n var $el = e.target;\n for (; $el && $el !== document; $el = $el.parentNode) {\n if (!matches($el, opts.trigger)) {\n continue;\n }\n var dataOptions = JSON.parse($el.getAttribute('data-scroll-options') || '{}');\n var data = $el.getAttribute('data-scroll');\n var to = data || $el.getAttribute('href');\n var options = __assign({}, opts, dataOptions);\n var preventDefault = options.preventDefault,\n stopPropagation = options.stopPropagation,\n vertical = options.vertical,\n horizontal = options.horizontal;\n if (preventDefault) {\n e.preventDefault();\n }\n if (stopPropagation) {\n e.stopPropagation();\n }\n // Passes the trigger element to callback\n _this.ctx.$trigger = $el;\n if (horizontal && vertical) {\n _this.to(to, options);\n } else if (vertical) {\n _this.toTop(to, options);\n } else if (horizontal) {\n _this.toLeft(to, options);\n }\n break;\n }\n };\n /**\r\n * Handling of container stop events.\r\n */\n this.handleStop = function (e) {\n var ctx = _this.ctx;\n var opts = ctx.opts;\n if (opts && opts.cancellable) {\n ctx.cancel = true;\n _this.stop();\n } else {\n e.preventDefault();\n }\n };\n this.opts = __assign({}, defaultOptions, options || {});\n var $container = null;\n if (canUseDOM) {\n if (typeof container === 'string') {\n $container = $(container);\n } else if (container != null) {\n $container = container;\n } else {\n $container = window;\n }\n }\n this.$el = $container;\n if ($container) {\n this.bind(true, false);\n }\n }\n /**\r\n * SweetScroll instance factory.\r\n */\n SweetScroll.create = function (options, container) {\n return new SweetScroll(options, container);\n };\n /**\r\n * Scroll animation to the specified position.\r\n */\n SweetScroll.prototype.to = function (distance, options) {\n if (!canUseDOM) {\n return;\n }\n var _a = this,\n $el = _a.$el,\n ctx = _a.ctx,\n currentOptions = _a.opts;\n var $trigger = ctx.$trigger;\n var opts = __assign({}, currentOptions, options || {});\n var optOffset = opts.offset,\n vertical = opts.vertical,\n horizontal = opts.horizontal;\n var $header = isElement(opts.header) ? opts.header : $(opts.header);\n var reg = /^#/;\n var hash = isString(distance) && reg.test(distance) ? distance : null;\n ctx.opts = opts; // Temporary options\n ctx.cancel = false; // Disable the call flag of `cancel`\n ctx.hash = hash;\n // Stop current animation\n this.stop();\n // Does not move if the container is not found\n if (!$el) {\n return;\n }\n // Get scroll offset\n var offset = parseCoordinate(optOffset, vertical);\n var coordinate = parseCoordinate(distance, vertical);\n var scroll = {\n top: 0,\n left: 0\n };\n if (coordinate) {\n if (coordinate.relative) {\n var current = getScroll($el, vertical ? 'y' : 'x');\n scroll.top = vertical ? current + coordinate.top : coordinate.top;\n scroll.left = !vertical ? current + coordinate.left : coordinate.left;\n } else {\n scroll = coordinate;\n }\n } else if (isString(distance) && distance !== '#') {\n var $target = $(distance);\n if (!$target) {\n return;\n }\n scroll = getOffset($target, $el);\n }\n if (offset) {\n scroll.top += offset.top;\n scroll.left += offset.left;\n }\n if ($header) {\n scroll.top = Math.max(0, scroll.top - getSize($header).height);\n }\n // Normalize scroll offset\n var _b = getViewportAndElementSizes($el),\n viewport = _b.viewport,\n size = _b.size;\n scroll.top = vertical ? Math.max(0, Math.min(size.height - viewport.height, scroll.top)) : getScroll($el, 'y');\n scroll.left = horizontal ? Math.max(0, Math.min(size.width - viewport.width, scroll.left)) : getScroll($el, 'x');\n // Call `before`\n // Stop scrolling when it returns false\n if (this.hook(opts, 'before', scroll, $trigger) === false) {\n ctx.opts = null;\n return;\n }\n // Set offset\n ctx.pos = scroll;\n // Run animation!!\n this.start(opts);\n // Bind stop events\n this.bind(false, true);\n };\n /**\r\n * Scroll animation to specified left position.\r\n */\n SweetScroll.prototype.toTop = function (distance, options) {\n this.to(distance, __assign({}, options || {}, {\n vertical: true,\n horizontal: false\n }));\n };\n /**\r\n * Scroll animation to specified top position.\r\n */\n SweetScroll.prototype.toLeft = function (distance, options) {\n this.to(distance, __assign({}, options || {}, {\n vertical: false,\n horizontal: true\n }));\n };\n /**\r\n * Scroll animation to specified element.\r\n */\n SweetScroll.prototype.toElement = function ($element, options) {\n var $el = this.$el;\n if (!canUseDOM || !$el) {\n return;\n }\n this.to(getOffset($element, $el), options || {});\n };\n /**\r\n * Stop the current scroll animation.\r\n */\n SweetScroll.prototype.stop = function (gotoEnd) {\n if (gotoEnd === void 0) {\n gotoEnd = false;\n }\n var _a = this,\n $el = _a.$el,\n ctx = _a.ctx;\n var pos = ctx.pos;\n if (!$el || !ctx.progress) {\n return;\n }\n SweetScroll.caf(ctx.id);\n ctx.progress = false;\n ctx.start = 0;\n ctx.id = 0;\n if (gotoEnd && pos) {\n setScroll($el, pos.left, 'x');\n setScroll($el, pos.top, 'y');\n }\n this.complete();\n };\n /**\r\n * Update options.\r\n */\n SweetScroll.prototype.update = function (options) {\n if (this.$el) {\n var opts = __assign({}, this.opts, options);\n this.stop();\n this.unbind(true, true);\n this.opts = opts;\n this.bind(true, false);\n }\n };\n /**\r\n * Destroy instance.\r\n */\n SweetScroll.prototype.destroy = function () {\n if (this.$el) {\n this.stop();\n this.unbind(true, true);\n this.$el = null;\n }\n };\n /**\r\n * Callback methods.\r\n */\n /* tslint:disable:no-empty */\n SweetScroll.prototype.onBefore = function (_, __) {\n return true;\n };\n SweetScroll.prototype.onStep = function (_) {};\n SweetScroll.prototype.onAfter = function (_, __) {};\n SweetScroll.prototype.onCancel = function () {};\n SweetScroll.prototype.onComplete = function (_) {};\n /* tslint:enable */\n /**\r\n * Start scrolling animation.\r\n */\n SweetScroll.prototype.start = function (opts) {\n var ctx = this.ctx;\n ctx.opts = opts;\n ctx.progress = true;\n ctx.easing = isFunction(opts.easing) ? opts.easing : easings[opts.easing];\n // Update start offset.\n var $container = this.$el;\n var start = {\n top: getScroll($container, 'y'),\n left: getScroll($container, 'x')\n };\n ctx.startPos = start;\n // Loop\n ctx.id = SweetScroll.raf(this.loop);\n };\n /**\r\n * Handle the completion of scrolling animation.\r\n */\n SweetScroll.prototype.complete = function () {\n var _a = this,\n $el = _a.$el,\n ctx = _a.ctx;\n var hash = ctx.hash,\n cancel = ctx.cancel,\n opts = ctx.opts,\n pos = ctx.pos,\n $trigger = ctx.$trigger;\n if (!$el || !opts) {\n return;\n }\n if (hash != null && hash !== window.location.hash) {\n var updateURL = opts.updateURL;\n if (canUseDOM && canUseHistory && updateURL !== false) {\n window.history[updateURL === 'replace' ? 'replaceState' : 'pushState'](null, '', hash);\n }\n }\n this.unbind(false, true);\n ctx.opts = null;\n ctx.$trigger = null;\n if (cancel) {\n this.hook(opts, 'cancel');\n } else {\n this.hook(opts, 'after', pos, $trigger);\n }\n this.hook(opts, 'complete', cancel);\n };\n /**\r\n * Callback function and method call.\r\n */\n SweetScroll.prototype.hook = function (options, type) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n var _a;\n var callback = options[type];\n var callbackResult;\n var methodResult;\n // callback\n if (isFunction(callback)) {\n callbackResult = callback.apply(this, args.concat([this]));\n }\n // method\n methodResult = (_a = this)[\"on\" + (type[0].toUpperCase() + type.slice(1))].apply(_a, args);\n return callbackResult !== undefined ? callbackResult : methodResult;\n };\n /**\r\n * Bind events of container element.\r\n */\n SweetScroll.prototype.bind = function (click, stop) {\n var _a = this,\n $el = _a.$el,\n opts = _a.ctx.opts;\n if ($el) {\n if (click) {\n addEvent($el, CONTAINER_CLICK_EVENT, this.handleClick, false);\n }\n if (stop) {\n addEvent($el, CONTAINER_STOP_EVENT, this.handleStop, opts ? opts.cancellable : true);\n }\n }\n };\n /**\r\n * Unbind events of container element.\r\n */\n SweetScroll.prototype.unbind = function (click, stop) {\n var _a = this,\n $el = _a.$el,\n opts = _a.ctx.opts;\n if ($el) {\n if (click) {\n removeEvent($el, CONTAINER_CLICK_EVENT, this.handleClick, false);\n }\n if (stop) {\n removeEvent($el, CONTAINER_STOP_EVENT, this.handleStop, opts ? opts.cancellable : true);\n }\n }\n };\n /**\r\n * You can set Polyfill (or Ponyfill) for browsers that do not support requestAnimationFrame.\r\n */\n SweetScroll.raf = raf;\n SweetScroll.caf = caf;\n return SweetScroll;\n }();\n return SweetScroll;\n});","/*\nTurbolinks 5.2.0\nCopyright © 2018 Basecamp, LLC\n */\n(function () {\n var t = this;\n (function () {\n (function () {\n this.Turbolinks = {\n supported: function () {\n return null != window.history.pushState && null != window.requestAnimationFrame && null != window.addEventListener;\n }(),\n visit: function (t, r) {\n return e.controller.visit(t, r);\n },\n clearCache: function () {\n return e.controller.clearCache();\n },\n setProgressBarDelay: function (t) {\n return e.controller.setProgressBarDelay(t);\n }\n };\n }).call(this);\n }).call(t);\n var e = t.Turbolinks;\n (function () {\n (function () {\n var t,\n r,\n n,\n o = [].slice;\n e.copyObject = function (t) {\n var e, r, n;\n r = {};\n for (e in t) n = t[e], r[e] = n;\n return r;\n }, e.closest = function (e, r) {\n return t.call(e, r);\n }, t = function () {\n var t, e;\n return t = document.documentElement, null != (e = t.closest) ? e : function (t) {\n var e;\n for (e = this; e;) {\n if (e.nodeType === Node.ELEMENT_NODE && r.call(e, t)) return e;\n e = e.parentNode;\n }\n };\n }(), e.defer = function (t) {\n return setTimeout(t, 1);\n }, e.throttle = function (t) {\n var e;\n return e = null, function () {\n var r;\n return r = 1 <= arguments.length ? o.call(arguments, 0) : [], null != e ? e : e = requestAnimationFrame(function (n) {\n return function () {\n return e = null, t.apply(n, r);\n };\n }(this));\n };\n }, e.dispatch = function (t, e) {\n var r, o, i, s, a, u;\n return a = null != e ? e : {}, u = a.target, r = a.cancelable, o = a.data, i = document.createEvent(\"Events\"), i.initEvent(t, !0, r === !0), i.data = null != o ? o : {}, i.cancelable && !n && (s = i.preventDefault, i.preventDefault = function () {\n return this.defaultPrevented || Object.defineProperty(this, \"defaultPrevented\", {\n get: function () {\n return !0;\n }\n }), s.call(this);\n }), (null != u ? u : document).dispatchEvent(i), i;\n }, n = function () {\n var t;\n return t = document.createEvent(\"Events\"), t.initEvent(\"test\", !0, !0), t.preventDefault(), t.defaultPrevented;\n }(), e.match = function (t, e) {\n return r.call(t, e);\n }, r = function () {\n var t, e, r, n;\n return t = document.documentElement, null != (e = null != (r = null != (n = t.matchesSelector) ? n : t.webkitMatchesSelector) ? r : t.msMatchesSelector) ? e : t.mozMatchesSelector;\n }(), e.uuid = function () {\n var t, e, r;\n for (r = \"\", t = e = 1; 36 >= e; t = ++e) r += 9 === t || 14 === t || 19 === t || 24 === t ? \"-\" : 15 === t ? \"4\" : 20 === t ? (Math.floor(4 * Math.random()) + 8).toString(16) : Math.floor(15 * Math.random()).toString(16);\n return r;\n };\n }).call(this), function () {\n e.Location = function () {\n function t(t) {\n var e, r;\n null == t && (t = \"\"), r = document.createElement(\"a\"), r.href = t.toString(), this.absoluteURL = r.href, e = r.hash.length, 2 > e ? this.requestURL = this.absoluteURL : (this.requestURL = this.absoluteURL.slice(0, -e), this.anchor = r.hash.slice(1));\n }\n var e, r, n, o;\n return t.wrap = function (t) {\n return t instanceof this ? t : new this(t);\n }, t.prototype.getOrigin = function () {\n return this.absoluteURL.split(\"/\", 3).join(\"/\");\n }, t.prototype.getPath = function () {\n var t, e;\n return null != (t = null != (e = this.requestURL.match(/\\/\\/[^\\/]*(\\/[^?;]*)/)) ? e[1] : void 0) ? t : \"/\";\n }, t.prototype.getPathComponents = function () {\n return this.getPath().split(\"/\").slice(1);\n }, t.prototype.getLastPathComponent = function () {\n return this.getPathComponents().slice(-1)[0];\n }, t.prototype.getExtension = function () {\n var t, e;\n return null != (t = null != (e = this.getLastPathComponent().match(/\\.[^.]*$/)) ? e[0] : void 0) ? t : \"\";\n }, t.prototype.isHTML = function () {\n return this.getExtension().match(/^(?:|\\.(?:htm|html|xhtml))$/);\n }, t.prototype.isPrefixedBy = function (t) {\n var e;\n return e = r(t), this.isEqualTo(t) || o(this.absoluteURL, e);\n }, t.prototype.isEqualTo = function (t) {\n return this.absoluteURL === (null != t ? t.absoluteURL : void 0);\n }, t.prototype.toCacheKey = function () {\n return this.requestURL;\n }, t.prototype.toJSON = function () {\n return this.absoluteURL;\n }, t.prototype.toString = function () {\n return this.absoluteURL;\n }, t.prototype.valueOf = function () {\n return this.absoluteURL;\n }, r = function (t) {\n return e(t.getOrigin() + t.getPath());\n }, e = function (t) {\n return n(t, \"/\") ? t : t + \"/\";\n }, o = function (t, e) {\n return t.slice(0, e.length) === e;\n }, n = function (t, e) {\n return t.slice(-e.length) === e;\n }, t;\n }();\n }.call(this), function () {\n var t = function (t, e) {\n return function () {\n return t.apply(e, arguments);\n };\n };\n e.HttpRequest = function () {\n function r(r, n, o) {\n this.delegate = r, this.requestCanceled = t(this.requestCanceled, this), this.requestTimedOut = t(this.requestTimedOut, this), this.requestFailed = t(this.requestFailed, this), this.requestLoaded = t(this.requestLoaded, this), this.requestProgressed = t(this.requestProgressed, this), this.url = e.Location.wrap(n).requestURL, this.referrer = e.Location.wrap(o).absoluteURL, this.createXHR();\n }\n return r.NETWORK_FAILURE = 0, r.TIMEOUT_FAILURE = -1, r.timeout = 60, r.prototype.send = function () {\n var t;\n return this.xhr && !this.sent ? (this.notifyApplicationBeforeRequestStart(), this.setProgress(0), this.xhr.send(), this.sent = !0, \"function\" == typeof (t = this.delegate).requestStarted ? t.requestStarted() : void 0) : void 0;\n }, r.prototype.cancel = function () {\n return this.xhr && this.sent ? this.xhr.abort() : void 0;\n }, r.prototype.requestProgressed = function (t) {\n return t.lengthComputable ? this.setProgress(t.loaded / t.total) : void 0;\n }, r.prototype.requestLoaded = function () {\n return this.endRequest(function (t) {\n return function () {\n var e;\n return 200 <= (e = t.xhr.status) && 300 > e ? t.delegate.requestCompletedWithResponse(t.xhr.responseText, t.xhr.getResponseHeader(\"Turbolinks-Location\")) : (t.failed = !0, t.delegate.requestFailedWithStatusCode(t.xhr.status, t.xhr.responseText));\n };\n }(this));\n }, r.prototype.requestFailed = function () {\n return this.endRequest(function (t) {\n return function () {\n return t.failed = !0, t.delegate.requestFailedWithStatusCode(t.constructor.NETWORK_FAILURE);\n };\n }(this));\n }, r.prototype.requestTimedOut = function () {\n return this.endRequest(function (t) {\n return function () {\n return t.failed = !0, t.delegate.requestFailedWithStatusCode(t.constructor.TIMEOUT_FAILURE);\n };\n }(this));\n }, r.prototype.requestCanceled = function () {\n return this.endRequest();\n }, r.prototype.notifyApplicationBeforeRequestStart = function () {\n return e.dispatch(\"turbolinks:request-start\", {\n data: {\n url: this.url,\n xhr: this.xhr\n }\n });\n }, r.prototype.notifyApplicationAfterRequestEnd = function () {\n return e.dispatch(\"turbolinks:request-end\", {\n data: {\n url: this.url,\n xhr: this.xhr\n }\n });\n }, r.prototype.createXHR = function () {\n return this.xhr = new XMLHttpRequest(), this.xhr.open(\"GET\", this.url, !0), this.xhr.timeout = 1e3 * this.constructor.timeout, this.xhr.setRequestHeader(\"Accept\", \"text/html, application/xhtml+xml\"), this.xhr.setRequestHeader(\"Turbolinks-Referrer\", this.referrer), this.xhr.onprogress = this.requestProgressed, this.xhr.onload = this.requestLoaded, this.xhr.onerror = this.requestFailed, this.xhr.ontimeout = this.requestTimedOut, this.xhr.onabort = this.requestCanceled;\n }, r.prototype.endRequest = function (t) {\n return this.xhr ? (this.notifyApplicationAfterRequestEnd(), null != t && t.call(this), this.destroy()) : void 0;\n }, r.prototype.setProgress = function (t) {\n var e;\n return this.progress = t, \"function\" == typeof (e = this.delegate).requestProgressed ? e.requestProgressed(this.progress) : void 0;\n }, r.prototype.destroy = function () {\n var t;\n return this.setProgress(1), \"function\" == typeof (t = this.delegate).requestFinished && t.requestFinished(), this.delegate = null, this.xhr = null;\n }, r;\n }();\n }.call(this), function () {\n var t = function (t, e) {\n return function () {\n return t.apply(e, arguments);\n };\n };\n e.ProgressBar = function () {\n function e() {\n this.trickle = t(this.trickle, this), this.stylesheetElement = this.createStylesheetElement(), this.progressElement = this.createProgressElement();\n }\n var r;\n return r = 300, e.defaultCSS = \".turbolinks-progress-bar {\\n position: fixed;\\n display: block;\\n top: 0;\\n left: 0;\\n height: 3px;\\n background: #0076ff;\\n z-index: 9999;\\n transition: width \" + r + \"ms ease-out, opacity \" + r / 2 + \"ms \" + r / 2 + \"ms ease-in;\\n transform: translate3d(0, 0, 0);\\n}\", e.prototype.show = function () {\n return this.visible ? void 0 : (this.visible = !0, this.installStylesheetElement(), this.installProgressElement(), this.startTrickling());\n }, e.prototype.hide = function () {\n return this.visible && !this.hiding ? (this.hiding = !0, this.fadeProgressElement(function (t) {\n return function () {\n return t.uninstallProgressElement(), t.stopTrickling(), t.visible = !1, t.hiding = !1;\n };\n }(this))) : void 0;\n }, e.prototype.setValue = function (t) {\n return this.value = t, this.refresh();\n }, e.prototype.installStylesheetElement = function () {\n return document.head.insertBefore(this.stylesheetElement, document.head.firstChild);\n }, e.prototype.installProgressElement = function () {\n return this.progressElement.style.width = 0, this.progressElement.style.opacity = 1, document.documentElement.insertBefore(this.progressElement, document.body), this.refresh();\n }, e.prototype.fadeProgressElement = function (t) {\n return this.progressElement.style.opacity = 0, setTimeout(t, 1.5 * r);\n }, e.prototype.uninstallProgressElement = function () {\n return this.progressElement.parentNode ? document.documentElement.removeChild(this.progressElement) : void 0;\n }, e.prototype.startTrickling = function () {\n return null != this.trickleInterval ? this.trickleInterval : this.trickleInterval = setInterval(this.trickle, r);\n }, e.prototype.stopTrickling = function () {\n return clearInterval(this.trickleInterval), this.trickleInterval = null;\n }, e.prototype.trickle = function () {\n return this.setValue(this.value + Math.random() / 100);\n }, e.prototype.refresh = function () {\n return requestAnimationFrame(function (t) {\n return function () {\n return t.progressElement.style.width = 10 + 90 * t.value + \"%\";\n };\n }(this));\n }, e.prototype.createStylesheetElement = function () {\n var t;\n return t = document.createElement(\"style\"), t.type = \"text/css\", t.textContent = this.constructor.defaultCSS, t;\n }, e.prototype.createProgressElement = function () {\n var t;\n return t = document.createElement(\"div\"), t.className = \"turbolinks-progress-bar\", t;\n }, e;\n }();\n }.call(this), function () {\n var t = function (t, e) {\n return function () {\n return t.apply(e, arguments);\n };\n };\n e.BrowserAdapter = function () {\n function r(r) {\n this.controller = r, this.showProgressBar = t(this.showProgressBar, this), this.progressBar = new e.ProgressBar();\n }\n var n, o, i;\n return i = e.HttpRequest, n = i.NETWORK_FAILURE, o = i.TIMEOUT_FAILURE, r.prototype.visitProposedToLocationWithAction = function (t, e) {\n return this.controller.startVisitToLocationWithAction(t, e);\n }, r.prototype.visitStarted = function (t) {\n return t.issueRequest(), t.changeHistory(), t.loadCachedSnapshot();\n }, r.prototype.visitRequestStarted = function (t) {\n return this.progressBar.setValue(0), t.hasCachedSnapshot() || \"restore\" !== t.action ? this.showProgressBarAfterDelay() : this.showProgressBar();\n }, r.prototype.visitRequestProgressed = function (t) {\n return this.progressBar.setValue(t.progress);\n }, r.prototype.visitRequestCompleted = function (t) {\n return t.loadResponse();\n }, r.prototype.visitRequestFailedWithStatusCode = function (t, e) {\n switch (e) {\n case n:\n case o:\n return this.reload();\n default:\n return t.loadResponse();\n }\n }, r.prototype.visitRequestFinished = function (t) {\n return this.hideProgressBar();\n }, r.prototype.visitCompleted = function (t) {\n return t.followRedirect();\n }, r.prototype.pageInvalidated = function () {\n return this.reload();\n }, r.prototype.showProgressBarAfterDelay = function () {\n return this.progressBarTimeout = setTimeout(this.showProgressBar, this.controller.progressBarDelay);\n }, r.prototype.showProgressBar = function () {\n return this.progressBar.show();\n }, r.prototype.hideProgressBar = function () {\n return this.progressBar.hide(), clearTimeout(this.progressBarTimeout);\n }, r.prototype.reload = function () {\n return window.location.reload();\n }, r;\n }();\n }.call(this), function () {\n var t = function (t, e) {\n return function () {\n return t.apply(e, arguments);\n };\n };\n e.History = function () {\n function r(e) {\n this.delegate = e, this.onPageLoad = t(this.onPageLoad, this), this.onPopState = t(this.onPopState, this);\n }\n return r.prototype.start = function () {\n return this.started ? void 0 : (addEventListener(\"popstate\", this.onPopState, !1), addEventListener(\"load\", this.onPageLoad, !1), this.started = !0);\n }, r.prototype.stop = function () {\n return this.started ? (removeEventListener(\"popstate\", this.onPopState, !1), removeEventListener(\"load\", this.onPageLoad, !1), this.started = !1) : void 0;\n }, r.prototype.push = function (t, r) {\n return t = e.Location.wrap(t), this.update(\"push\", t, r);\n }, r.prototype.replace = function (t, r) {\n return t = e.Location.wrap(t), this.update(\"replace\", t, r);\n }, r.prototype.onPopState = function (t) {\n var r, n, o, i;\n return this.shouldHandlePopState() && (i = null != (n = t.state) ? n.turbolinks : void 0) ? (r = e.Location.wrap(window.location), o = i.restorationIdentifier, this.delegate.historyPoppedToLocationWithRestorationIdentifier(r, o)) : void 0;\n }, r.prototype.onPageLoad = function (t) {\n return e.defer(function (t) {\n return function () {\n return t.pageLoaded = !0;\n };\n }(this));\n }, r.prototype.shouldHandlePopState = function () {\n return this.pageIsLoaded();\n }, r.prototype.pageIsLoaded = function () {\n return this.pageLoaded || \"complete\" === document.readyState;\n }, r.prototype.update = function (t, e, r) {\n var n;\n return n = {\n turbolinks: {\n restorationIdentifier: r\n }\n }, history[t + \"State\"](n, null, e);\n }, r;\n }();\n }.call(this), function () {\n e.HeadDetails = function () {\n function t(t) {\n var e, r, n, s, a, u;\n for (this.elements = {}, n = 0, a = t.length; a > n; n++) u = t[n], u.nodeType === Node.ELEMENT_NODE && (s = u.outerHTML, r = null != (e = this.elements)[s] ? e[s] : e[s] = {\n type: i(u),\n tracked: o(u),\n elements: []\n }, r.elements.push(u));\n }\n var e, r, n, o, i;\n return t.fromHeadElement = function (t) {\n var e;\n return new this(null != (e = null != t ? t.childNodes : void 0) ? e : []);\n }, t.prototype.hasElementWithKey = function (t) {\n return t in this.elements;\n }, t.prototype.getTrackedElementSignature = function () {\n var t, e;\n return function () {\n var r, n;\n r = this.elements, n = [];\n for (t in r) e = r[t].tracked, e && n.push(t);\n return n;\n }.call(this).join(\"\");\n }, t.prototype.getScriptElementsNotInDetails = function (t) {\n return this.getElementsMatchingTypeNotInDetails(\"script\", t);\n }, t.prototype.getStylesheetElementsNotInDetails = function (t) {\n return this.getElementsMatchingTypeNotInDetails(\"stylesheet\", t);\n }, t.prototype.getElementsMatchingTypeNotInDetails = function (t, e) {\n var r, n, o, i, s, a;\n o = this.elements, s = [];\n for (n in o) i = o[n], a = i.type, r = i.elements, a !== t || e.hasElementWithKey(n) || s.push(r[0]);\n return s;\n }, t.prototype.getProvisionalElements = function () {\n var t, e, r, n, o, i, s;\n r = [], n = this.elements;\n for (e in n) o = n[e], s = o.type, i = o.tracked, t = o.elements, null != s || i ? t.length > 1 && r.push.apply(r, t.slice(1)) : r.push.apply(r, t);\n return r;\n }, t.prototype.getMetaValue = function (t) {\n var e;\n return null != (e = this.findMetaElementByName(t)) ? e.getAttribute(\"content\") : void 0;\n }, t.prototype.findMetaElementByName = function (t) {\n var r, n, o, i;\n r = void 0, i = this.elements;\n for (o in i) n = i[o].elements, e(n[0], t) && (r = n[0]);\n return r;\n }, i = function (t) {\n return r(t) ? \"script\" : n(t) ? \"stylesheet\" : void 0;\n }, o = function (t) {\n return \"reload\" === t.getAttribute(\"data-turbolinks-track\");\n }, r = function (t) {\n var e;\n return e = t.tagName.toLowerCase(), \"script\" === e;\n }, n = function (t) {\n var e;\n return e = t.tagName.toLowerCase(), \"style\" === e || \"link\" === e && \"stylesheet\" === t.getAttribute(\"rel\");\n }, e = function (t, e) {\n var r;\n return r = t.tagName.toLowerCase(), \"meta\" === r && t.getAttribute(\"name\") === e;\n }, t;\n }();\n }.call(this), function () {\n e.Snapshot = function () {\n function t(t, e) {\n this.headDetails = t, this.bodyElement = e;\n }\n return t.wrap = function (t) {\n return t instanceof this ? t : \"string\" == typeof t ? this.fromHTMLString(t) : this.fromHTMLElement(t);\n }, t.fromHTMLString = function (t) {\n var e;\n return e = document.createElement(\"html\"), e.innerHTML = t, this.fromHTMLElement(e);\n }, t.fromHTMLElement = function (t) {\n var r, n, o, i;\n return o = t.querySelector(\"head\"), r = null != (i = t.querySelector(\"body\")) ? i : document.createElement(\"body\"), n = e.HeadDetails.fromHeadElement(o), new this(n, r);\n }, t.prototype.clone = function () {\n return new this.constructor(this.headDetails, this.bodyElement.cloneNode(!0));\n }, t.prototype.getRootLocation = function () {\n var t, r;\n return r = null != (t = this.getSetting(\"root\")) ? t : \"/\", new e.Location(r);\n }, t.prototype.getCacheControlValue = function () {\n return this.getSetting(\"cache-control\");\n }, t.prototype.getElementForAnchor = function (t) {\n try {\n return this.bodyElement.querySelector(\"[id='\" + t + \"'], a[name='\" + t + \"']\");\n } catch (e) {}\n }, t.prototype.getPermanentElements = function () {\n return this.bodyElement.querySelectorAll(\"[id][data-turbolinks-permanent]\");\n }, t.prototype.getPermanentElementById = function (t) {\n return this.bodyElement.querySelector(\"#\" + t + \"[data-turbolinks-permanent]\");\n }, t.prototype.getPermanentElementsPresentInSnapshot = function (t) {\n var e, r, n, o, i;\n for (o = this.getPermanentElements(), i = [], r = 0, n = o.length; n > r; r++) e = o[r], t.getPermanentElementById(e.id) && i.push(e);\n return i;\n }, t.prototype.findFirstAutofocusableElement = function () {\n return this.bodyElement.querySelector(\"[autofocus]\");\n }, t.prototype.hasAnchor = function (t) {\n return null != this.getElementForAnchor(t);\n }, t.prototype.isPreviewable = function () {\n return \"no-preview\" !== this.getCacheControlValue();\n }, t.prototype.isCacheable = function () {\n return \"no-cache\" !== this.getCacheControlValue();\n }, t.prototype.isVisitable = function () {\n return \"reload\" !== this.getSetting(\"visit-control\");\n }, t.prototype.getSetting = function (t) {\n return this.headDetails.getMetaValue(\"turbolinks-\" + t);\n }, t;\n }();\n }.call(this), function () {\n var t = [].slice;\n e.Renderer = function () {\n function e() {}\n var r;\n return e.render = function () {\n var e, r, n, o;\n return n = arguments[0], r = arguments[1], e = 3 <= arguments.length ? t.call(arguments, 2) : [], o = function (t, e, r) {\n r.prototype = t.prototype;\n var n = new r(),\n o = t.apply(n, e);\n return Object(o) === o ? o : n;\n }(this, e, function () {}), o.delegate = n, o.render(r), o;\n }, e.prototype.renderView = function (t) {\n return this.delegate.viewWillRender(this.newBody), t(), this.delegate.viewRendered(this.newBody);\n }, e.prototype.invalidateView = function () {\n return this.delegate.viewInvalidated();\n }, e.prototype.createScriptElement = function (t) {\n var e;\n return \"false\" === t.getAttribute(\"data-turbolinks-eval\") ? t : (e = document.createElement(\"script\"), e.textContent = t.textContent, e.async = !1, r(e, t), e);\n }, r = function (t, e) {\n var r, n, o, i, s, a, u;\n for (i = e.attributes, a = [], r = 0, n = i.length; n > r; r++) s = i[r], o = s.name, u = s.value, a.push(t.setAttribute(o, u));\n return a;\n }, e;\n }();\n }.call(this), function () {\n var t,\n r,\n n = function (t, e) {\n function r() {\n this.constructor = t;\n }\n for (var n in e) o.call(e, n) && (t[n] = e[n]);\n return r.prototype = e.prototype, t.prototype = new r(), t.__super__ = e.prototype, t;\n },\n o = {}.hasOwnProperty;\n e.SnapshotRenderer = function (e) {\n function o(t, e, r) {\n this.currentSnapshot = t, this.newSnapshot = e, this.isPreview = r, this.currentHeadDetails = this.currentSnapshot.headDetails, this.newHeadDetails = this.newSnapshot.headDetails, this.currentBody = this.currentSnapshot.bodyElement, this.newBody = this.newSnapshot.bodyElement;\n }\n return n(o, e), o.prototype.render = function (t) {\n return this.shouldRender() ? (this.mergeHead(), this.renderView(function (e) {\n return function () {\n return e.replaceBody(), e.isPreview || e.focusFirstAutofocusableElement(), t();\n };\n }(this))) : this.invalidateView();\n }, o.prototype.mergeHead = function () {\n return this.copyNewHeadStylesheetElements(), this.copyNewHeadScriptElements(), this.removeCurrentHeadProvisionalElements(), this.copyNewHeadProvisionalElements();\n }, o.prototype.replaceBody = function () {\n var t;\n return t = this.relocateCurrentBodyPermanentElements(), this.activateNewBodyScriptElements(), this.assignNewBody(), this.replacePlaceholderElementsWithClonedPermanentElements(t);\n }, o.prototype.shouldRender = function () {\n return this.newSnapshot.isVisitable() && this.trackedElementsAreIdentical();\n }, o.prototype.trackedElementsAreIdentical = function () {\n return this.currentHeadDetails.getTrackedElementSignature() === this.newHeadDetails.getTrackedElementSignature();\n }, o.prototype.copyNewHeadStylesheetElements = function () {\n var t, e, r, n, o;\n for (n = this.getNewHeadStylesheetElements(), o = [], e = 0, r = n.length; r > e; e++) t = n[e], o.push(document.head.appendChild(t));\n return o;\n }, o.prototype.copyNewHeadScriptElements = function () {\n var t, e, r, n, o;\n for (n = this.getNewHeadScriptElements(), o = [], e = 0, r = n.length; r > e; e++) t = n[e], o.push(document.head.appendChild(this.createScriptElement(t)));\n return o;\n }, o.prototype.removeCurrentHeadProvisionalElements = function () {\n var t, e, r, n, o;\n for (n = this.getCurrentHeadProvisionalElements(), o = [], e = 0, r = n.length; r > e; e++) t = n[e], o.push(document.head.removeChild(t));\n return o;\n }, o.prototype.copyNewHeadProvisionalElements = function () {\n var t, e, r, n, o;\n for (n = this.getNewHeadProvisionalElements(), o = [], e = 0, r = n.length; r > e; e++) t = n[e], o.push(document.head.appendChild(t));\n return o;\n }, o.prototype.relocateCurrentBodyPermanentElements = function () {\n var e, n, o, i, s, a, u;\n for (a = this.getCurrentBodyPermanentElements(), u = [], e = 0, n = a.length; n > e; e++) i = a[e], s = t(i), o = this.newSnapshot.getPermanentElementById(i.id), r(i, s.element), r(o, i), u.push(s);\n return u;\n }, o.prototype.replacePlaceholderElementsWithClonedPermanentElements = function (t) {\n var e, n, o, i, s, a, u;\n for (u = [], o = 0, i = t.length; i > o; o++) a = t[o], n = a.element, s = a.permanentElement, e = s.cloneNode(!0), u.push(r(n, e));\n return u;\n }, o.prototype.activateNewBodyScriptElements = function () {\n var t, e, n, o, i, s;\n for (i = this.getNewBodyScriptElements(), s = [], e = 0, o = i.length; o > e; e++) n = i[e], t = this.createScriptElement(n), s.push(r(n, t));\n return s;\n }, o.prototype.assignNewBody = function () {\n return document.body = this.newBody;\n }, o.prototype.focusFirstAutofocusableElement = function () {\n var t;\n return null != (t = this.newSnapshot.findFirstAutofocusableElement()) ? t.focus() : void 0;\n }, o.prototype.getNewHeadStylesheetElements = function () {\n return this.newHeadDetails.getStylesheetElementsNotInDetails(this.currentHeadDetails);\n }, o.prototype.getNewHeadScriptElements = function () {\n return this.newHeadDetails.getScriptElementsNotInDetails(this.currentHeadDetails);\n }, o.prototype.getCurrentHeadProvisionalElements = function () {\n return this.currentHeadDetails.getProvisionalElements();\n }, o.prototype.getNewHeadProvisionalElements = function () {\n return this.newHeadDetails.getProvisionalElements();\n }, o.prototype.getCurrentBodyPermanentElements = function () {\n return this.currentSnapshot.getPermanentElementsPresentInSnapshot(this.newSnapshot);\n }, o.prototype.getNewBodyScriptElements = function () {\n return this.newBody.querySelectorAll(\"script\");\n }, o;\n }(e.Renderer), t = function (t) {\n var e;\n return e = document.createElement(\"meta\"), e.setAttribute(\"name\", \"turbolinks-permanent-placeholder\"), e.setAttribute(\"content\", t.id), {\n element: e,\n permanentElement: t\n };\n }, r = function (t, e) {\n var r;\n return (r = t.parentNode) ? r.replaceChild(e, t) : void 0;\n };\n }.call(this), function () {\n var t = function (t, e) {\n function n() {\n this.constructor = t;\n }\n for (var o in e) r.call(e, o) && (t[o] = e[o]);\n return n.prototype = e.prototype, t.prototype = new n(), t.__super__ = e.prototype, t;\n },\n r = {}.hasOwnProperty;\n e.ErrorRenderer = function (e) {\n function r(t) {\n var e;\n e = document.createElement(\"html\"), e.innerHTML = t, this.newHead = e.querySelector(\"head\"), this.newBody = e.querySelector(\"body\");\n }\n return t(r, e), r.prototype.render = function (t) {\n return this.renderView(function (e) {\n return function () {\n return e.replaceHeadAndBody(), e.activateBodyScriptElements(), t();\n };\n }(this));\n }, r.prototype.replaceHeadAndBody = function () {\n var t, e;\n return e = document.head, t = document.body, e.parentNode.replaceChild(this.newHead, e), t.parentNode.replaceChild(this.newBody, t);\n }, r.prototype.activateBodyScriptElements = function () {\n var t, e, r, n, o, i;\n for (n = this.getScriptElements(), i = [], e = 0, r = n.length; r > e; e++) o = n[e], t = this.createScriptElement(o), i.push(o.parentNode.replaceChild(t, o));\n return i;\n }, r.prototype.getScriptElements = function () {\n return document.documentElement.querySelectorAll(\"script\");\n }, r;\n }(e.Renderer);\n }.call(this), function () {\n e.View = function () {\n function t(t) {\n this.delegate = t, this.htmlElement = document.documentElement;\n }\n return t.prototype.getRootLocation = function () {\n return this.getSnapshot().getRootLocation();\n }, t.prototype.getElementForAnchor = function (t) {\n return this.getSnapshot().getElementForAnchor(t);\n }, t.prototype.getSnapshot = function () {\n return e.Snapshot.fromHTMLElement(this.htmlElement);\n }, t.prototype.render = function (t, e) {\n var r, n, o;\n return o = t.snapshot, r = t.error, n = t.isPreview, this.markAsPreview(n), null != o ? this.renderSnapshot(o, n, e) : this.renderError(r, e);\n }, t.prototype.markAsPreview = function (t) {\n return t ? this.htmlElement.setAttribute(\"data-turbolinks-preview\", \"\") : this.htmlElement.removeAttribute(\"data-turbolinks-preview\");\n }, t.prototype.renderSnapshot = function (t, r, n) {\n return e.SnapshotRenderer.render(this.delegate, n, this.getSnapshot(), e.Snapshot.wrap(t), r);\n }, t.prototype.renderError = function (t, r) {\n return e.ErrorRenderer.render(this.delegate, r, t);\n }, t;\n }();\n }.call(this), function () {\n var t = function (t, e) {\n return function () {\n return t.apply(e, arguments);\n };\n };\n e.ScrollManager = function () {\n function r(r) {\n this.delegate = r, this.onScroll = t(this.onScroll, this), this.onScroll = e.throttle(this.onScroll);\n }\n return r.prototype.start = function () {\n return this.started ? void 0 : (addEventListener(\"scroll\", this.onScroll, !1), this.onScroll(), this.started = !0);\n }, r.prototype.stop = function () {\n return this.started ? (removeEventListener(\"scroll\", this.onScroll, !1), this.started = !1) : void 0;\n }, r.prototype.scrollToElement = function (t) {\n return t.scrollIntoView();\n }, r.prototype.scrollToPosition = function (t) {\n var e, r;\n return e = t.x, r = t.y, window.scrollTo(e, r);\n }, r.prototype.onScroll = function (t) {\n return this.updatePosition({\n x: window.pageXOffset,\n y: window.pageYOffset\n });\n }, r.prototype.updatePosition = function (t) {\n var e;\n return this.position = t, null != (e = this.delegate) ? e.scrollPositionChanged(this.position) : void 0;\n }, r;\n }();\n }.call(this), function () {\n e.SnapshotCache = function () {\n function t(t) {\n this.size = t, this.keys = [], this.snapshots = {};\n }\n var r;\n return t.prototype.has = function (t) {\n var e;\n return e = r(t), e in this.snapshots;\n }, t.prototype.get = function (t) {\n var e;\n if (this.has(t)) return e = this.read(t), this.touch(t), e;\n }, t.prototype.put = function (t, e) {\n return this.write(t, e), this.touch(t), e;\n }, t.prototype.read = function (t) {\n var e;\n return e = r(t), this.snapshots[e];\n }, t.prototype.write = function (t, e) {\n var n;\n return n = r(t), this.snapshots[n] = e;\n }, t.prototype.touch = function (t) {\n var e, n;\n return n = r(t), e = this.keys.indexOf(n), e > -1 && this.keys.splice(e, 1), this.keys.unshift(n), this.trim();\n }, t.prototype.trim = function () {\n var t, e, r, n, o;\n for (n = this.keys.splice(this.size), o = [], t = 0, r = n.length; r > t; t++) e = n[t], o.push(delete this.snapshots[e]);\n return o;\n }, r = function (t) {\n return e.Location.wrap(t).toCacheKey();\n }, t;\n }();\n }.call(this), function () {\n var t = function (t, e) {\n return function () {\n return t.apply(e, arguments);\n };\n };\n e.Visit = function () {\n function r(r, n, o) {\n this.controller = r, this.action = o, this.performScroll = t(this.performScroll, this), this.identifier = e.uuid(), this.location = e.Location.wrap(n), this.adapter = this.controller.adapter, this.state = \"initialized\", this.timingMetrics = {};\n }\n var n;\n return r.prototype.start = function () {\n return \"initialized\" === this.state ? (this.recordTimingMetric(\"visitStart\"), this.state = \"started\", this.adapter.visitStarted(this)) : void 0;\n }, r.prototype.cancel = function () {\n var t;\n return \"started\" === this.state ? (null != (t = this.request) && t.cancel(), this.cancelRender(), this.state = \"canceled\") : void 0;\n }, r.prototype.complete = function () {\n var t;\n return \"started\" === this.state ? (this.recordTimingMetric(\"visitEnd\"), this.state = \"completed\", \"function\" == typeof (t = this.adapter).visitCompleted && t.visitCompleted(this), this.controller.visitCompleted(this)) : void 0;\n }, r.prototype.fail = function () {\n var t;\n return \"started\" === this.state ? (this.state = \"failed\", \"function\" == typeof (t = this.adapter).visitFailed ? t.visitFailed(this) : void 0) : void 0;\n }, r.prototype.changeHistory = function () {\n var t, e;\n return this.historyChanged ? void 0 : (t = this.location.isEqualTo(this.referrer) ? \"replace\" : this.action, e = n(t), this.controller[e](this.location, this.restorationIdentifier), this.historyChanged = !0);\n }, r.prototype.issueRequest = function () {\n return this.shouldIssueRequest() && null == this.request ? (this.progress = 0, this.request = new e.HttpRequest(this, this.location, this.referrer), this.request.send()) : void 0;\n }, r.prototype.getCachedSnapshot = function () {\n var t;\n return !(t = this.controller.getCachedSnapshotForLocation(this.location)) || null != this.location.anchor && !t.hasAnchor(this.location.anchor) || \"restore\" !== this.action && !t.isPreviewable() ? void 0 : t;\n }, r.prototype.hasCachedSnapshot = function () {\n return null != this.getCachedSnapshot();\n }, r.prototype.loadCachedSnapshot = function () {\n var t, e;\n return (e = this.getCachedSnapshot()) ? (t = this.shouldIssueRequest(), this.render(function () {\n var r;\n return this.cacheSnapshot(), this.controller.render({\n snapshot: e,\n isPreview: t\n }, this.performScroll), \"function\" == typeof (r = this.adapter).visitRendered && r.visitRendered(this), t ? void 0 : this.complete();\n })) : void 0;\n }, r.prototype.loadResponse = function () {\n return null != this.response ? this.render(function () {\n var t, e;\n return this.cacheSnapshot(), this.request.failed ? (this.controller.render({\n error: this.response\n }, this.performScroll), \"function\" == typeof (t = this.adapter).visitRendered && t.visitRendered(this), this.fail()) : (this.controller.render({\n snapshot: this.response\n }, this.performScroll), \"function\" == typeof (e = this.adapter).visitRendered && e.visitRendered(this), this.complete());\n }) : void 0;\n }, r.prototype.followRedirect = function () {\n return this.redirectedToLocation && !this.followedRedirect ? (this.location = this.redirectedToLocation, this.controller.replaceHistoryWithLocationAndRestorationIdentifier(this.redirectedToLocation, this.restorationIdentifier), this.followedRedirect = !0) : void 0;\n }, r.prototype.requestStarted = function () {\n var t;\n return this.recordTimingMetric(\"requestStart\"), \"function\" == typeof (t = this.adapter).visitRequestStarted ? t.visitRequestStarted(this) : void 0;\n }, r.prototype.requestProgressed = function (t) {\n var e;\n return this.progress = t, \"function\" == typeof (e = this.adapter).visitRequestProgressed ? e.visitRequestProgressed(this) : void 0;\n }, r.prototype.requestCompletedWithResponse = function (t, r) {\n return this.response = t, null != r && (this.redirectedToLocation = e.Location.wrap(r)), this.adapter.visitRequestCompleted(this);\n }, r.prototype.requestFailedWithStatusCode = function (t, e) {\n return this.response = e, this.adapter.visitRequestFailedWithStatusCode(this, t);\n }, r.prototype.requestFinished = function () {\n var t;\n return this.recordTimingMetric(\"requestEnd\"), \"function\" == typeof (t = this.adapter).visitRequestFinished ? t.visitRequestFinished(this) : void 0;\n }, r.prototype.performScroll = function () {\n return this.scrolled ? void 0 : (\"restore\" === this.action ? this.scrollToRestoredPosition() || this.scrollToTop() : this.scrollToAnchor() || this.scrollToTop(), this.scrolled = !0);\n }, r.prototype.scrollToRestoredPosition = function () {\n var t, e;\n return t = null != (e = this.restorationData) ? e.scrollPosition : void 0, null != t ? (this.controller.scrollToPosition(t), !0) : void 0;\n }, r.prototype.scrollToAnchor = function () {\n return null != this.location.anchor ? (this.controller.scrollToAnchor(this.location.anchor), !0) : void 0;\n }, r.prototype.scrollToTop = function () {\n return this.controller.scrollToPosition({\n x: 0,\n y: 0\n });\n }, r.prototype.recordTimingMetric = function (t) {\n var e;\n return null != (e = this.timingMetrics)[t] ? e[t] : e[t] = new Date().getTime();\n }, r.prototype.getTimingMetrics = function () {\n return e.copyObject(this.timingMetrics);\n }, n = function (t) {\n switch (t) {\n case \"replace\":\n return \"replaceHistoryWithLocationAndRestorationIdentifier\";\n case \"advance\":\n case \"restore\":\n return \"pushHistoryWithLocationAndRestorationIdentifier\";\n }\n }, r.prototype.shouldIssueRequest = function () {\n return \"restore\" === this.action ? !this.hasCachedSnapshot() : !0;\n }, r.prototype.cacheSnapshot = function () {\n return this.snapshotCached ? void 0 : (this.controller.cacheSnapshot(), this.snapshotCached = !0);\n }, r.prototype.render = function (t) {\n return this.cancelRender(), this.frame = requestAnimationFrame(function (e) {\n return function () {\n return e.frame = null, t.call(e);\n };\n }(this));\n }, r.prototype.cancelRender = function () {\n return this.frame ? cancelAnimationFrame(this.frame) : void 0;\n }, r;\n }();\n }.call(this), function () {\n var t = function (t, e) {\n return function () {\n return t.apply(e, arguments);\n };\n };\n e.Controller = function () {\n function r() {\n this.clickBubbled = t(this.clickBubbled, this), this.clickCaptured = t(this.clickCaptured, this), this.pageLoaded = t(this.pageLoaded, this), this.history = new e.History(this), this.view = new e.View(this), this.scrollManager = new e.ScrollManager(this), this.restorationData = {}, this.clearCache(), this.setProgressBarDelay(500);\n }\n return r.prototype.start = function () {\n return e.supported && !this.started ? (addEventListener(\"click\", this.clickCaptured, !0), addEventListener(\"DOMContentLoaded\", this.pageLoaded, !1), this.scrollManager.start(), this.startHistory(), this.started = !0, this.enabled = !0) : void 0;\n }, r.prototype.disable = function () {\n return this.enabled = !1;\n }, r.prototype.stop = function () {\n return this.started ? (removeEventListener(\"click\", this.clickCaptured, !0), removeEventListener(\"DOMContentLoaded\", this.pageLoaded, !1), this.scrollManager.stop(), this.stopHistory(), this.started = !1) : void 0;\n }, r.prototype.clearCache = function () {\n return this.cache = new e.SnapshotCache(10);\n }, r.prototype.visit = function (t, r) {\n var n, o;\n return null == r && (r = {}), t = e.Location.wrap(t), this.applicationAllowsVisitingLocation(t) ? this.locationIsVisitable(t) ? (n = null != (o = r.action) ? o : \"advance\", this.adapter.visitProposedToLocationWithAction(t, n)) : window.location = t : void 0;\n }, r.prototype.startVisitToLocationWithAction = function (t, r, n) {\n var o;\n return e.supported ? (o = this.getRestorationDataForIdentifier(n), this.startVisit(t, r, {\n restorationData: o\n })) : window.location = t;\n }, r.prototype.setProgressBarDelay = function (t) {\n return this.progressBarDelay = t;\n }, r.prototype.startHistory = function () {\n return this.location = e.Location.wrap(window.location), this.restorationIdentifier = e.uuid(), this.history.start(), this.history.replace(this.location, this.restorationIdentifier);\n }, r.prototype.stopHistory = function () {\n return this.history.stop();\n }, r.prototype.pushHistoryWithLocationAndRestorationIdentifier = function (t, r) {\n return this.restorationIdentifier = r, this.location = e.Location.wrap(t), this.history.push(this.location, this.restorationIdentifier);\n }, r.prototype.replaceHistoryWithLocationAndRestorationIdentifier = function (t, r) {\n return this.restorationIdentifier = r, this.location = e.Location.wrap(t), this.history.replace(this.location, this.restorationIdentifier);\n }, r.prototype.historyPoppedToLocationWithRestorationIdentifier = function (t, r) {\n var n;\n return this.restorationIdentifier = r, this.enabled ? (n = this.getRestorationDataForIdentifier(this.restorationIdentifier), this.startVisit(t, \"restore\", {\n restorationIdentifier: this.restorationIdentifier,\n restorationData: n,\n historyChanged: !0\n }), this.location = e.Location.wrap(t)) : this.adapter.pageInvalidated();\n }, r.prototype.getCachedSnapshotForLocation = function (t) {\n var e;\n return null != (e = this.cache.get(t)) ? e.clone() : void 0;\n }, r.prototype.shouldCacheSnapshot = function () {\n return this.view.getSnapshot().isCacheable();\n }, r.prototype.cacheSnapshot = function () {\n var t, r;\n return this.shouldCacheSnapshot() ? (this.notifyApplicationBeforeCachingSnapshot(), r = this.view.getSnapshot(), t = this.lastRenderedLocation, e.defer(function (e) {\n return function () {\n return e.cache.put(t, r.clone());\n };\n }(this))) : void 0;\n }, r.prototype.scrollToAnchor = function (t) {\n var e;\n return (e = this.view.getElementForAnchor(t)) ? this.scrollToElement(e) : this.scrollToPosition({\n x: 0,\n y: 0\n });\n }, r.prototype.scrollToElement = function (t) {\n return this.scrollManager.scrollToElement(t);\n }, r.prototype.scrollToPosition = function (t) {\n return this.scrollManager.scrollToPosition(t);\n }, r.prototype.scrollPositionChanged = function (t) {\n var e;\n return e = this.getCurrentRestorationData(), e.scrollPosition = t;\n }, r.prototype.render = function (t, e) {\n return this.view.render(t, e);\n }, r.prototype.viewInvalidated = function () {\n return this.adapter.pageInvalidated();\n }, r.prototype.viewWillRender = function (t) {\n return this.notifyApplicationBeforeRender(t);\n }, r.prototype.viewRendered = function () {\n return this.lastRenderedLocation = this.currentVisit.location, this.notifyApplicationAfterRender();\n }, r.prototype.pageLoaded = function () {\n return this.lastRenderedLocation = this.location, this.notifyApplicationAfterPageLoad();\n }, r.prototype.clickCaptured = function () {\n return removeEventListener(\"click\", this.clickBubbled, !1), addEventListener(\"click\", this.clickBubbled, !1);\n }, r.prototype.clickBubbled = function (t) {\n var e, r, n;\n return this.enabled && this.clickEventIsSignificant(t) && (r = this.getVisitableLinkForNode(t.target)) && (n = this.getVisitableLocationForLink(r)) && this.applicationAllowsFollowingLinkToLocation(r, n) ? (t.preventDefault(), e = this.getActionForLink(r), this.visit(n, {\n action: e\n })) : void 0;\n }, r.prototype.applicationAllowsFollowingLinkToLocation = function (t, e) {\n var r;\n return r = this.notifyApplicationAfterClickingLinkToLocation(t, e), !r.defaultPrevented;\n }, r.prototype.applicationAllowsVisitingLocation = function (t) {\n var e;\n return e = this.notifyApplicationBeforeVisitingLocation(t), !e.defaultPrevented;\n }, r.prototype.notifyApplicationAfterClickingLinkToLocation = function (t, r) {\n return e.dispatch(\"turbolinks:click\", {\n target: t,\n data: {\n url: r.absoluteURL\n },\n cancelable: !0\n });\n }, r.prototype.notifyApplicationBeforeVisitingLocation = function (t) {\n return e.dispatch(\"turbolinks:before-visit\", {\n data: {\n url: t.absoluteURL\n },\n cancelable: !0\n });\n }, r.prototype.notifyApplicationAfterVisitingLocation = function (t) {\n return e.dispatch(\"turbolinks:visit\", {\n data: {\n url: t.absoluteURL\n }\n });\n }, r.prototype.notifyApplicationBeforeCachingSnapshot = function () {\n return e.dispatch(\"turbolinks:before-cache\");\n }, r.prototype.notifyApplicationBeforeRender = function (t) {\n return e.dispatch(\"turbolinks:before-render\", {\n data: {\n newBody: t\n }\n });\n }, r.prototype.notifyApplicationAfterRender = function () {\n return e.dispatch(\"turbolinks:render\");\n }, r.prototype.notifyApplicationAfterPageLoad = function (t) {\n return null == t && (t = {}), e.dispatch(\"turbolinks:load\", {\n data: {\n url: this.location.absoluteURL,\n timing: t\n }\n });\n }, r.prototype.startVisit = function (t, e, r) {\n var n;\n return null != (n = this.currentVisit) && n.cancel(), this.currentVisit = this.createVisit(t, e, r), this.currentVisit.start(), this.notifyApplicationAfterVisitingLocation(t);\n }, r.prototype.createVisit = function (t, r, n) {\n var o, i, s, a, u;\n return i = null != n ? n : {}, a = i.restorationIdentifier, s = i.restorationData, o = i.historyChanged, u = new e.Visit(this, t, r), u.restorationIdentifier = null != a ? a : e.uuid(), u.restorationData = e.copyObject(s), u.historyChanged = o, u.referrer = this.location, u;\n }, r.prototype.visitCompleted = function (t) {\n return this.notifyApplicationAfterPageLoad(t.getTimingMetrics());\n }, r.prototype.clickEventIsSignificant = function (t) {\n return !(t.defaultPrevented || t.target.isContentEditable || t.which > 1 || t.altKey || t.ctrlKey || t.metaKey || t.shiftKey);\n }, r.prototype.getVisitableLinkForNode = function (t) {\n return this.nodeIsVisitable(t) ? e.closest(t, \"a[href]:not([target]):not([download])\") : void 0;\n }, r.prototype.getVisitableLocationForLink = function (t) {\n var r;\n return r = new e.Location(t.getAttribute(\"href\")), this.locationIsVisitable(r) ? r : void 0;\n }, r.prototype.getActionForLink = function (t) {\n var e;\n return null != (e = t.getAttribute(\"data-turbolinks-action\")) ? e : \"advance\";\n }, r.prototype.nodeIsVisitable = function (t) {\n var r;\n return (r = e.closest(t, \"[data-turbolinks]\")) ? \"false\" !== r.getAttribute(\"data-turbolinks\") : !0;\n }, r.prototype.locationIsVisitable = function (t) {\n return t.isPrefixedBy(this.view.getRootLocation()) && t.isHTML();\n }, r.prototype.getCurrentRestorationData = function () {\n return this.getRestorationDataForIdentifier(this.restorationIdentifier);\n }, r.prototype.getRestorationDataForIdentifier = function (t) {\n var e;\n return null != (e = this.restorationData)[t] ? e[t] : e[t] = {};\n }, r;\n }();\n }.call(this), function () {\n !function () {\n var t, e;\n if ((t = e = document.currentScript) && !e.hasAttribute(\"data-turbolinks-suppress-warning\")) for (; t = t.parentNode;) if (t === document.body) return console.warn(\"You are loading Turbolinks from a