{"version":3,"file":"js/application-3f46f26d69b3446ab2d4.js","sources":["webpack:///webpack/bootstrap","webpack:///./app/javascript/controllers sync _controller\\.js$","webpack:///./app/javascript/controllers/datepicker_controller.js","webpack:///./app/javascript/controllers/index.js","webpack:///./app/javascript/controllers/inputmask_controller.js","webpack:///./app/javascript/packs/application.js","webpack:///./app/javascript/web/index.js","webpack:///./app/javascript/web/initializers/bootstrap.js","webpack:///./app/javascript/web/initializers/index.js","webpack:///./node_modules/@babel/runtime/regenerator/index.js","webpack:///./node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable.js","webpack:///./node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable_stream_source_element.js","webpack:///./node_modules/@hotwired/turbo-rails/app/javascript/turbo/index.js","webpack:///./node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js","webpack:///./node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js","webpack:///./node_modules/@stimulus/core/dist/action.js","webpack:///./node_modules/@stimulus/core/dist/action_descriptor.js","webpack:///./node_modules/@stimulus/core/dist/application.js","webpack:///./node_modules/@stimulus/core/dist/binding.js","webpack:///./node_modules/@stimulus/core/dist/binding_observer.js","webpack:///./node_modules/@stimulus/core/dist/blessing.js","webpack:///./node_modules/@stimulus/core/dist/class_map.js","webpack:///./node_modules/@stimulus/core/dist/class_properties.js","webpack:///./node_modules/@stimulus/core/dist/context.js","webpack:///./node_modules/@stimulus/core/dist/controller.js","webpack:///./node_modules/@stimulus/core/dist/data_map.js","webpack:///./node_modules/@stimulus/core/dist/definition.js","webpack:///./node_modules/@stimulus/core/dist/dispatcher.js","webpack:///./node_modules/@stimulus/core/dist/event_listener.js","webpack:///./node_modules/@stimulus/core/dist/guide.js","webpack:///./node_modules/@stimulus/core/dist/index.js","webpack:///./node_modules/@stimulus/core/dist/inheritable_statics.js","webpack:///./node_modules/@stimulus/core/dist/module.js","webpack:///./node_modules/@stimulus/core/dist/router.js","webpack:///./node_modules/@stimulus/core/dist/schema.js","webpack:///./node_modules/@stimulus/core/dist/scope.js","webpack:///./node_modules/@stimulus/core/dist/scope_observer.js","webpack:///./node_modules/@stimulus/core/dist/selectors.js","webpack:///./node_modules/@stimulus/core/dist/string_helpers.js","webpack:///./node_modules/@stimulus/core/dist/target_properties.js","webpack:///./node_modules/@stimulus/core/dist/target_set.js","webpack:///./node_modules/@stimulus/core/dist/value_observer.js","webpack:///./node_modules/@stimulus/core/dist/value_properties.js","webpack:///./node_modules/@stimulus/multimap/dist/index.js","webpack:///./node_modules/@stimulus/multimap/dist/indexed_multimap.js","webpack:///./node_modules/@stimulus/multimap/dist/multimap.js","webpack:///./node_modules/@stimulus/multimap/dist/set_operations.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/attribute_observer.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/element_observer.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/index.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/string_map_observer.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/token_list_observer.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/value_list_observer.js","webpack:///./node_modules/@stimulus/webpack-helpers/dist/index.js","webpack:///./node_modules/bootstrap-datepicker/dist/css/bootstrap-datepicker3.min.css","webpack:///./node_modules/bootstrap-datepicker/dist/js/bootstrap-datepicker.js","webpack:///./node_modules/bootstrap-datepicker/js/locales/bootstrap-datepicker.de.js","webpack:///./node_modules/bootstrap/dist/js/bootstrap.js","webpack:///./node_modules/inputmask/dist/inputmask.js","webpack:///./node_modules/inputmask/index.js","webpack:///./node_modules/jquery/dist/jquery.js","webpack:///./node_modules/popper.js/dist/esm/popper.js","webpack:///./node_modules/regenerator-runtime/runtime.js","webpack:///./node_modules/stimulus/index.js","webpack:///./node_modules/stimulus/webpack-helpers.js","webpack:///(webpack)/buildin/global.js","webpack:///(webpack)/buildin/module.js"],"sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t};\n\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t\"application\": 0\n \t};\n\n\n\n \t// script path function\n \tfunction jsonpScriptSrc(chunkId) {\n \t\treturn __webpack_require__.p + \"js/\" + ({}[chunkId]||chunkId) + \"-\" + {\"0\":\"cdc0b7333b8832904bc5\"}[chunkId] + \".chunk.js\"\n \t}\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 \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tvar promises = [];\n\n\n \t\t// JSONP chunk loading for javascript\n\n \t\tvar installedChunkData = installedChunks[chunkId];\n \t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n \t\t\t// a Promise means \"currently loading\".\n \t\t\tif(installedChunkData) {\n \t\t\t\tpromises.push(installedChunkData[2]);\n \t\t\t} else {\n \t\t\t\t// setup Promise in chunk cache\n \t\t\t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\t\t\tinstalledChunkData = installedChunks[chunkId] = [resolve, reject];\n \t\t\t\t});\n \t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n \t\t\t\t// start chunk loading\n \t\t\t\tvar script = document.createElement('script');\n \t\t\t\tvar onScriptComplete;\n\n \t\t\t\tscript.charset = 'utf-8';\n \t\t\t\tscript.timeout = 120;\n \t\t\t\tif (__webpack_require__.nc) {\n \t\t\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t\t\t}\n \t\t\t\tscript.src = jsonpScriptSrc(chunkId);\n\n \t\t\t\t// create error before stack unwound to get useful stacktrace later\n \t\t\t\tvar error = new Error();\n \t\t\t\tonScriptComplete = function (event) {\n \t\t\t\t\t// avoid mem leaks in IE.\n \t\t\t\t\tscript.onerror = script.onload = null;\n \t\t\t\t\tclearTimeout(timeout);\n \t\t\t\t\tvar chunk = installedChunks[chunkId];\n \t\t\t\t\tif(chunk !== 0) {\n \t\t\t\t\t\tif(chunk) {\n \t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n \t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n \t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n \t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n \t\t\t\t\t\t\terror.type = errorType;\n \t\t\t\t\t\t\terror.request = realSrc;\n \t\t\t\t\t\t\tchunk[1](error);\n \t\t\t\t\t\t}\n \t\t\t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t\t\t}\n \t\t\t\t};\n \t\t\t\tvar timeout = setTimeout(function(){\n \t\t\t\t\tonScriptComplete({ type: 'timeout', target: script });\n \t\t\t\t}, 120000);\n \t\t\t\tscript.onerror = script.onload = onScriptComplete;\n \t\t\t\tdocument.head.appendChild(script);\n \t\t\t}\n \t\t}\n \t\treturn Promise.all(promises);\n \t};\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 = \"https://cdn.drk-nrw-testzentrum.de/packs/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./app/javascript/packs/application.js\");\n","var map = {\n\t\"./datepicker_controller.js\": \"./app/javascript/controllers/datepicker_controller.js\",\n\t\"./inputmask_controller.js\": \"./app/javascript/controllers/inputmask_controller.js\"\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = \"./app/javascript/controllers sync recursive _controller\\\\.js$\";","import { Controller } from \"stimulus\"\n\nimport $ from 'jquery'\nimport 'bootstrap-datepicker'\nimport 'bootstrap-datepicker/js/locales/bootstrap-datepicker.de'\nimport 'bootstrap-datepicker/dist/css/bootstrap-datepicker3.min.css'\n\nexport default class extends Controller {\n static values = {\n params: Object\n }\n\n initialize () {\n this.defaults = {\n keyboardNavigation: false,\n forceParse: false,\n autoclose: true,\n maxViewMode: 3,\n language: 'de',\n todayHighlight: true\n }\n }\n\n connect() {\n let config = Object.assign(this.paramsValue, this.defaults)\n\n $(this.element).datepicker(config)\n }\n}\n","// Load all the controllers within this directory and all subdirectories.\n// Controller files must be named *_controller.js.\n\nimport { Application } from \"stimulus\"\nimport { definitionsFromContext } from \"stimulus/webpack-helpers\"\n\nconst application = Application.start()\nconst context = require.context(\"controllers\", true, /_controller\\.js$/)\napplication.load(definitionsFromContext(context))\n","import { Controller } from \"stimulus\"\n\nimport 'inputmask'\n\nexport default class extends Controller {\n connect() {\n Inputmask().mask(this.element);\n }\n}\n","// This file is automatically compiled by Webpack, along with any other files\n// present in this directory. You're encouraged to place your actual application logic in\n// a relevant structure within app/javascript and only use these pack files to reference\n// that code so it'll be compiled.\n\nimport Rails from \"@rails/ujs\"\nimport $ from 'jquery'\nrequire(\"@hotwired/turbo-rails\")\n\nRails.start()\n\n//import \"controllers\"\n\nimport 'web'\n\nwindow.jQuery = $;\nwindow.$ = $;\n\n\nimport \"controllers\"\n\n$(window).on(\"turbo:load ready turbo:render\", () => {\n $('[data-toggle=\"tooltip\"]').tooltip()\n $('[data-toggle=\"popover\"]').popover()\n\n $(document).on('change', 'input[type=\"checkbox\"].onlyOne', function(){\n $(this).siblings('input[type=\"checkbox\"].onlyOne').prop('checked', false);\n });\n})\n","import './initializers'\n","import 'bootstrap'\n","import './bootstrap'\n","module.exports = require(\"regenerator-runtime\");\n","import _regeneratorRuntime from \"@babel/runtime/regenerator\";\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nvar consumer;\nexport function getConsumer() {\n return _getConsumer.apply(this, arguments);\n}\n\nfunction _getConsumer() {\n _getConsumer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {\n var _yield$import, createConsumer;\n\n return _regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!consumer) {\n _context.next = 2;\n break;\n }\n\n return _context.abrupt(\"return\", consumer);\n\n case 2:\n _context.next = 4;\n return import(\"@rails/actioncable/src\");\n\n case 4:\n _yield$import = _context.sent;\n createConsumer = _yield$import.createConsumer;\n return _context.abrupt(\"return\", setConsumer(createConsumer()));\n\n case 7:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n return _getConsumer.apply(this, arguments);\n}\n\nexport function setConsumer(newConsumer) {\n return consumer = newConsumer;\n}\nexport function subscribeTo(_x, _x2) {\n return _subscribeTo.apply(this, arguments);\n}\n\nfunction _subscribeTo() {\n _subscribeTo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(channel, mixin) {\n var _yield$getConsumer, subscriptions;\n\n return _regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return getConsumer();\n\n case 2:\n _yield$getConsumer = _context2.sent;\n subscriptions = _yield$getConsumer.subscriptions;\n return _context2.abrupt(\"return\", subscriptions.create(channel, mixin));\n\n case 5:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n return _subscribeTo.apply(this, arguments);\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport _regeneratorRuntime from \"@babel/runtime/regenerator\";\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nimport { connectStreamSource, disconnectStreamSource } from \"@hotwired/turbo\";\nimport { subscribeTo } from \"./cable\";\n\nvar TurboCableStreamSourceElement = /*#__PURE__*/function (_HTMLElement) {\n _inherits(TurboCableStreamSourceElement, _HTMLElement);\n\n var _super = _createSuper(TurboCableStreamSourceElement);\n\n function TurboCableStreamSourceElement() {\n _classCallCheck(this, TurboCableStreamSourceElement);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(TurboCableStreamSourceElement, [{\n key: \"connectedCallback\",\n value: function () {\n var _connectedCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {\n return _regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n connectStreamSource(this);\n _context.next = 3;\n return subscribeTo(this.channel, {\n received: this.dispatchMessageEvent.bind(this)\n });\n\n case 3:\n this.subscription = _context.sent;\n\n case 4:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n\n function connectedCallback() {\n return _connectedCallback.apply(this, arguments);\n }\n\n return connectedCallback;\n }()\n }, {\n key: \"disconnectedCallback\",\n value: function disconnectedCallback() {\n disconnectStreamSource(this);\n if (this.subscription) this.subscription.unsubscribe();\n }\n }, {\n key: \"dispatchMessageEvent\",\n value: function dispatchMessageEvent(data) {\n var event = new MessageEvent(\"message\", {\n data: data\n });\n return this.dispatchEvent(event);\n }\n }, {\n key: \"channel\",\n get: function get() {\n var channel = this.getAttribute(\"channel\");\n var signed_stream_name = this.getAttribute(\"signed-stream-name\");\n return {\n channel: channel,\n signed_stream_name: signed_stream_name\n };\n }\n }]);\n\n return TurboCableStreamSourceElement;\n}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));\n\ncustomElements.define(\"turbo-cable-stream-source\", TurboCableStreamSourceElement);","import \"./cable_stream_source_element\";\nimport * as Turbo from \"@hotwired/turbo\";\nexport { Turbo };\nimport * as cable from \"./cable\";\nexport { cable };","var _templateObject, _templateObject2;\n\nfunction _get(target, property, receiver) { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }\n\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport _regeneratorRuntime from \"@babel/runtime/regenerator\";\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/*\nTurbo 7.0.0-beta.4\nCopyright © 2021 Basecamp, LLC\n */\n(function () {\n if (window.Reflect === undefined || window.customElements === undefined || window.customElements.polyfillWrapFlushCallback) {\n return;\n }\n\n var BuiltInHTMLElement = HTMLElement;\n var wrapperForTheName = {\n 'HTMLElement': function HTMLElement() {\n return Reflect.construct(BuiltInHTMLElement, [], this.constructor);\n }\n };\n window.HTMLElement = wrapperForTheName['HTMLElement'];\n HTMLElement.prototype = BuiltInHTMLElement.prototype;\n HTMLElement.prototype.constructor = HTMLElement;\n Object.setPrototypeOf(HTMLElement, BuiltInHTMLElement);\n})();\n\nvar submittersByForm = new WeakMap();\n\nfunction findSubmitterFromClickTarget(target) {\n var element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null;\n var candidate = element ? element.closest(\"input, button\") : null;\n return (candidate === null || candidate === void 0 ? void 0 : candidate.type) == \"submit\" ? candidate : null;\n}\n\nfunction clickCaptured(event) {\n var submitter = findSubmitterFromClickTarget(event.target);\n\n if (submitter && submitter.form) {\n submittersByForm.set(submitter.form, submitter);\n }\n}\n\n(function () {\n if (\"SubmitEvent\" in window) return;\n addEventListener(\"click\", clickCaptured, true);\n Object.defineProperty(Event.prototype, \"submitter\", {\n get: function get() {\n if (this.type == \"submit\" && this.target instanceof HTMLFormElement) {\n return submittersByForm.get(this.target);\n }\n }\n });\n})();\n\nvar FrameLoadingStyle;\n\n(function (FrameLoadingStyle) {\n FrameLoadingStyle[\"eager\"] = \"eager\";\n FrameLoadingStyle[\"lazy\"] = \"lazy\";\n})(FrameLoadingStyle || (FrameLoadingStyle = {}));\n\nvar FrameElement = /*#__PURE__*/function (_HTMLElement) {\n _inherits(FrameElement, _HTMLElement);\n\n var _super = _createSuper(FrameElement);\n\n function FrameElement() {\n var _this;\n\n _classCallCheck(this, FrameElement);\n\n _this = _super.call(this);\n _this.loaded = Promise.resolve();\n _this.delegate = new FrameElement.delegateConstructor(_assertThisInitialized(_this));\n return _this;\n }\n\n _createClass(FrameElement, [{\n key: \"connectedCallback\",\n value: function connectedCallback() {\n this.delegate.connect();\n }\n }, {\n key: \"disconnectedCallback\",\n value: function disconnectedCallback() {\n this.delegate.disconnect();\n }\n }, {\n key: \"attributeChangedCallback\",\n value: function attributeChangedCallback(name) {\n if (name == \"loading\") {\n this.delegate.loadingStyleChanged();\n } else if (name == \"src\") {\n this.delegate.sourceURLChanged();\n }\n }\n }, {\n key: \"src\",\n get: function get() {\n return this.getAttribute(\"src\");\n },\n set: function set(value) {\n if (value) {\n this.setAttribute(\"src\", value);\n } else {\n this.removeAttribute(\"src\");\n }\n }\n }, {\n key: \"loading\",\n get: function get() {\n return frameLoadingStyleFromString(this.getAttribute(\"loading\") || \"\");\n },\n set: function set(value) {\n if (value) {\n this.setAttribute(\"loading\", value);\n } else {\n this.removeAttribute(\"loading\");\n }\n }\n }, {\n key: \"disabled\",\n get: function get() {\n return this.hasAttribute(\"disabled\");\n },\n set: function set(value) {\n if (value) {\n this.setAttribute(\"disabled\", \"\");\n } else {\n this.removeAttribute(\"disabled\");\n }\n }\n }, {\n key: \"autoscroll\",\n get: function get() {\n return this.hasAttribute(\"autoscroll\");\n },\n set: function set(value) {\n if (value) {\n this.setAttribute(\"autoscroll\", \"\");\n } else {\n this.removeAttribute(\"autoscroll\");\n }\n }\n }, {\n key: \"complete\",\n get: function get() {\n return !this.delegate.isLoading;\n }\n }, {\n key: \"isActive\",\n get: function get() {\n return this.ownerDocument === document && !this.isPreview;\n }\n }, {\n key: \"isPreview\",\n get: function get() {\n var _a, _b;\n\n return (_b = (_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.documentElement) === null || _b === void 0 ? void 0 : _b.hasAttribute(\"data-turbo-preview\");\n }\n }], [{\n key: \"observedAttributes\",\n get: function get() {\n return [\"loading\", \"src\"];\n }\n }]);\n\n return FrameElement;\n}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));\n\nfunction frameLoadingStyleFromString(style) {\n switch (style.toLowerCase()) {\n case \"lazy\":\n return FrameLoadingStyle.lazy;\n\n default:\n return FrameLoadingStyle.eager;\n }\n}\n\nfunction expandURL(locatable) {\n var anchor = document.createElement(\"a\");\n anchor.href = locatable.toString();\n return new URL(anchor.href);\n}\n\nfunction getAnchor(url) {\n var anchorMatch;\n\n if (url.hash) {\n return url.hash.slice(1);\n } else if (anchorMatch = url.href.match(/#(.*)$/)) {\n return anchorMatch[1];\n } else {\n return \"\";\n }\n}\n\nfunction getExtension(url) {\n return (getLastPathComponent(url).match(/\\.[^.]*$/) || [])[0] || \"\";\n}\n\nfunction isHTML(url) {\n return !!getExtension(url).match(/^(?:|\\.(?:htm|html|xhtml))$/);\n}\n\nfunction isPrefixedBy(baseURL, url) {\n var prefix = getPrefix(url);\n return baseURL.href === expandURL(prefix).href || baseURL.href.startsWith(prefix);\n}\n\nfunction toCacheKey(url) {\n var anchorLength = url.hash.length;\n\n if (anchorLength < 2) {\n return url.href;\n } else {\n return url.href.slice(0, -anchorLength);\n }\n}\n\nfunction getPathComponents(url) {\n return url.pathname.split(\"/\").slice(1);\n}\n\nfunction getLastPathComponent(url) {\n return getPathComponents(url).slice(-1)[0];\n}\n\nfunction getPrefix(url) {\n return addTrailingSlash(url.origin + url.pathname);\n}\n\nfunction addTrailingSlash(value) {\n return value.endsWith(\"/\") ? value : value + \"/\";\n}\n\nvar FetchResponse = /*#__PURE__*/function () {\n function FetchResponse(response) {\n _classCallCheck(this, FetchResponse);\n\n this.response = response;\n }\n\n _createClass(FetchResponse, [{\n key: \"succeeded\",\n get: function get() {\n return this.response.ok;\n }\n }, {\n key: \"failed\",\n get: function get() {\n return !this.succeeded;\n }\n }, {\n key: \"clientError\",\n get: function get() {\n return this.statusCode >= 400 && this.statusCode <= 499;\n }\n }, {\n key: \"serverError\",\n get: function get() {\n return this.statusCode >= 500 && this.statusCode <= 599;\n }\n }, {\n key: \"redirected\",\n get: function get() {\n return this.response.redirected;\n }\n }, {\n key: \"location\",\n get: function get() {\n return expandURL(this.response.url);\n }\n }, {\n key: \"isHTML\",\n get: function get() {\n return this.contentType && this.contentType.match(/^(?:text\\/([^\\s;,]+\\b)?html|application\\/xhtml\\+xml)\\b/);\n }\n }, {\n key: \"statusCode\",\n get: function get() {\n return this.response.status;\n }\n }, {\n key: \"contentType\",\n get: function get() {\n return this.header(\"Content-Type\");\n }\n }, {\n key: \"responseText\",\n get: function get() {\n return this.response.text();\n }\n }, {\n key: \"responseHTML\",\n get: function get() {\n if (this.isHTML) {\n return this.response.text();\n } else {\n return Promise.resolve(undefined);\n }\n }\n }, {\n key: \"header\",\n value: function header(name) {\n return this.response.headers.get(name);\n }\n }]);\n\n return FetchResponse;\n}();\n\nfunction dispatch(eventName) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n target = _ref.target,\n cancelable = _ref.cancelable,\n detail = _ref.detail;\n\n var event = new CustomEvent(eventName, {\n cancelable: cancelable,\n bubbles: true,\n detail: detail\n });\n void (target || document.documentElement).dispatchEvent(event);\n return event;\n}\n\nfunction nextAnimationFrame() {\n return new Promise(function (resolve) {\n return requestAnimationFrame(function () {\n return resolve();\n });\n });\n}\n\nfunction nextEventLoopTick() {\n return new Promise(function (resolve) {\n return setTimeout(function () {\n return resolve();\n }, 0);\n });\n}\n\nfunction nextMicrotask() {\n return Promise.resolve();\n}\n\nfunction parseHTMLDocument() {\n var html = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \"\";\n return new DOMParser().parseFromString(html, \"text/html\");\n}\n\nfunction unindent(strings) {\n for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n values[_key - 1] = arguments[_key];\n }\n\n var lines = interpolate(strings, values).replace(/^\\n/, \"\").split(\"\\n\");\n var match = lines[0].match(/^\\s+/);\n var indent = match ? match[0].length : 0;\n return lines.map(function (line) {\n return line.slice(indent);\n }).join(\"\\n\");\n}\n\nfunction interpolate(strings, values) {\n return strings.reduce(function (result, string, i) {\n var value = values[i] == undefined ? \"\" : values[i];\n return result + string + value;\n }, \"\");\n}\n\nfunction uuid() {\n return Array.apply(null, {\n length: 36\n }).map(function (_, i) {\n if (i == 8 || i == 13 || i == 18 || i == 23) {\n return \"-\";\n } else if (i == 14) {\n return \"4\";\n } else if (i == 19) {\n return (Math.floor(Math.random() * 4) + 8).toString(16);\n } else {\n return Math.floor(Math.random() * 15).toString(16);\n }\n }).join(\"\");\n}\n\nvar FetchMethod;\n\n(function (FetchMethod) {\n FetchMethod[FetchMethod[\"get\"] = 0] = \"get\";\n FetchMethod[FetchMethod[\"post\"] = 1] = \"post\";\n FetchMethod[FetchMethod[\"put\"] = 2] = \"put\";\n FetchMethod[FetchMethod[\"patch\"] = 3] = \"patch\";\n FetchMethod[FetchMethod[\"delete\"] = 4] = \"delete\";\n})(FetchMethod || (FetchMethod = {}));\n\nfunction fetchMethodFromString(method) {\n switch (method.toLowerCase()) {\n case \"get\":\n return FetchMethod.get;\n\n case \"post\":\n return FetchMethod.post;\n\n case \"put\":\n return FetchMethod.put;\n\n case \"patch\":\n return FetchMethod.patch;\n\n case \"delete\":\n return FetchMethod.delete;\n }\n}\n\nvar FetchRequest = /*#__PURE__*/function () {\n function FetchRequest(delegate, method, location) {\n var body = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new URLSearchParams();\n\n _classCallCheck(this, FetchRequest);\n\n this.abortController = new AbortController();\n this.delegate = delegate;\n this.method = method;\n\n if (this.isIdempotent) {\n this.url = mergeFormDataEntries(location, _toConsumableArray(body.entries()));\n } else {\n this.body = body;\n this.url = location;\n }\n }\n\n _createClass(FetchRequest, [{\n key: \"location\",\n get: function get() {\n return this.url;\n }\n }, {\n key: \"params\",\n get: function get() {\n return this.url.searchParams;\n }\n }, {\n key: \"entries\",\n get: function get() {\n return this.body ? Array.from(this.body.entries()) : [];\n }\n }, {\n key: \"cancel\",\n value: function cancel() {\n this.abortController.abort();\n }\n }, {\n key: \"perform\",\n value: function () {\n var _perform = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {\n var fetchOptions, response;\n return _regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n fetchOptions = this.fetchOptions;\n dispatch(\"turbo:before-fetch-request\", {\n detail: {\n fetchOptions: fetchOptions\n }\n });\n _context.prev = 2;\n this.delegate.requestStarted(this);\n _context.next = 6;\n return fetch(this.url.href, fetchOptions);\n\n case 6:\n response = _context.sent;\n _context.next = 9;\n return this.receive(response);\n\n case 9:\n return _context.abrupt(\"return\", _context.sent);\n\n case 12:\n _context.prev = 12;\n _context.t0 = _context[\"catch\"](2);\n this.delegate.requestErrored(this, _context.t0);\n throw _context.t0;\n\n case 16:\n _context.prev = 16;\n this.delegate.requestFinished(this);\n return _context.finish(16);\n\n case 19:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this, [[2, 12, 16, 19]]);\n }));\n\n function perform() {\n return _perform.apply(this, arguments);\n }\n\n return perform;\n }()\n }, {\n key: \"receive\",\n value: function () {\n var _receive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(response) {\n var fetchResponse, event;\n return _regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n fetchResponse = new FetchResponse(response);\n event = dispatch(\"turbo:before-fetch-response\", {\n cancelable: true,\n detail: {\n fetchResponse: fetchResponse\n }\n });\n\n if (event.defaultPrevented) {\n this.delegate.requestPreventedHandlingResponse(this, fetchResponse);\n } else if (fetchResponse.succeeded) {\n this.delegate.requestSucceededWithResponse(this, fetchResponse);\n } else {\n this.delegate.requestFailedWithResponse(this, fetchResponse);\n }\n\n return _context2.abrupt(\"return\", fetchResponse);\n\n case 4:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n\n function receive(_x) {\n return _receive.apply(this, arguments);\n }\n\n return receive;\n }()\n }, {\n key: \"fetchOptions\",\n get: function get() {\n return {\n method: FetchMethod[this.method].toUpperCase(),\n credentials: \"same-origin\",\n headers: this.headers,\n redirect: \"follow\",\n body: this.body,\n signal: this.abortSignal\n };\n }\n }, {\n key: \"isIdempotent\",\n get: function get() {\n return this.method == FetchMethod.get;\n }\n }, {\n key: \"headers\",\n get: function get() {\n var headers = Object.assign({}, this.defaultHeaders);\n\n if (typeof this.delegate.prepareHeadersForRequest == \"function\") {\n this.delegate.prepareHeadersForRequest(headers, this);\n }\n\n return headers;\n }\n }, {\n key: \"abortSignal\",\n get: function get() {\n return this.abortController.signal;\n }\n }, {\n key: \"defaultHeaders\",\n get: function get() {\n return {\n \"Accept\": \"text/html, application/xhtml+xml\"\n };\n }\n }]);\n\n return FetchRequest;\n}();\n\nfunction mergeFormDataEntries(url, entries) {\n var currentSearchParams = new URLSearchParams(url.search);\n\n var _iterator = _createForOfIteratorHelper(entries),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var _ref4 = _step.value;\n\n var _ref3 = _slicedToArray(_ref4, 2);\n\n var name = _ref3[0];\n var value = _ref3[1];\n if (value instanceof File) continue;\n\n if (currentSearchParams.has(name)) {\n currentSearchParams.delete(name);\n url.searchParams.set(name, value);\n } else {\n url.searchParams.append(name, value);\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n return url;\n}\n\nvar AppearanceObserver = /*#__PURE__*/function () {\n function AppearanceObserver(delegate, element) {\n var _this2 = this;\n\n _classCallCheck(this, AppearanceObserver);\n\n this.started = false;\n\n this.intersect = function (entries) {\n var lastEntry = entries.slice(-1)[0];\n\n if (lastEntry === null || lastEntry === void 0 ? void 0 : lastEntry.isIntersecting) {\n _this2.delegate.elementAppearedInViewport(_this2.element);\n }\n };\n\n this.delegate = delegate;\n this.element = element;\n this.intersectionObserver = new IntersectionObserver(this.intersect);\n }\n\n _createClass(AppearanceObserver, [{\n key: \"start\",\n value: function start() {\n if (!this.started) {\n this.started = true;\n this.intersectionObserver.observe(this.element);\n }\n }\n }, {\n key: \"stop\",\n value: function stop() {\n if (this.started) {\n this.started = false;\n this.intersectionObserver.unobserve(this.element);\n }\n }\n }]);\n\n return AppearanceObserver;\n}();\n\nvar StreamMessage = /*#__PURE__*/function () {\n function StreamMessage(html) {\n _classCallCheck(this, StreamMessage);\n\n this.templateElement = document.createElement(\"template\");\n this.templateElement.innerHTML = html;\n }\n\n _createClass(StreamMessage, [{\n key: \"fragment\",\n get: function get() {\n var fragment = document.createDocumentFragment();\n\n var _iterator2 = _createForOfIteratorHelper(this.foreignElements),\n _step2;\n\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var element = _step2.value;\n fragment.appendChild(document.importNode(element, true));\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n\n return fragment;\n }\n }, {\n key: \"foreignElements\",\n get: function get() {\n return this.templateChildren.reduce(function (streamElements, child) {\n if (child.tagName.toLowerCase() == \"turbo-stream\") {\n return [].concat(_toConsumableArray(streamElements), [child]);\n } else {\n return streamElements;\n }\n }, []);\n }\n }, {\n key: \"templateChildren\",\n get: function get() {\n return Array.from(this.templateElement.content.children);\n }\n }], [{\n key: \"wrap\",\n value: function wrap(message) {\n if (typeof message == \"string\") {\n return new this(message);\n } else {\n return message;\n }\n }\n }]);\n\n return StreamMessage;\n}();\n\nStreamMessage.contentType = \"text/vnd.turbo-stream.html\";\nvar FormSubmissionState;\n\n(function (FormSubmissionState) {\n FormSubmissionState[FormSubmissionState[\"initialized\"] = 0] = \"initialized\";\n FormSubmissionState[FormSubmissionState[\"requesting\"] = 1] = \"requesting\";\n FormSubmissionState[FormSubmissionState[\"waiting\"] = 2] = \"waiting\";\n FormSubmissionState[FormSubmissionState[\"receiving\"] = 3] = \"receiving\";\n FormSubmissionState[FormSubmissionState[\"stopping\"] = 4] = \"stopping\";\n FormSubmissionState[FormSubmissionState[\"stopped\"] = 5] = \"stopped\";\n})(FormSubmissionState || (FormSubmissionState = {}));\n\nvar FormEnctype;\n\n(function (FormEnctype) {\n FormEnctype[\"urlEncoded\"] = \"application/x-www-form-urlencoded\";\n FormEnctype[\"multipart\"] = \"multipart/form-data\";\n FormEnctype[\"plain\"] = \"text/plain\";\n})(FormEnctype || (FormEnctype = {}));\n\nfunction formEnctypeFromString(encoding) {\n switch (encoding.toLowerCase()) {\n case FormEnctype.multipart:\n return FormEnctype.multipart;\n\n case FormEnctype.plain:\n return FormEnctype.plain;\n\n default:\n return FormEnctype.urlEncoded;\n }\n}\n\nvar FormSubmission = /*#__PURE__*/function () {\n function FormSubmission(delegate, formElement, submitter) {\n var mustRedirect = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n\n _classCallCheck(this, FormSubmission);\n\n this.state = FormSubmissionState.initialized;\n this.delegate = delegate;\n this.formElement = formElement;\n this.submitter = submitter;\n this.formData = buildFormData(formElement, submitter);\n this.fetchRequest = new FetchRequest(this, this.method, this.location, this.body);\n this.mustRedirect = mustRedirect;\n }\n\n _createClass(FormSubmission, [{\n key: \"method\",\n get: function get() {\n var _a;\n\n var method = ((_a = this.submitter) === null || _a === void 0 ? void 0 : _a.getAttribute(\"formmethod\")) || this.formElement.getAttribute(\"method\") || \"\";\n return fetchMethodFromString(method.toLowerCase()) || FetchMethod.get;\n }\n }, {\n key: \"action\",\n get: function get() {\n var _a;\n\n return ((_a = this.submitter) === null || _a === void 0 ? void 0 : _a.getAttribute(\"formaction\")) || this.formElement.action;\n }\n }, {\n key: \"location\",\n get: function get() {\n return expandURL(this.action);\n }\n }, {\n key: \"body\",\n get: function get() {\n if (this.enctype == FormEnctype.urlEncoded || this.method == FetchMethod.get) {\n return new URLSearchParams(this.stringFormData);\n } else {\n return this.formData;\n }\n }\n }, {\n key: \"enctype\",\n get: function get() {\n var _a;\n\n return formEnctypeFromString(((_a = this.submitter) === null || _a === void 0 ? void 0 : _a.getAttribute(\"formenctype\")) || this.formElement.enctype);\n }\n }, {\n key: \"stringFormData\",\n get: function get() {\n return _toConsumableArray(this.formData).reduce(function (entries, _ref5) {\n var _ref6 = _slicedToArray(_ref5, 2),\n name = _ref6[0],\n value = _ref6[1];\n\n return entries.concat(typeof value == \"string\" ? [[name, value]] : []);\n }, []);\n }\n }, {\n key: \"start\",\n value: function () {\n var _start = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {\n var _FormSubmissionState, initialized, requesting;\n\n return _regeneratorRuntime.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n _FormSubmissionState = FormSubmissionState, initialized = _FormSubmissionState.initialized, requesting = _FormSubmissionState.requesting;\n\n if (!(this.state == initialized)) {\n _context3.next = 4;\n break;\n }\n\n this.state = requesting;\n return _context3.abrupt(\"return\", this.fetchRequest.perform());\n\n case 4:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n\n function start() {\n return _start.apply(this, arguments);\n }\n\n return start;\n }()\n }, {\n key: \"stop\",\n value: function stop() {\n var _FormSubmissionState2 = FormSubmissionState,\n stopping = _FormSubmissionState2.stopping,\n stopped = _FormSubmissionState2.stopped;\n\n if (this.state != stopping && this.state != stopped) {\n this.state = stopping;\n this.fetchRequest.cancel();\n return true;\n }\n }\n }, {\n key: \"prepareHeadersForRequest\",\n value: function prepareHeadersForRequest(headers, request) {\n if (!request.isIdempotent) {\n var token = getCookieValue(getMetaContent(\"csrf-param\")) || getMetaContent(\"csrf-token\");\n\n if (token) {\n headers[\"X-CSRF-Token\"] = token;\n }\n\n headers[\"Accept\"] = [StreamMessage.contentType, headers[\"Accept\"]].join(\", \");\n }\n }\n }, {\n key: \"requestStarted\",\n value: function requestStarted(request) {\n this.state = FormSubmissionState.waiting;\n dispatch(\"turbo:submit-start\", {\n target: this.formElement,\n detail: {\n formSubmission: this\n }\n });\n this.delegate.formSubmissionStarted(this);\n }\n }, {\n key: \"requestPreventedHandlingResponse\",\n value: function requestPreventedHandlingResponse(request, response) {\n this.result = {\n success: response.succeeded,\n fetchResponse: response\n };\n }\n }, {\n key: \"requestSucceededWithResponse\",\n value: function requestSucceededWithResponse(request, response) {\n if (response.clientError || response.serverError) {\n this.delegate.formSubmissionFailedWithResponse(this, response);\n } else if (this.requestMustRedirect(request) && responseSucceededWithoutRedirect(response)) {\n var error = new Error(\"Form responses must redirect to another location\");\n this.delegate.formSubmissionErrored(this, error);\n } else {\n this.state = FormSubmissionState.receiving;\n this.result = {\n success: true,\n fetchResponse: response\n };\n this.delegate.formSubmissionSucceededWithResponse(this, response);\n }\n }\n }, {\n key: \"requestFailedWithResponse\",\n value: function requestFailedWithResponse(request, response) {\n this.result = {\n success: false,\n fetchResponse: response\n };\n this.delegate.formSubmissionFailedWithResponse(this, response);\n }\n }, {\n key: \"requestErrored\",\n value: function requestErrored(request, error) {\n this.result = {\n success: false,\n error: error\n };\n this.delegate.formSubmissionErrored(this, error);\n }\n }, {\n key: \"requestFinished\",\n value: function requestFinished(request) {\n this.state = FormSubmissionState.stopped;\n dispatch(\"turbo:submit-end\", {\n target: this.formElement,\n detail: Object.assign({\n formSubmission: this\n }, this.result)\n });\n this.delegate.formSubmissionFinished(this);\n }\n }, {\n key: \"requestMustRedirect\",\n value: function requestMustRedirect(request) {\n return !request.isIdempotent && this.mustRedirect;\n }\n }]);\n\n return FormSubmission;\n}();\n\nfunction buildFormData(formElement, submitter) {\n var formData = new FormData(formElement);\n var name = submitter === null || submitter === void 0 ? void 0 : submitter.getAttribute(\"name\");\n var value = submitter === null || submitter === void 0 ? void 0 : submitter.getAttribute(\"value\");\n\n if (name && formData.get(name) != value) {\n formData.append(name, value || \"\");\n }\n\n return formData;\n}\n\nfunction getCookieValue(cookieName) {\n if (cookieName != null) {\n var cookies = document.cookie ? document.cookie.split(\"; \") : [];\n var cookie = cookies.find(function (cookie) {\n return cookie.startsWith(cookieName);\n });\n\n if (cookie) {\n var value = cookie.split(\"=\").slice(1).join(\"=\");\n return value ? decodeURIComponent(value) : undefined;\n }\n }\n}\n\nfunction getMetaContent(name) {\n var element = document.querySelector(\"meta[name=\\\"\".concat(name, \"\\\"]\"));\n return element && element.content;\n}\n\nfunction responseSucceededWithoutRedirect(response) {\n return response.statusCode == 200 && !response.redirected;\n}\n\nvar Snapshot = /*#__PURE__*/function () {\n function Snapshot(element) {\n _classCallCheck(this, Snapshot);\n\n this.element = element;\n }\n\n _createClass(Snapshot, [{\n key: \"children\",\n get: function get() {\n return _toConsumableArray(this.element.children);\n }\n }, {\n key: \"hasAnchor\",\n value: function hasAnchor(anchor) {\n return this.getElementForAnchor(anchor) != null;\n }\n }, {\n key: \"getElementForAnchor\",\n value: function getElementForAnchor(anchor) {\n try {\n return this.element.querySelector(\"[id='\".concat(anchor, \"'], a[name='\").concat(anchor, \"']\"));\n } catch (_a) {\n return null;\n }\n }\n }, {\n key: \"firstAutofocusableElement\",\n get: function get() {\n return this.element.querySelector(\"[autofocus]\");\n }\n }, {\n key: \"permanentElements\",\n get: function get() {\n return _toConsumableArray(this.element.querySelectorAll(\"[id][data-turbo-permanent]\"));\n }\n }, {\n key: \"getPermanentElementById\",\n value: function getPermanentElementById(id) {\n return this.element.querySelector(\"#\".concat(id, \"[data-turbo-permanent]\"));\n }\n }, {\n key: \"getPermanentElementsPresentInSnapshot\",\n value: function getPermanentElementsPresentInSnapshot(snapshot) {\n return this.permanentElements.filter(function (_ref7) {\n var id = _ref7.id;\n return snapshot.getPermanentElementById(id);\n });\n }\n }]);\n\n return Snapshot;\n}();\n\nvar FormInterceptor = /*#__PURE__*/function () {\n function FormInterceptor(delegate, element) {\n var _this3 = this;\n\n _classCallCheck(this, FormInterceptor);\n\n this.submitBubbled = function (event) {\n if (event.target instanceof HTMLFormElement) {\n var form = event.target;\n var submitter = event.submitter || undefined;\n\n if (_this3.delegate.shouldInterceptFormSubmission(form, submitter)) {\n event.preventDefault();\n event.stopImmediatePropagation();\n\n _this3.delegate.formSubmissionIntercepted(form, submitter);\n }\n }\n };\n\n this.delegate = delegate;\n this.element = element;\n }\n\n _createClass(FormInterceptor, [{\n key: \"start\",\n value: function start() {\n this.element.addEventListener(\"submit\", this.submitBubbled);\n }\n }, {\n key: \"stop\",\n value: function stop() {\n this.element.removeEventListener(\"submit\", this.submitBubbled);\n }\n }]);\n\n return FormInterceptor;\n}();\n\nvar View = /*#__PURE__*/function () {\n function View(delegate, element) {\n _classCallCheck(this, View);\n\n this.delegate = delegate;\n this.element = element;\n }\n\n _createClass(View, [{\n key: \"scrollToAnchor\",\n value: function scrollToAnchor(anchor) {\n var element = this.snapshot.getElementForAnchor(anchor);\n\n if (element) {\n this.scrollToElement(element);\n } else {\n this.scrollToPosition({\n x: 0,\n y: 0\n });\n }\n }\n }, {\n key: \"scrollToElement\",\n value: function scrollToElement(element) {\n element.scrollIntoView();\n }\n }, {\n key: \"scrollToPosition\",\n value: function scrollToPosition(_ref8) {\n var x = _ref8.x,\n y = _ref8.y;\n this.scrollRoot.scrollTo(x, y);\n }\n }, {\n key: \"scrollRoot\",\n get: function get() {\n return window;\n }\n }, {\n key: \"render\",\n value: function () {\n var _render = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(renderer) {\n var isPreview, shouldRender, snapshot;\n return _regeneratorRuntime.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n if (!this.renderer) {\n _context4.next = 2;\n break;\n }\n\n throw new Error(\"rendering is already in progress\");\n\n case 2:\n isPreview = renderer.isPreview, shouldRender = renderer.shouldRender, snapshot = renderer.newSnapshot;\n\n if (!shouldRender) {\n _context4.next = 17;\n break;\n }\n\n _context4.prev = 4;\n this.renderer = renderer;\n this.prepareToRenderSnapshot(renderer);\n this.delegate.viewWillRenderSnapshot(snapshot, isPreview);\n _context4.next = 10;\n return this.renderSnapshot(renderer);\n\n case 10:\n this.delegate.viewRenderedSnapshot(snapshot, isPreview);\n this.finishRenderingSnapshot(renderer);\n\n case 12:\n _context4.prev = 12;\n delete this.renderer;\n return _context4.finish(12);\n\n case 15:\n _context4.next = 18;\n break;\n\n case 17:\n this.invalidate();\n\n case 18:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4, this, [[4,, 12, 15]]);\n }));\n\n function render(_x2) {\n return _render.apply(this, arguments);\n }\n\n return render;\n }()\n }, {\n key: \"invalidate\",\n value: function invalidate() {\n this.delegate.viewInvalidated();\n }\n }, {\n key: \"prepareToRenderSnapshot\",\n value: function prepareToRenderSnapshot(renderer) {\n this.markAsPreview(renderer.isPreview);\n renderer.prepareToRender();\n }\n }, {\n key: \"markAsPreview\",\n value: function markAsPreview(isPreview) {\n if (isPreview) {\n this.element.setAttribute(\"data-turbo-preview\", \"\");\n } else {\n this.element.removeAttribute(\"data-turbo-preview\");\n }\n }\n }, {\n key: \"renderSnapshot\",\n value: function () {\n var _renderSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(renderer) {\n return _regeneratorRuntime.wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n _context5.next = 2;\n return renderer.render();\n\n case 2:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5);\n }));\n\n function renderSnapshot(_x3) {\n return _renderSnapshot.apply(this, arguments);\n }\n\n return renderSnapshot;\n }()\n }, {\n key: \"finishRenderingSnapshot\",\n value: function finishRenderingSnapshot(renderer) {\n renderer.finishRendering();\n }\n }]);\n\n return View;\n}();\n\nvar FrameView = /*#__PURE__*/function (_View) {\n _inherits(FrameView, _View);\n\n var _super2 = _createSuper(FrameView);\n\n function FrameView() {\n _classCallCheck(this, FrameView);\n\n return _super2.apply(this, arguments);\n }\n\n _createClass(FrameView, [{\n key: \"invalidate\",\n value: function invalidate() {\n this.element.innerHTML = \"\";\n }\n }, {\n key: \"snapshot\",\n get: function get() {\n return new Snapshot(this.element);\n }\n }]);\n\n return FrameView;\n}(View);\n\nvar LinkInterceptor = /*#__PURE__*/function () {\n function LinkInterceptor(delegate, element) {\n var _this4 = this;\n\n _classCallCheck(this, LinkInterceptor);\n\n this.clickBubbled = function (event) {\n if (_this4.respondsToEventTarget(event.target)) {\n _this4.clickEvent = event;\n } else {\n delete _this4.clickEvent;\n }\n };\n\n this.linkClicked = function (event) {\n if (_this4.clickEvent && _this4.respondsToEventTarget(event.target) && event.target instanceof Element) {\n if (_this4.delegate.shouldInterceptLinkClick(event.target, event.detail.url)) {\n _this4.clickEvent.preventDefault();\n\n event.preventDefault();\n\n _this4.delegate.linkClickIntercepted(event.target, event.detail.url);\n }\n }\n\n delete _this4.clickEvent;\n };\n\n this.willVisit = function () {\n delete _this4.clickEvent;\n };\n\n this.delegate = delegate;\n this.element = element;\n }\n\n _createClass(LinkInterceptor, [{\n key: \"start\",\n value: function start() {\n this.element.addEventListener(\"click\", this.clickBubbled);\n document.addEventListener(\"turbo:click\", this.linkClicked);\n document.addEventListener(\"turbo:before-visit\", this.willVisit);\n }\n }, {\n key: \"stop\",\n value: function stop() {\n this.element.removeEventListener(\"click\", this.clickBubbled);\n document.removeEventListener(\"turbo:click\", this.linkClicked);\n document.removeEventListener(\"turbo:before-visit\", this.willVisit);\n }\n }, {\n key: \"respondsToEventTarget\",\n value: function respondsToEventTarget(target) {\n var element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null;\n return element && element.closest(\"turbo-frame, html\") == this.element;\n }\n }]);\n\n return LinkInterceptor;\n}();\n\nvar Renderer = /*#__PURE__*/function () {\n function Renderer(currentSnapshot, newSnapshot, isPreview) {\n var _this5 = this;\n\n _classCallCheck(this, Renderer);\n\n this.currentSnapshot = currentSnapshot;\n this.newSnapshot = newSnapshot;\n this.isPreview = isPreview;\n this.promise = new Promise(function (resolve, reject) {\n return _this5.resolvingFunctions = {\n resolve: resolve,\n reject: reject\n };\n });\n }\n\n _createClass(Renderer, [{\n key: \"shouldRender\",\n get: function get() {\n return true;\n }\n }, {\n key: \"prepareToRender\",\n value: function prepareToRender() {\n return;\n }\n }, {\n key: \"finishRendering\",\n value: function finishRendering() {\n if (this.resolvingFunctions) {\n this.resolvingFunctions.resolve();\n delete this.resolvingFunctions;\n }\n }\n }, {\n key: \"createScriptElement\",\n value: function createScriptElement(element) {\n if (element.getAttribute(\"data-turbo-eval\") == \"false\") {\n return element;\n } else {\n var createdScriptElement = document.createElement(\"script\");\n createdScriptElement.textContent = element.textContent;\n createdScriptElement.async = false;\n copyElementAttributes(createdScriptElement, element);\n return createdScriptElement;\n }\n }\n }, {\n key: \"preservingPermanentElements\",\n value: function preservingPermanentElements(callback) {\n var placeholders = relocatePermanentElements(this.currentSnapshot, this.newSnapshot);\n callback();\n replacePlaceholderElementsWithClonedPermanentElements(placeholders);\n }\n }, {\n key: \"focusFirstAutofocusableElement\",\n value: function focusFirstAutofocusableElement() {\n var element = this.newSnapshot.firstAutofocusableElement;\n\n if (elementIsFocusable(element)) {\n element.focus();\n }\n }\n }, {\n key: \"currentElement\",\n get: function get() {\n return this.currentSnapshot.element;\n }\n }, {\n key: \"newElement\",\n get: function get() {\n return this.newSnapshot.element;\n }\n }]);\n\n return Renderer;\n}();\n\nfunction replaceElementWithElement(fromElement, toElement) {\n var parentElement = fromElement.parentElement;\n\n if (parentElement) {\n return parentElement.replaceChild(toElement, fromElement);\n }\n}\n\nfunction copyElementAttributes(destinationElement, sourceElement) {\n for (var _i2 = 0, _arr2 = _toConsumableArray(sourceElement.attributes); _i2 < _arr2.length; _i2++) {\n var _ref10 = _arr2[_i2];\n var name = _ref10.name;\n var value = _ref10.value;\n destinationElement.setAttribute(name, value);\n }\n}\n\nfunction createPlaceholderForPermanentElement(permanentElement) {\n var element = document.createElement(\"meta\");\n element.setAttribute(\"name\", \"turbo-permanent-placeholder\");\n element.setAttribute(\"content\", permanentElement.id);\n return {\n element: element,\n permanentElement: permanentElement\n };\n}\n\nfunction replacePlaceholderElementsWithClonedPermanentElements(placeholders) {\n var _iterator3 = _createForOfIteratorHelper(placeholders),\n _step3;\n\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var _ref12 = _step3.value;\n var element = _ref12.element;\n var permanentElement = _ref12.permanentElement;\n var clonedElement = permanentElement.cloneNode(true);\n replaceElementWithElement(element, clonedElement);\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n}\n\nfunction relocatePermanentElements(currentSnapshot, newSnapshot) {\n return currentSnapshot.getPermanentElementsPresentInSnapshot(newSnapshot).reduce(function (placeholders, permanentElement) {\n var newElement = newSnapshot.getPermanentElementById(permanentElement.id);\n\n if (newElement) {\n var placeholder = createPlaceholderForPermanentElement(permanentElement);\n replaceElementWithElement(permanentElement, placeholder.element);\n replaceElementWithElement(newElement, permanentElement);\n return [].concat(_toConsumableArray(placeholders), [placeholder]);\n } else {\n return placeholders;\n }\n }, []);\n}\n\nfunction elementIsFocusable(element) {\n return element && typeof element.focus == \"function\";\n}\n\nvar FrameRenderer = /*#__PURE__*/function (_Renderer) {\n _inherits(FrameRenderer, _Renderer);\n\n var _super3 = _createSuper(FrameRenderer);\n\n function FrameRenderer() {\n _classCallCheck(this, FrameRenderer);\n\n return _super3.apply(this, arguments);\n }\n\n _createClass(FrameRenderer, [{\n key: \"shouldRender\",\n get: function get() {\n return true;\n }\n }, {\n key: \"render\",\n value: function () {\n var _render2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {\n var _this6 = this;\n\n return _regeneratorRuntime.wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n _context6.next = 2;\n return nextAnimationFrame();\n\n case 2:\n this.preservingPermanentElements(function () {\n _this6.loadFrameElement();\n });\n this.scrollFrameIntoView();\n _context6.next = 6;\n return nextAnimationFrame();\n\n case 6:\n this.focusFirstAutofocusableElement();\n\n case 7:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6, this);\n }));\n\n function render() {\n return _render2.apply(this, arguments);\n }\n\n return render;\n }()\n }, {\n key: \"loadFrameElement\",\n value: function loadFrameElement() {\n var _a;\n\n var destinationRange = document.createRange();\n destinationRange.selectNodeContents(this.currentElement);\n destinationRange.deleteContents();\n var frameElement = this.newElement;\n var sourceRange = (_a = frameElement.ownerDocument) === null || _a === void 0 ? void 0 : _a.createRange();\n\n if (sourceRange) {\n sourceRange.selectNodeContents(frameElement);\n this.currentElement.appendChild(sourceRange.extractContents());\n }\n }\n }, {\n key: \"scrollFrameIntoView\",\n value: function scrollFrameIntoView() {\n if (this.currentElement.autoscroll || this.newElement.autoscroll) {\n var element = this.currentElement.firstElementChild;\n var block = readScrollLogicalPosition(this.currentElement.getAttribute(\"data-autoscroll-block\"), \"end\");\n\n if (element) {\n element.scrollIntoView({\n block: block\n });\n return true;\n }\n }\n\n return false;\n }\n }]);\n\n return FrameRenderer;\n}(Renderer);\n\nfunction readScrollLogicalPosition(value, defaultValue) {\n if (value == \"end\" || value == \"start\" || value == \"center\" || value == \"nearest\") {\n return value;\n } else {\n return defaultValue;\n }\n}\n\nvar FrameController = /*#__PURE__*/function () {\n function FrameController(element) {\n _classCallCheck(this, FrameController);\n\n this.resolveVisitPromise = function () {};\n\n this.element = element;\n this.view = new FrameView(this, this.element);\n this.appearanceObserver = new AppearanceObserver(this, this.element);\n this.linkInterceptor = new LinkInterceptor(this, this.element);\n this.formInterceptor = new FormInterceptor(this, this.element);\n }\n\n _createClass(FrameController, [{\n key: \"connect\",\n value: function connect() {\n if (this.loadingStyle == FrameLoadingStyle.lazy) {\n this.appearanceObserver.start();\n }\n\n this.linkInterceptor.start();\n this.formInterceptor.start();\n }\n }, {\n key: \"disconnect\",\n value: function disconnect() {\n this.appearanceObserver.stop();\n this.linkInterceptor.stop();\n this.formInterceptor.stop();\n }\n }, {\n key: \"sourceURLChanged\",\n value: function sourceURLChanged() {\n if (this.loadingStyle == FrameLoadingStyle.eager) {\n this.loadSourceURL();\n }\n }\n }, {\n key: \"loadingStyleChanged\",\n value: function loadingStyleChanged() {\n if (this.loadingStyle == FrameLoadingStyle.lazy) {\n this.appearanceObserver.start();\n } else {\n this.appearanceObserver.stop();\n this.loadSourceURL();\n }\n }\n }, {\n key: \"loadSourceURL\",\n value: function () {\n var _loadSourceURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {\n return _regeneratorRuntime.wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n if (!(this.isActive && this.sourceURL && this.sourceURL != this.loadingURL)) {\n _context7.next = 10;\n break;\n }\n\n _context7.prev = 1;\n this.loadingURL = this.sourceURL;\n this.element.loaded = this.visit(this.sourceURL);\n this.appearanceObserver.stop();\n _context7.next = 7;\n return this.element.loaded;\n\n case 7:\n _context7.prev = 7;\n delete this.loadingURL;\n return _context7.finish(7);\n\n case 10:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7, this, [[1,, 7, 10]]);\n }));\n\n function loadSourceURL() {\n return _loadSourceURL.apply(this, arguments);\n }\n\n return loadSourceURL;\n }()\n }, {\n key: \"loadResponse\",\n value: function () {\n var _loadResponse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(response) {\n var html, _parseHTMLDocument, body, snapshot, renderer;\n\n return _regeneratorRuntime.wrap(function _callee8$(_context8) {\n while (1) {\n switch (_context8.prev = _context8.next) {\n case 0:\n _context8.prev = 0;\n _context8.next = 3;\n return response.responseHTML;\n\n case 3:\n html = _context8.sent;\n\n if (!html) {\n _context8.next = 14;\n break;\n }\n\n _parseHTMLDocument = parseHTMLDocument(html), body = _parseHTMLDocument.body;\n _context8.t0 = Snapshot;\n _context8.next = 9;\n return this.extractForeignFrameElement(body);\n\n case 9:\n _context8.t1 = _context8.sent;\n snapshot = new _context8.t0(_context8.t1);\n renderer = new FrameRenderer(this.view.snapshot, snapshot, false);\n _context8.next = 14;\n return this.view.render(renderer);\n\n case 14:\n _context8.next = 20;\n break;\n\n case 16:\n _context8.prev = 16;\n _context8.t2 = _context8[\"catch\"](0);\n console.error(_context8.t2);\n this.view.invalidate();\n\n case 20:\n case \"end\":\n return _context8.stop();\n }\n }\n }, _callee8, this, [[0, 16]]);\n }));\n\n function loadResponse(_x4) {\n return _loadResponse.apply(this, arguments);\n }\n\n return loadResponse;\n }()\n }, {\n key: \"elementAppearedInViewport\",\n value: function elementAppearedInViewport(element) {\n this.loadSourceURL();\n }\n }, {\n key: \"shouldInterceptLinkClick\",\n value: function shouldInterceptLinkClick(element, url) {\n return this.shouldInterceptNavigation(element);\n }\n }, {\n key: \"linkClickIntercepted\",\n value: function linkClickIntercepted(element, url) {\n this.navigateFrame(element, url);\n }\n }, {\n key: \"shouldInterceptFormSubmission\",\n value: function shouldInterceptFormSubmission(element) {\n return this.shouldInterceptNavigation(element);\n }\n }, {\n key: \"formSubmissionIntercepted\",\n value: function formSubmissionIntercepted(element, submitter) {\n if (this.formSubmission) {\n this.formSubmission.stop();\n }\n\n this.formSubmission = new FormSubmission(this, element, submitter);\n\n if (this.formSubmission.fetchRequest.isIdempotent) {\n this.navigateFrame(element, this.formSubmission.fetchRequest.url.href);\n } else {\n this.formSubmission.start();\n }\n }\n }, {\n key: \"prepareHeadersForRequest\",\n value: function prepareHeadersForRequest(headers, request) {\n headers[\"Turbo-Frame\"] = this.id;\n }\n }, {\n key: \"requestStarted\",\n value: function requestStarted(request) {\n this.element.setAttribute(\"busy\", \"\");\n }\n }, {\n key: \"requestPreventedHandlingResponse\",\n value: function requestPreventedHandlingResponse(request, response) {\n this.resolveVisitPromise();\n }\n }, {\n key: \"requestSucceededWithResponse\",\n value: function () {\n var _requestSucceededWithResponse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(request, response) {\n return _regeneratorRuntime.wrap(function _callee9$(_context9) {\n while (1) {\n switch (_context9.prev = _context9.next) {\n case 0:\n _context9.next = 2;\n return this.loadResponse(response);\n\n case 2:\n this.resolveVisitPromise();\n\n case 3:\n case \"end\":\n return _context9.stop();\n }\n }\n }, _callee9, this);\n }));\n\n function requestSucceededWithResponse(_x5, _x6) {\n return _requestSucceededWithResponse.apply(this, arguments);\n }\n\n return requestSucceededWithResponse;\n }()\n }, {\n key: \"requestFailedWithResponse\",\n value: function requestFailedWithResponse(request, response) {\n console.error(response);\n this.resolveVisitPromise();\n }\n }, {\n key: \"requestErrored\",\n value: function requestErrored(request, error) {\n console.error(error);\n this.resolveVisitPromise();\n }\n }, {\n key: \"requestFinished\",\n value: function requestFinished(request) {\n this.element.removeAttribute(\"busy\");\n }\n }, {\n key: \"formSubmissionStarted\",\n value: function formSubmissionStarted(formSubmission) {}\n }, {\n key: \"formSubmissionSucceededWithResponse\",\n value: function formSubmissionSucceededWithResponse(formSubmission, response) {\n var frame = this.findFrameElement(formSubmission.formElement);\n frame.delegate.loadResponse(response);\n }\n }, {\n key: \"formSubmissionFailedWithResponse\",\n value: function formSubmissionFailedWithResponse(formSubmission, fetchResponse) {\n this.element.delegate.loadResponse(fetchResponse);\n }\n }, {\n key: \"formSubmissionErrored\",\n value: function formSubmissionErrored(formSubmission, error) {}\n }, {\n key: \"formSubmissionFinished\",\n value: function formSubmissionFinished(formSubmission) {}\n }, {\n key: \"viewWillRenderSnapshot\",\n value: function viewWillRenderSnapshot(snapshot, isPreview) {}\n }, {\n key: \"viewRenderedSnapshot\",\n value: function viewRenderedSnapshot(snapshot, isPreview) {}\n }, {\n key: \"viewInvalidated\",\n value: function viewInvalidated() {}\n }, {\n key: \"visit\",\n value: function () {\n var _visit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(url) {\n var _this7 = this;\n\n var request;\n return _regeneratorRuntime.wrap(function _callee10$(_context10) {\n while (1) {\n switch (_context10.prev = _context10.next) {\n case 0:\n request = new FetchRequest(this, FetchMethod.get, expandURL(url));\n return _context10.abrupt(\"return\", new Promise(function (resolve) {\n _this7.resolveVisitPromise = function () {\n _this7.resolveVisitPromise = function () {};\n\n resolve();\n };\n\n request.perform();\n }));\n\n case 2:\n case \"end\":\n return _context10.stop();\n }\n }\n }, _callee10, this);\n }));\n\n function visit(_x7) {\n return _visit.apply(this, arguments);\n }\n\n return visit;\n }()\n }, {\n key: \"navigateFrame\",\n value: function navigateFrame(element, url) {\n var frame = this.findFrameElement(element);\n frame.src = url;\n }\n }, {\n key: \"findFrameElement\",\n value: function findFrameElement(element) {\n var _a;\n\n var id = element.getAttribute(\"data-turbo-frame\") || this.element.getAttribute(\"target\");\n return (_a = getFrameElementById(id)) !== null && _a !== void 0 ? _a : this.element;\n }\n }, {\n key: \"extractForeignFrameElement\",\n value: function () {\n var _extractForeignFrameElement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(container) {\n var element, id;\n return _regeneratorRuntime.wrap(function _callee11$(_context11) {\n while (1) {\n switch (_context11.prev = _context11.next) {\n case 0:\n id = CSS.escape(this.id);\n\n if (!(element = activateElement(container.querySelector(\"turbo-frame#\".concat(id))))) {\n _context11.next = 3;\n break;\n }\n\n return _context11.abrupt(\"return\", element);\n\n case 3:\n if (!(element = activateElement(container.querySelector(\"turbo-frame[src][recurse~=\".concat(id, \"]\"))))) {\n _context11.next = 9;\n break;\n }\n\n _context11.next = 6;\n return element.loaded;\n\n case 6:\n _context11.next = 8;\n return this.extractForeignFrameElement(element);\n\n case 8:\n return _context11.abrupt(\"return\", _context11.sent);\n\n case 9:\n console.error(\"Response has no matching element\"));\n return _context11.abrupt(\"return\", new FrameElement());\n\n case 11:\n case \"end\":\n return _context11.stop();\n }\n }\n }, _callee11, this);\n }));\n\n function extractForeignFrameElement(_x8) {\n return _extractForeignFrameElement.apply(this, arguments);\n }\n\n return extractForeignFrameElement;\n }()\n }, {\n key: \"shouldInterceptNavigation\",\n value: function shouldInterceptNavigation(element) {\n var id = element.getAttribute(\"data-turbo-frame\") || this.element.getAttribute(\"target\");\n\n if (!this.enabled || id == \"_top\") {\n return false;\n }\n\n if (id) {\n var frameElement = getFrameElementById(id);\n\n if (frameElement) {\n return !frameElement.disabled;\n }\n }\n\n return true;\n }\n }, {\n key: \"id\",\n get: function get() {\n return this.element.id;\n }\n }, {\n key: \"enabled\",\n get: function get() {\n return !this.element.disabled;\n }\n }, {\n key: \"sourceURL\",\n get: function get() {\n return this.element.src;\n }\n }, {\n key: \"loadingStyle\",\n get: function get() {\n return this.element.loading;\n }\n }, {\n key: \"isLoading\",\n get: function get() {\n return this.formSubmission !== undefined || this.loadingURL !== undefined;\n }\n }, {\n key: \"isActive\",\n get: function get() {\n return this.element.isActive;\n }\n }]);\n\n return FrameController;\n}();\n\nfunction getFrameElementById(id) {\n if (id != null) {\n var element = document.getElementById(id);\n\n if (element instanceof FrameElement) {\n return element;\n }\n }\n}\n\nfunction activateElement(element) {\n if (element && element.ownerDocument !== document) {\n element = document.importNode(element, true);\n }\n\n if (element instanceof FrameElement) {\n return element;\n }\n}\n\nvar StreamActions = {\n append: function append() {\n var _a;\n\n (_a = this.targetElement) === null || _a === void 0 ? void 0 : _a.append(this.templateContent);\n },\n prepend: function prepend() {\n var _a;\n\n (_a = this.targetElement) === null || _a === void 0 ? void 0 : _a.prepend(this.templateContent);\n },\n remove: function remove() {\n var _a;\n\n (_a = this.targetElement) === null || _a === void 0 ? void 0 : _a.remove();\n },\n replace: function replace() {\n var _a;\n\n (_a = this.targetElement) === null || _a === void 0 ? void 0 : _a.replaceWith(this.templateContent);\n },\n update: function update() {\n if (this.targetElement) {\n this.targetElement.innerHTML = \"\";\n this.targetElement.append(this.templateContent);\n }\n }\n};\n\nvar StreamElement = /*#__PURE__*/function (_HTMLElement2) {\n _inherits(StreamElement, _HTMLElement2);\n\n var _super4 = _createSuper(StreamElement);\n\n function StreamElement() {\n _classCallCheck(this, StreamElement);\n\n return _super4.apply(this, arguments);\n }\n\n _createClass(StreamElement, [{\n key: \"connectedCallback\",\n value: function () {\n var _connectedCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {\n return _regeneratorRuntime.wrap(function _callee12$(_context12) {\n while (1) {\n switch (_context12.prev = _context12.next) {\n case 0:\n _context12.prev = 0;\n _context12.next = 3;\n return this.render();\n\n case 3:\n _context12.next = 8;\n break;\n\n case 5:\n _context12.prev = 5;\n _context12.t0 = _context12[\"catch\"](0);\n console.error(_context12.t0);\n\n case 8:\n _context12.prev = 8;\n this.disconnect();\n return _context12.finish(8);\n\n case 11:\n case \"end\":\n return _context12.stop();\n }\n }\n }, _callee12, this, [[0, 5, 8, 11]]);\n }));\n\n function connectedCallback() {\n return _connectedCallback.apply(this, arguments);\n }\n\n return connectedCallback;\n }()\n }, {\n key: \"render\",\n value: function () {\n var _render3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {\n var _this8 = this;\n\n var _a;\n\n return _regeneratorRuntime.wrap(function _callee14$(_context14) {\n while (1) {\n switch (_context14.prev = _context14.next) {\n case 0:\n return _context14.abrupt(\"return\", (_a = this.renderPromise) !== null && _a !== void 0 ? _a : this.renderPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {\n return _regeneratorRuntime.wrap(function _callee13$(_context13) {\n while (1) {\n switch (_context13.prev = _context13.next) {\n case 0:\n if (!_this8.dispatchEvent(_this8.beforeRenderEvent)) {\n _context13.next = 4;\n break;\n }\n\n _context13.next = 3;\n return nextAnimationFrame();\n\n case 3:\n _this8.performAction();\n\n case 4:\n case \"end\":\n return _context13.stop();\n }\n }\n }, _callee13);\n }))());\n\n case 1:\n case \"end\":\n return _context14.stop();\n }\n }\n }, _callee14, this);\n }));\n\n function render() {\n return _render3.apply(this, arguments);\n }\n\n return render;\n }()\n }, {\n key: \"disconnect\",\n value: function disconnect() {\n try {\n this.remove();\n } catch (_a) {}\n }\n }, {\n key: \"performAction\",\n get: function get() {\n if (this.action) {\n var actionFunction = StreamActions[this.action];\n\n if (actionFunction) {\n return actionFunction;\n }\n\n this.raise(\"unknown action\");\n }\n\n this.raise(\"action attribute is missing\");\n }\n }, {\n key: \"targetElement\",\n get: function get() {\n var _a;\n\n if (this.target) {\n return (_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.getElementById(this.target);\n }\n\n this.raise(\"target attribute is missing\");\n }\n }, {\n key: \"templateContent\",\n get: function get() {\n return this.templateElement.content;\n }\n }, {\n key: \"templateElement\",\n get: function get() {\n if (this.firstElementChild instanceof HTMLTemplateElement) {\n return this.firstElementChild;\n }\n\n this.raise(\"first child element must be a