vendor: 4,202 bytes, lines 1-15
1/******/ (() => { // webpackBootstrap 2/******/ var __webpack_modules__ = ({ 3 4/***/ 757: 5/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6 7module.exports = __webpack_require__(666); 8 9 10/***/ }), 11 12/***/ 711: 13/***/ (function(module, __unused_webpack_exports, __webpack_require__) { 14 15!function(e,t){ true?module.exports=t():0}(this,function(){"use strict";var e="undefined"!=typeof window?window:"undefined"!=typeof __webpack_require__.g?__webpack_require__.g:"undefined"!=typeof self?self:{},t="Expected a function",n=NaN,o="[object Symbol]",i=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,c=/^0o[0-7]+$/i,s=parseInt,u="object"==typeof e&&e&&e.Object===Object&&e,d="object"==typeof self&&self&&self.Object===Object&&self,l=u||d||Function("return this")(),f=Object.prototype.toString,m=Math.max,p=Math.min,b=function(){return l.Date.now()};function v(e,n,o){var i,a,r,c,s,u,d=0,l=!1,f=!1,v=!0;if("function"!=typeof e)throw new TypeError(t);function y(t){var n=i,o=a;return i=a=void 0,d=t,c=e.apply(o,n)}function h(e){var t=e-u;return void 0===u||t>=n||t<0||f&&e-d>=r}function k(){var e=b();if(h(e))return x(e);s=setTimeout(k,function(e){var t=n-(e-u);return f?p(t,r-(e-d)):t}(e))}function x(e){return s=void 0,v&&i?y(e):(i=a=void 0,c)}function O(){var e=b(),t=h(e);if(i=arguments,a=this,u=e,t){if(void 0===s)return function(e){return d=e,s=setTimeout(k,n),l?y(e):c}(u);if(f)return s=setTimeout(k,n),y(u)}return void 0===s&&(s=setTimeout(k,n)),c}return n=w(n)||0,g(o)&&(l=!!o.leading,r=(f="maxWait"in o)?m(w(o.maxWait)||0,n):r,v="trailing"in o?!!o.trailing:v),O.cancel=function(){void 0!==s&&clearTimeout(s),d=0,i=u=a=s=void 0},O.flush=function(){return void 0===s?c:x(b())},O}function g(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function w(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&f.call(e)==o}(e))return n;if(g(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=g(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var u=r.test(e);return u||c.test(e)?s(e.slice(2),u?2:8):a.test(e)?n:+e}var y=function(e,n,o){var i=!0,a=!0;if("function"!=typeof e)throw new TypeError(t);return g(o)&&(i="leading"in o?!!o.leading:i,a="trailing"in o?!!o.trailing:a),v(e,n,{leading:i,maxWait:n,trailing:a})},h="Expected a function",k=NaN,x="[object Symbol]",O=/^\s+|\s+$/g,j=/^[-+]0x[0-9a-f]+$/i,E=/^0b[01]+$/i,N=/^0o[0-7]+$/i,z=parseInt,C="object"==typeof e&&e&&e.Object===Object&&e,A="object"==typeof self&&self&&self.Object===Object&&self,q=C||A||Function("return this")(),L=Object.prototype.toString,T=Math.max,M=Math.min,S=function(){return q.Date.now()};function D(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function H(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&L.call(e)==x}(e))return k;if(D(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=D(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(O,"");var n=E.test(e);return n||N.test(e)?z(e.slice(2),n?2:8):j.test(e)?k:+e}var $=function(e,t,n){var o,i,a,r,c,s,u=0,d=!1,l=!1,f=!0;if("function"!=typeof e)throw new TypeError(h);function m(t){var n=o,a=i;return o=i=void 0,u=t,r=e.apply(a,n)}function p(e){var n=e-s;return void 0===s||n>=t||n<0||l&&e-u>=a}function b(){var e=S();if(p(e))return v(e);c=setTimeout(b,function(e){var n=t-(e-s);return l?M(n,a-(e-u)):n}(e))}function v(e){return c=void 0,f&&o?m(e):(o=i=void 0,r)}function g(){var e=S(),n=p(e);if(o=arguments,i=this,s=e,n){if(void 0===c)return function(e){return u=e,c=setTimeout(b,t),d?m(e):r}(s);if(l)return c=setTimeout(b,t),m(s)}return void 0===c&&(c=setTimeout(b,t)),r}return t=H(t)||0,D(n)&&(d=!!n.leading,a=(l="maxWait"in n)?T(H(n.maxWait)||0,t):a,f="trailing"in n?!!n.trailing:f),g.cancel=function(){void 0!==c&&clearTimeout(c),u=0,o=s=i=c=void 0},g.flush=function(){return void 0===c?r:v(S())},g},W=function(){};function P(e){e&&e.forEach(function(e){var t=Array.prototype.slice.call(e.addedNodes),n=Array.prototype.slice.call(e.removedNodes);if(function e(t){var n=void 0,o=void 0;for(n=0;n<t.length;n+=1){if((o=t[n]).dataset&&o.dataset.aos)return!0;
15if(o.children&&e(o.children))return!0}return!1}(t.concat(n)))return W()})}function Y(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}var _={isSupported:function(){return!!Y()},ready:function(e,t){var n=window.document,o=new(Y())(P);W=t,o.observe(n.documentElement,{childList:!0,subtree:!0,removedNodes:!0})}},B=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},F=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),I=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},K=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,G=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,J=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i,Q=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
15sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;function R(){return navigator.userAgent||navigator.vendor||window.opera||""}var U=new(function(){function e(){B(this,e)}return F(e,[{key:"phone",value:function(){var e=R();return!(!K.test(e)&&!G.test(e.substr(0,4)))}},{key:"mobile",value:function(){var e=R();return!(!J.test(e)&&!Q.test(e.substr(0,4)))}},{key:"tablet",value:function(){return this.mobile()&&!this.phone()}},{key:"ie11",value:function(){return"-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style}}]),e}()),V=function(e,t){var n=void 0;return U.ie11()?(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,{detail:t}):n=new CustomEvent(e,{detail:t}),document.dispatchEvent(n)},X=function(e){return e.forEach(function(e,t){return function(e,t){var n=e.options,o=e.position,i=e.node,a=(e.data,function(){e.animated&&(function(e,t){t&&t.forEach(function(t){return e.classList.remove(t)})}(i,n.animatedClassNames),V("aos:out",i),e.options.id&&V("aos:in:"+e.options.id,i),e.animated=!1)});n.mirror&&t>=o.out&&!n.once?a():t>=o.in?e.animated||(function(e,t){t&&t.forEach(function(t){return e.classList.add(t)})}(i,n.animatedClassNames),V("aos:in",i),e.options.id&&V("aos:in:"+e.options.id,i),e.animated=!0):e.animated&&!n.once&&a()}(e,window.pageYOffset)})},Z=function(e){for(var t=0,n=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-("BODY"!=e.tagName?e.scrollLeft:0),n+=e.offsetTop-("BODY"!=e.tagName?e.scrollTop:0),e=e.offsetParent;return{top:n,left:t}},ee=function(e,t,n){var o=e.getAttribute("data-aos-"+t);if(void 0!==o){if("true"===o)return!0;if("false"===o)return!1}return o||n},te=function(e,t){return e.forEach(function(e,n){var o=ee(e.node,"mirror",t.mirror),i=ee(e.node,"once",t.once),a=ee(e.node,"id"),r=t.useClassNames&&e.node.getAttribute("data-aos"),c=[t.animatedClassName].concat(r?r.split(" "):[]).filter(function(e){return"string"==typeof e});t.initClassName&&e.node.classList.add(t.initClassName),e.position={in:function(e,t,n){var o=window.innerHeight,i=ee(e,"anchor"),a=ee(e,"anchor-placement"),r=Number(ee(e,"offset",a?0:t)),c=a||n,s=e;i&&document.querySelectorAll(i)&&(s=document.querySelectorAll(i)[0]);var u=Z(s).top-o;switch(c){case"top-bottom":break;case"center-bottom":u+=s.offsetHeight/2;break;case"bottom-bottom":u+=s.offsetHeight;break;case"top-center":u+=o/2;break;case"center-center":u+=o/2+s.offsetHeight/2;break;case"bottom-center":u+=o/2+s.offsetHeight;break;case"top-top":u+=o;break;case"bottom-top":u+=o+s.offsetHeight;break;case"center-top":u+=o+s.offsetHeight/2}return u+r}(e.node,t.offset,t.anchorPlacement),out:o&&function(e,t){window.innerHeight;var n=ee(e,"anchor"),o=ee(e,"offset",t),i=e;return n&&document.querySelectorAll(n)&&(i=document.querySelectorAll(n)[0]),Z(i).top+i.offsetHeight-o}(e.node,t.offset)},e.options={once:i,mirror:o,animatedClassNames:c,id:a}}),e},ne=function(){var e=document.querySelectorAll("[data-aos]");return Array.prototype.map.call(e,function(e){return{node:e}})},oe=[],ie=!1,ae={offset:120,delay:0,easing:"ease",duration:400,disable:!1,once:!1,mirror:!1,anchorPlacement:"top-bottom",startEvent:"DOMContentLoaded",animatedClassName:"aos-animate",initClassName:"aos-init",useClassNames:!1,disableMutationObserver:!1,throttleDelay:99,debounceDelay:50},re=function(){return document.all&&!window.atob},ce=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(ie=!0),ie&&(oe=te(oe,ae),X(oe),window.addEventListener("scroll",y(function(){X(oe,ae.once)},ae.throttleDelay)))},se=function(){if(oe=ne(),de(ae.disable)||re())return ue();ce()},ue=function(){oe.forEach(function(e,t){e.node.removeAttribute("data-aos"),e.node.removeAttribute("data-aos-easing"),e.node.removeAttribute("data-aos-duration"),e.node.removeAttribute("data-aos-delay"),ae.initClassName&&e.node.classList.remove(ae.initClassName),ae.animatedClassName&&e.node.classList.remove(ae.animatedClassName)})},de=function(e){return!0===e||"mobile"===e&&U.mobile()||"phone"===e&&U.phone()||"tablet"===e&&U.tablet()||"function"==typeof e&&!0===e()};return{init:function(e){return ae=I(ae,e),oe=ne(),ae.disableMutationObserver||_.isSupported()||(console.info('\n aos: MutationObserver is not supported on this browser,\n code mutations observing has been disabled.\n You may have to call "refreshHard()" by yourself.\n '),ae.disableMutationObserver=!0),ae.disableMutationObserver||_.ready("[data-aos]",se),de(ae.disable)||re()?ue():(document.querySelector("body").setAttribute("data-aos-easing",ae.easing),document.querySelector("body").setAttribute("data-aos-duration",ae.duration),document.querySelector("body").setAttribute("data-aos-delay",ae.delay),-1===["DOMContentLoaded","load"].indexOf(ae.startEvent)?document.addEventListener(ae.startEvent,function(){ce(!0)}):window.addEventListener("load",function(){ce(!0)}
15),"DOMContentLoaded"===ae.startEvent&&["complete","interactive"].indexOf(document.readyState)>-1&&ce(!0),window.addEventListener("resize",$(ce,ae.debounceDelay,!0)),window.addEventListener("orientationchange",$(ce,ae.debounceDelay,!0)),oe)},refresh:ce,refreshHard:se}}); 16 17 18/***/ }), 19 20/***/ 456: 21/***/ (() => { 22 23// Polyfill for creating CustomEvents on IE9/10/11 24 25// code pulled from: 26// https://github.com/d4tocchini/customevent-polyfill 27// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill 28 29try { 30 var ce = new window.CustomEvent('test'); 31 ce.preventDefault(); 32 if (ce.defaultPrevented !== true) { 33 // IE has problems with .preventDefault() on custom events 34 // http://stackoverflow.com/questions/23349191 35 throw new Error('Could not prevent default'); 36 } 37} catch(e) { 38 var CustomEvent = function(event, params) { 39 var evt, origPrevent; 40 params = params || { 41 bubbles: false, 42 cancelable: false, 43 detail: undefined 44 }; 45 46 evt = document.createEvent("CustomEvent"); 47 evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); 48 origPrevent = evt.preventDefault; 49 evt.preventDefault = function () { 50 origPrevent.call(this); 51 try { 52 Object.defineProperty(this, 'defaultPrevented', { 53 get: function () { 54 return true; 55 } 56 }); 57 } catch(e) { 58 this.defaultPrevented = true; 59 } 60 }; 61 return evt; 62 }; 63 64 CustomEvent.prototype = window.Event.prototype; 65 window.CustomEvent = CustomEvent; // expose definition to window 66} 67 68 69/***/ }), 70 71/***/ 631: 72/***/ (function(module) { 73 74/*! 75 * headroom.js v0.12.0 - Give your page some headroom. Hide your header until you need it 76 * Copyright (c) 2020 Nick Williams - http://wicky.nillia.ms/headroom.js 77 * License: MIT 78 */ 79 80(function (global, factory) { 81 true ? module.exports = factory() : 82 0; 83}(this, function () { 'use strict'; 84 85 function isBrowser() { 86 return typeof window !== "undefined"; 87 } 88 89 /** 90 * Used to detect browser support for adding an event listener with options 91 * Credit: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener 92 */ 93 function passiveEventsSupported() { 94 var supported = false; 95 96 try { 97 var options = { 98 // eslint-disable-next-line getter-return 99 get passive() { 100 supported = true; 101 } 102 }; 103 window.addEventListener("test", options, options); 104 window.removeEventListener("test", options, options); 105 } catch (err) { 106 supported = false; 107 } 108 109 return supported; 110 } 111 112 function isSupported() { 113 return !!( 114 isBrowser() && 115 function() {}.bind && 116 "classList" in document.documentElement && 117 Object.assign && 118 Object.keys && 119 requestAnimationFrame 120 ); 121 } 122 123 function isDocument(obj) { 124 return obj.nodeType === 9; // Node.DOCUMENT_NODE === 9 125 } 126 127 function isWindow(obj) { 128 // `obj === window` or `obj instanceof Window` is not sufficient, 129 // as the obj may be the window of an iframe. 130 return obj && obj.document && isDocument(obj.document); 131 } 132 133 function windowScroller(win) { 134 var doc = win.document; 135 var body = doc.body; 136 var html = doc.documentElement; 137 138 return { 139 /** 140 * @see http://james.padolsey.com/javascript/get-document-height-cross-browser/ 141 * @return {Number} the scroll height of the document in pixels 142 */ 143 scrollHeight: function() { 144 return Math.max( 145 body.scrollHeight, 146 html.scrollHeight, 147 body.offsetHeight, 148 html.offsetHeight, 149 body.clientHeight, 150 html.clientHeight 151 ); 152 }, 153 154 /** 155 * @see http://andylangton.co.uk/blog/development/get-viewport-size-width-and-height-javascript 156 * @return {Number} the height of the viewport in pixels 157 */ 158 height: function() { 159 return win.innerHeight || html.clientHeight || body.clientHeight; 160 }, 161 162 /** 163 * Gets the Y scroll position 164 * @return {Number} pixels the page has scrolled along the Y-axis 165 */ 166 scrollY: function() { 167 if (win.pageYOffset !== undefined) { 168 return win.pageYOffset; 169 } 170 171 return (html || body.parentNode || body).scrollTop; 172 } 173 }; 174 } 175 176 function elementScroller(element) { 177 return { 178 /** 179 * @return {Number} the scroll height of the element in pixels 180 */ 181 scrollHeight: function() { 182 return Math.max( 183 element.scrollHeight, 184 element.offsetHeight, 185 element.clientHeight 186 ); 187 }, 188 189 /** 190 * @return {Number} the height of the element in pixels 191 */ 192 height: function() { 193 return Math.max(element.offsetHeight, element.clientHeight); 194 }, 195 196 /** 197 * Gets the Y scroll position 198 * @return {Number} pixels the element has scrolled along the Y-axis 199 */ 200 scrollY: function() { 201 return element.scrollTop; 202 } 203 }; 204 } 205 206 function createScroller(element) { 207 return isWindow(element) ? windowScroller(element) : elementScroller(element); 208 } 209 210 /** 211 * @param element EventTarget 212 */ 213 function trackScroll(element, options, callback) { 214 var isPassiveSupported = passiveEventsSupported(); 215 var rafId; 216 var scrolled = false;
vendor: 7,270 bytes, lines 217-523
217 var scroller = createScroller(element); 218 var lastScrollY = scroller.scrollY(); 219 var details = {}; 220 221 function update() { 222 var scrollY = Math.round(scroller.scrollY()); 223 var height = scroller.height(); 224 var scrollHeight = scroller.scrollHeight(); 225 226 // reuse object for less memory churn 227 details.scrollY = scrollY; 228 details.lastScrollY = lastScrollY; 229 details.direction = scrollY > lastScrollY ? "down" : "up"; 230 details.distance = Math.abs(scrollY - lastScrollY); 231 details.isOutOfBounds = scrollY < 0 || scrollY + height > scrollHeight; 232 details.top = scrollY <= options.offset[details.direction]; 233 details.bottom = scrollY + height >= scrollHeight; 234 details.toleranceExceeded = 235 details.distance > options.tolerance[details.direction]; 236 237 callback(details); 238 239 lastScrollY = scrollY; 240 scrolled = false; 241 } 242 243 function handleScroll() { 244 if (!scrolled) { 245 scrolled = true; 246 rafId = requestAnimationFrame(update); 247 } 248 } 249 250 var eventOptions = isPassiveSupported 251 ? { passive: true, capture: false } 252 : false; 253 254 element.addEventListener("scroll", handleScroll, eventOptions); 255 update(); 256 257 return { 258 destroy: function() { 259 cancelAnimationFrame(rafId); 260 element.removeEventListener("scroll", handleScroll, eventOptions); 261 } 262 }; 263 } 264 265 function normalizeUpDown(t) { 266 return t === Object(t) ? t : { down: t, up: t }; 267 } 268 269 /** 270 * UI enhancement for fixed headers. 271 * Hides header when scrolling down 272 * Shows header when scrolling up 273 * @constructor 274 * @param {DOMElement} elem the header element 275 * @param {Object} options options for the widget 276 */ 277 function Headroom(elem, options) { 278 options = options || {}; 279 Object.assign(this, Headroom.options, options); 280 this.classes = Object.assign({}, Headroom.options.classes, options.classes); 281 282 this.elem = elem; 283 this.tolerance = normalizeUpDown(this.tolerance); 284 this.offset = normalizeUpDown(this.offset); 285 this.initialised = false; 286 this.frozen = false; 287 } 288 Headroom.prototype = { 289 constructor: Headroom, 290 291 /** 292 * Start listening to scrolling 293 * @public 294 */ 295 init: function() { 296 if (Headroom.cutsTheMustard && !this.initialised) { 297 this.addClass("initial"); 298 this.initialised = true; 299 300 // defer event registration to handle browser 301 // potentially restoring previous scroll position 302 setTimeout( 303 function(self) { 304 self.scrollTracker = trackScroll( 305 self.scroller, 306 { offset: self.offset, tolerance: self.tolerance }, 307 self.update.bind(self) 308 ); 309 }, 310 100, 311 this 312 ); 313 } 314 315 return this; 316 }, 317 318 /** 319 * Destroy the widget, clearing up after itself 320 * @public 321 */ 322 destroy: function() { 323 this.initialised = false; 324 Object.keys(this.classes).forEach(this.removeClass, this); 325 this.scrollTracker.destroy(); 326 }, 327 328 /** 329 * Unpin the element 330 * @public 331 */ 332 unpin: function() { 333 if (this.hasClass("pinned") || !this.hasClass("unpinned")) { 334 this.addClass("unpinned"); 335 this.removeClass("pinned"); 336 337 if (this.onUnpin) { 338 this.onUnpin.call(this); 339 } 340 } 341 }, 342 343 /** 344 * Pin the element 345 * @public 346 */ 347 pin: function() { 348 if (this.hasClass("unpinned")) { 349 this.addClass("pinned"); 350 this.removeClass("unpinned"); 351 352 if (this.onPin) { 353 this.onPin.call(this); 354 } 355 } 356 }, 357 358 /** 359 * Freezes the current state of the widget 360 * @public 361 */ 362 freeze: function() { 363 this.frozen = true; 364 this.addClass("frozen"); 365 }, 366 367 /** 368 * Re-enables the default behaviour of the widget 369 * @public 370 */ 371 unfreeze: function() { 372 this.frozen = false; 373 this.removeClass("frozen"); 374 }, 375 376 top: function() { 377 if (!this.hasClass("top")) { 378 this.addClass("top"); 379 this.removeClass("notTop"); 380 381 if (this.onTop) { 382 this.onTop.call(this); 383 } 384 } 385 }, 386 387 notTop: function() { 388 if (!this.hasClass("notTop")) { 389 this.addClass("notTop"); 390 this.removeClass("top"); 391 392 if (this.onNotTop) { 393 this.onNotTop.call(this); 394 } 395 } 396 }, 397 398 bottom: function() { 399 if (!this.hasClass("bottom")) { 400 this.addClass("bottom"); 401 this.removeClass("notBottom"); 402 403 if (this.onBottom) { 404 this.onBottom.call(this); 405 } 406 } 407 }, 408 409 notBottom: function() { 410 if (!this.hasClass("notBottom")) { 411 this.addClass("notBottom"); 412 this.removeClass("bottom"); 413 414 if (this.onNotBottom) { 415 this.onNotBottom.call(this); 416 } 417 } 418 }, 419 420 shouldUnpin: function(details) { 421 var scrollingDown = details.direction === "down"; 422 423 return scrollingDown && !details.top && details.toleranceExceeded; 424 }, 425 426 shouldPin: function(details) { 427 var scrollingUp = details.direction === "up"; 428 429 return (scrollingUp && details.toleranceExceeded) || details.top; 430 }, 431 432 addClass: function(className) { 433 this.elem.classList.add.apply( 434 this.elem.classList, 435 this.classes[className].split(" ") 436 ); 437 }, 438 439 removeClass: function(className) { 440 this.elem.classList.remove.apply( 441 this.elem.classList, 442 this.classes[className].split(" ") 443 ); 444 }, 445 446 hasClass: function(className) { 447 return this.classes[className].split(" ").every(function(cls) { 448 return this.classList.contains(cls); 449 }, this.elem); 450 }, 451 452 update: function(details) { 453 if (details.isOutOfBounds) { 454 // Ignore bouncy scrolling in OSX 455 return; 456 } 457 458 if (this.frozen === true) { 459 return; 460 } 461 462 if (details.top) { 463 this.top(); 464 } else { 465 this.notTop(); 466 } 467 468 if (details.bottom) { 469 this.bottom(); 470 } else { 471 this.notBottom(); 472 } 473 474 if (this.shouldUnpin(details)) { 475 this.unpin(); 476 } else if (this.shouldPin(details)) { 477 this.pin(); 478 } 479 } 480 }; 481 482 /** 483 * Default options 484 * @type {Object} 485 */ 486 Headroom.options = { 487 tolerance: { 488 up: 0, 489 down: 0 490 }, 491 offset: 0, 492 scroller: isBrowser() ? window : null, 493 classes: { 494 frozen: "headroom--frozen", 495 pinned: "headroom--pinned", 496 unpinned: "headroom--unpinned", 497 top: "headroom--top", 498 notTop: "headroom--not-top", 499 bottom: "headroom--bottom", 500 notBottom: "headroom--not-bottom", 501 initial: "headroom" 502 } 503 }; 504 505 Headroom.cutsTheMustard = isSupported(); 506 507 return Headroom; 508 509})); 510 511 512/***/ }), 513 514/***/ 443: 515/***/ (function(module, exports, __webpack_require__) { 516 517var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/* 518 0BSD 519*/ 520(function(F,y){ true?!(__WEBPACK_AMD_DEFINE_FACTORY__ = (y), 521 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 522 (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : 523 __WEBPACK_AMD_DEFINE_FACTORY__),
524 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):0})(this,function(){function F(a,c,b){b=b||[];if(a instanceof Element)c.apply(c,[a].concat(b));else{var d;var e=a.length;for(d=0;d<e;++d)c.apply(c,[a[d]].concat(b))}}function y(a){F(a,function(a){a.parentElement.removeChild(a)})}function J(a,c){do a=a.parentElement;while(a&&!B(a,c));return a}function B(a,c){return(a.matches||a.webkitMatchesSelector||a.msMatchesSelector).call(a, 525c)}function k(a,c){return a&&a.classList.contains(c)}function l(a,c){a.classList.add(c)}function q(a,c,b,d){if(-1!==b.indexOf(" ")){b=b.split(" ");var e=b.length,h;for(h=0;h<e;++h)q(a,c,b[h],d)}else a.__pickmeup.events.push([c,b,d]),c.addEventListener(b,d)}function z(a,c,b,d){var e;if(b&&-1!==b.indexOf(" ")){var h=b.split(" ");var l=h.length;for(e=0;e<l;++e)z(a,c,h[e],d)}else for(h=a.__pickmeup.events,l=h.length,e=0;e<l;++e)c&&c!==h[e][0]||b&&b!==h[e][1]||d&&d!==h[e][2]||h[e][0].removeEventListener(h[e][1], 526h[e][2])}function M(a){a=a.getBoundingClientRect();return{top:a.top+window.pageYOffset-document.documentElement.clientTop,left:a.left+window.pageXOffset-document.documentElement.clientLeft}}function C(a,c,b){var d=document.createEvent("Event");b&&(d.detail=b);d.initEvent("pickmeup-"+c,!1,!0);return a.dispatchEvent(d)}function K(a){a=new Date(a);for(var c=28,b=a.getMonth();a.getMonth()===b;)++c,a.setDate(c);return c-1}function A(a,c){a.setDate(a.getDate()+c)}function p(a,c){var b=a.getDate();a.setDate(1); 527a.setMonth(a.getMonth()+c);a.setDate(Math.min(b,K(a)))}function u(a,c){var b=a.getDate();a.setDate(1);a.setFullYear(a.getFullYear()+c);a.setDate(Math.min(b,K(a)))}function N(a){var c=a.__pickmeup.element,b=a.__pickmeup.options,d=Math.floor(b.calendars/2),e=b.date,h=b.current,m=b.min?new Date(b.min):null,v=b.max?new Date(b.max):null;m&&(m.setDate(1),p(m,1),A(m,-1));v&&(v.setDate(1),p(v,1),A(v,-1));y(Array.prototype.slice.call(c.querySelectorAll(".pmu-instance > :not(nav)")));for(var w=0;w<b.calendars;w++){var f= 528new Date(h);x(f);var n=Array.prototype.slice.call(c.querySelectorAll(".pmu-instance"))[w];if(k(c,"pmu-view-years")){u(f,12*(w-d));var G=f.getFullYear()-6+" - "+(f.getFullYear()+5)}else k(c,"pmu-view-months")?(u(f,w-d),G=f.getFullYear()):k(c,"pmu-view-days")&&(p(f,w-d),G="function"===typeof b.title_format?b.title_format(f,b.locales[b.locale]):D(f,b.title_format,b.locales[b.locale]));if(!r&&v){var r=new Date(f);b.select_day?p(r,b.calendars-1):b.select_month?u(r,b.calendars-1):u(r,12*(b.calendars-1)); 529if(r>v){--w;p(h,-1);r=void 0;continue}}r=new Date(f);if(!g){var g=new Date(f);g.setDate(1);p(g,1);A(g,-1);if(m&&m>g){--w;p(h,1);g=void 0;continue}}n.querySelector(".pmu-month").innerHTML=G;var q=function(a){return"range"===b.mode&&a>=(new Date(e[0])).getFullYear()&&a<=(new Date(e[1])).getFullYear()||"multiple"===b.mode&&-1!==e.reduce(function(a,b){a.push((new Date(b)).getFullYear());return a},[]).indexOf(a)||(new Date(e)).getFullYear()===a},t=function(a,c){var d=(new Date(e[0])).getFullYear(),f=(new Date(e[1])).getFullYear(), 530h=(new Date(e[0])).getMonth(),g=(new Date(e[1])).getMonth();return"range"===b.mode&&(a>d&&a<f||a>d&&a===f&&c<=g||a===d&&a<f&&c>=h||a===d&&a===f&&c>=h&&c<=g)||"multiple"===b.mode&&-1!==e.reduce(function(a,b){b=new Date(b);a.push(b.getFullYear()+"-"+b.getMonth());return a},[]).indexOf(a+"-"+c)||(new Date(e)).getFullYear()===a&&(new Date(e)).getMonth()===c};(function(){var a=[],c=f.getFullYear()-6,d=(new Date(b.min)).getFullYear(),e=(new Date(b.max)).getFullYear(),h;for(h=0;12>h;++h){var g=c+h;var m= 531document.createElement("div");m.textContent=g;m.__pickmeup_year=g;b.min&&g<d||b.max&&g>e?l(m,"pmu-disabled"):q(g)&&l(m,"pmu-selected");a.push(m)}n.appendChild(b.instance_content_template(a,"pmu-years"))})();(function(){var a=[],c=f.getFullYear(),d=(new Date(b.min)).getFullYear(),e=(new Date(b.min)).getMonth(),g=(new Date(b.max)).getFullYear(),h=(new Date(b.max)).getMonth(),m;for(m=0;12>m;++m){var k=document.createElement("div");k.textContent=b.locales[b.locale].monthsShort[m];k.__pickmeup_month=m; 532k.__pickmeup_year=c;b.min&&(c<d||m<e&&c===d)||b.max&&(c>g||m>h&&c>=g)?l(k,"pmu-disabled"):t(c,m)&&l(k,"pmu-selected");a.push(k)}n.appendChild(b.instance_content_template(a,"pmu-months"))})();(function(){var a=[],c=f.getMonth(),d=x(new Date).valueOf(),e;(function(){f.setDate(1);var a=(f.getDay()-b.first_day)%7;A(f,-(a+(0>a?7:0)))})();for(e=0;42>e;++e){var g=document.createElement("div");g.textContent=f.getDate();g.__pickmeup_day=f.getDate();g.__pickmeup_month=f.getMonth();g.__pickmeup_year=f.getFullYear(); 533c!==f.getMonth()&&l(g,"pmu-not-in-month");
5330===f.getDay()?l(g,"pmu-sunday"):6===f.getDay()&&l(g,"pmu-saturday");var h=b.render(new Date(f))||{};var m=x(new Date(f)).valueOf();var k=b.min&&b.min>f||b.max&&b.max<f;var v=b.date.valueOf()===m||b.date instanceof Array&&b.date.reduce(function(a,b){return a||m===b.valueOf()},!1)||"range"===b.mode&&m>=b.date[0]&&m<=b.date[1];h.disabled||!("disabled"in h)&&k?l(g,"pmu-disabled"):(h.selected||!("selected"in h)&&v)&&l(g,"pmu-selected");m===d&&l(g,"pmu-today"); 534h.class_name&&h.class_name.split(" ").forEach(l.bind(g,g));a.push(g);A(f,1)}n.appendChild(b.instance_content_template(a,"pmu-days"))})()}g.setDate(1);r.setDate(1);p(r,1);A(r,-1);d=c.querySelector(".pmu-prev");c=c.querySelector(".pmu-next");d&&(d.style.visibility=b.min&&b.min>=g?"hidden":"visible");c&&(c.style.visibility=b.max&&b.max<=r?"hidden":"visible");C(a,"fill")}function t(a,c){var b=c.format,d=c.separator,e=c.locales[c.locale];if(a instanceof Date||"number"===typeof a)return x(new Date(a)); 535if(!a)return x(new Date);if(a instanceof Array){a=a.slice();for(b=0;b<a.length;++b)a[b]=t(a[b],c);return a}d=a.split(d);if(1<d.length)return d.forEach(function(a,b,d){d[b]=t(a.trim(),c)}),d;d=[].concat(e.daysShort,e.daysMin,e.days,e.monthsShort,e.months);d=d.map(function(a){return"("+a+")"});d=new RegExp("[^0-9a-zA-Z"+d.join("")+"]+");a=a.split(d);d=b.split(d);var h=new Date;for(b=0;b<a.length;b++)switch(d[b]){case "b":var m=e.monthsShort.indexOf(a[b]);break;case "B":m=e.months.indexOf(a[b]);break; 536case "d":case "e":var l=parseInt(a[b],10);break;case "m":m=parseInt(a[b],10)-1;break;case "Y":case "y":var k=parseInt(a[b],10);k+=100<k?0:29>k?2E3:1900;break;case "H":case "I":case "k":case "l":var f=parseInt(a[b],10);break;case "P":case "p":/pm/i.test(a[b])&&12>f?f+=12:/am/i.test(a[b])&&12<=f&&(f-=12);break;case "M":var n=parseInt(a[b],10)}e=new Date(void 0===k?h.getFullYear():k,void 0===m?h.getMonth():m,void 0===l?h.getDate():l,void 0===f?h.getHours():f,void 0===n?h.getMinutes():n,0);isNaN(1*e)&& 537(e=new Date);return x(e)}function x(a){a.setHours(0,0,0,0);return a}function D(a,c,b){var d=a.getMonth(),e=a.getDate(),h=a.getFullYear(),m=a.getDay(),k=a.getHours(),l=12<=k,f=l?k-12:k;var n=new Date(a.getFullYear(),a.getMonth(),a.getDate(),0,0,0);var p=new Date(a.getFullYear(),0,0,0,0,0);n=Math.floor((n-p)/864E5);0===f&&(f=12);p=a.getMinutes();var r=a.getSeconds();c=c.split("");for(var g,q=0;q<c.length;q++){g=c[q];switch(g){case "a":g=b.daysShort[m];break;case "A":g=b.days[m];break;case "b":g=b.monthsShort[d]; 538break;case "B":g=b.months[d];break;case "C":g=1+Math.floor(h/100);break;case "d":g=10>e?"0"+e:e;break;case "e":g=e;break;case "H":g=10>k?"0"+k:k;break;case "I":g=10>f?"0"+f:f;break;case "j":g=100>n?10>n?"00"+n:"0"+n:n;break;case "k":g=k;break;case "l":g=f;break;case "m":g=9>d?"0"+(1+d):1+d;break;case "M":g=10>p?"0"+p:p;break;case "p":case "P":g=l?"PM":"AM";break;case "s":g=Math.floor(a.getTime()/1E3);break;case "S":g=10>r?"0"+r:r;break;case "u":g=m+1;break;case "w":g=m;break;case "y":g=(""+h).substr(2, 5392);break;case "Y":g=h}c[q]=g}return c.join("")}function O(a,c){var b=a.__pickmeup.options,d;x(c);a:switch(b.mode){case "multiple":var e=c.valueOf();for(d=0;d<b.date.length;++d)if(b.date[d].valueOf()===e){b.date.splice(d,1);break a}b.date.push(c);break;case "range":b.lastSel||(b.date[0]=c);c<=b.date[0]?(b.date[1]=b.date[0],b.date[0]=c):b.date[1]=c;b.lastSel=!b.lastSel;break;default:b.date=c.valueOf()}c=H(b);B(a,"input")&&(a.value="single"===b.mode?c.formatted_date:c.formatted_date.join(b.separator)); 540C(a,"change",c);b.flat||!b.hide_on_select||"range"===b.mode&&b.lastSel||b.bound.hide()}function P(a,c){var b=c.target;k(b,"pmu-button")||(b=J(b,".pmu-button"));if(!k(b,"pmu-button")||k(b,"pmu-disabled"))return!1;c.preventDefault();c.stopPropagation();a=a.__pickmeup.options;var d=J(b,".pmu-instance");c=d.parentElement;d=Array.prototype.slice.call(c.querySelectorAll(".pmu-instance")).indexOf(d);B(b.parentElement,"nav")?k(b,"pmu-month")?(p(a.current,d-Math.floor(a.calendars/2)),k(c,"pmu-view-years")? 541(a.current="single"!==a.mode?new Date(a.date[a.date.length-1]):new Date(a.date),a.select_day?(c.classList.remove("pmu-view-years"),l(c,"pmu-view-days")):a.select_month&&(c.classList.remove("pmu-view-years"),l(c,"pmu-view-months"))):k(c,"pmu-view-months")?a.select_year?(c.classList.remove("pmu-view-months"),l(c,"pmu-view-years")):a.select_day&&(c.classList.remove("pmu-view-months"),l(c,"pmu-view-days")):k(c,"pmu-view-days")&&(a.select_month?(c.classList.remove("pmu-view-days"),l(c,"pmu-view-months")): 542a.select_year&&(c.classList.remove("pmu-view-days"),l(c,"pmu-view-years")))):k(b,"pmu-prev")?a.bound.prev(!1):a.bound.next(!1):k(c,"pmu-view-years")?(a.current.setFullYear(b.__pickmeup_year),a.select_month?(c.classList.remove("pmu-view-years"),l(c,"pmu-view-months")):a.select_day?(c.classList.remove("pmu-view-years"),l(c,"pmu-view-days")):a.bound.update_date(a.current)):k(c,"pmu-view-months")?(a.current.setMonth(b.__pickmeup_month),a.current.setFullYear(b.__pickmeup_year),a.select_day?(c.classList.remove("pmu-view-months"), 543l(c,"pmu-view-days")):a.bound.update_date(a.current),p(a.current,Math.floor(a.calendars/2)-d)):(c=new Date(a.current),c.setYear(b.__pickmeup_year),c.setMonth(b.__pickmeup_month),c.setDate(b.__pickmeup_day),a.bound.update_date(c));a.bound.fill();return!0}
543function H(a){if("single"===a.mode){var c=new Date(a.date);return{formatted_date:D(c,a.format,a.locales[a.locale]),date:c}}c={formatted_date:[],date:[]};a.date.forEach(function(b){b=new Date(b);c.formatted_date.push(D(b,a.format,a.locales[a.locale])); 544c.date.push(b)});return c}function I(a,c){var b=a.__pickmeup.element;if(c||k(b,"pmu-hidden")){var d=a.__pickmeup.options,e=M(a),h=window.pageXOffset,m=window.pageYOffset,l=document.documentElement.clientWidth,p=document.documentElement.clientHeight,f=e.top,n=e.left;d.bound.fill();B(a,"input")&&((c=a.value)&&d.bound.set_date(c),q(a,a,"keydown",function(a){9===a.which&&d.bound.hide()}),d.lastSel=!1);if(C(a,"show")&&!d.flat){b.classList.remove("pmu-hidden");if(d.position instanceof Function)e=d.position.call(a), 545n=e.left,f=e.top;else{switch(d.position){case "top":f-=b.offsetHeight;break;case "left":n-=b.offsetWidth;break;case "right":n+=a.offsetWidth;break;case "bottom":f+=a.offsetHeight}f+b.offsetHeight>m+p&&(f=e.top-b.offsetHeight);f<m&&(f=e.top+a.offsetHeight);n+b.offsetWidth>h+l&&(n=e.left-b.offsetWidth);n<h&&(n=e.left+a.offsetWidth);n+="px";f+="px"}b.style.left=n;b.style.top=f;setTimeout(function(){q(a,document.documentElement,"click",d.bound.hide);q(a,window,"resize",d.bound.forced_show)})}}}function Q(a, 546c){var b=a.__pickmeup.element,d=a.__pickmeup.options;c&&c.target&&(c.target===a||b.compareDocumentPosition(c.target)&16)||!C(a,"hide")||(l(b,"pmu-hidden"),z(a,document.documentElement,"click",d.bound.hide),z(a,window,"resize",d.bound.forced_show),d.lastSel=!1)}function R(a){var c=a.__pickmeup.options;z(a,document.documentElement,"click",c.bound.hide);z(a,window,"resize",c.bound.forced_show);c.bound.forced_show()}function S(a){a=a.__pickmeup.options;"single"!==a.mode&&(a.date=[],a.lastSel=!1,a.bound.fill())} 547function T(a,c){"undefined"==typeof c&&(c=!0);var b=a.__pickmeup.element;a=a.__pickmeup.options;k(b,"pmu-view-years")?u(a.current,-12):k(b,"pmu-view-months")?u(a.current,-1):k(b,"pmu-view-days")&&p(a.current,-1);c&&a.bound.fill()}function U(a,c){"undefined"==typeof c&&(c=!0);var b=a.__pickmeup.element;a=a.__pickmeup.options;k(b,"pmu-view-years")?u(a.current,12):k(b,"pmu-view-months")?u(a.current,1):k(b,"pmu-view-days")&&p(a.current,1);c&&a.bound.fill()}function V(a,c){var b=a.__pickmeup.options;a= 548H(b);return"string"===typeof c?(a=a.date,a instanceof Date?D(a,c,b.locales[b.locale]):a.map(function(a){return D(a,c,b.locales[b.locale])})):a[c?"formatted_date":"date"]}function W(a,c,b){var d=a.__pickmeup.options;if(!(c instanceof Array)||0<c.length)if(d.date=t(c,d),"single"!==d.mode)for(d.date instanceof Array?(d.date[0]=d.date[0]||t(new Date,d),"range"===d.mode&&(d.date[1]=d.date[1]||t(d.date[0],d))):(d.date=[d.date],"range"===d.mode&&d.date.push(t(d.date[0],d))),c=0;c<d.date.length;++c)d.date[c]= 549L(d.date[c],d.min,d.max);else d.date instanceof Array&&(d.date=d.date[0]),d.date=L(d.date,d.min,d.max);else d.date=[];if(!d.select_day)if(d.date instanceof Array)for(c=0;c<d.date.length;++c)d.date[c].setDate(1);else d.date.setDate(1);if("multiple"===d.mode)for(c=0;c<d.date.length;++c)d.date.indexOf(d.date[c])!==c&&(d.date.splice(c,1),--c);b?d.current=t(b,d):(b="single"===d.mode?d.date:d.date[d.date.length-1],d.current=b?new Date(b):new Date);d.current.setDate(1);d.bound.fill();B(a,"input")&&!1!== 550d.default_date&&(b=H(d),c=a.value,d="single"===d.mode?b.formatted_date:b.formatted_date.join(d.separator),c||C(a,"change",b),c!==d&&(a.value=d))}function X(a){var c=a.__pickmeup.element;z(a);y(c);delete a.__pickmeup}function L(a,c,b){return c&&c>a?new Date(c):b&&b<a?new Date(b):a}function E(a,c){"string"==typeof a&&(a=document.querySelector(a));if(!a)return null;if(!a.__pickmeup){var b,d={};c=c||{};for(b in E.defaults)d[b]=b in c?c[b]:E.defaults[b];for(b in d)c=a.getAttribute("data-pmu-"+b),null!== 551c&&(d[b]=c);"days"!==d.view||d.select_day||(d.view="months");"months"!==d.view||d.select_month||(d.view="years");"years"!==d.view||d.select_year||(d.view="days");"days"!==d.view||d.select_day||(d.view="months");d.calendars=Math.max(1,parseInt(d.calendars,10)||1);d.mode=/single|multiple|range/.test(d.mode)?d.mode:"single";d.min&&(d.min=t(d.min,d),d.select_day||d.min.setDate(1));d.max&&(d.max=t(d.max,d),d.select_day||d.max.setDate(1));c=document.createElement("div");a.__pickmeup={options:d,events:[], 552element:c};c.__pickmeup_target=a;l(c,"pickmeup");d.class_name&&l(c,d.class_name);d.bound={fill:N.bind(a,a),update_date:O.bind(a,a),click:P.bind(a,a),show:I.bind(a,a),forced_show:I.bind(a,a,!0),hide:Q.bind(a,a),update:R.bind(a,a),clear:S.bind(a,a),prev:T.bind(a,a),next:U.bind(a,a),get_date:V.bind(a,a),set_date:W.bind(a,a),destroy:X.bind(a,a)};l(c,"pmu-view-"+d.view);var e=d.instance_template(d),h="";for(b=0;b<d.calendars;++b)h+=e;c.innerHTML=h;q(a,c,"click",d.bound.click);q(a,c,"onselectstart"in Element.prototype? 553"selectstart":"mousedown",function(a){a.preventDefault()});d.flat?(l(c,"pmu-flat"),a.appendChild(c)):(l(c,"pmu-hidden"),document.body.appendChild(c),q(a,a,"click",I.bind(a,a,!1)),q(a,a,"input",d.bound.update),q(a,a,"change",d.bound.update));d.bound.set_date(d.date,d.current)}d=a.__pickmeup.options;return{hide:d.bound.hide,show:d.bound.show,clear:d.bound.clear,update:d.bound.update,prev:d.bound.prev,next:d.bound.next,get_date:d.bound.get_date,set_date:d.bound.set_date,destroy:d.bound.destroy}}E.defaults= 554{current:null,date:new Date,default_date:new Date,flat:!1,first_day:1,prev:"◀",next:"▶",mode:"single",select_year:!0,select_month:!0,select_day:!0,view:"days",calendars:1,format:"d-m-Y",title_format:"B, Y",position:"bottom",class_name:"",separator:" - ",hide_on_select:!1,min:null,max:null,render:function(){},locale:"en",locales:{en:{days:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),daysShort:"Sun Mon Tue Wed Thu Fri Sat".split(" "),daysMin:"Su Mo Tu We Th Fr Sa".split(" "), 555months:"January February March April May June July August September October November December".split(" "),monthsShort:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")}},instance_template:function(a){var c=a.locales[a.locale].daysMin.slice();a.first_day&&c.push(c.shift());return'<div class="pmu-instance"><nav><div class="pmu-prev pmu-button">'+a.prev+'</div><div class="pmu-month pmu-button"></div><div class="pmu-next pmu-button">'+a.next+'</div></nav><nav class="pmu-day-of-week"><div>'+ 556c.join("</div><div>")+"</div></nav></div>"},instance_content_template:function(a,c){var b=document.createElement("div");l(b,c);for(c=0;c<a.length;++c)l(a[c],"pmu-button"),b.appendChild(a[c]);return b}};return E}); 557 558 559/***/ }), 560 561/***/ 666: 562/***/ ((module) =>
vendor: 17,269 bytes, lines 562-1061
562 { 563 564/** 565 * Copyright (c) 2014-present, Facebook, Inc. 566 * 567 * This source code is licensed under the MIT license found in the 568 * LICENSE file in the root directory of this source tree. 569 */ 570 571var runtime = (function (exports) { 572 "use strict"; 573 574 var Op = Object.prototype; 575 var hasOwn = Op.hasOwnProperty; 576 var undefined; // More compressible than void 0. 577 var $Symbol = typeof Symbol === "function" ? Symbol : {}; 578 var iteratorSymbol = $Symbol.iterator || "@@iterator"; 579 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; 580 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; 581 582 function define(obj, key, value) { 583 Object.defineProperty(obj, key, { 584 value: value, 585 enumerable: true, 586 configurable: true, 587 writable: true 588 }); 589 return obj[key]; 590 } 591 try { 592 // IE 8 has a broken Object.defineProperty that only works on DOM objects. 593 define({}, ""); 594 } catch (err) { 595 define = function(obj, key, value) { 596 return obj[key] = value; 597 }; 598 } 599 600 function wrap(innerFn, outerFn, self, tryLocsList) { 601 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. 602 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; 603 var generator = Object.create(protoGenerator.prototype); 604 var context = new Context(tryLocsList || []); 605 606 // The ._invoke method unifies the implementations of the .next, 607 // .throw, and .return methods. 608 generator._invoke = makeInvokeMethod(innerFn, self, context); 609 610 return generator; 611 } 612 exports.wrap = wrap; 613 614 // Try/catch helper to minimize deoptimizations. Returns a completion 615 // record like context.tryEntries[i].completion. This interface could 616 // have been (and was previously) designed to take a closure to be 617 // invoked without arguments, but in all the cases we care about we 618 // already have an existing method we want to call, so there's no need 619 // to create a new function object. We can even get away with assuming 620 // the method takes exactly one argument, since that happens to be true 621 // in every case, so we don't have to touch the arguments object. The 622 // only additional allocation required is the completion record, which 623 // has a stable shape and so hopefully should be cheap to allocate. 624 function tryCatch(fn, obj, arg) { 625 try { 626 return { type: "normal", arg: fn.call(obj, arg) }; 627 } catch (err) { 628 return { type: "throw", arg: err }; 629 } 630 } 631 632 var GenStateSuspendedStart = "suspendedStart"; 633 var GenStateSuspendedYield = "suspendedYield"; 634 var GenStateExecuting = "executing"; 635 var GenStateCompleted = "completed"; 636 637 // Returning this object from the innerFn has the same effect as 638 // breaking out of the dispatch switch statement. 639 var ContinueSentinel = {}; 640 641 // Dummy constructor functions that we use as the .constructor and 642 // .constructor.prototype properties for functions that return Generator 643 // objects. For full spec compliance, you may wish to configure your 644 // minifier not to mangle the names of these two functions. 645 function Generator() {} 646 function GeneratorFunction() {} 647 function GeneratorFunctionPrototype() {} 648 649 // This is a polyfill for %IteratorPrototype% for environments that 650 // don't natively support it. 651 var IteratorPrototype = {}; 652 define(IteratorPrototype, iteratorSymbol, function () { 653 return this; 654 }); 655 656 var getProto = Object.getPrototypeOf; 657 var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); 658 if (NativeIteratorPrototype && 659 NativeIteratorPrototype !== Op && 660 hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { 661 // This environment has a native %IteratorPrototype%; use it instead 662 // of the polyfill. 663 IteratorPrototype = NativeIteratorPrototype; 664 } 665 666 var Gp = GeneratorFunctionPrototype.prototype = 667 Generator.prototype = Object.create(IteratorPrototype); 668 GeneratorFunction.prototype = GeneratorFunctionPrototype; 669 define(Gp, "constructor", GeneratorFunctionPrototype); 670 define(GeneratorFunctionPrototype, "constructor", GeneratorFunction); 671 GeneratorFunction.displayName = define( 672 GeneratorFunctionPrototype, 673 toStringTagSymbol, 674 "GeneratorFunction" 675 ); 676 677 // Helper for defining the .next, .throw, and .return methods of the 678 // Iterator interface in terms of a single ._invoke method. 679 function defineIteratorMethods(prototype) { 680 ["next", "throw", "return"].forEach(function(method) { 681 define(prototype, method, function(arg) { 682 return this._invoke(method, arg); 683 }); 684 }); 685 } 686 687 exports.isGeneratorFunction = function(genFun) { 688 var ctor = typeof genFun === "function" && genFun.constructor; 689 return ctor 690 ? ctor === GeneratorFunction || 691 // For the native GeneratorFunction constructor, the best we can 692 // do is to check its .name property. 693 (ctor.displayName || ctor.name) === "GeneratorFunction" 694 : false; 695 }; 696 697 exports.mark = function(genFun) { 698 if (Object.setPrototypeOf) { 699 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); 700 } else { 701 genFun.__proto__ = GeneratorFunctionPrototype; 702 define(genFun, toStringTagSymbol, "GeneratorFunction"); 703 } 704 genFun.prototype = Object.create(Gp); 705 return genFun; 706 }; 707 708 // Within the body of any async function, `await x` is transformed to 709 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test 710 // `hasOwn.call(value, "__await")` to determine if the yielded value is 711 // meant to be awaited. 712 exports.awrap = function(arg) { 713 return { __await: arg }; 714 }; 715 716 function AsyncIterator(generator, PromiseImpl) { 717 function invoke(method, arg, resolve, reject) { 718 var record = tryCatch(generator[method], generator, arg); 719 if (record.type === "throw") { 720 reject(record.arg); 721 } else { 722 var result = record.arg; 723 var value = result.value; 724 if (value && 725 typeof value === "object" && 726 hasOwn.call(value, "__await")) { 727 return PromiseImpl.resolve(value.__await).then(function(value) { 728 invoke("next", value, resolve, reject); 729 }, function(err) { 730 invoke("throw", err, resolve, reject); 731 }); 732 } 733 734 return PromiseImpl.resolve(value).then(function(unwrapped) { 735 // When a yielded Promise is resolved, its final value becomes 736 // the .value of the Promise<{value,done}> result for the 737 // current iteration. 738 result.value = unwrapped; 739 resolve(result); 740 }, function(error) { 741 // If a rejected Promise was yielded, throw the rejection back 742 // into the async generator function so it can be handled there. 743 return invoke("throw", error, resolve, reject); 744 }); 745 } 746 } 747 748 var previousPromise; 749 750 function enqueue(method, arg) { 751 function callInvokeWithMethodAndArg() { 752 return new PromiseImpl(function(resolve, reject) { 753 invoke(method, arg, resolve, reject); 754 }); 755 } 756 757 return previousPromise = 758 // If enqueue has been called before, then we want to wait until 759 // all previous Promises have been resolved before calling invoke, 760 // so that results are always delivered in the correct order. If 761 // enqueue has not been called before, then it is important to 762 // call invoke immediately, without waiting on a callback to fire, 763 // so that the async generator function has the opportunity to do 764 // any necessary setup in a predictable way. This predictability 765 // is why the Promise constructor synchronously invokes its 766 // executor callback, and why async functions synchronously 767 // execute code before the first await. Since we implement simple 768 // async functions in terms of async generators, it is especially 769 // important to get this right, even though it requires care. 770 previousPromise ? previousPromise.then( 771 callInvokeWithMethodAndArg, 772 // Avoid propagating failures to Promises returned by later 773 // invocations of the iterator. 774 callInvokeWithMethodAndArg 775 ) : callInvokeWithMethodAndArg(); 776 } 777 778 // Define the unified helper method that is used to implement .next, 779 // .throw, and .return (see defineIteratorMethods). 780 this._invoke = enqueue; 781 } 782 783 defineIteratorMethods(AsyncIterator.prototype); 784 define(AsyncIterator.prototype, asyncIteratorSymbol, function () { 785 return this; 786 }); 787 exports.AsyncIterator = AsyncIterator; 788 789 // Note that simple async functions are implemented on top of 790 // AsyncIterator objects; they just return a Promise for the value of 791 // the final result produced by the iterator. 792 exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { 793 if (PromiseImpl === void 0) PromiseImpl = Promise; 794 795 var iter = new AsyncIterator( 796 wrap(innerFn, outerFn, self, tryLocsList), 797 PromiseImpl 798 ); 799 800 return exports.isGeneratorFunction(outerFn) 801 ? iter // If outerFn is a generator, return the full iterator. 802 : iter.next().then(function(result) { 803 return result.done ? result.value : iter.next(); 804 }); 805 }; 806 807 function makeInvokeMethod(innerFn, self, context) { 808 var state = GenStateSuspendedStart; 809 810 return function invoke(method, arg) { 811 if (state === GenStateExecuting) { 812 throw new Error("Generator is already running"); 813 } 814 815 if (state === GenStateCompleted) { 816 if (method === "throw") { 817 throw arg; 818 } 819 820 // Be forgiving, per 25.3.3.3.3 of the spec: 821 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume 822 return doneResult(); 823 } 824 825 context.method = method; 826 context.arg = arg; 827 828 while (true) { 829 var delegate = context.delegate; 830 if (delegate) { 831 var delegateResult = maybeInvokeDelegate(delegate, context); 832 if (delegateResult) { 833 if (delegateResult === ContinueSentinel) continue; 834 return delegateResult; 835 } 836 } 837 838 if (context.method === "next") { 839 // Setting context._sent for legacy support of Babel's 840 // function.sent implementation. 841 context.sent = context._sent = context.arg; 842 843 } else if (context.method === "throw") { 844 if (state === GenStateSuspendedStart) { 845 state = GenStateCompleted; 846 throw context.arg; 847 } 848 849 context.dispatchException(context.arg); 850 851 } else if (context.method === "return") { 852 context.abrupt("return", context.arg); 853 } 854 855 state = GenStateExecuting; 856 857 var record = tryCatch(innerFn, self, context); 858 if (record.type === "normal") { 859 // If an exception is thrown from innerFn, we leave state === 860 // GenStateExecuting and loop back for another invocation. 861 state = context.done 862 ? GenStateCompleted 863 : GenStateSuspendedYield; 864 865 if (record.arg === ContinueSentinel) { 866 continue; 867 } 868 869 return { 870 value: record.arg, 871 done: context.done 872 }; 873 874 } else if (record.type === "throw") { 875 state = GenStateCompleted; 876 // Dispatch the exception by looping back around to the 877 // context.dispatchException(context.arg) call above. 878 context.method = "throw"; 879 context.arg = record.arg; 880 } 881 } 882 }; 883 } 884 885 // Call delegate.iterator[context.method](context.arg) and handle the 886 // result, either by returning a { value, done } result from the 887 // delegate iterator, or by modifying context.method and context.arg, 888 // setting context.delegate to null, and returning the ContinueSentinel. 889 function maybeInvokeDelegate(delegate, context) { 890 var method = delegate.iterator[context.method]; 891 if (method === undefined) { 892 // A .throw or .return when the delegate iterator has no .throw 893 // method always terminates the yield* loop. 894 context.delegate = null; 895 896 if (context.method === "throw") { 897 // Note: ["return"] must be used for ES3 parsing compatibility. 898 if (delegate.iterator["return"]) { 899 // If the delegate iterator has a return method, give it a 900 // chance to clean up. 901 context.method = "return"; 902 context.arg = undefined; 903 maybeInvokeDelegate(delegate, context); 904 905 if (context.method === "throw") { 906 // If maybeInvokeDelegate(context) changed context.method from 907 // "return" to "throw", let that override the TypeError below. 908 return ContinueSentinel; 909 } 910 } 911 912 context.method = "throw"; 913 context.arg = new TypeError( 914 "The iterator does not provide a 'throw' method"); 915 } 916 917 return ContinueSentinel; 918 } 919 920 var record = tryCatch(method, delegate.iterator, context.arg); 921 922 if (record.type === "throw") { 923 context.method = "throw"; 924 context.arg = record.arg; 925 context.delegate = null; 926 return ContinueSentinel; 927 } 928 929 var info = record.arg; 930 931 if (! info) { 932 context.method = "throw"; 933 context.arg = new TypeError("iterator result is not an object"); 934 context.delegate = null; 935 return ContinueSentinel; 936 } 937 938 if (info.done) { 939 // Assign the result of the finished delegate to the temporary 940 // variable specified by delegate.resultName (see delegateYield). 941 context[delegate.resultName] = info.value; 942 943 // Resume execution at the desired location (see delegateYield). 944 context.next = delegate.nextLoc; 945 946 // If context.method was "throw" but the delegate handled the 947 // exception, let the outer generator proceed normally. If 948 // context.method was "next", forget context.arg since it has been 949 // "consumed" by the delegate iterator. If context.method was 950 // "return", allow the original .return call to continue in the 951 // outer generator. 952 if (context.method !== "return") { 953 context.method = "next"; 954 context.arg = undefined; 955 } 956 957 } else { 958 // Re-yield the result returned by the delegate method. 959 return info; 960 } 961 962 // The delegate iterator is finished, so forget it and continue with 963 // the outer generator. 964 context.delegate = null; 965 return ContinueSentinel; 966 } 967 968 // Define Generator.prototype.{next,throw,return} in terms of the 969 // unified ._invoke helper method. 970 defineIteratorMethods(Gp); 971 972 define(Gp, toStringTagSymbol, "Generator"); 973 974 // A Generator should always return itself as the iterator object when the 975 // @@iterator function is called on it. Some browsers' implementations of the 976 // iterator prototype chain incorrectly implement this, causing the Generator 977 // object to not be returned from this call. This ensures that doesn't happen. 978 // See https://github.com/facebook/regenerator/issues/274 for more details. 979 define(Gp, iteratorSymbol, function() { 980 return this; 981 }); 982 983 define(Gp, "toString", function() { 984 return "[object Generator]"; 985 }); 986 987 function pushTryEntry(locs) { 988 var entry = { tryLoc: locs[0] }; 989 990 if (1 in locs) { 991 entry.catchLoc = locs[1]; 992 } 993 994 if (2 in locs) { 995 entry.finallyLoc = locs[2]; 996 entry.afterLoc = locs[3]; 997 } 998 999 this.tryEntries.push(entry); 1000 } 1001 1002 function resetTryEntry(entry) { 1003 var record = entry.completion || {}; 1004 record.type = "normal"; 1005 delete record.arg; 1006 entry.completion = record; 1007 } 1008 1009 function Context(tryLocsList) { 1010 // The root entry object (effectively a try statement without a catch 1011 // or a finally block) gives us a place to store values thrown from 1012 // locations where there is no enclosing try statement. 1013 this.tryEntries = [{ tryLoc: "root" }]; 1014 tryLocsList.forEach(pushTryEntry, this); 1015 this.reset(true); 1016 } 1017 1018 exports.keys = function(object) { 1019 var keys = []; 1020 for (var key in object) { 1021 keys.push(key); 1022 } 1023 keys.reverse(); 1024 1025 // Rather than returning an object with a next method, we keep 1026 // things simple and return the next function itself. 1027 return function next() { 1028 while (keys.length) { 1029 var key = keys.pop(); 1030 if (key in object) { 1031 next.value = key; 1032 next.done = false; 1033 return next; 1034 } 1035 } 1036 1037 // To avoid creating an additional object, we just hang the .value 1038 // and .done properties off the next function object itself. This 1039 // also ensures that the minifier will not anonymize the function. 1040 next.done = true; 1041 return next; 1042 }; 1043 }; 1044 1045 function values(iterable) { 1046 if (iterable) { 1047 var iteratorMethod = iterable[iteratorSymbol]; 1048 if (iteratorMethod) { 1049 return iteratorMethod.call(iterable); 1050 } 1051 1052 if (typeof iterable.next === "function") { 1053 return iterable; 1054 } 1055 1056 if (!isNaN(iterable.length)) { 1057 var i = -1, next = function next() { 1058 while (++i < iterable.length) { 1059 if (hasOwn.call(iterable, i)) { 1060 next.value = iterable[i]; 1061 next.done = false;
vendor: 6,560 bytes, lines 1062-1296
1062 return next; 1063 } 1064 } 1065 1066 next.value = undefined; 1067 next.done = true; 1068 1069 return next; 1070 }; 1071 1072 return next.next = next; 1073 } 1074 } 1075 1076 // Return an iterator with no values. 1077 return { next: doneResult }; 1078 } 1079 exports.values = values; 1080 1081 function doneResult() { 1082 return { value: undefined, done: true }; 1083 } 1084 1085 Context.prototype = { 1086 constructor: Context, 1087 1088 reset: function(skipTempReset) { 1089 this.prev = 0; 1090 this.next = 0; 1091 // Resetting context._sent for legacy support of Babel's 1092 // function.sent implementation. 1093 this.sent = this._sent = undefined; 1094 this.done = false; 1095 this.delegate = null; 1096 1097 this.method = "next"; 1098 this.arg = undefined; 1099 1100 this.tryEntries.forEach(resetTryEntry); 1101 1102 if (!skipTempReset) { 1103 for (var name in this) { 1104 // Not sure about the optimal order of these conditions: 1105 if (name.charAt(0) === "t" && 1106 hasOwn.call(this, name) && 1107 !isNaN(+name.slice(1))) { 1108 this[name] = undefined; 1109 } 1110 } 1111 } 1112 }, 1113 1114 stop: function() { 1115 this.done = true; 1116 1117 var rootEntry = this.tryEntries[0]; 1118 var rootRecord = rootEntry.completion; 1119 if (rootRecord.type === "throw") { 1120 throw rootRecord.arg; 1121 } 1122 1123 return this.rval; 1124 }, 1125 1126 dispatchException: function(exception) { 1127 if (this.done) { 1128 throw exception; 1129 } 1130 1131 var context = this; 1132 function handle(loc, caught) { 1133 record.type = "throw"; 1134 record.arg = exception; 1135 context.next = loc; 1136 1137 if (caught) { 1138 // If the dispatched exception was caught by a catch block, 1139 // then let that catch block handle the exception normally. 1140 context.method = "next"; 1141 context.arg = undefined; 1142 } 1143 1144 return !! caught; 1145 } 1146 1147 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 1148 var entry = this.tryEntries[i]; 1149 var record = entry.completion; 1150 1151 if (entry.tryLoc === "root") { 1152 // Exception thrown outside of any try block that could handle 1153 // it, so set the completion value of the entire function to 1154 // throw the exception. 1155 return handle("end"); 1156 } 1157 1158 if (entry.tryLoc <= this.prev) { 1159 var hasCatch = hasOwn.call(entry, "catchLoc"); 1160 var hasFinally = hasOwn.call(entry, "finallyLoc"); 1161 1162 if (hasCatch && hasFinally) { 1163 if (this.prev < entry.catchLoc) { 1164 return handle(entry.catchLoc, true); 1165 } else if (this.prev < entry.finallyLoc) { 1166 return handle(entry.finallyLoc); 1167 } 1168 1169 } else if (hasCatch) { 1170 if (this.prev < entry.catchLoc) { 1171 return handle(entry.catchLoc, true); 1172 } 1173 1174 } else if (hasFinally) { 1175 if (this.prev < entry.finallyLoc) { 1176 return handle(entry.finallyLoc); 1177 } 1178 1179 } else { 1180 throw new Error("try statement without catch or finally"); 1181 } 1182 } 1183 } 1184 }, 1185 1186 abrupt: function(type, arg) { 1187 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 1188 var entry = this.tryEntries[i]; 1189 if (entry.tryLoc <= this.prev && 1190 hasOwn.call(entry, "finallyLoc") && 1191 this.prev < entry.finallyLoc) { 1192 var finallyEntry = entry; 1193 break; 1194 } 1195 } 1196 1197 if (finallyEntry && 1198 (type === "break" || 1199 type === "continue") && 1200 finallyEntry.tryLoc <= arg && 1201 arg <= finallyEntry.finallyLoc) { 1202 // Ignore the finally entry if control is not jumping to a 1203 // location outside the try/catch block. 1204 finallyEntry = null; 1205 } 1206 1207 var record = finallyEntry ? finallyEntry.completion : {}; 1208 record.type = type; 1209 record.arg = arg; 1210 1211 if (finallyEntry) { 1212 this.method = "next"; 1213 this.next = finallyEntry.finallyLoc; 1214 return ContinueSentinel; 1215 } 1216 1217 return this.complete(record); 1218 }, 1219 1220 complete: function(record, afterLoc) { 1221 if (record.type === "throw") { 1222 throw record.arg; 1223 } 1224 1225 if (record.type === "break" || 1226 record.type === "continue") { 1227 this.next = record.arg; 1228 } else if (record.type === "return") { 1229 this.rval = this.arg = record.arg; 1230 this.method = "return"; 1231 this.next = "end"; 1232 } else if (record.type === "normal" && afterLoc) { 1233 this.next = afterLoc; 1234 } 1235 1236 return ContinueSentinel; 1237 }, 1238 1239 finish: function(finallyLoc) { 1240 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 1241 var entry = this.tryEntries[i]; 1242 if (entry.finallyLoc === finallyLoc) { 1243 this.complete(entry.completion, entry.afterLoc); 1244 resetTryEntry(entry); 1245 return ContinueSentinel; 1246 } 1247 } 1248 }, 1249 1250 "catch": function(tryLoc) { 1251 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 1252 var entry = this.tryEntries[i]; 1253 if (entry.tryLoc === tryLoc) { 1254 var record = entry.completion; 1255 if (record.type === "throw") { 1256 var thrown = record.arg; 1257 resetTryEntry(entry); 1258 } 1259 return thrown; 1260 } 1261 } 1262 1263 // The context.catch method must only be called with a location 1264 // argument that corresponds to a known catch block. 1265 throw new Error("illegal catch attempt"); 1266 }, 1267 1268 delegateYield: function(iterable, resultName, nextLoc) { 1269 this.delegate = { 1270 iterator: values(iterable), 1271 resultName: resultName, 1272 nextLoc: nextLoc 1273 }; 1274 1275 if (this.method === "next") { 1276 // Deliberately forget the last sent value so that we don't 1277 // accidentally pass it on to the delegate. 1278 this.arg = undefined; 1279 } 1280 1281 return ContinueSentinel; 1282 } 1283 }; 1284 1285 // Regardless of whether this script is executing as a CommonJS module 1286 // or not, return the runtime object so that we can declare the variable 1287 // regeneratorRuntime in the outer scope, which allows this module to be 1288 // injected easily by `bin/regenerator --include-runtime script.js`. 1289 return exports; 1290 1291}( 1292 // If this script is executing as a CommonJS module, use module.exports 1293 // as the regeneratorRuntime namespace. Otherwise create a new empty 1294 // object. Either way, the resulting object will be used to initialize 1295 // the regeneratorRuntime variable at the top of this file. 1296
1296 true ? module.exports : 0 1297)); 1298 1299try { 1300 regeneratorRuntime = runtime; 1301} catch (accidentalStrictMode) { 1302 // This module should not be running in strict mode, so the above 1303 // assignment should always work unless something is misconfigured. Just 1304 // in case runtime.js accidentally runs in strict mode, in modern engines 1305 // we can explicitly access globalThis. In older engines we can escape 1306 // strict mode using a global Function call. This could conceivably fail 1307 // if a Content Security Policy forbids using Function, but in that case 1308 // the proper solution is to fix the accidental strict mode problem. If 1309 // you've misconfigured your bundler to force strict mode and applied a 1310 // CSP to forbid Function, and you're not willing to fix either of those 1311 // problems, please detail your unique predicament in a GitHub issue. 1312 if (typeof globalThis === "object") { 1313 globalThis.regeneratorRuntime = runtime; 1314 } else { 1315 Function("r", "regeneratorRuntime = r")(runtime); 1316 } 1317} 1318 1319 1320/***/ }), 1321 1322/***/ 440: 1323/***/ (function(module, exports) { 1324 1325var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!function(root, factory) { 1326 true ? // AMD. Register as an anonymous module unless amdModuleId is set 1327 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { 1328 return root.svg4everybody = factory(); 1329 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 1330 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : 0; 1331}(this, function() { 1332 /*! svg4everybody v2.1.9 | github.com/jonathantneal/svg4everybody */ 1333 function embed(parent, svg, target) { 1334 // if the target exists 1335 if (target) { 1336 // create a document fragment to hold the contents of the target 1337 var fragment = document.createDocumentFragment(), viewB
vendor: 5,809 bytes, lines 1337-1453
1337ox = !svg.hasAttribute("viewBox") && target.getAttribute("viewBox"); 1338 // conditionally set the viewBox on the svg 1339 viewBox && svg.setAttribute("viewBox", viewBox); 1340 // copy the contents of the clone into the fragment 1341 for (// clone the target 1342 var clone = target.cloneNode(!0); clone.childNodes.length; ) { 1343 fragment.appendChild(clone.firstChild); 1344 } 1345 // append the fragment into the svg 1346 parent.appendChild(fragment); 1347 } 1348 } 1349 function loadreadystatechange(xhr) { 1350 // listen to changes in the request 1351 xhr.onreadystatechange = function() { 1352 // if the request is ready 1353 if (4 === xhr.readyState) { 1354 // get the cached html document 1355 var cachedDocument = xhr._cachedDocument; 1356 // ensure the cached html document based on the xhr response 1357 cachedDocument || (cachedDocument = xhr._cachedDocument = document.implementation.createHTMLDocument(""), 1358 cachedDocument.body.innerHTML = xhr.responseText, xhr._cachedTarget = {}), // clear the xhr embeds list and embed each item 1359 xhr._embeds.splice(0).map(function(item) { 1360 // get the cached target 1361 var target = xhr._cachedTarget[item.id]; 1362 // ensure the cached target 1363 target || (target = xhr._cachedTarget[item.id] = cachedDocument.getElementById(item.id)), 1364 // embed the target into the svg 1365 embed(item.parent, item.svg, target); 1366 }); 1367 } 1368 }, // test the ready state change immediately 1369 xhr.onreadystatechange(); 1370 } 1371 function svg4everybody(rawopts) { 1372 function oninterval() { 1373 // while the index exists in the live <use> collection 1374 for (// get the cached <use> index 1375 var index = 0; index < uses.length; ) { 1376 // get the current <use> 1377 var use = uses[index], parent = use.parentNode, svg = getSVGAncestor(parent), src = use.getAttribute("xlink:href") || use.getAttribute("href"); 1378 if (!src && opts.attributeName && (src = use.getAttribute(opts.attributeName)), 1379 svg && src) { 1380 if (polyfill) { 1381 if (!opts.validate || opts.validate(src, svg, use)) { 1382 // remove the <use> element 1383 parent.removeChild(use); 1384 // parse the src and get the url and id 1385 var srcSplit = src.split("#"), url = srcSplit.shift(), id = srcSplit.join("#"); 1386 // if the link is external 1387 if (url.length) { 1388 // get the cached xhr request 1389 var xhr = requests[url]; 1390 // ensure the xhr request exists 1391 xhr || (xhr = requests[url] = new XMLHttpRequest(), xhr.open("GET", url), xhr.send(), 1392 xhr._embeds = []), // add the svg and id as an item to the xhr embeds list 1393 xhr._embeds.push({ 1394 parent: parent, 1395 svg: svg, 1396 id: id 1397 }), // prepare the xhr ready state change event 1398 loadreadystatechange(xhr); 1399 } else { 1400 // embed the local id into the svg 1401 embed(parent, svg, document.getElementById(id)); 1402 } 1403 } else { 1404 // increase the index when the previous value was not "valid" 1405 ++index, ++numberOfSvgUseElementsToBypass; 1406 } 1407 } 1408 } else { 1409 // increase the index when the previous value was not "valid" 1410 ++index; 1411 } 1412 } 1413 // continue the interval 1414 (!uses.length || uses.length - numberOfSvgUseElementsToBypass > 0) && requestAnimationFrame(oninterval, 67); 1415 } 1416 var polyfill, opts = Object(rawopts), newerIEUA = /\bTrident\/[567]\b|\bMSIE (?:9|10)\.0\b/, webkitUA = /\bAppleWebKit\/(\d+)\b/, olderEdgeUA = /\bEdge\/12\.(\d+)\b/, edgeUA = /\bEdge\/.(\d+)\b/, inIframe = window.top !== window.self; 1417 polyfill = "polyfill" in opts ? opts.polyfill : newerIEUA.test(navigator.userAgent) || (navigator.userAgent.match(olderEdgeUA) || [])[1] < 10547 || (navigator.userAgent.match(webkitUA) || [])[1] < 537 || edgeUA.test(navigator.userAgent) && inIframe; 1418 // create xhr requests object 1419 var requests = {}, requestAnimationFrame = window.requestAnimationFrame || setTimeout, uses = document.getElementsByTagName("use"), numberOfSvgUseElementsToBypass = 0; 1420 // conditionally start the interval if the polyfill is active 1421 polyfill && oninterval(); 1422 } 1423 function getSVGAncestor(node) { 1424 for (var svg = node; "svg" !== svg.nodeName.toLowerCase() && (svg = svg.parentNode); ) {} 1425 return svg; 1426 } 1427 return svg4everybody; 1428}); 1429 1430/***/ }), 1431 1432/***/ 764: 1433/***/ (function(module) { 1434 1435/*! 1436* sweetalert2 v11.4.13 1437* Released under the MIT License. 1438*/ 1439(function (global, factory) { 1440 true ? module.exports = factory() : 1441 0; 1442}(this, function () { 'use strict'; 1443 1444 const consolePrefix = 'SweetAlert2:'; 1445 /** 1446 * Filter the unique values into a new array 1447 * @param arr 1448 */ 1449 1450 const uniqueArray = arr => { 1451 const result = []; 1452 1453 for (let i = 0; i < arr.length; i++) {
vendor: 26,645 bytes, lines 1454-2161
1454 if (result.indexOf(arr[i]) === -1) { 1455 result.push(arr[i]); 1456 } 1457 } 1458 1459 return result; 1460 }; 1461 /** 1462 * Capitalize the first letter of a string 1463 * @param {string} str 1464 * @returns {string} 1465 */ 1466 1467 const capitalizeFirstLetter = str => str.charAt(0).toUpperCase() + str.slice(1); 1468 /** 1469 * @param {NodeList | HTMLCollection | NamedNodeMap} nodeList 1470 * @returns {array} 1471 */ 1472 1473 const toArray = nodeList => Array.prototype.slice.call(nodeList); 1474 /** 1475 * Standardize console warnings 1476 * @param {string | array} message 1477 */ 1478 1479 const warn = message => { 1480 console.warn("".concat(consolePrefix, " ").concat(typeof message === 'object' ? message.join(' ') : message)); 1481 }; 1482 /** 1483 * Standardize console errors 1484 * @param {string} message 1485 */ 1486 1487 const error = message => { 1488 console.error("".concat(consolePrefix, " ").concat(message)); 1489 }; 1490 /** 1491 * Private global state for `warnOnce` 1492 * @type {Array} 1493 * @private 1494 */ 1495 1496 const previousWarnOnceMessages = []; 1497 /** 1498 * Show a console warning, but only if it hasn't already been shown 1499 * @param {string} message 1500 */ 1501 1502 const warnOnce = message => { 1503 if (!previousWarnOnceMessages.includes(message)) { 1504 previousWarnOnceMessages.push(message); 1505 warn(message); 1506 } 1507 }; 1508 /** 1509 * Show a one-time console warning about deprecated params/methods 1510 */ 1511 1512 const warnAboutDeprecation = (deprecatedParam, useInstead) => { 1513 warnOnce("\"".concat(deprecatedParam, "\" is deprecated and will be removed in the next major release. Please use \"").concat(useInstead, "\" instead.")); 1514 }; 1515 /** 1516 * If `arg` is a function, call it (with no arguments or context) and return the result. 1517 * Otherwise, just pass the value through 1518 * @param arg 1519 */ 1520 1521 const callIfFunction = arg => typeof arg === 'function' ? arg() : arg; 1522 const hasToPromiseFn = arg => arg && typeof arg.toPromise === 'function'; 1523 const asPromise = arg => hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg); 1524 const isPromise = arg => arg && Promise.resolve(arg) === arg; 1525 const getRandomElement = arr => arr[Math.floor(Math.random() * arr.length)]; 1526 1527 const defaultParams = { 1528 title: '', 1529 titleText: '', 1530 text: '', 1531 html: '', 1532 footer: '', 1533 icon: undefined, 1534 iconColor: undefined, 1535 iconHtml: undefined, 1536 template: undefined, 1537 toast: false, 1538 showClass: { 1539 popup: 'swal2-show', 1540 backdrop: 'swal2-backdrop-show', 1541 icon: 'swal2-icon-show' 1542 }, 1543 hideClass: { 1544 popup: 'swal2-hide', 1545 backdrop: 'swal2-backdrop-hide', 1546 icon: 'swal2-icon-hide' 1547 }, 1548 customClass: {}, 1549 target: 'body', 1550 color: undefined, 1551 backdrop: true, 1552 heightAuto: true, 1553 allowOutsideClick: true, 1554 allowEscapeKey: true, 1555 allowEnterKey: true, 1556 stopKeydownPropagation: true, 1557 keydownListenerCapture: false, 1558 showConfirmButton: true, 1559 showDenyButton: false, 1560 showCancelButton: false, 1561 preConfirm: undefined, 1562 preDeny: undefined, 1563 confirmButtonText: 'OK', 1564 confirmButtonAriaLabel: '', 1565 confirmButtonColor: undefined, 1566 denyButtonText: 'No', 1567 denyButtonAriaLabel: '', 1568 denyButtonColor: undefined, 1569 cancelButtonText: 'Cancel', 1570 cancelButtonAriaLabel: '', 1571 cancelButtonColor: undefined, 1572 buttonsStyling: true, 1573 reverseButtons: false, 1574 focusConfirm: true, 1575 focusDeny: false, 1576 focusCancel: false, 1577 returnFocus: true, 1578 showCloseButton: false, 1579 closeButtonHtml: '×', 1580 closeButtonAriaLabel: 'Close this dialog', 1581 loaderHtml: '', 1582 showLoaderOnConfirm: false, 1583 showLoaderOnDeny: false, 1584 imageUrl: undefined, 1585 imageWidth: undefined, 1586 imageHeight: undefined, 1587 imageAlt: '', 1588 timer: undefined, 1589 timerProgressBar: false, 1590 width: undefined, 1591 padding: undefined, 1592 background: undefined, 1593 input: undefined, 1594 inputPlaceholder: '', 1595 inputLabel: '', 1596 inputValue: '', 1597 inputOptions: {}, 1598 inputAutoTrim: true, 1599 inputAttributes: {}, 1600 inputValidator: undefined, 1601 returnInputValueOnDeny: false, 1602 validationMessage: undefined, 1603 grow: false, 1604 position: 'center', 1605 progressSteps: [], 1606 currentProgressStep: undefined, 1607 progressStepsDistance: undefined, 1608 willOpen: undefined, 1609 didOpen: undefined, 1610 didRender: undefined, 1611 willClose: undefined, 1612 didClose: undefined, 1613 didDestroy: undefined, 1614 scrollbarPadding: true 1615 }; 1616 const updatableParams = ['allowEscapeKey', 'allowOutsideClick', 'background', 'buttonsStyling', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonText', 'closeButtonAriaLabel', 'closeButtonHtml', 'color', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonText', 'currentProgressStep', 'customClass', 'denyButtonAriaLabel', 'denyButtonColor', 'denyButtonText', 'didClose', 'didDestroy', 'footer', 'hideClass', 'html', 'icon', 'iconColor', 'iconHtml', 'imageAlt', 'imageHeight', 'imageUrl', 'imageWidth', 'preConfirm', 'preDeny', 'progressSteps', 'returnFocus', 'reverseButtons', 'showCancelButton', 'showCloseButton', 'showConfirmButton', 'showDenyButton', 'text', 'title', 'titleText', 'willClose']; 1617 const deprecatedParams = {}; 1618 const toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'focusConfirm', 'focusDeny', 'focusCancel', 'returnFocus', 'heightAuto', 'keydownListenerCapture']; 1619 /** 1620 * Is valid parameter 1621 * @param {string} paramName 1622 */ 1623 1624 const isValidParameter = paramName => { 1625 return Object.prototype.hasOwnProperty.call(defaultParams, paramName); 1626 }; 1627 /** 1628 * Is valid parameter for Swal.update() method 1629 * @param {string} paramName 1630 */ 1631 1632 const isUpdatableParameter = paramName => { 1633 return updatableParams.indexOf(paramName) !== -1; 1634 }; 1635 /** 1636 * Is deprecated parameter 1637 * @param {string} paramName 1638 */ 1639 1640 const isDeprecatedParameter = paramName => { 1641 return deprecatedParams[paramName]; 1642 }; 1643 1644 const checkIfParamIsValid = param => { 1645 if (!isValidParameter(param)) { 1646 warn("Unknown parameter \"".concat(param, "\"")); 1647 } 1648 }; 1649 1650 const checkIfToastParamIsValid = param => { 1651 if (toastIncompatibleParams.includes(param)) { 1652 warn("The parameter \"".concat(param, "\" is incompatible with toasts")); 1653 } 1654 }; 1655 1656 const checkIfParamIsDeprecated = param => { 1657 if (isDeprecatedParameter(param)) { 1658 warnAboutDeprecation(param, isDeprecatedParameter(param)); 1659 } 1660 }; 1661 /** 1662 * Show relevant warnings for given params 1663 * 1664 * @param params 1665 */ 1666 1667 1668 const showWarningsForParams = params => { 1669 if (!params.backdrop && params.allowOutsideClick) { 1670 warn('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'); 1671 } 1672 1673 for (const param in params) { 1674 checkIfParamIsValid(param); 1675 1676 if (params.toast) { 1677 checkIfToastParamIsValid(param); 1678 } 1679 1680 checkIfParamIsDeprecated(param); 1681 } 1682 }; 1683 1684 const swalPrefix = 'swal2-'; 1685 const prefix = items => { 1686 const result = {}; 1687 1688 for (const i in items) { 1689 result[items[i]] = swalPrefix + items[i]; 1690 } 1691 1692 return result; 1693 }; 1694 const swalClasses = prefix(['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', 'no-war']); 1695 const iconTypes = prefix(['success', 'warning', 'info', 'question', 'error']); 1696 1697 /** 1698 * Gets the popup container which contains the backdrop and the popup itself. 1699 * 1700 * @returns {HTMLElement | null} 1701 */ 1702 1703 const getContainer = () => document.body.querySelector(".".concat(swalClasses.container)); 1704 const elementBySelector = selectorString => { 1705 const container = getContainer(); 1706 return container ? container.querySelector(selectorString) : null; 1707 }; 1708 1709 const elementByClass = className => { 1710 return elementBySelector(".".concat(className)); 1711 }; 1712 1713 const getPopup = () => elementByClass(swalClasses.popup); 1714 const getIcon = () => elementByClass(swalClasses.icon); 1715 const getTitle = () => elementByClass(swalClasses.title); 1716 const getHtmlContainer = () => elementByClass(swalClasses['html-container']); 1717 const getImage = () => elementByClass(swalClasses.image); 1718 const getProgressSteps = () => elementByClass(swalClasses['progress-steps']); 1719 const getValidationMessage = () => elementByClass(swalClasses['validation-message']); 1720 const getConfirmButton = () => elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.confirm)); 1721 const getDenyButton = () => elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.deny)); 1722 const getInputLabel = () => elementByClass(swalClasses['input-label']); 1723 const getLoader = () => elementBySelector(".".concat(swalClasses.loader)); 1724 const getCancelButton = () => elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.cancel)); 1725 const getActions = () => elementByClass(swalClasses.actions); 1726 const getFooter = () => elementByClass(swalClasses.footer); 1727 const getTimerProgressBar = () => elementByClass(swalClasses['timer-progress-bar']); 1728 const getCloseButton = () => elementByClass(swalClasses.close); // https://github.com/jkup/focusable/blob/master/index.js 1729 1730 const focusable = "\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"; 1731 const getFocusableElements = () => { 1732 const focusableElementsWithTabindex = toArray(getPopup().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')) // sort according to tabindex 1733 .sort((a, b) => { 1734 const tabindexA = parseInt(a.getAttribute('tabindex')); 1735 const tabindexB = parseInt(b.getAttribute('tabindex')); 1736 1737 if (tabindexA > tabindexB) { 1738 return 1; 1739 } else if (tabindexA < tabindexB) { 1740 return -1; 1741 } 1742 1743 return 0; 1744 }); 1745 const otherFocusableElements = toArray(getPopup().querySelectorAll(focusable)).filter(el => el.getAttribute('tabindex') !== '-1'); 1746 return uniqueArray(focusableElementsWithTabindex.concat(otherFocusableElements)).filter(el => isVisible(el)); 1747 }; 1748 const isModal = () => { 1749 return hasClass(document.body, swalClasses.shown) && !hasClass(document.body, swalClasses['toast-shown']) && !hasClass(document.body, swalClasses['no-backdrop']); 1750 }; 1751 const isToast = () => { 1752 return getPopup() && hasClass(getPopup(), swalClasses.toast); 1753 }; 1754 const isLoading = () => { 1755 return getPopup().hasAttribute('data-loading'); 1756 }; 1757 1758 const states = { 1759 previousBodyPadding: null 1760 }; 1761 /** 1762 * Securely set innerHTML of an element 1763 * https://github.com/sweetalert2/sweetalert2/issues/1926 1764 * 1765 * @param {HTMLElement} elem 1766 * @param {string} html 1767 */ 1768 1769 const setInnerHtml = (elem, html) => { 1770 elem.textContent = ''; 1771 1772 if (html) { 1773 const parser = new DOMParser(); 1774 const parsed = parser.parseFromString(html, "text/html"); 1775 toArray(parsed.querySelector('head').childNodes).forEach(child => { 1776 elem.appendChild(child); 1777 }); 1778 toArray(parsed.querySelector('body').childNodes).forEach(child => { 1779 elem.appendChild(child); 1780 }); 1781 } 1782 }; 1783 /** 1784 * @param {HTMLElement} elem 1785 * @param {string} className 1786 * @returns {boolean} 1787 */ 1788 1789 const hasClass = (elem, className) => { 1790 if (!className) { 1791 return false; 1792 } 1793 1794 const classList = className.split(/\s+/); 1795 1796 for (let i = 0; i < classList.length; i++) { 1797 if (!elem.classList.contains(classList[i])) { 1798 return false; 1799 } 1800 } 1801 1802 return true; 1803 }; 1804 1805 const removeCustomClasses = (elem, params) => { 1806 toArray(elem.classList).forEach(className => { 1807 if (!Object.values(swalClasses).includes(className) && !Object.values(iconTypes).includes(className) && !Object.values(params.showClass).includes(className)) { 1808 elem.classList.remove(className); 1809 } 1810 }); 1811 }; 1812 1813 const applyCustomClass = (elem, params, className) => { 1814 removeCustomClasses(elem, params); 1815 1816 if (params.customClass && params.customClass[className]) { 1817 if (typeof params.customClass[className] !== 'string' && !params.customClass[className].forEach) { 1818 return warn("Invalid type of customClass.".concat(className, "! Expected string or iterable object, got \"").concat(typeof params.customClass[className], "\"")); 1819 } 1820 1821 addClass(elem, params.customClass[className]); 1822 } 1823 }; 1824 /** 1825 * @param {HTMLElement} popup 1826 * @param {import('./renderers/renderInput').InputClass} inputClass 1827 * @returns {HTMLInputElement | null} 1828 */ 1829 1830 const getInput = (popup, inputClass) => { 1831 if (!inputClass) { 1832 return null; 1833 } 1834 1835 switch (inputClass) { 1836 case 'select': 1837 case 'textarea': 1838 case 'file': 1839 return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses[inputClass])); 1840 1841 case 'checkbox': 1842 return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.checkbox, " input")); 1843 1844 case 'radio': 1845 return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.radio, " input:checked")) || popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.radio, " input:first-child")); 1846 1847 case 'range': 1848 return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.range, " input")); 1849 1850 default: 1851 return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.input)); 1852 } 1853 }; 1854 /** 1855 * @param {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} input 1856 */ 1857 1858 const focusInput = input => { 1859 input.focus(); // place cursor at end of text in text input 1860 1861 if (input.type !== 'file') { 1862 // http://stackoverflow.com/a/2345915 1863 const val = input.value; 1864 input.value = ''; 1865 input.value = val; 1866 } 1867 }; 1868 /** 1869 * @param {HTMLElement | HTMLElement[] | null} target 1870 * @param {string | string[] | readonly string[]} classList 1871 * @param {boolean} condition 1872 */ 1873 1874 const toggleClass = (target, classList, condition) => { 1875 if (!target || !classList) { 1876 return; 1877 } 1878 1879 if (typeof classList === 'string') { 1880 classList = classList.split(/\s+/).filter(Boolean); 1881 } 1882 1883 classList.forEach(className => { 1884 if (Array.isArray(target)) { 1885 target.forEach(elem => { 1886 condition ? elem.classList.add(className) : elem.classList.remove(className); 1887 }); 1888 } else { 1889 condition ? target.classList.add(className) : target.classList.remove(className); 1890 } 1891 }); 1892 }; 1893 /** 1894 * @param {HTMLElement | HTMLElement[] | null} target 1895 * @param {string | string[] | readonly string[]} classList 1896 */ 1897 1898 const addClass = (target, classList) => { 1899 toggleClass(target, classList, true); 1900 }; 1901 /** 1902 * @param {HTMLElement | HTMLElement[] | null} target 1903 * @param {string | string[] | readonly string[]} classList 1904 */ 1905 1906 const removeClass = (target, classList) => { 1907 toggleClass(target, classList, false); 1908 }; 1909 /** 1910 * Get direct child of an element by class name 1911 * 1912 * @param {HTMLElement} elem 1913 * @param {string} className 1914 * @returns {HTMLElement | null} 1915 */ 1916 1917 const getDirectChildByClass = (elem, className) => { 1918 const childNodes = toArray(elem.childNodes); 1919 1920 for (let i = 0; i < childNodes.length; i++) { 1921 if (hasClass(childNodes[i], className)) { 1922 return childNodes[i]; 1923 } 1924 } 1925 }; 1926 /** 1927 * @param {HTMLElement} elem 1928 * @param {string} property 1929 * @param {*} value 1930 */ 1931 1932 const applyNumericalStyle = (elem, property, value) => { 1933 if (value === "".concat(parseInt(value))) { 1934 value = parseInt(value); 1935 } 1936 1937 if (value || parseInt(value) === 0) { 1938 elem.style[property] = typeof value === 'number' ? "".concat(value, "px") : value; 1939 } else { 1940 elem.style.removeProperty(property); 1941 } 1942 }; 1943 /** 1944 * @param {HTMLElement} elem 1945 * @param {string} display 1946 */ 1947 1948 const show = function (elem) { 1949 let display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex'; 1950 elem.style.display = display; 1951 }; 1952 /** 1953 * @param {HTMLElement} elem 1954 */ 1955 1956 const hide = elem => { 1957 elem.style.display = 'none'; 1958 }; 1959 const setStyle = (parent, selector, property, value) => { 1960 const el = parent.querySelector(selector); 1961 1962 if (el) { 1963 el.style[property] = value; 1964 } 1965 }; 1966 const toggle = (elem, condition, display) => { 1967 condition ? show(elem, display) : hide(elem); 1968 }; // borrowed from jquery $(elem).is(':visible') implementation 1969 1970 const isVisible = elem => !!(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length)); 1971 const allButtonsAreHidden = () => !isVisible(getConfirmButton()) && !isVisible(getDenyButton()) && !isVisible(getCancelButton()); 1972 const isScrollable = elem => !!(elem.scrollHeight > elem.clientHeight); // borrowed from https://stackoverflow.com/a/46352119 1973 1974 const hasCssAnimation = elem => { 1975 const style = window.getComputedStyle(elem); 1976 const animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0'); 1977 const transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0'); 1978 return animDuration > 0 || transDuration > 0; 1979 }; 1980 const animateTimerProgressBar = function (timer) { 1981 let reset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 1982 const timerProgressBar = getTimerProgressBar(); 1983 1984 if (isVisible(timerProgressBar)) { 1985 if (reset) { 1986 timerProgressBar.style.transition = 'none'; 1987 timerProgressBar.style.width = '100%'; 1988 } 1989 1990 setTimeout(() => { 1991 timerProgressBar.style.transition = "width ".concat(timer / 1000, "s linear"); 1992 timerProgressBar.style.width = '0%'; 1993 }, 10); 1994 } 1995 }; 1996 const stopTimerProgressBar = () => { 1997 const timerProgressBar = getTimerProgressBar(); 1998 const timerProgressBarWidth = parseInt(window.getComputedStyle(timerProgressBar).width); 1999 timerProgressBar.style.removeProperty('transition'); 2000 timerProgressBar.style.width = '100%'; 2001 const timerProgressBarFullWidth = parseInt(window.getComputedStyle(timerProgressBar).width); 2002 const timerProgressBarPercent = timerProgressBarWidth / timerProgressBarFullWidth * 100; 2003 timerProgressBar.style.removeProperty('transition'); 2004 timerProgressBar.style.width = "".concat(timerProgressBarPercent, "%"); 2005 }; 2006 2007 /** 2008 * Detect Node env 2009 * 2010 * @returns {boolean} 2011 */ 2012 const isNodeEnv = () => typeof window === 'undefined' || typeof document === 'undefined'; 2013 2014 const RESTORE_FOCUS_TIMEOUT = 100; 2015 2016 const globalState = {}; 2017 2018 const focusPreviousActiveElement = () => { 2019 if (globalState.previousActiveElement && globalState.previousActiveElement.focus) { 2020 globalState.previousActiveElement.focus(); 2021 globalState.previousActiveElement = null; 2022 } else if (document.body) { 2023 document.body.focus(); 2024 } 2025 }; // Restore previous active (focused) element 2026 2027 2028 const restoreActiveElement = returnFocus => { 2029 return new Promise(resolve => { 2030 if (!returnFocus) { 2031 return resolve(); 2032 } 2033 2034 const x = window.scrollX; 2035 const y = window.scrollY; 2036 globalState.restoreFocusTimeout = setTimeout(() => { 2037 focusPreviousActiveElement(); 2038 resolve(); 2039 }, RESTORE_FOCUS_TIMEOUT); // issues/900 2040 2041 window.scrollTo(x, y); 2042 }); 2043 }; 2044 2045 const sweetHTML = "\n <div aria-labelledby=\"".concat(swalClasses.title, "\" aria-describedby=\"").concat(swalClasses['html-container'], "\" class=\"").concat(swalClasses.popup, "\" tabindex=\"-1\">\n <button type=\"button\" class=\"").concat(swalClasses.close, "\"></button>\n <ul class=\"").concat(swalClasses['progress-steps'], "\"></ul>\n <div class=\"").concat(swalClasses.icon, "\"></div>\n <img class=\"").concat(swalClasses.image, "\" />\n <h2 class=\"").concat(swalClasses.title, "\" id=\"").concat(swalClasses.title, "\"></h2>\n <div class=\"").concat(swalClasses['html-container'], "\" id=\"").concat(swalClasses['html-container'], "\"></div>\n <input class=\"").concat(swalClasses.input, "\" />\n <input type=\"file\" class=\"").concat(swalClasses.file, "\" />\n <div class=\"").concat(swalClasses.range, "\">\n <input type=\"range\" />\n <output></output>\n </div>\n <select class=\"").concat(swalClasses.select, "\"></select>\n <div class=\"").concat(swalClasses.radio, "\"></div>\n <label for=\"").concat(swalClasses.checkbox, "\" class=\"").concat(swalClasses.checkbox, "\">\n <input type=\"checkbox\" />\n <span class=\"").concat(swalClasses.label, "\"></span>\n </label>\n <textarea class=\"").concat(swalClasses.textarea, "\"></textarea>\n <div class=\"").concat(swalClasses['validation-message'], "\" id=\"").concat(swalClasses['validation-message'], "\"></div>\n <div class=\"").concat(swalClasses.actions, "\">\n <div class=\"").concat(swalClasses.loader, "\"></div>\n <button type=\"button\" class=\"").concat(swalClasses.confirm, "\"></button>\n <button type=\"button\" class=\"").concat(swalClasses.deny, "\"></button>\n <button type=\"button\" class=\"").concat(swalClasses.cancel, "\"></button>\n </div>\n <div class=\"").concat(swalClasses.footer, "\"></div>\n <div class=\"").concat(swalClasses['timer-progress-bar-container'], "\">\n <div class=\"").concat(swalClasses['timer-progress-bar'], "\"></div>\n </div>\n </div>\n").replace(/(^|\n)\s*/g, ''); 2046 2047 const resetOldContainer = () => { 2048 const oldContainer = getContainer(); 2049 2050 if (!oldContainer) { 2051 return false; 2052 } 2053 2054 oldContainer.remove(); 2055 removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]); 2056 return true; 2057 }; 2058 2059 const resetValidationMessage = () => { 2060 globalState.currentInstance.resetValidationMessage(); 2061 }; 2062 2063 const addInputChangeListeners = () => { 2064 const popup = getPopup(); 2065 const input = getDirectChildByClass(popup, swalClasses.input); 2066 const file = getDirectChildByClass(popup, swalClasses.file); 2067 const range = popup.querySelector(".".concat(swalClasses.range, " input")); 2068 const rangeOutput = popup.querySelector(".".concat(swalClasses.range, " output")); 2069 const select = getDirectChildByClass(popup, swalClasses.select); 2070 const checkbox = popup.querySelector(".".concat(swalClasses.checkbox, " input")); 2071 const textarea = getDirectChildByClass(popup, swalClasses.textarea); 2072 input.oninput = resetValidationMessage; 2073 file.onchange = resetValidationMessage; 2074 select.onchange = resetValidationMessage; 2075 checkbox.onchange = resetValidationMessage; 2076 textarea.oninput = resetValidationMessage; 2077 2078 range.oninput = () => { 2079 resetValidationMessage(); 2080 rangeOutput.value = range.value; 2081 }; 2082 2083 range.onchange = () => { 2084 resetValidationMessage(); 2085 range.nextSibling.value = range.value; 2086 }; 2087 }; 2088 2089 const getTarget = target => typeof target === 'string' ? document.querySelector(target) : target; 2090 2091 const setupAccessibility = params => { 2092 const popup = getPopup(); 2093 popup.setAttribute('role', params.toast ? 'alert' : 'dialog'); 2094 popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive'); 2095 2096 if (!params.toast) { 2097 popup.setAttribute('aria-modal', 'true'); 2098 } 2099 }; 2100 2101 const setupRTL = targetElement => { 2102 if (window.getComputedStyle(targetElement).direction === 'rtl') { 2103 addClass(getContainer(), swalClasses.rtl); 2104 } 2105 }; 2106 /* 2107 * Add modal + backdrop + no-war message for Russians to DOM 2108 */ 2109 2110 2111 const init = params => { 2112 // Clean up the old popup container if it exists 2113 const oldContainerExisted = resetOldContainer(); 2114 /* istanbul ignore if */ 2115 2116 if (isNodeEnv()) { 2117 error('SweetAlert2 requires document to initialize'); 2118 return; 2119 } 2120 2121 const container = document.createElement('div'); 2122 container.className = swalClasses.container; 2123 2124 if (oldContainerExisted) { 2125 addClass(container, swalClasses['no-transition']); 2126 } 2127 2128 setInnerHtml(container, sweetHTML); 2129 const targetElement = getTarget(params.target); 2130 targetElement.appendChild(container); 2131 setupAccessibility(params); 2132 setupRTL(targetElement); 2133 addInputChangeListeners(); 2134 noWarMessageForRussians(container, params); 2135 }; 2136 2137 const noWarMessageForRussians = (container, params) => { 2138 if (params.toast) { 2139 return; 2140 } // This message is targeted at people who are corrupted by propaganda, everybody else 2141 // is already against war either silently or actively. 2142 // 2143 // The point is to wrap the truth-bomb into a patriotic title so they will actually click it 2144 // and listen to the uncomfortable truth about the war from the people they love or respect. 2145 2146 2147 const message = getRandomElement([{ 2148 text: 'ШÐÐРЦÐÐÐÐÐÐРобÑаÑилÑÑ <br> к РУССÐÐÐУ ÐÐÐ ÐÐУ о войне', 2149 // Arnold is loved in Russia by all people including those who are for this war 2150 // His speech might change the mind of those who are brainwashed by propaganda 2151 youtubeId: 'fWClXZd9c78' 2152 }, { 2153 text: 'РУССÐÐÐ ÐÐТРÐÐТ <br> оÑкÑÑл главнÑÑ ÑÐ°Ð¹Ð½Ñ ÑпеÑопеÑаÑии', 2154 // In this video one of the most famous Russian nationalist leaders, Dmitry Demushkin, 2155 // explains that this war has no sense and produces the exact opposite result of what 2156 // it was intended to do. 2157 youtubeId: '_RjBNkn88yA' 2158 }, { 2159 text: 'ÐÐÐ ÐÐ ÐÐÐÐÐ ÐССÐРСТРÐÐÐÐÐ <br> дал оÑÐµÐ½ÐºÑ Ñ Ð¾Ð´Ñ ÑпеÑопеÑаÑии', 2160 // In this video Igor Girkin, who played a key role in the annexation of Crimea, 2161 // explains that this war has failed already and all possible outcomes are bad for Ru
vendor: 5,940 bytes, lines 2161-2344
2161ssia. 2162 youtubeId: 'yUmzQT4C8JY' 2163 }, { 2164 text: 'ФÐÐСÐÐÐ ÐРУРРÐССÐÐ <br> говоÑÐ¸Ñ ÐÐ-РУССÐРо ÑпеÑопеÑаÑии', 2165 youtubeId: 'hkCYb6edUrQ' 2166 }]); // The message will only be shown to Russian users visiting Russian sites 2167 2168 if (navigator.language === 'ru' && location.host.match(/\.(ru|su|xn--p1ai)$/)) { 2169 const noWar = document.createElement('div'); 2170 noWar.className = swalClasses['no-war']; 2171 setInnerHtml(noWar, "<a href=\"https://www.youtube.com/watch?v=".concat(message.youtubeId, "\" target=\"_blank\">").concat(message.text, "</a>")); 2172 container.appendChild(noWar); 2173 container.style.paddingTop = '4em'; 2174 } 2175 }; 2176 2177 /** 2178 * @param {HTMLElement | object | string} param 2179 * @param {HTMLElement} target 2180 */ 2181 2182 const parseHtmlToContainer = (param, target) => { 2183 // DOM element 2184 if (param instanceof HTMLElement) { 2185 target.appendChild(param); 2186 } // Object 2187 else if (typeof param === 'object') { 2188 handleObject(param, target); 2189 } // Plain string 2190 else if (param) { 2191 setInnerHtml(target, param); 2192 } 2193 }; 2194 /** 2195 * @param {object} param 2196 * @param {HTMLElement} target 2197 */ 2198 2199 const handleObject = (param, target) => { 2200 // JQuery element(s) 2201 if (param.jquery) { 2202 handleJqueryElem(target, param); 2203 } // For other objects use their string representation 2204 else { 2205 setInnerHtml(target, param.toString()); 2206 } 2207 }; 2208 2209 const handleJqueryElem = (target, elem) => { 2210 target.textContent = ''; 2211 2212 if (0 in elem) { 2213 for (let i = 0; (i in elem); i++) { 2214 target.appendChild(elem[i].cloneNode(true)); 2215 } 2216 } else { 2217 target.appendChild(elem.cloneNode(true)); 2218 } 2219 }; 2220 2221 const animationEndEvent = (() => { 2222 // Prevent run in Node env 2223 2224 /* istanbul ignore if */ 2225 if (isNodeEnv()) { 2226 return false; 2227 } 2228 2229 const testEl = document.createElement('div'); 2230 const transEndEventNames = { 2231 WebkitAnimation: 'webkitAnimationEnd', 2232 // Chrome, Safari and Opera 2233 animation: 'animationend' // Standard syntax 2234 2235 }; 2236 2237 for (const i in transEndEventNames) { 2238 if (Object.prototype.hasOwnProperty.call(transEndEventNames, i) && typeof testEl.style[i] !== 'undefined') { 2239 return transEndEventNames[i]; 2240 } 2241 } 2242 2243 return false; 2244 })(); 2245 2246 // https://github.com/twbs/bootstrap/blob/master/js/src/modal.js 2247 2248 const measureScrollbar = () => { 2249 const scrollDiv = document.createElement('div'); 2250 scrollDiv.className = swalClasses['scrollbar-measure']; 2251 document.body.appendChild(scrollDiv); 2252 const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 2253 document.body.removeChild(scrollDiv); 2254 return scrollbarWidth; 2255 }; 2256 2257 const renderActions = (instance, params) => { 2258 const actions = getActions(); 2259 const loader = getLoader(); // Actions (buttons) wrapper 2260 2261 if (!params.showConfirmButton && !params.showDenyButton && !params.showCancelButton) { 2262 hide(actions); 2263 } else { 2264 show(actions); 2265 } // Custom class 2266 2267 2268 applyCustomClass(actions, params, 'actions'); // Render all the buttons 2269 2270 renderButtons(actions, loader, params); // Loader 2271 2272 setInnerHtml(loader, params.loaderHtml); 2273 applyCustomClass(loader, params, 'loader'); 2274 }; 2275 2276 function renderButtons(actions, loader, params) { 2277 const confirmButton = getConfirmButton(); 2278 const denyButton = getDenyButton(); 2279 const cancelButton = getCancelButton(); // Render buttons 2280 2281 renderButton(confirmButton, 'confirm', params); 2282 renderButton(denyButton, 'deny', params); 2283 renderButton(cancelButton, 'cancel', params); 2284 handleButtonsStyling(confirmButton, denyButton, cancelButton, params); 2285 2286 if (params.reverseButtons) { 2287 if (params.toast) { 2288 actions.insertBefore(cancelButton, confirmButton); 2289 actions.insertBefore(denyButton, confirmButton); 2290 } else { 2291 actions.insertBefore(cancelButton, loader); 2292 actions.insertBefore(denyButton, loader); 2293 actions.insertBefore(confirmButton, loader); 2294 } 2295 } 2296 } 2297 2298 function handleButtonsStyling(confirmButton, denyButton, cancelButton, params) { 2299 if (!params.buttonsStyling) { 2300 return removeClass([confirmButton, denyButton, cancelButton], swalClasses.styled); 2301 } 2302 2303 addClass([confirmButton, denyButton, cancelButton], swalClasses.styled); // Buttons background colors 2304 2305 if (params.confirmButtonColor) { 2306 confirmButton.style.backgroundColor = params.confirmButtonColor; 2307 addClass(confirmButton, swalClasses['default-outline']); 2308 } 2309 2310 if (params.denyButtonColor) { 2311 denyButton.style.backgroundColor = params.denyButtonColor; 2312 addClass(denyButton, swalClasses['default-outline']); 2313 } 2314 2315 if (params.cancelButtonColor) { 2316 cancelButton.style.backgroundColor = params.cancelButtonColor; 2317 addClass(cancelButton, swalClasses['default-outline']); 2318 } 2319 } 2320 2321 function renderButton(button, buttonType, params) { 2322 toggle(button, params["show".concat(capitalizeFirstLetter(buttonType), "Button")], 'inline-block'); 2323 setInnerHtml(button, params["".concat(buttonType, "ButtonText")]); // Set caption text 2324 2325 button.setAttribute('aria-label', params["".concat(buttonType, "ButtonAriaLabel")]); // ARIA label 2326 // Add buttons custom classes 2327 2328 button.className = swalClasses[buttonType]; 2329 applyCustomClass(button, params, "".concat(buttonType, "Button")); 2330 addClass(button, params["".concat(buttonType, "ButtonClass")]); 2331 } 2332 2333 function handleBackdropParam(container, backdrop) { 2334 if (typeof backdrop === 'string') { 2335 container.style.background = backdrop; 2336 } else if (!backdrop) { 2337 addClass([document.documentElement, document.body], swalClasses['no-backdrop']); 2338 } 2339 } 2340 2341 function handlePositionParam(container, position) { 2342 if (position in swalClasses) { 2343 addClass(container, swalClasses[position]); 2344 } else {
2345 warn('The "position" parameter is not valid, defaulting to "center"'); 2346 addClass(container, swalClasses.center); 2347 } 2348 } 2349 2350 function handleGrowParam(container, grow) { 2351 if (grow && typeof grow === 'string') { 2352 const growClass = "grow-".concat(grow); 2353 2354 if (growClass in swalClasses) { 2355 addClass(container, swalClasses[growClass]); 2356 } 2357 } 2358 } 2359 2360 const renderContainer = (instance, params) => { 2361 const container = getContainer(); 2362 2363 if (!container) { 2364 return; 2365 } 2366 2367 handleBackdropParam(container, params.backdrop); 2368 handlePositionParam(container, params.position); 2369 handleGrowParam(container, params.grow); // Custom class 2370 2371 applyCustomClass(container, params, 'container'); 2372 }; 2373 2374 /** 2375 * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has. 2376 * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` 2377 * This is the approach that Babel will probably take to implement private methods/fields 2378 * https://github.com/tc39/proposal-private-methods 2379 * https://github.com/babel/babel/pull/7555 2380 * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* 2381 * then we can use that language feature. 2382 */ 2383 var privateProps = { 2384 awaitingPromise: new WeakMap(), 2385 promise: new WeakMap(), 2386 innerParams: new WeakMap(), 2387 domCache: new WeakMap() 2388 }; 2389 2390 /// <reference path="../../../../sweetalert2.d.ts"/> 2391 /** @type {InputClass[]} */ 2392 2393 const inputClasses = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea']; 2394 /** 2395 * @param {SweetAlert2} instance 2396 * @param {SweetAlertOptions} params 2397 */ 2398 2399 const renderInput = (instance, params) => { 2400 const popup = getPopup(); 2401 const innerParams = privateProps.innerParams.get(instance); 2402 const rerender = !innerParams || params.input !== innerParams.input; 2403 inputClasses.forEach(inputClass => { 2404 const inputContainer = getDirectChildByClass(popup, swalClasses[inputClass]); // set attributes 2405 2406 setAttributes(inputClass, params.inputAttributes); // set class 2407 2408 inputContainer.className = swalClasses[inputClass]; 2409 2410 if (rerender) { 2411 hide(inputContainer); 2412 } 2413 }); 2414 2415 if (params.input) { 2416 if (rerender) { 2417 showInput(params); 2418 } // set custom class 2419 2420 2421 setCustomClass(params); 2422 } 2423 }; 2424 /** 2425 * @param {SweetAlertOptions} params 2426 */ 2427 2428 const showInput = params => { 2429 if (!renderInputType[params.input]) { 2430 return error("Unexpected type of input! Expected \"text\", \"email\", \"password\", \"number\", \"tel\", \"select\", \"radio\", \"checkbox\", \"textarea\", \"file\" or \"url\", got \"".concat(params.input, "\"")); 2431 } 2432 2433 const inputContainer = getInputContainer(params.input); 2434 const input = renderInputType[params.input](inputContainer, params); 2435 show(inputContainer); // input autofocus 2436 2437 setTimeout(() => { 2438 focusInput(input); 2439 }); 2440 }; 2441 /** 2442 * @param {HTMLInputElement} input 2443 */ 2444 2445 2446 const removeAttributes = input => { 2447 for (let i = 0; i < input.attributes.length; i++) { 2448 const attrName = input.attributes[i].name; 2449 2450 if (!['type', 'value', 'style'].includes(attrName)) { 2451 input.removeAttribute(attrName); 2452 } 2453 } 2454 }; 2455 /** 2456 * @param {InputClass} inputClass 2457 * @param {SweetAlertOptions['inputAttributes']} inputAttributes 2458 */ 2459 2460 2461 const setAttributes = (inputClass, inputAttributes) => { 2462 const input = getInput(getPopup(), inputClass); 2463 2464 if (!input) { 2465 return; 2466 } 2467 2468 removeAttributes(input); 2469 2470 for (const attr in inputAttributes) { 2471 input.setAttribute(attr, inputAttributes[attr]); 2472 } 2473 }; 2474 /** 2475 * @param {SweetAlertOptions} params 2476 */ 2477 2478 2479 const setCustomClass = params => { 2480 const inputContainer = getInputContainer(params.input); 2481 2482 if (typeof params.customClass === 'object') { 2483 addClass(inputContainer, params.customClass.input); 2484 } 2485 }; 2486 /** 2487 * @param {HTMLInputElement | HTMLTextAreaElement} input 2488 * @param {SweetAlertOptions} params 2489 */ 2490 2491 2492 const setInputPlaceholder = (input, params) => { 2493 if (!input.placeholder || params.inputPlaceholder) { 2494 input.placeholder = params.inputPlaceholder; 2495 } 2496 }; 2497 /** 2498 * @param {Input} input 2499 * @param {Input} prependTo 2500 * @param {SweetAlertOptions} params 2501 */ 2502 2503 2504 const setInputLabel = (input, prependTo, params) => { 2505 if (params.inputLabel) { 2506 input.id = swalClasses.input; 2507 const label = document.createElement('label'); 2508 const labelClass = swalClasses['input-label']; 2509 label.setAttribute('for', input.id); 2510 label.className = labelClass; 2511 2512 if (typeof params.customClass === 'object') { 2513 addClass(label, params.customClass.inputLabel); 2514 } 2515 2516 label.innerText = params.inputLabel; 2517 prependTo.insertAdjacentElement('beforebegin', label); 2518 } 2519 }; 2520 /** 2521 * @param {SweetAlertOptions['input']} inputType 2522 * @returns {HTMLElement} 2523 */ 2524 2525 2526 const getInputContainer = inputType => { 2527 return getDirectChildByClass(getPopup(), swalClasses[inputType] || swalClasses.input); 2528 }; 2529 /** 2530 * @param {HTMLInputElement | HTMLOutputElement | HTMLTextAreaElement} input 2531 * @param {SweetAlertOptions['inputValue']} inputValue 2532 */ 2533 2534 2535 const checkAndSetInputValue = (input, inputValue) => { 2536 if (['string', 'number'].includes(typeof inputValue)) { 2537 input.value = "".concat(inputValue); 2538 } else if (!isPromise(inputValue)) { 2539 warn("Unexpected type of inputValue! Expected \"string\", \"number\" or \"Promise\", got \"".concat(typeof inputValue, "\"")); 2540 } 2541 }; 2542 /** @type Record<string, (input: Input | HTMLElement, params: SweetAlertOptions) =>
vendor: 2,941 bytes, lines 2542-2649
2542 Input> */ 2543 2544 2545 const renderInputType = {}; 2546 /** 2547 * @param {HTMLInputElement} input 2548 * @param {SweetAlertOptions} params 2549 * @returns {HTMLInputElement} 2550 */ 2551 2552 renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = (input, params) => { 2553 checkAndSetInputValue(input, params.inputValue); 2554 setInputLabel(input, input, params); 2555 setInputPlaceholder(input, params); 2556 input.type = params.input; 2557 return input; 2558 }; 2559 /** 2560 * @param {HTMLInputElement} input 2561 * @param {SweetAlertOptions} params 2562 * @returns {HTMLInputElement} 2563 */ 2564 2565 2566 renderInputType.file = (input, params) => { 2567 setInputLabel(input, input, params); 2568 setInputPlaceholder(input, params); 2569 return input; 2570 }; 2571 /** 2572 * @param {HTMLInputElement} range 2573 * @param {SweetAlertOptions} params 2574 * @returns {HTMLInputElement} 2575 */ 2576 2577 2578 renderInputType.range = (range, params) => { 2579 const rangeInput = range.querySelector('input'); 2580 const rangeOutput = range.querySelector('output'); 2581 checkAndSetInputValue(rangeInput, params.inputValue); 2582 rangeInput.type = params.input; 2583 checkAndSetInputValue(rangeOutput, params.inputValue); 2584 setInputLabel(rangeInput, range, params); 2585 return range; 2586 }; 2587 /** 2588 * @param {HTMLSelectElement} select 2589 * @param {SweetAlertOptions} params 2590 * @returns {HTMLSelectElement} 2591 */ 2592 2593 2594 renderInputType.select = (select, params) => { 2595 select.textContent = ''; 2596 2597 if (params.inputPlaceholder) { 2598 const placeholder = document.createElement('option'); 2599 setInnerHtml(placeholder, params.inputPlaceholder); 2600 placeholder.value = ''; 2601 placeholder.disabled = true; 2602 placeholder.selected = true; 2603 select.appendChild(placeholder); 2604 } 2605 2606 setInputLabel(select, select, params); 2607 return select; 2608 }; 2609 /** 2610 * @param {HTMLInputElement} radio 2611 * @returns {HTMLInputElement} 2612 */ 2613 2614 2615 renderInputType.radio = radio => { 2616 radio.textContent = ''; 2617 return radio; 2618 }; 2619 /** 2620 * @param {HTMLLabelElement} checkboxContainer 2621 * @param {SweetAlertOptions} params 2622 * @returns {HTMLInputElement} 2623 */ 2624 2625 2626 renderInputType.checkbox = (checkboxContainer, params) => { 2627 const checkbox = getInput(getPopup(), 'checkbox'); 2628 checkbox.value = '1'; 2629 checkbox.id = swalClasses.checkbox; 2630 checkbox.checked = Boolean(params.inputValue); 2631 const label = checkboxContainer.querySelector('span'); 2632 setInnerHtml(label, params.inputPlaceholder); 2633 return checkbox; 2634 }; 2635 /** 2636 * @param {HTMLTextAreaElement} textarea 2637 * @param {SweetAlertOptions} params 2638 * @returns {HTMLTextAreaElement} 2639 */ 2640 2641 2642 renderInputType.textarea = (textarea, params) => { 2643 checkAndSetInputValue(textarea, params.inputValue); 2644 setInputPlaceholder(textarea, params); 2645 setInputLabel(textarea, textarea, params); 2646 /** 2647 * @param {HTMLElement} el 2648 * @returns {number} 2649 */
vendor: 35,761 bytes, lines 2649-3835
2649 2650 2651 const getMargin = el => parseInt(window.getComputedStyle(el).marginLeft) + parseInt(window.getComputedStyle(el).marginRight); // https://github.com/sweetalert2/sweetalert2/issues/2291 2652 2653 2654 setTimeout(() => { 2655 // https://github.com/sweetalert2/sweetalert2/issues/1699 2656 if ('MutationObserver' in window) { 2657 const initialPopupWidth = parseInt(window.getComputedStyle(getPopup()).width); 2658 2659 const textareaResizeHandler = () => { 2660 const textareaWidth = textarea.offsetWidth + getMargin(textarea); 2661 2662 if (textareaWidth > initialPopupWidth) { 2663 getPopup().style.width = "".concat(textareaWidth, "px"); 2664 } else { 2665 getPopup().style.width = null; 2666 } 2667 }; 2668 2669 new MutationObserver(textareaResizeHandler).observe(textarea, { 2670 attributes: true, 2671 attributeFilter: ['style'] 2672 }); 2673 } 2674 }); 2675 return textarea; 2676 }; 2677 2678 const renderContent = (instance, params) => { 2679 const htmlContainer = getHtmlContainer(); 2680 applyCustomClass(htmlContainer, params, 'htmlContainer'); // Content as HTML 2681 2682 if (params.html) { 2683 parseHtmlToContainer(params.html, htmlContainer); 2684 show(htmlContainer, 'block'); 2685 } // Content as plain text 2686 else if (params.text) { 2687 htmlContainer.textContent = params.text; 2688 show(htmlContainer, 'block'); 2689 } // No content 2690 else { 2691 hide(htmlContainer); 2692 } 2693 2694 renderInput(instance, params); 2695 }; 2696 2697 const renderFooter = (instance, params) => { 2698 const footer = getFooter(); 2699 toggle(footer, params.footer); 2700 2701 if (params.footer) { 2702 parseHtmlToContainer(params.footer, footer); 2703 } // Custom class 2704 2705 2706 applyCustomClass(footer, params, 'footer'); 2707 }; 2708 2709 const renderCloseButton = (instance, params) => { 2710 const closeButton = getCloseButton(); 2711 setInnerHtml(closeButton, params.closeButtonHtml); // Custom class 2712 2713 applyCustomClass(closeButton, params, 'closeButton'); 2714 toggle(closeButton, params.showCloseButton); 2715 closeButton.setAttribute('aria-label', params.closeButtonAriaLabel); 2716 }; 2717 2718 const renderIcon = (instance, params) => { 2719 const innerParams = privateProps.innerParams.get(instance); 2720 const icon = getIcon(); // if the given icon already rendered, apply the styling without re-rendering the icon 2721 2722 if (innerParams && params.icon === innerParams.icon) { 2723 // Custom or default content 2724 setContent(icon, params); 2725 applyStyles(icon, params); 2726 return; 2727 } 2728 2729 if (!params.icon && !params.iconHtml) { 2730 return hide(icon); 2731 } 2732 2733 if (params.icon && Object.keys(iconTypes).indexOf(params.icon) === -1) { 2734 error("Unknown icon! Expected \"success\", \"error\", \"warning\", \"info\" or \"question\", got \"".concat(params.icon, "\"")); 2735 return hide(icon); 2736 } 2737 2738 show(icon); // Custom or default content 2739 2740 setContent(icon, params); 2741 applyStyles(icon, params); // Animate icon 2742 2743 addClass(icon, params.showClass.icon); 2744 }; 2745 2746 const applyStyles = (icon, params) => { 2747 for (const iconType in iconTypes) { 2748 if (params.icon !== iconType) { 2749 removeClass(icon, iconTypes[iconType]); 2750 } 2751 } 2752 2753 addClass(icon, iconTypes[params.icon]); // Icon color 2754 2755 setColor(icon, params); // Success icon background color 2756 2757 adjustSuccessIconBackgroundColor(); // Custom class 2758 2759 applyCustomClass(icon, params, 'icon'); 2760 }; // Adjust success icon background color to match the popup background color 2761 2762 2763 const adjustSuccessIconBackgroundColor = () => { 2764 const popup = getPopup(); 2765 const popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color'); 2766 const successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix'); 2767 2768 for (let i = 0; i < successIconParts.length; i++) { 2769 successIconParts[i].style.backgroundColor = popupBackgroundColor; 2770 } 2771 }; 2772 2773 const successIconHtml = "\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"; 2774 const errorIconHtml = "\n <span class=\"swal2-x-mark\">\n <span class=\"swal2-x-mark-line-left\"></span>\n <span class=\"swal2-x-mark-line-right\"></span>\n </span>\n"; 2775 2776 const setContent = (icon, params) => { 2777 icon.textContent = ''; 2778 2779 if (params.iconHtml) { 2780 setInnerHtml(icon, iconContent(params.iconHtml)); 2781 } else if (params.icon === 'success') { 2782 setInnerHtml(icon, successIconHtml); 2783 } else if (params.icon === 'error') { 2784 setInnerHtml(icon, errorIconHtml); 2785 } else { 2786 const defaultIconHtml = { 2787 question: '?', 2788 warning: '!', 2789 info: 'i' 2790 }; 2791 setInnerHtml(icon, iconContent(defaultIconHtml[params.icon])); 2792 } 2793 }; 2794 2795 const setColor = (icon, params) => { 2796 if (!params.iconColor) { 2797 return; 2798 } 2799 2800 icon.style.color = params.iconColor; 2801 icon.style.borderColor = params.iconColor; 2802 2803 for (const sel of ['.swal2-success-line-tip', '.swal2-success-line-long', '.swal2-x-mark-line-left', '.swal2-x-mark-line-right']) { 2804 setStyle(icon, sel, 'backgroundColor', params.iconColor); 2805 } 2806 2807 setStyle(icon, '.swal2-success-ring', 'borderColor', params.iconColor); 2808 }; 2809 2810 const iconContent = content => "<div class=\"".concat(swalClasses['icon-content'], "\">").concat(content, "</div>"); 2811 2812 const renderImage = (instance, params) => { 2813 const image = getImage(); 2814 2815 if (!params.imageUrl) { 2816 return hide(image); 2817 } 2818 2819 show(image, ''); // Src, alt 2820 2821 image.setAttribute('src', params.imageUrl); 2822 image.setAttribute('alt', params.imageAlt); // Width, height 2823 2824 applyNumericalStyle(image, 'width', params.imageWidth); 2825 applyNumericalStyle(image, 'height', params.imageHeight); // Class 2826 2827 image.className = swalClasses.image; 2828 applyCustomClass(image, params, 'image'); 2829 }; 2830 2831 const createStepElement = step => { 2832 const stepEl = document.createElement('li'); 2833 addClass(stepEl, swalClasses['progress-step']); 2834 setInnerHtml(stepEl, step); 2835 return stepEl; 2836 }; 2837 2838 const createLineElement = params => { 2839 const lineEl = document.createElement('li'); 2840 addClass(lineEl, swalClasses['progress-step-line']); 2841 2842 if (params.progressStepsDistance) { 2843 lineEl.style.width = params.progressStepsDistance; 2844 } 2845 2846 return lineEl; 2847 }; 2848 2849 const renderProgressSteps = (instance, params) => { 2850 const progressStepsContainer = getProgressSteps(); 2851 2852 if (!params.progressSteps || params.progressSteps.length === 0) { 2853 return hide(progressStepsContainer); 2854 } 2855 2856 show(progressStepsContainer); 2857 progressStepsContainer.textContent = ''; 2858 2859 if (params.currentProgressStep >= params.progressSteps.length) { 2860 warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)'); 2861 } 2862 2863 params.progressSteps.forEach((step, index) => { 2864 const stepEl = createStepElement(step); 2865 progressStepsContainer.appendChild(stepEl); 2866 2867 if (index === params.currentProgressStep) { 2868 addClass(stepEl, swalClasses['active-progress-step']); 2869 } 2870 2871 if (index !== params.progressSteps.length - 1) { 2872 const lineEl = createLineElement(params); 2873 progressStepsContainer.appendChild(lineEl); 2874 } 2875 }); 2876 }; 2877 2878 const renderTitle = (instance, params) => { 2879 const title = getTitle(); 2880 toggle(title, params.title || params.titleText, 'block'); 2881 2882 if (params.title) { 2883 parseHtmlToContainer(params.title, title); 2884 } 2885 2886 if (params.titleText) { 2887 title.innerText = params.titleText; 2888 } // Custom class 2889 2890 2891 applyCustomClass(title, params, 'title'); 2892 }; 2893 2894 const renderPopup = (instance, params) => { 2895 const container = getContainer(); 2896 const popup = getPopup(); // Width 2897 // https://github.com/sweetalert2/sweetalert2/issues/2170 2898 2899 if (params.toast) { 2900 applyNumericalStyle(container, 'width', params.width); 2901 popup.style.width = '100%'; 2902 popup.insertBefore(getLoader(), getIcon()); 2903 } else { 2904 applyNumericalStyle(popup, 'width', params.width); 2905 } // Padding 2906 2907 2908 applyNumericalStyle(popup, 'padding', params.padding); // Color 2909 2910 if (params.color) { 2911 popup.style.color = params.color; 2912 } // Background 2913 2914 2915 if (params.background) { 2916 popup.style.background = params.background; 2917 } 2918 2919 hide(getValidationMessage()); // Classes 2920 2921 addClasses(popup, params); 2922 }; 2923 2924 const addClasses = (popup, params) => { 2925 // Default Class + showClass when updating Swal.update({}) 2926 popup.className = "".concat(swalClasses.popup, " ").concat(isVisible(popup) ? params.showClass.popup : ''); 2927 2928 if (params.toast) { 2929 addClass([document.documentElement, document.body], swalClasses['toast-shown']); 2930 addClass(popup, swalClasses.toast); 2931 } else { 2932 addClass(popup, swalClasses.modal); 2933 } // Custom class 2934 2935 2936 applyCustomClass(popup, params, 'popup'); 2937 2938 if (typeof params.customClass === 'string') { 2939 addClass(popup, params.customClass); 2940 } // Icon class (#1842) 2941 2942 2943 if (params.icon) { 2944 addClass(popup, swalClasses["icon-".concat(params.icon)]); 2945 } 2946 }; 2947 2948 const render = (instance, params) => { 2949 renderPopup(instance, params); 2950 renderContainer(instance, params); 2951 renderProgressSteps(instance, params); 2952 renderIcon(instance, params); 2953 renderImage(instance, params); 2954 renderTitle(instance, params); 2955 renderCloseButton(instance, params); 2956 renderContent(instance, params); 2957 renderActions(instance, params); 2958 renderFooter(instance, params); 2959 2960 if (typeof params.didRender === 'function') { 2961 params.didRender(getPopup()); 2962 } 2963 }; 2964 2965 const DismissReason = Object.freeze({ 2966 cancel: 'cancel', 2967 backdrop: 'backdrop', 2968 close: 'close', 2969 esc: 'esc', 2970 timer: 'timer' 2971 }); 2972 2973 // Adding aria-hidden="true" to elements outside of the active modal dialog ensures that 2974 // elements not within the active modal dialog will not be surfaced if a user opens a screen 2975 // readerâs list of elements (headings, form controls, landmarks, etc.) in the document. 2976 2977 const setAriaHidden = () => { 2978 const bodyChildren = toArray(document.body.children); 2979 bodyChildren.forEach(el => { 2980 if (el === getContainer() || el.contains(getContainer())) { 2981 return; 2982 } 2983 2984 if (el.hasAttribute('aria-hidden')) { 2985 el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden')); 2986 } 2987 2988 el.setAttribute('aria-hidden', 'true'); 2989 }); 2990 }; 2991 const unsetAriaHidden = () => { 2992 const bodyChildren = toArray(document.body.children); 2993 bodyChildren.forEach(el => { 2994 if (el.hasAttribute('data-previous-aria-hidden')) { 2995 el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden')); 2996 el.removeAttribute('data-previous-aria-hidden'); 2997 } else { 2998 el.removeAttribute('aria-hidden'); 2999 } 3000 }); 3001 }; 3002 3003 const swalStringParams = ['swal-title', 'swal-html', 'swal-footer']; 3004 const getTemplateParams = params => { 3005 const template = typeof params.template === 'string' ? document.querySelector(params.template) : params.template; 3006 3007 if (!template) { 3008 return {}; 3009 } 3010 /** @type {DocumentFragment} */ 3011 3012 3013 const templateContent = template.content; 3014 showWarningsForElements(templateContent); 3015 const result = Object.assign(getSwalParams(templateContent), getSwalButtons(templateContent), getSwalImage(templateContent), getSwalIcon(templateContent), getSwalInput(templateContent), getSwalStringParams(templateContent, swalStringParams)); 3016 return result; 3017 }; 3018 /** 3019 * @param {DocumentFragment} templateContent 3020 */ 3021 3022 const getSwalParams = templateContent => { 3023 const result = {}; 3024 toArray(templateContent.querySelectorAll('swal-param')).forEach(param => { 3025 showWarningsForAttributes(param, ['name', 'value']); 3026 const paramName = param.getAttribute('name'); 3027 const value = param.getAttribute('value'); 3028 3029 if (typeof defaultParams[paramName] === 'boolean' && value === 'false') { 3030 result[paramName] = false; 3031 } 3032 3033 if (typeof defaultParams[paramName] === 'object') { 3034 result[paramName] = JSON.parse(value); 3035 } 3036 }); 3037 return result; 3038 }; 3039 /** 3040 * @param {DocumentFragment} templateContent 3041 */ 3042 3043 3044 const getSwalButtons = templateContent => { 3045 const result = {}; 3046 toArray(templateContent.querySelectorAll('swal-button')).forEach(button => { 3047 showWarningsForAttributes(button, ['type', 'color', 'aria-label']); 3048 const type = button.getAttribute('type'); 3049 result["".concat(type, "ButtonText")] = button.innerHTML; 3050 result["show".concat(capitalizeFirstLetter(type), "Button")] = true; 3051 3052 if (button.hasAttribute('color')) { 3053 result["".concat(type, "ButtonColor")] = button.getAttribute('color'); 3054 } 3055 3056 if (button.hasAttribute('aria-label')) { 3057 result["".concat(type, "ButtonAriaLabel")] = button.getAttribute('aria-label'); 3058 } 3059 }); 3060 return result; 3061 }; 3062 /** 3063 * @param {DocumentFragment} templateContent 3064 */ 3065 3066 3067 const getSwalImage = templateContent => { 3068 const result = {}; 3069 /** @type {HTMLElement} */ 3070 3071 const image = templateContent.querySelector('swal-image'); 3072 3073 if (image) { 3074 showWarningsForAttributes(image, ['src', 'width', 'height', 'alt']); 3075 3076 if (image.hasAttribute('src')) { 3077 result.imageUrl = image.getAttribute('src'); 3078 } 3079 3080 if (image.hasAttribute('width')) { 3081 result.imageWidth = image.getAttribute('width'); 3082 } 3083 3084 if (image.hasAttribute('height')) { 3085 result.imageHeight = image.getAttribute('height'); 3086 } 3087 3088 if (image.hasAttribute('alt')) { 3089 result.imageAlt = image.getAttribute('alt'); 3090 } 3091 } 3092 3093 return result; 3094 }; 3095 /** 3096 * @param {DocumentFragment} templateContent 3097 */ 3098 3099 3100 const getSwalIcon = templateContent => { 3101 const result = {}; 3102 /** @type {HTMLElement} */ 3103 3104 const icon = templateContent.querySelector('swal-icon'); 3105 3106 if (icon) { 3107 showWarningsForAttributes(icon, ['type', 'color']); 3108 3109 if (icon.hasAttribute('type')) { 3110 result.icon = icon.getAttribute('type'); 3111 } 3112 3113 if (icon.hasAttribute('color')) { 3114 result.iconColor = icon.getAttribute('color'); 3115 } 3116 3117 result.iconHtml = icon.innerHTML; 3118 } 3119 3120 return result; 3121 }; 3122 /** 3123 * @param {DocumentFragment} templateContent 3124 */ 3125 3126 3127 const getSwalInput = templateContent => { 3128 const result = {}; 3129 /** @type {HTMLElement} */ 3130 3131 const input = templateContent.querySelector('swal-input'); 3132 3133 if (input) { 3134 showWarningsForAttributes(input, ['type', 'label', 'placeholder', 'value']); 3135 result.input = input.getAttribute('type') || 'text'; 3136 3137 if (input.hasAttribute('label')) { 3138 result.inputLabel = input.getAttribute('label'); 3139 } 3140 3141 if (input.hasAttribute('placeholder')) { 3142 result.inputPlaceholder = input.getAttribute('placeholder'); 3143 } 3144 3145 if (input.hasAttribute('value')) { 3146 result.inputValue = input.getAttribute('value'); 3147 } 3148 } 3149 3150 const inputOptions = templateContent.querySelectorAll('swal-input-option'); 3151 3152 if (inputOptions.length) { 3153 result.inputOptions = {}; 3154 toArray(inputOptions).forEach(option => { 3155 showWarningsForAttributes(option, ['value']); 3156 const optionValue = option.getAttribute('value'); 3157 const optionName = option.innerHTML; 3158 result.inputOptions[optionValue] = optionName; 3159 }); 3160 } 3161 3162 return result; 3163 }; 3164 /** 3165 * @param {DocumentFragment} templateContent 3166 * @param {string[]} paramNames 3167 */ 3168 3169 3170 const getSwalStringParams = (templateContent, paramNames) => { 3171 const result = {}; 3172 3173 for (const i in paramNames) { 3174 const paramName = paramNames[i]; 3175 /** @type {HTMLElement} */ 3176 3177 const tag = templateContent.querySelector(paramName); 3178 3179 if (tag) { 3180 showWarningsForAttributes(tag, []); 3181 result[paramName.replace(/^swal-/, '')] = tag.innerHTML.trim(); 3182 } 3183 } 3184 3185 return result; 3186 }; 3187 /** 3188 * @param {DocumentFragment} templateContent 3189 */ 3190 3191 3192 const showWarningsForElements = templateContent => { 3193 const allowedElements = swalStringParams.concat(['swal-param', 'swal-button', 'swal-image', 'swal-icon', 'swal-input', 'swal-input-option']); 3194 toArray(templateContent.children).forEach(el => { 3195 const tagName = el.tagName.toLowerCase(); 3196 3197 if (allowedElements.indexOf(tagName) === -1) { 3198 warn("Unrecognized element <".concat(tagName, ">")); 3199 } 3200 }); 3201 }; 3202 /** 3203 * @param {HTMLElement} el 3204 * @param {string[]} allowedAttributes 3205 */ 3206 3207 3208 const showWarningsForAttributes = (el, allowedAttributes) => { 3209 toArray(el.attributes).forEach(attribute => { 3210 if (allowedAttributes.indexOf(attribute.name) === -1) { 3211 warn(["Unrecognized attribute \"".concat(attribute.name, "\" on <").concat(el.tagName.toLowerCase(), ">."), "".concat(allowedAttributes.length ? "Allowed attributes are: ".concat(allowedAttributes.join(', ')) : 'To set the value, use HTML within the element.')]); 3212 } 3213 }); 3214 }; 3215 3216 var defaultInputValidators = { 3217 email: (string, validationMessage) => { 3218 return /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid email address'); 3219 }, 3220 url: (string, validationMessage) => { 3221 // taken from https://stackoverflow.com/a/3809435 with a small change from #1306 and #2013 3222 return /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid URL'); 3223 } 3224 }; 3225 3226 function setDefaultInputValidators(params) { 3227 // Use default `inputValidator` for supported input types if not provided 3228 if (!params.inputValidator) { 3229 Object.keys(defaultInputValidators).forEach(key => { 3230 if (params.input === key) { 3231 params.inputValidator = defaultInputValidators[key]; 3232 } 3233 }); 3234 } 3235 } 3236 3237 function validateCustomTargetElement(params) { 3238 // Determine if the custom target element is valid 3239 if (!params.target || typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) { 3240 warn('Target parameter is not valid, defaulting to "body"'); 3241 params.target = 'body'; 3242 } 3243 } 3244 /** 3245 * Set type, text and actions on popup 3246 * 3247 * @param params 3248 */ 3249 3250 3251 function setParameters(params) { 3252 setDefaultInputValidators(params); // showLoaderOnConfirm && preConfirm 3253 3254 if (params.showLoaderOnConfirm && !params.preConfirm) { 3255 warn('showLoaderOnConfirm is set to true, but preConfirm is not defined.\n' + 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\n' + 'https://sweetalert2.github.io/#ajax-request'); 3256 } 3257 3258 validateCustomTargetElement(params); // Replace newlines with <br> in title 3259 3260 if (typeof params.title === 'string') { 3261 params.title = params.title.split('\n').join('<br />'); 3262 } 3263 3264 init(params); 3265 } 3266 3267 class Timer { 3268 constructor(callback, delay) { 3269 this.callback = callback; 3270 this.remaining = delay; 3271 this.running = false; 3272 this.start(); 3273 } 3274 3275 start() { 3276 if (!this.running) { 3277 this.running = true; 3278 this.started = new Date(); 3279 this.id = setTimeout(this.callback, this.remaining); 3280 } 3281 3282 return this.remaining; 3283 } 3284 3285 stop() { 3286 if (this.running) { 3287 this.running = false; 3288 clearTimeout(this.id); 3289 this.remaining -= new Date().getTime() - this.started.getTime(); 3290 } 3291 3292 return this.remaining; 3293 } 3294 3295 increase(n) { 3296 const running = this.running; 3297 3298 if (running) { 3299 this.stop(); 3300 } 3301 3302 this.remaining += n; 3303 3304 if (running) { 3305 this.start(); 3306 } 3307 3308 return this.remaining; 3309 } 3310 3311 getTimerLeft() { 3312 if (this.running) { 3313 this.stop(); 3314 this.start(); 3315 } 3316 3317 return this.remaining; 3318 } 3319 3320 isRunning() { 3321 return this.running; 3322 } 3323 3324 } 3325 3326 const fixScrollbar = () => { 3327 // for queues, do not do this more than once 3328 if (states.previousBodyPadding !== null) { 3329 return; 3330 } // if the body has overflow 3331 3332 3333 if (document.body.scrollHeight > window.innerHeight) { 3334 // add padding so the content doesn't shift after removal of scrollbar 3335 states.previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right')); 3336 document.body.style.paddingRight = "".concat(states.previousBodyPadding + measureScrollbar(), "px"); 3337 } 3338 }; 3339 const undoScrollbar = () => { 3340 if (states.previousBodyPadding !== null) { 3341 document.body.style.paddingRight = "".concat(states.previousBodyPadding, "px"); 3342 states.previousBodyPadding = null; 3343 } 3344 }; 3345 3346 /* istanbul ignore file */ 3347 3348 const iOSfix = () => { 3349 const iOS = // @ts-ignore 3350 /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1; 3351 3352 if (iOS && !hasClass(document.body, swalClasses.iosfix)) { 3353 const offset = document.body.scrollTop; 3354 document.body.style.top = "".concat(offset * -1, "px"); 3355 addClass(document.body, swalClasses.iosfix); 3356 lockBodyScroll(); 3357 addBottomPaddingForTallPopups(); 3358 } 3359 }; 3360 /** 3361 * https://github.com/sweetalert2/sweetalert2/issues/1948 3362 */ 3363 3364 const addBottomPaddingForTallPopups = () => { 3365 const ua = navigator.userAgent; 3366 const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i); 3367 const webkit = !!ua.match(/WebKit/i); 3368 const iOSSafari = iOS && webkit && !ua.match(/CriOS/i); 3369 3370 if (iOSSafari) { 3371 const bottomPanelHeight = 44; 3372 3373 if (getPopup().scrollHeight > window.innerHeight - bottomPanelHeight) { 3374 getContainer().style.paddingBottom = "".concat(bottomPanelHeight, "px"); 3375 } 3376 } 3377 }; 3378 /** 3379 * https://github.com/sweetalert2/sweetalert2/issues/1246 3380 */ 3381 3382 3383 const lockBodyScroll = () => { 3384 const container = getContainer(); 3385 let preventTouchMove; 3386 3387 container.ontouchstart = e => { 3388 preventTouchMove = shouldPreventTouchMove(e); 3389 }; 3390 3391 container.ontouchmove = e => { 3392 if (preventTouchMove) { 3393 e.preventDefault(); 3394 e.stopPropagation(); 3395 } 3396 }; 3397 }; 3398 3399 const shouldPreventTouchMove = event => { 3400 const target = event.target; 3401 const container = getContainer(); 3402 3403 if (isStylus(event) || isZoom(event)) { 3404 return false; 3405 } 3406 3407 if (target === container) { 3408 return true; 3409 } 3410 3411 if (!isScrollable(container) && target.tagName !== 'INPUT' && // #1603 3412 target.tagName !== 'TEXTAREA' && // #2266 3413 !(isScrollable(getHtmlContainer()) && // #1944 3414 getHtmlContainer().contains(target))) { 3415 return true; 3416 } 3417 3418 return false; 3419 }; 3420 /** 3421 * https://github.com/sweetalert2/sweetalert2/issues/1786 3422 * 3423 * @param {*} event 3424 * @returns {boolean} 3425 */ 3426 3427 3428 const isStylus = event => { 3429 return event.touches && event.touches.length && event.touches[0].touchType === 'stylus'; 3430 }; 3431 /** 3432 * https://github.com/sweetalert2/sweetalert2/issues/1891 3433 * 3434 * @param {TouchEvent} event 3435 * @returns {boolean} 3436 */ 3437 3438 3439 const isZoom = event => { 3440 return event.touches && event.touches.length > 1; 3441 }; 3442 3443 const undoIOSfix = () => { 3444 if (hasClass(document.body, swalClasses.iosfix)) { 3445 const offset = parseInt(document.body.style.top, 10); 3446 removeClass(document.body, swalClasses.iosfix); 3447 document.body.style.top = ''; 3448 document.body.scrollTop = offset * -1; 3449 } 3450 }; 3451 3452 const SHOW_CLASS_TIMEOUT = 10; 3453 /** 3454 * Open popup, add necessary classes and styles, fix scrollbar 3455 * 3456 * @param params 3457 */ 3458 3459 const openPopup = params => { 3460 const container = getContainer(); 3461 const popup = getPopup(); 3462 3463 if (typeof params.willOpen === 'function') { 3464 params.willOpen(popup); 3465 } 3466 3467 const bodyStyles = window.getComputedStyle(document.body); 3468 const initialBodyOverflow = bodyStyles.overflowY; 3469 addClasses$1(container, popup, params); // scrolling is 'hidden' until animation is done, after that 'auto' 3470 3471 setTimeout(() => { 3472 setScrollingVisibility(container, popup); 3473 }, SHOW_CLASS_TIMEOUT); 3474 3475 if (isModal()) { 3476 fixScrollContainer(container, params.scrollbarPadding, initialBodyOverflow); 3477 setAriaHidden(); 3478 } 3479 3480 if (!isToast() && !globalState.previousActiveElement) { 3481 globalState.previousActiveElement = document.activeElement; 3482 } 3483 3484 if (typeof params.didOpen === 'function') { 3485 setTimeout(() => params.didOpen(popup)); 3486 } 3487 3488 removeClass(container, swalClasses['no-transition']); 3489 }; 3490 3491 const swalOpenAnimationFinished = event => { 3492 const popup = getPopup(); 3493 3494 if (event.target !== popup) { 3495 return; 3496 } 3497 3498 const container = getContainer(); 3499 popup.removeEventListener(animationEndEvent, swalOpenAnimationFinished); 3500 container.style.overflowY = 'auto'; 3501 }; 3502 3503 const setScrollingVisibility = (container, popup) => { 3504 if (animationEndEvent && hasCssAnimation(popup)) { 3505 container.style.overflowY = 'hidden'; 3506 popup.addEventListener(animationEndEvent, swalOpenAnimationFinished); 3507 } else { 3508 container.style.overflowY = 'auto'; 3509 } 3510 }; 3511 3512 const fixScrollContainer = (container, scrollbarPadding, initialBodyOverflow) => { 3513 iOSfix(); 3514 3515 if (scrollbarPadding && initialBodyOverflow !== 'hidden') { 3516 fixScrollbar(); 3517 } // sweetalert2/issues/1247 3518 3519 3520 setTimeout(() => { 3521 container.scrollTop = 0; 3522 }); 3523 }; 3524 3525 const addClasses$1 = (container, popup, params) => { 3526 addClass(container, params.showClass.backdrop); // this workaround with opacity is needed for https://github.com/sweetalert2/sweetalert2/issues/2059 3527 3528 popup.style.setProperty('opacity', '0', 'important'); 3529 show(popup, 'grid'); 3530 setTimeout(() => { 3531 // Animate popup right after showing it 3532 addClass(popup, params.showClass.popup); // and remove the opacity workaround 3533 3534 popup.style.removeProperty('opacity'); 3535 }, SHOW_CLASS_TIMEOUT); // 10ms in order to fix #2062 3536 3537 addClass([document.documentElement, document.body], swalClasses.shown); 3538 3539 if (params.heightAuto && params.backdrop && !params.toast) { 3540 addClass([document.documentElement, document.body], swalClasses['height-auto']); 3541 } 3542 }; 3543 3544 /** 3545 * Shows loader (spinner), this is useful with AJAX requests. 3546 * By default the loader be shown instead of the "Confirm" button. 3547 */ 3548 3549 const showLoading = buttonToReplace => { 3550 let popup = getPopup(); 3551 3552 if (!popup) { 3553 new Swal(); // eslint-disable-line no-new 3554 } 3555 3556 popup = getPopup(); 3557 const loader = getLoader(); 3558 3559 if (isToast()) { 3560 hide(getIcon()); 3561 } else { 3562 replaceButton(popup, buttonToReplace); 3563 } 3564 3565 show(loader); 3566 popup.setAttribute('data-loading', true); 3567 popup.setAttribute('aria-busy', true); 3568 popup.focus(); 3569 }; 3570 3571 const replaceButton = (popup, buttonToReplace) => { 3572 const actions = getActions(); 3573 const loader = getLoader(); 3574 3575 if (!buttonToReplace && isVisible(getConfirmButton())) { 3576 buttonToReplace = getConfirmButton(); 3577 } 3578 3579 show(actions); 3580 3581 if (buttonToReplace) { 3582 hide(buttonToReplace); 3583 loader.setAttribute('data-button-to-replace', buttonToReplace.className); 3584 } 3585 3586 loader.parentNode.insertBefore(loader, buttonToReplace); 3587 addClass([popup, actions], swalClasses.loading); 3588 }; 3589 3590 const handleInputOptionsAndValue = (instance, params) => { 3591 if (params.input === 'select' || params.input === 'radio') { 3592 handleInputOptions(instance, params); 3593 } else if (['text', 'email', 'number', 'tel', 'textarea'].includes(params.input) && (hasToPromiseFn(params.inputValue) || isPromise(params.inputValue))) { 3594 showLoading(getConfirmButton()); 3595 handleInputValue(instance, params); 3596 } 3597 }; 3598 const getInputValue = (instance, innerParams) => { 3599 const input = instance.getInput(); 3600 3601 if (!input) { 3602 return null; 3603 } 3604 3605 switch (innerParams.input) { 3606 case 'checkbox': 3607 return getCheckboxValue(input); 3608 3609 case 'radio': 3610 return getRadioValue(input); 3611 3612 case 'file': 3613 return getFileValue(input); 3614 3615 default: 3616 return innerParams.inputAutoTrim ? input.value.trim() : input.value; 3617 } 3618 }; 3619 3620 const getCheckboxValue = input => input.checked ? 1 : 0; 3621 3622 const getRadioValue = input => input.checked ? input.value : null; 3623 3624 const getFileValue = input => input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null; 3625 3626 const handleInputOptions = (instance, params) => { 3627 const popup = getPopup(); 3628 3629 const processInputOptions = inputOptions => populateInputOptions[params.input](popup, formatInputOptions(inputOptions), params); 3630 3631 if (hasToPromiseFn(params.inputOptions) || isPromise(params.inputOptions)) { 3632 showLoading(getConfirmButton()); 3633 asPromise(params.inputOptions).then(inputOptions => { 3634 instance.hideLoading(); 3635 processInputOptions(inputOptions); 3636 }); 3637 } else if (typeof params.inputOptions === 'object') { 3638 processInputOptions(params.inputOptions); 3639 } else { 3640 error("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(typeof params.inputOptions)); 3641 } 3642 }; 3643 3644 const handleInputValue = (instance, params) => { 3645 const input = instance.getInput(); 3646 hide(input); 3647 asPromise(params.inputValue).then(inputValue => { 3648 input.value = params.input === 'number' ? parseFloat(inputValue) || 0 : "".concat(inputValue); 3649 show(input); 3650 input.focus(); 3651 instance.hideLoading(); 3652 }).catch(err => { 3653 error("Error in inputValue promise: ".concat(err)); 3654 input.value = ''; 3655 show(input); 3656 input.focus(); 3657 instance.hideLoading(); 3658 }); 3659 }; 3660 3661 const populateInputOptions = { 3662 select: (popup, inputOptions, params) => { 3663 const select = getDirectChildByClass(popup, swalClasses.select); 3664 3665 const renderOption = (parent, optionLabel, optionValue) => { 3666 const option = document.createElement('option'); 3667 option.value = optionValue; 3668 setInnerHtml(option, optionLabel); 3669 option.selected = isSelected(optionValue, params.inputValue); 3670 parent.appendChild(option); 3671 }; 3672 3673 inputOptions.forEach(inputOption => { 3674 const optionValue = inputOption[0]; 3675 const optionLabel = inputOption[1]; // <optgroup> spec: 3676 // https://www.w3.org/TR/html401/interact/forms.html#h-17.6 3677 // "...all OPTGROUP elements must be specified directly within a SELECT element (i.e., groups may not be nested)..." 3678 // check whether this is a <optgroup> 3679 3680 if (Array.isArray(optionLabel)) { 3681 // if it is an array, then it is an <optgroup> 3682 const optgroup = document.createElement('optgroup'); 3683 optgroup.label = optionValue; 3684 optgroup.disabled = false; // not configurable for now 3685 3686 select.appendChild(optgroup); 3687 optionLabel.forEach(o => renderOption(optgroup, o[1], o[0])); 3688 } else { 3689 // case of <option> 3690 renderOption(select, optionLabel, optionValue); 3691 } 3692 }); 3693 select.focus(); 3694 }, 3695 radio: (popup, inputOptions, params) => { 3696 const radio = getDirectChildByClass(popup, swalClasses.radio); 3697 inputOptions.forEach(inputOption => { 3698 const radioValue = inputOption[0]; 3699 const radioLabel = inputOption[1]; 3700 const radioInput = document.createElement('input'); 3701 const radioLabelElement = document.createElement('label'); 3702 radioInput.type = 'radio'; 3703 radioInput.name = swalClasses.radio; 3704 radioInput.value = radioValue; 3705 3706 if (isSelected(radioValue, params.inputValue)) { 3707 radioInput.checked = true; 3708 } 3709 3710 const label = document.createElement('span'); 3711 setInnerHtml(label, radioLabel); 3712 label.className = swalClasses.label; 3713 radioLabelElement.appendChild(radioInput); 3714 radioLabelElement.appendChild(label); 3715 radio.appendChild(radioLabelElement); 3716 }); 3717 const radios = radio.querySelectorAll('input'); 3718 3719 if (radios.length) { 3720 radios[0].focus(); 3721 } 3722 } 3723 }; 3724 /** 3725 * Converts `inputOptions` into an array of `[value, label]`s 3726 * @param inputOptions 3727 */ 3728 3729 const formatInputOptions = inputOptions => { 3730 const result = []; 3731 3732 if (typeof Map !== 'undefined' && inputOptions instanceof Map) { 3733 inputOptions.forEach((value, key) => { 3734 let valueFormatted = value; 3735 3736 if (typeof valueFormatted === 'object') { 3737 // case of <optgroup> 3738 valueFormatted = formatInputOptions(valueFormatted); 3739 } 3740 3741 result.push([key, valueFormatted]); 3742 }); 3743 } else { 3744 Object.keys(inputOptions).forEach(key => { 3745 let valueFormatted = inputOptions[key]; 3746 3747 if (typeof valueFormatted === 'object') { 3748 // case of <optgroup> 3749 valueFormatted = formatInputOptions(valueFormatted); 3750 } 3751 3752 result.push([key, valueFormatted]); 3753 }); 3754 } 3755 3756 return result; 3757 }; 3758 3759 const isSelected = (optionValue, inputValue) => { 3760 return inputValue && inputValue.toString() === optionValue.toString(); 3761 }; 3762 3763 /** 3764 * Hides loader and shows back the button which was hidden by .showLoading() 3765 */ 3766 3767 function hideLoading() { 3768 // do nothing if popup is closed 3769 const innerParams = privateProps.innerParams.get(this); 3770 3771 if (!innerParams) { 3772 return; 3773 } 3774 3775 const domCache = privateProps.domCache.get(this); 3776 hide(domCache.loader); 3777 3778 if (isToast()) { 3779 if (innerParams.icon) { 3780 show(getIcon()); 3781 } 3782 } else { 3783 showRelatedButton(domCache); 3784 } 3785 3786 removeClass([domCache.popup, domCache.actions], swalClasses.loading); 3787 domCache.popup.removeAttribute('aria-busy'); 3788 domCache.popup.removeAttribute('data-loading'); 3789 domCache.confirmButton.disabled = false; 3790 domCache.denyButton.disabled = false; 3791 domCache.cancelButton.disabled = false; 3792 } 3793 3794 const showRelatedButton = domCache => { 3795 const buttonToReplace = domCache.popup.getElementsByClassName(domCache.loader.getAttribute('data-button-to-replace')); 3796 3797 if (buttonToReplace.length) { 3798 show(buttonToReplace[0], 'inline-block'); 3799 } else if (allButtonsAreHidden()) { 3800 hide(domCache.actions); 3801 } 3802 }; 3803 3804 /** 3805 * Gets the input DOM node, this method works with input parameter. 3806 * @returns {HTMLElement | null} 3807 */ 3808 3809 function getInput$1(instance) { 3810 const innerParams = privateProps.innerParams.get(instance || this); 3811 const domCache = privateProps.domCache.get(instance || this); 3812 3813 if (!domCache) { 3814 return null; 3815 } 3816 3817 return getInput(domCache.popup, innerParams.input); 3818 } 3819 3820 /** 3821 * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has. 3822 * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` 3823 * This is the approach that Babel will probably take to implement private methods/fields 3824 * https://github.com/tc39/proposal-private-methods 3825 * https://github.com/babel/babel/pull/7555 3826 * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* 3827 * then we can use that language feature. 3828 */ 3829 var privateMethods = { 3830 swalPromiseResolve: new WeakMap(), 3831 swalPromiseReject: new WeakMap() 3832 }; 3833 3834 /* 3835 *
3835Global function to determine if SweetAlert2 popup is shown 3836 */ 3837 3838 const isVisible$1 = () => { 3839 return isVisible(getPopup()); 3840 }; 3841 /* 3842 * Global function to click 'Confirm' button 3843 */ 3844 3845 const clickConfirm = () => getConfirmButton() && getConfirmButton().click(); 3846 /* 3847 * Global function to click 'Deny' button 3848 */ 3849 3850 const clickDeny = () => getDenyButton() && getDenyButton().click(); 3851 /* 3852 * Global function to click 'Cancel' button 3853 */ 3854 3855 const clickCancel = () => getCancelButton() && getCancelButton().click(); 3856 3857 const removeKeydownHandler = globalState => { 3858 if (globalState.keydownTarget && globalState.keydownHandlerAdded) { 3859 globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, { 3860 capture: globalState.keydownListenerCapture 3861 }); 3862 globalState.keydownHandlerAdded = false; 3863 } 3864 }; 3865 const addKeydownHandler = (instance, globalState, innerParams, dismissWith) => { 3866 removeKeydownHandler(globalState);
vendor: 4,281 bytes, lines 3866-4011
3866 3867 3868 if (!innerParams.toast) { 3869 globalState.keydownHandler = e => keydownHandler(instance, e, dismissWith); 3870 3871 globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup(); 3872 globalState.keydownListenerCapture = innerParams.keydownListenerCapture; 3873 globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, { 3874 capture: globalState.keydownListenerCapture 3875 }); 3876 globalState.keydownHandlerAdded = true; 3877 } 3878 }; // Focus handling 3879 3880 const setFocus = (innerParams, index, increment) => { 3881 const focusableElements = getFocusableElements(); // search for visible elements and select the next possible match 3882 3883 if (focusableElements.length) { 3884 index = index + increment; // rollover to first item 3885 3886 if (index === focusableElements.length) { 3887 index = 0; // go to last item 3888 } else if (index === -1) { 3889 index = focusableElements.length - 1; 3890 } 3891 3892 return focusableElements[index].focus(); 3893 } // no visible focusable elements, focus the popup 3894 3895 3896 getPopup().focus(); 3897 }; 3898 const arrowKeysNextButton = ['ArrowRight', 'ArrowDown']; 3899 const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp']; 3900 3901 const keydownHandler = (instance, e, dismissWith) => { 3902 const innerParams = privateProps.innerParams.get(instance); 3903 3904 if (!innerParams) { 3905 return; // This instance has already been destroyed 3906 } // Ignore keydown during IME composition 3907 // https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event#ignoring_keydown_during_ime_composition 3908 // https://github.com/sweetalert2/sweetalert2/issues/720 3909 // https://github.com/sweetalert2/sweetalert2/issues/2406 3910 3911 3912 if (e.isComposing || e.keyCode === 229) { 3913 return; 3914 } 3915 3916 if (innerParams.stopKeydownPropagation) { 3917 e.stopPropagation(); 3918 } // ENTER 3919 3920 3921 if (e.key === 'Enter') { 3922 handleEnter(instance, e, innerParams); 3923 } // TAB 3924 else if (e.key === 'Tab') { 3925 handleTab(e, innerParams); 3926 } // ARROWS - switch focus between buttons 3927 else if ([...arrowKeysNextButton, ...arrowKeysPreviousButton].includes(e.key)) { 3928 handleArrows(e.key); 3929 } // ESC 3930 else if (e.key === 'Escape') { 3931 handleEsc(e, innerParams, dismissWith); 3932 } 3933 }; 3934 3935 const handleEnter = (instance, e, innerParams) => { 3936 // https://github.com/sweetalert2/sweetalert2/issues/2386 3937 if (!callIfFunction(innerParams.allowEnterKey)) { 3938 return; 3939 } 3940 3941 if (e.target && instance.getInput() && e.target.outerHTML === instance.getInput().outerHTML) { 3942 if (['textarea', 'file'].includes(innerParams.input)) { 3943 return; // do not submit 3944 } 3945 3946 clickConfirm(); 3947 e.preventDefault(); 3948 } 3949 }; 3950 3951 const handleTab = (e, innerParams) => { 3952 const targetElement = e.target; 3953 const focusableElements = getFocusableElements(); 3954 let btnIndex = -1; 3955 3956 for (let i = 0; i < focusableElements.length; i++) { 3957 if (targetElement === focusableElements[i]) { 3958 btnIndex = i; 3959 break; 3960 } 3961 } // Cycle to the next button 3962 3963 3964 if (!e.shiftKey) { 3965 setFocus(innerParams, btnIndex, 1); 3966 } // Cycle to the prev button 3967 else { 3968 setFocus(innerParams, btnIndex, -1); 3969 } 3970 3971 e.stopPropagation(); 3972 e.preventDefault(); 3973 }; 3974 3975 const handleArrows = key => { 3976 const confirmButton = getConfirmButton(); 3977 const denyButton = getDenyButton(); 3978 const cancelButton = getCancelButton(); 3979 3980 if (![confirmButton, denyButton, cancelButton].includes(document.activeElement)) { 3981 return; 3982 } 3983 3984 const sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling'; 3985 let buttonToFocus = document.activeElement; 3986 3987 for (let i = 0; i < getActions().children.length; i++) { 3988 buttonToFocus = buttonToFocus[sibling]; 3989 3990 if (!buttonToFocus) { 3991 return; 3992 } 3993 3994 if (isVisible(buttonToFocus) && buttonToFocus instanceof HTMLButtonElement) { 3995 break; 3996 } 3997 } 3998 3999 if (buttonToFocus instanceof HTMLButtonElement) { 4000 buttonToFocus.focus(); 4001 } 4002 }; 4003 4004 const handleEsc = (e, innerParams, dismissWith) => { 4005 if (callIfFunction(innerParams.allowEscapeKey)) { 4006 e.preventDefault(); 4007 dismissWith(DismissReason.esc); 4008 } 4009 }; 4010 4011
vendor: 15,883 bytes, lines 4011-4508
4011/* 4012 * Instance method to close sweetAlert 4013 */ 4014 4015 function removePopupAndResetState(instance, container, returnFocus, didClose) { 4016 if (isToast()) { 4017 triggerDidCloseAndDispose(instance, didClose); 4018 } else { 4019 restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose)); 4020 removeKeydownHandler(globalState); 4021 } 4022 4023 const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // workaround for #2088 4024 // for some reason removing the container in Safari will scroll the document to bottom 4025 4026 if (isSafari) { 4027 container.setAttribute('style', 'display:none !important'); 4028 container.removeAttribute('class'); 4029 container.innerHTML = ''; 4030 } else { 4031 container.remove(); 4032 } 4033 4034 if (isModal()) { 4035 undoScrollbar(); 4036 undoIOSfix(); 4037 unsetAriaHidden(); 4038 } 4039 4040 removeBodyClasses(); 4041 } 4042 4043 function removeBodyClasses() { 4044 removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown']]); 4045 } 4046 4047 function close(resolveValue) { 4048 resolveValue = prepareResolveValue(resolveValue); 4049 const swalPromiseResolve = privateMethods.swalPromiseResolve.get(this); 4050 const didClose = triggerClosePopup(this); 4051 4052 if (this.isAwaitingPromise()) { 4053 // A swal awaiting for a promise (after a click on Confirm or Deny) cannot be dismissed anymore #2335 4054 if (!resolveValue.isDismissed) { 4055 handleAwaitingPromise(this); 4056 swalPromiseResolve(resolveValue); 4057 } 4058 } else if (didClose) { 4059 // Resolve Swal promise 4060 swalPromiseResolve(resolveValue); 4061 } 4062 } 4063 function isAwaitingPromise() { 4064 return !!privateProps.awaitingPromise.get(this); 4065 } 4066 4067 const triggerClosePopup = instance => { 4068 const popup = getPopup(); 4069 4070 if (!popup) { 4071 return false; 4072 } 4073 4074 const innerParams = privateProps.innerParams.get(instance); 4075 4076 if (!innerParams || hasClass(popup, innerParams.hideClass.popup)) { 4077 return false; 4078 } 4079 4080 removeClass(popup, innerParams.showClass.popup); 4081 addClass(popup, innerParams.hideClass.popup); 4082 const backdrop = getContainer(); 4083 removeClass(backdrop, innerParams.showClass.backdrop); 4084 addClass(backdrop, innerParams.hideClass.backdrop); 4085 handlePopupAnimation(instance, popup, innerParams); 4086 return true; 4087 }; 4088 4089 function rejectPromise(error) { 4090 const rejectPromise = privateMethods.swalPromiseReject.get(this); 4091 handleAwaitingPromise(this); 4092 4093 if (rejectPromise) { 4094 // Reject Swal promise 4095 rejectPromise(error); 4096 } 4097 } 4098 const handleAwaitingPromise = instance => { 4099 if (instance.isAwaitingPromise()) { 4100 privateProps.awaitingPromise.delete(instance); // The instance might have been previously partly destroyed, we must resume the destroy process in this case #2335 4101 4102 if (!privateProps.innerParams.get(instance)) { 4103 instance._destroy(); 4104 } 4105 } 4106 }; 4107 4108 const prepareResolveValue = resolveValue => { 4109 // When user calls Swal.close() 4110 if (typeof resolveValue === 'undefined') { 4111 return { 4112 isConfirmed: false, 4113 isDenied: false, 4114 isDismissed: true 4115 }; 4116 } 4117 4118 return Object.assign({ 4119 isConfirmed: false, 4120 isDenied: false, 4121 isDismissed: false 4122 }, resolveValue); 4123 }; 4124 4125 const handlePopupAnimation = (instance, popup, innerParams) => { 4126 const container = getContainer(); // If animation is supported, animate 4127 4128 const animationIsSupported = animationEndEvent && hasCssAnimation(popup); 4129 4130 if (typeof innerParams.willClose === 'function') { 4131 innerParams.willClose(popup); 4132 } 4133 4134 if (animationIsSupported) { 4135 animatePopup(instance, popup, container, innerParams.returnFocus, innerParams.didClose); 4136 } else { 4137 // Otherwise, remove immediately 4138 removePopupAndResetState(instance, container, innerParams.returnFocus, innerParams.didClose); 4139 } 4140 }; 4141 4142 const animatePopup = (instance, popup, container, returnFocus, didClose) => { 4143 globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, returnFocus, didClose); 4144 popup.addEventListener(animationEndEvent, function (e) { 4145 if (e.target === popup) { 4146 globalState.swalCloseEventFinishedCallback(); 4147 delete globalState.swalCloseEventFinishedCallback; 4148 } 4149 }); 4150 }; 4151 4152 const triggerDidCloseAndDispose = (instance, didClose) => { 4153 setTimeout(() => { 4154 if (typeof didClose === 'function') { 4155 didClose.bind(instance.params)(); 4156 } 4157 4158 instance._destroy(); 4159 }); 4160 }; 4161 4162 function setButtonsDisabled(instance, buttons, disabled) { 4163 const domCache = privateProps.domCache.get(instance); 4164 buttons.forEach(button => { 4165 domCache[button].disabled = disabled; 4166 }); 4167 } 4168 4169 function setInputDisabled(input, disabled) { 4170 if (!input) { 4171 return false; 4172 } 4173 4174 if (input.type === 'radio') { 4175 const radiosContainer = input.parentNode.parentNode; 4176 const radios = radiosContainer.querySelectorAll('input'); 4177 4178 for (let i = 0; i < radios.length; i++) { 4179 radios[i].disabled = disabled; 4180 } 4181 } else { 4182 input.disabled = disabled; 4183 } 4184 } 4185 4186 function enableButtons() { 4187 setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], false); 4188 } 4189 function disableButtons() { 4190 setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], true); 4191 } 4192 function enableInput() { 4193 return setInputDisabled(this.getInput(), false); 4194 } 4195 function disableInput() { 4196 return setInputDisabled(this.getInput(), true); 4197 } 4198 4199 function showValidationMessage(error) { 4200 const domCache = privateProps.domCache.get(this); 4201 const params = privateProps.innerParams.get(this); 4202 setInnerHtml(domCache.validationMessage, error); 4203 domCache.validationMessage.className = swalClasses['validation-message']; 4204 4205 if (params.customClass && params.customClass.validationMessage) { 4206 addClass(domCache.validationMessage, params.customClass.validationMessage); 4207 } 4208 4209 show(domCache.validationMessage); 4210 const input = this.getInput(); 4211 4212 if (input) { 4213 input.setAttribute('aria-invalid', true); 4214 input.setAttribute('aria-describedby', swalClasses['validation-message']); 4215 focusInput(input); 4216 addClass(input, swalClasses.inputerror); 4217 } 4218 } // Hide block with validation message 4219 4220 function resetValidationMessage$1() { 4221 const domCache = privateProps.domCache.get(this); 4222 4223 if (domCache.validationMessage) { 4224 hide(domCache.validationMessage); 4225 } 4226 4227 const input = this.getInput(); 4228 4229 if (input) { 4230 input.removeAttribute('aria-invalid'); 4231 input.removeAttribute('aria-describedby'); 4232 removeClass(input, swalClasses.inputerror); 4233 } 4234 } 4235 4236 function getProgressSteps$1() { 4237 const domCache = privateProps.domCache.get(this); 4238 return domCache.progressSteps; 4239 } 4240 4241 /** 4242 * Updates popup parameters. 4243 */ 4244 4245 function update(params) { 4246 const popup = getPopup(); 4247 const innerParams = privateProps.innerParams.get(this); 4248 4249 if (!popup || hasClass(popup, innerParams.hideClass.popup)) { 4250 return warn("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup."); 4251 } 4252 4253 const validUpdatableParams = filterValidParams(params); 4254 const updatedParams = Object.assign({}, innerParams, validUpdatableParams); 4255 render(this, updatedParams); 4256 privateProps.innerParams.set(this, updatedParams); 4257 Object.defineProperties(this, { 4258 params: { 4259 value: Object.assign({}, this.params, params), 4260 writable: false, 4261 enumerable: true 4262 } 4263 }); 4264 } 4265 4266 const filterValidParams = params => { 4267 const validUpdatableParams = {}; 4268 Object.keys(params).forEach(param => { 4269 if (isUpdatableParameter(param)) { 4270 validUpdatableParams[param] = params[param]; 4271 } else { 4272 warn("Invalid parameter to update: ".concat(param)); 4273 } 4274 }); 4275 return validUpdatableParams; 4276 }; 4277 4278 function _destroy() { 4279 const domCache = privateProps.domCache.get(this); 4280 const innerParams = privateProps.innerParams.get(this); 4281 4282 if (!innerParams) { 4283 disposeWeakMaps(this); // The WeakMaps might have been partly destroyed, we must recall it to dispose any remaining WeakMaps #2335 4284 4285 return; // This instance has already been destroyed 4286 } // Check if there is another Swal closing 4287 4288 4289 if (domCache.popup && globalState.swalCloseEventFinishedCallback) { 4290 globalState.swalCloseEventFinishedCallback(); 4291 delete globalState.swalCloseEventFinishedCallback; 4292 } // Check if there is a swal disposal defer timer 4293 4294 4295 if (globalState.deferDisposalTimer) { 4296 clearTimeout(globalState.deferDisposalTimer); 4297 delete globalState.deferDisposalTimer; 4298 } 4299 4300 if (typeof innerParams.didDestroy === 'function') { 4301 innerParams.didDestroy(); 4302 } 4303 4304 disposeSwal(this); 4305 } 4306 4307 const disposeSwal = instance => { 4308 disposeWeakMaps(instance); // Unset this.params so GC will dispose it (#1569) 4309 4310 delete instance.params; // Unset globalState props so GC will dispose globalState (#1569) 4311 4312 delete globalState.keydownHandler; 4313 delete globalState.keydownTarget; // Unset currentInstance 4314 4315 delete globalState.currentInstance; 4316 }; 4317 4318 const disposeWeakMaps = instance => { 4319 // If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retrieved #2335 4320 if (instance.isAwaitingPromise()) { 4321 unsetWeakMaps(privateProps, instance); 4322 privateProps.awaitingPromise.set(instance, true); 4323 } else { 4324 unsetWeakMaps(privateMethods, instance); 4325 unsetWeakMaps(privateProps, instance); 4326 } 4327 }; 4328 4329 const unsetWeakMaps = (obj, instance) => { 4330 for (const i in obj) { 4331 obj[i].delete(instance); 4332 } 4333 }; 4334 4335 4336 4337 var instanceMethods = /*#__PURE__*/Object.freeze({ 4338 hideLoading: hideLoading, 4339 disableLoading: hideLoading, 4340 getInput: getInput$1, 4341 close: close, 4342 isAwaitingPromise: isAwaitingPromise, 4343 rejectPromise: rejectPromise, 4344 handleAwaitingPromise: handleAwaitingPromise, 4345 closePopup: close, 4346 closeModal: close, 4347 closeToast: close, 4348 enableButtons: enableButtons, 4349 disableButtons: disableButtons, 4350 enableInput: enableInput, 4351 disableInput: disableInput, 4352 showValidationMessage: showValidationMessage, 4353 resetValidationMessage: resetValidationMessage$1, 4354 getProgressSteps: getProgressSteps$1, 4355 update: update, 4356 _destroy: _destroy 4357 }); 4358 4359 const handleConfirmButtonClick = instance => { 4360 const innerParams = privateProps.innerParams.get(instance); 4361 instance.disableButtons(); 4362 4363 if (innerParams.input) { 4364 handleConfirmOrDenyWithInput(instance, 'confirm'); 4365 } else { 4366 confirm(instance, true); 4367 } 4368 }; 4369 const handleDenyButtonClick = instance => { 4370 const innerParams = privateProps.innerParams.get(instance); 4371 instance.disableButtons(); 4372 4373 if (innerParams.returnInputValueOnDeny) { 4374 handleConfirmOrDenyWithInput(instance, 'deny'); 4375 } else { 4376 deny(instance, false); 4377 } 4378 }; 4379 const handleCancelButtonClick = (instance, dismissWith) => { 4380 instance.disableButtons(); 4381 dismissWith(DismissReason.cancel); 4382 }; 4383 4384 const handleConfirmOrDenyWithInput = (instance, type 4385 /* 'confirm' | 'deny' */ 4386 ) => { 4387 const innerParams = privateProps.innerParams.get(instance); 4388 4389 if (!innerParams.input) { 4390 return error("The \"input\" parameter is needed to be set when using returnInputValueOn".concat(capitalizeFirstLetter(type))); 4391 } 4392 4393 const inputValue = getInputValue(instance, innerParams); 4394 4395 if (innerParams.inputValidator) { 4396 handleInputValidator(instance, inputValue, type); 4397 } else if (!instance.getInput().checkValidity()) { 4398 instance.enableButtons(); 4399 instance.showValidationMessage(innerParams.validationMessage); 4400 } else if (type === 'deny') { 4401 deny(instance, inputValue); 4402 } else { 4403 confirm(instance, inputValue); 4404 } 4405 }; 4406 4407 const handleInputValidator = (instance, inputValue, type 4408 /* 'confirm' | 'deny' */ 4409 ) => { 4410 const innerParams = privateProps.innerParams.get(instance); 4411 instance.disableInput(); 4412 const validationPromise = Promise.resolve().then(() => asPromise(innerParams.inputValidator(inputValue, innerParams.validationMessage))); 4413 validationPromise.then(validationMessage => { 4414 instance.enableButtons(); 4415 instance.enableInput(); 4416 4417 if (validationMessage) { 4418 instance.showValidationMessage(validationMessage); 4419 } else if (type === 'deny') { 4420 deny(instance, inputValue); 4421 } else { 4422 confirm(instance, inputValue); 4423 } 4424 }); 4425 }; 4426 4427 const deny = (instance, value) => { 4428 const innerParams = privateProps.innerParams.get(instance || undefined); 4429 4430 if (innerParams.showLoaderOnDeny) { 4431 showLoading(getDenyButton()); 4432 } 4433 4434 if (innerParams.preDeny) { 4435 privateProps.awaitingPromise.set(instance || undefined, true); // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preDeny's promise is received 4436 4437 const preDenyPromise = Promise.resolve().then(() => asPromise(innerParams.preDeny(value, innerParams.validationMessage))); 4438 preDenyPromise.then(preDenyValue => { 4439 if (preDenyValue === false) { 4440 instance.hideLoading(); 4441 handleAwaitingPromise(instance); 4442 } else { 4443 instance.closePopup({ 4444 isDenied: true, 4445 value: typeof preDenyValue === 'undefined' ? value : preDenyValue 4446 }); 4447 } 4448 }).catch(error$$1 => rejectWith(instance || undefined, error$$1)); 4449 } else { 4450 instance.closePopup({ 4451 isDenied: true, 4452 value 4453 }); 4454 } 4455 }; 4456 4457 const succeedWith = (instance, value) => { 4458 instance.closePopup({ 4459 isConfirmed: true, 4460 value 4461 }); 4462 }; 4463 4464 const rejectWith = (instance, error$$1) => { 4465 instance.rejectPromise(error$$1); 4466 }; 4467 4468 const confirm = (instance, value) => { 4469 const innerParams = privateProps.innerParams.get(instance || undefined); 4470 4471 if (innerParams.showLoaderOnConfirm) { 4472 showLoading(); 4473 } 4474 4475 if (innerParams.preConfirm) { 4476 instance.resetValidationMessage(); 4477 privateProps.awaitingPromise.set(instance || undefined, true); // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preConfirm's promise is received 4478 4479 const preConfirmPromise = Promise.resolve().then(() => asPromise(innerParams.preConfirm(value, innerParams.validationMessage))); 4480 preConfirmPromise.then(preConfirmValue => { 4481 if (isVisible(getValidationMessage()) || preConfirmValue === false) { 4482 instance.hideLoading(); 4483 handleAwaitingPromise(instance); 4484 } else { 4485 succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue); 4486 } 4487 }).catch(error$$1 => rejectWith(instance || undefined, error$$1)); 4488 } else { 4489 succeedWith(instance, value); 4490 } 4491 }; 4492 4493 const handlePopupClick = (instance, domCache, dismissWith) => { 4494 const innerParams = privateProps.innerParams.get(instance); 4495 4496 if (innerParams.toast) { 4497 handleToastClick(instance, domCache, dismissWith); 4498 } else { 4499 // Ignore click events that had mousedown on the popup but mouseup on the container 4500 // This can happen when the user drags a slider 4501 handleModalMousedown(domCache); // Ignore click events that had mousedown on the container but mouseup on the popup 4502 4503 handleContainerMousedown(domCache); 4504 handleModalClick(instance, domCache, dismissWith); 4505 } 4506 }; 4507 4508 const handleToastClick = (instance, domCache, dismissWith) => {
vendor: 1,885 bytes, lines 4509-4569
4509 // Closing toast by internal click 4510 domCache.popup.onclick = () => { 4511 const innerParams = privateProps.innerParams.get(instance); 4512 4513 if (innerParams && (isAnyButtonShown(innerParams) || innerParams.timer || innerParams.input)) { 4514 return; 4515 } 4516 4517 dismissWith(DismissReason.close); 4518 }; 4519 }; 4520 /** 4521 * @param {*} innerParams 4522 * @returns {boolean} 4523 */ 4524 4525 4526 const isAnyButtonShown = innerParams => { 4527 return innerParams.showConfirmButton || innerParams.showDenyButton || innerParams.showCancelButton || innerParams.showCloseButton; 4528 }; 4529 4530 let ignoreOutsideClick = false; 4531 4532 const handleModalMousedown = domCache => { 4533 domCache.popup.onmousedown = () => { 4534 domCache.container.onmouseup = function (e) { 4535 domCache.container.onmouseup = undefined; // We only check if the mouseup target is the container because usually it doesn't 4536 // have any other direct children aside of the popup 4537 4538 if (e.target === domCache.container) { 4539 ignoreOutsideClick = true; 4540 } 4541 }; 4542 }; 4543 }; 4544 4545 const handleContainerMousedown = domCache => { 4546 domCache.container.onmousedown = () => { 4547 domCache.popup.onmouseup = function (e) { 4548 domCache.popup.onmouseup = undefined; // We also need to check if the mouseup target is a child of the popup 4549 4550 if (e.target === domCache.popup || domCache.popup.contains(e.target)) { 4551 ignoreOutsideClick = true; 4552 } 4553 }; 4554 }; 4555 }; 4556 4557 const handleModalClick = (instance, domCache, dismissWith) => { 4558 domCache.container.onclick = e => { 4559 const innerParams = privateProps.innerParams.get(instance); 4560 4561 if (ignoreOutsideClick) { 4562 ignoreOutsideClick = false; 4563 return; 4564 } 4565 4566 if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) { 4567 dismissWith(DismissReason.backdrop); 4568 } 4569 };
vendor: 12,223 bytes, lines 4569-4974
4569 4570 }; 4571 4572 const isJqueryElement = elem => typeof elem === 'object' && elem.jquery; 4573 4574 const isElement = elem => elem instanceof Element || isJqueryElement(elem); 4575 4576 const argsToParams = args => { 4577 const params = {}; 4578 4579 if (typeof args[0] === 'object' && !isElement(args[0])) { 4580 Object.assign(params, args[0]); 4581 } else { 4582 ['title', 'html', 'icon'].forEach((name, index) => { 4583 const arg = args[index]; 4584 4585 if (typeof arg === 'string' || isElement(arg)) { 4586 params[name] = arg; 4587 } else if (arg !== undefined) { 4588 error("Unexpected type of ".concat(name, "! Expected \"string\" or \"Element\", got ").concat(typeof arg)); 4589 } 4590 }); 4591 } 4592 4593 return params; 4594 }; 4595 4596 function fire() { 4597 const Swal = this; // eslint-disable-line @typescript-eslint/no-this-alias 4598 4599 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 4600 args[_key] = arguments[_key]; 4601 } 4602 4603 return new Swal(...args); 4604 } 4605 4606 /** 4607 * Returns an extended version of `Swal` containing `params` as defaults. 4608 * Useful for reusing Swal configuration. 4609 * 4610 * For example: 4611 * 4612 * Before: 4613 * const textPromptOptions = { input: 'text', showCancelButton: true } 4614 * const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' }) 4615 * const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' }) 4616 * 4617 * After: 4618 * const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true }) 4619 * const {value: firstName} = await TextPrompt('What is your first name?') 4620 * const {value: lastName} = await TextPrompt('What is your last name?') 4621 * 4622 * @param mixinParams 4623 */ 4624 function mixin(mixinParams) { 4625 class MixinSwal extends this { 4626 _main(params, priorityMixinParams) { 4627 return super._main(params, Object.assign({}, mixinParams, priorityMixinParams)); 4628 } 4629 4630 } 4631 4632 return MixinSwal; 4633 } 4634 4635 /** 4636 * If `timer` parameter is set, returns number of milliseconds of timer remained. 4637 * Otherwise, returns undefined. 4638 */ 4639 4640 const getTimerLeft = () => { 4641 return globalState.timeout && globalState.timeout.getTimerLeft(); 4642 }; 4643 /** 4644 * Stop timer. Returns number of milliseconds of timer remained. 4645 * If `timer` parameter isn't set, returns undefined. 4646 */ 4647 4648 const stopTimer = () => { 4649 if (globalState.timeout) { 4650 stopTimerProgressBar(); 4651 return globalState.timeout.stop(); 4652 } 4653 }; 4654 /** 4655 * Resume timer. Returns number of milliseconds of timer remained. 4656 * If `timer` parameter isn't set, returns undefined. 4657 */ 4658 4659 const resumeTimer = () => { 4660 if (globalState.timeout) { 4661 const remaining = globalState.timeout.start(); 4662 animateTimerProgressBar(remaining); 4663 return remaining; 4664 } 4665 }; 4666 /** 4667 * Resume timer. Returns number of milliseconds of timer remained. 4668 * If `timer` parameter isn't set, returns undefined. 4669 */ 4670 4671 const toggleTimer = () => { 4672 const timer = globalState.timeout; 4673 return timer && (timer.running ? stopTimer() : resumeTimer()); 4674 }; 4675 /** 4676 * Increase timer. Returns number of milliseconds of an updated timer. 4677 * If `timer` parameter isn't set, returns undefined. 4678 */ 4679 4680 const increaseTimer = n => { 4681 if (globalState.timeout) { 4682 const remaining = globalState.timeout.increase(n); 4683 animateTimerProgressBar(remaining, true); 4684 return remaining; 4685 } 4686 }; 4687 /** 4688 * Check if timer is running. Returns true if timer is running 4689 * or false if timer is paused or stopped. 4690 * If `timer` parameter isn't set, returns undefined 4691 */ 4692 4693 const isTimerRunning = () => { 4694 return globalState.timeout && globalState.timeout.isRunning(); 4695 }; 4696 4697 let bodyClickListenerAdded = false; 4698 const clickHandlers = {}; 4699 function bindClickHandler() { 4700 let attr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'data-swal-template'; 4701 clickHandlers[attr] = this; 4702 4703 if (!bodyClickListenerAdded) { 4704 document.body.addEventListener('click', bodyClickListener); 4705 bodyClickListenerAdded = true; 4706 } 4707 } 4708 4709 const bodyClickListener = event => { 4710 for (let el = event.target; el && el !== document; el = el.parentNode) { 4711 for (const attr in clickHandlers) { 4712 const template = el.getAttribute(attr); 4713 4714 if (template) { 4715 clickHandlers[attr].fire({ 4716 template 4717 }); 4718 return; 4719 } 4720 } 4721 } 4722 }; 4723 4724 4725 4726 var staticMethods = /*#__PURE__*/Object.freeze({ 4727 isValidParameter: isValidParameter, 4728 isUpdatableParameter: isUpdatableParameter, 4729 isDeprecatedParameter: isDeprecatedParameter, 4730 argsToParams: argsToParams, 4731 isVisible: isVisible$1, 4732 clickConfirm: clickConfirm, 4733 clickDeny: clickDeny, 4734 clickCancel: clickCancel, 4735 getContainer: getContainer, 4736 getPopup: getPopup, 4737 getTitle: getTitle, 4738 getHtmlContainer: getHtmlContainer, 4739 getImage: getImage, 4740 getIcon: getIcon, 4741 getInputLabel: getInputLabel, 4742 getCloseButton: getCloseButton, 4743 getActions: getActions, 4744 getConfirmButton: getConfirmButton, 4745 getDenyButton: getDenyButton, 4746 getCancelButton: getCancelButton, 4747 getLoader: getLoader, 4748 getFooter: getFooter, 4749 getTimerProgressBar: getTimerProgressBar, 4750 getFocusableElements: getFocusableElements, 4751 getValidationMessage: getValidationMessage, 4752 isLoading: isLoading, 4753 fire: fire, 4754 mixin: mixin, 4755 showLoading: showLoading, 4756 enableLoading: showLoading, 4757 getTimerLeft: getTimerLeft, 4758 stopTimer: stopTimer, 4759 resumeTimer: resumeTimer, 4760 toggleTimer: toggleTimer, 4761 increaseTimer: increaseTimer, 4762 isTimerRunning: isTimerRunning, 4763 bindClickHandler: bindClickHandler 4764 }); 4765 4766 let currentInstance; 4767 4768 class SweetAlert { 4769 constructor() { 4770 // Prevent run in Node env 4771 if (typeof window === 'undefined') { 4772 return; 4773 } 4774 4775 currentInstance = this; // @ts-ignore 4776 4777 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 4778 args[_key] = arguments[_key]; 4779 } 4780 4781 const outerParams = Object.freeze(this.constructor.argsToParams(args)); 4782 Object.defineProperties(this, { 4783 params: { 4784 value: outerParams, 4785 writable: false, 4786 enumerable: true, 4787 configurable: true 4788 } 4789 }); // @ts-ignore 4790 4791 const promise = this._main(this.params); 4792 4793 privateProps.promise.set(this, promise); 4794 } 4795 4796 _main(userParams) { 4797 let mixinParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 4798 showWarningsForParams(Object.assign({}, mixinParams, userParams)); 4799 4800 if (globalState.currentInstance) { 4801 globalState.currentInstance._destroy(); 4802 4803 if (isModal()) { 4804 unsetAriaHidden(); 4805 } 4806 } 4807 4808 globalState.currentInstance = this; 4809 const innerParams = prepareParams(userParams, mixinParams); 4810 setParameters(innerParams); 4811 Object.freeze(innerParams); // clear the previous timer 4812 4813 if (globalState.timeout) { 4814 globalState.timeout.stop(); 4815 delete globalState.timeout; 4816 } // clear the restore focus timeout 4817 4818 4819 clearTimeout(globalState.restoreFocusTimeout); 4820 const domCache = populateDomCache(this); 4821 render(this, innerParams); 4822 privateProps.innerParams.set(this, innerParams); 4823 return swalPromise(this, domCache, innerParams); 4824 } // `catch` cannot be the name of a module export, so we define our thenable methods here instead 4825 4826 4827 then(onFulfilled) { 4828 const promise = privateProps.promise.get(this); 4829 return promise.then(onFulfilled); 4830 } 4831 4832 finally(onFinally) { 4833 const promise = privateProps.promise.get(this); 4834 return promise.finally(onFinally); 4835 } 4836 4837 } 4838 4839 const swalPromise = (instance, domCache, innerParams) => { 4840 return new Promise((resolve, reject) => { 4841 // functions to handle all closings/dismissals 4842 const dismissWith = dismiss => { 4843 instance.closePopup({ 4844 isDismissed: true, 4845 dismiss 4846 }); 4847 }; 4848 4849 privateMethods.swalPromiseResolve.set(instance, resolve); 4850 privateMethods.swalPromiseReject.set(instance, reject); 4851 4852 domCache.confirmButton.onclick = () => handleConfirmButtonClick(instance); 4853 4854 domCache.denyButton.onclick = () => handleDenyButtonClick(instance); 4855 4856 domCache.cancelButton.onclick = () => handleCancelButtonClick(instance, dismissWith); 4857 4858 domCache.closeButton.onclick = () => dismissWith(DismissReason.close); 4859 4860 handlePopupClick(instance, domCache, dismissWith); 4861 addKeydownHandler(instance, globalState, innerParams, dismissWith); 4862 handleInputOptionsAndValue(instance, innerParams); 4863 openPopup(innerParams); 4864 setupTimer(globalState, innerParams, dismissWith); 4865 initFocus(domCache, innerParams); // Scroll container to top on open (#1247, #1946) 4866 4867 setTimeout(() => { 4868 domCache.container.scrollTop = 0; 4869 }); 4870 }); 4871 }; 4872 4873 const prepareParams = (userParams, mixinParams) => { 4874 const templateParams = getTemplateParams(userParams); 4875 const params = Object.assign({}, defaultParams, mixinParams, templateParams, userParams); // precedence is described in #2131 4876 4877 params.showClass = Object.assign({}, defaultParams.showClass, params.showClass); 4878 params.hideClass = Object.assign({}, defaultParams.hideClass, params.hideClass); 4879 return params; 4880 }; 4881 4882 const populateDomCache = instance => { 4883 const domCache = { 4884 popup: getPopup(), 4885 container: getContainer(), 4886 actions: getActions(), 4887 confirmButton: getConfirmButton(), 4888 denyButton: getDenyButton(), 4889 cancelButton: getCancelButton(), 4890 loader: getLoader(), 4891 closeButton: getCloseButton(), 4892 validationMessage: getValidationMessage(), 4893 progressSteps: getProgressSteps() 4894 }; 4895 privateProps.domCache.set(instance, domCache); 4896 return domCache; 4897 }; 4898 4899 const setupTimer = (globalState$$1, innerParams, dismissWith) => { 4900 const timerProgressBar = getTimerProgressBar(); 4901 hide(timerProgressBar); 4902 4903 if (innerParams.timer) { 4904 globalState$$1.timeout = new Timer(() => { 4905 dismissWith('timer'); 4906 delete globalState$$1.timeout; 4907 }, innerParams.timer); 4908 4909 if (innerParams.timerProgressBar) { 4910 show(timerProgressBar); 4911 applyCustomClass(timerProgressBar, innerParams, 'timerProgressBar'); 4912 setTimeout(() => { 4913 if (globalState$$1.timeout && globalState$$1.timeout.running) { 4914 // timer can be already stopped or unset at this point 4915 animateTimerProgressBar(innerParams.timer); 4916 } 4917 }); 4918 } 4919 } 4920 }; 4921 4922 const initFocus = (domCache, innerParams) => { 4923 if (innerParams.toast) { 4924 return; 4925 } 4926 4927 if (!callIfFunction(innerParams.allowEnterKey)) { 4928 return blurActiveElement(); 4929 } 4930 4931 if (!focusButton(domCache, innerParams)) { 4932 setFocus(innerParams, -1, 1); 4933 } 4934 }; 4935 4936 const focusButton = (domCache, innerParams) => { 4937 if (innerParams.focusDeny && isVisible(domCache.denyButton)) { 4938 domCache.denyButton.focus(); 4939 return true; 4940 } 4941 4942 if (innerParams.focusCancel && isVisible(domCache.cancelButton)) { 4943 domCache.cancelButton.focus(); 4944 return true; 4945 } 4946 4947 if (innerParams.focusConfirm && isVisible(domCache.confirmButton)) { 4948 domCache.confirmButton.focus(); 4949 return true; 4950 } 4951 4952 return false; 4953 }; 4954 4955 const blurActiveElement = () => { 4956 if (document.activeElement instanceof HTMLElement && typeof document.activeElement.blur === 'function') { 4957 document.activeElement.blur(); 4958 } 4959 }; // Assign instance methods from src/instanceMethods/*.js to prototype 4960 4961 4962 Object.assign(SweetAlert.prototype, instanceMethods); // Assign static methods from src/staticMethods/*.js to constructor 4963 4964 Object.assign(SweetAlert, staticMethods); // Proxy to instance methods to constructor, for now, for backwards compatibility 4965 4966 Object.keys(instanceMethods).forEach(key => { 4967 SweetAlert[key] = function () { 4968 if (currentInstance) { 4969 return currentInstance[key](...arguments); 4970 } 4971 }; 4972 }); 4973 SweetAlert.DismissReason = DismissReason; 4974 SweetAlert.version = '11.4.
vendor: 8,660 bytes, lines 4974-4991
497413'; 4975 4976 const Swal = SweetAlert; // @ts-ignore 4977 4978 Swal.default = Swal; 4979 4980 return Swal; 4981 4982})); 4983if (typeof this !== 'undefined' && this.Sweetalert2){ this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2} 4984 4985 4986/***/ }), 4987 4988/***/ 732: 4989/***/ (function(module) { 4990 4991!function(n,t){ true?module.exports=t():0}(this,(function(){"use strict";function n(){return n=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}return n},n.apply(this,arguments)}var t="undefined"!=typeof window,e=t&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),o=t&&"IntersectionObserver"in window,i=t&&"classList"in document.createElement("p"),a=t&&window.devicePixelRatio>1,r={elements_selector:".lazy",container:e||t?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_bg_set:"bg-set",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1,restore_on_error:!1},c=function(t){return n({},r,t)},u=function(n,t){var e,o="LazyLoad::Initialized",i=new n(t);try{e=new CustomEvent(o,{detail:{instance:i}})}catch(n){(e=document.createEvent("CustomEvent")).initCustomEvent(o,!1,!1,{instance:i})}window.dispatchEvent(e)},l="src",s="srcset",f="sizes",d="poster",_="llOriginalAttrs",g="data",v="loading",b="loaded",p="applied",m="error",h="native",E="data-",I="ll-status",y=function(n,t){return n.getAttribute(E+t)},k=function(n){return y(n,I)},A=function(n,t){return function(n,t,e){var o="data-ll-status";null!==e?n.setAttribute(o,e):n.removeAttribute(o)}(n,0,t)},w=function(n){return A(n,null)},L=function(n){return null===k(n)},O=function(n){return k(n)===h},x=[v,b,p,m],C=function(n,t,e,o){n&&(void 0===o?void 0===e?n(t):n(t,e):n(t,e,o))},N=function(n,t){i?n.classList.add(t):n.className+=(n.className?" ":"")+t},M=function(n,t){i?n.classList.remove(t):n.className=n.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},z=function(n){return n.llTempImage},T=function(n,t){if(t){var e=t._observer;e&&e.unobserve(n)}},R=function(n,t){n&&(n.loadingCount+=t)},G=function(n,t){n&&(n.toLoadCount=t)},j=function(n){for(var t,e=[],o=0;t=n.children[o];o+=1)"SOURCE"===t.tagName&&e.push(t);return e},D=function(n,t){var e=n.parentNode;e&&"PICTURE"===e.tagName&&j(e).forEach(t)},V=function(n,t){j(n).forEach(t)},F=[l],B=[l,d],J=[l,s,f],P=[g],S=function(n){return!!n[_]},U=function(n){return n[_]},$=function(n){return delete n[_]},q=function(n,t){if(!S(n)){var e={};t.forEach((function(t){e[t]=n.getAttribute(t)})),n[_]=e}},H=function(n,t){if(S(n)){var e=U(n);t.forEach((function(t){!function(n,t,e){e?n.setAttribute(t,e):n.removeAttribute(t)}(n,t,e[t])}))}},K=function(n,t,e){N(n,t.class_applied),A(n,p),e&&(t.unobserve_completed&&T(n,t),C(t.callback_applied,n,e))},Q=function(n,t,e){N(n,t.class_loading),A(n,v),e&&(R(e,1),C(t.callback_loading,n,e))},W=function(n,t,e){e&&n.setAttribute(t,e)},X=function(n,t){W(n,f,y(n,t.data_sizes)),W(n,s,y(n,t.data_srcset)),W(n,l,y(n,t.data_src))},Y={IMG:function(n,t){D(n,(function(n){q(n,J),X(n,t)})),q(n,J),X(n,t)},IFRAME:function(n,t){q(n,F),W(n,l,y(n,t.data_src))},VIDEO:function(n,t){V(n,(function(n){q(n,F),W(n,l,y(n,t.data_src))})),q(n,B),W(n,d,y(n,t.data_poster)),W(n,l,y(n,t.data_src)),n.load()},OBJECT:function(n,t){q(n,P),W(n,g,y(n,t.data_src))}},Z=["IMG","IFRAME","VIDEO","OBJECT"],nn=function(n,t){!t||function(n){return n.loadingCount>0}(t)||function(n){return n.toLoadCount>0}(t)||C(n.callback_finish,t)},tn=function(n,t,e){n.addEventListener(t,e),n.llEvLisnrs[t]=e},en=function(n,t,e){n.removeEventListener(t,e)},on=function(n){return!!n.llEvLisnrs},an=function(n){if(on(n)){var t=n.llEvLisnrs;for(var e in t){var o=t[e];en(n,e,o)}delete n.llEvLisnrs}},rn=function(n,t,e){!function(n){delete n.llTempImage}(n),R(e,-1),function(n){n&&(n.toLoadCount-=1)}(e),M(n,t.class_loading),t.unobserve_completed&&T(n,e)},cn=function(n,t,e){var o=z(n)||n;on(o)||function(n,t,e){on(n)||(n.llEvLisnrs={});var o="VIDEO"===n.tagName?"loadeddata":"load";tn(n,o,t),tn(n,"error",e)}(o,(function(i){!function(n,t,e,o){var i=O(t);rn(t,e,o),N(t,e.class_loaded),A(t,b),C(e.callback_loaded,t,o),i||nn(e,o)}(0,n,t,e),an(o)}),(function(i){!function(n,t,e,o){var i=O(t);rn(t,e,o),N(t,e.class_error),A(t,m),C(e.callback_error,t,o),e.restore_on_error&&H(t,J),i||nn(e,o)}(0,n,t,e),an(o)}))},un=function(n,t,e){!function(n){return Z.indexOf(n.tagName)>-1}(n)?function(n,t,e){!function(n){n.llTempImage=document.createElement("IMG")}(n),cn(n,t,e),function(n){S(n)||(n[_]={backgroundImage:n.style.backgroundImage})}(n),function(n,t,e){var o=y(n,t.data_bg),i=y(n,t.data_bg_hidpi),r=a&&i?i:o;r&&(n.style.backgroundImage='url("'.concat(r,'")'),z(n).setAttribute(l,r),Q(n,t,e))}(n,t,e),function(n,t,e){var o=y(n,t.data_bg_multi),i=y(n,t.data_bg_multi_hidpi),r=a&&i?i:o;r&&(n.style.backgroundImage=r,K(n,t,e))}(n,t,e),function(n,t,e){var o=y(n,t.data_bg_set);if(o){var i=o.split("|"),a=i.map((function(n){return"image-set(".concat(n,")")}));n.style.backgroundImage=a.join(),""===n.style.backgroundImage&&(a=i.map((function(n){return"-webkit-image-set(".concat(n,")")})),n.style.backgroundImage=a.join()),K(n,t,e)}}(n,t,e)}(n,t,e):function(n,t,e){cn(n,t,e),function(n,t,e){var o=Y[n.tagName];o&&(o(n,t),Q(n,t,e))}(n,t,e)}(n,t,e)},ln=function(n){n.removeAttribute(l),n.removeAttribute(s),n.removeAttribute(f)},sn=function(n){D(n,(function(n){H(n,J)})),H(n,J)},fn={IMG:sn,IFRAME:function(n){H(n,F)},VIDEO:function(n){V(n,(function(n){H(n,F)})),H(n,B),n.load()},OBJECT:function(n){H(n,P)}},dn=function(n,t){(function(n){var t=fn[n.tagName];t?t(n):function(n){if(S(n)){var t=U(n);n.style.backgroundImage=t.backgroundImage}}(n)})(n),function(n,t){L(n)||O(n)||(M(n,t.class_entered),M(n,t.class_exited),M(n,t.class_applied),M(n,t.class_loading),M(n,t.class_loaded),M(n,t.class_error))}(n,t),w(n),$(n)},_n=["IMG","IFRAME","VIDEO"],gn=function(n){return n.use_native&&"loading"in HTMLImageElement.prototype},vn=function(n,t,e){n.forEach((function(n){return function(n){return n.isIntersecting||n.intersectionRatio>0}(n)?function(n,t,e,o){var i=function(n){return x.indexOf(k(n))>=0}(n);A(n,"entered"),N(n,e.class_entered),M(n,e.class_exited),function(n,t,e){t.unobserve_entered&&T(n,e)}(n,e,o),C(e.callback_enter,n,t,o),i||un(n,e,o)}(n.target,n,t,e):function(n,t,e,o){L(n)||(N(n,e.class_exited),function(n,t,e,o){e.cancel_on_exit&&function(n){return k(n)===v}(n)&&"IMG"===n.tagName&&(an(n),function(n){D(n,(function(n){ln(n)})),ln(n)}(n),sn(n),M(n,e.class_loading),R(o,-1),w(n),C(e.callback_cancel,n,t,o))}(n,t,e,o),C(e.callback_exit,n,t,o))}(n.target,n,t,e)}))},bn=function(n){return Array.prototype.slice.call(n)},pn=function(n){return n.container.querySelectorAll(n.elements_selector)},mn=function(n){return function(n){return k(n)===m}(n)},hn=function(n,t){return function(n){return bn(n).filter(L)}(n||pn(t))},En=function(n,e){var i=c(n);this._settings=i,this.loadingCount=0,function(n,t){o&&!gn(n)&&(t._observer=new IntersectionObserver((function(e){vn(e,n,t)}),function(n){return{root:n.container===document?null:n.container,rootMargin:n.thresholds||n.threshold+"px"}}(n)))}(i,this),function(n,e){t&&window.addEventListener("online",(function(){!function(n,t){var e;(e=pn(n),bn(e).filter(mn)).forEach((function(t){M(t,n.class_error),w(t)})),t.update()}(n,e)}))}(i,this),this.update(e)};return En.prototype={update:function(n){var t,i,a=this._settings,r=hn(n,a);G(this,r.length),!e&&o?gn(a)?function(n,t,e){n.forEach((function(n){-1!==_n.indexOf(n.tagName)&&function(n,t,e){n.setAttribute("loading","lazy"),cn(n,t,e),function(n,t){var e=Y[n.tagName];e&&e(n,t)}(n,t),A(n,h)}(n,t,e)})),G(e,0)}(r,a,this):(i=r,function(n){n.disconnect()}(t=this._observer),function(n,t){t.forEach((function(t){n.observe(t)}))}(t,i)):this.loadAll(r)},destroy:function(){this._observer&&this._observer.disconnect(),pn(this._settings).forEach((function(n){$(n)})),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(n){var t=this,e=this._settings;hn(n,e).forEach((function(n){T(n,t),un(n,e,t)}))},restoreAll:function(){var n=this._settings;
4991pn(n).forEach((function(t){dn(t,n)}))}},En.load=function(n,t){var e=c(t);un(n,e)},En.resetStatus=function(n){w(n)},t&&function(n,t){if(t)if(t.length)for(var e,o=0;e=t[o];o+=1)u(n,e);else u(n,t)}(En,window.lazyLoadOptions),En})); 4992 4993 4994/***/ }) 4995 4996/******/ }); 4997/************************************************************************/ 4998/******/ // The module cache 4999/******/ var __webpack_module_cache__ = {}; 5000/******/ 5001/******/ // The require function 5002/******/ function __webpack_require__(moduleId) { 5003/******/ // Check if module is in cache 5004/******/ var cachedModule = __webpack_module_cache__[moduleId]; 5005/******/ if (cachedModule !== undefined) { 5006/******/ return cachedModule.exports; 5007/******/ } 5008/******/ // Create a new module (and put it into the cache) 5009/******/ var module = __webpack_module_cache__[moduleId] = { 5010/******/ // no module.id needed 5011/******/ // no module.loaded needed 5012/******/ exports: {} 5013/******/ }; 5014/******/ 5015/******/ // Execute the module function 5016/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 5017/******/ 5018/******/ // Return the exports of the module 5019/******/ return module.exports; 5020/******/ } 5021/******/ 5022/************************************************************************/ 5023/******/ /* webpack/runtime/compat get default export */ 5024/******/ (() => { 5025/******/ // getDefaultExport function for compatibility with non-harmony modules 5026/******/ __webpack_require__.n = (module) => { 5027/******/ var getter = module && module.__esModule ? 5028/******/ () => (module['default']) : 5029/******/ () => (module); 5030/******/ __webpack_require__.d(getter, { a: getter }); 5031/******/ return getter; 5032/******/ }; 5033/******/ })(); 5034/******/ 5035/******/ /* webpack/runtime/define property getters */ 5036/******/ (() => { 5037/******/ // define getter functions for harmony exports 5038/******/ __webpack_require__.d = (exports, definition) => { 5039/******/ for(var key in definition) { 5040/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 5041/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 5042/******/ } 5043/******/ } 5044/******/ }; 5045/******/ })(); 5046/******/ 5047/******/ /* webpack/runtime/global */ 5048/******/ (() => { 5049/******/ __webpack_require__.g = (function() { 5050/******/ if (typeof globalThis === 'object') return globalThis; 5051/******/ try { 5052/******/ return this || new Function('return this')(); 5053/******/ } catch (e) { 5054/******/ if (typeof window === 'object') return window; 5055/******/ } 5056/******/ })(); 5057/******/ })(); 5058/******/ 5059/******/ /* webpack/runtime/hasOwnProperty shorthand */ 5060/******/ (() => { 5061/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 5062/******/ })(); 5063/******/ 5064/************************************************************************/ 5065var __webpack_exports__ = {}; 5066// This entry need to be wrapped in an IIFE because it need to be in strict mode. 5067(() => { 5068"use strict"; 5069 5070// EXTERNAL MODULE: ./node_modules/aos/dist/aos.js 5071var aos = __webpack_require__(711); 5072var aos_default = /*#__PURE__*/__webpack_require__.n(aos); 5073// EXTERNAL MODULE: ./node_modules/svg4everybody/dist/svg4everybody.js 5074var svg4everybody = __webpack_require__(440); 5075var svg4everybody_default = /*#__PURE__*/__webpack_require__.n(svg4everybody); 5076// EXTERNAL MODULE: ./node_modules/vanilla-lazyload/dist/lazyload.min.js 5077var lazyload_min = __webpack_require__(732); 5078var lazyload_min_default = /*#__PURE__*/__webpack_require__.n(lazyload_min); 5079// EXTERNAL MODULE: ./node_modules/custom-event-polyfill/custom-event-polyfill.js 5080var custom_event_polyfill = __webpack_require__(456); 5081;// CONCATENATED MODULE: ./node_modules/custom-select/src/index.js 5082/** 5083 * custom-select 5084 * A lightweight JS script for custom select creation. 5085 * Needs no dependencies. 5086 * 5087 * v0.0.1 5088 * (https://github.com/custom-select/custom-select) 5089 * 5090 * Copyright (c) 2016 Gionatan Lombardi & Marco Nucara 5091 * MIT License 5092 */ 5093 5094 5095 5096const defaultParams = { 5097 containerClass: 'custom-select-container', 5098 openerClass: 'custom-select-opener', 5099 panelClass: 'custom-select-panel', 5100 optionClass: 'custom-select-option', 5101 optgroupClass: 'custom-select-optgroup', 5102 isSelectedClass: 'is-selected', 5103 hasFocusClass: 'has-focus', 5104 isDisabledClass: 'is-disabled', 5105 isOpenClass: 'is-open', 5106}; 5107 5108function builder(el, builderParams) { 5109 const containerClass = 'customSelect'; 5110 let isOpen = false;
5111 let uId = ''; 5112 const select = el; 5113 let container; 5114 let opener; 5115 let focusedElement; 5116 let selectedElement; 5117 let panel; 5118 let currLabel; 5119 5120 let resetSearchTimeout; 5121 let searchKey = ''; 5122 5123 // 5124 // Inner Functions 5125 // 5126 5127 // Sets the focused element with the neccessary classes substitutions 5128 function setFocusedElement(cstOption) { 5129 if (focusedElement) { 5130 focusedElement.classList.remove(builderParams.hasFocusClass); 5131 } 5132 if (typeof cstOption !== 'undefined') { 5133 focusedElement = cstOption; 5134 focusedElement.classList.add(builderParams.hasFocusClass); 5135 // Offset update: checks if the focused element is in the visible part of the panelClass 5136 // if not dispatches a custom event 5137 if (isOpen) { 5138 if (cstOption.offsetTop < cstOption.offsetParent.scrollTop 5139 || cstOption.offsetTop > 5140 (cstOption.offsetParent.scrollTop + cstOption.offsetParent.clientHeight) 5141 - cstOption.clientHeight) { 5142 cstOption.dispatchEvent(new CustomEvent('custom-select:focus-outside-panel', { bubbles: true })); 5143 } 5144 } 5145 } else { 5146 focusedElement = undefined; 5147 } 5148 } 5149 5150 // Reassigns the focused and selected custom option 5151 // Updates the opener text 5152 // IMPORTANT: the setSelectedElement function doesn't change the select value! 5153 function setSelectedElement(cstOption) { 5154 if (selectedElement) { 5155 selectedElement.classList.remove(builderParams.isSelectedClass); 5156 selectedElement.removeAttribute('id'); 5157 opener.removeAttribute('aria-activedescendant'); 5158 } 5159 if (typeof cstOption !== 'undefined') { 5160 cstOption.classList.add(builderParams.isSelectedClass); 5161 cstOption.setAttribute('id', `${containerClass}-${uId}-selectedOption`); 5162 opener.setAttribute('aria-activedescendant', `${containerClass}-${uId}-selectedOption`); 5163 selectedElement = cstOption; 5164 opener.children[0].textContent = selectedElement.customSelectOriginalOption.text; 5165 } else { 5166 selectedElement = undefined; 5167 opener.children[0].textContent = ''; 5168 } 5169 setFocusedElement(cstOption); 5170 } 5171 5172 function setValue(value) { 5173 // Gets the option with the provided value 5174 let toSelect = select.querySelector(`option[value='${value}']`); 5175 // If no option has the provided value get the first 5176 if (!toSelect) { 5177 [toSelect] = select.options; 5178 } 5179 // The option with the provided value becomes the selected one 5180 // And changes the select current value 5181 toSelect.selected = true; 5182 5183 setSelectedElement(select.options[select.selectedIndex].customSelectCstOption); 5184 } 5185 5186 function moveFocuesedElement(direction) { 5187 // Get all the .custom-select-options 5188 // Get the index of the current focused one 5189 const currentFocusedIndex = 5190 [].indexOf.call(select.options, focusedElement.customSelectOriginalOption); 5191 // If the next or prev custom option exist 5192 // Sets it as the new focused one 5193 if (select.options[currentFocusedIndex + direction]) { 5194 setFocusedElement(select.options[currentFocusedIndex + direction].customSelectCstOption); 5195 } 5196 } 5197 5198 // Open/Close function (toggle) 5199 function open(bool) { 5200 // Open 5201 if (bool || typeof bool === 'undefined') { 5202 // If present closes an opened instance of the plugin 5203 // Only one at time can be open 5204 const openedCustomSelect = 5205 document.querySelector(`.${containerClass}.${builderParams.isOpenClass}`); 5206 if (openedCustomSelect) { 5207 openedCustomSelect.customSelect.open = false; 5208 } 5209 5210 // Opens only the clicked one 5211 container.classList.add(builderParams.isOpenClass); 5212 5213 // aria-expanded update 5214 container.classList.add(builderParams.isOpenClass); 5215 opener.setAttribute('aria-expanded', 'true'); 5216 5217 // Updates the scrollTop position of the panel in relation with the focused option 5218 if (selectedElement) { 5219 panel.scrollTop = selectedElement.offsetTop; 5220 } 5221 5222 // Dispatches the custom event open 5223 container.dispatchEvent(new CustomEvent('custom-select:open')); 5224 5225 // Sets the global state 5226 isOpen = true; 5227 5228 // Close 5229 } else { 5230 // Removes the css classes 5231 container.classList.remove(builderParams.isOpenClass); 5232 5233 // aria-expanded update 5234 opener.setAttribute('aria-expanded', 'false'); 5235 5236 // Sets the global state 5237 isOpen = false;
vendor: 5,561 bytes, lines 5238-5395
5238 5239 // When closing the panel the focused custom option must be the selected one 5240 setFocusedElement(selectedElement); 5241 5242 // Dispatches the custom event close 5243 container.dispatchEvent(new CustomEvent('custom-select:close')); 5244 } 5245 return isOpen; 5246 } 5247 5248 function clickEvent(e) { 5249 // Opener click 5250 if (e.target === opener || opener.contains(e.target)) { 5251 if (isOpen) { 5252 open(false); 5253 } else { 5254 open(); 5255 } 5256 // Custom Option click 5257 } else if ( 5258 e.target.classList 5259 && e.target.classList.contains(builderParams.optionClass) 5260 && panel.contains(e.target)) { 5261 setSelectedElement(e.target); 5262 // Sets the corrisponding select's option to selected updating the select's value too 5263 selectedElement.customSelectOriginalOption.selected = true; 5264 open(false); 5265 // Triggers the native change event of the select 5266 select.dispatchEvent(new CustomEvent('change')); 5267 // click on label or select (click on label corrispond to select click) 5268 } else if (e.target === select) { 5269 // if the original select is focusable (for any external reason) let the focus 5270 // else trigger the focus on opener 5271 if (opener !== document.activeElement && select !== document.activeElement) { 5272 opener.focus(); 5273 } 5274 // Click outside the container closes the panel 5275 } else if (isOpen && !container.contains(e.target)) { 5276 open(false); 5277 } 5278 } 5279 5280 function mouseoverEvent(e) { 5281 // On mouse move over and options it bacames the focused one 5282 if (e.target.classList && e.target.classList.contains(builderParams.optionClass)) { 5283 setFocusedElement(e.target); 5284 } 5285 } 5286 5287 function keydownEvent(e) { 5288 if (!isOpen) { 5289 // On "Arrow down", "Arrow up" and "Space" keys opens the panel 5290 if (e.keyCode === 40 || e.keyCode === 38 || e.keyCode === 32) { 5291 open(); 5292 } 5293 } else { 5294 switch (e.keyCode) { 5295 case 13: 5296 case 32: 5297 // On "Enter" or "Space" selects the focused element as the selected one 5298 setSelectedElement(focusedElement); 5299 // Sets the corrisponding select's option to selected updating the select's value too 5300 selectedElement.customSelectOriginalOption.selected = true; 5301 // Triggers the native change event of the select 5302 select.dispatchEvent(new CustomEvent('change')); 5303 open(false); 5304 break; 5305 case 27: 5306 // On "Escape" closes the panel 5307 open(false); 5308 break; 5309 5310 case 38: 5311 // On "Arrow up" set focus to the prev option if present 5312 moveFocuesedElement(-1); 5313 break; 5314 case 40: 5315 // On "Arrow down" set focus to the next option if present 5316 moveFocuesedElement(+1); 5317 break; 5318 default: 5319 // search in panel (autocomplete) 5320 if (e.keyCode >= 48 && e.keyCode <= 90) { 5321 // clear existing reset timeout 5322 if (resetSearchTimeout) { 5323 clearTimeout(resetSearchTimeout); 5324 } 5325 5326 // reset timeout for empty search key 5327 resetSearchTimeout = setTimeout(() => { 5328 searchKey = ''; 5329 }, 1500); 5330 5331 // update search keyword appending the current key 5332 searchKey += String.fromCharCode(e.keyCode); 5333 5334 // search the element 5335 for (let i = 0, l = select.options.length; i < l; i++) { 5336 // removed cause not supported by IE: 5337 // if (options[i].text.startsWith(searchKey)) 5338 if (select.options[i].text.toUpperCase().substr(0, searchKey.length) === searchKey) { 5339 setFocusedElement(select.options[i].customSelectCstOption); 5340 break; 5341 } 5342 } 5343 } 5344 break; 5345 } 5346 } 5347 } 5348 5349 function changeEvent() { 5350 const index = select.selectedIndex; 5351 const element = index === -1 ? undefined : select.options[index].customSelectCstOption; 5352 5353 setSelectedElement(element); 5354 } 5355 5356 // When the option is outside the visible part of the opened panel, updates the scrollTop position 5357 // This is the default behaviour 5358 // To block it the plugin user must 5359 // add a "custom-select:focus-outside-panel" eventListener on the panel 5360 // with useCapture set to true 5361 // and stopPropagation 5362 function scrollToFocused(e) { 5363 const currPanel = e.currentTarget; 5364 const currOption = e.target; 5365 // Up 5366 if (currOption.offsetTop < currPanel.scrollTop) { 5367 currPanel.scrollTop = currOption.offsetTop; 5368 // Down 5369 } else { 5370 currPanel.scrollTop = (currOption.offsetTop + currOption.clientHeight) 5371 - currPanel.clientHeight; 5372 } 5373 } 5374 5375 function addEvents() { 5376 document.addEventListener('click', clickEvent); 5377 panel.addEventListener('mouseover', mouseoverEvent); 5378 panel.addEventListener('custom-select:focus-outside-panel', scrollToFocused); 5379 select.addEventListener('change', changeEvent); 5380 container.addEventListener('keydown', keydownEvent); 5381 } 5382 5383 function removeEvents() { 5384 document.removeEventListener('click', clickEvent); 5385 panel.removeEventListener('mouseover', mouseoverEvent); 5386 panel.removeEventListener('custom-select:focus-outside-panel', scrollToFocused); 5387 select.removeEventListener('change', changeEvent); 5388 container.removeEventListener('keydown', keydownEvent); 5389 } 5390 5391 function disabled(bool) { 5392 if (bool && !select.disabled) { 5393 container.classList.add(builderParams.isDisabledClass); 5394 select.disabled = true; 5395 opener.removeAttribute('tabindex');
5396 container.dispatchEvent(new CustomEvent('custom-select:disabled')); 5397 removeEvents(); 5398 } else if (!bool && select.disabled) { 5399 container.classList.remove(builderParams.isDisabledClass); 5400 select.disabled = false; 5401 opener.setAttribute('tabindex', '0'); 5402 container.dispatchEvent(new CustomEvent('custom-select:enabled')); 5403 addEvents(); 5404 } 5405 } 5406 5407 // Form a given select children DOM tree (options and optgroup), 5408 // Creates the corresponding custom HTMLElements list (divs with different classes and attributes) 5409 function parseMarkup(children) { 5410 const nodeList = children; 5411 const cstList = []; 5412 5413 if (typeof nodeList.length === 'undefined') { 5414 throw new TypeError('Invalid Argument'); 5415 } 5416 5417 for (let i = 0, li = nodeList.length; i < li; i++) { 5418 if (nodeList[i] instanceof HTMLElement && nodeList[i].tagName.toUpperCase() === 'OPTGROUP') { 5419 const cstOptgroup = document.createElement('div'); 5420 cstOptgroup.classList.add(builderParams.optgroupClass); 5421 cstOptgroup.setAttribute('data-label', nodeList[i].label); 5422 5423 // IMPORTANT: Stores in a property of the created custom option group 5424 // a hook to the the corrisponding select's option group 5425 cstOptgroup.customSelectOriginalOptgroup = nodeList[i]; 5426 5427 // IMPORTANT: Stores in a property of select's option group 5428 // a hook to the created custom option group 5429 nodeList[i].customSelectCstOptgroup = cstOptgroup; 5430 5431 const subNodes = parseMarkup(nodeList[i].children); 5432 for (let j = 0, lj = subNodes.length; j < lj; j++) { 5433 cstOptgroup.appendChild(subNodes[j]); 5434 } 5435 5436 cstList.push(cstOptgroup); 5437 } else if (nodeList[i] instanceof HTMLElement 5438 && nodeList[i].tagName.toUpperCase() === 'OPTION') { 5439 const cstOption = document.createElement('div'); 5440 cstOption.classList.add(builderParams.optionClass); 5441 cstOption.textContent = nodeList[i].text; 5442 cstOption.setAttribute('data-value', nodeList[i].value); 5443 cstOption.setAttribute('role', 'option'); 5444 5445 // IMPORTANT: Stores in a property of the created custom option 5446 // a hook to the the corrisponding select's option 5447 cstOption.customSelectOriginalOption = nodeList[i]; 5448 5449 // IMPORTANT: Stores in a property of select's option 5450 // a hook to the created custom option 5451 nodeList[i].customSelectCstOption = cstOption; 5452 5453 // If the select's option is selected 5454 if (nodeList[i].selected) { 5455 setSelectedElement(cstOption); 5456 } 5457 cstList.push(cstOption); 5458 } else { 5459 throw new TypeError('Invalid Argument'); 5460 } 5461 } 5462 return cstList; 5463 } 5464 5465 function append(nodePar, appendIntoOriginal, targetPar) { 5466 let target; 5467 if (typeof targetPar === 'undefined' 5468 || (targetPar === select)) { 5469 target = panel; 5470 } else if (targetPar instanceof HTMLElement 5471 && targetPar.tagName.toUpperCase() === 'OPTGROUP' 5472 && select.contains(targetPar)) { 5473 target = targetPar.customSelectCstOptgroup; 5474 } else { 5475 throw new TypeError('Invalid Argument'); 5476 } 5477 5478 // If the node provided is a single HTMLElement it is stored in an array 5479 const node = nodePar instanceof HTMLElement ? [nodePar] : nodePar; 5480 5481 // Injects the options|optgroup in the select 5482 if (appendIntoOriginal) { 5483 for (let i = 0, l = node.length; i < l; i++) { 5484 if (target === panel) { 5485 select.appendChild(node[i]); 5486 } else { 5487 target.customSelectOriginalOptgroup.appendChild(node[i]); 5488 } 5489 } 5490 } 5491 5492 // The custom markup to append 5493 const markupToInsert = parseMarkup(node); 5494 5495 // Injects the created DOM content in the panel 5496 for (let i = 0, l = markupToInsert.length; i < l; i++) { 5497 target.appendChild(markupToInsert[i]); 5498 } 5499 5500 return node; 5501 } 5502 5503 function insertBefore(node, targetPar) { 5504 let target; 5505 if (targetPar instanceof HTMLElement 5506 && targetPar.tagName.toUpperCase() === 'OPTION' 5507 && select.contains(targetPar)) { 5508 target = targetPar.customSelectCstOption; 5509 } else if (targetPar instanceof HTMLElement 5510 && targetPar.tagName.toUpperCase() === 'OPTGROUP' 5511 && select.contains(targetPar)) { 5512 target = targetPar.customSelectCstOptgroup; 5513 } else { 5514 throw new TypeError('Invalid Argument'); 5515 } 5516 5517 // The custom markup to append 5518 const markupToInsert = parseMarkup(node.length ? node : [node]); 5519 5520 target.parentNode.insertBefore(markupToInsert[0], target); 5521 5522 // Injects the option or optgroup node in the original select and returns the injected node 5523 return targetPar.parentNode.insertBefore(node.length ? node[0] : node, targetPar); 5524 } 5525 5526 function remove(node) {
5527 let cstNode; 5528 if (node instanceof HTMLElement 5529 && node.tagName.toUpperCase() === 'OPTION' 5530 && select.contains(node)) { 5531 cstNode = node.customSelectCstOption; 5532 } else if (node instanceof HTMLElement 5533 && node.tagName.toUpperCase() === 'OPTGROUP' 5534 && select.contains(node)) { 5535 cstNode = node.customSelectCstOptgroup; 5536 } else { 5537 throw new TypeError('Invalid Argument'); 5538 } 5539 cstNode.parentNode.removeChild(cstNode); 5540 const removedNode = node.parentNode.removeChild(node); 5541 changeEvent(); 5542 return removedNode; 5543 } 5544 5545 function empty() { 5546 const removed = []; 5547 while (select.children.length) { 5548 panel.removeChild(panel.children[0]); 5549 removed.push(select.removeChild(select.children[0])); 5550 } 5551 setSelectedElement(); 5552 return removed; 5553 } 5554 5555 function destroy() { 5556 for (let i = 0, l = select.options.length; i < l; i++) { 5557 delete select.options[i].customSelectCstOption; 5558 } 5559 const optGroup = select.getElementsByTagName('optgroup'); 5560 for (let i = 0, l = optGroup.length; i < l; i++) { 5561 delete optGroup.customSelectCstOptgroup; 5562 } 5563 5564 removeEvents(); 5565 5566 return container.parentNode.replaceChild(select, container); 5567 } 5568 // 5569 // Custom Select DOM tree creation 5570 // 5571 5572 // Creates the container/wrapper 5573 container = document.createElement('div'); 5574 container.classList.add(builderParams.containerClass, containerClass); 5575 5576 // Creates the opener 5577 opener = document.createElement('span'); 5578 opener.className = builderParams.openerClass; 5579 opener.setAttribute('role', 'combobox'); 5580 opener.setAttribute('aria-autocomplete', 'list'); 5581 opener.setAttribute('aria-expanded', 'false'); 5582 opener.innerHTML = `<span> 5583 ${(select.selectedIndex !== -1 ? select.options[select.selectedIndex].text : '')} 5584 </span>`; 5585 5586 // Creates the panel 5587 // and injects the markup of the select inside 5588 // with some tag and attributes replacement 5589 panel = document.createElement('div'); 5590 // Create random id 5591 const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; 5592 for (let i = 0; i < 5; i++) { 5593 uId += possible.charAt(Math.floor(Math.random() * possible.length)); 5594 } 5595 panel.id = `${containerClass}-${uId}-panel`; 5596 panel.className = builderParams.panelClass; 5597 panel.setAttribute('role', 'listbox'); 5598 opener.setAttribute('aria-owns', panel.id); 5599 5600 append(select.children, false); 5601 5602 // Injects the container in the original DOM position of the select 5603 container.appendChild(opener); 5604 select.parentNode.replaceChild(container, select); 5605 container.appendChild(select); 5606 container.appendChild(panel); 5607 5608 // ARIA labelledby - label 5609 if (document.querySelector(`label[for="${select.id}"]`)) { 5610 currLabel = document.querySelector(`label[for="${select.id}"]`); 5611 } else if (container.parentNode.tagName.toUpperCase() === 'LABEL') { 5612 currLabel = container.parentNode; 5613 } 5614 if (typeof currLabel !== 'undefined') { 5615 currLabel.setAttribute('id', `${containerClass}-${uId}-label`); 5616 opener.setAttribute('aria-labelledby', `${containerClass}-${uId}-label`); 5617 } 5618 5619 // Event Init 5620 if (select.disabled) { 5621 container.classList.add(builderParams.isDisabledClass); 5622 } else { 5623 opener.setAttribute('tabindex', '0'); 5624 select.setAttribute('tabindex', '-1'); 5625 addEvents(); 5626 } 5627 5628 // Stores the plugin public exposed methods and properties, directly in the container HTMLElement 5629 container.customSelect = { 5630 get pluginOptions() { return builderParams; }, 5631 get open() { return isOpen; }, 5632 set open(bool) { 5633 open(bool); 5634 }, 5635 get disabled() { return select.disabled; }, 5636 set disabled(bool) { 5637 disabled(bool); 5638 }, 5639 get value() { return select.value; }, 5640 set value(val) { 5641 setValue(val); 5642 }, 5643 append: (node, target) => append(node, true, target), 5644 insertBefore: (node, target) => insertBefore(node, target), 5645 remove, 5646 empty, 5647 destroy, 5648 opener, 5649 select, 5650 panel, 5651 container, 5652 }; 5653 5654 // Stores the plugin directly in the original select 5655 select.customSelect = container.customSelect; 5656 5657 // Returns the plugin instance, with the public exposed methods and properties 5658 return container.customSelect; 5659} 5660 5661function customSelect(element, customParams) { 5662 // Overrides the default options with the ones provided by the user 5663 const nodeList = []; 5664 const selects = []; 5665
5666 return (function init() { 5667 // The plugin is called on a single HTMLElement 5668 if (element && element instanceof HTMLElement && element.tagName.toUpperCase() === 'SELECT') { 5669 nodeList.push(element); 5670 // The plugin is called on a selector 5671 } else if (element && typeof element === 'string') { 5672 const elementsList = document.querySelectorAll(element); 5673 for (let i = 0, l = elementsList.length; i < l; ++i) { 5674 if (elementsList[i] instanceof HTMLElement 5675 && elementsList[i].tagName.toUpperCase() === 'SELECT') { 5676 nodeList.push(elementsList[i]); 5677 } 5678 } 5679 // The plugin is called on any HTMLElements list (NodeList, HTMLCollection, Array, etc.) 5680 } else if (element && element.length) { 5681 for (let i = 0, l = element.length; i < l; ++i) { 5682 if (element[i] instanceof HTMLElement 5683 && element[i].tagName.toUpperCase() === 'SELECT') { 5684 nodeList.push(element[i]); 5685 } 5686 } 5687 } 5688 5689 // Launches the plugin over every HTMLElement 5690 // And stores every plugin instance 5691 for (let i = 0, l = nodeList.length; i < l; ++i) { 5692 selects.push(builder(nodeList[i], Object.assign({}, defaultParams, customParams))); 5693 } 5694 5695 // Returns all plugin instances 5696 return selects; 5697 }()); 5698} 5699 5700// EXTERNAL MODULE: ./node_modules/headroom.js/dist/headroom.js 5701var dist_headroom = __webpack_require__(631); 5702var headroom_default = /*#__PURE__*/__webpack_require__.n(dist_headroom); 5703;// CONCATENATED MODULE: ./src/js/modules/helpers.js 5704 5705 5706function preventDefault() { 5707 var emptyLinks = document.querySelectorAll('a[href="#"]'); 5708 var forms = document.querySelectorAll('form'); 5709 5710 emptyLinks.forEach(function (link) { 5711 link.addEventListener('click', function (e) { 5712 e.preventDefault(); 5713 }); 5714 }); 5715 5716// forms.forEach(function (form) { 5717// form.addEventListener('submit', function (e) { 5718// e.preventDefault(); 5719// }); 5720// }); 5721} 5722 5723/* 5724function setContentMargin() { 5725 var pageContent = document.querySelector('main'); 5726 var header = document.querySelector('header'); 5727 var exception = document.querySelector('.hero'); 5728 5729 if (header) { 5730 if (header.dataset.page === 'home') { 5731 exception.style.height = "calc(100vh - ".concat(parseFloat(window.getComputedStyle(header).height), "px)"); 5732 pageContent.style.marginTop = window.getComputedStyle(header).height; 5733 } else { 5734 pageContent.style.marginTop = window.getComputedStyle(header).height; 5735 } 5736 } 5737} 5738 5739*/ 5740 5741function disableAnimationRepeat() { 5742 var animatedElems = document.querySelectorAll("[data-aos]"); 5743 5744 animatedElems.forEach(function (el) { 5745 if (!el.dataset.aosOnce) { 5746 el.setAttribute('data-aos-once', 'true'); 5747 } 5748 }); 5749} 5750 5751function setEdgePadding() { 5752 var container = document.querySelector('.container'); 5753 5754 var offsetLeft = parseFloat(window.getComputedStyle(container).marginLeft) + parseFloat(window.getComputedStyle(container).paddingLeft); 5755 var offsetRight = parseFloat(window.getComputedStyle(container).marginRight) + parseFloat(window.getComputedStyle(container).paddingRight); 5756 5757 return { left: offsetLeft, right: offsetRight }; 5758} 5759 5760function setCurrentYear() { 5761 var container = document.getElementById('currentYear'); 5762 5763 if (container) { 5764 container.textContent = String(new Date().getFullYear()); 5765 } 5766} 5767;// CONCATENATED MODULE: ./src/js/modules/nav.js 5768 5769 5770 5771 5772 5773function drawNav() { 5774 var header = document.querySelector('.header'); 5775 var menu = document.querySelector('.header_nav'); 5776 var menuTrigger = document.querySelector('.header_trigger'); 5777 var logo = document.querySelector('.header_logo'); 5778 5779 5780 menuTrigger.addEventListener('click', function () { 5781 menuTrigger.classList.toggle('active'); 5782 menu.classList.toggle('active'); 5783 document.documentElement.classList.toggle('fixed'); 5784 }); 5785 5786 function closeMenu() { 5787 menuTrigger.classList.remove('active'); 5788 menu.classList.remove('active'); 5789 document.documentElement.classList.remove('fixed'); 5790 } 5791 5792 function setElementMargin() { 5793 if (window.innerWidth < 992) { 5794 logo.style.marginLeft = "".concat(setEdgePadding().left, "px"); 5795 menuTrigger.style.marginRight = "".concat(setEdgePadding().right, "px"); 5796 } else {
5797 logo.style.marginLeft = "0px"; 5798 menuTrigger.style.marginRight = "0px"; 5799 } 5800 } 5801 5802 5803 initHeadroom(header); 5804 setActivePageClass(header); 5805 setDropdownMenu(); 5806 setElementMargin(); 5807 5808 window.addEventListener('resize', closeMenu); 5809 window.addEventListener('resize', setDropdownMenu); 5810 window.addEventListener('resize', setElementMargin); 5811} 5812 5813// hide header on scroll 5814function initHeadroom(headerEl) { 5815 var headroom = new (headroom_default())(headerEl, { 5816 offset: 500, 5817 classes: { 5818 pinned: "header--pinned", 5819 unpinned: "header--unpinned" } }); 5820 5821 5822 headroom.init(); 5823} 5824 5825// set activity class for the current page 5826function setActivePageClass(headerEl) { 5827 var menuListItems = document.querySelectorAll('.nav-item'); 5828 5829 menuListItems.forEach(function (item) { 5830 if (item.dataset.page === headerEl.dataset.page) { 5831 item.classList.add('active'); 5832 } 5833 }); 5834 5835} 5836 5837// dropdown menus (mobile/desktop) 5838function setDropdownMenu() { 5839 var dropdownElems = document.querySelectorAll('.dropdown'); 5840 var triggers = document.querySelectorAll('.dropdown-toggle'); 5841 var menuLists = document.querySelectorAll('.dropdown-menu'); 5842 5843 triggers.forEach(function (el, i) { 5844 5845 function closeMenu() { 5846 el.classList.remove('active'); 5847 menuLists[i].classList.remove('active'); 5848 } 5849 5850 if (window.innerWidth < 992) { 5851 el.addEventListener('click', function () { 5852 el.classList.toggle('active'); 5853 menuLists[i].classList.toggle('active'); 5854 }); 5855 window.addEventListener('resize', closeMenu); 5856 } else { 5857 window.addEventListener('resize', closeMenu); 5858 window.addEventListener('scroll', closeMenu); 5859 } 5860 5861 }); 5862 5863 5864 dropdownElems.forEach(function (el) { 5865 5866 el.addEventListener('mouseover', function (e) { 5867 var trigger = this.querySelector('a[data-bs-toggle]'); 5868 var menu = trigger.nextElementSibling; 5869 trigger.classList.add('active'); 5870 menu.classList.add('active'); 5871 }); 5872 5873 el.addEventListener('mouseleave', function (e) { 5874 var trigger = this.querySelector('a[data-bs-toggle]'); 5875 var menu = trigger.nextElementSibling; 5876 trigger.classList.remove('active'); 5877 menu.classList.remove('active'); 5878 }); 5879 }); 5880 5881} 5882 5883/* harmony default export */ const nav = (drawNav); 5884;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js 5885function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { 5886 try { 5887 var info = gen[key](arg); 5888 var value = info.value; 5889 } catch (error) { 5890 reject(error); 5891 return; 5892 } 5893 5894 if (info.done) { 5895 resolve(value); 5896 } else { 5897 Promise.resolve(value).then(_next, _throw); 5898 } 5899} 5900 5901function _asyncToGenerator(fn) { 5902 return function () { 5903 var self = this, 5904 args = arguments; 5905 return new Promise(function (resolve, reject) { 5906 var gen = fn.apply(self, args); 5907 5908 function _next(value) { 5909 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); 5910 } 5911 5912 function _throw(err) { 5913 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); 5914 } 5915 5916 _next(undefined); 5917 }); 5918 }; 5919} 5920// EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js 5921var regenerator = __webpack_require__(757); 5922var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator); 5923// EXTERNAL MODULE: ./node_modules/pickmeup/dist/pickmeup.min.js 5924var pickmeup_min = __webpack_require__(443); 5925var pickmeup_min_default = /*#__PURE__*/__webpack_require__.n(pickmeup_min); 5926;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js 5927function _defineProperty(obj, key, value) { 5928 if (key in obj) { 5929 Object.defineProperty(obj, key, { 5930 value: value, 5931 enumerable: true, 5932 configurable: true, 5933 writable: true 5934 }); 5935 } else { 5936 obj[key] = value; 5937 } 5938 5939 return obj; 5940} 5941// EXTERNAL MODULE: ./node_modules/sweetalert2/dist/sweetalert2.js 5942var sweetalert2 = __webpack_require__(764); 5943var sweetalert2_default = /*#__PURE__*/__webpack_require__.n(sweetalert2); 5944;// CONCATENATED MODULE: ./src/js/modules/notification.js 5945function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);enumerableOnly && (symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;})), keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = null != arguments[i] ? arguments[i] : {};
5945i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {_defineProperty(target, key, source[key]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}return target;} 5946 5947 5948 5949function drawNotification(settings, alertText) { 5950 sweetalert2_default().fire(_objectSpread({ 5951 showClass: { 5952 popup: 'fadeIn' }, 5953 5954 hideClass: { 5955 popup: 'fadeOut' }, 5956 5957 showConfirmButton: false, 5958 showCloseButton: true, 5959 closeButtonHtml: "\n <i class=\"icon-close\"></i>\n ", 5960 5961 5962 html: "\n <p class=\"main\">".concat( 5963 alertText ? alertText : '', "</p>") }, 5964 settings)); 5965 5966} 5967 5968/* harmony default export */ const modules_notification = (drawNotification); 5969;// CONCATENATED MODULE: ./src/js/modules/forms.js 5970 5971 5972var emailRegExp = /^\w+([-]?\w+)*@\w+([-]?\w+)*(\.\w{2,3})+$/; 5973 5974 5975function 5976 5977sendForm(_x) {return _sendForm.apply(this, arguments);}function _sendForm() {_sendForm = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee(form) {var handler, response;return regenerator_default().wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0: 5978 handler = form.getAttribute('action');if (!( 5979 handler !== '' && handler !== '#')) {_context.next = 6;break;}_context.next = 4;return ( 5980 fetch( 5981 handler, 5982 { 5983 method: 'POST', 5984 body: new FormData(form) }));case 4:response = _context.sent; 5985 5986 5987 if (response.ok) { 5988 form.reset(); 5989 }case 6:case "end":return _context.stop();}}}, _callee);}));return _sendForm.apply(this, arguments);} 5990 5991 5992 5993// function validateForm(target) {var fieldSelector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '.field'; 5994// var form = document.querySelector(target); 5995// var inputsArr = document.querySelectorAll("".concat(target, " ").concat(fieldSelector)); 5996 5997// var notificationText = ''; 5998// var notification = { 5999// title: "Thank you!", 6000// toast: true, 6001// position: 'top-end', 6002// timer: 3000, 6003// customClass: { 6004// popup: 'alert_popup', 6005// title: 'alert_popup-title', 6006// htmlContainer: 'alert_popup-content', 6007// closeButton: 'alert_popup-close', 6008// container: 'alert_popup-container' } }; 6009 6010 6011 6012// var valid = function valid(elem) {return !elem.classList.contains('error');}; 6013 6014// if (form) { 6015// form.addEventListener('submit', function () {var _loop = function _loop( 6016// i) { 6017// var el = inputsArr[i]; 6018// var value = el.value; 6019// if (el.classList.contains('required') && value === '') { 6020// el.classList.add('error'); 6021// el.classList.remove('error'); 6022// } else if (el.dataset.type === 'email' && !emailRegExp.test(value)) { 6023// el.classList.add('error'); 6024// el.classList.remove('error'); 6025// } else if (el.dataset.type === 'tel' && isNaN(+value)) { 6026// el.classList.add('error'); 6027// el.classList.remove('error'); 6028// } 6029 6030// el.addEventListener('input', function () { 6031// el.classList.remove('error'); 6032// });};for (var i = 0; i < inputsArr.length; i++) {_loop(i); 6033// } 6034 6035// if (Array.from(inputsArr).every(valid)) { 6036// inputsArr.forEach(function (el) { 6037// el.classList.remove('error'); 6038// }); 6039// if (form.dataset.type === 'newsletter') { 6040// notificationText = 'Now you\'re subscribed to our newsletter.'; 6041// } else if (form.dataset.type === 'feedback') { 6042// notificationText = 'Your message has been sent. We\'ll reply you as soon as possible.'; 6043// } else if (form.dataset.type === 'reply') { 6044// notificationText = 'Your comment is awaiting moderation.'; 6045// } 6046// modules_notification(notification, notificationText); 6047// sendForm(form); 6048// } 6049// }); 6050// } 6051// } 6052 6053function applyDatepicker() {var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '[data-type="date"]'; 6054 var currentDate = new Date(); 6055 pickmeup_min_default()(selector, { 6056 render: function render(date) { 6057 if (date < currentDate) { 6058 return { disabled: true, class_name: 'date-in-past' }; 6059 } 6060 return {}; 6061 }, 6062 default_date: false, 6063 hide_on_select: true }); 6064 6065} 6066
6067function saveFormValues() { 6068 var serviceSelect = document.querySelector('#contactsService').customSelect, 6069 serviceValue = document.querySelector('#contactsServiceValue'), 6070 datePicker = document.querySelector('#contactsDate'), 6071 dateValue = document.querySelector('#contactsDateValue'); 6072 6073 serviceValue.value = serviceSelect.select.value; 6074 6075 serviceSelect.select.addEventListener('change', function (e) { 6076 serviceValue.value = e.target.value; 6077 }); 6078 6079 datePicker.addEventListener('pickmeup-change', function (e) { 6080 dateValue.value = e.detail.formatted_date; 6081 }); 6082 6083} 6084;// CONCATENATED MODULE: ./src/js/common.js 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096var pageHeader = document.querySelector('.header'); 6097 6098 6099document.addEventListener('DOMContentLoaded', function () { 6100 //setContentMargin(); 6101 6102 if (pageHeader !== null) { 6103 nav(); 6104 } 6105 6106 preventDefault(); 6107 svg4everybody_default()(); 6108 var lazyload = new (lazyload_min_default())(); 6109 6110 aos_default().init({ 6111 offset: 60, // offset (in px) from the original trigger point 6112 delay: 0, // values from 0 to 3000, with step 50ms 6113 duration: 600, // values from 0 to 3000, with step 50ms 6114 easing: 'ease' // default easing for AOS animations 6115 }); 6116 disableAnimationRepeat(); 6117 6118 //window.addEventListener('resize', setContentMargin); 6119 6120 applyDatepicker(); 6121 customSelect('select'); 6122// validateForm('.footer_newsletter-form'); 6123// validateForm('.post_main-reply_form'); 6124// validateForm('.contacts_main-form'); 6125 setCurrentYear(); 6126}); 6127})(); 6128 6129/******/ })() 6130;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.