UNPKG

holly-packages

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