{ "version": 3, "sources": ["../../node_modules/@rails/actioncable/src/adapters.js", "../../node_modules/@rails/actioncable/src/logger.js", "../../node_modules/@rails/actioncable/src/connection_monitor.js", "../../node_modules/@rails/actioncable/src/internal.js", "../../node_modules/@rails/actioncable/src/connection.js", "../../node_modules/@rails/actioncable/src/subscription.js", "../../node_modules/@rails/actioncable/src/subscription_guarantor.js", "../../node_modules/@rails/actioncable/src/subscriptions.js", "../../node_modules/@rails/actioncable/src/consumer.js", "../../node_modules/@rails/actioncable/src/index.js", "../../node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js", "../../node_modules/ev-emitter/ev-emitter.js", "../../node_modules/get-size/get-size.js", "../../node_modules/desandro-matches-selector/matches-selector.js", "../../node_modules/fizzy-ui-utils/utils.js", "../../node_modules/flickity/js/cell.js", "../../node_modules/flickity/js/slide.js", "../../node_modules/flickity/js/animate.js", "../../node_modules/flickity/js/flickity.js", "../../node_modules/unipointer/unipointer.js", "../../node_modules/unidragger/unidragger.js", "../../node_modules/flickity/js/drag.js", "../../node_modules/flickity/js/prev-next-button.js", "../../node_modules/flickity/js/page-dots.js", "../../node_modules/flickity/js/player.js", "../../node_modules/flickity/js/add-remove-cell.js", "../../node_modules/flickity/js/lazyload.js", "../../node_modules/flickity/js/index.js", "../../app/javascript/controllers/link_to_add_fields_controller.js", "../../node_modules/dropzone/dist/dropzone.js", "../../node_modules/apexcharts/dist/apexcharts.common.js", "../../node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js", "../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable.js", "../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/snakeize.js", "../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable_stream_source_element.js", "../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/fetch_requests.js", "../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/index.js", "../../app/javascript/application.js", "../../node_modules/@rails/activestorage/app/assets/javascripts/activestorage.esm.js", "../../node_modules/@vue/shared/dist/shared.esm-bundler.js", "../../node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js", "../../node_modules/alpinejs/dist/module.esm.js", "../../app/javascript/alpine/caption_forms.js", "../../node_modules/@hotwired/stimulus/dist/stimulus.js", "../../app/javascript/controllers/application.js", "../../app/javascript/controllers/accounts/registrations_controller.js", "../../app/javascript/controllers/buttons_controller.js", "../../app/javascript/controllers/categories_controller.js", "../../app/javascript/controllers/competitors_controller.js", "../../app/javascript/controllers/captions_controller.js", "../../app/javascript/controllers/dashboard_controller.js", "../../node_modules/canvas-confetti/dist/confetti.module.mjs", "../../app/javascript/controllers/hashtags_controller.js", "../../app/javascript/controllers/strategy_profiles_controller.js", "../../app/javascript/controllers/index.js", "../../app/javascript/controllers/redirect_controller.js", "../../app/javascript/controllers/sjabloon/accordion_controller.js", "../../app/javascript/controllers/sjabloon/utilities.js", "../../app/javascript/controllers/sjabloon/announcements_controller.js", "../../app/javascript/controllers/sjabloon/coupon_controller.js", "../../app/javascript/controllers/sjabloon/dropdown_controller.js", "../../app/javascript/controllers/sjabloon/dropzone_controller.js", "../../app/javascript/controllers/sjabloon/helpers.js", "../../app/javascript/controllers/sjabloon/fill_form_controller.js", "../../app/javascript/controllers/sjabloon/flash_controller.js", "../../app/javascript/controllers/sjabloon/form_controller.js", "../../app/javascript/controllers/sjabloon/form_validation_controller.js", "../../app/javascript/controllers/sjabloon/modal_controller.js", "../../app/javascript/controllers/sjabloon/navigation_controller.js", "../../app/javascript/controllers/sjabloon/plan_switch_controller.js", "../../app/javascript/controllers/sjabloon/pricing_controller.js", "../../app/javascript/controllers/sjabloon/site_announcements_controller.js", "../../app/javascript/controllers/sjabloon/stripe_controller.js", "../../app/javascript/controllers/sjabloon/tabs_controller.js", "../../app/javascript/controllers/sjabloon/toggle_controller.js", "../../app/javascript/refreshers/content_ideas_index_refresher.js", "../../app/javascript/refreshers/content_idea_more_like_this_refresher.js", "../../app/javascript/refreshers/show_caption_refresher.js"], "sourcesContent": ["export default {\n logger: self.console,\n WebSocket: self.WebSocket\n}\n", "import adapters from \"./adapters\"\n\n// The logger is disabled by default. You can enable it with:\n//\n// ActionCable.logger.enabled = true\n//\n// Example:\n//\n// import * as ActionCable from '@rails/actioncable'\n//\n// ActionCable.logger.enabled = true\n// ActionCable.logger.log('Connection Established.')\n//\n\nexport default {\n log(...messages) {\n if (this.enabled) {\n messages.push(Date.now())\n adapters.logger.log(\"[ActionCable]\", ...messages)\n }\n },\n}\n", "import logger from \"./logger\"\n\n// Responsible for ensuring the cable connection is in good health by validating the heartbeat pings sent from the server, and attempting\n// revival reconnections if things go astray. Internal class, not intended for direct user manipulation.\n\nconst now = () => new Date().getTime()\n\nconst secondsSince = time => (now() - time) / 1000\n\nclass ConnectionMonitor {\n constructor(connection) {\n this.visibilityDidChange = this.visibilityDidChange.bind(this)\n this.connection = connection\n this.reconnectAttempts = 0\n }\n\n start() {\n if (!this.isRunning()) {\n this.startedAt = now()\n delete this.stoppedAt\n this.startPolling()\n addEventListener(\"visibilitychange\", this.visibilityDidChange)\n logger.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`)\n }\n }\n\n stop() {\n if (this.isRunning()) {\n this.stoppedAt = now()\n this.stopPolling()\n removeEventListener(\"visibilitychange\", this.visibilityDidChange)\n logger.log(\"ConnectionMonitor stopped\")\n }\n }\n\n isRunning() {\n return this.startedAt && !this.stoppedAt\n }\n\n recordPing() {\n this.pingedAt = now()\n }\n\n recordConnect() {\n this.reconnectAttempts = 0\n this.recordPing()\n delete this.disconnectedAt\n logger.log(\"ConnectionMonitor recorded connect\")\n }\n\n recordDisconnect() {\n this.disconnectedAt = now()\n logger.log(\"ConnectionMonitor recorded disconnect\")\n }\n\n // Private\n\n startPolling() {\n this.stopPolling()\n this.poll()\n }\n\n stopPolling() {\n clearTimeout(this.pollTimeout)\n }\n\n poll() {\n this.pollTimeout = setTimeout(() => {\n this.reconnectIfStale()\n this.poll()\n }\n , this.getPollInterval())\n }\n\n getPollInterval() {\n const { staleThreshold, reconnectionBackoffRate } = this.constructor\n const backoff = Math.pow(1 + reconnectionBackoffRate, Math.min(this.reconnectAttempts, 10))\n const jitterMax = this.reconnectAttempts === 0 ? 1.0 : reconnectionBackoffRate\n const jitter = jitterMax * Math.random()\n return staleThreshold * 1000 * backoff * (1 + jitter)\n }\n\n reconnectIfStale() {\n if (this.connectionIsStale()) {\n logger.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`)\n this.reconnectAttempts++\n if (this.disconnectedRecently()) {\n logger.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince(this.disconnectedAt)} s`)\n } else {\n logger.log(\"ConnectionMonitor reopening\")\n this.connection.reopen()\n }\n }\n }\n\n get refreshedAt() {\n return this.pingedAt ? this.pingedAt : this.startedAt\n }\n\n connectionIsStale() {\n return secondsSince(this.refreshedAt) > this.constructor.staleThreshold\n }\n\n disconnectedRecently() {\n return this.disconnectedAt && (secondsSince(this.disconnectedAt) < this.constructor.staleThreshold)\n }\n\n visibilityDidChange() {\n if (document.visibilityState === \"visible\") {\n setTimeout(() => {\n if (this.connectionIsStale() || !this.connection.isOpen()) {\n logger.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`)\n this.connection.reopen()\n }\n }\n , 200)\n }\n }\n\n}\n\nConnectionMonitor.staleThreshold = 6 // Server::Connections::BEAT_INTERVAL * 2 (missed two pings)\nConnectionMonitor.reconnectionBackoffRate = 0.15\n\nexport default ConnectionMonitor\n", "export default {\n \"message_types\": {\n \"welcome\": \"welcome\",\n \"disconnect\": \"disconnect\",\n \"ping\": \"ping\",\n \"confirmation\": \"confirm_subscription\",\n \"rejection\": \"reject_subscription\"\n },\n \"disconnect_reasons\": {\n \"unauthorized\": \"unauthorized\",\n \"invalid_request\": \"invalid_request\",\n \"server_restart\": \"server_restart\"\n },\n \"default_mount_path\": \"/cable\",\n \"protocols\": [\n \"actioncable-v1-json\",\n \"actioncable-unsupported\"\n ]\n}\n", "import adapters from \"./adapters\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport INTERNAL from \"./internal\"\nimport logger from \"./logger\"\n\n// Encapsulate the cable connection held by the consumer. This is an internal class not intended for direct user manipulation.\n\nconst {message_types, protocols} = INTERNAL\nconst supportedProtocols = protocols.slice(0, protocols.length - 1)\n\nconst indexOf = [].indexOf\n\nclass Connection {\n constructor(consumer) {\n this.open = this.open.bind(this)\n this.consumer = consumer\n this.subscriptions = this.consumer.subscriptions\n this.monitor = new ConnectionMonitor(this)\n this.disconnected = true\n }\n\n send(data) {\n if (this.isOpen()) {\n this.webSocket.send(JSON.stringify(data))\n return true\n } else {\n return false\n }\n }\n\n open() {\n if (this.isActive()) {\n logger.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`)\n return false\n } else {\n logger.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${protocols}`)\n if (this.webSocket) { this.uninstallEventHandlers() }\n this.webSocket = new adapters.WebSocket(this.consumer.url, protocols)\n this.installEventHandlers()\n this.monitor.start()\n return true\n }\n }\n\n close({allowReconnect} = {allowReconnect: true}) {\n if (!allowReconnect) { this.monitor.stop() }\n // Avoid closing websockets in a \"connecting\" state due to Safari 15.1+ bug. See: https://github.com/rails/rails/issues/43835#issuecomment-1002288478\n if (this.isOpen()) {\n return this.webSocket.close()\n }\n }\n\n reopen() {\n logger.log(`Reopening WebSocket, current state is ${this.getState()}`)\n if (this.isActive()) {\n try {\n return this.close()\n } catch (error) {\n logger.log(\"Failed to reopen WebSocket\", error)\n }\n finally {\n logger.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`)\n setTimeout(this.open, this.constructor.reopenDelay)\n }\n } else {\n return this.open()\n }\n }\n\n getProtocol() {\n if (this.webSocket) {\n return this.webSocket.protocol\n }\n }\n\n isOpen() {\n return this.isState(\"open\")\n }\n\n isActive() {\n return this.isState(\"open\", \"connecting\")\n }\n\n // Private\n\n isProtocolSupported() {\n return indexOf.call(supportedProtocols, this.getProtocol()) >= 0\n }\n\n isState(...states) {\n return indexOf.call(states, this.getState()) >= 0\n }\n\n getState() {\n if (this.webSocket) {\n for (let state in adapters.WebSocket) {\n if (adapters.WebSocket[state] === this.webSocket.readyState) {\n return state.toLowerCase()\n }\n }\n }\n return null\n }\n\n installEventHandlers() {\n for (let eventName in this.events) {\n const handler = this.events[eventName].bind(this)\n this.webSocket[`on${eventName}`] = handler\n }\n }\n\n uninstallEventHandlers() {\n for (let eventName in this.events) {\n this.webSocket[`on${eventName}`] = function() {}\n }\n }\n\n}\n\nConnection.reopenDelay = 500\n\nConnection.prototype.events = {\n message(event) {\n if (!this.isProtocolSupported()) { return }\n const {identifier, message, reason, reconnect, type} = JSON.parse(event.data)\n switch (type) {\n case message_types.welcome:\n this.monitor.recordConnect()\n return this.subscriptions.reload()\n case message_types.disconnect:\n logger.log(`Disconnecting. Reason: ${reason}`)\n return this.close({allowReconnect: reconnect})\n case message_types.ping:\n return this.monitor.recordPing()\n case message_types.confirmation:\n this.subscriptions.confirmSubscription(identifier)\n return this.subscriptions.notify(identifier, \"connected\")\n case message_types.rejection:\n return this.subscriptions.reject(identifier)\n default:\n return this.subscriptions.notify(identifier, \"received\", message)\n }\n },\n\n open() {\n logger.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`)\n this.disconnected = false\n if (!this.isProtocolSupported()) {\n logger.log(\"Protocol is unsupported. Stopping monitor and disconnecting.\")\n return this.close({allowReconnect: false})\n }\n },\n\n close(event) {\n logger.log(\"WebSocket onclose event\")\n if (this.disconnected) { return }\n this.disconnected = true\n this.monitor.recordDisconnect()\n return this.subscriptions.notifyAll(\"disconnected\", {willAttemptReconnect: this.monitor.isRunning()})\n },\n\n error() {\n logger.log(\"WebSocket onerror event\")\n }\n}\n\nexport default Connection\n", "// A new subscription is created through the ActionCable.Subscriptions instance available on the consumer.\n// It provides a number of callbacks and a method for calling remote procedure calls on the corresponding\n// Channel instance on the server side.\n//\n// An example demonstrates the basic functionality:\n//\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\", {\n// connected() {\n// // Called once the subscription has been successfully completed\n// },\n//\n// disconnected({ willAttemptReconnect: boolean }) {\n// // Called when the client has disconnected with the server.\n// // The object will have an `willAttemptReconnect` property which\n// // says whether the client has the intention of attempting\n// // to reconnect.\n// },\n//\n// appear() {\n// this.perform('appear', {appearing_on: this.appearingOn()})\n// },\n//\n// away() {\n// this.perform('away')\n// },\n//\n// appearingOn() {\n// $('main').data('appearing-on')\n// }\n// })\n//\n// The methods #appear and #away forward their intent to the remote AppearanceChannel instance on the server\n// by calling the `perform` method with the first parameter being the action (which maps to AppearanceChannel#appear/away).\n// The second parameter is a hash that'll get JSON encoded and made available on the server in the data parameter.\n//\n// This is how the server component would look:\n//\n// class AppearanceChannel < ApplicationActionCable::Channel\n// def subscribed\n// current_user.appear\n// end\n//\n// def unsubscribed\n// current_user.disappear\n// end\n//\n// def appear(data)\n// current_user.appear on: data['appearing_on']\n// end\n//\n// def away\n// current_user.away\n// end\n// end\n//\n// The \"AppearanceChannel\" name is automatically mapped between the client-side subscription creation and the server-side Ruby class name.\n// The AppearanceChannel#appear/away public methods are exposed automatically to client-side invocation through the perform method.\n\nconst extend = function(object, properties) {\n if (properties != null) {\n for (let key in properties) {\n const value = properties[key]\n object[key] = value\n }\n }\n return object\n}\n\nexport default class Subscription {\n constructor(consumer, params = {}, mixin) {\n this.consumer = consumer\n this.identifier = JSON.stringify(params)\n extend(this, mixin)\n }\n\n // Perform a channel action with the optional data passed as an attribute\n perform(action, data = {}) {\n data.action = action\n return this.send(data)\n }\n\n send(data) {\n return this.consumer.send({command: \"message\", identifier: this.identifier, data: JSON.stringify(data)})\n }\n\n unsubscribe() {\n return this.consumer.subscriptions.remove(this)\n }\n}\n", "import logger from \"./logger\"\n\n// Responsible for ensuring channel subscribe command is confirmed, retrying until confirmation is received.\n// Internal class, not intended for direct user manipulation.\n\nclass SubscriptionGuarantor {\n constructor(subscriptions) {\n this.subscriptions = subscriptions\n this.pendingSubscriptions = []\n }\n\n guarantee(subscription) {\n if(this.pendingSubscriptions.indexOf(subscription) == -1){ \n logger.log(`SubscriptionGuarantor guaranteeing ${subscription.identifier}`)\n this.pendingSubscriptions.push(subscription) \n }\n else {\n logger.log(`SubscriptionGuarantor already guaranteeing ${subscription.identifier}`)\n }\n this.startGuaranteeing()\n }\n\n forget(subscription) {\n logger.log(`SubscriptionGuarantor forgetting ${subscription.identifier}`)\n this.pendingSubscriptions = (this.pendingSubscriptions.filter((s) => s !== subscription))\n }\n\n startGuaranteeing() {\n this.stopGuaranteeing()\n this.retrySubscribing()\n }\n \n stopGuaranteeing() {\n clearTimeout(this.retryTimeout)\n }\n\n retrySubscribing() {\n this.retryTimeout = setTimeout(() => {\n if (this.subscriptions && typeof(this.subscriptions.subscribe) === \"function\") {\n this.pendingSubscriptions.map((subscription) => {\n logger.log(`SubscriptionGuarantor resubscribing ${subscription.identifier}`)\n this.subscriptions.subscribe(subscription)\n })\n }\n }\n , 500)\n }\n}\n\nexport default SubscriptionGuarantor", "import Subscription from \"./subscription\"\nimport SubscriptionGuarantor from \"./subscription_guarantor\"\nimport logger from \"./logger\"\n\n// Collection class for creating (and internally managing) channel subscriptions.\n// The only method intended to be triggered by the user is ActionCable.Subscriptions#create,\n// and it should be called through the consumer like so:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n\nexport default class Subscriptions {\n constructor(consumer) {\n this.consumer = consumer\n this.guarantor = new SubscriptionGuarantor(this)\n this.subscriptions = []\n }\n\n create(channelName, mixin) {\n const channel = channelName\n const params = typeof channel === \"object\" ? channel : {channel}\n const subscription = new Subscription(this.consumer, params, mixin)\n return this.add(subscription)\n }\n\n // Private\n\n add(subscription) {\n this.subscriptions.push(subscription)\n this.consumer.ensureActiveConnection()\n this.notify(subscription, \"initialized\")\n this.subscribe(subscription)\n return subscription\n }\n\n remove(subscription) {\n this.forget(subscription)\n if (!this.findAll(subscription.identifier).length) {\n this.sendCommand(subscription, \"unsubscribe\")\n }\n return subscription\n }\n\n reject(identifier) {\n return this.findAll(identifier).map((subscription) => {\n this.forget(subscription)\n this.notify(subscription, \"rejected\")\n return subscription\n })\n }\n\n forget(subscription) {\n this.guarantor.forget(subscription)\n this.subscriptions = (this.subscriptions.filter((s) => s !== subscription))\n return subscription\n }\n\n findAll(identifier) {\n return this.subscriptions.filter((s) => s.identifier === identifier)\n }\n\n reload() {\n return this.subscriptions.map((subscription) =>\n this.subscribe(subscription))\n }\n\n notifyAll(callbackName, ...args) {\n return this.subscriptions.map((subscription) =>\n this.notify(subscription, callbackName, ...args))\n }\n\n notify(subscription, callbackName, ...args) {\n let subscriptions\n if (typeof subscription === \"string\") {\n subscriptions = this.findAll(subscription)\n } else {\n subscriptions = [subscription]\n }\n\n return subscriptions.map((subscription) =>\n (typeof subscription[callbackName] === \"function\" ? subscription[callbackName](...args) : undefined))\n }\n\n subscribe(subscription) {\n if (this.sendCommand(subscription, \"subscribe\")) {\n this.guarantor.guarantee(subscription)\n }\n }\n\n confirmSubscription(identifier) {\n logger.log(`Subscription confirmed ${identifier}`)\n this.findAll(identifier).map((subscription) =>\n this.guarantor.forget(subscription))\n }\n\n sendCommand(subscription, command) {\n const {identifier} = subscription\n return this.consumer.send({command, identifier})\n }\n}\n", "import Connection from \"./connection\"\nimport Subscriptions from \"./subscriptions\"\n\n// The ActionCable.Consumer establishes the connection to a server-side Ruby Connection object. Once established,\n// the ActionCable.ConnectionMonitor will ensure that its properly maintained through heartbeats and checking for stale updates.\n// The Consumer instance is also the gateway to establishing subscriptions to desired channels through the #createSubscription\n// method.\n//\n// The following example shows how this can be set up:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n//\n// When a consumer is created, it automatically connects with the server.\n//\n// To disconnect from the server, call\n//\n// App.cable.disconnect()\n//\n// and to restart the connection:\n//\n// App.cable.connect()\n//\n// Any channel subscriptions which existed prior to disconnecting will\n// automatically resubscribe.\n\nexport default class Consumer {\n constructor(url) {\n this._url = url\n this.subscriptions = new Subscriptions(this)\n this.connection = new Connection(this)\n }\n\n get url() {\n return createWebSocketURL(this._url)\n }\n\n send(data) {\n return this.connection.send(data)\n }\n\n connect() {\n return this.connection.open()\n }\n\n disconnect() {\n return this.connection.close({allowReconnect: false})\n }\n\n ensureActiveConnection() {\n if (!this.connection.isActive()) {\n return this.connection.open()\n }\n }\n}\n\nexport function createWebSocketURL(url) {\n if (typeof url === \"function\") {\n url = url()\n }\n\n if (url && !/^wss?:/i.test(url)) {\n const a = document.createElement(\"a\")\n a.href = url\n // Fix populating Location properties in IE. Otherwise, protocol will be blank.\n a.href = a.href\n a.protocol = a.protocol.replace(\"http\", \"ws\")\n return a.href\n } else {\n return url\n }\n}\n", "import Connection from \"./connection\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport Consumer, { createWebSocketURL } from \"./consumer\"\nimport INTERNAL from \"./internal\"\nimport Subscription from \"./subscription\"\nimport Subscriptions from \"./subscriptions\"\nimport SubscriptionGuarantor from \"./subscription_guarantor\"\nimport adapters from \"./adapters\"\nimport logger from \"./logger\"\n\nexport {\n Connection,\n ConnectionMonitor,\n Consumer,\n INTERNAL,\n Subscription,\n Subscriptions,\n SubscriptionGuarantor,\n adapters,\n createWebSocketURL,\n logger,\n}\n\nexport function createConsumer(url = getConfig(\"url\") || INTERNAL.default_mount_path) {\n return new Consumer(url)\n}\n\nexport function getConfig(name) {\n const element = document.head.querySelector(`meta[name='action-cable-${name}']`)\n if (element) {\n return element.getAttribute(\"content\")\n }\n}\n", "/*\nUnobtrusive JavaScript\nhttps://github.com/rails/rails/blob/master/actionview/app/assets/javascripts\nReleased under the MIT license\n */\n\n(function() {\n var context = this;\n\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\n }).call(this);\n }).call(context);\n\n var Rails = context.Rails;\n\n (function() {\n (function() {\n var cspNonce;\n\n cspNonce = Rails.cspNonce = function() {\n var meta;\n meta = document.querySelector('meta[name=csp-nonce]');\n return meta && meta.content;\n };\n\n }).call(this);\n (function() {\n var expando, m;\n\n m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;\n\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\n expando = '_ujsData';\n\n Rails.getData = function(element, key) {\n var ref;\n return (ref = element[expando]) != null ? ref[key] : void 0;\n };\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\n Rails.$ = function(selector) {\n return Array.prototype.slice.call(document.querySelectorAll(selector));\n };\n\n }).call(this);\n (function() {\n var $, csrfParam, csrfToken;\n\n $ = Rails.$;\n\n csrfToken = Rails.csrfToken = function() {\n var meta;\n meta = document.querySelector('meta[name=csrf-token]');\n return meta && meta.content;\n };\n\n csrfParam = Rails.csrfParam = function() {\n var meta;\n meta = document.querySelector('meta[name=csrf-param]');\n return meta && meta.content;\n };\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\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\n }).call(this);\n (function() {\n var CustomEvent, fire, matches, preventDefault;\n\n matches = Rails.matches;\n\n CustomEvent = window.CustomEvent;\n\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\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\n Rails.stopEverything = function(e) {\n fire(e.target, 'ujs:everythingStopped');\n e.preventDefault();\n e.stopPropagation();\n return e.stopImmediatePropagation();\n };\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\n }).call(this);\n (function() {\n var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;\n\n cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;\n\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\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\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\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 }\n CSRFProtection(xhr);\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\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(/\\bxml\\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\n Rails.href = function(element) {\n return element.href;\n };\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\n }).call(this);\n (function() {\n var matches, toArray;\n\n matches = Rails.matches;\n\n toArray = function(e) {\n return Array.prototype.slice.call(e);\n };\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\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\n }).call(this);\n (function() {\n var allowAction, fire, stopEverything;\n\n fire = Rails.fire, stopEverything = Rails.stopEverything;\n\n Rails.handleConfirm = function(e) {\n if (!allowAction(this)) {\n return stopEverything(e);\n }\n };\n\n Rails.confirm = function(message, element) {\n return confirm(message);\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 = Rails.confirm(message, element);\n } catch (error) {}\n callback = fire(element, 'confirm:complete', [answer]);\n }\n return answer && callback;\n };\n\n }).call(this);\n (function() {\n var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, isXhrRedirect, matches, setData, stopEverything;\n\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements;\n\n Rails.handleDisabledElement = function(e) {\n var element;\n element = this;\n if (element.disabled) {\n return stopEverything(e);\n }\n };\n\n Rails.enableElement = function(e) {\n var element;\n if (e instanceof Event) {\n if (isXhrRedirect(e)) {\n return;\n }\n element = e.target;\n } else {\n element = e;\n }\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\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\n disableLinkElement = function(element) {\n var replacement;\n if (getData(element, 'ujs:disabled')) {\n return;\n }\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\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\n disableFormElements = function(form) {\n return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);\n };\n\n disableFormElement = function(element) {\n var replacement;\n if (getData(element, 'ujs:disabled')) {\n return;\n }\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\n enableFormElements = function(form) {\n return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);\n };\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\n isXhrRedirect = function(event) {\n var ref, xhr;\n xhr = (ref = event.detail) != null ? ref[0] : void 0;\n return (xhr != null ? xhr.getResponseHeader(\"X-Xhr-Redirect\") : void 0) != null;\n };\n\n }).call(this);\n (function() {\n var stopEverything;\n\n stopEverything = Rails.stopEverything;\n\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\n }).call(this);\n (function() {\n var ajax, fire, getData, isCrossDomain, isRemote, matches, serializeElement, setData, stopEverything,\n slice = [].slice;\n\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\n isRemote = function(element) {\n var value;\n value = element.getAttribute('data-remote');\n return (value != null) && value !== 'false';\n };\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\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\n Rails.preventInsignificantClick = function(e) {\n var data, insignificantMetaClick, link, metaClick, method, primaryMouseKey;\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 primaryMouseKey = e.button === 0;\n if (!primaryMouseKey || insignificantMetaClick) {\n return e.stopImmediatePropagation();\n }\n };\n\n }).call(this);\n (function() {\n var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, preventInsignificantClick, refreshCSRFTokens;\n\n fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, 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\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\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 return window._rails_loaded = true;\n };\n\n if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {\n Rails.start();\n }\n\n }).call(this);\n }).call(this);\n\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);\n", "/**\n * EvEmitter v1.1.0\n * Lil' event emitter\n * MIT License\n */\n\n/* jshint unused: true, undef: true, strict: true */\n\n( function( global, factory ) {\n // universal module definition\n /* jshint strict: false */ /* globals define, module, window */\n if ( typeof define == 'function' && define.amd ) {\n // AMD - RequireJS\n define( factory );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS - Browserify, Webpack\n module.exports = factory();\n } else {\n // Browser globals\n global.EvEmitter = factory();\n }\n\n}( typeof window != 'undefined' ? window : this, function() {\n\n\"use strict\";\n\nfunction EvEmitter() {}\n\nvar proto = EvEmitter.prototype;\n\nproto.on = function( eventName, listener ) {\n if ( !eventName || !listener ) {\n return;\n }\n // set events hash\n var events = this._events = this._events || {};\n // set listeners array\n var listeners = events[ eventName ] = events[ eventName ] || [];\n // only add once\n if ( listeners.indexOf( listener ) == -1 ) {\n listeners.push( listener );\n }\n\n return this;\n};\n\nproto.once = function( eventName, listener ) {\n if ( !eventName || !listener ) {\n return;\n }\n // add event\n this.on( eventName, listener );\n // set once flag\n // set onceEvents hash\n var onceEvents = this._onceEvents = this._onceEvents || {};\n // set onceListeners object\n var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {};\n // set flag\n onceListeners[ listener ] = true;\n\n return this;\n};\n\nproto.off = function( eventName, listener ) {\n var listeners = this._events && this._events[ eventName ];\n if ( !listeners || !listeners.length ) {\n return;\n }\n var index = listeners.indexOf( listener );\n if ( index != -1 ) {\n listeners.splice( index, 1 );\n }\n\n return this;\n};\n\nproto.emitEvent = function( eventName, args ) {\n var listeners = this._events && this._events[ eventName ];\n if ( !listeners || !listeners.length ) {\n return;\n }\n // copy over to avoid interference if .off() in listener\n listeners = listeners.slice(0);\n args = args || [];\n // once stuff\n var onceListeners = this._onceEvents && this._onceEvents[ eventName ];\n\n for ( var i=0; i < listeners.length; i++ ) {\n var listener = listeners[i]\n var isOnce = onceListeners && onceListeners[ listener ];\n if ( isOnce ) {\n // remove listener\n // remove before trigger to prevent recursion\n this.off( eventName, listener );\n // unset once flag\n delete onceListeners[ listener ];\n }\n // trigger listener\n listener.apply( this, args );\n }\n\n return this;\n};\n\nproto.allOff = function() {\n delete this._events;\n delete this._onceEvents;\n};\n\nreturn EvEmitter;\n\n}));\n", "/*!\n * getSize v2.0.3\n * measure size of elements\n * MIT license\n */\n\n/* jshint browser: true, strict: true, undef: true, unused: true */\n/* globals console: false */\n\n( function( window, factory ) {\n /* jshint strict: false */ /* globals define, module */\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( factory );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory();\n } else {\n // browser global\n window.getSize = factory();\n }\n\n})( window, function factory() {\n'use strict';\n\n// -------------------------- helpers -------------------------- //\n\n// get a number from a string, not a percentage\nfunction getStyleSize( value ) {\n var num = parseFloat( value );\n // not a percent like '100%', and a number\n var isValid = value.indexOf('%') == -1 && !isNaN( num );\n return isValid && num;\n}\n\nfunction noop() {}\n\nvar logError = typeof console == 'undefined' ? noop :\n function( message ) {\n console.error( message );\n };\n\n// -------------------------- measurements -------------------------- //\n\nvar measurements = [\n 'paddingLeft',\n 'paddingRight',\n 'paddingTop',\n 'paddingBottom',\n 'marginLeft',\n 'marginRight',\n 'marginTop',\n 'marginBottom',\n 'borderLeftWidth',\n 'borderRightWidth',\n 'borderTopWidth',\n 'borderBottomWidth'\n];\n\nvar measurementsLength = measurements.length;\n\nfunction getZeroSize() {\n var size = {\n width: 0,\n height: 0,\n innerWidth: 0,\n innerHeight: 0,\n outerWidth: 0,\n outerHeight: 0\n };\n for ( var i=0; i < measurementsLength; i++ ) {\n var measurement = measurements[i];\n size[ measurement ] = 0;\n }\n return size;\n}\n\n// -------------------------- getStyle -------------------------- //\n\n/**\n * getStyle, get style of element, check for Firefox bug\n * https://bugzilla.mozilla.org/show_bug.cgi?id=548397\n */\nfunction getStyle( elem ) {\n var style = getComputedStyle( elem );\n if ( !style ) {\n logError( 'Style returned ' + style +\n '. Are you running this code in a hidden iframe on Firefox? ' +\n 'See https://bit.ly/getsizebug1' );\n }\n return style;\n}\n\n// -------------------------- setup -------------------------- //\n\nvar isSetup = false;\n\nvar isBoxSizeOuter;\n\n/**\n * setup\n * check isBoxSizerOuter\n * do on first getSize() rather than on page load for Firefox bug\n */\nfunction setup() {\n // setup once\n if ( isSetup ) {\n return;\n }\n isSetup = true;\n\n // -------------------------- box sizing -------------------------- //\n\n /**\n * Chrome & Safari measure the outer-width on style.width on border-box elems\n * IE11 & Firefox<29 measures the inner-width\n */\n var div = document.createElement('div');\n div.style.width = '200px';\n div.style.padding = '1px 2px 3px 4px';\n div.style.borderStyle = 'solid';\n div.style.borderWidth = '1px 2px 3px 4px';\n div.style.boxSizing = 'border-box';\n\n var body = document.body || document.documentElement;\n body.appendChild( div );\n var style = getStyle( div );\n // round value for browser zoom. desandro/masonry#928\n isBoxSizeOuter = Math.round( getStyleSize( style.width ) ) == 200;\n getSize.isBoxSizeOuter = isBoxSizeOuter;\n\n body.removeChild( div );\n}\n\n// -------------------------- getSize -------------------------- //\n\nfunction getSize( elem ) {\n setup();\n\n // use querySeletor if elem is string\n if ( typeof elem == 'string' ) {\n elem = document.querySelector( elem );\n }\n\n // do not proceed on non-objects\n if ( !elem || typeof elem != 'object' || !elem.nodeType ) {\n return;\n }\n\n var style = getStyle( elem );\n\n // if hidden, everything is 0\n if ( style.display == 'none' ) {\n return getZeroSize();\n }\n\n var size = {};\n size.width = elem.offsetWidth;\n size.height = elem.offsetHeight;\n\n var isBorderBox = size.isBorderBox = style.boxSizing == 'border-box';\n\n // get all measurements\n for ( var i=0; i < measurementsLength; i++ ) {\n var measurement = measurements[i];\n var value = style[ measurement ];\n var num = parseFloat( value );\n // any 'auto', 'medium' value will be 0\n size[ measurement ] = !isNaN( num ) ? num : 0;\n }\n\n var paddingWidth = size.paddingLeft + size.paddingRight;\n var paddingHeight = size.paddingTop + size.paddingBottom;\n var marginWidth = size.marginLeft + size.marginRight;\n var marginHeight = size.marginTop + size.marginBottom;\n var borderWidth = size.borderLeftWidth + size.borderRightWidth;\n var borderHeight = size.borderTopWidth + size.borderBottomWidth;\n\n var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter;\n\n // overwrite width and height if we can get it from style\n var styleWidth = getStyleSize( style.width );\n if ( styleWidth !== false ) {\n size.width = styleWidth +\n // add padding and border unless it's already including it\n ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth );\n }\n\n var styleHeight = getStyleSize( style.height );\n if ( styleHeight !== false ) {\n size.height = styleHeight +\n // add padding and border unless it's already including it\n ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight );\n }\n\n size.innerWidth = size.width - ( paddingWidth + borderWidth );\n size.innerHeight = size.height - ( paddingHeight + borderHeight );\n\n size.outerWidth = size.width + marginWidth;\n size.outerHeight = size.height + marginHeight;\n\n return size;\n}\n\nreturn getSize;\n\n});\n", "/**\n * matchesSelector v2.0.2\n * matchesSelector( element, '.selector' )\n * MIT license\n */\n\n/*jshint browser: true, strict: true, undef: true, unused: true */\n\n( function( window, factory ) {\n /*global define: false, module: false */\n 'use strict';\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( factory );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory();\n } else {\n // browser global\n window.matchesSelector = factory();\n }\n\n}( window, function factory() {\n 'use strict';\n\n var matchesMethod = ( function() {\n var ElemProto = window.Element.prototype;\n // check for the standard method name first\n if ( ElemProto.matches ) {\n return 'matches';\n }\n // check un-prefixed\n if ( ElemProto.matchesSelector ) {\n return 'matchesSelector';\n }\n // check vendor prefixes\n var prefixes = [ 'webkit', 'moz', 'ms', 'o' ];\n\n for ( var i=0; i < prefixes.length; i++ ) {\n var prefix = prefixes[i];\n var method = prefix + 'MatchesSelector';\n if ( ElemProto[ method ] ) {\n return method;\n }\n }\n })();\n\n return function matchesSelector( elem, selector ) {\n return elem[ matchesMethod ]( selector );\n };\n\n}));\n", "/**\n * Fizzy UI utils v2.0.7\n * MIT license\n */\n\n/*jshint browser: true, undef: true, unused: true, strict: true */\n\n( function( window, factory ) {\n // universal module definition\n /*jshint strict: false */ /*globals define, module, require */\n\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'desandro-matches-selector/matches-selector'\n ], function( matchesSelector ) {\n return factory( window, matchesSelector );\n });\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('desandro-matches-selector')\n );\n } else {\n // browser global\n window.fizzyUIUtils = factory(\n window,\n window.matchesSelector\n );\n }\n\n}( window, function factory( window, matchesSelector ) {\n\n'use strict';\n\nvar utils = {};\n\n// ----- extend ----- //\n\n// extends objects\nutils.extend = function( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n};\n\n// ----- modulo ----- //\n\nutils.modulo = function( num, div ) {\n return ( ( num % div ) + div ) % div;\n};\n\n// ----- makeArray ----- //\n\nvar arraySlice = Array.prototype.slice;\n\n// turn element or nodeList into an array\nutils.makeArray = function( obj ) {\n if ( Array.isArray( obj ) ) {\n // use object if already an array\n return obj;\n }\n // return empty array if undefined or null. #6\n if ( obj === null || obj === undefined ) {\n return [];\n }\n\n var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';\n if ( isArrayLike ) {\n // convert nodeList to array\n return arraySlice.call( obj );\n }\n\n // array of single index\n return [ obj ];\n};\n\n// ----- removeFrom ----- //\n\nutils.removeFrom = function( ary, obj ) {\n var index = ary.indexOf( obj );\n if ( index != -1 ) {\n ary.splice( index, 1 );\n }\n};\n\n// ----- getParent ----- //\n\nutils.getParent = function( elem, selector ) {\n while ( elem.parentNode && elem != document.body ) {\n elem = elem.parentNode;\n if ( matchesSelector( elem, selector ) ) {\n return elem;\n }\n }\n};\n\n// ----- getQueryElement ----- //\n\n// use element as selector string\nutils.getQueryElement = function( elem ) {\n if ( typeof elem == 'string' ) {\n return document.querySelector( elem );\n }\n return elem;\n};\n\n// ----- handleEvent ----- //\n\n// enable .ontype to trigger from .addEventListener( elem, 'type' )\nutils.handleEvent = function( event ) {\n var method = 'on' + event.type;\n if ( this[ method ] ) {\n this[ method ]( event );\n }\n};\n\n// ----- filterFindElements ----- //\n\nutils.filterFindElements = function( elems, selector ) {\n // make array of elems\n elems = utils.makeArray( elems );\n var ffElems = [];\n\n elems.forEach( function( elem ) {\n // check that elem is an actual element\n if ( !( elem instanceof HTMLElement ) ) {\n return;\n }\n // add elem if no selector\n if ( !selector ) {\n ffElems.push( elem );\n return;\n }\n // filter & find items if we have a selector\n // filter\n if ( matchesSelector( elem, selector ) ) {\n ffElems.push( elem );\n }\n // find children\n var childElems = elem.querySelectorAll( selector );\n // concat childElems to filterFound array\n for ( var i=0; i < childElems.length; i++ ) {\n ffElems.push( childElems[i] );\n }\n });\n\n return ffElems;\n};\n\n// ----- debounceMethod ----- //\n\nutils.debounceMethod = function( _class, methodName, threshold ) {\n threshold = threshold || 100;\n // original method\n var method = _class.prototype[ methodName ];\n var timeoutName = methodName + 'Timeout';\n\n _class.prototype[ methodName ] = function() {\n var timeout = this[ timeoutName ];\n clearTimeout( timeout );\n\n var args = arguments;\n var _this = this;\n this[ timeoutName ] = setTimeout( function() {\n method.apply( _this, args );\n delete _this[ timeoutName ];\n }, threshold );\n };\n};\n\n// ----- docReady ----- //\n\nutils.docReady = function( callback ) {\n var readyState = document.readyState;\n if ( readyState == 'complete' || readyState == 'interactive' ) {\n // do async to allow for other scripts to run. metafizzy/flickity#441\n setTimeout( callback );\n } else {\n document.addEventListener( 'DOMContentLoaded', callback );\n }\n};\n\n// ----- htmlInit ----- //\n\n// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/\nutils.toDashed = function( str ) {\n return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) {\n return $1 + '-' + $2;\n }).toLowerCase();\n};\n\nvar console = window.console;\n/**\n * allow user to initialize classes via [data-namespace] or .js-namespace class\n * htmlInit( Widget, 'widgetName' )\n * options are parsed from data-namespace-options\n */\nutils.htmlInit = function( WidgetClass, namespace ) {\n utils.docReady( function() {\n var dashedNamespace = utils.toDashed( namespace );\n var dataAttr = 'data-' + dashedNamespace;\n var dataAttrElems = document.querySelectorAll( '[' + dataAttr + ']' );\n var jsDashElems = document.querySelectorAll( '.js-' + dashedNamespace );\n var elems = utils.makeArray( dataAttrElems )\n .concat( utils.makeArray( jsDashElems ) );\n var dataOptionsAttr = dataAttr + '-options';\n var jQuery = window.jQuery;\n\n elems.forEach( function( elem ) {\n var attr = elem.getAttribute( dataAttr ) ||\n elem.getAttribute( dataOptionsAttr );\n var options;\n try {\n options = attr && JSON.parse( attr );\n } catch ( error ) {\n // log error, do not initialize\n if ( console ) {\n console.error( 'Error parsing ' + dataAttr + ' on ' + elem.className +\n ': ' + error );\n }\n return;\n }\n // initialize\n var instance = new WidgetClass( elem, options );\n // make available via $().data('namespace')\n if ( jQuery ) {\n jQuery.data( elem, namespace, instance );\n }\n });\n\n });\n};\n\n// ----- ----- //\n\nreturn utils;\n\n}));\n", "// Flickity.Cell\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'get-size/get-size',\n ], function( getSize ) {\n return factory( window, getSize );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('get-size')\n );\n } else {\n // browser global\n window.Flickity = window.Flickity || {};\n window.Flickity.Cell = factory(\n window,\n window.getSize\n );\n }\n\n}( window, function factory( window, getSize ) {\n\n'use strict';\n\nfunction Cell( elem, parent ) {\n this.element = elem;\n this.parent = parent;\n\n this.create();\n}\n\nvar proto = Cell.prototype;\n\nproto.create = function() {\n this.element.style.position = 'absolute';\n this.element.setAttribute( 'aria-hidden', 'true' );\n this.x = 0;\n this.shift = 0;\n this.element.style[ this.parent.originSide ] = 0;\n};\n\nproto.destroy = function() {\n // reset style\n this.unselect();\n this.element.style.position = '';\n var side = this.parent.originSide;\n this.element.style[ side ] = '';\n this.element.style.transform = '';\n this.element.removeAttribute('aria-hidden');\n};\n\nproto.getSize = function() {\n this.size = getSize( this.element );\n};\n\nproto.setPosition = function( x ) {\n this.x = x;\n this.updateTarget();\n this.renderPosition( x );\n};\n\n// setDefaultTarget v1 method, backwards compatibility, remove in v3\nproto.updateTarget = proto.setDefaultTarget = function() {\n var marginProperty = this.parent.originSide == 'left' ? 'marginLeft' : 'marginRight';\n this.target = this.x + this.size[ marginProperty ] +\n this.size.width * this.parent.cellAlign;\n};\n\nproto.renderPosition = function( x ) {\n // render position of cell with in slider\n var sideOffset = this.parent.originSide === 'left' ? 1 : -1;\n\n var adjustedX = this.parent.options.percentPosition ?\n x * sideOffset * ( this.parent.size.innerWidth / this.size.width ) :\n x * sideOffset;\n\n this.element.style.transform = 'translateX(' +\n this.parent.getPositionValue( adjustedX ) + ')';\n};\n\nproto.select = function() {\n this.element.classList.add('is-selected');\n this.element.removeAttribute('aria-hidden');\n};\n\nproto.unselect = function() {\n this.element.classList.remove('is-selected');\n this.element.setAttribute( 'aria-hidden', 'true' );\n};\n\n/**\n * @param {Integer} shift - 0, 1, or -1\n */\nproto.wrapShift = function( shift ) {\n this.shift = shift;\n this.renderPosition( this.x + this.parent.slideableWidth * shift );\n};\n\nproto.remove = function() {\n this.element.parentNode.removeChild( this.element );\n};\n\nreturn Cell;\n\n} ) );\n", "// slide\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( factory );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory();\n } else {\n // browser global\n window.Flickity = window.Flickity || {};\n window.Flickity.Slide = factory();\n }\n\n}( window, function factory() {\n'use strict';\n\nfunction Slide( parent ) {\n this.parent = parent;\n this.isOriginLeft = parent.originSide == 'left';\n this.cells = [];\n this.outerWidth = 0;\n this.height = 0;\n}\n\nvar proto = Slide.prototype;\n\nproto.addCell = function( cell ) {\n this.cells.push( cell );\n this.outerWidth += cell.size.outerWidth;\n this.height = Math.max( cell.size.outerHeight, this.height );\n // first cell stuff\n if ( this.cells.length == 1 ) {\n this.x = cell.x; // x comes from first cell\n var beginMargin = this.isOriginLeft ? 'marginLeft' : 'marginRight';\n this.firstMargin = cell.size[ beginMargin ];\n }\n};\n\nproto.updateTarget = function() {\n var endMargin = this.isOriginLeft ? 'marginRight' : 'marginLeft';\n var lastCell = this.getLastCell();\n var lastMargin = lastCell ? lastCell.size[ endMargin ] : 0;\n var slideWidth = this.outerWidth - ( this.firstMargin + lastMargin );\n this.target = this.x + this.firstMargin + slideWidth * this.parent.cellAlign;\n};\n\nproto.getLastCell = function() {\n return this.cells[ this.cells.length - 1 ];\n};\n\nproto.select = function() {\n this.cells.forEach( function( cell ) {\n cell.select();\n } );\n};\n\nproto.unselect = function() {\n this.cells.forEach( function( cell ) {\n cell.unselect();\n } );\n};\n\nproto.getCellElements = function() {\n return this.cells.map( function( cell ) {\n return cell.element;\n } );\n};\n\nreturn Slide;\n\n} ) );\n", "// animate\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'fizzy-ui-utils/utils',\n ], function( utils ) {\n return factory( window, utils );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('fizzy-ui-utils')\n );\n } else {\n // browser global\n window.Flickity = window.Flickity || {};\n window.Flickity.animatePrototype = factory(\n window,\n window.fizzyUIUtils\n );\n }\n\n}( window, function factory( window, utils ) {\n\n'use strict';\n\n// -------------------------- animate -------------------------- //\n\nvar proto = {};\n\nproto.startAnimation = function() {\n if ( this.isAnimating ) {\n return;\n }\n\n this.isAnimating = true;\n this.restingFrames = 0;\n this.animate();\n};\n\nproto.animate = function() {\n this.applyDragForce();\n this.applySelectedAttraction();\n\n var previousX = this.x;\n\n this.integratePhysics();\n this.positionSlider();\n this.settle( previousX );\n // animate next frame\n if ( this.isAnimating ) {\n var _this = this;\n requestAnimationFrame( function animateFrame() {\n _this.animate();\n } );\n }\n};\n\nproto.positionSlider = function() {\n var x = this.x;\n // wrap position around\n if ( this.options.wrapAround && this.cells.length > 1 ) {\n x = utils.modulo( x, this.slideableWidth );\n x -= this.slideableWidth;\n this.shiftWrapCells( x );\n }\n\n this.setTranslateX( x, this.isAnimating );\n this.dispatchScrollEvent();\n};\n\nproto.setTranslateX = function( x, is3d ) {\n x += this.cursorPosition;\n // reverse if right-to-left and using transform\n x = this.options.rightToLeft ? -x : x;\n var translateX = this.getPositionValue( x );\n // use 3D transforms for hardware acceleration on iOS\n // but use 2D when settled, for better font-rendering\n this.slider.style.transform = is3d ?\n 'translate3d(' + translateX + ',0,0)' : 'translateX(' + translateX + ')';\n};\n\nproto.dispatchScrollEvent = function() {\n var firstSlide = this.slides[0];\n if ( !firstSlide ) {\n return;\n }\n var positionX = -this.x - firstSlide.target;\n var progress = positionX / this.slidesWidth;\n this.dispatchEvent( 'scroll', null, [ progress, positionX ] );\n};\n\nproto.positionSliderAtSelected = function() {\n if ( !this.cells.length ) {\n return;\n }\n this.x = -this.selectedSlide.target;\n this.velocity = 0; // stop wobble\n this.positionSlider();\n};\n\nproto.getPositionValue = function( position ) {\n if ( this.options.percentPosition ) {\n // percent position, round to 2 digits, like 12.34%\n return ( Math.round( ( position / this.size.innerWidth ) * 10000 ) * 0.01 ) + '%';\n } else {\n // pixel positioning\n return Math.round( position ) + 'px';\n }\n};\n\nproto.settle = function( previousX ) {\n // keep track of frames where x hasn't moved\n var isResting = !this.isPointerDown &&\n Math.round( this.x * 100 ) == Math.round( previousX * 100 );\n if ( isResting ) {\n this.restingFrames++;\n }\n // stop animating if resting for 3 or more frames\n if ( this.restingFrames > 2 ) {\n this.isAnimating = false;\n delete this.isFreeScrolling;\n // render position with translateX when settled\n this.positionSlider();\n this.dispatchEvent( 'settle', null, [ this.selectedIndex ] );\n }\n};\n\nproto.shiftWrapCells = function( x ) {\n // shift before cells\n var beforeGap = this.cursorPosition + x;\n this._shiftCells( this.beforeShiftCells, beforeGap, -1 );\n // shift after cells\n var afterGap = this.size.innerWidth - ( x + this.slideableWidth + this.cursorPosition );\n this._shiftCells( this.afterShiftCells, afterGap, 1 );\n};\n\nproto._shiftCells = function( cells, gap, shift ) {\n for ( var i = 0; i < cells.length; i++ ) {\n var cell = cells[i];\n var cellShift = gap > 0 ? shift : 0;\n cell.wrapShift( cellShift );\n gap -= cell.size.outerWidth;\n }\n};\n\nproto._unshiftCells = function( cells ) {\n if ( !cells || !cells.length ) {\n return;\n }\n for ( var i = 0; i < cells.length; i++ ) {\n cells[i].wrapShift( 0 );\n }\n};\n\n// -------------------------- physics -------------------------- //\n\nproto.integratePhysics = function() {\n this.x += this.velocity;\n this.velocity *= this.getFrictionFactor();\n};\n\nproto.applyForce = function( force ) {\n this.velocity += force;\n};\n\nproto.getFrictionFactor = function() {\n return 1 - this.options[ this.isFreeScrolling ? 'freeScrollFriction' : 'friction' ];\n};\n\nproto.getRestingPosition = function() {\n // my thanks to Steven Wittens, who simplified this math greatly\n return this.x + this.velocity / ( 1 - this.getFrictionFactor() );\n};\n\nproto.applyDragForce = function() {\n if ( !this.isDraggable || !this.isPointerDown ) {\n return;\n }\n // change the position to drag position by applying force\n var dragVelocity = this.dragX - this.x;\n var dragForce = dragVelocity - this.velocity;\n this.applyForce( dragForce );\n};\n\nproto.applySelectedAttraction = function() {\n // do not attract if pointer down or no slides\n var dragDown = this.isDraggable && this.isPointerDown;\n if ( dragDown || this.isFreeScrolling || !this.slides.length ) {\n return;\n }\n var distance = this.selectedSlide.target * -1 - this.x;\n var force = distance * this.options.selectedAttraction;\n this.applyForce( force );\n};\n\nreturn proto;\n\n} ) );\n", "// Flickity main\n/* eslint-disable max-params */\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'ev-emitter/ev-emitter',\n 'get-size/get-size',\n 'fizzy-ui-utils/utils',\n './cell',\n './slide',\n './animate',\n ], function( EvEmitter, getSize, utils, Cell, Slide, animatePrototype ) {\n return factory( window, EvEmitter, getSize, utils, Cell, Slide, animatePrototype );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('ev-emitter'),\n require('get-size'),\n require('fizzy-ui-utils'),\n require('./cell'),\n require('./slide'),\n require('./animate')\n );\n } else {\n // browser global\n var _Flickity = window.Flickity;\n\n window.Flickity = factory(\n window,\n window.EvEmitter,\n window.getSize,\n window.fizzyUIUtils,\n _Flickity.Cell,\n _Flickity.Slide,\n _Flickity.animatePrototype\n );\n }\n\n}( window, function factory( window, EvEmitter, getSize,\n utils, Cell, Slide, animatePrototype ) {\n\n/* eslint-enable max-params */\n'use strict';\n\n// vars\nvar jQuery = window.jQuery;\nvar getComputedStyle = window.getComputedStyle;\nvar console = window.console;\n\nfunction moveElements( elems, toElem ) {\n elems = utils.makeArray( elems );\n while ( elems.length ) {\n toElem.appendChild( elems.shift() );\n }\n}\n\n// -------------------------- Flickity -------------------------- //\n\n// globally unique identifiers\nvar GUID = 0;\n// internal store of all Flickity intances\nvar instances = {};\n\nfunction Flickity( element, options ) {\n var queryElement = utils.getQueryElement( element );\n if ( !queryElement ) {\n if ( console ) {\n console.error( 'Bad element for Flickity: ' + ( queryElement || element ) );\n }\n return;\n }\n this.element = queryElement;\n // do not initialize twice on same element\n if ( this.element.flickityGUID ) {\n var instance = instances[ this.element.flickityGUID ];\n if ( instance ) instance.option( options );\n return instance;\n }\n\n // add jQuery\n if ( jQuery ) {\n this.$element = jQuery( this.element );\n }\n // options\n this.options = utils.extend( {}, this.constructor.defaults );\n this.option( options );\n\n // kick things off\n this._create();\n}\n\nFlickity.defaults = {\n accessibility: true,\n // adaptiveHeight: false,\n cellAlign: 'center',\n // cellSelector: undefined,\n // contain: false,\n freeScrollFriction: 0.075, // friction when free-scrolling\n friction: 0.28, // friction when selecting\n namespaceJQueryEvents: true,\n // initialIndex: 0,\n percentPosition: true,\n resize: true,\n selectedAttraction: 0.025,\n setGallerySize: true,\n // watchCSS: false,\n // wrapAround: false\n};\n\n// hash of methods triggered on _create()\nFlickity.createMethods = [];\n\nvar proto = Flickity.prototype;\n// inherit EventEmitter\nutils.extend( proto, EvEmitter.prototype );\n\nproto._create = function() {\n // add id for Flickity.data\n var id = this.guid = ++GUID;\n this.element.flickityGUID = id; // expando\n instances[ id ] = this; // associate via id\n // initial properties\n this.selectedIndex = 0;\n // how many frames slider has been in same position\n this.restingFrames = 0;\n // initial physics properties\n this.x = 0;\n this.velocity = 0;\n this.originSide = this.options.rightToLeft ? 'right' : 'left';\n // create viewport & slider\n this.viewport = document.createElement('div');\n this.viewport.className = 'flickity-viewport';\n this._createSlider();\n\n if ( this.options.resize || this.options.watchCSS ) {\n window.addEventListener( 'resize', this );\n }\n\n // add listeners from on option\n for ( var eventName in this.options.on ) {\n var listener = this.options.on[ eventName ];\n this.on( eventName, listener );\n }\n\n Flickity.createMethods.forEach( function( method ) {\n this[ method ]();\n }, this );\n\n if ( this.options.watchCSS ) {\n this.watchCSS();\n } else {\n this.activate();\n }\n\n};\n\n/**\n * set options\n * @param {Object} opts - options to extend\n */\nproto.option = function( opts ) {\n utils.extend( this.options, opts );\n};\n\nproto.activate = function() {\n if ( this.isActive ) {\n return;\n }\n this.isActive = true;\n this.element.classList.add('flickity-enabled');\n if ( this.options.rightToLeft ) {\n this.element.classList.add('flickity-rtl');\n }\n\n this.getSize();\n // move initial cell elements so they can be loaded as cells\n var cellElems = this._filterFindCellElements( this.element.children );\n moveElements( cellElems, this.slider );\n this.viewport.appendChild( this.slider );\n this.element.appendChild( this.viewport );\n // get cells from children\n this.reloadCells();\n\n if ( this.options.accessibility ) {\n // allow element to focusable\n this.element.tabIndex = 0;\n // listen for key presses\n this.element.addEventListener( 'keydown', this );\n }\n\n this.emitEvent('activate');\n this.selectInitialIndex();\n // flag for initial activation, for using initialIndex\n this.isInitActivated = true;\n // ready event. #493\n this.dispatchEvent('ready');\n};\n\n// slider positions the cells\nproto._createSlider = function() {\n // slider element does all the positioning\n var slider = document.createElement('div');\n slider.className = 'flickity-slider';\n slider.style[ this.originSide ] = 0;\n this.slider = slider;\n};\n\nproto._filterFindCellElements = function( elems ) {\n return utils.filterFindElements( elems, this.options.cellSelector );\n};\n\n// goes through all children\nproto.reloadCells = function() {\n // collection of item elements\n this.cells = this._makeCells( this.slider.children );\n this.positionCells();\n this._getWrapShiftCells();\n this.setGallerySize();\n};\n\n/**\n * turn elements into Flickity.Cells\n * @param {[Array, NodeList, HTMLElement]} elems - elements to make into cells\n * @returns {Array} items - collection of new Flickity Cells\n */\nproto._makeCells = function( elems ) {\n var cellElems = this._filterFindCellElements( elems );\n\n // create new Flickity for collection\n var cells = cellElems.map( function( cellElem ) {\n return new Cell( cellElem, this );\n }, this );\n\n return cells;\n};\n\nproto.getLastCell = function() {\n return this.cells[ this.cells.length - 1 ];\n};\n\nproto.getLastSlide = function() {\n return this.slides[ this.slides.length - 1 ];\n};\n\n// positions all cells\nproto.positionCells = function() {\n // size all cells\n this._sizeCells( this.cells );\n // position all cells\n this._positionCells( 0 );\n};\n\n/**\n * position certain cells\n * @param {Integer} index - which cell to start with\n */\nproto._positionCells = function( index ) {\n index = index || 0;\n // also measure maxCellHeight\n // start 0 if positioning all cells\n this.maxCellHeight = index ? this.maxCellHeight || 0 : 0;\n var cellX = 0;\n // get cellX\n if ( index > 0 ) {\n var startCell = this.cells[ index - 1 ];\n cellX = startCell.x + startCell.size.outerWidth;\n }\n var len = this.cells.length;\n for ( var i = index; i < len; i++ ) {\n var cell = this.cells[i];\n cell.setPosition( cellX );\n cellX += cell.size.outerWidth;\n this.maxCellHeight = Math.max( cell.size.outerHeight, this.maxCellHeight );\n }\n // keep track of cellX for wrap-around\n this.slideableWidth = cellX;\n // slides\n this.updateSlides();\n // contain slides target\n this._containSlides();\n // update slidesWidth\n this.slidesWidth = len ? this.getLastSlide().target - this.slides[0].target : 0;\n};\n\n/**\n * cell.getSize() on multiple cells\n * @param {Array} cells - cells to size\n */\nproto._sizeCells = function( cells ) {\n cells.forEach( function( cell ) {\n cell.getSize();\n } );\n};\n\n// -------------------------- -------------------------- //\n\nproto.updateSlides = function() {\n this.slides = [];\n if ( !this.cells.length ) {\n return;\n }\n\n var slide = new Slide( this );\n this.slides.push( slide );\n var isOriginLeft = this.originSide == 'left';\n var nextMargin = isOriginLeft ? 'marginRight' : 'marginLeft';\n\n var canCellFit = this._getCanCellFit();\n\n this.cells.forEach( function( cell, i ) {\n // just add cell if first cell in slide\n if ( !slide.cells.length ) {\n slide.addCell( cell );\n return;\n }\n\n var slideWidth = ( slide.outerWidth - slide.firstMargin ) +\n ( cell.size.outerWidth - cell.size[ nextMargin ] );\n\n if ( canCellFit.call( this, i, slideWidth ) ) {\n slide.addCell( cell );\n } else {\n // doesn't fit, new slide\n slide.updateTarget();\n\n slide = new Slide( this );\n this.slides.push( slide );\n slide.addCell( cell );\n }\n }, this );\n // last slide\n slide.updateTarget();\n // update .selectedSlide\n this.updateSelectedSlide();\n};\n\nproto._getCanCellFit = function() {\n var groupCells = this.options.groupCells;\n if ( !groupCells ) {\n return function() {\n return false;\n };\n } else if ( typeof groupCells == 'number' ) {\n // group by number. 3 -> [0,1,2], [3,4,5], ...\n var number = parseInt( groupCells, 10 );\n return function( i ) {\n return ( i % number ) !== 0;\n };\n }\n // default, group by width of slide\n // parse '75%\n var percentMatch = typeof groupCells == 'string' &&\n groupCells.match( /^(\\d+)%$/ );\n var percent = percentMatch ? parseInt( percentMatch[1], 10 ) / 100 : 1;\n return function( i, slideWidth ) {\n /* eslint-disable-next-line no-invalid-this */\n return slideWidth <= ( this.size.innerWidth + 1 ) * percent;\n };\n};\n\n// alias _init for jQuery plugin .flickity()\nproto._init =\nproto.reposition = function() {\n this.positionCells();\n this.positionSliderAtSelected();\n};\n\nproto.getSize = function() {\n this.size = getSize( this.element );\n this.setCellAlign();\n this.cursorPosition = this.size.innerWidth * this.cellAlign;\n};\n\nvar cellAlignShorthands = {\n // cell align, then based on origin side\n center: {\n left: 0.5,\n right: 0.5,\n },\n left: {\n left: 0,\n right: 1,\n },\n right: {\n right: 0,\n left: 1,\n },\n};\n\nproto.setCellAlign = function() {\n var shorthand = cellAlignShorthands[ this.options.cellAlign ];\n this.cellAlign = shorthand ? shorthand[ this.originSide ] : this.options.cellAlign;\n};\n\nproto.setGallerySize = function() {\n if ( this.options.setGallerySize ) {\n var height = this.options.adaptiveHeight && this.selectedSlide ?\n this.selectedSlide.height : this.maxCellHeight;\n this.viewport.style.height = height + 'px';\n }\n};\n\nproto._getWrapShiftCells = function() {\n // only for wrap-around\n if ( !this.options.wrapAround ) {\n return;\n }\n // unshift previous cells\n this._unshiftCells( this.beforeShiftCells );\n this._unshiftCells( this.afterShiftCells );\n // get before cells\n // initial gap\n var gapX = this.cursorPosition;\n var cellIndex = this.cells.length - 1;\n this.beforeShiftCells = this._getGapCells( gapX, cellIndex, -1 );\n // get after cells\n // ending gap between last cell and end of gallery viewport\n gapX = this.size.innerWidth - this.cursorPosition;\n // start cloning at first cell, working forwards\n this.afterShiftCells = this._getGapCells( gapX, 0, 1 );\n};\n\nproto._getGapCells = function( gapX, cellIndex, increment ) {\n // keep adding cells until the cover the initial gap\n var cells = [];\n while ( gapX > 0 ) {\n var cell = this.cells[ cellIndex ];\n if ( !cell ) {\n break;\n }\n cells.push( cell );\n cellIndex += increment;\n gapX -= cell.size.outerWidth;\n }\n return cells;\n};\n\n// ----- contain ----- //\n\n// contain cell targets so no excess sliding\nproto._containSlides = function() {\n if ( !this.options.contain || this.options.wrapAround || !this.cells.length ) {\n return;\n }\n var isRightToLeft = this.options.rightToLeft;\n var beginMargin = isRightToLeft ? 'marginRight' : 'marginLeft';\n var endMargin = isRightToLeft ? 'marginLeft' : 'marginRight';\n var contentWidth = this.slideableWidth - this.getLastCell().size[ endMargin ];\n // content is less than gallery size\n var isContentSmaller = contentWidth < this.size.innerWidth;\n // bounds\n var beginBound = this.cursorPosition + this.cells[0].size[ beginMargin ];\n var endBound = contentWidth - this.size.innerWidth * ( 1 - this.cellAlign );\n // contain each cell target\n this.slides.forEach( function( slide ) {\n if ( isContentSmaller ) {\n // all cells fit inside gallery\n slide.target = contentWidth * this.cellAlign;\n } else {\n // contain to bounds\n slide.target = Math.max( slide.target, beginBound );\n slide.target = Math.min( slide.target, endBound );\n }\n }, this );\n};\n\n// ----- ----- //\n\n/**\n * emits events via eventEmitter and jQuery events\n * @param {String} type - name of event\n * @param {Event} event - original event\n * @param {Array} args - extra arguments\n */\nproto.dispatchEvent = function( type, event, args ) {\n var emitArgs = event ? [ event ].concat( args ) : args;\n this.emitEvent( type, emitArgs );\n\n if ( jQuery && this.$element ) {\n // default trigger with type if no event\n type += this.options.namespaceJQueryEvents ? '.flickity' : '';\n var $event = type;\n if ( event ) {\n // create jQuery event\n var jQEvent = new jQuery.Event( event );\n jQEvent.type = type;\n $event = jQEvent;\n }\n this.$element.trigger( $event, args );\n }\n};\n\n// -------------------------- select -------------------------- //\n\n/**\n * @param {Integer} index - index of the slide\n * @param {Boolean} isWrap - will wrap-around to last/first if at the end\n * @param {Boolean} isInstant - will immediately set position at selected cell\n */\nproto.select = function( index, isWrap, isInstant ) {\n if ( !this.isActive ) {\n return;\n }\n index = parseInt( index, 10 );\n this._wrapSelect( index );\n\n if ( this.options.wrapAround || isWrap ) {\n index = utils.modulo( index, this.slides.length );\n }\n // bail if invalid index\n if ( !this.slides[ index ] ) {\n return;\n }\n var prevIndex = this.selectedIndex;\n this.selectedIndex = index;\n this.updateSelectedSlide();\n if ( isInstant ) {\n this.positionSliderAtSelected();\n } else {\n this.startAnimation();\n }\n if ( this.options.adaptiveHeight ) {\n this.setGallerySize();\n }\n // events\n this.dispatchEvent( 'select', null, [ index ] );\n // change event if new index\n if ( index != prevIndex ) {\n this.dispatchEvent( 'change', null, [ index ] );\n }\n // old v1 event name, remove in v3\n this.dispatchEvent('cellSelect');\n};\n\n// wraps position for wrapAround, to move to closest slide. #113\nproto._wrapSelect = function( index ) {\n var len = this.slides.length;\n var isWrapping = this.options.wrapAround && len > 1;\n if ( !isWrapping ) {\n return index;\n }\n var wrapIndex = utils.modulo( index, len );\n // go to shortest\n var delta = Math.abs( wrapIndex - this.selectedIndex );\n var backWrapDelta = Math.abs( ( wrapIndex + len ) - this.selectedIndex );\n var forewardWrapDelta = Math.abs( ( wrapIndex - len ) - this.selectedIndex );\n if ( !this.isDragSelect && backWrapDelta < delta ) {\n index += len;\n } else if ( !this.isDragSelect && forewardWrapDelta < delta ) {\n index -= len;\n }\n // wrap position so slider is within normal area\n if ( index < 0 ) {\n this.x -= this.slideableWidth;\n } else if ( index >= len ) {\n this.x += this.slideableWidth;\n }\n};\n\nproto.previous = function( isWrap, isInstant ) {\n this.select( this.selectedIndex - 1, isWrap, isInstant );\n};\n\nproto.next = function( isWrap, isInstant ) {\n this.select( this.selectedIndex + 1, isWrap, isInstant );\n};\n\nproto.updateSelectedSlide = function() {\n var slide = this.slides[ this.selectedIndex ];\n // selectedIndex could be outside of slides, if triggered before resize()\n if ( !slide ) {\n return;\n }\n // unselect previous selected slide\n this.unselectSelectedSlide();\n // update new selected slide\n this.selectedSlide = slide;\n slide.select();\n this.selectedCells = slide.cells;\n this.selectedElements = slide.getCellElements();\n // HACK: selectedCell & selectedElement is first cell in slide, backwards compatibility\n // Remove in v3?\n this.selectedCell = slide.cells[0];\n this.selectedElement = this.selectedElements[0];\n};\n\nproto.unselectSelectedSlide = function() {\n if ( this.selectedSlide ) {\n this.selectedSlide.unselect();\n }\n};\n\nproto.selectInitialIndex = function() {\n var initialIndex = this.options.initialIndex;\n // already activated, select previous selectedIndex\n if ( this.isInitActivated ) {\n this.select( this.selectedIndex, false, true );\n return;\n }\n // select with selector string\n if ( initialIndex && typeof initialIndex == 'string' ) {\n var cell = this.queryCell( initialIndex );\n if ( cell ) {\n this.selectCell( initialIndex, false, true );\n return;\n }\n }\n\n var index = 0;\n // select with number\n if ( initialIndex && this.slides[ initialIndex ] ) {\n index = initialIndex;\n }\n // select instantly\n this.select( index, false, true );\n};\n\n/**\n * select slide from number or cell element\n * @param {[Element, Number]} value - zero-based index or element to select\n * @param {Boolean} isWrap - enables wrapping around for extra index\n * @param {Boolean} isInstant - disables slide animation\n */\nproto.selectCell = function( value, isWrap, isInstant ) {\n // get cell\n var cell = this.queryCell( value );\n if ( !cell ) {\n return;\n }\n\n var index = this.getCellSlideIndex( cell );\n this.select( index, isWrap, isInstant );\n};\n\nproto.getCellSlideIndex = function( cell ) {\n // get index of slides that has cell\n for ( var i = 0; i < this.slides.length; i++ ) {\n var slide = this.slides[i];\n var index = slide.cells.indexOf( cell );\n if ( index != -1 ) {\n return i;\n }\n }\n};\n\n// -------------------------- get cells -------------------------- //\n\n/**\n * get Flickity.Cell, given an Element\n * @param {Element} elem - matching cell element\n * @returns {Flickity.Cell} cell - matching cell\n */\nproto.getCell = function( elem ) {\n // loop through cells to get the one that matches\n for ( var i = 0; i < this.cells.length; i++ ) {\n var cell = this.cells[i];\n if ( cell.element == elem ) {\n return cell;\n }\n }\n};\n\n/**\n * get collection of Flickity.Cells, given Elements\n * @param {[Element, Array, NodeList]} elems - multiple elements\n * @returns {Array} cells - Flickity.Cells\n */\nproto.getCells = function( elems ) {\n elems = utils.makeArray( elems );\n var cells = [];\n elems.forEach( function( elem ) {\n var cell = this.getCell( elem );\n if ( cell ) {\n cells.push( cell );\n }\n }, this );\n return cells;\n};\n\n/**\n * get cell elements\n * @returns {Array} cellElems\n */\nproto.getCellElements = function() {\n return this.cells.map( function( cell ) {\n return cell.element;\n } );\n};\n\n/**\n * get parent cell from an element\n * @param {Element} elem - child element\n * @returns {Flickit.Cell} cell - parent cell\n */\nproto.getParentCell = function( elem ) {\n // first check if elem is cell\n var cell = this.getCell( elem );\n if ( cell ) {\n return cell;\n }\n // try to get parent cell elem\n elem = utils.getParent( elem, '.flickity-slider > *' );\n return this.getCell( elem );\n};\n\n/**\n * get cells adjacent to a slide\n * @param {Integer} adjCount - number of adjacent slides\n * @param {Integer} index - index of slide to start\n * @returns {Array} cells - array of Flickity.Cells\n */\nproto.getAdjacentCellElements = function( adjCount, index ) {\n if ( !adjCount ) {\n return this.selectedSlide.getCellElements();\n }\n index = index === undefined ? this.selectedIndex : index;\n\n var len = this.slides.length;\n if ( 1 + ( adjCount * 2 ) >= len ) {\n return this.getCellElements();\n }\n\n var cellElems = [];\n for ( var i = index - adjCount; i <= index + adjCount; i++ ) {\n var slideIndex = this.options.wrapAround ? utils.modulo( i, len ) : i;\n var slide = this.slides[ slideIndex ];\n if ( slide ) {\n cellElems = cellElems.concat( slide.getCellElements() );\n }\n }\n return cellElems;\n};\n\n/**\n * select slide from number or cell element\n * @param {[Element, String, Number]} selector - element, selector string, or index\n * @returns {Flickity.Cell} - matching cell\n */\nproto.queryCell = function( selector ) {\n if ( typeof selector == 'number' ) {\n // use number as index\n return this.cells[ selector ];\n }\n if ( typeof selector == 'string' ) {\n // do not select invalid selectors from hash: #123, #/. #791\n if ( selector.match( /^[#.]?[\\d/]/ ) ) {\n return;\n }\n // use string as selector, get element\n selector = this.element.querySelector( selector );\n }\n // get cell from element\n return this.getCell( selector );\n};\n\n// -------------------------- events -------------------------- //\n\nproto.uiChange = function() {\n this.emitEvent('uiChange');\n};\n\n// keep focus on element when child UI elements are clicked\nproto.childUIPointerDown = function( event ) {\n // HACK iOS does not allow touch events to bubble up?!\n if ( event.type != 'touchstart' ) {\n event.preventDefault();\n }\n this.focus();\n};\n\n// ----- resize ----- //\n\nproto.onresize = function() {\n this.watchCSS();\n this.resize();\n};\n\nutils.debounceMethod( Flickity, 'onresize', 150 );\n\nproto.resize = function() {\n // #1177 disable resize behavior when animating or dragging for iOS 15\n if ( !this.isActive || this.isAnimating || this.isDragging ) {\n return;\n }\n this.getSize();\n // wrap values\n if ( this.options.wrapAround ) {\n this.x = utils.modulo( this.x, this.slideableWidth );\n }\n this.positionCells();\n this._getWrapShiftCells();\n this.setGallerySize();\n this.emitEvent('resize');\n // update selected index for group slides, instant\n // TODO: position can be lost between groups of various numbers\n var selectedElement = this.selectedElements && this.selectedElements[0];\n this.selectCell( selectedElement, false, true );\n};\n\n// watches the :after property, activates/deactivates\nproto.watchCSS = function() {\n var watchOption = this.options.watchCSS;\n if ( !watchOption ) {\n return;\n }\n\n var afterContent = getComputedStyle( this.element, ':after' ).content;\n // activate if :after { content: 'flickity' }\n if ( afterContent.indexOf('flickity') != -1 ) {\n this.activate();\n } else {\n this.deactivate();\n }\n};\n\n// ----- keydown ----- //\n\n// go previous/next if left/right keys pressed\nproto.onkeydown = function( event ) {\n // only work if element is in focus\n var isNotFocused = document.activeElement && document.activeElement != this.element;\n if ( !this.options.accessibility || isNotFocused ) {\n return;\n }\n\n var handler = Flickity.keyboardHandlers[ event.keyCode ];\n if ( handler ) {\n handler.call( this );\n }\n};\n\nFlickity.keyboardHandlers = {\n // left arrow\n 37: function() {\n var leftMethod = this.options.rightToLeft ? 'next' : 'previous';\n this.uiChange();\n this[ leftMethod ]();\n },\n // right arrow\n 39: function() {\n var rightMethod = this.options.rightToLeft ? 'previous' : 'next';\n this.uiChange();\n this[ rightMethod ]();\n },\n};\n\n// ----- focus ----- //\n\nproto.focus = function() {\n // TODO remove scrollTo once focus options gets more support\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus ...\n // #Browser_compatibility\n var prevScrollY = window.pageYOffset;\n this.element.focus({ preventScroll: true });\n // hack to fix scroll jump after focus, #76\n if ( window.pageYOffset != prevScrollY ) {\n window.scrollTo( window.pageXOffset, prevScrollY );\n }\n};\n\n// -------------------------- destroy -------------------------- //\n\n// deactivate all Flickity functionality, but keep stuff available\nproto.deactivate = function() {\n if ( !this.isActive ) {\n return;\n }\n this.element.classList.remove('flickity-enabled');\n this.element.classList.remove('flickity-rtl');\n this.unselectSelectedSlide();\n // destroy cells\n this.cells.forEach( function( cell ) {\n cell.destroy();\n } );\n this.element.removeChild( this.viewport );\n // move child elements back into element\n moveElements( this.slider.children, this.element );\n if ( this.options.accessibility ) {\n this.element.removeAttribute('tabIndex');\n this.element.removeEventListener( 'keydown', this );\n }\n // set flags\n this.isActive = false;\n this.emitEvent('deactivate');\n};\n\nproto.destroy = function() {\n this.deactivate();\n window.removeEventListener( 'resize', this );\n this.allOff();\n this.emitEvent('destroy');\n if ( jQuery && this.$element ) {\n jQuery.removeData( this.element, 'flickity' );\n }\n delete this.element.flickityGUID;\n delete instances[ this.guid ];\n};\n\n// -------------------------- prototype -------------------------- //\n\nutils.extend( proto, animatePrototype );\n\n// -------------------------- extras -------------------------- //\n\n/**\n * get Flickity instance from element\n * @param {[Element, String]} elem - element or selector string\n * @returns {Flickity} - Flickity instance\n */\nFlickity.data = function( elem ) {\n elem = utils.getQueryElement( elem );\n var id = elem && elem.flickityGUID;\n return id && instances[ id ];\n};\n\nutils.htmlInit( Flickity, 'flickity' );\n\nif ( jQuery && jQuery.bridget ) {\n jQuery.bridget( 'flickity', Flickity );\n}\n\n// set internal jQuery, for Webpack + jQuery v3, #478\nFlickity.setJQuery = function( jq ) {\n jQuery = jq;\n};\n\nFlickity.Cell = Cell;\nFlickity.Slide = Slide;\n\nreturn Flickity;\n\n} ) );\n", "/*!\n * Unipointer v2.4.0\n * base class for doing one thing with pointer event\n * MIT license\n */\n\n/*jshint browser: true, undef: true, unused: true, strict: true */\n\n( function( window, factory ) {\n // universal module definition\n /* jshint strict: false */ /*global define, module, require */\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'ev-emitter/ev-emitter'\n ], function( EvEmitter ) {\n return factory( window, EvEmitter );\n });\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('ev-emitter')\n );\n } else {\n // browser global\n window.Unipointer = factory(\n window,\n window.EvEmitter\n );\n }\n\n}( window, function factory( window, EvEmitter ) {\n\n'use strict';\n\nfunction noop() {}\n\nfunction Unipointer() {}\n\n// inherit EvEmitter\nvar proto = Unipointer.prototype = Object.create( EvEmitter.prototype );\n\nproto.bindStartEvent = function( elem ) {\n this._bindStartEvent( elem, true );\n};\n\nproto.unbindStartEvent = function( elem ) {\n this._bindStartEvent( elem, false );\n};\n\n/**\n * Add or remove start event\n * @param {Boolean} isAdd - remove if falsey\n */\nproto._bindStartEvent = function( elem, isAdd ) {\n // munge isAdd, default to true\n isAdd = isAdd === undefined ? true : isAdd;\n var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener';\n\n // default to mouse events\n var startEvent = 'mousedown';\n if ( 'ontouchstart' in window ) {\n // HACK prefer Touch Events as you can preventDefault on touchstart to\n // disable scroll in iOS & mobile Chrome metafizzy/flickity#1177\n startEvent = 'touchstart';\n } else if ( window.PointerEvent ) {\n // Pointer Events\n startEvent = 'pointerdown';\n }\n elem[ bindMethod ]( startEvent, this );\n};\n\n// trigger handler methods for events\nproto.handleEvent = function( event ) {\n var method = 'on' + event.type;\n if ( this[ method ] ) {\n this[ method ]( event );\n }\n};\n\n// returns the touch that we're keeping track of\nproto.getTouch = function( touches ) {\n for ( var i=0; i < touches.length; i++ ) {\n var touch = touches[i];\n if ( touch.identifier == this.pointerIdentifier ) {\n return touch;\n }\n }\n};\n\n// ----- start event ----- //\n\nproto.onmousedown = function( event ) {\n // dismiss clicks from right or middle buttons\n var button = event.button;\n if ( button && ( button !== 0 && button !== 1 ) ) {\n return;\n }\n this._pointerDown( event, event );\n};\n\nproto.ontouchstart = function( event ) {\n this._pointerDown( event, event.changedTouches[0] );\n};\n\nproto.onpointerdown = function( event ) {\n this._pointerDown( event, event );\n};\n\n/**\n * pointer start\n * @param {Event} event\n * @param {Event or Touch} pointer\n */\nproto._pointerDown = function( event, pointer ) {\n // dismiss right click and other pointers\n // button = 0 is okay, 1-4 not\n if ( event.button || this.isPointerDown ) {\n return;\n }\n\n this.isPointerDown = true;\n // save pointer identifier to match up touch events\n this.pointerIdentifier = pointer.pointerId !== undefined ?\n // pointerId for pointer events, touch.indentifier for touch events\n pointer.pointerId : pointer.identifier;\n\n this.pointerDown( event, pointer );\n};\n\nproto.pointerDown = function( event, pointer ) {\n this._bindPostStartEvents( event );\n this.emitEvent( 'pointerDown', [ event, pointer ] );\n};\n\n// hash of events to be bound after start event\nvar postStartEvents = {\n mousedown: [ 'mousemove', 'mouseup' ],\n touchstart: [ 'touchmove', 'touchend', 'touchcancel' ],\n pointerdown: [ 'pointermove', 'pointerup', 'pointercancel' ],\n};\n\nproto._bindPostStartEvents = function( event ) {\n if ( !event ) {\n return;\n }\n // get proper events to match start event\n var events = postStartEvents[ event.type ];\n // bind events to node\n events.forEach( function( eventName ) {\n window.addEventListener( eventName, this );\n }, this );\n // save these arguments\n this._boundPointerEvents = events;\n};\n\nproto._unbindPostStartEvents = function() {\n // check for _boundEvents, in case dragEnd triggered twice (old IE8 bug)\n if ( !this._boundPointerEvents ) {\n return;\n }\n this._boundPointerEvents.forEach( function( eventName ) {\n window.removeEventListener( eventName, this );\n }, this );\n\n delete this._boundPointerEvents;\n};\n\n// ----- move event ----- //\n\nproto.onmousemove = function( event ) {\n this._pointerMove( event, event );\n};\n\nproto.onpointermove = function( event ) {\n if ( event.pointerId == this.pointerIdentifier ) {\n this._pointerMove( event, event );\n }\n};\n\nproto.ontouchmove = function( event ) {\n var touch = this.getTouch( event.changedTouches );\n if ( touch ) {\n this._pointerMove( event, touch );\n }\n};\n\n/**\n * pointer move\n * @param {Event} event\n * @param {Event or Touch} pointer\n * @private\n */\nproto._pointerMove = function( event, pointer ) {\n this.pointerMove( event, pointer );\n};\n\n// public\nproto.pointerMove = function( event, pointer ) {\n this.emitEvent( 'pointerMove', [ event, pointer ] );\n};\n\n// ----- end event ----- //\n\n\nproto.onmouseup = function( event ) {\n this._pointerUp( event, event );\n};\n\nproto.onpointerup = function( event ) {\n if ( event.pointerId == this.pointerIdentifier ) {\n this._pointerUp( event, event );\n }\n};\n\nproto.ontouchend = function( event ) {\n var touch = this.getTouch( event.changedTouches );\n if ( touch ) {\n this._pointerUp( event, touch );\n }\n};\n\n/**\n * pointer up\n * @param {Event} event\n * @param {Event or Touch} pointer\n * @private\n */\nproto._pointerUp = function( event, pointer ) {\n this._pointerDone();\n this.pointerUp( event, pointer );\n};\n\n// public\nproto.pointerUp = function( event, pointer ) {\n this.emitEvent( 'pointerUp', [ event, pointer ] );\n};\n\n// ----- pointer done ----- //\n\n// triggered on pointer up & pointer cancel\nproto._pointerDone = function() {\n this._pointerReset();\n this._unbindPostStartEvents();\n this.pointerDone();\n};\n\nproto._pointerReset = function() {\n // reset properties\n this.isPointerDown = false;\n delete this.pointerIdentifier;\n};\n\nproto.pointerDone = noop;\n\n// ----- pointer cancel ----- //\n\nproto.onpointercancel = function( event ) {\n if ( event.pointerId == this.pointerIdentifier ) {\n this._pointerCancel( event, event );\n }\n};\n\nproto.ontouchcancel = function( event ) {\n var touch = this.getTouch( event.changedTouches );\n if ( touch ) {\n this._pointerCancel( event, touch );\n }\n};\n\n/**\n * pointer cancel\n * @param {Event} event\n * @param {Event or Touch} pointer\n * @private\n */\nproto._pointerCancel = function( event, pointer ) {\n this._pointerDone();\n this.pointerCancel( event, pointer );\n};\n\n// public\nproto.pointerCancel = function( event, pointer ) {\n this.emitEvent( 'pointerCancel', [ event, pointer ] );\n};\n\n// ----- ----- //\n\n// utility function for getting x/y coords from event\nUnipointer.getPointerPoint = function( pointer ) {\n return {\n x: pointer.pageX,\n y: pointer.pageY\n };\n};\n\n// ----- ----- //\n\nreturn Unipointer;\n\n}));\n", "/*!\n * Unidragger v2.4.0\n * Draggable base class\n * MIT license\n */\n\n/*jshint browser: true, unused: true, undef: true, strict: true */\n\n( function( window, factory ) {\n // universal module definition\n /*jshint strict: false */ /*globals define, module, require */\n\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'unipointer/unipointer'\n ], function( Unipointer ) {\n return factory( window, Unipointer );\n });\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('unipointer')\n );\n } else {\n // browser global\n window.Unidragger = factory(\n window,\n window.Unipointer\n );\n }\n\n}( window, function factory( window, Unipointer ) {\n\n'use strict';\n\n// -------------------------- Unidragger -------------------------- //\n\nfunction Unidragger() {}\n\n// inherit Unipointer & EvEmitter\nvar proto = Unidragger.prototype = Object.create( Unipointer.prototype );\n\n// ----- bind start ----- //\n\nproto.bindHandles = function() {\n this._bindHandles( true );\n};\n\nproto.unbindHandles = function() {\n this._bindHandles( false );\n};\n\n/**\n * Add or remove start event\n * @param {Boolean} isAdd\n */\nproto._bindHandles = function( isAdd ) {\n // munge isAdd, default to true\n isAdd = isAdd === undefined ? true : isAdd;\n // bind each handle\n var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener';\n var touchAction = isAdd ? this._touchActionValue : '';\n for ( var i=0; i < this.handles.length; i++ ) {\n var handle = this.handles[i];\n this._bindStartEvent( handle, isAdd );\n handle[ bindMethod ]( 'click', this );\n // touch-action: none to override browser touch gestures. metafizzy/flickity#540\n if ( window.PointerEvent ) {\n handle.style.touchAction = touchAction;\n }\n }\n};\n\n// prototype so it can be overwriteable by Flickity\nproto._touchActionValue = 'none';\n\n// ----- start event ----- //\n\n/**\n * pointer start\n * @param {Event} event\n * @param {Event or Touch} pointer\n */\nproto.pointerDown = function( event, pointer ) {\n var isOkay = this.okayPointerDown( event );\n if ( !isOkay ) {\n return;\n }\n // track start event position\n // Safari 9 overrides pageX and pageY. These values needs to be copied. flickity#842\n this.pointerDownPointer = {\n pageX: pointer.pageX,\n pageY: pointer.pageY,\n };\n\n event.preventDefault();\n this.pointerDownBlur();\n // bind move and end events\n this._bindPostStartEvents( event );\n this.emitEvent( 'pointerDown', [ event, pointer ] );\n};\n\n// nodes that have text fields\nvar cursorNodes = {\n TEXTAREA: true,\n INPUT: true,\n SELECT: true,\n OPTION: true,\n};\n\n// input types that do not have text fields\nvar clickTypes = {\n radio: true,\n checkbox: true,\n button: true,\n submit: true,\n image: true,\n file: true,\n};\n\n// dismiss inputs with text fields. flickity#403, flickity#404\nproto.okayPointerDown = function( event ) {\n var isCursorNode = cursorNodes[ event.target.nodeName ];\n var isClickType = clickTypes[ event.target.type ];\n var isOkay = !isCursorNode || isClickType;\n if ( !isOkay ) {\n this._pointerReset();\n }\n return isOkay;\n};\n\n// kludge to blur previously focused input\nproto.pointerDownBlur = function() {\n var focused = document.activeElement;\n // do not blur body for IE10, metafizzy/flickity#117\n var canBlur = focused && focused.blur && focused != document.body;\n if ( canBlur ) {\n focused.blur();\n }\n};\n\n// ----- move event ----- //\n\n/**\n * drag move\n * @param {Event} event\n * @param {Event or Touch} pointer\n */\nproto.pointerMove = function( event, pointer ) {\n var moveVector = this._dragPointerMove( event, pointer );\n this.emitEvent( 'pointerMove', [ event, pointer, moveVector ] );\n this._dragMove( event, pointer, moveVector );\n};\n\n// base pointer move logic\nproto._dragPointerMove = function( event, pointer ) {\n var moveVector = {\n x: pointer.pageX - this.pointerDownPointer.pageX,\n y: pointer.pageY - this.pointerDownPointer.pageY\n };\n // start drag if pointer has moved far enough to start drag\n if ( !this.isDragging && this.hasDragStarted( moveVector ) ) {\n this._dragStart( event, pointer );\n }\n return moveVector;\n};\n\n// condition if pointer has moved far enough to start drag\nproto.hasDragStarted = function( moveVector ) {\n return Math.abs( moveVector.x ) > 3 || Math.abs( moveVector.y ) > 3;\n};\n\n// ----- end event ----- //\n\n/**\n * pointer up\n * @param {Event} event\n * @param {Event or Touch} pointer\n */\nproto.pointerUp = function( event, pointer ) {\n this.emitEvent( 'pointerUp', [ event, pointer ] );\n this._dragPointerUp( event, pointer );\n};\n\nproto._dragPointerUp = function( event, pointer ) {\n if ( this.isDragging ) {\n this._dragEnd( event, pointer );\n } else {\n // pointer didn't move enough for drag to start\n this._staticClick( event, pointer );\n }\n};\n\n// -------------------------- drag -------------------------- //\n\n// dragStart\nproto._dragStart = function( event, pointer ) {\n this.isDragging = true;\n // prevent clicks\n this.isPreventingClicks = true;\n this.dragStart( event, pointer );\n};\n\nproto.dragStart = function( event, pointer ) {\n this.emitEvent( 'dragStart', [ event, pointer ] );\n};\n\n// dragMove\nproto._dragMove = function( event, pointer, moveVector ) {\n // do not drag if not dragging yet\n if ( !this.isDragging ) {\n return;\n }\n\n this.dragMove( event, pointer, moveVector );\n};\n\nproto.dragMove = function( event, pointer, moveVector ) {\n event.preventDefault();\n this.emitEvent( 'dragMove', [ event, pointer, moveVector ] );\n};\n\n// dragEnd\nproto._dragEnd = function( event, pointer ) {\n // set flags\n this.isDragging = false;\n // re-enable clicking async\n setTimeout( function() {\n delete this.isPreventingClicks;\n }.bind( this ) );\n\n this.dragEnd( event, pointer );\n};\n\nproto.dragEnd = function( event, pointer ) {\n this.emitEvent( 'dragEnd', [ event, pointer ] );\n};\n\n// ----- onclick ----- //\n\n// handle all clicks and prevent clicks when dragging\nproto.onclick = function( event ) {\n if ( this.isPreventingClicks ) {\n event.preventDefault();\n }\n};\n\n// ----- staticClick ----- //\n\n// triggered after pointer down & up with no/tiny movement\nproto._staticClick = function( event, pointer ) {\n // ignore emulated mouse up clicks\n if ( this.isIgnoringMouseUp && event.type == 'mouseup' ) {\n return;\n }\n\n this.staticClick( event, pointer );\n\n // set flag for emulated clicks 300ms after touchend\n if ( event.type != 'mouseup' ) {\n this.isIgnoringMouseUp = true;\n // reset flag after 300ms\n setTimeout( function() {\n delete this.isIgnoringMouseUp;\n }.bind( this ), 400 );\n }\n};\n\nproto.staticClick = function( event, pointer ) {\n this.emitEvent( 'staticClick', [ event, pointer ] );\n};\n\n// ----- utils ----- //\n\nUnidragger.getPointerPoint = Unipointer.getPointerPoint;\n\n// ----- ----- //\n\nreturn Unidragger;\n\n}));\n", "// drag\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n './flickity',\n 'unidragger/unidragger',\n 'fizzy-ui-utils/utils',\n ], function( Flickity, Unidragger, utils ) {\n return factory( window, Flickity, Unidragger, utils );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('./flickity'),\n require('unidragger'),\n require('fizzy-ui-utils')\n );\n } else {\n // browser global\n window.Flickity = factory(\n window,\n window.Flickity,\n window.Unidragger,\n window.fizzyUIUtils\n );\n }\n\n}( window, function factory( window, Flickity, Unidragger, utils ) {\n\n'use strict';\n\n// ----- defaults ----- //\n\nutils.extend( Flickity.defaults, {\n draggable: '>1',\n dragThreshold: 3,\n} );\n\n// ----- create ----- //\n\nFlickity.createMethods.push('_createDrag');\n\n// -------------------------- drag prototype -------------------------- //\n\nvar proto = Flickity.prototype;\nutils.extend( proto, Unidragger.prototype );\nproto._touchActionValue = 'pan-y';\n\n// -------------------------- -------------------------- //\n\nproto._createDrag = function() {\n this.on( 'activate', this.onActivateDrag );\n this.on( 'uiChange', this._uiChangeDrag );\n this.on( 'deactivate', this.onDeactivateDrag );\n this.on( 'cellChange', this.updateDraggable );\n // TODO updateDraggable on resize? if groupCells & slides change\n};\n\nproto.onActivateDrag = function() {\n this.handles = [ this.viewport ];\n this.bindHandles();\n this.updateDraggable();\n};\n\nproto.onDeactivateDrag = function() {\n this.unbindHandles();\n this.element.classList.remove('is-draggable');\n};\n\nproto.updateDraggable = function() {\n // disable dragging if less than 2 slides. #278\n if ( this.options.draggable == '>1' ) {\n this.isDraggable = this.slides.length > 1;\n } else {\n this.isDraggable = this.options.draggable;\n }\n if ( this.isDraggable ) {\n this.element.classList.add('is-draggable');\n } else {\n this.element.classList.remove('is-draggable');\n }\n};\n\n// backwards compatibility\nproto.bindDrag = function() {\n this.options.draggable = true;\n this.updateDraggable();\n};\n\nproto.unbindDrag = function() {\n this.options.draggable = false;\n this.updateDraggable();\n};\n\nproto._uiChangeDrag = function() {\n delete this.isFreeScrolling;\n};\n\n// -------------------------- pointer events -------------------------- //\n\nproto.pointerDown = function( event, pointer ) {\n if ( !this.isDraggable ) {\n this._pointerDownDefault( event, pointer );\n return;\n }\n var isOkay = this.okayPointerDown( event );\n if ( !isOkay ) {\n return;\n }\n\n this._pointerDownPreventDefault( event );\n this.pointerDownFocus( event );\n // blur\n if ( document.activeElement != this.element ) {\n // do not blur if already focused\n this.pointerDownBlur();\n }\n\n // stop if it was moving\n this.dragX = this.x;\n this.viewport.classList.add('is-pointer-down');\n // track scrolling\n this.pointerDownScroll = getScrollPosition();\n window.addEventListener( 'scroll', this );\n\n this._pointerDownDefault( event, pointer );\n};\n\n// default pointerDown logic, used for staticClick\nproto._pointerDownDefault = function( event, pointer ) {\n // track start event position\n // Safari 9 overrides pageX and pageY. These values needs to be copied. #779\n this.pointerDownPointer = {\n pageX: pointer.pageX,\n pageY: pointer.pageY,\n };\n // bind move and end events\n this._bindPostStartEvents( event );\n this.dispatchEvent( 'pointerDown', event, [ pointer ] );\n};\n\nvar focusNodes = {\n INPUT: true,\n TEXTAREA: true,\n SELECT: true,\n};\n\nproto.pointerDownFocus = function( event ) {\n var isFocusNode = focusNodes[ event.target.nodeName ];\n if ( !isFocusNode ) {\n this.focus();\n }\n};\n\nproto._pointerDownPreventDefault = function( event ) {\n var isTouchStart = event.type == 'touchstart';\n var isTouchPointer = event.pointerType == 'touch';\n var isFocusNode = focusNodes[ event.target.nodeName ];\n if ( !isTouchStart && !isTouchPointer && !isFocusNode ) {\n event.preventDefault();\n }\n};\n\n// ----- move ----- //\n\nproto.hasDragStarted = function( moveVector ) {\n return Math.abs( moveVector.x ) > this.options.dragThreshold;\n};\n\n// ----- up ----- //\n\nproto.pointerUp = function( event, pointer ) {\n delete this.isTouchScrolling;\n this.viewport.classList.remove('is-pointer-down');\n this.dispatchEvent( 'pointerUp', event, [ pointer ] );\n this._dragPointerUp( event, pointer );\n};\n\nproto.pointerDone = function() {\n window.removeEventListener( 'scroll', this );\n delete this.pointerDownScroll;\n};\n\n// -------------------------- dragging -------------------------- //\n\nproto.dragStart = function( event, pointer ) {\n if ( !this.isDraggable ) {\n return;\n }\n this.dragStartPosition = this.x;\n this.startAnimation();\n window.removeEventListener( 'scroll', this );\n this.dispatchEvent( 'dragStart', event, [ pointer ] );\n};\n\nproto.pointerMove = function( event, pointer ) {\n var moveVector = this._dragPointerMove( event, pointer );\n this.dispatchEvent( 'pointerMove', event, [ pointer, moveVector ] );\n this._dragMove( event, pointer, moveVector );\n};\n\nproto.dragMove = function( event, pointer, moveVector ) {\n if ( !this.isDraggable ) {\n return;\n }\n event.preventDefault();\n\n this.previousDragX = this.dragX;\n // reverse if right-to-left\n var direction = this.options.rightToLeft ? -1 : 1;\n if ( this.options.wrapAround ) {\n // wrap around move. #589\n moveVector.x %= this.slideableWidth;\n }\n var dragX = this.dragStartPosition + moveVector.x * direction;\n\n if ( !this.options.wrapAround && this.slides.length ) {\n // slow drag\n var originBound = Math.max( -this.slides[0].target, this.dragStartPosition );\n dragX = dragX > originBound ? ( dragX + originBound ) * 0.5 : dragX;\n var endBound = Math.min( -this.getLastSlide().target, this.dragStartPosition );\n dragX = dragX < endBound ? ( dragX + endBound ) * 0.5 : dragX;\n }\n\n this.dragX = dragX;\n\n this.dragMoveTime = new Date();\n this.dispatchEvent( 'dragMove', event, [ pointer, moveVector ] );\n};\n\nproto.dragEnd = function( event, pointer ) {\n if ( !this.isDraggable ) {\n return;\n }\n if ( this.options.freeScroll ) {\n this.isFreeScrolling = true;\n }\n // set selectedIndex based on where flick will end up\n var index = this.dragEndRestingSelect();\n\n if ( this.options.freeScroll && !this.options.wrapAround ) {\n // if free-scroll & not wrap around\n // do not free-scroll if going outside of bounding slides\n // so bounding slides can attract slider, and keep it in bounds\n var restingX = this.getRestingPosition();\n this.isFreeScrolling = -restingX > this.slides[0].target &&\n -restingX < this.getLastSlide().target;\n } else if ( !this.options.freeScroll && index == this.selectedIndex ) {\n // boost selection if selected index has not changed\n index += this.dragEndBoostSelect();\n }\n delete this.previousDragX;\n // apply selection\n // TODO refactor this, selecting here feels weird\n // HACK, set flag so dragging stays in correct direction\n this.isDragSelect = this.options.wrapAround;\n this.select( index );\n delete this.isDragSelect;\n this.dispatchEvent( 'dragEnd', event, [ pointer ] );\n};\n\nproto.dragEndRestingSelect = function() {\n var restingX = this.getRestingPosition();\n // how far away from selected slide\n var distance = Math.abs( this.getSlideDistance( -restingX, this.selectedIndex ) );\n // get closet resting going up and going down\n var positiveResting = this._getClosestResting( restingX, distance, 1 );\n var negativeResting = this._getClosestResting( restingX, distance, -1 );\n // use closer resting for wrap-around\n var index = positiveResting.distance < negativeResting.distance ?\n positiveResting.index : negativeResting.index;\n return index;\n};\n\n/**\n * given resting X and distance to selected cell\n * get the distance and index of the closest cell\n * @param {Number} restingX - estimated post-flick resting position\n * @param {Number} distance - distance to selected cell\n * @param {Integer} increment - +1 or -1, going up or down\n * @returns {Object} - { distance: {Number}, index: {Integer} }\n */\nproto._getClosestResting = function( restingX, distance, increment ) {\n var index = this.selectedIndex;\n var minDistance = Infinity;\n var condition = this.options.contain && !this.options.wrapAround ?\n // if contain, keep going if distance is equal to minDistance\n function( dist, minDist ) {\n return dist <= minDist;\n } : function( dist, minDist ) {\n return dist < minDist;\n };\n while ( condition( distance, minDistance ) ) {\n // measure distance to next cell\n index += increment;\n minDistance = distance;\n distance = this.getSlideDistance( -restingX, index );\n if ( distance === null ) {\n break;\n }\n distance = Math.abs( distance );\n }\n return {\n distance: minDistance,\n // selected was previous index\n index: index - increment,\n };\n};\n\n/**\n * measure distance between x and a slide target\n * @param {Number} x - horizontal position\n * @param {Integer} index - slide index\n * @returns {Number} - slide distance\n */\nproto.getSlideDistance = function( x, index ) {\n var len = this.slides.length;\n // wrap around if at least 2 slides\n var isWrapAround = this.options.wrapAround && len > 1;\n var slideIndex = isWrapAround ? utils.modulo( index, len ) : index;\n var slide = this.slides[ slideIndex ];\n if ( !slide ) {\n return null;\n }\n // add distance for wrap-around slides\n var wrap = isWrapAround ? this.slideableWidth * Math.floor( index/len ) : 0;\n return x - ( slide.target + wrap );\n};\n\nproto.dragEndBoostSelect = function() {\n // do not boost if no previousDragX or dragMoveTime\n if ( this.previousDragX === undefined || !this.dragMoveTime ||\n // or if drag was held for 100 ms\n new Date() - this.dragMoveTime > 100 ) {\n return 0;\n }\n\n var distance = this.getSlideDistance( -this.dragX, this.selectedIndex );\n var delta = this.previousDragX - this.dragX;\n if ( distance > 0 && delta > 0 ) {\n // boost to next if moving towards the right, and positive velocity\n return 1;\n } else if ( distance < 0 && delta < 0 ) {\n // boost to previous if moving towards the left, and negative velocity\n return -1;\n }\n return 0;\n};\n\n// ----- staticClick ----- //\n\nproto.staticClick = function( event, pointer ) {\n // get clickedCell, if cell was clicked\n var clickedCell = this.getParentCell( event.target );\n var cellElem = clickedCell && clickedCell.element;\n var cellIndex = clickedCell && this.cells.indexOf( clickedCell );\n this.dispatchEvent( 'staticClick', event, [ pointer, cellElem, cellIndex ] );\n};\n\n// ----- scroll ----- //\n\nproto.onscroll = function() {\n var scroll = getScrollPosition();\n var scrollMoveX = this.pointerDownScroll.x - scroll.x;\n var scrollMoveY = this.pointerDownScroll.y - scroll.y;\n // cancel click/tap if scroll is too much\n if ( Math.abs( scrollMoveX ) > 3 || Math.abs( scrollMoveY ) > 3 ) {\n this._pointerDone();\n }\n};\n\n// ----- utils ----- //\n\nfunction getScrollPosition() {\n return {\n x: window.pageXOffset,\n y: window.pageYOffset,\n };\n}\n\n// ----- ----- //\n\nreturn Flickity;\n\n} ) );\n", "// prev/next buttons\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n './flickity',\n 'unipointer/unipointer',\n 'fizzy-ui-utils/utils',\n ], function( Flickity, Unipointer, utils ) {\n return factory( window, Flickity, Unipointer, utils );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('./flickity'),\n require('unipointer'),\n require('fizzy-ui-utils')\n );\n } else {\n // browser global\n factory(\n window,\n window.Flickity,\n window.Unipointer,\n window.fizzyUIUtils\n );\n }\n\n}( window, function factory( window, Flickity, Unipointer, utils ) {\n'use strict';\n\nvar svgURI = 'http://www.w3.org/2000/svg';\n\n// -------------------------- PrevNextButton -------------------------- //\n\nfunction PrevNextButton( direction, parent ) {\n this.direction = direction;\n this.parent = parent;\n this._create();\n}\n\nPrevNextButton.prototype = Object.create( Unipointer.prototype );\n\nPrevNextButton.prototype._create = function() {\n // properties\n this.isEnabled = true;\n this.isPrevious = this.direction == -1;\n var leftDirection = this.parent.options.rightToLeft ? 1 : -1;\n this.isLeft = this.direction == leftDirection;\n\n var element = this.element = document.createElement('button');\n element.className = 'flickity-button flickity-prev-next-button';\n element.className += this.isPrevious ? ' previous' : ' next';\n // prevent button from submitting form http://stackoverflow.com/a/10836076/182183\n element.setAttribute( 'type', 'button' );\n // init as disabled\n this.disable();\n\n element.setAttribute( 'aria-label', this.isPrevious ? 'Previous' : 'Next' );\n\n // create arrow\n var svg = this.createSVG();\n element.appendChild( svg );\n // events\n this.parent.on( 'select', this.update.bind( this ) );\n this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) );\n};\n\nPrevNextButton.prototype.activate = function() {\n this.bindStartEvent( this.element );\n this.element.addEventListener( 'click', this );\n // add to DOM\n this.parent.element.appendChild( this.element );\n};\n\nPrevNextButton.prototype.deactivate = function() {\n // remove from DOM\n this.parent.element.removeChild( this.element );\n // click events\n this.unbindStartEvent( this.element );\n this.element.removeEventListener( 'click', this );\n};\n\nPrevNextButton.prototype.createSVG = function() {\n var svg = document.createElementNS( svgURI, 'svg' );\n svg.setAttribute( 'class', 'flickity-button-icon' );\n svg.setAttribute( 'viewBox', '0 0 100 100' );\n var path = document.createElementNS( svgURI, 'path' );\n var pathMovements = getArrowMovements( this.parent.options.arrowShape );\n path.setAttribute( 'd', pathMovements );\n path.setAttribute( 'class', 'arrow' );\n // rotate arrow\n if ( !this.isLeft ) {\n path.setAttribute( 'transform', 'translate(100, 100) rotate(180) ' );\n }\n svg.appendChild( path );\n return svg;\n};\n\n// get SVG path movmement\nfunction getArrowMovements( shape ) {\n // use shape as movement if string\n if ( typeof shape == 'string' ) {\n return shape;\n }\n // create movement string\n return 'M ' + shape.x0 + ',50' +\n ' L ' + shape.x1 + ',' + ( shape.y1 + 50 ) +\n ' L ' + shape.x2 + ',' + ( shape.y2 + 50 ) +\n ' L ' + shape.x3 + ',50 ' +\n ' L ' + shape.x2 + ',' + ( 50 - shape.y2 ) +\n ' L ' + shape.x1 + ',' + ( 50 - shape.y1 ) +\n ' Z';\n}\n\nPrevNextButton.prototype.handleEvent = utils.handleEvent;\n\nPrevNextButton.prototype.onclick = function() {\n if ( !this.isEnabled ) {\n return;\n }\n this.parent.uiChange();\n var method = this.isPrevious ? 'previous' : 'next';\n this.parent[ method ]();\n};\n\n// ----- ----- //\n\nPrevNextButton.prototype.enable = function() {\n if ( this.isEnabled ) {\n return;\n }\n this.element.disabled = false;\n this.isEnabled = true;\n};\n\nPrevNextButton.prototype.disable = function() {\n if ( !this.isEnabled ) {\n return;\n }\n this.element.disabled = true;\n this.isEnabled = false;\n};\n\nPrevNextButton.prototype.update = function() {\n // index of first or last slide, if previous or next\n var slides = this.parent.slides;\n // enable is wrapAround and at least 2 slides\n if ( this.parent.options.wrapAround && slides.length > 1 ) {\n this.enable();\n return;\n }\n var lastIndex = slides.length ? slides.length - 1 : 0;\n var boundIndex = this.isPrevious ? 0 : lastIndex;\n var method = this.parent.selectedIndex == boundIndex ? 'disable' : 'enable';\n this[ method ]();\n};\n\nPrevNextButton.prototype.destroy = function() {\n this.deactivate();\n this.allOff();\n};\n\n// -------------------------- Flickity prototype -------------------------- //\n\nutils.extend( Flickity.defaults, {\n prevNextButtons: true,\n arrowShape: {\n x0: 10,\n x1: 60, y1: 50,\n x2: 70, y2: 40,\n x3: 30,\n },\n} );\n\nFlickity.createMethods.push('_createPrevNextButtons');\nvar proto = Flickity.prototype;\n\nproto._createPrevNextButtons = function() {\n if ( !this.options.prevNextButtons ) {\n return;\n }\n\n this.prevButton = new PrevNextButton( -1, this );\n this.nextButton = new PrevNextButton( 1, this );\n\n this.on( 'activate', this.activatePrevNextButtons );\n};\n\nproto.activatePrevNextButtons = function() {\n this.prevButton.activate();\n this.nextButton.activate();\n this.on( 'deactivate', this.deactivatePrevNextButtons );\n};\n\nproto.deactivatePrevNextButtons = function() {\n this.prevButton.deactivate();\n this.nextButton.deactivate();\n this.off( 'deactivate', this.deactivatePrevNextButtons );\n};\n\n// -------------------------- -------------------------- //\n\nFlickity.PrevNextButton = PrevNextButton;\n\nreturn Flickity;\n\n} ) );\n", "// page dots\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n './flickity',\n 'unipointer/unipointer',\n 'fizzy-ui-utils/utils',\n ], function( Flickity, Unipointer, utils ) {\n return factory( window, Flickity, Unipointer, utils );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('./flickity'),\n require('unipointer'),\n require('fizzy-ui-utils')\n );\n } else {\n // browser global\n factory(\n window,\n window.Flickity,\n window.Unipointer,\n window.fizzyUIUtils\n );\n }\n\n}( window, function factory( window, Flickity, Unipointer, utils ) {\n\n// -------------------------- PageDots -------------------------- //\n\n'use strict';\n\nfunction PageDots( parent ) {\n this.parent = parent;\n this._create();\n}\n\nPageDots.prototype = Object.create( Unipointer.prototype );\n\nPageDots.prototype._create = function() {\n // create holder element\n this.holder = document.createElement('ol');\n this.holder.className = 'flickity-page-dots';\n // create dots, array of elements\n this.dots = [];\n // events\n this.handleClick = this.onClick.bind( this );\n this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) );\n};\n\nPageDots.prototype.activate = function() {\n this.setDots();\n this.holder.addEventListener( 'click', this.handleClick );\n this.bindStartEvent( this.holder );\n // add to DOM\n this.parent.element.appendChild( this.holder );\n};\n\nPageDots.prototype.deactivate = function() {\n this.holder.removeEventListener( 'click', this.handleClick );\n this.unbindStartEvent( this.holder );\n // remove from DOM\n this.parent.element.removeChild( this.holder );\n};\n\nPageDots.prototype.setDots = function() {\n // get difference between number of slides and number of dots\n var delta = this.parent.slides.length - this.dots.length;\n if ( delta > 0 ) {\n this.addDots( delta );\n } else if ( delta < 0 ) {\n this.removeDots( -delta );\n }\n};\n\nPageDots.prototype.addDots = function( count ) {\n var fragment = document.createDocumentFragment();\n var newDots = [];\n var length = this.dots.length;\n var max = length + count;\n\n for ( var i = length; i < max; i++ ) {\n var dot = document.createElement('li');\n dot.className = 'dot';\n dot.setAttribute( 'aria-label', 'Page dot ' + ( i + 1 ) );\n fragment.appendChild( dot );\n newDots.push( dot );\n }\n\n this.holder.appendChild( fragment );\n this.dots = this.dots.concat( newDots );\n};\n\nPageDots.prototype.removeDots = function( count ) {\n // remove from this.dots collection\n var removeDots = this.dots.splice( this.dots.length - count, count );\n // remove from DOM\n removeDots.forEach( function( dot ) {\n this.holder.removeChild( dot );\n }, this );\n};\n\nPageDots.prototype.updateSelected = function() {\n // remove selected class on previous\n if ( this.selectedDot ) {\n this.selectedDot.className = 'dot';\n this.selectedDot.removeAttribute('aria-current');\n }\n // don't proceed if no dots\n if ( !this.dots.length ) {\n return;\n }\n this.selectedDot = this.dots[ this.parent.selectedIndex ];\n this.selectedDot.className = 'dot is-selected';\n this.selectedDot.setAttribute( 'aria-current', 'step' );\n};\n\nPageDots.prototype.onTap = // old method name, backwards-compatible\nPageDots.prototype.onClick = function( event ) {\n var target = event.target;\n // only care about dot clicks\n if ( target.nodeName != 'LI' ) {\n return;\n }\n\n this.parent.uiChange();\n var index = this.dots.indexOf( target );\n this.parent.select( index );\n};\n\nPageDots.prototype.destroy = function() {\n this.deactivate();\n this.allOff();\n};\n\nFlickity.PageDots = PageDots;\n\n// -------------------------- Flickity -------------------------- //\n\nutils.extend( Flickity.defaults, {\n pageDots: true,\n} );\n\nFlickity.createMethods.push('_createPageDots');\n\nvar proto = Flickity.prototype;\n\nproto._createPageDots = function() {\n if ( !this.options.pageDots ) {\n return;\n }\n this.pageDots = new PageDots( this );\n // events\n this.on( 'activate', this.activatePageDots );\n this.on( 'select', this.updateSelectedPageDots );\n this.on( 'cellChange', this.updatePageDots );\n this.on( 'resize', this.updatePageDots );\n this.on( 'deactivate', this.deactivatePageDots );\n};\n\nproto.activatePageDots = function() {\n this.pageDots.activate();\n};\n\nproto.updateSelectedPageDots = function() {\n this.pageDots.updateSelected();\n};\n\nproto.updatePageDots = function() {\n this.pageDots.setDots();\n};\n\nproto.deactivatePageDots = function() {\n this.pageDots.deactivate();\n};\n\n// ----- ----- //\n\nFlickity.PageDots = PageDots;\n\nreturn Flickity;\n\n} ) );\n", "// player & autoPlay\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'ev-emitter/ev-emitter',\n 'fizzy-ui-utils/utils',\n './flickity',\n ], function( EvEmitter, utils, Flickity ) {\n return factory( EvEmitter, utils, Flickity );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n require('ev-emitter'),\n require('fizzy-ui-utils'),\n require('./flickity')\n );\n } else {\n // browser global\n factory(\n window.EvEmitter,\n window.fizzyUIUtils,\n window.Flickity\n );\n }\n\n}( window, function factory( EvEmitter, utils, Flickity ) {\n\n'use strict';\n\n// -------------------------- Player -------------------------- //\n\nfunction Player( parent ) {\n this.parent = parent;\n this.state = 'stopped';\n // visibility change event handler\n this.onVisibilityChange = this.visibilityChange.bind( this );\n this.onVisibilityPlay = this.visibilityPlay.bind( this );\n}\n\nPlayer.prototype = Object.create( EvEmitter.prototype );\n\n// start play\nPlayer.prototype.play = function() {\n if ( this.state == 'playing' ) {\n return;\n }\n // do not play if page is hidden, start playing when page is visible\n var isPageHidden = document.hidden;\n if ( isPageHidden ) {\n document.addEventListener( 'visibilitychange', this.onVisibilityPlay );\n return;\n }\n\n this.state = 'playing';\n // listen to visibility change\n document.addEventListener( 'visibilitychange', this.onVisibilityChange );\n // start ticking\n this.tick();\n};\n\nPlayer.prototype.tick = function() {\n // do not tick if not playing\n if ( this.state != 'playing' ) {\n return;\n }\n\n var time = this.parent.options.autoPlay;\n // default to 3 seconds\n time = typeof time == 'number' ? time : 3000;\n var _this = this;\n // HACK: reset ticks if stopped and started within interval\n this.clear();\n this.timeout = setTimeout( function() {\n _this.parent.next( true );\n _this.tick();\n }, time );\n};\n\nPlayer.prototype.stop = function() {\n this.state = 'stopped';\n this.clear();\n // remove visibility change event\n document.removeEventListener( 'visibilitychange', this.onVisibilityChange );\n};\n\nPlayer.prototype.clear = function() {\n clearTimeout( this.timeout );\n};\n\nPlayer.prototype.pause = function() {\n if ( this.state == 'playing' ) {\n this.state = 'paused';\n this.clear();\n }\n};\n\nPlayer.prototype.unpause = function() {\n // re-start play if paused\n if ( this.state == 'paused' ) {\n this.play();\n }\n};\n\n// pause if page visibility is hidden, unpause if visible\nPlayer.prototype.visibilityChange = function() {\n var isPageHidden = document.hidden;\n this[ isPageHidden ? 'pause' : 'unpause' ]();\n};\n\nPlayer.prototype.visibilityPlay = function() {\n this.play();\n document.removeEventListener( 'visibilitychange', this.onVisibilityPlay );\n};\n\n// -------------------------- Flickity -------------------------- //\n\nutils.extend( Flickity.defaults, {\n pauseAutoPlayOnHover: true,\n} );\n\nFlickity.createMethods.push('_createPlayer');\nvar proto = Flickity.prototype;\n\nproto._createPlayer = function() {\n this.player = new Player( this );\n\n this.on( 'activate', this.activatePlayer );\n this.on( 'uiChange', this.stopPlayer );\n this.on( 'pointerDown', this.stopPlayer );\n this.on( 'deactivate', this.deactivatePlayer );\n};\n\nproto.activatePlayer = function() {\n if ( !this.options.autoPlay ) {\n return;\n }\n this.player.play();\n this.element.addEventListener( 'mouseenter', this );\n};\n\n// Player API, don't hate the ... thanks I know where the door is\n\nproto.playPlayer = function() {\n this.player.play();\n};\n\nproto.stopPlayer = function() {\n this.player.stop();\n};\n\nproto.pausePlayer = function() {\n this.player.pause();\n};\n\nproto.unpausePlayer = function() {\n this.player.unpause();\n};\n\nproto.deactivatePlayer = function() {\n this.player.stop();\n this.element.removeEventListener( 'mouseenter', this );\n};\n\n// ----- mouseenter/leave ----- //\n\n// pause auto-play on hover\nproto.onmouseenter = function() {\n if ( !this.options.pauseAutoPlayOnHover ) {\n return;\n }\n this.player.pause();\n this.element.addEventListener( 'mouseleave', this );\n};\n\n// resume auto-play on hover off\nproto.onmouseleave = function() {\n this.player.unpause();\n this.element.removeEventListener( 'mouseleave', this );\n};\n\n// ----- ----- //\n\nFlickity.Player = Player;\n\nreturn Flickity;\n\n} ) );\n", "// add, remove cell\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n './flickity',\n 'fizzy-ui-utils/utils',\n ], function( Flickity, utils ) {\n return factory( window, Flickity, utils );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('./flickity'),\n require('fizzy-ui-utils')\n );\n } else {\n // browser global\n factory(\n window,\n window.Flickity,\n window.fizzyUIUtils\n );\n }\n\n}( window, function factory( window, Flickity, utils ) {\n\n'use strict';\n\n// append cells to a document fragment\nfunction getCellsFragment( cells ) {\n var fragment = document.createDocumentFragment();\n cells.forEach( function( cell ) {\n fragment.appendChild( cell.element );\n } );\n return fragment;\n}\n\n// -------------------------- add/remove cell prototype -------------------------- //\n\nvar proto = Flickity.prototype;\n\n/**\n * Insert, prepend, or append cells\n * @param {[Element, Array, NodeList]} elems - Elements to insert\n * @param {Integer} index - Zero-based number to insert\n */\nproto.insert = function( elems, index ) {\n var cells = this._makeCells( elems );\n if ( !cells || !cells.length ) {\n return;\n }\n var len = this.cells.length;\n // default to append\n index = index === undefined ? len : index;\n // add cells with document fragment\n var fragment = getCellsFragment( cells );\n // append to slider\n var isAppend = index == len;\n if ( isAppend ) {\n this.slider.appendChild( fragment );\n } else {\n var insertCellElement = this.cells[ index ].element;\n this.slider.insertBefore( fragment, insertCellElement );\n }\n // add to this.cells\n if ( index === 0 ) {\n // prepend, add to start\n this.cells = cells.concat( this.cells );\n } else if ( isAppend ) {\n // append, add to end\n this.cells = this.cells.concat( cells );\n } else {\n // insert in this.cells\n var endCells = this.cells.splice( index, len - index );\n this.cells = this.cells.concat( cells ).concat( endCells );\n }\n\n this._sizeCells( cells );\n this.cellChange( index, true );\n};\n\nproto.append = function( elems ) {\n this.insert( elems, this.cells.length );\n};\n\nproto.prepend = function( elems ) {\n this.insert( elems, 0 );\n};\n\n/**\n * Remove cells\n * @param {[Element, Array, NodeList]} elems - ELements to remove\n */\nproto.remove = function( elems ) {\n var cells = this.getCells( elems );\n if ( !cells || !cells.length ) {\n return;\n }\n\n var minCellIndex = this.cells.length - 1;\n // remove cells from collection & DOM\n cells.forEach( function( cell ) {\n cell.remove();\n var index = this.cells.indexOf( cell );\n minCellIndex = Math.min( index, minCellIndex );\n utils.removeFrom( this.cells, cell );\n }, this );\n\n this.cellChange( minCellIndex, true );\n};\n\n/**\n * logic to be run after a cell's size changes\n * @param {Element} elem - cell's element\n */\nproto.cellSizeChange = function( elem ) {\n var cell = this.getCell( elem );\n if ( !cell ) {\n return;\n }\n cell.getSize();\n\n var index = this.cells.indexOf( cell );\n this.cellChange( index );\n};\n\n/**\n * logic any time a cell is changed: added, removed, or size changed\n * @param {Integer} changedCellIndex - index of the changed cell, optional\n * @param {Boolean} isPositioningSlider - Positions slider after selection\n */\nproto.cellChange = function( changedCellIndex, isPositioningSlider ) {\n var prevSelectedElem = this.selectedElement;\n this._positionCells( changedCellIndex );\n this._getWrapShiftCells();\n this.setGallerySize();\n // update selectedIndex\n // try to maintain position & select previous selected element\n var cell = this.getCell( prevSelectedElem );\n if ( cell ) {\n this.selectedIndex = this.getCellSlideIndex( cell );\n }\n this.selectedIndex = Math.min( this.slides.length - 1, this.selectedIndex );\n\n this.emitEvent( 'cellChange', [ changedCellIndex ] );\n // position slider\n this.select( this.selectedIndex );\n // do not position slider after lazy load\n if ( isPositioningSlider ) {\n this.positionSliderAtSelected();\n }\n};\n\n// ----- ----- //\n\nreturn Flickity;\n\n} ) );\n", "// lazyload\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n './flickity',\n 'fizzy-ui-utils/utils',\n ], function( Flickity, utils ) {\n return factory( window, Flickity, utils );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('./flickity'),\n require('fizzy-ui-utils')\n );\n } else {\n // browser global\n factory(\n window,\n window.Flickity,\n window.fizzyUIUtils\n );\n }\n\n}( window, function factory( window, Flickity, utils ) {\n'use strict';\n\nFlickity.createMethods.push('_createLazyload');\nvar proto = Flickity.prototype;\n\nproto._createLazyload = function() {\n this.on( 'select', this.lazyLoad );\n};\n\nproto.lazyLoad = function() {\n var lazyLoad = this.options.lazyLoad;\n if ( !lazyLoad ) {\n return;\n }\n // get adjacent cells, use lazyLoad option for adjacent count\n var adjCount = typeof lazyLoad == 'number' ? lazyLoad : 0;\n var cellElems = this.getAdjacentCellElements( adjCount );\n // get lazy images in those cells\n var lazyImages = [];\n cellElems.forEach( function( cellElem ) {\n var lazyCellImages = getCellLazyImages( cellElem );\n lazyImages = lazyImages.concat( lazyCellImages );\n } );\n // load lazy images\n lazyImages.forEach( function( img ) {\n new LazyLoader( img, this );\n }, this );\n};\n\nfunction getCellLazyImages( cellElem ) {\n // check if cell element is lazy image\n if ( cellElem.nodeName == 'IMG' ) {\n var lazyloadAttr = cellElem.getAttribute('data-flickity-lazyload');\n var srcAttr = cellElem.getAttribute('data-flickity-lazyload-src');\n var srcsetAttr = cellElem.getAttribute('data-flickity-lazyload-srcset');\n if ( lazyloadAttr || srcAttr || srcsetAttr ) {\n return [ cellElem ];\n }\n }\n // select lazy images in cell\n var lazySelector = 'img[data-flickity-lazyload], ' +\n 'img[data-flickity-lazyload-src], img[data-flickity-lazyload-srcset]';\n var imgs = cellElem.querySelectorAll( lazySelector );\n return utils.makeArray( imgs );\n}\n\n// -------------------------- LazyLoader -------------------------- //\n\n/**\n * class to handle loading images\n * @param {Image} img - Image element\n * @param {Flickity} flickity - Flickity instance\n */\nfunction LazyLoader( img, flickity ) {\n this.img = img;\n this.flickity = flickity;\n this.load();\n}\n\nLazyLoader.prototype.handleEvent = utils.handleEvent;\n\nLazyLoader.prototype.load = function() {\n this.img.addEventListener( 'load', this );\n this.img.addEventListener( 'error', this );\n // get src & srcset\n var src = this.img.getAttribute('data-flickity-lazyload') ||\n this.img.getAttribute('data-flickity-lazyload-src');\n var srcset = this.img.getAttribute('data-flickity-lazyload-srcset');\n // set src & serset\n this.img.src = src;\n if ( srcset ) {\n this.img.setAttribute( 'srcset', srcset );\n }\n // remove attr\n this.img.removeAttribute('data-flickity-lazyload');\n this.img.removeAttribute('data-flickity-lazyload-src');\n this.img.removeAttribute('data-flickity-lazyload-srcset');\n};\n\nLazyLoader.prototype.onload = function( event ) {\n this.complete( event, 'flickity-lazyloaded' );\n};\n\nLazyLoader.prototype.onerror = function( event ) {\n this.complete( event, 'flickity-lazyerror' );\n};\n\nLazyLoader.prototype.complete = function( event, className ) {\n // unbind events\n this.img.removeEventListener( 'load', this );\n this.img.removeEventListener( 'error', this );\n\n var cell = this.flickity.getParentCell( this.img );\n var cellElem = cell && cell.element;\n this.flickity.cellSizeChange( cellElem );\n\n this.img.classList.add( className );\n this.flickity.dispatchEvent( 'lazyLoad', event, cellElem );\n};\n\n// ----- ----- //\n\nFlickity.LazyLoader = LazyLoader;\n\nreturn Flickity;\n\n} ) );\n", "/*!\n * Flickity v2.3.0\n * Touch, responsive, flickable carousels\n *\n * Licensed GPLv3 for open source use\n * or Flickity Commercial License for commercial use\n *\n * https://flickity.metafizzy.co\n * Copyright 2015-2021 Metafizzy\n */\n\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n './flickity',\n './drag',\n './prev-next-button',\n './page-dots',\n './player',\n './add-remove-cell',\n './lazyload',\n ], factory );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n require('./flickity'),\n require('./drag'),\n require('./prev-next-button'),\n require('./page-dots'),\n require('./player'),\n require('./add-remove-cell'),\n require('./lazyload')\n );\n }\n\n} )( window, function factory( Flickity ) {\n return Flickity;\n} );\n", "(function() {\n document.addEventListener('click', function(e) {\n if (e.target.hasAttribute('data-link-to-remove-field')) {\n e.preventDefault();\n var input = e.target.previousElementSibling;\n input.value = '1';\n var target = e.target.getAttribute('data-link-to-remove-field');\n var field = e.target.closest(target);\n field.style.display = 'none';\n } else if (e.target.hasAttribute('data-link-to-add-field')) {\n e.preventDefault();\n var fields_html, regexp, time;\n time = new Date().getTime();\n regexp = new RegExp(e.target.getAttribute('data-link-to-add-field-id'), 'g');\n fields_html = e.target.getAttribute('data-link-to-add-field').replace(regexp, time);\n e.target.insertAdjacentHTML('beforebegin', fields_html);\n }\n });\n}).call(this);", "\"use strict\";\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 _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\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 _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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\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\n/*\n *\n * More info at [www.dropzonejs.com](http://www.dropzonejs.com)\n *\n * Copyright (c) 2012, Matias Meno\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n */\n// The Emitter class provides the ability to call `.on()` on Dropzone to listen\n// to events.\n// It is strongly based on component's emitter class, and I removed the\n// functionality because of the dependency hell with different frameworks.\nvar Emitter =\n/*#__PURE__*/\nfunction () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n }\n\n _createClass(Emitter, [{\n key: \"on\",\n // Add an event listener for given event\n value: function on(event, fn) {\n this._callbacks = this._callbacks || {}; // Create namespace for this event\n\n if (!this._callbacks[event]) {\n this._callbacks[event] = [];\n }\n\n this._callbacks[event].push(fn);\n\n return this;\n }\n }, {\n key: \"emit\",\n value: function emit(event) {\n this._callbacks = this._callbacks || {};\n var callbacks = this._callbacks[event];\n\n if (callbacks) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = callbacks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var callback = _step.value;\n callback.apply(this, args);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator[\"return\"] != null) {\n _iterator[\"return\"]();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n\n return this;\n } // Remove event listener for given event. If fn is not provided, all event\n // listeners for that event will be removed. If neither is provided, all\n // event listeners will be removed.\n\n }, {\n key: \"off\",\n value: function off(event, fn) {\n if (!this._callbacks || arguments.length === 0) {\n this._callbacks = {};\n return this;\n } // specific event\n\n\n var callbacks = this._callbacks[event];\n\n if (!callbacks) {\n return this;\n } // remove all handlers\n\n\n if (arguments.length === 1) {\n delete this._callbacks[event];\n return this;\n } // remove specific handler\n\n\n for (var i = 0; i < callbacks.length; i++) {\n var callback = callbacks[i];\n\n if (callback === fn) {\n callbacks.splice(i, 1);\n break;\n }\n }\n\n return this;\n }\n }]);\n\n return Emitter;\n}();\n\nvar Dropzone =\n/*#__PURE__*/\nfunction (_Emitter) {\n _inherits(Dropzone, _Emitter);\n\n _createClass(Dropzone, null, [{\n key: \"initClass\",\n value: function initClass() {\n // Exposing the emitter class, mainly for tests\n this.prototype.Emitter = Emitter;\n /*\n This is a list of all available events you can register on a dropzone object.\n You can register an event handler like this:\n dropzone.on(\"dragEnter\", function() { });\n */\n\n this.prototype.events = [\"drop\", \"dragstart\", \"dragend\", \"dragenter\", \"dragover\", \"dragleave\", \"addedfile\", \"addedfiles\", \"removedfile\", \"thumbnail\", \"error\", \"errormultiple\", \"processing\", \"processingmultiple\", \"uploadprogress\", \"totaluploadprogress\", \"sending\", \"sendingmultiple\", \"success\", \"successmultiple\", \"canceled\", \"canceledmultiple\", \"complete\", \"completemultiple\", \"reset\", \"maxfilesexceeded\", \"maxfilesreached\", \"queuecomplete\"];\n this.prototype.defaultOptions = {\n /**\n * Has to be specified on elements other than form (or when the form\n * doesn't have an `action` attribute). You can also\n * provide a function that will be called with `files` and\n * must return the url (since `v3.12.0`)\n */\n url: null,\n\n /**\n * Can be changed to `\"put\"` if necessary. You can also provide a function\n * that will be called with `files` and must return the method (since `v3.12.0`).\n */\n method: \"post\",\n\n /**\n * Will be set on the XHRequest.\n */\n withCredentials: false,\n\n /**\n * The timeout for the XHR requests in milliseconds (since `v4.4.0`).\n */\n timeout: 30000,\n\n /**\n * How many file uploads to process in parallel (See the\n * Enqueuing file uploads documentation section for more info)\n */\n parallelUploads: 2,\n\n /**\n * Whether to send multiple files in one request. If\n * this it set to true, then the fallback file input element will\n * have the `multiple` attribute as well. This option will\n * also trigger additional events (like `processingmultiple`). See the events\n * documentation section for more information.\n */\n uploadMultiple: false,\n\n /**\n * Whether you want files to be uploaded in chunks to your server. This can't be\n * used in combination with `uploadMultiple`.\n *\n * See [chunksUploaded](#config-chunksUploaded) for the callback to finalise an upload.\n */\n chunking: false,\n\n /**\n * If `chunking` is enabled, this defines whether **every** file should be chunked,\n * even if the file size is below chunkSize. This means, that the additional chunk\n * form data will be submitted and the `chunksUploaded` callback will be invoked.\n */\n forceChunking: false,\n\n /**\n * If `chunking` is `true`, then this defines the chunk size in bytes.\n */\n chunkSize: 2000000,\n\n /**\n * If `true`, the individual chunks of a file are being uploaded simultaneously.\n */\n parallelChunkUploads: false,\n\n /**\n * Whether a chunk should be retried if it fails.\n */\n retryChunks: false,\n\n /**\n * If `retryChunks` is true, how many times should it be retried.\n */\n retryChunksLimit: 3,\n\n /**\n * If not `null` defines how many files this Dropzone handles. If it exceeds,\n * the event `maxfilesexceeded` will be called. The dropzone element gets the\n * class `dz-max-files-reached` accordingly so you can provide visual feedback.\n */\n maxFilesize: 256,\n\n /**\n * The name of the file param that gets transferred.\n * **NOTE**: If you have the option `uploadMultiple` set to `true`, then\n * Dropzone will append `[]` to the name.\n */\n paramName: \"file\",\n\n /**\n * Whether thumbnails for images should be generated\n */\n createImageThumbnails: true,\n\n /**\n * In MB. When the filename exceeds this limit, the thumbnail will not be generated.\n */\n maxThumbnailFilesize: 10,\n\n /**\n * If `null`, the ratio of the image will be used to calculate it.\n */\n thumbnailWidth: 120,\n\n /**\n * The same as `thumbnailWidth`. If both are null, images will not be resized.\n */\n thumbnailHeight: 120,\n\n /**\n * How the images should be scaled down in case both, `thumbnailWidth` and `thumbnailHeight` are provided.\n * Can be either `contain` or `crop`.\n */\n thumbnailMethod: 'crop',\n\n /**\n * If set, images will be resized to these dimensions before being **uploaded**.\n * If only one, `resizeWidth` **or** `resizeHeight` is provided, the original aspect\n * ratio of the file will be preserved.\n *\n * The `options.transformFile` function uses these options, so if the `transformFile` function\n * is overridden, these options don't do anything.\n */\n resizeWidth: null,\n\n /**\n * See `resizeWidth`.\n */\n resizeHeight: null,\n\n /**\n * The mime type of the resized image (before it gets uploaded to the server).\n * If `null` the original mime type will be used. To force jpeg, for example, use `image/jpeg`.\n * See `resizeWidth` for more information.\n */\n resizeMimeType: null,\n\n /**\n * The quality of the resized images. See `resizeWidth`.\n */\n resizeQuality: 0.8,\n\n /**\n * How the images should be scaled down in case both, `resizeWidth` and `resizeHeight` are provided.\n * Can be either `contain` or `crop`.\n */\n resizeMethod: 'contain',\n\n /**\n * The base that is used to calculate the filesize. You can change this to\n * 1024 if you would rather display kibibytes, mebibytes, etc...\n * 1024 is technically incorrect, because `1024 bytes` are `1 kibibyte` not `1 kilobyte`.\n * You can change this to `1024` if you don't care about validity.\n */\n filesizeBase: 1000,\n\n /**\n * Can be used to limit the maximum number of files that will be handled by this Dropzone\n */\n maxFiles: null,\n\n /**\n * An optional object to send additional headers to the server. Eg:\n * `{ \"My-Awesome-Header\": \"header value\" }`\n */\n headers: null,\n\n /**\n * If `true`, the dropzone element itself will be clickable, if `false`\n * nothing will be clickable.\n *\n * You can also pass an HTML element, a CSS selector (for multiple elements)\n * or an array of those. In that case, all of those elements will trigger an\n * upload when clicked.\n */\n clickable: true,\n\n /**\n * Whether hidden files in directories should be ignored.\n */\n ignoreHiddenFiles: true,\n\n /**\n * The default implementation of `accept` checks the file's mime type or\n * extension against this list. This is a comma separated list of mime\n * types or file extensions.\n *\n * Eg.: `image/*,application/pdf,.psd`\n *\n * If the Dropzone is `clickable` this option will also be used as\n * [`accept`](https://developer.mozilla.org/en-US/docs/HTML/Element/input#attr-accept)\n * parameter on the hidden file input as well.\n */\n acceptedFiles: null,\n\n /**\n * **Deprecated!**\n * Use acceptedFiles instead.\n */\n acceptedMimeTypes: null,\n\n /**\n * If false, files will be added to the queue but the queue will not be\n * processed automatically.\n * This can be useful if you need some additional user input before sending\n * files (or if you want want all files sent at once).\n * If you're ready to send the file simply call `myDropzone.processQueue()`.\n *\n * See the [enqueuing file uploads](#enqueuing-file-uploads) documentation\n * section for more information.\n */\n autoProcessQueue: true,\n\n /**\n * If false, files added to the dropzone will not be queued by default.\n * You'll have to call `enqueueFile(file)` manually.\n */\n autoQueue: true,\n\n /**\n * If `true`, this will add a link to every file preview to remove or cancel (if\n * already uploading) the file. The `dictCancelUpload`, `dictCancelUploadConfirmation`\n * and `dictRemoveFile` options are used for the wording.\n */\n addRemoveLinks: false,\n\n /**\n * Defines where to display the file previews \u2013 if `null` the\n * Dropzone element itself is used. Can be a plain `HTMLElement` or a CSS\n * selector. The element should have the `dropzone-previews` class so\n * the previews are displayed properly.\n */\n previewsContainer: null,\n\n /**\n * This is the element the hidden input field (which is used when clicking on the\n * dropzone to trigger file selection) will be appended to. This might\n * be important in case you use frameworks to switch the content of your page.\n *\n * Can be a selector string, or an element directly.\n */\n hiddenInputContainer: \"body\",\n\n /**\n * If null, no capture type will be specified\n * If camera, mobile devices will skip the file selection and choose camera\n * If microphone, mobile devices will skip the file selection and choose the microphone\n * If camcorder, mobile devices will skip the file selection and choose the camera in video mode\n * On apple devices multiple must be set to false. AcceptedFiles may need to\n * be set to an appropriate mime type (e.g. \"image/*\", \"audio/*\", or \"video/*\").\n */\n capture: null,\n\n /**\n * **Deprecated**. Use `renameFile` instead.\n */\n renameFilename: null,\n\n /**\n * A function that is invoked before the file is uploaded to the server and renames the file.\n * This function gets the `File` as argument and can use the `file.name`. The actual name of the\n * file that gets used during the upload can be accessed through `file.upload.filename`.\n */\n renameFile: null,\n\n /**\n * If `true` the fallback will be forced. This is very useful to test your server\n * implementations first and make sure that everything works as\n * expected without dropzone if you experience problems, and to test\n * how your fallbacks will look.\n */\n forceFallback: false,\n\n /**\n * The text used before any files are dropped.\n */\n dictDefaultMessage: \"Drop files here to upload\",\n\n /**\n * The text that replaces the default message text it the browser is not supported.\n */\n dictFallbackMessage: \"Your browser does not support drag'n'drop file uploads.\",\n\n /**\n * The text that will be added before the fallback form.\n * If you provide a fallback element yourself, or if this option is `null` this will\n * be ignored.\n */\n dictFallbackText: \"Please use the fallback form below to upload your files like in the olden days.\",\n\n /**\n * If the filesize is too big.\n * `{{filesize}}` and `{{maxFilesize}}` will be replaced with the respective configuration values.\n */\n dictFileTooBig: \"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.\",\n\n /**\n * If the file doesn't match the file type.\n */\n dictInvalidFileType: \"You can't upload files of this type.\",\n\n /**\n * If the server response was invalid.\n * `{{statusCode}}` will be replaced with the servers status code.\n */\n dictResponseError: \"Server responded with {{statusCode}} code.\",\n\n /**\n * If `addRemoveLinks` is true, the text to be used for the cancel upload link.\n */\n dictCancelUpload: \"Cancel upload\",\n\n /**\n * The text that is displayed if an upload was manually canceled\n */\n dictUploadCanceled: \"Upload canceled.\",\n\n /**\n * If `addRemoveLinks` is true, the text to be used for confirmation when cancelling upload.\n */\n dictCancelUploadConfirmation: \"Are you sure you want to cancel this upload?\",\n\n /**\n * If `addRemoveLinks` is true, the text to be used to remove a file.\n */\n dictRemoveFile: \"Remove file\",\n\n /**\n * If this is not null, then the user will be prompted before removing a file.\n */\n dictRemoveFileConfirmation: null,\n\n /**\n * Displayed if `maxFiles` is st and exceeded.\n * The string `{{maxFiles}}` will be replaced by the configuration value.\n */\n dictMaxFilesExceeded: \"You can not upload any more files.\",\n\n /**\n * Allows you to translate the different units. Starting with `tb` for terabytes and going down to\n * `b` for bytes.\n */\n dictFileSizeUnits: {\n tb: \"TB\",\n gb: \"GB\",\n mb: \"MB\",\n kb: \"KB\",\n b: \"b\"\n },\n\n /**\n * Called when dropzone initialized\n * You can add event listeners here\n */\n init: function init() {},\n\n /**\n * Can be an **object** of additional parameters to transfer to the server, **or** a `Function`\n * that gets invoked with the `files`, `xhr` and, if it's a chunked upload, `chunk` arguments. In case\n * of a function, this needs to return a map.\n *\n * The default implementation does nothing for normal uploads, but adds relevant information for\n * chunked uploads.\n *\n * This is the same as adding hidden input fields in the form element.\n */\n params: function params(files, xhr, chunk) {\n if (chunk) {\n return {\n dzuuid: chunk.file.upload.uuid,\n dzchunkindex: chunk.index,\n dztotalfilesize: chunk.file.size,\n dzchunksize: this.options.chunkSize,\n dztotalchunkcount: chunk.file.upload.totalChunkCount,\n dzchunkbyteoffset: chunk.index * this.options.chunkSize\n };\n }\n },\n\n /**\n * A function that gets a [file](https://developer.mozilla.org/en-US/docs/DOM/File)\n * and a `done` function as parameters.\n *\n * If the done function is invoked without arguments, the file is \"accepted\" and will\n * be processed. If you pass an error message, the file is rejected, and the error\n * message will be displayed.\n * This function will not be called if the file is too big or doesn't match the mime types.\n */\n accept: function accept(file, done) {\n return done();\n },\n\n /**\n * The callback that will be invoked when all chunks have been uploaded for a file.\n * It gets the file for which the chunks have been uploaded as the first parameter,\n * and the `done` function as second. `done()` needs to be invoked when everything\n * needed to finish the upload process is done.\n */\n chunksUploaded: function chunksUploaded(file, done) {\n done();\n },\n\n /**\n * Gets called when the browser is not supported.\n * The default implementation shows the fallback input field and adds\n * a text.\n */\n fallback: function fallback() {\n // This code should pass in IE7... :(\n var messageElement;\n this.element.className = \"\".concat(this.element.className, \" dz-browser-not-supported\");\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = this.element.getElementsByTagName(\"div\")[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var child = _step2.value;\n\n if (/(^| )dz-message($| )/.test(child.className)) {\n messageElement = child;\n child.className = \"dz-message\"; // Removes the 'dz-default' class\n\n break;\n }\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2[\"return\"] != null) {\n _iterator2[\"return\"]();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n\n if (!messageElement) {\n messageElement = Dropzone.createElement(\"
\");\n this.element.appendChild(messageElement);\n }\n\n var span = messageElement.getElementsByTagName(\"span\")[0];\n\n if (span) {\n if (span.textContent != null) {\n span.textContent = this.options.dictFallbackMessage;\n } else if (span.innerText != null) {\n span.innerText = this.options.dictFallbackMessage;\n }\n }\n\n return this.element.appendChild(this.getFallbackForm());\n },\n\n /**\n * Gets called to calculate the thumbnail dimensions.\n *\n * It gets `file`, `width` and `height` (both may be `null`) as parameters and must return an object containing:\n *\n * - `srcWidth` & `srcHeight` (required)\n * - `trgWidth` & `trgHeight` (required)\n * - `srcX` & `srcY` (optional, default `0`)\n * - `trgX` & `trgY` (optional, default `0`)\n *\n * Those values are going to be used by `ctx.drawImage()`.\n */\n resize: function resize(file, width, height, resizeMethod) {\n var info = {\n srcX: 0,\n srcY: 0,\n srcWidth: file.width,\n srcHeight: file.height\n };\n var srcRatio = file.width / file.height; // Automatically calculate dimensions if not specified\n\n if (width == null && height == null) {\n width = info.srcWidth;\n height = info.srcHeight;\n } else if (width == null) {\n width = height * srcRatio;\n } else if (height == null) {\n height = width / srcRatio;\n } // Make sure images aren't upscaled\n\n\n width = Math.min(width, info.srcWidth);\n height = Math.min(height, info.srcHeight);\n var trgRatio = width / height;\n\n if (info.srcWidth > width || info.srcHeight > height) {\n // Image is bigger and needs rescaling\n if (resizeMethod === 'crop') {\n if (srcRatio > trgRatio) {\n info.srcHeight = file.height;\n info.srcWidth = info.srcHeight * trgRatio;\n } else {\n info.srcWidth = file.width;\n info.srcHeight = info.srcWidth / trgRatio;\n }\n } else if (resizeMethod === 'contain') {\n // Method 'contain'\n if (srcRatio > trgRatio) {\n height = width / srcRatio;\n } else {\n width = height * srcRatio;\n }\n } else {\n throw new Error(\"Unknown resizeMethod '\".concat(resizeMethod, \"'\"));\n }\n }\n\n info.srcX = (file.width - info.srcWidth) / 2;\n info.srcY = (file.height - info.srcHeight) / 2;\n info.trgWidth = width;\n info.trgHeight = height;\n return info;\n },\n\n /**\n * Can be used to transform the file (for example, resize an image if necessary).\n *\n * The default implementation uses `resizeWidth` and `resizeHeight` (if provided) and resizes\n * images according to those dimensions.\n *\n * Gets the `file` as the first parameter, and a `done()` function as the second, that needs\n * to be invoked with the file when the transformation is done.\n */\n transformFile: function transformFile(file, done) {\n if ((this.options.resizeWidth || this.options.resizeHeight) && file.type.match(/image.*/)) {\n return this.resizeImage(file, this.options.resizeWidth, this.options.resizeHeight, this.options.resizeMethod, done);\n } else {\n return done(file);\n }\n },\n\n /**\n * A string that contains the template used for each dropped\n * file. Change it to fulfill your needs but make sure to properly\n * provide all elements.\n *\n * If you want to use an actual HTML element instead of providing a String\n * as a config option, you could create a div with the id `tpl`,\n * put the template inside it and provide the element like this:\n *\n * document\n * .querySelector('#tpl')\n * .innerHTML\n *\n */\n previewTemplate: \"\".concat(this.options.dictFallbackText, \"
\");\n }\n\n fieldsString += \"