1 line
40 KiB
JavaScript
1 line
40 KiB
JavaScript
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Sweetalert2=t()}(this,(function(){"use strict";const e={},t=t=>new Promise((n=>{if(!t)return n();const o=window.scrollX,i=window.scrollY;e.restoreFocusTimeout=setTimeout((()=>{e.previousActiveElement instanceof HTMLElement?(e.previousActiveElement.focus(),e.previousActiveElement=null):document.body&&document.body.focus(),n()}),100),window.scrollTo(o,i)}));var n={promise:new WeakMap,innerParams:new WeakMap,domCache:new WeakMap};const o="swal2-",i=["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","show","hide","close","title","html-container","actions","confirm","deny","cancel","default-outline","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","input-label","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loader","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","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error"].reduce(((e,t)=>(e[t]=o+t,e)),{}),s=["success","warning","info","question","error"].reduce(((e,t)=>(e[t]=o+t,e)),{}),r=e=>e.charAt(0).toUpperCase()+e.slice(1),a=[],l=(e,t)=>{var n;n=`"${e}" is deprecated and will be removed in the next major release. Please use "${t}" instead.`,a.includes(n)||a.push(n)},c=e=>"function"==typeof e?e():e,u=e=>e&&"function"==typeof e.toPromise,d=e=>u(e)?e.toPromise():Promise.resolve(e),p=e=>e&&Promise.resolve(e)===e,m=()=>document.body.querySelector(`.${i.container}`),g=e=>{const t=m();return t?t.querySelector(e):null},h=e=>g(`.${e}`),f=()=>h(i.popup),b=()=>h(i.icon),y=()=>h(i.title),w=()=>h(i["html-container"]),v=()=>h(i.image),C=()=>h(i["progress-steps"]),A=()=>h(i["validation-message"]),k=()=>g(`.${i.actions} .${i.confirm}`),B=()=>g(`.${i.actions} .${i.cancel}`),P=()=>g(`.${i.actions} .${i.deny}`),E=()=>g(`.${i.loader}`),x=()=>h(i.actions),T=()=>h(i.footer),$=()=>h(i["timer-progress-bar"]),L=()=>h(i.close),S=()=>{const e=f();if(!e)return[];const t=e.querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])'),n=Array.from(t).sort(((e,t)=>{const n=parseInt(e.getAttribute("tabindex")||"0"),o=parseInt(t.getAttribute("tabindex")||"0");return n>o?1:n<o?-1:0})),o=e.querySelectorAll('\n a[href],\n area[href],\n input:not([disabled]),\n select:not([disabled]),\n textarea:not([disabled]),\n button:not([disabled]),\n iframe,\n object,\n embed,\n [tabindex="0"],\n [contenteditable],\n audio[controls],\n video[controls],\n summary\n'),i=Array.from(o).filter((e=>"-1"!==e.getAttribute("tabindex")));return[...new Set(n.concat(i))].filter((e=>Y(e)))},O=()=>H(document.body,i.shown)&&!H(document.body,i["toast-shown"])&&!H(document.body,i["no-backdrop"]),M=()=>{const e=f();return!!e&&H(e,i.toast)},j=(e,t)=>{if(e.textContent="",t){const n=(new DOMParser).parseFromString(t,"text/html"),o=n.querySelector("head");o&&Array.from(o.childNodes).forEach((t=>{e.appendChild(t)}));const i=n.querySelector("body");i&&Array.from(i.childNodes).forEach((t=>{t instanceof HTMLVideoElement||t instanceof HTMLAudioElement?e.appendChild(t.cloneNode(!0)):e.appendChild(t)}))}},H=(e,t)=>{if(!t)return!1;const n=t.split(/\s+/);for(let t=0;t<n.length;t++)if(!e.classList.contains(n[t]))return!1;return!0},I=(e,t,n)=>{if(((e,t)=>{Array.from(e.classList).forEach((n=>{Object.values(i).includes(n)||Object.values(s).includes(n)||Object.values(t.showClass||{}).includes(n)||e.classList.remove(n)}))})(e,t),t.customClass&&t.customClass[n]){if("string"!=typeof t.customClass[n]&&!t.customClass[n].forEach)return void t.customClass[n];N(e,t.customClass[n])}},D=(e,t
|