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AMuC,aAAagC,IACZ,CAET,CAEEwD,YAAW,WAAY/H,EAAMkF,oBAAoBX,EAAO,GAAG,GAE/D,IAEArE,EAAUgH,GAAG,cAAelH,EAAMQ,wBAAwB,SAASoB,GACjE,IAAImB,EAASjD,EAAEuF,MAEf,IAAKrF,EAAM2F,YAAY5C,GAAS,OAAO/C,EAAM8G,eAAelF,GAG5D,IAAIF,EAAOqB,EAAO/B,KAAK,QACrBW,EAAOD,EAAO,CAACA,KAAKA,EAAMuG,MAAMlF,EAAOxB,OAAS,KAE9CgD,EAAOxB,EAAOmF,QAAQ,QACN,IAAhB3D,EAAKoC,SACPpC,EAAOzE,EAAE,IAAMiD,EAAO/B,KAAK,UAE7BuD,EAAK5C,KAAK,oBAAqBA,GAG/B4C,EAAK5C,KAAK,4BAA6BoB,EAAO/B,KAAK,mBACnDuD,EAAK5C,KAAK,+BAAgCoB,EAAO/B,KAAK,eACtDuD,EAAK5C,KAAK,+BAAgCoB,EAAO/B,KAAK,cACxD,IAEAd,EAAUgH,GAAG,kBAAmBlH,EAAMO,oBAAoB,SAASqB,GAC7DyD,OAASzD,EAAM0C,QAAQtE,EAAMkF,oBAAoBpF,EAAEuF,MACzD,IAEAnF,EAAUgH,GAAG,sBAAuBlH,EAAMO,oBAAoB,SAASqB,GACjEyD,OAASzD,EAAM0C,QAAQtE,EAAMwF,mBAAmB1F,EAAEuF,MACxD,IAEAvF,GAAE,WACAE,EAAMsB,mBACR,IAGF,EAEIiG,OAAOY,OACTtI,EAAcsI,GAEdC,EAAOC,QAAUxI,CAEpB,CAxiBD,E","sources":["webpack://elvis/./node_modules/jquery-ujs/src/rails.js"],"sourcesContent":["/* jshint node: true */\n\n/**\n * Unobtrusive scripting adapter for jQuery\n * https://github.com/rails/jquery-ujs\n *\n * Requires jQuery 1.8.0 or later.\n *\n * Released under the MIT license\n *\n */\n\n(function() {\n 'use strict';\n\n var jqueryUjsInit = function($, undefined) {\n\n // Cut down on the number of issues from people inadvertently including jquery_ujs twice\n // by detecting and raising an error when it happens.\n if ( $.rails !== undefined ) {\n $.error('jquery-ujs has already been loaded!');\n }\n\n // Shorthand to make it a little easier to call public rails functions from within rails.js\n var rails;\n var $document = $(document);\n\n $.rails = rails = {\n // Link elements bound by jquery-ujs\n linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',\n\n // Button elements bound by jquery-ujs\n buttonClickSelector: 'button[data-remote]:not([form]):not(form button), button[data-confirm]:not([form]):not(form button)',\n\n // Select elements bound by jquery-ujs\n inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',\n\n // Form elements bound by jquery-ujs\n formSubmitSelector: 'form:not([data-turbo=true])',\n\n // Form input elements bound by jquery-ujs\n formInputClickSelector: 'form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',\n\n // Form input elements disabled during form submission\n disableSelector: '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\n // Form input elements re-enabled after form submission\n enableSelector: '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\n // Form required input elements\n requiredInputSelector: 'input[name][required]:not([disabled]), textarea[name][required]:not([disabled])',\n\n // Form file input elements\n fileInputSelector: 'input[name][type=file]:not([disabled])',\n\n // Link onClick disable selector with possible reenable after remote submission\n linkDisableSelector: 'a[data-disable-with], a[data-disable]',\n\n // Button onClick disable selector with possible reenable after remote submission\n buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]',\n\n // Up-to-date Cross-Site Request Forgery token\n csrfToken: function() {\n return $('meta[name=csrf-token]').attr('content');\n },\n\n // URL param that must contain the CSRF token\n csrfParam: function() {\n return $('meta[name=csrf-param]').attr('content');\n },\n\n // Make sure that every Ajax request sends the CSRF token\n CSRFProtection: function(xhr) {\n var token = rails.csrfToken();\n if (token) xhr.setRequestHeader('X-CSRF-Token', token);\n },\n\n // Make sure that all forms have actual up-to-date tokens (cached forms contain old ones)\n refreshCSRFTokens: function(){\n $('form input[name=\"' + rails.csrfParam() + '\"]').val(rails.csrfToken());\n },\n\n // Triggers an event on an element and returns false if the event result is false\n fire: function(obj, name, data) {\n var event = $.Event(name);\n obj.trigger(event, data);\n return event.result !== false;\n },\n\n // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm\n confirm: function(message) {\n return confirm(message);\n },\n\n // Default ajax function, may be overridden with custom function in $.rails.ajax\n ajax: function(options) {\n return $.ajax(options);\n },\n\n // Default way to get an element's href. May be overridden at $.rails.href.\n href: function(element) {\n return element[0].href;\n },\n\n // Checks \"data-remote\" if true to handle the request through a XHR request.\n isRemote: function(element) {\n return element.data('remote') !== undefined && element.data('remote') !== false;\n },\n\n // Submits \"remote\" forms and links with ajax\n handleRemote: function(element) {\n var method, url, data, withCredentials, dataType, options;\n\n if (rails.fire(element, 'ajax:before')) {\n withCredentials = element.data('with-credentials') || null;\n dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);\n\n if (element.is('form')) {\n method = element.data('ujs:submit-button-formmethod') || element.attr('method');\n url = element.data('ujs:submit-button-formaction') || element.attr('action');\n data = $(element[0]).serializeArray();\n // memoized value from clicked submit button\n var button = element.data('ujs:submit-button');\n if (button) {\n data.push(button);\n element.data('ujs:submit-button', null);\n }\n element.data('ujs:submit-button-formmethod', null);\n element.data('ujs:submit-button-formaction', null);\n } else if (element.is(rails.inputChangeSelector)) {\n method = element.data('method');\n url = element.data('url');\n data = element.serialize();\n if (element.data('params')) data = data + '&' + element.data('params');\n } else if (element.is(rails.buttonClickSelector)) {\n method = element.data('method') || 'get';\n url = element.data('url');\n data = element.serialize();\n if (element.data('params')) data = data + '&' + element.data('params');\n } else {\n method = element.data('method');\n url = rails.href(element);\n data = element.data('params') || null;\n }\n\n options = {\n type: method || 'GET', data: data, dataType: dataType,\n // stopping the \"ajax:beforeSend\" event will cancel the ajax request\n beforeSend: function(xhr, settings) {\n if (settings.dataType === undefined) {\n xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);\n }\n if (rails.fire(element, 'ajax:beforeSend', [xhr, settings])) {\n element.trigger('ajax:send', xhr);\n } else {\n return false;\n }\n },\n success: function(data, status, xhr) {\n element.trigger('ajax:success', [data, status, xhr]);\n },\n complete: function(xhr, status) {\n element.trigger('ajax:complete', [xhr, status]);\n },\n error: function(xhr, status, error) {\n element.trigger('ajax:error', [xhr, status, error]);\n },\n crossDomain: rails.isCrossDomain(url)\n };\n\n // There is no withCredentials for IE6-8 when\n // \"Enable native XMLHTTP support\" is disabled\n if (withCredentials) {\n options.xhrFields = {\n withCredentials: withCredentials\n };\n }\n\n // Only pass url to `ajax` options if not blank\n if (url) { options.url = url; }\n\n return rails.ajax(options);\n } else {\n return false;\n }\n },\n\n // Determines if the request is a cross domain request.\n isCrossDomain: function(url) {\n var originAnchor = document.createElement('a');\n originAnchor.href = location.href;\n var urlAnchor = document.createElement('a');\n\n try {\n urlAnchor.href = url;\n // This is a workaround to a IE bug.\n urlAnchor.href = urlAnchor.href;\n\n // If URL protocol is false or is a string containing a single colon\n // *and* host are false, assume it is not a cross-domain request\n // (should only be the case for IE7 and IE compatibility mode).\n // Otherwise, evaluate protocol and host of the URL against the origin\n // protocol and host.\n return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) ||\n (originAnchor.protocol + '//' + originAnchor.host ===\n urlAnchor.protocol + '//' + urlAnchor.host));\n } catch (e) {\n // If there is an error parsing the URL, assume it is crossDomain.\n return true;\n }\n },\n\n // Handles \"data-method\" on links such as:\n // Delete\n handleMethod: function(link) {\n var href = rails.href(link),\n method = link.data('method'),\n target = link.attr('target'),\n csrfToken = rails.csrfToken(),\n csrfParam = rails.csrfParam(),\n form = $('
'),\n metadataInput = '';\n\n if (csrfParam !== undefined && csrfToken !== undefined && !rails.isCrossDomain(href)) {\n metadataInput += '';\n }\n\n if (target) { form.attr('target', target); }\n\n form.hide().append(metadataInput).appendTo('body');\n form.submit();\n },\n\n // Helper function that returns form elements that match the specified CSS selector\n // If form is actually a \"form\" element this will return associated elements outside the from that have\n // the html form attribute set\n formElements: function(form, selector) {\n return form.is('form') ? $(form[0].elements).filter(selector) : form.find(selector);\n },\n\n /* Disables form elements:\n - Caches element value in 'ujs:enable-with' data store\n - Replaces element text with value of 'data-disable-with' attribute\n - Sets disabled property to true\n */\n disableFormElements: function(form) {\n rails.formElements(form, rails.disableSelector).each(function() {\n rails.disableFormElement($(this));\n });\n },\n\n disableFormElement: function(element) {\n var method, replacement;\n\n method = element.is('button') ? 'html' : 'val';\n replacement = element.data('disable-with');\n\n if (replacement !== undefined) {\n element.data('ujs:enable-with', element[method]());\n element[method](replacement);\n }\n\n element.prop('disabled', true);\n element.data('ujs:disabled', true);\n },\n\n /* Re-enables disabled form elements:\n - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`)\n - Sets disabled property to false\n */\n enableFormElements: function(form) {\n rails.formElements(form, rails.enableSelector).each(function() {\n rails.enableFormElement($(this));\n });\n },\n\n enableFormElement: function(element) {\n var method = element.is('button') ? 'html' : 'val';\n if (element.data('ujs:enable-with') !== undefined) {\n element[method](element.data('ujs:enable-with'));\n element.removeData('ujs:enable-with'); // clean up cache\n }\n element.prop('disabled', false);\n element.removeData('ujs:disabled');\n },\n\n /* For 'data-confirm' attribute:\n - Fires `confirm` event\n - Shows the confirmation dialog\n - Fires the `confirm:complete` event\n\n Returns `true` if no function stops the chain and user chose yes; `false` otherwise.\n Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog.\n Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function\n return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog.\n */\n allowAction: function(element) {\n var message = element.data('confirm'),\n answer = false, callback;\n if (!message) { return true; }\n\n if (rails.fire(element, 'confirm')) {\n try {\n answer = rails.confirm(message);\n } catch (e) {\n (console.error || console.log).call(console, e.stack || e);\n }\n callback = rails.fire(element, 'confirm:complete', [answer]);\n }\n return answer && callback;\n },\n\n // Helper function which checks for blank inputs in a form that match the specified CSS selector\n blankInputs: function(form, specifiedSelector, nonBlank) {\n var foundInputs = $(),\n input,\n valueToCheck,\n radiosForNameWithNoneSelected,\n radioName,\n selector = specifiedSelector || 'input,textarea',\n requiredInputs = form.find(selector),\n checkedRadioButtonNames = {};\n\n requiredInputs.each(function() {\n input = $(this);\n if (input.is('input[type=radio]')) {\n\n // Don't count unchecked required radio as blank if other radio with same name is checked,\n // regardless of whether same-name radio input has required attribute or not. The spec\n // states https://www.w3.org/TR/html5/forms.html#the-required-attribute\n radioName = input.attr('name');\n\n // Skip if we've already seen the radio with this name.\n if (!checkedRadioButtonNames[radioName]) {\n\n // If none checked\n if (form.find('input[type=radio]:checked[name=\"' + radioName + '\"]').length === 0) {\n radiosForNameWithNoneSelected = form.find(\n 'input[type=radio][name=\"' + radioName + '\"]');\n foundInputs = foundInputs.add(radiosForNameWithNoneSelected);\n }\n\n // We only need to check each name once.\n checkedRadioButtonNames[radioName] = radioName;\n }\n } else {\n valueToCheck = input.is('input[type=checkbox],input[type=radio]') ? input.is(':checked') : !!input.val();\n if (valueToCheck === nonBlank) {\n foundInputs = foundInputs.add(input);\n }\n }\n });\n return foundInputs.length ? foundInputs : false;\n },\n\n // Helper function which checks for non-blank inputs in a form that match the specified CSS selector\n nonBlankInputs: function(form, specifiedSelector) {\n return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank\n },\n\n // Helper function, needed to provide consistent behavior in IE\n stopEverything: function(e) {\n $(e.target).trigger('ujs:everythingStopped');\n e.stopImmediatePropagation();\n return false;\n },\n\n // Replace element's html with the 'data-disable-with' after storing original html\n // and prevent clicking on it\n disableElement: function(element) {\n var replacement = element.data('disable-with');\n\n if (replacement !== undefined) {\n element.data('ujs:enable-with', element.html()); // store enabled state\n element.html(replacement);\n }\n\n element.on('click.railsDisable', function(e) { // prevent further clicking\n return rails.stopEverything(e);\n });\n element.data('ujs:disabled', true);\n },\n\n // Restore element to its original state which was disabled by 'disableElement' above\n enableElement: function(element) {\n if (element.data('ujs:enable-with') !== undefined) {\n element.html(element.data('ujs:enable-with')); // set to old enabled state\n element.removeData('ujs:enable-with'); // clean up cache\n }\n element.off('click.railsDisable'); // enable element\n element.removeData('ujs:disabled');\n }\n };\n\n if (rails.fire($document, 'rails:attachBindings')) {\n\n $.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }});\n\n // This event works the same as the load event, except that it fires every\n // time the page is loaded.\n //\n // See https://github.com/rails/jquery-ujs/issues/357\n // See https://developer.mozilla.org/en-US/docs/Using_Firefox_1.5_caching\n $(window).on('pageshow.rails', function () {\n $($.rails.enableSelector).each(function () {\n var element = $(this);\n\n if (element.data('ujs:disabled')) {\n $.rails.enableFormElement(element);\n }\n });\n\n $($.rails.linkDisableSelector).each(function () {\n var element = $(this);\n\n if (element.data('ujs:disabled')) {\n $.rails.enableElement(element);\n }\n });\n });\n\n $document.on('ajax:complete', rails.linkDisableSelector, function() {\n rails.enableElement($(this));\n });\n\n $document.on('ajax:complete', rails.buttonDisableSelector, function() {\n rails.enableFormElement($(this));\n });\n\n $document.on('click.rails', rails.linkClickSelector, function(e) {\n var link = $(this), method = link.data('method'), data = link.data('params'), metaClick = e.metaKey || e.ctrlKey;\n if (!rails.allowAction(link)) return rails.stopEverything(e);\n\n if (!metaClick && link.is(rails.linkDisableSelector)) rails.disableElement(link);\n\n if (rails.isRemote(link)) {\n if (metaClick && (!method || method === 'GET') && !data) { return true; }\n\n var handleRemote = rails.handleRemote(link);\n // Response from rails.handleRemote() will either be false or a deferred object promise.\n if (handleRemote === false) {\n rails.enableElement(link);\n } else {\n handleRemote.fail( function() { rails.enableElement(link); } );\n }\n return false;\n\n } else if (method) {\n rails.handleMethod(link);\n return false;\n }\n });\n\n $document.on('click.rails', rails.buttonClickSelector, function(e) {\n var button = $(this);\n\n if (!rails.allowAction(button) || !rails.isRemote(button)) return rails.stopEverything(e);\n\n if (button.is(rails.buttonDisableSelector)) rails.disableFormElement(button);\n\n var handleRemote = rails.handleRemote(button);\n // Response from rails.handleRemote() will either be false or a deferred object promise.\n if (handleRemote === false) {\n rails.enableFormElement(button);\n } else {\n handleRemote.fail( function() { rails.enableFormElement(button); } );\n }\n return false;\n });\n\n $document.on('change.rails', rails.inputChangeSelector, function(e) {\n var link = $(this);\n if (!rails.allowAction(link) || !rails.isRemote(link)) return rails.stopEverything(e);\n\n rails.handleRemote(link);\n return false;\n });\n\n $document.on('submit.rails', rails.formSubmitSelector, function(e) {\n var form = $(this),\n remote = rails.isRemote(form),\n blankRequiredInputs,\n nonBlankFileInputs;\n\n if (!rails.allowAction(form)) return rails.stopEverything(e);\n\n // Skip other logic when required values are missing or file upload is present\n if (form.attr('novalidate') === undefined) {\n if (form.data('ujs:formnovalidate-button') === undefined) {\n blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector, false);\n if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {\n return rails.stopEverything(e);\n }\n } else {\n // Clear the formnovalidate in case the next button click is not on a formnovalidate button\n // Not strictly necessary to do here, since it is also reset on each button click, but just to be certain\n form.data('ujs:formnovalidate-button', undefined);\n }\n }\n\n if (remote) {\n nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector);\n if (nonBlankFileInputs) {\n // Slight timeout so that the submit button gets properly serialized\n // (make it easy for event handler to serialize form without disabled values)\n setTimeout(function(){ rails.disableFormElements(form); }, 13);\n var aborted = rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]);\n\n // Re-enable form elements if event bindings return false (canceling normal form submission)\n if (!aborted) { setTimeout(function(){ rails.enableFormElements(form); }, 13); }\n\n return aborted;\n }\n\n rails.handleRemote(form);\n return false;\n\n } else {\n // Slight timeout so that the submit button gets properly serialized\n setTimeout(function(){ rails.disableFormElements(form); }, 13);\n }\n });\n\n $document.on('click.rails', rails.formInputClickSelector, function(event) {\n var button = $(this);\n\n if (!rails.allowAction(button)) return rails.stopEverything(event);\n\n // Register the pressed submit button\n var name = button.attr('name'),\n data = name ? {name:name, value:button.val()} : null;\n\n var form = button.closest('form');\n if (form.length === 0) {\n form = $('#' + button.attr('form'));\n }\n form.data('ujs:submit-button', data);\n\n // Save attributes from button\n form.data('ujs:formnovalidate-button', button.attr('formnovalidate'));\n form.data('ujs:submit-button-formaction', button.attr('formaction'));\n form.data('ujs:submit-button-formmethod', button.attr('formmethod'));\n });\n\n $document.on('ajax:send.rails', rails.formSubmitSelector, function(event) {\n if (this === event.target) rails.disableFormElements($(this));\n });\n\n $document.on('ajax:complete.rails', rails.formSubmitSelector, function(event) {\n if (this === event.target) rails.enableFormElements($(this));\n });\n\n $(function(){\n rails.refreshCSRFTokens();\n });\n }\n\n };\n\n if (window.jQuery) {\n jqueryUjsInit(jQuery);\n } else if (typeof exports === 'object' && typeof module === 'object') {\n module.exports = jqueryUjsInit;\n }\n})();\n"],"names":["jqueryUjsInit","$","undefined","rails","error","$document","document","linkClickSelector","buttonClickSelector","inputChangeSelector","formSubmitSelector","formInputClickSelector","disableSelector","enableSelector","requiredInputSelector","fileInputSelector","linkDisableSelector","buttonDisableSelector","csrfToken","attr","csrfParam","CSRFProtection","xhr","token","setRequestHeader","refreshCSRFTokens","val","fire","obj","name","data","event","Event","trigger","result","confirm","message","ajax","options","href","element","isRemote","handleRemote","method","url","withCredentials","dataType","ajaxSettings","is","serializeArray","button","push","serialize","type","beforeSend","settings","accepts","script","success","status","complete","crossDomain","isCrossDomain","xhrFields","originAnchor","createElement","location","urlAnchor","protocol","host","e","handleMethod","link","target","form","metadataInput","hide","append","appendTo","submit","formElements","selector","elements","filter","find","disableFormElements","each","disableFormElement","this","replacement","prop","enableFormElements","enableFormElement","removeData","allowAction","callback","answer","console","log","call","stack","blankInputs","specifiedSelector","nonBlank","input","radiosForNameWithNoneSelected","radioName","foundInputs","requiredInputs","checkedRadioButtonNames","length","add","nonBlankInputs","stopEverything","stopImmediatePropagation","disableElement","html","on","enableElement","off","ajaxPrefilter","originalOptions","window","metaClick","metaKey","ctrlKey","fail","blankRequiredInputs","nonBlankFileInputs","remote","setTimeout","aborted","value","closest","jQuery","module","exports"],"sourceRoot":""}