document.addEventListener(“click”,function(t){var e,a;if(a=t.target,matches.call(a,“a, button, input”))return e=a.getAttribute(“data-confirm”),confirm(e)?void 0:(t.stopPropagation(),t.stopImmediatePropagation(),t.preventDefault(),!1)},!1);var CSRF={token:function(){var t=document.querySelector(‘meta');return t&&t.getAttribute(“content”)},param:function(){var t=document.querySelector(’meta');return t&&t.getAttribute(“content”)}},sameOrigin=function(t){var e,a=document.createElement(“a”);return a.href=t,e=a.href.split(“/”,3).join(“/”),0===window.location.href.indexOf(e)};window.CSRF=CSRF,document.addEventListener(“ajax:before”,function(t){var e=CSRF.token(),a=t.detail;e&&a.setRequestHeader(“X-CSRF-Token”,e)}),document.addEventListener(“submit”,function(t){var e=CSRF.token(),a=CSRF.param(),n=t.target;if(matches.call(n,“form”)){if(matches.call(n,“form”))return!0;if(!n.method||“GET”==n.method.toUpperCase())return!0;if(!sameOrigin(n.action))return!0;if(a&&e&&!n.querySelector(“input[name=”a“]”)){var r=document.createElement(“input”);r.setAttribute(“type”,“hidden”),r.setAttribute(“name”,a),r.setAttribute(“value”,e),n.appendChild®}return!0}}),document.addEventListener(“click”,function(t){var e,a;3!=t.which&&(“submit”===(a=t.target).getAttribute(“type”)&&null!==a.form.querySelector(“:invalid”)||matches.call(a,“a, button, input”)&&(e=a.getAttribute(“data-disable-with”),a.value?a.value=e:a.innerHTML=e,setTimeout(function(){a.setAttribute(“disabled”,“disabled”)},0)))},!1),document.addEventListener(“submit”,function(t){var e=t.target;if(matches.call(e,“form”)){var a=e.action,n=(e.method||e.getAttribute(“data-method”)||“POST”).toUpperCase(),r=new FormData(e);if(CSRF.param()&&CSRF.token()&&(r=CSRF.token()),!LiteAjax.ajax({url:a,method:n,data:r,target:e}))return!0;t.preventDefault()}});var LiteAjax=function(){var LiteAjax={};return LiteAjax.options={method:“GET”,url:window.location.href},LiteAjax.ajax=function(url,options){“object”==typeof url&&(options=url,url=void 0),options=options||{},options.accepts||(options.accepts=“text/javascript, application/javascript, application/ecmascript, application/x-ecmascript”),url=url||options.url||location.href||“”;var data=options.data,target=options.target||document,xhr=new XMLHttpRequest;xhr.addEventListener(“load”,function(){var responseType=xhr.getResponseHeader(“content-type”);“text/javascript; charset=utf-8”===responseType&&eval(xhr.response);var event=new CustomEvent(“ajax:complete”,{detail:xhr,bubbles:!0});target.dispatchEvent(event)}),“function”==typeof options.success&&xhr.addEventListener(“load”,function(t){xhr.status>=200&&xhr.status<300&&options.success(xhr)}),“function”==typeof options.error&&(xhr.addEventListener(“load”,function(t){(xhr.status<200||xhr.status>=300)&&options.error(xhr)}),xhr.addEventListener(“error”,function(t){options.error(xhr)})),xhr.open(options.method||“GET”,url),xhr.setRequestHeader(“X-Requested-With”,“XmlHttpRequest”),xhr.setRequestHeader(“Accept”,“/;q=0.5, ”+options.accepts),options.json&&(xhr.setRequestHeader(“Content-type”,“application/json”),data=JSON.stringify(data));var beforeSend=new CustomEvent(“ajax:before”,{detail:xhr,bubbles:!0});return target.dispatchEvent(beforeSend),xhr.send(data),xhr},LiteAjax}();document.addEventListener(“click”,function(t){var e,a,n,r;if(0===t.button&&(e=t.target,matches.call(e,“a”))){if(a=e.getAttribute(“href”),n=e.getAttribute(“data-method”).toUpperCase(),r={},CSRF.param()&&CSRF.token()&&(r=CSRF.token()),!(matches.call(e,“a”)?function(t){return LiteAjax.ajax(t),!0}:function(t){var e,a,n;if(“GET”==t.method)return!1;for(n in(e=document.createElement(“form”)).method=“POST”,e.action=t.url,e.style.display=“none”,t.data)Object.prototype.hasOwnProperty.call(t.data,n)&&((a=document.createElement(“input”)).setAttribute(“type”,“hidden”),a.setAttribute(“name”,n),a.setAttribute(“value”,t.data),e.appendChild(a));“POST”!=t.method&&((a=document.createElement(“input”)).setAttribute(“type”,“hidden”),a.setAttribute(“name”,“_method”),a.setAttribute(“value”,t.method),e.appendChild(a));return document.body.appendChild(e),e.submit(),!0})({url:a,method:n,data:r,target:e}))return!0;t.preventDefault()}},!1);var matches=function(t){return t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.msMatchesSelector}(document.documentElement),CustomEvent=function(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var a=document.createEvent(“CustomEvent”);return a.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),a};CustomEvent.prototype=window.CustomEvent.prototype,window.CustomEvent=CustomEvent;