sweetalert2.min.js 26 KB

1
  1. !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Sweetalert2=t()}(this,function(){"use strict";var e={title:"",titleText:"",text:"",html:"",type:null,toast:!1,customClass:"",target:"body",backdrop:!0,animation:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,showConfirmButton:!0,showCancelButton:!1,preConfirm:null,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:"#3085d6",confirmButtonClass:null,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:"#aaa",cancelButtonClass:null,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusCancel:!1,showCloseButton:!1,closeButtonAriaLabel:"Close this dialog",showLoaderOnConfirm:!1,imageUrl:null,imageWidth:null,imageHeight:null,imageAlt:"",imageClass:null,timer:null,width:500,padding:20,background:"#fff",input:null,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputClass:null,inputAttributes:{},inputValidator:null,grow:!1,position:"center",progressSteps:[],currentProgressStep:null,progressStepsDistance:"40px",onBeforeOpen:null,onOpen:null,onClose:null,useRejections:!1,expectRejections:!1},t=["useRejections","expectRejections"],n=function(e){var t={};for(var n in e)t[e[n]]="swal2-"+e[n];return t},o=n(["container","shown","iosfix","popup","modal","no-backdrop","toast","toast-shown","overlay","fade","show","hide","noanimation","close","title","header","content","actions","confirm","cancel","icon","image","input","has-input","file","range","select","radio","checkbox","textarea","inputerror","validationerror","progresssteps","activeprogressstep","progresscircle","progressline","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen"]),i=n(["success","warning","info","question","error"]),r="SweetAlert2:",a=function(e,t){(e=String(e).replace(/[^0-9a-f]/gi,"")).length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),t=t||0;for(var n="#",o=0;o<3;o++){var i=parseInt(e.substr(2*o,2),16);n+=("00"+(i=Math.round(Math.min(Math.max(0,i+i*t),255)).toString(16))).substr(i.length)}return n},s=function(e){console.warn(r+" "+e)},l=function(e){console.error(r+" "+e)},u=[],c=function(e){-1===u.indexOf(e)&&(u.push(e),s(e))},d=function(e){return"function"==typeof e?e():e},p={previousActiveElement:null,previousBodyPadding:null},f=function(){return"undefined"==typeof window||"undefined"==typeof document},m=function(e){var t=v();t&&(t.parentNode.removeChild(t),j([document.documentElement,document.body],[o["no-backdrop"],o["has-input"],o["toast-shown"]]));{if(!f()){var n=document.createElement("div");n.className=o.container,n.innerHTML=b;("string"==typeof e.target?document.querySelector(e.target):e.target).appendChild(n);var i=g(),r=w(),a=N(r,o.input),s=N(r,o.file),u=r.querySelector("."+o.range+" input"),c=r.querySelector("."+o.range+" output"),d=N(r,o.select),p=r.querySelector("."+o.checkbox+" input"),m=N(r,o.textarea);i.setAttribute("aria-live",e.toast?"polite":"assertive");var h=function(){J.isVisible()&&J.resetValidationError()};return a.oninput=h,s.onchange=h,d.onchange=h,p.onchange=h,m.oninput=h,u.oninput=function(){h(),c.value=u.value},u.onchange=function(){h(),u.previousSibling.value=u.value},i}l("SweetAlert2 requires document to initialize")}},b=('\n <div role="dialog" aria-modal="true" aria-labelledby="'+o.title+'" aria-describedby="'+o.content+'" class="'+o.popup+'" tabindex="-1">\n <div class="'+o.header+'">\n <ul class="'+o.progresssteps+'"></ul>\n <div class="'+o.icon+" "+i.error+'">\n <span class="swal2-x-mark"><span class="swal2-x-mark-line-left"></span><span class="swal2-x-mark-line-right"></span></span>\n </div>\n <div class="'+o.icon+" "+i.question+'">?</div>\n <div class="'+o.icon+" "+i.warning+'">!</div>\n <div class="'+o.icon+" "+i.info+'">i</div>\n <div class="'+o.icon+" "+i.success+'">\n <div class="swal2-success-circular-line-left"></div>\n <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>\n <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>\n <div class="swal2-success-circular-line-right"></div>\n </div>\n <img class="'+o.image+'" />\n <h2 class="'+o.title+'" id="'+o.title+'"></h2>\n <button type="button" class="'+o.close+'">×</button>\n </div>\n <div class="'+o.content+'">\n <div id="'+o.content+'"></div>\n <input class="'+o.input+'" />\n <input type="file" class="'+o.file+'" />\n <div class="'+o.range+'">\n <output></output>\n <input type="range" />\n </div>\n <select class="'+o.select+'"></select>\n <div class="'+o.radio+'"></div>\n <label for="'+o.checkbox+'" class="'+o.checkbox+'">\n <input type="checkbox" />\n </label>\n <textarea class="'+o.textarea+'"></textarea>\n <div class="'+o.validationerror+'" id="'+o.validationerror+'"></div>\n </div>\n <div class="'+o.actions+'">\n <button type="button" class="'+o.confirm+'">OK</button>\n <button type="button" class="'+o.cancel+'">Cancel</button>\n </div>\n </div>\n').replace(/(^|\n)\s*/g,""),v=function(){return document.body.querySelector("."+o.container)},g=function(){return v()?v().querySelector("."+o.popup):null},h=function(e){return v()?v().querySelector("."+e):null},y=function(){return h(o.title)},w=function(){return h(o.content)},C=function(){return h(o.image)},x=function(){return h(o.progresssteps)},k=function(){return h(o.validationerror)},S=function(){return h(o.confirm)},A=function(){return h(o.cancel)},B=function(){return h(o.actions)},P=function(){return h(o.close)},E=function(){var e=Array.prototype.slice.call(g().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')).sort(function(e,t){return e=parseInt(e.getAttribute("tabindex")),t=parseInt(t.getAttribute("tabindex")),e>t?1:e<t?-1:0}),t=Array.prototype.slice.call(g().querySelectorAll('button, input:not([type=hidden]), textarea, select, a, [tabindex="0"]'));return function(e){var t=[];for(var n in e)-1===t.indexOf(e[n])&&t.push(e[n]);return t}(e.concat(t))},L=function(){return!document.body.classList.contains(o["toast-shown"])},T=function(e,t){return!!e.classList&&e.classList.contains(t)},q=function(e){if(e.focus(),"file"!==e.type){var t=e.value;e.value="",e.value=t}},O=function(e,t,n){e&&t&&("string"==typeof t&&(t=t.split(/\s+/).filter(Boolean)),t.forEach(function(t){e.forEach?e.forEach(function(e){n?e.classList.add(t):e.classList.remove(t)}):n?e.classList.add(t):e.classList.remove(t)}))},V=function(e,t){O(e,t,!0)},j=function(e,t){O(e,t,!1)},N=function(e,t){for(var n=0;n<e.childNodes.length;n++)if(T(e.childNodes[n],t))return e.childNodes[n]},M=function(e,t){t||(t=e===g()||e===B()?"flex":"block"),e.style.opacity="",e.style.display=t},H=function(e){e.style.opacity="",e.style.display="none"},R=function(e){return e&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},I=function(){if(f())return!1;var e=document.createElement("div"),t={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",animation:"animationend"};for(var n in t)if(t.hasOwnProperty(n)&&void 0!==e.style[n])return t[n];return!1}(),D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},U=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},W=U({},e),z=[],K=void 0,Z=void 0;"undefined"==typeof Promise&&l("This package requires a Promise library, please include a shim to enable it in this browser (See: https://github.com/sweetalert2/sweetalert2/wiki/Migration-from-SweetAlert-to-SweetAlert2#1-ie-support)");var _=function(e){for(var t in e)J.isValidParameter(t)||s('Unknown parameter "'+t+'"'),J.isDeprecatedParameter(t)&&c('The parameter "'+t+'" is deprecated and will be removed in the next major release.')},Q=function(t){("string"==typeof t.target&&!document.querySelector(t.target)||"string"!=typeof t.target&&!t.target.appendChild)&&(s('Target parameter is not valid, defaulting to "body"'),t.target="body");var n=void 0,r=g(),a="string"==typeof t.target?document.querySelector(t.target):t.target;n=r&&a&&r.parentNode!==a.parentNode?m(t):r||m(t);var u=t.width===e.width&&t.toast?"auto":t.width;n.style.width="number"==typeof u?u+"px":u;var c=t.padding===e.padding&&t.toast?"inherit":t.padding;n.style.padding="number"==typeof c?c+"px":c,n.style.background=t.background;for(var d=n.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix"),p=0;p<d.length;p++)d[p].style.background=t.background;var f=v(),b=y(),h=w().querySelector("#"+o.content),k=B(),E=S(),L=A(),T=P();if(t.titleText?b.innerText=t.titleText:b.innerHTML=t.title.split("\n").join("<br />"),t.backdrop||V([document.documentElement,document.body],o["no-backdrop"]),t.text||t.html){if("object"===D(t.html))if(h.innerHTML="",0 in t.html)for(var q=0;q in t.html;q++)h.appendChild(t.html[q].cloneNode(!0));else h.appendChild(t.html.cloneNode(!0));else t.html?h.innerHTML=t.html:t.text&&(h.textContent=t.text);M(h)}else H(h);if(t.position in o&&V(f,o[t.position]),t.grow&&"string"==typeof t.grow){var O="grow-"+t.grow;O in o&&V(f,o[O])}t.showCloseButton?(T.setAttribute("aria-label",t.closeButtonAriaLabel),M(T)):H(T),n.className=o.popup,t.toast?(V([document.documentElement,document.body],o["toast-shown"]),V(n,o.toast)):V(n,o.modal),t.customClass&&V(n,t.customClass);var N=x(),R=parseInt(null===t.currentProgressStep?J.getQueueStep():t.currentProgressStep,10);t.progressSteps.length?(M(N),function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}(N),R>=t.progressSteps.length&&s("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),t.progressSteps.forEach(function(e,n){var i=document.createElement("li");if(V(i,o.progresscircle),i.innerHTML=e,n===R&&V(i,o.activeprogressstep),N.appendChild(i),n!==t.progressSteps.length-1){var r=document.createElement("li");V(r,o.progressline),r.style.width=t.progressStepsDistance,N.appendChild(r)}})):H(N);for(var I=g().querySelectorAll("."+o.icon),U=0;U<I.length;U++)H(I[U]);if(t.type){var W=!1;for(var z in i)if(t.type===z){W=!0;break}if(!W)return l("Unknown alert type: "+t.type),!1;var K=n.querySelector("."+o.icon+"."+i[t.type]);if(M(K),t.animation)switch(t.type){case"success":V(K,"swal2-animate-success-icon"),V(K.querySelector(".swal2-success-line-tip"),"swal2-animate-success-line-tip"),V(K.querySelector(".swal2-success-line-long"),"swal2-animate-success-line-long");break;case"error":V(K,"swal2-animate-error-icon"),V(K.querySelector(".swal2-x-mark"),"swal2-animate-x-mark")}}var Z=C();t.imageUrl?(Z.setAttribute("src",t.imageUrl),Z.setAttribute("alt",t.imageAlt),M(Z),t.imageWidth?Z.setAttribute("width",t.imageWidth):Z.removeAttribute("width"),t.imageHeight?Z.setAttribute("height",t.imageHeight):Z.removeAttribute("height"),Z.className=o.image,t.imageClass&&V(Z,t.imageClass)):H(Z),t.showCancelButton?L.style.display="inline-block":H(L),t.showConfirmButton?function(e,t){e.style.removeProperty?e.style.removeProperty(t):e.style.removeAttribute(t)}(E,"display"):H(E),t.showConfirmButton||t.showCancelButton?M(k):H(k),E.innerHTML=t.confirmButtonText,L.innerHTML=t.cancelButtonText,E.setAttribute("aria-label",t.confirmButtonAriaLabel),L.setAttribute("aria-label",t.cancelButtonAriaLabel),t.buttonsStyling&&(E.style.backgroundColor=t.confirmButtonColor,L.style.backgroundColor=t.cancelButtonColor),E.className=o.confirm,V(E,t.confirmButtonClass),L.className=o.cancel,V(L,t.cancelButtonClass),t.buttonsStyling?V([E,L],o.styled):(j([E,L],o.styled),E.style.backgroundColor=E.style.borderLeftColor=E.style.borderRightColor="",L.style.backgroundColor=L.style.borderLeftColor=L.style.borderRightColor=""),!0===t.animation?j(n,o.noanimation):V(n,o.noanimation),t.showLoaderOnConfirm&&!t.preConfirm&&s("showLoaderOnConfirm is set to true, but preConfirm is not defined.\nshowLoaderOnConfirm should be used together with preConfirm, see usage example:\nhttps://sweetalert2.github.io/#ajax-request")},Y=function(){null===p.previousBodyPadding&&document.body.scrollHeight>window.innerHeight&&(p.previousBodyPadding=document.body.style.paddingRight,document.body.style.paddingRight=function(){if("ontouchstart"in window||navigator.msMaxTouchPoints)return 0;var e=document.createElement("div");e.style.width="50px",e.style.height="50px",e.style.overflow="scroll",document.body.appendChild(e);var t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t}()+"px")},$=function(){if(/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream&&!T(document.body,o.iosfix)){var e=document.body.scrollTop;document.body.style.top=-1*e+"px",V(document.body,o.iosfix)}},J=function e(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];if("undefined"!=typeof window){if(void 0===n[0])return l("SweetAlert2 expects at least 1 attribute!"),!1;var r=U({},W);switch(D(n[0])){case"string":r.title=n[0],r.html=n[1],r.type=n[2];break;case"object":if(_(n[0]),U(r,n[0]),r.extraParams=n[0].extraParams,"email"===r.input&&null===r.inputValidator){var s=function(e){return new Promise(function(t,n){/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(e)?t():n("Invalid email address")})};r.inputValidator=r.expectRejections?s:e.adaptInputValidator(s)}if("url"===r.input&&null===r.inputValidator){var u=function(e){return new Promise(function(t,n){/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)$/.test(e)?t():n("Invalid URL")})};r.inputValidator=r.expectRejections?u:e.adaptInputValidator(u)}break;default:return l('Unexpected type of argument! Expected "string" or "object", got '+D(n[0])),!1}Q(r);var f=v(),m=g();return new Promise(function(t,n){var i=function(n){e.closePopup(r.onClose),t(r.useRejections?n:{value:n})},s=function(o){e.closePopup(r.onClose),r.useRejections?n(o):t({dismiss:o})},u=function(t){e.closePopup(r.onClose),n(t)};r.timer&&(m.timeout=setTimeout(function(){return s("timer")},r.timer));var b=function(e){if(!(e=e||r.input))return null;switch(e){case"select":case"textarea":case"file":return N(J,o[e]);case"checkbox":return m.querySelector("."+o.checkbox+" input");case"radio":return m.querySelector("."+o.radio+" input:checked")||m.querySelector("."+o.radio+" input:first-child");case"range":return m.querySelector("."+o.range+" input");default:return N(J,o.input)}};r.input&&setTimeout(function(){var e=b();e&&q(e)},0);for(var O=function(t){if(r.showLoaderOnConfirm&&e.showLoading(),r.preConfirm){e.resetValidationError();var n=Promise.resolve().then(function(){return r.preConfirm(t,r.extraParams)});r.expectRejections?n.then(function(e){return i(e||t)},function(t){e.hideLoading(),t&&e.showValidationError(t)}):n.then(function(n){R(k())?e.hideLoading():i(n||t)},function(e){return u(e)})}else i(t)},U=function(t){var n=t||window.event,o=n.target||n.srcElement,i=S(),l=A(),c=i&&(i===o||i.contains(o)),d=l&&(l===o||l.contains(o));switch(n.type){case"mouseover":case"mouseup":r.buttonsStyling&&(c?i.style.backgroundColor=a(r.confirmButtonColor,-.1):d&&(l.style.backgroundColor=a(r.cancelButtonColor,-.1)));break;case"mouseout":r.buttonsStyling&&(c?i.style.backgroundColor=r.confirmButtonColor:d&&(l.style.backgroundColor=r.cancelButtonColor));break;case"mousedown":r.buttonsStyling&&(c?i.style.backgroundColor=a(r.confirmButtonColor,-.2):d&&(l.style.backgroundColor=a(r.cancelButtonColor,-.2)));break;case"click":if(c&&e.isVisible())if(e.disableButtons(),r.input){var p=function(){var e=b();if(!e)return null;switch(r.input){case"checkbox":return e.checked?1:0;case"radio":return e.checked?e.value:null;case"file":return e.files.length?e.files[0]:null;default:return r.inputAutoTrim?e.value.trim():e.value}}();if(r.inputValidator){e.disableInput();var f=Promise.resolve().then(function(){return r.inputValidator(p,r.extraParams)});r.expectRejections?f.then(function(){e.enableButtons(),e.enableInput(),O(p)},function(t){e.enableButtons(),e.enableInput(),t&&e.showValidationError(t)}):f.then(function(t){e.enableButtons(),e.enableInput(),t?e.showValidationError(t):O(p)},function(e){return u(e)})}else O(p)}else O(!0);else d&&e.isVisible()&&(e.disableButtons(),s("cancel"))}},W=m.querySelectorAll("button"),z=0;z<W.length;z++)W[z].onclick=U,W[z].onmouseover=U,W[z].onmouseout=U,W[z].onmousedown=U;if(P().onclick=function(){s("close")},r.toast)m.onclick=function(t){t.target!==m||r.showConfirmButton||r.showCancelButton||r.allowOutsideClick&&(e.closePopup(r.onClose),s("overlay"))};else{var _=!1;m.onmousedown=function(){f.onmouseup=function(e){f.onmouseup=void 0,e.target===f&&(_=!0)}},f.onmousedown=function(){m.onmouseup=function(e){m.onmouseup=void 0,(e.target===m||m.contains(e.target))&&(_=!0)}},f.onclick=function(e){_?_=!1:e.target===f&&d(r.allowOutsideClick)&&s("overlay")}}var J=w(),X=B(),F=S(),G=A();r.reverseButtons?F.parentNode.insertBefore(G,F):F.parentNode.insertBefore(F,G);var ee=function(e,t){for(var n=E(r.focusCancel),o=0;o<n.length;o++){(e+=t)===n.length?e=0:-1===e&&(e=n.length-1);var i=n[e];if(R(i))return i.focus()}};r.toast&&Z&&(window.onkeydown=K,Z=!1),r.toast||Z||(K=window.onkeydown,Z=!0,window.onkeydown=function(t){var n=t||window.event;if("Enter"!==n.key||n.isComposing)if("Tab"===n.key){for(var o=n.target||n.srcElement,i=E(r.focusCancel),a=-1,l=0;l<i.length;l++)if(o===i[l]){a=l;break}n.shiftKey?ee(a,-1):ee(a,1),n.stopPropagation(),n.preventDefault()}else-1!==["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Left","Right","Up","Down"].indexOf(n.key)?document.activeElement===F&&R(G)?G.focus():document.activeElement===G&&R(F)&&F.focus():"Escape"!==n.key&&"Esc"!==n.key||!0!==d(r.allowEscapeKey)||s("esc");else if(n.target===b()){if(-1!==["textarea","file"].indexOf(r.input))return;e.clickConfirm(),n.preventDefault()}}),r.buttonsStyling&&(F.style.borderLeftColor=r.confirmButtonColor,F.style.borderRightColor=r.confirmButtonColor),e.hideLoading=e.disableLoading=function(){r.showConfirmButton||(H(F),r.showCancelButton||H(B())),j([m,X],o.loading),m.removeAttribute("aria-busy"),m.removeAttribute("data-loading"),F.disabled=!1,G.disabled=!1},e.getTitle=function(){return y()},e.getContent=function(){return w()},e.getInput=function(){return b()},e.getImage=function(){return C()},e.getButtonsWrapper=function(){return c("swal.getButtonsWrapper() is deprecated and will be removed in the next major release, use swal.getActions() instead"),h(o.actions)},e.getActions=function(){return B()},e.getConfirmButton=function(){return S()},e.getCancelButton=function(){return A()},e.isLoading=function(){return g().hasAttribute("data-loading")},e.enableButtons=function(){F.disabled=!1,G.disabled=!1},e.disableButtons=function(){F.disabled=!0,G.disabled=!0},e.enableConfirmButton=function(){F.disabled=!1},e.disableConfirmButton=function(){F.disabled=!0},e.enableInput=function(){var e=b();if(!e)return!1;if("radio"===e.type)for(var t=e.parentNode.parentNode.querySelectorAll("input"),n=0;n<t.length;n++)t[n].disabled=!1;else e.disabled=!1},e.disableInput=function(){var e=b();if(!e)return!1;if(e&&"radio"===e.type)for(var t=e.parentNode.parentNode.querySelectorAll("input"),n=0;n<t.length;n++)t[n].disabled=!0;else e.disabled=!0},e.showValidationError=function(e){var t=k();t.innerHTML=e,M(t);var n=b();n&&(n.setAttribute("aria-invalid",!0),n.setAttribute("aria-describedBy",o.validationerror),q(n),V(n,o.inputerror))},e.resetValidationError=function(){var e=k();H(e);var t=b();t&&(t.removeAttribute("aria-invalid"),t.removeAttribute("aria-describedBy"),j(t,o.inputerror))},e.getProgressSteps=function(){return r.progressSteps},e.setProgressSteps=function(e){r.progressSteps=e,Q(r)},e.showProgressSteps=function(){M(x())},e.hideProgressSteps=function(){H(x())},e.enableButtons(),e.hideLoading(),e.resetValidationError(),r.input&&V(document.body,o["has-input"]);for(var te=["input","file","range","select","radio","checkbox","textarea"],ne=void 0,oe=0;oe<te.length;oe++){var ie=o[te[oe]],re=N(J,ie);if(ne=b(te[oe])){for(var ae in ne.attributes)if(ne.attributes.hasOwnProperty(ae)){var se=ne.attributes[ae].name;"type"!==se&&"value"!==se&&ne.removeAttribute(se)}for(var le in r.inputAttributes)ne.setAttribute(le,r.inputAttributes[le])}re.className=ie,r.inputClass&&V(re,r.inputClass),H(re)}var ue=void 0;switch(r.input){case"text":case"email":case"password":case"number":case"tel":case"url":(ne=N(J,o.input)).value=r.inputValue,ne.placeholder=r.inputPlaceholder,ne.type=r.input,M(ne);break;case"file":(ne=N(J,o.file)).placeholder=r.inputPlaceholder,ne.type=r.input,M(ne);break;case"range":var ce=N(J,o.range),de=ce.querySelector("input"),pe=ce.querySelector("output");de.value=r.inputValue,de.type=r.input,pe.value=r.inputValue,M(ce);break;case"select":var fe=N(J,o.select);if(fe.innerHTML="",r.inputPlaceholder){var me=document.createElement("option");me.innerHTML=r.inputPlaceholder,me.value="",me.disabled=!0,me.selected=!0,fe.appendChild(me)}ue=function(e){for(var t in e){var n=document.createElement("option");n.value=t,n.innerHTML=e[t],r.inputValue.toString()===t&&(n.selected=!0),fe.appendChild(n)}M(fe),fe.focus()};break;case"radio":var be=N(J,o.radio);be.innerHTML="",ue=function(e){for(var t in e){var n=document.createElement("input"),i=document.createElement("label"),a=document.createElement("span");n.type="radio",n.name=o.radio,n.value=t,r.inputValue.toString()===t&&(n.checked=!0),a.innerHTML=e[t],i.appendChild(n),i.appendChild(a),i.for=n.id,be.appendChild(i)}M(be);var s=be.querySelectorAll("input");s.length&&s[0].focus()};break;case"checkbox":var ve=N(J,o.checkbox),ge=b("checkbox");ge.type="checkbox",ge.value=1,ge.id=o.checkbox,ge.checked=Boolean(r.inputValue);var he=ve.getElementsByTagName("span");he.length&&ve.removeChild(he[0]),(he=document.createElement("span")).innerHTML=r.inputPlaceholder,ve.appendChild(he),M(ve);break;case"textarea":var ye=N(J,o.textarea);ye.value=r.inputValue,ye.placeholder=r.inputPlaceholder,M(ye);break;case null:break;default:l('Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "'+r.input+'"')}"select"!==r.input&&"radio"!==r.input||(r.inputOptions instanceof Promise?(e.showLoading(),r.inputOptions.then(function(t){e.hideLoading(),ue(t)})):"object"===D(r.inputOptions)?ue(r.inputOptions):l("Unexpected type of inputOptions! Expected object or Promise, got "+D(r.inputOptions))),function(e,t,n){var i=v(),r=g();null!==t&&"function"==typeof t&&t(r),e?(V(r,o.show),V(i,o.fade),j(r,o.hide)):j(r,o.fade),M(r),i.style.overflowY="hidden",I&&!T(r,o.noanimation)?r.addEventListener(I,function e(){r.removeEventListener(I,e),i.style.overflowY="auto"}):i.style.overflowY="auto",V([document.documentElement,document.body,i],o.shown),L()&&(Y(),$()),p.previousActiveElement=document.activeElement,null!==n&&"function"==typeof n&&setTimeout(function(){n(r)})}(r.animation,r.onBeforeOpen,r.onOpen),r.toast||(d(r.allowEnterKey)?r.focusCancel&&R(G)?G.focus():r.focusConfirm&&R(F)?F.focus():ee(-1,1):document.activeElement&&document.activeElement.blur()),v().scrollTop=0})}};return J.isVisible=function(){return!!g()},J.queue=function(e){z=e;var t=function(){z=[],document.body.removeAttribute("data-swal2-queue-step")},n=[];return new Promise(function(e,o){!function o(i,r){i<z.length?(document.body.setAttribute("data-swal2-queue-step",i),J(z[i]).then(function(a){void 0!==a.value?(n.push(a.value),o(i+1,r)):(t(),e({dismiss:a.dismiss}))})):(t(),e({value:n}))}(0)})},J.getQueueStep=function(){return document.body.getAttribute("data-swal2-queue-step")},J.insertQueueStep=function(e,t){return t&&t<z.length?z.splice(t,0,e):z.push(e)},J.deleteQueueStep=function(e){void 0!==z[e]&&z.splice(e,1)},J.close=J.closePopup=J.closeModal=J.closeToast=function(e){var t=v(),n=g();if(n){j(n,o.show),V(n,o.hide),clearTimeout(n.timeout),document.body.classList.contains(o["toast-shown"])||(!function(){if(p.previousActiveElement&&p.previousActiveElement.focus){var e=window.scrollX,t=window.scrollY;p.previousActiveElement.focus(),void 0!==e&&void 0!==t&&window.scrollTo(e,t)}}(),window.onkeydown=K,Z=!1);var i=function(){t.parentNode&&t.parentNode.removeChild(t),j([document.documentElement,document.body],[o.shown,o["no-backdrop"],o["has-input"],o["toast-shown"]]),L()&&(null!==p.previousBodyPadding&&(document.body.style.paddingRight=p.previousBodyPadding,p.previousBodyPadding=null),function(){if(T(document.body,o.iosfix)){var e=parseInt(document.body.style.top,10);j(document.body,o.iosfix),document.body.style.top="",document.body.scrollTop=-1*e}}())};I&&!T(n,o.noanimation)?n.addEventListener(I,function e(){n.removeEventListener(I,e),T(n,o.hide)&&i()}):i(),null!==e&&"function"==typeof e&&setTimeout(function(){e(n)})}},J.clickConfirm=function(){return S().click()},J.clickCancel=function(){return A().click()},J.showLoading=J.enableLoading=function(){var e=g();e||J(""),e=g();var t=B(),n=S(),i=A();M(t),M(n,"inline-block"),V([e,t],o.loading),n.disabled=!0,i.disabled=!0,e.setAttribute("data-loading",!0),e.setAttribute("aria-busy",!0),e.focus()},J.isValidParameter=function(t){return e.hasOwnProperty(t)||"extraParams"===t},J.isDeprecatedParameter=function(e){return-1!==t.indexOf(e)},J.setDefaults=function(e){if(!e||"object"!==(void 0===e?"undefined":D(e)))return l("the argument for setDefaults() is required and has to be a object");_(e);for(var t in e)J.isValidParameter(t)&&(W[t]=e[t])},J.resetDefaults=function(){W=U({},e)},J.adaptInputValidator=function(e){return function(t,n){return e.call(this,t,n).then(function(){},function(e){return e})}},J.noop=function(){},J.version="7.4.1",J.default=J,"undefined"!=typeof window&&"object"===D(window._swalDefaults)&&J.setDefaults(window._swalDefaults),J}),"undefined"!=typeof window&&window.Sweetalert2&&(window.sweetAlert=window.swal=window.Sweetalert2);