sweet_alert.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:"",footer:"",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:null,confirmButtonClass:null,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:null,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:null,padding:null,background:null,input:null,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputClass:null,inputAttributes:{},inputValidator:null,grow:!1,position:"center",progressSteps:[],currentProgressStep:null,progressStepsDistance:null,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","fade","show","hide","noanimation","close","title","header","content","actions","confirm","cancel","footer","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){console.warn(r+" "+e)},s=function(e){console.error(r+" "+e)},l=[],u=function(e){-1===l.indexOf(e)&&(l.push(e),a(e))},c=function(e){return"function"==typeof e?e():e},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},p=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},f=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],o=!0,i=!1,r=void 0;try{for(var a,s=e[Symbol.iterator]();!(o=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{!o&&s.return&&s.return()}finally{if(i)throw r}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},m={previousActiveElement:null,previousBodyPadding:null},g=function(){return"undefined"==typeof window||"undefined"==typeof document},b=function(e){var t=h();if(t&&(t.parentNode.removeChild(t),H([document.documentElement,document.body],[o["no-backdrop"],o["has-input"],o["toast-shown"]])),!g()){var n=document.createElement("div");n.className=o.container,n.innerHTML=v,("string"==typeof e.target?document.querySelector(e.target):e.target).appendChild(n);var i=y(),r=x(),a=M(r,o.input),l=M(r,o.file),u=r.querySelector("."+o.range+" input"),c=r.querySelector("."+o.range+" output"),d=M(r,o.select),p=r.querySelector("."+o.checkbox+" input"),f=M(r,o.textarea);i.setAttribute("role",e.toast?"alert":"dialog"),i.setAttribute("aria-live",e.toast?"polite":"assertive"),e.toast||i.setAttribute("aria-modal","true");var m=function(){X.isVisible()&&X.resetValidationError()};return a.oninput=m,l.onchange=m,d.onchange=m,p.onchange=m,f.oninput=m,u.oninput=function(){m(),c.value=u.value},u.onchange=function(){m(),u.nextSibling.value=u.value},i}s("SweetAlert2 requires document to initialize")},v=('\n <div 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 <input type="range" />\n <output></output>\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 class="'+o.footer+'">\n </div>\n </div>\n').replace(/(^|\n)\s*/g,""),h=function(){return document.body.querySelector("."+o.container)},y=function(){return h()?h().querySelector("."+o.popup):null},w=function(e){return h()?h().querySelector("."+e):null},C=function(){return w(o.title)},x=function(){return w(o.content)},k=function(){return w(o.image)},A=function(){return w(o.progresssteps)},S=function(){return w(o.validationerror)},B=function(){return w(o.confirm)},P=function(){return w(o.cancel)},E=function(){return w(o.actions)},L=function(){return w(o.footer)},T=function(){return w(o.close)},V=function(){var e=Array.prototype.slice.call(y().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')).sort(function(e,t){return(e=parseInt(e.getAttribute("tabindex")))>(t=parseInt(t.getAttribute("tabindex")))?1:e<t?-1:0}),t=Array.prototype.slice.call(y().querySelectorAll('button, input:not([type=hidden]), textarea, select, a, [tabindex="0"]'));return function(e){for(var t=[],n=0;n<e.length;n++)-1===t.indexOf(e[n])&&t.push(e[n]);return t}(e.concat(t))},O=function(e,t){if(!e)return U(t);if("object"===(void 0===e?"undefined":d(e)))if(t.innerHTML="",0 in e)for(var n=0;n in e;n++)t.appendChild(e[n].cloneNode(!0));else t.appendChild(e.cloneNode(!0));else e&&(t.innerHTML=e);I(t)},q=function(){return!document.body.classList.contains(o["toast-shown"])},j=function(e,t){return!!e.classList&&e.classList.contains(t)},R=function(e){if(e.focus(),"file"!==e.type){var t=e.value;e.value="",e.value=t}},N=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)}))},D=function(e,t){N(e,t,!0)},H=function(e,t){N(e,t,!1)},M=function(e,t){for(var n=0;n<e.childNodes.length;n++)if(j(e.childNodes[n],t))return e.childNodes[n]},I=function(e){e.style.opacity="",e.style.display=e.id===o.content?"block":"flex"},U=function(e){e.style.opacity="",e.style.display="none"},W=function(e){return e&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},z=function(){if(g())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}(),K=p({},e),Z=[],_=void 0,Q=void 0,Y=function(e){for(var t in e)X.isValidParameter(t)||a('Unknown parameter "'+t+'"'),X.isDeprecatedParameter(t)&&u('The parameter "'+t+'" is deprecated and will be removed in the next major release.')},$=function(e){(!e.target||"string"==typeof e.target&&!document.querySelector(e.target)||"string"!=typeof e.target&&!e.target.appendChild)&&(a('Target parameter is not valid, defaulting to "body"'),e.target="body");var t=void 0,n=y(),r="string"==typeof e.target?document.querySelector(e.target):e.target;t=n&&r&&n.parentNode!==r.parentNode?b(e):n||b(e),e.width&&(t.style.width="number"==typeof e.width?e.width+"px":e.width),e.padding&&(t.style.padding="number"==typeof e.padding?e.padding+"px":e.padding),e.background&&(t.style.background=e.background);for(var l=window.getComputedStyle(t).getPropertyValue("background-color"),u=t.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix"),c=0;c<u.length;c++)u[c].style.backgroundColor=l;var d=h(),p=C(),f=x().querySelector("#"+o.content),m=E(),g=B(),v=P(),w=T(),S=L();if(e.titleText?p.innerText=e.titleText:e.title&&(p.innerHTML=e.title.split("\n").join("<br />")),"string"==typeof e.backdrop?h().style.background=e.backdrop:e.backdrop||D([document.documentElement,document.body],o["no-backdrop"]),e.html?O(e.html,f):e.text?(f.textContent=e.text,I(f)):U(f),e.position in o?D(d,o[e.position]):(a('The "position" parameter is not valid, defaulting to "center"'),D(d,o.center)),e.grow&&"string"==typeof e.grow){var V="grow-"+e.grow;V in o&&D(d,o[V])}"function"==typeof e.animation&&(e.animation=e.animation.call()),e.showCloseButton?(w.setAttribute("aria-label",e.closeButtonAriaLabel),I(w)):U(w),t.className=o.popup,e.toast?(D([document.documentElement,document.body],o["toast-shown"]),D(t,o.toast)):D(t,o.modal),e.customClass&&D(t,e.customClass);var q=A(),j=parseInt(null===e.currentProgressStep?X.getQueueStep():e.currentProgressStep,10);e.progressSteps&&e.progressSteps.length?(I(q),function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}(q),j>=e.progressSteps.length&&a("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),e.progressSteps.forEach(function(t,n){var i=document.createElement("li");if(D(i,o.progresscircle),i.innerHTML=t,n===j&&D(i,o.activeprogressstep),q.appendChild(i),n!==e.progressSteps.length-1){var r=document.createElement("li");D(r,o.progressline),e.progressStepsDistance&&(r.style.width=e.progressStepsDistance),q.appendChild(r)}})):U(q);for(var R=y().querySelectorAll("."+o.icon),N=0;N<R.length;N++)U(R[N]);if(e.type){var M=!1;for(var W in i)if(e.type===W){M=!0;break}if(!M)return s("Unknown alert type: "+e.type),!1;var z=t.querySelector("."+o.icon+"."+i[e.type]);I(z),e.animation&&D(z,"swal2-animate-"+e.type+"-icon")}var K,Z,_=k();if(e.imageUrl?(_.setAttribute("src",e.imageUrl),_.setAttribute("alt",e.imageAlt),I(_),e.imageWidth?_.setAttribute("width",e.imageWidth):_.removeAttribute("width"),e.imageHeight?_.setAttribute("height",e.imageHeight):_.removeAttribute("height"),_.className=o.image,e.imageClass&&D(_,e.imageClass)):U(_),e.showCancelButton?v.style.display="inline-block":U(v),e.showConfirmButton?(Z="display",(K=g).style.removeProperty?K.style.removeProperty(Z):K.style.removeAttribute(Z)):U(g),e.showConfirmButton||e.showCancelButton?I(m):U(m),g.innerHTML=e.confirmButtonText,v.innerHTML=e.cancelButtonText,g.setAttribute("aria-label",e.confirmButtonAriaLabel),v.setAttribute("aria-label",e.cancelButtonAriaLabel),g.className=o.confirm,D(g,e.confirmButtonClass),v.className=o.cancel,D(v,e.cancelButtonClass),e.buttonsStyling){D([g,v],o.styled),e.confirmButtonColor&&(g.style.backgroundColor=e.confirmButtonColor),e.cancelButtonColor&&(v.style.backgroundColor=e.cancelButtonColor);var Q=window.getComputedStyle(g).getPropertyValue("background-color");g.style.borderLeftColor=Q,g.style.borderRightColor=Q}else H([g,v],o.styled),g.style.backgroundColor=g.style.borderLeftColor=g.style.borderRightColor="",v.style.backgroundColor=v.style.borderLeftColor=v.style.borderRightColor="";O(e.footer,S),!0===e.animation?H(t,o.noanimation):D(t,o.noanimation),e.showLoaderOnConfirm&&!e.preConfirm&&a("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")},F=function(){null===m.previousBodyPadding&&document.body.scrollHeight>window.innerHeight&&(m.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")},J=function(){if(/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream&&!j(document.body,o.iosfix)){var e=document.body.scrollTop;document.body.style.top=-1*e+"px",D(document.body,o.iosfix)}},X=function e(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];if("undefined"!=typeof window){if("undefined"==typeof Promise&&s("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)"),void 0===n[0])return s("SweetAlert2 expects at least 1 attribute!"),!1;var r=p({},K);switch(d(n[0])){case"string":r.title=n[0],r.html=n[1],r.type=n[2];break;case"object":if(Y(n[0]),p(r,n[0]),r.extraParams=n[0].extraParams,"email"===r.input&&null===r.inputValidator){var a=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?a:e.adaptInputValidator(a)}if("url"===r.input&&null===r.inputValidator){var l=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?l:e.adaptInputValidator(l)}break;default:return s('Unexpected type of argument! Expected "string" or "object", got '+d(n[0])),!1}$(r);var g=h(),b=y();return new Promise(function(t,n){var i=function(n){e.closePopup(r.onClose),r.useRejections?t(n):t({value:n})},a=function(o){e.closePopup(r.onClose),r.useRejections?n(o):t({dismiss:o})},l=function(t){e.closePopup(r.onClose),n(t)};r.timer&&(b.timeout=setTimeout(function(){return a("timer")},r.timer));var p=function(e){if(!(e=e||r.input))return null;switch(e){case"select":case"textarea":case"file":return M(Y,o[e]);case"checkbox":return b.querySelector("."+o.checkbox+" input");case"radio":return b.querySelector("."+o.radio+" input:checked")||b.querySelector("."+o.radio+" input:first-child");case"range":return b.querySelector("."+o.range+" input");default:return M(Y,o.input)}};r.input&&setTimeout(function(){var e=p();e&&R(e)},0);for(var v=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){W(S())||!1===n?e.hideLoading():i(n||t)},function(e){return l(e)})}else i(t)},O=function(t){var n=t||window.event,o=n.target||n.srcElement,i=B(),s=P(),u=i&&(i===o||i.contains(o)),c=s&&(s===o||s.contains(o));switch(n.type){case"click":if(u&&e.isVisible())if(e.disableButtons(),r.input){var d=function(){var e=p();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(d,r.extraParams)});r.expectRejections?f.then(function(){e.enableButtons(),e.enableInput(),v(d)},function(t){e.enableButtons(),e.enableInput(),t&&e.showValidationError(t)}):f.then(function(t){e.enableButtons(),e.enableInput(),t?e.showValidationError(t):v(d)},function(e){return l(e)})}else v(d)}else v(!0);else c&&e.isVisible()&&(e.disableButtons(),a(e.DismissReason.cancel))}},N=b.querySelectorAll("button"),K=0;K<N.length;K++)N[K].onclick=O,N[K].onmouseover=O,N[K].onmouseout=O,N[K].onmousedown=O;if(T().onclick=function(){a(e.DismissReason.close)},r.toast)b.onclick=function(t){t.target!==b||r.showConfirmButton||r.showCancelButton||r.allowOutsideClick&&(e.closePopup(r.onClose),a(e.DismissReason.backdrop))};else{var Z=!1;b.onmousedown=function(){g.onmouseup=function(e){g.onmouseup=void 0,e.target===g&&(Z=!0)}},g.onmousedown=function(){b.onmouseup=function(e){b.onmouseup=void 0,(e.target===b||b.contains(e.target))&&(Z=!0)}},g.onclick=function(t){Z?Z=!1:t.target===g&&c(r.allowOutsideClick)&&a(e.DismissReason.backdrop)}}var Y=x(),X=E(),G=B(),ee=P();r.reverseButtons?G.parentNode.insertBefore(ee,G):G.parentNode.insertBefore(G,ee);var te=function(e,t){for(var n=V(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(W(i))return i.focus()}};r.toast&&Q&&(window.onkeydown=_,Q=!1),r.toast||Q||(_=window.onkeydown,Q=!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=V(r.focusCancel),s=-1,l=0;l<i.length;l++)if(o===i[l]){s=l;break}n.shiftKey?te(s,-1):te(s,1),n.stopPropagation(),n.preventDefault()}else-1!==["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Left","Right","Up","Down"].indexOf(n.key)?document.activeElement===G&&W(ee)?ee.focus():document.activeElement===ee&&W(G)&&G.focus():"Escape"!==n.key&&"Esc"!==n.key||!0!==c(r.allowEscapeKey)||a(e.DismissReason.esc);else if(n.target===p()){if(-1!==["textarea","file"].indexOf(r.input))return;e.clickConfirm(),n.preventDefault()}}),e.hideLoading=e.disableLoading=function(){r.showConfirmButton||(U(G),r.showCancelButton||U(E())),H([b,X],o.loading),b.removeAttribute("aria-busy"),b.removeAttribute("data-loading"),G.disabled=!1,ee.disabled=!1},e.getTitle=function(){return C()},e.getContent=function(){return x()},e.getInput=function(){return p()},e.getImage=function(){return k()},e.getButtonsWrapper=function(){return u("swal.getButtonsWrapper() is deprecated and will be removed in the next major release, use swal.getActions() instead"),w(o.actions)},e.getActions=function(){return E()},e.getConfirmButton=function(){return B()},e.getCancelButton=function(){return P()},e.getFooter=function(){return L()},e.isLoading=function(){return y().hasAttribute("data-loading")},e.enableButtons=function(){G.disabled=!1,ee.disabled=!1},e.disableButtons=function(){G.disabled=!0,ee.disabled=!0},e.enableConfirmButton=function(){G.disabled=!1},e.disableConfirmButton=function(){G.disabled=!0},e.enableInput=function(){var e=p();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=p();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=S();t.innerHTML=e;var n=window.getComputedStyle(b);t.style.marginLeft="-"+n.getPropertyValue("padding-left"),t.style.marginRight="-"+n.getPropertyValue("padding-right"),I(t);var i=p();i&&(i.setAttribute("aria-invalid",!0),i.setAttribute("aria-describedBy",o.validationerror),R(i),D(i,o.inputerror))},e.resetValidationError=function(){var e=S();e&&U(e);var t=p();t&&(t.removeAttribute("aria-invalid"),t.removeAttribute("aria-describedBy"),H(t,o.inputerror))},e.getProgressSteps=function(){return r.progressSteps},e.setProgressSteps=function(e){r.progressSteps=e,$(r)},e.showProgressSteps=function(){I(A())},e.hideProgressSteps=function(){U(A())},e.enableButtons(),e.hideLoading(),e.resetValidationError(),r.input&&D(document.body,o["has-input"]);for(var ne=["input","file","range","select","radio","checkbox","textarea"],oe=void 0,ie=0;ie<ne.length;ie++){var re=o[ne[ie]],ae=M(Y,re);if(oe=p(ne[ie])){for(var se in oe.attributes)if(oe.attributes.hasOwnProperty(se)){var le=oe.attributes[se].name;"type"!==le&&"value"!==le&&oe.removeAttribute(le)}for(var ue in r.inputAttributes)oe.setAttribute(ue,r.inputAttributes[ue])}ae.className=re,r.inputClass&&D(ae,r.inputClass),U(ae)}var ce,de,pe,fe,me,ge=void 0;switch(r.input){case"text":case"email":case"password":case"number":case"tel":case"url":(oe=M(Y,o.input)).value=r.inputValue,oe.placeholder=r.inputPlaceholder,oe.type=r.input,I(oe);break;case"file":(oe=M(Y,o.file)).placeholder=r.inputPlaceholder,oe.type=r.input,I(oe);break;case"range":var be=M(Y,o.range),ve=be.querySelector("input"),he=be.querySelector("output");ve.value=r.inputValue,ve.type=r.input,he.value=r.inputValue,I(be);break;case"select":var ye=M(Y,o.select);if(ye.innerHTML="",r.inputPlaceholder){var we=document.createElement("option");we.innerHTML=r.inputPlaceholder,we.value="",we.disabled=!0,we.selected=!0,ye.appendChild(we)}ge=function(e){e.forEach(function(e){var t=f(e,2),n=t[0],o=t[1],i=document.createElement("option");i.value=n,i.innerHTML=o,r.inputValue.toString()===n.toString()&&(i.selected=!0),ye.appendChild(i)}),I(ye),ye.focus()};break;case"radio":var Ce=M(Y,o.radio);Ce.innerHTML="",ge=function(e){e.forEach(function(e){var t=f(e,2),n=t[0],i=t[1],a=document.createElement("input"),s=document.createElement("label");a.type="radio",a.name=o.radio,a.value=n,r.inputValue.toString()===n.toString()&&(a.checked=!0),s.innerHTML=i,s.insertBefore(a,s.firstChild),Ce.appendChild(s)}),I(Ce);var t=Ce.querySelectorAll("input");t.length&&t[0].focus()};break;case"checkbox":var xe=M(Y,o.checkbox),ke=p("checkbox");ke.type="checkbox",ke.value=1,ke.id=o.checkbox,ke.checked=Boolean(r.inputValue);var Ae=xe.getElementsByTagName("span");Ae.length&&xe.removeChild(Ae[0]),(Ae=document.createElement("span")).innerHTML=r.inputPlaceholder,xe.appendChild(Ae),I(xe);break;case"textarea":var Se=M(Y,o.textarea);Se.value=r.inputValue,Se.placeholder=r.inputPlaceholder,I(Se);break;case null:break;default:s('Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "'+r.input+'"')}if("select"===r.input||"radio"===r.input){var Be=function(e){return ge((n=[],(t=e)instanceof Map?t.forEach(function(e,t){n.push([t,e])}):Object.keys(t).forEach(function(e){n.push([e,t[e]])}),n));var t,n};r.inputOptions instanceof Promise?(e.showLoading(),r.inputOptions.then(function(t){e.hideLoading(),Be(t)})):"object"===d(r.inputOptions)?Be(r.inputOptions):s("Unexpected type of inputOptions! Expected object, Map or Promise, got "+d(r.inputOptions))}ce=r.animation,de=r.onBeforeOpen,pe=r.onOpen,fe=h(),me=y(),null!==de&&"function"==typeof de&&de(me),ce?(D(me,o.show),D(fe,o.fade),H(me,o.hide)):H(me,o.fade),I(me),fe.style.overflowY="hidden",z&&!j(me,o.noanimation)?me.addEventListener(z,function e(){me.removeEventListener(z,e),fe.style.overflowY="auto"}):fe.style.overflowY="auto",D([document.documentElement,document.body,fe],o.shown),q()&&(F(),J()),m.previousActiveElement=document.activeElement,null!==pe&&"function"==typeof pe&&setTimeout(function(){pe(me)}),r.toast||(c(r.allowEnterKey)?r.focusCancel&&W(ee)?ee.focus():r.focusConfirm&&W(G)?G.focus():te(-1,1):document.activeElement&&document.activeElement.blur()),h().scrollTop=0})}};return X.isVisible=function(){return!!y()},X.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),X(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)})},X.getQueueStep=function(){return document.body.getAttribute("data-swal2-queue-step")},X.insertQueueStep=function(e,t){return t&&t<Z.length?Z.splice(t,0,e):Z.push(e)},X.deleteQueueStep=function(e){void 0!==Z[e]&&Z.splice(e,1)},X.close=X.closePopup=X.closeModal=X.closeToast=function(e){var t=h(),n=y();if(n){H(n,o.show),D(n,o.hide),clearTimeout(n.timeout),document.body.classList.contains(o["toast-shown"])||(!function(){if(m.previousActiveElement&&m.previousActiveElement.focus){var e=window.scrollX,t=window.scrollY;m.previousActiveElement.focus(),void 0!==e&&void 0!==t&&window.scrollTo(e,t)}}(),window.onkeydown=_,Q=!1);var i=function(){t.parentNode&&t.parentNode.removeChild(t),H([document.documentElement,document.body],[o.shown,o["no-backdrop"],o["has-input"],o["toast-shown"]]),q()&&(null!==m.previousBodyPadding&&(document.body.style.paddingRight=m.previousBodyPadding,m.previousBodyPadding=null),function(){if(j(document.body,o.iosfix)){var e=parseInt(document.body.style.top,10);H(document.body,o.iosfix),document.body.style.top="",document.body.scrollTop=-1*e}}())};z&&!j(n,o.noanimation)?n.addEventListener(z,function e(){n.removeEventListener(z,e),j(n,o.hide)&&i()}):i(),null!==e&&"function"==typeof e&&setTimeout(function(){e(n)})}},X.clickConfirm=function(){return B().click()},X.clickCancel=function(){return P().click()},X.showLoading=X.enableLoading=function(){var e=y();e||X(""),e=y();var t=E(),n=B(),i=P();I(t),I(n),D([e,t],o.loading),n.disabled=!0,i.disabled=!0,e.setAttribute("data-loading",!0),e.setAttribute("aria-busy",!0),e.focus()},X.isValidParameter=function(t){return e.hasOwnProperty(t)||"extraParams"===t},X.isDeprecatedParameter=function(e){return-1!==t.indexOf(e)},X.setDefaults=function(e){if(!e||"object"!==(void 0===e?"undefined":d(e)))return s("the argument for setDefaults() is required and has to be a object");for(var t in Y(e),e)X.isValidParameter(t)&&(K[t]=e[t])},X.resetDefaults=function(){K=p({},e)},X.adaptInputValidator=function(e){return function(t,n){return e.call(this,t,n).then(function(){},function(e){return e})}},X.DismissReason=Object.freeze({cancel:"cancel",backdrop:"overlay",close:"close",esc:"esc",timer:"timer"}),X.noop=function(){},X.version="7.12.17",X.default=X,"undefined"!=typeof window&&"object"===d(window._swalDefaults)&&X.setDefaults(window._swalDefaults),X}),"undefined"!=typeof window&&window.Sweetalert2&&(window.sweetAlert=window.swal=window.Sweetalert2);