1 2; /* Start:"a:4:{s:4:"full";s:72:"/local/templates/rr-wheels_corp/js/swiper-bundle.min.js?1775202386139064";s:6:"source";s:55:"/local/templates/rr-wheels_corp/js/swiper-bundle.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 3/** 4 * Swiper 8.0.6 5 * Most modern mobile touch slider and framework with hardware accelerated transitions 6 * https://swiperjs.com 7 * 8 * Copyright 2014-2022 Vladimir Kharlampidi 9 * 10 * Released under the MIT License 11 * 12 * Released on: February 14, 2022 13 */ 14
vendor: 110,491 bytes, line 15
15!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Swiper=t()}(this,(function(){"use strict";function e(e){return null!==e&&"object"==typeof e&&"constructor"in e&&e.constructor===Object}function t(s,a){void 0===s&&(s={}),void 0===a&&(a={}),Object.keys(a).forEach((i=>{void 0===s[i]?s[i]=a[i]:e(a[i])&&e(s[i])&&Object.keys(a[i]).length>0&&t(s[i],a[i])}))}const s={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector:()=>null,querySelectorAll:()=>[],getElementById:()=>null,createEvent:()=>({initEvent(){}}),createElement:()=>({children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName:()=>[]}),createElementNS:()=>({}),importNode:()=>null,location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function a(){const e="undefined"!=typeof document?document:{};return t(e,s),e}const i={document:s,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle:()=>({getPropertyValue:()=>""}),Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia:()=>({}),requestAnimationFrame:e=>"undefined"==typeof setTimeout?(e(),null):setTimeout(e,0),cancelAnimationFrame(e){"undefined"!=typeof setTimeout&&clearTimeout(e)}};function r(){const e="undefined"!=typeof window?window:{};return t(e,i),e}class n extends Array{constructor(e){"number"==typeof e?super(e):(super(...e||[]),function(e){const t=e.__proto__;Object.defineProperty(e,"__proto__",{get:()=>t,set(e){t.__proto__=e}})}(this))}}function l(e){void 0===e&&(e=[]);const t=[];return e.forEach((e=>{Array.isArray(e)?t.push(...l(e)):t.push(e)})),t}function o(e,t){return Array.prototype.filter.call(e,t)}function d(e,t){const s=r(),i=a();let l=[];if(!t&&e instanceof n)return e;if(!e)return new n(l);if("string"==typeof e){const s=e.trim();if(s.indexOf("<")>=0&&s.indexOf(">")>=0){let e="div";0===s.indexOf("<li")&&(e="ul"),0===s.indexOf("<tr")&&(e="tbody"),0!==s.indexOf("<td")&&0!==s.indexOf("<th")||(e="tr"),0===s.indexOf("<tbody")&&(e="table"),0===s.indexOf("<option")&&(e="select");const t=i.createElement(e);t.innerHTML=s;for(let e=0;e<t.childNodes.length;e+=1)l.push(t.childNodes[e])}else l=function(e,t){if("string"!=typeof e)return[e];const s=[],a=t.querySelectorAll(e);for(let e=0;e<a.length;e+=1)s.push(a[e]);return s}(e.trim(),t||i)}else if(e.nodeType||e===s||e===i)l.push(e);else if(Array.isArray(e)){if(e instanceof n)return e;l=e}return new n(function(e){const t=[];for(let s=0;s<e.length;s+=1)-1===t.indexOf(e[s])&&t.push(e[s]);return t}(l))}d.fn=n.prototype;const c={addClass:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];const a=l(t.map((e=>e.split(" "))));return this.forEach((e=>{e.classList.add(...a)})),this},removeClass:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];const a=l(t.map((e=>e.split(" "))));return this.forEach((e=>{e.classList.remove(...a)})),this},hasClass:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];const a=l(t.map((e=>e.split(" "))));return o(this,(e=>a.filter((t=>e.classList.contains(t))).length>0)).length>0},toggleClass:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];const a=l(t.map((e=>e.split(" "))));this.forEach((e=>{a.forEach((t=>{e.classList.toggle(t)}))}))},attr:function(e,t){if(1===arguments.length&&"string"==typeof e)return this[0]?this[0].getAttribute(e):void 0;for(let s=0;s<this.length;s+=1)if(2===arguments.length)this[s].setAttribute(e,t);else for(const t in e)this[s][t]=e[t],this[s].setAttribute(t,e[t]);return this},removeAttr:function(e){for(let t=0;t<this.length;t+=1)this[t].removeAttribute(e);return this},transform:function(e){for(let t=0;t<this.length;t+=1)this[t].style.transform=e;return this},transition:function(e){for(let t=0;t<this.length;t+=1)this[t].style.transitionDuration="string"!=typeof e?`${e}ms`:e;return this},on:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];let[a,i,r,n]=t;function l(e){const t=e.target;if(!t)return;const s=e.target.dom7EventData||[];if(s.indexOf(e)<0&&s.unshift(e),d(t).is(i))r.apply(t,s);else{const e=d(t).parents();for(let t=0;t<e.length;t+=1)d(e[t]).is(i)&&r.apply(e[t],s)}}function o(e){const t=e&&e.target&&e.target.dom7EventData||[];t.indexOf(e)<0&&t.unshift(e),r.apply(this,t)}"function"==typeof t[1]&&([a,r,n]=t,i=void 0),n||(n=!1);const c=a.split(" ");let p;for(let e=0;e<this.length;e+=1){const t=this[e];if(i)for(p=0;p<c.length;p+=1){const e=c[p];t.dom7LiveListeners||(t.dom7LiveListeners={}),t.dom7LiveListeners[e]||(t.dom7LiveListeners[e]=[]),t.dom7LiveListeners[e].push({listener:r,proxyListener:l}),t.addEventListener(e,l,n)}else for(p=0;p<c.length;p+=1){const e=c[p];t.dom7Listeners||(t.dom7Listeners={}),t.dom7Listeners[e]||(t.dom7Listeners[e]=[]),t.dom7Listeners[e].push({listener:r,proxyListener:o}),t.addEventListener(e,o,n)}}return this},off:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];let[a,i,r,n]=t;"function"==typeof t[1]&&([a,r,n]=t,i=void 0),n||(n=!1);const l=a.split(" ");for(let e=0;e<l.length;e+=1){const t=l[e];for(let e=0;e<this.length;e+=1){const s=this[e];let a;if(!i&&s.dom7Listeners?a=s.dom7Listeners[t]:i&&s.dom7LiveListeners&&(a=s.dom7LiveListeners[t]),a&&a.length)for(let e=a.length-1;e>=0;e-=1){const i=a[e];r&&i.listener===r||r&&i.listener&&i.listener.dom7proxy&&i.listener.dom7proxy===r?(s.removeEventListener(t,i.proxyListener,n),a.splice(e,1)):r||(s.removeEventListener(t,i.proxyListener,n),a.splice(e,1))}}}return this},trigger:function(){const e=r();for(var t=arguments.length,s=new Array(t),a=0;a<t;a++)s[a]=arguments[a];const i=s[0].split(" "),n=s[1];for(let t=0;t<i.length;t+=1){const a=i[t];for(let t=0;t<this.length;t+=1){const i=this[t];if(e.CustomEvent){const t=new e.CustomEvent(a,{detail:n,bubbles:!0,cancelable:!0});i.dom7EventData=s.filter(((e,t)=>t>0)),i.dispatchEvent(t),i.dom7EventData=[],delete i.dom7EventData}}}return this},transitionEnd:function(e){const t=this;return e&&t.on("transitionend",(function s(a){a.target===this&&(e.call(this,a),t.off("transitionend",s))})),this},outerWidth:function(e){if(this.length>0){if(e){const e=this.styles();return this[0].offsetWidth+parseFloat(e.getPropertyValue("margin-right"))+parseFloat(e.getPropertyValue("margin-left"))}return this[0].offsetWidth}return null},outerHeight:function(e){if(this.length>0){if(e){const e=this.styles();return this[0].offsetHeight+parseFloat(e.getPropertyValue("margin-top"))+parseFloat(e.getPropertyValue("margin-bottom"))}return this[0].offsetHeight}return null},styles:function(){const e=r();return this[0]?e.getComputedStyle(this[0],null):{}},offset:function(){if(this.length>0){const e=r(),t=a(),s=this[0],i=s.getBoundingClientRect(),n=t.body,l=s.clientTop||n.clientTop||0,o=s.clientLeft||n.clientLeft||0,d=s===e?e.scrollY:s.scrollTop,c=s===e?e.scrollX:s.scrollLeft;return{top:i.top+d-l,left:i.left+c-o}}return null},css:function(e,t){const s=r();let a;if(1===arguments.length){if("string"!=typeof e){for(a=0;a<this.length;a+=1)for(const t in e)this[a].style[t]=e[t];return this}if(this[0])return s.getComputedStyle(this[0],null).getPropertyValue(e)}if(2===arguments.length&&"string"==typeof e){for(a=0;a<this.length;a+=1)this[a].style[e]=t;return this}return this},each:function(e){return e?(this.forEach(((t,s)=>{e.apply(t,[t,s])})),this):this},html:function(e){if(void 0===e)return this[0]?this[0].innerHTML:null;for(let t=0;t<this.length;t+=1)this[t].innerHTML=e;return this},text:function(e){if(void 0===e)return this[0]?this[0].textContent.trim():null;for(let t=0;t<this.length;t+=1)this[t].textContent=e;return this},is:function(e){const t=r(),s=a(),i=this[0];let l,o;if(!i||void 0===e)return!1;if("string"==typeof e){if(i.matches)return i.matches(e);if(i.webkitMatchesSelector)return i.webkitMatchesSelector(e);if(i.msMatchesSelector)return i.msMatchesSelector(e);for(l=d(e),o=0;o<l.length;o+=1)if(l[o]===i)return!0;return!1}if(e===s)return i===s;if(e===t)return i===t;if(e.nodeType||e instanceof n){for(l=e.nodeType?[e]:e,o=0;o<l.length;o+=1)if(l[o]===i)return!0;return!1}return!1},index:function(){let e,t=this[0];if(t){for(e=0;null!==(t=t.previousSibling);)1===t.nodeType&&(e+=1);return e}},eq:function(e){if(void 0===e)return this;const t=this.length;if(e>t-1)return d([]);if(e<0){const s=t+e;return d(s<0?[]:[this[s]])}return d([this[e]])},append:function(){let e;const t=a();for(let s=0;s<arguments.length;s+=1){e=s<0||arguments.length<=s?void 0:arguments[s];for(let s=0;s<this.length;s+=1)if("string"==typeof e){const a=t.createElement("div");for(a.innerHTML=e;a.firstChild;)this[s].appendChild(a.firstChild)}else if(e instanceof n)for(let t=0;t<e.length;t+=1)this[s].appendChild(e[t]);else this[s].appendChild(e)}return this},prepend:function(e){const t=a();let s,i;for(s=0;s<this.length;s+=1)if("string"==typeof e){const a=t.createElement("div");for(a.innerHTML=e,i=a.childNodes.length-1;i>=0;i-=1)this[s].insertBefore(a.childNodes[i],this[s].childNodes[0])}else if(e instanceof n)for(i=0;i<e.length;i+=1)this[s].insertBefore(e[i],this[s].childNodes[0]);else this[s].insertBefore(e,this[s].childNodes[0]);return this},next:function(e){return this.length>0?e?this[0].nextElementSibling&&d(this[0].nextElementSibling).is(e)?d([this[0].nextElementSibling]):d([]):this[0].nextElementSibling?d([this[0].nextElementSibling]):d([]):d([])},nextAll:function(e){const t=[];let s=this[0];if(!s)return d([]);for(;s.nextElementSibling;){const a=s.nextElementSibling;e?d(a).is(e)&&t.push(a):t.push(a),s=a}return d(t)},prev:function(e){if(this.length>0){const t=this[0];return e?t.previousElementSibling&&d(t.previousElementSibling).is(e)?d([t.previousElementSibling]):d([]):t.previousElementSibling?d([t.previousElementSibling]):d([])}return d([])},prevAll:function(e){const t=[];let s=this[0];if(!s)return d([]);for(;s.previousElementSibling;){const a=s.previousElementSibling;e?d(a).is(e)&&t.push(a):t.push(a),s=a}return d(t)},parent:function(e){const t=[];for(let s=0;s<this.length;s+=1)null!==this[s].parentNode&&(e?d(this[s].parentNode).is(e)&&t.push(this[s].parentNode):t.push(this[s].parentNode));return d(t)},parents:function(e){const t=[];for(let s=0;s<this.length;s+=1){let a=this[s].parentNode;for(;a;)e?d(a).is(e)&&t.push(a):t.push(a),a=a.parentNode}return d(t)},closest:function(e){let t=this;return void 0===e?d([]):(t.is(e)||(t=t.parents(e).eq(0)),t)},find:function(e){const t=[];for(let s=0;s<this.length;s+=1){const a=this[s].querySelectorAll(e);for(let e=0;e<a.length;e+=1)t.push(a[e])}return d(t)},children:function(e){const t=[];for(let s=0;s<this.length;s+=1){const a=this[s].children;for(let s=0;s<a.length;s+=1)e&&!d(a[s]).is(e)||t.push(a[s])}return d(t)},filter:function(e){return d(o(this,e))},remove:function(){for(let e=0;e<this.length;e+=1)this[e].parentNode&&this[e].parentNode.removeChild(this[e]);return this}};function p(e,t){return void 0===t&&(t=0),setTimeout(e,t)}function u(){return Date.now()}function h(e,t){void 0===t&&(t="x");const s=r();let a,i,n;const l=function(e){const t=r();let s;return t.getComputedStyle&&(s=t.getComputedStyle(e,null)),!s&&e.currentStyle&&(s=e.currentStyle),s||(s=e.style),s}(e);return s.WebKitCSSMatrix?(i=l.transform||l.webkitTransform,i.split(",").length>6&&(i=i.split(", ").map((e=>e.replace(",","."))).join(", ")),n=new s.WebKitCSSMatrix("none"===i?"":i)):(n=l.MozTransform||l.OTransform||l.MsTransform||l.msTransform||l.transform||l.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),a=n.toString().split(",")),"x"===t&&(i=s.WebKitCSSMatrix?n.m41:16===a.length?parseFloat(a[12]):parseFloat(a[4])),"y"===t&&(i=s.WebKitCSSMatrix?n.m42:16===a.length?parseFloat(a[13]):parseFloat(a[5])),i||0}function m(e){return"object"==typeof e&&null!==e&&e.constructor&&"Object"===Object.prototype.toString.call(e).slice(8,-1)}function f(e){return"undefined"!=typeof window&&void 0!==window.HTMLElement?e instanceof HTMLElement:e&&(1===e.nodeType||11===e.nodeType)}function g(){const e=Object(arguments.length<=0?void 0:arguments[0]),t=["__proto__","constructor","prototype"];for(let s=1;s<arguments.length;s+=1){const a=s<0||arguments.length<=s?void 0:arguments[s];if(null!=a&&!f(a)){const s=Object.keys(Object(a)).filter((e=>t.indexOf(e)<0));for(let t=0,i=s.length;t<i;t+=1){const i=s[t],r=Object.getOwnPropertyDescriptor(a,i);void 0!==r&&r.enumerable&&(m(e[i])&&m(a[i])?a[i].__swiper__?e[i]=a[i]:g(e[i],a[i]):!m(e[i])&&m(a[i])?(e[i]={},a[i].__swiper__?e[i]=a[i]:g(e[i],a[i])):e[i]=a[i])}}}return e}function v(e,t,s){e.style.setProperty(t,s)}function w(e){let{swiper:t,targetPosition:s,side:a}=e;const i=r(),n=-t.translate;let l,o=null;const d=t.params.speed;t.wrapperEl.style.scrollSnapType="none",i.cancelAnimationFrame(t.cssModeFrameID);const c=s>n?"next":"prev",p=(e,t)=>"next"===c&&e>=t||"prev"===c&&e<=t,u=()=>{l=(new Date).getTime(),null===o&&(o=l);const e=Math.max(Math.min((l-o)/d,1),0),r=.5-Math.cos(e*Math.PI)/2;let c=n+r*(s-n);if(p(c,s)&&(c=s),t.wrapperEl.scrollTo({[a]:c}),p(c,s))return t.wrapperEl.style.overflow="hidden",t.wrapperEl.style.scrollSnapType="",setTimeout((()=>{t.wrapperEl.style.overflow="",t.wrapperEl.scrollTo({[a]:c})})),void i.cancelAnimationFrame(t.cssModeFrameID);t.cssModeFrameID=i.requestAnimationFrame(u)};u()}let b,x,y;function E(){return b||(b=function(){const e=r(),t=a();return{smoothScroll:t.documentElement&&"scrollBehavior"in t.documentElement.style,touch:!!("ontouchstart"in e||e.DocumentTouch&&t instanceof e.DocumentTouch),passiveListener:function(){let t=!1;try{const s=Object.defineProperty({},"passive",{get(){t=!0}});e.addEventListener("testPassiveListener",null,s)}catch(e){}return t}(),gestures:"ongesturestart"in e}}()),b}function T(e){return void 0===e&&(e={}),x||(x=function(e){let{userAgent:t}=void 0===e?{}:e;const s=E(),a=r(),i=a.navigator.platform,n=t||a.navigator.userAgent,l={ios:!1,android:!1},o=a.screen.width,d=a.screen.height,c=n.match(/(Android);?[\s\/]+([\d.]+)?/);let p=n.match(/(iPad).*OS\s([\d_]+)/);const u=n.match(/(iPod)(.*OS\s([\d_]+))?/),h=!p&&n.match(/(iPhone\sOS|iOS)\s([\d_]+)/),m="Win32"===i;let f="MacIntel"===i;return!p&&f&&s.touch&&["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"].indexOf(`${o}x${d}`)>=0&&(p=n.match(/(Version)\/([\d.]+)/),p||(p=[0,1,"13_0_0"]),f=!1),c&&!m&&(l.os="android",l.android=!0),(p||h||u)&&(l.os="ios",l.ios=!0),l}(e)),x}function C(){return y||(y=function(){const e=r();return{isSafari:function(){const t=e.navigator.userAgent.toLowerCase();return t.indexOf("safari")>=0&&t.indexOf("chrome")<0&&t.indexOf("android")<0}(),isWebView:/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(e.navigator.userAgent)}}()),y}Object.keys(c).forEach((e=>{Object.defineProperty(d.fn,e,{value:c[e],writable:!0})}));var $={on(e,t,s){const a=this;if("function"!=typeof t)return a;const i=s?"unshift":"push";return e.split(" ").forEach((e=>{a.eventsListeners[e]||(a.eventsListeners[e]=[]),a.eventsListeners[e][i](t)})),a},once(e,t,s){const a=this;if("function"!=typeof t)return a;function i(){a.off(e,i),i.__emitterProxy&&delete i.__emitterProxy;for(var s=arguments.length,r=new Array(s),n=0;n<s;n++)r[n]=arguments[n];t.apply(a,r)}return i.__emitterProxy=t,a.on(e,i,s)},onAny(e,t){const s=this;if("function"!=typeof e)return s;const a=t?"unshift":"push";return s.eventsAnyListeners.indexOf(e)<0&&s.eventsAnyListeners[a](e),s},offAny(e){const t=this;if(!t.eventsAnyListeners)return t;const s=t.eventsAnyListeners.indexOf(e);return s>=0&&t.eventsAnyListeners.splice(s,1),t},off(e,t){const s=this;return s.eventsListeners?(e.split(" ").forEach((e=>{void 0===t?s.eventsListeners[e]=[]:s.eventsListeners[e]&&s.eventsListeners[e].forEach(((a,i)=>{(a===t||a.__emitterProxy&&a.__emitterProxy===t)&&s.eventsListeners[e].splice(i,1)}))})),s):s},emit(){const e=this;if(!e.eventsListeners)return e;let t,s,a;for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];"string"==typeof r[0]||Array.isArray(r[0])?(t=r[0],s=r.slice(1,r.length),a=e):(t=r[0].events,s=r[0].data,a=r[0].context||e),s.unshift(a);return(Array.isArray(t)?t:t.split(" ")).forEach((t=>{e.eventsAnyListeners&&e.eventsAnyListeners.length&&e.eventsAnyListeners.forEach((e=>{e.apply(a,[t,...s])})),e.eventsListeners&&e.eventsListeners[t]&&e.eventsListeners[t].forEach((e=>{e.apply(a,s)}))})),e}};var S={updateSize:function(){const e=this;let t,s;const a=e.$el;t=void 0!==e.params.width&&null!==e.params.width?e.params.width:a[0].clientWidth,s=void 0!==e.params.height&&null!==e.params.height?e.params.height:a[0].clientHeight,0===t&&e.isHorizontal()||0===s&&e.isVertical()||(t=t-parseInt(a.css("padding-left")||0,10)-parseInt(a.css("padding-right")||0,10),s=s-parseInt(a.css("padding-top")||0,10)-parseInt(a.css("padding-bottom")||0,10),Number.isNaN(t)&&(t=0),Number.isNaN(s)&&(s=0),Object.assign(e,{width:t,height:s,size:e.isHorizontal()?t:s}))},updateSlides:function(){const e=this;function t(t){return e.isHorizontal()?t:{width:"height","margin-top":"margin-left","margin-bottom ":"margin-right","margin-left":"margin-top","margin-right":"margin-bottom","padding-left":"padding-top","padding-right":"padding-bottom",marginRight:"marginBottom"}[t]}function s(e,s){return parseFloat(e.getPropertyValue(t(s))||0)}const a=e.params,{$wrapperEl:i,size:r,rtlTranslate:n,wrongRTL:l}=e,o=e.virtual&&a.virtual.enabled,d=o?e.virtual.slides.length:e.slides.length,c=i.children(`.${e.params.slideClass}`),p=o?e.virtual.slides.length:c.length;let u=[];const h=[],m=[];let f=a.slidesOffsetBefore;"function"==typeof f&&(f=a.slidesOffsetBefore.call(e));let g=a.slidesOffsetAfter;"function"==typeof g&&(g=a.slidesOffsetAfter.call(e));const w=e.snapGrid.length,b=e.slidesGrid.length;let x=a.spaceBetween,y=-f,E=0,T=0;if(void 0===r)return;"string"==typeof x&&x.indexOf("%")>=0&&(x=parseFloat(x.replace("%",""))/100*r),e.virtualSize=-x,n?c.css({marginLeft:"",marginBottom:"",marginTop:""}):c.css({marginRight:"",marginBottom:"",marginTop:""}),a.centeredSlides&&a.cssMode&&(v(e.wrapperEl,"--swiper-centered-offset-before",""),v(e.wrapperEl,"--swiper-centered-offset-after",""));const C=a.grid&&a.grid.rows>1&&e.grid;let $;C&&e.grid.initSlides(p);const S="auto"===a.slidesPerView&&a.breakpoints&&Object.keys(a.breakpoints).filter((e=>void 0!==a.breakpoints[e].slidesPerView)).length>0;for(let i=0;i<p;i+=1){$=0;const n=c.eq(i);if(C&&e.grid.updateSlide(i,n,p,t),"none"!==n.css("display")){if("auto"===a.slidesPerView){S&&(c[i].style[t("width")]="");const r=getComputedStyle(n[0]),l=n[0].style.transform,o=n[0].style.webkitTransform;if(l&&(n[0].style.transform="none"),o&&(n[0].style.webkitTransform="none"),a.roundLengths)$=e.isHorizontal()?n.outerWidth(!0):n.outerHeight(!0);else{const e=s(r,"width"),t=s(r,"padding-left"),a=s(r,"padding-right"),i=s(r,"margin-left"),l=s(r,"margin-right"),o=r.getPropertyValue("box-sizing");if(o&&"border-box"===o)$=e+i+l;else{const{clientWidth:s,offsetWidth:r}=n[0];$=e+t+a+i+l+(r-s)}}l&&(n[0].style.transform=l),o&&(n[0].style.webkitTransform=o),a.roundLengths&&($=Math.floor($))}else $=(r-(a.slidesPerView-1)*x)/a.slidesPerView,a.roundLengths&&($=Math.floor($)),c[i]&&(c[i].style[t("width")]=`${$}px`);c[i]&&(c[i].swiperSlideSize=$),m.push($),a.centeredSlides?(y=y+$/2+E/2+x,0===E&&0!==i&&(y=y-r/2-x),0===i&&(y=y-r/2-x),Math.abs(y)<.001&&(y=0),a.roundLengths&&(y=Math.floor(y)),T%a.slidesPerGroup==0&&u.push(y),h.push(y)):(a.roundLengths&&(y=Math.floor(y)),(T-Math.min(e.params.slidesPerGroupSkip,T))%e.params.slidesPerGroup==0&&u.push(y),h.push(y),y=y+$+x),e.virtualSize+=$+x,E=$,T+=1}}if(e.virtualSize=Math.max(e.virtualSize,r)+g,n&&l&&("slide"===a.effect||"coverflow"===a.effect)&&i.css({width:`${e.virtualSize+a.spaceBetween}px`}),a.setWrapperSize&&i.css({[t("width")]:`${e.virtualSize+a.spaceBetween}px`}),C&&e.grid.updateWrapperSize($,u,t),!a.centeredSlides){const t=[];for(let s=0;s<u.length;s+=1){let i=u[s];a.roundLengths&&(i=Math.floor(i)),u[s]<=e.virtualSize-r&&t.push(i)}u=t,Math.floor(e.virtualSize-r)-Math.floor(u[u.length-1])>1&&u.push(e.virtualSize-r)}if(0===u.length&&(u=[0]),0!==a.spaceBetween){const s=e.isHorizontal()&&n?"marginLeft":t("marginRight");c.filter(((e,t)=>!a.cssMode||t!==c.length-1)).css({[s]:`${x}px`})}if(a.centeredSlides&&a.centeredSlidesBounds){let e=0;m.forEach((t=>{e+=t+(a.spaceBetween?a.spaceBetween:0)})),e-=a.spaceBetween;const t=e-r;u=u.map((e=>e<0?-f:e>t?t+g:e))}if(a.centerInsufficientSlides){let e=0;if(m.forEach((t=>{e+=t+(a.spaceBetween?a.spaceBetween:0)})),e-=a.spaceBetween,e<r){const t=(r-e)/2;u.forEach(((e,s)=>{u[s]=e-t})),h.forEach(((e,s)=>{h[s]=e+t}))}}if(Object.assign(e,{slides:c,snapGrid:u,slidesGrid:h,slidesSizesGrid:m}),a.centeredSlides&&a.cssMode&&!a.centeredSlidesBounds){v(e.wrapperEl,"--swiper-centered-offset-before",-u[0]+"px"),v(e.wrapperEl,"--swiper-centered-offset-after",e.size/2-m[m.length-1]/2+"px");const t=-e.snapGrid[0],s=-e.slidesGrid[0];e.snapGrid=e.snapGrid.map((e=>e+t)),e.slidesGrid=e.slidesGrid.map((e=>e+s))}if(p!==d&&e.emit("slidesLengthChange"),u.length!==w&&(e.params.watchOverflow&&e.checkOverflow(),e.emit("snapGridLengthChange")),h.length!==b&&e.emit("slidesGridLengthChange"),a.watchSlidesProgress&&e.updateSlidesOffset(),!(o||a.cssMode||"slide"!==a.effect&&"fade"!==a.effect)){const t=`${a.containerModifierClass}backface-hidden`,s=e.$el.hasClass(t);p<=a.maxBackfaceHiddenSlides?s||e.$el.addClass(t):s&&e.$el.removeClass(t)}},updateAutoHeight:function(e){const t=this,s=[],a=t.virtual&&t.params.virtual.enabled;let i,r=0;"number"==typeof e?t.setTransition(e):!0===e&&t.setTransition(t.params.speed);const n=e=>a?t.slides.filter((t=>parseInt(t.getAttribute("data-swiper-slide-index"),10)===e))[0]:t.slides.eq(e)[0];if("auto"!==t.params.slidesPerView&&t.params.slidesPerView>1)if(t.params.centeredSlides)t.visibleSlides.each((e=>{s.push(e)}));else for(i=0;i<Math.ceil(t.params.slidesPerView);i+=1){const e=t.activeIndex+i;if(e>t.slides.length&&!a)break;s.push(n(e))}else s.push(n(t.activeIndex));for(i=0;i<s.length;i+=1)if(void 0!==s[i]){const e=s[i].offsetHeight;r=e>r?e:r}(r||0===r)&&t.$wrapperEl.css("height",`${r}px`)},updateSlidesOffset:function(){const e=this,t=e.slides;for(let s=0;s<t.length;s+=1)t[s].swiperSlideOffset=e.isHorizontal()?t[s].offsetLeft:t[s].offsetTop},updateSlidesProgress:function(e){void 0===e&&(e=this&&this.translate||0);const t=this,s=t.params,{slides:a,rtlTranslate:i,snapGrid:r}=t;if(0===a.length)return;void 0===a[0].swiperSlideOffset&&t.updateSlidesOffset();let n=-e;i&&(n=e),a.removeClass(s.slideVisibleClass),t.visibleSlidesIndexes=[],t.visibleSlides=[];for(let e=0;e<a.length;e+=1){const l=a[e];let o=l.swiperSlideOffset;s.cssMode&&s.centeredSlides&&(o-=a[0].swiperSlideOffset);const d=(n+(s.centeredSlides?t.minTranslate():0)-o)/(l.swiperSlideSize+s.spaceBetween),c=(n-r[0]+(s.centeredSlides?t.minTranslate():0)-o)/(l.swiperSlideSize+s.spaceBetween),p=-(n-o),u=p+t.slidesSizesGrid[e];(p>=0&&p<t.size-1||u>1&&u<=t.size||p<=0&&u>=t.size)&&(t.visibleSlides.push(l),t.visibleSlidesIndexes.push(e),a.eq(e).addClass(s.slideVisibleClass)),l.progress=i?-d:d,l.originalProgress=i?-c:c}t.visibleSlides=d(t.visibleSlides)},updateProgress:function(e){const t=this;if(void 0===e){const s=t.rtlTranslate?-1:1;e=t&&t.translate&&t.translate*s||0}const s=t.params,a=t.maxTranslate()-t.minTranslate();let{progress:i,isBeginning:r,isEnd:n}=t;const l=r,o=n;0===a?(i=0,r=!0,n=!0):(i=(e-t.minTranslate())/a,r=i<=0,n=i>=1),Object.assign(t,{progress:i,isBeginning:r,isEnd:n}),(s.watchSlidesProgress||s.centeredSlides&&s.autoHeight)&&t.updateSlidesProgress(e),r&&!l&&t.emit("reachBeginning toEdge"),n&&!o&&t.emit("reachEnd toEdge"),(l&&!r||o&&!n)&&t.emit("fromEdge"),t.emit("progress",i)},updateSlidesClasses:function(){const e=this,{slides:t,params:s,$wrapperEl:a,activeIndex:i,realIndex:r}=e,n=e.virtual&&s.virtual.enabled;let l;t.removeClass(`${s.slideActiveClass} ${s.slideNextClass} ${s.slidePrevClass} ${s.slideDuplicateActiveClass} ${s.slideDuplicateNextClass} ${s.slideDuplicatePrevClass}`),l=n?e.$wrapperEl.find(`.${s.slideClass}[data-swiper-slide-index="${i}"]`):t.eq(i),l.addClass(s.slideActiveClass),s.loop&&(l.hasClass(s.slideDuplicateClass)?a.children(`.${s.slideClass}:not(.${s.slideDuplicateClass})[data-swiper-slide-index="${r}"]`).addClass(s.slideDuplicateActiveClass):a.children(`.${s.slideClass}.${s.slideDuplicateClass}[data-swiper-slide-index="${r}"]`).addClass(s.slideDuplicateActiveClass));let o=l.nextAll(`.${s.slideClass}`).eq(0).addClass(s.slideNextClass);s.loop&&0===o.length&&(o=t.eq(0),o.addClass(s.slideNextClass));let d=l.prevAll(`.${s.slideClass}`).eq(0).addClass(s.slidePrevClass);s.loop&&0===d.length&&(d=t.eq(-1),d.addClass(s.slidePrevClass)),s.loop&&(o.hasClass(s.slideDuplicateClass)?a.children(`.${s.slideClass}:not(.${s.slideDuplicateClass})[data-swiper-slide-index="${o.attr("data-swiper-slide-index")}"]`).addClass(s.slideDuplicateNextClass):a.children(`.${s.slideClass}.${s.slideDuplicateClass}[data-swiper-slide-index="${o.attr("data-swiper-slide-index")}"]`).addClass(s.slideDuplicateNextClass),d.hasClass(s.slideDuplicateClass)?a.children(`.${s.slideClass}:not(.${s.slideDuplicateClass})[data-swiper-slide-index="${d.attr("data-swiper-slide-index")}"]`).addClass(s.slideDuplicatePrevClass):a.children(`.${s.slideClass}.${s.slideDuplicateClass}[data-swiper-slide-index="${d.attr("data-swiper-slide-index")}"]`).addClass(s.slideDuplicatePrevClass)),e.emitSlidesClasses()},updateActiveIndex:function(e){const t=this,s=t.rtlTranslate?t.translate:-t.translate,{slidesGrid:a,snapGrid:i,params:r,activeIndex:n,realIndex:l,snapIndex:o}=t;let d,c=e;if(void 0===c){for(let e=0;e<a.length;e+=1)void 0!==a[e+1]?s>=a[e]&&s<a[e+1]-(a[e+1]-a[e])/2?c=e:s>=a[e]&&s<a[e+1]&&(c=e+1):s>=a[e]&&(c=e);r.normalizeSlideIndex&&(c<0||void 0===c)&&(c=0)}if(i.indexOf(s)>=0)d=i.indexOf(s);else{const e=Math.min(r.slidesPerGroupSkip,c);d=e+Math.floor((c-e)/r.slidesPerGroup)}if(d>=i.length&&(d=i.length-1),c===n)return void(d!==o&&(t.snapIndex=d,t.emit("snapIndexChange")));const p=parseInt(t.slides.eq(c).attr("data-swiper-slide-index")||c,10);Object.assign(t,{snapIndex:d,realIndex:p,previousIndex:n,activeIndex:c}),t.emit("activeIndexChange"),t.emit("snapIndexChange"),l!==p&&t.emit("realIndexChange"),(t.initialized||t.params.runCallbacksOnInit)&&t.emit("slideChange")},updateClickedSlide:function(e){const t=this,s=t.params,a=d(e).closest(`.${s.slideClass}`)[0];let i,r=!1;if(a)for(let e=0;e<t.slides.length;e+=1)if(t.slides[e]===a){r=!0,i=e;break}if(!a||!r)return t.clickedSlide=void 0,void(t.clickedIndex=void 0);t.clickedSlide=a,t.virtual&&t.params.virtual.enabled?t.clickedIndex=parseInt(d(a).attr("data-swiper-slide-index"),10):t.clickedIndex=i,s.slideToClickedSlide&&void 0!==t.clickedIndex&&t.clickedIndex!==t.activeIndex&&t.slideToClickedSlide()}};var M={getTranslate:function(e){void 0===e&&(e=this.isHorizontal()?"x":"y");const{params:t,rtlTranslate:s,translate:a,$wrapperEl:i}=this;if(t.virtualTranslate)return s?-a:a;if(t.cssMode)return a;let r=h(i[0],e);return s&&(r=-r),r||0},setTranslate:function(e,t){const s=this,{rtlTranslate:a,params:i,$wrapperEl:r,wrapperEl:n,progress:l}=s;let o,d=0,c=0;s.isHorizontal()?d=a?-e:e:c=e,i.roundLengths&&(d=Math.floor(d),c=Math.floor(c)),i.cssMode?n[s.isHorizontal()?"scrollLeft":"scrollTop"]=s.isHorizontal()?-d:-c:i.virtualTranslate||r.transform(`translate3d(${d}px, ${c}px, 0px)`),s.previousTranslate=s.translate,s.translate=s.isHorizontal()?d:c;const p=s.maxTranslate()-s.minTranslate();o=0===p?0:(e-s.minTranslate())/p,o!==l&&s.updateProgress(e),s.emit("setTranslate",s.translate,t)},minTranslate:function(){return-this.snapGrid[0]},maxTranslate:function(){return-this.snapGrid[this.snapGrid.length-1]},translateTo:function(e,t,s,a,i){void 0===e&&(e=0),void 0===t&&(t=this.params.speed),void 0===s&&(s=!0),void 0===a&&(a=!0);const r=this,{params:n,wrapperEl:l}=r;if(r.animating&&n.preventInteractionOnTransition)return!1;const o=r.minTranslate(),d=r.maxTranslate();let c;if(c=a&&e>o?o:a&&e<d?d:e,r.updateProgress(c),n.cssMode){const e=r.isHorizontal();if(0===t)l[e?"scrollLeft":"scrollTop"]=-c;else{if(!r.support.smoothScroll)return w({swiper:r,targetPosition:-c,side:e?"left":"top"}),!0;l.scrollTo({[e?"left":"top"]:-c,behavior:"smooth"})}return!0}return 0===t?(r.setTransition(0),r.setTranslate(c),s&&(r.emit("beforeTransitionStart",t,i),r.emit("transitionEnd"))):(r.setTransition(t),r.setTranslate(c),s&&(r.emit("beforeTransitionStart",t,i),r.emit("transitionStart")),r.animating||(r.animating=!0,r.onTranslateToWrapperTransitionEnd||(r.onTranslateToWrapperTransitionEnd=function(e){r&&!r.destroyed&&e.target===this&&(r.$wrapperEl[0].removeEventListener("transitionend",r.onTranslateToWrapperTransitionEnd),r.$wrapperEl[0].removeEventListener("webkitTransitionEnd",r.onTranslateToWrapperTransitionEnd),r.onTranslateToWrapperTransitionEnd=null,delete r.onTranslateToWrapperTransitionEnd,s&&r.emit("transitionEnd"))}),r.$wrapperEl[0].addEventListener("transitionend",r.onTranslateToWrapperTransitionEnd),r.$wrapperEl[0].addEventListener("webkitTransitionEnd",r.onTranslateToWrapperTransitionEnd))),!0}};function P(e){let{swiper:t,runCallbacks:s,direction:a,step:i}=e;const{activeIndex:r,previousIndex:n}=t;let l=a;if(l||(l=r>n?"next":r<n?"prev":"reset"),t.emit(`transition${i}`),s&&r!==n){if("reset"===l)return void t.emit(`slideResetTransition${i}`);t.emit(`slideChangeTransition${i}`),"next"===l?t.emit(`slideNextTransition${i}`):t.emit(`slidePrevTransition${i}`)}}var k={slideTo:function(e,t,s,a,i){if(void 0===e&&(e=0),void 0===t&&(t=this.params.speed),void 0===s&&(s=!0),"number"!=typeof e&&"string"!=typeof e)throw new Error(`The 'index' argument cannot have type other than 'number' or 'string'. [${typeof e}] given.`);if("string"==typeof e){const t=parseInt(e,10);if(!isFinite(t))throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${e}] given.`);e=t}const r=this;let n=e;n<0&&(n=0);const{params:l,snapGrid:o,slidesGrid:d,previousIndex:c,activeIndex:p,rtlTranslate:u,wrapperEl:h,enabled:m}=r;if(r.animating&&l.preventInteractionOnTransition||!m&&!a&&!i)return!1;const f=Math.min(r.params.slidesPerGroupSkip,n);let g=f+Math.floor((n-f)/r.params.slidesPerGroup);g>=o.length&&(g=o.length-1),(p||l.initialSlide||0)===(c||0)&&s&&r.emit("beforeSlideChangeStart");const v=-o[g];if(r.updateProgress(v),l.normalizeSlideIndex)for(let e=0;e<d.length;e+=1){const t=-Math.floor(100*v),s=Math.floor(100*d[e]),a=Math.floor(100*d[e+1]);void 0!==d[e+1]?t>=s&&t<a-(a-s)/2?n=e:t>=s&&t<a&&(n=e+1):t>=s&&(n=e)}if(r.initialized&&n!==p){if(!r.allowSlideNext&&v<r.translate&&v<r.minTranslate())return!1;if(!r.allowSlidePrev&&v>r.translate&&v>r.maxTranslate()&&(p||0)!==n)return!1}let b;if(b=n>p?"next":n<p?"prev":"reset",u&&-v===r.translate||!u&&v===r.translate)return r.updateActiveIndex(n),l.autoHeight&&r.updateAutoHeight(),r.updateSlidesClasses(),"slide"!==l.effect&&r.setTranslate(v),"reset"!==b&&(r.transitionStart(s,b),r.transitionEnd(s,b)),!1;if(l.cssMode){const e=r.isHorizontal(),s=u?v:-v;if(0===t){const t=r.virtual&&r.params.virtual.enabled;t&&(r.wrapperEl.style.scrollSnapType="none",r._immediateVirtual=!0),h[e?"scrollLeft":"scrollTop"]=s,t&&requestAnimationFrame((()=>{r.wrapperEl.style.scrollSnapType="",r._swiperImmediateVirtual=!1}))}else{if(!r.support.smoothScroll)return w({swiper:r,targetPosition:s,side:e?"left":"top"}),!0;h.scrollTo({[e?"left":"top"]:s,behavior:"smooth"})}return!0}return r.setTransition(t),r.setTranslate(v),r.updateActiveIndex(n),r.updateSlidesClasses(),r.emit("beforeTransitionStart",t,a),r.transitionStart(s,b),0===t?r.transitionEnd(s,b):r.animating||(r.animating=!0,r.onSlideToWrapperTransitionEnd||(r.onSlideToWrapperTransitionEnd=function(e){r&&!r.destroyed&&e.target===this&&(r.$wrapperEl[0].removeEventListener("transitionend",r.onSlideToWrapperTransitionEnd),r.$wrapperEl[0].removeEventListener("webkitTransitionEnd",r.onSlideToWrapperTransitionEnd),r.onSlideToWrapperTransitionEnd=null,delete r.onSlideToWrapperTransitionEnd,r.transitionEnd(s,b))}),r.$wrapperEl[0].addEventListener("transitionend",r.onSlideToWrapperTransitionEnd),r.$wrapperEl[0].addEventListener("webkitTransitionEnd",r.onSlideToWrapperTransitionEnd)),!0},slideToLoop:function(e,t,s,a){void 0===e&&(e=0),void 0===t&&(t=this.params.speed),void 0===s&&(s=!0);const i=this;let r=e;return i.params.loop&&(r+=i.loopedSlides),i.slideTo(r,t,s,a)},slideNext:function(e,t,s){void 0===e&&(e=this.params.speed),void 0===t&&(t=!0);const a=this,{animating:i,enabled:r,params:n}=a;if(!r)return a;let l=n.slidesPerGroup;"auto"===n.slidesPerView&&1===n.slidesPerGroup&&n.slidesPerGroupAuto&&(l=Math.max(a.slidesPerViewDynamic("current",!0),1));const o=a.activeIndex<n.slidesPerGroupSkip?1:l;if(n.loop){if(i&&n.loopPreventsSlide)return!1;a.loopFix(),a._clientLeft=a.$wrapperEl[0].clientLeft}return n.rewind&&a.isEnd?a.slideTo(0,e,t,s):a.slideTo(a.activeIndex+o,e,t,s)},slidePrev:function(e,t,s){void 0===e&&(e=this.params.speed),void 0===t&&(t=!0);const a=this,{params:i,animating:r,snapGrid:n,slidesGrid:l,rtlTranslate:o,enabled:d}=a;if(!d)return a;if(i.loop){if(r&&i.loopPreventsSlide)return!1;a.loopFix(),a._clientLeft=a.$wrapperEl[0].clientLeft}function c(e){return e<0?-Math.floor(Math.abs(e)):Math.floor(e)}const p=c(o?a.translate:-a.translate),u=n.map((e=>c(e)));let h=n[u.indexOf(p)-1];if(void 0===h&&i.cssMode){let e;n.forEach(((t,s)=>{p>=t&&(e=s)})),void 0!==e&&(h=n[e>0?e-1:e])}let m=0;if(void 0!==h&&(m=l.indexOf(h),m<0&&(m=a.activeIndex-1),"auto"===i.slidesPerView&&1===i.slidesPerGroup&&i.slidesPerGroupAuto&&(m=m-a.slidesPerViewDynamic("previous",!0)+1,m=Math.max(m,0))),i.rewind&&a.isBeginning){const i=a.params.virtual&&a.params.virtual.enabled&&a.virtual?a.virtual.slides.length-1:a.slides.length-1;return a.slideTo(i,e,t,s)}return a.slideTo(m,e,t,s)},slideReset:function(e,t,s){return void 0===e&&(e=this.params.speed),void 0===t&&(t=!0),this.slideTo(this.activeIndex,e,t,s)},slideToClosest:function(e,t,s,a){void 0===e&&(e=this.params.speed),void 0===t&&(t=!0),void 0===a&&(a=.5);const i=this;let r=i.activeIndex;const n=Math.min(i.params.slidesPerGroupSkip,r),l=n+Math.floor((r-n)/i.params.slidesPerGroup),o=i.rtlTranslate?i.translate:-i.translate;if(o>=i.snapGrid[l]){const e=i.snapGrid[l];o-e>(i.snapGrid[l+1]-e)*a&&(r+=i.params.slidesPerGroup)}else{const e=i.snapGrid[l-1];o-e<=(i.snapGrid[l]-e)*a&&(r-=i.params.slidesPerGroup)}return r=Math.max(r,0),r=Math.min(r,i.slidesGrid.length-1),i.slideTo(r,e,t,s)},slideToClickedSlide:function(){const e=this,{params:t,$wrapperEl:s}=e,a="auto"===t.slidesPerView?e.slidesPerViewDynamic():t.slidesPerView;let i,r=e.clickedIndex;if(t.loop){if(e.animating)return;i=parseInt(d(e.clickedSlide).attr("data-swiper-slide-index"),10),t.centeredSlides?r<e.loopedSlides-a/2||r>e.slides.length-e.loopedSlides+a/2?(e.loopFix(),r=s.children(`.${t.slideClass}[data-swiper-slide-index="${i}"]:not(.${t.slideDuplicateClass})`).eq(0).index(),p((()=>{e.slideTo(r)}))):e.slideTo(r):r>e.slides.length-a?(e.loopFix(),r=s.children(`.${t.slideClass}[data-swiper-slide-index="${i}"]:not(.${t.slideDuplicateClass})`).eq(0).index(),p((()=>{e.slideTo(r)}))):e.slideTo(r)}else e.slideTo(r)}};var z={loopCreate:function(){const e=this,t=a(),{params:s,$wrapperEl:i}=e,r=i.children().length>0?d(i.children()[0].parentNode):i;r.children(`.${s.slideClass}.${s.slideDuplicateClass}`).remove();let n=r.children(`.${s.slideClass}`);if(s.loopFillGroupWithBlank){const e=s.slidesPerGroup-n.length%s.slidesPerGroup;if(e!==s.slidesPerGroup){for(let a=0;a<e;a+=1){const e=d(t.createElement("div")).addClass(`${s.slideClass} ${s.slideBlankClass}`);r.append(e)}n=r.children(`.${s.slideClass}`)}}"auto"!==s.slidesPerView||s.loopedSlides||(s.loopedSlides=n.length),e.loopedSlides=Math.ceil(parseFloat(s.loopedSlides||s.slidesPerView,10)),e.loopedSlides+=s.loopAdditionalSlides,e.loopedSlides>n.length&&(e.loopedSlides=n.length);const l=[],o=[];n.each(((t,s)=>{const a=d(t);s<e.loopedSlides&&o.push(t),s<n.length&&s>=n.length-e.loopedSlides&&l.push(t),a.attr("data-swiper-slide-index",s)}));for(let e=0;e<o.length;e+=1)r.append(d(o[e].cloneNode(!0)).addClass(s.slideDuplicateClass));for(let e=l.length-1;e>=0;e-=1)r.prepend(d(l[e].cloneNode(!0)).addClass(s.slideDuplicateClass))},loopFix:function(){const e=this;e.emit("beforeLoopFix");const{activeIndex:t,slides:s,loopedSlides:a,allowSlidePrev:i,allowSlideNext:r,snapGrid:n,rtlTranslate:l}=e;let o;e.allowSlidePrev=!0,e.allowSlideNext=!0;const d=-n[t]-e.getTranslate();if(t<a){o=s.length-3*a+t,o+=a;e.slideTo(o,0,!1,!0)&&0!==d&&e.setTranslate((l?-e.translate:e.translate)-d)}else if(t>=s.length-a){o=-s.length+t+a,o+=a;e.slideTo(o,0,!1,!0)&&0!==d&&e.setTranslate((l?-e.translate:e.translate)-d)}e.allowSlidePrev=i,e.allowSlideNext=r,e.emit("loopFix")},loopDestroy:function(){const{$wrapperEl:e,params:t,slides:s}=this;e.children(`.${t.slideClass}.${t.slideDuplicateClass},.${t.slideClass}.${t.slideBlankClass}`).remove(),s.removeAttr("data-swiper-slide-index")}};function O(e){const t=this,s=a(),i=r(),n=t.touchEventsData,{params:l,touches:o,enabled:c}=t;if(!c)return;if(t.animating&&l.preventInteractionOnTransition)return;!t.animating&&l.cssMode&&l.loop&&t.loopFix();let p=e;p.originalEvent&&(p=p.originalEvent);let h=d(p.target);if("wrapper"===l.touchEventsTarget&&!h.closest(t.wrapperEl).length)return;if(n.isTouchEvent="touchstart"===p.type,!n.isTouchEvent&&"which"in p&&3===p.which)return;if(!n.isTouchEvent&&"button"in p&&p.button>0)return;if(n.isTouched&&n.isMoved)return;!!l.noSwipingClass&&""!==l.noSwipingClass&&p.target&&p.target.shadowRoot&&e.path&&e.path[0]&&(h=d(e.path[0]));const m=l.noSwipingSelector?l.noSwipingSelector:`.${l.noSwipingClass}`,f=!(!p.target||!p.target.shadowRoot);if(l.noSwiping&&(f?function(e,t){return void 0===t&&(t=this),function t(s){return s&&s!==a()&&s!==r()?(s.assignedSlot&&(s=s.assignedSlot),s.closest(e)||t(s.getRootNode().host)):null}(t)}(m,p.target):h.closest(m)[0]))return void(t.allowClick=!0);if(l.swipeHandler&&!h.closest(l.swipeHandler)[0])return;o.currentX="touchstart"===p.type?p.targetTouches[0].pageX:p.pageX,o.currentY="touchstart"===p.type?p.targetTouches[0].pageY:p.pageY;const g=o.currentX,v=o.currentY,w=l.edgeSwipeDetection||l.iOSEdgeSwipeDetection,b=l.edgeSwipeThreshold||l.iOSEdgeSwipeThreshold;if(w&&(g<=b||g>=i.innerWidth-b)){if("prevent"!==w)return;e.preventDefault()}if(Object.assign(n,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),o.startX=g,o.startY=v,n.touchStartTime=u(),t.allowClick=!0,t.updateSize(),t.swipeDirection=void 0,l.threshold>0&&(n.allowThresholdMove=!1),"touchstart"!==p.type){let e=!0;h.is(n.focusableElements)&&(e=!1,"SELECT"===h[0].nodeName&&(n.isTouched=!1)),s.activeElement&&d(s.activeElement).is(n.focusableElements)&&s.activeElement!==h[0]&&s.activeElement.blur();const a=e&&t.allowTouchMove&&l.touchStartPreventDefault;!l.touchStartForcePreventDefault&&!a||h[0].isContentEditable||p.preventDefault()}t.params.freeMode&&t.params.freeMode.enabled&&t.freeMode&&t.animating&&!l.cssMode&&t.freeMode.onTouchStart(),t.emit("touchStart",p)}function I(e){const t=a(),s=this,i=s.touchEventsData,{params:r,touches:n,rtlTranslate:l,enabled:o}=s;if(!o)return;let c=e;if(c.originalEvent&&(c=c.originalEvent),!i.isTouched)return void(i.startMoving&&i.isScrolling&&s.emit("touchMoveOpposite",c));if(i.isTouchEvent&&"touchmove"!==c.type)return;const p="touchmove"===c.type&&c.targetTouches&&(c.targetTouches[0]||c.changedTouches[0]),h="touchmove"===c.type?p.pageX:c.pageX,m="touchmove"===c.type?p.pageY:c.pageY;if(c.preventedByNestedSwiper)return n.startX=h,void(n.startY=m);if(!s.allowTouchMove)return d(c.target).is(i.focusableElements)||(s.allowClick=!1),void(i.isTouched&&(Object.assign(n,{startX:h,startY:m,currentX:h,currentY:m}),i.touchStartTime=u()));if(i.isTouchEvent&&r.touchReleaseOnEdges&&!r.loop)if(s.isVertical()){if(m<n.startY&&s.translate<=s.maxTranslate()||m>n.startY&&s.translate>=s.minTranslate())return i.isTouched=!1,void(i.isMoved=!1)}else if(h<n.startX&&s.translate<=s.maxTranslate()||h>n.startX&&s.translate>=s.minTranslate())return;if(i.isTouchEvent&&t.activeElement&&c.target===t.activeElement&&d(c.target).is(i.focusableElements))return i.isMoved=!0,void(s.allowClick=!1);if(i.allowTouchCallbacks&&s.emit("touchMove",c),c.targetTouches&&c.targetTouches.length>1)return;n.currentX=h,n.currentY=m;const f=n.currentX-n.startX,g=n.currentY-n.startY;if(s.params.threshold&&Math.sqrt(f**2+g**2)<s.params.threshold)return;if(void 0===i.isScrolling){let e;s.isHorizontal()&&n.currentY===n.startY||s.isVertical()&&n.currentX===n.startX?i.isScrolling=!1:f*f+g*g>=25&&(e=180*Math.atan2(Math.abs(g),Math.abs(f))/Math.PI,i.isScrolling=s.isHorizontal()?e>r.touchAngle:90-e>r.touchAngle)}if(i.isScrolling&&s.emit("touchMoveOpposite",c),void 0===i.startMoving&&(n.currentX===n.startX&&n.currentY===n.startY||(i.startMoving=!0)),i.isScrolling)return void(i.isTouched=!1);if(!i.startMoving)return;s.allowClick=!1,!r.cssMode&&c.cancelable&&c.preventDefault(),r.touchMoveStopPropagation&&!r.nested&&c.stopPropagation(),i.isMoved||(r.loop&&!r.cssMode&&s.loopFix(),i.startTranslate=s.getTranslate(),s.setTransition(0),s.animating&&s.$wrapperEl.trigger("webkitTransitionEnd transitionend"),i.allowMomentumBounce=!1,!r.grabCursor||!0!==s.allowSlideNext&&!0!==s.allowSlidePrev||s.setGrabCursor(!0),s.emit("sliderFirstMove",c)),s.emit("sliderMove",c),i.isMoved=!0;let v=s.isHorizontal()?f:g;n.diff=v,v*=r.touchRatio,l&&(v=-v),s.swipeDirection=v>0?"prev":"next",i.currentTranslate=v+i.startTranslate;let w=!0,b=r.resistanceRatio;if(r.touchReleaseOnEdges&&(b=0),v>0&&i.currentTranslate>s.minTranslate()?(w=!1,r.resistance&&(i.currentTranslate=s.minTranslate()-1+(-s.minTranslate()+i.startTranslate+v)**b)):v<0&&i.currentTranslate<s.maxTranslate()&&(w=!1,r.resistance&&(i.currentTranslate=s.maxTranslate()+1-(s.maxTranslate()-i.startTranslate-v)**b)),w&&(c.preventedByNestedSwiper=!0),!s.allowSlideNext&&"next"===s.swipeDirection&&i.currentTranslate<i.startTranslate&&(i.currentTranslate=i.startTranslate),!s.allowSlidePrev&&"prev"===s.swipeDirection&&i.currentTranslate>i.startTranslate&&(i.currentTranslate=i.startTranslate),s.allowSlidePrev||s.allowSlideNext||(i.currentTranslate=i.startTranslate),r.threshold>0){if(!(Math.abs(v)>r.threshold||i.allowThresholdMove))return void(i.currentTranslate=i.startTranslate);if(!i.allowThresholdMove)return i.allowThresholdMove=!0,n.startX=n.currentX,n.startY=n.currentY,i.currentTranslate=i.startTranslate,void(n.diff=s.isHorizontal()?n.currentX-n.startX:n.currentY-n.startY)}r.followFinger&&!r.cssMode&&((r.freeMode&&r.freeMode.enabled&&s.freeMode||r.watchSlidesProgress)&&(s.updateActiveIndex(),s.updateSlidesClasses()),s.params.freeMode&&r.freeMode.enabled&&s.freeMode&&s.freeMode.onTouchMove(),s.updateProgress(i.currentTranslate),s.setTranslate(i.currentTranslate))}function L(e){const t=this,s=t.touchEventsData,{params:a,touches:i,rtlTranslate:r,slidesGrid:n,enabled:l}=t;if(!l)return;let o=e;if(o.originalEvent&&(o=o.originalEvent),s.allowTouchCallbacks&&t.emit("touchEnd",o),s.allowTouchCallbacks=!1,!s.isTouched)return s.isMoved&&a.grabCursor&&t.setGrabCursor(!1),s.isMoved=!1,void(s.startMoving=!1);a.grabCursor&&s.isMoved&&s.isTouched&&(!0===t.allowSlideNext||!0===t.allowSlidePrev)&&t.setGrabCursor(!1);const d=u(),c=d-s.touchStartTime;if(t.allowClick){const e=o.path||o.composedPath&&o.composedPath();t.updateClickedSlide(e&&e[0]||o.target),t.emit("tap click",o),c<300&&d-s.lastClickTime<300&&t.emit("doubleTap doubleClick",o)}if(s.lastClickTime=u(),p((()=>{t.destroyed||(t.allowClick=!0)})),!s.isTouched||!s.isMoved||!t.swipeDirection||0===i.diff||s.currentTranslate===s.startTranslate)return s.isTouched=!1,s.isMoved=!1,void(s.startMoving=!1);let h;if(s.isTouched=!1,s.isMoved=!1,s.startMoving=!1,h=a.followFinger?r?t.translate:-t.translate:-s.currentTranslate,a.cssMode)return;if(t.params.freeMode&&a.freeMode.enabled)return void t.freeMode.onTouchEnd({currentPos:h});let m=0,f=t.slidesSizesGrid[0];for(let e=0;e<n.length;e+=e<a.slidesPerGroupSkip?1:a.slidesPerGroup){const t=e<a.slidesPerGroupSkip-1?1:a.slidesPerGroup;void 0!==n[e+t]?h>=n[e]&&h<n[e+t]&&(m=e,f=n[e+t]-n[e]):h>=n[e]&&(m=e,f=n[n.length-1]-n[n.length-2])}let g=null,v=null;a.rewind&&(t.isBeginning?v=t.params.virtual&&t.params.virtual.enabled&&t.virtual?t.virtual.slides.length-1:t.slides.length-1:t.isEnd&&(g=0));const w=(h-n[m])/f,b=m<a.slidesPerGroupSkip-1?1:a.slidesPerGroup;if(c>a.longSwipesMs){if(!a.longSwipes)return void t.slideTo(t.activeIndex);"next"===t.swipeDirection&&(w>=a.longSwipesRatio?t.slideTo(a.rewind&&t.isEnd?g:m+b):t.slideTo(m)),"prev"===t.swipeDirection&&(w>1-a.longSwipesRatio?t.slideTo(m+b):null!==v&&w<0&&Math.abs(w)>a.longSwipesRatio?t.slideTo(v):t.slideTo(m))}else{if(!a.shortSwipes)return void t.slideTo(t.activeIndex);t.navigation&&(o.target===t.navigation.nextEl||o.target===t.navigation.prevEl)?o.target===t.navigation.nextEl?t.slideTo(m+b):t.slideTo(m):("next"===t.swipeDirection&&t.slideTo(null!==g?g:m+b),"prev"===t.swipeDirection&&t.slideTo(null!==v?v:m))}}function A(){const e=this,{params:t,el:s}=e;if(s&&0===s.offsetWidth)return;t.breakpoints&&e.setBreakpoint();const{allowSlideNext:a,allowSlidePrev:i,snapGrid:r}=e;e.allowSlideNext=!0,e.allowSlidePrev=!0,e.updateSize(),e.updateSlides(),e.updateSlidesClasses(),("auto"===t.slidesPerView||t.slidesPerView>1)&&e.isEnd&&!e.isBeginning&&!e.params.centeredSlides?e.slideTo(e.slides.length-1,0,!1,!0):e.slideTo(e.activeIndex,0,!1,!0),e.autoplay&&e.autoplay.running&&e.autoplay.paused&&e.autoplay.run(),e.allowSlidePrev=i,e.allowSlideNext=a,e.params.watchOverflow&&r!==e.snapGrid&&e.checkOverflow()}function D(e){const t=this;t.enabled&&(t.allowClick||(t.params.preventClicks&&e.preventDefault(),t.params.preventClicksPropagation&&t.animating&&(e.stopPropagation(),e.stopImmediatePropagation())))}function G(){const e=this,{wrapperEl:t,rtlTranslate:s,enabled:a}=e;if(!a)return;let i;e.previousTranslate=e.translate,e.isHorizontal()?e.translate=-t.scrollLeft:e.translate=-t.scrollTop,-0===e.translate&&(e.translate=0),e.updateActiveIndex(),e.updateSlidesClasses();const r=e.maxTranslate()-e.minTranslate();i=0===r?0:(e.translate-e.minTranslate())/r,i!==e.progress&&e.updateProgress(s?-e.translate:e.translate),e.emit("setTranslate",e.translate,!1)}let B=!1;function N(){}const H=(e,t)=>{const s=a(),{params:i,touchEvents:r,el:n,wrapperEl:l,device:o,support:d}=e,c=!!i.nested,p="on"===t?"addEventListener":"removeEventListener",u=t;if(d.touch){const t=!("touchstart"!==r.start||!d.passiveListener||!i.passiveListeners)&&{passive:!0,capture:!1};n[p](r.start,e.onTouchStart,t),n[p](r.move,e.onTouchMove,d.passiveListener?{passive:!1,capture:c}:c),n[p](r.end,e.onTouchEnd,t),r.cancel&&n[p](r.cancel,e.onTouchEnd,t)}else n[p](r.start,e.onTouchStart,!1),s[p](r.move,e.onTouchMove,c),s[p](r.end,e.onTouchEnd,!1);(i.preventClicks||i.preventClicksPropagation)&&n[p]("click",e.onClick,!0),i.cssMode&&l[p]("scroll",e.onScroll),i.updateOnWindowResize?e[u](o.ios||o.android?"resize orientationchange observerUpdate":"resize observerUpdate",A,!0):e[u]("observerUpdate",A,!0)};var X={attachEvents:function(){const e=this,t=a(),{params:s,support:i}=e;e.onTouchStart=O.bind(e),e.onTouchMove=I.bind(e),e.onTouchEnd=L.bind(e),s.cssMode&&(e.onScroll=G.bind(e)),e.onClick=D.bind(e),i.touch&&!B&&(t.addEventListener("touchstart",N),B=!0),H(e,"on")},detachEvents:function(){H(this,"off")}};const Y=(e,t)=>e.grid&&t.grid&&t.grid.rows>1;var R={addClasses:function(){const e=this,{classNames:t,params:s,rtl:a,$el:i,device:r,support:n}=e,l=function(e,t){const s=[];return e.forEach((e=>{"object"==typeof e?Object.keys(e).forEach((a=>{e[a]&&s.push(t+a)})):"string"==typeof e&&s.push(t+e)})),s}(["initialized",s.direction,{"pointer-events":!n.touch},{"free-mode":e.params.freeMode&&s.freeMode.enabled},{autoheight:s.autoHeight},{rtl:a},{grid:s.grid&&s.grid.rows>1},{"grid-column":s.grid&&s.grid.rows>1&&"column"===s.grid.fill},{android:r.android},{ios:r.ios},{"css-mode":s.cssMode},{centered:s.cssMode&&s.centeredSlides}],s.containerModifierClass);t.push(...l),i.addClass([...t].join(" ")),e.emitContainerClasses()},removeClasses:function(){const{$el:e,classNames:t}=this;e.removeClass(t.join(" ")),this.emitContainerClasses()}};var W={init:!0,direction:"horizontal",touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,enabled:!0,focusableElements:"input, select, option, textarea, button, video, label",width:null,height:null,preventInteractionOnTransition:!1,userAgent:null,url:null,edgeSwipeDetection:!1,edgeSwipeThreshold:20,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsBase:"window",spaceBetween:0,slidesPerView:1,slidesPerGroup:1,slidesPerGroupSkip:0,slidesPerGroupAuto:!1,centeredSlides:!1,centeredSlidesBounds:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,watchOverflow:!0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:0,touchMoveStopPropagation:!1,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,preloadImages:!0,updateOnImagesReady:!0,loop:!1,loopAdditionalSlides:0,loopedSlides:null,loopFillGroupWithBlank:!1,loopPreventsSlide:!0,rewind:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,maxBackfaceHiddenSlides:10,containerModifierClass:"swiper-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-invisible-blank",slideActiveClass:"swiper-slide-active",slideDuplicateActiveClass:"swiper-slide-duplicate-active",slideVisibleClass:"swiper-slide-visible",slideDuplicateClass:"swiper-slide-duplicate",slideNextClass:"swiper-slide-next",slideDuplicateNextClass:"swiper-slide-duplicate-next",slidePrevClass:"swiper-slide-prev",slideDuplicatePrevClass:"swiper-slide-duplicate-prev",wrapperClass:"swiper-wrapper",runCallbacksOnInit:!0,_emitClasses:!1};function j(e,t){return function(s){void 0===s&&(s={});const a=Object.keys(s)[0],i=s[a];"object"==typeof i&&null!==i?(["navigation","pagination","scrollbar"].indexOf(a)>=0&&!0===e[a]&&(e[a]={auto:!0}),a in e&&"enabled"in i?(!0===e[a]&&(e[a]={enabled:!0}),"object"!=typeof e[a]||"enabled"in e[a]||(e[a].enabled=!0),e[a]||(e[a]={enabled:!1}),g(t,s)):g(t,s)):g(t,s)}}const _={eventsEmitter:$,update:S,translate:M,transition:{setTransition:function(e,t){const s=this;s.params.cssMode||s.$wrapperEl.transition(e),s.emit("setTransition",e,t)},transitionStart:function(e,t){void 0===e&&(e=!0);const s=this,{params:a}=s;a.cssMode||(a.autoHeight&&s.updateAutoHeight(),P({swiper:s,runCallbacks:e,direction:t,step:"Start"}))},transitionEnd:function(e,t){void 0===e&&(e=!0);const s=this,{params:a}=s;s.animating=!1,a.cssMode||(s.setTransition(0),P({swiper:s,runCallbacks:e,direction:t,step:"End"}))}},slide:k,loop:z,grabCursor:{setGrabCursor:function(e){const t=this;if(t.support.touch||!t.params.simulateTouch||t.params.watchOverflow&&t.isLocked||t.params.cssMode)return;const s="container"===t.params.touchEventsTarget?t.el:t.wrapperEl;s.style.cursor="move",s.style.cursor=e?"-webkit-grabbing":"-webkit-grab",s.style.cursor=e?"-moz-grabbin":"-moz-grab",s.style.cursor=e?"grabbing":"grab"},unsetGrabCursor:function(){const e=this;e.support.touch||e.params.watchOverflow&&e.isLocked||e.params.cssMode||(e["container"===e.params.touchEventsTarget?"el":"wrapperEl"].style.cursor="")}},events:X,breakpoints:{setBreakpoint:function(){const e=this,{activeIndex:t,initialized:s,loopedSlides:a=0,params:i,$el:r}=e,n=i.breakpoints;if(!n||n&&0===Object.keys(n).length)return;const l=e.getBreakpoint(n,e.params.breakpointsBase,e.el);if(!l||e.currentBreakpoint===l)return;const o=(l in n?n[l]:void 0)||e.originalParams,d=Y(e,i),c=Y(e,o),p=i.enabled;d&&!c?(r.removeClass(`${i.containerModifierClass}grid ${i.containerModifierClass}grid-column`),e.emitContainerClasses()):!d&&c&&(r.addClass(`${i.containerModifierClass}grid`),(o.grid.fill&&"column"===o.grid.fill||!o.grid.fill&&"column"===i.grid.fill)&&r.addClass(`${i.containerModifierClass}grid-column`),e.emitContainerClasses());const u=o.direction&&o.direction!==i.direction,h=i.loop&&(o.slidesPerView!==i.slidesPerView||u);u&&s&&e.changeDirection(),g(e.params,o);const m=e.params.enabled;Object.assign(e,{allowTouchMove:e.params.allowTouchMove,allowSlideNext:e.params.allowSlideNext,allowSlidePrev:e.params.allowSlidePrev}),p&&!m?e.disable():!p&&m&&e.enable(),e.currentBreakpoint=l,e.emit("_beforeBreakpoint",o),h&&s&&(e.loopDestroy(),e.loopCreate(),e.updateSlides(),e.slideTo(t-a+e.loopedSlides,0,!1)),e.emit("breakpoint",o)},getBreakpoint:function(e,t,s){if(void 0===t&&(t="window"),!e||"container"===t&&!s)return;let a=!1;const i=r(),n="window"===t?i.innerHeight:s.clientHeight,l=Object.keys(e).map((e=>{if("string"==typeof e&&0===e.indexOf("@")){const t=parseFloat(e.substr(1));return{value:n*t,point:e}}return{value:e,point:e}}));l.sort(((e,t)=>parseInt(e.value,10)-parseInt(t.value,10)));for(let e=0;e<l.length;e+=1){const{point:r,value:n}=l[e];"window"===t?i.matchMedia(`(min-width: ${n}px)`).matches&&(a=r):n<=s.clientWidth&&(a=r)}return a||"max"}},checkOverflow:{checkOverflow:function(){const e=this,{isLocked:t,params:s}=e,{slidesOffsetBefore:a}=s;if(a){const t=e.slides.length-1,s=e.slidesGrid[t]+e.slidesSizesGrid[t]+2*a;e.isLocked=e.size>s}else e.isLocked=1===e.snapGrid.length;!0===s.allowSlideNext&&(e.allowSlideNext=!e.isLocked),!0===s.allowSlidePrev&&(e.allowSlidePrev=!e.isLocked),t&&t!==e.isLocked&&(e.isEnd=!1),t!==e.isLocked&&e.emit(e.isLocked?"lock":"unlock")}},classes:R,images:{loadImage:function(e,t,s,a,i,n){const l=r();let o;function c(){n&&n()}d(e).parent("picture")[0]||e.complete&&i?c():t?(o=new l.Image,o.onload=c,o.onerror=c,a&&(o.sizes=a),s&&(o.srcset=s),t&&(o.src=t)):c()},preloadImages:function(){const e=this;function t(){null!=e&&e&&!e.destroyed&&(void 0!==e.imagesLoaded&&(e.imagesLoaded+=1),e.imagesLoaded===e.imagesToLoad.length&&(e.params.updateOnImagesReady&&e.update(),e.emit("imagesReady")))}e.imagesToLoad=e.$el.find("img");for(let s=0;s<e.imagesToLoad.length;s+=1){const a=e.imagesToLoad[s];e.loadImage(a,a.currentSrc||a.getAttribute("src"),a.srcset||a.getAttribute("srcset"),a.sizes||a.getAttribute("sizes"),!0,t)}}}},V={};class q{constructor(){let e,t;for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];if(1===a.length&&a[0].constructor&&"Object"===Object.prototype.toString.call(a[0]).slice(8,-1)?t=a[0]:[e,t]=a,t||(t={}),t=g({},t),e&&!t.el&&(t.el=e),t.el&&d(t.el).length>1){const e=[];return d(t.el).each((s=>{const a=g({},t,{el:s});e.push(new q(a))})),e}const r=this;r.__swiper__=!0,r.support=E(),r.device=T({userAgent:t.userAgent}),r.browser=C(),r.eventsListeners={},r.eventsAnyListeners=[],r.modules=[...r.__modules__],t.modules&&Array.isArray(t.modules)&&r.modules.push(...t.modules);const n={};r.modules.forEach((e=>{e({swiper:r,extendParams:j(t,n),on:r.on.bind(r),once:r.once.bind(r),off:r.off.bind(r),emit:r.emit.bind(r)})}));const l=g({},W,n);return r.params=g({},l,V,t),r.originalParams=g({},r.params),r.passedParams=g({},t),r.params&&r.params.on&&Object.keys(r.params.on).forEach((e=>{r.on(e,r.params.on[e])})),r.params&&r.params.onAny&&r.onAny(r.params.onAny),r.$=d,Object.assign(r,{enabled:r.params.enabled,el:e,classNames:[],slides:d(),slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal:()=>"horizontal"===r.params.direction,isVertical:()=>"vertical"===r.params.direction,activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,allowSlideNext:r.params.allowSlideNext,allowSlidePrev:r.params.allowSlidePrev,touchEvents:function(){const e=["touchstart","touchmove","touchend","touchcancel"],t=["pointerdown","pointermove","pointerup"];return r.touchEventsTouch={start:e[0],move:e[1],end:e[2],cancel:e[3]},r.touchEventsDesktop={start:t[0],move:t[1],end:t[2]},r.support.touch||!r.params.simulateTouch?r.touchEventsTouch:r.touchEventsDesktop}(),touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,focusableElements:r.params.focusableElements,lastClickTime:u(),clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,isTouchEvent:void 0,startMoving:void 0},allowClick:!0,allowTouchMove:r.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),r.emit("_swiper"),r.params.init&&r.init(),r}enable(){const e=this;e.enabled||(e.enabled=!0,e.params.grabCursor&&e.setGrabCursor(),e.emit("enable"))}disable(){const e=this;e.enabled&&(e.enabled=!1,e.params.grabCursor&&e.unsetGrabCursor(),e.emit("disable"))}setProgress(e,t){const s=this;e=Math.min(Math.max(e,0),1);const a=s.minTranslate(),i=(s.maxTranslate()-a)*e+a;s.translateTo(i,void 0===t?0:t),s.updateActiveIndex(),s.updateSlidesClasses()}emitContainerClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const t=e.el.className.split(" ").filter((t=>0===t.indexOf("swiper")||0===t.indexOf(e.params.containerModifierClass)));e.emit("_containerClasses",t.join(" "))}getSlideClasses(e){const t=this;return e.className.split(" ").filter((e=>0===e.indexOf("swiper-slide")||0===e.indexOf(t.params.slideClass))).join(" ")}emitSlidesClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const t=[];e.slides.each((s=>{const a=e.getSlideClasses(s);t.push({slideEl:s,classNames:a}),e.emit("_slideClass",s,a)})),e.emit("_slideClasses",t)}slidesPerViewDynamic(e,t){void 0===e&&(e="current"),void 0===t&&(t=!1);const{params:s,slides:a,slidesGrid:i,slidesSizesGrid:r,size:n,activeIndex:l}=this;let o=1;if(s.centeredSlides){let e,t=a[l].swiperSlideSize;for(let s=l+1;s<a.length;s+=1)a[s]&&!e&&(t+=a[s].swiperSlideSize,o+=1,t>n&&(e=!0));for(let s=l-1;s>=0;s-=1)a[s]&&!e&&(t+=a[s].swiperSlideSize,o+=1,t>n&&(e=!0))}else if("current"===e)for(let e=l+1;e<a.length;e+=1){(t?i[e]+r[e]-i[l]<n:i[e]-i[l]<n)&&(o+=1)}else for(let e=l-1;e>=0;e-=1){i[l]-i[e]<n&&(o+=1)}return o}update(){const e=this;if(!e||e.destroyed)return;const{snapGrid:t,params:s}=e;function a(){const t=e.rtlTranslate?-1*e.translate:e.translate,s=Math.min(Math.max(t,e.maxTranslate()),e.minTranslate());e.setTranslate(s),e.updateActiveIndex(),e.updateSlidesClasses()}let i;s.breakpoints&&e.setBreakpoint(),e.updateSize(),e.updateSlides(),e.updateProgress(),e.updateSlidesClasses(),e.params.freeMode&&e.params.freeMode.enabled?(a(),e.params.autoHeight&&e.updateAutoHeight()):(i=("auto"===e.params.slidesPerView||e.params.slidesPerView>1)&&e.isEnd&&!e.params.centeredSlides?e.slideTo(e.slides.length-1,0,!1,!0):e.slideTo(e.activeIndex,0,!1,!0),i||a()),s.watchOverflow&&t!==e.snapGrid&&e.checkOverflow(),e.emit("update")}changeDirection(e,t){void 0===t&&(t=!0);const s=this,a=s.params.direction;return e||(e="horizontal"===a?"vertical":"horizontal"),e===a||"horizontal"!==e&&"vertical"!==e||(s.$el.removeClass(`${s.params.containerModifierClass}${a}`).addClass(`${s.params.containerModifierClass}${e}`),s.emitContainerClasses(),s.params.direction=e,s.slides.each((t=>{"vertical"===e?t.style.width="":t.style.height=""})),s.emit("changeDirection"),t&&s.update()),s}mount(e){const t=this;if(t.mounted)return!0;const s=d(e||t.params.el);if(!(e=s[0]))return!1;e.swiper=t;const i=()=>`.${(t.params.wrapperClass||"").trim().split(" ").join(".")}`;let r=(()=>{if(e&&e.shadowRoot&&e.shadowRoot.querySelector){const t=d(e.shadowRoot.querySelector(i()));return t.children=e=>s.children(e),t}return s.children(i())})();if(0===r.length&&t.params.createElements){const e=a().createElement("div");r=d(e),e.className=t.params.wrapperClass,s.append(e),s.children(`.${t.params.slideClass}`).each((e=>{r.append(e)}))}return Object.assign(t,{$el:s,el:e,$wrapperEl:r,wrapperEl:r[0],mounted:!0,rtl:"rtl"===e.dir.toLowerCase()||"rtl"===s.css("direction"),rtlTranslate:"horizontal"===t.params.direction&&("rtl"===e.dir.toLowerCase()||"rtl"===s.css("direction")),wrongRTL:"-webkit-box"===r.css("display")}),!0}init(e){const t=this;if(t.initialized)return t;return!1===t.mount(e)||(t.emit("beforeInit"),t.params.breakpoints&&t.setBreakpoint(),t.addClasses(),t.params.loop&&t.loopCreate(),t.updateSize(),t.updateSlides(),t.params.watchOverflow&&t.checkOverflow(),t.params.grabCursor&&t.enabled&&t.setGrabCursor(),t.params.preloadImages&&t.preloadImages(),t.params.loop?t.slideTo(t.params.initialSlide+t.loopedSlides,0,t.params.runCallbacksOnInit,!1,!0):t.slideTo(t.params.initialSlide,0,t.params.runCallbacksOnInit,!1,!0),t.attachEvents(),t.initialized=!0,t.emit("init"),t.emit("afterInit")),t}destroy(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0);const s=this,{params:a,$el:i,$wrapperEl:r,slides:n}=s;return void 0===s.params||s.destroyed||(s.emit("beforeDestroy"),s.initialized=!1,s.detachEvents(),a.loop&&s.loopDestroy(),t&&(s.removeClasses(),i.removeAttr("style"),r.removeAttr("style"),n&&n.length&&n.removeClass([a.slideVisibleClass,a.slideActiveClass,a.slideNextClass,a.slidePrevClass].join(" ")).removeAttr("style").removeAttr("data-swiper-slide-index")),s.emit("destroy"),Object.keys(s.eventsListeners).forEach((e=>{s.off(e)})),!1!==e&&(s.$el[0].swiper=null,function(e){const t=e;Object.keys(t).forEach((e=>{try{t[e]=null}catch(e){}try{delete t[e]}catch(e){}}))}(s)),s.destroyed=!0),null}static extendDefaults(e){g(V,e)}static get extendedDefaults(){return V}static get defaults(){return W}static installModule(e){q.prototype.__modules__||(q.prototype.__modules__=[]);const t=q.prototype.__modules__;"function"==typeof e&&t.indexOf(e)<0&&t.push(e)}static use(e){return Array.isArray(e)?(e.forEach((e=>q.installModule(e))),q):(q.installModule(e),q)}}function F(e,t,s,i){const r=a();return e.params.createElements&&Object.keys(i).forEach((a=>{if(!s[a]&&!0===s.auto){let n=e.$el.children(`.${i[a]}`)[0];n||(n=r.createElement("div"),n.className=i[a],e.$el.append(n)),s[a]=n,t[a]=n}})),s}function U(e){return void 0===e&&(e=""),`.${e.trim().replace(/([\.:!\/])/g,"\\$1").replace(/ /g,".")}`}function K(e){const t=this,{$wrapperEl:s,params:a}=t;if(a.loop&&t.loopDestroy(),"object"==typeof e&&"length"in e)for(let t=0;t<e.length;t+=1)e[t]&&s.append(e[t]);else s.append(e);a.loop&&t.loopCreate(),a.observer||t.update()}function Z(e){const t=this,{params:s,$wrapperEl:a,activeIndex:i}=t;s.loop&&t.loopDestroy();let r=i+1;if("object"==typeof e&&"length"in e){for(let t=0;t<e.length;t+=1)e[t]&&a.prepend(e[t]);r=i+e.length}else a.prepend(e);s.loop&&t.loopCreate(),s.observer||t.update(),t.slideTo(r,0,!1)}function J(e,t){const s=this,{$wrapperEl:a,params:i,activeIndex:r}=s;let n=r;i.loop&&(n-=s.loopedSlides,s.loopDestroy(),s.slides=a.children(`.${i.slideClass}`));const l=s.slides.length;if(e<=0)return void s.prependSlide(t);if(e>=l)return void s.appendSlide(t);let o=n>e?n+1:n;const d=[];for(let t=l-1;t>=e;t-=1){const e=s.slides.eq(t);e.remove(),d.unshift(e)}if("object"==typeof t&&"length"in t){for(let e=0;e<t.length;e+=1)t[e]&&a.append(t[e]);o=n>e?n+t.length:n}else a.append(t);for(let e=0;e<d.length;e+=1)a.append(d[e]);i.loop&&s.loopCreate(),i.observer||s.update(),i.loop?s.slideTo(o+s.loopedSlides,0,!1):s.slideTo(o,0,!1)}function Q(e){const t=this,{params:s,$wrapperEl:a,activeIndex:i}=t;let r=i;s.loop&&(r-=t.loopedSlides,t.loopDestroy(),t.slides=a.children(`.${s.slideClass}`));let n,l=r;if("object"==typeof e&&"length"in e){for(let s=0;s<e.length;s+=1)n=e[s],t.slides[n]&&t.slides.eq(n).remove(),n<l&&(l-=1);l=Math.max(l,0)}else n=e,t.slides[n]&&t.slides.eq(n).remove(),n<l&&(l-=1),l=Math.max(l,0);s.loop&&t.loopCreate(),s.observer||t.update(),s.loop?t.slideTo(l+t.loopedSlides,0,!1):t.slideTo(l,0,!1)}function ee(){const e=this,t=[];for(let s=0;s<e.slides.length;s+=1)t.push(s);e.removeSlide(t)}function te(e){const{effect:t,swiper:s,on:a,setTranslate:i,setTransition:r,overwriteParams:n,perspective:l}=e;a("beforeInit",(()=>{if(s.params.effect!==t)return;s.classNames.push(`${s.params.containerModifierClass}${t}`),l&&l()&&s.classNames.push(`${s.params.containerModifierClass}3d`);const e=n?n():{};Object.assign(s.params,e),Object.assign(s.originalParams,e)})),a("setTranslate",(()=>{s.params.effect===t&&i()})),a("setTransition",((e,a)=>{s.params.effect===t&&r(a)}))}function se(e,t){return e.transformEl?t.find(e.transformEl).css({"backface-visibility":"hidden","-webkit-backface-visibility":"hidden"}):t}function ae(e){let{swiper:t,duration:s,transformEl:a,allSlides:i}=e;const{slides:r,activeIndex:n,$wrapperEl:l}=t;if(t.params.virtualTranslate&&0!==s){let e,s=!1;e=i?a?r.find(a):r:a?r.eq(n).find(a):r.eq(n),e.transitionEnd((()=>{if(s)return;if(!t||t.destroyed)return;s=!0,t.animating=!1;const e=["webkitTransitionEnd","transitionend"];for(let t=0;t<e.length;t+=1)l.trigger(e[t])}))}}function ie(e,t,s){const a="swiper-slide-shadow"+(s?`-${s}`:""),i=e.transformEl?t.find(e.transformEl):t;let r=i.children(`.${a}`);return r.length||(r=d(`<div class="swiper-slide-shadow${s?`-${s}`:""}"></div>`),i.append(r)),r}Object.keys(_).forEach((e=>{Object.keys(_[e]).forEach((t=>{q.prototype[t]=_[e][t]}))})),q.use([function(e){let{swiper:t,on:s,emit:a}=e;const i=r();let n=null,l=null;const o=()=>{t&&!t.destroyed&&t.initialized&&(a("beforeResize"),a("resize"))},d=()=>{t&&!t.destroyed&&t.initialized&&a("orientationchange")};s("init",(()=>{t.params.resizeObserver&&void 0!==i.ResizeObserver?t&&!t.destroyed&&t.initialized&&(n=new ResizeObserver((e=>{l=i.requestAnimationFrame((()=>{const{width:s,height:a}=t;let i=s,r=a;e.forEach((e=>{let{contentBoxSize:s,contentRect:a,target:n}=e;n&&n!==t.el||(i=a?a.width:(s[0]||s).inlineSize,r=a?a.height:(s[0]||s).blockSize)})),i===s&&r===a||o()}))})),n.observe(t.el)):(i.addEventListener("resize",o),i.addEventListener("orientationchange",d))})),s("destroy",(()=>{l&&i.cancelAnimationFrame(l),n&&n.unobserve&&t.el&&(n.unobserve(t.el),n=null),i.removeEventListener("resize",o),i.removeEventListener("orientationchange",d)}))},function(e){let{swiper:t,extendParams:s,on:a,emit:i}=e;const n=[],l=r(),o=function(e,t){void 0===t&&(t={});const s=new(l.MutationObserver||l.WebkitMutationObserver)((e=>{if(1===e.length)return void i("observerUpdate",e[0]);const t=function(){i("observerUpdate",e[0])};l.requestAnimationFrame?l.requestAnimationFrame(t):l.setTimeout(t,0)}));s.observe(e,{attributes:void 0===t.attributes||t.attributes,childList:void 0===t.childList||t.childList,characterData:void 0===t.characterData||t.characterData}),n.push(s)};s({observer:!1,observeParents:!1,observeSlideChildren:!1}),a("init",(()=>{if(t.params.observer){if(t.params.observeParents){const e=t.$el.parents();for(let t=0;t<e.length;t+=1)o(e[t])}o(t.$el[0],{childList:t.params.observeSlideChildren}),o(t.$wrapperEl[0],{attributes:!1})}})),a("destroy",(()=>{n.forEach((e=>{e.disconnect()})),n.splice(0,n.length)}))}]);const re=[function(e){let t,{swiper:s,extendParams:a,on:i}=e;function r(e,t){const a=s.params.virtual;if(a.cache&&s.virtual.cache[t])return s.virtual.cache[t];const i=a.renderSlide?d(a.renderSlide.call(s,e,t)):d(`<div class="${s.params.slideClass}" data-swiper-slide-index="${t}">${e}</div>`);return i.attr("data-swiper-slide-index")||i.attr("data-swiper-slide-index",t),a.cache&&(s.virtual.cache[t]=i),i}function n(e){const{slidesPerView:t,slidesPerGroup:a,centeredSlides:i}=s.params,{addSlidesBefore:n,addSlidesAfter:l}=s.params.virtual,{from:o,to:d,slides:c,slidesGrid:p,offset:u}=s.virtual;s.params.cssMode||s.updateActiveIndex();const h=s.activeIndex||0;let m,f,g;m=s.rtlTranslate?"right":s.isHorizontal()?"left":"top",i?(f=Math.floor(t/2)+a+l,g=Math.floor(t/2)+a+n):(f=t+(a-1)+l,g=a+n);const v=Math.max((h||0)-g,0),w=Math.min((h||0)+f,c.length-1),b=(s.slidesGrid[v]||0)-(s.slidesGrid[0]||0);function x(){s.updateSlides(),s.updateProgress(),s.updateSlidesClasses(),s.lazy&&s.params.lazy.enabled&&s.lazy.load()}if(Object.assign(s.virtual,{from:v,to:w,offset:b,slidesGrid:s.slidesGrid}),o===v&&d===w&&!e)return s.slidesGrid!==p&&b!==u&&s.slides.css(m,`${b}px`),void s.updateProgress();if(s.params.virtual.renderExternal)return s.params.virtual.renderExternal.call(s,{offset:b,from:v,to:w,slides:function(){const e=[];for(let t=v;t<=w;t+=1)e.push(c[t]);return e}()}),void(s.params.virtual.renderExternalUpdate&&x());const y=[],E=[];if(e)s.$wrapperEl.find(`.${s.params.slideClass}`).remove();else for(let e=o;e<=d;e+=1)(e<v||e>w)&&s.$wrapperEl.find(`.${s.params.slideClass}[data-swiper-slide-index="${e}"]`).remove();for(let t=0;t<c.length;t+=1)t>=v&&t<=w&&(void 0===d||e?E.push(t):(t>d&&E.push(t),t<o&&y.push(t)));E.forEach((e=>{s.$wrapperEl.append(r(c[e],e))})),y.sort(((e,t)=>t-e)).forEach((e=>{s.$wrapperEl.prepend(r(c[e],e))})),s.$wrapperEl.children(".swiper-slide").css(m,`${b}px`),x()}a({virtual:{enabled:!1,slides:[],cache:!0,renderSlide:null,renderExternal:null,renderExternalUpdate:!0,addSlidesBefore:0,addSlidesAfter:0}}),s.virtual={cache:{},from:void 0,to:void 0,slides:[],offset:0,slidesGrid:[]},i("beforeInit",(()=>{s.params.virtual.enabled&&(s.virtual.slides=s.params.virtual.slides,s.classNames.push(`${s.params.containerModifierClass}virtual`),s.params.watchSlidesProgress=!0,s.originalParams.watchSlidesProgress=!0,s.params.initialSlide||n())})),i("setTranslate",(()=>{s.params.virtual.enabled&&(s.params.cssMode&&!s._immediateVirtual?(clearTimeout(t),t=setTimeout((()=>{n()}),100)):n())})),i("init update resize",(()=>{s.params.virtual.enabled&&s.params.cssMode&&v(s.wrapperEl,"--swiper-virtual-size",`${s.virtualSize}px`)})),Object.assign(s.virtual,{appendSlide:function(e){if("object"==typeof e&&"length"in e)for(let t=0;t<e.length;t+=1)e[t]&&s.virtual.slides.push(e[t]);else s.virtual.slides.push(e);n(!0)},prependSlide:function(e){const t=s.activeIndex;let a=t+1,i=1;if(Array.isArray(e)){for(let t=0;t<e.length;t+=1)e[t]&&s.virtual.slides.unshift(e[t]);a=t+e.length,i=e.length}else s.virtual.slides.unshift(e);if(s.params.virtual.cache){const e=s.virtual.cache,t={};Object.keys(e).forEach((s=>{const a=e[s],r=a.attr("data-swiper-slide-index");r&&a.attr("data-swiper-slide-index",parseInt(r,10)+i),t[parseInt(s,10)+i]=a})),s.virtual.cache=t}n(!0),s.slideTo(a,0)},removeSlide:function(e){if(null==e)return;let t=s.activeIndex;if(Array.isArray(e))for(let a=e.length-1;a>=0;a-=1)s.virtual.slides.splice(e[a],1),s.params.virtual.cache&&delete s.virtual.cache[e[a]],e[a]<t&&(t-=1),t=Math.max(t,0);else s.virtual.slides.splice(e,1),s.params.virtual.cache&&delete s.virtual.cache[e],e<t&&(t-=1),t=Math.max(t,0);n(!0),s.slideTo(t,0)},removeAllSlides:function(){s.virtual.slides=[],s.params.virtual.cache&&(s.virtual.cache={}),n(!0),s.slideTo(0,0)},update:n})},function(e){let{swiper:t,extendParams:s,on:i,emit:n}=e;const l=a(),o=r();function c(e){if(!t.enabled)return;const{rtlTranslate:s}=t;let a=e;a.originalEvent&&(a=a.originalEvent);const i=a.keyCode||a.charCode,r=t.params.keyboard.pageUpDown,d=r&&33===i,c=r&&34===i,p=37===i,u=39===i,h=38===i,m=40===i;if(!t.allowSlideNext&&(t.isHorizontal()&&u||t.isVertical()&&m||c))return!1;if(!t.allowSlidePrev&&(t.isHorizontal()&&p||t.isVertical()&&h||d))return!1;if(!(a.shiftKey||a.altKey||a.ctrlKey||a.metaKey||l.activeElement&&l.activeElement.nodeName&&("input"===l.activeElement.nodeName.toLowerCase()||"textarea"===l.activeElement.nodeName.toLowerCase()))){if(t.params.keyboard.onlyInViewport&&(d||c||p||u||h||m)){let e=!1;if(t.$el.parents(`.${t.params.slideClass}`).length>0&&0===t.$el.parents(`.${t.params.slideActiveClass}`).length)return;const a=t.$el,i=a[0].clientWidth,r=a[0].clientHeight,n=o.innerWidth,l=o.innerHeight,d=t.$el.offset();s&&(d.left-=t.$el[0].scrollLeft);const c=[[d.left,d.top],[d.left+i,d.top],[d.left,d.top+r],[d.left+i,d.top+r]];for(let t=0;t<c.length;t+=1){const s=c[t];if(s[0]>=0&&s[0]<=n&&s[1]>=0&&s[1]<=l){if(0===s[0]&&0===s[1])continue;e=!0}}if(!e)return}t.isHorizontal()?((d||c||p||u)&&(a.preventDefault?a.preventDefault():a.returnValue=!1),((c||u)&&!s||(d||p)&&s)&&t.slideNext(),((d||p)&&!s||(c||u)&&s)&&t.slidePrev()):((d||c||h||m)&&(a.preventDefault?a.preventDefault():a.returnValue=!1),(c||m)&&t.slideNext(),(d||h)&&t.slidePrev()),n("keyPress",i)}}function p(){t.keyboard.enabled||(d(l).on("keydown",c),t.keyboard.enabled=!0)}function u(){t.keyboard.enabled&&(d(l).off("keydown",c),t.keyboard.enabled=!1)}t.keyboard={enabled:!1},s({keyboard:{enabled:!1,onlyInViewport:!0,pageUpDown:!0}}),i("init",(()=>{t.params.keyboard.enabled&&p()})),i("destroy",(()=>{t.keyboard.enabled&&u()})),Object.assign(t.keyboard,{enable:p,disable:u})},function(e){let{swiper:t,extendParams:s,on:a,emit:i}=e;const n=r();let l;s({mousewheel:{enabled:!1,releaseOnEdges:!1,invert:!1,forceToAxis:!1,sensitivity:1,eventsTarget:"container",thresholdDelta:null,thresholdTime:null}}),t.mousewheel={enabled:!1};let o,c=u();const h=[];function m(){t.enabled&&(t.mouseEntered=!0)}function f(){t.enabled&&(t.mouseEntered=!1)}function g(e){return!(t.params.mousewheel.thresholdDelta&&e.delta<t.params.mousewheel.thresholdDelta)&&(!(t.params.mousewheel.thresholdTime&&u()-c<t.params.mousewheel.thresholdTime)&&(e.delta>=6&&u()-c<60||(e.direction<0?t.isEnd&&!t.params.loop||t.animating||(t.slideNext(),i("scroll",e.raw)):t.isBeginning&&!t.params.loop||t.animating||(t.slidePrev(),i("scroll",e.raw)),c=(new n.Date).getTime(),!1)))}function v(e){let s=e,a=!0;if(!t.enabled)return;const r=t.params.mousewheel;t.params.cssMode&&s.preventDefault();let n=t.$el;if("container"!==t.params.mousewheel.eventsTarget&&(n=d(t.params.mousewheel.eventsTarget)),!t.mouseEntered&&!n[0].contains(s.target)&&!r.releaseOnEdges)return!0;s.originalEvent&&(s=s.originalEvent);let c=0;const m=t.rtlTranslate?-1:1,f=function(e){let t=0,s=0,a=0,i=0;return"detail"in e&&(s=e.detail),"wheelDelta"in e&&(s=-e.wheelDelta/120),"wheelDeltaY"in e&&(s=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=s,s=0),a=10*t,i=10*s,"deltaY"in e&&(i=e.deltaY),"deltaX"in e&&(a=e.deltaX),e.shiftKey&&!a&&(a=i,i=0),(a||i)&&e.deltaMode&&(1===e.deltaMode?(a*=40,i*=40):(a*=800,i*=800)),a&&!t&&(t=a<1?-1:1),i&&!s&&(s=i<1?-1:1),{spinX:t,spinY:s,pixelX:a,pixelY:i}}(s);if(r.forceToAxis)if(t.isHorizontal()){if(!(Math.abs(f.pixelX)>Math.abs(f.pixelY)))return!0;c=-f.pixelX*m}else{if(!(Math.abs(f.pixelY)>Math.abs(f.pixelX)))return!0;c=-f.pixelY}else c=Math.abs(f.pixelX)>Math.abs(f.pixelY)?-f.pixelX*m:-f.pixelY;if(0===c)return!0;r.invert&&(c=-c);let v=t.getTranslate()+c*r.sensitivity;if(v>=t.minTranslate()&&(v=t.minTranslate()),v<=t.maxTranslate()&&(v=t.maxTranslate()),a=!!t.params.loop||!(v===t.minTranslate()||v===t.maxTranslate()),a&&t.params.nested&&s.stopPropagation(),t.params.freeMode&&t.params.freeMode.enabled){const e={time:u(),delta:Math.abs(c),direction:Math.sign(c)},a=o&&e.time<o.time+500&&e.delta<=o.delta&&e.direction===o.direction;if(!a){o=void 0,t.params.loop&&t.loopFix();let n=t.getTranslate()+c*r.sensitivity;const d=t.isBeginning,u=t.isEnd;if(n>=t.minTranslate()&&(n=t.minTranslate()),n<=t.maxTranslate()&&(n=t.maxTranslate()),t.setTransition(0),t.setTranslate(n),t.updateProgress(),t.updateActiveIndex(),t.updateSlidesClasses(),(!d&&t.isBeginning||!u&&t.isEnd)&&t.updateSlidesClasses(),t.params.freeMode.sticky){clearTimeout(l),l=void 0,h.length>=15&&h.shift();const s=h.length?h[h.length-1]:void 0,a=h[0];if(h.push(e),s&&(e.delta>s.delta||e.direction!==s.direction))h.splice(0);else if(h.length>=15&&e.time-a.time<500&&a.delta-e.delta>=1&&e.delta<=6){const s=c>0?.8:.2;o=e,h.splice(0),l=p((()=>{t.slideToClosest(t.params.speed,!0,void 0,s)}),0)}l||(l=p((()=>{o=e,h.splice(0),t.slideToClosest(t.params.speed,!0,void 0,.5)}),500))}if(a||i("scroll",s),t.params.autoplay&&t.params.autoplayDisableOnInteraction&&t.autoplay.stop(),n===t.minTranslate()||n===t.maxTranslate())return!0}}else{const s={time:u(),delta:Math.abs(c),direction:Math.sign(c),raw:e};h.length>=2&&h.shift();const a=h.length?h[h.length-1]:void 0;if(h.push(s),a?(s.direction!==a.direction||s.delta>a.delta||s.time>a.time+150)&&g(s):g(s),function(e){const s=t.params.mousewheel;if(e.direction<0){if(t.isEnd&&!t.params.loop&&s.releaseOnEdges)return!0}else if(t.isBeginning&&!t.params.loop&&s.releaseOnEdges)return!0;return!1}(s))return!0}return s.preventDefault?s.preventDefault():s.returnValue=!1,!1}function w(e){let s=t.$el;"container"!==t.params.mousewheel.eventsTarget&&(s=d(t.params.mousewheel.eventsTarget)),s[e]("mouseenter",m),s[e]("mouseleave",f),s[e]("wheel",v)}function b(){return t.params.cssMode?(t.wrapperEl.removeEventListener("wheel",v),!0):!t.mousewheel.enabled&&(w("on"),t.mousewheel.enabled=!0,!0)}function x(){return t.params.cssMode?(t.wrapperEl.addEventListener(event,v),!0):!!t.mousewheel.enabled&&(w("off"),t.mousewheel.enabled=!1,!0)}a("init",(()=>{!t.params.mousewheel.enabled&&t.params.cssMode&&x(),t.params.mousewheel.enabled&&b()})),a("destroy",(()=>{t.params.cssMode&&b(),t.mousewheel.enabled&&x()})),Object.assign(t.mousewheel,{enable:b,disable:x})},function(e){let{swiper:t,extendParams:s,on:a,emit:i}=e;function r(e){let s;return e&&(s=d(e),t.params.uniqueNavElements&&"string"==typeof e&&s.length>1&&1===t.$el.find(e).length&&(s=t.$el.find(e))),s}function n(e,s){const a=t.params.navigation;e&&e.length>0&&(e[s?"addClass":"removeClass"](a.disabledClass),e[0]&&"BUTTON"===e[0].tagName&&(e[0].disabled=s),t.params.watchOverflow&&t.enabled&&e[t.isLocked?"addClass":"removeClass"](a.lockClass))}function l(){if(t.params.loop)return;const{$nextEl:e,$prevEl:s}=t.navigation;n(s,t.isBeginning&&!t.params.rewind),n(e,t.isEnd&&!t.params.rewind)}function o(e){e.preventDefault(),(!t.isBeginning||t.params.loop||t.params.rewind)&&t.slidePrev()}function c(e){e.preventDefault(),(!t.isEnd||t.params.loop||t.params.rewind)&&t.slideNext()}function p(){const e=t.params.navigation;if(t.params.navigation=F(t,t.originalParams.navigation,t.params.navigation,{nextEl:"swiper-button-next",prevEl:"swiper-button-prev"}),!e.nextEl&&!e.prevEl)return;const s=r(e.nextEl),a=r(e.prevEl);s&&s.length>0&&s.on("click",c),a&&a.length>0&&a.on("click",o),Object.assign(t.navigation,{$nextEl:s,nextEl:s&&s[0],$prevEl:a,prevEl:a&&a[0]}),t.enabled||(s&&s.addClass(e.lockClass),a&&a.addClass(e.lockClass))}function u(){const{$nextEl:e,$prevEl:s}=t.navigation;e&&e.length&&(e.off("click",c),e.removeClass(t.params.navigation.disabledClass)),s&&s.length&&(s.off("click",o),s.removeClass(t.params.navigation.disabledClass))}s({navigation:{nextEl:null,prevEl:null,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock"}}),t.navigation={nextEl:null,$nextEl:null,prevEl:null,$prevEl:null},a("init",(()=>{p(),l()})),a("toEdge fromEdge lock unlock",(()=>{l()})),a("destroy",(()=>{u()})),a("enable disable",(()=>{const{$nextEl:e,$prevEl:s}=t.navigation;e&&e[t.enabled?"removeClass":"addClass"](t.params.navigation.lockClass),s&&s[t.enabled?"removeClass":"addClass"](t.params.navigation.lockClass)})),a("click",((e,s)=>{const{$nextEl:a,$prevEl:r}=t.navigation,n=s.target;if(t.params.navigation.hideOnClick&&!d(n).is(r)&&!d(n).is(a)){if(t.pagination&&t.params.pagination&&t.params.pagination.clickable&&(t.pagination.el===n||t.pagination.el.contains(n)))return;let e;a?e=a.hasClass(t.params.navigation.hiddenClass):r&&(e=r.hasClass(t.params.navigation.hiddenClass)),i(!0===e?"navigationShow":"navigationHide"),a&&a.toggleClass(t.params.navigation.hiddenClass),r&&r.toggleClass(t.params.navigation.hiddenClass)}})),Object.assign(t.navigation,{update:l,init:p,destroy:u})},function(e){let{swiper:t,extendParams:s,on:a,emit:i}=e;const r="swiper-pagination";let n;s({pagination:{el:null,bulletElement:"span",clickable:!1,hideOnClick:!1,renderBullet:null,renderProgressbar:null,renderFraction:null,renderCustom:null,progressbarOpposite:!1,type:"bullets",dynamicBullets:!1,dynamicMainBullets:1,formatFractionCurrent:e=>e,formatFractionTotal:e=>e,bulletClass:`${r}-bullet`,bulletActiveClass:`${r}-bullet-active`,modifierClass:`${r}-`,currentClass:`${r}-current`,totalClass:`${r}-total`,hiddenClass:`${r}-hidden`,progressbarFillClass:`${r}-progressbar-fill`,progressbarOppositeClass:`${r}-progressbar-opposite`,clickableClass:`${r}-clickable`,lockClass:`${r}-lock`,horizontalClass:`${r}-horizontal`,verticalClass:`${r}-vertical`}}),t.pagination={el:null,$el:null,bullets:[]};let l=0;function o(){return!t.params.pagination.el||!t.pagination.el||!t.pagination.$el||0===t.pagination.$el.length}function c(e,s){const{bulletActiveClass:a}=t.params.pagination;e[s]().addClass(`${a}-${s}`)[s]().addClass(`${a}-${s}-${s}`)}function p(){const e=t.rtl,s=t.params.pagination;if(o())return;const a=t.virtual&&t.params.virtual.enabled?t.virtual.slides.length:t.slides.length,r=t.pagination.$el;let p;const u=t.params.loop?Math.ceil((a-2*t.loopedSlides)/t.params.slidesPerGroup):t.snapGrid.length;if(t.params.loop?(p=Math.ceil((t.activeIndex-t.loopedSlides)/t.params.slidesPerGroup),p>a-1-2*t.loopedSlides&&(p-=a-2*t.loopedSlides),p>u-1&&(p-=u),p<0&&"bullets"!==t.params.paginationType&&(p=u+p)):p=void 0!==t.snapIndex?t.snapIndex:t.activeIndex||0,"bullets"===s.type&&t.pagination.bullets&&t.pagination.bullets.length>0){const a=t.pagination.bullets;let i,o,u;if(s.dynamicBullets&&(n=a.eq(0)[t.isHorizontal()?"outerWidth":"outerHeight"](!0),r.css(t.isHorizontal()?"width":"height",n*(s.dynamicMainBullets+4)+"px"),s.dynamicMainBullets>1&&void 0!==t.previousIndex&&(l+=p-(t.previousIndex-t.loopedSlides||0),l>s.dynamicMainBullets-1?l=s.dynamicMainBullets-1:l<0&&(l=0)),i=Math.max(p-l,0),o=i+(Math.min(a.length,s.dynamicMainBullets)-1),u=(o+i)/2),a.removeClass(["","-next","-next-next","-prev","-prev-prev","-main"].map((e=>`${s.bulletActiveClass}${e}`)).join(" ")),r.length>1)a.each((e=>{const t=d(e),a=t.index();a===p&&t.addClass(s.bulletActiveClass),s.dynamicBullets&&(a>=i&&a<=o&&t.addClass(`${s.bulletActiveClass}-main`),a===i&&c(t,"prev"),a===o&&c(t,"next"))}));else{const e=a.eq(p),r=e.index();if(e.addClass(s.bulletActiveClass),s.dynamicBullets){const e=a.eq(i),n=a.eq(o);for(let e=i;e<=o;e+=1)a.eq(e).addClass(`${s.bulletActiveClass}-main`);if(t.params.loop)if(r>=a.length){for(let e=s.dynamicMainBullets;e>=0;e-=1)a.eq(a.length-e).addClass(`${s.bulletActiveClass}-main`);a.eq(a.length-s.dynamicMainBullets-1).addClass(`${s.bulletActiveClass}-prev`)}else c(e,"prev"),c(n,"next");else c(e,"prev"),c(n,"next")}}if(s.dynamicBullets){const i=Math.min(a.length,s.dynamicMainBullets+4),r=(n*i-n)/2-u*n,l=e?"right":"left";a.css(t.isHorizontal()?l:"top",`${r}px`)}}if("fraction"===s.type&&(r.find(U(s.currentClass)).text(s.formatFractionCurrent(p+1)),r.find(U(s.totalClass)).text(s.formatFractionTotal(u))),"progressbar"===s.type){let e;e=s.progressbarOpposite?t.isHorizontal()?"vertical":"horizontal":t.isHorizontal()?"horizontal":"vertical";const a=(p+1)/u;let i=1,n=1;"horizontal"===e?i=a:n=a,r.find(U(s.progressbarFillClass)).transform(`translate3d(0,0,0) scaleX(${i}) scaleY(${n})`).transition(t.params.speed)}"custom"===s.type&&s.renderCustom?(r.html(s.renderCustom(t,p+1,u)),i("paginationRender",r[0])):i("paginationUpdate",r[0]),t.params.watchOverflow&&t.enabled&&r[t.isLocked?"addClass":"removeClass"](s.lockClass)}function u(){const e=t.params.pagination;if(o())return;const s=t.virtual&&t.params.virtual.enabled?t.virtual.slides.length:t.slides.length,a=t.pagination.$el;let r="";if("bullets"===e.type){let i=t.params.loop?Math.ceil((s-2*t.loopedSlides)/t.params.slidesPerGroup):t.snapGrid.length;t.params.freeMode&&t.params.freeMode.enabled&&!t.params.loop&&i>s&&(i=s);for(let s=0;s<i;s+=1)e.renderBullet?r+=e.renderBullet.call(t,s,e.bulletClass):r+=`<${e.bulletElement} class="${e.bulletClass}"></${e.bulletElement}>`;a.html(r),t.pagination.bullets=a.find(U(e.bulletClass))}"fraction"===e.type&&(r=e.renderFraction?e.renderFraction.call(t,e.currentClass,e.totalClass):`<span class="${e.currentClass}"></span> / <span class="${e.totalClass}"></span>`,a.html(r)),"progressbar"===e.type&&(r=e.renderProgressbar?e.renderProgressbar.call(t,e.progressbarFillClass):`<span class="${e.progressbarFillClass}"></span>`,a.html(r)),"custom"!==e.type&&i("paginationRender",t.pagination.$el[0])}function h(){t.params.pagination=F(t,t.originalParams.pagination,t.params.pagination,{el:"swiper-pagination"});const e=t.params.pagination;if(!e.el)return;let s=d(e.el);0!==s.length&&(t.params.uniqueNavElements&&"string"==typeof e.el&&s.length>1&&(s=t.$el.find(e.el),s.length>1&&(s=s.filter((e=>d(e).parents(".swiper")[0]===t.el)))),"bullets"===e.type&&e.clickable&&s.addClass(e.clickableClass),s.addClass(e.modifierClass+e.type),s.addClass(e.modifierClass+t.params.direction),"bullets"===e.type&&e.dynamicBullets&&(s.addClass(`${e.modifierClass}${e.type}-dynamic`),l=0,e.dynamicMainBullets<1&&(e.dynamicMainBullets=1)),"progressbar"===e.type&&e.progressbarOpposite&&s.addClass(e.progressbarOppositeClass),e.clickable&&s.on("click",U(e.bulletClass),(function(e){e.preventDefault();let s=d(this).index()*t.params.slidesPerGroup;t.params.loop&&(s+=t.loopedSlides),t.slideTo(s)})),Object.assign(t.pagination,{$el:s,el:s[0]}),t.enabled||s.addClass(e.lockClass))}function m(){const e=t.params.pagination;if(o())return;const s=t.pagination.$el;s.removeClass(e.hiddenClass),s.removeClass(e.modifierClass+e.type),s.removeClass(e.modifierClass+t.params.direction),t.pagination.bullets&&t.pagination.bullets.removeClass&&t.pagination.bullets.removeClass(e.bulletActiveClass),e.clickable&&s.off("click",U(e.bulletClass))}a("init",(()=>{h(),u(),p()})),a("activeIndexChange",(()=>{(t.params.loop||void 0===t.snapIndex)&&p()})),a("snapIndexChange",(()=>{t.params.loop||p()})),a("slidesLengthChange",(()=>{t.params.loop&&(u(),p())})),a("snapGridLengthChange",(()=>{t.params.loop||(u(),p())})),a("destroy",(()=>{m()})),a("enable disable",(()=>{const{$el:e}=t.pagination;e&&e[t.enabled?"removeClass":"addClass"](t.params.pagination.lockClass)})),a("lock unlock",(()=>{p()})),a("click",((e,s)=>{const a=s.target,{$el:r}=t.pagination;if(t.params.pagination.el&&t.params.pagination.hideOnClick&&r.length>0&&!d(a).hasClass(t.params.pagination.bulletClass)){if(t.navigation&&(t.navigation.nextEl&&a===t.navigation.nextEl||t.navigation.prevEl&&a===t.navigation.prevEl))return;const e=r.hasClass(t.params.pagination.hiddenClass);i(!0===e?"paginationShow":"paginationHide"),r.toggleClass(t.params.pagination.hiddenClass)}})),Object.assign(t.pagination,{render:u,update:p,init:h,destroy:m})},function(e){let{swiper:t,extendParams:s,on:i,emit:r}=e;const n=a();let l,o,c,u,h=!1,m=null,f=null;function g(){if(!t.params.scrollbar.el||!t.scrollbar.el)return;const{scrollbar:e,rtlTranslate:s,progress:a}=t,{$dragEl:i,$el:r}=e,n=t.params.scrollbar;let l=o,d=(c-o)*a;s?(d=-d,d>0?(l=o-d,d=0):-d+o>c&&(l=c+d)):d<0?(l=o+d,d=0):d+o>c&&(l=c-d),t.isHorizontal()?(i.transform(`translate3d(${d}px, 0, 0)`),i[0].style.width=`${l}px`):(i.transform(`translate3d(0px, ${d}px, 0)`),i[0].style.height=`${l}px`),n.hide&&(clearTimeout(m),r[0].style.opacity=1,m=setTimeout((()=>{r[0].style.opacity=0,r.transition(400)}),1e3))}function v(){if(!t.params.scrollbar.el||!t.scrollbar.el)return;const{scrollbar:e}=t,{$dragEl:s,$el:a}=e;s[0].style.width="",s[0].style.height="",c=t.isHorizontal()?a[0].offsetWidth:a[0].offsetHeight,u=t.size/(t.virtualSize+t.params.slidesOffsetBefore-(t.params.centeredSlides?t.snapGrid[0]:0)),o="auto"===t.params.scrollbar.dragSize?c*u:parseInt(t.params.scrollbar.dragSize,10),t.isHorizontal()?s[0].style.width=`${o}px`:s[0].style.height=`${o}px`,a[0].style.display=u>=1?"none":"",t.params.scrollbar.hide&&(a[0].style.opacity=0),t.params.watchOverflow&&t.enabled&&e.$el[t.isLocked?"addClass":"removeClass"](t.params.scrollbar.lockClass)}function w(e){return t.isHorizontal()?"touchstart"===e.type||"touchmove"===e.type?e.targetTouches[0].clientX:e.clientX:"touchstart"===e.type||"touchmove"===e.type?e.targetTouches[0].clientY:e.clientY}function b(e){const{scrollbar:s,rtlTranslate:a}=t,{$el:i}=s;let r;r=(w(e)-i.offset()[t.isHorizontal()?"left":"top"]-(null!==l?l:o/2))/(c-o),r=Math.max(Math.min(r,1),0),a&&(r=1-r);const n=t.minTranslate()+(t.maxTranslate()-t.minTranslate())*r;t.updateProgress(n),t.setTranslate(n),t.updateActiveIndex(),t.updateSlidesClasses()}function x(e){const s=t.params.scrollbar,{scrollbar:a,$wrapperEl:i}=t,{$el:n,$dragEl:o}=a;h=!0,l=e.target===o[0]||e.target===o?w(e)-e.target.getBoundingClientRect()[t.isHorizontal()?"left":"top"]:null,e.preventDefault(),e.stopPropagation(),i.transition(100),o.transition(100),b(e),clearTimeout(f),n.transition(0),s.hide&&n.css("opacity",1),t.params.cssMode&&t.$wrapperEl.css("scroll-snap-type","none"),r("scrollbarDragStart",e)}function y(e){const{scrollbar:s,$wrapperEl:a}=t,{$el:i,$dragEl:n}=s;h&&(e.preventDefault?e.preventDefault():e.returnValue=!1,b(e),a.transition(0),i.transition(0),n.transition(0),r("scrollbarDragMove",e))}function E(e){const s=t.params.scrollbar,{scrollbar:a,$wrapperEl:i}=t,{$el:n}=a;h&&(h=!1,t.params.cssMode&&(t.$wrapperEl.css("scroll-snap-type",""),i.transition("")),s.hide&&(clearTimeout(f),f=p((()=>{n.css("opacity",0),n.transition(400)}),1e3)),r("scrollbarDragEnd",e),s.snapOnRelease&&t.slideToClosest())}function T(e){const{scrollbar:s,touchEventsTouch:a,touchEventsDesktop:i,params:r,support:l}=t,o=s.$el[0],d=!(!l.passiveListener||!r.passiveListeners)&&{passive:!1,capture:!1},c=!(!l.passiveListener||!r.passiveListeners)&&{passive:!0,capture:!1};if(!o)return;const p="on"===e?"addEventListener":"removeEventListener";l.touch?(o[p](a.start,x,d),o[p](a.move,y,d),o[p](a.end,E,c)):(o[p](i.start,x,d),n[p](i.move,y,d),n[p](i.end,E,c))}function C(){const{scrollbar:e,$el:s}=t;t.params.scrollbar=F(t,t.originalParams.scrollbar,t.params.scrollbar,{el:"swiper-scrollbar"});const a=t.params.scrollbar;if(!a.el)return;let i=d(a.el);t.params.uniqueNavElements&&"string"==typeof a.el&&i.length>1&&1===s.find(a.el).length&&(i=s.find(a.el));let r=i.find(`.${t.params.scrollbar.dragClass}`);0===r.length&&(r=d(`<div class="${t.params.scrollbar.dragClass}"></div>`),i.append(r)),Object.assign(e,{$el:i,el:i[0],$dragEl:r,dragEl:r[0]}),a.draggable&&t.params.scrollbar.el&&T("on"),i&&i[t.enabled?"removeClass":"addClass"](t.params.scrollbar.lockClass)}function $(){t.params.scrollbar.el&&T("off")}s({scrollbar:{el:null,dragSize:"auto",hide:!1,draggable:!1,snapOnRelease:!0,lockClass:"swiper-scrollbar-lock",dragClass:"swiper-scrollbar-drag"}}),t.scrollbar={el:null,dragEl:null,$el:null,$dragEl:null},i("init",(()=>{C(),v(),g()})),i("update resize observerUpdate lock unlock",(()=>{v()})),i("setTranslate",(()=>{g()})),i("setTransition",((e,s)=>{!function(e){t.params.scrollbar.el&&t.scrollbar.el&&t.scrollbar.$dragEl.transition(e)}(s)})),i("enable disable",(()=>{const{$el:e}=t.scrollbar;e&&e[t.enabled?"removeClass":"addClass"](t.params.scrollbar.lockClass)})),i("destroy",(()=>{$()})),Object.assign(t.scrollbar,{updateSize:v,setTranslate:g,init:C,destroy:$})},function(e){let{swiper:t,extendParams:s,on:a}=e;s({parallax:{enabled:!1}});const i=(e,s)=>{const{rtl:a}=t,i=d(e),r=a?-1:1,n=i.attr("data-swiper-parallax")||"0";let l=i.attr("data-swiper-parallax-x"),o=i.attr("data-swiper-parallax-y");const c=i.attr("data-swiper-parallax-scale"),p=i.attr("data-swiper-parallax-opacity");if(l||o?(l=l||"0",o=o||"0"):t.isHorizontal()?(l=n,o="0"):(o=n,l="0"),l=l.indexOf("%")>=0?parseInt(l,10)*s*r+"%":l*s*r+"px",o=o.indexOf("%")>=0?parseInt(o,10)*s+"%":o*s+"px",null!=p){const e=p-(p-1)*(1-Math.abs(s));i[0].style.opacity=e}if(null==c)i.transform(`translate3d(${l}, ${o}, 0px)`);else{const e=c-(c-1)*(1-Math.abs(s));i.transform(`translate3d(${l}, ${o}, 0px) scale(${e})`)}},r=()=>{const{$el:e,slides:s,progress:a,snapGrid:r}=t;e.children("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]").each((e=>{i(e,a)})),s.each(((e,s)=>{let n=e.progress;t.params.slidesPerGroup>1&&"auto"!==t.params.slidesPerView&&(n+=Math.ceil(s/2)-a*(r.length-1)),n=Math.min(Math.max(n,-1),1),d(e).find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]").each((e=>{i(e,n)}))}))};a("beforeInit",(()=>{t.params.parallax.enabled&&(t.params.watchSlidesProgress=!0,t.originalParams.watchSlidesProgress=!0)})),a("init",(()=>{t.params.parallax.enabled&&r()})),a("setTranslate",(()=>{t.params.parallax.enabled&&r()})),a("setTransition",((e,s)=>{t.params.parallax.enabled&&function(e){void 0===e&&(e=t.params.speed);const{$el:s}=t;s.find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]").each((t=>{const s=d(t);let a=parseInt(s.attr("data-swiper-parallax-duration"),10)||e;0===e&&(a=0),s.transition(a)}))}(s)}))},function(e){let{swiper:t,extendParams:s,on:a,emit:i}=e;const n=r();s({zoom:{enabled:!1,maxRatio:3,minRatio:1,toggle:!0,containerClass:"swiper-zoom-container",zoomedSlideClass:"swiper-slide-zoomed"}}),t.zoom={enabled:!1};let l,o,c,p=1,u=!1;const m={$slideEl:void 0,slideWidth:void 0,slideHeight:void 0,$imageEl:void 0,$imageWrapEl:void 0,maxRatio:3},f={isTouched:void 0,isMoved:void 0,currentX:void 0,currentY:void 0,minX:void 0,minY:void 0,maxX:void 0,maxY:void 0,width:void 0,height:void 0,startX:void 0,startY:void 0,touchesStart:{},touchesCurrent:{}},g={x:void 0,y:void 0,prevPositionX:void 0,prevPositionY:void 0,prevTime:void 0};let v=1;function w(e){if(e.targetTouches.length<2)return 1;const t=e.targetTouches[0].pageX,s=e.targetTouches[0].pageY,a=e.targetTouches[1].pageX,i=e.targetTouches[1].pageY;return Math.sqrt((a-t)**2+(i-s)**2)}function b(e){const s=t.support,a=t.params.zoom;if(o=!1,c=!1,!s.gestures){if("touchstart"!==e.type||"touchstart"===e.type&&e.targetTouches.length<2)return;o=!0,m.scaleStart=w(e)}m.$slideEl&&m.$slideEl.length||(m.$slideEl=d(e.target).closest(`.${t.params.slideClass}`),0===m.$slideEl.length&&(m.$slideEl=t.slides.eq(t.activeIndex)),m.$imageEl=m.$slideEl.find(`.${a.containerClass}`).eq(0).find("picture, img, svg, canvas, .swiper-zoom-target").eq(0),m.$imageWrapEl=m.$imageEl.parent(`.${a.containerClass}`),m.maxRatio=m.$imageWrapEl.attr("data-swiper-zoom")||a.maxRatio,0!==m.$imageWrapEl.length)?(m.$imageEl&&m.$imageEl.transition(0),u=!0):m.$imageEl=void 0}function x(e){const s=t.support,a=t.params.zoom,i=t.zoom;if(!s.gestures){if("touchmove"!==e.type||"touchmove"===e.type&&e.targetTouches.length<2)return;c=!0,m.scaleMove=w(e)}m.$imageEl&&0!==m.$imageEl.length?(s.gestures?i.scale=e.scale*p:i.scale=m.scaleMove/m.scaleStart*p,i.scale>m.maxRatio&&(i.scale=m.maxRatio-1+(i.scale-m.maxRatio+1)**.5),i.scale<a.minRatio&&(i.scale=a.minRatio+1-(a.minRatio-i.scale+1)**.5),m.$imageEl.transform(`translate3d(0,0,0) scale(${i.scale})`)):"gesturechange"===e.type&&b(e)}function y(e){const s=t.device,a=t.support,i=t.params.zoom,r=t.zoom;if(!a.gestures){if(!o||!c)return;if("touchend"!==e.type||"touchend"===e.type&&e.changedTouches.length<2&&!s.android)return;o=!1,c=!1}m.$imageEl&&0!==m.$imageEl.length&&(r.scale=Math.max(Math.min(r.scale,m.maxRatio),i.minRatio),m.$imageEl.transition(t.params.speed).transform(`translate3d(0,0,0) scale(${r.scale})`),p=r.scale,u=!1,1===r.scale&&(m.$slideEl=void 0))}function E(e){const s=t.zoom;if(!m.$imageEl||0===m.$imageEl.length)return;if(t.allowClick=!1,!f.isTouched||!m.$slideEl)return;f.isMoved||(f.width=m.$imageEl[0].offsetWidth,f.height=m.$imageEl[0].offsetHeight,f.startX=h(m.$imageWrapEl[0],"x")||0,f.startY=h(m.$imageWrapEl[0],"y")||0,m.slideWidth=m.$slideEl[0].offsetWidth,m.slideHeight=m.$slideEl[0].offsetHeight,m.$imageWrapEl.transition(0));const a=f.width*s.scale,i=f.height*s.scale;if(!(a<m.slideWidth&&i<m.slideHeight)){if(f.minX=Math.min(m.slideWidth/2-a/2,0),f.maxX=-f.minX,f.minY=Math.min(m.slideHeight/2-i/2,0),f.maxY=-f.minY,f.touchesCurrent.x="touchmove"===e.type?e.targetTouches[0].pageX:e.pageX,f.touchesCurrent.y="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY,!f.isMoved&&!u){if(t.isHorizontal()&&(Math.floor(f.minX)===Math.floor(f.startX)&&f.touchesCurrent.x<f.touchesStart.x||Math.floor(f.maxX)===Math.floor(f.startX)&&f.touchesCurrent.x>f.touchesStart.x))return void(f.isTouched=!1);if(!t.isHorizontal()&&(Math.floor(f.minY)===Math.floor(f.startY)&&f.touchesCurrent.y<f.touchesStart.y||Math.floor(f.maxY)===Math.floor(f.startY)&&f.touchesCurrent.y>f.touchesStart.y))return void(f.isTouched=!1)}e.cancelable&&e.preventDefault(),e.stopPropagation(),f.isMoved=!0,f.currentX=f.touchesCurrent.x-f.touchesStart.x+f.startX,f.currentY=f.touchesCurrent.y-f.touchesStart.y+f.startY,f.currentX<f.minX&&(f.currentX=f.minX+1-(f.minX-f.currentX+1)**.8),f.currentX>f.maxX&&(f.currentX=f.maxX-1+(f.currentX-f.maxX+1)**.8),f.currentY<f.minY&&(f.currentY=f.minY+1-(f.minY-f.currentY+1)**.8),f.currentY>f.maxY&&(f.currentY=f.maxY-1+(f.currentY-f.maxY+1)**.8),g.prevPositionX||(g.prevPositionX=f.touchesCurrent.x),g.prevPositionY||(g.prevPositionY=f.touchesCurrent.y),g.prevTime||(g.prevTime=Date.now()),g.x=(f.touchesCurrent.x-g.prevPositionX)/(Date.now()-g.prevTime)/2,g.y=(f.touchesCurrent.y-g.prevPositionY)/(Date.now()-g.prevTime)/2,Math.abs(f.touchesCurrent.x-g.prevPositionX)<2&&(g.x=0),Math.abs(f.touchesCurrent.y-g.prevPositionY)<2&&(g.y=0),g.prevPositionX=f.touchesCurrent.x,g.prevPositionY=f.touchesCurrent.y,g.prevTime=Date.now(),m.$imageWrapEl.transform(`translate3d(${f.currentX}px, ${f.currentY}px,0)`)}}function T(){const e=t.zoom;m.$slideEl&&t.previousIndex!==t.activeIndex&&(m.$imageEl&&m.$imageEl.transform("translate3d(0,0,0) scale(1)"),m.$imageWrapEl&&m.$imageWrapEl.transform("translate3d(0,0,0)"),e.scale=1,p=1,m.$slideEl=void 0,m.$imageEl=void 0,m.$imageWrapEl=void 0)}function C(e){const s=t.zoom,a=t.params.zoom;if(m.$slideEl||(e&&e.target&&(m.$slideEl=d(e.target).closest(`.${t.params.slideClass}`)),m.$slideEl||(t.params.virtual&&t.params.virtual.enabled&&t.virtual?m.$slideEl=t.$wrapperEl.children(`.${t.params.slideActiveClass}`):m.$slideEl=t.slides.eq(t.activeIndex)),m.$imageEl=m.$slideEl.find(`.${a.containerClass}`).eq(0).find("picture, img, svg, canvas, .swiper-zoom-target").eq(0),m.$imageWrapEl=m.$imageEl.parent(`.${a.containerClass}`)),!m.$imageEl||0===m.$imageEl.length||!m.$imageWrapEl||0===m.$imageWrapEl.length)return;let i,r,l,o,c,u,h,g,v,w,b,x,y,E,T,C,$,S;t.params.cssMode&&(t.wrapperEl.style.overflow="hidden",t.wrapperEl.style.touchAction="none"),m.$slideEl.addClass(`${a.zoomedSlideClass}`),void 0===f.touchesStart.x&&e?(i="touchend"===e.type?e.changedTouches[0].pageX:e.pageX,r="touchend"===e.type?e.changedTouches[0].pageY:e.pageY):(i=f.touchesStart.x,r=f.touchesStart.y),s.scale=m.$imageWrapEl.attr("data-swiper-zoom")||a.maxRatio,p=m.$imageWrapEl.attr("data-swiper-zoom")||a.maxRatio,e?($=m.$slideEl[0].offsetWidth,S=m.$slideEl[0].offsetHeight,l=m.$slideEl.offset().left+n.scrollX,o=m.$slideEl.offset().top+n.scrollY,c=l+$/2-i,u=o+S/2-r,v=m.$imageEl[0].offsetWidth,w=m.$imageEl[0].offsetHeight,b=v*s.scale,x=w*s.scale,y=Math.min($/2-b/2,0),E=Math.min(S/2-x/2,0),T=-y,C=-E,h=c*s.scale,g=u*s.scale,h<y&&(h=y),h>T&&(h=T),g<E&&(g=E),g>C&&(g=C)):(h=0,g=0),m.$imageWrapEl.transition(300).transform(`translate3d(${h}px, ${g}px,0)`),m.$imageEl.transition(300).transform(`translate3d(0,0,0) scale(${s.scale})`)}function $(){const e=t.zoom,s=t.params.zoom;m.$slideEl||(t.params.virtual&&t.params.virtual.enabled&&t.virtual?m.$slideEl=t.$wrapperEl.children(`.${t.params.slideActiveClass}`):m.$slideEl=t.slides.eq(t.activeIndex),m.$imageEl=m.$slideEl.find(`.${s.containerClass}`).eq(0).find("picture, img, svg, canvas, .swiper-zoom-target").eq(0),m.$imageWrapEl=m.$imageEl.parent(`.${s.containerClass}`)),m.$imageEl&&0!==m.$imageEl.length&&m.$imageWrapEl&&0!==m.$imageWrapEl.length&&(t.params.cssMode&&(t.wrapperEl.style.overflow="",t.wrapperEl.style.touchAction=""),e.scale=1,p=1,m.$imageWrapEl.transition(300).transform("translate3d(0,0,0)"),m.$imageEl.transition(300).transform("translate3d(0,0,0) scale(1)"),m.$slideEl.removeClass(`${s.zoomedSlideClass}`),m.$slideEl=void 0)}function S(e){const s=t.zoom;s.scale&&1!==s.scale?$():C(e)}function M(){const e=t.support;return{passiveListener:!("touchstart"!==t.touchEvents.start||!e.passiveListener||!t.params.passiveListeners)&&{passive:!0,capture:!1},activeListenerWithCapture:!e.passiveListener||{passive:!1,capture:!0}}}function P(){return`.${t.params.slideClass}`}function k(e){const{passiveListener:s}=M(),a=P();t.$wrapperEl[e]("gesturestart",a,b,s),t.$wrapperEl[e]("gesturechange",a,x,s),t.$wrapperEl[e]("gestureend",a,y,s)}function z(){l||(l=!0,k("on"))}function O(){l&&(l=!1,k("off"))}function I(){const e=t.zoom;if(e.enabled)return;e.enabled=!0;const s=t.support,{passiveListener:a,activeListenerWithCapture:i}=M(),r=P();s.gestures?(t.$wrapperEl.on(t.touchEvents.start,z,a),t.$wrapperEl.on(t.touchEvents.end,O,a)):"touchstart"===t.touchEvents.start&&(t.$wrapperEl.on(t.touchEvents.start,r,b,a),t.$wrapperEl.on(t.touchEvents.move,r,x,i),t.$wrapperEl.on(t.touchEvents.end,r,y,a),t.touchEvents.cancel&&t.$wrapperEl.on(t.touchEvents.cancel,r,y,a)),t.$wrapperEl.on(t.touchEvents.move,`.${t.params.zoom.containerClass}`,E,i)}function L(){const e=t.zoom;if(!e.enabled)return;const s=t.support;e.enabled=!1;const{passiveListener:a,activeListenerWithCapture:i}=M(),r=P();s.gestures?(t.$wrapperEl.off(t.touchEvents.start,z,a),t.$wrapperEl.off(t.touchEvents.end,O,a)):"touchstart"===t.touchEvents.start&&(t.$wrapperEl.off(t.touchEvents.start,r,b,a),t.$wrapperEl.off(t.touchEvents.move,r,x,i),t.$wrapperEl.off(t.touchEvents.end,r,y,a),t.touchEvents.cancel&&t.$wrapperEl.off(t.touchEvents.cancel,r,y,a)),t.$wrapperEl.off(t.touchEvents.move,`.${t.params.zoom.containerClass}`,E,i)}Object.defineProperty(t.zoom,"scale",{get:()=>v,set(e){if(v!==e){const t=m.$imageEl?m.$imageEl[0]:void 0,s=m.$slideEl?m.$slideEl[0]:void 0;i("zoomChange",e,t,s)}v=e}}),a("init",(()=>{t.params.zoom.enabled&&I()})),a("destroy",(()=>{L()})),a("touchStart",((e,s)=>{t.zoom.enabled&&function(e){const s=t.device;m.$imageEl&&0!==m.$imageEl.length&&(f.isTouched||(s.android&&e.cancelable&&e.preventDefault(),f.isTouched=!0,f.touchesStart.x="touchstart"===e.type?e.targetTouches[0].pageX:e.pageX,f.touchesStart.y="touchstart"===e.type?e.targetTouches[0].pageY:e.pageY))}(s)})),a("touchEnd",((e,s)=>{t.zoom.enabled&&function(){const e=t.zoom;if(!m.$imageEl||0===m.$imageEl.length)return;if(!f.isTouched||!f.isMoved)return f.isTouched=!1,void(f.isMoved=!1);f.isTouched=!1,f.isMoved=!1;let s=300,a=300;const i=g.x*s,r=f.currentX+i,n=g.y*a,l=f.currentY+n;0!==g.x&&(s=Math.abs((r-f.currentX)/g.x)),0!==g.y&&(a=Math.abs((l-f.currentY)/g.y));const o=Math.max(s,a);f.currentX=r,f.currentY=l;const d=f.width*e.scale,c=f.height*e.scale;f.minX=Math.min(m.slideWidth/2-d/2,0),f.maxX=-f.minX,f.minY=Math.min(m.slideHeight/2-c/2,0),f.maxY=-f.minY,f.currentX=Math.max(Math.min(f.currentX,f.maxX),f.minX),f.currentY=Math.max(Math.min(f.currentY,f.maxY),f.minY),m.$imageWrapEl.transition(o).transform(`translate3d(${f.currentX}px, ${f.currentY}px,0)`)}()})),a("doubleTap",((e,s)=>{!t.animating&&t.params.zoom.enabled&&t.zoom.enabled&&t.params.zoom.toggle&&S(s)})),a("transitionEnd",(()=>{t.zoom.enabled&&t.params.zoom.enabled&&T()})),a("slideChange",(()=>{t.zoom.enabled&&t.params.zoom.enabled&&t.params.cssMode&&T()})),Object.assign(t.zoom,{enable:I,disable:L,in:C,out:$,toggle:S})},function(e){let{swiper:t,extendParams:s,on:a,emit:i}=e;s({lazy:{checkInView:!1,enabled:!1,loadPrevNext:!1,loadPrevNextAmount:1,loadOnTransitionStart:!1,scrollingElement:"",elementClass:"swiper-lazy",loadingClass:"swiper-lazy-loading",loadedClass:"swiper-lazy-loaded",preloaderClass:"swiper-lazy-preloader"}}),t.lazy={};let n=!1,l=!1;function o(e,s){void 0===s&&(s=!0);const a=t.params.lazy;if(void 0===e)return;if(0===t.slides.length)return;const r=t.virtual&&t.params.virtual.enabled?t.$wrapperEl.children(`.${t.params.slideClass}[data-swiper-slide-index="${e}"]`):t.slides.eq(e),n=r.find(`.${a.elementClass}:not(.${a.loadedClass}):not(.${a.loadingClass})`);!r.hasClass(a.elementClass)||r.hasClass(a.loadedClass)||r.hasClass(a.loadingClass)||n.push(r[0]),0!==n.length&&n.each((e=>{const n=d(e);n.addClass(a.loadingClass);const l=n.attr("data-background"),c=n.attr("data-src"),p=n.attr("data-srcset"),u=n.attr("data-sizes"),h=n.parent("picture");t.loadImage(n[0],c||l,p,u,!1,(()=>{if(null!=t&&t&&(!t||t.params)&&!t.destroyed){if(l?(n.css("background-image",`url("${l}")`),n.removeAttr("data-background")):(p&&(n.attr("srcset",p),n.removeAttr("data-srcset")),u&&(n.attr("sizes",u),n.removeAttr("data-sizes")),h.length&&h.children("source").each((e=>{const t=d(e);t.attr("data-srcset")&&(t.attr("srcset",t.attr("data-srcset")),t.removeAttr("data-srcset"))})),c&&(n.attr("src",c),n.removeAttr("data-src"))),n.addClass(a.loadedClass).removeClass(a.loadingClass),r.find(`.${a.preloaderClass}`).remove(),t.params.loop&&s){const e=r.attr("data-swiper-slide-index");if(r.hasClass(t.params.slideDuplicateClass)){o(t.$wrapperEl.children(`[data-swiper-slide-index="${e}"]:not(.${t.params.slideDuplicateClass})`).index(),!1)}else{o(t.$wrapperEl.children(`.${t.params.slideDuplicateClass}[data-swiper-slide-index="${e}"]`).index(),!1)}}i("lazyImageReady",r[0],n[0]),t.params.autoHeight&&t.updateAutoHeight()}})),i("lazyImageLoad",r[0],n[0])}))}function c(){const{$wrapperEl:e,params:s,slides:a,activeIndex:i}=t,r=t.virtual&&s.virtual.enabled,n=s.lazy;let c=s.slidesPerView;function p(t){if(r){if(e.children(`.${s.slideClass}[data-swiper-slide-index="${t}"]`).length)return!0}else if(a[t])return!0;return!1}function u(e){return r?d(e).attr("data-swiper-slide-index"):d(e).index()}if("auto"===c&&(c=0),l||(l=!0),t.params.watchSlidesProgress)e.children(`.${s.slideVisibleClass}`).each((e=>{o(r?d(e).attr("data-swiper-slide-index"):d(e).index())}));else if(c>1)for(let e=i;e<i+c;e+=1)p(e)&&o(e);else o(i);if(n.loadPrevNext)if(c>1||n.loadPrevNextAmount&&n.loadPrevNextAmount>1){const e=n.loadPrevNextAmount,t=c,s=Math.min(i+t+Math.max(e,t),a.length),r=Math.max(i-Math.max(t,e),0);for(let e=i+c;e<s;e+=1)p(e)&&o(e);for(let e=r;e<i;e+=1)p(e)&&o(e)}else{const t=e.children(`.${s.slideNextClass}`);t.length>0&&o(u(t));const a=e.children(`.${s.slidePrevClass}`);a.length>0&&o(u(a))}}function p(){const e=r();if(!t||t.destroyed)return;const s=t.params.lazy.scrollingElement?d(t.params.lazy.scrollingElement):d(e),a=s[0]===e,i=a?e.innerWidth:s[0].offsetWidth,l=a?e.innerHeight:s[0].offsetHeight,o=t.$el.offset(),{rtlTranslate:u}=t;let h=!1;u&&(o.left-=t.$el[0].scrollLeft);const m=[[o.left,o.top],[o.left+t.width,o.top],[o.left,o.top+t.height],[o.left+t.width,o.top+t.height]];for(let e=0;e<m.length;e+=1){const t=m[e];if(t[0]>=0&&t[0]<=i&&t[1]>=0&&t[1]<=l){if(0===t[0]&&0===t[1])continue;h=!0}}const f=!("touchstart"!==t.touchEvents.start||!t.support.passiveListener||!t.params.passiveListeners)&&{passive:!0,capture:!1};h?(c(),s.off("scroll",p,f)):n||(n=!0,s.on("scroll",p,f))}a("beforeInit",(()=>{t.params.lazy.enabled&&t.params.preloadImages&&(t.params.preloadImages=!1)})),a("init",(()=>{t.params.lazy.enabled&&(t.params.lazy.checkInView?p():c())})),a("scroll",(()=>{t.params.freeMode&&t.params.freeMode.enabled&&!t.params.freeMode.sticky&&c()})),a("scrollbarDragMove resize _freeModeNoMomentumRelease",(()=>{t.params.lazy.enabled&&(t.params.lazy.checkInView?p():c())})),a("transitionStart",(()=>{t.params.lazy.enabled&&(t.params.lazy.loadOnTransitionStart||!t.params.lazy.loadOnTransitionStart&&!l)&&(t.params.lazy.checkInView?p():c())})),a("transitionEnd",(()=>{t.params.lazy.enabled&&!t.params.lazy.loadOnTransitionStart&&(t.params.lazy.checkInView?p():c())})),a("slideChange",(()=>{const{lazy:e,cssMode:s,watchSlidesProgress:a,touchReleaseOnEdges:i,resistanceRatio:r}=t.params;e.enabled&&(s||a&&(i||0===r))&&c()})),Object.assign(t.lazy,{load:c,loadInSlide:o})},function(e){let{swiper:t,extendParams:s,on:a}=e;function i(e,t){const s=function(){let e,t,s;return(a,i)=>{for(t=-1,e=a.length;e-t>1;)s=e+t>>1,a[s]<=i?t=s:e=s;return e}}();let a,i;return this.x=e,this.y=t,this.lastIndex=e.length-1,this.interpolate=function(e){return e?(i=s(this.x,e),a=i-1,(e-this.x[a])*(this.y[i]-this.y[a])/(this.x[i]-this.x[a])+this.y[a]):0},this}function r(){t.controller.control&&t.controller.spline&&(t.controller.spline=void 0,delete t.controller.spline)}s({controller:{control:void 0,inverse:!1,by:"slide"}}),t.controller={control:void 0},a("beforeInit",(()=>{t.controller.control=t.params.controller.control})),a("update",(()=>{r()})),a("resize",(()=>{r()})),a("observerUpdate",(()=>{r()})),a("setTranslate",((e,s,a)=>{t.controller.control&&t.controller.setTranslate(s,a)})),a("setTransition",((e,s,a)=>{t.controller.control&&t.controller.setTransition(s,a)})),Object.assign(t.controller,{setTranslate:function(e,s){const a=t.controller.control;let r,n;const l=t.constructor;function o(e){const s=t.rtlTranslate?-t.translate:t.translate;"slide"===t.params.controller.by&&(!function(e){t.controller.spline||(t.controller.spline=t.params.loop?new i(t.slidesGrid,e.slidesGrid):new i(t.snapGrid,e.snapGrid))}(e),n=-t.controller.spline.interpolate(-s)),n&&"container"!==t.params.controller.by||(r=(e.maxTranslate()-e.minTranslate())/(t.maxTranslate()-t.minTranslate()),n=(s-t.minTranslate())*r+e.minTranslate()),t.params.controller.inverse&&(n=e.maxTranslate()-n),e.updateProgress(n),e.setTranslate(n,t),e.updateActiveIndex(),e.updateSlidesClasses()}if(Array.isArray(a))for(let e=0;e<a.length;e+=1)a[e]!==s&&a[e]instanceof l&&o(a[e]);else a instanceof l&&s!==a&&o(a)},setTransition:function(e,s){const a=t.constructor,i=t.controller.control;let r;function n(s){s.setTransition(e,t),0!==e&&(s.transitionStart(),s.params.autoHeight&&p((()=>{s.updateAutoHeight()})),s.$wrapperEl.transitionEnd((()=>{i&&(s.params.loop&&"slide"===t.params.controller.by&&s.loopFix(),s.transitionEnd())})))}if(Array.isArray(i))for(r=0;r<i.length;r+=1)i[r]!==s&&i[r]instanceof a&&n(i[r]);else i instanceof a&&s!==i&&n(i)}})},function(e){let{swiper:t,extendParams:s,on:a}=e;s({a11y:{enabled:!0,notificationClass:"swiper-notification",prevSlideMessage:"Previous slide",nextSlideMessage:"Next slide",firstSlideMessage:"This is the first slide",lastSlideMessage:"This is the last slide",paginationBulletMessage:"Go to slide
15{{index}}",slideLabelMessage:"{{index}} / {{slidesLength}}
vendor: 28,247 bytes, line 15
15",containerMessage:null,containerRoleDescriptionMessage:null,itemRoleDescriptionMessage:null,slideRole:"group"}});let i=null;function r(e){const t=i;0!==t.length&&(t.html(""),t.html(e))}function n(e){e.attr("tabIndex","0")}function l(e){e.attr("tabIndex","-1")}function o(e,t){e.attr("role",t)}function c(e,t){e.attr("aria-roledescription",t)}function p(e,t){e.attr("aria-label",t)}function u(e){e.attr("aria-disabled",!0)}function h(e){e.attr("aria-disabled",!1)}function m(e){if(13!==e.keyCode&&32!==e.keyCode)return;const s=t.params.a11y,a=d(e.target);t.navigation&&t.navigation.$nextEl&&a.is(t.navigation.$nextEl)&&(t.isEnd&&!t.params.loop||t.slideNext(),t.isEnd?r(s.lastSlideMessage):r(s.nextSlideMessage)),t.navigation&&t.navigation.$prevEl&&a.is(t.navigation.$prevEl)&&(t.isBeginning&&!t.params.loop||t.slidePrev(),t.isBeginning?r(s.firstSlideMessage):r(s.prevSlideMessage)),t.pagination&&a.is(U(t.params.pagination.bulletClass))&&a[0].click()}function f(){return t.pagination&&t.pagination.bullets&&t.pagination.bullets.length}function g(){return f()&&t.params.pagination.clickable}const v=(e,t,s)=>{n(e),"BUTTON"!==e[0].tagName&&(o(e,"button"),e.on("keydown",m)),p(e,s),function(e,t){e.attr("aria-controls",t)}(e,t)},w=e=>{const s=e.target.closest(`.${t.params.slideClass}`);if(!s||!t.slides.includes(s))return;const a=t.slides.indexOf(s)===t.activeIndex,i=t.params.watchSlidesProgress&&t.visibleSlides&&t.visibleSlides.includes(s);a||i||t.slideTo(t.slides.indexOf(s),0)};function b(){const e=t.params.a11y;t.$el.append(i);const s=t.$el;e.containerRoleDescriptionMessage&&c(s,e.containerRoleDescriptionMessage),e.containerMessage&&p(s,e.containerMessage);const a=t.$wrapperEl,r=a.attr("id")||`swiper-wrapper-${n=16,void 0===n&&(n=16),"x".repeat(n).replace(/x/g,(()=>Math.round(16*Math.random()).toString(16)))}`;var n;const l=t.params.autoplay&&t.params.autoplay.enabled?"off":"polite";var u;u=r,a.attr("id",u),function(e,t){e.attr("aria-live",t)}(a,l),e.itemRoleDescriptionMessage&&c(d(t.slides),e.itemRoleDescriptionMessage),o(d(t.slides),e.slideRole);const h=t.params.loop?t.slides.filter((e=>!e.classList.contains(t.params.slideDuplicateClass))).length:t.slides.length;let f,b;t.slides.each(((s,a)=>{const i=d(s),r=t.params.loop?parseInt(i.attr("data-swiper-slide-index"),10):a;p(i,e.slideLabelMessage.replace(/\{\{index\}\}/,r+1).replace(/\{\{slidesLength\}\}/,h))})),t.navigation&&t.navigation.$nextEl&&(f=t.navigation.$nextEl),t.navigation&&t.navigation.$prevEl&&(b=t.navigation.$prevEl),f&&f.length&&v(f,r,e.nextSlideMessage),b&&b.length&&v(b,r,e.prevSlideMessage),g()&&t.pagination.$el.on("keydown",U(t.params.pagination.bulletClass),m),t.$el.on("focus",w,!0)}a("beforeInit",(()=>{i=d(`<span class="${t.params.a11y.notificationClass}" aria-live="assertive" aria-atomic="true"></span>`)})),a("afterInit",(()=>{t.params.a11y.enabled&&b()})),a("fromEdge toEdge afterInit lock unlock",(()=>{t.params.a11y.enabled&&function(){if(t.params.loop||t.params.rewind||!t.navigation)return;const{$nextEl:e,$prevEl:s}=t.navigation;s&&s.length>0&&(t.isBeginning?(u(s),l(s)):(h(s),n(s))),e&&e.length>0&&(t.isEnd?(u(e),l(e)):(h(e),n(e)))}()})),a("paginationUpdate",(()=>{t.params.a11y.enabled&&function(){const e=t.params.a11y;f()&&t.pagination.bullets.each((s=>{const a=d(s);t.params.pagination.clickable&&(n(a),t.params.pagination.renderBullet||(o(a,"button"),p(a,e.paginationBulletMessage.replace(/\{\{index\}\}/,a.index()+1)))),a.is(`.${t.params.pagination.bulletActiveClass}`)?a.attr("aria-current","true"):a.removeAttr("aria-current")}))}()})),a("destroy",(()=>{t.params.a11y.enabled&&function(){let e,s;i&&i.length>0&&i.remove(),t.navigation&&t.navigation.$nextEl&&(e=t.navigation.$nextEl),t.navigation&&t.navigation.$prevEl&&(s=t.navigation.$prevEl),e&&e.off("keydown",m),s&&s.off("keydown",m),g()&&t.pagination.$el.off("keydown",U(t.params.pagination.bulletClass),m),t.$el.off("focus",w,!0)}()}))},function(e){let{swiper:t,extendParams:s,on:a}=e;s({history:{enabled:!1,root:"",replaceState:!1,key:"slides"}});let i=!1,n={};const l=e=>e.toString().replace(/\s+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,""),o=e=>{const t=r();let s;s=e?new URL(e):t.location;const a=s.pathname.slice(1).split("/").filter((e=>""!==e)),i=a.length;return{key:a[i-2],value:a[i-1]}},d=(e,s)=>{const a=r();if(!i||!t.params.history.enabled)return;let n;n=t.params.url?new URL(t.params.url):a.location;const o=t.slides.eq(s);let d=l(o.attr("data-history"));if(t.params.history.root.length>0){let s=t.params.history.root;"/"===s[s.length-1]&&(s=s.slice(0,s.length-1)),d=`${s}/${e}/${d}`}else n.pathname.includes(e)||(d=`${e}/${d}`);const c=a.history.state;c&&c.value===d||(t.params.history.replaceState?a.history.replaceState({value:d},null,d):a.history.pushState({value:d},null,d))},c=(e,s,a)=>{if(s)for(let i=0,r=t.slides.length;i<r;i+=1){const r=t.slides.eq(i);if(l(r.attr("data-history"))===s&&!r.hasClass(t.params.slideDuplicateClass)){const s=r.index();t.slideTo(s,e,a)}}else t.slideTo(0,e,a)},p=()=>{n=o(t.params.url),c(t.params.speed,t.paths.value,!1)};a("init",(()=>{t.params.history.enabled&&(()=>{const e=r();if(t.params.history){if(!e.history||!e.history.pushState)return t.params.history.enabled=!1,void(t.params.hashNavigation.enabled=!0);i=!0,n=o(t.params.url),(n.key||n.value)&&(c(0,n.value,t.params.runCallbacksOnInit),t.params.history.replaceState||e.addEventListener("popstate",p))}})()})),a("destroy",(()=>{t.params.history.enabled&&(()=>{const e=r();t.params.history.replaceState||e.removeEventListener("popstate",p)})()})),a("transitionEnd _freeModeNoMomentumRelease",(()=>{i&&d(t.params.history.key,t.activeIndex)})),a("slideChange",(()=>{i&&t.params.cssMode&&d(t.params.history.key,t.activeIndex)}))},function(e){let{swiper:t,extendParams:s,emit:i,on:n}=e,l=!1;const o=a(),c=r();s({hashNavigation:{enabled:!1,replaceState:!1,watchState:!1}});const p=()=>{i("hashChange");const e=o.location.hash.replace("#","");if(e!==t.slides.eq(t.activeIndex).attr("data-hash")){const s=t.$wrapperEl.children(`.${t.params.slideClass}[data-hash="${e}"]`).index();if(void 0===s)return;t.slideTo(s)}},u=()=>{if(l&&t.params.hashNavigation.enabled)if(t.params.hashNavigation.replaceState&&c.history&&c.history.replaceState)c.history.replaceState(null,null,`#${t.slides.eq(t.activeIndex).attr("data-hash")}`||""),i("hashSet");else{const e=t.slides.eq(t.activeIndex),s=e.attr("data-hash")||e.attr("data-history");o.location.hash=s||"",i("hashSet")}};n("init",(()=>{t.params.hashNavigation.enabled&&(()=>{if(!t.params.hashNavigation.enabled||t.params.history&&t.params.history.enabled)return;l=!0;const e=o.location.hash.replace("#","");if(e){const s=0;for(let a=0,i=t.slides.length;a<i;a+=1){const i=t.slides.eq(a);if((i.attr("data-hash")||i.attr("data-history"))===e&&!i.hasClass(t.params.slideDuplicateClass)){const e=i.index();t.slideTo(e,s,t.params.runCallbacksOnInit,!0)}}}t.params.hashNavigation.watchState&&d(c).on("hashchange",p)})()})),n("destroy",(()=>{t.params.hashNavigation.enabled&&t.params.hashNavigation.watchState&&d(c).off("hashchange",p)})),n("transitionEnd _freeModeNoMomentumRelease",(()=>{l&&u()})),n("slideChange",(()=>{l&&t.params.cssMode&&u()}))},function(e){let t,{swiper:s,extendParams:i,on:r,emit:n}=e;function l(){const e=s.slides.eq(s.activeIndex);let a=s.params.autoplay.delay;e.attr("data-swiper-autoplay")&&(a=e.attr("data-swiper-autoplay")||s.params.autoplay.delay),clearTimeout(t),t=p((()=>{let e;s.params.autoplay.reverseDirection?s.params.loop?(s.loopFix(),e=s.slidePrev(s.params.speed,!0,!0),n("autoplay")):s.isBeginning?s.params.autoplay.stopOnLastSlide?d():(e=s.slideTo(s.slides.length-1,s.params.speed,!0,!0),n("autoplay")):(e=s.slidePrev(s.params.speed,!0,!0),n("autoplay")):s.params.loop?(s.loopFix(),e=s.slideNext(s.params.speed,!0,!0),n("autoplay")):s.isEnd?s.params.autoplay.stopOnLastSlide?d():(e=s.slideTo(0,s.params.speed,!0,!0),n("autoplay")):(e=s.slideNext(s.params.speed,!0,!0),n("autoplay")),(s.params.cssMode&&s.autoplay.running||!1===e)&&l()}),a)}function o(){return void 0===t&&(!s.autoplay.running&&(s.autoplay.running=!0,n("autoplayStart"),l(),!0))}function d(){return!!s.autoplay.running&&(void 0!==t&&(t&&(clearTimeout(t),t=void 0),s.autoplay.running=!1,n("autoplayStop"),!0))}function c(e){s.autoplay.running&&(s.autoplay.paused||(t&&clearTimeout(t),s.autoplay.paused=!0,0!==e&&s.params.autoplay.waitForTransition?["transitionend","webkitTransitionEnd"].forEach((e=>{s.$wrapperEl[0].addEventListener(e,h)})):(s.autoplay.paused=!1,l())))}function u(){const e=a();"hidden"===e.visibilityState&&s.autoplay.running&&c(),"visible"===e.visibilityState&&s.autoplay.paused&&(l(),s.autoplay.paused=!1)}function h(e){s&&!s.destroyed&&s.$wrapperEl&&e.target===s.$wrapperEl[0]&&(["transitionend","webkitTransitionEnd"].forEach((e=>{s.$wrapperEl[0].removeEventListener(e,h)})),s.autoplay.paused=!1,s.autoplay.running?l():d())}function m(){s.params.autoplay.disableOnInteraction?d():(n("autoplayPause"),c()),["transitionend","webkitTransitionEnd"].forEach((e=>{s.$wrapperEl[0].removeEventListener(e,h)}))}function f(){s.params.autoplay.disableOnInteraction||(s.autoplay.paused=!1,n("autoplayResume"),l())}s.autoplay={running:!1,paused:!1},i({autoplay:{enabled:!1,delay:3e3,waitForTransition:!0,disableOnInteraction:!0,stopOnLastSlide:!1,reverseDirection:!1,pauseOnMouseEnter:!1}}),r("init",(()=>{if(s.params.autoplay.enabled){o();a().addEventListener("visibilitychange",u),s.params.autoplay.pauseOnMouseEnter&&(s.$el.on("mouseenter",m),s.$el.on("mouseleave",f))}})),r("beforeTransitionStart",((e,t,a)=>{s.autoplay.running&&(a||!s.params.autoplay.disableOnInteraction?s.autoplay.pause(t):d())})),r("sliderFirstMove",(()=>{s.autoplay.running&&(s.params.autoplay.disableOnInteraction?d():c())})),r("touchEnd",(()=>{s.params.cssMode&&s.autoplay.paused&&!s.params.autoplay.disableOnInteraction&&l()})),r("destroy",(()=>{s.$el.off("mouseenter",m),s.$el.off("mouseleave",f),s.autoplay.running&&d();a().removeEventListener("visibilitychange",u)})),Object.assign(s.autoplay,{pause:c,run:l,start:o,stop:d})},function(e){let{swiper:t,extendParams:s,on:a}=e;s({thumbs:{swiper:null,multipleActiveThumbs:!0,autoScrollOffset:0,slideThumbActiveClass:"swiper-slide-thumb-active",thumbsContainerClass:"swiper-thumbs"}});let i=!1,r=!1;function n(){const e=t.thumbs.swiper;if(!e)return;const s=e.clickedIndex,a=e.clickedSlide;if(a&&d(a).hasClass(t.params.thumbs.slideThumbActiveClass))return;if(null==s)return;let i;if(i=e.params.loop?parseInt(d(e.clickedSlide).attr("data-swiper-slide-index"),10):s,t.params.loop){let e=t.activeIndex;t.slides.eq(e).hasClass(t.params.slideDuplicateClass)&&(t.loopFix(),t._clientLeft=t.$wrapperEl[0].clientLeft,e=t.activeIndex);const s=t.slides.eq(e).prevAll(`[data-swiper-slide-index="${i}"]`).eq(0).index(),a=t.slides.eq(e).nextAll(`[data-swiper-slide-index="${i}"]`).eq(0).index();i=void 0===s?a:void 0===a?s:a-e<e-s?a:s}t.slideTo(i)}function l(){const{thumbs:e}=t.params;if(i)return!1;i=!0;const s=t.constructor;if(e.swiper instanceof s)t.thumbs.swiper=e.swiper,Object.assign(t.thumbs.swiper.originalParams,{watchSlidesProgress:!0,slideToClickedSlide:!1}),Object.assign(t.thumbs.swiper.params,{watchSlidesProgress:!0,slideToClickedSlide:!1});else if(m(e.swiper)){const a=Object.assign({},e.swiper);Object.assign(a,{watchSlidesProgress:!0,slideToClickedSlide:!1}),t.thumbs.swiper=new s(a),r=!0}return t.thumbs.swiper.$el.addClass(t.params.thumbs.thumbsContainerClass),t.thumbs.swiper.on("tap",n),!0}function o(e){const s=t.thumbs.swiper;if(!s)return;const a="auto"===s.params.slidesPerView?s.slidesPerViewDynamic():s.params.slidesPerView,i=t.params.thumbs.autoScrollOffset,r=i&&!s.params.loop;if(t.realIndex!==s.realIndex||r){let n,l,o=s.activeIndex;if(s.params.loop){s.slides.eq(o).hasClass(s.params.slideDuplicateClass)&&(s.loopFix(),s._clientLeft=s.$wrapperEl[0].clientLeft,o=s.activeIndex);const e=s.slides.eq(o).prevAll(`[data-swiper-slide-index="${t.realIndex}"]`).eq(0).index(),a=s.slides.eq(o).nextAll(`[data-swiper-slide-index="${t.realIndex}"]`).eq(0).index();n=void 0===e?a:void 0===a?e:a-o==o-e?s.params.slidesPerGroup>1?a:o:a-o<o-e?a:e,l=t.activeIndex>t.previousIndex?"next":"prev"}else n=t.realIndex,l=n>t.previousIndex?"next":"prev";r&&(n+="next"===l?i:-1*i),s.visibleSlidesIndexes&&s.visibleSlidesIndexes.indexOf(n)<0&&(s.params.centeredSlides?n=n>o?n-Math.floor(a/2)+1:n+Math.floor(a/2)-1:n>o&&s.params.slidesPerGroup,s.slideTo(n,e?0:void 0))}let n=1;const l=t.params.thumbs.slideThumbActiveClass;if(t.params.slidesPerView>1&&!t.params.centeredSlides&&(n=t.params.slidesPerView),t.params.thumbs.multipleActiveThumbs||(n=1),n=Math.floor(n),s.slides.removeClass(l),s.params.loop||s.params.virtual&&s.params.virtual.enabled)for(let e=0;e<n;e+=1)s.$wrapperEl.children(`[data-swiper-slide-index="${t.realIndex+e}"]`).addClass(l);else for(let e=0;e<n;e+=1)s.slides.eq(t.realIndex+e).addClass(l)}t.thumbs={swiper:null},a("beforeInit",(()=>{const{thumbs:e}=t.params;e&&e.swiper&&(l(),o(!0))})),a("slideChange update resize observerUpdate",(()=>{t.thumbs.swiper&&o()})),a("setTransition",((e,s)=>{const a=t.thumbs.swiper;a&&a.setTransition(s)})),a("beforeDestroy",(()=>{const e=t.thumbs.swiper;e&&r&&e&&e.destroy()})),Object.assign(t.thumbs,{init:l,update:o})},function(e){let{swiper:t,extendParams:s,emit:a,once:i}=e;s({freeMode:{enabled:!1,momentum:!0,momentumRatio:1,momentumBounce:!0,momentumBounceRatio:1,momentumVelocityRatio:1,sticky:!1,minimumVelocity:.02}}),Object.assign(t,{freeMode:{onTouchStart:function(){const e=t.getTranslate();t.setTranslate(e),t.setTransition(0),t.touchEventsData.velocities.length=0,t.freeMode.onTouchEnd({currentPos:t.rtl?t.translate:-t.translate})},onTouchMove:function(){const{touchEventsData:e,touches:s}=t;0===e.velocities.length&&e.velocities.push({position:s[t.isHorizontal()?"startX":"startY"],time:e.touchStartTime}),e.velocities.push({position:s[t.isHorizontal()?"currentX":"currentY"],time:u()})},onTouchEnd:function(e){let{currentPos:s}=e;const{params:r,$wrapperEl:n,rtlTranslate:l,snapGrid:o,touchEventsData:d}=t,c=u()-d.touchStartTime;if(s<-t.minTranslate())t.slideTo(t.activeIndex);else if(s>-t.maxTranslate())t.slides.length<o.length?t.slideTo(o.length-1):t.slideTo(t.slides.length-1);else{if(r.freeMode.momentum){if(d.velocities.length>1){const e=d.velocities.pop(),s=d.velocities.pop(),a=e.position-s.position,i=e.time-s.time;t.velocity=a/i,t.velocity/=2,Math.abs(t.velocity)<r.freeMode.minimumVelocity&&(t.velocity=0),(i>150||u()-e.time>300)&&(t.velocity=0)}else t.velocity=0;t.velocity*=r.freeMode.momentumVelocityRatio,d.velocities.length=0;let e=1e3*r.freeMode.momentumRatio;const s=t.velocity*e;let c=t.translate+s;l&&(c=-c);let p,h=!1;const m=20*Math.abs(t.velocity)*r.freeMode.momentumBounceRatio;let f;if(c<t.maxTranslate())r.freeMode.momentumBounce?(c+t.maxTranslate()<-m&&(c=t.maxTranslate()-m),p=t.maxTranslate(),h=!0,d.allowMomentumBounce=!0):c=t.maxTranslate(),r.loop&&r.centeredSlides&&(f=!0);else if(c>t.minTranslate())r.freeMode.momentumBounce?(c-t.minTranslate()>m&&(c=t.minTranslate()+m),p=t.minTranslate(),h=!0,d.allowMomentumBounce=!0):c=t.minTranslate(),r.loop&&r.centeredSlides&&(f=!0);else if(r.freeMode.sticky){let e;for(let t=0;t<o.length;t+=1)if(o[t]>-c){e=t;break}c=Math.abs(o[e]-c)<Math.abs(o[e-1]-c)||"next"===t.swipeDirection?o[e]:o[e-1],c=-c}if(f&&i("transitionEnd",(()=>{t.loopFix()})),0!==t.velocity){if(e=l?Math.abs((-c-t.translate)/t.velocity):Math.abs((c-t.translate)/t.velocity),r.freeMode.sticky){const s=Math.abs((l?-c:c)-t.translate),a=t.slidesSizesGrid[t.activeIndex];e=s<a?r.speed:s<2*a?1.5*r.speed:2.5*r.speed}}else if(r.freeMode.sticky)return void t.slideToClosest();r.freeMode.momentumBounce&&h?(t.updateProgress(p),t.setTransition(e),t.setTranslate(c),t.transitionStart(!0,t.swipeDirection),t.animating=!0,n.transitionEnd((()=>{t&&!t.destroyed&&d.allowMomentumBounce&&(a("momentumBounce"),t.setTransition(r.speed),setTimeout((()=>{t.setTranslate(p),n.transitionEnd((()=>{t&&!t.destroyed&&t.transitionEnd()}))}),0))}))):t.velocity?(a("_freeModeNoMomentumRelease"),t.updateProgress(c),t.setTransition(e),t.setTranslate(c),t.transitionStart(!0,t.swipeDirection),t.animating||(t.animating=!0,n.transitionEnd((()=>{t&&!t.destroyed&&t.transitionEnd()})))):t.updateProgress(c),t.updateActiveIndex(),t.updateSlidesClasses()}else{if(r.freeMode.sticky)return void t.slideToClosest();r.freeMode&&a("_freeModeNoMomentumRelease")}(!r.freeMode.momentum||c>=r.longSwipesMs)&&(t.updateProgress(),t.updateActiveIndex(),t.updateSlidesClasses())}}}})},function(e){let t,s,a,{swiper:i,extendParams:r}=e;r({grid:{rows:1,fill:"column"}}),i.grid={initSlides:e=>{const{slidesPerView:r}=i.params,{rows:n,fill:l}=i.params.grid;s=t/n,a=Math.floor(e/n),t=Math.floor(e/n)===e/n?e:Math.ceil(e/n)*n,"auto"!==r&&"row"===l&&(t=Math.max(t,r*n))},updateSlide:(e,r,n,l)=>{const{slidesPerGroup:o,spaceBetween:d}=i.params,{rows:c,fill:p}=i.params.grid;let u,h,m;if("row"===p&&o>1){const s=Math.floor(e/(o*c)),a=e-c*o*s,i=0===s?o:Math.min(Math.ceil((n-s*c*o)/c),o);m=Math.floor(a/i),h=a-m*i+s*o,u=h+m*t/c,r.css({"-webkit-order":u,order:u})}else"column"===p?(h=Math.floor(e/c),m=e-h*c,(h>a||h===a&&m===c-1)&&(m+=1,m>=c&&(m=0,h+=1))):(m=Math.floor(e/s),h=e-m*s);r.css(l("margin-top"),0!==m?d&&`${d}px`:"")},updateWrapperSize:(e,s,a)=>{const{spaceBetween:r,centeredSlides:n,roundLengths:l}=i.params,{rows:o}=i.params.grid;if(i.virtualSize=(e+r)*t,i.virtualSize=Math.ceil(i.virtualSize/o)-r,i.$wrapperEl.css({[a("width")]:`${i.virtualSize+r}px`}),n){s.splice(0,s.length);const e=[];for(let t=0;t<s.length;t+=1){let a=s[t];l&&(a=Math.floor(a)),s[t]<i.virtualSize+s[0]&&e.push(a)}s.push(...e)}}}},function(e){let{swiper:t}=e;Object.assign(t,{appendSlide:K.bind(t),prependSlide:Z.bind(t),addSlide:J.bind(t),removeSlide:Q.bind(t),removeAllSlides:ee.bind(t)})},function(e){let{swiper:t,extendParams:s,on:a}=e;s({fadeEffect:{crossFade:!1,transformEl:null}}),te({effect:"fade",swiper:t,on:a,setTranslate:()=>{const{slides:e}=t,s=t.params.fadeEffect;for(let a=0;a<e.length;a+=1){const e=t.slides.eq(a);let i=-e[0].swiperSlideOffset;t.params.virtualTranslate||(i-=t.translate);let r=0;t.isHorizontal()||(r=i,i=0);const n=t.params.fadeEffect.crossFade?Math.max(1-Math.abs(e[0].progress),0):1+Math.min(Math.max(e[0].progress,-1),0);se(s,e).css({opacity:n}).transform(`translate3d(${i}px, ${r}px, 0px)`)}},setTransition:e=>{const{transformEl:s}=t.params.fadeEffect;(s?t.slides.find(s):t.slides).transition(e),ae({swiper:t,duration:e,transformEl:s,allSlides:!0})},overwriteParams:()=>({slidesPerView:1,slidesPerGroup:1,watchSlidesProgress:!0,spaceBetween:0,virtualTranslate:!t.params.cssMode})})},function(e){let{swiper:t,extendParams:s,on:a}=e;s({cubeEffect:{slideShadows:!0,shadow:!0,shadowOffset:20,shadowScale:.94}}),te({effect:"cube",swiper:t,on:a,setTranslate:()=>{const{$el:e,$wrapperEl:s,slides:a,width:i,height:r,rtlTranslate:n,size:l,browser:o}=t,c=t.params.cubeEffect,p=t.isHorizontal(),u=t.virtual&&t.params.virtual.enabled;let h,m=0;c.shadow&&(p?(h=s.find(".swiper-cube-shadow"),0===h.length&&(h=d('<div class="swiper-cube-shadow"></div>'),s.append(h)),h.css({height:`${i}px`})):(h=e.find(".swiper-cube-shadow"),0===h.length&&(h=d('<div class="swiper-cube-shadow"></div>'),e.append(h))));for(let e=0;e<a.length;e+=1){const t=a.eq(e);let s=e;u&&(s=parseInt(t.attr("data-swiper-slide-index"),10));let i=90*s,r=Math.floor(i/360);n&&(i=-i,r=Math.floor(-i/360));const o=Math.max(Math.min(t[0].progress,1),-1);let h=0,f=0,g=0;s%4==0?(h=4*-r*l,g=0):(s-1)%4==0?(h=0,g=4*-r*l):(s-2)%4==0?(h=l+4*r*l,g=l):(s-3)%4==0&&(h=-l,g=3*l+4*l*r),n&&(h=-h),p||(f=h,h=0);const v=`rotateX(${p?0:-i}deg) rotateY(${p?i:0}deg) translate3d(${h}px, ${f}px, ${g}px)`;if(o<=1&&o>-1&&(m=90*s+90*o,n&&(m=90*-s-90*o)),t.transform(v),c.slideShadows){let e=p?t.find(".swiper-slide-shadow-left"):t.find(".swiper-slide-shadow-top"),s=p?t.find(".swiper-slide-shadow-right"):t.find(".swiper-slide-shadow-bottom");0===e.length&&(e=d(`<div class="swiper-slide-shadow-${p?"left":"top"}"></div>`),t.append(e)),0===s.length&&(s=d(`<div class="swiper-slide-shadow-${p?"right":"bottom"}"></div>`),t.append(s)),e.length&&(e[0].style.opacity=Math.max(-o,0)),s.length&&(s[0].style.opacity=Math.max(o,0))}}if(s.css({"-webkit-transform-origin":`50% 50% -${l/2}px`,"transform-origin":`50% 50% -${l/2}px`}),c.shadow)if(p)h.transform(`translate3d(0px, ${i/2+c.shadowOffset}px, ${-i/2}px) rotateX(90deg) rotateZ(0deg) scale(${c.shadowScale})`);else{const e=Math.abs(m)-90*Math.floor(Math.abs(m)/90),t=1.5-(Math.sin(2*e*Math.PI/360)/2+Math.cos(2*e*Math.PI/360)/2),s=c.shadowScale,a=c.shadowScale/t,i=c.shadowOffset;h.transform(`scale3d(${s}, 1, ${a}) translate3d(0px, ${r/2+i}px, ${-r/2/a}px) rotateX(-90deg)`)}const f=o.isSafari||o.isWebView?-l/2:0;s.transform(`translate3d(0px,0,${f}px) rotateX(${t.isHorizontal()?0:m}deg) rotateY(${t.isHorizontal()?-m:0}deg)`)},setTransition:e=>{const{$el:s,slides:a}=t;a.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),t.params.cubeEffect.shadow&&!t.isHorizontal()&&s.find(".swiper-cube-shadow").transition(e)},perspective:()=>!0,overwriteParams:()=>({slidesPerView:1,slidesPerGroup:1,watchSlidesProgress:!0,resistanceRatio:0,spaceBetween:0,centeredSlides:!1,virtualTranslate:!0})})},function(e){let{swiper:t,extendParams:s,on:a}=e;s({flipEffect:{slideShadows:!0,limitRotation:!0,transformEl:null}}),te({effect:"flip",swiper:t,on:a,setTranslate:()=>{const{slides:e,rtlTranslate:s}=t,a=t.params.flipEffect;for(let i=0;i<e.length;i+=1){const r=e.eq(i);let n=r[0].progress;t.params.flipEffect.limitRotation&&(n=Math.max(Math.min(r[0].progress,1),-1));const l=r[0].swiperSlideOffset;let o=-180*n,d=0,c=t.params.cssMode?-l-t.translate:-l,p=0;if(t.isHorizontal()?s&&(o=-o):(p=c,c=0,d=-o,o=0),r[0].style.zIndex=-Math.abs(Math.round(n))+e.length,a.slideShadows){let e=t.isHorizontal()?r.find(".swiper-slide-shadow-left"):r.find(".swiper-slide-shadow-top"),s=t.isHorizontal()?r.find(".swiper-slide-shadow-right"):r.find(".swiper-slide-shadow-bottom");0===e.length&&(e=ie(a,r,t.isHorizontal()?"left":"top")),0===s.length&&(s=ie(a,r,t.isHorizontal()?"right":"bottom")),e.length&&(e[0].style.opacity=Math.max(-n,0)),s.length&&(s[0].style.opacity=Math.max(n,0))}const u=`translate3d(${c}px, ${p}px, 0px) rotateX(${d}deg) rotateY(${o}deg)`;se(a,r).transform(u)}},setTransition:e=>{const{transformEl:s}=t.params.flipEffect;(s?t.slides.find(s):t.slides).transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),ae({swiper:t,duration:e,transformEl:s})},perspective:()=>!0,overwriteParams:()=>({slidesPerView:1,slidesPerGroup:1,watchSlidesProgress:!0,spaceBetween:0,virtualTranslate:!t.params.cssMode})})},function(e){let{swiper:t,extendParams:s,on:a}=e;s({coverflowEffect:{rotate:50,stretch:0,depth:100,scale:1,modifier:1,slideShadows:!0,transformEl:null}}),te({effect:"coverflow",swiper:t,on:a,setTranslate:()=>{const{width:e,height:s,slides:a,slidesSizesGrid:i}=t,r=t.params.coverflowEffect,n=t.isHorizontal(),l=t.translate,o=n?e/2-l:s/2-l,d=n?r.rotate:-r.rotate,c=r.depth;for(let e=0,t=a.length;e<t;e+=1){const t=a.eq(e),s=i[e],l=(o-t[0].swiperSlideOffset-s/2)/s*r.modifier;let p=n?d*l:0,u=n?0:d*l,h=-c*Math.abs(l),m=r.stretch;"string"==typeof m&&-1!==m.indexOf("%")&&(m=parseFloat(r.stretch)/100*s);let f=n?0:m*l,g=n?m*l:0,v=1-(1-r.scale)*Math.abs(l);Math.abs(g)<.001&&(g=0),Math.abs(f)<.001&&(f=0),Math.abs(h)<.001&&(h=0),Math.abs(p)<.001&&(p=0),Math.abs(u)<.001&&(u=0),Math.abs(v)<.001&&(v=0);const w=`translate3d(${g}px,${f}px,${h}px) rotateX(${u}deg) rotateY(${p}deg) scale(${v})`;if(se(r,t).transform(w),t[0].style.zIndex=1-Math.abs(Math.round(l)),r.slideShadows){let e=n?t.find(".swiper-slide-shadow-left"):t.find(".swiper-slide-shadow-top"),s=n?t.find(".swiper-slide-shadow-right"):t.find(".swiper-slide-shadow-bottom");0===e.length&&(e=ie(r,t,n?"left":"top")),0===s.length&&(s=ie(r,t,n?"right":"bottom")),e.length&&(e[0].style.opacity=l>0?l:0),s.length&&(s[0].style.opacity=-l>0?-l:0)}}},setTransition:e=>{const{transformEl:s}=t.params.coverflowEffect;(s?t.slides.find(s):t.slides).transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e)},perspective:()=>!0,overwriteParams:()=>({watchSlidesProgress:!0})})},function(e){let{swiper:t,extendParams:s,on:a}=e;s({creativeEffect:{transformEl:null,limitProgress:1,shadowPerProgress:!1,progressMultiplier:1,perspective:!0,prev:{translate:[0,0,0],rotate:[0,0,0],opacity:1,scale:1},next:{translate:[0,0,0],rotate:[0,0,0],opacity:1,scale:1}}});const i=e=>"string"==typeof e?e:`${e}px`;te({effect:"creative",swiper:t,on:a,setTranslate:()=>{const{slides:e,$wrapperEl:s,slidesSizesGrid:a}=t,r=t.params.creativeEffect,{progressMultiplier:n}=r,l=t.params.centeredSlides;if(l){const e=a[0]/2-t.params.slidesOffsetBefore||0;s.transform(`translateX(calc(50% - ${e}px))`)}for(let s=0;s<e.length;s+=1){const a=e.eq(s),o=a[0].progress,d=Math.min(Math.max(a[0].progress,-r.limitProgress),r.limitProgress);let c=d;l||(c=Math.min(Math.max(a[0].originalProgress,-r.limitProgress),r.limitProgress));const p=a[0].swiperSlideOffset,u=[t.params.cssMode?-p-t.translate:-p,0,0],h=[0,0,0];let m=!1;t.isHorizontal()||(u[1]=u[0],u[0]=0);let f={translate:[0,0,0],rotate:[0,0,0],scale:1,opacity:1};d<0?(f=r.next,m=!0):d>0&&(f=r.prev,m=!0),u.forEach(((e,t)=>{u[t]=`calc(${e}px + (${i(f.translate[t])} * ${Math.abs(d*n)}))`})),h.forEach(((e,t)=>{h[t]=f.rotate[t]*Math.abs(d*n)})),a[0].style.zIndex=-Math.abs(Math.round(o))+e.length;const g=u.join(", "),v=`rotateX(${h[0]}deg) rotateY(${h[1]}deg) rotateZ(${h[2]}deg)`,w=c<0?`scale(${1+(1-f.scale)*c*n})`:`scale(${1-(1-f.scale)*c*n})`,b=c<0?1+(1-f.opacity)*c*n:1-(1-f.opacity)*c*n,x=`translate3d(${g}) ${v} ${w}`;if(m&&f.shadow||!m){let e=a.children(".swiper-slide-shadow");if(0===e.length&&f.shadow&&(e=ie(r,a)),e.length){const t=r.shadowPerProgress?d*(1/r.limitProgress):d;e[0].style.opacity=Math.min(Math.max(Math.abs(t),0),1)}}const y=se(r,a);y.transform(x).css({opacity:b}),f.origin&&y.css("transform-origin",f.origin)}},setTransition:e=>{const{transformEl:s}=t.params.creativeEffect;(s?t.slides.find(s):t.slides).transition(e).find(".swiper-slide-shadow").transition(e),ae({swiper:t,duration:e,transformEl:s,allSlides:!0})},perspective:()=>t.params.creativeEffect.perspective,overwriteParams:()=>({watchSlidesProgress:!0,virtualTranslate:!t.params.cssMode})})},function(e){let{swiper:t,extendParams:s,on:a}=e;s({cardsEffect:{slideShadows:!0,transformEl:null}}),te({effect:"cards",swiper:t,on:a,setTranslate:()=>{const{slides:e,activeIndex:s}=t,a=t.params.cardsEffect,{startTranslate:i,isTouched:r}=t.touchEventsData,n=t.translate;for(let l=0;l<e.length;l+=1){const o=e.eq(l),d=o[0].progress,c=Math.min(Math.max(d,-4),4);let p=o[0].swiperSlideOffset;t.params.centeredSlides&&!t.params.cssMode&&t.$wrapperEl.transform(`translateX(${t.minTranslate()}px)`),t.params.centeredSlides&&t.params.cssMode&&(p-=e[0].swiperSlideOffset);let u=t.params.cssMode?-p-t.translate:-p,h=0;const m=-100*Math.abs(c);let f=1,g=-2*c,v=8-.75*Math.abs(c);const w=(l===s||l===s-1)&&c>0&&c<1&&(r||t.params.cssMode)&&n<i,b=(l===s||l===s+1)&&c<0&&c>-1&&(r||t.params.cssMode)&&n>i;if(w||b){const e=(1-Math.abs((Math.abs(c)-.5)/.5))**.5;g+=-28*c*e,f+=-.5*e,v+=96*e,h=-25*e*Math.abs(c)+"%"}if(u=c<0?`calc(${u}px + (${v*Math.abs(c)}%))`:c>0?`calc(${u}px + (-${v*Math.abs(c)}%))`:`${u}px`,!t.isHorizontal()){const e=h;h=u,u=e}const x=`\n translate3d(${u}, ${h}, ${m}px)\n rotateZ(${g}deg)\n scale(${c<0?""+(1+(1-f)*c):""+(1-(1-f)*c)})\n `;if(a.slideShadows){let e=o.find(".swiper-slide-shadow");0===e.length&&(e=ie(a,o)),e.length&&(e[0].style.opacity=Math.min(Math.max((Math.abs(c)-.5)/.5,0),1))}o[0].style.zIndex=-Math.abs(Math.round(d))+e.length;se(a,o).transform(x)}},setTransition:e=>{const{transformEl:s}=t.params.cardsEffect;(s?t.slides.find(s):t.slides).transition(e).find(".swiper-slide-shadow").transition(e),ae({swiper:t,duration:e,transformEl:s})},perspective:()=>!0,overwriteParams:()=>({watchSlidesProgress:!0,virtualTranslate:!t.params.cssMode})})}];return q.use(re),q}));
16/* End */ 17; 18; /* Start:"a:4:{s:4:"full";s:67:"/local/templates/rr-wheels_corp/js/products-swiper.js?1775202386571";s:6:"source";s:53:"/local/templates/rr-wheels_corp/js/products-swiper.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 19document.addEventListener('DOMContentLoaded', function() { 20 const catalogSwiper = document.querySelector('.catalog-swiper'); 21 22 if (catalogSwiper) { 23 new Swiper('.catalog-swiper', { 24 slidesPerView: 'auto', 25 spaceBetween: 20, 26 breakpoints: { 27 320: { 28 slidesPerView: 'auto', 29 spaceBetween: 20, 30 }, 31 769: { 32 slidesPerView: 'auto', 33 spaceBetween: 20, 34 }, 35 }, 36 navigation: { 37 nextEl: '.catalog-swiper-next', 38 prevEl: '.catalog-swiper-prev', 39 }, 40 }); 41 } 42}); 43 44 45/* End */ 46; 47; /* Start:"a:4:{s:4:"full";s:63:"/local/templates/rr-wheels_corp/js/libs.min.js?1775202386296028";s:6:"source";s:46:"/local/templates/rr-wheels_corp/js/libs.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 48/*! 49 * jQuery JavaScript Library v3.7.1 50 * https://jquery.com/ 51 * 52 * Copyright OpenJS Foundation and other contributors 53 * Released under the MIT license 54 * https://jquery.org/license 55 * 56 * Date: 2023-08-28T13:37Z 57 */ 58( function( global, factory ) { 59 60 "use strict"; 61 62 if ( typeof module === "object" && typeof module.exports === "object" ) { 63 64 // For CommonJS and CommonJS-like environments where a proper `window` 65 // is present, execute the factory and get jQuery. 66 // For environments that do not have a `window` with a `document` 67 // (such as Node.js), expose a factory as module.exports. 68 // This accentuates the need for the creation of a real `window`. 69 // e.g. var jQuery = require("jquery")(window); 70 // See ticket trac-14549 for more info. 71 module.exports = global.document ? 72 factory( global, true ) : 73 function( w ) { 74 if ( !w.document ) { 75 throw new Error( "jQuery requires a window with a document" ); 76 } 77 return factory( w ); 78 }; 79 } else { 80 factory( global ); 81 } 82 83// Pass this if window is not defined yet 84} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 85 86// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 87// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 88// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), str
vendor: 111,947 bytes, lines 88-4124
88ict mode should be common 89// enough that all such attempts are guarded in a try block. 90"use strict"; 91 92var arr = []; 93 94var getProto = Object.getPrototypeOf; 95 96var slice = arr.slice; 97 98var flat = arr.flat ? function( array ) { 99 return arr.flat.call( array ); 100} : function( array ) { 101 return arr.concat.apply( [], array ); 102}; 103 104 105var push = arr.push; 106 107var indexOf = arr.indexOf; 108 109var class2type = {}; 110 111var toString = class2type.toString; 112 113var hasOwn = class2type.hasOwnProperty; 114 115var fnToString = hasOwn.toString; 116 117var ObjectFunctionString = fnToString.call( Object ); 118 119var support = {}; 120 121var isFunction = function isFunction( obj ) { 122 123 // Support: Chrome <=57, Firefox <=52 124 // In some browsers, typeof returns "function" for HTML <object> elements 125 // (i.e., `typeof document.createElement( "object" ) === "function"`). 126 // We don't want to classify *any* DOM node as a function. 127 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 128 // Plus for old WebKit, typeof returns "function" for HTML collections 129 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 130 return typeof obj === "function" && typeof obj.nodeType !== "number" && 131 typeof obj.item !== "function"; 132 }; 133 134 135var isWindow = function isWindow( obj ) { 136 return obj != null && obj === obj.window; 137 }; 138 139 140var document = window.document; 141 142 143 144 var preservedScriptAttributes = { 145 type: true, 146 src: true, 147 nonce: true, 148 noModule: true 149 }; 150 151 function DOMEval( code, node, doc ) { 152 doc = doc || document; 153 154 var i, val, 155 script = doc.createElement( "script" ); 156 157 script.text = code; 158 if ( node ) { 159 for ( i in preservedScriptAttributes ) { 160 161 // Support: Firefox 64+, Edge 18+ 162 // Some browsers don't support the "nonce" property on scripts. 163 // On the other hand, just using `getAttribute` is not enough as 164 // the `nonce` attribute is reset to an empty string whenever it 165 // becomes browsing-context connected. 166 // See https://github.com/whatwg/html/issues/2369 167 // See https://html.spec.whatwg.org/#nonce-attributes 168 // The `node.getAttribute` check was added for the sake of 169 // `jQuery.globalEval` so that it can fake a nonce-containing node 170 // via an object. 171 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 172 if ( val ) { 173 script.setAttribute( i, val ); 174 } 175 } 176 } 177 doc.head.appendChild( script ).parentNode.removeChild( script ); 178 } 179 180 181function toType( obj ) { 182 if ( obj == null ) { 183 return obj + ""; 184 } 185 186 // Support: Android <=2.3 only (functionish RegExp) 187 return typeof obj === "object" || typeof obj === "function" ? 188 class2type[ toString.call( obj ) ] || "object" : 189 typeof obj; 190} 191/* global Symbol */ 192// Defining this global in .eslintrc.json would create a danger of using the global 193// unguarded in another place, it seems safer to define global only for this module 194 195 196 197var version = "3.7.1", 198 199 rhtmlSuffix = /HTML$/i, 200 201 // Define a local copy of jQuery 202 jQuery = function( selector, context ) { 203 204 // The jQuery object is actually just the init constructor 'enhanced' 205 // Need init if jQuery is called (just allow error to be thrown if not included) 206 return new jQuery.fn.init( selector, context ); 207 }; 208 209jQuery.fn = jQuery.prototype = { 210 211 // The current version of jQuery being used 212 jquery: version, 213 214 constructor: jQuery, 215 216 // The default length of a jQuery object is 0 217 length: 0, 218 219 toArray: function() { 220 return slice.call( this ); 221 }, 222 223 // Get the Nth element in the matched element set OR 224 // Get the whole matched element set as a clean array 225 get: function( num ) { 226 227 // Return all the elements in a clean array 228 if ( num == null ) { 229 return slice.call( this ); 230 } 231 232 // Return just the one element from the set 233 return num < 0 ? this[ num + this.length ] : this[ num ]; 234 }, 235 236 // Take an array of elements and push it onto the stack 237 // (returning the new matched element set) 238 pushStack: function( elems ) { 239 240 // Build a new jQuery matched element set 241 var ret = jQuery.merge( this.constructor(), elems ); 242 243 // Add the old object onto the stack (as a reference) 244 ret.prevObject = this; 245 246 // Return the newly-formed element set 247 return ret; 248 }, 249 250 // Execute a callback for every element in the matched set. 251 each: function( callback ) { 252 return jQuery.each( this, callback ); 253 }, 254 255 map: function( callback ) { 256 return this.pushStack( jQuery.map( this, function( elem, i ) { 257 return callback.call( elem, i, elem ); 258 } ) ); 259 }, 260 261 slice: function() { 262 return this.pushStack( slice.apply( this, arguments ) ); 263 }, 264 265 first: function() { 266 return this.eq( 0 ); 267 }, 268 269 last: function() { 270 return this.eq( -1 ); 271 }, 272 273 even: function() { 274 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 275 return ( i + 1 ) % 2; 276 } ) ); 277 }, 278 279 odd: function() { 280 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 281 return i % 2; 282 } ) ); 283 }, 284 285 eq: function( i ) { 286 var len = this.length, 287 j = +i + ( i < 0 ? len : 0 ); 288 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 289 }, 290 291 end: function() { 292 return this.prevObject || this.constructor(); 293 }, 294 295 // For internal use only. 296 // Behaves like an Array's method, not like a jQuery method. 297 push: push, 298 sort: arr.sort, 299 splice: arr.splice 300}; 301 302jQuery.extend = jQuery.fn.extend = function() { 303 var options, name, src, copy, copyIsArray, clone, 304 target = arguments[ 0 ] || {}, 305 i = 1, 306 length = arguments.length, 307 deep = false; 308 309 // Handle a deep copy situation 310 if ( typeof target === "boolean" ) { 311 deep = target; 312 313 // Skip the boolean and the target 314 target = arguments[ i ] || {}; 315 i++; 316 } 317 318 // Handle case when target is a string or something (possible in deep copy) 319 if ( typeof target !== "object" && !isFunction( target ) ) { 320 target = {}; 321 } 322 323 // Extend jQuery itself if only one argument is passed 324 if ( i === length ) { 325 target = this; 326 i--; 327 } 328 329 for ( ; i < length; i++ ) { 330 331 // Only deal with non-null/undefined values 332 if ( ( options = arguments[ i ] ) != null ) { 333 334 // Extend the base object 335 for ( name in options ) { 336 copy = options[ name ]; 337 338 // Prevent Object.prototype pollution 339 // Prevent never-ending loop 340 if ( name === "__proto__" || target === copy ) { 341 continue; 342 } 343 344 // Recurse if we're merging plain objects or arrays 345 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 346 ( copyIsArray = Array.isArray( copy ) ) ) ) { 347 src = target[ name ]; 348 349 // Ensure proper type for the source value 350 if ( copyIsArray && !Array.isArray( src ) ) { 351 clone = []; 352 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 353 clone = {}; 354 } else { 355 clone = src; 356 } 357 copyIsArray = false; 358 359 // Never move original objects, clone them 360 target[ name ] = jQuery.extend( deep, clone, copy ); 361 362 // Don't bring in undefined values 363 } else if ( copy !== undefined ) { 364 target[ name ] = copy; 365 } 366 } 367 } 368 } 369 370 // Return the modified object 371 return target; 372}; 373 374jQuery.extend( { 375 376 // Unique for each copy of jQuery on the page 377 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 378 379 // Assume jQuery is ready without the ready module 380 isReady: true, 381 382 error: function( msg ) { 383 throw new Error( msg ); 384 }, 385 386 noop: function() {}, 387 388 isPlainObject: function( obj ) { 389 var proto, Ctor; 390 391 // Detect obvious negatives 392 // Use toString instead of jQuery.type to catch host objects 393 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 394 return false; 395 } 396 397 proto = getProto( obj ); 398 399 // Objects with no prototype (e.g., `Object.create( null )`) are plain 400 if ( !proto ) { 401 return true; 402 } 403 404 // Objects with prototype are plain iff they were constructed by a global Object function 405 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 406 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 407 }, 408 409 isEmptyObject: function( obj ) { 410 var name; 411 412 for ( name in obj ) { 413 return false; 414 } 415 return true; 416 }, 417 418 // Evaluates a script in a provided context; falls back to the global one 419 // if not specified. 420 globalEval: function( code, options, doc ) { 421 DOMEval( code, { nonce: options && options.nonce }, doc ); 422 }, 423 424 each: function( obj, callback ) { 425 var length, i = 0; 426 427 if ( isArrayLike( obj ) ) { 428 length = obj.length; 429 for ( ; i < length; i++ ) { 430 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 431 break; 432 } 433 } 434 } else { 435 for ( i in obj ) { 436 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 437 break; 438 } 439 } 440 } 441 442 return obj; 443 }, 444 445 446 // Retrieve the text value of an array of DOM nodes 447 text: function( elem ) { 448 var node, 449 ret = "", 450 i = 0, 451 nodeType = elem.nodeType; 452 453 if ( !nodeType ) { 454 455 // If no nodeType, this is expected to be an array 456 while ( ( node = elem[ i++ ] ) ) { 457 458 // Do not traverse comment nodes 459 ret += jQuery.text( node ); 460 } 461 } 462 if ( nodeType === 1 || nodeType === 11 ) { 463 return elem.textContent; 464 } 465 if ( nodeType === 9 ) { 466 return elem.documentElement.textContent; 467 } 468 if ( nodeType === 3 || nodeType === 4 ) { 469 return elem.nodeValue; 470 } 471 472 // Do not include comment or processing instruction nodes 473 474 return ret; 475 }, 476 477 // results is for internal usage only 478 makeArray: function( arr, results ) { 479 var ret = results || []; 480 481 if ( arr != null ) { 482 if ( isArrayLike( Object( arr ) ) ) { 483 jQuery.merge( ret, 484 typeof arr === "string" ? 485 [ arr ] : arr 486 ); 487 } else { 488 push.call( ret, arr ); 489 } 490 } 491 492 return ret; 493 }, 494 495 inArray: function( elem, arr, i ) { 496 return arr == null ? -1 : indexOf.call( arr, elem, i ); 497 }, 498 499 isXMLDoc: function( elem ) { 500 var namespace = elem && elem.namespaceURI, 501 docElem = elem && ( elem.ownerDocument || elem ).documentElement; 502 503 // Assume HTML when documentElement doesn't yet exist, such as inside 504 // document fragments. 505 return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); 506 }, 507 508 // Support: Android <=4.0 only, PhantomJS 1 only 509 // push.apply(_, arraylike) throws on ancient WebKit 510 merge: function( first, second ) { 511 var len = +second.length, 512 j = 0, 513 i = first.length; 514 515 for ( ; j < len; j++ ) { 516 first[ i++ ] = second[ j ]; 517 } 518 519 first.length = i; 520 521 return first; 522 }, 523 524 grep: function( elems, callback, invert ) { 525 var callbackInverse, 526 matches = [], 527 i = 0, 528 length = elems.length, 529 callbackExpect = !invert; 530 531 // Go through the array, only saving the items 532 // that pass the validator function 533 for ( ; i < length; i++ ) { 534 callbackInverse = !callback( elems[ i ], i ); 535 if ( callbackInverse !== callbackExpect ) { 536 matches.push( elems[ i ] ); 537 } 538 } 539 540 return matches; 541 }, 542 543 // arg is for internal usage only 544 map: function( elems, callback, arg ) { 545 var length, value, 546 i = 0, 547 ret = []; 548 549 // Go through the array, translating each of the items to their new values 550 if ( isArrayLike( elems ) ) { 551 length = elems.length; 552 for ( ; i < length; i++ ) { 553 value = callback( elems[ i ], i, arg ); 554 555 if ( value != null ) { 556 ret.push( value ); 557 } 558 } 559 560 // Go through every key on the object, 561 } else { 562 for ( i in elems ) { 563 value = callback( elems[ i ], i, arg ); 564 565 if ( value != null ) { 566 ret.push( value ); 567 } 568 } 569 } 570 571 // Flatten any nested arrays 572 return flat( ret ); 573 }, 574 575 // A global GUID counter for objects 576 guid: 1, 577 578 // jQuery.support is not used in Core but other projects attach their 579 // properties to it so it needs to exist. 580 support: support 581} ); 582 583if ( typeof Symbol === "function" ) { 584 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 585} 586 587// Populate the class2type map 588jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 589 function( _i, name ) { 590 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 591 } ); 592 593function isArrayLike( obj ) { 594 595 // Support: real iOS 8.2 only (not reproducible in simulator) 596 // `in` check used to prevent JIT error (gh-2145) 597 // hasOwn isn't used here due to false negatives 598 // regarding Nodelist length in IE 599 var length = !!obj && "length" in obj && obj.length, 600 type = toType( obj ); 601 602 if ( isFunction( obj ) || isWindow( obj ) ) { 603 return false; 604 } 605 606 return type === "array" || length === 0 || 607 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 608} 609 610 611function nodeName( elem, name ) { 612 613 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 614 615} 616var pop = arr.pop; 617 618 619var sort = arr.sort; 620 621 622var splice = arr.splice; 623 624 625var whitespace = "[\\x20\\t\\r\\n\\f]"; 626 627 628var rtrimCSS = new RegExp( 629 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", 630 "g" 631); 632 633 634 635 636// Note: an element does not contain itself 637jQuery.contains = function( a, b ) { 638 var bup = b && b.parentNode; 639 640 return a === bup || !!( bup && bup.nodeType === 1 && ( 641 642 // Support: IE 9 - 11+ 643 // IE doesn't have `contains` on SVG. 644 a.contains ? 645 a.contains( bup ) : 646 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 647 ) ); 648}; 649 650 651 652 653// CSS string/identifier serialization 654// https://drafts.csswg.org/cssom/#common-serializing-idioms 655var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 656 657function fcssescape( ch, asCodePoint ) { 658 if ( asCodePoint ) { 659 660 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 661 if ( ch === "\0" ) { 662 return "\uFFFD"; 663 } 664 665 // Control characters and (dependent upon position) numbers get escaped as code points 666 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 667 } 668 669 // Other potentially-special ASCII characters get backslash-escaped 670 return "\\" + ch; 671} 672 673jQuery.escapeSelector = function( sel ) { 674 return ( sel + "" ).replace( rcssescape, fcssescape ); 675}; 676 677 678 679 680var preferredDoc = document, 681 pushNative = push; 682 683( function() { 684 685var i, 686 Expr, 687 outermostContext, 688 sortInput, 689 hasDuplicate, 690 push = pushNative, 691 692 // Local document vars 693 document, 694 documentElement, 695 documentIsHTML, 696 rbuggyQSA, 697 matches, 698 699 // Instance-specific data 700 expando = jQuery.expando, 701 dirruns = 0, 702 done = 0, 703 classCache = createCache(), 704 tokenCache = createCache(), 705 compilerCache = createCache(), 706 nonnativeSelectorCache = createCache(), 707 sortOrder = function( a, b ) { 708 if ( a === b ) { 709 hasDuplicate = true; 710 } 711 return 0; 712 }, 713 714 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + 715 "loop|multiple|open|readonly|required|scoped", 716 717 // Regular expressions 718 719 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 720 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 721 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 722 723 // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors 724 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 725 726 // Operator (capture 2) 727 "*([*^$|!~]?=)" + whitespace + 728 729 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 730 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 731 whitespace + "*\\]", 732 733 pseudos = ":(" + identifier + ")(?:\\((" + 734 735 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 736 // 1. quoted (capture 3; capture 4 or capture 5) 737 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 738 739 // 2. simple (capture 6) 740 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 741 742 // 3. anything else (capture 2) 743 ".*" + 744 ")\\)|)", 745 746 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 747 rwhitespace = new RegExp( whitespace + "+", "g" ), 748 749 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 750 rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + 751 whitespace + "*" ), 752 rdescend = new RegExp( whitespace + "|>" ), 753 754 rpseudo = new RegExp( pseudos ), 755 ridentifier = new RegExp( "^" + identifier + "$" ), 756 757 matchExpr = { 758 ID: new RegExp( "^#(" + identifier + ")" ), 759 CLASS: new RegExp( "^\\.(" + identifier + ")" ), 760 TAG: new RegExp( "^(" + identifier + "|[*])" ), 761 ATTR: new RegExp( "^" + attributes ), 762 PSEUDO: new RegExp( "^" + pseudos ), 763 CHILD: new RegExp( 764 "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 765 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 766 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 767 bool: new RegExp( "^(?:" + booleans + ")$", "i" ), 768 769 // For use in libraries implementing .is() 770 // We use this for POS matching in `select` 771 needsContext: new RegExp( "^" + whitespace + 772 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 773 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 774 }, 775 776 rinputs = /^(?:input|select|textarea|button)$/i, 777 rheader = /^h\d$/i, 778 779 // Easily-parseable/retrievable ID or TAG or CLASS selectors 780 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 781 782 rsibling = /[+~]/, 783 784 // CSS escapes 785 // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters 786 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + 787 "?|\\\\([^\\r\\n\\f])", "g" ), 788 funescape = function( escape, nonHex ) { 789 var high = "0x" + escape.slice( 1 ) - 0x10000; 790 791 if ( nonHex ) { 792 793 // Strip the backslash prefix from a non-hex escape sequence 794 return nonHex; 795 } 796 797 // Replace a hexadecimal escape sequence with the encoded Unicode code point 798 // Support: IE <=11+ 799 // For values outside the Basic Multilingual Plane (BMP), manually construct a 800 // surrogate pair 801 return high < 0 ? 802 String.fromCharCode( high + 0x10000 ) : 803 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 804 }, 805 806 // Used for iframes; see `setDocument`. 807 // Support: IE 9 - 11+, Edge 12 - 18+ 808 // Removing the function wrapper causes a "Permission Denied" 809 // error in IE/Edge. 810 unloadHandler = function() { 811 setDocument(); 812 }, 813 814 inDisabledFieldset = addCombinator( 815 function( elem ) { 816 return elem.disabled === true && nodeName( elem, "fieldset" ); 817 }, 818 { dir: "parentNode", next: "legend" } 819 ); 820 821// Support: IE <=9 only 822// Accessing document.activeElement can throw unexpectedly 823// https://bugs.jquery.com/ticket/13393 824function safeActiveElement() { 825 try { 826 return document.activeElement; 827 } catch ( err ) { } 828} 829 830// Optimize for push.apply( _, NodeList ) 831try { 832 push.apply( 833 ( arr = slice.call( preferredDoc.childNodes ) ), 834 preferredDoc.childNodes 835 ); 836 837 // Support: Android <=4.0 838 // Detect silently failing push.apply 839 // eslint-disable-next-line no-unused-expressions 840 arr[ preferredDoc.childNodes.length ].nodeType; 841} catch ( e ) { 842 push = { 843 apply: function( target, els ) { 844 pushNative.apply( target, slice.call( els ) ); 845 }, 846 call: function( target ) { 847 pushNative.apply( target, slice.call( arguments, 1 ) ); 848 } 849 }; 850} 851 852function find( selector, context, results, seed ) { 853 var m, i, elem, nid, match, groups, newSelector, 854 newContext = context && context.ownerDocument, 855 856 // nodeType defaults to 9, since context defaults to document 857 nodeType = context ? context.nodeType : 9; 858 859 results = results || []; 860 861 // Return early from calls with invalid selector or context 862 if ( typeof selector !== "string" || !selector || 863 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 864 865 return results; 866 } 867 868 // Try to shortcut find operations (as opposed to filters) in HTML documents 869 if ( !seed ) { 870 setDocument( context ); 871 context = context || document; 872 873 if ( documentIsHTML ) { 874 875 // If the selector is sufficiently simple, try using a "get*By*" DOM method 876 // (excepting DocumentFragment context, where the methods don't exist) 877 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 878 879 // ID selector 880 if ( ( m = match[ 1 ] ) ) { 881 882 // Document context 883 if ( nodeType === 9 ) { 884 if ( ( elem = context.getElementById( m ) ) ) { 885 886 // Support: IE 9 only 887 // getElementById can match elements by name instead of ID 888 if ( elem.id === m ) { 889 push.call( results, elem ); 890 return results; 891 } 892 } else { 893 return results; 894 } 895 896 // Element context 897 } else { 898 899 // Support: IE 9 only 900 // getElementById can match elements by name instead of ID 901 if ( newContext && ( elem = newContext.getElementById( m ) ) && 902 find.contains( context, elem ) && 903 elem.id === m ) { 904 905 push.call( results, elem ); 906 return results; 907 } 908 } 909 910 // Type selector 911 } else if ( match[ 2 ] ) { 912 push.apply( results, context.getElementsByTagName( selector ) ); 913 return results; 914 915 // Class selector 916 } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { 917 push.apply( results, context.getElementsByClassName( m ) ); 918 return results; 919 } 920 } 921 922 // Take advantage of querySelectorAll 923 if ( !nonnativeSelectorCache[ selector + " " ] && 924 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { 925 926 newSelector = selector; 927 newContext = context; 928 929 // qSA considers elements outside a scoping root when evaluating child or 930 // descendant combinators, which is not what we want. 931 // In such cases, we work around the behavior by prefixing every selector in the 932 // list with an ID selector referencing the scope context. 933 // The technique has to be used as well when a leading combinator is used 934 // as such selectors are not recognized by querySelectorAll. 935 // Thanks to Andrew Dupont for this technique. 936 if ( nodeType === 1 && 937 ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { 938 939 // Expand context for sibling selectors 940 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 941 context; 942 943 // We can use :scope instead of the ID hack if the browser 944 // supports it & if we're not changing the context. 945 // Support: IE 11+, Edge 17 - 18+ 946 // IE/Edge sometimes throw a "Permission denied" error when 947 // strict-comparing two documents; shallow comparisons work. 948 // eslint-disable-next-line eqeqeq 949 if ( newContext != context || !support.scope ) { 950 951 // Capture the context ID, setting it first if necessary 952 if ( ( nid = context.getAttribute( "id" ) ) ) { 953 nid = jQuery.escapeSelector( nid ); 954 } else { 955 context.setAttribute( "id", ( nid = expando ) ); 956 } 957 } 958 959 // Prefix every selector in the list 960 groups = tokenize( selector ); 961 i = groups.length; 962 while ( i-- ) { 963 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 964 toSelector( groups[ i ] ); 965 } 966 newSelector = groups.join( "," ); 967 } 968 969 try { 970 push.apply( results, 971 newContext.querySelectorAll( newSelector ) 972 ); 973 return results; 974 } catch ( qsaError ) { 975 nonnativeSelectorCache( selector, true ); 976 } finally { 977 if ( nid === expando ) { 978 context.removeAttribute( "id" ); 979 } 980 } 981 } 982 } 983 } 984 985 // All others 986 return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); 987} 988 989/** 990 * Create key-value caches of limited size 991 * @returns {function(string, object)} Returns the Object data after storing it on itself with 992 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 993 * deleting the oldest entry 994 */ 995function createCache() { 996 var keys = []; 997 998 function cache( key, value ) { 999 1000 // Use (key + " ") to avoid collision with native prototype properties 1001 // (see https://github.com/jquery/sizzle/issues/157) 1002 if ( keys.push( key + " " ) > Expr.cacheLength ) { 1003 1004 // Only keep the most recent entries 1005 delete cache[ keys.shift() ]; 1006 } 1007 return ( cache[ key + " " ] = value ); 1008 } 1009 return cache; 1010} 1011 1012/** 1013 * Mark a function for special use by jQuery selector module 1014 * @param {Function} fn The function to mark 1015 */ 1016function markFunction( fn ) { 1017 fn[ expando ] = true; 1018 return fn; 1019} 1020 1021/** 1022 * Support testing using an element 1023 * @param {Function} fn Passed the created element and returns a boolean result 1024 */ 1025function assert( fn ) { 1026 var el = document.createElement( "fieldset" ); 1027 1028 try { 1029 return !!fn( el ); 1030 } catch ( e ) { 1031 return false; 1032 } finally { 1033 1034 // Remove from its parent by default 1035 if ( el.parentNode ) { 1036 el.parentNode.removeChild( el ); 1037 } 1038 1039 // release memory in IE 1040 el = null; 1041 } 1042} 1043 1044/** 1045 * Returns a function to use in pseudos for input types 1046 * @param {String} type 1047 */ 1048function createInputPseudo( type ) { 1049 return function( elem ) { 1050 return nodeName( elem, "input" ) && elem.type === type; 1051 }; 1052} 1053 1054/** 1055 * Returns a function to use in pseudos for buttons 1056 * @param {String} type 1057 */ 1058function createButtonPseudo( type ) { 1059 return function( elem ) { 1060 return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && 1061 elem.type === type; 1062 }; 1063} 1064 1065/** 1066 * Returns a function to use in pseudos for :enabled/:disabled 1067 * @param {Boolean} disabled true for :disabled; false for :enabled 1068 */ 1069function createDisabledPseudo( disabled ) { 1070 1071 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 1072 return function( elem ) { 1073 1074 // Only certain elements can match :enabled or :disabled 1075 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 1076 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 1077 if ( "form" in elem ) { 1078 1079 // Check for inherited disabledness on relevant non-disabled elements: 1080 // * listed form-associated elements in a disabled fieldset 1081 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 1082 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 1083 // * option elements in a disabled optgroup 1084 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 1085 // All such elements have a "form" property. 1086 if ( elem.parentNode && elem.disabled === false ) { 1087 1088 // Option elements defer to a parent optgroup if present 1089 if ( "label" in elem ) { 1090 if ( "label" in elem.parentNode ) { 1091 return elem.parentNode.disabled === disabled; 1092 } else { 1093 return elem.disabled === disabled; 1094 } 1095 } 1096 1097 // Support: IE 6 - 11+ 1098 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 1099 return elem.isDisabled === disabled || 1100 1101 // Where there is no isDisabled, check manually 1102 elem.isDisabled !== !disabled && 1103 inDisabledFieldset( elem ) === disabled; 1104 } 1105 1106 return elem.disabled === disabled; 1107 1108 // Try to winnow out elements that can't be disabled before trusting the disabled property. 1109 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 1110 // even exist on them, let alone have a boolean value. 1111 } else if ( "label" in elem ) { 1112 return elem.disabled === disabled; 1113 } 1114 1115 // Remaining elements are neither :enabled nor :disabled 1116 return false; 1117 }; 1118} 1119 1120/** 1121 * Returns a function to use in pseudos for positionals 1122 * @param {Function} fn 1123 */ 1124function createPositionalPseudo( fn ) { 1125 return markFunction( function( argument ) { 1126 argument = +argument; 1127 return markFunction( function( seed, matches ) { 1128 var j, 1129 matchIndexes = fn( [], seed.length, argument ), 1130 i = matchIndexes.length; 1131 1132 // Match elements found at the specified indexes 1133 while ( i-- ) { 1134 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 1135 seed[ j ] = !( matches[ j ] = seed[ j ] ); 1136 } 1137 } 1138 } ); 1139 } ); 1140} 1141 1142/** 1143 * Checks a node for validity as a jQuery selector context 1144 * @param {Element|Object=} context 1145 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1146 */ 1147function testContext( context ) { 1148 return context && typeof context.getElementsByTagName !== "undefined" && context; 1149} 1150 1151/** 1152 * Sets document-related variables once based on the current document 1153 * @param {Element|Object} [node] An element or document object to use to set the document 1154 * @returns {Object} Returns the current document 1155 */ 1156function setDocument( node ) { 1157 var subWindow, 1158 doc = node ? node.ownerDocument || node : preferredDoc; 1159 1160 // Return early if doc is invalid or already selected 1161 // Support: IE 11+, Edge 17 - 18+ 1162 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1163 // two documents; shallow comparisons work. 1164 // eslint-disable-next-line eqeqeq 1165 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 1166 return document; 1167 } 1168 1169 // Update global variables 1170 document = doc; 1171 documentElement = document.documentElement; 1172 documentIsHTML = !jQuery.isXMLDoc( document ); 1173 1174 // Support: iOS 7 only, IE 9 - 11+ 1175 // Older browsers didn't support unprefixed `matches`. 1176 matches = documentElement.matches || 1177 documentElement.webkitMatchesSelector || 1178 documentElement.msMatchesSelector; 1179 1180 // Support: IE 9 - 11+, Edge 12 - 18+ 1181 // Accessing iframe documents after unload throws "permission denied" errors 1182 // (see trac-13936). 1183 // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`, 1184 // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well. 1185 if ( documentElement.msMatchesSelector && 1186 1187 // Support: IE 11+, Edge 17 - 18+ 1188 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1189 // two documents; shallow comparisons work. 1190 // eslint-disable-next-line eqeqeq 1191 preferredDoc != document && 1192 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 1193 1194 // Support: IE 9 - 11+, Edge 12 - 18+ 1195 subWindow.addEventListener( "unload", unloadHandler ); 1196 } 1197 1198 // Support: IE <10 1199 // Check if getElementById returns elements by name 1200 // The broken getElementById methods don't pick up programmatically-set names, 1201 // so use a roundabout getElementsByName test 1202 support.getById = assert( function( el ) { 1203 documentElement.appendChild( el ).id = jQuery.expando; 1204 return !document.getElementsByName || 1205 !document.getElementsByName( jQuery.expando ).length; 1206 } ); 1207 1208 // Support: IE 9 only 1209 // Check to see if it's possible to do matchesSelector 1210 // on a disconnected node. 1211 support.disconnectedMatch = assert( function( el ) { 1212 return matches.call( el, "*" ); 1213 } ); 1214 1215 // Support: IE 9 - 11+, Edge 12 - 18+ 1216 // IE/Edge don't support the :scope pseudo-class. 1217 support.scope = assert( function() { 1218 return document.querySelectorAll( ":scope" ); 1219 } ); 1220 1221 // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only 1222 // Make sure the `:has()` argument is parsed unforgivingly. 1223 // We include `*` in the test to detect buggy implementations that are 1224 // _selectively_ forgiving (specifically when the list includes at least 1225 // one valid selector). 1226 // Note that we treat complete lack of support for `:has()` as if it were 1227 // spec-compliant support, which is fine because use of `:has()` in such 1228 // environments will fail in the qSA path and fall back to jQuery traversal 1229 // anyway. 1230 support.cssHas = assert( function() { 1231 try { 1232 document.querySelector( ":has(*,:jqfake)" ); 1233 return false; 1234 } catch ( e ) { 1235 return true; 1236 } 1237 } ); 1238 1239 // ID filter and find 1240 if ( support.getById ) { 1241 Expr.filter.ID = function( id ) { 1242 var attrId = id.replace( runescape, funescape ); 1243 return function( elem ) { 1244 return elem.getAttribute( "id" ) === attrId; 1245 }; 1246 }; 1247 Expr.find.ID = function( id, context ) { 1248 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1249 var elem = context.getElementById( id ); 1250 return elem ? [ elem ] : []; 1251 } 1252 }; 1253 } else { 1254 Expr.filter.ID = function( id ) { 1255 var attrId = id.replace( runescape, funescape ); 1256 return function( elem ) { 1257 var node = typeof elem.getAttributeNode !== "undefined" && 1258 elem.getAttributeNode( "id" ); 1259 return node && node.value === attrId; 1260 }; 1261 }; 1262 1263 // Support: IE 6 - 7 only 1264 // getElementById is not reliable as a find shortcut 1265 Expr.find.ID = function( id, context ) { 1266 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1267 var node, i, elems, 1268 elem = context.getElementById( id ); 1269 1270 if ( elem ) { 1271 1272 // Verify the id attribute 1273 node = elem.getAttributeNode( "id" ); 1274 if ( node && node.value === id ) { 1275 return [ elem ]; 1276 } 1277 1278 // Fall back on getElementsByName 1279 elems = context.getElementsByName( id ); 1280 i = 0; 1281 while ( ( elem = elems[ i++ ] ) ) { 1282 node = elem.getAttributeNode( "id" ); 1283 if ( node && node.value === id ) { 1284 return [ elem ]; 1285 } 1286 } 1287 } 1288 1289 return []; 1290 } 1291 }; 1292 } 1293 1294 // Tag 1295 Expr.find.TAG = function( tag, context ) { 1296 if ( typeof context.getElementsByTagName !== "undefined" ) { 1297 return context.getElementsByTagName( tag ); 1298 1299 // DocumentFragment nodes don't have gEBTN 1300 } else { 1301 return context.querySelectorAll( tag ); 1302 } 1303 }; 1304 1305 // Class 1306 Expr.find.CLASS = function( className, context ) { 1307 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1308 return context.getElementsByClassName( className ); 1309 } 1310 }; 1311 1312 /* QSA/matchesSelector 1313 ---------------------------------------------------------------------- */ 1314 1315 // QSA and matchesSelector support 1316 1317 rbuggyQSA = []; 1318 1319 // Build QSA regex 1320 // Regex strategy adopted from Diego Perini 1321 assert( function( el ) { 1322 1323 var input; 1324 1325 documentElement.appendChild( el ).innerHTML = 1326 "<a id='" + expando + "' href='' disabled='disabled'></a>" + 1327 "<select id='" + expando + "-\r\\' disabled='disabled'>" + 1328 "<option selected=''></option></select>"; 1329 1330 // Support: iOS <=7 - 8 only 1331 // Boolean attributes and "value" are not treated correctly in some XML documents 1332 if ( !el.querySelectorAll( "[selected]" ).length ) { 1333 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1334 } 1335 1336 // Support: iOS <=7 - 8 only 1337 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1338 rbuggyQSA.push( "~=" ); 1339 } 1340 1341 // Support: iOS 8 only 1342 // https://bugs.webkit.org/show_bug.cgi?id=136851 1343 // In-page `selector#id sibling-combinator selector` fails 1344 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 1345 rbuggyQSA.push( ".#.+[+~]" ); 1346 } 1347 1348 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 1349 // In some of the document kinds, these selectors wouldn't work natively. 1350 // This is probably OK but for backwards compatibility we want to maintain 1351 // handling them through jQuery traversal in jQuery 3.x. 1352 if ( !el.querySelectorAll( ":checked" ).length ) { 1353 rbuggyQSA.push( ":checked" ); 1354 } 1355 1356 // Support: Windows 8 Native Apps 1357 // The type and name attributes are restricted during .innerHTML assignment 1358 input = document.createElement( "input" ); 1359 input.setAttribute( "type", "hidden" ); 1360 el.appendChild( input ).setAttribute( "name", "D" ); 1361 1362 // Support: IE 9 - 11+ 1363 // IE's :disabled selector does not pick up the children of disabled fieldsets 1364 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 1365 // In some of the document kinds, these selectors wouldn't work natively. 1366 // This is probably OK but for backwards compatibility we want to maintain 1367 // handling them through jQuery traversal in jQuery 3.x. 1368 documentElement.appendChild( el ).disabled = true; 1369 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 1370 rbuggyQSA.push( ":enabled", ":disabled" ); 1371 } 1372 1373 // Support: IE 11+, Edge 15 - 18+ 1374 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 1375 // Adding a temporary attribute to the document before the selection works 1376 // around the issue. 1377 // Interestingly, IE 10 & older don't seem to have the issue. 1378 input = document.createElement( "input" ); 1379 input.setAttribute( "name", "" ); 1380 el.appendChild( input ); 1381 if ( !el.querySelectorAll( "[name='']" ).length ) { 1382 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 1383 whitespace + "*(?:''|\"\")" ); 1384 } 1385 } ); 1386 1387 if ( !support.cssHas ) { 1388 1389 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ 1390 // Our regular `try-catch` mechanism fails to detect natively-unsupported 1391 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) 1392 // in browsers that parse the `:has()` argument as a forgiving selector list. 1393 // https://drafts.csswg.org/selectors/#relational now requires the argument 1394 // to be parsed unforgivingly, but browsers have not yet fully adjusted. 1395 rbuggyQSA.push( ":has" ); 1396 } 1397 1398 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 1399 1400 /* Sorting 1401 ---------------------------------------------------------------------- */ 1402 1403 // Document order sorting 1404 sortOrder = function( a, b ) { 1405 1406 // Flag for duplicate removal 1407 if ( a === b ) { 1408 hasDuplicate = true; 1409 return 0; 1410 } 1411 1412 // Sort on method existence if only one input has compareDocumentPosition 1413 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1414 if ( compare ) { 1415 return compare; 1416 } 1417 1418 // Calculate position if both inputs belong to the same document 1419 // Support: IE 11+, Edge 17 - 18+ 1420 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1421 // two documents; shallow comparisons work. 1422 // eslint-disable-next-line eqeqeq 1423 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 1424 a.compareDocumentPosition( b ) : 1425 1426 // Otherwise we know they are disconnected 1427 1; 1428 1429 // Disconnected nodes 1430 if ( compare & 1 || 1431 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 1432 1433 // Choose the first element that is related to our preferred document 1434 // Support: IE 11+, Edge 17 - 18+ 1435 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1436 // two documents; shallow comparisons work. 1437 // eslint-disable-next-line eqeqeq 1438 if ( a === document || a.ownerDocument == preferredDoc && 1439 find.contains( preferredDoc, a ) ) { 1440 return -1; 1441 } 1442 1443 // Support: IE 11+, Edge 17 - 18+ 1444 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1445 // two documents; shallow comparisons work. 1446 // eslint-disable-next-line eqeqeq 1447 if ( b === document || b.ownerDocument == preferredDoc && 1448 find.contains( preferredDoc, b ) ) { 1449 return 1; 1450 } 1451 1452 // Maintain original order 1453 return sortInput ? 1454 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 1455 0; 1456 } 1457 1458 return compare & 4 ? -1 : 1; 1459 }; 1460 1461 return document; 1462} 1463 1464find.matches = function( expr, elements ) { 1465 return find( expr, null, null, elements ); 1466}; 1467 1468find.matchesSelector = function( elem, expr ) { 1469 setDocument( elem ); 1470 1471 if ( documentIsHTML && 1472 !nonnativeSelectorCache[ expr + " " ] && 1473 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1474 1475 try { 1476 var ret = matches.call( elem, expr ); 1477 1478 // IE 9's matchesSelector returns false on disconnected nodes 1479 if ( ret || support.disconnectedMatch || 1480 1481 // As well, disconnected nodes are said to be in a document 1482 // fragment in IE 9 1483 elem.document && elem.document.nodeType !== 11 ) { 1484 return ret; 1485 } 1486 } catch ( e ) { 1487 nonnativeSelectorCache( expr, true ); 1488 } 1489 } 1490 1491 return find( expr, document, null, [ elem ] ).length > 0; 1492}; 1493 1494find.contains = function( context, elem ) { 1495 1496 // Set document vars if needed 1497 // Support: IE 11+, Edge 17 - 18+ 1498 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1499 // two documents; shallow comparisons work. 1500 // eslint-disable-next-line eqeqeq 1501 if ( ( context.ownerDocument || context ) != document ) { 1502 setDocument( context ); 1503 } 1504 return jQuery.contains( context, elem ); 1505}; 1506 1507 1508find.attr = function( elem, name ) { 1509 1510 // Set document vars if needed 1511 // Support: IE 11+, Edge 17 - 18+ 1512 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1513 // two documents; shallow comparisons work. 1514 // eslint-disable-next-line eqeqeq 1515 if ( ( elem.ownerDocument || elem ) != document ) { 1516 setDocument( elem ); 1517 } 1518 1519 var fn = Expr.attrHandle[ name.toLowerCase() ], 1520 1521 // Don't get fooled by Object.prototype properties (see trac-13807) 1522 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1523 fn( elem, name, !documentIsHTML ) : 1524 undefined; 1525 1526 if ( val !== undefined ) { 1527 return val; 1528 } 1529 1530 return elem.getAttribute( name ); 1531}; 1532 1533find.error = function( msg ) { 1534 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1535}; 1536 1537/** 1538 * Document sorting and removing duplicates 1539 * @param {ArrayLike} results 1540 */ 1541jQuery.uniqueSort = function( results ) { 1542 var elem, 1543 duplicates = [], 1544 j = 0, 1545 i = 0; 1546 1547 // Unless we *know* we can detect duplicates, assume their presence 1548 // 1549 // Support: Android <=4.0+ 1550 // Testing for detecting duplicates is unpredictable so instead assume we can't 1551 // depend on duplicate detection in all browsers without a stable sort. 1552 hasDuplicate = !support.sortStable; 1553 sortInput = !support.sortStable && slice.call( results, 0 ); 1554 sort.call( results, sortOrder ); 1555 1556 if ( hasDuplicate ) { 1557 while ( ( elem = results[ i++ ] ) ) { 1558 if ( elem === results[ i ] ) { 1559 j = duplicates.push( i ); 1560 } 1561 } 1562 while ( j-- ) { 1563 splice.call( results, duplicates[ j ], 1 ); 1564 } 1565 } 1566 1567 // Clear input after sorting to release objects 1568 // See https://github.com/jquery/sizzle/pull/225 1569 sortInput = null; 1570 1571 return results; 1572}; 1573 1574jQuery.fn.uniqueSort = function() { 1575 return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); 1576}; 1577 1578Expr = jQuery.expr = { 1579 1580 // Can be adjusted by the user 1581 cacheLength: 50, 1582 1583 createPseudo: markFunction, 1584 1585 match: matchExpr, 1586 1587 attrHandle: {}, 1588 1589 find: {}, 1590 1591 relative: { 1592 ">": { dir: "parentNode", first: true }, 1593 " ": { dir: "parentNode" }, 1594 "+": { dir: "previousSibling", first: true }, 1595 "~": { dir: "previousSibling" } 1596 }, 1597 1598 preFilter: { 1599 ATTR: function( match ) { 1600 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 1601 1602 // Move the given value to match[3] whether quoted or unquoted 1603 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) 1604 .replace( runescape, funescape ); 1605 1606 if ( match[ 2 ] === "~=" ) { 1607 match[ 3 ] = " " + match[ 3 ] + " "; 1608 } 1609 1610 return match.slice( 0, 4 ); 1611 }, 1612 1613 CHILD: function( match ) { 1614 1615 /* matches from matchExpr["CHILD"] 1616 1 type (only|nth|...) 1617 2 what (child|of-type) 1618 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1619 4 xn-component of xn+y argument ([+-]?\d*n|) 1620 5 sign of xn-component 1621 6 x of xn-component 1622 7 sign of y-component 1623 8 y of y-component 1624 */ 1625 match[ 1 ] = match[ 1 ].toLowerCase(); 1626 1627 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 1628 1629 // nth-* requires argument 1630 if ( !match[ 3 ] ) { 1631 find.error( match[ 0 ] ); 1632 } 1633 1634 // numeric x and y parameters for Expr.filter.CHILD 1635 // remember that false/true cast respectively to 0/1 1636 match[ 4 ] = +( match[ 4 ] ? 1637 match[ 5 ] + ( match[ 6 ] || 1 ) : 1638 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) 1639 ); 1640 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 1641 1642 // other types prohibit arguments 1643 } else if ( match[ 3 ] ) { 1644 find.error( match[ 0 ] ); 1645 } 1646 1647 return match; 1648 }, 1649 1650 PSEUDO: function( match ) { 1651 var excess, 1652 unquoted = !match[ 6 ] && match[ 2 ]; 1653 1654 if ( matchExpr.CHILD.test( match[ 0 ] ) ) { 1655 return null; 1656 } 1657 1658 // Accept quoted arguments as-is 1659 if ( match[ 3 ] ) { 1660 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 1661 1662 // Strip excess characters from unquoted arguments 1663 } else if ( unquoted && rpseudo.test( unquoted ) && 1664 1665 // Get excess from tokenize (recursively) 1666 ( excess = tokenize( unquoted, true ) ) && 1667 1668 // advance to the next closing parenthesis 1669 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 1670 1671 // excess is a negative index 1672 match[ 0 ] = match[ 0 ].slice( 0, excess ); 1673 match[ 2 ] = unquoted.slice( 0, excess ); 1674 } 1675 1676 // Return only captures needed by the pseudo filter method (type and argument) 1677 return match.slice( 0, 3 ); 1678 } 1679 }, 1680 1681 filter: { 1682 1683 TAG: function( nodeNameSelector ) { 1684 var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1685 return nodeNameSelector === "*" ? 1686 function() { 1687 return true; 1688 } : 1689 function( elem ) { 1690 return nodeName( elem, expectedNodeName ); 1691 }; 1692 }, 1693 1694 CLASS: function( className ) { 1695 var pattern = classCache[ className + " " ]; 1696 1697 return pattern || 1698 ( pattern = new RegExp( "(^|" + whitespace + ")" + className + 1699 "(" + whitespace + "|$)" ) ) && 1700 classCache( className, function( elem ) { 1701 return pattern.test( 1702 typeof elem.className === "string" && elem.className || 1703 typeof elem.getAttribute !== "undefined" && 1704 elem.getAttribute( "class" ) || 1705 "" 1706 ); 1707 } ); 1708 }, 1709 1710 ATTR: function( name, operator, check ) { 1711 return function( elem ) { 1712 var result = find.attr( elem, name ); 1713 1714 if ( result == null ) { 1715 return operator === "!="; 1716 } 1717 if ( !operator ) { 1718 return true; 1719 } 1720 1721 result += ""; 1722 1723 if ( operator === "=" ) { 1724 return result === check; 1725 } 1726 if ( operator === "!=" ) { 1727 return result !== check; 1728 } 1729 if ( operator === "^=" ) { 1730 return check && result.indexOf( check ) === 0; 1731 } 1732 if ( operator === "*=" ) { 1733 return check && result.indexOf( check ) > -1; 1734 } 1735 if ( operator === "$=" ) { 1736 return check && result.slice( -check.length ) === check; 1737 } 1738 if ( operator === "~=" ) { 1739 return ( " " + result.replace( rwhitespace, " " ) + " " ) 1740 .indexOf( check ) > -1; 1741 } 1742 if ( operator === "|=" ) { 1743 return result === check || result.slice( 0, check.length + 1 ) === check + "-"; 1744 } 1745 1746 return false; 1747 }; 1748 }, 1749 1750 CHILD: function( type, what, _argument, first, last ) { 1751 var simple = type.slice( 0, 3 ) !== "nth", 1752 forward = type.slice( -4 ) !== "last", 1753 ofType = what === "of-type"; 1754 1755 return first === 1 && last === 0 ? 1756 1757 // Shortcut for :nth-*(n) 1758 function( elem ) { 1759 return !!elem.parentNode; 1760 } : 1761 1762 function( elem, _context, xml ) { 1763 var cache, outerCache, node, nodeIndex, start, 1764 dir = simple !== forward ? "nextSibling" : "previousSibling", 1765 parent = elem.parentNode, 1766 name = ofType && elem.nodeName.toLowerCase(), 1767 useCache = !xml && !ofType, 1768 diff = false; 1769 1770 if ( parent ) { 1771 1772 // :(first|last|only)-(child|of-type) 1773 if ( simple ) { 1774 while ( dir ) { 1775 node = elem; 1776 while ( ( node = node[ dir ] ) ) { 1777 if ( ofType ? 1778 nodeName( node, name ) : 1779 node.nodeType === 1 ) { 1780 1781 return false; 1782 } 1783 } 1784 1785 // Reverse direction for :only-* (if we haven't yet done so) 1786 start = dir = type === "only" && !start && "nextSibling"; 1787 } 1788 return true; 1789 } 1790 1791 start = [ forward ? parent.firstChild : parent.lastChild ]; 1792 1793 // non-xml :nth-child(...) stores cache data on `parent` 1794 if ( forward && useCache ) { 1795 1796 // Seek `elem` from a previously-cached index 1797 outerCache = parent[ expando ] || ( parent[ expando ] = {} ); 1798 cache = outerCache[ type ] || []; 1799 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1800 diff = nodeIndex && cache[ 2 ]; 1801 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1802 1803 while ( ( node = ++nodeIndex && node && node[ dir ] || 1804 1805 // Fallback to seeking `elem` from the start 1806 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 1807 1808 // When found, cache indexes on `parent` and break 1809 if ( node.nodeType === 1 && ++diff && node === elem ) { 1810 outerCache[ type ] = [ dirruns, nodeIndex, diff ]; 1811 break; 1812 } 1813 } 1814 1815 } else { 1816 1817 // Use previously-cached element index if available 1818 if ( useCache ) { 1819 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 1820 cache = outerCache[ type ] || []; 1821 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1822 diff = nodeIndex; 1823 } 1824 1825 // xml :nth-child(...) 1826 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 1827 if ( diff === false ) { 1828 1829 // Use the same loop as above to seek `elem` from the start 1830 while ( ( node = ++nodeIndex && node && node[ dir ] || 1831 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 1832 1833 if ( ( ofType ? 1834 nodeName( node, name ) : 1835 node.nodeType === 1 ) && 1836 ++diff ) { 1837 1838 // Cache the index of each encountered element 1839 if ( useCache ) { 1840 outerCache = node[ expando ] || 1841 ( node[ expando ] = {} ); 1842 outerCache[ type ] = [ dirruns, diff ]; 1843 } 1844 1845 if ( node === elem ) { 1846 break; 1847 } 1848 } 1849 } 1850 } 1851 } 1852 1853 // Incorporate the offset, then check against cycle size 1854 diff -= last; 1855 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 1856 } 1857 }; 1858 }, 1859 1860 PSEUDO: function( pseudo, argument ) { 1861 1862 // pseudo-class names are case-insensitive 1863 // https://www.w3.org/TR/selectors/#pseudo-classes 1864 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 1865 // Remember that setFilters inherits from pseudos 1866 var args, 1867 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 1868 find.error( "unsupported pseudo: " + pseudo ); 1869 1870 // The user may use createPseudo to indicate that 1871 // arguments are needed to create the filter function 1872 // just as jQuery does 1873 if ( fn[ expando ] ) { 1874 return fn( argument ); 1875 } 1876 1877 // But maintain support for old signatures 1878 if ( fn.length > 1 ) { 1879 args = [ pseudo, pseudo, "", argument ]; 1880 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 1881 markFunction( function( seed, matches ) { 1882 var idx, 1883 matched = fn( seed, argument ), 1884 i = matched.length; 1885 while ( i-- ) { 1886 idx = indexOf.call( seed, matched[ i ] ); 1887 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 1888 } 1889 } ) : 1890 function( elem ) { 1891 return fn( elem, 0, args ); 1892 }; 1893 } 1894 1895 return fn; 1896 } 1897 }, 1898 1899 pseudos: { 1900 1901 // Potentially complex pseudos 1902 not: markFunction( function( selector ) { 1903 1904 // Trim the selector passed to compile 1905 // to avoid treating leading and trailing 1906 // spaces as combinators 1907 var input = [], 1908 results = [], 1909 matcher = compile( selector.replace( rtrimCSS, "$1" ) ); 1910 1911 return matcher[ expando ] ? 1912 markFunction( function( seed, matches, _context, xml ) { 1913 var elem, 1914 unmatched = matcher( seed, null, xml, [] ), 1915 i = seed.length; 1916 1917 // Match elements unmatched by `matcher` 1918 while ( i-- ) { 1919 if ( ( elem = unmatched[ i ] ) ) { 1920 seed[ i ] = !( matches[ i ] = elem ); 1921 } 1922 } 1923 } ) : 1924 function( elem, _context, xml ) { 1925 input[ 0 ] = elem; 1926 matcher( input, null, xml, results ); 1927 1928 // Don't keep the element 1929 // (see https://github.com/jquery/sizzle/issues/299) 1930 input[ 0 ] = null; 1931 return !results.pop(); 1932 }; 1933 } ), 1934 1935 has: markFunction( function( selector ) { 1936 return function( elem ) { 1937 return find( selector, elem ).length > 0; 1938 }; 1939 } ), 1940 1941 contains: markFunction( function( text ) { 1942 text = text.replace( runescape, funescape ); 1943 return function( elem ) { 1944 return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; 1945 }; 1946 } ), 1947 1948 // "Whether an element is represented by a :lang() selector 1949 // is based solely on the element's language value 1950 // being equal to the identifier C, 1951 // or beginning with the identifier C immediately followed by "-". 1952 // The matching of C against the element's language value is performed case-insensitively. 1953 // The identifier C does not have to be a valid language name." 1954 // https://www.w3.org/TR/selectors/#lang-pseudo 1955 lang: markFunction( function( lang ) { 1956 1957 // lang value must be a valid identifier 1958 if ( !ridentifier.test( lang || "" ) ) { 1959 find.error( "unsupported lang: " + lang ); 1960 } 1961 lang = lang.replace( runescape, funescape ).toLowerCase(); 1962 return function( elem ) { 1963 var elemLang; 1964 do { 1965 if ( ( elemLang = documentIsHTML ? 1966 elem.lang : 1967 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 1968 1969 elemLang = elemLang.toLowerCase(); 1970 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 1971 } 1972 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 1973 return false; 1974 }; 1975 } ), 1976 1977 // Miscellaneous 1978 target: function( elem ) { 1979 var hash = window.location && window.location.hash; 1980 return hash && hash.slice( 1 ) === elem.id; 1981 }, 1982 1983 root: function( elem ) { 1984 return elem === documentElement; 1985 }, 1986 1987 focus: function( elem ) { 1988 return elem === safeActiveElement() && 1989 document.hasFocus() && 1990 !!( elem.type || elem.href || ~elem.tabIndex ); 1991 }, 1992 1993 // Boolean properties 1994 enabled: createDisabledPseudo( false ), 1995 disabled: createDisabledPseudo( true ), 1996 1997 checked: function( elem ) { 1998 1999 // In CSS3, :checked should return both checked and selected elements 2000 // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 2001 return ( nodeName( elem, "input" ) && !!elem.checked ) || 2002 ( nodeName( elem, "option" ) && !!elem.selected ); 2003 }, 2004 2005 selected: function( elem ) { 2006 2007 // Support: IE <=11+ 2008 // Accessing the selectedIndex property 2009 // forces the browser to treat the default option as 2010 // selected when in an optgroup. 2011 if ( elem.parentNode ) { 2012 // eslint-disable-next-line no-unused-expressions 2013 elem.parentNode.selectedIndex; 2014 } 2015 2016 return elem.selected === true; 2017 }, 2018 2019 // Contents 2020 empty: function( elem ) { 2021 2022 // https://www.w3.org/TR/selectors/#empty-pseudo 2023 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 2024 // but not by others (comment: 8; processing instruction: 7; etc.) 2025 // nodeType < 6 works because attributes (2) do not appear as children 2026 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 2027 if ( elem.nodeType < 6 ) { 2028 return false; 2029 } 2030 } 2031 return true; 2032 }, 2033 2034 parent: function( elem ) { 2035 return !Expr.pseudos.empty( elem ); 2036 }, 2037 2038 // Element/input types 2039 header: function( elem ) { 2040 return rheader.test( elem.nodeName ); 2041 }, 2042 2043 input: function( elem ) { 2044 return rinputs.test( elem.nodeName ); 2045 }, 2046 2047 button: function( elem ) { 2048 return nodeName( elem, "input" ) && elem.type === "button" || 2049 nodeName( elem, "button" ); 2050 }, 2051 2052 text: function( elem ) { 2053 var attr; 2054 return nodeName( elem, "input" ) && elem.type === "text" && 2055 2056 // Support: IE <10 only 2057 // New HTML5 attribute values (e.g., "search") appear 2058 // with elem.type === "text" 2059 ( ( attr = elem.getAttribute( "type" ) ) == null || 2060 attr.toLowerCase() === "text" ); 2061 }, 2062 2063 // Position-in-collection 2064 first: createPositionalPseudo( function() { 2065 return [ 0 ]; 2066 } ), 2067 2068 last: createPositionalPseudo( function( _matchIndexes, length ) { 2069 return [ length - 1 ]; 2070 } ), 2071 2072 eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { 2073 return [ argument < 0 ? argument + length : argument ]; 2074 } ), 2075 2076 even: createPositionalPseudo( function( matchIndexes, length ) { 2077 var i = 0; 2078 for ( ; i < length; i += 2 ) { 2079 matchIndexes.push( i ); 2080 } 2081 return matchIndexes; 2082 } ), 2083 2084 odd: createPositionalPseudo( function( matchIndexes, length ) { 2085 var i = 1; 2086 for ( ; i < length; i += 2 ) { 2087 matchIndexes.push( i ); 2088 } 2089 return matchIndexes; 2090 } ), 2091 2092 lt: createPositionalPseudo( function( matchIndexes, length, argument ) { 2093 var i; 2094 2095 if ( argument < 0 ) { 2096 i = argument + length; 2097 } else if ( argument > length ) { 2098 i = length; 2099 } else { 2100 i = argument; 2101 } 2102 2103 for ( ; --i >= 0; ) { 2104 matchIndexes.push( i ); 2105 } 2106 return matchIndexes; 2107 } ), 2108 2109 gt: createPositionalPseudo( function( matchIndexes, length, argument ) { 2110 var i = argument < 0 ? argument + length : argument; 2111 for ( ; ++i < length; ) { 2112 matchIndexes.push( i ); 2113 } 2114 return matchIndexes; 2115 } ) 2116 } 2117}; 2118 2119Expr.pseudos.nth = Expr.pseudos.eq; 2120 2121// Add button/input type pseudos 2122for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2123 Expr.pseudos[ i ] = createInputPseudo( i ); 2124} 2125for ( i in { submit: true, reset: true } ) { 2126 Expr.pseudos[ i ] = createButtonPseudo( i ); 2127} 2128 2129// Easy API for creating new setFilters 2130function setFilters() {} 2131setFilters.prototype = Expr.filters = Expr.pseudos; 2132Expr.setFilters = new setFilters(); 2133 2134function tokenize( selector, parseOnly ) { 2135 var matched, match, tokens, type, 2136 soFar, groups, preFilters, 2137 cached = tokenCache[ selector + " " ]; 2138 2139 if ( cached ) { 2140 return parseOnly ? 0 : cached.slice( 0 ); 2141 } 2142 2143 soFar = selector; 2144 groups = []; 2145 preFilters = Expr.preFilter; 2146 2147 while ( soFar ) { 2148 2149 // Comma and first run 2150 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 2151 if ( match ) { 2152 2153 // Don't consume trailing commas as valid 2154 soFar = soFar.slice( match[ 0 ].length ) || soFar; 2155 } 2156 groups.push( ( tokens = [] ) ); 2157 } 2158 2159 matched = false; 2160 2161 // Combinators 2162 if ( ( match = rleadingCombinator.exec( soFar ) ) ) { 2163 matched = match.shift(); 2164 tokens.push( { 2165 value: matched, 2166 2167 // Cast descendant combinators to space 2168 type: match[ 0 ].replace( rtrimCSS, " " ) 2169 } ); 2170 soFar = soFar.slice( matched.length ); 2171 } 2172 2173 // Filters 2174 for ( type in Expr.filter ) { 2175 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 2176 ( match = preFilters[ type ]( match ) ) ) ) { 2177 matched = match.shift(); 2178 tokens.push( { 2179 value: matched, 2180 type: type, 2181 matches: match 2182 } ); 2183 soFar = soFar.slice( matched.length ); 2184 } 2185 } 2186 2187 if ( !matched ) { 2188 break; 2189 } 2190 } 2191 2192 // Return the length of the invalid excess 2193 // if we're just parsing 2194 // Otherwise, throw an error or return tokens 2195 if ( parseOnly ) { 2196 return soFar.length; 2197 } 2198 2199 return soFar ? 2200 find.error( selector ) : 2201 2202 // Cache the tokens 2203 tokenCache( selector, groups ).slice( 0 ); 2204} 2205 2206function toSelector( tokens ) { 2207 var i = 0, 2208 len = tokens.length, 2209 selector = ""; 2210 for ( ; i < len; i++ ) { 2211 selector += tokens[ i ].value; 2212 } 2213 return selector; 2214} 2215 2216function addCombinator( matcher, combinator, base ) { 2217 var dir = combinator.dir, 2218 skip = combinator.next, 2219 key = skip || dir, 2220 checkNonElements = base && key === "parentNode", 2221 doneName = done++; 2222 2223 return combinator.first ? 2224 2225 // Check against closest ancestor/preceding element 2226 function( elem, context, xml ) { 2227 while ( ( elem = elem[ dir ] ) ) { 2228 if ( elem.nodeType === 1 || checkNonElements ) { 2229 return matcher( elem, context, xml ); 2230 } 2231 } 2232 return false; 2233 } : 2234 2235 // Check against all ancestor/preceding elements 2236 function( elem, context, xml ) { 2237 var oldCache, outerCache, 2238 newCache = [ dirruns, doneName ]; 2239 2240 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2241 if ( xml ) { 2242 while ( ( elem = elem[ dir ] ) ) { 2243 if ( elem.nodeType === 1 || checkNonElements ) { 2244 if ( matcher( elem, context, xml ) ) { 2245 return true; 2246 } 2247 } 2248 } 2249 } else { 2250 while ( ( elem = elem[ dir ] ) ) { 2251 if ( elem.nodeType === 1 || checkNonElements ) { 2252 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 2253 2254 if ( skip && nodeName( elem, skip ) ) { 2255 elem = elem[ dir ] || elem; 2256 } else if ( ( oldCache = outerCache[ key ] ) && 2257 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2258 2259 // Assign to newCache so results back-propagate to previous elements 2260 return ( newCache[ 2 ] = oldCache[ 2 ] ); 2261 } else { 2262 2263 // Reuse newcache so results back-propagate to previous elements 2264 outerCache[ key ] = newCache; 2265 2266 // A match means we're done; a fail means we have to keep checking 2267 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 2268 return true; 2269 } 2270 } 2271 } 2272 } 2273 } 2274 return false; 2275 }; 2276} 2277 2278function elementMatcher( matchers ) { 2279 return matchers.length > 1 ? 2280 function( elem, context, xml ) { 2281 var i = matchers.length; 2282 while ( i-- ) { 2283 if ( !matchers[ i ]( elem, context, xml ) ) { 2284 return false; 2285 } 2286 } 2287 return true; 2288 } : 2289 matchers[ 0 ]; 2290} 2291 2292function multipleContexts( selector, contexts, results ) { 2293 var i = 0, 2294 len = contexts.length; 2295 for ( ; i < len; i++ ) { 2296 find( selector, contexts[ i ], results ); 2297 } 2298 return results; 2299} 2300 2301function condense( unmatched, map, filter, context, xml ) { 2302 var elem, 2303 newUnmatched = [], 2304 i = 0, 2305 len = unmatched.length, 2306 mapped = map != null; 2307 2308 for ( ; i < len; i++ ) { 2309 if ( ( elem = unmatched[ i ] ) ) { 2310 if ( !filter || filter( elem, context, xml ) ) { 2311 newUnmatched.push( elem ); 2312 if ( mapped ) { 2313 map.push( i ); 2314 } 2315 } 2316 } 2317 } 2318 2319 return newUnmatched; 2320} 2321 2322function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2323 if ( postFilter && !postFilter[ expando ] ) { 2324 postFilter = setMatcher( postFilter ); 2325 } 2326 if ( postFinder && !postFinder[ expando ] ) { 2327 postFinder = setMatcher( postFinder, postSelector ); 2328 } 2329 return markFunction( function( seed, results, context, xml ) { 2330 var temp, i, elem, matcherOut, 2331 preMap = [], 2332 postMap = [], 2333 preexisting = results.length, 2334 2335 // Get initial elements from seed or context 2336 elems = seed || 2337 multipleContexts( selector || "*", 2338 context.nodeType ? [ context ] : context, [] ), 2339 2340 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2341 matcherIn = preFilter && ( seed || !selector ) ? 2342 condense( elems, preMap, preFilter, context, xml ) : 2343 elems; 2344 2345 if ( matcher ) { 2346 2347 // If we have a postFinder, or filtered seed, or non-seed postFilter 2348 // or preexisting results, 2349 matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2350 2351 // ...intermediate processing is necessary 2352 [] : 2353 2354 // ...otherwise use results directly 2355 results; 2356 2357 // Find primary matches 2358 matcher( matcherIn, matcherOut, context, xml ); 2359 } else { 2360 matcherOut = matcherIn; 2361 } 2362 2363 // Apply postFilter 2364 if ( postFilter ) { 2365 temp = condense( matcherOut, postMap ); 2366 postFilter( temp, [], context, xml ); 2367 2368 // Un-match failing elements by moving them back to matcherIn 2369 i = temp.length; 2370 while ( i-- ) { 2371 if ( ( elem = temp[ i ] ) ) { 2372 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); 2373 } 2374 } 2375 } 2376 2377 if ( seed ) { 2378 if ( postFinder || preFilter ) { 2379 if ( postFinder ) { 2380 2381 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2382 temp = []; 2383 i = matcherOut.length; 2384 while ( i-- ) { 2385 if ( ( elem = matcherOut[ i ] ) ) { 2386 2387 // Restore matcherIn since elem is not yet a final match 2388 temp.push( ( matcherIn[ i ] = elem ) ); 2389 } 2390 } 2391 postFinder( null, ( matcherOut = [] ), temp, xml ); 2392 } 2393 2394 // Move matched elements from seed to results to keep them synchronized 2395 i = matcherOut.length; 2396 while ( i-- ) { 2397 if ( ( elem = matcherOut[ i ] ) && 2398 ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { 2399 2400 seed[ temp ] = !( results[ temp ] = elem ); 2401 } 2402 } 2403 } 2404 2405 // Add elements to results, through postFinder if defined 2406 } else { 2407 matcherOut = condense( 2408 matcherOut === results ? 2409 matcherOut.splice( preexisting, matcherOut.length ) : 2410 matcherOut 2411 ); 2412 if ( postFinder ) { 2413 postFinder( null, results, matcherOut, xml ); 2414 } else { 2415 push.apply( results, matcherOut ); 2416 } 2417 } 2418 } ); 2419} 2420 2421function matcherFromTokens( tokens ) { 2422 var checkContext, matcher, j, 2423 len = tokens.length, 2424 leadingRelative = Expr.relative[ tokens[ 0 ].type ], 2425 implicitRelative = leadingRelative || Expr.relative[ " " ], 2426 i = leadingRelative ? 1 : 0, 2427 2428 // The foundational matcher ensures that elements are reachable from top-level context(s) 2429 matchContext = addCombinator( function( elem ) { 2430 return elem === checkContext; 2431 }, implicitRelative, true ), 2432 matchAnyContext = addCombinator( function( elem ) { 2433 return indexOf.call( checkContext, elem ) > -1; 2434 }, implicitRelative, true ), 2435 matchers = [ function( elem, context, xml ) { 2436 2437 // Support: IE 11+, Edge 17 - 18+ 2438 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2439 // two documents; shallow comparisons work. 2440 // eslint-disable-next-line eqeqeq 2441 var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( 2442 ( checkContext = context ).nodeType ? 2443 matchContext( elem, context, xml ) : 2444 matchAnyContext( elem, context, xml ) ); 2445 2446 // Avoid hanging onto element 2447 // (see https://github.com/jquery/sizzle/issues/299) 2448 checkContext = null; 2449 return ret; 2450 } ]; 2451 2452 for ( ; i < len; i++ ) { 2453 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 2454 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 2455 } else { 2456 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 2457 2458 // Return special upon seeing a positional matcher 2459 if ( matcher[ expando ] ) { 2460 2461 // Find the next relative operator (if any) for proper handling 2462 j = ++i; 2463 for ( ; j < len; j++ ) { 2464 if ( Expr.relative[ tokens[ j ].type ] ) { 2465 break; 2466 } 2467 } 2468 return setMatcher( 2469 i > 1 && elementMatcher( matchers ), 2470 i > 1 && toSelector( 2471 2472 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2473 tokens.slice( 0, i - 1 ) 2474 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 2475 ).replace( rtrimCSS, "$1" ), 2476 matcher, 2477 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2478 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 2479 j < len && toSelector( tokens ) 2480 ); 2481 } 2482 matchers.push( matcher ); 2483 } 2484 } 2485 2486 return elementMatcher( matchers ); 2487} 2488 2489function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2490 var bySet = setMatchers.length > 0, 2491 byElement = elementMatchers.length > 0, 2492 superMatcher = function( seed, context, xml, results, outermost ) { 2493 var elem, j, matcher, 2494 matchedCount = 0, 2495 i = "0", 2496 unmatched = seed && [], 2497 setMatched = [], 2498 contextBackup = outermostContext, 2499 2500 // We must always have either seed elements or outermost context 2501 elems = seed || byElement && Expr.find.TAG( "*", outermost ), 2502 2503 // Use integer dirruns iff this is the outermost matcher 2504 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 2505 len = elems.length; 2506 2507 if ( outermost ) { 2508 2509 // Support: IE 11+, Edge 17 - 18+ 2510 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2511 // two documents; shallow comparisons work. 2512 // eslint-disable-next-line eqeqeq 2513 outermostContext = context == document || context || outermost; 2514 } 2515 2516 // Add elements passing elementMatchers directly to results 2517 // Support: iOS <=7 - 9 only 2518 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching 2519 // elements by id. (see trac-14142) 2520 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 2521 if ( byElement && elem ) { 2522 j = 0; 2523 2524 // Support: IE 11+, Edge 17 - 18+ 2525 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2526 // two documents; shallow comparisons work. 2527 // eslint-disable-next-line eqeqeq 2528 if ( !context && elem.ownerDocument != document ) { 2529 setDocument( elem ); 2530 xml = !documentIsHTML; 2531 } 2532 while ( ( matcher = elementMatchers[ j++ ] ) ) { 2533 if ( matcher( elem, context || document, xml ) ) { 2534 push.call( results, elem ); 2535 break; 2536 } 2537 } 2538 if ( outermost ) { 2539 dirruns = dirrunsUnique; 2540 } 2541 } 2542 2543 // Track unmatched elements for set filters 2544 if ( bySet ) { 2545 2546 // They will have gone through all possible matchers 2547 if ( ( elem = !matcher && elem ) ) { 2548 matchedCount--; 2549 } 2550 2551 // Lengthen the array for every element, matched or not 2552 if ( seed ) { 2553 unmatched.push( elem ); 2554 } 2555 } 2556 } 2557 2558 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2559 // makes the latter nonnegative. 2560 matchedCount += i; 2561 2562 // Apply set filters to unmatched elements 2563 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2564 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2565 // no element matchers and no seed. 2566 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2567 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2568 // numerically zero. 2569 if ( bySet && i !== matchedCount ) { 2570 j = 0; 2571 while ( ( matcher = setMatchers[ j++ ] ) ) { 2572 matcher( unmatched, setMatched, context, xml ); 2573 } 2574 2575 if ( seed ) { 2576 2577 // Reintegrate element matches to eliminate the need for sorting 2578 if ( matchedCount > 0 ) { 2579 while ( i-- ) { 2580 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 2581 setMatched[ i ] = pop.call( results ); 2582 } 2583 } 2584 } 2585 2586 // Discard index placeholder values to get only actual matches 2587 setMatched = condense( setMatched ); 2588 } 2589 2590 // Add matches to results 2591 push.apply( results, setMatched ); 2592 2593 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2594 if ( outermost && !seed && setMatched.length > 0 && 2595 ( matchedCount + setMatchers.length ) > 1 ) { 2596 2597 jQuery.uniqueSort( results ); 2598 } 2599 } 2600 2601 // Override manipulation of globals by nested matchers 2602 if ( outermost ) { 2603 dirruns = dirrunsUnique; 2604 outermostContext = contextBackup; 2605 } 2606 2607 return unmatched; 2608 }; 2609 2610 return bySet ? 2611 markFunction( superMatcher ) : 2612 superMatcher; 2613} 2614 2615function compile( selector, match /* Internal Use Only */ ) { 2616 var i, 2617 setMatchers = [], 2618 elementMatchers = [], 2619 cached = compilerCache[ selector + " " ]; 2620 2621 if ( !cached ) { 2622 2623 // Generate a function of recursive functions that can be used to check each element 2624 if ( !match ) { 2625 match = tokenize( selector ); 2626 } 2627 i = match.length; 2628 while ( i-- ) { 2629 cached = matcherFromTokens( match[ i ] ); 2630 if ( cached[ expando ] ) { 2631 setMatchers.push( cached ); 2632 } else { 2633 elementMatchers.push( cached ); 2634 } 2635 } 2636 2637 // Cache the compiled function 2638 cached = compilerCache( selector, 2639 matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 2640 2641 // Save selector and tokenization 2642 cached.selector = selector; 2643 } 2644 return cached; 2645} 2646 2647/** 2648 * A low-level selection function that works with jQuery's compiled 2649 * selector functions 2650 * @param {String|Function} selector A selector or a pre-compiled 2651 * selector function built with jQuery selector compile 2652 * @param {Element} context 2653 * @param {Array} [results] 2654 * @param {Array} [seed] A set of elements to match against 2655 */ 2656function select( selector, context, results, seed ) { 2657 var i, tokens, token, type, find, 2658 compiled = typeof selector === "function" && selector, 2659 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 2660 2661 results = results || []; 2662 2663 // Try to minimize operations if there is only one selector in the list and no seed 2664 // (the latter of which guarantees us context) 2665 if ( match.length === 1 ) { 2666 2667 // Reduce context if the leading compound selector is an ID 2668 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 2669 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 2670 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 2671 2672 context = ( Expr.find.ID( 2673 token.matches[ 0 ].replace( runescape, funescape ), 2674 context 2675 ) || [] )[ 0 ]; 2676 if ( !context ) { 2677 return results; 2678 2679 // Precompiled matchers will still verify ancestry, so step up a level 2680 } else if ( compiled ) { 2681 context = context.parentNode; 2682 } 2683 2684 selector = selector.slice( tokens.shift().value.length ); 2685 } 2686 2687 // Fetch a seed set for right-to-left matching 2688 i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; 2689 while ( i-- ) { 2690 token = tokens[ i ]; 2691 2692 // Abort if we hit a combinator 2693 if ( Expr.relative[ ( type = token.type ) ] ) { 2694 break; 2695 } 2696 if ( ( find = Expr.find[ type ] ) ) { 2697 2698 // Search, expanding context for leading sibling combinators 2699 if ( ( seed = find( 2700 token.matches[ 0 ].replace( runescape, funescape ), 2701 rsibling.test( tokens[ 0 ].type ) && 2702 testContext( context.parentNode ) || context 2703 ) ) ) { 2704 2705 // If seed is empty or no tokens remain, we can return early 2706 tokens.splice( i, 1 ); 2707 selector = seed.length && toSelector( tokens ); 2708 if ( !selector ) { 2709 push.apply( results, seed ); 2710 return results; 2711 } 2712 2713 break; 2714 } 2715 } 2716 } 2717 } 2718 2719 // Compile and execute a filtering function if one is not provided 2720 // Provide `match` to avoid retokenization if we modified the selector above 2721 ( compiled || compile( selector, match ) )( 2722 seed, 2723 context, 2724 !documentIsHTML, 2725 results, 2726 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2727 ); 2728 return results; 2729} 2730 2731// One-time assignments 2732 2733// Support: Android <=4.0 - 4.1+ 2734// Sort stability 2735support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 2736 2737// Initialize against the default document 2738setDocument(); 2739 2740// Support: Android <=4.0 - 4.1+ 2741// Detached nodes confoundingly follow *each other* 2742support.sortDetached = assert( function( el ) { 2743 2744 // Should return 1, but returns 4 (following) 2745 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 2746} ); 2747 2748jQuery.find = find; 2749 2750// Deprecated 2751jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2752jQuery.unique = jQuery.uniqueSort; 2753 2754// These have always been private, but they used to be documented as part of 2755// Sizzle so let's maintain them for now for backwards compatibility purposes. 2756find.compile = compile; 2757find.select = select; 2758find.setDocument = setDocument; 2759find.tokenize = tokenize; 2760 2761find.escape = jQuery.escapeSelector; 2762find.getText = jQuery.text; 2763find.isXML = jQuery.isXMLDoc; 2764find.selectors = jQuery.expr; 2765find.support = jQuery.support; 2766find.uniqueSort = jQuery.uniqueSort; 2767 2768 /* eslint-enable */ 2769 2770} )(); 2771 2772 2773var dir = function( elem, dir, until ) { 2774 var matched = [], 2775 truncate = until !== undefined; 2776 2777 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 2778 if ( elem.nodeType === 1 ) { 2779 if ( truncate && jQuery( elem ).is( until ) ) { 2780 break; 2781 } 2782 matched.push( elem ); 2783 } 2784 } 2785 return matched; 2786}; 2787 2788 2789var siblings = function( n, elem ) { 2790 var matched = []; 2791 2792 for ( ; n; n = n.nextSibling ) { 2793 if ( n.nodeType === 1 && n !== elem ) { 2794 matched.push( n ); 2795 } 2796 } 2797 2798 return matched; 2799}; 2800 2801 2802var rneedsContext = jQuery.expr.match.needsContext; 2803 2804var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 2805 2806 2807 2808// Implement the identical functionality for filter and not 2809function winnow( elements, qualifier, not ) { 2810 if ( isFunction( qualifier ) ) { 2811 return jQuery.grep( elements, function( elem, i ) { 2812 return !!qualifier.call( elem, i, elem ) !== not; 2813 } ); 2814 } 2815 2816 // Single element 2817 if ( qualifier.nodeType ) { 2818 return jQuery.grep( elements, function( elem ) { 2819 return ( elem === qualifier ) !== not; 2820 } ); 2821 } 2822 2823 // Arraylike of elements (jQuery, arguments, Array) 2824 if ( typeof qualifier !== "string" ) { 2825 return jQuery.grep( elements, function( elem ) { 2826 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 2827 } ); 2828 } 2829 2830 // Filtered directly for both simple and complex selectors 2831 return jQuery.filter( qualifier, elements, not ); 2832} 2833 2834jQuery.filter = function( expr, elems, not ) { 2835 var elem = elems[ 0 ]; 2836 2837 if ( not ) { 2838 expr = ":not(" + expr + ")"; 2839 } 2840 2841 if ( elems.length === 1 && elem.nodeType === 1 ) { 2842 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 2843 } 2844 2845 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 2846 return elem.nodeType === 1; 2847 } ) ); 2848}; 2849 2850jQuery.fn.extend( { 2851 find: function( selector ) { 2852 var i, ret, 2853 len = this.length, 2854 self = this; 2855 2856 if ( typeof selector !== "string" ) { 2857 return this.pushStack( jQuery( selector ).filter( function() { 2858 for ( i = 0; i < len; i++ ) { 2859 if ( jQuery.contains( self[ i ], this ) ) { 2860 return true; 2861 } 2862 } 2863 } ) ); 2864 } 2865 2866 ret = this.pushStack( [] ); 2867 2868 for ( i = 0; i < len; i++ ) { 2869 jQuery.find( selector, self[ i ], ret ); 2870 } 2871 2872 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 2873 }, 2874 filter: function( selector ) { 2875 return this.pushStack( winnow( this, selector || [], false ) ); 2876 }, 2877 not: function( selector ) { 2878 return this.pushStack( winnow( this, selector || [], true ) ); 2879 }, 2880 is: function( selector ) { 2881 return !!winnow( 2882 this, 2883 2884 // If this is a positional/relative selector, check membership in the returned set 2885 // so $("p:first").is("p:last") won't return true for a doc with two "p". 2886 typeof selector === "string" && rneedsContext.test( selector ) ? 2887 jQuery( selector ) : 2888 selector || [], 2889 false 2890 ).length; 2891 } 2892} ); 2893 2894 2895// Initialize a jQuery object 2896 2897 2898// A central reference to the root jQuery(document) 2899var rootjQuery, 2900 2901 // A simple way to check for HTML strings 2902 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) 2903 // Strict HTML recognition (trac-11290: must start with <) 2904 // Shortcut simple #id case for speed 2905 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 2906 2907 init = jQuery.fn.init = function( selector, context, root ) { 2908 var match, elem; 2909 2910 // HANDLE: $(""), $(null), $(undefined), $(false) 2911 if ( !selector ) { 2912 return this; 2913 } 2914 2915 // Method init() accepts an alternate rootjQuery 2916 // so migrate can support jQuery.sub (gh-2101) 2917 root = root || rootjQuery; 2918 2919 // Handle HTML strings 2920 if ( typeof selector === "string" ) { 2921 if ( selector[ 0 ] === "<" && 2922 selector[ selector.length - 1 ] === ">" && 2923 selector.length >= 3 ) { 2924 2925 // Assume that strings that start and end with <> are HTML and skip the regex check 2926 match = [ null, selector, null ]; 2927 2928 } else { 2929 match = rquickExpr.exec( selector ); 2930 } 2931 2932 // Match html or make sure no context is specified for #id 2933 if ( match && ( match[ 1 ] || !context ) ) { 2934 2935 // HANDLE: $(html) -> $(array) 2936 if ( match[ 1 ] ) { 2937 context = context instanceof jQuery ? context[ 0 ] : context; 2938 2939 // Option to run scripts is true for back-compat 2940 // Intentionally let the error be thrown if parseHTML is not present 2941 jQuery.merge( this, jQuery.parseHTML( 2942 match[ 1 ], 2943 context && context.nodeType ? context.ownerDocument || context : document, 2944 true 2945 ) ); 2946 2947 // HANDLE: $(html, props) 2948 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 2949 for ( match in context ) { 2950 2951 // Properties of context are called as methods if possible 2952 if ( isFunction( this[ match ] ) ) { 2953 this[ match ]( context[ match ] ); 2954 2955 // ...and otherwise set as attributes 2956 } else { 2957 this.attr( match, context[ match ] ); 2958 } 2959 } 2960 } 2961 2962 return this; 2963 2964 // HANDLE: $(#id) 2965 } else { 2966 elem = document.getElementById( match[ 2 ] ); 2967 2968 if ( elem ) { 2969 2970 // Inject the element directly into the jQuery object 2971 this[ 0 ] = elem; 2972 this.length = 1; 2973 } 2974 return this; 2975 } 2976 2977 // HANDLE: $(expr, $(...)) 2978 } else if ( !context || context.jquery ) { 2979 return ( context || root ).find( selector ); 2980 2981 // HANDLE: $(expr, context) 2982 // (which is just equivalent to: $(context).find(expr) 2983 } else { 2984 return this.constructor( context ).find( selector ); 2985 } 2986 2987 // HANDLE: $(DOMElement) 2988 } else if ( selector.nodeType ) { 2989 this[ 0 ] = selector; 2990 this.length = 1; 2991 return this; 2992 2993 // HANDLE: $(function) 2994 // Shortcut for document ready 2995 } else if ( isFunction( selector ) ) { 2996 return root.ready !== undefined ? 2997 root.ready( selector ) : 2998 2999 // Execute immediately if ready is not present 3000 selector( jQuery ); 3001 } 3002 3003 return jQuery.makeArray( selector, this ); 3004 }; 3005 3006// Give the init function the jQuery prototype for later instantiation 3007init.prototype = jQuery.fn; 3008 3009// Initialize central reference 3010rootjQuery = jQuery( document ); 3011 3012 3013var rparentsprev = /^(?:parents|prev(?:Until|All))/, 3014 3015 // Methods guaranteed to produce a unique set when starting from a unique set 3016 guaranteedUnique = { 3017 children: true, 3018 contents: true, 3019 next: true, 3020 prev: true 3021 }; 3022 3023jQuery.fn.extend( { 3024 has: function( target ) { 3025 var targets = jQuery( target, this ), 3026 l = targets.length; 3027 3028 return this.filter( function() { 3029 var i = 0; 3030 for ( ; i < l; i++ ) { 3031 if ( jQuery.contains( this, targets[ i ] ) ) { 3032 return true; 3033 } 3034 } 3035 } ); 3036 }, 3037 3038 closest: function( selectors, context ) { 3039 var cur, 3040 i = 0, 3041 l = this.length, 3042 matched = [], 3043 targets = typeof selectors !== "string" && jQuery( selectors ); 3044 3045 // Positional selectors never match, since there's no _selection_ context 3046 if ( !rneedsContext.test( selectors ) ) { 3047 for ( ; i < l; i++ ) { 3048 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 3049 3050 // Always skip document fragments 3051 if ( cur.nodeType < 11 && ( targets ? 3052 targets.index( cur ) > -1 : 3053 3054 // Don't pass non-elements to jQuery#find 3055 cur.nodeType === 1 && 3056 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3057 3058 matched.push( cur ); 3059 break; 3060 } 3061 } 3062 } 3063 } 3064 3065 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3066 }, 3067 3068 // Determine the position of an element within the set 3069 index: function( elem ) { 3070 3071 // No argument, return index in parent 3072 if ( !elem ) { 3073 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3074 } 3075 3076 // Index in selector 3077 if ( typeof elem === "string" ) { 3078 return indexOf.call( jQuery( elem ), this[ 0 ] ); 3079 } 3080 3081 // Locate the position of the desired element 3082 return indexOf.call( this, 3083 3084 // If it receives a jQuery object, the first element is used 3085 elem.jquery ? elem[ 0 ] : elem 3086 ); 3087 }, 3088 3089 add: function( selector, context ) { 3090 return this.pushStack( 3091 jQuery.uniqueSort( 3092 jQuery.merge( this.get(), jQuery( selector, context ) ) 3093 ) 3094 ); 3095 }, 3096 3097 addBack: function( selector ) { 3098 return this.add( selector == null ? 3099 this.prevObject : this.prevObject.filter( selector ) 3100 ); 3101 } 3102} ); 3103 3104function sibling( cur, dir ) { 3105 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 3106 return cur; 3107} 3108 3109jQuery.each( { 3110 parent: function( elem ) { 3111 var parent = elem.parentNode; 3112 return parent && parent.nodeType !== 11 ? parent : null; 3113 }, 3114 parents: function( elem ) { 3115 return dir( elem, "parentNode" ); 3116 }, 3117 parentsUntil: function( elem, _i, until ) { 3118 return dir( elem, "parentNode", until ); 3119 }, 3120 next: function( elem ) { 3121 return sibling( elem, "nextSibling" ); 3122 }, 3123 prev: function( elem ) { 3124 return sibling( elem, "previousSibling" ); 3125 }, 3126 nextAll: function( elem ) { 3127 return dir( elem, "nextSibling" ); 3128 }, 3129 prevAll: function( elem ) { 3130 return dir( elem, "previousSibling" ); 3131 }, 3132 nextUntil: function( elem, _i, until ) { 3133 return dir( elem, "nextSibling", until ); 3134 }, 3135 prevUntil: function( elem, _i, until ) { 3136 return dir( elem, "previousSibling", until ); 3137 }, 3138 siblings: function( elem ) { 3139 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 3140 }, 3141 children: function( elem ) { 3142 return siblings( elem.firstChild ); 3143 }, 3144 contents: function( elem ) { 3145 if ( elem.contentDocument != null && 3146 3147 // Support: IE 11+ 3148 // <object> elements with no `data` attribute has an object 3149 // `contentDocument` with a `null` prototype. 3150 getProto( elem.contentDocument ) ) { 3151 3152 return elem.contentDocument; 3153 } 3154 3155 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 3156 // Treat the template element as a regular one in browsers that 3157 // don't support it. 3158 if ( nodeName( elem, "template" ) ) { 3159 elem = elem.content || elem; 3160 } 3161 3162 return jQuery.merge( [], elem.childNodes ); 3163 } 3164}, function( name, fn ) { 3165 jQuery.fn[ name ] = function( until, selector ) { 3166 var matched = jQuery.map( this, fn, until ); 3167 3168 if ( name.slice( -5 ) !== "Until" ) { 3169 selector = until; 3170 } 3171 3172 if ( selector && typeof selector === "string" ) { 3173 matched = jQuery.filter( selector, matched ); 3174 } 3175 3176 if ( this.length > 1 ) { 3177 3178 // Remove duplicates 3179 if ( !guaranteedUnique[ name ] ) { 3180 jQuery.uniqueSort( matched ); 3181 } 3182 3183 // Reverse order for parents* and prev-derivatives 3184 if ( rparentsprev.test( name ) ) { 3185 matched.reverse(); 3186 } 3187 } 3188 3189 return this.pushStack( matched ); 3190 }; 3191} ); 3192var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 3193 3194 3195 3196// Convert String-formatted options into Object-formatted ones 3197function createOptions( options ) { 3198 var object = {}; 3199 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 3200 object[ flag ] = true; 3201 } ); 3202 return object; 3203} 3204 3205/* 3206 * Create a callback list using the following parameters: 3207 * 3208 * options: an optional list of space-separated options that will change how 3209 * the callback list behaves or a more traditional option object 3210 * 3211 * By default a callback list will act like an event callback list and can be 3212 * "fired" multiple times. 3213 * 3214 * Possible options: 3215 * 3216 * once: will ensure the callback list can only be fired once (like a Deferred) 3217 * 3218 * memory: will keep track of previous values and will call any callback added 3219 * after the list has been fired right away with the latest "memorized" 3220 * values (like a Deferred) 3221 * 3222 * unique: will ensure a callback can only be added once (no duplicate in the list) 3223 * 3224 * stopOnFalse: interrupt callings when a callback returns false 3225 * 3226 */ 3227jQuery.Callbacks = function( options ) { 3228 3229 // Convert options from String-formatted to Object-formatted if needed 3230 // (we check in cache first) 3231 options = typeof options === "string" ? 3232 createOptions( options ) : 3233 jQuery.extend( {}, options ); 3234 3235 var // Flag to know if list is currently firing 3236 firing, 3237 3238 // Last fire value for non-forgettable lists 3239 memory, 3240 3241 // Flag to know if list was already fired 3242 fired, 3243 3244 // Flag to prevent firing 3245 locked, 3246 3247 // Actual callback list 3248 list = [], 3249 3250 // Queue of execution data for repeatable lists 3251 queue = [], 3252 3253 // Index of currently firing callback (modified by add/remove as needed) 3254 firingIndex = -1, 3255 3256 // Fire callbacks 3257 fire = function() { 3258 3259 // Enforce single-firing 3260 locked = locked || options.once; 3261 3262 // Execute callbacks for all pending executions, 3263 // respecting firingIndex overrides and runtime changes 3264 fired = firing = true; 3265 for ( ; queue.length; firingIndex = -1 ) { 3266 memory = queue.shift(); 3267 while ( ++firingIndex < list.length ) { 3268 3269 // Run callback and check for early termination 3270 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 3271 options.stopOnFalse ) { 3272 3273 // Jump to end and forget the data so .add doesn't re-fire 3274 firingIndex = list.length; 3275 memory = false; 3276 } 3277 } 3278 } 3279 3280 // Forget the data if we're done with it 3281 if ( !options.memory ) { 3282 memory = false; 3283 } 3284 3285 firing = false; 3286 3287 // Clean up if we're done firing for good 3288 if ( locked ) { 3289 3290 // Keep an empty list if we have data for future add calls 3291 if ( memory ) { 3292 list = []; 3293 3294 // Otherwise, this object is spent 3295 } else { 3296 list = ""; 3297 } 3298 } 3299 }, 3300 3301 // Actual Callbacks object 3302 self = { 3303 3304 // Add a callback or a collection of callbacks to the list 3305 add: function() { 3306 if ( list ) { 3307 3308 // If we have memory from a past run, we should fire after adding 3309 if ( memory && !firing ) { 3310 firingIndex = list.length - 1; 3311 queue.push( memory ); 3312 } 3313 3314 ( function add( args ) { 3315 jQuery.each( args, function( _, arg ) { 3316 if ( isFunction( arg ) ) { 3317 if ( !options.unique || !self.has( arg ) ) { 3318 list.push( arg ); 3319 } 3320 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 3321 3322 // Inspect recursively 3323 add( arg ); 3324 } 3325 } ); 3326 } )( arguments ); 3327 3328 if ( memory && !firing ) { 3329 fire(); 3330 } 3331 } 3332 return this; 3333 }, 3334 3335 // Remove a callback from the list 3336 remove: function() { 3337 jQuery.each( arguments, function( _, arg ) { 3338 var index; 3339 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3340 list.splice( index, 1 ); 3341 3342 // Handle firing indexes 3343 if ( index <= firingIndex ) { 3344 firingIndex--; 3345 } 3346 } 3347 } ); 3348 return this; 3349 }, 3350 3351 // Check if a given callback is in the list. 3352 // If no argument is given, return whether or not list has callbacks attached. 3353 has: function( fn ) { 3354 return fn ? 3355 jQuery.inArray( fn, list ) > -1 : 3356 list.length > 0; 3357 }, 3358 3359 // Remove all callbacks from the list 3360 empty: function() { 3361 if ( list ) { 3362 list = []; 3363 } 3364 return this; 3365 }, 3366 3367 // Disable .fire and .add 3368 // Abort any current/pending executions 3369 // Clear all callbacks and values 3370 disable: function() { 3371 locked = queue = []; 3372 list = memory = ""; 3373 return this; 3374 }, 3375 disabled: function() { 3376 return !list; 3377 }, 3378 3379 // Disable .fire 3380 // Also disable .add unless we have memory (since it would have no effect) 3381 // Abort any pending executions 3382 lock: function() { 3383 locked = queue = []; 3384 if ( !memory && !firing ) { 3385 list = memory = ""; 3386 } 3387 return this; 3388 }, 3389 locked: function() { 3390 return !!locked; 3391 }, 3392 3393 // Call all callbacks with the given context and arguments 3394 fireWith: function( context, args ) { 3395 if ( !locked ) { 3396 args = args || []; 3397 args = [ context, args.slice ? args.slice() : args ]; 3398 queue.push( args ); 3399 if ( !firing ) { 3400 fire(); 3401 } 3402 } 3403 return this; 3404 }, 3405 3406 // Call all the callbacks with the given arguments 3407 fire: function() { 3408 self.fireWith( this, arguments ); 3409 return this; 3410 }, 3411 3412 // To know if the callbacks have already been called at least once 3413 fired: function() { 3414 return !!fired; 3415 } 3416 }; 3417 3418 return self; 3419}; 3420 3421 3422function Identity( v ) { 3423 return v; 3424} 3425function Thrower( ex ) { 3426 throw ex; 3427} 3428 3429function adoptValue( value, resolve, reject, noValue ) { 3430 var method; 3431 3432 try { 3433 3434 // Check for promise aspect first to privilege synchronous behavior 3435 if ( value && isFunction( ( method = value.promise ) ) ) { 3436 method.call( value ).done( resolve ).fail( reject ); 3437 3438 // Other thenables 3439 } else if ( value && isFunction( ( method = value.then ) ) ) { 3440 method.call( value, resolve, reject ); 3441 3442 // Other non-thenables 3443 } else { 3444 3445 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 3446 // * false: [ value ].slice( 0 ) => resolve( value ) 3447 // * true: [ value ].slice( 1 ) => resolve() 3448 resolve.apply( undefined, [ value ].slice( noValue ) ); 3449 } 3450 3451 // For Promises/A+, convert exceptions into rejections 3452 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 3453 // Deferred#then to conditionally suppress rejection. 3454 } catch ( value ) { 3455 3456 // Support: Android 4.0 only 3457 // Strict mode functions invoked without .call/.apply get global-object context 3458 reject.apply( undefined, [ value ] ); 3459 } 3460} 3461 3462jQuery.extend( { 3463 3464 Deferred: function( func ) { 3465 var tuples = [ 3466 3467 // action, add listener, callbacks, 3468 // ... .then handlers, argument index, [final state] 3469 [ "notify", "progress", jQuery.Callbacks( "memory" ), 3470 jQuery.Callbacks( "memory" ), 2 ], 3471 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 3472 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 3473 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 3474 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 3475 ], 3476 state = "pending", 3477 promise = { 3478 state: function() { 3479 return state; 3480 }, 3481 always: function() { 3482 deferred.done( arguments ).fail( arguments ); 3483 return this; 3484 }, 3485 "catch": function( fn ) { 3486 return promise.then( null, fn ); 3487 }, 3488 3489 // Keep pipe for back-compat 3490 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 3491 var fns = arguments; 3492 3493 return jQuery.Deferred( function( newDefer ) { 3494 jQuery.each( tuples, function( _i, tuple ) { 3495 3496 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 3497 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 3498 3499 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 3500 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 3501 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 3502 deferred[ tuple[ 1 ] ]( function() { 3503 var returned = fn && fn.apply( this, arguments ); 3504 if ( returned && isFunction( returned.promise ) ) { 3505 returned.promise() 3506 .progress( newDefer.notify ) 3507 .done( newDefer.resolve ) 3508 .fail( newDefer.reject ); 3509 } else { 3510 newDefer[ tuple[ 0 ] + "With" ]( 3511 this, 3512 fn ? [ returned ] : arguments 3513 ); 3514 } 3515 } ); 3516 } ); 3517 fns = null; 3518 } ).promise(); 3519 }, 3520 then: function( onFulfilled, onRejected, onProgress ) { 3521 var maxDepth = 0; 3522 function resolve( depth, deferred, handler, special ) { 3523 return function() { 3524 var that = this, 3525 args = arguments, 3526 mightThrow = function() { 3527 var returned, then; 3528 3529 // Support: Promises/A+ section 2.3.3.3.3 3530 // https://promisesaplus.com/#point-59 3531 // Ignore double-resolution attempts 3532 if ( depth < maxDepth ) { 3533 return; 3534 } 3535 3536 returned = handler.apply( that, args ); 3537 3538 // Support: Promises/A+ section 2.3.1 3539 // https://promisesaplus.com/#point-48 3540 if ( returned === deferred.promise() ) { 3541 throw new TypeError( "Thenable self-resolution" ); 3542 } 3543 3544 // Support: Promises/A+ sections 2.3.3.1, 3.5 3545 // https://promisesaplus.com/#point-54 3546 // https://promisesaplus.com/#point-75 3547 // Retrieve `then` only once 3548 then = returned && 3549 3550 // Support: Promises/A+ section 2.3.4 3551 // https://promisesaplus.com/#point-64 3552 // Only check objects and functions for thenability 3553 ( typeof returned === "object" || 3554 typeof returned === "function" ) && 3555 returned.then; 3556 3557 // Handle a returned thenable 3558 if ( isFunction( then ) ) { 3559 3560 // Special processors (notify) just wait for resolution 3561 if ( special ) { 3562 then.call( 3563 returned, 3564 resolve( maxDepth, deferred, Identity, special ), 3565 resolve( maxDepth, deferred, Thrower, special ) 3566 ); 3567 3568 // Normal processors (resolve) also hook into progress 3569 } else { 3570 3571 // ...and disregard older resolution values 3572 maxDepth++; 3573 3574 then.call( 3575 returned, 3576 resolve( maxDepth, deferred, Identity, special ), 3577 resolve( maxDepth, deferred, Thrower, special ), 3578 resolve( maxDepth, deferred, Identity, 3579 deferred.notifyWith ) 3580 ); 3581 } 3582 3583 // Handle all other returned values 3584 } else { 3585 3586 // Only substitute handlers pass on context 3587 // and multiple values (non-spec behavior) 3588 if ( handler !== Identity ) { 3589 that = undefined; 3590 args = [ returned ]; 3591 } 3592 3593 // Process the value(s) 3594 // Default process is resolve 3595 ( special || deferred.resolveWith )( that, args ); 3596 } 3597 }, 3598 3599 // Only normal processors (resolve) catch and reject exceptions 3600 process = special ? 3601 mightThrow : 3602 function() { 3603 try { 3604 mightThrow(); 3605 } catch ( e ) { 3606 3607 if ( jQuery.Deferred.exceptionHook ) { 3608 jQuery.Deferred.exceptionHook( e, 3609 process.error ); 3610 } 3611 3612 // Support: Promises/A+ section 2.3.3.3.4.1 3613 // https://promisesaplus.com/#point-61 3614 // Ignore post-resolution exceptions 3615 if ( depth + 1 >= maxDepth ) { 3616 3617 // Only substitute handlers pass on context 3618 // and multiple values (non-spec behavior) 3619 if ( handler !== Thrower ) { 3620 that = undefined; 3621 args = [ e ]; 3622 } 3623 3624 deferred.rejectWith( that, args ); 3625 } 3626 } 3627 }; 3628 3629 // Support: Promises/A+ section 2.3.3.3.1 3630 // https://promisesaplus.com/#point-57 3631 // Re-resolve promises immediately to dodge false rejection from 3632 // subsequent errors 3633 if ( depth ) { 3634 process(); 3635 } else { 3636 3637 // Call an optional hook to record the error, in case of exception 3638 // since it's otherwise lost when execution goes async 3639 if ( jQuery.Deferred.getErrorHook ) { 3640 process.error = jQuery.Deferred.getErrorHook(); 3641 3642 // The deprecated alias of the above. While the name suggests 3643 // returning the stack, not an error instance, jQuery just passes 3644 // it directly to `console.warn` so both will work; an instance 3645 // just better cooperates with source maps. 3646 } else if ( jQuery.Deferred.getStackHook ) { 3647 process.error = jQuery.Deferred.getStackHook(); 3648 } 3649 window.setTimeout( process ); 3650 } 3651 }; 3652 } 3653 3654 return jQuery.Deferred( function( newDefer ) { 3655 3656 // progress_handlers.add( ... ) 3657 tuples[ 0 ][ 3 ].add( 3658 resolve( 3659 0, 3660 newDefer, 3661 isFunction( onProgress ) ? 3662 onProgress : 3663 Identity, 3664 newDefer.notifyWith 3665 ) 3666 ); 3667 3668 // fulfilled_handlers.add( ... ) 3669 tuples[ 1 ][ 3 ].add( 3670 resolve( 3671 0, 3672 newDefer, 3673 isFunction( onFulfilled ) ? 3674 onFulfilled : 3675 Identity 3676 ) 3677 ); 3678 3679 // rejected_handlers.add( ... ) 3680 tuples[ 2 ][ 3 ].add( 3681 resolve( 3682 0, 3683 newDefer, 3684 isFunction( onRejected ) ? 3685 onRejected : 3686 Thrower 3687 ) 3688 ); 3689 } ).promise(); 3690 }, 3691 3692 // Get a promise for this deferred 3693 // If obj is provided, the promise aspect is added to the object 3694 promise: function( obj ) { 3695 return obj != null ? jQuery.extend( obj, promise ) : promise; 3696 } 3697 }, 3698 deferred = {}; 3699 3700 // Add list-specific methods 3701 jQuery.each( tuples, function( i, tuple ) { 3702 var list = tuple[ 2 ], 3703 stateString = tuple[ 5 ]; 3704 3705 // promise.progress = list.add 3706 // promise.done = list.add 3707 // promise.fail = list.add 3708 promise[ tuple[ 1 ] ] = list.add; 3709 3710 // Handle state 3711 if ( stateString ) { 3712 list.add( 3713 function() { 3714 3715 // state = "resolved" (i.e., fulfilled) 3716 // state = "rejected" 3717 state = stateString; 3718 }, 3719 3720 // rejected_callbacks.disable 3721 // fulfilled_callbacks.disable 3722 tuples[ 3 - i ][ 2 ].disable, 3723 3724 // rejected_handlers.disable 3725 // fulfilled_handlers.disable 3726 tuples[ 3 - i ][ 3 ].disable, 3727 3728 // progress_callbacks.lock 3729 tuples[ 0 ][ 2 ].lock, 3730 3731 // progress_handlers.lock 3732 tuples[ 0 ][ 3 ].lock 3733 ); 3734 } 3735 3736 // progress_handlers.fire 3737 // fulfilled_handlers.fire 3738 // rejected_handlers.fire 3739 list.add( tuple[ 3 ].fire ); 3740 3741 // deferred.notify = function() { deferred.notifyWith(...) } 3742 // deferred.resolve = function() { deferred.resolveWith(...) } 3743 // deferred.reject = function() { deferred.rejectWith(...) } 3744 deferred[ tuple[ 0 ] ] = function() { 3745 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 3746 return this; 3747 }; 3748 3749 // deferred.notifyWith = list.fireWith 3750 // deferred.resolveWith = list.fireWith 3751 // deferred.rejectWith = list.fireWith 3752 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 3753 } ); 3754 3755 // Make the deferred a promise 3756 promise.promise( deferred ); 3757 3758 // Call given func if any 3759 if ( func ) { 3760 func.call( deferred, deferred ); 3761 } 3762 3763 // All done! 3764 return deferred; 3765 }, 3766 3767 // Deferred helper 3768 when: function( singleValue ) { 3769 var 3770 3771 // count of uncompleted subordinates 3772 remaining = arguments.length, 3773 3774 // count of unprocessed arguments 3775 i = remaining, 3776 3777 // subordinate fulfillment data 3778 resolveContexts = Array( i ), 3779 resolveValues = slice.call( arguments ), 3780 3781 // the primary Deferred 3782 primary = jQuery.Deferred(), 3783 3784 // subordinate callback factory 3785 updateFunc = function( i ) { 3786 return function( value ) { 3787 resolveContexts[ i ] = this; 3788 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 3789 if ( !( --remaining ) ) { 3790 primary.resolveWith( resolveContexts, resolveValues ); 3791 } 3792 }; 3793 }; 3794 3795 // Single- and empty arguments are adopted like Promise.resolve 3796 if ( remaining <= 1 ) { 3797 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, 3798 !remaining ); 3799 3800 // Use .then() to unwrap secondary thenables (cf. gh-3000) 3801 if ( primary.state() === "pending" || 3802 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 3803 3804 return primary.then(); 3805 } 3806 } 3807 3808 // Multiple arguments are aggregated like Promise.all array elements 3809 while ( i-- ) { 3810 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); 3811 } 3812 3813 return primary.promise(); 3814 } 3815} ); 3816 3817 3818// These usually indicate a programmer mistake during development, 3819// warn about them ASAP rather than swallowing them by default. 3820var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 3821 3822// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error 3823// captured before the async barrier to get the original error cause 3824// which may otherwise be hidden. 3825jQuery.Deferred.exceptionHook = function( error, asyncError ) { 3826 3827 // Support: IE 8 - 9 only 3828 // Console exists when dev tools are open, which can happen at any time 3829 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 3830 window.console.warn( "jQuery.Deferred exception: " + error.message, 3831 error.stack, asyncError ); 3832 } 3833}; 3834 3835 3836 3837 3838jQuery.readyException = function( error ) { 3839 window.setTimeout( function() { 3840 throw error; 3841 } ); 3842}; 3843 3844 3845 3846 3847// The deferred used on DOM ready 3848var readyList = jQuery.Deferred(); 3849 3850jQuery.fn.ready = function( fn ) { 3851 3852 readyList 3853 .then( fn ) 3854 3855 // Wrap jQuery.readyException in a function so that the lookup 3856 // happens at the time of error handling instead of callback 3857 // registration. 3858 .catch( function( error ) { 3859 jQuery.readyException( error ); 3860 } ); 3861 3862 return this; 3863}; 3864 3865jQuery.extend( { 3866 3867 // Is the DOM ready to be used? Set to true once it occurs. 3868 isReady: false, 3869 3870 // A counter to track how many items to wait for before 3871 // the ready event fires. See trac-6781 3872 readyWait: 1, 3873 3874 // Handle when the DOM is ready 3875 ready: function( wait ) { 3876 3877 // Abort if there are pending holds or we're already ready 3878 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 3879 return; 3880 } 3881 3882 // Remember that the DOM is ready 3883 jQuery.isReady = true; 3884 3885 // If a normal DOM Ready event fired, decrement, and wait if need be 3886 if ( wait !== true && --jQuery.readyWait > 0 ) { 3887 return; 3888 } 3889 3890 // If there are functions bound, to execute 3891 readyList.resolveWith( document, [ jQuery ] ); 3892 } 3893} ); 3894 3895jQuery.ready.then = readyList.then; 3896 3897// The ready event handler and self cleanup method 3898function completed() { 3899 document.removeEventListener( "DOMContentLoaded", completed ); 3900 window.removeEventListener( "load", completed ); 3901 jQuery.ready(); 3902} 3903 3904// Catch cases where $(document).ready() is called 3905// after the browser event has already occurred. 3906// Support: IE <=9 - 10 only 3907// Older IE sometimes signals "interactive" too soon 3908if ( document.readyState === "complete" || 3909 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 3910 3911 // Handle it asynchronously to allow scripts the opportunity to delay ready 3912 window.setTimeout( jQuery.ready ); 3913 3914} else { 3915 3916 // Use the handy event callback 3917 document.addEventListener( "DOMContentLoaded", completed ); 3918 3919 // A fallback to window.onload, that will always work 3920 window.addEventListener( "load", completed ); 3921} 3922 3923 3924 3925 3926// Multifunctional method to get and set values of a collection 3927// The value/s can optionally be executed if it's a function 3928var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 3929 var i = 0, 3930 len = elems.length, 3931 bulk = key == null; 3932 3933 // Sets many values 3934 if ( toType( key ) === "object" ) { 3935 chainable = true; 3936 for ( i in key ) { 3937 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 3938 } 3939 3940 // Sets one value 3941 } else if ( value !== undefined ) { 3942 chainable = true; 3943 3944 if ( !isFunction( value ) ) { 3945 raw = true; 3946 } 3947 3948 if ( bulk ) { 3949 3950 // Bulk operations run against the entire set 3951 if ( raw ) { 3952 fn.call( elems, value ); 3953 fn = null; 3954 3955 // ...except when executing function values 3956 } else { 3957 bulk = fn; 3958 fn = function( elem, _key, value ) { 3959 return bulk.call( jQuery( elem ), value ); 3960 }; 3961 } 3962 } 3963 3964 if ( fn ) { 3965 for ( ; i < len; i++ ) { 3966 fn( 3967 elems[ i ], key, raw ? 3968 value : 3969 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 3970 ); 3971 } 3972 } 3973 } 3974 3975 if ( chainable ) { 3976 return elems; 3977 } 3978 3979 // Gets 3980 if ( bulk ) { 3981 return fn.call( elems ); 3982 } 3983 3984 return len ? fn( elems[ 0 ], key ) : emptyGet; 3985}; 3986 3987 3988// Matches dashed string for camelizing 3989var rmsPrefix = /^-ms-/, 3990 rdashAlpha = /-([a-z])/g; 3991 3992// Used by camelCase as callback to replace() 3993function fcamelCase( _all, letter ) { 3994 return letter.toUpperCase(); 3995} 3996 3997// Convert dashed to camelCase; used by the css and data modules 3998// Support: IE <=9 - 11, Edge 12 - 15 3999// Microsoft forgot to hump their vendor prefix (trac-9572) 4000function camelCase( string ) { 4001 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 4002} 4003var acceptData = function( owner ) { 4004 4005 // Accepts only: 4006 // - Node 4007 // - Node.ELEMENT_NODE 4008 // - Node.DOCUMENT_NODE 4009 // - Object 4010 // - Any 4011 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 4012}; 4013 4014 4015 4016 4017function Data() { 4018 this.expando = jQuery.expando + Data.uid++; 4019} 4020 4021Data.uid = 1; 4022 4023Data.prototype = { 4024 4025 cache: function( owner ) { 4026 4027 // Check if the owner object already has a cache 4028 var value = owner[ this.expando ]; 4029 4030 // If not, create one 4031 if ( !value ) { 4032 value = {}; 4033 4034 // We can accept data for non-element nodes in modern browsers, 4035 // but we should not, see trac-8335. 4036 // Always return an empty object. 4037 if ( acceptData( owner ) ) { 4038 4039 // If it is a node unlikely to be stringify-ed or looped over 4040 // use plain assignment 4041 if ( owner.nodeType ) { 4042 owner[ this.expando ] = value; 4043 4044 // Otherwise secure it in a non-enumerable property 4045 // configurable must be true to allow the property to be 4046 // deleted when data is removed 4047 } else { 4048 Object.defineProperty( owner, this.expando, { 4049 value: value, 4050 configurable: true 4051 } ); 4052 } 4053 } 4054 } 4055 4056 return value; 4057 }, 4058 set: function( owner, data, value ) { 4059 var prop, 4060 cache = this.cache( owner ); 4061 4062 // Handle: [ owner, key, value ] args 4063 // Always use camelCase key (gh-2257) 4064 if ( typeof data === "string" ) { 4065 cache[ camelCase( data ) ] = value; 4066 4067 // Handle: [ owner, { properties } ] args 4068 } else { 4069 4070 // Copy the properties one-by-one to the cache object 4071 for ( prop in data ) { 4072 cache[ camelCase( prop ) ] = data[ prop ]; 4073 } 4074 } 4075 return cache; 4076 }, 4077 get: function( owner, key ) { 4078 return key === undefined ? 4079 this.cache( owner ) : 4080 4081 // Always use camelCase key (gh-2257) 4082 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 4083 }, 4084 access: function( owner, key, value ) { 4085 4086 // In cases where either: 4087 // 4088 // 1. No key was specified 4089 // 2. A string key was specified, but no value provided 4090 // 4091 // Take the "read" path and allow the get method to determine 4092 // which value to return, respectively either: 4093 // 4094 // 1. The entire cache object 4095 // 2. The data stored at the key 4096 // 4097 if ( key === undefined || 4098 ( ( key && typeof key === "string" ) && value === undefined ) ) { 4099 4100 return this.get( owner, key ); 4101 } 4102 4103 // When the key is not a string, or both a key and value 4104 // are specified, set or extend (existing objects) with either: 4105 // 4106 // 1. An object of properties 4107 // 2. A key and value 4108 // 4109 this.set( owner, key, value ); 4110 4111 // Since the "set" path can have two possible entry points 4112 // return the expected data based on which path was taken[*] 4113 return value !== undefined ? value : key; 4114 }, 4115 remove: function( owner, key ) { 4116 var i, 4117 cache = owner[ this.expando ]; 4118 4119 if ( cache === undefined ) { 4120 return; 4121 } 4122 4123 if ( key !== undefined ) { 4124
vendor: 4,799 bytes, lines 4125-4307
4125 // Support array or space separated string of keys 4126 if ( Array.isArray( key ) ) { 4127 4128 // If key is an array of keys... 4129 // We always set camelCase keys, so remove that. 4130 key = key.map( camelCase ); 4131 } else { 4132 key = camelCase( key ); 4133 4134 // If a key with the spaces exists, use it. 4135 // Otherwise, create an array by matching non-whitespace 4136 key = key in cache ? 4137 [ key ] : 4138 ( key.match( rnothtmlwhite ) || [] ); 4139 } 4140 4141 i = key.length; 4142 4143 while ( i-- ) { 4144 delete cache[ key[ i ] ]; 4145 } 4146 } 4147 4148 // Remove the expando if there's no more data 4149 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 4150 4151 // Support: Chrome <=35 - 45 4152 // Webkit & Blink performance suffers when deleting properties 4153 // from DOM nodes, so set to undefined instead 4154 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 4155 if ( owner.nodeType ) { 4156 owner[ this.expando ] = undefined; 4157 } else { 4158 delete owner[ this.expando ]; 4159 } 4160 } 4161 }, 4162 hasData: function( owner ) { 4163 var cache = owner[ this.expando ]; 4164 return cache !== undefined && !jQuery.isEmptyObject( cache ); 4165 } 4166}; 4167var dataPriv = new Data(); 4168 4169var dataUser = new Data(); 4170 4171 4172 4173// Implementation Summary 4174// 4175// 1. Enforce API surface and semantic compatibility with 1.9.x branch 4176// 2. Improve the module's maintainability by reducing the storage 4177// paths to a single mechanism. 4178// 3. Use the same single mechanism to support "private" and "user" data. 4179// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 4180// 5. Avoid exposing implementation details on user objects (eg. expando properties) 4181// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 4182 4183var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 4184 rmultiDash = /[A-Z]/g; 4185 4186function getData( data ) { 4187 if ( data === "true" ) { 4188 return true; 4189 } 4190 4191 if ( data === "false" ) { 4192 return false; 4193 } 4194 4195 if ( data === "null" ) { 4196 return null; 4197 } 4198 4199 // Only convert to a number if it doesn't change the string 4200 if ( data === +data + "" ) { 4201 return +data; 4202 } 4203 4204 if ( rbrace.test( data ) ) { 4205 return JSON.parse( data ); 4206 } 4207 4208 return data; 4209} 4210 4211function dataAttr( elem, key, data ) { 4212 var name; 4213 4214 // If nothing was found internally, try to fetch any 4215 // data from the HTML5 data-* attribute 4216 if ( data === undefined && elem.nodeType === 1 ) { 4217 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 4218 data = elem.getAttribute( name ); 4219 4220 if ( typeof data === "string" ) { 4221 try { 4222 data = getData( data ); 4223 } catch ( e ) {} 4224 4225 // Make sure we set the data so it isn't changed later 4226 dataUser.set( elem, key, data ); 4227 } else { 4228 data = undefined; 4229 } 4230 } 4231 return data; 4232} 4233 4234jQuery.extend( { 4235 hasData: function( elem ) { 4236 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 4237 }, 4238 4239 data: function( elem, name, data ) { 4240 return dataUser.access( elem, name, data ); 4241 }, 4242 4243 removeData: function( elem, name ) { 4244 dataUser.remove( elem, name ); 4245 }, 4246 4247 // TODO: Now that all calls to _data and _removeData have been replaced 4248 // with direct calls to dataPriv methods, these can be deprecated. 4249 _data: function( elem, name, data ) { 4250 return dataPriv.access( elem, name, data ); 4251 }, 4252 4253 _removeData: function( elem, name ) { 4254 dataPriv.remove( elem, name ); 4255 } 4256} ); 4257 4258jQuery.fn.extend( { 4259 data: function( key, value ) { 4260 var i, name, data, 4261 elem = this[ 0 ], 4262 attrs = elem && elem.attributes; 4263 4264 // Gets all values 4265 if ( key === undefined ) { 4266 if ( this.length ) { 4267 data = dataUser.get( elem ); 4268 4269 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 4270 i = attrs.length; 4271 while ( i-- ) { 4272 4273 // Support: IE 11 only 4274 // The attrs elements can be null (trac-14894) 4275 if ( attrs[ i ] ) { 4276 name = attrs[ i ].name; 4277 if ( name.indexOf( "data-" ) === 0 ) { 4278 name = camelCase( name.slice( 5 ) ); 4279 dataAttr( elem, name, data[ name ] ); 4280 } 4281 } 4282 } 4283 dataPriv.set( elem, "hasDataAttrs", true ); 4284 } 4285 } 4286 4287 return data; 4288 } 4289 4290 // Sets multiple values 4291 if ( typeof key === "object" ) { 4292 return this.each( function() { 4293 dataUser.set( this, key ); 4294 } ); 4295 } 4296 4297 return access( this, function( value ) { 4298 var data; 4299 4300 // The calling jQuery object (element matches) is not empty 4301 // (and therefore has an element appears at this[ 0 ]) and the 4302 // `value` parameter was not undefined. An empty jQuery object 4303 // will result in `undefined` for elem = this[ 0 ] which will 4304 // throw an exception if an attempt to read a data cache is made. 4305 if ( elem && value === undefined ) { 4306 4307 // Attempt to get data from the cache
vendor: 20,334 bytes, lines 4308-5081
4308 // The key will always be camelCased in Data 4309 data = dataUser.get( elem, key ); 4310 if ( data !== undefined ) { 4311 return data; 4312 } 4313 4314 // Attempt to "discover" the data in 4315 // HTML5 custom data-* attrs 4316 data = dataAttr( elem, key ); 4317 if ( data !== undefined ) { 4318 return data; 4319 } 4320 4321 // We tried really hard, but the data doesn't exist. 4322 return; 4323 } 4324 4325 // Set the data... 4326 this.each( function() { 4327 4328 // We always store the camelCased key 4329 dataUser.set( this, key, value ); 4330 } ); 4331 }, null, value, arguments.length > 1, null, true ); 4332 }, 4333 4334 removeData: function( key ) { 4335 return this.each( function() { 4336 dataUser.remove( this, key ); 4337 } ); 4338 } 4339} ); 4340 4341 4342jQuery.extend( { 4343 queue: function( elem, type, data ) { 4344 var queue; 4345 4346 if ( elem ) { 4347 type = ( type || "fx" ) + "queue"; 4348 queue = dataPriv.get( elem, type ); 4349 4350 // Speed up dequeue by getting out quickly if this is just a lookup 4351 if ( data ) { 4352 if ( !queue || Array.isArray( data ) ) { 4353 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 4354 } else { 4355 queue.push( data ); 4356 } 4357 } 4358 return queue || []; 4359 } 4360 }, 4361 4362 dequeue: function( elem, type ) { 4363 type = type || "fx"; 4364 4365 var queue = jQuery.queue( elem, type ), 4366 startLength = queue.length, 4367 fn = queue.shift(), 4368 hooks = jQuery._queueHooks( elem, type ), 4369 next = function() { 4370 jQuery.dequeue( elem, type ); 4371 }; 4372 4373 // If the fx queue is dequeued, always remove the progress sentinel 4374 if ( fn === "inprogress" ) { 4375 fn = queue.shift(); 4376 startLength--; 4377 } 4378 4379 if ( fn ) { 4380 4381 // Add a progress sentinel to prevent the fx queue from being 4382 // automatically dequeued 4383 if ( type === "fx" ) { 4384 queue.unshift( "inprogress" ); 4385 } 4386 4387 // Clear up the last queue stop function 4388 delete hooks.stop; 4389 fn.call( elem, next, hooks ); 4390 } 4391 4392 if ( !startLength && hooks ) { 4393 hooks.empty.fire(); 4394 } 4395 }, 4396 4397 // Not public - generate a queueHooks object, or return the current one 4398 _queueHooks: function( elem, type ) { 4399 var key = type + "queueHooks"; 4400 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 4401 empty: jQuery.Callbacks( "once memory" ).add( function() { 4402 dataPriv.remove( elem, [ type + "queue", key ] ); 4403 } ) 4404 } ); 4405 } 4406} ); 4407 4408jQuery.fn.extend( { 4409 queue: function( type, data ) { 4410 var setter = 2; 4411 4412 if ( typeof type !== "string" ) { 4413 data = type; 4414 type = "fx"; 4415 setter--; 4416 } 4417 4418 if ( arguments.length < setter ) { 4419 return jQuery.queue( this[ 0 ], type ); 4420 } 4421 4422 return data === undefined ? 4423 this : 4424 this.each( function() { 4425 var queue = jQuery.queue( this, type, data ); 4426 4427 // Ensure a hooks for this queue 4428 jQuery._queueHooks( this, type ); 4429 4430 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 4431 jQuery.dequeue( this, type ); 4432 } 4433 } ); 4434 }, 4435 dequeue: function( type ) { 4436 return this.each( function() { 4437 jQuery.dequeue( this, type ); 4438 } ); 4439 }, 4440 clearQueue: function( type ) { 4441 return this.queue( type || "fx", [] ); 4442 }, 4443 4444 // Get a promise resolved when queues of a certain type 4445 // are emptied (fx is the type by default) 4446 promise: function( type, obj ) { 4447 var tmp, 4448 count = 1, 4449 defer = jQuery.Deferred(), 4450 elements = this, 4451 i = this.length, 4452 resolve = function() { 4453 if ( !( --count ) ) { 4454 defer.resolveWith( elements, [ elements ] ); 4455 } 4456 }; 4457 4458 if ( typeof type !== "string" ) { 4459 obj = type; 4460 type = undefined; 4461 } 4462 type = type || "fx"; 4463 4464 while ( i-- ) { 4465 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 4466 if ( tmp && tmp.empty ) { 4467 count++; 4468 tmp.empty.add( resolve ); 4469 } 4470 } 4471 resolve(); 4472 return defer.promise( obj ); 4473 } 4474} ); 4475var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 4476 4477var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 4478 4479 4480var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4481 4482var documentElement = document.documentElement; 4483 4484 4485 4486 var isAttached = function( elem ) { 4487 return jQuery.contains( elem.ownerDocument, elem ); 4488 }, 4489 composed = { composed: true }; 4490 4491 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 4492 // Check attachment across shadow DOM boundaries when possible (gh-3504) 4493 // Support: iOS 10.0-10.2 only 4494 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 4495 // leading to errors. We need to check for `getRootNode`. 4496 if ( documentElement.getRootNode ) { 4497 isAttached = function( elem ) { 4498 return jQuery.contains( elem.ownerDocument, elem ) || 4499 elem.getRootNode( composed ) === elem.ownerDocument; 4500 }; 4501 } 4502var isHiddenWithinTree = function( elem, el ) { 4503 4504 // isHiddenWithinTree might be called from jQuery#filter function; 4505 // in that case, element will be second argument 4506 elem = el || elem; 4507 4508 // Inline style trumps all 4509 return elem.style.display === "none" || 4510 elem.style.display === "" && 4511 4512 // Otherwise, check computed style 4513 // Support: Firefox <=43 - 45 4514 // Disconnected elements can have computed display: none, so first confirm that elem is 4515 // in the document. 4516 isAttached( elem ) && 4517 4518 jQuery.css( elem, "display" ) === "none"; 4519 }; 4520 4521 4522 4523function adjustCSS( elem, prop, valueParts, tween ) { 4524 var adjusted, scale, 4525 maxIterations = 20, 4526 currentValue = tween ? 4527 function() { 4528 return tween.cur(); 4529 } : 4530 function() { 4531 return jQuery.css( elem, prop, "" ); 4532 }, 4533 initial = currentValue(), 4534 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 4535 4536 // Starting value computation is required for potential unit mismatches 4537 initialInUnit = elem.nodeType && 4538 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 4539 rcssNum.exec( jQuery.css( elem, prop ) ); 4540 4541 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 4542 4543 // Support: Firefox <=54 4544 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 4545 initial = initial / 2; 4546 4547 // Trust units reported by jQuery.css 4548 unit = unit || initialInUnit[ 3 ]; 4549 4550 // Iteratively approximate from a nonzero starting point 4551 initialInUnit = +initial || 1; 4552 4553 while ( maxIterations-- ) { 4554 4555 // Evaluate and update our best guess (doubling guesses that zero out). 4556 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 4557 jQuery.style( elem, prop, initialInUnit + unit ); 4558 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 4559 maxIterations = 0; 4560 } 4561 initialInUnit = initialInUnit / scale; 4562 4563 } 4564 4565 initialInUnit = initialInUnit * 2; 4566 jQuery.style( elem, prop, initialInUnit + unit ); 4567 4568 // Make sure we update the tween properties later on 4569 valueParts = valueParts || []; 4570 } 4571 4572 if ( valueParts ) { 4573 initialInUnit = +initialInUnit || +initial || 0; 4574 4575 // Apply relative offset (+=/-=) if specified 4576 adjusted = valueParts[ 1 ] ? 4577 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 4578 +valueParts[ 2 ]; 4579 if ( tween ) { 4580 tween.unit = unit; 4581 tween.start = initialInUnit; 4582 tween.end = adjusted; 4583 } 4584 } 4585 return adjusted; 4586} 4587 4588 4589var defaultDisplayMap = {}; 4590 4591function getDefaultDisplay( elem ) { 4592 var temp, 4593 doc = elem.ownerDocument, 4594 nodeName = elem.nodeName, 4595 display = defaultDisplayMap[ nodeName ]; 4596 4597 if ( display ) { 4598 return display; 4599 } 4600 4601 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 4602 display = jQuery.css( temp, "display" ); 4603 4604 temp.parentNode.removeChild( temp ); 4605 4606 if ( display === "none" ) { 4607 display = "block"; 4608 } 4609 defaultDisplayMap[ nodeName ] = display; 4610 4611 return display; 4612} 4613 4614function showHide( elements, show ) { 4615 var display, elem, 4616 values = [], 4617 index = 0, 4618 length = elements.length; 4619 4620 // Determine new display value for elements that need to change 4621 for ( ; index < length; index++ ) { 4622 elem = elements[ index ]; 4623 if ( !elem.style ) { 4624 continue; 4625 } 4626 4627 display = elem.style.display; 4628 if ( show ) { 4629 4630 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 4631 // check is required in this first loop unless we have a nonempty display value (either 4632 // inline or about-to-be-restored) 4633 if ( display === "none" ) { 4634 values[ index ] = dataPriv.get( elem, "display" ) || null; 4635 if ( !values[ index ] ) { 4636 elem.style.display = ""; 4637 } 4638 } 4639 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 4640 values[ index ] = getDefaultDisplay( elem ); 4641 } 4642 } else { 4643 if ( display !== "none" ) { 4644 values[ index ] = "none"; 4645 4646 // Remember what we're overwriting 4647 dataPriv.set( elem, "display", display ); 4648 } 4649 } 4650 } 4651 4652 // Set the display of the elements in a second loop to avoid constant reflow 4653 for ( index = 0; index < length; index++ ) { 4654 if ( values[ index ] != null ) { 4655 elements[ index ].style.display = values[ index ]; 4656 } 4657 } 4658 4659 return elements; 4660} 4661 4662jQuery.fn.extend( { 4663 show: function() { 4664 return showHide( this, true ); 4665 }, 4666 hide: function() { 4667 return showHide( this ); 4668 }, 4669 toggle: function( state ) { 4670 if ( typeof state === "boolean" ) { 4671 return state ? this.show() : this.hide(); 4672 } 4673 4674 return this.each( function() { 4675 if ( isHiddenWithinTree( this ) ) { 4676 jQuery( this ).show(); 4677 } else { 4678 jQuery( this ).hide(); 4679 } 4680 } ); 4681 } 4682} ); 4683var rcheckableType = ( /^(?:checkbox|radio)$/i ); 4684 4685var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 4686 4687var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 4688 4689 4690 4691( function() { 4692 var fragment = document.createDocumentFragment(), 4693 div = fragment.appendChild( document.createElement( "div" ) ), 4694 input = document.createElement( "input" ); 4695 4696 // Support: Android 4.0 - 4.3 only 4697 // Check state lost if the name is set (trac-11217) 4698 // Support: Windows Web Apps (WWA) 4699 // `name` and `type` must use .setAttribute for WWA (trac-14901) 4700 input.setAttribute( "type", "radio" ); 4701 input.setAttribute( "checked", "checked" ); 4702 input.setAttribute( "name", "t" ); 4703 4704 div.appendChild( input ); 4705 4706 // Support: Android <=4.1 only 4707 // Older WebKit doesn't clone checked state correctly in fragments 4708 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4709 4710 // Support: IE <=11 only 4711 // Make sure textarea (and checkbox) defaultValue is properly cloned 4712 div.innerHTML = "<textarea>x</textarea>"; 4713 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4714 4715 // Support: IE <=9 only 4716 // IE <=9 replaces <option> tags with their contents when inserted outside of 4717 // the select element. 4718 div.innerHTML = "<option></option>"; 4719 support.option = !!div.lastChild; 4720} )(); 4721 4722 4723// We have to close these tags to support XHTML (trac-13200) 4724var wrapMap = { 4725 4726 // XHTML parsers do not magically insert elements in the 4727 // same way that tag soup parsers do. So we cannot shorten 4728 // this by omitting <tbody> or other required elements. 4729 thead: [ 1, "<table>", "</table>" ], 4730 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 4731 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 4732 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 4733 4734 _default: [ 0, "", "" ] 4735}; 4736 4737wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4738wrapMap.th = wrapMap.td; 4739 4740// Support: IE <=9 only 4741if ( !support.option ) { 4742 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 4743} 4744 4745 4746function getAll( context, tag ) { 4747 4748 // Support: IE <=9 - 11 only 4749 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) 4750 var ret; 4751 4752 if ( typeof context.getElementsByTagName !== "undefined" ) { 4753 ret = context.getElementsByTagName( tag || "*" ); 4754 4755 } else if ( typeof context.querySelectorAll !== "undefined" ) { 4756 ret = context.querySelectorAll( tag || "*" ); 4757 4758 } else { 4759 ret = []; 4760 } 4761 4762 if ( tag === undefined || tag && nodeName( context, tag ) ) { 4763 return jQuery.merge( [ context ], ret ); 4764 } 4765 4766 return ret; 4767} 4768 4769 4770// Mark scripts as having already been evaluated 4771function setGlobalEval( elems, refElements ) { 4772 var i = 0, 4773 l = elems.length; 4774 4775 for ( ; i < l; i++ ) { 4776 dataPriv.set( 4777 elems[ i ], 4778 "globalEval", 4779 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 4780 ); 4781 } 4782} 4783 4784 4785var rhtml = /<|&#?\w+;/; 4786 4787function buildFragment( elems, context, scripts, selection, ignored ) { 4788 var elem, tmp, tag, wrap, attached, j, 4789 fragment = context.createDocumentFragment(), 4790 nodes = [], 4791 i = 0, 4792 l = elems.length; 4793 4794 for ( ; i < l; i++ ) { 4795 elem = elems[ i ]; 4796 4797 if ( elem || elem === 0 ) { 4798 4799 // Add nodes directly 4800 if ( toType( elem ) === "object" ) { 4801 4802 // Support: Android <=4.0 only, PhantomJS 1 only 4803 // push.apply(_, arraylike) throws on ancient WebKit 4804 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 4805 4806 // Convert non-html into a text node 4807 } else if ( !rhtml.test( elem ) ) { 4808 nodes.push( context.createTextNode( elem ) ); 4809 4810 // Convert html into DOM nodes 4811 } else { 4812 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 4813 4814 // Deserialize a standard representation 4815 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 4816 wrap = wrapMap[ tag ] || wrapMap._default; 4817 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 4818 4819 // Descend through wrappers to the right content 4820 j = wrap[ 0 ]; 4821 while ( j-- ) { 4822 tmp = tmp.lastChild; 4823 } 4824 4825 // Support: Android <=4.0 only, PhantomJS 1 only 4826 // push.apply(_, arraylike) throws on ancient WebKit 4827 jQuery.merge( nodes, tmp.childNodes ); 4828 4829 // Remember the top-level container 4830 tmp = fragment.firstChild; 4831 4832 // Ensure the created nodes are orphaned (trac-12392) 4833 tmp.textContent = ""; 4834 } 4835 } 4836 } 4837 4838 // Remove wrapper from fragment 4839 fragment.textContent = ""; 4840 4841 i = 0; 4842 while ( ( elem = nodes[ i++ ] ) ) { 4843 4844 // Skip elements already in the context collection (trac-4087) 4845 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 4846 if ( ignored ) { 4847 ignored.push( elem ); 4848 } 4849 continue; 4850 } 4851 4852 attached = isAttached( elem ); 4853 4854 // Append to fragment 4855 tmp = getAll( fragment.appendChild( elem ), "script" ); 4856 4857 // Preserve script evaluation history 4858 if ( attached ) { 4859 setGlobalEval( tmp ); 4860 } 4861 4862 // Capture executables 4863 if ( scripts ) { 4864 j = 0; 4865 while ( ( elem = tmp[ j++ ] ) ) { 4866 if ( rscriptType.test( elem.type || "" ) ) { 4867 scripts.push( elem ); 4868 } 4869 } 4870 } 4871 } 4872 4873 return fragment; 4874} 4875 4876 4877var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 4878 4879function returnTrue() { 4880 return true; 4881} 4882 4883function returnFalse() { 4884 return false; 4885} 4886 4887function on( elem, types, selector, data, fn, one ) { 4888 var origFn, type; 4889 4890 // Types can be a map of types/handlers 4891 if ( typeof types === "object" ) { 4892 4893 // ( types-Object, selector, data ) 4894 if ( typeof selector !== "string" ) { 4895 4896 // ( types-Object, data ) 4897 data = data || selector; 4898 selector = undefined; 4899 } 4900 for ( type in types ) { 4901 on( elem, type, selector, data, types[ type ], one ); 4902 } 4903 return elem; 4904 } 4905 4906 if ( data == null && fn == null ) { 4907 4908 // ( types, fn ) 4909 fn = selector; 4910 data = selector = undefined; 4911 } else if ( fn == null ) { 4912 if ( typeof selector === "string" ) { 4913 4914 // ( types, selector, fn ) 4915 fn = data; 4916 data = undefined; 4917 } else { 4918 4919 // ( types, data, fn ) 4920 fn = data; 4921 data = selector; 4922 selector = undefined; 4923 } 4924 } 4925 if ( fn === false ) { 4926 fn = returnFalse; 4927 } else if ( !fn ) { 4928 return elem; 4929 } 4930 4931 if ( one === 1 ) { 4932 origFn = fn; 4933 fn = function( event ) { 4934 4935 // Can use an empty set, since event contains the info 4936 jQuery().off( event ); 4937 return origFn.apply( this, arguments ); 4938 }; 4939 4940 // Use same guid so caller can remove using origFn 4941 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 4942 } 4943 return elem.each( function() { 4944 jQuery.event.add( this, types, fn, data, selector ); 4945 } ); 4946} 4947 4948/* 4949 * Helper functions for managing events -- not part of the public interface. 4950 * Props to Dean Edwards' addEvent library for many of the ideas. 4951 */ 4952jQuery.event = { 4953 4954 global: {}, 4955 4956 add: function( elem, types, handler, data, selector ) { 4957 4958 var handleObjIn, eventHandle, tmp, 4959 events, t, handleObj, 4960 special, handlers, type, namespaces, origType, 4961 elemData = dataPriv.get( elem ); 4962 4963 // Only attach events to objects that accept data 4964 if ( !acceptData( elem ) ) { 4965 return; 4966 } 4967 4968 // Caller can pass in an object of custom data in lieu of the handler 4969 if ( handler.handler ) { 4970 handleObjIn = handler; 4971 handler = handleObjIn.handler; 4972 selector = handleObjIn.selector; 4973 } 4974 4975 // Ensure that invalid selectors throw exceptions at attach time 4976 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 4977 if ( selector ) { 4978 jQuery.find.matchesSelector( documentElement, selector ); 4979 } 4980 4981 // Make sure that the handler has a unique ID, used to find/remove it later 4982 if ( !handler.guid ) { 4983 handler.guid = jQuery.guid++; 4984 } 4985 4986 // Init the element's event structure and main handler, if this is the first 4987 if ( !( events = elemData.events ) ) { 4988 events = elemData.events = Object.create( null ); 4989 } 4990 if ( !( eventHandle = elemData.handle ) ) { 4991 eventHandle = elemData.handle = function( e ) { 4992 4993 // Discard the second event of a jQuery.event.trigger() and 4994 // when an event is called after a page has unloaded 4995 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 4996 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 4997 }; 4998 } 4999 5000 // Handle multiple events separated by a space 5001 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5002 t = types.length; 5003 while ( t-- ) { 5004 tmp = rtypenamespace.exec( types[ t ] ) || []; 5005 type = origType = tmp[ 1 ]; 5006 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5007 5008 // There *must* be a type, no attaching namespace-only handlers 5009 if ( !type ) { 5010 continue; 5011 } 5012 5013 // If event changes its type, use the special event handlers for the changed type 5014 special = jQuery.event.special[ type ] || {}; 5015 5016 // If selector defined, determine special event api type, otherwise given type 5017 type = ( selector ? special.delegateType : special.bindType ) || type; 5018 5019 // Update special based on newly reset type 5020 special = jQuery.event.special[ type ] || {}; 5021 5022 // handleObj is passed to all event handlers 5023 handleObj = jQuery.extend( { 5024 type: type, 5025 origType: origType, 5026 data: data, 5027 handler: handler, 5028 guid: handler.guid, 5029 selector: selector, 5030 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 5031 namespace: namespaces.join( "." ) 5032 }, handleObjIn ); 5033 5034 // Init the event handler queue if we're the first 5035 if ( !( handlers = events[ type ] ) ) { 5036 handlers = events[ type ] = []; 5037 handlers.delegateCount = 0; 5038 5039 // Only use addEventListener if the special events handler returns false 5040 if ( !special.setup || 5041 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 5042 5043 if ( elem.addEventListener ) { 5044 elem.addEventListener( type, eventHandle ); 5045 } 5046 } 5047 } 5048 5049 if ( special.add ) { 5050 special.add.call( elem, handleObj ); 5051 5052 if ( !handleObj.handler.guid ) { 5053 handleObj.handler.guid = handler.guid; 5054 } 5055 } 5056 5057 // Add to the element's handler list, delegates in front 5058 if ( selector ) { 5059 handlers.splice( handlers.delegateCount++, 0, handleObj ); 5060 } else { 5061 handlers.push( handleObj ); 5062 } 5063 5064 // Keep track of which events have ever been used, for event optimization 5065 jQuery.event.global[ type ] = true; 5066 } 5067 5068 }, 5069 5070 // Detach an event or set of events from an element 5071 remove: function( elem, types, handler, selector, mappedTypes ) { 5072 5073 var j, origCount, tmp, 5074 events, t, handleObj, 5075 special, handlers, type, namespaces, origType, 5076 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 5077 5078 if ( !elemData || !( events = elemData.events ) ) { 5079 return; 5080 } 5081
vendor: 4,336 bytes, lines 5082-5220
5082 // Once for each type.namespace in types; type may be omitted 5083 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5084 t = types.length; 5085 while ( t-- ) { 5086 tmp = rtypenamespace.exec( types[ t ] ) || []; 5087 type = origType = tmp[ 1 ]; 5088 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5089 5090 // Unbind all events (on this namespace, if provided) for the element 5091 if ( !type ) { 5092 for ( type in events ) { 5093 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 5094 } 5095 continue; 5096 } 5097 5098 special = jQuery.event.special[ type ] || {}; 5099 type = ( selector ? special.delegateType : special.bindType ) || type; 5100 handlers = events[ type ] || []; 5101 tmp = tmp[ 2 ] && 5102 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 5103 5104 // Remove matching events 5105 origCount = j = handlers.length; 5106 while ( j-- ) { 5107 handleObj = handlers[ j ]; 5108 5109 if ( ( mappedTypes || origType === handleObj.origType ) && 5110 ( !handler || handler.guid === handleObj.guid ) && 5111 ( !tmp || tmp.test( handleObj.namespace ) ) && 5112 ( !selector || selector === handleObj.selector || 5113 selector === "**" && handleObj.selector ) ) { 5114 handlers.splice( j, 1 ); 5115 5116 if ( handleObj.selector ) { 5117 handlers.delegateCount--; 5118 } 5119 if ( special.remove ) { 5120 special.remove.call( elem, handleObj ); 5121 } 5122 } 5123 } 5124 5125 // Remove generic event handler if we removed something and no more handlers exist 5126 // (avoids potential for endless recursion during removal of special event handlers) 5127 if ( origCount && !handlers.length ) { 5128 if ( !special.teardown || 5129 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 5130 5131 jQuery.removeEvent( elem, type, elemData.handle ); 5132 } 5133 5134 delete events[ type ]; 5135 } 5136 } 5137 5138 // Remove data and the expando if it's no longer used 5139 if ( jQuery.isEmptyObject( events ) ) { 5140 dataPriv.remove( elem, "handle events" ); 5141 } 5142 }, 5143 5144 dispatch: function( nativeEvent ) { 5145 5146 var i, j, ret, matched, handleObj, handlerQueue, 5147 args = new Array( arguments.length ), 5148 5149 // Make a writable jQuery.Event from the native event object 5150 event = jQuery.event.fix( nativeEvent ), 5151 5152 handlers = ( 5153 dataPriv.get( this, "events" ) || Object.create( null ) 5154 )[ event.type ] || [], 5155 special = jQuery.event.special[ event.type ] || {}; 5156 5157 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5158 args[ 0 ] = event; 5159 5160 for ( i = 1; i < arguments.length; i++ ) { 5161 args[ i ] = arguments[ i ]; 5162 } 5163 5164 event.delegateTarget = this; 5165 5166 // Call the preDispatch hook for the mapped type, and let it bail if desired 5167 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 5168 return; 5169 } 5170 5171 // Determine handlers 5172 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 5173 5174 // Run delegates first; they may want to stop propagation beneath us 5175 i = 0; 5176 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 5177 event.currentTarget = matched.elem; 5178 5179 j = 0; 5180 while ( ( handleObj = matched.handlers[ j++ ] ) && 5181 !event.isImmediatePropagationStopped() ) { 5182 5183 // If the event is namespaced, then each handler is only invoked if it is 5184 // specially universal or its namespaces are a superset of the event's. 5185 if ( !event.rnamespace || handleObj.namespace === false || 5186 event.rnamespace.test( handleObj.namespace ) ) { 5187 5188 event.handleObj = handleObj; 5189 event.data = handleObj.data; 5190 5191 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 5192 handleObj.handler ).apply( matched.elem, args ); 5193 5194 if ( ret !== undefined ) { 5195 if ( ( event.result = ret ) === false ) { 5196 event.preventDefault(); 5197 event.stopPropagation(); 5198 } 5199 } 5200 } 5201 } 5202 } 5203 5204 // Call the postDispatch hook for the mapped type 5205 if ( special.postDispatch ) { 5206 special.postDispatch.call( this, event ); 5207 } 5208 5209 return event.result; 5210 }, 5211 5212 handlers: function( event, handlers ) { 5213 var i, handleObj, sel, matchedHandlers, matchedSelectors, 5214 handlerQueue = [], 5215 delegateCount = handlers.delegateCount, 5216 cur = event.target; 5217 5218 // Find delegate handlers 5219 if ( delegateCount && 5220
vendor: 26,293 bytes, lines 5221-6097
5221 // Support: IE <=9 5222 // Black-hole SVG <use> instance trees (trac-13180) 5223 cur.nodeType && 5224 5225 // Support: Firefox <=42 5226 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 5227 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 5228 // Support: IE 11 only 5229 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 5230 !( event.type === "click" && event.button >= 1 ) ) { 5231 5232 for ( ; cur !== this; cur = cur.parentNode || this ) { 5233 5234 // Don't check non-elements (trac-13208) 5235 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) 5236 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 5237 matchedHandlers = []; 5238 matchedSelectors = {}; 5239 for ( i = 0; i < delegateCount; i++ ) { 5240 handleObj = handlers[ i ]; 5241 5242 // Don't conflict with Object.prototype properties (trac-13203) 5243 sel = handleObj.selector + " "; 5244 5245 if ( matchedSelectors[ sel ] === undefined ) { 5246 matchedSelectors[ sel ] = handleObj.needsContext ? 5247 jQuery( sel, this ).index( cur ) > -1 : 5248 jQuery.find( sel, this, null, [ cur ] ).length; 5249 } 5250 if ( matchedSelectors[ sel ] ) { 5251 matchedHandlers.push( handleObj ); 5252 } 5253 } 5254 if ( matchedHandlers.length ) { 5255 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 5256 } 5257 } 5258 } 5259 } 5260 5261 // Add the remaining (directly-bound) handlers 5262 cur = this; 5263 if ( delegateCount < handlers.length ) { 5264 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 5265 } 5266 5267 return handlerQueue; 5268 }, 5269 5270 addProp: function( name, hook ) { 5271 Object.defineProperty( jQuery.Event.prototype, name, { 5272 enumerable: true, 5273 configurable: true, 5274 5275 get: isFunction( hook ) ? 5276 function() { 5277 if ( this.originalEvent ) { 5278 return hook( this.originalEvent ); 5279 } 5280 } : 5281 function() { 5282 if ( this.originalEvent ) { 5283 return this.originalEvent[ name ]; 5284 } 5285 }, 5286 5287 set: function( value ) { 5288 Object.defineProperty( this, name, { 5289 enumerable: true, 5290 configurable: true, 5291 writable: true, 5292 value: value 5293 } ); 5294 } 5295 } ); 5296 }, 5297 5298 fix: function( originalEvent ) { 5299 return originalEvent[ jQuery.expando ] ? 5300 originalEvent : 5301 new jQuery.Event( originalEvent ); 5302 }, 5303 5304 special: { 5305 load: { 5306 5307 // Prevent triggered image.load events from bubbling to window.load 5308 noBubble: true 5309 }, 5310 click: { 5311 5312 // Utilize native event to ensure correct state for checkable inputs 5313 setup: function( data ) { 5314 5315 // For mutual compressibility with _default, replace `this` access with a local var. 5316 // `|| data` is dead code meant only to preserve the variable through minification. 5317 var el = this || data; 5318 5319 // Claim the first handler 5320 if ( rcheckableType.test( el.type ) && 5321 el.click && nodeName( el, "input" ) ) { 5322 5323 // dataPriv.set( el, "click", ... ) 5324 leverageNative( el, "click", true ); 5325 } 5326 5327 // Return false to allow normal processing in the caller 5328 return false; 5329 }, 5330 trigger: function( data ) { 5331 5332 // For mutual compressibility with _default, replace `this` access with a local var. 5333 // `|| data` is dead code meant only to preserve the variable through minification. 5334 var el = this || data; 5335 5336 // Force setup before triggering a click 5337 if ( rcheckableType.test( el.type ) && 5338 el.click && nodeName( el, "input" ) ) { 5339 5340 leverageNative( el, "click" ); 5341 } 5342 5343 // Return non-false to allow normal event-path propagation 5344 return true; 5345 }, 5346 5347 // For cross-browser consistency, suppress native .click() on links 5348 // Also prevent it if we're currently inside a leveraged native-event stack 5349 _default: function( event ) { 5350 var target = event.target; 5351 return rcheckableType.test( target.type ) && 5352 target.click && nodeName( target, "input" ) && 5353 dataPriv.get( target, "click" ) || 5354 nodeName( target, "a" ); 5355 } 5356 }, 5357 5358 beforeunload: { 5359 postDispatch: function( event ) { 5360 5361 // Support: Firefox 20+ 5362 // Firefox doesn't alert if the returnValue field is not set. 5363 if ( event.result !== undefined && event.originalEvent ) { 5364 event.originalEvent.returnValue = event.result; 5365 } 5366 } 5367 } 5368 } 5369}; 5370 5371// Ensure the presence of an event listener that handles manually-triggered 5372// synthetic events by interrupting progress until reinvoked in response to 5373// *native* events that it fires directly, ensuring that state changes have 5374// already occurred before other listeners are invoked. 5375function leverageNative( el, type, isSetup ) { 5376 5377 // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add 5378 if ( !isSetup ) { 5379 if ( dataPriv.get( el, type ) === undefined ) { 5380 jQuery.event.add( el, type, returnTrue ); 5381 } 5382 return; 5383 } 5384 5385 // Register the controller as a special universal handler for all event namespaces 5386 dataPriv.set( el, type, false ); 5387 jQuery.event.add( el, type, { 5388 namespace: false, 5389 handler: function( event ) { 5390 var result, 5391 saved = dataPriv.get( this, type ); 5392 5393 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 5394 5395 // Interrupt processing of the outer synthetic .trigger()ed event 5396 if ( !saved ) { 5397 5398 // Store arguments for use when handling the inner native event 5399 // There will always be at least one argument (an event object), so this array 5400 // will not be confused with a leftover capture object. 5401 saved = slice.call( arguments ); 5402 dataPriv.set( this, type, saved ); 5403 5404 // Trigger the native event and capture its result 5405 this[ type ](); 5406 result = dataPriv.get( this, type ); 5407 dataPriv.set( this, type, false ); 5408 5409 if ( saved !== result ) { 5410 5411 // Cancel the outer synthetic event 5412 event.stopImmediatePropagation(); 5413 event.preventDefault(); 5414 5415 return result; 5416 } 5417 5418 // If this is an inner synthetic event for an event with a bubbling surrogate 5419 // (focus or blur), assume that the surrogate already propagated from triggering 5420 // the native event and prevent that from happening again here. 5421 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 5422 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 5423 // less bad than duplication. 5424 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 5425 event.stopPropagation(); 5426 } 5427 5428 // If this is a native event triggered above, everything is now in order 5429 // Fire an inner synthetic event with the original arguments 5430 } else if ( saved ) { 5431 5432 // ...and capture the result 5433 dataPriv.set( this, type, jQuery.event.trigger( 5434 saved[ 0 ], 5435 saved.slice( 1 ), 5436 this 5437 ) ); 5438 5439 // Abort handling of the native event by all jQuery handlers while allowing 5440 // native handlers on the same element to run. On target, this is achieved 5441 // by stopping immediate propagation just on the jQuery event. However, 5442 // the native event is re-wrapped by a jQuery one on each level of the 5443 // propagation so the only way to stop it for jQuery is to stop it for 5444 // everyone via native `stopPropagation()`. This is not a problem for 5445 // focus/blur which don't bubble, but it does also stop click on checkboxes 5446 // and radios. We accept this limitation. 5447 event.stopPropagation(); 5448 event.isImmediatePropagationStopped = returnTrue; 5449 } 5450 } 5451 } ); 5452} 5453 5454jQuery.removeEvent = function( elem, type, handle ) { 5455 5456 // This "if" is needed for plain objects 5457 if ( elem.removeEventListener ) { 5458 elem.removeEventListener( type, handle ); 5459 } 5460}; 5461 5462jQuery.Event = function( src, props ) { 5463 5464 // Allow instantiation without the 'new' keyword 5465 if ( !( this instanceof jQuery.Event ) ) { 5466 return new jQuery.Event( src, props ); 5467 } 5468 5469 // Event object 5470 if ( src && src.type ) { 5471 this.originalEvent = src; 5472 this.type = src.type; 5473 5474 // Events bubbling up the document may have been marked as prevented 5475 // by a handler lower down the tree; reflect the correct value. 5476 this.isDefaultPrevented = src.defaultPrevented || 5477 src.defaultPrevented === undefined && 5478 5479 // Support: Android <=2.3 only 5480 src.returnValue === false ? 5481 returnTrue : 5482 returnFalse; 5483 5484 // Create target properties 5485 // Support: Safari <=6 - 7 only 5486 // Target should not be a text node (trac-504, trac-13143) 5487 this.target = ( src.target && src.target.nodeType === 3 ) ? 5488 src.target.parentNode : 5489 src.target; 5490 5491 this.currentTarget = src.currentTarget; 5492 this.relatedTarget = src.relatedTarget; 5493 5494 // Event type 5495 } else { 5496 this.type = src; 5497 } 5498 5499 // Put explicitly provided properties onto the event object 5500 if ( props ) { 5501 jQuery.extend( this, props ); 5502 } 5503 5504 // Create a timestamp if incoming event doesn't have one 5505 this.timeStamp = src && src.timeStamp || Date.now(); 5506 5507 // Mark it as fixed 5508 this[ jQuery.expando ] = true; 5509}; 5510 5511// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5512// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5513jQuery.Event.prototype = { 5514 constructor: jQuery.Event, 5515 isDefaultPrevented: returnFalse, 5516 isPropagationStopped: returnFalse, 5517 isImmediatePropagationStopped: returnFalse, 5518 isSimulated: false, 5519 5520 preventDefault: function() { 5521 var e = this.originalEvent; 5522 5523 this.isDefaultPrevented = returnTrue; 5524 5525 if ( e && !this.isSimulated ) { 5526 e.preventDefault(); 5527 } 5528 }, 5529 stopPropagation: function() { 5530 var e = this.originalEvent; 5531 5532 this.isPropagationStopped = returnTrue; 5533 5534 if ( e && !this.isSimulated ) { 5535 e.stopPropagation(); 5536 } 5537 }, 5538 stopImmediatePropagation: function() { 5539 var e = this.originalEvent; 5540 5541 this.isImmediatePropagationStopped = returnTrue; 5542 5543 if ( e && !this.isSimulated ) { 5544 e.stopImmediatePropagation(); 5545 } 5546 5547 this.stopPropagation(); 5548 } 5549}; 5550 5551// Includes all common event props including KeyEvent and MouseEvent specific props 5552jQuery.each( { 5553 altKey: true, 5554 bubbles: true, 5555 cancelable: true, 5556 changedTouches: true, 5557 ctrlKey: true, 5558 detail: true, 5559 eventPhase: true, 5560 metaKey: true, 5561 pageX: true, 5562 pageY: true, 5563 shiftKey: true, 5564 view: true, 5565 "char": true, 5566 code: true, 5567 charCode: true, 5568 key: true, 5569 keyCode: true, 5570 button: true, 5571 buttons: true, 5572 clientX: true, 5573 clientY: true, 5574 offsetX: true, 5575 offsetY: true, 5576 pointerId: true, 5577 pointerType: true, 5578 screenX: true, 5579 screenY: true, 5580 targetTouches: true, 5581 toElement: true, 5582 touches: true, 5583 which: true 5584}, jQuery.event.addProp ); 5585 5586jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 5587 5588 function focusMappedHandler( nativeEvent ) { 5589 if ( document.documentMode ) { 5590 5591 // Support: IE 11+ 5592 // Attach a single focusin/focusout handler on the document while someone wants 5593 // focus/blur. This is because the former are synchronous in IE while the latter 5594 // are async. In other browsers, all those handlers are invoked synchronously. 5595 5596 // `handle` from private data would already wrap the event, but we need 5597 // to change the `type` here. 5598 var handle = dataPriv.get( this, "handle" ), 5599 event = jQuery.event.fix( nativeEvent ); 5600 event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; 5601 event.isSimulated = true; 5602 5603 // First, handle focusin/focusout 5604 handle( nativeEvent ); 5605 5606 // ...then, handle focus/blur 5607 // 5608 // focus/blur don't bubble while focusin/focusout do; simulate the former by only 5609 // invoking the handler at the lower level. 5610 if ( event.target === event.currentTarget ) { 5611 5612 // The setup part calls `leverageNative`, which, in turn, calls 5613 // `jQuery.event.add`, so event handle will already have been set 5614 // by this point. 5615 handle( event ); 5616 } 5617 } else { 5618 5619 // For non-IE browsers, attach a single capturing handler on the document 5620 // while someone wants focusin/focusout. 5621 jQuery.event.simulate( delegateType, nativeEvent.target, 5622 jQuery.event.fix( nativeEvent ) ); 5623 } 5624 } 5625 5626 jQuery.event.special[ type ] = { 5627 5628 // Utilize native event if possible so blur/focus sequence is correct 5629 setup: function() { 5630 5631 var attaches; 5632 5633 // Claim the first handler 5634 // dataPriv.set( this, "focus", ... ) 5635 // dataPriv.set( this, "blur", ... ) 5636 leverageNative( this, type, true ); 5637 5638 if ( document.documentMode ) { 5639 5640 // Support: IE 9 - 11+ 5641 // We use the same native handler for focusin & focus (and focusout & blur) 5642 // so we need to coordinate setup & teardown parts between those events. 5643 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 5644 attaches = dataPriv.get( this, delegateType ); 5645 if ( !attaches ) { 5646 this.addEventListener( delegateType, focusMappedHandler ); 5647 } 5648 dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 ); 5649 } else { 5650 5651 // Return false to allow normal processing in the caller 5652 return false; 5653 } 5654 }, 5655 trigger: function() { 5656 5657 // Force setup before trigger 5658 leverageNative( this, type ); 5659 5660 // Return non-false to allow normal event-path propagation 5661 return true; 5662 }, 5663 5664 teardown: function() { 5665 var attaches; 5666 5667 if ( document.documentMode ) { 5668 attaches = dataPriv.get( this, delegateType ) - 1; 5669 if ( !attaches ) { 5670 this.removeEventListener( delegateType, focusMappedHandler ); 5671 dataPriv.remove( this, delegateType ); 5672 } else { 5673 dataPriv.set( this, delegateType, attaches ); 5674 } 5675 } else { 5676 5677 // Return false to indicate standard teardown should be applied 5678 return false; 5679 } 5680 }, 5681 5682 // Suppress native focus or blur if we're currently inside 5683 // a leveraged native-event stack 5684 _default: function( event ) { 5685 return dataPriv.get( event.target, type ); 5686 }, 5687 5688 delegateType: delegateType 5689 }; 5690 5691 // Support: Firefox <=44 5692 // Firefox doesn't have focus(in | out) events 5693 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 5694 // 5695 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 5696 // focus(in | out) events fire after focus & blur events, 5697 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 5698 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 5699 // 5700 // Support: IE 9 - 11+ 5701 // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch, 5702 // attach a single handler for both events in IE. 5703 jQuery.event.special[ delegateType ] = { 5704 setup: function() { 5705 5706 // Handle: regular nodes (via `this.ownerDocument`), window 5707 // (via `this.document`) & document (via `this`). 5708 var doc = this.ownerDocument || this.document || this, 5709 dataHolder = document.documentMode ? this : doc, 5710 attaches = dataPriv.get( dataHolder, delegateType ); 5711 5712 // Support: IE 9 - 11+ 5713 // We use the same native handler for focusin & focus (and focusout & blur) 5714 // so we need to coordinate setup & teardown parts between those events. 5715 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 5716 if ( !attaches ) { 5717 if ( document.documentMode ) { 5718 this.addEventListener( delegateType, focusMappedHandler ); 5719 } else { 5720 doc.addEventListener( type, focusMappedHandler, true ); 5721 } 5722 } 5723 dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 ); 5724 }, 5725 teardown: function() { 5726 var doc = this.ownerDocument || this.document || this, 5727 dataHolder = document.documentMode ? this : doc, 5728 attaches = dataPriv.get( dataHolder, delegateType ) - 1; 5729 5730 if ( !attaches ) { 5731 if ( document.documentMode ) { 5732 this.removeEventListener( delegateType, focusMappedHandler ); 5733 } else { 5734 doc.removeEventListener( type, focusMappedHandler, true ); 5735 } 5736 dataPriv.remove( dataHolder, delegateType ); 5737 } else { 5738 dataPriv.set( dataHolder, delegateType, attaches ); 5739 } 5740 } 5741 }; 5742} ); 5743 5744// Create mouseenter/leave events using mouseover/out and event-time checks 5745// so that event delegation works in jQuery. 5746// Do the same for pointerenter/pointerleave and pointerover/pointerout 5747// 5748// Support: Safari 7 only 5749// Safari sends mouseenter too often; see: 5750// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 5751// for the description of the bug (it existed in older Chrome versions as well). 5752jQuery.each( { 5753 mouseenter: "mouseover", 5754 mouseleave: "mouseout", 5755 pointerenter: "pointerover", 5756 pointerleave: "pointerout" 5757}, function( orig, fix ) { 5758 jQuery.event.special[ orig ] = { 5759 delegateType: fix, 5760 bindType: fix, 5761 5762 handle: function( event ) { 5763 var ret, 5764 target = this, 5765 related = event.relatedTarget, 5766 handleObj = event.handleObj; 5767 5768 // For mouseenter/leave call the handler if related is outside the target. 5769 // NB: No relatedTarget if the mouse left/entered the browser window 5770 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 5771 event.type = handleObj.origType; 5772 ret = handleObj.handler.apply( this, arguments ); 5773 event.type = fix; 5774 } 5775 return ret; 5776 } 5777 }; 5778} ); 5779 5780jQuery.fn.extend( { 5781 5782 on: function( types, selector, data, fn ) { 5783 return on( this, types, selector, data, fn ); 5784 }, 5785 one: function( types, selector, data, fn ) { 5786 return on( this, types, selector, data, fn, 1 ); 5787 }, 5788 off: function( types, selector, fn ) { 5789 var handleObj, type; 5790 if ( types && types.preventDefault && types.handleObj ) { 5791 5792 // ( event ) dispatched jQuery.Event 5793 handleObj = types.handleObj; 5794 jQuery( types.delegateTarget ).off( 5795 handleObj.namespace ? 5796 handleObj.origType + "." + handleObj.namespace : 5797 handleObj.origType, 5798 handleObj.selector, 5799 handleObj.handler 5800 ); 5801 return this; 5802 } 5803 if ( typeof types === "object" ) { 5804 5805 // ( types-object [, selector] ) 5806 for ( type in types ) { 5807 this.off( type, selector, types[ type ] ); 5808 } 5809 return this; 5810 } 5811 if ( selector === false || typeof selector === "function" ) { 5812 5813 // ( types [, fn] ) 5814 fn = selector; 5815 selector = undefined; 5816 } 5817 if ( fn === false ) { 5818 fn = returnFalse; 5819 } 5820 return this.each( function() { 5821 jQuery.event.remove( this, types, fn, selector ); 5822 } ); 5823 } 5824} ); 5825 5826 5827var 5828 5829 // Support: IE <=10 - 11, Edge 12 - 13 only 5830 // In IE/Edge using regex groups here causes severe slowdowns. 5831 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 5832 rnoInnerhtml = /<script|<style|<link/i, 5833 5834 // checked="checked" or checked 5835 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5836 5837 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 5838 5839// Prefer a tbody over its parent table for containing new rows 5840function manipulationTarget( elem, content ) { 5841 if ( nodeName( elem, "table" ) && 5842 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 5843 5844 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 5845 } 5846 5847 return elem; 5848} 5849 5850// Replace/restore the type attribute of script elements for safe DOM manipulation 5851function disableScript( elem ) { 5852 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 5853 return elem; 5854} 5855function restoreScript( elem ) { 5856 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 5857 elem.type = elem.type.slice( 5 ); 5858 } else { 5859 elem.removeAttribute( "type" ); 5860 } 5861 5862 return elem; 5863} 5864 5865function cloneCopyEvent( src, dest ) { 5866 var i, l, type, pdataOld, udataOld, udataCur, events; 5867 5868 if ( dest.nodeType !== 1 ) { 5869 return; 5870 } 5871 5872 // 1. Copy private data: events, handlers, etc. 5873 if ( dataPriv.hasData( src ) ) { 5874 pdataOld = dataPriv.get( src ); 5875 events = pdataOld.events; 5876 5877 if ( events ) { 5878 dataPriv.remove( dest, "handle events" ); 5879 5880 for ( type in events ) { 5881 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 5882 jQuery.event.add( dest, type, events[ type ][ i ] ); 5883 } 5884 } 5885 } 5886 } 5887 5888 // 2. Copy user data 5889 if ( dataUser.hasData( src ) ) { 5890 udataOld = dataUser.access( src ); 5891 udataCur = jQuery.extend( {}, udataOld ); 5892 5893 dataUser.set( dest, udataCur ); 5894 } 5895} 5896 5897// Fix IE bugs, see support tests 5898function fixInput( src, dest ) { 5899 var nodeName = dest.nodeName.toLowerCase(); 5900 5901 // Fails to persist the checked state of a cloned checkbox or radio button. 5902 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 5903 dest.checked = src.checked; 5904 5905 // Fails to return the selected option to the default selected state when cloning options 5906 } else if ( nodeName === "input" || nodeName === "textarea" ) { 5907 dest.defaultValue = src.defaultValue; 5908 } 5909} 5910 5911function domManip( collection, args, callback, ignored ) { 5912 5913 // Flatten any nested arrays 5914 args = flat( args ); 5915 5916 var fragment, first, scripts, hasScripts, node, doc, 5917 i = 0, 5918 l = collection.length, 5919 iNoClone = l - 1, 5920 value = args[ 0 ], 5921 valueIsFunction = isFunction( value ); 5922 5923 // We can't cloneNode fragments that contain checked, in WebKit 5924 if ( valueIsFunction || 5925 ( l > 1 && typeof value === "string" && 5926 !support.checkClone && rchecked.test( value ) ) ) { 5927 return collection.each( function( index ) { 5928 var self = collection.eq( index ); 5929 if ( valueIsFunction ) { 5930 args[ 0 ] = value.call( this, index, self.html() ); 5931 } 5932 domManip( self, args, callback, ignored ); 5933 } ); 5934 } 5935 5936 if ( l ) { 5937 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 5938 first = fragment.firstChild; 5939 5940 if ( fragment.childNodes.length === 1 ) { 5941 fragment = first; 5942 } 5943 5944 // Require either new content or an interest in ignored elements to invoke the callback 5945 if ( first || ignored ) { 5946 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 5947 hasScripts = scripts.length; 5948 5949 // Use the original fragment for the last item 5950 // instead of the first because it can end up 5951 // being emptied incorrectly in certain situations (trac-8070). 5952 for ( ; i < l; i++ ) { 5953 node = fragment; 5954 5955 if ( i !== iNoClone ) { 5956 node = jQuery.clone( node, true, true ); 5957 5958 // Keep references to cloned scripts for later restoration 5959 if ( hasScripts ) { 5960 5961 // Support: Android <=4.0 only, PhantomJS 1 only 5962 // push.apply(_, arraylike) throws on ancient WebKit 5963 jQuery.merge( scripts, getAll( node, "script" ) ); 5964 } 5965 } 5966 5967 callback.call( collection[ i ], node, i ); 5968 } 5969 5970 if ( hasScripts ) { 5971 doc = scripts[ scripts.length - 1 ].ownerDocument; 5972 5973 // Re-enable scripts 5974 jQuery.map( scripts, restoreScript ); 5975 5976 // Evaluate executable scripts on first document insertion 5977 for ( i = 0; i < hasScripts; i++ ) { 5978 node = scripts[ i ]; 5979 if ( rscriptType.test( node.type || "" ) && 5980 !dataPriv.access( node, "globalEval" ) && 5981 jQuery.contains( doc, node ) ) { 5982 5983 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 5984 5985 // Optional AJAX dependency, but won't run scripts if not present 5986 if ( jQuery._evalUrl && !node.noModule ) { 5987 jQuery._evalUrl( node.src, { 5988 nonce: node.nonce || node.getAttribute( "nonce" ) 5989 }, doc ); 5990 } 5991 } else { 5992 5993 // Unwrap a CDATA section containing script contents. This shouldn't be 5994 // needed as in XML documents they're already not visible when 5995 // inspecting element contents and in HTML documents they have no 5996 // meaning but we're preserving that logic for backwards compatibility. 5997 // This will be removed completely in 4.0. See gh-4904. 5998 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 5999 } 6000 } 6001 } 6002 } 6003 } 6004 } 6005 6006 return collection; 6007} 6008 6009function remove( elem, selector, keepData ) { 6010 var node, 6011 nodes = selector ? jQuery.filter( selector, elem ) : elem, 6012 i = 0; 6013 6014 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 6015 if ( !keepData && node.nodeType === 1 ) { 6016 jQuery.cleanData( getAll( node ) ); 6017 } 6018 6019 if ( node.parentNode ) { 6020 if ( keepData && isAttached( node ) ) { 6021 setGlobalEval( getAll( node, "script" ) ); 6022 } 6023 node.parentNode.removeChild( node ); 6024 } 6025 } 6026 6027 return elem; 6028} 6029 6030jQuery.extend( { 6031 htmlPrefilter: function( html ) { 6032 return html; 6033 }, 6034 6035 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 6036 var i, l, srcElements, destElements, 6037 clone = elem.cloneNode( true ), 6038 inPage = isAttached( elem ); 6039 6040 // Fix IE cloning issues 6041 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 6042 !jQuery.isXMLDoc( elem ) ) { 6043 6044 // We eschew jQuery#find here for performance reasons: 6045 // https://jsperf.com/getall-vs-sizzle/2 6046 destElements = getAll( clone ); 6047 srcElements = getAll( elem ); 6048 6049 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6050 fixInput( srcElements[ i ], destElements[ i ] ); 6051 } 6052 } 6053 6054 // Copy the events from the original to the clone 6055 if ( dataAndEvents ) { 6056 if ( deepDataAndEvents ) { 6057 srcElements = srcElements || getAll( elem ); 6058 destElements = destElements || getAll( clone ); 6059 6060 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6061 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 6062 } 6063 } else { 6064 cloneCopyEvent( elem, clone ); 6065 } 6066 } 6067 6068 // Preserve script evaluation history 6069 destElements = getAll( clone, "script" ); 6070 if ( destElements.length > 0 ) { 6071 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 6072 } 6073 6074 // Return the cloned set 6075 return clone; 6076 }, 6077 6078 cleanData: function( elems ) { 6079 var data, elem, type, 6080 special = jQuery.event.special, 6081 i = 0; 6082 6083 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 6084 if ( acceptData( elem ) ) { 6085 if ( ( data = elem[ dataPriv.expando ] ) ) { 6086 if ( data.events ) { 6087 for ( type in data.events ) { 6088 if ( special[ type ] ) { 6089 jQuery.event.remove( elem, type ); 6090 6091 // This is a shortcut to avoid jQuery.event.remove's overhead 6092 } else { 6093 jQuery.removeEvent( elem, type, data.handle ); 6094 } 6095 } 6096 } 6097
vendor: 4,139 bytes, lines 6098-6262
6098 // Support: Chrome <=35 - 45+ 6099 // Assign undefined instead of using delete, see Data#remove 6100 elem[ dataPriv.expando ] = undefined; 6101 } 6102 if ( elem[ dataUser.expando ] ) { 6103 6104 // Support: Chrome <=35 - 45+ 6105 // Assign undefined instead of using delete, see Data#remove 6106 elem[ dataUser.expando ] = undefined; 6107 } 6108 } 6109 } 6110 } 6111} ); 6112 6113jQuery.fn.extend( { 6114 detach: function( selector ) { 6115 return remove( this, selector, true ); 6116 }, 6117 6118 remove: function( selector ) { 6119 return remove( this, selector ); 6120 }, 6121 6122 text: function( value ) { 6123 return access( this, function( value ) { 6124 return value === undefined ? 6125 jQuery.text( this ) : 6126 this.empty().each( function() { 6127 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6128 this.textContent = value; 6129 } 6130 } ); 6131 }, null, value, arguments.length ); 6132 }, 6133 6134 append: function() { 6135 return domManip( this, arguments, function( elem ) { 6136 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6137 var target = manipulationTarget( this, elem ); 6138 target.appendChild( elem ); 6139 } 6140 } ); 6141 }, 6142 6143 prepend: function() { 6144 return domManip( this, arguments, function( elem ) { 6145 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6146 var target = manipulationTarget( this, elem ); 6147 target.insertBefore( elem, target.firstChild ); 6148 } 6149 } ); 6150 }, 6151 6152 before: function() { 6153 return domManip( this, arguments, function( elem ) { 6154 if ( this.parentNode ) { 6155 this.parentNode.insertBefore( elem, this ); 6156 } 6157 } ); 6158 }, 6159 6160 after: function() { 6161 return domManip( this, arguments, function( elem ) { 6162 if ( this.parentNode ) { 6163 this.parentNode.insertBefore( elem, this.nextSibling ); 6164 } 6165 } ); 6166 }, 6167 6168 empty: function() { 6169 var elem, 6170 i = 0; 6171 6172 for ( ; ( elem = this[ i ] ) != null; i++ ) { 6173 if ( elem.nodeType === 1 ) { 6174 6175 // Prevent memory leaks 6176 jQuery.cleanData( getAll( elem, false ) ); 6177 6178 // Remove any remaining nodes 6179 elem.textContent = ""; 6180 } 6181 } 6182 6183 return this; 6184 }, 6185 6186 clone: function( dataAndEvents, deepDataAndEvents ) { 6187 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6188 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6189 6190 return this.map( function() { 6191 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 6192 } ); 6193 }, 6194 6195 html: function( value ) { 6196 return access( this, function( value ) { 6197 var elem = this[ 0 ] || {}, 6198 i = 0, 6199 l = this.length; 6200 6201 if ( value === undefined && elem.nodeType === 1 ) { 6202 return elem.innerHTML; 6203 } 6204 6205 // See if we can take a shortcut and just use innerHTML 6206 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 6207 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 6208 6209 value = jQuery.htmlPrefilter( value ); 6210 6211 try { 6212 for ( ; i < l; i++ ) { 6213 elem = this[ i ] || {}; 6214 6215 // Remove element nodes and prevent memory leaks 6216 if ( elem.nodeType === 1 ) { 6217 jQuery.cleanData( getAll( elem, false ) ); 6218 elem.innerHTML = value; 6219 } 6220 } 6221 6222 elem = 0; 6223 6224 // If using innerHTML throws an exception, use the fallback method 6225 } catch ( e ) {} 6226 } 6227 6228 if ( elem ) { 6229 this.empty().append( value ); 6230 } 6231 }, null, value, arguments.length ); 6232 }, 6233 6234 replaceWith: function() { 6235 var ignored = []; 6236 6237 // Make the changes, replacing each non-ignored context element with the new content 6238 return domManip( this, arguments, function( elem ) { 6239 var parent = this.parentNode; 6240 6241 if ( jQuery.inArray( this, ignored ) < 0 ) { 6242 jQuery.cleanData( getAll( this ) ); 6243 if ( parent ) { 6244 parent.replaceChild( elem, this ); 6245 } 6246 } 6247 6248 // Force callback invocation 6249 }, ignored ); 6250 } 6251} ); 6252 6253jQuery.each( { 6254 appendTo: "append", 6255 prependTo: "prepend", 6256 insertBefore: "before", 6257 insertAfter: "after", 6258 replaceAll: "replaceWith" 6259}, function( name, original ) { 6260 jQuery.fn[ name ] = function( selector ) { 6261 var elems, 6262 ret = [],
vendor: 31,588 bytes, lines 6263-7325
6263 insert = jQuery( selector ), 6264 last = insert.length - 1, 6265 i = 0; 6266 6267 for ( ; i <= last; i++ ) { 6268 elems = i === last ? this : this.clone( true ); 6269 jQuery( insert[ i ] )[ original ]( elems ); 6270 6271 // Support: Android <=4.0 only, PhantomJS 1 only 6272 // .get() because push.apply(_, arraylike) throws on ancient WebKit 6273 push.apply( ret, elems.get() ); 6274 } 6275 6276 return this.pushStack( ret ); 6277 }; 6278} ); 6279var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6280 6281var rcustomProp = /^--/; 6282 6283 6284var getStyles = function( elem ) { 6285 6286 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) 6287 // IE throws on elements created in popups 6288 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6289 var view = elem.ownerDocument.defaultView; 6290 6291 if ( !view || !view.opener ) { 6292 view = window; 6293 } 6294 6295 return view.getComputedStyle( elem ); 6296 }; 6297 6298var swap = function( elem, options, callback ) { 6299 var ret, name, 6300 old = {}; 6301 6302 // Remember the old values, and insert the new ones 6303 for ( name in options ) { 6304 old[ name ] = elem.style[ name ]; 6305 elem.style[ name ] = options[ name ]; 6306 } 6307 6308 ret = callback.call( elem ); 6309 6310 // Revert the old values 6311 for ( name in options ) { 6312 elem.style[ name ] = old[ name ]; 6313 } 6314 6315 return ret; 6316}; 6317 6318 6319var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 6320 6321 6322 6323( function() { 6324 6325 // Executing both pixelPosition & boxSizingReliable tests require only one layout 6326 // so they're executed at the same time to save the second computation. 6327 function computeStyleTests() { 6328 6329 // This is a singleton, we need to execute it only once 6330 if ( !div ) { 6331 return; 6332 } 6333 6334 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 6335 "margin-top:1px;padding:0;border:0"; 6336 div.style.cssText = 6337 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 6338 "margin:auto;border:1px;padding:1px;" + 6339 "width:60%;top:1%"; 6340 documentElement.appendChild( container ).appendChild( div ); 6341 6342 var divStyle = window.getComputedStyle( div ); 6343 pixelPositionVal = divStyle.top !== "1%"; 6344 6345 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 6346 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 6347 6348 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 6349 // Some styles come back with percentage values, even though they shouldn't 6350 div.style.right = "60%"; 6351 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 6352 6353 // Support: IE 9 - 11 only 6354 // Detect misreporting of content dimensions for box-sizing:border-box elements 6355 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 6356 6357 // Support: IE 9 only 6358 // Detect overflow:scroll screwiness (gh-3699) 6359 // Support: Chrome <=64 6360 // Don't get tricked when zoom affects offsetWidth (gh-4029) 6361 div.style.position = "absolute"; 6362 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 6363 6364 documentElement.removeChild( container ); 6365 6366 // Nullify the div so it wouldn't be stored in the memory and 6367 // it will also be a sign that checks already performed 6368 div = null; 6369 } 6370 6371 function roundPixelMeasures( measure ) { 6372 return Math.round( parseFloat( measure ) ); 6373 } 6374 6375 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 6376 reliableTrDimensionsVal, reliableMarginLeftVal, 6377 container = document.createElement( "div" ), 6378 div = document.createElement( "div" ); 6379 6380 // Finish early in limited (non-browser) environments 6381 if ( !div.style ) { 6382 return; 6383 } 6384 6385 // Support: IE <=9 - 11 only 6386 // Style of cloned element affects source element cloned (trac-8908) 6387 div.style.backgroundClip = "content-box"; 6388 div.cloneNode( true ).style.backgroundClip = ""; 6389 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6390 6391 jQuery.extend( support, { 6392 boxSizingReliable: function() { 6393 computeStyleTests(); 6394 return boxSizingReliableVal; 6395 }, 6396 pixelBoxStyles: function() { 6397 computeStyleTests(); 6398 return pixelBoxStylesVal; 6399 }, 6400 pixelPosition: function() { 6401 computeStyleTests(); 6402 return pixelPositionVal; 6403 }, 6404 reliableMarginLeft: function() { 6405 computeStyleTests(); 6406 return reliableMarginLeftVal; 6407 }, 6408 scrollboxSize: function() { 6409 computeStyleTests(); 6410 return scrollboxSizeVal; 6411 }, 6412 6413 // Support: IE 9 - 11+, Edge 15 - 18+ 6414 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6415 // set in CSS while `offset*` properties report correct values. 6416 // Behavior in IE 9 is more subtle than in newer versions & it passes 6417 // some versions of this test; make sure not to make it pass there! 6418 // 6419 // Support: Firefox 70+ 6420 // Only Firefox includes border widths 6421 // in computed dimensions. (gh-4529) 6422 reliableTrDimensions: function() { 6423 var table, tr, trChild, trStyle; 6424 if ( reliableTrDimensionsVal == null ) { 6425 table = document.createElement( "table" ); 6426 tr = document.createElement( "tr" ); 6427 trChild = document.createElement( "div" ); 6428 6429 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 6430 tr.style.cssText = "box-sizing:content-box;border:1px solid"; 6431 6432 // Support: Chrome 86+ 6433 // Height set through cssText does not get applied. 6434 // Computed height then comes back as 0. 6435 tr.style.height = "1px"; 6436 trChild.style.height = "9px"; 6437 6438 // Support: Android 8 Chrome 86+ 6439 // In our bodyBackground.html iframe, 6440 // display for all div elements is set to "inline", 6441 // which causes a problem only in Android 8 Chrome 86. 6442 // Ensuring the div is `display: block` 6443 // gets around this issue. 6444 trChild.style.display = "block"; 6445 6446 documentElement 6447 .appendChild( table ) 6448 .appendChild( tr ) 6449 .appendChild( trChild ); 6450 6451 trStyle = window.getComputedStyle( tr ); 6452 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + 6453 parseInt( trStyle.borderTopWidth, 10 ) + 6454 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; 6455 6456 documentElement.removeChild( table ); 6457 } 6458 return reliableTrDimensionsVal; 6459 } 6460 } ); 6461} )(); 6462 6463 6464function curCSS( elem, name, computed ) { 6465 var width, minWidth, maxWidth, ret, 6466 isCustomProp = rcustomProp.test( name ), 6467 6468 // Support: Firefox 51+ 6469 // Retrieving style before computed somehow 6470 // fixes an issue with getting wrong values 6471 // on detached elements 6472 style = elem.style; 6473 6474 computed = computed || getStyles( elem ); 6475 6476 // getPropertyValue is needed for: 6477 // .css('filter') (IE 9 only, trac-12537) 6478 // .css('--customProperty) (gh-3144) 6479 if ( computed ) { 6480 6481 // Support: IE <=9 - 11+ 6482 // IE only supports `"float"` in `getPropertyValue`; in computed styles 6483 // it's only available as `"cssFloat"`. We no longer modify properties 6484 // sent to `.css()` apart from camelCasing, so we need to check both. 6485 // Normally, this would create difference in behavior: if 6486 // `getPropertyValue` returns an empty string, the value returned 6487 // by `.css()` would be `undefined`. This is usually the case for 6488 // disconnected elements. However, in IE even disconnected elements 6489 // with no styles return `"none"` for `getPropertyValue( "float" )` 6490 ret = computed.getPropertyValue( name ) || computed[ name ]; 6491 6492 if ( isCustomProp && ret ) { 6493 6494 // Support: Firefox 105+, Chrome <=105+ 6495 // Spec requires trimming whitespace for custom properties (gh-4926). 6496 // Firefox only trims leading whitespace. Chrome just collapses 6497 // both leading & trailing whitespace to a single space. 6498 // 6499 // Fall back to `undefined` if empty string returned. 6500 // This collapses a missing definition with property defined 6501 // and set to an empty string but there's no standard API 6502 // allowing us to differentiate them without a performance penalty 6503 // and returning `undefined` aligns with older jQuery. 6504 // 6505 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED 6506 // as whitespace while CSS does not, but this is not a problem 6507 // because CSS preprocessing replaces them with U+000A LINE FEED 6508 // (which *is* CSS whitespace) 6509 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing 6510 ret = ret.replace( rtrimCSS, "$1" ) || undefined; 6511 } 6512 6513 if ( ret === "" && !isAttached( elem ) ) { 6514 ret = jQuery.style( elem, name ); 6515 } 6516 6517 // A tribute to the "awesome hack by Dean Edwards" 6518 // Android Browser returns percentage for some values, 6519 // but width seems to be reliably pixels. 6520 // This is against the CSSOM draft spec: 6521 // https://drafts.csswg.org/cssom/#resolved-values 6522 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 6523 6524 // Remember the original values 6525 width = style.width; 6526 minWidth = style.minWidth; 6527 maxWidth = style.maxWidth; 6528 6529 // Put in the new values to get a computed value out 6530 style.minWidth = style.maxWidth = style.width = ret; 6531 ret = computed.width; 6532 6533 // Revert the changed values 6534 style.width = width; 6535 style.minWidth = minWidth; 6536 style.maxWidth = maxWidth; 6537 } 6538 } 6539 6540 return ret !== undefined ? 6541 6542 // Support: IE <=9 - 11 only 6543 // IE returns zIndex value as an integer. 6544 ret + "" : 6545 ret; 6546} 6547 6548 6549function addGetHookIf( conditionFn, hookFn ) { 6550 6551 // Define the hook, we'll check on the first run if it's really needed. 6552 return { 6553 get: function() { 6554 if ( conditionFn() ) { 6555 6556 // Hook not needed (or it's not possible to use it due 6557 // to missing dependency), remove it. 6558 delete this.get; 6559 return; 6560 } 6561 6562 // Hook needed; redefine it so that the support test is not executed again. 6563 return ( this.get = hookFn ).apply( this, arguments ); 6564 } 6565 }; 6566} 6567 6568 6569var cssPrefixes = [ "Webkit", "Moz", "ms" ], 6570 emptyStyle = document.createElement( "div" ).style, 6571 vendorProps = {}; 6572 6573// Return a vendor-prefixed property or undefined 6574function vendorPropName( name ) { 6575 6576 // Check for vendor prefixed names 6577 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 6578 i = cssPrefixes.length; 6579 6580 while ( i-- ) { 6581 name = cssPrefixes[ i ] + capName; 6582 if ( name in emptyStyle ) { 6583 return name; 6584 } 6585 } 6586} 6587 6588// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 6589function finalPropName( name ) { 6590 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 6591 6592 if ( final ) { 6593 return final; 6594 } 6595 if ( name in emptyStyle ) { 6596 return name; 6597 } 6598 return vendorProps[ name ] = vendorPropName( name ) || name; 6599} 6600 6601 6602var 6603 6604 // Swappable if display is none or starts with table 6605 // except "table", "table-cell", or "table-caption" 6606 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6607 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6608 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6609 cssNormalTransform = { 6610 letterSpacing: "0", 6611 fontWeight: "400" 6612 }; 6613 6614function setPositiveNumber( _elem, value, subtract ) { 6615 6616 // Any relative (+/-) values have already been 6617 // normalized at this point 6618 var matches = rcssNum.exec( value ); 6619 return matches ? 6620 6621 // Guard against undefined "subtract", e.g., when used as in cssHooks 6622 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 6623 value; 6624} 6625 6626function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 6627 var i = dimension === "width" ? 1 : 0, 6628 extra = 0, 6629 delta = 0, 6630 marginDelta = 0; 6631 6632 // Adjustment may not be necessary 6633 if ( box === ( isBorderBox ? "border" : "content" ) ) { 6634 return 0; 6635 } 6636 6637 for ( ; i < 4; i += 2 ) { 6638 6639 // Both box models exclude margin 6640 // Count margin delta separately to only add it after scroll gutter adjustment. 6641 // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). 6642 if ( box === "margin" ) { 6643 marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 6644 } 6645 6646 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 6647 if ( !isBorderBox ) { 6648 6649 // Add padding 6650 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6651 6652 // For "border" or "margin", add border 6653 if ( box !== "padding" ) { 6654 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6655 6656 // But still keep track of it otherwise 6657 } else { 6658 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6659 } 6660 6661 // If we get here with a border-box (content + padding + border), we're seeking "content" or 6662 // "padding" or "margin" 6663 } else { 6664 6665 // For "content", subtract padding 6666 if ( box === "content" ) { 6667 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6668 } 6669 6670 // For "content" or "padding", subtract border 6671 if ( box !== "margin" ) { 6672 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6673 } 6674 } 6675 } 6676 6677 // Account for positive content-box scroll gutter when requested by providing computedVal 6678 if ( !isBorderBox && computedVal >= 0 ) { 6679 6680 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 6681 // Assuming integer scroll gutter, subtract the rest and round down 6682 delta += Math.max( 0, Math.ceil( 6683 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6684 computedVal - 6685 delta - 6686 extra - 6687 0.5 6688 6689 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 6690 // Use an explicit zero to avoid NaN (gh-3964) 6691 ) ) || 0; 6692 } 6693 6694 return delta + marginDelta; 6695} 6696 6697function getWidthOrHeight( elem, dimension, extra ) { 6698 6699 // Start with computed style 6700 var styles = getStyles( elem ), 6701 6702 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 6703 // Fake content-box until we know it's needed to know the true value. 6704 boxSizingNeeded = !support.boxSizingReliable() || extra, 6705 isBorderBox = boxSizingNeeded && 6706 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6707 valueIsBorderBox = isBorderBox, 6708 6709 val = curCSS( elem, dimension, styles ), 6710 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 6711 6712 // Support: Firefox <=54 6713 // Return a confounding non-pixel value or feign ignorance, as appropriate. 6714 if ( rnumnonpx.test( val ) ) { 6715 if ( !extra ) { 6716 return val; 6717 } 6718 val = "auto"; 6719 } 6720 6721 6722 // Support: IE 9 - 11 only 6723 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 6724 // In those cases, the computed value can be trusted to be border-box. 6725 if ( ( !support.boxSizingReliable() && isBorderBox || 6726 6727 // Support: IE 10 - 11+, Edge 15 - 18+ 6728 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6729 // set in CSS while `offset*` properties report correct values. 6730 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 6731 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 6732 6733 // Fall back to offsetWidth/offsetHeight when value is "auto" 6734 // This happens for inline elements with no explicit setting (gh-3571) 6735 val === "auto" || 6736 6737 // Support: Android <=4.1 - 4.3 only 6738 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 6739 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 6740 6741 // Make sure the element is visible & connected 6742 elem.getClientRects().length ) { 6743 6744 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 6745 6746 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 6747 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 6748 // retrieved value as a content box dimension. 6749 valueIsBorderBox = offsetProp in elem; 6750 if ( valueIsBorderBox ) { 6751 val = elem[ offsetProp ]; 6752 } 6753 } 6754 6755 // Normalize "" and auto 6756 val = parseFloat( val ) || 0; 6757 6758 // Adjust for the element's box model 6759 return ( val + 6760 boxModelAdjustment( 6761 elem, 6762 dimension, 6763 extra || ( isBorderBox ? "border" : "content" ), 6764 valueIsBorderBox, 6765 styles, 6766 6767 // Provide the current computed size to request scroll gutter calculation (gh-3589) 6768 val 6769 ) 6770 ) + "px"; 6771} 6772 6773jQuery.extend( { 6774 6775 // Add in style property hooks for overriding the default 6776 // behavior of getting and setting a style property 6777 cssHooks: { 6778 opacity: { 6779 get: function( elem, computed ) { 6780 if ( computed ) { 6781 6782 // We should always get a number back from opacity 6783 var ret = curCSS( elem, "opacity" ); 6784 return ret === "" ? "1" : ret; 6785 } 6786 } 6787 } 6788 }, 6789 6790 // Don't automatically add "px" to these possibly-unitless properties 6791 cssNumber: { 6792 animationIterationCount: true, 6793 aspectRatio: true, 6794 borderImageSlice: true, 6795 columnCount: true, 6796 flexGrow: true, 6797 flexShrink: true, 6798 fontWeight: true, 6799 gridArea: true, 6800 gridColumn: true, 6801 gridColumnEnd: true, 6802 gridColumnStart: true, 6803 gridRow: true, 6804 gridRowEnd: true, 6805 gridRowStart: true, 6806 lineHeight: true, 6807 opacity: true, 6808 order: true, 6809 orphans: true, 6810 scale: true, 6811 widows: true, 6812 zIndex: true, 6813 zoom: true, 6814 6815 // SVG-related 6816 fillOpacity: true, 6817 floodOpacity: true, 6818 stopOpacity: true, 6819 strokeMiterlimit: true, 6820 strokeOpacity: true 6821 }, 6822 6823 // Add in properties whose names you wish to fix before 6824 // setting or getting the value 6825 cssProps: {}, 6826 6827 // Get and set the style property on a DOM Node 6828 style: function( elem, name, value, extra ) { 6829 6830 // Don't set styles on text and comment nodes 6831 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 6832 return; 6833 } 6834 6835 // Make sure that we're working with the right name 6836 var ret, type, hooks, 6837 origName = camelCase( name ), 6838 isCustomProp = rcustomProp.test( name ), 6839 style = elem.style; 6840 6841 // Make sure that we're working with the right name. We don't 6842 // want to query the value if it is a CSS custom property 6843 // since they are user-defined. 6844 if ( !isCustomProp ) { 6845 name = finalPropName( origName ); 6846 } 6847 6848 // Gets hook for the prefixed version, then unprefixed version 6849 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6850 6851 // Check if we're setting a value 6852 if ( value !== undefined ) { 6853 type = typeof value; 6854 6855 // Convert "+=" or "-=" to relative numbers (trac-7345) 6856 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 6857 value = adjustCSS( elem, name, ret ); 6858 6859 // Fixes bug trac-9237 6860 type = "number"; 6861 } 6862 6863 // Make sure that null and NaN values aren't set (trac-7116) 6864 if ( value == null || value !== value ) { 6865 return; 6866 } 6867 6868 // If a number was passed in, add the unit (except for certain CSS properties) 6869 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 6870 // "px" to a few hardcoded values. 6871 if ( type === "number" && !isCustomProp ) { 6872 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 6873 } 6874 6875 // background-* props affect original clone's values 6876 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 6877 style[ name ] = "inherit"; 6878 } 6879 6880 // If a hook was provided, use that value, otherwise just set the specified value 6881 if ( !hooks || !( "set" in hooks ) || 6882 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 6883 6884 if ( isCustomProp ) { 6885 style.setProperty( name, value ); 6886 } else { 6887 style[ name ] = value; 6888 } 6889 } 6890 6891 } else { 6892 6893 // If a hook was provided get the non-computed value from there 6894 if ( hooks && "get" in hooks && 6895 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 6896 6897 return ret; 6898 } 6899 6900 // Otherwise just get the value from the style object 6901 return style[ name ]; 6902 } 6903 }, 6904 6905 css: function( elem, name, extra, styles ) { 6906 var val, num, hooks, 6907 origName = camelCase( name ), 6908 isCustomProp = rcustomProp.test( name ); 6909 6910 // Make sure that we're working with the right name. We don't 6911 // want to modify the value if it is a CSS custom property 6912 // since they are user-defined. 6913 if ( !isCustomProp ) { 6914 name = finalPropName( origName ); 6915 } 6916 6917 // Try prefixed name followed by the unprefixed name 6918 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6919 6920 // If a hook was provided get the computed value from there 6921 if ( hooks && "get" in hooks ) { 6922 val = hooks.get( elem, true, extra ); 6923 } 6924 6925 // Otherwise, if a way to get the computed value exists, use that 6926 if ( val === undefined ) { 6927 val = curCSS( elem, name, styles ); 6928 } 6929 6930 // Convert "normal" to computed value 6931 if ( val === "normal" && name in cssNormalTransform ) { 6932 val = cssNormalTransform[ name ]; 6933 } 6934 6935 // Make numeric if forced or a qualifier was provided and val looks numeric 6936 if ( extra === "" || extra ) { 6937 num = parseFloat( val ); 6938 return extra === true || isFinite( num ) ? num || 0 : val; 6939 } 6940 6941 return val; 6942 } 6943} ); 6944 6945jQuery.each( [ "height", "width" ], function( _i, dimension ) { 6946 jQuery.cssHooks[ dimension ] = { 6947 get: function( elem, computed, extra ) { 6948 if ( computed ) { 6949 6950 // Certain elements can have dimension info if we invisibly show them 6951 // but it must have a current display style that would benefit 6952 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 6953 6954 // Support: Safari 8+ 6955 // Table columns in Safari have non-zero offsetWidth & zero 6956 // getBoundingClientRect().width unless display is changed. 6957 // Support: IE <=11 only 6958 // Running getBoundingClientRect on a disconnected node 6959 // in IE throws an error. 6960 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 6961 swap( elem, cssShow, function() { 6962 return getWidthOrHeight( elem, dimension, extra ); 6963 } ) : 6964 getWidthOrHeight( elem, dimension, extra ); 6965 } 6966 }, 6967 6968 set: function( elem, value, extra ) { 6969 var matches, 6970 styles = getStyles( elem ), 6971 6972 // Only read styles.position if the test has a chance to fail 6973 // to avoid forcing a reflow. 6974 scrollboxSizeBuggy = !support.scrollboxSize() && 6975 styles.position === "absolute", 6976 6977 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 6978 boxSizingNeeded = scrollboxSizeBuggy || extra, 6979 isBorderBox = boxSizingNeeded && 6980 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6981 subtract = extra ? 6982 boxModelAdjustment( 6983 elem, 6984 dimension, 6985 extra, 6986 isBorderBox, 6987 styles 6988 ) : 6989 0; 6990 6991 // Account for unreliable border-box dimensions by comparing offset* to computed and 6992 // faking a content-box to get border and padding (gh-3699) 6993 if ( isBorderBox && scrollboxSizeBuggy ) { 6994 subtract -= Math.ceil( 6995 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6996 parseFloat( styles[ dimension ] ) - 6997 boxModelAdjustment( elem, dimension, "border", false, styles ) - 6998 0.5 6999 ); 7000 } 7001 7002 // Convert to pixels if value adjustment is needed 7003 if ( subtract && ( matches = rcssNum.exec( value ) ) && 7004 ( matches[ 3 ] || "px" ) !== "px" ) { 7005 7006 elem.style[ dimension ] = value; 7007 value = jQuery.css( elem, dimension ); 7008 } 7009 7010 return setPositiveNumber( elem, value, subtract ); 7011 } 7012 }; 7013} ); 7014 7015jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 7016 function( elem, computed ) { 7017 if ( computed ) { 7018 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 7019 elem.getBoundingClientRect().left - 7020 swap( elem, { marginLeft: 0 }, function() { 7021 return elem.getBoundingClientRect().left; 7022 } ) 7023 ) + "px"; 7024 } 7025 } 7026); 7027 7028// These hooks are used by animate to expand properties 7029jQuery.each( { 7030 margin: "", 7031 padding: "", 7032 border: "Width" 7033}, function( prefix, suffix ) { 7034 jQuery.cssHooks[ prefix + suffix ] = { 7035 expand: function( value ) { 7036 var i = 0, 7037 expanded = {}, 7038 7039 // Assumes a single number if not a string 7040 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 7041 7042 for ( ; i < 4; i++ ) { 7043 expanded[ prefix + cssExpand[ i ] + suffix ] = 7044 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 7045 } 7046 7047 return expanded; 7048 } 7049 }; 7050 7051 if ( prefix !== "margin" ) { 7052 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 7053 } 7054} ); 7055 7056jQuery.fn.extend( { 7057 css: function( name, value ) { 7058 return access( this, function( elem, name, value ) { 7059 var styles, len, 7060 map = {}, 7061 i = 0; 7062 7063 if ( Array.isArray( name ) ) { 7064 styles = getStyles( elem ); 7065 len = name.length; 7066 7067 for ( ; i < len; i++ ) { 7068 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 7069 } 7070 7071 return map; 7072 } 7073 7074 return value !== undefined ? 7075 jQuery.style( elem, name, value ) : 7076 jQuery.css( elem, name ); 7077 }, name, value, arguments.length > 1 ); 7078 } 7079} ); 7080 7081 7082function Tween( elem, options, prop, end, easing ) { 7083 return new Tween.prototype.init( elem, options, prop, end, easing ); 7084} 7085jQuery.Tween = Tween; 7086 7087Tween.prototype = { 7088 constructor: Tween, 7089 init: function( elem, options, prop, end, easing, unit ) { 7090 this.elem = elem; 7091 this.prop = prop; 7092 this.easing = easing || jQuery.easing._default; 7093 this.options = options; 7094 this.start = this.now = this.cur(); 7095 this.end = end; 7096 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 7097 }, 7098 cur: function() { 7099 var hooks = Tween.propHooks[ this.prop ]; 7100 7101 return hooks && hooks.get ? 7102 hooks.get( this ) : 7103 Tween.propHooks._default.get( this ); 7104 }, 7105 run: function( percent ) { 7106 var eased, 7107 hooks = Tween.propHooks[ this.prop ]; 7108 7109 if ( this.options.duration ) { 7110 this.pos = eased = jQuery.easing[ this.easing ]( 7111 percent, this.options.duration * percent, 0, 1, this.options.duration 7112 ); 7113 } else { 7114 this.pos = eased = percent; 7115 } 7116 this.now = ( this.end - this.start ) * eased + this.start; 7117 7118 if ( this.options.step ) { 7119 this.options.step.call( this.elem, this.now, this ); 7120 } 7121 7122 if ( hooks && hooks.set ) { 7123 hooks.set( this ); 7124 } else { 7125 Tween.propHooks._default.set( this ); 7126 } 7127 return this; 7128 } 7129}; 7130 7131Tween.prototype.init.prototype = Tween.prototype; 7132 7133Tween.propHooks = { 7134 _default: { 7135 get: function( tween ) { 7136 var result; 7137 7138 // Use a property on the element directly when it is not a DOM element, 7139 // or when there is no matching style property that exists. 7140 if ( tween.elem.nodeType !== 1 || 7141 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 7142 return tween.elem[ tween.prop ]; 7143 } 7144 7145 // Passing an empty string as a 3rd parameter to .css will automatically 7146 // attempt a parseFloat and fallback to a string if the parse fails. 7147 // Simple values such as "10px" are parsed to Float; 7148 // complex values such as "rotate(1rad)" are returned as-is. 7149 result = jQuery.css( tween.elem, tween.prop, "" ); 7150 7151 // Empty strings, null, undefined and "auto" are converted to 0. 7152 return !result || result === "auto" ? 0 : result; 7153 }, 7154 set: function( tween ) { 7155 7156 // Use step hook for back compat. 7157 // Use cssHook if its there. 7158 // Use .style if available and use plain properties where available. 7159 if ( jQuery.fx.step[ tween.prop ] ) { 7160 jQuery.fx.step[ tween.prop ]( tween ); 7161 } else if ( tween.elem.nodeType === 1 && ( 7162 jQuery.cssHooks[ tween.prop ] || 7163 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 7164 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 7165 } else { 7166 tween.elem[ tween.prop ] = tween.now; 7167 } 7168 } 7169 } 7170}; 7171 7172// Support: IE <=9 only 7173// Panic based approach to setting things on disconnected nodes 7174Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7175 set: function( tween ) { 7176 if ( tween.elem.nodeType && tween.elem.parentNode ) { 7177 tween.elem[ tween.prop ] = tween.now; 7178 } 7179 } 7180}; 7181 7182jQuery.easing = { 7183 linear: function( p ) { 7184 return p; 7185 }, 7186 swing: function( p ) { 7187 return 0.5 - Math.cos( p * Math.PI ) / 2; 7188 }, 7189 _default: "swing" 7190}; 7191 7192jQuery.fx = Tween.prototype.init; 7193 7194// Back compat <1.8 extension point 7195jQuery.fx.step = {}; 7196 7197 7198 7199 7200var 7201 fxNow, inProgress, 7202 rfxtypes = /^(?:toggle|show|hide)$/, 7203 rrun = /queueHooks$/; 7204 7205function schedule() { 7206 if ( inProgress ) { 7207 if ( document.hidden === false && window.requestAnimationFrame ) { 7208 window.requestAnimationFrame( schedule ); 7209 } else { 7210 window.setTimeout( schedule, jQuery.fx.interval ); 7211 } 7212 7213 jQuery.fx.tick(); 7214 } 7215} 7216 7217// Animations created synchronously will run synchronously 7218function createFxNow() { 7219 window.setTimeout( function() { 7220 fxNow = undefined; 7221 } ); 7222 return ( fxNow = Date.now() ); 7223} 7224 7225// Generate parameters to create a standard animation 7226function genFx( type, includeWidth ) { 7227 var which, 7228 i = 0, 7229 attrs = { height: type }; 7230 7231 // If we include width, step value is 1 to do all cssExpand values, 7232 // otherwise step value is 2 to skip over Left and Right 7233 includeWidth = includeWidth ? 1 : 0; 7234 for ( ; i < 4; i += 2 - includeWidth ) { 7235 which = cssExpand[ i ]; 7236 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 7237 } 7238 7239 if ( includeWidth ) { 7240 attrs.opacity = attrs.width = type; 7241 } 7242 7243 return attrs; 7244} 7245 7246function createTween( value, prop, animation ) { 7247 var tween, 7248 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 7249 index = 0, 7250 length = collection.length; 7251 for ( ; index < length; index++ ) { 7252 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 7253 7254 // We're done with this property 7255 return tween; 7256 } 7257 } 7258} 7259 7260function defaultPrefilter( elem, props, opts ) { 7261 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 7262 isBox = "width" in props || "height" in props, 7263 anim = this, 7264 orig = {}, 7265 style = elem.style, 7266 hidden = elem.nodeType && isHiddenWithinTree( elem ), 7267 dataShow = dataPriv.get( elem, "fxshow" ); 7268 7269 // Queue-skipping animations hijack the fx hooks 7270 if ( !opts.queue ) { 7271 hooks = jQuery._queueHooks( elem, "fx" ); 7272 if ( hooks.unqueued == null ) { 7273 hooks.unqueued = 0; 7274 oldfire = hooks.empty.fire; 7275 hooks.empty.fire = function() { 7276 if ( !hooks.unqueued ) { 7277 oldfire(); 7278 } 7279 }; 7280 } 7281 hooks.unqueued++; 7282 7283 anim.always( function() { 7284 7285 // Ensure the complete handler is called before this completes 7286 anim.always( function() { 7287 hooks.unqueued--; 7288 if ( !jQuery.queue( elem, "fx" ).length ) { 7289 hooks.empty.fire(); 7290 } 7291 } ); 7292 } ); 7293 } 7294 7295 // Detect show/hide animations 7296 for ( prop in props ) { 7297 value = props[ prop ]; 7298 if ( rfxtypes.test( value ) ) { 7299 delete props[ prop ]; 7300 toggle = toggle || value === "toggle"; 7301 if ( value === ( hidden ? "hide" : "show" ) ) { 7302 7303 // Pretend to be hidden if this is a "show" and 7304 // there is still data from a stopped show/hide 7305 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 7306 hidden = true; 7307 7308 // Ignore all other no-op show/hide data 7309 } else { 7310 continue; 7311 } 7312 } 7313 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 7314 } 7315 } 7316 7317 // Bail out if this is a no-op like .hide().hide() 7318 propTween = !jQuery.isEmptyObject( props ); 7319 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 7320 return; 7321 } 7322 7323 // Restrict "overflow" and "display" styles during box animations 7324 if ( isBox && elem.nodeType === 1 ) { 7325
vendor: 4,381 bytes, lines 7326-7485
7326 // Support: IE <=9 - 11, Edge 12 - 15 7327 // Record all 3 overflow attributes because IE does not infer the shorthand 7328 // from identically-valued overflowX and overflowY and Edge just mirrors 7329 // the overflowX value there. 7330 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 7331 7332 // Identify a display type, preferring old show/hide data over the CSS cascade 7333 restoreDisplay = dataShow && dataShow.display; 7334 if ( restoreDisplay == null ) { 7335 restoreDisplay = dataPriv.get( elem, "display" ); 7336 } 7337 display = jQuery.css( elem, "display" ); 7338 if ( display === "none" ) { 7339 if ( restoreDisplay ) { 7340 display = restoreDisplay; 7341 } else { 7342 7343 // Get nonempty value(s) by temporarily forcing visibility 7344 showHide( [ elem ], true ); 7345 restoreDisplay = elem.style.display || restoreDisplay; 7346 display = jQuery.css( elem, "display" ); 7347 showHide( [ elem ] ); 7348 } 7349 } 7350 7351 // Animate inline elements as inline-block 7352 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 7353 if ( jQuery.css( elem, "float" ) === "none" ) { 7354 7355 // Restore the original display value at the end of pure show/hide animations 7356 if ( !propTween ) { 7357 anim.done( function() { 7358 style.display = restoreDisplay; 7359 } ); 7360 if ( restoreDisplay == null ) { 7361 display = style.display; 7362 restoreDisplay = display === "none" ? "" : display; 7363 } 7364 } 7365 style.display = "inline-block"; 7366 } 7367 } 7368 } 7369 7370 if ( opts.overflow ) { 7371 style.overflow = "hidden"; 7372 anim.always( function() { 7373 style.overflow = opts.overflow[ 0 ]; 7374 style.overflowX = opts.overflow[ 1 ]; 7375 style.overflowY = opts.overflow[ 2 ]; 7376 } ); 7377 } 7378 7379 // Implement show/hide animations 7380 propTween = false; 7381 for ( prop in orig ) { 7382 7383 // General show/hide setup for this element animation 7384 if ( !propTween ) { 7385 if ( dataShow ) { 7386 if ( "hidden" in dataShow ) { 7387 hidden = dataShow.hidden; 7388 } 7389 } else { 7390 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 7391 } 7392 7393 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 7394 if ( toggle ) { 7395 dataShow.hidden = !hidden; 7396 } 7397 7398 // Show elements before animating them 7399 if ( hidden ) { 7400 showHide( [ elem ], true ); 7401 } 7402 7403 /* eslint-disable no-loop-func */ 7404 7405 anim.done( function() { 7406 7407 /* eslint-enable no-loop-func */ 7408 7409 // The final step of a "hide" animation is actually hiding the element 7410 if ( !hidden ) { 7411 showHide( [ elem ] ); 7412 } 7413 dataPriv.remove( elem, "fxshow" ); 7414 for ( prop in orig ) { 7415 jQuery.style( elem, prop, orig[ prop ] ); 7416 } 7417 } ); 7418 } 7419 7420 // Per-property setup 7421 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7422 if ( !( prop in dataShow ) ) { 7423 dataShow[ prop ] = propTween.start; 7424 if ( hidden ) { 7425 propTween.end = propTween.start; 7426 propTween.start = 0; 7427 } 7428 } 7429 } 7430} 7431 7432function propFilter( props, specialEasing ) { 7433 var index, name, easing, value, hooks; 7434 7435 // camelCase, specialEasing and expand cssHook pass 7436 for ( index in props ) { 7437 name = camelCase( index ); 7438 easing = specialEasing[ name ]; 7439 value = props[ index ]; 7440 if ( Array.isArray( value ) ) { 7441 easing = value[ 1 ]; 7442 value = props[ index ] = value[ 0 ]; 7443 } 7444 7445 if ( index !== name ) { 7446 props[ name ] = value; 7447 delete props[ index ]; 7448 } 7449 7450 hooks = jQuery.cssHooks[ name ]; 7451 if ( hooks && "expand" in hooks ) { 7452 value = hooks.expand( value ); 7453 delete props[ name ]; 7454 7455 // Not quite $.extend, this won't overwrite existing keys. 7456 // Reusing 'index' because we have the correct "name" 7457 for ( index in value ) { 7458 if ( !( index in props ) ) { 7459 props[ index ] = value[ index ]; 7460 specialEasing[ index ] = easing; 7461 } 7462 } 7463 } else { 7464 specialEasing[ name ] = easing; 7465 } 7466 } 7467} 7468 7469function Animation( elem, properties, options ) { 7470 var result, 7471 stopped, 7472 index = 0, 7473 length = Animation.prefilters.length, 7474 deferred = jQuery.Deferred().always( function() { 7475 7476 // Don't match elem in the :animated selector 7477 delete tick.elem; 7478 } ), 7479 tick = function() { 7480 if ( stopped ) { 7481 return false; 7482 } 7483 var currentTime = fxNow || createFxNow(), 7484 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7485
vendor: 39,713 bytes, lines 7486-9036
7486 // Support: Android 2.3 only 7487 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) 7488 temp = remaining / animation.duration || 0, 7489 percent = 1 - temp, 7490 index = 0, 7491 length = animation.tweens.length; 7492 7493 for ( ; index < length; index++ ) { 7494 animation.tweens[ index ].run( percent ); 7495 } 7496 7497 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 7498 7499 // If there's more to do, yield 7500 if ( percent < 1 && length ) { 7501 return remaining; 7502 } 7503 7504 // If this was an empty animation, synthesize a final progress notification 7505 if ( !length ) { 7506 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7507 } 7508 7509 // Resolve the animation and report its conclusion 7510 deferred.resolveWith( elem, [ animation ] ); 7511 return false; 7512 }, 7513 animation = deferred.promise( { 7514 elem: elem, 7515 props: jQuery.extend( {}, properties ), 7516 opts: jQuery.extend( true, { 7517 specialEasing: {}, 7518 easing: jQuery.easing._default 7519 }, options ), 7520 originalProperties: properties, 7521 originalOptions: options, 7522 startTime: fxNow || createFxNow(), 7523 duration: options.duration, 7524 tweens: [], 7525 createTween: function( prop, end ) { 7526 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7527 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7528 animation.tweens.push( tween ); 7529 return tween; 7530 }, 7531 stop: function( gotoEnd ) { 7532 var index = 0, 7533 7534 // If we are going to the end, we want to run all the tweens 7535 // otherwise we skip this part 7536 length = gotoEnd ? animation.tweens.length : 0; 7537 if ( stopped ) { 7538 return this; 7539 } 7540 stopped = true; 7541 for ( ; index < length; index++ ) { 7542 animation.tweens[ index ].run( 1 ); 7543 } 7544 7545 // Resolve when we played the last frame; otherwise, reject 7546 if ( gotoEnd ) { 7547 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7548 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7549 } else { 7550 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7551 } 7552 return this; 7553 } 7554 } ), 7555 props = animation.props; 7556 7557 propFilter( props, animation.opts.specialEasing ); 7558 7559 for ( ; index < length; index++ ) { 7560 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 7561 if ( result ) { 7562 if ( isFunction( result.stop ) ) { 7563 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 7564 result.stop.bind( result ); 7565 } 7566 return result; 7567 } 7568 } 7569 7570 jQuery.map( props, createTween, animation ); 7571 7572 if ( isFunction( animation.opts.start ) ) { 7573 animation.opts.start.call( elem, animation ); 7574 } 7575 7576 // Attach callbacks from options 7577 animation 7578 .progress( animation.opts.progress ) 7579 .done( animation.opts.done, animation.opts.complete ) 7580 .fail( animation.opts.fail ) 7581 .always( animation.opts.always ); 7582 7583 jQuery.fx.timer( 7584 jQuery.extend( tick, { 7585 elem: elem, 7586 anim: animation, 7587 queue: animation.opts.queue 7588 } ) 7589 ); 7590 7591 return animation; 7592} 7593 7594jQuery.Animation = jQuery.extend( Animation, { 7595 7596 tweeners: { 7597 "*": [ function( prop, value ) { 7598 var tween = this.createTween( prop, value ); 7599 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 7600 return tween; 7601 } ] 7602 }, 7603 7604 tweener: function( props, callback ) { 7605 if ( isFunction( props ) ) { 7606 callback = props; 7607 props = [ "*" ]; 7608 } else { 7609 props = props.match( rnothtmlwhite ); 7610 } 7611 7612 var prop, 7613 index = 0, 7614 length = props.length; 7615 7616 for ( ; index < length; index++ ) { 7617 prop = props[ index ]; 7618 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 7619 Animation.tweeners[ prop ].unshift( callback ); 7620 } 7621 }, 7622 7623 prefilters: [ defaultPrefilter ], 7624 7625 prefilter: function( callback, prepend ) { 7626 if ( prepend ) { 7627 Animation.prefilters.unshift( callback ); 7628 } else { 7629 Animation.prefilters.push( callback ); 7630 } 7631 } 7632} ); 7633 7634jQuery.speed = function( speed, easing, fn ) { 7635 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7636 complete: fn || !fn && easing || 7637 isFunction( speed ) && speed, 7638 duration: speed, 7639 easing: fn && easing || easing && !isFunction( easing ) && easing 7640 }; 7641 7642 // Go to the end state if fx are off 7643 if ( jQuery.fx.off ) { 7644 opt.duration = 0; 7645 7646 } else { 7647 if ( typeof opt.duration !== "number" ) { 7648 if ( opt.duration in jQuery.fx.speeds ) { 7649 opt.duration = jQuery.fx.speeds[ opt.duration ]; 7650 7651 } else { 7652 opt.duration = jQuery.fx.speeds._default; 7653 } 7654 } 7655 } 7656 7657 // Normalize opt.queue - true/undefined/null -> "fx" 7658 if ( opt.queue == null || opt.queue === true ) { 7659 opt.queue = "fx"; 7660 } 7661 7662 // Queueing 7663 opt.old = opt.complete; 7664 7665 opt.complete = function() { 7666 if ( isFunction( opt.old ) ) { 7667 opt.old.call( this ); 7668 } 7669 7670 if ( opt.queue ) { 7671 jQuery.dequeue( this, opt.queue ); 7672 } 7673 }; 7674 7675 return opt; 7676}; 7677 7678jQuery.fn.extend( { 7679 fadeTo: function( speed, to, easing, callback ) { 7680 7681 // Show any hidden elements after setting opacity to 0 7682 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 7683 7684 // Animate to the value specified 7685 .end().animate( { opacity: to }, speed, easing, callback ); 7686 }, 7687 animate: function( prop, speed, easing, callback ) { 7688 var empty = jQuery.isEmptyObject( prop ), 7689 optall = jQuery.speed( speed, easing, callback ), 7690 doAnimation = function() { 7691 7692 // Operate on a copy of prop so per-property easing won't be lost 7693 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7694 7695 // Empty animations, or finishing resolves immediately 7696 if ( empty || dataPriv.get( this, "finish" ) ) { 7697 anim.stop( true ); 7698 } 7699 }; 7700 7701 doAnimation.finish = doAnimation; 7702 7703 return empty || optall.queue === false ? 7704 this.each( doAnimation ) : 7705 this.queue( optall.queue, doAnimation ); 7706 }, 7707 stop: function( type, clearQueue, gotoEnd ) { 7708 var stopQueue = function( hooks ) { 7709 var stop = hooks.stop; 7710 delete hooks.stop; 7711 stop( gotoEnd ); 7712 }; 7713 7714 if ( typeof type !== "string" ) { 7715 gotoEnd = clearQueue; 7716 clearQueue = type; 7717 type = undefined; 7718 } 7719 if ( clearQueue ) { 7720 this.queue( type || "fx", [] ); 7721 } 7722 7723 return this.each( function() { 7724 var dequeue = true, 7725 index = type != null && type + "queueHooks", 7726 timers = jQuery.timers, 7727 data = dataPriv.get( this ); 7728 7729 if ( index ) { 7730 if ( data[ index ] && data[ index ].stop ) { 7731 stopQueue( data[ index ] ); 7732 } 7733 } else { 7734 for ( index in data ) { 7735 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7736 stopQueue( data[ index ] ); 7737 } 7738 } 7739 } 7740 7741 for ( index = timers.length; index--; ) { 7742 if ( timers[ index ].elem === this && 7743 ( type == null || timers[ index ].queue === type ) ) { 7744 7745 timers[ index ].anim.stop( gotoEnd ); 7746 dequeue = false; 7747 timers.splice( index, 1 ); 7748 } 7749 } 7750 7751 // Start the next in the queue if the last step wasn't forced. 7752 // Timers currently will call their complete callbacks, which 7753 // will dequeue but only if they were gotoEnd. 7754 if ( dequeue || !gotoEnd ) { 7755 jQuery.dequeue( this, type ); 7756 } 7757 } ); 7758 }, 7759 finish: function( type ) { 7760 if ( type !== false ) { 7761 type = type || "fx"; 7762 } 7763 return this.each( function() { 7764 var index, 7765 data = dataPriv.get( this ), 7766 queue = data[ type + "queue" ], 7767 hooks = data[ type + "queueHooks" ], 7768 timers = jQuery.timers, 7769 length = queue ? queue.length : 0; 7770 7771 // Enable finishing flag on private data 7772 data.finish = true; 7773 7774 // Empty the queue first 7775 jQuery.queue( this, type, [] ); 7776 7777 if ( hooks && hooks.stop ) { 7778 hooks.stop.call( this, true ); 7779 } 7780 7781 // Look for any active animations, and finish them 7782 for ( index = timers.length; index--; ) { 7783 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 7784 timers[ index ].anim.stop( true ); 7785 timers.splice( index, 1 ); 7786 } 7787 } 7788 7789 // Look for any animations in the old queue and finish them 7790 for ( index = 0; index < length; index++ ) { 7791 if ( queue[ index ] && queue[ index ].finish ) { 7792 queue[ index ].finish.call( this ); 7793 } 7794 } 7795 7796 // Turn off finishing flag 7797 delete data.finish; 7798 } ); 7799 } 7800} ); 7801 7802jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 7803 var cssFn = jQuery.fn[ name ]; 7804 jQuery.fn[ name ] = function( speed, easing, callback ) { 7805 return speed == null || typeof speed === "boolean" ? 7806 cssFn.apply( this, arguments ) : 7807 this.animate( genFx( name, true ), speed, easing, callback ); 7808 }; 7809} ); 7810 7811// Generate shortcuts for custom animations 7812jQuery.each( { 7813 slideDown: genFx( "show" ), 7814 slideUp: genFx( "hide" ), 7815 slideToggle: genFx( "toggle" ), 7816 fadeIn: { opacity: "show" }, 7817 fadeOut: { opacity: "hide" }, 7818 fadeToggle: { opacity: "toggle" } 7819}, function( name, props ) { 7820 jQuery.fn[ name ] = function( speed, easing, callback ) { 7821 return this.animate( props, speed, easing, callback ); 7822 }; 7823} ); 7824 7825jQuery.timers = []; 7826jQuery.fx.tick = function() { 7827 var timer, 7828 i = 0, 7829 timers = jQuery.timers; 7830 7831 fxNow = Date.now(); 7832 7833 for ( ; i < timers.length; i++ ) { 7834 timer = timers[ i ]; 7835 7836 // Run the timer and safely remove it when done (allowing for external removal) 7837 if ( !timer() && timers[ i ] === timer ) { 7838 timers.splice( i--, 1 ); 7839 } 7840 } 7841 7842 if ( !timers.length ) { 7843 jQuery.fx.stop(); 7844 } 7845 fxNow = undefined; 7846}; 7847 7848jQuery.fx.timer = function( timer ) { 7849 jQuery.timers.push( timer ); 7850 jQuery.fx.start(); 7851}; 7852 7853jQuery.fx.interval = 13; 7854jQuery.fx.start = function() { 7855 if ( inProgress ) { 7856 return; 7857 } 7858 7859 inProgress = true; 7860 schedule(); 7861}; 7862 7863jQuery.fx.stop = function() { 7864 inProgress = null; 7865}; 7866 7867jQuery.fx.speeds = { 7868 slow: 600, 7869 fast: 200, 7870 7871 // Default speed 7872 _default: 400 7873}; 7874 7875 7876// Based off of the plugin by Clint Helfers, with permission. 7877jQuery.fn.delay = function( time, type ) { 7878 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 7879 type = type || "fx"; 7880 7881 return this.queue( type, function( next, hooks ) { 7882 var timeout = window.setTimeout( next, time ); 7883 hooks.stop = function() { 7884 window.clearTimeout( timeout ); 7885 }; 7886 } ); 7887}; 7888 7889 7890( function() { 7891 var input = document.createElement( "input" ), 7892 select = document.createElement( "select" ), 7893 opt = select.appendChild( document.createElement( "option" ) ); 7894 7895 input.type = "checkbox"; 7896 7897 // Support: Android <=4.3 only 7898 // Default value for a checkbox should be "on" 7899 support.checkOn = input.value !== ""; 7900 7901 // Support: IE <=11 only 7902 // Must access selectedIndex to make default options select 7903 support.optSelected = opt.selected; 7904 7905 // Support: IE <=11 only 7906 // An input loses its value after becoming a radio 7907 input = document.createElement( "input" ); 7908 input.value = "t"; 7909 input.type = "radio"; 7910 support.radioValue = input.value === "t"; 7911} )(); 7912 7913 7914var boolHook, 7915 attrHandle = jQuery.expr.attrHandle; 7916 7917jQuery.fn.extend( { 7918 attr: function( name, value ) { 7919 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 7920 }, 7921 7922 removeAttr: function( name ) { 7923 return this.each( function() { 7924 jQuery.removeAttr( this, name ); 7925 } ); 7926 } 7927} ); 7928 7929jQuery.extend( { 7930 attr: function( elem, name, value ) { 7931 var ret, hooks, 7932 nType = elem.nodeType; 7933 7934 // Don't get/set attributes on text, comment and attribute nodes 7935 if ( nType === 3 || nType === 8 || nType === 2 ) { 7936 return; 7937 } 7938 7939 // Fallback to prop when attributes are not supported 7940 if ( typeof elem.getAttribute === "undefined" ) { 7941 return jQuery.prop( elem, name, value ); 7942 } 7943 7944 // Attribute hooks are determined by the lowercase version 7945 // Grab necessary hook if one is defined 7946 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 7947 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 7948 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 7949 } 7950 7951 if ( value !== undefined ) { 7952 if ( value === null ) { 7953 jQuery.removeAttr( elem, name ); 7954 return; 7955 } 7956 7957 if ( hooks && "set" in hooks && 7958 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 7959 return ret; 7960 } 7961 7962 elem.setAttribute( name, value + "" ); 7963 return value; 7964 } 7965 7966 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 7967 return ret; 7968 } 7969 7970 ret = jQuery.find.attr( elem, name ); 7971 7972 // Non-existent attributes return null, we normalize to undefined 7973 return ret == null ? undefined : ret; 7974 }, 7975 7976 attrHooks: { 7977 type: { 7978 set: function( elem, value ) { 7979 if ( !support.radioValue && value === "radio" && 7980 nodeName( elem, "input" ) ) { 7981 var val = elem.value; 7982 elem.setAttribute( "type", value ); 7983 if ( val ) { 7984 elem.value = val; 7985 } 7986 return value; 7987 } 7988 } 7989 } 7990 }, 7991 7992 removeAttr: function( elem, value ) { 7993 var name, 7994 i = 0, 7995 7996 // Attribute names can contain non-HTML whitespace characters 7997 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 7998 attrNames = value && value.match( rnothtmlwhite ); 7999 8000 if ( attrNames && elem.nodeType === 1 ) { 8001 while ( ( name = attrNames[ i++ ] ) ) { 8002 elem.removeAttribute( name ); 8003 } 8004 } 8005 } 8006} ); 8007 8008// Hooks for boolean attributes 8009boolHook = { 8010 set: function( elem, value, name ) { 8011 if ( value === false ) { 8012 8013 // Remove boolean attributes when set to false 8014 jQuery.removeAttr( elem, name ); 8015 } else { 8016 elem.setAttribute( name, name ); 8017 } 8018 return name; 8019 } 8020}; 8021 8022jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 8023 var getter = attrHandle[ name ] || jQuery.find.attr; 8024 8025 attrHandle[ name ] = function( elem, name, isXML ) { 8026 var ret, handle, 8027 lowercaseName = name.toLowerCase(); 8028 8029 if ( !isXML ) { 8030 8031 // Avoid an infinite loop by temporarily removing this function from the getter 8032 handle = attrHandle[ lowercaseName ]; 8033 attrHandle[ lowercaseName ] = ret; 8034 ret = getter( elem, name, isXML ) != null ? 8035 lowercaseName : 8036 null; 8037 attrHandle[ lowercaseName ] = handle; 8038 } 8039 return ret; 8040 }; 8041} ); 8042 8043 8044 8045 8046var rfocusable = /^(?:input|select|textarea|button)$/i, 8047 rclickable = /^(?:a|area)$/i; 8048 8049jQuery.fn.extend( { 8050 prop: function( name, value ) { 8051 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 8052 }, 8053 8054 removeProp: function( name ) { 8055 return this.each( function() { 8056 delete this[ jQuery.propFix[ name ] || name ]; 8057 } ); 8058 } 8059} ); 8060 8061jQuery.extend( { 8062 prop: function( elem, name, value ) { 8063 var ret, hooks, 8064 nType = elem.nodeType; 8065 8066 // Don't get/set properties on text, comment and attribute nodes 8067 if ( nType === 3 || nType === 8 || nType === 2 ) { 8068 return; 8069 } 8070 8071 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8072 8073 // Fix name and attach hooks 8074 name = jQuery.propFix[ name ] || name; 8075 hooks = jQuery.propHooks[ name ]; 8076 } 8077 8078 if ( value !== undefined ) { 8079 if ( hooks && "set" in hooks && 8080 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8081 return ret; 8082 } 8083 8084 return ( elem[ name ] = value ); 8085 } 8086 8087 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8088 return ret; 8089 } 8090 8091 return elem[ name ]; 8092 }, 8093 8094 propHooks: { 8095 tabIndex: { 8096 get: function( elem ) { 8097 8098 // Support: IE <=9 - 11 only 8099 // elem.tabIndex doesn't always return the 8100 // correct value when it hasn't been explicitly set 8101 // Use proper attribute retrieval (trac-12072) 8102 var tabindex = jQuery.find.attr( elem, "tabindex" ); 8103 8104 if ( tabindex ) { 8105 return parseInt( tabindex, 10 ); 8106 } 8107 8108 if ( 8109 rfocusable.test( elem.nodeName ) || 8110 rclickable.test( elem.nodeName ) && 8111 elem.href 8112 ) { 8113 return 0; 8114 } 8115 8116 return -1; 8117 } 8118 } 8119 }, 8120 8121 propFix: { 8122 "for": "htmlFor", 8123 "class": "className" 8124 } 8125} ); 8126 8127// Support: IE <=11 only 8128// Accessing the selectedIndex property 8129// forces the browser to respect setting selected 8130// on the option 8131// The getter ensures a default option is selected 8132// when in an optgroup 8133// eslint rule "no-unused-expressions" is disabled for this code 8134// since it considers such accessions noop 8135if ( !support.optSelected ) { 8136 jQuery.propHooks.selected = { 8137 get: function( elem ) { 8138 8139 /* eslint no-unused-expressions: "off" */ 8140 8141 var parent = elem.parentNode; 8142 if ( parent && parent.parentNode ) { 8143 parent.parentNode.selectedIndex; 8144 } 8145 return null; 8146 }, 8147 set: function( elem ) { 8148 8149 /* eslint no-unused-expressions: "off" */ 8150 8151 var parent = elem.parentNode; 8152 if ( parent ) { 8153 parent.selectedIndex; 8154 8155 if ( parent.parentNode ) { 8156 parent.parentNode.selectedIndex; 8157 } 8158 } 8159 } 8160 }; 8161} 8162 8163jQuery.each( [ 8164 "tabIndex", 8165 "readOnly", 8166 "maxLength", 8167 "cellSpacing", 8168 "cellPadding", 8169 "rowSpan", 8170 "colSpan", 8171 "useMap", 8172 "frameBorder", 8173 "contentEditable" 8174], function() { 8175 jQuery.propFix[ this.toLowerCase() ] = this; 8176} ); 8177 8178 8179 8180 8181 // Strip and collapse whitespace according to HTML spec 8182 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 8183 function stripAndCollapse( value ) { 8184 var tokens = value.match( rnothtmlwhite ) || []; 8185 return tokens.join( " " ); 8186 } 8187 8188 8189function getClass( elem ) { 8190 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 8191} 8192 8193function classesToArray( value ) { 8194 if ( Array.isArray( value ) ) { 8195 return value; 8196 } 8197 if ( typeof value === "string" ) { 8198 return value.match( rnothtmlwhite ) || []; 8199 } 8200 return []; 8201} 8202 8203jQuery.fn.extend( { 8204 addClass: function( value ) { 8205 var classNames, cur, curValue, className, i, finalValue; 8206 8207 if ( isFunction( value ) ) { 8208 return this.each( function( j ) { 8209 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 8210 } ); 8211 } 8212 8213 classNames = classesToArray( value ); 8214 8215 if ( classNames.length ) { 8216 return this.each( function() { 8217 curValue = getClass( this ); 8218 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8219 8220 if ( cur ) { 8221 for ( i = 0; i < classNames.length; i++ ) { 8222 className = classNames[ i ]; 8223 if ( cur.indexOf( " " + className + " " ) < 0 ) { 8224 cur += className + " "; 8225 } 8226 } 8227 8228 // Only assign if different to avoid unneeded rendering. 8229 finalValue = stripAndCollapse( cur ); 8230 if ( curValue !== finalValue ) { 8231 this.setAttribute( "class", finalValue ); 8232 } 8233 } 8234 } ); 8235 } 8236 8237 return this; 8238 }, 8239 8240 removeClass: function( value ) { 8241 var classNames, cur, curValue, className, i, finalValue; 8242 8243 if ( isFunction( value ) ) { 8244 return this.each( function( j ) { 8245 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 8246 } ); 8247 } 8248 8249 if ( !arguments.length ) { 8250 return this.attr( "class", "" ); 8251 } 8252 8253 classNames = classesToArray( value ); 8254 8255 if ( classNames.length ) { 8256 return this.each( function() { 8257 curValue = getClass( this ); 8258 8259 // This expression is here for better compressibility (see addClass) 8260 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8261 8262 if ( cur ) { 8263 for ( i = 0; i < classNames.length; i++ ) { 8264 className = classNames[ i ]; 8265 8266 // Remove *all* instances 8267 while ( cur.indexOf( " " + className + " " ) > -1 ) { 8268 cur = cur.replace( " " + className + " ", " " ); 8269 } 8270 } 8271 8272 // Only assign if different to avoid unneeded rendering. 8273 finalValue = stripAndCollapse( cur ); 8274 if ( curValue !== finalValue ) { 8275 this.setAttribute( "class", finalValue ); 8276 } 8277 } 8278 } ); 8279 } 8280 8281 return this; 8282 }, 8283 8284 toggleClass: function( value, stateVal ) { 8285 var classNames, className, i, self, 8286 type = typeof value, 8287 isValidValue = type === "string" || Array.isArray( value ); 8288 8289 if ( isFunction( value ) ) { 8290 return this.each( function( i ) { 8291 jQuery( this ).toggleClass( 8292 value.call( this, i, getClass( this ), stateVal ), 8293 stateVal 8294 ); 8295 } ); 8296 } 8297 8298 if ( typeof stateVal === "boolean" && isValidValue ) { 8299 return stateVal ? this.addClass( value ) : this.removeClass( value ); 8300 } 8301 8302 classNames = classesToArray( value ); 8303 8304 return this.each( function() { 8305 if ( isValidValue ) { 8306 8307 // Toggle individual class names 8308 self = jQuery( this ); 8309 8310 for ( i = 0; i < classNames.length; i++ ) { 8311 className = classNames[ i ]; 8312 8313 // Check each className given, space separated list 8314 if ( self.hasClass( className ) ) { 8315 self.removeClass( className ); 8316 } else { 8317 self.addClass( className ); 8318 } 8319 } 8320 8321 // Toggle whole class name 8322 } else if ( value === undefined || type === "boolean" ) { 8323 className = getClass( this ); 8324 if ( className ) { 8325 8326 // Store className if set 8327 dataPriv.set( this, "__className__", className ); 8328 } 8329 8330 // If the element has a class name or if we're passed `false`, 8331 // then remove the whole classname (if there was one, the above saved it). 8332 // Otherwise bring back whatever was previously saved (if anything), 8333 // falling back to the empty string if nothing was stored. 8334 if ( this.setAttribute ) { 8335 this.setAttribute( "class", 8336 className || value === false ? 8337 "" : 8338 dataPriv.get( this, "__className__" ) || "" 8339 ); 8340 } 8341 } 8342 } ); 8343 }, 8344 8345 hasClass: function( selector ) { 8346 var className, elem, 8347 i = 0; 8348 8349 className = " " + selector + " "; 8350 while ( ( elem = this[ i++ ] ) ) { 8351 if ( elem.nodeType === 1 && 8352 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 8353 return true; 8354 } 8355 } 8356 8357 return false; 8358 } 8359} ); 8360 8361 8362 8363 8364var rreturn = /\r/g; 8365 8366jQuery.fn.extend( { 8367 val: function( value ) { 8368 var hooks, ret, valueIsFunction, 8369 elem = this[ 0 ]; 8370 8371 if ( !arguments.length ) { 8372 if ( elem ) { 8373 hooks = jQuery.valHooks[ elem.type ] || 8374 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 8375 8376 if ( hooks && 8377 "get" in hooks && 8378 ( ret = hooks.get( elem, "value" ) ) !== undefined 8379 ) { 8380 return ret; 8381 } 8382 8383 ret = elem.value; 8384 8385 // Handle most common string cases 8386 if ( typeof ret === "string" ) { 8387 return ret.replace( rreturn, "" ); 8388 } 8389 8390 // Handle cases where value is null/undef or number 8391 return ret == null ? "" : ret; 8392 } 8393 8394 return; 8395 } 8396 8397 valueIsFunction = isFunction( value ); 8398 8399 return this.each( function( i ) { 8400 var val; 8401 8402 if ( this.nodeType !== 1 ) { 8403 return; 8404 } 8405 8406 if ( valueIsFunction ) { 8407 val = value.call( this, i, jQuery( this ).val() ); 8408 } else { 8409 val = value; 8410 } 8411 8412 // Treat null/undefined as ""; convert numbers to string 8413 if ( val == null ) { 8414 val = ""; 8415 8416 } else if ( typeof val === "number" ) { 8417 val += ""; 8418 8419 } else if ( Array.isArray( val ) ) { 8420 val = jQuery.map( val, function( value ) { 8421 return value == null ? "" : value + ""; 8422 } ); 8423 } 8424 8425 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 8426 8427 // If set returns undefined, fall back to normal setting 8428 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 8429 this.value = val; 8430 } 8431 } ); 8432 } 8433} ); 8434 8435jQuery.extend( { 8436 valHooks: { 8437 option: { 8438 get: function( elem ) { 8439 8440 var val = jQuery.find.attr( elem, "value" ); 8441 return val != null ? 8442 val : 8443 8444 // Support: IE <=10 - 11 only 8445 // option.text throws exceptions (trac-14686, trac-14858) 8446 // Strip and collapse whitespace 8447 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8448 stripAndCollapse( jQuery.text( elem ) ); 8449 } 8450 }, 8451 select: { 8452 get: function( elem ) { 8453 var value, option, i, 8454 options = elem.options, 8455 index = elem.selectedIndex, 8456 one = elem.type === "select-one", 8457 values = one ? null : [], 8458 max = one ? index + 1 : options.length; 8459 8460 if ( index < 0 ) { 8461 i = max; 8462 8463 } else { 8464 i = one ? index : 0; 8465 } 8466 8467 // Loop through all the selected options 8468 for ( ; i < max; i++ ) { 8469 option = options[ i ]; 8470 8471 // Support: IE <=9 only 8472 // IE8-9 doesn't update selected after form reset (trac-2551) 8473 if ( ( option.selected || i === index ) && 8474 8475 // Don't return options that are disabled or in a disabled optgroup 8476 !option.disabled && 8477 ( !option.parentNode.disabled || 8478 !nodeName( option.parentNode, "optgroup" ) ) ) { 8479 8480 // Get the specific value for the option 8481 value = jQuery( option ).val(); 8482 8483 // We don't need an array for one selects 8484 if ( one ) { 8485 return value; 8486 } 8487 8488 // Multi-Selects return an array 8489 values.push( value ); 8490 } 8491 } 8492 8493 return values; 8494 }, 8495 8496 set: function( elem, value ) { 8497 var optionSet, option, 8498 options = elem.options, 8499 values = jQuery.makeArray( value ), 8500 i = options.length; 8501 8502 while ( i-- ) { 8503 option = options[ i ]; 8504 8505 /* eslint-disable no-cond-assign */ 8506 8507 if ( option.selected = 8508 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 8509 ) { 8510 optionSet = true; 8511 } 8512 8513 /* eslint-enable no-cond-assign */ 8514 } 8515 8516 // Force browsers to behave consistently when non-matching value is set 8517 if ( !optionSet ) { 8518 elem.selectedIndex = -1; 8519 } 8520 return values; 8521 } 8522 } 8523 } 8524} ); 8525 8526// Radios and checkboxes getter/setter 8527jQuery.each( [ "radio", "checkbox" ], function() { 8528 jQuery.valHooks[ this ] = { 8529 set: function( elem, value ) { 8530 if ( Array.isArray( value ) ) { 8531 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 8532 } 8533 } 8534 }; 8535 if ( !support.checkOn ) { 8536 jQuery.valHooks[ this ].get = function( elem ) { 8537 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 8538 }; 8539 } 8540} ); 8541 8542 8543 8544 8545// Return jQuery for attributes-only inclusion 8546var location = window.location; 8547 8548var nonce = { guid: Date.now() }; 8549 8550var rquery = ( /\?/ ); 8551 8552 8553 8554// Cross-browser xml parsing 8555jQuery.parseXML = function( data ) { 8556 var xml, parserErrorElem; 8557 if ( !data || typeof data !== "string" ) { 8558 return null; 8559 } 8560 8561 // Support: IE 9 - 11 only 8562 // IE throws on parseFromString with invalid input. 8563 try { 8564 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 8565 } catch ( e ) {} 8566 8567 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; 8568 if ( !xml || parserErrorElem ) { 8569 jQuery.error( "Invalid XML: " + ( 8570 parserErrorElem ? 8571 jQuery.map( parserErrorElem.childNodes, function( el ) { 8572 return el.textContent; 8573 } ).join( "\n" ) : 8574 data 8575 ) ); 8576 } 8577 return xml; 8578}; 8579 8580 8581var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 8582 stopPropagationCallback = function( e ) { 8583 e.stopPropagation(); 8584 }; 8585 8586jQuery.extend( jQuery.event, { 8587 8588 trigger: function( event, data, elem, onlyHandlers ) { 8589 8590 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 8591 eventPath = [ elem || document ], 8592 type = hasOwn.call( event, "type" ) ? event.type : event, 8593 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 8594 8595 cur = lastElement = tmp = elem = elem || document; 8596 8597 // Don't do events on text and comment nodes 8598 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 8599 return; 8600 } 8601 8602 // focus/blur morphs to focusin/out; ensure we're not firing them right now 8603 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 8604 return; 8605 } 8606 8607 if ( type.indexOf( "." ) > -1 ) { 8608 8609 // Namespaced trigger; create a regexp to match event type in handle() 8610 namespaces = type.split( "." ); 8611 type = namespaces.shift(); 8612 namespaces.sort(); 8613 } 8614 ontype = type.indexOf( ":" ) < 0 && "on" + type; 8615 8616 // Caller can pass in a jQuery.Event object, Object, or just an event type string 8617 event = event[ jQuery.expando ] ? 8618 event : 8619 new jQuery.Event( type, typeof event === "object" && event ); 8620 8621 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 8622 event.isTrigger = onlyHandlers ? 2 : 3; 8623 event.namespace = namespaces.join( "." ); 8624 event.rnamespace = event.namespace ? 8625 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 8626 null; 8627 8628 // Clean up the event in case it is being reused 8629 event.result = undefined; 8630 if ( !event.target ) { 8631 event.target = elem; 8632 } 8633 8634 // Clone any incoming data and prepend the event, creating the handler arg list 8635 data = data == null ? 8636 [ event ] : 8637 jQuery.makeArray( data, [ event ] ); 8638 8639 // Allow special events to draw outside the lines 8640 special = jQuery.event.special[ type ] || {}; 8641 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 8642 return; 8643 } 8644 8645 // Determine event propagation path in advance, per W3C events spec (trac-9951) 8646 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) 8647 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 8648 8649 bubbleType = special.delegateType || type; 8650 if ( !rfocusMorph.test( bubbleType + type ) ) { 8651 cur = cur.parentNode; 8652 } 8653 for ( ; cur; cur = cur.parentNode ) { 8654 eventPath.push( cur ); 8655 tmp = cur; 8656 } 8657 8658 // Only add window if we got to document (e.g., not plain obj or detached DOM) 8659 if ( tmp === ( elem.ownerDocument || document ) ) { 8660 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 8661 } 8662 } 8663 8664 // Fire handlers on the event path 8665 i = 0; 8666 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 8667 lastElement = cur; 8668 event.type = i > 1 ? 8669 bubbleType : 8670 special.bindType || type; 8671 8672 // jQuery handler 8673 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && 8674 dataPriv.get( cur, "handle" ); 8675 if ( handle ) { 8676 handle.apply( cur, data ); 8677 } 8678 8679 // Native handler 8680 handle = ontype && cur[ ontype ]; 8681 if ( handle && handle.apply && acceptData( cur ) ) { 8682 event.result = handle.apply( cur, data ); 8683 if ( event.result === false ) { 8684 event.preventDefault(); 8685 } 8686 } 8687 } 8688 event.type = type; 8689 8690 // If nobody prevented the default action, do it now 8691 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 8692 8693 if ( ( !special._default || 8694 special._default.apply( eventPath.pop(), data ) === false ) && 8695 acceptData( elem ) ) { 8696 8697 // Call a native DOM method on the target with the same name as the event. 8698 // Don't do default actions on window, that's where global variables be (trac-6170) 8699 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 8700 8701 // Don't re-trigger an onFOO event when we call its FOO() method 8702 tmp = elem[ ontype ]; 8703 8704 if ( tmp ) { 8705 elem[ ontype ] = null; 8706 } 8707 8708 // Prevent re-triggering of the same event, since we already bubbled it above 8709 jQuery.event.triggered = type; 8710 8711 if ( event.isPropagationStopped() ) { 8712 lastElement.addEventListener( type, stopPropagationCallback ); 8713 } 8714 8715 elem[ type ](); 8716 8717 if ( event.isPropagationStopped() ) { 8718 lastElement.removeEventListener( type, stopPropagationCallback ); 8719 } 8720 8721 jQuery.event.triggered = undefined; 8722 8723 if ( tmp ) { 8724 elem[ ontype ] = tmp; 8725 } 8726 } 8727 } 8728 } 8729 8730 return event.result; 8731 }, 8732 8733 // Piggyback on a donor event to simulate a different one 8734 // Used only for `focus(in | out)` events 8735 simulate: function( type, elem, event ) { 8736 var e = jQuery.extend( 8737 new jQuery.Event(), 8738 event, 8739 { 8740 type: type, 8741 isSimulated: true 8742 } 8743 ); 8744 8745 jQuery.event.trigger( e, null, elem ); 8746 } 8747 8748} ); 8749 8750jQuery.fn.extend( { 8751 8752 trigger: function( type, data ) { 8753 return this.each( function() { 8754 jQuery.event.trigger( type, data, this ); 8755 } ); 8756 }, 8757 triggerHandler: function( type, data ) { 8758 var elem = this[ 0 ]; 8759 if ( elem ) { 8760 return jQuery.event.trigger( type, data, elem, true ); 8761 } 8762 } 8763} ); 8764 8765 8766var 8767 rbracket = /\[\]$/, 8768 rCRLF = /\r?\n/g, 8769 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 8770 rsubmittable = /^(?:input|select|textarea|keygen)/i; 8771 8772function buildParams( prefix, obj, traditional, add ) { 8773 var name; 8774 8775 if ( Array.isArray( obj ) ) { 8776 8777 // Serialize array item. 8778 jQuery.each( obj, function( i, v ) { 8779 if ( traditional || rbracket.test( prefix ) ) { 8780 8781 // Treat each array item as a scalar. 8782 add( prefix, v ); 8783 8784 } else { 8785 8786 // Item is non-scalar (array or object), encode its numeric index. 8787 buildParams( 8788 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 8789 v, 8790 traditional, 8791 add 8792 ); 8793 } 8794 } ); 8795 8796 } else if ( !traditional && toType( obj ) === "object" ) { 8797 8798 // Serialize object item. 8799 for ( name in obj ) { 8800 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 8801 } 8802 8803 } else { 8804 8805 // Serialize scalar item. 8806 add( prefix, obj ); 8807 } 8808} 8809 8810// Serialize an array of form elements or a set of 8811// key/values into a query string 8812jQuery.param = function( a, traditional ) { 8813 var prefix, 8814 s = [], 8815 add = function( key, valueOrFunction ) { 8816 8817 // If value is a function, invoke it and use its return value 8818 var value = isFunction( valueOrFunction ) ? 8819 valueOrFunction() : 8820 valueOrFunction; 8821 8822 s[ s.length ] = encodeURIComponent( key ) + "=" + 8823 encodeURIComponent( value == null ? "" : value ); 8824 }; 8825 8826 if ( a == null ) { 8827 return ""; 8828 } 8829 8830 // If an array was passed in, assume that it is an array of form elements. 8831 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 8832 8833 // Serialize the form elements 8834 jQuery.each( a, function() { 8835 add( this.name, this.value ); 8836 } ); 8837 8838 } else { 8839 8840 // If traditional, encode the "old" way (the way 1.3.2 or older 8841 // did it), otherwise encode params recursively. 8842 for ( prefix in a ) { 8843 buildParams( prefix, a[ prefix ], traditional, add ); 8844 } 8845 } 8846 8847 // Return the resulting serialization 8848 return s.join( "&" ); 8849}; 8850 8851jQuery.fn.extend( { 8852 serialize: function() { 8853 return jQuery.param( this.serializeArray() ); 8854 }, 8855 serializeArray: function() { 8856 return this.map( function() { 8857 8858 // Can add propHook for "elements" to filter or add form elements 8859 var elements = jQuery.prop( this, "elements" ); 8860 return elements ? jQuery.makeArray( elements ) : this; 8861 } ).filter( function() { 8862 var type = this.type; 8863 8864 // Use .is( ":disabled" ) so that fieldset[disabled] works 8865 return this.name && !jQuery( this ).is( ":disabled" ) && 8866 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 8867 ( this.checked || !rcheckableType.test( type ) ); 8868 } ).map( function( _i, elem ) { 8869 var val = jQuery( this ).val(); 8870 8871 if ( val == null ) { 8872 return null; 8873 } 8874 8875 if ( Array.isArray( val ) ) { 8876 return jQuery.map( val, function( val ) { 8877 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8878 } ); 8879 } 8880 8881 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8882 } ).get(); 8883 } 8884} ); 8885 8886 8887var 8888 r20 = /%20/g, 8889 rhash = /#.*$/, 8890 rantiCache = /([?&])_=[^&]*/, 8891 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 8892 8893 // trac-7653, trac-8125, trac-8152: local protocol detection 8894 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 8895 rnoContent = /^(?:GET|HEAD)$/, 8896 rprotocol = /^\/\//, 8897 8898 /* Prefilters 8899 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 8900 * 2) These are called: 8901 * - BEFORE asking for a transport 8902 * - AFTER param serialization (s.data is a string if s.processData is true) 8903 * 3) key is the dataType 8904 * 4) the catchall symbol "*" can be used 8905 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 8906 */ 8907 prefilters = {}, 8908 8909 /* Transports bindings 8910 * 1) key is the dataType 8911 * 2) the catchall symbol "*" can be used 8912 * 3) selection will start with transport dataType and THEN go to "*" if needed 8913 */ 8914 transports = {}, 8915 8916 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression 8917 allTypes = "*/".concat( "*" ), 8918 8919 // Anchor tag for parsing the document origin 8920 originAnchor = document.createElement( "a" ); 8921 8922originAnchor.href = location.href; 8923 8924// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 8925function addToPrefiltersOrTransports( structure ) { 8926 8927 // dataTypeExpression is optional and defaults to "*" 8928 return function( dataTypeExpression, func ) { 8929 8930 if ( typeof dataTypeExpression !== "string" ) { 8931 func = dataTypeExpression; 8932 dataTypeExpression = "*"; 8933 } 8934 8935 var dataType, 8936 i = 0, 8937 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 8938 8939 if ( isFunction( func ) ) { 8940 8941 // For each dataType in the dataTypeExpression 8942 while ( ( dataType = dataTypes[ i++ ] ) ) { 8943 8944 // Prepend if requested 8945 if ( dataType[ 0 ] === "+" ) { 8946 dataType = dataType.slice( 1 ) || "*"; 8947 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 8948 8949 // Otherwise append 8950 } else { 8951 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 8952 } 8953 } 8954 } 8955 }; 8956} 8957 8958// Base inspection function for prefilters and transports 8959function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 8960 8961 var inspected = {}, 8962 seekingTransport = ( structure === transports ); 8963 8964 function inspect( dataType ) { 8965 var selected; 8966 inspected[ dataType ] = true; 8967 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 8968 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 8969 if ( typeof dataTypeOrTransport === "string" && 8970 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 8971 8972 options.dataTypes.unshift( dataTypeOrTransport ); 8973 inspect( dataTypeOrTransport ); 8974 return false; 8975 } else if ( seekingTransport ) { 8976 return !( selected = dataTypeOrTransport ); 8977 } 8978 } ); 8979 return selected; 8980 } 8981 8982 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 8983} 8984 8985// A special extend for ajax options 8986// that takes "flat" options (not to be deep extended) 8987// Fixes trac-9887 8988function ajaxExtend( target, src ) { 8989 var key, deep, 8990 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 8991 8992 for ( key in src ) { 8993 if ( src[ key ] !== undefined ) { 8994 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 8995 } 8996 } 8997 if ( deep ) { 8998 jQuery.extend( true, target, deep ); 8999 } 9000 9001 return target; 9002} 9003 9004/* Handles responses to an ajax request: 9005 * - finds the right dataType (mediates between content-type and expected dataType) 9006 * - returns the corresponding response 9007 */ 9008function ajaxHandleResponses( s, jqXHR, responses ) { 9009 9010 var ct, type, finalDataType, firstDataType, 9011 contents = s.contents, 9012 dataTypes = s.dataTypes; 9013 9014 // Remove auto dataType and get content-type in the process 9015 while ( dataTypes[ 0 ] === "*" ) { 9016 dataTypes.shift(); 9017 if ( ct === undefined ) { 9018 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 9019 } 9020 } 9021 9022 // Check if we're dealing with a known content-type 9023 if ( ct ) { 9024 for ( type in contents ) { 9025 if ( contents[ type ] && contents[ type ].test( ct ) ) { 9026 dataTypes.unshift( type ); 9027 break; 9028 } 9029 } 9030 } 9031 9032 // Check to see if we have a response for the expected dataType 9033 if ( dataTypes[ 0 ] in responses ) { 9034 finalDataType = dataTypes[ 0 ]; 9035 } else { 9036
vendor: 9,527 bytes, lines 9037-9412
9037 // Try convertible dataTypes 9038 for ( type in responses ) { 9039 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 9040 finalDataType = type; 9041 break; 9042 } 9043 if ( !firstDataType ) { 9044 firstDataType = type; 9045 } 9046 } 9047 9048 // Or just use first one 9049 finalDataType = finalDataType || firstDataType; 9050 } 9051 9052 // If we found a dataType 9053 // We add the dataType to the list if needed 9054 // and return the corresponding response 9055 if ( finalDataType ) { 9056 if ( finalDataType !== dataTypes[ 0 ] ) { 9057 dataTypes.unshift( finalDataType ); 9058 } 9059 return responses[ finalDataType ]; 9060 } 9061} 9062 9063/* Chain conversions given the request and the original response 9064 * Also sets the responseXXX fields on the jqXHR instance 9065 */ 9066function ajaxConvert( s, response, jqXHR, isSuccess ) { 9067 var conv2, current, conv, tmp, prev, 9068 converters = {}, 9069 9070 // Work with a copy of dataTypes in case we need to modify it for conversion 9071 dataTypes = s.dataTypes.slice(); 9072 9073 // Create converters map with lowercased keys 9074 if ( dataTypes[ 1 ] ) { 9075 for ( conv in s.converters ) { 9076 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 9077 } 9078 } 9079 9080 current = dataTypes.shift(); 9081 9082 // Convert to each sequential dataType 9083 while ( current ) { 9084 9085 if ( s.responseFields[ current ] ) { 9086 jqXHR[ s.responseFields[ current ] ] = response; 9087 } 9088 9089 // Apply the dataFilter if provided 9090 if ( !prev && isSuccess && s.dataFilter ) { 9091 response = s.dataFilter( response, s.dataType ); 9092 } 9093 9094 prev = current; 9095 current = dataTypes.shift(); 9096 9097 if ( current ) { 9098 9099 // There's only work to do if current dataType is non-auto 9100 if ( current === "*" ) { 9101 9102 current = prev; 9103 9104 // Convert response if prev dataType is non-auto and differs from current 9105 } else if ( prev !== "*" && prev !== current ) { 9106 9107 // Seek a direct converter 9108 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 9109 9110 // If none found, seek a pair 9111 if ( !conv ) { 9112 for ( conv2 in converters ) { 9113 9114 // If conv2 outputs current 9115 tmp = conv2.split( " " ); 9116 if ( tmp[ 1 ] === current ) { 9117 9118 // If prev can be converted to accepted input 9119 conv = converters[ prev + " " + tmp[ 0 ] ] || 9120 converters[ "* " + tmp[ 0 ] ]; 9121 if ( conv ) { 9122 9123 // Condense equivalence converters 9124 if ( conv === true ) { 9125 conv = converters[ conv2 ]; 9126 9127 // Otherwise, insert the intermediate dataType 9128 } else if ( converters[ conv2 ] !== true ) { 9129 current = tmp[ 0 ]; 9130 dataTypes.unshift( tmp[ 1 ] ); 9131 } 9132 break; 9133 } 9134 } 9135 } 9136 } 9137 9138 // Apply converter (if not an equivalence) 9139 if ( conv !== true ) { 9140 9141 // Unless errors are allowed to bubble, catch and return them 9142 if ( conv && s.throws ) { 9143 response = conv( response ); 9144 } else { 9145 try { 9146 response = conv( response ); 9147 } catch ( e ) { 9148 return { 9149 state: "parsererror", 9150 error: conv ? e : "No conversion from " + prev + " to " + current 9151 }; 9152 } 9153 } 9154 } 9155 } 9156 } 9157 } 9158 9159 return { state: "success", data: response }; 9160} 9161 9162jQuery.extend( { 9163 9164 // Counter for holding the number of active queries 9165 active: 0, 9166 9167 // Last-Modified header cache for next request 9168 lastModified: {}, 9169 etag: {}, 9170 9171 ajaxSettings: { 9172 url: location.href, 9173 type: "GET", 9174 isLocal: rlocalProtocol.test( location.protocol ), 9175 global: true, 9176 processData: true, 9177 async: true, 9178 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9179 9180 /* 9181 timeout: 0, 9182 data: null, 9183 dataType: null, 9184 username: null, 9185 password: null, 9186 cache: null, 9187 throws: false, 9188 traditional: false, 9189 headers: {}, 9190 */ 9191 9192 accepts: { 9193 "*": allTypes, 9194 text: "text/plain", 9195 html: "text/html", 9196 xml: "application/xml, text/xml", 9197 json: "application/json, text/javascript" 9198 }, 9199 9200 contents: { 9201 xml: /\bxml\b/, 9202 html: /\bhtml/, 9203 json: /\bjson\b/ 9204 }, 9205 9206 responseFields: { 9207 xml: "responseXML", 9208 text: "responseText", 9209 json: "responseJSON" 9210 }, 9211 9212 // Data converters 9213 // Keys separate source (or catchall "*") and destination types with a single space 9214 converters: { 9215 9216 // Convert anything to text 9217 "* text": String, 9218 9219 // Text to html (true = no transformation) 9220 "text html": true, 9221 9222 // Evaluate text as a json expression 9223 "text json": JSON.parse, 9224 9225 // Parse text as xml 9226 "text xml": jQuery.parseXML 9227 }, 9228 9229 // For options that shouldn't be deep extended: 9230 // you can add your own custom options here if 9231 // and when you create one that shouldn't be 9232 // deep extended (see ajaxExtend) 9233 flatOptions: { 9234 url: true, 9235 context: true 9236 } 9237 }, 9238 9239 // Creates a full fledged settings object into target 9240 // with both ajaxSettings and settings fields. 9241 // If target is omitted, writes into ajaxSettings. 9242 ajaxSetup: function( target, settings ) { 9243 return settings ? 9244 9245 // Building a settings object 9246 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 9247 9248 // Extending ajaxSettings 9249 ajaxExtend( jQuery.ajaxSettings, target ); 9250 }, 9251 9252 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 9253 ajaxTransport: addToPrefiltersOrTransports( transports ), 9254 9255 // Main method 9256 ajax: function( url, options ) { 9257 9258 // If url is an object, simulate pre-1.5 signature 9259 if ( typeof url === "object" ) { 9260 options = url; 9261 url = undefined; 9262 } 9263 9264 // Force options to be an object 9265 options = options || {}; 9266 9267 var transport, 9268 9269 // URL without anti-cache param 9270 cacheURL, 9271 9272 // Response headers 9273 responseHeadersString, 9274 responseHeaders, 9275 9276 // timeout handle 9277 timeoutTimer, 9278 9279 // Url cleanup var 9280 urlAnchor, 9281 9282 // Request state (becomes false upon send and true upon completion) 9283 completed, 9284 9285 // To know if global events are to be dispatched 9286 fireGlobals, 9287 9288 // Loop variable 9289 i, 9290 9291 // uncached part of the url 9292 uncached, 9293 9294 // Create the final options object 9295 s = jQuery.ajaxSetup( {}, options ), 9296 9297 // Callbacks context 9298 callbackContext = s.context || s, 9299 9300 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9301 globalEventContext = s.context && 9302 ( callbackContext.nodeType || callbackContext.jquery ) ? 9303 jQuery( callbackContext ) : 9304 jQuery.event, 9305 9306 // Deferreds 9307 deferred = jQuery.Deferred(), 9308 completeDeferred = jQuery.Callbacks( "once memory" ), 9309 9310 // Status-dependent callbacks 9311 statusCode = s.statusCode || {}, 9312 9313 // Headers (they are sent all at once) 9314 requestHeaders = {}, 9315 requestHeadersNames = {}, 9316 9317 // Default abort message 9318 strAbort = "canceled", 9319 9320 // Fake xhr 9321 jqXHR = { 9322 readyState: 0, 9323 9324 // Builds headers hashtable if needed 9325 getResponseHeader: function( key ) { 9326 var match; 9327 if ( completed ) { 9328 if ( !responseHeaders ) { 9329 responseHeaders = {}; 9330 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 9331 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 9332 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 9333 .concat( match[ 2 ] ); 9334 } 9335 } 9336 match = responseHeaders[ key.toLowerCase() + " " ]; 9337 } 9338 return match == null ? null : match.join( ", " ); 9339 }, 9340 9341 // Raw string 9342 getAllResponseHeaders: function() { 9343 return completed ? responseHeadersString : null; 9344 }, 9345 9346 // Caches the header 9347 setRequestHeader: function( name, value ) { 9348 if ( completed == null ) { 9349 name = requestHeadersNames[ name.toLowerCase() ] = 9350 requestHeadersNames[ name.toLowerCase() ] || name; 9351 requestHeaders[ name ] = value; 9352 } 9353 return this; 9354 }, 9355 9356 // Overrides response content-type header 9357 overrideMimeType: function( type ) { 9358 if ( completed == null ) { 9359 s.mimeType = type; 9360 } 9361 return this; 9362 }, 9363 9364 // Status-dependent callbacks 9365 statusCode: function( map ) { 9366 var code; 9367 if ( map ) { 9368 if ( completed ) { 9369 9370 // Execute the appropriate callbacks 9371 jqXHR.always( map[ jqXHR.status ] ); 9372 } else { 9373 9374 // Lazy-add the new callbacks in a way that preserves old ones 9375 for ( code in map ) { 9376 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9377 } 9378 } 9379 } 9380 return this; 9381 }, 9382 9383 // Cancel the request 9384 abort: function( statusText ) { 9385 var finalText = statusText || strAbort; 9386 if ( transport ) { 9387 transport.abort( finalText ); 9388 } 9389 done( 0, finalText ); 9390 return this; 9391 } 9392 }; 9393 9394 // Attach deferreds 9395 deferred.promise( jqXHR ); 9396 9397 // Add protocol if not provided (prefilters might expect it) 9398 // Handle falsy url in the settings object (trac-10093: consistency with old signature) 9399 // We also use the url parameter if available 9400 s.url = ( ( url || s.url || location.href ) + "" ) 9401 .replace( rprotocol, location.protocol + "//" ); 9402 9403 // Alias method option to type as per ticket trac-12004 9404 s.type = options.method || options.type || s.method || s.type; 9405 9406 // Extract dataTypes list 9407 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 9408 9409 // A cross-domain request is in order when the origin doesn't match the current origin. 9410 if ( s.crossDomain == null ) { 9411 urlAnchor = document.createElement( "a" ); 9412
vendor: 37,849 bytes, lines 9413-10768
9413 // Support: IE <=8 - 11, Edge 12 - 15 9414 // IE throws exception on accessing the href property if url is malformed, 9415 // e.g. http://example.com:80x/ 9416 try { 9417 urlAnchor.href = s.url; 9418 9419 // Support: IE <=8 - 11 only 9420 // Anchor's host property isn't correctly set when s.url is relative 9421 urlAnchor.href = urlAnchor.href; 9422 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 9423 urlAnchor.protocol + "//" + urlAnchor.host; 9424 } catch ( e ) { 9425 9426 // If there is an error parsing the URL, assume it is crossDomain, 9427 // it can be rejected by the transport if it is invalid 9428 s.crossDomain = true; 9429 } 9430 } 9431 9432 // Convert data if not already a string 9433 if ( s.data && s.processData && typeof s.data !== "string" ) { 9434 s.data = jQuery.param( s.data, s.traditional ); 9435 } 9436 9437 // Apply prefilters 9438 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9439 9440 // If request was aborted inside a prefilter, stop there 9441 if ( completed ) { 9442 return jqXHR; 9443 } 9444 9445 // We can fire global events as of now if asked to 9446 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) 9447 fireGlobals = jQuery.event && s.global; 9448 9449 // Watch for a new set of requests 9450 if ( fireGlobals && jQuery.active++ === 0 ) { 9451 jQuery.event.trigger( "ajaxStart" ); 9452 } 9453 9454 // Uppercase the type 9455 s.type = s.type.toUpperCase(); 9456 9457 // Determine if request has content 9458 s.hasContent = !rnoContent.test( s.type ); 9459 9460 // Save the URL in case we're toying with the If-Modified-Since 9461 // and/or If-None-Match header later on 9462 // Remove hash to simplify url manipulation 9463 cacheURL = s.url.replace( rhash, "" ); 9464 9465 // More options handling for requests with no content 9466 if ( !s.hasContent ) { 9467 9468 // Remember the hash so we can put it back 9469 uncached = s.url.slice( cacheURL.length ); 9470 9471 // If data is available and should be processed, append data to url 9472 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 9473 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 9474 9475 // trac-9682: remove data so that it's not used in an eventual retry 9476 delete s.data; 9477 } 9478 9479 // Add or update anti-cache param if needed 9480 if ( s.cache === false ) { 9481 cacheURL = cacheURL.replace( rantiCache, "$1" ); 9482 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 9483 uncached; 9484 } 9485 9486 // Put hash and anti-cache on the URL that will be requested (gh-1732) 9487 s.url = cacheURL + uncached; 9488 9489 // Change '%20' to '+' if this is encoded form body content (gh-2658) 9490 } else if ( s.data && s.processData && 9491 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 9492 s.data = s.data.replace( r20, "+" ); 9493 } 9494 9495 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9496 if ( s.ifModified ) { 9497 if ( jQuery.lastModified[ cacheURL ] ) { 9498 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9499 } 9500 if ( jQuery.etag[ cacheURL ] ) { 9501 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9502 } 9503 } 9504 9505 // Set the correct header, if data is being sent 9506 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9507 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9508 } 9509 9510 // Set the Accepts header for the server, depending on the dataType 9511 jqXHR.setRequestHeader( 9512 "Accept", 9513 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 9514 s.accepts[ s.dataTypes[ 0 ] ] + 9515 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9516 s.accepts[ "*" ] 9517 ); 9518 9519 // Check for headers option 9520 for ( i in s.headers ) { 9521 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9522 } 9523 9524 // Allow custom headers/mimetypes and early abort 9525 if ( s.beforeSend && 9526 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 9527 9528 // Abort if not done already and return 9529 return jqXHR.abort(); 9530 } 9531 9532 // Aborting is no longer a cancellation 9533 strAbort = "abort"; 9534 9535 // Install callbacks on deferreds 9536 completeDeferred.add( s.complete ); 9537 jqXHR.done( s.success ); 9538 jqXHR.fail( s.error ); 9539 9540 // Get transport 9541 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9542 9543 // If no transport, we auto-abort 9544 if ( !transport ) { 9545 done( -1, "No Transport" ); 9546 } else { 9547 jqXHR.readyState = 1; 9548 9549 // Send global event 9550 if ( fireGlobals ) { 9551 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9552 } 9553 9554 // If request was aborted inside ajaxSend, stop there 9555 if ( completed ) { 9556 return jqXHR; 9557 } 9558 9559 // Timeout 9560 if ( s.async && s.timeout > 0 ) { 9561 timeoutTimer = window.setTimeout( function() { 9562 jqXHR.abort( "timeout" ); 9563 }, s.timeout ); 9564 } 9565 9566 try { 9567 completed = false; 9568 transport.send( requestHeaders, done ); 9569 } catch ( e ) { 9570 9571 // Rethrow post-completion exceptions 9572 if ( completed ) { 9573 throw e; 9574 } 9575 9576 // Propagate others as results 9577 done( -1, e ); 9578 } 9579 } 9580 9581 // Callback for when everything is done 9582 function done( status, nativeStatusText, responses, headers ) { 9583 var isSuccess, success, error, response, modified, 9584 statusText = nativeStatusText; 9585 9586 // Ignore repeat invocations 9587 if ( completed ) { 9588 return; 9589 } 9590 9591 completed = true; 9592 9593 // Clear timeout if it exists 9594 if ( timeoutTimer ) { 9595 window.clearTimeout( timeoutTimer ); 9596 } 9597 9598 // Dereference transport for early garbage collection 9599 // (no matter how long the jqXHR object will be used) 9600 transport = undefined; 9601 9602 // Cache response headers 9603 responseHeadersString = headers || ""; 9604 9605 // Set readyState 9606 jqXHR.readyState = status > 0 ? 4 : 0; 9607 9608 // Determine if successful 9609 isSuccess = status >= 200 && status < 300 || status === 304; 9610 9611 // Get response data 9612 if ( responses ) { 9613 response = ajaxHandleResponses( s, jqXHR, responses ); 9614 } 9615 9616 // Use a noop converter for missing script but not if jsonp 9617 if ( !isSuccess && 9618 jQuery.inArray( "script", s.dataTypes ) > -1 && 9619 jQuery.inArray( "json", s.dataTypes ) < 0 ) { 9620 s.converters[ "text script" ] = function() {}; 9621 } 9622 9623 // Convert no matter what (that way responseXXX fields are always set) 9624 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9625 9626 // If successful, handle type chaining 9627 if ( isSuccess ) { 9628 9629 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9630 if ( s.ifModified ) { 9631 modified = jqXHR.getResponseHeader( "Last-Modified" ); 9632 if ( modified ) { 9633 jQuery.lastModified[ cacheURL ] = modified; 9634 } 9635 modified = jqXHR.getResponseHeader( "etag" ); 9636 if ( modified ) { 9637 jQuery.etag[ cacheURL ] = modified; 9638 } 9639 } 9640 9641 // if no content 9642 if ( status === 204 || s.type === "HEAD" ) { 9643 statusText = "nocontent"; 9644 9645 // if not modified 9646 } else if ( status === 304 ) { 9647 statusText = "notmodified"; 9648 9649 // If we have data, let's convert it 9650 } else { 9651 statusText = response.state; 9652 success = response.data; 9653 error = response.error; 9654 isSuccess = !error; 9655 } 9656 } else { 9657 9658 // Extract error from statusText and normalize for non-aborts 9659 error = statusText; 9660 if ( status || !statusText ) { 9661 statusText = "error"; 9662 if ( status < 0 ) { 9663 status = 0; 9664 } 9665 } 9666 } 9667 9668 // Set data for the fake xhr object 9669 jqXHR.status = status; 9670 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9671 9672 // Success/Error 9673 if ( isSuccess ) { 9674 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9675 } else { 9676 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9677 } 9678 9679 // Status-dependent callbacks 9680 jqXHR.statusCode( statusCode ); 9681 statusCode = undefined; 9682 9683 if ( fireGlobals ) { 9684 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9685 [ jqXHR, s, isSuccess ? success : error ] ); 9686 } 9687 9688 // Complete 9689 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9690 9691 if ( fireGlobals ) { 9692 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9693 9694 // Handle the global AJAX counter 9695 if ( !( --jQuery.active ) ) { 9696 jQuery.event.trigger( "ajaxStop" ); 9697 } 9698 } 9699 } 9700 9701 return jqXHR; 9702 }, 9703 9704 getJSON: function( url, data, callback ) { 9705 return jQuery.get( url, data, callback, "json" ); 9706 }, 9707 9708 getScript: function( url, callback ) { 9709 return jQuery.get( url, undefined, callback, "script" ); 9710 } 9711} ); 9712 9713jQuery.each( [ "get", "post" ], function( _i, method ) { 9714 jQuery[ method ] = function( url, data, callback, type ) { 9715 9716 // Shift arguments if data argument was omitted 9717 if ( isFunction( data ) ) { 9718 type = type || callback; 9719 callback = data; 9720 data = undefined; 9721 } 9722 9723 // The url can be an options object (which then must have .url) 9724 return jQuery.ajax( jQuery.extend( { 9725 url: url, 9726 type: method, 9727 dataType: type, 9728 data: data, 9729 success: callback 9730 }, jQuery.isPlainObject( url ) && url ) ); 9731 }; 9732} ); 9733 9734jQuery.ajaxPrefilter( function( s ) { 9735 var i; 9736 for ( i in s.headers ) { 9737 if ( i.toLowerCase() === "content-type" ) { 9738 s.contentType = s.headers[ i ] || ""; 9739 } 9740 } 9741} ); 9742 9743 9744jQuery._evalUrl = function( url, options, doc ) { 9745 return jQuery.ajax( { 9746 url: url, 9747 9748 // Make this explicit, since user can override this through ajaxSetup (trac-11264) 9749 type: "GET", 9750 dataType: "script", 9751 cache: true, 9752 async: false, 9753 global: false, 9754 9755 // Only evaluate the response if it is successful (gh-4126) 9756 // dataFilter is not invoked for failure responses, so using it instead 9757 // of the default converter is kludgy but it works. 9758 converters: { 9759 "text script": function() {} 9760 }, 9761 dataFilter: function( response ) { 9762 jQuery.globalEval( response, options, doc ); 9763 } 9764 } ); 9765}; 9766 9767 9768jQuery.fn.extend( { 9769 wrapAll: function( html ) { 9770 var wrap; 9771 9772 if ( this[ 0 ] ) { 9773 if ( isFunction( html ) ) { 9774 html = html.call( this[ 0 ] ); 9775 } 9776 9777 // The elements to wrap the target around 9778 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 9779 9780 if ( this[ 0 ].parentNode ) { 9781 wrap.insertBefore( this[ 0 ] ); 9782 } 9783 9784 wrap.map( function() { 9785 var elem = this; 9786 9787 while ( elem.firstElementChild ) { 9788 elem = elem.firstElementChild; 9789 } 9790 9791 return elem; 9792 } ).append( this ); 9793 } 9794 9795 return this; 9796 }, 9797 9798 wrapInner: function( html ) { 9799 if ( isFunction( html ) ) { 9800 return this.each( function( i ) { 9801 jQuery( this ).wrapInner( html.call( this, i ) ); 9802 } ); 9803 } 9804 9805 return this.each( function() { 9806 var self = jQuery( this ), 9807 contents = self.contents(); 9808 9809 if ( contents.length ) { 9810 contents.wrapAll( html ); 9811 9812 } else { 9813 self.append( html ); 9814 } 9815 } ); 9816 }, 9817 9818 wrap: function( html ) { 9819 var htmlIsFunction = isFunction( html ); 9820 9821 return this.each( function( i ) { 9822 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 9823 } ); 9824 }, 9825 9826 unwrap: function( selector ) { 9827 this.parent( selector ).not( "body" ).each( function() { 9828 jQuery( this ).replaceWith( this.childNodes ); 9829 } ); 9830 return this; 9831 } 9832} ); 9833 9834 9835jQuery.expr.pseudos.hidden = function( elem ) { 9836 return !jQuery.expr.pseudos.visible( elem ); 9837}; 9838jQuery.expr.pseudos.visible = function( elem ) { 9839 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 9840}; 9841 9842 9843 9844 9845jQuery.ajaxSettings.xhr = function() { 9846 try { 9847 return new window.XMLHttpRequest(); 9848 } catch ( e ) {} 9849}; 9850 9851var xhrSuccessStatus = { 9852 9853 // File protocol always yields status code 0, assume 200 9854 0: 200, 9855 9856 // Support: IE <=9 only 9857 // trac-1450: sometimes IE returns 1223 when it should be 204 9858 1223: 204 9859 }, 9860 xhrSupported = jQuery.ajaxSettings.xhr(); 9861 9862support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 9863support.ajax = xhrSupported = !!xhrSupported; 9864 9865jQuery.ajaxTransport( function( options ) { 9866 var callback, errorCallback; 9867 9868 // Cross domain only allowed if supported through XMLHttpRequest 9869 if ( support.cors || xhrSupported && !options.crossDomain ) { 9870 return { 9871 send: function( headers, complete ) { 9872 var i, 9873 xhr = options.xhr(); 9874 9875 xhr.open( 9876 options.type, 9877 options.url, 9878 options.async, 9879 options.username, 9880 options.password 9881 ); 9882 9883 // Apply custom fields if provided 9884 if ( options.xhrFields ) { 9885 for ( i in options.xhrFields ) { 9886 xhr[ i ] = options.xhrFields[ i ]; 9887 } 9888 } 9889 9890 // Override mime type if needed 9891 if ( options.mimeType && xhr.overrideMimeType ) { 9892 xhr.overrideMimeType( options.mimeType ); 9893 } 9894 9895 // X-Requested-With header 9896 // For cross-domain requests, seeing as conditions for a preflight are 9897 // akin to a jigsaw puzzle, we simply never set it to be sure. 9898 // (it can always be set on a per-request basis or even using ajaxSetup) 9899 // For same-domain requests, won't change header if already provided. 9900 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 9901 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 9902 } 9903 9904 // Set headers 9905 for ( i in headers ) { 9906 xhr.setRequestHeader( i, headers[ i ] ); 9907 } 9908 9909 // Callback 9910 callback = function( type ) { 9911 return function() { 9912 if ( callback ) { 9913 callback = errorCallback = xhr.onload = 9914 xhr.onerror = xhr.onabort = xhr.ontimeout = 9915 xhr.onreadystatechange = null; 9916 9917 if ( type === "abort" ) { 9918 xhr.abort(); 9919 } else if ( type === "error" ) { 9920 9921 // Support: IE <=9 only 9922 // On a manual native abort, IE9 throws 9923 // errors on any property access that is not readyState 9924 if ( typeof xhr.status !== "number" ) { 9925 complete( 0, "error" ); 9926 } else { 9927 complete( 9928 9929 // File: protocol always yields status 0; see trac-8605, trac-14207 9930 xhr.status, 9931 xhr.statusText 9932 ); 9933 } 9934 } else { 9935 complete( 9936 xhrSuccessStatus[ xhr.status ] || xhr.status, 9937 xhr.statusText, 9938 9939 // Support: IE <=9 only 9940 // IE9 has no XHR2 but throws on binary (trac-11426) 9941 // For XHR2 non-text, let the caller handle it (gh-2498) 9942 ( xhr.responseType || "text" ) !== "text" || 9943 typeof xhr.responseText !== "string" ? 9944 { binary: xhr.response } : 9945 { text: xhr.responseText }, 9946 xhr.getAllResponseHeaders() 9947 ); 9948 } 9949 } 9950 }; 9951 }; 9952 9953 // Listen to events 9954 xhr.onload = callback(); 9955 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 9956 9957 // Support: IE 9 only 9958 // Use onreadystatechange to replace onabort 9959 // to handle uncaught aborts 9960 if ( xhr.onabort !== undefined ) { 9961 xhr.onabort = errorCallback; 9962 } else { 9963 xhr.onreadystatechange = function() { 9964 9965 // Check readyState before timeout as it changes 9966 if ( xhr.readyState === 4 ) { 9967 9968 // Allow onerror to be called first, 9969 // but that will not handle a native abort 9970 // Also, save errorCallback to a variable 9971 // as xhr.onerror cannot be accessed 9972 window.setTimeout( function() { 9973 if ( callback ) { 9974 errorCallback(); 9975 } 9976 } ); 9977 } 9978 }; 9979 } 9980 9981 // Create the abort callback 9982 callback = callback( "abort" ); 9983 9984 try { 9985 9986 // Do send the request (this may raise an exception) 9987 xhr.send( options.hasContent && options.data || null ); 9988 } catch ( e ) { 9989 9990 // trac-14683: Only rethrow if this hasn't been notified as an error yet 9991 if ( callback ) { 9992 throw e; 9993 } 9994 } 9995 }, 9996 9997 abort: function() { 9998 if ( callback ) { 9999 callback(); 10000 } 10001 } 10002 }; 10003 } 10004} ); 10005 10006 10007 10008 10009// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 10010jQuery.ajaxPrefilter( function( s ) { 10011 if ( s.crossDomain ) { 10012 s.contents.script = false; 10013 } 10014} ); 10015 10016// Install script dataType 10017jQuery.ajaxSetup( { 10018 accepts: { 10019 script: "text/javascript, application/javascript, " + 10020 "application/ecmascript, application/x-ecmascript" 10021 }, 10022 contents: { 10023 script: /\b(?:java|ecma)script\b/ 10024 }, 10025 converters: { 10026 "text script": function( text ) { 10027 jQuery.globalEval( text ); 10028 return text; 10029 } 10030 } 10031} ); 10032 10033// Handle cache's special case and crossDomain 10034jQuery.ajaxPrefilter( "script", function( s ) { 10035 if ( s.cache === undefined ) { 10036 s.cache = false; 10037 } 10038 if ( s.crossDomain ) { 10039 s.type = "GET"; 10040 } 10041} ); 10042 10043// Bind script tag hack transport 10044jQuery.ajaxTransport( "script", function( s ) { 10045 10046 // This transport only deals with cross domain or forced-by-attrs requests 10047 if ( s.crossDomain || s.scriptAttrs ) { 10048 var script, callback; 10049 return { 10050 send: function( _, complete ) { 10051 script = jQuery( "<script>" ) 10052 .attr( s.scriptAttrs || {} ) 10053 .prop( { charset: s.scriptCharset, src: s.url } ) 10054 .on( "load error", callback = function( evt ) { 10055 script.remove(); 10056 callback = null; 10057 if ( evt ) { 10058 complete( evt.type === "error" ? 404 : 200, evt.type ); 10059 } 10060 } ); 10061 10062 // Use native DOM manipulation to avoid our domManip AJAX trickery 10063 document.head.appendChild( script[ 0 ] ); 10064 }, 10065 abort: function() { 10066 if ( callback ) { 10067 callback(); 10068 } 10069 } 10070 }; 10071 } 10072} ); 10073 10074 10075 10076 10077var oldCallbacks = [], 10078 rjsonp = /(=)\?(?=&|$)|\?\?/; 10079 10080// Default jsonp settings 10081jQuery.ajaxSetup( { 10082 jsonp: "callback", 10083 jsonpCallback: function() { 10084 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 10085 this[ callback ] = true; 10086 return callback; 10087 } 10088} ); 10089 10090// Detect, normalize options and install callbacks for jsonp requests 10091jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 10092 10093 var callbackName, overwritten, responseContainer, 10094 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 10095 "url" : 10096 typeof s.data === "string" && 10097 ( s.contentType || "" ) 10098 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 10099 rjsonp.test( s.data ) && "data" 10100 ); 10101 10102 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10103 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 10104 10105 // Get callback name, remembering preexisting value associated with it 10106 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 10107 s.jsonpCallback() : 10108 s.jsonpCallback; 10109 10110 // Insert callback into url or form data 10111 if ( jsonProp ) { 10112 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 10113 } else if ( s.jsonp !== false ) { 10114 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 10115 } 10116 10117 // Use data converter to retrieve json after script execution 10118 s.converters[ "script json" ] = function() { 10119 if ( !responseContainer ) { 10120 jQuery.error( callbackName + " was not called" ); 10121 } 10122 return responseContainer[ 0 ]; 10123 }; 10124 10125 // Force json dataType 10126 s.dataTypes[ 0 ] = "json"; 10127 10128 // Install callback 10129 overwritten = window[ callbackName ]; 10130 window[ callbackName ] = function() { 10131 responseContainer = arguments; 10132 }; 10133 10134 // Clean-up function (fires after converters) 10135 jqXHR.always( function() { 10136 10137 // If previous value didn't exist - remove it 10138 if ( overwritten === undefined ) { 10139 jQuery( window ).removeProp( callbackName ); 10140 10141 // Otherwise restore preexisting value 10142 } else { 10143 window[ callbackName ] = overwritten; 10144 } 10145 10146 // Save back as free 10147 if ( s[ callbackName ] ) { 10148 10149 // Make sure that re-using the options doesn't screw things around 10150 s.jsonpCallback = originalSettings.jsonpCallback; 10151 10152 // Save the callback name for future use 10153 oldCallbacks.push( callbackName ); 10154 } 10155 10156 // Call if it was a function and we have a response 10157 if ( responseContainer && isFunction( overwritten ) ) { 10158 overwritten( responseContainer[ 0 ] ); 10159 } 10160 10161 responseContainer = overwritten = undefined; 10162 } ); 10163 10164 // Delegate to script 10165 return "script"; 10166 } 10167} ); 10168 10169 10170 10171 10172// Support: Safari 8 only 10173// In Safari 8 documents created via document.implementation.createHTMLDocument 10174// collapse sibling forms: the second one becomes a child of the first one. 10175// Because of that, this security measure has to be disabled in Safari 8. 10176// https://bugs.webkit.org/show_bug.cgi?id=137337 10177support.createHTMLDocument = ( function() { 10178 var body = document.implementation.createHTMLDocument( "" ).body; 10179 body.innerHTML = "<form></form><form></form>"; 10180 return body.childNodes.length === 2; 10181} )(); 10182 10183 10184// Argument "data" should be string of html 10185// context (optional): If specified, the fragment will be created in this context, 10186// defaults to document 10187// keepScripts (optional): If true, will include scripts passed in the html string 10188jQuery.parseHTML = function( data, context, keepScripts ) { 10189 if ( typeof data !== "string" ) { 10190 return []; 10191 } 10192 if ( typeof context === "boolean" ) { 10193 keepScripts = context; 10194 context = false; 10195 } 10196 10197 var base, parsed, scripts; 10198 10199 if ( !context ) { 10200 10201 // Stop scripts or inline event handlers from being executed immediately 10202 // by using document.implementation 10203 if ( support.createHTMLDocument ) { 10204 context = document.implementation.createHTMLDocument( "" ); 10205 10206 // Set the base href for the created document 10207 // so any parsed elements with URLs 10208 // are based on the document's URL (gh-2965) 10209 base = context.createElement( "base" ); 10210 base.href = document.location.href; 10211 context.head.appendChild( base ); 10212 } else { 10213 context = document; 10214 } 10215 } 10216 10217 parsed = rsingleTag.exec( data ); 10218 scripts = !keepScripts && []; 10219 10220 // Single tag 10221 if ( parsed ) { 10222 return [ context.createElement( parsed[ 1 ] ) ]; 10223 } 10224 10225 parsed = buildFragment( [ data ], context, scripts ); 10226 10227 if ( scripts && scripts.length ) { 10228 jQuery( scripts ).remove(); 10229 } 10230 10231 return jQuery.merge( [], parsed.childNodes ); 10232}; 10233 10234 10235/** 10236 * Load a url into a page 10237 */ 10238jQuery.fn.load = function( url, params, callback ) { 10239 var selector, type, response, 10240 self = this, 10241 off = url.indexOf( " " ); 10242 10243 if ( off > -1 ) { 10244 selector = stripAndCollapse( url.slice( off ) ); 10245 url = url.slice( 0, off ); 10246 } 10247 10248 // If it's a function 10249 if ( isFunction( params ) ) { 10250 10251 // We assume that it's the callback 10252 callback = params; 10253 params = undefined; 10254 10255 // Otherwise, build a param string 10256 } else if ( params && typeof params === "object" ) { 10257 type = "POST"; 10258 } 10259 10260 // If we have elements to modify, make the request 10261 if ( self.length > 0 ) { 10262 jQuery.ajax( { 10263 url: url, 10264 10265 // If "type" variable is undefined, then "GET" method will be used. 10266 // Make value of this field explicit since 10267 // user can override it through ajaxSetup method 10268 type: type || "GET", 10269 dataType: "html", 10270 data: params 10271 } ).done( function( responseText ) { 10272 10273 // Save response for use in complete callback 10274 response = arguments; 10275 10276 self.html( selector ? 10277 10278 // If a selector was specified, locate the right elements in a dummy div 10279 // Exclude scripts to avoid IE 'Permission Denied' errors 10280 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 10281 10282 // Otherwise use the full result 10283 responseText ); 10284 10285 // If the request succeeds, this function gets "data", "status", "jqXHR" 10286 // but they are ignored because response was set above. 10287 // If it fails, this function gets "jqXHR", "status", "error" 10288 } ).always( callback && function( jqXHR, status ) { 10289 self.each( function() { 10290 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 10291 } ); 10292 } ); 10293 } 10294 10295 return this; 10296}; 10297 10298 10299 10300 10301jQuery.expr.pseudos.animated = function( elem ) { 10302 return jQuery.grep( jQuery.timers, function( fn ) { 10303 return elem === fn.elem; 10304 } ).length; 10305}; 10306 10307 10308 10309 10310jQuery.offset = { 10311 setOffset: function( elem, options, i ) { 10312 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10313 position = jQuery.css( elem, "position" ), 10314 curElem = jQuery( elem ), 10315 props = {}; 10316 10317 // Set position first, in-case top/left are set even on static elem 10318 if ( position === "static" ) { 10319 elem.style.position = "relative"; 10320 } 10321 10322 curOffset = curElem.offset(); 10323 curCSSTop = jQuery.css( elem, "top" ); 10324 curCSSLeft = jQuery.css( elem, "left" ); 10325 calculatePosition = ( position === "absolute" || position === "fixed" ) && 10326 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 10327 10328 // Need to be able to calculate position if either 10329 // top or left is auto and position is either absolute or fixed 10330 if ( calculatePosition ) { 10331 curPosition = curElem.position(); 10332 curTop = curPosition.top; 10333 curLeft = curPosition.left; 10334 10335 } else { 10336 curTop = parseFloat( curCSSTop ) || 0; 10337 curLeft = parseFloat( curCSSLeft ) || 0; 10338 } 10339 10340 if ( isFunction( options ) ) { 10341 10342 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 10343 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 10344 } 10345 10346 if ( options.top != null ) { 10347 props.top = ( options.top - curOffset.top ) + curTop; 10348 } 10349 if ( options.left != null ) { 10350 props.left = ( options.left - curOffset.left ) + curLeft; 10351 } 10352 10353 if ( "using" in options ) { 10354 options.using.call( elem, props ); 10355 10356 } else { 10357 curElem.css( props ); 10358 } 10359 } 10360}; 10361 10362jQuery.fn.extend( { 10363 10364 // offset() relates an element's border box to the document origin 10365 offset: function( options ) { 10366 10367 // Preserve chaining for setter 10368 if ( arguments.length ) { 10369 return options === undefined ? 10370 this : 10371 this.each( function( i ) { 10372 jQuery.offset.setOffset( this, options, i ); 10373 } ); 10374 } 10375 10376 var rect, win, 10377 elem = this[ 0 ]; 10378 10379 if ( !elem ) { 10380 return; 10381 } 10382 10383 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 10384 // Support: IE <=11 only 10385 // Running getBoundingClientRect on a 10386 // disconnected node in IE throws an error 10387 if ( !elem.getClientRects().length ) { 10388 return { top: 0, left: 0 }; 10389 } 10390 10391 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 10392 rect = elem.getBoundingClientRect(); 10393 win = elem.ownerDocument.defaultView; 10394 return { 10395 top: rect.top + win.pageYOffset, 10396 left: rect.left + win.pageXOffset 10397 }; 10398 }, 10399 10400 // position() relates an element's margin box to its offset parent's padding box 10401 // This corresponds to the behavior of CSS absolute positioning 10402 position: function() { 10403 if ( !this[ 0 ] ) { 10404 return; 10405 } 10406 10407 var offsetParent, offset, doc, 10408 elem = this[ 0 ], 10409 parentOffset = { top: 0, left: 0 }; 10410 10411 // position:fixed elements are offset from the viewport, which itself always has zero offset 10412 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10413 10414 // Assume position:fixed implies availability of getBoundingClientRect 10415 offset = elem.getBoundingClientRect(); 10416 10417 } else { 10418 offset = this.offset(); 10419 10420 // Account for the *real* offset parent, which can be the document or its root element 10421 // when a statically positioned element is identified 10422 doc = elem.ownerDocument; 10423 offsetParent = elem.offsetParent || doc.documentElement; 10424 while ( offsetParent && 10425 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 10426 jQuery.css( offsetParent, "position" ) === "static" ) { 10427 10428 offsetParent = offsetParent.parentNode; 10429 } 10430 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 10431 10432 // Incorporate borders into its offset, since they are outside its content origin 10433 parentOffset = jQuery( offsetParent ).offset(); 10434 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 10435 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 10436 } 10437 } 10438 10439 // Subtract parent offsets and element margins 10440 return { 10441 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10442 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 10443 }; 10444 }, 10445 10446 // This method will return documentElement in the following cases: 10447 // 1) For the element inside the iframe without offsetParent, this method will return 10448 // documentElement of the parent window 10449 // 2) For the hidden or detached element 10450 // 3) For body or html element, i.e. in case of the html node - it will return itself 10451 // 10452 // but those exceptions were never presented as a real life use-cases 10453 // and might be considered as more preferable results. 10454 // 10455 // This logic, however, is not guaranteed and can change at any point in the future 10456 offsetParent: function() { 10457 return this.map( function() { 10458 var offsetParent = this.offsetParent; 10459 10460 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 10461 offsetParent = offsetParent.offsetParent; 10462 } 10463 10464 return offsetParent || documentElement; 10465 } ); 10466 } 10467} ); 10468 10469// Create scrollLeft and scrollTop methods 10470jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10471 var top = "pageYOffset" === prop; 10472 10473 jQuery.fn[ method ] = function( val ) { 10474 return access( this, function( elem, method, val ) { 10475 10476 // Coalesce documents and windows 10477 var win; 10478 if ( isWindow( elem ) ) { 10479 win = elem; 10480 } else if ( elem.nodeType === 9 ) { 10481 win = elem.defaultView; 10482 } 10483 10484 if ( val === undefined ) { 10485 return win ? win[ prop ] : elem[ method ]; 10486 } 10487 10488 if ( win ) { 10489 win.scrollTo( 10490 !top ? val : win.pageXOffset, 10491 top ? val : win.pageYOffset 10492 ); 10493 10494 } else { 10495 elem[ method ] = val; 10496 } 10497 }, method, val, arguments.length ); 10498 }; 10499} ); 10500 10501// Support: Safari <=7 - 9.1, Chrome <=37 - 49 10502// Add the top/left cssHooks using jQuery.fn.position 10503// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10504// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 10505// getComputedStyle returns percent when specified for top/left/bottom/right; 10506// rather than make the css module depend on the offset module, just check for it here 10507jQuery.each( [ "top", "left" ], function( _i, prop ) { 10508 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10509 function( elem, computed ) { 10510 if ( computed ) { 10511 computed = curCSS( elem, prop ); 10512 10513 // If curCSS returns percentage, fallback to offset 10514 return rnumnonpx.test( computed ) ? 10515 jQuery( elem ).position()[ prop ] + "px" : 10516 computed; 10517 } 10518 } 10519 ); 10520} ); 10521 10522 10523// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10524jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10525 jQuery.each( { 10526 padding: "inner" + name, 10527 content: type, 10528 "": "outer" + name 10529 }, function( defaultExtra, funcName ) { 10530 10531 // Margin is only for outerHeight, outerWidth 10532 jQuery.fn[ funcName ] = function( margin, value ) { 10533 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10534 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10535 10536 return access( this, function( elem, type, value ) { 10537 var doc; 10538 10539 if ( isWindow( elem ) ) { 10540 10541 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 10542 return funcName.indexOf( "outer" ) === 0 ? 10543 elem[ "inner" + name ] : 10544 elem.document.documentElement[ "client" + name ]; 10545 } 10546 10547 // Get document width or height 10548 if ( elem.nodeType === 9 ) { 10549 doc = elem.documentElement; 10550 10551 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10552 // whichever is greatest 10553 return Math.max( 10554 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10555 elem.body[ "offset" + name ], doc[ "offset" + name ], 10556 doc[ "client" + name ] 10557 ); 10558 } 10559 10560 return value === undefined ? 10561 10562 // Get width or height on the element, requesting but not forcing parseFloat 10563 jQuery.css( elem, type, extra ) : 10564 10565 // Set width or height on the element 10566 jQuery.style( elem, type, value, extra ); 10567 }, type, chainable ? margin : undefined, chainable ); 10568 }; 10569 } ); 10570} ); 10571 10572 10573jQuery.each( [ 10574 "ajaxStart", 10575 "ajaxStop", 10576 "ajaxComplete", 10577 "ajaxError", 10578 "ajaxSuccess", 10579 "ajaxSend" 10580], function( _i, type ) { 10581 jQuery.fn[ type ] = function( fn ) { 10582 return this.on( type, fn ); 10583 }; 10584} ); 10585 10586 10587 10588 10589jQuery.fn.extend( { 10590 10591 bind: function( types, data, fn ) { 10592 return this.on( types, null, data, fn ); 10593 }, 10594 unbind: function( types, fn ) { 10595 return this.off( types, null, fn ); 10596 }, 10597 10598 delegate: function( selector, types, data, fn ) { 10599 return this.on( types, selector, data, fn ); 10600 }, 10601 undelegate: function( selector, types, fn ) { 10602 10603 // ( namespace ) or ( selector, types [, fn] ) 10604 return arguments.length === 1 ? 10605 this.off( selector, "**" ) : 10606 this.off( types, selector || "**", fn ); 10607 }, 10608 10609 hover: function( fnOver, fnOut ) { 10610 return this 10611 .on( "mouseenter", fnOver ) 10612 .on( "mouseleave", fnOut || fnOver ); 10613 } 10614} ); 10615 10616jQuery.each( 10617 ( "blur focus focusin focusout resize scroll click dblclick " + 10618 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 10619 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 10620 function( _i, name ) { 10621 10622 // Handle event binding 10623 jQuery.fn[ name ] = function( data, fn ) { 10624 return arguments.length > 0 ? 10625 this.on( name, null, data, fn ) : 10626 this.trigger( name ); 10627 }; 10628 } 10629); 10630 10631 10632 10633 10634// Support: Android <=4.0 only 10635// Make sure we trim BOM and NBSP 10636// Require that the "whitespace run" starts from a non-whitespace 10637// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. 10638var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 10639 10640// Bind a function to a context, optionally partially applying any 10641// arguments. 10642// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 10643// However, it is not slated for removal any time soon 10644jQuery.proxy = function( fn, context ) { 10645 var tmp, args, proxy; 10646 10647 if ( typeof context === "string" ) { 10648 tmp = fn[ context ]; 10649 context = fn; 10650 fn = tmp; 10651 } 10652 10653 // Quick check to determine if target is callable, in the spec 10654 // this throws a TypeError, but we will just return undefined. 10655 if ( !isFunction( fn ) ) { 10656 return undefined; 10657 } 10658 10659 // Simulated bind 10660 args = slice.call( arguments, 2 ); 10661 proxy = function() { 10662 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 10663 }; 10664 10665 // Set the guid of unique handler to the same of original handler, so it can be removed 10666 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 10667 10668 return proxy; 10669}; 10670 10671jQuery.holdReady = function( hold ) { 10672 if ( hold ) { 10673 jQuery.readyWait++; 10674 } else { 10675 jQuery.ready( true ); 10676 } 10677}; 10678jQuery.isArray = Array.isArray; 10679jQuery.parseJSON = JSON.parse; 10680jQuery.nodeName = nodeName; 10681jQuery.isFunction = isFunction; 10682jQuery.isWindow = isWindow; 10683jQuery.camelCase = camelCase; 10684jQuery.type = toType; 10685 10686jQuery.now = Date.now; 10687 10688jQuery.isNumeric = function( obj ) { 10689 10690 // As of jQuery 3.0, isNumeric is limited to 10691 // strings and numbers (primitives or objects) 10692 // that can be coerced to finite numbers (gh-2662) 10693 var type = jQuery.type( obj ); 10694 return ( type === "number" || type === "string" ) && 10695 10696 // parseFloat NaNs numeric-cast false positives ("") 10697 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 10698 // subtraction forces infinities to NaN 10699 !isNaN( obj - parseFloat( obj ) ); 10700}; 10701 10702jQuery.trim = function( text ) { 10703 return text == null ? 10704 "" : 10705 ( text + "" ).replace( rtrim, "$1" ); 10706}; 10707 10708 10709 10710// Register as a named AMD module, since jQuery can be concatenated with other 10711// files that may use define, but not via a proper concatenation script that 10712// understands anonymous AMD modules. A named AMD is safest and most robust 10713// way to register. Lowercase jquery is used because AMD module names are 10714// derived from file names, and jQuery is normally delivered in a lowercase 10715// file name. Do this after creating the global so that if an AMD module wants 10716// to call noConflict to hide this version of jQuery, it will work. 10717 10718// Note that for maximum portability, libraries that are not jQuery should 10719// declare themselves as anonymous modules, and avoid setting a global if an 10720// AMD loader is present. jQuery is a special case. For more information, see 10721// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10722 10723if ( typeof define === "function" && define.amd ) { 10724 define( "jquery", [], function() { 10725 return jQuery; 10726 } ); 10727} 10728 10729 10730 10731 10732var 10733 10734 // Map over jQuery in case of overwrite 10735 _jQuery = window.jQuery, 10736 10737 // Map over the $ in case of overwrite 10738 _$ = window.$; 10739 10740jQuery.noConflict = function( deep ) { 10741 if ( window.$ === jQuery ) { 10742 window.$ = _$; 10743 } 10744 10745 if ( deep && window.jQuery === jQuery ) { 10746 window.jQuery = _jQuery; 10747 } 10748 10749 return jQuery; 10750}; 10751 10752// Expose jQuery and $ identifiers, even in AMD 10753// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) 10754// and CommonJS for browser emulators (trac-13566) 10755if ( typeof noGlobal === "undefined" ) { 10756 window.jQuery = window.$ = jQuery; 10757} 10758 10759 10760 10761 10762return jQuery; 10763} ); 10764/* End */ 10765; 10766; /* Start:"a:4:{s:4:"full";s:67:"/local/templates/rr-wheels_corp/js/jquery-ui.min.js?177520238622229";s:6:"source";s:51:"/local/templates/rr-wheels_corp/js/jquery-ui.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 10767/*! jQuery UI - v1.12.1 - 2018-05-02 10768* http://jqueryui.com
10769* Includes: widget.js, keycode.js, widgets/mouse.js, widgets/slider.js 10770* Copyright jQuery Foundation and other contributors; Licensed MIT */ 10771�
vendor: 22,024 bytes, lines 10771-10772
10771 10772(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){t.ui=t.ui||{},t.ui.version="1.12.1";var e=0,i=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},l=e.split(".")[0];e=e.split(".")[1];var h=l+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var s,n,o=i.call(arguments,1),a=0,r=o.length;r>a;a++)for(s in o[a])n=o[a][s],o[a].hasOwnProperty(s)&&void 0!==n&&(e[s]=t.isPlainObject(n)?t.isPlainObject(e[s])?t.widget.extend({},e[s],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,s){var n=s.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=i.call(arguments,1),l=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(l=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):l=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new s(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(i,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=e++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),i),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var s=!1;t(document).on("mouseup",function(){s=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!s){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,n=1===e.which,o="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return n&&!o&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),s=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,s=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.widget("ui.slider",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle"),o="<span tabindex='0'></span>",a=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)a.push(o);this.handles=n.add(t(a.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=t("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),("min"===e.range||"max"===e.range)&&this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,o,a,r,l,h,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-c.values(e));(n>i||n===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(n=i,o=t(this),a=e)}),r=this._start(e,a),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=a,this._addClass(o,null,"ui-state-active"),o.trigger("focus"),l=o.offset(),h=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=h?{left:0,top:0}:{left:e.pageX-l.left-o.width()/2,top:e.pageY-l.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,a,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,o;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),o=this._valueMin()+s*n,this._trimAlignValue(o)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n,o=this.value(),a=this.values();this._hasMultipleValues()&&(n=this.values(e?0:1),o=this.values(e),2===this.options.values.length&&this.options.range===!0&&(i=0===e?Math.min(n,i):Math.max(n,i)),a[e]=i),i!==o&&(s=this._trigger("slide",t,this._uiHash(e,i,a)),s!==!1&&(this._hasMultipleValues()?this.values(e,i):this.value(i)))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(e,i){var s,n,o;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),void 0;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this._hasMultipleValues()?this._values(e):this.value();for(s=this.options.values,n=arguments[0],o=0;s.length>o;o+=1)s[o]=this._trimAlignValue(n[o]),this._change(null,o);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),this._super(e,i),e){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(i),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=n-1;s>=0;s--)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this._hasMultipleValues()){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step,s=Math.round((t-e)/i)*i;t=s+e,t>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,s,n,o,a=this.options.range,r=this.options,l=this,h=this._animateOff?!1:r.animate,c={};this._hasMultipleValues()?this.handles.each(function(s){i=100*((l.values(s)-l._valueMin())/(l._valueMax()-l._valueMin())),c["horizontal"===l.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[h?"animate":"css"](c,r.animate),l.options.range===!0&&("horizontal"===l.orientation?(0===s&&l.range.stop(1,1)[h?"animate":"css"]({left:i+"%"},r.animate),1===s&&l.range[h?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&l.range.stop(1,1)[h?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&l.range[h?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),o=this._valueMax(),i=o!==n?100*((s-n)/(o-n)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[h?"animate":"css"](c,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:100-i+"%"},r.animate),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:100-i+"%"},r.animate))},_handleEvents:{keydown:function(e){var i,s,n,o,a=t(e.target).data("ui-slider-handle-index");switch(e.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(e.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(t(e.target),null,"ui-state-active"),i=this._start(e,a),i===!1))return}switch(o=this.options.step,s=n=this._hasMultipleValues()?this.values(a):this.value(),e.keyCode){case t.ui.keyCode.HOME:n=this._valueMin();break;case t.ui.keyCode.END:n=this._valueMax();break;case t.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-o)}this._slide(e,a,n)},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),this._removeClass(t(e.target),null,"ui-state-active"))}}})});
vendor: 25,329 bytes, lines 10772-10776
10772 10773/* End */ 10774; 10775; /* Start:"a:4:{s:4:"full";s:70:"/local/templates/rr-wheels_corp/js/jquery.fancybox.js?1775202386142360";s:6:"source";s:53:"/local/templates/rr-wheels_corp/js/jquery.fancybox.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 10776!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),i=function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,n=-1!==i.indexOf("hidden"),s=-1!==i.indexOf("visible");return e&&!n&&!s},n=function(t,e=void 0){return!(!t||t===document.body||e&&t===e)&&(i(t)?t:n(t.parentElement,e))},s=function(t){var e=(new DOMParser).parseFromString(t,"text/html").body;if(e.childElementCount>1){for(var i=document.createElement("div");e.firstChild;)i.appendChild(e.firstChild);return i}return e.firstChild},o=t=>`${t||""}`.split(" ").filter((t=>!!t)),a=(t,e,i)=>{t&&o(e).forEach((e=>{t.classList.toggle(e,i||!1)}))};class r{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const l={passive:!1};class c{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:n=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=n;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("mousedown",this.onPointerStart,l),this.element.addEventListener("touchstart",this.onTouchStart,l),this.element.addEventListener("touchmove",this.onMove,l),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new r(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches||[]))this.triggerPointerStart(new r(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches||[]).map((t=>new r(t))):[new r(t)],n=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(n.push(t),this.currentPointers[e]=t)}n.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new r(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches||[]))this.triggerPointerEnd(t,new r(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,l),this.element.removeEventListener("touchstart",this.onTouchStart,l),this.element.removeEventListener("touchmove",this.onMove,l),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function h(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function d(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const u=t=>"object"==typeof t&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t),p=(t,...e)=>{const i=e.length;for(let n=0;n<i;n++){const i=e[n]||{};Object.entries(i).forEach((([e,i])=>{const n=Array.isArray(i)?[]:{};t[e]||Object.assign(t,{[e]:n}),u(i)?Object.assign(t[e],p(n,i)):Array.isArray(i)?Object.assign(t,{[e]:[...i]}):Object.assign(t,{[e]:i})}))}return t},f=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class g{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?p({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=f(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...n){let s=f(e,t);var o;"string"!=typeof(o=s)||isNaN(o)||isNaN(parseFloat(o))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...n));let a=f(e,this.options);return a&&"function"==typeof a?s=a.call(this,this,t,...n,s):void 0===s&&(s=a),void 0===s?i:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;i<e.length;i++)t=t.split(e[i][0]).join(e[i][1]);return t=t.replace(/\{\{(.*?)\}\}/g,((t,e)=>e))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(g,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(g,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class m extends g{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,n]of Object.entries(t)){const t=this.option(i),s=this.plugins[i];s||!1===t?s&&!1===t&&(s.detach(),delete this.plugins[i]):e.set(i,new n(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach()}detachPlugins(t){t=t||Object.keys(this.plugins);for(const e of t){const t=this.plugins[e];t&&t.detach(),delete this.plugins[e]}return this.emit("detachPlugins"),this}}var v;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(v||(v={}));const b=["a","b","c","d","e","f"],y={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},w={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:y},x='<circle cx="25" cy="25" r="20"></circle>',E='<div class="f-spinner"><svg viewBox="0 0 50 50">'+x+x+"</svg></div>",S=t=>t&&null!==t&&t instanceof Element&&"nodeType"in t,P=(t,e)=>{t&&o(e).forEach((e=>{t.classList.remove(e)}))},C=(t,e)=>{t&&o(e).forEach((e=>{t.classList.add(e)}))},T={a:1,b:0,c:0,d:1,e:0,f:0},M=1e5,O=1e4,A="mousemove",L="drag",z="content",R="auto";let k=null,I=null;class D extends m{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return null===I&&(I=window.matchMedia("(hover: none)").matches),I}get isMobile(){return null===k&&(k=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),k}get panMode(){return this.options.panMode!==A||this.isTouchDevice?L:A}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return t===R?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const t=this.content;return!!(t&&t instanceof HTMLImageElement)&&!t.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of b){const e="e"==t||"f"===t?1e-4:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var n;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"cwd",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pmme",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:v.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},T)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},T)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("Container Element Not Found");this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},D.Plugins),i)),this.emit("attachPlugins"),this.emit("init");const o=this.content;if(o.addEventListener("load",this.onLoad),o.addEventListener("error",this.onError),this.isContentLoading){if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const e=s(E);!t.contains(o)||o.parentElement instanceof HTMLPictureElement?this.spinner=t.appendChild(e):this.spinner=(null===(n=o.parentElement)||void 0===n?void 0:n.insertBefore(e,o))||null}this.emit("beforeLoad")}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this,e=this.cn(z);let i=this.option(z)||t.querySelector(`.${e}`);if(i||(i=t.querySelector("img,picture")||t.firstElementChild,i&&C(i,e)),i instanceof HTMLPictureElement&&(i=i.querySelector("img")),!i)throw new Error("No content found");this.content=i}onLoad(){const{spinner:t,container:e,state:i}=this;t&&(t.remove(),this.spinner=null),this.option("spinner")&&e.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),i===v.Init?this.enable():this.updateMetrics()}onError(){this.state!==v.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=v.Error,this.emit("error"))}getNextScale(t){const{fullScale:e,targetScale:i,coverScale:n,maxScale:s,minScale:o}=this;let a=o;switch(t){case"toggleMax":a=i-o<.5*(s-o)?s:o;break;case"toggleCover":a=i-o<.5*(n-o)?n:o;break;case"toggleZoom":a=i-o<.5*(e-o)?e:o;break;case"iterateZoom":let t=[1,e,s].sort(((t,e)=>t-e)),r=t.findIndex((t=>t>i+1e-5));a=t[r]||1}return a}attachObserver(){var t;const e=()=>{const{container:t,containerRect:e}=this;return Math.abs(e.width-t.getBoundingClientRect().width)>.1||Math.abs(e.height-t.getBoundingClientRect().height)>.1};this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((()=>{this.updateTimer||(e()?(this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{e()&&this.onResize(),this.updateTimer=null}),500))):this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null))}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new c(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(A,this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener(A,this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.friction,e=this.option("maxVelocity");for(const i of b)t?(this.velocity[i]*=1-t,e&&!this.isScaling&&(this.velocity[i]=Math.max(Math.min(this.velocity[i],e),-1*e)),this.current[i]+=this.velocity[i]):this.current[i]=this.target[i];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of b)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,n=i.e+t,s=i.f+e,o=this.getBounds(),{x:a,y:r}=o,l=a.min,c=a.max,h=r.min,d=r.max;let u=0,p=0;return l!==1/0&&n<l?u=l-n:c!==1/0&&n>c&&(u=c-n),h!==1/0&&s<h?p=h-s:d!==1/0&&s>d&&(p=d-s),Math.abs(u)<1e-4&&(u=0),Math.abs(p)<1e-4&&(p=0),Object.assign(Object.assign({},o),{xDiff:u,yDiff:p,inBounds:!u&&!p})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:n,fitHeight:s,fullWidth:o,fullHeight:a}=i;let r=o,l=a;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),c=i?o:n,h=i?a:s,d=this.getMatrix(t),u=new DOMPoint(0,0).matrixTransform(d),p=new DOMPoint(0+c,0).matrixTransform(d),f=new DOMPoint(0+c,0+h).matrixTransform(d),g=new DOMPoint(0,0+h).matrixTransform(d),m=Math.abs(f.x-u.x),v=Math.abs(f.y-u.y),b=Math.abs(g.x-p.x),y=Math.abs(g.y-p.y);r=Math.max(m,b),l=Math.max(v,y)}return{contentWidth:r,contentHeight:l}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===A||this.targetScale<this.scale)return this.isBouncingX=!1,void(this.isBouncingY=!1);const{target:t}=this,{x:e,y:i,xDiff:n,yDiff:s}=this.checkBounds();const o=this.option("maxVelocity");let a=this.velocity.e,r=this.velocity.f;0!==n?(this.isBouncingX=!0,n*a<=0?a+=.14*n:(a=.14*n,e.min!==1/0&&(this.target.e=Math.max(t.e,e.min)),e.max!==1/0&&(this.target.e=Math.min(t.e,e.max))),o&&(a=Math.max(Math.min(a,o),-1*o))):this.isBouncingX=!1,0!==s?(this.isBouncingY=!0,s*r<=0?r+=.14*s:(r=.14*s,i.min!==1/0&&(this.target.f=Math.max(t.f,i.min)),i.max!==1/0&&(this.target.f=Math.min(t.f,i.max))),o&&(r=Math.max(Math.min(r,o),-1*o))):this.isBouncingY=!1,this.isBouncingX&&(this.velocity.e=a),this.isBouncingY&&(this.velocity.f=r)}enable(){const{content:t}=this,e=new DOMMatrixReadOnly(window.getComputedStyle(t).transform);for(const t of b)this.current[t]=this.target[t]=e[t];this.updateMetrics(),this.attachObserver(),this.attachEvents(),this.state=v.Ready,this.emit("ready")}onClick(t){var e;"click"===t.type&&0===t.detail&&(this.dragOffset.x=0,this.dragOffset.y=0),this.isDragging&&(null===(e=this.pointerTracker)||void 0===e||e.clear(),this.trackingPoints=[],this.startDecelAnim());const i=t.target;if(!i||t.defaultPrevented)return;if(i.hasAttribute("disabled"))return t.preventDefault(),void t.stopPropagation();if((()=>{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const n=i.closest("[data-panzoom-action]"),s=i.closest("[data-panzoom-change]"),o=n||s,a=o&&S(o)?o.dataset:null;if(a){const e=a.panzoomChange,i=a.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();if(i.closest("[data-fancybox]"))return;const r=this.content.getBoundingClientRect(),l=this.dragStart;if(l.time&&!this.canZoomOut()&&(Math.abs(r.x-l.x)>2||Math.abs(r.y-l.y)>2))return;this.dragStart.time=0;const c=e=>{this.option("zoom",t)&&e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},h=this.option("click",t),d=this.option("dblClick",t);d?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&h&&c(h)):(this.emit("dblClick",t),t.defaultPrevented||c(d)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&h&&c(h))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(t,e,i){var n;if(!1===this.option("touch",t))return!1;this.pwt=0,this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const s=this.content.getBoundingClientRect();if(this.dragStart={x:s.x,y:s.y,top:s.top,left:s.left,time:Date.now()},this.clickTimer)return!1;if(this.panMode===A&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;const o=t.composedPath()[0];if(!i.length){if(["TEXTAREA","OPTION","INPUT","SELECT","VIDEO","IFRAME"].includes(o.nodeName)||o.closest("[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]"))return!1;null===(n=window.getSelection())||void 0===n||n.removeAllRanges()}if("mousedown"===t.type)["A","BUTTON"].includes(o.nodeName)||t.preventDefault();else if(Math.abs(this.velocity.a)>.3)return!1;return this.target.e=this.current.e,this.target.f=this.current.f,this.stop(),this.isDragging||(this.isDragging=!0,this.addTrackingPoint(e),this.emit("touchStart",t)),!0}onPointerMove(t,i,s){if(!1===this.option("touch",t))return;if(!this.isDragging)return;if(i.length<2&&this.panOnlyZoomed&&e(this.targetScale)<=e(this.minScale))return;if(this.emit("touchMove",t),t.defaultPrevented)return;this.addTrackingPoint(i[0]);const{content:o}=this,a=d(s[0],s[1]),r=d(i[0],i[1]);let l=0,c=0;if(i.length>1){const t=o.getBoundingClientRect();l=a.clientX-t.left-.5*t.width,c=a.clientY-t.top-.5*t.height}const u=h(s[0],s[1]),p=h(i[0],i[1]);let f=u?p/u:1,g=r.clientX-a.clientX,m=r.clientY-a.clientY;this.dragOffset.x+=g,this.dragOffset.y+=m,this.dragOffset.time=Date.now()-this.dragStart.time;let v=e(this.targetScale)===e(this.minScale)&&this.option("lockAxis");if(v&&!this.lockedAxis)if("xy"===v||"y"===v||"touchmove"===t.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const e=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=e>45&&e<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,g=0,m=0}else this.lockedAxis=v;if(n(t.target,this.content)&&(v="x",this.dragOffset.y=0),v&&"xy"!==v&&this.lockedAxis!==v&&e(this.targetScale)===e(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const b=this.checkBounds(g,m);this.option("rubberband")?("x"!==this.isInfinite&&(b.xDiff>0&&g<0||b.xDiff<0&&g>0)&&(g*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*b.xDiff))),"y"!==this.isInfinite&&(b.yDiff>0&&m<0||b.yDiff<0&&m>0)&&(m*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*b.yDiff)))):(b.xDiff&&(g=0),b.yDiff&&(m=0));const y=this.targetScale,w=this.minScale,x=this.maxScale;y<.5*w&&(f=Math.max(f,w)),y>
vendor: 13,574 bytes, line 10776
107761.5*x&&(f=Math.min(f,x)),"y"===this.lockedAxis&&e(y)===e(w)&&(g=0),"x"===this.lockedAxis&&e(y)===e(w)&&(m=0),this.applyChange({originX:l,originY:c,panX:g,panY:m,scale:f,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,e,i){if(i.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.addTrackingPoint(e),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),n(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.isDragging=!1,this.lockedAxis=!1,this.state!==v.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){var t;const i=this.isScaling;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of b)this.velocity[t]=0;this.target.e=this.current.e,this.target.f=this.current.f,P(this.container,"is-scaling"),P(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:n}=this,s=n[0],o=n[n.length-1];let a=0,r=0,l=0;o&&s&&(a=o.clientX-s.clientX,r=o.clientY-s.clientY,l=o.time-s.time);const c=(null===(t=window.visualViewport)||void 0===t?void 0:t.scale)||1;1!==c&&(a*=c,r*=c);let h=0,d=0,u=0,p=0,f=this.option("decelFriction");const g=this.targetScale;if(l>0){u=Math.abs(a)>3?a/(l/30):0,p=Math.abs(r)>3?r/(l/30):0;const t=this.option("maxVelocity");t&&(u=Math.max(Math.min(u,t),-1*t),p=Math.max(Math.min(p,t),-1*t))}u&&(h=u/(1/(1-f)-1)),p&&(d=p/(1/(1-f)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&e(g)===this.minScale)&&(h=u=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&e(g)===this.minScale)&&(d=p=0);const m=this.dragOffset.x,v=this.dragOffset.y,y=this.option("dragMinThreshold")||0;Math.abs(m)<y&&Math.abs(v)<y&&(h=d=0,u=p=0),(this.option("zoom")&&(g<this.minScale-1e-5||g>this.maxScale+1e-5)||i&&!h&&!d)&&(f=.35),this.applyChange({panX:h,panY:d,friction:f}),this.emit("decel",u,p,m,v)}onWheel(t){var e=[-t.deltaX||0,-t.deltaY||0,-t.detail||0].reduce((function(t,e){return Math.abs(e)>Math.abs(t)?e:t}));const i=Math.max(-1,Math.min(1,e));if(this.emit("wheel",t,i),this.panMode===A)return;if(t.defaultPrevented)return;const n=this.option("wheel");"pan"===n?(t.preventDefault(),this.panOnlyZoomed&&!this.canZoomOut()||this.applyChange({panX:2*-t.deltaX,panY:2*-t.deltaY,bounce:!1})):"zoom"===n&&!1!==this.option("zoom")&&this.zoomWithWheel(t)}onMouseMove(t){this.panWithMouse(t)}onKeydown(t){"Escape"===t.key&&this.toggleFS()}onResize(){this.updateMetrics(),this.checkBounds().inBounds||this.requestTick()}setTransform(){this.emit("beforeTransform");const{current:t,target:i,content:n,contentRect:s}=this,o=Object.assign({},T);for(const n of b){const s="e"==n||"f"===n?O:M;o[n]=e(t[n],s),Math.abs(i[n]-t[n])<("e"==n||"f"===n?.51:.001)&&(t[n]=i[n])}let{a:a,b:r,c:l,d:c,e:h,f:d}=o,u=`matrix(${a}, ${r}, ${l}, ${c}, ${h}, ${d})`,p=n.parentElement instanceof HTMLPictureElement?n.parentElement:n;if(this.option("transformParent")&&(p=p.parentElement||p),p.style.transform===u)return;p.style.transform=u;const{contentWidth:f,contentHeight:g}=this.calculateContentDim();s.width=f,s.height=g,this.emit("afterTransform")}updateMetrics(t=!1){var i;if(!this||this.state===v.Destroy)return;if(this.isContentLoading)return;const n=Math.max(1,(null===(i=window.visualViewport)||void 0===i?void 0:i.scale)||1),{container:s,content:o}=this,a=o instanceof HTMLImageElement,r=s.getBoundingClientRect(),l=getComputedStyle(this.container);let c=r.width*n,h=r.height*n;const d=parseFloat(l.paddingTop)+parseFloat(l.paddingBottom),u=c-(parseFloat(l.paddingLeft)+parseFloat(l.paddingRight)),p=h-d;this.containerRect={width:c,height:h,innerWidth:u,innerHeight:p};const f=parseFloat(o.dataset.width||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:Math.max(t.offsetWidth,t.scrollWidth),e||0})(o),g=parseFloat(o.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:Math.max(t.offsetHeight,t.scrollHeight),e||0})(o);let m=this.option("width",f)||R,b=this.option("height",g)||R;const y=m===R,w=b===R;"number"!=typeof m&&(m=f),"number"!=typeof b&&(b=g),y&&(m=f*(b/g)),w&&(b=g/(f/m));let x=o.parentElement instanceof HTMLPictureElement?o.parentElement:o;this.option("transformParent")&&(x=x.parentElement||x);const E=x.getAttribute("style")||"";x.style.setProperty("transform","none","important"),a&&(x.style.width="",x.style.height=""),x.offsetHeight;const S=o.getBoundingClientRect();let P=S.width*n,C=S.height*n,T=P,M=C;P=Math.min(P,m),C=Math.min(C,b),a?({width:P,height:C}=((t,e,i,n)=>{const s=i/t,o=n/e,a=Math.min(s,o);return{width:t*=a,height:e*=a}})(m,b,P,C)):(P=Math.min(P,m),C=Math.min(C,b));let O=.5*(M-C),A=.5*(T-P);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:S.top-r.top+O,bottom:r.bottom-S.bottom+O,left:S.left-r.left+A,right:r.right-S.right+A,fitWidth:P,fitHeight:C,width:P,height:C,fullWidth:m,fullHeight:b}),x.style.cssText=E,a&&(x.style.width=`${P}px`,x.style.height=`${C}px`),this.setTransform(),!0!==t&&this.emit("refresh"),this.ignoreBounds||(e(this.targetScale)<e(this.minScale)?this.zoomTo(this.minScale,{friction:0}):this.targetScale>this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===v.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}calculateBounds(){const{contentWidth:t,contentHeight:i}=this.calculateContentDim(this.target),{targetScale:n,lockedAxis:s}=this,{fitWidth:o,fitHeight:a}=this.contentRect;let r=0,l=0,c=0,h=0;const d=this.option("infinite");if(!0===d||s&&d===s)r=-1/0,c=1/0,l=-1/0,h=1/0;else{let{containerRect:s,contentRect:d}=this,u=e(o*n,O),p=e(a*n,O),{innerWidth:f,innerHeight:g}=s;if(s.width===u&&(f=s.width),s.width===p&&(g=s.height),t>f){c=.5*(t-f),r=-1*c;let e=.5*(d.right-d.left);r+=e,c+=e}if(o>f&&t<f&&(r-=.5*(o-f),c-=.5*(o-f)),i>g){h=.5*(i-g),l=-1*h;let t=.5*(d.bottom-d.top);l+=t,h+=t}a>g&&i<g&&(r-=.5*(a-g),c-=.5*(a-g))}return{x:{min:r,max:c},y:{min:l,max:h}}}getBounds(){const t=this.option("bounds");return t!==R?t:this.calculateBounds()}updateControls(){const t=this,i=t.container,{panMode:n,contentRect:s,targetScale:o,minScale:r}=t;let l=r,c=t.option("click")||!1;c&&(l=t.getNextScale(c));let h=t.canZoomIn(),d=t.canZoomOut(),u=n===L&&!!this.option("touch"),p=d&&u;if(u&&(e(o)<e(r)&&!this.panOnlyZoomed&&(p=!0),(e(s.width,1)>e(s.fitWidth,1)||e(s.height,1)>e(s.fitHeight,1))&&(p=!0)),e(s.width*o,1)<e(s.fitWidth,1)&&(p=!1),n===A&&(p=!1),a(i,this.cn("isDraggable"),p),!this.option("zoom"))return;let f=h&&e(l)>e(o),g=!f&&!p&&d&&e(l)<e(o);a(i,this.cn("canZoomIn"),f),a(i,this.cn("canZoomOut"),g);for(const t of i.querySelectorAll("[data-panzoom-action]")){let e=!1,i=!1;switch(t.dataset.panzoomAction){case"zoomIn":h?e=!0:i=!0;break;case"zoomOut":d?e=!0:i=!0;break;case"toggleZoom":case"iterateZoom":h||d?e=!0:i=!0;const n=t.querySelector("g");n&&(n.style.display=h?"":"none")}e?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):i&&(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"))}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:n=this.option("friction"),angle:s=0,originX:o=0,originY:a=0,flipX:r=!1,flipY:l=!1,ignoreBounds:c=!1}){this.state!==v.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:s,originX:o,originY:a,friction:n,flipX:r,flipY:l,ignoreBounds:c})}applyChange({panX:t=0,panY:i=0,scale:n=1,angle:s=0,originX:o=-this.current.e,originY:a=-this.current.f,friction:r=this.option("friction"),flipX:l=!1,flipY:c=!1,ignoreBounds:h=!1,bounce:d=this.option("bounce")}){const u=this.state;if(u===v.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.friction=r||0,this.ignoreBounds=h;const{current:p}=this,f=p.e,g=p.f,m=this.getMatrix(this.target);let y=(new DOMMatrix).translate(f,g).translate(o,a).translate(t,i);if(this.option("zoom")){if(!h){const t=this.targetScale,e=this.minScale,i=this.maxScale;t*n<e&&(n=e/t),t*n>i&&(n=i/t)}y=y.scale(n)}y=y.translate(-o,-a).translate(-f,-g).multiply(m),s&&(y=y.rotate(s)),l&&(y=y.scale(-1,1)),c&&(y=y.scale(1,-1));for(const t of b)"e"!==t&&"f"!==t&&(y[t]>this.minScale+1e-5||y[t]<this.minScale-1e-5)?this.target[t]=y[t]:this.target[t]=e(y[t],O);(this.targetScale<this.scale||Math.abs(n-1)>.1||this.panMode===A||!1===d)&&!h&&this.clampTargetBounds(),u===v.Init?this.animate():this.isResting||(this.state=v.Panning,this.requestTick())}stop(t=!1){if(this.state===v.Init||this.state===v.Destroy)return;const e=this.isTicking;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of b)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),P(this.container,"is-scaling"),P(this.container,"is-animating"),this.isTicking=!1,this.state=v.Ready,e&&(this.emit("endAnimation"),this.updateControls())}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),C(this.container,"is-animating"),this.isScaling&&C(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(t,i=this.option("mouseMoveFriction")){if(this.pmme=t,this.panMode!==A||!t)return;if(e(this.targetScale)<=e(this.minScale))return;this.emit("mouseMove",t);const{container:n,containerRect:s,contentRect:o}=this,a=s.width,r=s.height,l=n.getBoundingClientRect(),c=(t.clientX||0)-l.left,h=(t.clientY||0)-l.top;let{contentWidth:d,contentHeight:u}=this.calculateContentDim(this.target);const p=this.option("mouseMoveFactor");p>1&&(d!==a&&(d*=p),u!==r&&(u*=p));let f=.5*(d-a)-c/a*100/100*(d-a);f+=.5*(o.right-o.left);let g=.5*(u-r)-h/r*100/100*(u-r);g+=.5*(o.bottom-o.top),this.applyChange({panX:f-this.target.e,panY:g-this.target.f,friction:i})}zoomWithWheel(t){if(this.state===v.Destroy||this.state===v.Init)return;const i=Date.now();if(i-this.pwt<45)return void t.preventDefault();this.pwt=i;var n=[-t.deltaX||0,-t.deltaY||0,-t.detail||0].reduce((function(t,e){return Math.abs(e)>Math.abs(t)?e:t}));const s=Math.max(-1,Math.min(1,n)),{targetScale:o,maxScale:a,minScale:r}=this;let l=o*(100+45*s)/100;e(l)<e(r)&&e(o)<=e(r)?(this.cwd+=Math.abs(s),l=r):e(l)>e(a)&&e(o)>=e(a)?(this.cwd+=Math.abs(s),l=a):(this.cwd=0,l=Math.max(Math.min(l,a),r)),this.cwd>this.option("wheelLimit")||(t.preventDefault(),e(l)!==e(o)&&this.zoomTo(l,{event:t}))}canZoomIn(){return this.option("zoom")&&(e(this.contentRect.width,1)<e(this.contentRect.fitWidth,1)||e(this.targetScale)<e(this.maxScale))}canZoomOut(){return this.option("zoom")&&e(this.targetScale)>e(this.minScale)}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.getNextScale("toggleZoom"),t)}toggleMax(t){this.zoomTo(this.getNextScale("toggleMax"),t)}toggleCover(t){this.zoomTo(this.getNextScale("toggleCover"),t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e=R,originX:i=R,originY:n=R,event:s}={}){if(this.isContentLoading||this.state===v.Destroy)return;const{targetScale:o,fullScale:a,maxScale:r,coverScale:l}=this;if(this.stop(),this.panMode===A&&(s=this.pmme||s),s||i===R||n===R){const t=this.content.getBoundingClientRect(),e=this.container.getBoundingClientRect(),o=s?s.clientX:e.left+.5*e.width,a=s?s.clientY:e.top+.5*e.height;i=o-t.left-.5*t.width,n=a-t.top-.5*t.height}let c=1;"number"==typeof t?c=t:"full"===t?c=a:"cover"===t?c=l:"max"===t?c=r:"fit"===t?c=1:"next"===t&&(c=this.getNextScale("iterateZoom")),c=c/o||1,e=e===R?c>1?.15:.25:e,this.applyChange({scale:c,originX:i,originY:n,friction:e}),s&&this.panMode===A&&this.panWithMouse(s,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.innerHeight-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const n=t.classList.contains(e);n?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(n?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:n,d:s,e:o,f:a}=t;return new DOMMatrix([e,i,n,s,o,a])}reset(t){if(this.state!==v.Init&&this.state!==v.Destroy){this.stop("current");for(const t of b)this.target[t]=T[t];this.target.a=this.minScale,this.target.d=this.minScale,this.clampTargetBounds(),this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=v.Panning,this.requestTick())}}
vendor: 6,597 bytes, line 10776
10776destroy(){this.stop(),this.state=v.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(D,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:w}),Object.defineProperty(D,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const F=function(t,e){let i=!0;return(...n)=>{i&&(i=!1,t(...n),setTimeout((()=>{i=!0}),e))}},j=(t,e)=>{let i=[];return t.childNodes.forEach((t=>{t.nodeType!==Node.ELEMENT_NODE||e&&!t.matches(e)||i.push(t)})),i},B={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,Panzoom:{decelFriction:.12},center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var H;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"}(H||(H={}));const N=t=>{if("string"==typeof t||t instanceof HTMLElement)t={html:t};else{const e=t.thumb;void 0!==e&&("string"==typeof e&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",customClass:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},_=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class $ extends g{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const W={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'<button type="button" data-carousel-page="%i" aria-label="{{GOTO}}"><span class="f-carousel__dot" aria-hidden="true"></span></button>',dynamicFrom:11,maxCount:1/0,minCount:2};class X extends ${constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let t=this.list;if(!t){t=document.createElement("ul"),C(t,this.cn("list")),t.setAttribute("role","tablist");const e=this.instance.container;e.appendChild(t),C(e,this.cn("hasDots")),this.list=t}return t}refresh(){var t;const e=this.instance.pages.length,i=Math.min(2,this.option("minCount")),n=Math.max(2e3,this.option("maxCount")),s=this.option("dynamicFrom");if(e<i||e>n)return void this.cleanup();const o="number"==typeof s&&e>5&&e>=s,r=!this.list||this.isDynamic!==o||this.list.children.length!==e;r&&this.cleanup();const l=this.build();if(a(l,this.cn("isDynamic"),!!o),r)for(let t=0;t<e;t++)l.append(this.createItem(t));let c,h=0;for(const e of[...l.children]){const i=h===this.instance.page;i&&(c=e),a(e,this.cn("isCurrent"),i),null===(t=e.children[0])||void 0===t||t.setAttribute("aria-selected",i?"true":"false");for(const t of["isBeforePrev","isPrev","isNext","isAfterNext"])P(e,this.cn(t));h++}if(c=c||l.firstChild,o&&c){const t=c.previousElementSibling,e=t&&t.previousElementSibling;C(t,this.cn("isPrev")),C(e,this.cn("isBeforePrev"));const i=c.nextElementSibling,n=i&&i.nextElementSibling;C(i,this.cn("isNext")),C(n,this.cn("isAfterNext"))}this.isDynamic=o}createItem(t=0){var e;const i=document.createElement("li");i.setAttribute("role","presentation");const n=s(this.instance.localize(this.option("dotTpl"),[["%d",t+1]]).replace(/\%i/g,t+""));return i.appendChild(n),null===(e=i.children[0])||void 0===e||e.setAttribute("role","tab"),i}cleanup(){this.list&&(this.list.remove(),this.list=null),this.isDynamic=!1,P(this.instance.container,this.cn("hasDots"))}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(X,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:W});const q="disabled",Y="next",V="prev";class Z extends ${constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prev",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"next",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isDom",{enumerable:!0,configurable:!0,writable:!0,value:!1})}onRefresh(){const t=this.instance,e=t.pages.length,i=t.page;if(e<2)return void this.cleanup();this.build();let n=this.prev,s=this.next;n&&s&&(n.removeAttribute(q),s.removeAttribute(q),t.isInfinite||(i<=0&&n.setAttribute(q,""),i>=e-1&&s.setAttribute(q,"")))}addBtn(t){var e;const i=this.instance,n=document.createElement("button");n.setAttribute("tabindex","0"),n.setAttribute("title",i.localize(`{{${t.toUpperCase()}}}`)),C(n,this.cn("button")+" "+this.cn(t===Y?"isNext":"isPrev"));const s=i.isRTL?t===Y?V:Y:t;var o;return n.innerHTML=i.localize(this.option(`${s}Tpl`)),n.dataset[`carousel${o=t,o?o.match("^[a-z]")?o.charAt(0).toUpperCase()+o.substring(1):o:""}`]="true",null===(e=this.container)||void 0===e||e.appendChild(n),n}build(){const t=this.instance.container,e=this.cn("container");let{container:i,prev:n,next:s}=this;i||(i=t.querySelector("."+e),this.isDom=!!i),i||(i=document.createElement("div"),C(i,e),t.appendChild(i)),this.container=i,s||(s=i.querySelector("[data-carousel-next]")),s||(s=this.addBtn(Y)),this.next=s,n||(n=i.querySelector("[data-carousel-prev]")),n||(n=this.addBtn(V)),this.prev=n}cleanup(){this.isDom||(this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove()),this.prev=null,this.next=null,this.container=null,this.isDom=!1}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(Z,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M9 3l9 9-9 9"/></svg>
10776',prevTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M15 3l-9 9 9 9"/></svg>'}});class U extends ${constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){const{nav:t,target:e}=this;t&&e&&(t.options.initialSlide=e.options.initialPage,t.state===H.Ready?this.onNavReady(t):t.on("ready",this.onNavReady),e.state===H.Ready?this.onTargetReady(e):e.on("ready",this.onTargetReady))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),t.on("Panzoom.touchEnd",this.onNavTouch),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,e,i){this.onNavTouch(t,t.panzoom,i)}onNavTouch(t,e,i){var n,s;if(Math.abs(e.dragOffset.x)>3||Math.abs(e.dragOffset.y)>3)return;const o=i.target,{nav:a,target:r}=this;if(!a||!r||!o)return;const l=o.closest("[data-index]");if(i.stopPropagation(),i.preventDefault(),!l)return;const c=parseInt(l.dataset.index||"",10)||0,h=r.getPageForSlide(c),d=a.getPageForSlide(c);a.slideTo(d),r.slideTo(h,{friction:(null===(s=null===(n=this.nav)||void 0===n?void 0:n.plugins)||void 0===s?void 0:s.Sync.option("friction"))||0}),this.markSelectedSlide(c)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){var t,e;const{target:i,nav:n}=this;if(!i||!n)return;if(n.state!==H.Ready||i.state!==H.Ready)return;const s=null===(e=null===(t=i.pages[i.page])||void 0===t?void 0:t.slides[0])||void 0===e?void 0:e.index,o=n.getPageForSlide(s);this.markSelectedSlide(s),n.slideTo(o,null===n.prevPage&&null===i.prevPage?{friction:0}:void 0)}markSelectedSlide(t){const e=this.nav;e&&e.state===H.Ready&&(this.selectedIndex=t,[...e.slides].map((e=>{e.el&&e.el.classList[e.index===t?"add":"remove"]("is-nav-selected")})))}attach(){const t=this;let e=t.options.target,i=t.options.nav;e?t.addAsNavFor(e):i&&t.addAsTargetFor(i)}detach(){const t=this,e=t.nav,i=t.target;e&&(e.off("ready",t.onNavReady),e.off("createSlide",t.onNavCreateSlide),e.off("Panzoom.click",t.onNavClick),e.off("Panzoom.touchEnd",t.onNavTouch)),t.nav=null,i&&(i.off("ready",t.onTargetReady),i.off("refresh",t.onTargetChange),i.off("change",t.onTargetChange)),t.target=null}}Object.defineProperty(U,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const G={Navigation:Z,Dots:X,Sync:U},K="animationend",J="isSelected",Q="slide";class tt extends m{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===H.Ready}get isInfinite(){let t=!1;const{contentDim:e,viewportDim:i,pages:n,slides:s}=this,o=s[0];return n.length>=2&&o&&e+o.dim>=i&&(t=this.option("infinite")),t}get isRTL(){return"rtl"===this.option("direction")}get isHorizontal(){return"x"===this.option("axis")}constructor(t,e={},i={}){if(super(),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"lp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:H.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),"string"==typeof t&&(t=document.querySelector(t)),!t||!S(t))throw new Error("No Element found");this.container=t,this.slideNext=F(this.slideNext.bind(this),150),this.slidePrev=F(this.slidePrev.bind(this),150),this.userOptions=e,this.userPlugins=i,queueMicrotask((()=>{this.processOptions()}))}processOptions(){var t,e;const i=p({},tt.defaults,this.userOptions);let n="";const s=i.breakpoints;if(s&&u(s))for(const[t,e]of Object.entries(s))window.matchMedia(t).matches&&u(e)&&(n+=t,p(i,e));n===this.bp&&this.state!==H.Init||(this.bp=n,this.state===H.Ready&&(i.initialSlide=(null===(e=null===(t=this.pages[this.page])||void 0===t?void 0:t.slides[0])||void 0===e?void 0:e.index)||0),this.state!==H.Init&&this.destroy(),super.setOptions(i),!1===this.option("enabled")?this.attachEvents():setTimeout((()=>{this.init()}),0))}
vendor: 19,959 bytes, line 10776
10776init(){this.state=H.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},tt.Plugins),this.userPlugins)),this.emit("attachPlugins"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=H.Ready,this.emit("ready")}initLayout(){const{container:t}=this,e=this.option("classes");C(t,this.cn("container")),a(t,e.isLTR,!this.isRTL),a(t,e.isRTL,this.isRTL),a(t,e.isVertical,!this.isHorizontal),a(t,e.isHorizontal,this.isHorizontal);let i=this.option("viewport")||t.querySelector(`.${e.viewport}`);i||(i=document.createElement("div"),C(i,e.viewport),i.append(...j(t,`.${e.slide}`)),t.prepend(i)),i.addEventListener("scroll",this.onScroll);let n=this.option("track")||t.querySelector(`.${e.track}`);n||(n=document.createElement("div"),C(n,e.track),n.append(...Array.from(i.childNodes))),n.setAttribute("aria-live","polite"),i.contains(n)||i.prepend(n),this.viewport=i,this.track=n,this.emit("initLayout")}initSlides(){const{track:t}=this;if(!t)return;const e=[...this.slides],i=[];[...j(t,`.${this.cn(Q)}`)].forEach((t=>{if(S(t)){const e=N({el:t,isDom:!0,index:this.slides.length});i.push(e)}}));for(let t of[...this.option("slides",[])||[],...e])i.push(N(t));this.slides=i;for(let t=0;t<this.slides.length;t++)this.slides[t].index=t;for(const t of i)this.emit("beforeInitSlide",t,t.index),this.emit("initSlide",t,t.index);this.emit("initSlides")}setInitialPage(){const t=this.option("initialSlide");this.page="number"==typeof t?this.getPageForSlide(t):parseInt(this.option("initialPage",0)+"",10)||0}setInitialPosition(){const{track:t,pages:e,isHorizontal:i}=this;if(!t||!e.length)return;let n=this.page;e[n]||(this.page=n=0);const s=(e[n].pos||0)*(this.isRTL&&i?1:-1),o=i?`${s}px`:"0",a=i?"0":`${s}px`;t.style.transform=`translate3d(${o}, ${a}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new D(this.viewport,p({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,click:!1,dblClick:!1,touch:t=>!(this.pages.length<2&&!t.options.infinite),bounds:()=>this.getBounds(),maxVelocity:t=>Math.abs(t.target[this.axis]-t.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",((t,e,...i)=>{this.emit(`Panzoom.${e}`,t,...i)})),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation)}attachEvents(){const t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:e,viewportDim:i}=this;let n=this.option("slidesPerPage");n=("auto"===n||e<=i)&&!1!==this.option("fill")?1/0:parseFloat(n+"");let s=0,o=0,a=0;for(const e of this.slides)(!t.length||o+e.dim-i>.05||a>=n)&&(t.push(_()),s=t.length-1,o=0,a=0),t[s].slides.push(e),o+=e.dim+e.gap,a++;return t}processPages(){const t=this.pages,{contentDim:i,viewportDim:n,isInfinite:s}=this,o=this.option("center"),a=this.option("fill"),r=a&&o&&i>n&&!s;if(t.forEach(((t,e)=>{var s;t.index=e,t.pos=(null===(s=t.slides[0])||void 0===s?void 0:s.pos)||0,t.dim=0;for(const[e,i]of t.slides.entries())t.dim+=i.dim,e<t.slides.length-1&&(t.dim+=i.gap);r&&t.pos+.5*t.dim<.5*n?t.pos=0:r&&t.pos+.5*t.dim>=i-.5*n?t.pos=i-n:o&&(t.pos+=-.5*(n-t.dim))})),t.forEach((t=>{a&&!s&&i>n&&(t.pos=Math.max(t.pos,0),t.pos=Math.min(t.pos,i-n)),t.pos=e(t.pos,1e3),t.dim=e(t.dim,1e3),Math.abs(t.pos)<=.1&&(t.pos=0)})),s)return t;const l=[];let c;return t.forEach((t=>{const e=Object.assign({},t);c&&e.pos===c.pos?(c.dim+=e.dim,c.slides=[...c.slides,...e.slides]):(e.index=l.length,c=e,l.push(e))})),l}getPageFromIndex(t=0){const e=this.pages.length;let i;return t=parseInt((t||0).toString())||0,i=this.isInfinite?(t%e+e)%e:Math.max(Math.min(t,e-1),0),i}getSlideMetrics(t){var i,n;const s=this.isHorizontal?"width":"height";let o=0,a=0,r=t.el;const l=!(!r||r.parentNode);if(r?o=parseFloat(r.dataset[s]||"")||0:(r=document.createElement("div"),r.style.visibility="hidden",(this.track||document.body).prepend(r)),C(r,this.cn(Q)+" "+t.class+" "+t.customClass),o)r.style[s]=`${o}px`,r.style["width"===s?"height":"width"]="";else{l&&(this.track||document.body).prepend(r),o=r.getBoundingClientRect()[s]*Math.max(1,(null===(i=window.visualViewport)||void 0===i?void 0:i.scale)||1);let t=r[this.isHorizontal?"offsetWidth":"offsetHeight"];t-1>o&&(o=t)}const c=getComputedStyle(r);return"content-box"===c.boxSizing&&(this.isHorizontal?(o+=parseFloat(c.paddingLeft)||0,o+=parseFloat(c.paddingRight)||0):(o+=parseFloat(c.paddingTop)||0,o+=parseFloat(c.paddingBottom)||0)),a=parseFloat(c[this.isHorizontal?"marginRight":"marginBottom"])||0,l?null===(n=r.parentElement)||void 0===n||n.removeChild(r):t.el||r.remove(),{dim:e(o,1e3),gap:e(a,1e3)}}getBounds(){const{isInfinite:t,isRTL:e,isHorizontal:i,pages:n}=this;let s={min:0,max:0};if(t)s={min:-1/0,max:1/0};else if(n.length){const t=n[0].pos,o=n[n.length-1].pos;s=e&&i?{min:t,max:o}:{min:-1*o,max:-1*t}}return{x:i?s:{min:0,max:0},y:i?{min:0,max:0}:s}}repositionSlides(){let t,{isHorizontal:i,isRTL:n,isInfinite:s,viewport:o,viewportDim:a,contentDim:r,page:l,pages:c,slides:h,panzoom:d}=this,u=0,p=0,f=0,g=0;d?g=-1*d.current[this.axis]:c[l]&&(g=c[l].pos||0),t=i?n?"right":"left":"top",n&&i&&(g*=-1);for(const i of h){const n=i.el;n?("top"===t?(n.style.right="",n.style.left=""):n.style.top="",i.index!==u?n.style[t]=0===p?"":`${e(p,1e3)}px`:n.style[t]="",f+=i.dim+i.gap,u++):p+=i.dim+i.gap}if(s&&f&&o){let n=getComputedStyle(o),s="padding",l=i?"Right":"Bottom",c=parseFloat(n[s+(i?"Left":"Top")]);g-=c,a+=c,a+=parseFloat(n[s+l]);for(const i of h)i.el&&(e(i.pos)<e(a)&&e(i.pos+i.dim+i.gap)<e(g)&&e(g)>e(r-a)&&(i.el.style[t]=`${e(p+f,1e3)}px`),e(i.pos+i.gap)>=e(r-a)&&e(i.pos)>e(g+a)&&e(g)<e(a)&&(i.el.style[t]=`-${e(f,1e3)}px`))}let m,v,b=[...this.inTransition];if(b.length>1&&(m=c[b[0]],v=c[b[1]]),m&&v){let i=0;for(const n of h)n.el?this.inTransition.has(n.index)&&m.slides.indexOf(n)<0&&(n.el.style[t]=`${e(i+(m.pos-v.pos),1e3)}px`):i+=n.dim+n.gap}}createSlideEl(t){const{track:e,slides:i}=this;if(!e||!t)return;if(t.el&&t.el.parentNode)return;const n=t.el||document.createElement("div");C(n,this.cn(Q)),C(n,t.class),C(n,t.customClass);const s=t.html;s&&(s instanceof HTMLElement?n.appendChild(s):n.innerHTML=t.html+"");const o=[];i.forEach(((t,e)=>{t.el&&o.push(e)}));const a=t.index;let r=null;if(o.length){r=i[o.reduce(((t,e)=>Math.abs(e-a)<Math.abs(t-a)?e:t))]}const l=r&&r.el&&r.el.parentNode?r.index<t.index?r.el.nextSibling:r.el:null;e.insertBefore(n,e.contains(l)?l:null),t.el=n,this.emit("createSlide",t)}removeSlideEl(t,e=!1){const i=null==t?void 0:t.el;if(!i||!i.parentNode)return;const n=this.cn(J);if(i.classList.contains(n)&&(P(i,n),this.emit("unselectSlide",t)),t.isDom&&!e)return i.removeAttribute("aria-hidden"),i.removeAttribute("data-index"),void(i.style.left="");this.emit("removeSlide",t);const s=new CustomEvent(K);i.dispatchEvent(s),t.el&&(t.el.remove(),t.el=null)}transitionTo(t=0,e=this.option("transition")){var i,n,s,o;if(!e)return!1;const a=this.page,{pages:r,panzoom:l}=this;t=parseInt((t||0).toString())||0;const c=this.getPageFromIndex(t);if(!l||!r[c]||r.length<2||Math.abs(((null===(n=null===(i=r[a])||void 0===i?void 0:i.slides[0])||void 0===n?void 0:n.dim)||0)-this.viewportDim)>1)return!1;let h=t>a?1:-1;this.isInfinite&&(0===a&&t===r.length-1&&(h=-1),a===r.length-1&&0===t&&(h=1));const d=r[c].pos*(this.isRTL?1:-1);if(a===c&&Math.abs(d-l.target[this.axis])<1)return!1;this.clearTransitions();const u=l.isResting;C(this.container,this.cn("inTransition"));const p=(null===(s=r[a])||void 0===s?void 0:s.slides[0])||null,f=(null===(o=r[c])||void 0===o?void 0:o.slides[0])||null;this.inTransition.add(f.index),this.createSlideEl(f);let g=p.el,m=f.el;u||e===Q||(e="fadeFast",g=null);const v=this.isRTL?"next":"prev",b=this.isRTL?"prev":"next";return g&&(this.inTransition.add(p.index),p.transition=e,g.addEventListener(K,this.onAnimationEnd),g.classList.add(`f-${e}Out`,`to-${h>0?b:v}`)),m&&(f.transition=e,m.addEventListener(K,this.onAnimationEnd),m.classList.add(`f-${e}In`,`from-${h>0?v:b}`)),l.current[this.axis]=d,l.target[this.axis]=d,l.requestTick(),this.onChange(c),!0}manageSlideVisiblity(){const t=new Set,e=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const n of this.slides)i.has(n)?t.add(n):e.add(n);for(const e of this.inTransition)t.add(this.slides[e]);for(const e of t)this.createSlideEl(e),this.lazyLoadSlide(e);for(const i of e)t.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let e=this.cn(J);if(e)for(const i of this.slides){const n=i.el;n&&(n.dataset.index=`${i.index}`,n.classList.contains("f-thumbs__slide")?this.getVisibleSlides(0).has(i)?n.removeAttribute(t):n.setAttribute(t,"true"):this.pages[this.page].slides.includes(i)?(n.classList.contains(e)||(C(n,e),this.emit("selectSlide",i)),n.removeAttribute(t)):(n.classList.contains(e)&&(P(n,e),this.emit("unselectSlide",i)),n.setAttribute(t,"true")))}}flipInfiniteTrack(){const{axis:t,isHorizontal:e,isInfinite:i,isRTL:n,viewportDim:s,contentDim:o}=this,a=this.panzoom;if(!a||!i)return;let r=a.current[t],l=a.target[t]-r,c=0,h=.5*s;n&&e?(r<-h&&(c=-1,r+=o),r>o-h&&(c=1,r-=o)):(r>h&&(c=1,r-=o),r<-o+h&&(c=-1,r+=o)),c&&(a.current[t]=r,a.target[t]=r+l)}lazyLoadImg(t,e){const i=this,n="f-fadeIn",o="is-preloading";let a=!1,r=null;const l=()=>{a||(a=!0,r&&(r.remove(),r=null),P(e,o),e.complete&&(C(e,n),setTimeout((()=>{P(e,n)}),350)),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&(i.updateMetrics(),i.setViewportHeight()),this.emit("load",t))};C(e,o),e.src=e.dataset.lazySrcset||e.dataset.lazySrc||"",delete e.dataset.lazySrc,delete e.dataset.lazySrcset,e.addEventListener("error",(()=>{l()})),e.addEventListener("load",(()=>{l()})),setTimeout((()=>{const i=e.parentNode;i&&t.el&&(e.complete?l():a||(r=s(E),i.insertBefore(r,e)))}),300)}lazyLoadSlide(t){const e=t&&t.el;if(!e)return;const i=new Set;let n=Array.from(e.querySelectorAll("[data-lazy-src],[data-lazy-srcset]"));e.dataset.lazySrc&&n.push(e),n.map((t=>{t instanceof HTMLImageElement?i.add(t):t instanceof HTMLElement&&t.dataset.lazySrc&&(t.style.backgroundImage=`url('${t.dataset.lazySrc}')`,delete t.dataset.lazySrc)}));for(const e of i)this.lazyLoadImg(t,e)}onAnimationEnd(t){var e;const i=t.target,n=i?parseInt(i.dataset.index||"",10)||0:-1,s=this.slides[n],o=t.animationName;if(!i||!s||!o)return;const a=!!this.inTransition.has(n)&&s.transition;a&&o.substring(0,a.length+2)===`f-${a}`&&this.inTransition.delete(n),this.inTransition.size||this.clearTransitions(),n===this.page&&(null===(e=this.panzoom)||void 0===e?void 0:e.isResting)&&this.emit("settle")}onDecel(t,e=0,i=0,n=0,s=0){if(this.option("dragFree"))return void this.setPageFromPosition();const{isRTL:o,isHorizontal:a,axis:r,pages:l}=this,c=l.length,h=Math.abs(Math.atan2(i,e)/(Math.PI/180));let d=0;if(d=h>45&&h<135?a?0:i:a?e:0,!c)return;let u=this.page,p=o&&a?1:-1;const f=t.current[r]*p;let{pageIndex:g}=this.getPageFromPosition(f);Math.abs(d)>5?(l[u].dim<document.documentElement["client"+(this.isHorizontal?"Width":"Height")]-1&&(u=g),u=o&&a?d<0?u-1:u+1:d<0?u+1:u-1):u=0===n&&0===s?u:g,this.slideTo(u,{transition:!1,friction:t.option("decelFriction")})}onClick(t){const e=t.target,i=e&&S(e)?e.dataset:null;let n,s;i&&(void 0!==i.carouselPage?(s="slideTo",n=i.carouselPage):void 0!==i.carouselNext?s="slideNext":void 0!==i.carouselPrev&&(s="slidePrev")),s?(t.preventDefault(),t.stopPropagation(),e&&!e.hasAttribute("disabled")&&this[s](n)):this.emit("click",t)}onSlideTo(t){const e=t.detail||0;this.slideTo(this.getPageForSlide(e),{friction:0})}onChange(t,e=0){const i=this.page;this.prevPage=i,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),t!==i&&(this.markSelectedSlides(),this.emit("change",t,i,e))}onRefresh(){let t=this.contentDim,e=this.viewportDim;this.updateMetrics(),this.contentDim===t&&this.viewportDim===e||this.slideTo(this.page,{friction:0,transition:!1})}onScroll(){var t;null===(t=this.viewport)||void 0===t||t.scroll(0,0)}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(t){this.lp!==t.current[this.axis]&&(this.flipInfiniteTrack(),this.manageSlideVisiblity()),this.lp=t.current.e}onEndAnimation(){this.inTransition.size||this.emit("settle")}reInit(t=null,e=null){this.destroy(),this.state=H.Init,this.prevPage=null,this.userOptions=t||this.userOptions,this.userPlugins=e||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:e=this.option("friction"),transition:i=this.option("transition")}={}){if(this.state===H.Destroy)return;t=parseInt((t||0).toString())||0;const n=this.getPageFromIndex(t),{axis:s,isHorizontal:o,isRTL:a,pages:r,panzoom:l}=this,c=r.length,h=a&&o?1:-1;if(!l||!c)return;if(this.page!==n){const e=new Event("beforeChange",{bubbles:!0,cancelable:!0});if(this.emit("beforeChange",e,t),e.defaultPrevented)return}if(this.transitionTo(t,i))return;let d=r[n].pos;if(this.isInfinite){const e=this.contentDim,i=l.target[s]*h;if(2===c)d+=e*Math.floor(parseFloat(t+"")/2);else{d=[d,d-e,d+e].reduce((function(t,e){return Math.abs(e-i)<Math.abs(t-i)?e:t}))}}d*=h,Math.abs(l.target[s]-d)<1||(l.panTo({x:o?d:0,y:o?0:d,friction:e}),this.onChange(n))}slideToClosest(t){if(this.panzoom){const{pageIndex:e}=this.getPageFromPosition();this.slideTo(e,t)}}slideNext(){this.slideTo(this.page+1)}slidePrev(){this.slideTo(this.page-1)}clearTransitions(){this.inTransition.clear(),P(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const e of this.slides){const i=e.el;if(i){i.removeEventListener(K,this.onAnimationEnd),i.classList.remove(...t);const n=e.transition;n&&i.classList.remove(`f-${n}Out`,`f-${n}In`)}}this.manageSlideVisiblity()}addSlide(t,e){var i,n,s,o;const a=this.panzoom,r=(null===(i=this.pages[this.page])||void 0===i?void 0:i.pos)||0,l=(null===(n=this.pages[this.page])||void 0===n?void 0:n.dim)||0,c=this.contentDim<this.viewportDim;let h=Array.isArray(e)?e:[e];const d=[];for(const t of h)d.push(N(t));this.slides.splice(t,0,...d);for(let t=0;t<this.slides.length;t++)this.slides[t].index=t;for(const t of d)this.emit("beforeInitSlide",t,t.index);if(this.page>=t&&(this.page+=d.length),this.updateMetrics(),a){const e=(null===(s=this.pages[this.page])||void 0===s?void 0:s.pos)||0,i=(null===(o=this.pages[this.page])||void 0===o?void 0:o.dim)||0,n=this.pages.length||1,h=this.isRTL?l-i:i-l,d=this.isRTL?r-e:e-r;c&&1===n?(t<=this.page&&(a.current[this.axis]-=h,a.target[this.axis]-=h),a.panTo({[this.isHorizontal?"x":"y"]:-1*e})):d&&t<=this.page&&(a.target[this.axis]-=d,a.current[this.axis]-=d,a.requestTick())}for(const t of d)this.emit("initSlide",t,t.index)}prependSlide(t){this.addSlide(0,t)}appendSlide(t){this.addSlide(this.slides.length,t)}removeSlide(t){const e=this.slides.length;t=(t%e+e)%e;const i=this.slides[t];if(i){this.removeSlideEl(i,!0),this.slides.splice(t,1);for(let t=0;t<this.slides.length;t++)this.slides[t].index=t;this.updateMetrics(),this.slideTo(this.page,{friction:0,transition:!1}),this.emit("destroySlide",i)}}updateMetrics(){const{panzoom:t,viewport:i,track:n,slides:s,isHorizontal:o,isInfinite:a}=this;if(!n)return;const r=o?"width":"height",l=o?"offsetWidth":"offsetHeight";if(i){let t=Math.max(i[l],e(i.getBoundingClientRect()[r],1e3)),n=getComputedStyle(i),s="padding",a=o?"Right":"Bottom";t-=parseFloat(n[s+(o?"Left":"Top")])+parseFloat(n[s+a]),this.viewportDim=t}let c,h=0;for(const[t,i]of s.entries()){let n=0,o=0;!i.el&&c?(n=c.dim,o=c.gap):(({dim:n,gap:o}=this.getSlideMetrics(i)),c=i),n=e(n,1e3),o=e(o,1e3),i.dim=n,i.gap=o,i.pos=h,h+=n,(a||t<s.length-1)&&(h+=o)}h=e(h,1e3),this.contentDim=h,t&&(t.contentRect[r]=h,t.contentRect[o?"fullWidth":"fullHeight"]=h),this.pages=this.createPages(),this.pages=this.processPages(),this.state===H.Init&&this.setInitialPage(),this.page=Math.max(0,Math.min(this.page,this.pages.length-1)),this.manageSlideVisiblity(),this.emit("refresh")}getProgress(t,i=!1,n=!1){void 0===t&&(t=this.page);const s=this,o=s.panzoom,a=s.contentDim,r=s.pages[t]||0;if(!r||!o)return t>this.page?-1:1;let l=-1*o.current.e,c=e((l-r.pos)/(1*r.dim),1e3),h=c,d=c;this.isInfinite&&!0!==n&&(h=e((l-r.pos+a)/(1*r.dim),1e3),d=e((l-r.pos-a)/(1*r.dim),1e3));let u=[c,h,d].reduce((function(t,e){return Math.abs(e)<Math.abs(t)?e:t}));return i?u:u>1?1:u<-1?-1:u}setViewportHeight(){const{page:t,pages:e,viewport:i,isHorizontal:n}=this;if(!i||!e[t])return;let s=0;n&&this.track&&(this.track.style.height="auto",e[t].slides.forEach((t=>{t.el&&(s=Math.max(s,t.el.offsetHeight))}))),i.style.height=s?`${s}px`:""}getPageForSlide(t){for(const e of this.pages)for(const i of e.slides)if(i.index===t)return e.index;return-1}getVisibleSlides(t=0){var e;const i=new Set;let{panzoom:n,contentDim:s,viewportDim:o,pages:a,page:r}=this;if(o){s=s+(null===(e=this.slides[this.slides.length-1])||void 0===e?void 0:e.gap)||0;let l=0;l=n&&n.state!==v.Init&&n.state!==v.Destroy?-1*n.current[this.axis]:a[r]&&a[r].pos||0,this.isInfinite&&(l-=Math.floor(l/s)*s),this.isRTL&&this.isHorizontal&&(l*=-1);const c=l-o*t,h=l+o*(t+1),d=this.isInfinite?[-1,0,1]:[0];for(const t of this.slides)for(const e of d){const n=t.pos+e*s,o=n+t.dim+t.gap;n<h&&o>c&&i.add(t)}}return i}getPageFromPosition(t){const{viewportDim:e,contentDim:i,slides:n,pages:s,panzoom:o}=this,a=s.length,r=n.length,l=n[0],c=n[r-1],h=this.option("center");let d=0,u=0,p=0,f=void 0===t?-1*((null==o?void 0:o.target[this.axis])||0):t;h&&(f+=.5*e),this.isInfinite?(f<l.pos-.5*c.gap&&(f-=i,p=-1),f>c.pos+c.dim+.5*c.gap&&(f-=i,p=1)):f=Math.max(l.pos||0,Math.min(f,c.pos));let g=c,m=n.find((t=>{const e=t.pos-.5*g.gap,i=t.pos+t.dim+.5*t.gap;return g=t,f>=e&&f<i}));return m||(m=c),u=this.getPageForSlide(m.index),d=u+p*a,{page:d,pageIndex:u}}setPageFromPosition(){const{pageIndex:t}=this.getPageFromPosition();this.onChange(t)}destroy(){if([H.Destroy].includes(this.state))return;this.state=H.Destroy;const{container:t,viewport:e,track:i,slides:n,panzoom:s}=this,o=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),s&&(s.destroy(),this.panzoom=null),n&&n.forEach((t=>{this.removeSlideEl(t)})),this.detachPlugins(),e&&(e.removeEventListener("scroll",this.onScroll),e.offsetParent&&i&&i.offsetParent&&e.replaceWith(...i.childNodes));for(const[e,i]of Object.entries(o))"container"!==e&&i&&t.classList.remove(i);this.track=null,this.viewport=null,this.page=0,this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty(tt,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:D}),Object.defineProperty(tt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:B}),Object.defineProperty(tt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:G});const et=function(t){if(!S(t))return 0;const e=window.scrollY,i=window.innerHeight,n=e+i,s=t.getBoundingClientRect(),o=s.y+e,a=s.height,r=o+a;if(e>r||n<o)return 0;if(e<o&&n>r)return 100;if(o<e&&r>n)return 100;let l=a;o<e&&(l-=e-o),r>n&&(l-=r-n);const c=l/i*100;return Math.round(c)},it=!("undefined"==typeof window||!window.document||!window.document.createElement);let nt;const st=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not
10776([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),ot=t=>{if(t&&it){void 0===nt&&document.createElement("div").focus({get preventScroll(){return nt=!0,!1}});try{if(nt)t.focus({preventScroll:!0});else{const e=window.scrollY||document.body.scrollTop,i=window.scrollX||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:i,behavior:"auto"})}}catch(t){}}},at=()=>{const t=document;let e,i="",n="",s="";return t.fullscreenEnabled?(i="requestFullscreen",n="exitFullscreen",s="fullscreenElement"):t.webkitFullscreenEnabled&&(i="webkitRequestFullscreen",n="webkitExitFullscreen",s="webkitFullscreenElement"),i&&(e={request:function(e=t.documentElement){return"webkitRequestFullscreen"===i?e[i](Element.ALLOW_KEYBOARD_INPUT):e[i]()},exit:function(){return t[s]&&t[n]()},isFullscreen:function(){return t[s]}}),e},rt={animated:!0,autoFocus:!0,backdropClick:"close",Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},closeButton:"auto",closeExisting:!1,commonCaption:!1,compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,contentClick:"toggleZoom",contentDblClick:!1,defaultType:"image",defaultDisplay:"flex",dragToClose:!0,Fullscreen:{autoStart:!1},groupAll:!1,groupAttr:"data-fancybox",hideClass:"f-fadeOut",hideScrollbar:!0,idle:3500,keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"prev",ArrowDown:"next",ArrowRight:"next",ArrowLeft:"prev"},l10n:Object.assign(Object.assign({},y),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),parentEl:null,placeFocusBack:!0,showClass:"f-zoomInUp",startIndex:0,tpl:{closeButton:'<button data-fancybox-close class="f-button is-close-btn" title="{{CLOSE}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M20 20L4 4m16 0L4 20"/></svg></button>',main:'<div class="fancybox__container" role="dialog" aria-modal="true" aria-label="{{MODAL}}" tabindex="-1">\n <div class="fancybox__backdrop"></div>\n <div class="fancybox__carousel"></div>\n <div class="fancybox__footer"></div>\n </div>'},trapFocus:!0,wheel:"zoom"};var lt,ct;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Closing=2]="Closing",t[t.CustomClosing=3]="CustomClosing",t[t.Destroy=4]="Destroy"}(lt||(lt={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(ct||(ct={}));let ht="",dt=!1,ut=!1,pt=null;const ft=()=>{let t="",e="";const i=Ae.getInstance();if(i){const n=i.carousel,s=i.getSlide();if(n&&s){let o=s.slug||void 0,a=s.triggerEl||void 0;e=o||(i.option("slug")||""),!e&&a&&a.dataset&&(e=a.dataset.fancybox||""),e&&"true"!==e&&(t="#"+e+(!o&&n.slides.length>1?"-"+(s.index+1):""))}}return{hash:t,slug:e,index:1}},gt=()=>{const t=new URL(document.URL).hash,e=t.slice(1).split("-"),i=e[e.length-1],n=i&&/^\+?\d+$/.test(i)&&parseInt(e.pop()||"1",10)||1;return{hash:t,slug:e.join("-"),index:n}},mt=()=>{const{slug:t,index:e}=gt();if(!t)return;let i=document.querySelector(`[data-slug="${t}"]`);if(i&&i.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),Ae.getInstance())return;const n=document.querySelectorAll(`[data-fancybox="${t}"]`);n.length&&(i=n[e-1],i&&i.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))},vt=()=>{if(!1===Ae.defaults.Hash)return;const t=Ae.getInstance();if(!1===(null==t?void 0:t.options.Hash))return;const{slug:e,index:i}=gt(),{slug:n}=ft();t&&(e===n?t.jumpTo(i-1):(dt=!0,t.close())),mt()},bt=()=>{pt&&clearTimeout(pt),queueMicrotask((()=>{vt()}))},yt=()=>{window.addEventListener("hashchange",bt,!1),setTimeout((()=>{vt()}),500)};it&&(/complete|interactive|loaded/.test(document.readyState)?yt():document.addEventListener("DOMContentLoaded",yt));const wt="is-zooming-in";class xt extends ${onCreateSlide(t,e,i){const n=this.instance.optionFor(i,"src")||"";i.el&&"image"===i.type&&"string"==typeof n&&this.setImage(i,n)}onRemoveSlide(t,e,i){i.panzoom&&i.panzoom.destroy(),i.panzoom=void 0,i.imageEl=void 0}onChange(t,e,i,n){P(this.instance.container,wt);for(const t of e.slides){const e=t.panzoom;e&&t.index!==i&&e.reset(.35)}}onClose(){var t;const e=this.instance,i=e.container,n=e.getSlide();if(!i||!i.parentElement||!n)return;const{el:s,contentEl:o,panzoom:a,thumbElSrc:r}=n;if(!s||!r||!o||!a||a.isContentLoading||a.state===v.Init||a.state===v.Destroy)return;a.updateMetrics();let l=this.getZoomInfo(n);if(!l)return;this.instance.state=lt.CustomClosing,i.classList.remove(wt),i.classList.add("is-zooming-out"),o.style.backgroundImage=`url('${r}')`;const c=i.getBoundingClientRect();
vendor: 4,252 bytes, line 10776
107761===((null===(t=window.visualViewport)||void 0===t?void 0:t.scale)||1)&&Object.assign(i.style,{position:"absolute",top:`${i.offsetTop+window.scrollY}px`,left:`${i.offsetLeft+window.scrollX}px`,bottom:"auto",right:"auto",width:`${c.width}px`,height:`${c.height}px`,overflow:"hidden"});const{x:h,y:d,scale:u,opacity:p}=l;if(p){const t=((t,e,i,n)=>{const s=e-t,o=n-i;return e=>i+((e-t)/s*o||0)})(a.scale,u,1,0);a.on("afterTransform",(()=>{o.style.opacity=t(a.scale)+""}))}a.on("endAnimation",(()=>{e.destroy()})),a.target.a=u,a.target.b=0,a.target.c=0,a.target.d=u,a.panTo({x:h,y:d,scale:u,friction:p?.2:.33,ignoreBounds:!0}),a.isResting&&e.destroy()}setImage(t,e){const i=this.instance;t.src=e,this.process(t,e).then((e=>{const{contentEl:n,imageEl:s,thumbElSrc:o,el:a}=t;if(i.isClosing()||!n||!s)return;n.offsetHeight;const r=!!i.isOpeningSlide(t)&&this.getZoomInfo(t);if(this.option("protected")&&a){a.addEventListener("contextmenu",(t=>{t.preventDefault()}));const t=document.createElement("div");C(t,"fancybox-protected"),n.appendChild(t)}if(o&&r){const s=e.contentRect,a=Math.max(s.fullWidth,s.fullHeight);let c=null;!r.opacity&&a>1200&&(c=document.createElement("img"),C(c,"fancybox-ghost"),c.src=o,n.appendChild(c));const h=()=>{c&&(C(c,"f-fadeFastOut"),setTimeout((()=>{c&&(c.remove(),c=null)}),200))};(l=o,new Promise(((t,e)=>{const i=new Image;i.onload=t,i.onerror=e,i.src=l}))).then((()=>{i.hideLoading(t),t.state=ct.Opening,this.instance.emit("reveal",t),this.zoomIn(t).then((()=>{h(),this.instance.done(t)}),(()=>{})),c&&setTimeout((()=>{h()}),a>2500?800:200)}),(()=>{i.hideLoading(t),i.revealContent(t)}))}else{const n=this.optionFor(t,"initialSize"),s=this.optionFor(t,"zoom"),o={event:i.prevMouseMoveEvent||i.options.event,friction:s?.12:0};let a=i.optionFor(t,"showClass")||void 0,r=!0;i.isOpeningSlide(t)&&("full"===n?e.zoomToFull(o):"cover"===n?e.zoomToCover(o):"max"===n?e.zoomToMax(o):r=!1,e.stop("current")),r&&a&&(a=e.isDragging?"f-fadeIn":""),i.hideLoading(t),i.revealContent(t,a)}var l}),(()=>{i.setError(t,"{{IMAGE_ERROR}}")}))}process(t,e){return new Promise(((i,n)=>{var o;const a=this.instance,r=t.el;a.clearContent(t),a.showLoading(t);let l=this.optionFor(t,"content");if("string"==typeof l&&(l=s(l)),!l||!S(l)){if(l=document.createElement("img"),l instanceof HTMLImageElement){let i="",n=t.caption;i="string"==typeof n&&n?n.replace(/<[^>]+>/gi,"").substring(0,1e3):`Image ${t.index+1} of ${(null===(o=a.carousel)||void 0===o?void 0:o.pages.length)||1}`,l.src=e||"",l.alt=i,l.draggable=!1,t.srcset&&l.setAttribute("srcset",t.srcset),this.instance.isOpeningSlide(t)&&(l.fetchPriority="high")}t.sizes&&l.setAttribute("sizes",t.sizes)}C(l,"fancybox-image"),t.imageEl=l,a.setContent(t,l,!1);t.panzoom=new D(r,p({transformParent:!0},this.option("Panzoom")||{},{content:l,width:(e,i)=>a.optionFor(t,"width","auto",i)||"auto",height:(e,i)=>a.optionFor(t,"height","auto",i)||"auto",wheel:()=>{const t=a.option("wheel");return("zoom"===t||"pan"==t)&&t},click:(e,i)=>{var n,s;if(a.isCompact||a.isClosing())return!1;if(t.index!==(null===(n=a.getSlide())||void 0===n?void 0:n.index))return!1;if(i){const t=i.composedPath()[0];if(["A","BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(t.nodeName))return!1}let o=!i||i.target&&(null===(s=t.contentEl)||void 0===s?void 0:s.contains(i.target));return a.option(o?"contentClick":"backdropClick")||!1},dblClick:()=>a.isCompact?"toggleZoom":a.option("contentDblClick")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,on:{ready:t=>{i(t)},error:()=>{n()},destroy:()=>{n()}}}))}))}zoomIn(t){return new Promise(((e,i)=>{const n=this.instance,s=n.container,{panzoom:o,contentEl:a,el:r}=t;o&&o.updateMetrics();const l=this.getZoomInfo(t);if(!(l&&r&&a&&o&&s))return void i();const{x:c,y:h,scale:d,opacity:u}=l,p=()=>{t.state!==ct.Closing&&(u&&(a.style.opacity=Math.max(Math.min(1,1-(1-o.scale)/(1-d)),0)+""),o.scale>=1&&o.scale>o.targetScale-.1&&e(o))},f=t=>{(t.scale<.99||t.scale>1.01)&&!t.isDragging||(P(s,wt),a.style.opacity="",t.off("endAnimation",f),t.off("touchStart",f),t.off("afterTransform",p),e(t))};o.on("endAnimation",f),o.on("touchStart",f),o.on("afterTransform",p),o.on(["error","destroy"],(()=>{i()})),o.panTo({x:c,y:h,scale:d,friction:0,ignoreBounds:!0}),o.stop("current");
vendor: 12,286 bytes, line 10776
10776const g={event:"mousemove"===o.panMode?n.prevMouseMoveEvent||n.options.event:void 0},m=this.optionFor(t,"initialSize");C(s,wt),n.hideLoading(t),"full"===m?o.zoomToFull(g):"cover"===m?o.zoomToCover(g):"max"===m?o.zoomToMax(g):o.reset(.172)}))}getZoomInfo(t){const{el:e,imageEl:i,thumbEl:n,panzoom:s}=t,o=this.instance,a=o.container;if(!e||!i||!n||!s||et(n)<3||!this.optionFor(t,"zoom")||!a||o.state===lt.Destroy)return!1;if("0"===getComputedStyle(a).getPropertyValue("--f-images-zoom"))return!1;const r=window.visualViewport||null;if(1!==(r?r.scale:1))return!1;let{top:l,left:c,width:h,height:d}=n.getBoundingClientRect(),{top:u,left:p,fitWidth:f,fitHeight:g}=s.contentRect;if(!(h&&d&&f&&g))return!1;const m=s.container.getBoundingClientRect();p+=m.left,u+=m.top;const v=-1*(p+.5*f-(c+.5*h)),b=-1*(u+.5*g-(l+.5*d)),y=h/f;let w=this.option("zoomOpacity")||!1;return"auto"===w&&(w=Math.abs(h/d-f/g)>.1),{x:v,y:b,scale:y,opacity:w}}attach(){const t=this,e=t.instance;e.on("Carousel.change",t.onChange),e.on("Carousel.createSlide",t.onCreateSlide),e.on("Carousel.removeSlide",t.onRemoveSlide),e.on("close",t.onClose)}detach(){const t=this,e=t.instance;e.off("Carousel.change",t.onChange),e.off("Carousel.createSlide",t.onCreateSlide),e.off("Carousel.removeSlide",t.onRemoveSlide),e.off("close",t.onClose)}}Object.defineProperty(xt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}}),"function"==typeof SuppressedError&&SuppressedError;const Et="html",St="image",Pt="map",Ct="youtube",Tt="vimeo",Mt="html5video",Ot=(t,e={})=>{const i=new URL(t),n=new URLSearchParams(i.search),s=new URLSearchParams;for(const[t,i]of[...n,...Object.entries(e)]){let e=i+"";if("t"===t){let t=e.match(/((\d*)m)?(\d*)s?/);t&&s.set("start",60*parseInt(t[2]||"0")+parseInt(t[3]||"0")+"")}else s.set(t,e)}let o=s+"",a=t.match(/#t=((.*)?\d+s)/);return a&&(o+=`#t=${a[1]}`),o},At={ajax:null,autoSize:!0,iframeAttr:{allow:"autoplay; fullscreen",scrolling:"auto"},preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:'<video class="fancybox__html5video" playsinline controls controlsList="nodownload" poster="{{poster}}">\n <source src="{{src}}" type="{{format}}" />Sorry, your browser doesn\'t support embedded videos.</video>',videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,nocookie:1,rel:0,fs:1}},Lt=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo"];class zt extends ${onBeforeInitSlide(t,e,i){this.processType(i)}onCreateSlide(t,e,i){this.setContent(i)}onClearContent(t,e){e.xhr&&(e.xhr.abort(),e.xhr=null);const i=e.iframeEl;i&&(i.onload=i.onerror=null,i.src="//about:blank",e.iframeEl=null);const n=e.contentEl,s=e.placeholderEl;if("inline"===e.type&&n&&s)n.classList.remove("fancybox__content"),"none"!==getComputedStyle(n).getPropertyValue("display")&&(n.style.display="none"),setTimeout((()=>{s&&(n&&s.parentNode&&s.parentNode.insertBefore(n,s),s.remove())}),0),e.contentEl=void 0,e.placeholderEl=void 0;else for(;e.el&&e.el.firstChild;)e.el.removeChild(e.el.firstChild)}onSelectSlide(t,e,i){i.state===ct.Ready&&this.playVideo()}onUnselectSlide(t,e,i){var n,s;if(i.type===Mt){try{null===(s=null===(n=i.el)||void 0===n?void 0:n.querySelector("video"))||void 0===s||s.pause()}catch(t){}return}let o;i.type===Tt?o={method:"pause",value:"true"}:i.type===Ct&&(o={event:"command",func:"pauseVideo"}),o&&i.iframeEl&&i.iframeEl.contentWindow&&i.iframeEl.contentWindow.postMessage(JSON.stringify(o),"*"),i.poller&&clearTimeout(i.poller)}onDone(t,e){t.isCurrentSlide(e)&&!t.isClosing()&&this.playVideo()}onRefresh(t,e){e.slides.forEach((t=>{t.el&&(this.resizeIframe(t),this.setAspectRatio(t))}))}onMessage(t){try{let e=JSON.parse(t.data);if("https://player.vimeo.com"===t.origin){if("ready"===e.event)for(let e of Array.from(document.getElementsByClassName("fancybox__iframe")))e instanceof HTMLIFrameElement&&e.contentWindow===t.source&&(e.dataset.ready="true")}else if(t.origin.match(/^https:\/\/(www.)?youtube(-nocookie)?.com$/)&&"onReady"===e.event){const t=document.getElementById(e.id);t&&(t.dataset.ready="true")}}catch(t){}}loadAjaxContent(t){const e=this.instance.optionFor(t,"src")||"";this.instance.showLoading(t);const i=this.instance,n=new XMLHttpRequest;i.showLoading(t),n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&i.state===lt.Ready&&(i.hideLoading(t),200===n.status?i.setContent(t,n.responseText):i.setError(t,404===n.status?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const s=t.ajax||null;n.open(s?"POST":"GET",e+""),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send(s),t.xhr=n}setInlineContent(t){let e=null;if(S(t.src))e=t.src;else if("string"==typeof t.src){const i=t.src.split("#",2).pop();e=i?document.getElementById(i):null}if(e){if("clone"===t.type||e.closest(".fancybox__slide")){e=e.cloneNode(!0);const i=e.dataset.animationName;i&&(e.classList.remove(i),delete e.dataset.animationName);let n=e.getAttribute("id");n=n?`${n}--clone`:`clone-${this.instance.id}-${t.index}`,e.setAttribute("id",n)}else if(e.parentNode){const i=document.createElement("div");i.classList.add("fancybox-placeholder"),e.parentNode.insertBefore(i,e),t.placeholderEl=i}this.instance.setContent(t,e)}else this.instance.setError(t,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(t){const{src:e,el:i}=t;if(!e||"string"!=typeof e||!i)return;i.classList.add("is-loading");const n=this.instance,s=document.createElement("iframe");s.className="fancybox__iframe",s.setAttribute("id",`fancybox__iframe_${n.id}_${t.index}`);for(const[e,i]of Object.entries(this.optionFor(t,"iframeAttr")||{}))s.setAttribute(e,i);s.onerror=()=>{n.setError(t,"{{IFRAME_ERROR}}")},t.iframeEl=s;const o=this.optionFor(t,"preload");if("iframe"!==t.type||!1===o)return s.setAttribute("src",t.src+""),n.setContent(t,s,!1),this.resizeIframe(t),void n.revealContent(t);n.showLoading(t),s.onload=()=>{if(!s.src.length)return;const e="true"!==s.dataset.ready;s.dataset.ready="true",this.resizeIframe(t),e?n.revealContent(t):n.hideLoading(t)},s.setAttribute("src",e),n.setContent(t,s,!1)}resizeIframe(t){const{type:e,iframeEl:i}=t;if(e===Ct||e===Tt)return;const n=null==i?void 0:i.parentElement;if(!i||!n)return;let s=t.autoSize;void 0===s&&(s=this.optionFor(t,"autoSize"));let o=t.width||0,a=t.height||0;o&&a&&(s=!1);const r=n&&n.style;if(!1!==t.preload&&!1!==s&&r)try{const t=window.getComputedStyle(n),e=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),s=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),l=i.contentWindow;if(l){const t=l.document,i=t.getElementsByTagName(Et)[0],n=t.body;r.width="",n.style.overflow="hidden",o=o||i.scrollWidth+e,r.width=`${o}px`,n.style.overflow="",r.flex="0 0 auto",r.height=`${n.scrollHeight}px`,a=i.scrollHeight+s}}catch(t){}if(o||a){const t={flex:"0 1 auto",width:"",height:""};o&&"auto"!==o&&(t.width=`${o}px`),a&&"auto"!==a&&(t.height=`${a}px`),Object.assign(r,t)}}playVideo(){const t=this.instance.getSlide();if(!t)return;const{el:e}=t;if(!e||!e.offsetParent)return;if(!this.optionFor(t,"videoAutoplay"))return;if(t.type===Mt)try{const t=e.querySelector("video");if(t){const e=t.play();void 0!==e&&e.then((()=>{})).catch((e=>{t.muted=!0,t.play()}))}}catch(t){}if(t.type!==Ct&&t.type!==Tt)return;const i=()=>{if(t.iframeEl&&t.iframeEl.contentWindow){let e;if("true"===t.iframeEl.dataset.ready)return e=t.type===Ct?{event:"command",func:"playVideo"}:{method:"play",value:"true"},e&&t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"),void(t.poller=void 0);t.type===Ct&&(e={event:"listening",id:t.iframeEl.getAttribute("id")},t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"))}t.poller=setTimeout(i,250)};i()}processType(t){if(t.html)return t.type=Et,t.src=t.html,void(t.html="");const e=this.instance.optionFor(t,"src","");if(!e||"string"!=typeof e)return;let i=t.type,n=null;if(n=e.match(/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|shorts\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const s=this.optionFor(t,Ct),{nocookie:o}=s,a=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(i[n[s]]=t[n[s]])}return i}(s,["nocookie"]),r=`www.youtube${o?"-nocookie":""}.com`,l=Ot(e,a),c=encodeURIComponent(n[2]);t.videoId=c,t.src=`https://${r}/embed/${c}?${l}`,t.thumbSrc=t.thumbSrc||`https://i.ytimg.com/vi/${c}/mqdefault.jpg`,i=Ct}else if(n=e.match(/^.+vimeo.com\/(?:\/)?([\d]+)((\/|\?h=)([a-z0-9]+))?(.*)?/)){const s=Ot(e,this.optionFor(t,Tt)),o=encodeURIComponent(n[1]),a=n[4]||"";t.videoId=o,t.src=`https://player.vimeo.com/video/${o}?${a?`h=${a}${s?"&":""}`:""}${s}`,i=Tt}if(!i&&t.triggerEl){const e=t.triggerEl.dataset.type;Lt.includes(e)&&(i=e)}i||"string"==typeof e&&("#"===e.charAt(0)?i="inline":(n=e.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i=Mt,t.videoFormat=t.videoFormat||"video/"+("ogv"===n[1]?"ogg":n[1])):e.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i=St:e.match(/\.(pdf)((\?|#).*)?$/i)&&(i="pdf")),(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src=`https://maps.google.${n[1]}/?ll=${(n[2]?n[2]+"&z="+Math.floor(parseFloat(n[3]))+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&")}&output=${n[4]&&n[4].indexOf("layer=c")>0?"svembed":"embed"}`,i=Pt):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src=`https://maps.google.${n[1]}/maps?q=${n[2].replace("query=","q=").replace("api=1","")}&output=embed`,i=Pt),i=i||this.instance.option("defaultType"),t.type=i,i===St&&(t.thumbSrc=t.thumbSrc||t.src)}setContent(t){const e=this.instance.optionFor(t,"src")||"";if(t&&t.type&&e){switch(t.type){case Et:this.instance.setContent(t,e);break;case Mt:const i=this.option("videoTpl");i&&this.instance.setContent(t,i.replace(/\{\{src\}\}/gi,e+"").replace(/\{\{format\}\}/gi,this.optionFor(t,"videoFormat")||"").replace(/\{\{poster\}\}/gi,t.poster||t.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case Pt:case Ct:case Tt:t.preload=!1;case"iframe":this.setIframeContent(t)}this.setAspectRatio(t)}}setAspectRatio(t){const e=t.contentEl;if(!(t.el&&e&&t.type&&[Ct,Tt,Mt].includes(t.type)))return;let i,n=t.width||"auto",s=t.height||"auto";if("auto"===n||"auto"===s){i=this.optionFor(t,"videoRatio");const e=(i+"").match(/(\d+)\s*\/\s?(\d+)/);i=e&&e.length>2?parseFloat(e[1])/parseFloat(e[2]):parseFloat(i+"")}else n&&s&&(i=n/s);if(!i)return;e.style.aspectRatio="",e.style.width="",e.style.height="",e.offsetHeight;const o=e.getBoundingClientRect(),a=o.width||1,r=o.height||1;e.style.aspectRatio=i+"",i<a/r?(s="auto"===s?r:Math.min(r,s),e.style.width="auto",e.style.height=`${s}px`):(n="auto"===n?a:Math.min(a,n),e.style.width=`${n}px`,e.style.height="auto")}attach(){const t=this,e=t.instance;e.on("Carousel.beforeInitSlide",t.onBeforeInitSlide),e.on("Carousel.createSlide",t.onCreateSlide),e.on("Carousel.selectSlide",t.onSelectSlide),e.on("Carousel.unselectSlide",t.onUnselectSlide),e.on("Carousel.Panzoom.refresh",t.onRefresh),e.on("done",t.onDone),e.on("clearContent",t.onClearContent),window.addEventListener("message",t.onMessage)}detach(){const t=this,e=t.instance;e.off("Carousel.beforeInitSlide",t.onBeforeInitSlide),e.off("Carousel.createSlide",t.onCreateSlide),e.off("Carousel.selectSlide",t.onSelectSlide),e.off("Carousel.unselectSlide",t.onUnselectSlide),e.off("Carousel.Panzoom.refresh",t.onRefresh),e.off("done",t.onDone),e.off("clearContent",t.onClearContent),window.removeEventListener("message",t.onMessage)}}Object.defineProperty(zt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:At});const Rt="play",kt="pause",It="ready";class Dt extends ${constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:
vendor: 4,793 bytes, line 10776
10776It}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return this.state!==It}onReady(t){this.option("autoStart")&&(t.isInfinite||t.page<t.pages.length-1)&&this.start()}onChange(){this.removeProgressBar(),this.pause()}onSettle(){this.resume()}onVisibilityChange(){"visible"===document.visibilityState?this.resume():this.pause()}onMouseEnter(){this.inHover=!0,this.pause()}onMouseLeave(){var t;this.inHover=!1,(null===(t=this.instance.panzoom)||void 0===t?void 0:t.isResting)&&this.resume()}onTimerEnd(){const t=this.instance;"play"===this.state&&(t.isInfinite||t.page!==t.pages.length-1?t.slideNext():t.slideTo(0))}removeProgressBar(){this.progressBar&&(this.progressBar.remove(),this.progressBar=null)}createProgressBar(){var t;if(!this.option("showProgress"))return null;this.removeProgressBar();const e=this.instance,i=(null===(t=e.pages[e.page])||void 0===t?void 0:t.slides)||[];let n=this.option("progressParentEl");if(n||(n=(1===i.length?i[0].el:null)||e.viewport),!n)return null;const s=document.createElement("div");return C(s,"f-progress"),n.prepend(s),this.progressBar=s,s.offsetHeight,s}set(){const t=this,e=t.instance;if(e.pages.length<2)return;if(t.timer)return;const i=t.option("timeout");t.state=Rt,C(e.container,"has-autoplay");let n=t.createProgressBar();n&&(n.style.transitionDuration=`${i}ms`,n.style.transform="scaleX(1)"),t.timer=setTimeout((()=>{t.timer=null,t.inHover||t.onTimerEnd()}),i),t.emit("set")}clear(){const t=this;t.timer&&(clearTimeout(t.timer),t.timer=null),t.removeProgressBar()}start(){const t=this;if(t.set(),t.state!==It){if(t.option("pauseOnHover")){const e=t.instance.container;e.addEventListener("mouseenter",t.onMouseEnter,!1),e.addEventListener("mouseleave",t.onMouseLeave,!1)}document.addEventListener("visibilitychange",t.onVisibilityChange,!1),t.emit("start")}}stop(){const t=this,e=t.state,i=t.instance.container;t.clear(),t.state=It,i.removeEventListener("mouseenter",t.onMouseEnter,!1),i.removeEventListener("mouseleave",t.onMouseLeave,!1),document.removeEventListener("visibilitychange",t.onVisibilityChange,!1),P(i,"has-autoplay"),e!==It&&t.emit("stop")}pause(){const t=this;t.state===Rt&&(t.state=kt,t.clear(),t.emit(kt))}resume(){const t=this,e=t.instance;if(e.isInfinite||e.page!==e.pages.length-1)if(t.state!==Rt){if(t.state===kt&&!t.inHover){const e=new Event("resume",{bubbles:!0,cancelable:!0});t.emit("resume",e),e.defaultPrevented||t.set()}}else t.set();else t.stop()}toggle(){this.state===Rt||this.state===kt?this.stop():this.start()}attach(){const t=this,e=t.instance;e.on("ready",t.onReady),e.on("Panzoom.startAnimation",t.onChange),e.on("Panzoom.endAnimation",t.onSettle),e.on("Panzoom.touchMove",t.onChange)}detach(){const t=this,e=t.instance;e.off("ready",t.onReady),e.off("Panzoom.startAnimation",t.onChange),e.off("Panzoom.endAnimation",t.onSettle),e.off("Panzoom.touchMove",t.onChange),t.stop()}}Object.defineProperty(Dt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class Ft extends ${constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(t){const e=t.carousel;if(!e)return;const i=t.container;i&&(e.options.Autoplay=p({autoStart:!1},this.option("Autoplay")||{},{pauseOnHover:!1,timeout:this.option("timeout"),progressParentEl:()=>this.option("progressParentEl")||null,on:{start:()=>{t.emit("startSlideshow")},set:e=>{var n;i.classList.add("has-slideshow"),(null===(n=t.getSlide())||void 0===n?void 0:n.state)!==ct.Ready&&e.pause()},stop:()=>{i.classList.remove("has-slideshow"),t.isCompact||t.endIdle(),t.emit("endSlideshow")},resume:(e,i)=>{var n,s,o;!i||!i.cancelable||(null===(n=t.getSlide())||void 0===n?void 0:n.state)===ct.Ready&&(null===(o=null===(s=t.carousel)||void 0===s?void 0:s.panzoom)||void 0===o?void 0:o.isResting)||i.preventDefault()}}}),e.attachPlugins({Autoplay:Dt}),this.ref=e.plugins.Autoplay)}onReady(t){const e=t.carousel,i=this.ref;i&&e&&this.option("playOnStart")&&(e.isInfinite||e.page<e.pages.length-1)&&i.start()}onDone(t,e){const i=this.ref,n=t.carousel;if(!i||!n)return;const s=e.panzoom;s&&s.on("startAnimation",(()=>{t.isCurrentSlide(e)&&i.stop()})),t.isCurrentSlide(e)&&i.resume()}onKeydown(t,e){var i;const n=this.ref;n&&e===this.option("key")&&"BUTTON"!==(null===(i=document.activeElement)||void 0===i?void 0:i.nodeName)&&n.toggle()}attach(){const t=this,e=t.instance;e.on("Carousel.init",t.onPrepare),e.on("Carousel.ready",t.onReady),e.on("done",t.onDone),e.on("key
10776down",t.onKeydown)}detach(){const t=this,e=t.instance;e.off("Carousel.init",t.onPrepare),e.off("Carousel.ready",t.onReady),e.off("done",t.onDone),e.off("keydown",t.onKeydown)}}Object.defineProperty(Ft,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,progressParentEl:t=>{var e;return(null===(e=t.instance.container)||void 0===e?void 0:e.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]"))||t.instance.container},timeout:3e3}});const jt={classes:{container:"f-thumbs f-carousel__thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'<button class="f-thumbs__slide__button" tabindex="0" type="button" aria-label="{{GOTO}}" data-carousel-index="%i"><img class="f-thumbs__slide__img" data-lazy-src="{{%s}}" alt="" /></button>',type:"modern"};var Bt;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden"}(Bt||(Bt={}));const Ht="isResting",Nt="thumbWidth",_t="thumbHeight",$t="thumbClipWidth";let Wt=class extends ${constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Bt.Init})}get isModern(){return"modern"===this.type}onInitSlide(t,e){const i=e.el?e.el.dataset:void 0;i&&(e.thumbSrc=i.thumbSrc||e.thumbSrc||"",e[$t]=parseFloat(i[$t]||"")||e[$t]||0,e[_t]=parseFloat(i.thumbHeight||"")||e[_t]||0),this.addSlide(e)}onInitSlides(){this.build()}onChange(){var t;if(!this.isModern)return;const e=this.container,i=this.instance,n=i.panzoom,s=this.carousel,o=s?s.panzoom:null,r=i.page;if(n&&s&&o){if(n.isDragging){P(e,this.cn(Ht));let n=(null===(t=s.pages[r])||void 0===t?void 0:t.pos)||0;n+=i.getProgress(r)*(this[$t]+this.thumbGap);let a=o.getBounds();-1*n>a.x.min&&-1*n<a.x.max&&o.panTo({x:-1*n,friction:.12})}else a(e,this.cn(Ht),n.isResting);this.shiftModern()}}onRefresh(){this.updateProps();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.shiftModern()}isDisabled(){const t=this.option("minCount")||0;if(t){const e=this.instance;let i=0;for(const t of e.slides||[])t.thumbSrc&&i++;if(i<t)return!0}const e=this.option("type");return["modern","classic"].indexOf(e)<0}getThumb(t){const e=this.option("thumbTpl")||"";return{html:this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}}addSlide(t){const e=this.carousel;e&&e.addSlide(t.index,this.getThumb(t))}getSlides(){const t=[];for(const e of this.instance.slides||[])t.push(this.getThumb(e));return t}resizeModernSlide(t){this.isModern&&(t[Nt]=t[$t]&&t[_t]?Math.round(this[_t]*(t[$t]/t[_t])):this[Nt])}updateProps(){const t=this.container;if(!t)return;const e=e=>parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-"+e))||0;this.thumbGap=e("gap"),this.thumbExtraGap=e("extra-gap"),this[Nt]=e("width")||40,this[$t]=e("clip-width")||40,this[_t]=e("height")||40}build(){const t=this;if(t.state!==Bt.Init)return;if(t.isDisabled())return void t.emit("disabled");const e=t.instance,i=e.container,n=t.getSlides(),s=t.option("type");t.type=s;const o=t.option("parentEl"),a=t.cn("container"),r=t.cn("track");let l=null==o?void 0:o.querySelector("."+a);l||(l=document.createElement("div"),C(l,a),o?o.appendChild(l):i.after(l)),C(l,`is-${s}`),C(i,t.cn("hasThumbs")),t.container=l,t.updateProps();let c=l.querySelector("."+r);c||(c=document.createElement("div"),C(c,t.cn("track")),l.appendChild(c)),t.track=c;const h=p({},{track:c,infinite:!1,center:!0,fill:"classic"===s,dragFree:!0,slidesPerPage:1,transition:!1,preload:.25,friction:.12,Panzoom:{maxVelocity:0},Dots:!1,Navigation:!1,classes:{container:"f-thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide"}},t.option("Carousel")||{},{Sync:{target:e},slides:n}),d=new e.constructor(l,h);d.on("createSlide",((e,i)=>{t.setProps(i.index),t.emit("createSlide",i,i.el)})),d.on("ready",(()=>{t.shiftModern(),t.emit("ready")})),d.on("refresh",(()=>{t.shiftModern()})),d.on("Panzoom.click",((e,i,n)=>{t.onClick(n)})),t.carousel=d,t.state=Bt.Ready}onClick(t){t.preventDefault(),t.stopPropagation();const e=this.instance,{pages:i,page:n}=e,s=t=>{if(t){const e=t.closest("[data-carousel-index]");if(e)return[parseInt(e.dataset.carouselIndex||"",10)||0,e]}return[-1,void 0]},o=(t,e)=>{const i=document.elementFromPoint(t,e);return i?s(i):[-1,void 0]};let[a,r]=s(t.target);if(a>-1)return;const l=this[$t],c=t.clientX,h=t.clientY;let[d,u]=o(c-l,h),[p,f]=o(c+l,h);u&&f?(a=Math.abs(c-u.getBoundingClientRect().right)<Math.abs(c-f.getBoundingClientRect().left)?d:
vendor: 4,266 bytes, line 10776
10776p,a===n&&(a=a===d?p:d)):u?a=d:f&&(a=p),a>-1&&i[a]&&e.slideTo(a)}getShift(t){var e;const i=this,{instance:n}=i,s=i.carousel;if(!n||!s)return 0;const o=i[Nt],a=i[$t],r=i.thumbGap,l=i.thumbExtraGap;if(!(null===(e=s.slides[t])||void 0===e?void 0:e.el))return 0;const c=.5*(o-a),h=n.pages.length-1;let d=n.getProgress(0),u=n.getProgress(h),p=n.getProgress(t,!1,!0),f=0,g=c+l+r;const m=d<0&&d>-1,v=u>0&&u<1;return 0===t?(f=g*Math.abs(d),v&&1===d&&(f-=g*Math.abs(u))):t===h?(f=g*Math.abs(u)*-1,m&&-1===u&&(f+=g*Math.abs(d))):m||v?(f=-1*g,f+=g*Math.abs(d),f+=g*(1-Math.abs(u))):f=g*p,f}setProps(t){var i;const n=this;if(!n.isModern)return;const{instance:s}=n,o=n.carousel;if(s&&o){const a=null===(i=o.slides[t])||void 0===i?void 0:i.el;if(a&&a.childNodes.length){let i=e(1-Math.abs(s.getProgress(t))),o=e(n.getShift(t));a.style.setProperty("--progress",i?i+"":""),a.style.setProperty("--shift",o+"")}}}shiftModern(){const t=this;if(!t.isModern)return;const{instance:e,track:i}=t,n=e.panzoom,s=t.carousel;if(!(e&&i&&n&&s))return;if(n.state===v.Init||n.state===v.Destroy)return;for(const i of e.slides)t.setProps(i.index);let o=(t[$t]+t.thumbGap)*(s.slides.length||0);i.style.setProperty("--width",o+"")}cleanup(){const t=this;t.carousel&&t.carousel.destroy(),t.carousel=null,t.container&&t.container.remove(),t.container=null,t.track&&t.track.remove(),t.track=null,t.state=Bt.Init,P(t.instance.container,t.cn("hasThumbs"))}attach(){const t=this,e=t.instance;e.on("initSlide",t.onInitSlide),e.state===H.Init?e.on("initSlides",t.onInitSlides):t.onInitSlides(),e.on(["change","Panzoom.afterTransform"],t.onChange),e.on("Panzoom.refresh",t.onRefresh)}detach(){const t=this,e=t.instance;e.off("initSlide",t.onInitSlide),e.off("initSlides",t.onInitSlides),e.off(["change","Panzoom.afterTransform"],t.onChange),e.off("Panzoom.refresh",t.onRefresh),t.cleanup()}};Object.defineProperty(Wt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:jt});const Xt=Object.assign(Object.assign({},jt),{key:"t",showOnStart:!0,parentEl:null}),qt="is-masked",Yt="aria-hidden";class Vt extends ${constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hidden",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get isEnabled(){const t=this.ref;return t&&!t.isDisabled()}get isHidden(){return this.hidden}onClick(t,e){e.stopPropagation()}onCreateSlide(t,e){var i,n,s;const o=(null===(s=null===(n=null===(i=this.instance)||void 0===i?void 0:i.carousel)||void 0===n?void 0:n.slides[e.index])||void 0===s?void 0:s.type)||"",a=e.el;if(a&&o){let t=`for-${o}`;["video","youtube","vimeo","html5video"].includes(o)&&(t+=" for-video"),C(a,t)}}onInit(){var t;const e=this,i=e.instance,n=i.carousel;if(e.ref||!n)return;const s=e.option("parentEl")||i.footer||i.container;if(!s)return;const o=p({},e.options,{parentEl:s,classes:{container:"f-thumbs fancybox__thumbs"},Carousel:{Sync:{friction:i.option("Carousel.friction")||0}},on:{ready:t=>{const i=t.container;i&&this.hidden&&(e.refresh(),i.style.transition="none",e.hide(),i.offsetHeight,queueMicrotask((()=>{i.style.transition="",e.show()})))}}});o.Carousel=o.Carousel||{},o.Carousel.on=p((null===(t=e.options.Carousel)||void 0===t?void 0:t.on)||{},{click:this.onClick,createSlide:this.onCreateSlide}),n.options.Thumbs=o,n.attachPlugins({Thumbs:Wt}),e.ref=n.plugins.Thumbs,e.option("showOnStart")||(e.ref.state=Bt.Hidden,e.hidden=!0)}onResize(){var t;const e=null===(t=this.ref)||void 0===t?void 0:t.container;e&&(e.style.maxHeight="")}onKeydown(t,e){const i=this.option("key");i&&i===e&&this.toggle()}toggle(){const t=this.ref;if(t&&!t.isDisabled())return t.state===Bt.Hidden?(t.state=Bt.Init,void t.build()):void(this.hidden?this.show():this.hide())}show(){const t=this.ref;if(!t||t.isDisabled())return;const e=t.container;e&&(this.refresh(),e.offsetHeight,e.removeAttribute(Yt),e.classList.remove(qt),this.hidden=!1)}hide(){const t=this.ref,e=t&&t.container;e&&(this.refresh(),e.offsetHeight,e.classList.add(qt),e.setAttribute(Yt,"true")),this.hidden=!0}refresh(){const t=this.ref;if(!t||!t.state)return;const e=t.container,i=(null==e?void 0:e.firstChild)||null;e&&i&&i.childNodes.length&&(e.style.maxHeight=`${i.getBoundingClientRect().height}px`)}
vendor: 6,220 bytes, line 10776
10776attach(){const t=this,e=t.instance;e.state===lt.Init?e.on("Carousel.init",t.onInit):t.onInit(),e.on("resize",t.onResize),e.on("keydown",t.onKeydown)}detach(){var t;const e=this,i=e.instance;i.off("Carousel.init",e.onInit),i.off("resize",e.onResize),i.off("keydown",e.onKeydown),null===(t=i.carousel)||void 0===t||t.detachPlugins(["Thumbs"]),e.ref=null}}Object.defineProperty(Vt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:Xt});const Zt={panLeft:{icon:'<svg><path d="M5 12h14M5 12l6 6M5 12l6-6"/></svg>',change:{panX:-100}},panRight:{icon:'<svg><path d="M5 12h14M13 18l6-6M13 6l6 6"/></svg>',change:{panX:100}},panUp:{icon:'<svg><path d="M12 5v14M18 11l-6-6M6 11l6-6"/></svg>',change:{panY:-100}},panDown:{icon:'<svg><path d="M12 5v14M18 13l-6 6M6 13l6 6"/></svg>',change:{panY:100}},zoomIn:{icon:'<svg><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M11 8v6M8 11h6"/></svg>',action:"zoomIn"},zoomOut:{icon:'<svg><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"zoomOut"},toggle1to1:{icon:'<svg><path d="M3.51 3.07c5.74.02 11.48-.02 17.22.02 1.37.1 2.34 1.64 2.18 3.13 0 4.08.02 8.16 0 12.23-.1 1.54-1.47 2.64-2.79 2.46-5.61-.01-11.24.02-16.86-.01-1.36-.12-2.33-1.65-2.17-3.14 0-4.07-.02-8.16 0-12.23.1-1.36 1.22-2.48 2.42-2.46Z"/><path d="M5.65 8.54h1.49v6.92m8.94-6.92h1.49v6.92M11.5 9.4v.02m0 5.18v0"/></svg>',action:"toggleZoom"},toggleZoom:{icon:'<svg><g><line x1="11" y1="8" x2="11" y2="14"></line></g><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"toggleZoom"},iterateZoom:{icon:'<svg><g><line x1="11" y1="8" x2="11" y2="14"></line></g><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"iterateZoom"},rotateCCW:{icon:'<svg><path d="M15 4.55a8 8 0 0 0-6 14.9M9 15v5H4M18.37 7.16v.01M13 19.94v.01M16.84 18.37v.01M19.37 15.1v.01M19.94 11v.01"/></svg>',action:"rotateCCW"},rotateCW:{icon:'<svg><path d="M9 4.55a8 8 0 0 1 6 14.9M15 15v5h5M5.63 7.16v.01M4.06 11v.01M4.63 15.1v.01M7.16 18.37v.01M11 19.94v.01"/></svg>',action:"rotateCW"},flipX:{icon:'<svg style="stroke-width: 1.3"><path d="M12 3v18M16 7v10h5L16 7M8 7v10H3L8 7"/></svg>',action:"flipX"},flipY:{icon:'<svg style="stroke-width: 1.3"><path d="M3 12h18M7 16h10L7 21v-5M7 8h10L7 3v5"/></svg>',action:"flipY"},fitX:{icon:'<svg><path d="M4 12V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v6M10 18H3M21 18h-7M6 15l-3 3 3 3M18 15l3 3-3 3"/></svg>',action:"fitX"},fitY:{icon:'<svg><path d="M12 20H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h6M18 14v7M18 3v7M15 18l3 3 3-3M15 6l3-3 3 3"/></svg>',action:"fitY"},reset:{icon:'<svg><path d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/></svg>',action:"reset"},toggleFS:{icon:'<svg><g><path d="M14.5 9.5 21 3m0 0h-6m6 0v6M3 21l6.5-6.5M3 21v-6m0 6h6"/></g><g><path d="m14 10 7-7m-7 7h6m-6 0V4M3 21l7-7m0 0v6m0-6H4"/></g></svg>',action:"toggleFS"}};var Ut;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"}(Ut||(Ut={}));const Gt={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'<div class="fancybox__infobar" tabindex="-1"><span data-fancybox-current-index></span>/<span data-fancybox-count></span></div>'},download:{tpl:'<a class="f-button" title="{{DOWNLOAD}}" data-fancybox-download href="javasript:;"><svg><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2M7 11l5 5 5-5M12 4v12"/></svg></a>'},prev:{tpl:'<button class="f-button" title="{{PREV}}" data-fancybox-prev><svg><path d="m15 6-6 6 6 6"/></svg></button>'},next:{tpl:'<button class="f-button" title="{{NEXT}}" data-fancybox-next><svg><path d="m9 6 6 6-6 6"/></svg></button>'},slideshow:{tpl:'<button class="f-button" title="{{TOGGLE_SLIDESHOW}}" data-fancybox-toggle-slideshow><svg><g><path d="M8 4v16l13 -8z"></path></g><g><path d="M8 4v15M17 4v15"/></g></svg></button>'},fullscreen:{tpl:'<button class="f-button" title="{{TOGGLE_FULLSCREEN}}" data-fancybox-toggle-fullscreen><svg><g><path d="M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2M16 4h2a2 2 0 0 1 2 2v2M16 20h2a2 2 0 0 0 2-2v-2"/></g><g><path d="M15 19v-2a2 2 0 0 1 2-2h2M15 5v2a2 2 0 0 0 2 2h2M5 15h2a2 2 0 0 1 2 2v2M5 9h2a2 2 0 0 0 2-2V5"/></g></svg></button>'},thumbs:{tpl:'<button class="f-button" title="{{TOGGLE_THUMBS}}" data-fancybox-toggle-thumbs><svg><circle cx="5.5" cy="5.5" r="1"/><circle cx="12" cy="5.5" r="1"/><circle cx="18.5" cy="5.5" r="1"/><circle cx="5.5" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="18.5" cy="12" r="1"/><circle cx="5.5" cy="18.5" r="1"/><circle cx="12" cy="18.5" r="1"/><circle cx="18.5" cy="18.5" r="1"/></svg></button>'},close:{tpl:'<button class="f-button" title="{{CLOSE}}" data-fancybox-close><svg><path d="m19.5 4.5-15 15M4.5 4.5l15 15"/></svg></button>'}},parentEl:null},Kt={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Jt="has-toolbar",Qt="fancybox__toolbar";class te extends ${constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Ut.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(t){var e;if(!t.carousel)return;let i=this.option("display"),n=this.option("absolute"),s=this.option("enabled");if("auto"===s){const t=this.instance.carousel;let e=0;if(t)for(const i of t.slides)(i.panzoom||"image"===i.type)&&e++;e||(s=!1)}s||(i=void 0);let o=0;const a={left:[],middle:[],right:[]};if(i)for(const t of["left","middle","right"])for(const n of i[t]){const i=this.createEl(n);i&&(null===(e=a[t])||void 0===e||e.push(i),o++)}let r=null;if(o&&(r=this.createContainer()),r){for(const[t,e]of Object.entries(a)){const i=document.createElement("div");C(i,Qt+"__column is-"+t);for(const t of e)i.appendChild(t);"auto"!==n||"middle"!==t||e.length||(n=!0),r.appendChild(i)}!0===n&&C(r,"is-absolute"),this.state=Ut.Ready,this.onRefresh()}else this.state=Ut.Disabled}onClick(t){var e,i;const n=this.instance,s=n.getSlide(),o=null==s?void 0:s.panzoom,a=t.target,r=a&&S(a)?a.dataset:null;if(!r)return;if(void 0!==r.fancyboxToggleThumbs)return t.preventDefault(),t.stopPropagation(),void(null===(e=n.plugins.Thumbs
vendor: 26,214 bytes, line 10776
10776)||void 0===e||e.toggle());if(void 0!==r.fancyboxToggleFullscreen)return t.preventDefault(),t.stopPropagation(),void this.instance.toggleFullscreen();if(void 0!==r.fancyboxToggleSlideshow){t.preventDefault(),t.stopPropagation();const e=null===(i=n.carousel)||void 0===i?void 0:i.plugins.Autoplay;let s=e.isActive;return o&&"mousemove"===o.panMode&&!s&&o.reset(),void(s?e.stop():e.start())}const l=r.panzoomAction,c=r.panzoomChange;if((c||l)&&(t.preventDefault(),t.stopPropagation()),c){let t={};try{t=JSON.parse(c)}catch(t){}o&&o.applyChange(t)}else l&&o&&o[l]&&o[l]()}onChange(){this.onRefresh()}onRefresh(){if(this.instance.isClosing())return;const t=this.container;if(!t)return;const e=this.instance.getSlide();if(!e||e.state!==ct.Ready)return;const i=e&&!e.error&&e.panzoom;for(const e of t.querySelectorAll("[data-panzoom-action]"))i?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));let n=i&&i.canZoomIn(),s=i&&i.canZoomOut();for(const e of t.querySelectorAll('[data-panzoom-action="zoomIn"]'))n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="zoomOut"]'))s?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){s||n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));const t=e.querySelector("g");t&&(t.style.display=n?"":"none")}}onDone(t,e){var i;null===(i=e.panzoom)||void 0===i||i.on("afterTransform",(()=>{this.instance.isCurrentSlide(e)&&this.onRefresh()})),this.instance.isCurrentSlide(e)&&this.onRefresh()}createContainer(){const t=this.instance.container;if(!t)return null;const e=this.option("parentEl")||t;let i=e.querySelector("."+Qt);return i||(i=document.createElement("div"),C(i,Qt),e.prepend(i)),i.addEventListener("click",this.onClick,{passive:!1,capture:!0}),t&&C(t,Jt),this.container=i,i}createEl(t){const e=this.instance,i=e.carousel;if(!i)return null;if("toggleFS"===t)return null;if("fullscreen"===t&&!at())return null;let n=null;const o=i.slides.length||0;let a=0,r=0;for(const t of i.slides)(t.panzoom||"image"===t.type)&&a++,("image"===t.type||t.downloadSrc)&&r++;if(o<2&&["infobar","prev","next"].includes(t))return n;if(void 0!==Zt[t]&&!a)return null;if("download"===t&&!r)return null;if("thumbs"===t){const t=e.plugins.Thumbs;if(!t||!t.isEnabled)return null}if("slideshow"===t){if(!i.plugins.Autoplay||o<2)return null}if(void 0!==Zt[t]){const e=Zt[t];n=document.createElement("button"),n.setAttribute("title",this.instance.localize(`{{${t.toUpperCase()}}}`)),C(n,"f-button"),e.action&&(n.dataset.panzoomAction=e.action),e.change&&(n.dataset.panzoomChange=JSON.stringify(e.change)),n.appendChild(s(this.instance.localize(e.icon)))}else{const e=(this.option("items")||[])[t];e&&(n=s(this.instance.localize(e.tpl)),"function"==typeof e.click&&n.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),"function"==typeof e.click&&e.click.call(this,this,t)})))}const l=null==n?void 0:n.querySelector("svg");if(l)for(const[t,e]of Object.entries(Kt))l.getAttribute(t)||l.setAttribute(t,String(e));return n}removeContainer(){const t=this.container;t&&t.remove(),this.container=null,this.state=Ut.Disabled;const e=this.instance.container;e&&P(e,Jt)}attach(){const t=this,e=t.instance;e.on("Carousel.initSlides",t.onReady),e.on("done",t.onDone),e.on(["reveal","Carousel.change"],t.onChange),t.onReady(t.instance)}detach(){const t=this,e=t.instance;e.off("Carousel.initSlides",t.onReady),e.off("done",t.onDone),e.off(["reveal","Carousel.change"],t.onChange),t.removeContainer()}}Object.defineProperty(te,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:Gt});const ee={Hash:class extends ${onReady(){dt=!1}onChange(t){pt&&clearTimeout(pt);const{hash:e}=ft(),{hash:i}=gt(),n=t.isOpeningSlide(t.getSlide());n&&(ht=i===e?"":i),e&&e!==i&&(pt=setTimeout((()=>{try{if(t.state===lt.Ready){let t="replaceState";n&&!ut&&(t="pushState",ut=!0),window.history[t]({},document.title,window.location.pathname+window.location.search+e)}}catch(t){}}),300))}onClose(t){if(pt&&clearTimeout(pt),!dt&&ut)return ut=!1,dt=!1,void window.history.back();if(!dt)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(ht||""))}catch(t){}}attach(){const t=this.instance;t.on("ready",this.onReady),t.on(["Carousel.ready","Carousel.change"],this.onChange),t.on("close",this.onClose)}detach(){const t=this.instance;t.off("ready",this.onReady),t.off(["Carousel.ready","Carousel.change"],this.onChange),t.off("close",this.onClose)}static parseURL(){return gt()}static startFromUrl(){mt()}static destroy(){window.removeEventListener("hashchange",bt,!1)}},Html:zt,Images:xt,Slideshow:Ft,Thumbs:Vt,Toolbar:te},ie="with-fancybox",ne="hide-scrollbar",se="--fancybox-scrollbar-compensate",oe="--fancybox-body-margin",ae="aria-hidden",re="is-using-tab",le="is-animated",ce="is-compact",he="is-loading",de="is-opening",ue="has-caption",pe="disabled",fe="tabindex",ge="download",me="href",ve="src",be=t=>"string"==typeof t,ye=function(){var t=window.getSelection();return!!t&&"Range"===t.type};let we,xe=null,Ee=null,Se=0,Pe=0,Ce=0,Te=0;const Me=new Map;let Oe=0;class Ae extends m{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(t=[],e={},i={}){super(e),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startedFs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:lt.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),we||(we=at()),this.id=e.id||++Oe,Me.set(this.id,this),this.userSlides=t,this.userPlugins=i,queueMicrotask((()=>{this.init()}))}init(){if(this.state===lt.Destroy)return;this.state=lt.Init,this.attachPlugins(Object.assign(Object.assign({},Ae.Plugins),this.userPlugins)),this.emit("init"),this.emit("attachPlugins"),!0===this.option("hideScrollbar")&&(()=>{if(!it)return;const t=document,e=t.body,i=t.documentElement;if(e.classList.contains(ne))return;let n=window.innerWidth-i.getBoundingClientRect().width;const s=parseFloat(window.getComputedStyle(e).marginRight);n<0&&(n=0),i.style.setProperty(se,`${n}px`),s&&e.style.setProperty(oe,`${s}px`),e.classList.add(ne)})(),this.initLayout(),this.scale();const t=()=>{this.initCarousel(this.userSlides),this.state=lt.Ready,this.attachEvents(),this.emit("ready"),setTimeout((()=>{this.container&&this.container.setAttribute(ae,"false")}),16)};this.option("Fullscreen.autoStart")&&we&&!we.isFullscreen()?we.request().then((()=>{this.startedFs=!0,t()})).catch((()=>t())):t()}initLayout(){var t,e;const i=this.option("parentEl")||document.body,n=s(this.localize(this.option("tpl.main")||""));if(n){if(n.setAttribute("id",`fancybox-${this.id}`),n.setAttribute("aria-label",this.localize("{{MODAL}}")),n.classList.toggle(ce,this.isCompact),C(n,this.option("mainClass")||""),C(n,de),this.container=n,this.footer=n.querySelector(".fancybox__footer"),i.appendChild(n),C(document.documentElement,ie),xe&&Ee||(xe=document.createElement("span"),C(xe,"fancybox-focus-guard"),xe.setAttribute(fe,"0"),xe.setAttribute(ae,"true"),xe.setAttribute("aria-label","Focus guard"),Ee=xe.cloneNode(),null===(t=n.parentElement)||void 0===t||t.insertBefore(xe,n),null===(e=n.parentElement)||void 0===e||e.append(Ee)),n.addEventListener("mousedown",(t=>{Se=t.pageX,Pe=t.pageY,P(n,re)})),this.option("closeExisting"))for(const t of Me.values())t.id!==this.id&&t.close();else this.option("animated")&&(C(n,le),setTimeout((()=>{this.isClosing()||P(n,le)}),350));this.emit("initLayout")}}initCarousel(t){const e=this.container;if(!e)return;const n=e.querySelector(".fancybox__carousel");if(!n)return;const s=this.carousel=new tt(n,p({},{slides:t,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));s.on("*",((t,e,...i)=>{this.emit(`Carousel.${e}`,t,...i)})),s.on(["ready","change"],(()=>{this.manageCaption()})),this.on("Carousel.removeSlide",((t,e,i)=>{this.clearContent(i),i.state=void 0})),s.on("Panzoom.touchStart",(()=>{var t,e;this.isCompact||this.endIdle(),(null===(t=document.activeElement)||void 0===t?void 0:t.closest(".f-thumbs"))&&(null===(e=this.container)||void 0===e||e.focus())})),s.on("settle",(()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&!this.isClosing&&this.checkFocus()})),this.option("dragToClose")&&(s.on("Panzoom.afterTransform",((t,e)=>{const n=this.getSlide();if(n&&i(n.el))return;const s=this.container;if(s){const t=Math.abs(e.current.f),i=t<1?"":Math.max(.5,Math.min(1,1-t/e.contentRect.fitHeight*1.5));s.style.setProperty("--fancybox-ts",i?"0s":""),s.style.setProperty("--fancybox-opacity",i+"")}})),s.on("Panzoom.touchEnd",((t,e,n)=>{var s;const o=this.getSlide();if(o&&i(o.el))return;if(e.isMobile&&document.activeElement&&-1!==["TEXTAREA","INPUT"].indexOf(null===(s=document.activeElement)||void 0===s?void 0:s.nodeName))return;const a=Math.abs(e.dragOffset.y);"y"===e.lockedAxis&&(a>=200||a>=50&&e.dragOffset.time<300)&&(n&&n.cancelable&&n.preventDefault(),this.close(n,"f-throwOut"+(e.current.f<0?"Up":"Down")))}))),s.on("change",(t=>{var e;let i=null===(e=this.getSlide())||void 0===e?void 0:e.triggerEl;if(i){const e=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:t.page});i.dispatchEvent(e)}})),s.on(["refresh","change"],(t=>{const e=this.container;if(!e)return;for(const i of e.querySelectorAll("[data-fancybox-current-index]"))i.innerHTML=t.page+1;for(const i of e.querySelectorAll("[data-fancybox-count]"))i.innerHTML=t.pages.length;if(!t.isInfinite){for(const i of e.querySelectorAll("[data-fancybox-next]"))t.page<t.pages.length-1?(i.removeAttribute(pe),i.removeAttribute(fe)):(i.setAttribute(pe,""),i.setAttribute(fe,"-1"));for(const i of e.querySelectorAll("[data-fancybox-prev]"))t.page>0?(i.removeAttribute(pe),i.removeAttribute(fe)):(i.setAttribute(pe,""),i.setAttribute(fe,"-1"))}const i=this.getSlide();if(!i)return;let n=i.downloadSrc||"";n||"image"!==i.type||i.error||!be(i[ve])||(n=i[ve]);for(const t of e.querySelectorAll("[data-fancybox-download]")){const e=i.downloadFilename;n?(t.removeAttribute(pe),t.removeAttribute(fe),t.setAttribute(me,n),t.setAttribute(ge,e||n),t.setAttribute("target","_blank")):(t.setAttribute(pe,""),t.setAttribute(fe,"-1"),t.removeAttribute(me),t.removeAttribute(ge))}})),this.emit("initCarousel")}attachEvents(){const t=this,e=t.container;if(!e)return;e.addEventListener("click",t.onClick,{passive:!1,capture:!1}),e.addEventListener("wheel",t.onWheel,{passive:!1,capture:!1}),document.addEventListener("keydown",t.onKeydown,{passive:!1,capture:!0}),document.addEventListener("visibilitychange",t.onVisibilityChange,!1),document.addEventListener("mousemove",t.onMousemove),t.option("trapFocus")&&document.addEventListener("focus",t.onFocus,!0),window.addEventListener("resize",t.onResize);const i=window.visualViewport;i&&(i.addEventListener("scroll",t.onResize),i.addEventListener("resize",t.onResize))}detachEvents(){const t=this,e=t.container;if(!e)return;document.removeEventListener("keydown",t.onKeydown,{passive:!1,capture:!0}),e.removeEventListener("wheel",t.onWheel,{passive:!1,capture:!1}),e.removeEventListener("click",t.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",t.onMousemove),window.removeEventListener("resize",t.onResize);const i=window.visualViewport;i&&(i.removeEventListener("resize",t.onResize),i.removeEventListener("scroll",t.onResize)),document.removeEventListener("visibilitychange",t.onVisibilityChange,!1),document.removeEventListener("focus",t.onFocus,!0)}scale(){const t=this.container;if(!t)return;const e=window.visualViewport,i=Math.max(1,(null==e?void 0:e.scale)||1);let n="",s="",o="";if(e&&i>1){let t=`${e.offsetLeft}px`,a=`${e.offsetTop}px`;n=e.width*i+"px",s=e.height*i+"px",o=`translate3d(${t}, ${a}, 0) scale(${1/i})`}t.style.transform=o,t.style.width=n,t.style.height=s}onClick(t){var e;const{container:i,isCompact:n}=this;if(!i||this.isClosing())return;!n&&this.option("idle")&&this.resetIdle();const s=t.composedPath()[0];if(s.closest(".fancybox-spinner")||s.closest("[data-fancybox-close]"))return t.preventDefault(),void this.close(t);if(s.closest("[data-fancybox-prev]"))return t.preventDefault(),void this.prev();if(s.closest("[data-fancybox-next]"))return t.preventDefault(),void this.next();if("click"===t.type&&0===t.detail)return;if(Math.abs(t.pageX-Se)>30||Math.abs(t.pageY-Pe)>30)return;const o=document.activeElement;if(ye()&&o&&i.contains(o))return;if(n&&"image"===(null===(e=this.getSlide())||void 0===e?void 0:e.type))return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout((()=>{this.toggleIdle(),this.clickTimer=null}),350));if(this.emit("click",t),t.defaultPrevented)return;let a=!1;if(s.closest(".fancybox__content")){if(o){if(o.closest("[contenteditable]"))return;s.matches(st)||o.blur()}if(ye())return;a=this.option("contentClick")}else s.closest(".fancybox__carousel")&&!s.matches(st)&&(a=this.option("backdropClick"));"close"===a?(t.preventDefault(),this.close(t)):"next"===a?(t.preventDefault(),this.next()):"prev"===a&&(t.preventDefault(),this.prev())}onWheel(t){const e=t.target;let i=this.option("wheel",t);e.closest(".fancybox__thumbs")&&(i="slide");const s="slide"===i,o=[-t.deltaX||0,-t.deltaY||0,-t.detail||0].reduce((function(t,e){return Math.abs(e)>Math.abs(t)?e:t})),a=Math.max(-1,Math.min(1,o)),r=Date.now();this.pwt&&r-this.pwt<300?s&&t.preventDefault():(this.pwt=r,this.emit("wheel",t,a),t.defaultPrevented||("close"===i?(t.preventDefault(),this.close(t)):"slide"===i&&(n(e)||(t.preventDefault(),this[a>0?"prev":"next"]()))))}onScroll(){window.scrollTo(Ce,Te)}onKeydown(t){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const e=t.key,i=this.option("keyboard");if(!i)return;const n=t.composedPath()[0],s=document.activeElement&&document.activeElement.classList,o=s&&s.contains("f-button")||n.dataset.carouselPage||n.dataset.carouselIndex;if("Escape"!==e&&!o&&S(n)){if(n.isContentEditable||-1!==["TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(n.nodeName))return}if("Tab"===t.key?C(this.container,re):P(this.container,re),t.ctrlKey||t.altKey||t.shiftKey)return;this.emit("keydown",e,t);const a=i[e];a&&"function"==typeof this[a]&&(t.preventDefault(),this[a]())}onResize(){const t=this.container;if(!t)return;const e=this.isCompact;t.classList.toggle(ce,e),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.scale(),this.emit("resize")}onFocus(t){this.isTopmost()&&this.checkFocus(t)}onMousemove(t){this.prevMouseMoveEvent=t,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){"visible"===document.visibilityState?this.checkFocus():this.endIdle()}manageCloseBtn(t){const e=this.optionFor(t,"closeButton")||!1;if("auto"===e){const t=this.plugins.Toolbar;if(t&&t.state===Ut.Ready)return}if(!e)return;if(!t.contentEl||t.closeBtnEl)return;const i=this.option("tpl.closeButton");if(i){const e=s(this.localize(i));t.closeBtnEl=t.contentEl.appendChild(e),t.el&&C(t.el,"has-close-btn")}}manageCaption(t=void 0){var e,i;const n="fancybox__caption",s=this.container;if(!s)return;P(s,ue);const o=this.isCompact||this.option("commonCaption"),a=!o;if(this.caption&&this.stop(this.caption),a&&this.caption&&(this.caption.remove(),this.caption=null),o&&!this.caption)for(const t of(null===(e=this.carousel)||void 0===e?void 0:e.slides)||[])t.captionEl&&(t.captionEl.remove(),t.captionEl=void 0,P(t.el,ue),null===(i=t.el)||void 0===i||i.removeAttribute("aria-labelledby"));if(t||(t=this.getSlide()),!t||o&&!this.isCurrentSlide(t))return;const r=t.el;let l=this.optionFor(t,"caption","");if(!l)return void(o&&this.caption&&this.animate(this.caption,"f-fadeOut",(()=>{this.caption&&(this.caption.innerHTML="")})));let c=null;if(a){if(c=t.captionEl||null,r&&!c){const e=n+`_${this.id}_${t.index}`;c=document.createElement("div"),C(c,n),c.setAttribute("id",e),t.captionEl=r.appendChild(c),C(r,ue),r.setAttribute("aria-labelledby",e)}}else{if(c=this.caption,c||(c=s.querySelector("."+n)),!c){c=document.createElement("div"),c.dataset.fancyboxCaption="",C(c,n);(this.footer||s).prepend(c)}C(s,ue),this.caption=c}c&&(c.innerHTML="",be(l)||"number"==typeof l?c.innerHTML=l+"":l instanceof HTMLElement&&c.appendChild(l))}checkFocus(t){this.focus(t)}focus(t){var e;if(this.ignoreFocusChange)return;const i=document.activeElement||null,n=(null==t?void 0:t.target)||null,s=this.container,o=null===(e=this.carousel)||void 0===e?void 0:e.viewport;if(!s||!o)return;if(!t&&i&&s.contains(i))return;const a=this.getSlide(),r=a&&a.state===ct.Ready?a.el:null;if(!r||r.contains(i)||s===i)return;t&&t.cancelable&&t.preventDefault(),this.ignoreFocusChange=!0;const l=Array.from(s.querySelectorAll(st));let c=[],h=null;for(let t of l){const e=!t.offsetParent||!!t.closest('[aria-hidden="true"]'),i=r&&r.contains(t),n=!o.contains(t);if(t===s||(i||n)&&!e){c.push(t);const e=t.dataset.origTabindex;void 0!==e&&e&&(t.tabIndex=parseFloat(e)),t.removeAttribute("data-orig-tabindex"),!t.hasAttribute("autoFocus")&&h||(h=t)}else{const e=void 0===t.dataset.origTabindex?t.getAttribute("tabindex")||"":t.dataset.origTabindex;e&&(t.dataset.origTabindex=e),t.tabIndex=-1}}let d=null;t?(!n||c.indexOf(n)<0)&&(d=h||s,c.length&&(i===Ee?d=c[0]:this.lastFocus!==s&&i!==xe||(d=c[c.length-1]))):d=a&&"image"===a.type?s:h||s,d&&ot(d),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const t=this.carousel;t&&t.pages.length>1&&t.slideNext()}prev(){const t=this.carousel;t&&t.pages.length>1&&t.slidePrev()}jumpTo(...t){this.carousel&&this.carousel.slideTo(...t)}isTopmost(){var t;return(null===(t=Ae.getInstance())||void 0===t?void 0:t.id)==this.id}animate(t=null,e="",i){if(!t||!e)return void(i&&i());this.stop(t);const n=s=>{s.target===t&&t.dataset.animationName&&(t.removeEventListener("animationend",n),delete t.dataset.animationName,i&&i(),P(t,e))};t.dataset.animationName=e,t.addEventListener("animationend",n),C(t,e)}stop(t){t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:t}))}setContent(t,e="",i=!0){if(this.isClosing())return;const n=t.el;if(!n)return;let o=null;if(S(e)?o=e:(o=s(e+""),S(o)||(o=document.createElement("div"),o.innerHTML=e+"")),["img","picture","iframe","video","audio"].includes(o.nodeName.toLowerCase())){const t=document.createElement("div");t.appendChild(o),o=t}S(o)&&t.filter&&!t.error&&(o=o.querySelector(t.filter)),o&&S(o)?(C(o,"fancybox__content"),t.id&&o.setAttribute("id",t.id),n.classList.add(`has-${t.error?"error":t.type||"unknown"}`),n.prepend(o),"none"===o.style.display&&(o.style.display=""),"none"===getComputedStyle(o).getPropertyValue("display")&&(o.style.display=t.display||this.option("defaultDisplay")||"flex"),t.contentEl=o,i&&this.revealContent(t),this.manageCloseBtn(t),this.manageCaption(t)):this.setError(t,"{{ELEMENT_NOT_FOUND}}")}revealContent(t,e){const i=t.el,n=t.contentEl;i&&n&&(this.emit("reveal",t),this.hideLoading(t),t.state=ct.Opening,(e=this.isOpeningSlide(t)?void 0===e?this.optionFor(t,"showClass"):e:"f-fadeIn")?this.animate(n,e,(()=>{this.done(t)})):this.done(t))}done(t){this.isClosing()||(t.state=ct.Ready,this.emit("done",t),C(t.el,"is-done"),this.isCurrentSlide(t)&&this.option("autoFocus")&&queueMicrotask((()=>{var e;null===(e=t.panzoom)||void 0===e||e.updateControls(),this.option("autoFocus")&&this.focus()})),this.isOpeningSlide(t)&&(P(this.container,de),!this.isCompact&&this.option("idle")&&this.setIdle()))}isCurrentSlide(t){const e=this.getSlide();return!(!t||!e)&&e.index===t.index}isOpeningSlide(t){var e,i;return null===(null===(e=this.carousel)||void 0===e?void 0:e.prevPage)&&t&&t.index===(null===(i=this.getSlide())||void 0===i?void 0:i.index)}showLoading(t){t.state=ct.Loading;const e=t.el;if(!e)return;C(e,he),this.emit("loading",t),t.spinnerEl||setTimeout((()=>{if(!this.isClosing()&&!t.spinnerEl&&t.state===ct.Loading){let i=s(E);C(i,"fancybox-spinner"),t.spinnerEl=i,e.prepend(i),this.animate(i,"f-fadeIn")}}),250)}hideLoading(t){const e=t.el;if(!e)return;const i=t.spinnerEl;this.isClosing()?null==i||i.remove():(P(e,he),i&&this.animate(i,"f-fadeOut",(()=>{i.remove()})),t.state===ct.Loading&&(this.emit("loaded",t),t.state=ct.Ready))}setError(t,e){if(this.isClosing())return;const i=new Event("error",{bubbles:!0,cancelable:!0});if(this.emit("error",i,t),i.defaultPrevented)return;t.error=e,this.hideLoading(t),this.clearContent(t);const n=document.createElement("div");n.classList.add("fancybox-error"),n.innerHTML=this.localize(e||"<p>{{ERROR}}</p>"),this.setContent(t,n)}clearContent(t){if(void 0===t.state)return;this.emit("clearContent",t),t.contentEl&&(t.contentEl.remove(),t.contentEl=void 0);const e=t.el;e&&(P(e,"has-error"),P(e,"has-unknown"),P(e,`has-${t.type||"unknown"}`)),t.closeBtnEl&&t.closeBtnEl.remove(),t.closeBtnEl=void 0,t.captionEl&&t.captionEl.remove(),t.captionEl=void 0,t.spinnerEl&&t.spinnerEl.remove(),t.spinnerEl=void 0}getSlide(){var t;const e=this.carousel;return(null===(t=null==e?void 0:e.pages[null==e?void 0:e.page])||void 0===t?void 0:t.slides[0])||void 0}close(t,e){if(this.isClosing())return;const i=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",i,t),i.defaultPrevented)return;t&&t.cancelable&&(t.preventDefault(),t.stopPropagation());const n=()=>{this.proceedClose(t,e)};this.startedFs&&we&&we.isFullscreen()?Promise.resolve(we.exit()).then((()=>n())):n()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(t=!1){const e=()=>{this.clearIdle(),this.idle=!0,C(this.container,"is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(t)e();else{const t=this.option("idle");t&&(this.idleTimer=setTimeout(e,t))}}endIdle(){this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,P(this.container,"is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){we&&(we.isFullscreen()?we.exit():we.request().then((()=>{this.startedFs=!0})))}isClosing(){return[lt.Closing,lt.CustomClosing,lt.Destroy].includes(this.state)}proceedClose(t,e){var i,n;this.state=lt.Closing,this.clearIdle(),this.detachEvents();const s=this.container,o=this.carousel,a=this.getSlide(),r=a&&this.option("placeFocusBack")?a.triggerEl||this.option("triggerEl"):null;if(r&&(et(r)?ot(r):r.focus()),s&&(P(s,de),C(s,"is-closing"),s.setAttribute(ae,"true"),this.option("animated")&&C(s,le),s.style.pointerEvents="none"),o){o.clearTransitions(),null===(i=o.panzoom)||void 0===i||i.destroy(),null===(n=o.plugins.Navigation)||void 0===n||n.detach();for(const t of o.slides){t.state=ct.Closing,this.hideLoading(t);const e=t.contentEl;e&&this.stop(e);const i=null==t?void 0:t.panzoom;i&&(i.stop(),i.detachEvents(),i.detachObserver()),this.isCurrentSlide(t)||o.emit("removeSlide",t)}}Ce=window.scrollX,Te=window.scrollY,window.addEventListener("scroll",this.onScroll),this.emit("close",t),this.state!==lt.CustomClosing?(void 0===e&&a&&(e=this.optionFor(a,"hideClass")),e&&a?(this.animate(a.contentEl,e,(()=>{o&&o.emit("removeSlide",a)})),setTimeout((()=>{this.destroy()}),500)):this.destroy()):setTimeout((()=>{this.destroy()}),500)}destroy(){var t;if(this.state===lt.Destroy)return;window.removeEventListener("scroll",this.onScroll),this.state=lt.Destroy,null===(t=this.carousel)||void 0===t||t.destroy();const e=this.container;e&&e.remove(),Me.delete(this.id);const i=Ae.getInstance();i?i.focus():(xe&&(xe.remove(),xe=null),Ee&&(Ee.remove(),Ee=null),P(document.documentElement,ie),(()=>{if(!it)return;const t=document,e=t.body;e.classList.remove(ne),e.style.setProperty(oe,""),t.documentElement.style.setProperty(se,"")})(),this.emit("destroy"))}static bind(t,e,i){if(!it)return;let n,s="",o={};if(void 0===t?n=document.body:be(t)?(n=document.body,s=t,"object"==typeof e&&(o=e||{})):(n=t,be(e)&&(s=e),"object"==typeof i&&(o=i||{})),!n||!S(n))return;s=s||"[data-fancybox]";const a=Ae.openers.get(n)||new Map;a.set(s,o),Ae.openers.set(n,a),1===a.size&&n.addEventListener("click",Ae.fromEvent)}static unbind(t,e){let i,n="";if(be(t)?(i=document.body,n=t):(i=t,be(e)&&(n=e)),!i)return;const s=Ae.openers.get(i);s&&n&&s.delete(n),n&&s||(Ae.openers.delete(i),i.removeEventListener("click",Ae.fromEvent))}static destroy(){let t;for(;t=Ae.getInstance();)t.destroy();for(const t of Ae.openers.keys())t.removeEventListener("click",Ae.from
10776Event);Ae.openers=new Map}static fromEvent(t){if(t.defaultPrevented)return;if(t.button&&0!==t.button)return;if(t.ctrlKey||t.metaKey||t.shiftKey)return;let e=t.composedPath()[0];const i=e.closest("[data-fancybox-trigger]");if(i){const t=i.dataset.fancyboxTrigger||"",n=document.querySelectorAll(`[data-fancybox="${t}"]`),s=parseInt(i.dataset.fancyboxIndex||"",10)||0;e=n[s]||e}if(!(e&&e instanceof Element))return;let n,s,o,a;if([...Ae.openers].reverse().find((([t,i])=>!(!t.contains(e)||![...i].reverse().find((([i,r])=>{let l=e.closest(i);return!!l&&(n=t,s=i,o=l,a=r,!0)}))))),!n||!s||!o)return;a=a||{},t.preventDefault(),e=o;let r=[],l=p({},rt,a);l.event=t,l.triggerEl=e,l.delegate=i;const c=l.groupAll,h=l.groupAttr,d=h&&e?e.getAttribute(`${h}`):"";if((!e||d||c)&&(r=[].slice.call(n.querySelectorAll(s))),e&&!c&&(r=d?r.filter((t=>t.getAttribute(`${h}`)===d)):[e]),!r.length)return;const u=Ae.getInstance();return u&&u.options.triggerEl&&r.indexOf(u.options.triggerEl)>-1?void 0:(e&&(l.startIndex=r.indexOf(e)),Ae.fromNodes(r,l))}static fromSelector(t,e,i){let n=null,s="",o={};if(be(t)?(n=document.body,s=t,"object"==typeof e&&(o=e||{})):t instanceof HTMLElement&&be(e)&&(n=t,s=e,"object"==typeof i&&(o=i||{})),!n||!s)return!1;const a=Ae.openers.get(n);return!!a&&(o=p({},a.get(s)||{},o),!!o&&Ae.fromNodes(Array.from(n.querySelectorAll(s)),o))}static fromNodes(t,e){e=p({},rt,e||{});const i=[];for(const n of t){const t=n.dataset||{},s=t[ve]||n.getAttribute(me)||n.getAttribute("currentSrc")||n.getAttribute(ve)||void 0;let o;const a=e.delegate;let r;a&&i.length===e.startIndex&&(o=a instanceof HTMLImageElement?a:a.querySelector("img:not([aria-hidden])")),o||(o=n instanceof HTMLImageElement?n:n.querySelector("img:not([aria-hidden])")),o&&(r=o.currentSrc||o[ve]||void 0,!r&&o.dataset&&(r=o.dataset.lazySrc||o.dataset[ve]||void 0));const l={src:s,triggerEl:n,thumbEl:o,thumbElSrc:r,thumbSrc:r};for(const e in t){let i=t[e]+"";i="false"!==i&&("true"===i||i),l[e]=i}i.push(l)}return new Ae(i,e)}static getInstance(t){if(t)return Me.get(t);return Array.from(Me.values()).reverse().find((t=>!t.isClosing()&&t))||null}static getSlide(){var t;return(null===(t=Ae.getInstance())||void 0===t?void 0:t.getSlide())||null}static show(t=[],e={}){return new Ae(t,e)}static next(){const t=Ae.getInstance();t&&t.next()}static prev(){const t=Ae.getInstance();t&&t.prev()}static close(t=!0,...e){if(t)for(const t of Me.values())t.close(...e);else{const t=Ae.getInstance();t&&t.close(...e)}}}Object.defineProperty(Ae,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(Ae,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:rt}),Object.defineProperty(Ae,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:ee}),Object.defineProperty(Ae,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),t.Carousel=tt,t.Fancybox=Ae,t.Panzoom=D})); 10777/* End */ 10778; 10779; /* Start:"a:4:{s:4:"full";s:60:"/local/templates/rr-wheels_corp/js/fancybox.js?1775202386610";s:6:"source";s:46:"/local/templates/rr-wheels_corp/js/fancybox.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 10780document.addEventListener("DOMContentLoaded", function () { 10781 Fancybox.bind('[data-fancybox^="card-"]', { 10782 compact: false, 10783 idle: false, 10784 dragToClose: false, 10785 10786 animated: false, 10787 showClass: false, 10788 hideClass: false, 10789 10790 Hash: false, 10791 Thumbs: { 10792 type: "modern", 10793 }, 10794 Toolbar: { 10795 display: { 10796 right: ["close"], 10797 }, 10798 }, 10799 10800 Carousel: { 10801 transition: "fadeFast", 10802 preload: 3, 10803 }, 10804 10805 Images: { 10806 zoom: true, 10807 Panzoom: { 10808 panMode: "mousemove", 10809 mouseMoveFactor: 1.1, 10810 }, 10811 }, 10812 }); 10813}); 10814 10815/* End */ 10816; 10817; /* Start:"a:4:{s:4:"full";s:60:"/local/templates/rr-wheels_corp/js/imask.js?1775202386135105";s:6:"source";s:43:"/local/templates/rr-wheels_corp/js/imask.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 10818(function (global, factory) { 10819 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : 10820 typeof define === 'function' && define.amd ? define(['exports'], factory) : 10821 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.IMask = {})); 10822 })(this, (function (exports) { 'use strict'; 10823 10824 /** Checks if value is string */ 10825 function isString(str) { 10826 return typeof str === 'string' || str instanceof String; 10827 } 10828 10829 /** Checks if value is object */ 10830 function isObject(obj) { 10831 var _obj$constructor; 10832 return typeof obj === 'object' && obj != null && (obj == null || (_obj$constructor = obj.constructor) == null ? void 0 : _obj$constructor.name) === 'Object'; 10833 } 10834 function pick(obj, keys) { 10835 if (Array.isArray(keys)) return pick(obj, (_, k) => keys.includes(k)); 10836 return Object.entries(obj).reduce((acc, _ref) => { 10837 let [k, v] = _ref; 10838 if (keys(v, k)) acc[k] = v; 10839 return acc; 10840 }, {}); 10841 } 10842 10843 /** Direction */ 10844 const DIRECTION = { 10845 NONE: 'NONE', 10846 LEFT: 'LEFT', 10847 FORCE_LEFT: 'FORCE_LEFT', 10848 RIGHT: 'RIGHT', 10849 FORCE_RIGHT: 'FORCE_RIGHT' 10850 }; 10851 10852 /** Direction */ 10853 10854 function forceDirection(direction) { 10855 switch (direction) { 10856 case DIRECTION.LEFT: 10857 return DIRECTION.FORCE_LEFT; 10858 case DIRECTION.RIGHT: 10859 return DIRECTION.FORCE_RIGHT; 10860 default: 10861 return direction; 10862 } 10863 } 10864 10865 /** Escapes regular expression control chars */ 10866 function escapeRegExp(str) { 10867 return str.replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1'); 10868 } 10869 10870 // cloned from https://github.com/epoberezkin/fast-deep-equal with small changes 10871 function objectIncludes(b, a) { 10872 if (a === b) return true; 10873 const arrA = Array.isArray(a), 10874 arrB = Array.isArray(b); 10875 let i; 10876 if (arrA && arrB) { 10877 if (a.length != b.length) return false; 10878 for (i = 0; i < a.length; i++) if (!objectIncludes(a[i], b[i])) return false; 10879 return true; 10880 } 10881 if (arrA != arrB) return false; 10882 if (a && b && typeof a === 'object' && typeof b === 'object') { 10883 const dateA = a instanceof Date, 10884 dateB = b instanceof Date; 10885 if (dateA && dateB) return a.getTime() == b.getTime(); 10886 if (dateA != dateB) return false; 10887 const regexpA = a instanceof RegExp, 10888 regexpB = b instanceof RegExp; 10889 if (regexpA && regexpB) return a.toString() == b.toString(); 10890 if (regexpA != regexpB) return false;
vendor: 17,992 bytes, lines 10891-11289
10891 const keys = Object.keys(a); 10892 // if (keys.length !== Object.keys(b).length) return false; 10893 10894 for (i = 0; i < keys.length; i++) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; 10895 for (i = 0; i < keys.length; i++) if (!objectIncludes(b[keys[i]], a[keys[i]])) return false; 10896 return true; 10897 } else if (a && b && typeof a === 'function' && typeof b === 'function') { 10898 return a.toString() === b.toString(); 10899 } 10900 return false; 10901 } 10902 10903 /** Selection range */ 10904 10905 /** Provides details of changing input */ 10906 class ActionDetails { 10907 /** Current input value */ 10908 10909 /** Current cursor position */ 10910 10911 /** Old input value */ 10912 10913 /** Old selection */ 10914 10915 constructor(opts) { 10916 Object.assign(this, opts); 10917 10918 // double check if left part was changed (autofilling, other non-standard input triggers) 10919 while (this.value.slice(0, this.startChangePos) !== this.oldValue.slice(0, this.startChangePos)) { 10920 --this.oldSelection.start; 10921 } 10922 if (this.insertedCount) { 10923 // double check right part 10924 while (this.value.slice(this.cursorPos) !== this.oldValue.slice(this.oldSelection.end)) { 10925 if (this.value.length - this.cursorPos < this.oldValue.length - this.oldSelection.end) ++this.oldSelection.end;else ++this.cursorPos; 10926 } 10927 } 10928 } 10929 10930 /** Start changing position */ 10931 get startChangePos() { 10932 return Math.min(this.cursorPos, this.oldSelection.start); 10933 } 10934 10935 /** Inserted symbols count */ 10936 get insertedCount() { 10937 return this.cursorPos - this.startChangePos; 10938 } 10939 10940 /** Inserted symbols */ 10941 get inserted() { 10942 return this.value.substr(this.startChangePos, this.insertedCount); 10943 } 10944 10945 /** Removed symbols count */ 10946 get removedCount() { 10947 // Math.max for opposite operation 10948 return Math.max(this.oldSelection.end - this.startChangePos || 10949 // for Delete 10950 this.oldValue.length - this.value.length, 0); 10951 } 10952 10953 /** Removed symbols */ 10954 get removed() { 10955 return this.oldValue.substr(this.startChangePos, this.removedCount); 10956 } 10957 10958 /** Unchanged head symbols */ 10959 get head() { 10960 return this.value.substring(0, this.startChangePos); 10961 } 10962 10963 /** Unchanged tail symbols */ 10964 get tail() { 10965 return this.value.substring(this.startChangePos + this.insertedCount); 10966 } 10967 10968 /** Remove direction */ 10969 get removeDirection() { 10970 if (!this.removedCount || this.insertedCount) return DIRECTION.NONE; 10971 10972 // align right if delete at right 10973 return (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && 10974 // if not range removed (event with backspace) 10975 this.oldSelection.end === this.oldSelection.start ? DIRECTION.RIGHT : DIRECTION.LEFT; 10976 } 10977 } 10978 10979 /** Applies mask on element */ 10980 function IMask(el, opts) { 10981 // currently available only for input-like elements 10982 return new IMask.InputMask(el, opts); 10983 } 10984 10985 // TODO can't use overloads here because of https://github.com/microsoft/TypeScript/issues/50754 10986 // export function maskedClass(mask: string): typeof MaskedPattern; 10987 // export function maskedClass(mask: DateConstructor): typeof MaskedDate; 10988 // export function maskedClass(mask: NumberConstructor): typeof MaskedNumber; 10989 // export function maskedClass(mask: Array<any> | ArrayConstructor): typeof MaskedDynamic; 10990 // export function maskedClass(mask: MaskedDate): typeof MaskedDate; 10991 // export function maskedClass(mask: MaskedNumber): typeof MaskedNumber; 10992 // export function maskedClass(mask: MaskedEnum): typeof MaskedEnum; 10993 // export function maskedClass(mask: MaskedRange): typeof MaskedRange; 10994 // export function maskedClass(mask: MaskedRegExp): typeof MaskedRegExp; 10995 // export function maskedClass(mask: MaskedFunction): typeof MaskedFunction; 10996 // export function maskedClass(mask: MaskedPattern): typeof MaskedPattern; 10997 // export function maskedClass(mask: MaskedDynamic): typeof MaskedDynamic; 10998 // export function maskedClass(mask: Masked): typeof Masked; 10999 // export function maskedClass(mask: typeof Masked): typeof Masked; 11000 // export function maskedClass(mask: typeof MaskedDate): typeof MaskedDate; 11001 // export function maskedClass(mask: typeof MaskedNumber): typeof MaskedNumber; 11002 // export function maskedClass(mask: typeof MaskedEnum): typeof MaskedEnum; 11003 // export function maskedClass(mask: typeof MaskedRange): typeof MaskedRange; 11004 // export function maskedClass(mask: typeof MaskedRegExp): typeof MaskedRegExp; 11005 // export function maskedClass(mask: typeof MaskedFunction): typeof MaskedFunction; 11006 // export function maskedClass(mask: typeof MaskedPattern): typeof MaskedPattern; 11007 // export function maskedClass(mask: typeof MaskedDynamic): typeof MaskedDynamic; 11008 // export function maskedClass<Mask extends typeof Masked> (mask: Mask): Mask; 11009 // export function maskedClass(mask: RegExp): typeof MaskedRegExp; 11010 // export function maskedClass(mask: (value: string, ...args: any[]) => boolean): typeof MaskedFunction; 11011 11012 /** Get Masked class by mask type */ 11013 function maskedClass(mask) /* TODO */{ 11014 if (mask == null) throw new Error('mask property should be defined'); 11015 if (mask instanceof RegExp) return IMask.MaskedRegExp; 11016 if (isString(mask)) return IMask.MaskedPattern; 11017 if (mask === Date) return IMask.MaskedDate; 11018 if (mask === Number) return IMask.MaskedNumber; 11019 if (Array.isArray(mask) || mask === Array) return IMask.MaskedDynamic; 11020 if (IMask.Masked && mask.prototype instanceof IMask.Masked) return mask; 11021 if (IMask.Masked && mask instanceof IMask.Masked) return mask.constructor; 11022 if (mask instanceof Function) return IMask.MaskedFunction; 11023 console.warn('Mask not found for mask', mask); // eslint-disable-line no-console 11024 return IMask.Masked; 11025 } 11026 function normalizeOpts(opts) { 11027 if (!opts) throw new Error('Options in not defined'); 11028 if (IMask.Masked) { 11029 if (opts.prototype instanceof IMask.Masked) return { 11030 mask: opts 11031 }; 11032 11033 /* 11034 handle cases like: 11035 1) opts = Masked 11036 2) opts = { mask: Masked, ...instanceOpts } 11037 */ 11038 const { 11039 mask = undefined, 11040 ...instanceOpts 11041 } = opts instanceof IMask.Masked ? { 11042 mask: opts 11043 } : isObject(opts) && opts.mask instanceof IMask.Masked ? opts : {}; 11044 if (mask) { 11045 const _mask = mask.mask; 11046 return { 11047 ...pick(mask, (_, k) => !k.startsWith('_')), 11048 mask: mask.constructor, 11049 _mask, 11050 ...instanceOpts 11051 }; 11052 } 11053 } 11054 if (!isObject(opts)) return { 11055 mask: opts 11056 }; 11057 return { 11058 ...opts 11059 }; 11060 } 11061 11062 // TODO can't use overloads here because of https://github.com/microsoft/TypeScript/issues/50754 11063 11064 // From masked 11065 // export default function createMask<Opts extends Masked, ReturnMasked=Opts> (opts: Opts): ReturnMasked; 11066 // // From masked class 11067 // export default function createMask<Opts extends MaskedOptions<typeof Masked>, ReturnMasked extends Masked=InstanceType<Opts['mask']>> (opts: Opts): ReturnMasked; 11068 // export default function createMask<Opts extends MaskedOptions<typeof MaskedDate>, ReturnMasked extends MaskedDate=MaskedDate<Opts['parent']>> (opts: Opts): ReturnMasked; 11069 // export default function createMask<Opts extends MaskedOptions<typeof MaskedNumber>, ReturnMasked extends MaskedNumber=MaskedNumber<Opts['parent']>> (opts: Opts): ReturnMasked; 11070 // export default function createMask<Opts extends MaskedOptions<typeof MaskedEnum>, ReturnMasked extends MaskedEnum=MaskedEnum<Opts['parent']>> (opts: Opts): ReturnMasked; 11071 // export default function createMask<Opts extends MaskedOptions<typeof MaskedRange>, ReturnMasked extends MaskedRange=MaskedRange<Opts['parent']>> (opts: Opts): ReturnMasked; 11072 // export default function createMask<Opts extends MaskedOptions<typeof MaskedRegExp>, ReturnMasked extends MaskedRegExp=MaskedRegExp<Opts['parent']>> (opts: Opts): ReturnMasked; 11073 // export default function createMask<Opts extends MaskedOptions<typeof MaskedFunction>, ReturnMasked extends MaskedFunction=MaskedFunction<Opts['parent']>> (opts: Opts): ReturnMasked; 11074 // export default function createMask<Opts extends MaskedOptions<typeof MaskedPattern>, ReturnMasked extends MaskedPattern=MaskedPattern<Opts['parent']>> (opts: Opts): ReturnMasked; 11075 // export default function createMask<Opts extends MaskedOptions<typeof MaskedDynamic>, ReturnMasked extends MaskedDynamic=MaskedDynamic<Opts['parent']>> (opts: Opts): ReturnMasked; 11076 // // From mask opts 11077 // export default function createMask<Opts extends MaskedOptions<Masked>, ReturnMasked=Opts extends MaskedOptions<infer M> ? M : never> (opts: Opts): ReturnMasked; 11078 // export default function createMask<Opts extends MaskedNumberOptions, ReturnMasked extends MaskedNumber=MaskedNumber<Opts['parent']>> (opts: Opts): ReturnMasked; 11079 // export default function createMask<Opts extends MaskedDateFactoryOptions, ReturnMasked extends MaskedDate=MaskedDate<Opts['parent']>> (opts: Opts): ReturnMasked; 11080 // export default function createMask<Opts extends MaskedEnumOptions, ReturnMasked extends MaskedEnum=MaskedEnum<Opts['parent']>> (opts: Opts): ReturnMasked; 11081 // export default function createMask<Opts extends MaskedRangeOptions, ReturnMasked extends MaskedRange=MaskedRange<Opts['parent']>> (opts: Opts): ReturnMasked; 11082 // export default function createMask<Opts extends MaskedPatternOptions, ReturnMasked extends MaskedPattern=MaskedPattern<Opts['parent']>> (opts: Opts): ReturnMasked; 11083 // export default function createMask<Opts extends MaskedDynamicOptions, ReturnMasked extends MaskedDynamic=MaskedDynamic<Opts['parent']>> (opts: Opts): ReturnMasked; 11084 // export default function createMask<Opts extends MaskedOptions<RegExp>, ReturnMasked extends MaskedRegExp=MaskedRegExp<Opts['parent']>> (opts: Opts): ReturnMasked; 11085 // export default function createMask<Opts extends MaskedOptions<Function>, ReturnMasked extends MaskedFunction=MaskedFunction<Opts['parent']>> (opts: Opts): ReturnMasked; 11086 11087 /** Creates new {@link Masked} depending on mask type */ 11088 function createMask(opts) { 11089 if (IMask.Masked && opts instanceof IMask.Masked) return opts; 11090 const nOpts = normalizeOpts(opts); 11091 const MaskedClass = maskedClass(nOpts.mask); 11092 if (!MaskedClass) throw new Error("Masked class is not found for provided mask " + nOpts.mask + ", appropriate module needs to be imported manually before creating mask."); 11093 if (nOpts.mask === MaskedClass) delete nOpts.mask; 11094 if (nOpts._mask) { 11095 nOpts.mask = nOpts._mask; 11096 delete nOpts._mask; 11097 } 11098 return new MaskedClass(nOpts); 11099 } 11100 IMask.createMask = createMask; 11101 11102 /** Generic element API to use with mask */ 11103 class MaskElement { 11104 /** */ 11105 11106 /** */ 11107 11108 /** */ 11109 11110 /** Safely returns selection start */ 11111 get selectionStart() { 11112 let start; 11113 try { 11114 start = this._unsafeSelectionStart; 11115 } catch {} 11116 return start != null ? start : this.value.length; 11117 } 11118 11119 /** Safely returns selection end */ 11120 get selectionEnd() { 11121 let end; 11122 try { 11123 end = this._unsafeSelectionEnd; 11124 } catch {} 11125 return end != null ? end : this.value.length; 11126 } 11127 11128 /** Safely sets element selection */ 11129 select(start, end) { 11130 if (start == null || end == null || start === this.selectionStart && end === this.selectionEnd) return; 11131 try { 11132 this._unsafeSelect(start, end); 11133 } catch {} 11134 } 11135 11136 /** */ 11137 get isActive() { 11138 return false; 11139 } 11140 /** */ 11141 11142 /** */ 11143 11144 /** */ 11145 } 11146 IMask.MaskElement = MaskElement; 11147 11148 const KEY_Z = 90; 11149 const KEY_Y = 89; 11150 11151 /** Bridge between HTMLElement and {@link Masked} */ 11152 class HTMLMaskElement extends MaskElement { 11153 /** HTMLElement to use mask on */ 11154 11155 constructor(input) { 11156 super(); 11157 this.input = input; 11158 this._onKeydown = this._onKeydown.bind(this); 11159 this._onInput = this._onInput.bind(this); 11160 this._onBeforeinput = this._onBeforeinput.bind(this); 11161 this._onCompositionEnd = this._onCompositionEnd.bind(this); 11162 } 11163 get rootElement() { 11164 var _this$input$getRootNo, _this$input$getRootNo2, _this$input; 11165 return (_this$input$getRootNo = (_this$input$getRootNo2 = (_this$input = this.input).getRootNode) == null ? void 0 : _this$input$getRootNo2.call(_this$input)) != null ? _this$input$getRootNo : document; 11166 } 11167 11168 /** Is element in focus */ 11169 get isActive() { 11170 return this.input === this.rootElement.activeElement; 11171 } 11172 11173 /** Binds HTMLElement events to mask internal events */ 11174 bindEvents(handlers) { 11175 this.input.addEventListener('keydown', this._onKeydown); 11176 this.input.addEventListener('input', this._onInput); 11177 this.input.addEventListener('beforeinput', this._onBeforeinput); 11178 this.input.addEventListener('compositionend', this._onCompositionEnd); 11179 this.input.addEventListener('drop', handlers.drop); 11180 this.input.addEventListener('click', handlers.click); 11181 this.input.addEventListener('focus', handlers.focus); 11182 this.input.addEventListener('blur', handlers.commit); 11183 this._handlers = handlers; 11184 } 11185 _onKeydown(e) { 11186 if (this._handlers.redo && (e.keyCode === KEY_Z && e.shiftKey && (e.metaKey || e.ctrlKey) || e.keyCode === KEY_Y && e.ctrlKey)) { 11187 e.preventDefault(); 11188 return this._handlers.redo(e); 11189 } 11190 if (this._handlers.undo && e.keyCode === KEY_Z && (e.metaKey || e.ctrlKey)) { 11191 e.preventDefault(); 11192 return this._handlers.undo(e); 11193 } 11194 if (!e.isComposing) this._handlers.selectionChange(e); 11195 } 11196 _onBeforeinput(e) { 11197 if (e.inputType === 'historyUndo' && this._handlers.undo) { 11198 e.preventDefault(); 11199 return this._handlers.undo(e); 11200 } 11201 if (e.inputType === 'historyRedo' && this._handlers.redo) { 11202 e.preventDefault(); 11203 return this._handlers.redo(e); 11204 } 11205 } 11206 _onCompositionEnd(e) { 11207 this._handlers.input(e); 11208 } 11209 _onInput(e) { 11210 if (!e.isComposing) this._handlers.input(e); 11211 } 11212 11213 /** Unbinds HTMLElement events to mask internal events */ 11214 unbindEvents() { 11215 this.input.removeEventListener('keydown', this._onKeydown); 11216 this.input.removeEventListener('input', this._onInput); 11217 this.input.removeEventListener('beforeinput', this._onBeforeinput); 11218 this.input.removeEventListener('compositionend', this._onCompositionEnd); 11219 this.input.removeEventListener('drop', this._handlers.drop); 11220 this.input.removeEventListener('click', this._handlers.click); 11221 this.input.removeEventListener('focus', this._handlers.focus); 11222 this.input.removeEventListener('blur', this._handlers.commit); 11223 this._handlers = {}; 11224 } 11225 } 11226 IMask.HTMLMaskElement = HTMLMaskElement; 11227 11228 /** Bridge between InputElement and {@link Masked} */ 11229 class HTMLInputMaskElement extends HTMLMaskElement { 11230 /** InputElement to use mask on */ 11231 11232 constructor(input) { 11233 super(input); 11234 this.input = input; 11235 } 11236 11237 /** Returns InputElement selection start */ 11238 get _unsafeSelectionStart() { 11239 return this.input.selectionStart != null ? this.input.selectionStart : this.value.length; 11240 } 11241 11242 /** Returns InputElement selection end */ 11243 get _unsafeSelectionEnd() { 11244 return this.input.selectionEnd; 11245 } 11246 11247 /** Sets InputElement selection */ 11248 _unsafeSelect(start, end) { 11249 this.input.setSelectionRange(start, end); 11250 } 11251 get value() { 11252 return this.input.value; 11253 } 11254 set value(value) { 11255 this.input.value = value; 11256 } 11257 } 11258 IMask.HTMLMaskElement = HTMLMaskElement; 11259 11260 class HTMLContenteditableMaskElement extends HTMLMaskElement { 11261 /** Returns HTMLElement selection start */ 11262 get _unsafeSelectionStart() { 11263 const root = this.rootElement; 11264 const selection = root.getSelection && root.getSelection(); 11265 const anchorOffset = selection && selection.anchorOffset; 11266 const focusOffset = selection && selection.focusOffset; 11267 if (focusOffset == null || anchorOffset == null || anchorOffset < focusOffset) { 11268 return anchorOffset; 11269 } 11270 return focusOffset; 11271 } 11272 11273 /** Returns HTMLElement selection end */ 11274 get _unsafeSelectionEnd() { 11275 const root = this.rootElement; 11276 const selection = root.getSelection && root.getSelection(); 11277 const anchorOffset = selection && selection.anchorOffset; 11278 const focusOffset = selection && selection.focusOffset; 11279 if (focusOffset == null || anchorOffset == null || anchorOffset > focusOffset) { 11280 return anchorOffset; 11281 } 11282 return focusOffset; 11283 } 11284 11285 /** Sets HTMLElement selection */ 11286 _unsafeSelect(start, end) { 11287 if (!this.rootElement.createRange) return; 11288 const range = this.rootElement.createRange(); 11289 range.setStart(this.input.firstChild || this.input, start);
vendor: 4,577 bytes, lines 11290-11432
11290 range.setEnd(this.input.lastChild || this.input, end); 11291 const root = this.rootElement; 11292 const selection = root.getSelection && root.getSelection(); 11293 if (selection) { 11294 selection.removeAllRanges(); 11295 selection.addRange(range); 11296 } 11297 } 11298 11299 /** HTMLElement value */ 11300 get value() { 11301 return this.input.textContent || ''; 11302 } 11303 set value(value) { 11304 this.input.textContent = value; 11305 } 11306 } 11307 IMask.HTMLContenteditableMaskElement = HTMLContenteditableMaskElement; 11308 11309 class InputHistory { 11310 constructor() { 11311 this.states = []; 11312 this.currentIndex = 0; 11313 } 11314 get currentState() { 11315 return this.states[this.currentIndex]; 11316 } 11317 get isEmpty() { 11318 return this.states.length === 0; 11319 } 11320 push(state) { 11321 // if current index points before the last element then remove the future 11322 if (this.currentIndex < this.states.length - 1) this.states.length = this.currentIndex + 1; 11323 this.states.push(state); 11324 if (this.states.length > InputHistory.MAX_LENGTH) this.states.shift(); 11325 this.currentIndex = this.states.length - 1; 11326 } 11327 go(steps) { 11328 this.currentIndex = Math.min(Math.max(this.currentIndex + steps, 0), this.states.length - 1); 11329 return this.currentState; 11330 } 11331 undo() { 11332 return this.go(-1); 11333 } 11334 redo() { 11335 return this.go(+1); 11336 } 11337 clear() { 11338 this.states.length = 0; 11339 this.currentIndex = 0; 11340 } 11341 } 11342 InputHistory.MAX_LENGTH = 100; 11343 11344 /** Listens to element events and controls changes between element and {@link Masked} */ 11345 class InputMask { 11346 /** 11347 View element 11348 */ 11349 11350 /** Internal {@link Masked} model */ 11351 11352 constructor(el, opts) { 11353 this.el = el instanceof MaskElement ? el : el.isContentEditable && el.tagName !== 'INPUT' && el.tagName !== 'TEXTAREA' ? new HTMLContenteditableMaskElement(el) : new HTMLInputMaskElement(el); 11354 this.masked = createMask(opts); 11355 this._listeners = {}; 11356 this._value = ''; 11357 this._unmaskedValue = ''; 11358 this._rawInputValue = ''; 11359 this.history = new InputHistory(); 11360 this._saveSelection = this._saveSelection.bind(this); 11361 this._onInput = this._onInput.bind(this); 11362 this._onChange = this._onChange.bind(this); 11363 this._onDrop = this._onDrop.bind(this); 11364 this._onFocus = this._onFocus.bind(this); 11365 this._onClick = this._onClick.bind(this); 11366 this._onUndo = this._onUndo.bind(this); 11367 this._onRedo = this._onRedo.bind(this); 11368 this.alignCursor = this.alignCursor.bind(this); 11369 this.alignCursorFriendly = this.alignCursorFriendly.bind(this); 11370 this._bindEvents(); 11371 11372 // refresh 11373 this.updateValue(); 11374 this._onChange(); 11375 } 11376 maskEquals(mask) { 11377 var _this$masked; 11378 return mask == null || ((_this$masked = this.masked) == null ? void 0 : _this$masked.maskEquals(mask)); 11379 } 11380 11381 /** Masked */ 11382 get mask() { 11383 return this.masked.mask; 11384 } 11385 set mask(mask) { 11386 if (this.maskEquals(mask)) return; 11387 if (!(mask instanceof IMask.Masked) && this.masked.constructor === maskedClass(mask)) { 11388 // TODO "any" no idea 11389 this.masked.updateOptions({ 11390 mask 11391 }); 11392 return; 11393 } 11394 const masked = mask instanceof IMask.Masked ? mask : createMask({ 11395 mask 11396 }); 11397 masked.unmaskedValue = this.masked.unmaskedValue; 11398 this.masked = masked; 11399 } 11400 11401 /** Raw value */ 11402 get value() { 11403 return this._value; 11404 } 11405 set value(str) { 11406 if (this.value === str) return; 11407 this.masked.value = str; 11408 this.updateControl('auto'); 11409 } 11410 11411 /** Unmasked value */ 11412 get unmaskedValue() { 11413 return this._unmaskedValue; 11414 } 11415 set unmaskedValue(str) { 11416 if (this.unmaskedValue === str) return; 11417 this.masked.unmaskedValue = str; 11418 this.updateControl('auto'); 11419 } 11420 11421 /** Raw input value */ 11422 get rawInputValue() { 11423 return this._rawInputValue; 11424 } 11425 set rawInputValue(str) { 11426 if (this.rawInputValue === str) return; 11427 this.masked.rawInputValue = str; 11428 this.updateControl(); 11429 this.alignCursor(); 11430 } 11431 11432 /** Typed unmasked value */
vendor: 4,072 bytes, lines 11433-11547
11433 get typedValue() { 11434 return this.masked.typedValue; 11435 } 11436 set typedValue(val) { 11437 if (this.masked.typedValueEquals(val)) return; 11438 this.masked.typedValue = val; 11439 this.updateControl('auto'); 11440 } 11441 11442 /** Display value */ 11443 get displayValue() { 11444 return this.masked.displayValue; 11445 } 11446 11447 /** Starts listening to element events */ 11448 _bindEvents() { 11449 this.el.bindEvents({ 11450 selectionChange: this._saveSelection, 11451 input: this._onInput, 11452 drop: this._onDrop, 11453 click: this._onClick, 11454 focus: this._onFocus, 11455 commit: this._onChange, 11456 undo: this._onUndo, 11457 redo: this._onRedo 11458 }); 11459 } 11460 11461 /** Stops listening to element events */ 11462 _unbindEvents() { 11463 if (this.el) this.el.unbindEvents(); 11464 } 11465 11466 /** Fires custom event */ 11467 _fireEvent(ev, e) { 11468 const listeners = this._listeners[ev]; 11469 if (!listeners) return; 11470 listeners.forEach(l => l(e)); 11471 } 11472 11473 /** Current selection start */ 11474 get selectionStart() { 11475 return this._cursorChanging ? this._changingCursorPos : this.el.selectionStart; 11476 } 11477 11478 /** Current cursor position */ 11479 get cursorPos() { 11480 return this._cursorChanging ? this._changingCursorPos : this.el.selectionEnd; 11481 } 11482 set cursorPos(pos) { 11483 if (!this.el || !this.el.isActive) return; 11484 this.el.select(pos, pos); 11485 this._saveSelection(); 11486 } 11487 11488 /** Stores current selection */ 11489 _saveSelection( /* ev */ 11490 ) { 11491 if (this.displayValue !== this.el.value) { 11492 console.warn('Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly.'); // eslint-disable-line no-console 11493 } 11494 this._selection = { 11495 start: this.selectionStart, 11496 end: this.cursorPos 11497 }; 11498 } 11499 11500 /** Syncronizes model value from view */ 11501 updateValue() { 11502 this.masked.value = this.el.value; 11503 this._value = this.masked.value; 11504 this._unmaskedValue = this.masked.unmaskedValue; 11505 this._rawInputValue = this.masked.rawInputValue; 11506 } 11507 11508 /** Syncronizes view from model value, fires change events */ 11509 updateControl(cursorPos) { 11510 const newUnmaskedValue = this.masked.unmaskedValue; 11511 const newValue = this.masked.value; 11512 const newRawInputValue = this.masked.rawInputValue; 11513 const newDisplayValue = this.displayValue; 11514 const isChanged = this.unmaskedValue !== newUnmaskedValue || this.value !== newValue || this._rawInputValue !== newRawInputValue; 11515 this._unmaskedValue = newUnmaskedValue; 11516 this._value = newValue; 11517 this._rawInputValue = newRawInputValue; 11518 if (this.el.value !== newDisplayValue) this.el.value = newDisplayValue; 11519 if (cursorPos === 'auto') this.alignCursor();else if (cursorPos != null) this.cursorPos = cursorPos; 11520 if (isChanged) this._fireChangeEvents(); 11521 if (!this._historyChanging && (isChanged || this.history.isEmpty)) this.history.push({ 11522 unmaskedValue: newUnmaskedValue, 11523 selection: { 11524 start: this.selectionStart, 11525 end: this.cursorPos 11526 } 11527 }); 11528 } 11529 11530 /** Updates options with deep equal check, recreates {@link Masked} model if mask type changes */ 11531 updateOptions(opts) { 11532 const { 11533 mask, 11534 ...restOpts 11535 } = opts; // TODO types, yes, mask is optional 11536 11537 const updateMask = !this.maskEquals(mask); 11538 const updateOpts = this.masked.optionsIsChanged(restOpts); 11539 if (updateMask) this.mask = mask; 11540 if (updateOpts) this.masked.updateOptions(restOpts); // TODO 11541 11542 if (updateMask || updateOpts) this.updateControl(); 11543 } 11544 11545 /** Updates cursor */ 11546 updateCursor(cursorPos) { 11547 if (cursorPos == null) return;
11548 this.cursorPos = cursorPos; 11549 11550 // also queue change cursor for mobile browsers 11551 this._delayUpdateCursor(cursorPos); 11552 } 11553 11554 /** Delays cursor update to support mobile browsers */ 11555 _delayUpdateCursor(cursorPos) { 11556 this._abortUpdateCursor(); 11557 this._changingCursorPos = cursorPos; 11558 this._cursorChanging = setTimeout(() => { 11559 if (!this.el) return; // if was destroyed 11560 this.cursorPos = this._changingCursorPos; 11561 this._abortUpdateCursor(); 11562 }, 10); 11563 } 11564 11565 /** Fires custom events */ 11566 _fireChangeEvents() { 11567 this._fireEvent('accept', this._inputEvent); 11568 if (this.masked.isComplete) this._fireEvent('complete', this._inputEvent); 11569 } 11570 11571 /** Aborts delayed cursor update */ 11572 _abortUpdateCursor() { 11573 if (this._cursorChanging) { 11574 clearTimeout(this._cursorChanging); 11575 delete this._cursorChanging; 11576 } 11577 } 11578 11579 /** Aligns cursor to nearest available position */ 11580 alignCursor() {
vendor: 48,512 bytes, lines 11581-12975
11581 this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, DIRECTION.LEFT)); 11582 } 11583 11584 /** Aligns cursor only if selection is empty */ 11585 alignCursorFriendly() { 11586 if (this.selectionStart !== this.cursorPos) return; // skip if range is selected 11587 this.alignCursor(); 11588 } 11589 11590 /** Adds listener on custom event */ 11591 on(ev, handler) { 11592 if (!this._listeners[ev]) this._listeners[ev] = []; 11593 this._listeners[ev].push(handler); 11594 return this; 11595 } 11596 11597 /** Removes custom event listener */ 11598 off(ev, handler) { 11599 if (!this._listeners[ev]) return this; 11600 if (!handler) { 11601 delete this._listeners[ev]; 11602 return this; 11603 } 11604 const hIndex = this._listeners[ev].indexOf(handler); 11605 if (hIndex >= 0) this._listeners[ev].splice(hIndex, 1); 11606 return this; 11607 } 11608 11609 /** Handles view input event */ 11610 _onInput(e) { 11611 this._inputEvent = e; 11612 this._abortUpdateCursor(); 11613 const details = new ActionDetails({ 11614 // new state 11615 value: this.el.value, 11616 cursorPos: this.cursorPos, 11617 // old state 11618 oldValue: this.displayValue, 11619 oldSelection: this._selection 11620 }); 11621 const oldRawValue = this.masked.rawInputValue; 11622 const offset = this.masked.splice(details.startChangePos, details.removed.length, details.inserted, details.removeDirection, { 11623 input: true, 11624 raw: true 11625 }).offset; 11626 11627 // force align in remove direction only if no input chars were removed 11628 // otherwise we still need to align with NONE (to get out from fixed symbols for instance) 11629 const removeDirection = oldRawValue === this.masked.rawInputValue ? details.removeDirection : DIRECTION.NONE; 11630 let cursorPos = this.masked.nearestInputPos(details.startChangePos + offset, removeDirection); 11631 if (removeDirection !== DIRECTION.NONE) cursorPos = this.masked.nearestInputPos(cursorPos, DIRECTION.NONE); 11632 this.updateControl(cursorPos); 11633 delete this._inputEvent; 11634 } 11635 11636 /** Handles view change event and commits model value */ 11637 _onChange() { 11638 if (this.displayValue !== this.el.value) this.updateValue(); 11639 this.masked.doCommit(); 11640 this.updateControl(); 11641 this._saveSelection(); 11642 } 11643 11644 /** Handles view drop event, prevents by default */ 11645 _onDrop(ev) { 11646 ev.preventDefault(); 11647 ev.stopPropagation(); 11648 } 11649 11650 /** Restore last selection on focus */ 11651 _onFocus(ev) { 11652 this.alignCursorFriendly(); 11653 } 11654 11655 /** Restore last selection on focus */ 11656 _onClick(ev) { 11657 this.alignCursorFriendly(); 11658 } 11659 _onUndo() { 11660 this._applyHistoryState(this.history.undo()); 11661 } 11662 _onRedo() { 11663 this._applyHistoryState(this.history.redo()); 11664 } 11665 _applyHistoryState(state) { 11666 if (!state) return; 11667 this._historyChanging = true; 11668 this.unmaskedValue = state.unmaskedValue; 11669 this.el.select(state.selection.start, state.selection.end); 11670 this._saveSelection(); 11671 this._historyChanging = false; 11672 } 11673 11674 /** Unbind view events and removes element reference */ 11675 destroy() { 11676 this._unbindEvents(); 11677 this._listeners.length = 0; 11678 delete this.el; 11679 } 11680 } 11681 IMask.InputMask = InputMask; 11682 11683 /** Provides details of changing model value */ 11684 class ChangeDetails { 11685 /** Inserted symbols */ 11686 11687 /** Additional offset if any changes occurred before tail */ 11688 11689 /** Raw inserted is used by dynamic mask */ 11690 11691 /** Can skip chars */ 11692 11693 static normalize(prep) { 11694 return Array.isArray(prep) ? prep : [prep, new ChangeDetails()]; 11695 } 11696 constructor(details) { 11697 Object.assign(this, { 11698 inserted: '', 11699 rawInserted: '', 11700 tailShift: 0, 11701 skip: false 11702 }, details); 11703 } 11704 11705 /** Aggregate changes */ 11706 aggregate(details) { 11707 this.inserted += details.inserted; 11708 this.rawInserted += details.rawInserted; 11709 this.tailShift += details.tailShift; 11710 this.skip = this.skip || details.skip; 11711 return this; 11712 } 11713 11714 /** Total offset considering all changes */ 11715 get offset() { 11716 return this.tailShift + this.inserted.length; 11717 } 11718 get consumed() { 11719 return Boolean(this.rawInserted) || this.skip; 11720 } 11721 equals(details) { 11722 return this.inserted === details.inserted && this.tailShift === details.tailShift && this.rawInserted === details.rawInserted && this.skip === details.skip; 11723 } 11724 } 11725 IMask.ChangeDetails = ChangeDetails; 11726 11727 /** Provides details of continuous extracted tail */ 11728 class ContinuousTailDetails { 11729 /** Tail value as string */ 11730 11731 /** Tail start position */ 11732 11733 /** Start position */ 11734 11735 constructor(value, from, stop) { 11736 if (value === void 0) { 11737 value = ''; 11738 } 11739 if (from === void 0) { 11740 from = 0; 11741 } 11742 this.value = value; 11743 this.from = from; 11744 this.stop = stop; 11745 } 11746 toString() { 11747 return this.value; 11748 } 11749 extend(tail) { 11750 this.value += String(tail); 11751 } 11752 appendTo(masked) { 11753 return masked.append(this.toString(), { 11754 tail: true 11755 }).aggregate(masked._appendPlaceholder()); 11756 } 11757 get state() { 11758 return { 11759 value: this.value, 11760 from: this.from, 11761 stop: this.stop 11762 }; 11763 } 11764 set state(state) { 11765 Object.assign(this, state); 11766 } 11767 unshift(beforePos) { 11768 if (!this.value.length || beforePos != null && this.from >= beforePos) return ''; 11769 const shiftChar = this.value[0]; 11770 this.value = this.value.slice(1); 11771 return shiftChar; 11772 } 11773 shift() { 11774 if (!this.value.length) return ''; 11775 const shiftChar = this.value[this.value.length - 1]; 11776 this.value = this.value.slice(0, -1); 11777 return shiftChar; 11778 } 11779 } 11780 11781 /** Append flags */ 11782 11783 /** Extract flags */ 11784 11785 // see https://github.com/microsoft/TypeScript/issues/6223 11786 11787 /** Provides common masking stuff */ 11788 class Masked { 11789 /** */ 11790 11791 /** */ 11792 11793 /** Transforms value before mask processing */ 11794 11795 /** Transforms each char before mask processing */ 11796 11797 /** Validates if value is acceptable */ 11798 11799 /** Does additional processing at the end of editing */ 11800 11801 /** Format typed value to string */ 11802 11803 /** Parse string to get typed value */ 11804 11805 /** Enable characters overwriting */ 11806 11807 /** */ 11808 11809 /** */ 11810 11811 /** */ 11812 11813 /** */ 11814 11815 constructor(opts) { 11816 this._value = ''; 11817 this._update({ 11818 ...Masked.DEFAULTS, 11819 ...opts 11820 }); 11821 this._initialized = true; 11822 } 11823 11824 /** Sets and applies new options */ 11825 updateOptions(opts) { 11826 if (!this.optionsIsChanged(opts)) return; 11827 this.withValueRefresh(this._update.bind(this, opts)); 11828 } 11829 11830 /** Sets new options */ 11831 _update(opts) { 11832 Object.assign(this, opts); 11833 } 11834 11835 /** Mask state */ 11836 get state() { 11837 return { 11838 _value: this.value, 11839 _rawInputValue: this.rawInputValue 11840 }; 11841 } 11842 set state(state) { 11843 this._value = state._value; 11844 } 11845 11846 /** Resets value */ 11847 reset() { 11848 this._value = ''; 11849 } 11850 get value() { 11851 return this._value; 11852 } 11853 set value(value) { 11854 this.resolve(value, { 11855 input: true 11856 }); 11857 } 11858 11859 /** Resolve new value */ 11860 resolve(value, flags) { 11861 if (flags === void 0) { 11862 flags = { 11863 input: true 11864 }; 11865 } 11866 this.reset(); 11867 this.append(value, flags, ''); 11868 this.doCommit(); 11869 } 11870 get unmaskedValue() { 11871 return this.value; 11872 } 11873 set unmaskedValue(value) { 11874 this.resolve(value, {}); 11875 } 11876 get typedValue() { 11877 return this.parse ? this.parse(this.value, this) : this.unmaskedValue; 11878 } 11879 set typedValue(value) { 11880 if (this.format) { 11881 this.value = this.format(value, this); 11882 } else { 11883 this.unmaskedValue = String(value); 11884 } 11885 } 11886 11887 /** Value that includes raw user input */ 11888 get rawInputValue() { 11889 return this.extractInput(0, this.displayValue.length, { 11890 raw: true 11891 }); 11892 } 11893 set rawInputValue(value) { 11894 this.resolve(value, { 11895 raw: true 11896 }); 11897 } 11898 get displayValue() { 11899 return this.value; 11900 } 11901 get isComplete() { 11902 return true; 11903 } 11904 get isFilled() { 11905 return this.isComplete; 11906 } 11907 11908 /** Finds nearest input position in direction */ 11909 nearestInputPos(cursorPos, direction) { 11910 return cursorPos; 11911 } 11912 totalInputPositions(fromPos, toPos) { 11913 if (fromPos === void 0) { 11914 fromPos = 0; 11915 } 11916 if (toPos === void 0) { 11917 toPos = this.displayValue.length; 11918 } 11919 return Math.min(this.displayValue.length, toPos - fromPos); 11920 } 11921 11922 /** Extracts value in range considering flags */ 11923 extractInput(fromPos, toPos, flags) { 11924 if (fromPos === void 0) { 11925 fromPos = 0; 11926 } 11927 if (toPos === void 0) { 11928 toPos = this.displayValue.length; 11929 } 11930 return this.displayValue.slice(fromPos, toPos); 11931 } 11932 11933 /** Extracts tail in range */ 11934 extractTail(fromPos, toPos) { 11935 if (fromPos === void 0) { 11936 fromPos = 0; 11937 } 11938 if (toPos === void 0) { 11939 toPos = this.displayValue.length; 11940 } 11941 return new ContinuousTailDetails(this.extractInput(fromPos, toPos), fromPos); 11942 } 11943 11944 /** Appends tail */ 11945 appendTail(tail) { 11946 if (isString(tail)) tail = new ContinuousTailDetails(String(tail)); 11947 return tail.appendTo(this); 11948 } 11949 11950 /** Appends char */ 11951 _appendCharRaw(ch, flags) { 11952 if (!ch) return new ChangeDetails(); 11953 this._value += ch; 11954 return new ChangeDetails({ 11955 inserted: ch, 11956 rawInserted: ch 11957 }); 11958 } 11959 11960 /** Appends char */ 11961 _appendChar(ch, flags, checkTail) { 11962 if (flags === void 0) { 11963 flags = {}; 11964 } 11965 const consistentState = this.state; 11966 let details; 11967 [ch, details] = this.doPrepareChar(ch, flags); 11968 if (ch) { 11969 details = details.aggregate(this._appendCharRaw(ch, flags)); 11970 11971 // TODO handle `skip`? 11972 11973 // try `autofix` lookahead 11974 if (!details.rawInserted && this.autofix === 'pad') { 11975 const noFixState = this.state; 11976 this.state = consistentState; 11977 let fixDetails = this.pad(flags); 11978 const chDetails = this._appendCharRaw(ch, flags); 11979 fixDetails = fixDetails.aggregate(chDetails); 11980 11981 // if fix was applied or 11982 // if details are equal use skip restoring state optimization 11983 if (chDetails.rawInserted || fixDetails.equals(details)) { 11984 details = fixDetails; 11985 } else { 11986 this.state = noFixState; 11987 } 11988 } 11989 } 11990 if (details.inserted) { 11991 let consistentTail; 11992 let appended = this.doValidate(flags) !== false; 11993 if (appended && checkTail != null) { 11994 // validation ok, check tail 11995 const beforeTailState = this.state; 11996 if (this.overwrite === true) { 11997 consistentTail = checkTail.state; 11998 for (let i = 0; i < details.rawInserted.length; ++i) { 11999 checkTail.unshift(this.displayValue.length - details.tailShift); 12000 } 12001 } 12002 let tailDetails = this.appendTail(checkTail); 12003 appended = tailDetails.rawInserted.length === checkTail.toString().length; 12004 12005 // not ok, try shift 12006 if (!(appended && tailDetails.inserted) && this.overwrite === 'shift') { 12007 this.state = beforeTailState; 12008 consistentTail = checkTail.state; 12009 for (let i = 0; i < details.rawInserted.length; ++i) { 12010 checkTail.shift(); 12011 } 12012 tailDetails = this.appendTail(checkTail); 12013 appended = tailDetails.rawInserted.length === checkTail.toString().length; 12014 } 12015 12016 // if ok, rollback state after tail 12017 if (appended && tailDetails.inserted) this.state = beforeTailState; 12018 } 12019 12020 // revert all if something went wrong 12021 if (!appended) { 12022 details = new ChangeDetails(); 12023 this.state = consistentState; 12024 if (checkTail && consistentTail) checkTail.state = consistentTail; 12025 } 12026 } 12027 return details; 12028 } 12029 12030 /** Appends optional placeholder at the end */ 12031 _appendPlaceholder() { 12032 return new ChangeDetails(); 12033 } 12034 12035 /** Appends optional eager placeholder at the end */ 12036 _appendEager() { 12037 return new ChangeDetails(); 12038 } 12039 12040 /** Appends symbols considering flags */ 12041 append(str, flags, tail) { 12042 if (!isString(str)) throw new Error('value should be string'); 12043 const checkTail = isString(tail) ? new ContinuousTailDetails(String(tail)) : tail; 12044 if (flags != null && flags.tail) flags._beforeTailState = this.state; 12045 let details; 12046 [str, details] = this.doPrepare(str, flags); 12047 for (let ci = 0; ci < str.length; ++ci) { 12048 const d = this._appendChar(str[ci], flags, checkTail); 12049 if (!d.rawInserted && !this.doSkipInvalid(str[ci], flags, checkTail)) break; 12050 details.aggregate(d); 12051 } 12052 if ((this.eager === true || this.eager === 'append') && flags != null && flags.input && str) { 12053 details.aggregate(this._appendEager()); 12054 } 12055 12056 // append tail but aggregate only tailShift 12057 if (checkTail != null) { 12058 details.tailShift += this.appendTail(checkTail).tailShift; 12059 // TODO it's a good idea to clear state after appending ends 12060 // but it causes bugs when one append calls another (when dynamic dispatch set rawInputValue) 12061 // this._resetBeforeTailState(); 12062 } 12063 return details; 12064 } 12065 remove(fromPos, toPos) { 12066 if (fromPos === void 0) { 12067 fromPos = 0; 12068 } 12069 if (toPos === void 0) { 12070 toPos = this.displayValue.length; 12071 } 12072 this._value = this.displayValue.slice(0, fromPos) + this.displayValue.slice(toPos); 12073 return new ChangeDetails(); 12074 } 12075 12076 /** Calls function and reapplies current value */ 12077 withValueRefresh(fn) { 12078 if (this._refreshing || !this._initialized) return fn(); 12079 this._refreshing = true; 12080 const rawInput = this.rawInputValue; 12081 const value = this.value; 12082 const ret = fn(); 12083 this.rawInputValue = rawInput; 12084 // append lost trailing chars at the end 12085 if (this.value && this.value !== value && value.indexOf(this.value) === 0) { 12086 this.append(value.slice(this.displayValue.length), {}, ''); 12087 this.doCommit(); 12088 } 12089 delete this._refreshing; 12090 return ret; 12091 } 12092 runIsolated(fn) { 12093 if (this._isolated || !this._initialized) return fn(this); 12094 this._isolated = true; 12095 const state = this.state; 12096 const ret = fn(this); 12097 this.state = state; 12098 delete this._isolated; 12099 return ret; 12100 } 12101 doSkipInvalid(ch, flags, checkTail) { 12102 return Boolean(this.skipInvalid); 12103 } 12104 12105 /** Prepares string before mask processing */ 12106 doPrepare(str, flags) { 12107 if (flags === void 0) { 12108 flags = {}; 12109 } 12110 return ChangeDetails.normalize(this.prepare ? this.prepare(str, this, flags) : str); 12111 } 12112 12113 /** Prepares each char before mask processing */ 12114 doPrepareChar(str, flags) { 12115 if (flags === void 0) { 12116 flags = {}; 12117 } 12118 return ChangeDetails.normalize(this.prepareChar ? this.prepareChar(str, this, flags) : str); 12119 } 12120 12121 /** Validates if value is acceptable */ 12122 doValidate(flags) { 12123 return (!this.validate || this.validate(this.value, this, flags)) && (!this.parent || this.parent.doValidate(flags)); 12124 } 12125 12126 /** Does additional processing at the end of editing */ 12127 doCommit() { 12128 if (this.commit) this.commit(this.value, this); 12129 } 12130 splice(start, deleteCount, inserted, removeDirection, flags) { 12131 if (inserted === void 0) { 12132 inserted = ''; 12133 } 12134 if (removeDirection === void 0) { 12135 removeDirection = DIRECTION.NONE; 12136 } 12137 if (flags === void 0) { 12138 flags = { 12139 input: true 12140 }; 12141 } 12142 const tailPos = start + deleteCount; 12143 const tail = this.extractTail(tailPos); 12144 const eagerRemove = this.eager === true || this.eager === 'remove'; 12145 let oldRawValue; 12146 if (eagerRemove) { 12147 removeDirection = forceDirection(removeDirection); 12148 oldRawValue = this.extractInput(0, tailPos, { 12149 raw: true 12150 }); 12151 } 12152 let startChangePos = start; 12153 const details = new ChangeDetails(); 12154 12155 // if it is just deletion without insertion 12156 if (removeDirection !== DIRECTION.NONE) { 12157 startChangePos = this.nearestInputPos(start, deleteCount > 1 && start !== 0 && !eagerRemove ? DIRECTION.NONE : removeDirection); 12158 12159 // adjust tailShift if start was aligned 12160 details.tailShift = startChangePos - start; 12161 } 12162 details.aggregate(this.remove(startChangePos)); 12163 if (eagerRemove && removeDirection !== DIRECTION.NONE && oldRawValue === this.rawInputValue) { 12164 if (removeDirection === DIRECTION.FORCE_LEFT) { 12165 let valLength; 12166 while (oldRawValue === this.rawInputValue && (valLength = this.displayValue.length)) { 12167 details.aggregate(new ChangeDetails({ 12168 tailShift: -1 12169 })).aggregate(this.remove(valLength - 1)); 12170 } 12171 } else if (removeDirection === DIRECTION.FORCE_RIGHT) { 12172 tail.unshift(); 12173 } 12174 } 12175 return details.aggregate(this.append(inserted, flags, tail)); 12176 } 12177 maskEquals(mask) { 12178 return this.mask === mask; 12179 } 12180 optionsIsChanged(opts) { 12181 return !objectIncludes(this, opts); 12182 } 12183 typedValueEquals(value) { 12184 const tval = this.typedValue; 12185 return value === tval || Masked.EMPTY_VALUES.includes(value) && Masked.EMPTY_VALUES.includes(tval) || (this.format ? this.format(value, this) === this.format(this.typedValue, this) : false); 12186 } 12187 pad(flags) { 12188 return new ChangeDetails(); 12189 } 12190 } 12191 Masked.DEFAULTS = { 12192 skipInvalid: true 12193 }; 12194 Masked.EMPTY_VALUES = [undefined, null, '']; 12195 IMask.Masked = Masked; 12196 12197 class ChunksTailDetails { 12198 /** */ 12199 12200 constructor(chunks, from) { 12201 if (chunks === void 0) { 12202 chunks = []; 12203 } 12204 if (from === void 0) { 12205 from = 0; 12206 } 12207 this.chunks = chunks; 12208 this.from = from; 12209 } 12210 toString() { 12211 return this.chunks.map(String).join(''); 12212 } 12213 extend(tailChunk) { 12214 if (!String(tailChunk)) return; 12215 tailChunk = isString(tailChunk) ? new ContinuousTailDetails(String(tailChunk)) : tailChunk; 12216 const lastChunk = this.chunks[this.chunks.length - 1]; 12217 const extendLast = lastChunk && ( 12218 // if stops are same or tail has no stop 12219 lastChunk.stop === tailChunk.stop || tailChunk.stop == null) && 12220 // if tail chunk goes just after last chunk 12221 tailChunk.from === lastChunk.from + lastChunk.toString().length; 12222 if (tailChunk instanceof ContinuousTailDetails) { 12223 // check the ability to extend previous chunk 12224 if (extendLast) { 12225 // extend previous chunk 12226 lastChunk.extend(tailChunk.toString()); 12227 } else { 12228 // append new chunk 12229 this.chunks.push(tailChunk); 12230 } 12231 } else if (tailChunk instanceof ChunksTailDetails) { 12232 if (tailChunk.stop == null) { 12233 // unwrap floating chunks to parent, keeping `from` pos 12234 let firstTailChunk; 12235 while (tailChunk.chunks.length && tailChunk.chunks[0].stop == null) { 12236 firstTailChunk = tailChunk.chunks.shift(); // not possible to be `undefined` because length was checked above 12237 firstTailChunk.from += tailChunk.from; 12238 this.extend(firstTailChunk); 12239 } 12240 } 12241 12242 // if tail chunk still has value 12243 if (tailChunk.toString()) { 12244 // if chunks contains stops, then popup stop to container 12245 tailChunk.stop = tailChunk.blockIndex; 12246 this.chunks.push(tailChunk); 12247 } 12248 } 12249 } 12250 appendTo(masked) { 12251 if (!(masked instanceof IMask.MaskedPattern)) { 12252 const tail = new ContinuousTailDetails(this.toString()); 12253 return tail.appendTo(masked); 12254 } 12255 const details = new ChangeDetails(); 12256 for (let ci = 0; ci < this.chunks.length; ++ci) { 12257 const chunk = this.chunks[ci]; 12258 const lastBlockIter = masked._mapPosToBlock(masked.displayValue.length); 12259 const stop = chunk.stop; 12260 let chunkBlock; 12261 if (stop != null && ( 12262 // if block not found or stop is behind lastBlock 12263 !lastBlockIter || lastBlockIter.index <= stop)) { 12264 if (chunk instanceof ChunksTailDetails || 12265 // for continuous block also check if stop is exist 12266 masked._stops.indexOf(stop) >= 0) { 12267 details.aggregate(masked._appendPlaceholder(stop)); 12268 } 12269 chunkBlock = chunk instanceof ChunksTailDetails && masked._blocks[stop]; 12270 } 12271 if (chunkBlock) { 12272 const tailDetails = chunkBlock.appendTail(chunk); 12273 details.aggregate(tailDetails); 12274 12275 // get not inserted chars 12276 const remainChars = chunk.toString().slice(tailDetails.rawInserted.length); 12277 if (remainChars) details.aggregate(masked.append(remainChars, { 12278 tail: true 12279 })); 12280 } else { 12281 details.aggregate(masked.append(chunk.toString(), { 12282 tail: true 12283 })); 12284 } 12285 } 12286 return details; 12287 } 12288 get state() { 12289 return { 12290 chunks: this.chunks.map(c => c.state), 12291 from: this.from, 12292 stop: this.stop, 12293 blockIndex: this.blockIndex 12294 }; 12295 } 12296 set state(state) { 12297 const { 12298 chunks, 12299 ...props 12300 } = state; 12301 Object.assign(this, props); 12302 this.chunks = chunks.map(cstate => { 12303 const chunk = "chunks" in cstate ? new ChunksTailDetails() : new ContinuousTailDetails(); 12304 chunk.state = cstate; 12305 return chunk; 12306 }); 12307 } 12308 unshift(beforePos) { 12309 if (!this.chunks.length || beforePos != null && this.from >= beforePos) return ''; 12310 const chunkShiftPos = beforePos != null ? beforePos - this.from : beforePos; 12311 let ci = 0; 12312 while (ci < this.chunks.length) { 12313 const chunk = this.chunks[ci]; 12314 const shiftChar = chunk.unshift(chunkShiftPos); 12315 if (chunk.toString()) { 12316 // chunk still contains value 12317 // but not shifted - means no more available chars to shift 12318 if (!shiftChar) break; 12319 ++ci; 12320 } else { 12321 // clean if chunk has no value 12322 this.chunks.splice(ci, 1); 12323 } 12324 if (shiftChar) return shiftChar; 12325 } 12326 return ''; 12327 } 12328 shift() { 12329 if (!this.chunks.length) return ''; 12330 let ci = this.chunks.length - 1; 12331 while (0 <= ci) { 12332 const chunk = this.chunks[ci]; 12333 const shiftChar = chunk.shift(); 12334 if (chunk.toString()) { 12335 // chunk still contains value 12336 // but not shifted - means no more available chars to shift 12337 if (!shiftChar) break; 12338 --ci; 12339 } else { 12340 // clean if chunk has no value 12341 this.chunks.splice(ci, 1); 12342 } 12343 if (shiftChar) return shiftChar; 12344 } 12345 return ''; 12346 } 12347 } 12348 12349 class PatternCursor { 12350 constructor(masked, pos) { 12351 this.masked = masked; 12352 this._log = []; 12353 const { 12354 offset, 12355 index 12356 } = masked._mapPosToBlock(pos) || (pos < 0 ? 12357 // first 12358 { 12359 index: 0, 12360 offset: 0 12361 } : 12362 // last 12363 { 12364 index: this.masked._blocks.length, 12365 offset: 0 12366 }); 12367 this.offset = offset; 12368 this.index = index; 12369 this.ok = false; 12370 } 12371 get block() { 12372 return this.masked._blocks[this.index]; 12373 } 12374 get pos() { 12375 return this.masked._blockStartPos(this.index) + this.offset; 12376 } 12377 get state() { 12378 return { 12379 index: this.index, 12380 offset: this.offset, 12381 ok: this.ok 12382 }; 12383 } 12384 set state(s) { 12385 Object.assign(this, s); 12386 } 12387 pushState() { 12388 this._log.push(this.state); 12389 } 12390 popState() { 12391 const s = this._log.pop(); 12392 if (s) this.state = s; 12393 return s; 12394 } 12395 bindBlock() { 12396 if (this.block) return; 12397 if (this.index < 0) { 12398 this.index = 0; 12399 this.offset = 0; 12400 } 12401 if (this.index >= this.masked._blocks.length) { 12402 this.index = this.masked._blocks.length - 1; 12403 this.offset = this.block.displayValue.length; // TODO this is stupid type error, `block` depends on index that was changed above 12404 } 12405 } 12406 _pushLeft(fn) { 12407 this.pushState(); 12408 for (this.bindBlock(); 0 <= this.index; --this.index, this.offset = ((_this$block = this.block) == null ? void 0 : _this$block.displayValue.length) || 0) { 12409 var _this$block; 12410 if (fn()) return this.ok = true; 12411 } 12412 return this.ok = false; 12413 } 12414 _pushRight(fn) { 12415 this.pushState(); 12416 for (this.bindBlock(); this.index < this.masked._blocks.length; ++this.index, this.offset = 0) { 12417 if (fn()) return this.ok = true; 12418 } 12419 return this.ok = false; 12420 } 12421 pushLeftBeforeFilled() { 12422 return this._pushLeft(() => { 12423 if (this.block.isFixed || !this.block.value) return; 12424 this.offset = this.block.nearestInputPos(this.offset, DIRECTION.FORCE_LEFT); 12425 if (this.offset !== 0) return true; 12426 }); 12427 } 12428 pushLeftBeforeInput() { 12429 // cases: 12430 // filled input: 00| 12431 // optional empty input: 00[]| 12432 // nested block: XX<[]>| 12433 return this._pushLeft(() => { 12434 if (this.block.isFixed) return; 12435 this.offset = this.block.nearestInputPos(this.offset, DIRECTION.LEFT); 12436 return true; 12437 }); 12438 } 12439 pushLeftBeforeRequired() { 12440 return this._pushLeft(() => { 12441 if (this.block.isFixed || this.block.isOptional && !this.block.value) return; 12442 this.offset = this.block.nearestInputPos(this.offset, DIRECTION.LEFT); 12443 return true; 12444 }); 12445 } 12446 pushRightBeforeFilled() { 12447 return this._pushRight(() => { 12448 if (this.block.isFixed || !this.block.value) return; 12449 this.offset = this.block.nearestInputPos(this.offset, DIRECTION.FORCE_RIGHT); 12450 if (this.offset !== this.block.value.length) return true; 12451 }); 12452 } 12453 pushRightBeforeInput() { 12454 return this._pushRight(() => { 12455 if (this.block.isFixed) return; 12456 12457 // const o = this.offset; 12458 this.offset = this.block.nearestInputPos(this.offset, DIRECTION.NONE); 12459 // HACK cases like (STILL DOES NOT WORK FOR NESTED) 12460 // aa|X 12461 // aa<X|[]>X_ - this will not work 12462 // if (o && o === this.offset && this.block instanceof PatternInputDefinition) continue; 12463 return true; 12464 }); 12465 } 12466 pushRightBeforeRequired() { 12467 return this._pushRight(() => { 12468 if (this.block.isFixed || this.block.isOptional && !this.block.value) return; 12469 12470 // TODO check |[*]XX_ 12471 this.offset = this.block.nearestInputPos(this.offset, DIRECTION.NONE); 12472 return true; 12473 }); 12474 } 12475 } 12476 12477 class PatternFixedDefinition { 12478 /** */ 12479 12480 /** */ 12481 12482 /** */ 12483 12484 /** */ 12485 12486 /** */ 12487 12488 /** */ 12489 12490 constructor(opts) { 12491 Object.assign(this, opts); 12492 this._value = ''; 12493 this.isFixed = true; 12494 } 12495 get value() { 12496 return this._value; 12497 } 12498 get unmaskedValue() { 12499 return this.isUnmasking ? this.value : ''; 12500 } 12501 get rawInputValue() { 12502 return this._isRawInput ? this.value : ''; 12503 } 12504 get displayValue() { 12505 return this.value; 12506 } 12507 reset() { 12508 this._isRawInput = false; 12509 this._value = ''; 12510 } 12511 remove(fromPos, toPos) { 12512 if (fromPos === void 0) { 12513 fromPos = 0; 12514 } 12515 if (toPos === void 0) { 12516 toPos = this._value.length; 12517 } 12518 this._value = this._value.slice(0, fromPos) + this._value.slice(toPos); 12519 if (!this._value) this._isRawInput = false; 12520 return new ChangeDetails(); 12521 } 12522 nearestInputPos(cursorPos, direction) { 12523 if (direction === void 0) { 12524 direction = DIRECTION.NONE; 12525 } 12526 const minPos = 0; 12527 const maxPos = this._value.length; 12528 switch (direction) { 12529 case DIRECTION.LEFT: 12530 case DIRECTION.FORCE_LEFT: 12531 return minPos; 12532 case DIRECTION.NONE: 12533 case DIRECTION.RIGHT: 12534 case DIRECTION.FORCE_RIGHT: 12535 default: 12536 return maxPos; 12537 } 12538 } 12539 totalInputPositions(fromPos, toPos) { 12540 if (fromPos === void 0) { 12541 fromPos = 0; 12542 } 12543 if (toPos === void 0) { 12544 toPos = this._value.length; 12545 } 12546 return this._isRawInput ? toPos - fromPos : 0; 12547 } 12548 extractInput(fromPos, toPos, flags) { 12549 if (fromPos === void 0) { 12550 fromPos = 0; 12551 } 12552 if (toPos === void 0) { 12553 toPos = this._value.length; 12554 } 12555 if (flags === void 0) { 12556 flags = {}; 12557 } 12558 return flags.raw && this._isRawInput && this._value.slice(fromPos, toPos) || ''; 12559 } 12560 get isComplete() { 12561 return true; 12562 } 12563 get isFilled() { 12564 return Boolean(this._value); 12565 } 12566 _appendChar(ch, flags) { 12567 if (flags === void 0) { 12568 flags = {}; 12569 } 12570 if (this.isFilled) return new ChangeDetails(); 12571 const appendEager = this.eager === true || this.eager === 'append'; 12572 const appended = this.char === ch; 12573 const isResolved = appended && (this.isUnmasking || flags.input || flags.raw) && (!flags.raw || !appendEager) && !flags.tail; 12574 const details = new ChangeDetails({ 12575 inserted: this.char, 12576 rawInserted: isResolved ? this.char : '' 12577 }); 12578 this._value = this.char; 12579 this._isRawInput = isResolved && (flags.raw || flags.input); 12580 return details; 12581 } 12582 _appendEager() { 12583 return this._appendChar(this.char, { 12584 tail: true 12585 }); 12586 } 12587 _appendPlaceholder() { 12588 const details = new ChangeDetails(); 12589 if (this.isFilled) return details; 12590 this._value = details.inserted = this.char; 12591 return details; 12592 } 12593 extractTail() { 12594 return new ContinuousTailDetails(''); 12595 } 12596 appendTail(tail) { 12597 if (isString(tail)) tail = new ContinuousTailDetails(String(tail)); 12598 return tail.appendTo(this); 12599 } 12600 append(str, flags, tail) { 12601 const details = this._appendChar(str[0], flags); 12602 if (tail != null) { 12603 details.tailShift += this.appendTail(tail).tailShift; 12604 } 12605 return details; 12606 } 12607 doCommit() {} 12608 get state() { 12609 return { 12610 _value: this._value, 12611 _rawInputValue: this.rawInputValue 12612 }; 12613 } 12614 set state(state) { 12615 this._value = state._value; 12616 this._isRawInput = Boolean(state._rawInputValue); 12617 } 12618 pad(flags) { 12619 return this._appendPlaceholder(); 12620 } 12621 } 12622 12623 class PatternInputDefinition { 12624 /** */ 12625 12626 /** */ 12627 12628 /** */ 12629 12630 /** */ 12631 12632 /** */ 12633 12634 /** */ 12635 12636 /** */ 12637 12638 /** */ 12639 12640 constructor(opts) { 12641 const { 12642 parent, 12643 isOptional, 12644 placeholderChar, 12645 displayChar, 12646 lazy, 12647 eager, 12648 ...maskOpts 12649 } = opts; 12650 this.masked = createMask(maskOpts); 12651 Object.assign(this, { 12652 parent, 12653 isOptional, 12654 placeholderChar, 12655 displayChar, 12656 lazy, 12657 eager 12658 }); 12659 } 12660 reset() { 12661 this.isFilled = false; 12662 this.masked.reset(); 12663 } 12664 remove(fromPos, toPos) { 12665 if (fromPos === void 0) { 12666 fromPos = 0; 12667 } 12668 if (toPos === void 0) { 12669 toPos = this.value.length; 12670 } 12671 if (fromPos === 0 && toPos >= 1) { 12672 this.isFilled = false; 12673 return this.masked.remove(fromPos, toPos); 12674 } 12675 return new ChangeDetails(); 12676 } 12677 get value() { 12678 return this.masked.value || (this.isFilled && !this.isOptional ? this.placeholderChar : ''); 12679 } 12680 get unmaskedValue() { 12681 return this.masked.unmaskedValue; 12682 } 12683 get rawInputValue() { 12684 return this.masked.rawInputValue; 12685 } 12686 get displayValue() { 12687 return this.masked.value && this.displayChar || this.value; 12688 } 12689 get isComplete() { 12690 return Boolean(this.masked.value) || this.isOptional; 12691 } 12692 _appendChar(ch, flags) { 12693 if (flags === void 0) { 12694 flags = {}; 12695 } 12696 if (this.isFilled) return new ChangeDetails(); 12697 const state = this.masked.state; 12698 // simulate input 12699 let details = this.masked._appendChar(ch, this.currentMaskFlags(flags)); 12700 if (details.inserted && this.doValidate(flags) === false) { 12701 details = new ChangeDetails(); 12702 this.masked.state = state; 12703 } 12704 if (!details.inserted && !this.isOptional && !this.lazy && !flags.input) { 12705 details.inserted = this.placeholderChar; 12706 } 12707 details.skip = !details.inserted && !this.isOptional; 12708 this.isFilled = Boolean(details.inserted); 12709 return details; 12710 } 12711 append(str, flags, tail) { 12712 // TODO probably should be done via _appendChar 12713 return this.masked.append(str, this.currentMaskFlags(flags), tail); 12714 } 12715 _appendPlaceholder() { 12716 if (this.isFilled || this.isOptional) return new ChangeDetails(); 12717 this.isFilled = true; 12718 return new ChangeDetails({ 12719 inserted: this.placeholderChar 12720 }); 12721 } 12722 _appendEager() { 12723 return new ChangeDetails(); 12724 } 12725 extractTail(fromPos, toPos) { 12726 return this.masked.extractTail(fromPos, toPos); 12727 } 12728 appendTail(tail) { 12729 return this.masked.appendTail(tail); 12730 } 12731 extractInput(fromPos, toPos, flags) { 12732 if (fromPos === void 0) { 12733 fromPos = 0; 12734 } 12735 if (toPos === void 0) { 12736 toPos = this.value.length; 12737 } 12738 return this.masked.extractInput(fromPos, toPos, flags); 12739 } 12740 nearestInputPos(cursorPos, direction) { 12741 if (direction === void 0) { 12742 direction = DIRECTION.NONE; 12743 } 12744 const minPos = 0; 12745 const maxPos = this.value.length; 12746 const boundPos = Math.min(Math.max(cursorPos, minPos), maxPos); 12747 switch (direction) { 12748 case DIRECTION.LEFT: 12749 case DIRECTION.FORCE_LEFT: 12750 return this.isComplete ? boundPos : minPos; 12751 case DIRECTION.RIGHT: 12752 case DIRECTION.FORCE_RIGHT: 12753 return this.isComplete ? boundPos : maxPos; 12754 case DIRECTION.NONE: 12755 default: 12756 return boundPos; 12757 } 12758 } 12759 totalInputPositions(fromPos, toPos) { 12760 if (fromPos === void 0) { 12761 fromPos = 0; 12762 } 12763 if (toPos === void 0) { 12764 toPos = this.value.length; 12765 } 12766 return this.value.slice(fromPos, toPos).length; 12767 } 12768 doValidate(flags) { 12769 return this.masked.doValidate(this.currentMaskFlags(flags)) && (!this.parent || this.parent.doValidate(this.currentMaskFlags(flags))); 12770 } 12771 doCommit() { 12772 this.masked.doCommit(); 12773 } 12774 get state() { 12775 return { 12776 _value: this.value, 12777 _rawInputValue: this.rawInputValue, 12778 masked: this.masked.state, 12779 isFilled: this.isFilled 12780 }; 12781 } 12782 set state(state) { 12783 this.masked.state = state.masked; 12784 this.isFilled = state.isFilled; 12785 } 12786 currentMaskFlags(flags) { 12787 var _flags$_beforeTailSta; 12788 return { 12789 ...flags, 12790 _beforeTailState: (flags == null || (_flags$_beforeTailSta = flags._beforeTailState) == null ? void 0 : _flags$_beforeTailSta.masked) || (flags == null ? void 0 : flags._beforeTailState) 12791 }; 12792 } 12793 pad(flags) { 12794 return new ChangeDetails(); 12795 } 12796 } 12797 PatternInputDefinition.DEFAULT_DEFINITIONS = { 12798 '0': /\d/, 12799 'a': /[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/, 12800 // http://stackoverflow.com/a/22075070 12801 '*': /./ 12802 }; 12803 12804 /** Masking by RegExp */ 12805 class MaskedRegExp extends Masked { 12806 /** */ 12807 12808 /** Enable characters overwriting */ 12809 12810 /** */ 12811 12812 /** */ 12813 12814 /** */ 12815 12816 updateOptions(opts) { 12817 super.updateOptions(opts); 12818 } 12819 _update(opts) { 12820 const mask = opts.mask; 12821 if (mask) opts.validate = value => value.search(mask) >= 0; 12822 super._update(opts); 12823 } 12824 } 12825 IMask.MaskedRegExp = MaskedRegExp; 12826 12827 /** Pattern mask */ 12828 class MaskedPattern extends Masked { 12829 /** */ 12830 12831 /** */ 12832 12833 /** Single char for empty input */ 12834 12835 /** Single char for filled input */ 12836 12837 /** Show placeholder only when needed */ 12838 12839 /** Enable characters overwriting */ 12840 12841 /** */ 12842 12843 /** */ 12844 12845 /** */ 12846 12847 constructor(opts) { 12848 super({ 12849 ...MaskedPattern.DEFAULTS, 12850 ...opts, 12851 definitions: Object.assign({}, PatternInputDefinition.DEFAULT_DEFINITIONS, opts == null ? void 0 : opts.definitions) 12852 }); 12853 } 12854 updateOptions(opts) { 12855 super.updateOptions(opts); 12856 } 12857 _update(opts) { 12858 opts.definitions = Object.assign({}, this.definitions, opts.definitions); 12859 super._update(opts); 12860 this._rebuildMask(); 12861 } 12862 _rebuildMask() { 12863 const defs = this.definitions; 12864 this._blocks = []; 12865 this.exposeBlock = undefined; 12866 this._stops = []; 12867 this._maskedBlocks = {}; 12868 const pattern = this.mask; 12869 if (!pattern || !defs) return; 12870 let unmaskingBlock = false; 12871 let optionalBlock = false; 12872 for (let i = 0; i < pattern.length; ++i) { 12873 if (this.blocks) { 12874 const p = pattern.slice(i); 12875 const bNames = Object.keys(this.blocks).filter(bName => p.indexOf(bName) === 0); 12876 // order by key length 12877 bNames.sort((a, b) => b.length - a.length); 12878 // use block name with max length 12879 const bName = bNames[0]; 12880 if (bName) { 12881 const { 12882 expose, 12883 repeat, 12884 ...bOpts 12885 } = normalizeOpts(this.blocks[bName]); // TODO type Opts<Arg & Extra> 12886 const blockOpts = { 12887 lazy: this.lazy, 12888 eager: this.eager, 12889 placeholderChar: this.placeholderChar, 12890 displayChar: this.displayChar, 12891 overwrite: this.overwrite, 12892 autofix: this.autofix, 12893 ...bOpts, 12894 repeat, 12895 parent: this 12896 }; 12897 const maskedBlock = repeat != null ? new IMask.RepeatBlock(blockOpts /* TODO */) : createMask(blockOpts); 12898 if (maskedBlock) { 12899 this._blocks.push(maskedBlock); 12900 if (expose) this.exposeBlock = maskedBlock; 12901 12902 // store block index 12903 if (!this._maskedBlocks[bName]) this._maskedBlocks[bName] = []; 12904 this._maskedBlocks[bName].push(this._blocks.length - 1); 12905 } 12906 i += bName.length - 1; 12907 continue; 12908 } 12909 } 12910 let char = pattern[i]; 12911 let isInput = (char in defs); 12912 if (char === MaskedPattern.STOP_CHAR) { 12913 this._stops.push(this._blocks.length); 12914 continue; 12915 } 12916 if (char === '{' || char === '}') { 12917 unmaskingBlock = !unmaskingBlock; 12918 continue; 12919 } 12920 if (char === '[' || char === ']') { 12921 optionalBlock = !optionalBlock; 12922 continue; 12923 } 12924 if (char === MaskedPattern.ESCAPE_CHAR) { 12925 ++i; 12926 char = pattern[i]; 12927 if (!char) break; 12928 isInput = false; 12929 } 12930 const def = isInput ? new PatternInputDefinition({ 12931 isOptional: optionalBlock, 12932 lazy: this.lazy, 12933 eager: this.eager, 12934 placeholderChar: this.placeholderChar, 12935 displayChar: this.displayChar, 12936 ...normalizeOpts(defs[char]), 12937 parent: this 12938 }) : new PatternFixedDefinition({ 12939 char, 12940 eager: this.eager, 12941 isUnmasking: unmaskingBlock 12942 }); 12943 this._blocks.push(def); 12944 } 12945 } 12946 get state() { 12947 return { 12948 ...super.state, 12949 _blocks: this._blocks.map(b => b.state) 12950 }; 12951 } 12952 set state(state) { 12953 if (!state) { 12954 this.reset(); 12955 return; 12956 } 12957 const { 12958 _blocks, 12959 ...maskedState 12960 } = state; 12961 this._blocks.forEach((b, bi) => b.state = _blocks[bi]); 12962 super.state = maskedState; 12963 } 12964 reset() { 12965 super.reset(); 12966 this._blocks.forEach(b => b.reset()); 12967 } 12968 get isComplete() { 12969 return this.exposeBlock ? this.exposeBlock.isComplete : this._blocks.every(b => b.isComplete); 12970 } 12971 get isFilled() { 12972 return this._blocks.every(b => b.isFilled); 12973 } 12974 get isFixed() { 12975 return this._blocks.every(b => b.isFixed);
12976 } 12977 get isOptional() { 12978 return this._blocks.every(b => b.isOptional); 12979 } 12980 doCommit() { 12981 this._blocks.forEach(b => b.doCommit()); 12982 super.doCommit(); 12983 } 12984 get unmaskedValue() { 12985 return this.exposeBlock ? this.exposeBlock.unmaskedValue : this._blocks.reduce((str, b) => str += b.unmaskedValue, ''); 12986 } 12987 set unmaskedValue(unmaskedValue) { 12988 if (this.exposeBlock) { 12989 const tail = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length); 12990 this.exposeBlock.unmaskedValue = unmaskedValue; 12991 this.appendTail(tail); 12992 this.doCommit(); 12993 } else super.unmaskedValue = unmaskedValue; 12994 } 12995 get value() { 12996 return this.exposeBlock ? this.exposeBlock.value : 12997 // TODO return _value when not in change? 12998 this._blocks.reduce((str, b) => str += b.value, ''); 12999 } 13000 set value(value) { 13001 if (this.exposeBlock) { 13002 const tail = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length); 13003 this.exposeBlock.value = value; 13004 this.appendTail(tail); 13005 this.doCommit(); 13006 } else super.value = value; 13007 }
vendor: 51,889 bytes, lines 13008-14377
13008 get typedValue() { 13009 return this.exposeBlock ? this.exposeBlock.typedValue : super.typedValue; 13010 } 13011 set typedValue(value) { 13012 if (this.exposeBlock) { 13013 const tail = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length); 13014 this.exposeBlock.typedValue = value; 13015 this.appendTail(tail); 13016 this.doCommit(); 13017 } else super.typedValue = value; 13018 } 13019 get displayValue() { 13020 return this._blocks.reduce((str, b) => str += b.displayValue, ''); 13021 } 13022 appendTail(tail) { 13023 return super.appendTail(tail).aggregate(this._appendPlaceholder()); 13024 } 13025 _appendEager() { 13026 var _this$_mapPosToBlock; 13027 const details = new ChangeDetails(); 13028 let startBlockIndex = (_this$_mapPosToBlock = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : _this$_mapPosToBlock.index; 13029 if (startBlockIndex == null) return details; 13030 13031 // TODO test if it works for nested pattern masks 13032 if (this._blocks[startBlockIndex].isFilled) ++startBlockIndex; 13033 for (let bi = startBlockIndex; bi < this._blocks.length; ++bi) { 13034 const d = this._blocks[bi]._appendEager(); 13035 if (!d.inserted) break; 13036 details.aggregate(d); 13037 } 13038 return details; 13039 } 13040 _appendCharRaw(ch, flags) { 13041 if (flags === void 0) { 13042 flags = {}; 13043 } 13044 const blockIter = this._mapPosToBlock(this.displayValue.length); 13045 const details = new ChangeDetails(); 13046 if (!blockIter) return details; 13047 for (let bi = blockIter.index, block; block = this._blocks[bi]; ++bi) { 13048 var _flags$_beforeTailSta; 13049 const blockDetails = block._appendChar(ch, { 13050 ...flags, 13051 _beforeTailState: (_flags$_beforeTailSta = flags._beforeTailState) == null || (_flags$_beforeTailSta = _flags$_beforeTailSta._blocks) == null ? void 0 : _flags$_beforeTailSta[bi] 13052 }); 13053 details.aggregate(blockDetails); 13054 if (blockDetails.consumed) break; // go next char 13055 } 13056 return details; 13057 } 13058 extractTail(fromPos, toPos) { 13059 if (fromPos === void 0) { 13060 fromPos = 0; 13061 } 13062 if (toPos === void 0) { 13063 toPos = this.displayValue.length; 13064 } 13065 const chunkTail = new ChunksTailDetails(); 13066 if (fromPos === toPos) return chunkTail; 13067 this._forEachBlocksInRange(fromPos, toPos, (b, bi, bFromPos, bToPos) => { 13068 const blockChunk = b.extractTail(bFromPos, bToPos); 13069 blockChunk.stop = this._findStopBefore(bi); 13070 blockChunk.from = this._blockStartPos(bi); 13071 if (blockChunk instanceof ChunksTailDetails) blockChunk.blockIndex = bi; 13072 chunkTail.extend(blockChunk); 13073 }); 13074 return chunkTail; 13075 } 13076 extractInput(fromPos, toPos, flags) { 13077 if (fromPos === void 0) { 13078 fromPos = 0; 13079 } 13080 if (toPos === void 0) { 13081 toPos = this.displayValue.length; 13082 } 13083 if (flags === void 0) { 13084 flags = {}; 13085 } 13086 if (fromPos === toPos) return ''; 13087 let input = ''; 13088 this._forEachBlocksInRange(fromPos, toPos, (b, _, fromPos, toPos) => { 13089 input += b.extractInput(fromPos, toPos, flags); 13090 }); 13091 return input; 13092 } 13093 _findStopBefore(blockIndex) { 13094 let stopBefore; 13095 for (let si = 0; si < this._stops.length; ++si) { 13096 const stop = this._stops[si]; 13097 if (stop <= blockIndex) stopBefore = stop;else break; 13098 } 13099 return stopBefore; 13100 } 13101 13102 /** Appends placeholder depending on laziness */ 13103 _appendPlaceholder(toBlockIndex) { 13104 const details = new ChangeDetails(); 13105 if (this.lazy && toBlockIndex == null) return details; 13106 const startBlockIter = this._mapPosToBlock(this.displayValue.length); 13107 if (!startBlockIter) return details; 13108 const startBlockIndex = startBlockIter.index; 13109 const endBlockIndex = toBlockIndex != null ? toBlockIndex : this._blocks.length; 13110 this._blocks.slice(startBlockIndex, endBlockIndex).forEach(b => { 13111 if (!b.lazy || toBlockIndex != null) { 13112 var _blocks2; 13113 details.aggregate(b._appendPlaceholder((_blocks2 = b._blocks) == null ? void 0 : _blocks2.length)); 13114 } 13115 }); 13116 return details; 13117 } 13118 13119 /** Finds block in pos */ 13120 _mapPosToBlock(pos) { 13121 let accVal = ''; 13122 for (let bi = 0; bi < this._blocks.length; ++bi) { 13123 const block = this._blocks[bi]; 13124 const blockStartPos = accVal.length; 13125 accVal += block.displayValue; 13126 if (pos <= accVal.length) { 13127 return { 13128 index: bi, 13129 offset: pos - blockStartPos 13130 }; 13131 } 13132 } 13133 } 13134 _blockStartPos(blockIndex) { 13135 return this._blocks.slice(0, blockIndex).reduce((pos, b) => pos += b.displayValue.length, 0); 13136 } 13137 _forEachBlocksInRange(fromPos, toPos, fn) { 13138 if (toPos === void 0) { 13139 toPos = this.displayValue.length; 13140 } 13141 const fromBlockIter = this._mapPosToBlock(fromPos); 13142 if (fromBlockIter) { 13143 const toBlockIter = this._mapPosToBlock(toPos); 13144 // process first block 13145 const isSameBlock = toBlockIter && fromBlockIter.index === toBlockIter.index; 13146 const fromBlockStartPos = fromBlockIter.offset; 13147 const fromBlockEndPos = toBlockIter && isSameBlock ? toBlockIter.offset : this._blocks[fromBlockIter.index].displayValue.length; 13148 fn(this._blocks[fromBlockIter.index], fromBlockIter.index, fromBlockStartPos, fromBlockEndPos); 13149 if (toBlockIter && !isSameBlock) { 13150 // process intermediate blocks 13151 for (let bi = fromBlockIter.index + 1; bi < toBlockIter.index; ++bi) { 13152 fn(this._blocks[bi], bi, 0, this._blocks[bi].displayValue.length); 13153 } 13154 13155 // process last block 13156 fn(this._blocks[toBlockIter.index], toBlockIter.index, 0, toBlockIter.offset); 13157 } 13158 } 13159 } 13160 remove(fromPos, toPos) { 13161 if (fromPos === void 0) { 13162 fromPos = 0; 13163 } 13164 if (toPos === void 0) { 13165 toPos = this.displayValue.length; 13166 } 13167 const removeDetails = super.remove(fromPos, toPos); 13168 this._forEachBlocksInRange(fromPos, toPos, (b, _, bFromPos, bToPos) => { 13169 removeDetails.aggregate(b.remove(bFromPos, bToPos)); 13170 }); 13171 return removeDetails; 13172 } 13173 nearestInputPos(cursorPos, direction) { 13174 if (direction === void 0) { 13175 direction = DIRECTION.NONE; 13176 } 13177 if (!this._blocks.length) return 0; 13178 const cursor = new PatternCursor(this, cursorPos); 13179 if (direction === DIRECTION.NONE) { 13180 // ------------------------------------------------- 13181 // NONE should only go out from fixed to the right! 13182 // ------------------------------------------------- 13183 if (cursor.pushRightBeforeInput()) return cursor.pos; 13184 cursor.popState(); 13185 if (cursor.pushLeftBeforeInput()) return cursor.pos; 13186 return this.displayValue.length; 13187 } 13188 13189 // FORCE is only about a|* otherwise is 0 13190 if (direction === DIRECTION.LEFT || direction === DIRECTION.FORCE_LEFT) { 13191 // try to break fast when *|a 13192 if (direction === DIRECTION.LEFT) { 13193 cursor.pushRightBeforeFilled(); 13194 if (cursor.ok && cursor.pos === cursorPos) return cursorPos; 13195 cursor.popState(); 13196 } 13197 13198 // forward flow 13199 cursor.pushLeftBeforeInput(); 13200 cursor.pushLeftBeforeRequired(); 13201 cursor.pushLeftBeforeFilled(); 13202 13203 // backward flow 13204 if (direction === DIRECTION.LEFT) { 13205 cursor.pushRightBeforeInput(); 13206 cursor.pushRightBeforeRequired(); 13207 if (cursor.ok && cursor.pos <= cursorPos) return cursor.pos; 13208 cursor.popState(); 13209 if (cursor.ok && cursor.pos <= cursorPos) return cursor.pos; 13210 cursor.popState(); 13211 } 13212 if (cursor.ok) return cursor.pos; 13213 if (direction === DIRECTION.FORCE_LEFT) return 0; 13214 cursor.popState(); 13215 if (cursor.ok) return cursor.pos; 13216 cursor.popState(); 13217 if (cursor.ok) return cursor.pos; 13218 return 0; 13219 } 13220 if (direction === DIRECTION.RIGHT || direction === DIRECTION.FORCE_RIGHT) { 13221 // forward flow 13222 cursor.pushRightBeforeInput(); 13223 cursor.pushRightBeforeRequired(); 13224 if (cursor.pushRightBeforeFilled()) return cursor.pos; 13225 if (direction === DIRECTION.FORCE_RIGHT) return this.displayValue.length; 13226 13227 // backward flow 13228 cursor.popState(); 13229 if (cursor.ok) return cursor.pos; 13230 cursor.popState(); 13231 if (cursor.ok) return cursor.pos; 13232 return this.nearestInputPos(cursorPos, DIRECTION.LEFT); 13233 } 13234 return cursorPos; 13235 } 13236 totalInputPositions(fromPos, toPos) { 13237 if (fromPos === void 0) { 13238 fromPos = 0; 13239 } 13240 if (toPos === void 0) { 13241 toPos = this.displayValue.length; 13242 } 13243 let total = 0; 13244 this._forEachBlocksInRange(fromPos, toPos, (b, _, bFromPos, bToPos) => { 13245 total += b.totalInputPositions(bFromPos, bToPos); 13246 }); 13247 return total; 13248 } 13249 13250 /** Get block by name */ 13251 maskedBlock(name) { 13252 return this.maskedBlocks(name)[0]; 13253 } 13254 13255 /** Get all blocks by name */ 13256 maskedBlocks(name) { 13257 const indices = this._maskedBlocks[name]; 13258 if (!indices) return []; 13259 return indices.map(gi => this._blocks[gi]); 13260 } 13261 pad(flags) { 13262 const details = new ChangeDetails(); 13263 this._forEachBlocksInRange(0, this.displayValue.length, b => details.aggregate(b.pad(flags))); 13264 return details; 13265 } 13266 } 13267 MaskedPattern.DEFAULTS = { 13268 ...Masked.DEFAULTS, 13269 lazy: true, 13270 placeholderChar: '_' 13271 }; 13272 MaskedPattern.STOP_CHAR = '`'; 13273 MaskedPattern.ESCAPE_CHAR = '\\'; 13274 MaskedPattern.InputDefinition = PatternInputDefinition; 13275 MaskedPattern.FixedDefinition = PatternFixedDefinition; 13276 IMask.MaskedPattern = MaskedPattern; 13277 13278 /** Pattern which accepts ranges */ 13279 class MaskedRange extends MaskedPattern { 13280 /** 13281 Optionally sets max length of pattern. 13282 Used when pattern length is longer then `to` param length. Pads zeros at start in this case. 13283 */ 13284 13285 /** Min bound */ 13286 13287 /** Max bound */ 13288 13289 get _matchFrom() { 13290 return this.maxLength - String(this.from).length; 13291 } 13292 constructor(opts) { 13293 super(opts); // mask will be created in _update 13294 } 13295 updateOptions(opts) { 13296 super.updateOptions(opts); 13297 } 13298 _update(opts) { 13299 const { 13300 to = this.to || 0, 13301 from = this.from || 0, 13302 maxLength = this.maxLength || 0, 13303 autofix = this.autofix, 13304 ...patternOpts 13305 } = opts; 13306 this.to = to; 13307 this.from = from; 13308 this.maxLength = Math.max(String(to).length, maxLength); 13309 this.autofix = autofix; 13310 const fromStr = String(this.from).padStart(this.maxLength, '0'); 13311 const toStr = String(this.to).padStart(this.maxLength, '0'); 13312 let sameCharsCount = 0; 13313 while (sameCharsCount < toStr.length && toStr[sameCharsCount] === fromStr[sameCharsCount]) ++sameCharsCount; 13314 patternOpts.mask = toStr.slice(0, sameCharsCount).replace(/0/g, '\\0') + '0'.repeat(this.maxLength - sameCharsCount); 13315 super._update(patternOpts); 13316 } 13317 get isComplete() { 13318 return super.isComplete && Boolean(this.value); 13319 } 13320 boundaries(str) { 13321 let minstr = ''; 13322 let maxstr = ''; 13323 const [, placeholder, num] = str.match(/^(\D*)(\d*)(\D*)/) || []; 13324 if (num) { 13325 minstr = '0'.repeat(placeholder.length) + num; 13326 maxstr = '9'.repeat(placeholder.length) + num; 13327 } 13328 minstr = minstr.padEnd(this.maxLength, '0'); 13329 maxstr = maxstr.padEnd(this.maxLength, '9'); 13330 return [minstr, maxstr]; 13331 } 13332 doPrepareChar(ch, flags) { 13333 if (flags === void 0) { 13334 flags = {}; 13335 } 13336 let details; 13337 [ch, details] = super.doPrepareChar(ch.replace(/\D/g, ''), flags); 13338 if (!ch) details.skip = !this.isComplete; 13339 return [ch, details]; 13340 } 13341 _appendCharRaw(ch, flags) { 13342 if (flags === void 0) { 13343 flags = {}; 13344 } 13345 if (!this.autofix || this.value.length + 1 > this.maxLength) return super._appendCharRaw(ch, flags); 13346 const fromStr = String(this.from).padStart(this.maxLength, '0'); 13347 const toStr = String(this.to).padStart(this.maxLength, '0'); 13348 const [minstr, maxstr] = this.boundaries(this.value + ch); 13349 if (Number(maxstr) < this.from) return super._appendCharRaw(fromStr[this.value.length], flags); 13350 if (Number(minstr) > this.to) { 13351 if (!flags.tail && this.autofix === 'pad' && this.value.length + 1 < this.maxLength) { 13352 return super._appendCharRaw(fromStr[this.value.length], flags).aggregate(this._appendCharRaw(ch, flags)); 13353 } 13354 return super._appendCharRaw(toStr[this.value.length], flags); 13355 } 13356 return super._appendCharRaw(ch, flags); 13357 } 13358 doValidate(flags) { 13359 const str = this.value; 13360 const firstNonZero = str.search(/[^0]/); 13361 if (firstNonZero === -1 && str.length <= this._matchFrom) return true; 13362 const [minstr, maxstr] = this.boundaries(str); 13363 return this.from <= Number(maxstr) && Number(minstr) <= this.to && super.doValidate(flags); 13364 } 13365 pad(flags) { 13366 const details = new ChangeDetails(); 13367 if (this.value.length === this.maxLength) return details; 13368 const value = this.value; 13369 const padLength = this.maxLength - this.value.length; 13370 if (padLength) { 13371 this.reset(); 13372 for (let i = 0; i < padLength; ++i) { 13373 details.aggregate(super._appendCharRaw('0', flags)); 13374 } 13375 13376 // append tail 13377 value.split('').forEach(ch => this._appendCharRaw(ch)); 13378 } 13379 return details; 13380 } 13381 } 13382 IMask.MaskedRange = MaskedRange; 13383 13384 const DefaultPattern = 'd{.}`m{.}`Y'; 13385 13386 // Make format and parse required when pattern is provided 13387 13388 /** Date mask */ 13389 class MaskedDate extends MaskedPattern { 13390 static extractPatternOptions(opts) { 13391 const { 13392 mask, 13393 pattern, 13394 ...patternOpts 13395 } = opts; 13396 return { 13397 ...patternOpts, 13398 mask: isString(mask) ? mask : pattern 13399 }; 13400 } 13401 13402 /** Pattern mask for date according to {@link MaskedDate#format} */ 13403 13404 /** Start date */ 13405 13406 /** End date */ 13407 13408 /** Format typed value to string */ 13409 13410 /** Parse string to get typed value */ 13411 13412 constructor(opts) { 13413 super(MaskedDate.extractPatternOptions({ 13414 ...MaskedDate.DEFAULTS, 13415 ...opts 13416 })); 13417 } 13418 updateOptions(opts) { 13419 super.updateOptions(opts); 13420 } 13421 _update(opts) { 13422 const { 13423 mask, 13424 pattern, 13425 blocks, 13426 ...patternOpts 13427 } = { 13428 ...MaskedDate.DEFAULTS, 13429 ...opts 13430 }; 13431 const patternBlocks = Object.assign({}, MaskedDate.GET_DEFAULT_BLOCKS()); 13432 // adjust year block 13433 if (opts.min) patternBlocks.Y.from = opts.min.getFullYear(); 13434 if (opts.max) patternBlocks.Y.to = opts.max.getFullYear(); 13435 if (opts.min && opts.max && patternBlocks.Y.from === patternBlocks.Y.to) { 13436 patternBlocks.m.from = opts.min.getMonth() + 1; 13437 patternBlocks.m.to = opts.max.getMonth() + 1; 13438 if (patternBlocks.m.from === patternBlocks.m.to) { 13439 patternBlocks.d.from = opts.min.getDate(); 13440 patternBlocks.d.to = opts.max.getDate(); 13441 } 13442 } 13443 Object.assign(patternBlocks, this.blocks, blocks); 13444 super._update({ 13445 ...patternOpts, 13446 mask: isString(mask) ? mask : pattern, 13447 blocks: patternBlocks 13448 }); 13449 } 13450 doValidate(flags) { 13451 const date = this.date; 13452 return super.doValidate(flags) && (!this.isComplete || this.isDateExist(this.value) && date != null && (this.min == null || this.min <= date) && (this.max == null || date <= this.max)); 13453 } 13454 13455 /** Checks if date is exists */ 13456 isDateExist(str) { 13457 return this.format(this.parse(str, this), this).indexOf(str) >= 0; 13458 } 13459 13460 /** Parsed Date */ 13461 get date() { 13462 return this.typedValue; 13463 } 13464 set date(date) { 13465 this.typedValue = date; 13466 } 13467 get typedValue() { 13468 return this.isComplete ? super.typedValue : null; 13469 } 13470 set typedValue(value) { 13471 super.typedValue = value; 13472 } 13473 maskEquals(mask) { 13474 return mask === Date || super.maskEquals(mask); 13475 } 13476 optionsIsChanged(opts) { 13477 return super.optionsIsChanged(MaskedDate.extractPatternOptions(opts)); 13478 } 13479 } 13480 MaskedDate.GET_DEFAULT_BLOCKS = () => ({ 13481 d: { 13482 mask: MaskedRange, 13483 from: 1, 13484 to: 31, 13485 maxLength: 2 13486 }, 13487 m: { 13488 mask: MaskedRange, 13489 from: 1, 13490 to: 12, 13491 maxLength: 2 13492 }, 13493 Y: { 13494 mask: MaskedRange, 13495 from: 1900, 13496 to: 9999 13497 } 13498 }); 13499 MaskedDate.DEFAULTS = { 13500 ...MaskedPattern.DEFAULTS, 13501 mask: Date, 13502 pattern: DefaultPattern, 13503 format: (date, masked) => { 13504 if (!date) return ''; 13505 const day = String(date.getDate()).padStart(2, '0'); 13506 const month = String(date.getMonth() + 1).padStart(2, '0'); 13507 const year = date.getFullYear(); 13508 return [day, month, year].join('.'); 13509 }, 13510 parse: (str, masked) => { 13511 const [day, month, year] = str.split('.').map(Number); 13512 return new Date(year, month - 1, day); 13513 } 13514 }; 13515 IMask.MaskedDate = MaskedDate; 13516 13517 /** Dynamic mask for choosing appropriate mask in run-time */ 13518 class MaskedDynamic extends Masked { 13519 constructor(opts) { 13520 super({ 13521 ...MaskedDynamic.DEFAULTS, 13522 ...opts 13523 }); 13524 this.currentMask = undefined; 13525 } 13526 updateOptions(opts) { 13527 super.updateOptions(opts); 13528 } 13529 _update(opts) { 13530 super._update(opts); 13531 if ('mask' in opts) { 13532 this.exposeMask = undefined; 13533 // mask could be totally dynamic with only `dispatch` option 13534 this.compiledMasks = Array.isArray(opts.mask) ? opts.mask.map(m => { 13535 const { 13536 expose, 13537 ...maskOpts 13538 } = normalizeOpts(m); 13539 const masked = createMask({ 13540 overwrite: this._overwrite, 13541 eager: this._eager, 13542 skipInvalid: this._skipInvalid, 13543 ...maskOpts 13544 }); 13545 if (expose) this.exposeMask = masked; 13546 return masked; 13547 }) : []; 13548 13549 // this.currentMask = this.doDispatch(''); // probably not needed but lets see 13550 } 13551 } 13552 _appendCharRaw(ch, flags) { 13553 if (flags === void 0) { 13554 flags = {}; 13555 } 13556 const details = this._applyDispatch(ch, flags); 13557 if (this.currentMask) { 13558 details.aggregate(this.currentMask._appendChar(ch, this.currentMaskFlags(flags))); 13559 } 13560 return details; 13561 } 13562 _applyDispatch(appended, flags, tail) { 13563 if (appended === void 0) { 13564 appended = ''; 13565 } 13566 if (flags === void 0) { 13567 flags = {}; 13568 } 13569 if (tail === void 0) { 13570 tail = ''; 13571 } 13572 const prevValueBeforeTail = flags.tail && flags._beforeTailState != null ? flags._beforeTailState._value : this.value; 13573 const inputValue = this.rawInputValue; 13574 const insertValue = flags.tail && flags._beforeTailState != null ? flags._beforeTailState._rawInputValue : inputValue; 13575 const tailValue = inputValue.slice(insertValue.length); 13576 const prevMask = this.currentMask; 13577 const details = new ChangeDetails(); 13578 const prevMaskState = prevMask == null ? void 0 : prevMask.state; 13579 13580 // clone flags to prevent overwriting `_beforeTailState` 13581 this.currentMask = this.doDispatch(appended, { 13582 ...flags 13583 }, tail); 13584 13585 // restore state after dispatch 13586 if (this.currentMask) { 13587 if (this.currentMask !== prevMask) { 13588 // if mask changed reapply input 13589 this.currentMask.reset(); 13590 if (insertValue) { 13591 this.currentMask.append(insertValue, { 13592 raw: true 13593 }); 13594 details.tailShift = this.currentMask.value.length - prevValueBeforeTail.length; 13595 } 13596 if (tailValue) { 13597 details.tailShift += this.currentMask.append(tailValue, { 13598 raw: true, 13599 tail: true 13600 }).tailShift; 13601 } 13602 } else if (prevMaskState) { 13603 // Dispatch can do something bad with state, so 13604 // restore prev mask state 13605 this.currentMask.state = prevMaskState; 13606 } 13607 } 13608 return details; 13609 } 13610 _appendPlaceholder() { 13611 const details = this._applyDispatch(); 13612 if (this.currentMask) { 13613 details.aggregate(this.currentMask._appendPlaceholder()); 13614 } 13615 return details; 13616 } 13617 _appendEager() { 13618 const details = this._applyDispatch(); 13619 if (this.currentMask) { 13620 details.aggregate(this.currentMask._appendEager()); 13621 } 13622 return details; 13623 } 13624 appendTail(tail) { 13625 const details = new ChangeDetails(); 13626 if (tail) details.aggregate(this._applyDispatch('', {}, tail)); 13627 return details.aggregate(this.currentMask ? this.currentMask.appendTail(tail) : super.appendTail(tail)); 13628 } 13629 currentMaskFlags(flags) { 13630 var _flags$_beforeTailSta, _flags$_beforeTailSta2; 13631 return { 13632 ...flags, 13633 _beforeTailState: ((_flags$_beforeTailSta = flags._beforeTailState) == null ? void 0 : _flags$_beforeTailSta.currentMaskRef) === this.currentMask && ((_flags$_beforeTailSta2 = flags._beforeTailState) == null ? void 0 : _flags$_beforeTailSta2.currentMask) || flags._beforeTailState 13634 }; 13635 } 13636 doDispatch(appended, flags, tail) { 13637 if (flags === void 0) { 13638 flags = {}; 13639 } 13640 if (tail === void 0) { 13641 tail = ''; 13642 } 13643 return this.dispatch(appended, this, flags, tail); 13644 } 13645 doValidate(flags) { 13646 return super.doValidate(flags) && (!this.currentMask || this.currentMask.doValidate(this.currentMaskFlags(flags))); 13647 } 13648 doPrepare(str, flags) { 13649 if (flags === void 0) { 13650 flags = {}; 13651 } 13652 let [s, details] = super.doPrepare(str, flags); 13653 if (this.currentMask) { 13654 let currentDetails; 13655 [s, currentDetails] = super.doPrepare(s, this.currentMaskFlags(flags)); 13656 details = details.aggregate(currentDetails); 13657 } 13658 return [s, details]; 13659 } 13660 doPrepareChar(str, flags) { 13661 if (flags === void 0) { 13662 flags = {}; 13663 } 13664 let [s, details] = super.doPrepareChar(str, flags); 13665 if (this.currentMask) { 13666 let currentDetails; 13667 [s, currentDetails] = super.doPrepareChar(s, this.currentMaskFlags(flags)); 13668 details = details.aggregate(currentDetails); 13669 } 13670 return [s, details]; 13671 } 13672 reset() { 13673 var _this$currentMask; 13674 (_this$currentMask = this.currentMask) == null || _this$currentMask.reset(); 13675 this.compiledMasks.forEach(m => m.reset()); 13676 } 13677 get value() { 13678 return this.exposeMask ? this.exposeMask.value : this.currentMask ? this.currentMask.value : ''; 13679 } 13680 set value(value) { 13681 if (this.exposeMask) { 13682 this.exposeMask.value = value; 13683 this.currentMask = this.exposeMask; 13684 this._applyDispatch(); 13685 } else super.value = value; 13686 } 13687 get unmaskedValue() { 13688 return this.exposeMask ? this.exposeMask.unmaskedValue : this.currentMask ? this.currentMask.unmaskedValue : ''; 13689 } 13690 set unmaskedValue(unmaskedValue) { 13691 if (this.exposeMask) { 13692 this.exposeMask.unmaskedValue = unmaskedValue; 13693 this.currentMask = this.exposeMask; 13694 this._applyDispatch(); 13695 } else super.unmaskedValue = unmaskedValue; 13696 } 13697 get typedValue() { 13698 return this.exposeMask ? this.exposeMask.typedValue : this.currentMask ? this.currentMask.typedValue : ''; 13699 } 13700 set typedValue(typedValue) { 13701 if (this.exposeMask) { 13702 this.exposeMask.typedValue = typedValue; 13703 this.currentMask = this.exposeMask; 13704 this._applyDispatch(); 13705 return; 13706 } 13707 let unmaskedValue = String(typedValue); 13708 13709 // double check it 13710 if (this.currentMask) { 13711 this.currentMask.typedValue = typedValue; 13712 unmaskedValue = this.currentMask.unmaskedValue; 13713 } 13714 this.unmaskedValue = unmaskedValue; 13715 } 13716 get displayValue() { 13717 return this.currentMask ? this.currentMask.displayValue : ''; 13718 } 13719 get isComplete() { 13720 var _this$currentMask2; 13721 return Boolean((_this$currentMask2 = this.currentMask) == null ? void 0 : _this$currentMask2.isComplete); 13722 } 13723 get isFilled() { 13724 var _this$currentMask3; 13725 return Boolean((_this$currentMask3 = this.currentMask) == null ? void 0 : _this$currentMask3.isFilled); 13726 } 13727 remove(fromPos, toPos) { 13728 const details = new ChangeDetails(); 13729 if (this.currentMask) { 13730 details.aggregate(this.currentMask.remove(fromPos, toPos)) 13731 // update with dispatch 13732 .aggregate(this._applyDispatch()); 13733 } 13734 return details; 13735 } 13736 get state() { 13737 var _this$currentMask4; 13738 return { 13739 ...super.state, 13740 _rawInputValue: this.rawInputValue, 13741 compiledMasks: this.compiledMasks.map(m => m.state), 13742 currentMaskRef: this.currentMask, 13743 currentMask: (_this$currentMask4 = this.currentMask) == null ? void 0 : _this$currentMask4.state 13744 }; 13745 } 13746 set state(state) { 13747 const { 13748 compiledMasks, 13749 currentMaskRef, 13750 currentMask, 13751 ...maskedState 13752 } = state; 13753 if (compiledMasks) this.compiledMasks.forEach((m, mi) => m.state = compiledMasks[mi]); 13754 if (currentMaskRef != null) { 13755 this.currentMask = currentMaskRef; 13756 this.currentMask.state = currentMask; 13757 } 13758 super.state = maskedState; 13759 } 13760 extractInput(fromPos, toPos, flags) { 13761 return this.currentMask ? this.currentMask.extractInput(fromPos, toPos, flags) : ''; 13762 } 13763 extractTail(fromPos, toPos) { 13764 return this.currentMask ? this.currentMask.extractTail(fromPos, toPos) : super.extractTail(fromPos, toPos); 13765 } 13766 doCommit() { 13767 if (this.currentMask) this.currentMask.doCommit(); 13768 super.doCommit(); 13769 } 13770 nearestInputPos(cursorPos, direction) { 13771 return this.currentMask ? this.currentMask.nearestInputPos(cursorPos, direction) : super.nearestInputPos(cursorPos, direction); 13772 } 13773 get overwrite() { 13774 return this.currentMask ? this.currentMask.overwrite : this._overwrite; 13775 } 13776 set overwrite(overwrite) { 13777 this._overwrite = overwrite; 13778 } 13779 get eager() { 13780 return this.currentMask ? this.currentMask.eager : this._eager; 13781 } 13782 set eager(eager) { 13783 this._eager = eager; 13784 } 13785 get skipInvalid() { 13786 return this.currentMask ? this.currentMask.skipInvalid : this._skipInvalid; 13787 } 13788 set skipInvalid(skipInvalid) { 13789 this._skipInvalid = skipInvalid; 13790 } 13791 get autofix() { 13792 return this.currentMask ? this.currentMask.autofix : this._autofix; 13793 } 13794 set autofix(autofix) { 13795 this._autofix = autofix; 13796 } 13797 maskEquals(mask) { 13798 return Array.isArray(mask) ? this.compiledMasks.every((m, mi) => { 13799 if (!mask[mi]) return; 13800 const { 13801 mask: oldMask, 13802 ...restOpts 13803 } = mask[mi]; 13804 return objectIncludes(m, restOpts) && m.maskEquals(oldMask); 13805 }) : super.maskEquals(mask); 13806 } 13807 typedValueEquals(value) { 13808 var _this$currentMask5; 13809 return Boolean((_this$currentMask5 = this.currentMask) == null ? void 0 : _this$currentMask5.typedValueEquals(value)); 13810 } 13811 } 13812 /** Currently chosen mask */ 13813 /** Currently chosen mask */ 13814 /** Compliled {@link Masked} options */ 13815 /** Chooses {@link Masked} depending on input value */ 13816 MaskedDynamic.DEFAULTS = { 13817 ...Masked.DEFAULTS, 13818 dispatch: (appended, masked, flags, tail) => { 13819 if (!masked.compiledMasks.length) return; 13820 const inputValue = masked.rawInputValue; 13821 13822 // simulate input 13823 const inputs = masked.compiledMasks.map((m, index) => { 13824 const isCurrent = masked.currentMask === m; 13825 const startInputPos = isCurrent ? m.displayValue.length : m.nearestInputPos(m.displayValue.length, DIRECTION.FORCE_LEFT); 13826 if (m.rawInputValue !== inputValue) { 13827 m.reset(); 13828 m.append(inputValue, { 13829 raw: true 13830 }); 13831 } else if (!isCurrent) { 13832 m.remove(startInputPos); 13833 } 13834 m.append(appended, masked.currentMaskFlags(flags)); 13835 m.appendTail(tail); 13836 return { 13837 index, 13838 weight: m.rawInputValue.length, 13839 totalInputPositions: m.totalInputPositions(0, Math.max(startInputPos, m.nearestInputPos(m.displayValue.length, DIRECTION.FORCE_LEFT))) 13840 }; 13841 }); 13842 13843 // pop masks with longer values first 13844 inputs.sort((i1, i2) => i2.weight - i1.weight || i2.totalInputPositions - i1.totalInputPositions); 13845 return masked.compiledMasks[inputs[0].index]; 13846 } 13847 }; 13848 IMask.MaskedDynamic = MaskedDynamic; 13849 13850 /** Pattern which validates enum values */ 13851 class MaskedEnum extends MaskedPattern { 13852 constructor(opts) { 13853 super({ 13854 ...MaskedEnum.DEFAULTS, 13855 ...opts 13856 }); // mask will be created in _update 13857 } 13858 updateOptions(opts) { 13859 super.updateOptions(opts); 13860 } 13861 _update(opts) { 13862 const { 13863 enum: enum_, 13864 ...eopts 13865 } = opts; 13866 if (enum_) { 13867 const lengths = enum_.map(e => e.length); 13868 const requiredLength = Math.min(...lengths); 13869 const optionalLength = Math.max(...lengths) - requiredLength; 13870 eopts.mask = '*'.repeat(requiredLength); 13871 if (optionalLength) eopts.mask += '[' + '*'.repeat(optionalLength) + ']'; 13872 this.enum = enum_; 13873 } 13874 super._update(eopts); 13875 } 13876 _appendCharRaw(ch, flags) { 13877 if (flags === void 0) { 13878 flags = {}; 13879 } 13880 const matchFrom = Math.min(this.nearestInputPos(0, DIRECTION.FORCE_RIGHT), this.value.length); 13881 const matches = this.enum.filter(e => this.matchValue(e, this.unmaskedValue + ch, matchFrom)); 13882 if (matches.length) { 13883 if (matches.length === 1) { 13884 this._forEachBlocksInRange(0, this.value.length, (b, bi) => { 13885 const mch = matches[0][bi]; 13886 if (bi >= this.value.length || mch === b.value) return; 13887 b.reset(); 13888 b._appendChar(mch, flags); 13889 }); 13890 } 13891 const d = super._appendCharRaw(matches[0][this.value.length], flags); 13892 if (matches.length === 1) { 13893 matches[0].slice(this.unmaskedValue.length).split('').forEach(mch => d.aggregate(super._appendCharRaw(mch))); 13894 } 13895 return d; 13896 } 13897 return new ChangeDetails({ 13898 skip: !this.isComplete 13899 }); 13900 } 13901 extractTail(fromPos, toPos) { 13902 if (fromPos === void 0) { 13903 fromPos = 0; 13904 } 13905 if (toPos === void 0) { 13906 toPos = this.displayValue.length; 13907 } 13908 // just drop tail 13909 return new ContinuousTailDetails('', fromPos); 13910 } 13911 remove(fromPos, toPos) { 13912 if (fromPos === void 0) { 13913 fromPos = 0; 13914 } 13915 if (toPos === void 0) { 13916 toPos = this.displayValue.length; 13917 } 13918 if (fromPos === toPos) return new ChangeDetails(); 13919 const matchFrom = Math.min(super.nearestInputPos(0, DIRECTION.FORCE_RIGHT), this.value.length); 13920 let pos; 13921 for (pos = fromPos; pos >= 0; --pos) { 13922 const matches = this.enum.filter(e => this.matchValue(e, this.value.slice(matchFrom, pos), matchFrom)); 13923 if (matches.length > 1) break; 13924 } 13925 const details = super.remove(pos, toPos); 13926 details.tailShift += pos - fromPos; 13927 return details; 13928 } 13929 get isComplete() { 13930 return this.enum.indexOf(this.value) >= 0; 13931 } 13932 } 13933 /** Match enum value */ 13934 MaskedEnum.DEFAULTS = { 13935 ...MaskedPattern.DEFAULTS, 13936 matchValue: (estr, istr, matchFrom) => estr.indexOf(istr, matchFrom) === matchFrom 13937 }; 13938 IMask.MaskedEnum = MaskedEnum; 13939 13940 /** Masking by custom Function */ 13941 class MaskedFunction extends Masked { 13942 /** */ 13943 13944 /** Enable characters overwriting */ 13945 13946 /** */ 13947 13948 /** */ 13949 13950 /** */ 13951 13952 updateOptions(opts) { 13953 super.updateOptions(opts); 13954 } 13955 _update(opts) { 13956 super._update({ 13957 ...opts, 13958 validate: opts.mask 13959 }); 13960 } 13961 } 13962 IMask.MaskedFunction = MaskedFunction; 13963 13964 var _MaskedNumber; 13965 /** Number mask */ 13966 class MaskedNumber extends Masked { 13967 /** Single char */ 13968 13969 /** Single char */ 13970 13971 /** Array of single chars */ 13972 13973 /** */ 13974 13975 /** */ 13976 13977 /** Digits after point */ 13978 13979 /** Flag to remove leading and trailing zeros in the end of editing */ 13980 13981 /** Flag to pad trailing zeros after point in the end of editing */ 13982 13983 /** Enable characters overwriting */ 13984 13985 /** */ 13986 13987 /** */ 13988 13989 /** */ 13990 13991 /** Format typed value to string */ 13992 13993 /** Parse string to get typed value */ 13994 13995 constructor(opts) { 13996 super({ 13997 ...MaskedNumber.DEFAULTS, 13998 ...opts 13999 }); 14000 } 14001 updateOptions(opts) { 14002 super.updateOptions(opts); 14003 } 14004 _update(opts) { 14005 super._update(opts); 14006 this._updateRegExps(); 14007 } 14008 _updateRegExps() { 14009 const start = '^' + (this.allowNegative ? '[+|\\-]?' : ''); 14010 const mid = '\\d*'; 14011 const end = (this.scale ? "(" + escapeRegExp(this.radix) + "\\d{0," + this.scale + "})?" : '') + '$'; 14012 this._numberRegExp = new RegExp(start + mid + end); 14013 this._mapToRadixRegExp = new RegExp("[" + this.mapToRadix.map(escapeRegExp).join('') + "]", 'g'); 14014 this._thousandsSeparatorRegExp = new RegExp(escapeRegExp(this.thousandsSeparator), 'g'); 14015 } 14016 _removeThousandsSeparators(value) { 14017 return value.replace(this._thousandsSeparatorRegExp, ''); 14018 } 14019 _insertThousandsSeparators(value) { 14020 // https://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript 14021 const parts = value.split(this.radix); 14022 parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, this.thousandsSeparator); 14023 return parts.join(this.radix); 14024 } 14025 doPrepareChar(ch, flags) { 14026 if (flags === void 0) { 14027 flags = {}; 14028 } 14029 const [prepCh, details] = super.doPrepareChar(this._removeThousandsSeparators(this.scale && this.mapToRadix.length && ( 14030 /* 14031 radix should be mapped when 14032 1) input is done from keyboard = flags.input && flags.raw 14033 2) unmasked value is set = !flags.input && !flags.raw 14034 and should not be mapped when 14035 1) value is set = flags.input && !flags.raw 14036 2) raw value is set = !flags.input && flags.raw 14037 */ 14038 flags.input && flags.raw || !flags.input && !flags.raw) ? ch.replace(this._mapToRadixRegExp, this.radix) : ch), flags); 14039 if (ch && !prepCh) details.skip = true; 14040 if (prepCh && !this.allowPositive && !this.value && prepCh !== '-') details.aggregate(this._appendChar('-')); 14041 return [prepCh, details]; 14042 } 14043 _separatorsCount(to, extendOnSeparators) { 14044 if (extendOnSeparators === void 0) { 14045 extendOnSeparators = false; 14046 } 14047 let count = 0; 14048 for (let pos = 0; pos < to; ++pos) { 14049 if (this._value.indexOf(this.thousandsSeparator, pos) === pos) { 14050 ++count; 14051 if (extendOnSeparators) to += this.thousandsSeparator.length; 14052 } 14053 } 14054 return count; 14055 } 14056 _separatorsCountFromSlice(slice) { 14057 if (slice === void 0) { 14058 slice = this._value; 14059 } 14060 return this._separatorsCount(this._removeThousandsSeparators(slice).length, true); 14061 } 14062 extractInput(fromPos, toPos, flags) { 14063 if (fromPos === void 0) { 14064 fromPos = 0; 14065 } 14066 if (toPos === void 0) { 14067 toPos = this.displayValue.length; 14068 } 14069 [fromPos, toPos] = this._adjustRangeWithSeparators(fromPos, toPos); 14070 return this._removeThousandsSeparators(super.extractInput(fromPos, toPos, flags)); 14071 } 14072 _appendCharRaw(ch, flags) { 14073 if (flags === void 0) { 14074 flags = {}; 14075 } 14076 const prevBeforeTailValue = flags.tail && flags._beforeTailState ? flags._beforeTailState._value : this._value; 14077 const prevBeforeTailSeparatorsCount = this._separatorsCountFromSlice(prevBeforeTailValue); 14078 this._value = this._removeThousandsSeparators(this.value); 14079 const oldValue = this._value; 14080 this._value += ch; 14081 const num = this.number; 14082 let accepted = !isNaN(num); 14083 let skip = false; 14084 if (accepted) { 14085 let fixedNum; 14086 if (this.min != null && this.min < 0 && this.number < this.min) fixedNum = this.min; 14087 if (this.max != null && this.max > 0 && this.number > this.max) fixedNum = this.max; 14088 if (fixedNum != null) { 14089 if (this.autofix) { 14090 this._value = this.format(fixedNum, this).replace(MaskedNumber.UNMASKED_RADIX, this.radix); 14091 skip || (skip = oldValue === this._value && !flags.tail); // if not changed on tail it's still ok to proceed 14092 } else { 14093 accepted = false; 14094 } 14095 } 14096 accepted && (accepted = Boolean(this._value.match(this._numberRegExp))); 14097 } 14098 let appendDetails; 14099 if (!accepted) { 14100 this._value = oldValue; 14101 appendDetails = new ChangeDetails(); 14102 } else { 14103 appendDetails = new ChangeDetails({ 14104 inserted: this._value.slice(oldValue.length), 14105 rawInserted: skip ? '' : ch, 14106 skip 14107 }); 14108 } 14109 this._value = this._insertThousandsSeparators(this._value); 14110 const beforeTailValue = flags.tail && flags._beforeTailState ? flags._beforeTailState._value : this._value; 14111 const beforeTailSeparatorsCount = this._separatorsCountFromSlice(beforeTailValue); 14112 appendDetails.tailShift += (beforeTailSeparatorsCount - prevBeforeTailSeparatorsCount) * this.thousandsSeparator.length; 14113 return appendDetails; 14114 } 14115 _findSeparatorAround(pos) { 14116 if (this.thousandsSeparator) { 14117 const searchFrom = pos - this.thousandsSeparator.length + 1; 14118 const separatorPos = this.value.indexOf(this.thousandsSeparator, searchFrom); 14119 if (separatorPos <= pos) return separatorPos; 14120 } 14121 return -1; 14122 } 14123 _adjustRangeWithSeparators(from, to) { 14124 const separatorAroundFromPos = this._findSeparatorAround(from); 14125 if (separatorAroundFromPos >= 0) from = separatorAroundFromPos; 14126 const separatorAroundToPos = this._findSeparatorAround(to); 14127 if (separatorAroundToPos >= 0) to = separatorAroundToPos + this.thousandsSeparator.length; 14128 return [from, to]; 14129 } 14130 remove(fromPos, toPos) { 14131 if (fromPos === void 0) { 14132 fromPos = 0; 14133 } 14134 if (toPos === void 0) { 14135 toPos = this.displayValue.length; 14136 } 14137 [fromPos, toPos] = this._adjustRangeWithSeparators(fromPos, toPos); 14138 const valueBeforePos = this.value.slice(0, fromPos); 14139 const valueAfterPos = this.value.slice(toPos); 14140 const prevBeforeTailSeparatorsCount = this._separatorsCount(valueBeforePos.length); 14141 this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(valueBeforePos + valueAfterPos)); 14142 const beforeTailSeparatorsCount = this._separatorsCountFromSlice(valueBeforePos); 14143 return new ChangeDetails({ 14144 tailShift: (beforeTailSeparatorsCount - prevBeforeTailSeparatorsCount) * this.thousandsSeparator.length 14145 }); 14146 } 14147 nearestInputPos(cursorPos, direction) { 14148 if (!this.thousandsSeparator) return cursorPos; 14149 switch (direction) { 14150 case DIRECTION.NONE: 14151 case DIRECTION.LEFT: 14152 case DIRECTION.FORCE_LEFT: 14153 { 14154 const separatorAtLeftPos = this._findSeparatorAround(cursorPos - 1); 14155 if (separatorAtLeftPos >= 0) { 14156 const separatorAtLeftEndPos = separatorAtLeftPos + this.thousandsSeparator.length; 14157 if (cursorPos < separatorAtLeftEndPos || this.value.length <= separatorAtLeftEndPos || direction === DIRECTION.FORCE_LEFT) { 14158 return separatorAtLeftPos; 14159 } 14160 } 14161 break; 14162 } 14163 case DIRECTION.RIGHT: 14164 case DIRECTION.FORCE_RIGHT: 14165 { 14166 const separatorAtRightPos = this._findSeparatorAround(cursorPos); 14167 if (separatorAtRightPos >= 0) { 14168 return separatorAtRightPos + this.thousandsSeparator.length; 14169 } 14170 } 14171 } 14172 return cursorPos; 14173 } 14174 doCommit() { 14175 if (this.value) { 14176 const number = this.number; 14177 let validnum = number; 14178 14179 // check bounds 14180 if (this.min != null) validnum = Math.max(validnum, this.min); 14181 if (this.max != null) validnum = Math.min(validnum, this.max); 14182 if (validnum !== number) this.unmaskedValue = this.format(validnum, this); 14183 let formatted = this.value; 14184 if (this.normalizeZeros) formatted = this._normalizeZeros(formatted); 14185 if (this.padFractionalZeros && this.scale > 0) formatted = this._padFractionalZeros(formatted); 14186 this._value = formatted; 14187 } 14188 super.doCommit(); 14189 } 14190 _normalizeZeros(value) { 14191 const parts = this._removeThousandsSeparators(value).split(this.radix); 14192 14193 // remove leading zeros 14194 parts[0] = parts[0].replace(/^(\D*)(0*)(\d*)/, (match, sign, zeros, num) => sign + num); 14195 // add leading zero 14196 if (value.length && !/\d$/.test(parts[0])) parts[0] = parts[0] + '0'; 14197 if (parts.length > 1) { 14198 parts[1] = parts[1].replace(/0*$/, ''); // remove trailing zeros 14199 if (!parts[1].length) parts.length = 1; // remove fractional 14200 } 14201 return this._insertThousandsSeparators(parts.join(this.radix)); 14202 } 14203 _padFractionalZeros(value) { 14204 if (!value) return value; 14205 const parts = value.split(this.radix); 14206 if (parts.length < 2) parts.push(''); 14207 parts[1] = parts[1].padEnd(this.scale, '0'); 14208 return parts.join(this.radix); 14209 } 14210 doSkipInvalid(ch, flags, checkTail) { 14211 if (flags === void 0) { 14212 flags = {}; 14213 } 14214 const dropFractional = this.scale === 0 && ch !== this.thousandsSeparator && (ch === this.radix || ch === MaskedNumber.UNMASKED_RADIX || this.mapToRadix.includes(ch)); 14215 return super.doSkipInvalid(ch, flags, checkTail) && !dropFractional; 14216 } 14217 get unmaskedValue() { 14218 return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix, MaskedNumber.UNMASKED_RADIX); 14219 } 14220 set unmaskedValue(unmaskedValue) { 14221 super.unmaskedValue = unmaskedValue; 14222 } 14223 get typedValue() { 14224 return this.parse(this.unmaskedValue, this); 14225 } 14226 set typedValue(n) { 14227 this.rawInputValue = this.format(n, this).replace(MaskedNumber.UNMASKED_RADIX, this.radix); 14228 } 14229 14230 /** Parsed Number */ 14231 get number() { 14232 return this.typedValue; 14233 } 14234 set number(number) { 14235 this.typedValue = number; 14236 } 14237 get allowNegative() { 14238 return this.min != null && this.min < 0 || this.max != null && this.max < 0; 14239 } 14240 get allowPositive() { 14241 return this.min != null && this.min > 0 || this.max != null && this.max > 0; 14242 } 14243 typedValueEquals(value) { 14244 // handle 0 -> '' case (typed = 0 even if value = '') 14245 // for details see https://github.com/uNmAnNeR/imaskjs/issues/134 14246 return (super.typedValueEquals(value) || MaskedNumber.EMPTY_VALUES.includes(value) && MaskedNumber.EMPTY_VALUES.includes(this.typedValue)) && !(value === 0 && this.value === ''); 14247 } 14248 } 14249 _MaskedNumber = MaskedNumber; 14250 MaskedNumber.UNMASKED_RADIX = '.'; 14251 MaskedNumber.EMPTY_VALUES = [...Masked.EMPTY_VALUES, 0]; 14252 MaskedNumber.DEFAULTS = { 14253 ...Masked.DEFAULTS, 14254 mask: Number, 14255 radix: ',', 14256 thousandsSeparator: '', 14257 mapToRadix: [_MaskedNumber.UNMASKED_RADIX], 14258 min: Number.MIN_SAFE_INTEGER, 14259 max: Number.MAX_SAFE_INTEGER, 14260 scale: 2, 14261 normalizeZeros: true, 14262 padFractionalZeros: false, 14263 parse: Number, 14264 format: n => n.toLocaleString('en-US', { 14265 useGrouping: false, 14266 maximumFractionDigits: 20 14267 }) 14268 }; 14269 IMask.MaskedNumber = MaskedNumber; 14270 14271 /** Mask pipe source and destination types */ 14272 const PIPE_TYPE = { 14273 MASKED: 'value', 14274 UNMASKED: 'unmaskedValue', 14275 TYPED: 'typedValue' 14276 }; 14277 /** Creates new pipe function depending on mask type, source and destination options */ 14278 function createPipe(arg, from, to) { 14279 if (from === void 0) { 14280 from = PIPE_TYPE.MASKED; 14281 } 14282 if (to === void 0) { 14283 to = PIPE_TYPE.MASKED; 14284 } 14285 const masked = createMask(arg); 14286 return value => masked.runIsolated(m => { 14287 m[from] = value; 14288 return m[to]; 14289 }); 14290 } 14291 14292 /** Pipes value through mask depending on mask type, source and destination options */ 14293 function pipe(value, mask, from, to) { 14294 return createPipe(mask, from, to)(value); 14295 } 14296 IMask.PIPE_TYPE = PIPE_TYPE; 14297 IMask.createPipe = createPipe; 14298 IMask.pipe = pipe; 14299 14300 /** Pattern mask */ 14301 class RepeatBlock extends MaskedPattern { 14302 get repeatFrom() { 14303 var _ref; 14304 return (_ref = Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === Infinity ? 0 : this.repeat) != null ? _ref : 0; 14305 } 14306 get repeatTo() { 14307 var _ref2; 14308 return (_ref2 = Array.isArray(this.repeat) ? this.repeat[1] : this.repeat) != null ? _ref2 : Infinity; 14309 } 14310 constructor(opts) { 14311 super(opts); 14312 } 14313 updateOptions(opts) { 14314 super.updateOptions(opts); 14315 } 14316 _update(opts) { 14317 var _ref3, _ref4, _this$_blocks; 14318 const { 14319 repeat, 14320 ...blockOpts 14321 } = normalizeOpts(opts); // TODO type 14322 this._blockOpts = Object.assign({}, this._blockOpts, blockOpts); 14323 const block = createMask(this._blockOpts); 14324 this.repeat = (_ref3 = (_ref4 = repeat != null ? repeat : block.repeat) != null ? _ref4 : this.repeat) != null ? _ref3 : Infinity; // TODO type 14325 14326 super._update({ 14327 mask: 'm'.repeat(Math.max(this.repeatTo === Infinity && ((_this$_blocks = this._blocks) == null ? void 0 : _this$_blocks.length) || 0, this.repeatFrom)), 14328 blocks: { 14329 m: block 14330 }, 14331 eager: block.eager, 14332 overwrite: block.overwrite, 14333 skipInvalid: block.skipInvalid, 14334 lazy: block.lazy, 14335 placeholderChar: block.placeholderChar, 14336 displayChar: block.displayChar 14337 }); 14338 } 14339 _allocateBlock(bi) { 14340 if (bi < this._blocks.length) return this._blocks[bi]; 14341 if (this.repeatTo === Infinity || this._blocks.length < this.repeatTo) { 14342 this._blocks.push(createMask(this._blockOpts)); 14343 this.mask += 'm'; 14344 return this._blocks[this._blocks.length - 1]; 14345 } 14346 } 14347 _appendCharRaw(ch, flags) { 14348 if (flags === void 0) { 14349 flags = {}; 14350 } 14351 const details = new ChangeDetails(); 14352 for (let bi = (_this$_mapPosToBlock$ = (_this$_mapPosToBlock = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : _this$_mapPosToBlock.index) != null ? _this$_mapPosToBlock$ : Math.max(this._blocks.length - 1, 0), block, allocated; 14353 // try to get a block or 14354 // try to allocate a new block if not allocated already 14355 block = (_this$_blocks$bi = this._blocks[bi]) != null ? _this$_blocks$bi : allocated = !allocated && this._allocateBlock(bi); ++bi) { 14356 var _this$_mapPosToBlock$, _this$_mapPosToBlock, _this$_blocks$bi, _flags$_beforeTailSta; 14357 const blockDetails = block._appendChar(ch, { 14358 ...flags, 14359 _beforeTailState: (_flags$_beforeTailSta = flags._beforeTailState) == null || (_flags$_beforeTailSta = _flags$_beforeTailSta._blocks) == null ? void 0 : _flags$_beforeTailSta[bi] 14360 }); 14361 if (blockDetails.skip && allocated) { 14362 // remove the last allocated block and break 14363 this._blocks.pop(); 14364 this.mask = this.mask.slice(1); 14365 break; 14366 } 14367 details.aggregate(blockDetails); 14368 if (blockDetails.consumed) break; // go next char 14369 } 14370 return details; 14371 } 14372 _trimEmptyTail(fromPos, toPos) { 14373 var _this$_mapPosToBlock2, _this$_mapPosToBlock3; 14374 if (fromPos === void 0) { 14375 fromPos = 0; 14376 } 14377 const firstBlockIndex = Math.max(((_this$_mapPosToBlock2 = this._mapPosToBlock(fromPos)) == null ? void 0 : _this$_mapPosToBlock2.
14377index) || 0, this.repeatFrom, 0); 14378 let lastBlockIndex; 14379 if (toPos != null) lastBlockIndex = (_this$_mapPosToBlock3 = this._mapPosToBlock(toPos)) == null ? void 0 : _this$_mapPosToBlock3.index; 14380 if (lastBlockIndex == null) lastBlockIndex = this._blocks.length - 1; 14381 let removeCount = 0; 14382 for (let blockIndex = lastBlockIndex; firstBlockIndex <= blockIndex; --blockIndex, ++removeCount) { 14383 if (this._blocks[blockIndex].unmaskedValue) break; 14384 } 14385 if (removeCount) { 14386 this._blocks.splice(lastBlockIndex - removeCount + 1, removeCount); 14387 this.mask = this.mask.slice(removeCount); 14388 } 14389 } 14390 reset() { 14391 super.reset(); 14392 this._trimEmptyTail(); 14393 } 14394 remove(fromPos, toPos) { 14395 if (fromPos === void 0) { 14396 fromPos = 0; 14397 } 14398 if (toPos === void 0) { 14399 toPos = this.displayValue.length; 14400 } 14401 const removeDetails = super.remove(fromPos, toPos); 14402 this._trimEmptyTail(fromPos, toPos); 14403 return removeDetails; 14404 } 14405 totalInputPositions(fromPos, toPos) { 14406 if (fromPos === void 0) { 14407 fromPos = 0; 14408 } 14409 if (toPos == null && this.repeatTo === Infinity) return Infinity; 14410 return super.totalInputPositions(fromPos, toPos); 14411 } 14412 get state() { 14413 return super.state; 14414 } 14415 set state(state) { 14416 this._blocks.length = state._blocks.length; 14417 this.mask = this.mask.slice(0, this._blocks.length); 14418 super.state = state; 14419 } 14420 } 14421 IMask.RepeatBlock = RepeatBlock; 14422 14423 try { 14424 globalThis.IMask = IMask; 14425 } catch {} 14426 14427 exports.ChangeDetails = ChangeDetails; 14428 exports.ChunksTailDetails = ChunksTailDetails; 14429 exports.DIRECTION = DIRECTION; 14430 exports.HTMLContenteditableMaskElement = HTMLContenteditableMaskElement; 14431 exports.HTMLInputMaskElement = HTMLInputMaskElement; 14432 exports.HTMLMaskElement = HTMLMaskElement; 14433 exports.InputMask = InputMask; 14434 exports.MaskElement = MaskElement; 14435 exports.Masked = Masked; 14436 exports.MaskedDate = MaskedDate; 14437 exports.MaskedDynamic = MaskedDynamic; 14438 exports.MaskedEnum = MaskedEnum; 14439 exports.MaskedFunction = MaskedFunction; 14440 exports.MaskedNumber = MaskedNumber; 14441 exports.MaskedPattern = MaskedPattern; 14442 exports.MaskedRange = MaskedRange; 14443 exports.MaskedRegExp = MaskedRegExp; 14444 exports.PIPE_TYPE = PIPE_TYPE; 14445 exports.PatternFixedDefinition = PatternFixedDefinition; 14446 exports.PatternInputDefinition = PatternInputDefinition; 14447 exports.RepeatBlock = RepeatBlock; 14448 exports.createMask = createMask; 14449 exports.createPipe = createPipe; 14450 exports.default = IMask; 14451 exports.forceDirection = forceDirection; 14452 exports.normalizeOpts = normalizeOpts; 14453 exports.pipe = pipe; 14454 14455 Object.defineProperty(exports, '__esModule', { value: true }); 14456 14457 })); 14458 //# sourceMappingURL=imask.js.map 14459/* End */ 14460; 14461; /* Start:"a:4:{s:4:"full";s:59:"/local/templates/rr-wheels_corp/js/soklib.js?17752023867255";s:6:"source";s:44:"/local/templates/rr-wheels_corp/js/soklib.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 14462sokJSLib = { 14463 childs:[], 14464 ajaxDataType:"json", 14465 //object main functions(methods) section 14466 init:function(options){ 14467 let _this=this 14468 $.each(options, function(i,v){ 14469 _this[i]=v; 14470 }); 14471 this.eventsChecker(); 14472 this.listenersChecker(); 14473 }, 14474 //object events checker method, provides binding functions on events from the "events" property of object 14475 eventsChecker:function(){ 14476 let thisObj=this; 14477 $.each(thisObj.events, function(eventType, eventData) { 14478 $.each(eventData, function(selector, callback){ 14479 if(Array.isArray(callback)){ 14480 $.each(callback, function(index, callbackFunction){ 14481 if(eventType=="load"){ 14482 thisObj[callbackFunction].call($(selector), thisObj); 14483 }else if(eventType=="ready"){ 14484 $(document).ready(function(){ 14485 thisObj[callbackFunction].call($(selector), thisObj); 14486 }); 14487 }else if(eventType=="custom"){ 14488 $(document).off(selector, thisObj[callbackFunction]); 14489 $(document).on(selector, thisObj[callbackFunction]); 14490 }else if(eventType=="scroll"){ 14491 selector=selector=="window"?window:selector; 14492 $(selector).off(eventType, thisObj[callbackFunction]); 14493 $(selector).on(eventType, thisObj[callbackFunction]); 14494 }else if(eventType=="wheel" || eventType=="touchmove"){ 14495 $(selector).off(eventType, { passive: false }, thisObj[callbackFunction]); 14496 $(selector).on(eventType, { passive: false }, thisObj[callbackFunction]); 14497 }else{ 14498 $(document).off(eventType, selector, thisObj[callbackFunction]); 14499 $(document).on(eventType, selector, thisObj[callbackFunction]); 14500 } 14501 }) 14502 }else{ 14503 if(eventType=="load"){ 14504 thisObj[callback].call($(selector), thisObj); 14505 }else if(eventType=="ready"){ 14506 $(document).ready(function(){ 14507 thisObj[callback].call($(selector), thisObj); 14508 }); 14509 }else if(eventType=="custom"){ 14510 $(document).off(selector, thisObj[callback]); 14511 $(document).on(selector, thisObj[callback]); 14512 }else if(eventType=="scroll"){ 14513 selector=selector=="window"?window:selector; 14514 $(selector).off(eventType, thisObj[callback]); 14515 $(selector).on(eventType, thisObj[callback]); 14516 }else if(eventType=="wheel" || eventType=="touchmove"){ 14517 $(selector).off(eventType, { passive: false }, thisObj[callback]); 14518 $(selector).on(eventType, { passive: false }, thisObj[callback]); 14519 }else{ 14520 $(document).off(eventType, selector, thisObj[callback]); 14521 $(document).on(eventType, selector, thisObj[callback]); 14522 } 14523 } 14524 }) 14525 }); 14526 }, 14527 addListener:function(event, params=false, context=false){ 14528 var customEvent=$.Event(event); 14529 if(context) 14530 customEvent.context = context; 14531 $(document).trigger(customEvent, context); 14532 }, 14533 //common ajax request metod 14534 sendRequest: async function(Callback){ 14535 let _this=this; 14536 console.log("Callback", Callback); 14537 console.log("ajaxUrl", _this.ajaxUrl); 14538 console.log("data", this.ajaxParams); 14539 console.log("data_type", _this.ajaxDataType); 14540 let result=new Promise((resolve, reject) =>{ 14541 $.ajax({
14542 url: _this.ajaxUrl, 14543 method: 'POST', 14544 data: this.ajaxParams, 14545 dataType: _this.ajaxDataType, 14546 success: function(data) { 14547 setTimeout(function(){ 14548 _this[Callback](data); 14549 resolve(true); 14550 }, 10); 14551 }, 14552 error: function(xhr, status, error) { // добавлÑем аÑгÑменÑÑ xhr, status и error 14553 console.log('XHR status:', xhr); 14554 console.log('Error status:', status); 14555 console.log('Error message:', error); 14556 resolve(false); 14557 } 14558 }); 14559 }); 14560 return result; 14561 }, 14562 listenersChecker:function(){ 14563 let thisObj=this; 14564 this.Proxy=new Proxy(thisObj, { 14565 set: function(target, prop, value) { 14566 Reflect.set(target, prop, value); 14567 Object.keys(thisObj.propListeners).forEach(function(propName){ 14568 console.log(prop, propName); 14569 if(prop==propName){ 14570 thisObj[thisObj.propListeners[propName]](); 14571 } 14572 }); 14573 } 14574 }) 14575 }, 14576 prepareTemplate:function(data, template, selector=false, insertType="html"){ 14577 let templateHTML=this.templatesHTML[template]; 14578 var $html = $(templateHTML); 14579 this.replaceTemplatePlaceholders($html, data); 14580 this.processSIfAttribute($html, data); 14581 if(selector!==false){ 14582 $(selector)[insertType]($html); 14583 } 14584 else{ 14585 return $html; 14586 } 14587 }, 14588 replaceTemplatePlaceholders: function ($element, data) { 14589 $element.find('*').addBack().each(function() { 14590 var $this = $(this); 14591 var text = $this.text(); 14592 var replacedText = text.replace(/#(\w+)#/g, function(match, key) { 14593 return data[key] !== undefined ? data[key] : match; 14594 }); 14595 if (text !== replacedText) { 14596 $this.text(replacedText); 14597 } 14598 }); 14599 }, 14600 processSIfAttribute: function ($element, data) { 14601 $element.find('[s-if]').each(function() { 14602 var $this = $(this); 14603 var attrKey = $this.attr('s-if'); 14604 if (!this.evaluateCondition(condition, data)) { 14605 $this.remove(); 14606 } else { 14607 $this.removeAttr('s-if'); 14608 var text = $this.text(); 14609 var replacedText = text.replace(/#(\w+)#/g, function(match, key) { 14610 return data[key] !== undefined ? data[key] : match; 14611 }); 14612 $this.text(replacedText); 14613 } 14614 }); 14615 }, 14616 evaluateCondition: function(condition, data) { 14617 const operators = ['==', '!=', '===', '!==', '>', '<', '>=', '<=', '&&', '||']; 14618 let tokens = []; 14619 let currentToken = ''; 14620 for (let char of condition) { 14621 if (operators.some(op => op.startsWith(currentToken + char))) { 14622 currentToken += char; 14623 } else { 14624 if (currentToken) { 14625 tokens.push(currentToken); 14626 currentToken = ''; 14627 } 14628 if (/\s/.test(char)) { 14629 continue; 14630 } 14631 currentToken = char; 14632 } 14633 } 14634 if (currentToken) { 14635 tokens.push(currentToken); 14636 } 14637 for (let i = 0; i < tokens.length; i++) { 14638 let token = tokens[i]; 14639 if (data[token] !== undefined) { 14640 tokens[i] = JSON.stringify(data[token]); 14641 } 14642 } 14643 try { 14644 return new Function('return ' + tokens.join(' '))(); 14645 } catch (e) { 14646 console.error("Invalid condition:", condition); 14647 return false; 14648 } 14649 }, 14650 extend:function (Child) { 14651 object=this; 14652 for(var key in object) { 14653 if(key!="childs") 14654 Child[key]=object[key]; 14655 } 14656 console.log(Child); 14657 //sokJSLib.childs.push(Child.constructor); 14658 }, 14659}; 14660/* End */ 14661; 14662; /* Start:"a:4:{s:4:"full";s:60:"/local/templates/rr-wheels_corp/js/ui-kit.js?177520238610512";s:6:"source";s:44:"/local/templates/rr-wheels_corp/js/ui-kit.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 14663uiKitJS = { 14664 dropdown_timeout: 0, 14665 catalog_btn_timeout: 0, 14666 previousScroll: 0, 14667 currentScroll: $(this).scrollTop(), 14668 events: { 14669 scroll: { 14670 window: "showFixedHeader", 14671 }, 14672 click: { 14673 ".dropdown-click": "dropdownClick",
14674 ".accordion-click .accordion-click__show": "accordionClick", 14675 14676 html: ["disableSelect", "dropdownClickDisable"], 14677 ".input-select__option": "chooseSelect", 14678 ".mobile-menu-modal-container .mobile-menu-modal .header-menu-item-parent .header-menu-top-parent": 14679 "openMobileMenu", 14680 ".mobile-menu-modal-container .mobile-menu-modal .header-menu-dropdown .modal-nav__icon": 14681 "closeMobileMenu", 14682 "a.anchor-item": "scrollToAnchor", 14683 ".tab-item": "showTab", 14684 }, 14685 mouseenter: { 14686 ".dropdown": "dropdownEnter", 14687 }, 14688 mouseleave: { 14689 ".dropdown": "dropdownLeave", 14690 }, 14691 ready: { 14692 document: ["checkFixedHeader", "SelectInit", "checkActiveAccordion"], 14693 }, 14694 }, 14695 AddModalBg: function (event) { 14696 $(".sok--modal").addClass("_active"); 14697 }, 14698 RemoveModalBg: function (event) { 14699 $(".sok--modal").removeClass("_active"); 14700 $(".header").removeClass("z-index"); 14701 }, 14702 dropdownEnter: function () { 14703 //console.log("dropdownEnter"); 14704 clearTimeout(uiKitJS.dropdown_timeout); 14705 $(".dropdown").removeClass("_active"); 14706 $(this).addClass("_active"); 14707 }, 14708 dropdownLeave: function () { 14709 var $this = $(this); 14710 uiKitJS.dropdown_timeout = setTimeout(function () { 14711 $this.removeClass("_active"); 14712 }, 600); 14713 }, 14714 14715 dropdownClick: function (event) { 14716 if ($(event.target).closest(".dropdown-click__content").length) { 14717 return; // ÐÑли клик на доÑеÑнем ÑлеменÑе, ниÑего не делаем 14718 } 14719 14720 if ($(this).hasClass("_active")) { 14721 $(".dropdown-click").removeClass("_active"); 14722 $(this).addClass("_active"); 14723 } else { 14724 $(".dropdown-click").removeClass("_active"); 14725 } 14726 14727 // ТепеÑÑ toggleClass можно оÑÑавиÑÑ Ð´Ð»Ñ Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ ÐºÐ»Ð°ÑÑа к ÑекÑÑÐµÐ¼Ñ ÑлеменÑÑ 14728 $(this).toggleClass("_active"); 14729 }, 14730 accordionClick: function (event) { 14731 //console.log("accordionClick"); 14732 let $accordion = $(this).closest(".accordion-click"); 14733 let $content = $accordion.find(".accordion-click__content"); 14734 14735 // ÐÑовеÑка на оÑкÑÑÑое ÑоÑÑоÑние 14736 if ($accordion.hasClass("_active")) { 14737 // ÐÑли ÑейÑÐ°Ñ Ð¾ÑкÑÑÑо, ÑкÑÑваем конÑÐµÐ½Ñ 14738 $content.css("max-height", "0"); 14739 } else { 14740 $content.css("max-height", $content.prop("scrollHeight") + "px"); 14741 } 14742 $accordion.toggleClass("_active"); 14743 }, 14744 checkActiveAccordion: function (event) { 14745 //console.log("accordionClick"); 14746 let $accordion = $(".accordion-click._active"); 14747 let $content = $accordion.find(".accordion-click__content"); 14748 14749 // ÐÑовеÑка на оÑкÑÑÑое ÑоÑÑоÑние 14750 if ($accordion) { 14751 $content.css("max-height", $content.prop("scrollHeight") + "px"); 14752 } 14753 }, 14754 14755 dropdownClickDisable: function (event) { 14756 if (!$(event.target).closest(".dropdown-click").length) { 14757 $(".dropdown-click").removeClass("_active"); 14758 } 14759 }, 14760 14761 checkFixedHeader: function (event) { 14762 //console.log("checkFixedHeader"); 14763 //console.log("previousScroll", uiKitJS.previousScroll); 14764 //console.log("currentScroll", uiKitJS.currentScroll); 14765 var headerHeight = $(".header").outerHeight(true); 14766 14767 if (uiKitJS.currentScroll > headerHeight) { 14768 uiKitJS.showFixedHeader(uiKitJS.currentScroll, headerHeight); 14769 } 14770 }, 14771 showFixedHeader: function (event) { 14772 //console.log("showFixedHeader"); 14773 uiKitJS.currentScroll = $(this).scrollTop(); 14774 if ($(window).width() <= 992) { 14775 var header = $(".header"); 14776 } else { 14777 var header = $(".header"); 14778 } 14779 var headerHeight = header.outerHeight(true); 14780 if (uiKitJS.currentScroll > headerHeight) { 14781 if (!header.find(".fixed__wrapper").hasClass("_fixed")) { 14782 header.find(".fixed__wrapper").addClass("_fixed"); 14783 } 14784 } else { 14785 if (header.find(".fixed__wrapper").hasClass("_fixed")) { 14786 header.find(".fixed__wrapper").removeClass("_fixed"); 14787 } 14788 } 14789 uiKitJS.previousScroll = uiKitJS.currentScroll; 14790 }, 14791 // SelectInit: function () { 14792 // console.log("SelectInit"); 14793 // $(".input-select select option").each(function () { 14794 // console.log("this", $(this).val()); 14795 // $(this).closest(".input-select").find(".input-select__list").append(` 14796 // <li class="input-select__option" data-value="${$( 14797 // this 14798 // ).val()}">${$(this).text()}</li>`); 14799 // }); 14800 // }, 14801 14802 SelectInit: function () { 14803 $(".input-select").each(function () { 14804 var $block = $(this); 14805 var $select = $block.find("select"); 14806 var $inner = $block.find(".input-select__inner"); 14807 if ($select.length && $inner.length) { 14808 $inner.empty(); 14809 $select.find("option").each(function () { 14810 $inner.append( 14811 '<li class="input-select__option" data-value="' + 14812 $(this).val() + 14813 '" style="'+$(this).attr('style')+'">' + 14814 $(this).html() + 14815 "</li>" 14816 ); 14817 }); 14818 } 14819 });
14820 }, 14821 disableSelect: function (event) { 14822 if (!$(event.target).closest(".input-select").length) { 14823 $(".input-select").removeClass("_active"); 14824 } 14825 }, 14826 chooseSelect: function (event) { 14827 var select = $(this).closest(".input-select"); 14828 select.find("select").val($(this).data("value")); 14829 select.find(".input-select__current").text($(this).text()); 14830 select.removeClass("_active"); 14831 //console.log($(this).closest(".input-select").find("select").val()); 14832 }, 14833 14834 openMobileMenu: function () { 14835 var item = $(this).closest(".header-menu-item"); 14836 var content_container = item.closest(".mobile-menu-modal"); 14837 // ÐолÑÑаем ÑекÑÑее знаÑение ÑÑанÑÑоÑмаÑии 14838 var currentTransform = content_container.css("transform"); 14839 var currentTranslateX = 0; // ÐаÑалÑное знаÑение 14840 14841 // ÐÑовеÑÑем, полÑÑено ли ÑекÑÑее знаÑение ÑÑанÑÑоÑмаÑии 14842 if (currentTransform !== "none") { 14843 // Ðзвлекаем ÑекÑÑее знаÑение `translateX` из маÑÑиÑÑ ÑÑанÑÑоÑмаÑии 14844 var matrix = currentTransform.match(/matrix\(([^)]+)\)/); 14845 if (matrix) { 14846 var values = matrix[1].split(", "); 14847 currentTranslateX = parseFloat(values[4]); // ÐÑо знаÑение Ð´Ð»Ñ translateX в пикÑелÑÑ 14848 } 14849 } 14850 14851 // Так как Ð¼Ñ Ñ Ð¾Ñим ÑабоÑаÑÑ Ñ Ð¿ÑоÑенÑами, пеÑеведем ÑекÑÑее знаÑение в пÑоÑенÑÑ 14852 // Ðажно: вам нÑжно знаÑÑ ÑиÑÐ¸Ð½Ñ ÐºÐ¾Ð½ÑейнеÑа, ÑÑÐ¾Ð±Ñ Ð¿ÑоизвеÑÑи ÑаÑÑÐµÑ Ð² пÑоÑенÑÐ°Ñ . 14853 var containerWidth = content_container.width(); 14854 var newTranslateXPercent = (currentTranslateX / containerWidth) * 100 - 100; // УменÑÑаем на 100% 14855 14856 // ÐÑименÑем новое знаÑение 14857 content_container.css( 14858 "transform", 14859 "translateX(" + newTranslateXPercent + "%)" 14860 ); 14861 14862 // Ðелаем Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼ÑÑ ÑабоÑÑ Ñ Ð²ÑпадаÑÑим Ð¼ÐµÐ½Ñ 14863 var dropdown_menu = item.find(".header-menu-dropdown").first(); 14864 // $(".header-menu-dropdown").removeClass("_active"); 14865 dropdown_menu.closest(".header-menu-dropdown").addClass("_active"); 14866 dropdown_menu.addClass("_active"); 14867 }, 14868 closeMobileMenu: function () { 14869 var content_container = $(this).closest(".mobile-menu-modal"); 14870 14871 // ÐолÑÑаем ÑекÑÑее знаÑение ÑÑанÑÑоÑмаÑии 14872 var currentTransform = content_container.css("transform"); 14873 var currentTranslateX = 0; // ÐаÑалÑное знаÑение 14874 14875 // ÐÑовеÑÑем, полÑÑено ли ÑекÑÑее знаÑение ÑÑанÑÑоÑмаÑии 14876 if (currentTransform !== "none") { 14877 // Ðзвлекаем ÑекÑÑее знаÑение `translateX` из маÑÑиÑÑ ÑÑанÑÑоÑмаÑии 14878 var matrix = currentTransform.match(/matrix\(([^)]+)\)/); 14879 if (matrix) { 14880 var values = matrix[1].split(", "); 14881 currentTranslateX = parseFloat(values[4]); // ÐÑо знаÑение Ð´Ð»Ñ translateX в пикÑелÑÑ 14882 } 14883 } 14884 14885 // ÐеÑеводим ÑекÑÑее знаÑение в пÑоÑенÑÑ 14886 var containerWidth = content_container.width(); 14887 var currentTranslateXPercent = (currentTranslateX / containerWidth) * 100; // ТекÑÑее знаÑение в пÑоÑенÑÐ°Ñ 14888 14889 // УвелиÑиваем `translateX` на 100% 14890 var newTranslateXPercent = currentTranslateXPercent + 100; 14891 14892 // ÐÑименÑем новое знаÑение Ð´Ð»Ñ `translateX` 14893 content_container.css( 14894 "transform", 14895 "translateX(" + newTranslateXPercent + "%)" 14896 ); 14897 14898 // УбиÑаем акÑивнÑй клаÑÑ Ñ Ð²ÑпадаÑÑего Ð¼ÐµÐ½Ñ 14899 $(this).closest(".header-menu-dropdown").removeClass("_active"); 14900 }, 14901 14902 scrollToAnchor: function (event) { 14903 event.preventDefault(); 14904 14905 var anchor = $(this).attr("href"); 14906 //console.log(anchor); 14907 anchor = anchor.replace("#", ""); 14908 var targetSection = $('[data-anchor="' + anchor + '"]'); 14909
14910 if (targetSection.length) { 14911 $("html, body").animate( 14912 { 14913 scrollTop: 14914 targetSection.offset().top - $(".header").outerHeight(true), 14915 }, 14916 600 14917 ); 14918 } 14919 }, 14920 showTab: function (event) { 14921 var anchor = $(this).attr("tab-trigger"); 14922 $("[tab-trigger]").removeClass("_active"); 14923 $(`[tab-trigger='${anchor}']`).addClass("_active"); 14924 var targetSection = $('[data-tab="' + anchor + '"]'); 14925 14926 if (targetSection.length) { 14927 $("[data-tab]").removeClass("_active"); 14928 targetSection.addClass("_active"); 14929 } 14930 }, 14931}; 14932sokJSLib.extend(uiKitJS); 14933uiKitJS.init(); 14934BX.addCustomEvent('onAjaxSuccess', function(){ 14935 //uiKitJS.init(); 14936 setTimeout(function(){ 14937 //console.log('uiKitJS', uiKitJS); 14938 uiKitJS.SelectInit(); 14939 14940 }, 1000); 14941}); 14942 14943/* End */ 14944; 14945; /* Start:"a:4:{s:4:"full";s:59:"/local/templates/rr-wheels_corp/js/formJS.js?17752023867130";s:6:"source";s:44:"/local/templates/rr-wheels_corp/js/formJS.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 14946formJS = { 14947 modal_timeout: 0, 14948 events: { 14949 click: { 14950 ".toggle-password": "showPassword", 14951 14952 ".close_field .close-text": "clearCloseField", 14953 ".change-password--trigger": "showPasswordFields", 14954 ".btn-submit": "validate", 14955 14956 }, 14957 input: { 14958 ".close_field input": "showCloseField", 14959 }, 14960 ready: { 14961 body: "callMasks", 14962 }, 14963 }, 14964 14965 initPhoneMask: function (event) { 14966 const phoneInputs = document.querySelectorAll(".js-phone-mask"); 14967 phoneInputs.forEach((input) => { 14968 IMask(input, { 14969 mask: "+{7}(000)000-00-00", 14970 }); 14971 }); 14972 }, 14973 callMasks: function () { 14974 formJS.initPhoneMask(); 14975 }, 14976 14977 showPassword: function () { 14978 var input = $(this).closest(".password_field").find("input"); 14979 if (input.attr("type") === "text") { 14980 input.attr("type", "password"); 14981 $(this) 14982 .closest(".password_field") 14983 .find(".toggle-password") 14984 .removeClass("password-show"); 14985 } else { 14986 input.attr("type", "text"); 14987 $(this) 14988 .closest(".password_field") 14989 .find(".toggle-password") 14990 .addClass("password-show"); 14991 } 14992 }, 14993 showCloseField: function () { 14994 let close_field = $(this).closest(".close_field"); 14995 if ($(this).val().length > 0) { 14996 close_field.addClass("_fill"); 14997 } else { 14998 close_field.removeClass("_fill"); 14999 } 15000 }, 15001 clearCloseField: function () { 15002 let close_field = $(this).closest(".close_field"); 15003 close_field.find("input").val(""); 15004 close_field.removeClass("_fill"); 15005 }, 15006 15007 showPasswordFields: function (event) { 15008 $(this).closest(".form-container").find("fieldset").removeClass("--hide"); 15009 $(".form-container__nav").hide(); 15010 }, 15011 15012 15013 15014 //ÐалидаÑÐ¸Ñ 15015 InputErrorDraw: function (input, isError) { 15016 const container = input.closest(".input-text, .input-textarea"); 15017 container.toggleClass("input-error", isError); 15018 }, 15019 15020 addError: function (input, message) { 15021 const fieldset = input.closest("fieldset"); 15022 formJS.InputErrorDraw(input, true); 15023 fieldset.find(".text-error").remove(); // УдалÑем пÑедÑдÑÑие оÑибки 15024 fieldset.append(`<span class='text-error'>${message}</span>`); 15025 }, 15026 15027 removeError: function (input) { 15028 formJS.InputErrorDraw(input, false); 15029 input.closest("fieldset").find(".text-error").remove(); 15030 }, 15031 15032 validateField: function (input) { 15033 const value = input.val().trim(); 15034 const type = input.attr("type"); 15035 const name = input.attr("name"); 15036 let isValid = true; 15037 15038 // ÐÑовеÑка на required 15039 if (input.is("[required]") && value === "" && !input.is("[disabled]")) { 15040 const fieldName = input.closest("fieldset").find("label").text(); 15041 formJS.addError(input, `ÐаполниÑе поле ${fieldName}`); 15042 return false; 15043 } 15044 15045 // ÐÑовеÑка Ð´Ð»Ñ Email 15046 if ( 15047 type === "email" && 15048 value !== "" && 15049 !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value) 15050 ) { 15051 formJS.addError(input, "ÐведиÑе коÑÑекÑнÑй email"); 15052 return false; 15053 } 15054 15055 //ÐÑовеÑка паÑÐ¾Ð»Ñ 15056 if (type === "password") { 15057 // const passwordRegex = 15058 // /^[a-zA-Z0-9!@#$%^&*()_+=[\]{};':"\\|,.<>/?-]{6,50}$/; 15059 // if (!passwordRegex.test(value)) { 15060 // formJS.addError(input, "ÐаÑÐ¾Ð»Ñ Ð´Ð¾Ð»Ð¶ÐµÐ½ ÑодеÑжаÑÑ Ð¾Ñ 6 до 50 Ñимволов"); 15061 // return false; 15062 // } 15063 15064 15065 // ÐÑовеÑка ÑÐ¾Ð²Ð¿Ð°Ð´ÐµÐ½Ð¸Ñ Ð¿Ð°Ñолей 15066 if (input.hasClass("password_repeat")) { 15067 const prevPassword = input 15068 .closest("form") 15069 .find('input[type="password"]:not(.password_repeat)') 15070 .val(); 15071 if (prevPassword !== value) { 15072 formJS.addError(input, "ÐаÑоли не ÑовпадаÑÑ"); 15073 return false; 15074 } 15075 } 15076 15077 } 15078 15079 // ÐÑовеÑка ÑелеÑона 15080 if (input.hasClass("js-phone-mask")) { 15081 const digitsOnly = value.replace(/\D/g, ""); 15082 if (digitsOnly.length < 11 && value !== "") { 15083 formJS.addError(input, "ÐведиÑе коÑÑекÑнÑй Ð½Ð¾Ð¼ÐµÑ ÑелеÑона"); 15084 return false; 15085 } 15086 if ( 15087 input.hasClass("check-phone") && 15088 localStorage.getItem("NeedSms") !== null 15089 ) { 15090 formJS.addError(input, "ÐодÑвеÑдиÑе Ð²Ð°Ñ ÑелеÑон"); 15091 return false; 15092 } 15093 } 15094 15095 // ÐÑовеÑка комбинаÑии Email/Phone 15096 if (input.hasClass("js-input-mask-email-phone") && value !== "") { 15097 if (/[a-zA-Z]/.test(value)) { 15098 // ÐÑли ÑÑо email 15099 const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; 15100 if (!emailPattern.test(value)) { 15101 formJS.addError(input, "ÐведиÑе коÑÑекÑнÑй email"); 15102 return false; 15103 } 15104 } else { 15105 // ÐÑли ÑÑо ÑелеÑон 15106 const digitsOnly = value.replace(/\D/g, ""); 15107 if (digitsOnly.length < 11) { 15108 formJS.addError(input, "ÐведиÑе коÑÑекÑнÑй Ð½Ð¾Ð¼ÐµÑ ÑелеÑона"); 15109 return false; 15110 } 15111 } 15112 } 15113 15114 // ÐÑе пÑовеÑки пÑÐ¾Ð¹Ð´ÐµÐ½Ñ 15115 formJS.removeError(input); 15116 return isValid; 15117 }, 15118 15119 validate: function (event) { 15120 const button = $(event.target); 15121 const form = button.closest("form"); 15122 let hasErrors = false; 15123 15124 // УдалÑем пÑедÑдÑÑие оÑибки 15125 form.find(".text-error").remove(); 15126 15127 // ÐÑовеÑÑем каждÑй input/textarea 15128 form 15129 .find("input:not(.validate-skip), textarea:not(.validate-skip)") 15130 .each((_, element) => { 15131 const input = $(element); 15132 if (!formJS.validateField(input)) { 15133 hasErrors = true; // ФикÑиÑÑем налиÑие оÑибок 15134 } 15135 }); 15136 15137 if (hasErrors) { 15138 event.preventDefault(); // ÐлокиÑÑем оÑпÑÐ°Ð²ÐºÑ ÑоÑÐ¼Ñ 15139 } else { 15140 return true; // УÑпеÑÐ½Ð°Ñ Ð¾ÑпÑавка ÑоÑÐ¼Ñ 15141 } 15142 }, 15143}; 15144sokJSLib.extend(formJS); 15145 15146formJS.init(); 15147 15148/* End */ 15149; 15150; /* Start:"a:4:{s:4:"full";s:58:"/local/templates/rr-wheels_corp/js/modal.js?17752023863668";s:6:"source";s:43:"/local/templates/rr-wheels_corp/js/modal.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 15151SokModal = { 15152 modal_timeout: 0, 15153 events: { 15154 click: { 15155 "[data-modal]": "openModalTrigger", 15156 ".modal__overlay": "modalClose", 15157 ".modal-close-trigger": "modalClose", 15158 }, 15159 ready: { 15160 document: "modalInit", 15161 }, 15162 }, 15163 15164 modalClose: function () { 15165 $(".modal__dialog-container").remove(); 15166 SokModal.RemoveModalBg(); 15167 }, 15168 15169 AddModalBg: function (event) { 15170 console.log("AddModalBg"); 15171 $(".sok--modal").addClass("_active"); 15172 SokModal.RemoveTwitching(true); 15173 $("body").addClass("sok--fixed"); 15174 }, 15175 RemoveModalBg: function (event) { 15176 $(".sok--modal").removeClass("_active"); 15177 $(".header").removeClass("z-index"); 15178 SokModal.RemoveTwitching(false); 15179 $("body").removeClass("sok--fixed"); 15180 $(".header-catalog-btn").removeClass("_active"); 15181 }, 15182 modalInit: function () { 15183 console.log('modalInit'); 15184 if (!$("html").find(".sok--modal").length) { 15185 $("body").append( 15186 ` 15187 <div class="sok--modal"> 15188 <div class="modal__overlay"></div> 15189 </div> 15190 ` 15191 ); 15192 } 15193 }, 15194 openModalTrigger: function (event) {
15195 console.log("openModalTrigger"); 15196 event.preventDefault(); 15197 $(".header").removeClass("z-index"); 15198 $(".modal__dialog-container").remove(); 15199 SokModal.AddModalBg(); 15200 SokModal.modalOpen($(this)); 15201 var _this = this; 15202 $(_this).addClass("--disabled"); 15203 SokModal.modal_timeout = setTimeout(function () { 15204 $(_this).removeClass("--disabled"); 15205 }, 1000); 15206 }, 15207 modalOpen: function (el, params) { 15208 console.log("modalOpen"); 15209 this.ajaxDataType = "html"; 15210 if (!params || $.isEmptyObject(params)) { 15211 var name = el.data("modal"); 15212 var url = el.data("url"); 15213 SokModal.newWindow = el.data("modal-top"); 15214 // this.ajaxUrl = url ? url : `/modals/${name}.php`; 15215 this.ajaxUrl = url ? url : `${mainJs.templatePath}/modals/${name}.php`; 15216 this.ajaxParams = 15217 typeof el.data("params") != "undefined" ? el.data("params") : {}; 15218 if (name == "form") { 15219 this.ajaxParams.formId = el.data("form-id"); 15220 this.ajaxParams.formTemplate = typeof el.data("form-template") != "undefined" ? el.data("form-template") : "modal_form"; 15221 } 15222 } else { 15223 this.ajaxUrl = params.url; 15224 this.ajaxParams = params.data; 15225 } 15226 this.sendRequest("updateModalContent"); 15227 }, 15228 updateModalContent: function (response) { 15229 console.log("updateModalContent", response); 15230 var $html = $(response); 15231 $(".sok--modal").append($html); 15232 uiKitJS.SelectInit(); 15233 if ($html.find(".js-phone-mask").length) { 15234 console.log("$html.find( .js-phone-mask"); 15235 formJS.initPhoneMask(); 15236 } 15237 }, 15238 RemoveTwitching: function (state) { 15239 console.log("RemoveTwitching"); 15240 if (state) { 15241 var scrollbarWidth = 15242 window.innerWidth - document.documentElement.clientWidth; 15243 $("body").css("margin-right", scrollbarWidth + "px"); 15244 $(".header .fixed__wrapper._fixed").css("margin-right", scrollbarWidth + "px"); 15245 } else { 15246 $("body").css("margin-right", ""); 15247 $(".header .fixed__wrapper._fixed").css("margin-right", ""); 15248 } 15249 }, 15250}; 15251sokJSLib.extend(SokModal); 15252 15253SokModal.init(); 15254 15255/* End */ 15256; 15257; /* Start:"a:4:{s:4:"full";s:98:"/local/templates/rr-wheels_corp/components/bitrix/form.result.new/default/script.js?17854090512027";s:6:"source";s:83:"/local/templates/rr-wheels_corp/components/bitrix/form.result.new/default/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 15258sokJSLib.extend(SokFormResultNew={ 15259 events: { 15260 submit: { 15261 ".js-form-result-new-ajax": "submitForm", 15262 }, 15263 }, 15264 submitForm: function (e) { 15265 e.preventDefault(); 15266 SokFormResultNew.form = $(this); 15267 if (!SokFormResultNew.validateForm()) { 15268 return; 15269 } 15270 SokFormResultNew.button = SokFormResultNew.form.find("button[type='submit']"); 15271 SokFormResultNew.button.addClass("loading").prop("disabled", true); 15272 var formData = SokFormResultNew.form.serialize(); 15273 SokFormResultNew.ajaxParams = formData + 15274 '&sessid=' + encodeURIComponent(BX.bitrix_sessid()) + 15275 '&signedParams=' + encodeURIComponent(SokFormResultNew.signedParams || '') + 15276 '&siteId=' + encodeURIComponent(SokFormResultNew.siteId || '') + 15277 '&templateName=' + encodeURIComponent(SokFormResultNew.templateName || '') + 15278 '&web_form_submit=' + encodeURIComponent('submit'); 15279 SokFormResultNew.sendRequest("submitFormCallback"); 15280 }, 15281 submitFormCallback: function (data) { 15282 var $container = SokFormResultNew.form.closest('.sok--modal-content, .form-container'); 15283 if ($container.length) { 15284 $container.html(data.html); 15285 } else { 15286 SokFormResultNew.form.replaceWith(data.html); 15287 } 15288 }, 15289 validateForm: function () { 15290 var isValid = true; 15291 SokFormResultNew.form.find('input[required]').each(function(){ 15292 if (!$(this).val().trim()) { 15293 isValid = false;
15294 $(this).addClass('error'); 15295 } else { 15296 $(this).removeClass('error'); 15297 } 15298 }); 15299 var $personalData = SokFormResultNew.form.find('#personal-data'); 15300 if ($personalData.length && !$personalData.is(':checked')) { 15301 isValid = false; 15302 alert('ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ ÑоглаÑиÑÑÑÑ Ð½Ð° обÑабоÑÐºÑ Ð¿ÐµÑÑоналÑнÑÑ Ð´Ð°Ð½Ð½ÑÑ '); 15303 } 15304 return isValid; 15305 }, 15306}); 15307/* End */ 15308; 15309; /* Start:"a:4:{s:4:"full";s:59:"/local/templates/rr-wheels_corp/js/alerts.js?17752023862036";s:6:"source";s:44:"/local/templates/rr-wheels_corp/js/alerts.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 15310alertsJS = { 15311 events: { 15312 ready: { 15313 body: "initAlerts", 15314 }, 15315 click: { 15316 ".alert-close--trigger": "alertClose", 15317 } 15318 }, 15319 15320 alertClose: function () { 15321 let alerts = $(this).closest(".alert-messages"); 15322 let alert = $(this).closest(".alert-message"); 15323 alert.remove(); 15324 if (!$(".alert-messages .alert-message").length > 0) { 15325 alerts.remove(); 15326 } 15327 }, 15328 initAlerts: function () { 15329 $("body").prepend(`<div class="alert-messages"></div>`); 15330 let alerts = $(".alert-messages"); 15331 console.log('alertsJS ', alertsJS); 15332 15333 alertsJS.arResultItems.forEach((alert, index) => { 15334 console.log("alert", alert); 15335 alerts.addClass("_active"); 15336 alerts.append(` 15337 <div class="alert-message ${alert.TYPE}"> 15338 <div class="sok__container"> 15339 <div class="alert-message__content"> 15340 <div class="alert-message__inner">${alert.TEXT_HTML}</div> 15341 <div class="alert-message__close alert-close--trigger"> 15342 <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none"> 15343 <path d="M19.3479 11.9861L11.8054 19.5286C11.545 19.7889 11.545 20.2111 11.8054 20.4714C12.0657 20.7318 12.4878 20.7318 12.7482 20.4714L20.2907 12.9289C20.551 12.6686 20.551 12.2465 20.2907 11.9861C20.0303 11.7258 19.6082 11.7258 19.3479 11.9861Z" fill="#F5F8FA" /> 15344 <path d="M12.6521 11.9861L20.1946 19.5286C20.455 19.7889 20.455 20.2111 20.1946 20.4714C19.9343 20.7318 19.5122 20.7318 19.2518 20.4714L11.7093 12.9289C11.449 12.6686 11.449 12.2465 11.7093 11.9861C11.9697 11.7258 12.3918 11.7258 12.6521 11.9861Z" fill="#F5F8FA" /> 15345 </svg> 15346 </div> 15347 </div></div></div> 15348 `) 15349 }); 15350 }, 15351}; 15352/* End */ 15353; 15354; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/rr-wheels_corp/js/notification.js?17752023861838";s:6:"source";s:50:"/local/templates/rr-wheels_corp/js/notification.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 15355// Ðогика Ñведомлений (заимÑÑвовано из Sowa/main.js) 15356// ÐÑедполагаеÑÑÑ Ð½Ð°Ð»Ð¸Ñие jQuery и конÑейнеÑа .notification-container на ÑÑÑаниÑе 15357(function () { 15358 let notificationTimeout = 0; 15359 15360 function showNotification(name) { 15361 $.ajax({ 15362 url: mainJs.templatePath + `/notifications/${name}.php`, 15363 method: "GET", 15364 dataType: "html", 15365 success: function (response) { 15366 updateNotificationContent(response); 15367 }, 15368 }); 15369 } 15370 15371 function updateNotificationContent(response) { 15372 const $html = $(response); 15373 $(".notification-container").append($html); 15374 setTimeout(function () { 15375 $html.addClass("show"); 15376 }, 10); 15377 notificationTimeout = setTimeout(function () { 15378 $html.addClass("fade-out"); 15379 setTimeout(function () { 15380 $html.remove(); 15381 }, 500); 15382 }, 3000); 15383 } 15384 15385 function notificationEnter() { 15386 clearTimeout(notificationTimeout); 15387 $(this).removeClass("fade-out"); 15388 } 15389 15390 function notificationLeave() { 15391 const $this = $(this); 15392 notificationTimeout = setTimeout(function () { 15393 $this.addClass("fade-out"); 15394 setTimeout(function () { 15395 $this.remove(); 15396 }, 500); 15397 }, 3000); 15398 } 15399 15400 // ÐелегиÑование ÑобÑÑий Ð´Ð»Ñ Ð´Ð¸Ð½Ð°Ð¼Ð¸ÑеÑки добавлÑемÑÑ Ñведомлений 15401 $(document).on("mouseenter", ".notification", notificationEnter); 15402 $(document).on("mouseleave", ".notification", notificationLeave); 15403
15404 // ÐкÑпоÑÑ Ð² глобал Ð´Ð»Ñ Ð²Ñзова: notification.showNotification('cart-add') 15405 window.notification = { 15406 showNotification, 15407 }; 15408})(); 15409 15410 15411/* End */ 15412; 15413; /* Start:"a:4:{s:4:"full";s:60:"/local/templates/rr-wheels_corp/js/catalog.js?17752023867824";s:6:"source";s:45:"/local/templates/rr-wheels_corp/js/catalog.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 15414catalogJS = { 15415 // ФÑнкÑии Ð´Ð»Ñ ÑабоÑÑ Ñ ÐºÑками 15416 setCookie: function(name, value, days) { 15417 var expires = ""; 15418 if (days) { 15419 var date = new Date(); 15420 date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); 15421 expires = "; expires=" + date.toUTCString(); 15422 } 15423 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 15424 }, 15425 getCookie: function(name) { 15426 var nameEQ = name + "="; 15427 var ca = document.cookie.split(";"); 15428 for (var i = 0; i < ca.length; i++) { 15429 var c = ca[i]; 15430 while (c.charAt(0) == " ") c = c.substring(1, c.length); 15431 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); 15432 } 15433 return null; 15434 }, 15435 15436 events: { 15437 change: { 15438 ".catalog-filter-param": "selectFilterParams", 15439 }, 15440 click: { 15441 ".catalog-filter-param .input-select__option": "selectFilterParams", 15442 ".catalog-filter-param .delete_filter": "deleteFilterParams", 15443 15444 ".filter-container .catalog-filter-bottom .sok__btn-opacity": 15445 "resetFilter", 15446 ".catalog-filter-param .filter-list .input-checkbox, .catalog-filter-param .filter-list .input-radio, .catalog-filter-param .input-select__option": 15447 "addFilterParamsText", 15448 ".catalog-top__buttons .catalog-top__button": "toggleCatalogShowType", 15449 ".dropdown-click._sort .dropdown-click__content li": "selectSort", 15450 ".content-nav .pagination .pagination__btn": "paginationLoader", 15451 }, 15452 }, 15453 15454 // toggleCatalogShowType: function () { 15455 // $(".catalog-list__view .catalog-list__items").addClass("_hide"); 15456 // if ($(this).hasClass("_tile")) { 15457 // $(".catalog-list__view .catalog-list__items._tile").removeClass("_hide"); 15458 // } else if ($(this).hasClass("_list")) { 15459 // $(".catalog-list__view .catalog-list__items._list").removeClass("_hide"); 15460 // } 15461 // $(".catalog-top__buttons .catalog-top__button").removeClass("_active"); 15462 // $(this).addClass("_active"); 15463 // }, 15464 toggleCatalogShowType: function () { 15465 console.log("rrrrwwwr", $(this)); 15466 var viewType = ""; 15467 if ($(this).hasClass("_tile")) { 15468 $(".catalog-list__view .catalog-list__items").removeClass("_list").addClass("_tile"); 15469 viewType = "_tile"; 15470 } else if ($(this).hasClass("_list")) { 15471 $(".catalog-list__view .catalog-list__items").removeClass("_tile").addClass("_list"); 15472 viewType = "_list"; 15473 } 15474 $(".catalog-top__buttons .catalog-top__button").removeClass("_active"); 15475 $(this).addClass("_active"); 15476 15477 // Ð¡Ð¾Ñ ÑанÑем вÑбÑаннÑй Ñип оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð² кÑки (на 365 дней) 15478 if (viewType) { 15479 catalogJS.setCookie("catViewType", viewType, 365); 15480 } 15481 }, 15482 15483 // ÐниÑиализаÑÐ¸Ñ Ñипа оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð¸Ð· кÑки 15484 initCatalogViewType: function () { 15485 var savedViewType = catalogJS.getCookie("catViewType"); 15486 if (savedViewType === "_tile" || savedViewType === "_list") { 15487 $(".catalog-list__view .catalog-list__items").removeClass("_tile _list").addClass(savedViewType); 15488 $(".catalog-top__buttons .catalog-top__button").removeClass("_active"); 15489 $(".catalog-top__buttons .catalog-top__button." + savedViewType).addClass("_active"); 15490 } 15491 }, 15492 resetFilter: function (event) { 15493 let params = $(this) 15494 .closest(".catalog-filter") 15495 .find(".catalog-filter-param"); 15496 params.removeClass("_select"); 15497 15498 params.find(".filter-param-title span").empty(""); 15499 }, 15500 // ÐÑли вÑбÑÐ°Ð½Ñ Ð¿Ð°ÑамеÑÑÑ ÑилÑÑÑа 15501 selectFilterParams: function (event) { 15502 var $parent = $(this); 15503 console.log("selectFilterParams", $parent); 15504 console.log("val", $(this).val()); 15505 15506 // ÐÑовеÑÑем налиÑие оÑмеÑеннÑÑ checkbox, radio и вÑбÑаннÑÑ Ð·Ð½Ð°Ñений select 15507 var hasCheckedInput = 15508 $parent.find("input[type='checkbox']:checked").length > 0 || 15509 $parent.find("input[type='radio']:checked").length > 0; // ÐÑовеÑÑем знаÑение select 15510 var hasSelected = 15511 $(this).closest(".catalog-filter-param").find("select").val() !== null; 15512 15513 // ÐобавлÑем или ÑбиÑаем клаÑÑ _select в завиÑимоÑÑи Ð¾Ñ Ð½Ð°Ð»Ð¸ÑÐ¸Ñ Ð²ÑделеннÑÑ Ð¸Ð½Ð¿ÑÑов 15514 if (hasCheckedInput) { 15515 $parent.addClass("_select"); 15516 } else if (hasSelected) { 15517 $(this).closest(".catalog-filter-param").addClass("_select"); 15518 } else { 15519 $parent.removeClass("_select"); // УбиÑаем клаÑÑ, еÑли ни один инпÑÑ Ð½Ðµ оÑмеÑен 15520 } 15521 }, 15522 addFilterParamsText: function (event) { 15523 let $parent = $(this).closest(".catalog-filter-param"); 15524 let param_inputs = $parent.find( 15525 "input[type='checkbox']:checked, input[type='radio']:checked" 15526 ); 15527 15528 // ÐолÑÑаем ÑекÑÑ Ð´Ð»Ñ ÑекбокÑов и Ñадио 15529 let param_texts = param_inputs 15530 .closest(".input-checkbox, input-radio") 15531 .find("span") 15532 .map(function () { 15533 return $(this).text().trim(); 15534 }) 15535 .get(); 15536 15537 // ÐобавлÑем вÑбÑаннÑе знаÑÐµÐ½Ð¸Ñ Ð¸Ð· select 15538 let selectTexts = $parent 15539 .find("select option:selected") 15540 .map(function () { 15541 return $(this).text().trim(); 15542 }) 15543 .get(); 15544 console.log("selectTexts", selectTexts); 15545 // ÐбÑединÑем ÑекÑÑ Ð¸Ð· инпÑÑов и select 15546 let final_param_text = param_texts.concat(selectTexts).join(", "); 15547 15548 if (final_param_text.length) { 15549 $parent.find(".filter-param-title span").text(": " + final_param_text); 15550 } else { 15551 $parent.find(".filter-param-title span").empty(""); 15552 } 15553 console.log("param_text", final_param_text); // ÐÑпÑавлено Ð´Ð»Ñ ÐºÐ¾ÑÑекÑного логиÑÐ¾Ð²Ð°Ð½Ð¸Ñ 15554 }, 15555 deleteFilterParams: function (event) { 15556 event.stopPropagation(); 15557 var $parent = $(this).closest(".catalog-filter-param"); 15558 15559 // Снимаем вÑделение Ñ checkbox 15560 $parent.find("input[type='checkbox']").prop("checked", false); 15561 15562 // ÐÐ»Ñ radio (dropdown): оÑмеÑаем опÑÐ¸Ñ Â«ÐÑе» 15563 var $radios = $parent.find("input[type='radio']"); 15564 if ($radios.length) { 15565 $radios.prop("checked", false); 15566 $parent.find('input[type="radio"][id^="all_"]').prop("checked", true); 15567 } 15568 15569 // СбÑаÑÑваем select 15570 var $selects = $parent.find("select"); 15571 $selects.each(function () { 15572 $(this).val(""); 15573 var $block = $(this).closest(".input-select"); 15574 var $span = $block.find(".input-select__current"); 15575 if ($span.length) $span.text(""); 15576 }); 15577 15578 $parent.removeClass("_select"); 15579 $parent.find(".filter-param-title span").empty(""); 15580 $parent.find("[data-role='currentOption']").text(""); 15581 15582 // ÐапÑÑкаем обновление ÑилÑÑÑа (AJAX-запÑÐ¾Ñ Ð¸ пеÑеÑÑÑÑ) 15583 if (typeof smartFilter !== "undefined") { 15584 smartFilter.reload(this); 15585 } 15586 }, 15587 selectSort: function (event) { 15588 let dropdown = $(this).closest(".dropdown-click"); 15589 let text_show = dropdown.find(".dropdown-click__show span"); 15590 text_show.text($(this).text()); 15591 }, 15592 15593 paginationLoader: function () { 15594 console.log("paginationLoader"); 15595 clearTimeout(loading); 15596 var $this = $(this); 15597 $this 15598 .closest(".catalog-list__content") 15599 .find(".ajax-load") 15600 .addClass("loading-state-before"); 15601 var loading = setTimeout(function () { 15602 $this 15603 .closest(".catalog-list__content") 15604 .find(".ajax-load") 15605 .removeClass("loading-state-before"); 15606 }, 2000); 15607 }, 15608}; 15609 15610sokJSLib.extend(catalogJS); 15611catalogJS.init(); 15612 15613// ÐоÑÑÑанавливаем Ñип оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð¸Ð· кÑки пÑи загÑÑзке ÑÑÑаниÑÑ 15614// $(document).ready(function() { 15615// catalogJS.initCatalogViewType(); 15616// }); 15617 15618/* End */ 15619; 15620; /* Start:"a:4:{s:4:"full";s:59:"/local/templates/rr-wheels_corp/js/y-map.js?177520238611269";s:6:"source";s:43:"/local/templates/rr-wheels_corp/js/y-map.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 15621contactsList = { 15622 page_scroll_timeout: 0, 15623 events: { 15624 load: { 15625 window: "initMaps", 15626 }, 15627 scroll: { 15628 window: "mapsDisabled", 15629 }, 15630 click: {}, 15631 }, 15632 initMaps: function () {
15633 contactsList.arResultItems.forEach((map, index) => { 15634 console.log("map", map); 15635 // ÐÑзÑваем ÑÑнкÑÐ¸Ñ initMap Ñ Ð¿Ð¾Ð´Ð³Ð¾ÑовленнÑми паÑамеÑÑами 15636 contactsList.initMap(map, index); 15637 }); 15638 }, 15639 mapsDisabled: function () { 15640 console.log("scrollll"); 15641 $(".y-map").addClass("--disabled"); 15642 15643 clearTimeout(contactsList.page_scroll_timeout); 15644 15645 contactsList.page_scroll_timeout = setTimeout(function () { 15646 $(".y-map").removeClass("--disabled"); 15647 }, 300); 15648 }, 15649 getBounds: function (coordinates) { 15650 console.log("getBounds"); 15651 let minLat = Infinity, 15652 minLng = Infinity; 15653 let maxLat = -Infinity, 15654 maxLng = -Infinity; 15655 15656 for (const coords of coordinates) { 15657 const lat = coords[1]; 15658 const lng = coords[0]; 15659 15660 if (lat < minLat) minLat = lat; 15661 if (lat > maxLat) maxLat = lat; 15662 if (lng < minLng) minLng = lng; 15663 if (lng > maxLng) maxLng = lng; 15664 } 15665 15666 return [ 15667 [minLng, minLat], 15668 [maxLng, maxLat], 15669 ]; 15670 }, 15671 circle: function (count) { 15672 const circle = document.createElement("div"); 15673 circle.classList.add("ymap-circle"); 15674 circle.innerHTML = ` 15675 <div class="circle-content"> 15676 <span class="circle-text">${count}</span> 15677 </div> 15678 `; 15679 return circle; 15680 }, 15681 // ФÑнкÑÐ¸Ñ ÑоздаÑÑ ÑодеÑжимое tip Ð´Ð»Ñ Ð¼Ð°ÑкеÑа 15682 createTipContent: function (markerData) { 15683 const title = markerData.TIP_TITLE 15684 ? `<div class="marker-title">${markerData.TIP_TITLE}</div>` 15685 : ""; 15686 const items = markerData.TIP_ITEMS 15687 ? markerData.TIP_ITEMS.map( 15688 (item) => 15689 `<div class="marker-text-item"> 15690 <div class="marker-text-item-title">${item.ITEM_NAME}:</div> 15691 <div class="marker-text-item-text">${item.ITEM_VALUE}</div> 15692 </div>` 15693 ).join("") 15694 : '<div class="marker-text-item"><div class="marker-text-item-text">ÐÐµÑ Ð´Ð¾Ð¿Ð¾Ð»Ð½Ð¸ÑелÑной инÑоÑмаÑии</div></div>'; 15695 return ` 15696 <div class="tip_close"> 15697 <img class="" src="${contactsList.templateFolder}/img/icons/modal-close.svg"> 15698 </div> 15699 <div class="marker-content"> 15700 ${title} 15701 ${items} 15702 </div> 15703 `; 15704 }, 15705 createTipSaleOrder: function (markerData) { 15706 const title = markerData.TIP_TITLE 15707 ? `<div class="marker-title">${markerData.TIP_TITLE}</div>` 15708 : ""; 15709 const items = markerData.TIP_ITEMS 15710 ? markerData.TIP_ITEMS.map( 15711 (item) => 15712 `<div class="marker-text-item"> 15713 <div class="marker-text-item-title">${item.ITEM_NAME}:</div> 15714 <div class="marker-text-item-text">${item.ITEM_VALUE}</div> 15715 </div>` 15716 ).join("") 15717 : '<div class="marker-text-item"><div class="marker-text-item-text">ÐÐµÑ Ð´Ð¾Ð¿Ð¾Ð»Ð½Ð¸ÑелÑной инÑоÑмаÑии</div></div>'; 15718 return ` 15719 <div class="tip_close"> 15720 <img class="" src="${contactsList.templateFolder}/img/icons/modal-close.svg"> 15721 </div> 15722 <div class="marker-content"> 15723 ${title} 15724 ${items} 15725 <div class="sok__btn-primary sok__btn--sm w-max make-order-address-choose"> 15726 <span>ÐÑбÑаÑÑ</span> 15727 </div> 15728 </div> 15729 `; 15730 }, 15731 15732 initMap: async function (params, map_index) { 15733 console.log("initMap", params); 15734 await ymaps3.ready; 15735 const { 15736 YMap, 15737 YMapListener, 15738 YMapDefaultSchemeLayer, 15739 YMapMarker, 15740 YMapLayer, 15741 YMapFeatureDataSource, 15742 } = ymaps3; 15743 const { YMapClusterer, clusterByGrid } = await ymaps3.import( 15744 "@yandex/[email protected]" 15745 ); 15746 let center = params.PARAMS.map_location; 15747 let zoom = params.PARAMS.zoomMap; 15748 15749 const map = new YMap(document.getElementById(`y-map-${map_index}`), { 15750 location: { 15751 center: center, 15752 zoom: zoom,
15753 }, 15754 behaviors: ["drag", "dblClickZoom", "scrollZoom", "pinchZoom"], 15755 }); 15756 var jsArray = params.MARKERS.map((item) => { 15757 // РазделÑем кооÑдинаÑÑ Ð´Ð»Ñ Ð¿Ð¾Ð»ÑÑÐµÐ½Ð¸Ñ ÑиÑоÑÑ Ð¸ долгоÑÑ 15758 var coords = item.YMAP_COORDS.VALUE.split(","); 15759 15760 // ÐÑеобÑазÑем ÑвойÑÑва в маÑÑив обÑекÑов 15761 var tipItems = item.PROPERTIES.map((prop) => ({ 15762 ITEM_NAME: prop.NAME ? prop.NAME : "Ðе Ñказан", 15763 ITEM_VALUE: prop.VALUE ? prop.VALUE : "Ðе Ñказан", 15764 })); 15765 15766 return { 15767 UF_LATITUDE: coords[0].trim(), // ШиÑоÑа 15768 UF_LONGITUDE: coords[1].trim(), // ÐолгоÑа 15769 MARKER_TYPE: item.MARKER_TYPE, // ÐолгоÑа 15770 TIP_TITLE: item.NAME, 15771 TIP_ITEMS: tipItems, // ÐÑполÑзÑем пÑеобÑазованнÑй маÑÑив ÑвойÑÑв 15772 }; 15773 }); 15774 console.log("jsArray", jsArray); 15775 //Создание маÑÑива ÑоÑек Ð´Ð»Ñ ÐºÐ»Ð°ÑÑеÑизаÑии 15776 const features = jsArray.map((markerData) => [ 15777 markerData.UF_LONGITUDE, 15778 markerData.UF_LATITUDE, 15779 ]); 15780 console.log("features", features); 15781 map 15782 .addChild(new YMapDefaultSchemeLayer()) 15783 .addChild(new YMapFeatureDataSource({ id: "my-source" })) 15784 .addChild( 15785 new YMapLayer({ source: "my-source", type: "markers", zIndex: 1800 }) 15786 ) 15787 .addChild( 15788 new YMapListener({ 15789 layer: "any", 15790 onActionEnd: () => { 15791 window.clusterer.update({ 15792 features: features.map((lnglat, i) => { 15793 return { 15794 type: "Feature", 15795 id: "marker-id-" + lnglat.join("-"), 15796 geometry: { coordinates: lnglat }, 15797 properties: { name: "Point of issue of orders" }, 15798 }; 15799 }), 15800 }); 15801 map.update(); 15802 }, 15803 }) 15804 ); 15805 15806 const points = features.map((lnglat, i) => { 15807 const markerData = jsArray[i]; // Ðзвлекаем даннÑе конкÑеÑного маÑкеÑа из маÑÑива 15808 return { 15809 type: "Feature", 15810 id: "marker-id-" + lnglat.join("-"), 15811 geometry: { coordinates: lnglat }, 15812 properties: { 15813 name: markerData.TIP_TITLE || "Point of issue of orders", 15814 }, 15815 }; 15816 }); 15817 15818 const marker = (feature) => { 15819 const index = jsArray.findIndex( 15820 (item) => 15821 item.UF_LATITUDE === feature.geometry.coordinates[1] && 15822 item.UF_LONGITUDE === feature.geometry.coordinates[0] 15823 ); 15824 15825 15826 // ÐлониÑÑем конÑÐµÐ¹Ð½ÐµÑ Ð¸ изменÑем его ÑодеÑжимое 15827 const tip_container = document.createElement("div"); 15828 tip_container.classList.add("marker-container"); 15829 15830 const icon = document.createElement("img"); 15831 icon.classList.add("ymap-tip"); 15832 icon.src = contactsList.templateFolder + "/img/icons/map-pin-line-2.svg"; 15833 15834 const tip = document.createElement("div"); 15835 tip.classList.add("marker-tip-container"); 15836 tip.classList.add("_hide"); 15837 tip.setAttribute("data-id", index); 15838 if (jsArray[0].MARKER_TYPE == "contacts") { 15839 tip.innerHTML = contactsList.createTipContent(jsArray[0]); 15840 } else if (jsArray[0].MARKER_TYPE == "sale") { 15841 tip.innerHTML = contactsList.createTipSaleOrder(jsArray[0]); 15842 } 15843 console.log("index", index); 15844 // Ðобавление ÑлеменÑов в конÑÐµÐ¹Ð½ÐµÑ 15845 tip_container.appendChild(icon); 15846 tip_container.appendChild(tip); 15847 15848 return new ymaps3.YMapMarker( 15849 { 15850 coordinates: feature.geometry.coordinates, 15851 source: "my-source", 15852 }, 15853 tip_container 15854 ); 15855 }; 15856 const cluster = (coordinates, features) => 15857 new ymaps3.YMapMarker( 15858 { 15859 coordinates, 15860 source: "my-source", 15861 onClick() { 15862 const bounds = contactsList.getBounds( 15863 features.map((feature) => feature.geometry.coordinates) 15864 ); 15865 console.log("bounds", bounds); 15866 map.update({ 15867 location: { bounds, ...contactsList.COMMON_LOCATION_PARAMS }, 15868 }); 15869 }, 15870 }, 15871 contactsList.circle(features.length).cloneNode(true) 15872 ); 15873 window.clusterer = new YMapClusterer({
15874 method: clusterByGrid({ gridSize: 64 }), 15875 features: points, 15876 marker, 15877 cluster, 15878 }); 15879 15880 map.addChild(window.clusterer); 15881 15882 $(document).on("click", `#y-map-${map_index} .ymap-tip`, function (event) { 15883 $(".marker-tip-container").addClass("_hide"); 15884 $(".y-map").addClass("--disabled"); 15885 $(this).closest(".y-map").removeClass('--disabled'); 15886 $(".marker-tip-container").closest(".ymaps3x0--marker").css("z-index", 1); 15887 console.log("ymap-tip"); 15888 15889 var marker_index = $(this).closest(".ymaps3x0--marker"); 15890 marker_index.css("z-index", 2); 15891 var data_id = $(this) 15892 .closest(".marker-container") 15893 .find(".marker-tip-container") 15894 .data("id"); 15895 var UF_LATITUDE = jsArray[data_id].UF_LATITUDE; 15896 var UF_LONGITUDE = jsArray[data_id].UF_LONGITUDE; 15897 map.update({ 15898 location: { 15899 center: [UF_LONGITUDE, UF_LATITUDE], 15900 zoom: 16, 15901 ...contactsList.COMMON_LOCATION_PARAMS, 15902 }, 15903 behaviors: ["drag:false", "scrollZoom:false", "pinchZoom :false"], 15904 }); 15905 $(this) 15906 .closest(".marker-container") 15907 .find(".marker-tip-container") 15908 .removeClass("_hide"); 15909 }); 15910 15911 15912 $(document).on( 15913 "click", 15914 `#coords-map-${map_index}.show-on-map`, 15915 function (event) { 15916 console.log('show-on-map', params); 15917 var coords = $(this).data("coordinates").split(",").map(Number); 15918 try { 15919 map.update({ 15920 location: { 15921 center: coords, 15922 zoom: 16, 15923 ...params.PARAMS.COMMON_LOCATION_PARAMS, // ÐÑпÑавлено 15924 }, 15925 }); 15926 } catch (error) { 15927 console.error("ÐÑибка Ð¾Ð±Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ ÐºÐ°ÑÑÑ: ", error); 15928 } 15929 } 15930 ); 15931 15932 $(document).on( 15933 "click", 15934 `#y-map-${map_index} .marker-tip-container .tip_close`, 15935 function (event) { 15936 console.log("tip_close"); 15937 $(this) 15938 .closest(".marker-container") 15939 .find(".marker-tip-container") 15940 .addClass("_hide"); 15941 $(".y-map").removeClass("--disabled"); 15942 map.update({ 15943 behaviors: ["drag", "scrollZoom", "pinchZoom"], 15944 }); 15945 } 15946 ); 15947 }, 15948}; 15949 15950/* End */ 15951; 15952; /* Start:"a:4:{s:4:"full";s:57:"/local/templates/rr-wheels_corp/js/main.js?17752023863881";s:6:"source";s:42:"/local/templates/rr-wheels_corp/js/main.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 15953mainJs = { 15954 templatePath:"", 15955 events: { 15956 click: { 15957 "a[href^='mailto:']": "copyEmail", 15958 ".catalog-card .product-counter .product-counter__control": "changeCountCart", 15959 ".cart-btn": "CartAdd", 15960 }, 15961 change: { 15962 //".product-counter .input-text": "changeCountCart", 15963 }, 15964 }, 15965 15966 changeCountCart: function () { 15967 console.log("changeCountCart"); 15968 let counter = $(this).closest(".product-counter"); 15969 let cart_btn = counter.find(".cart-btn"); 15970 let input = counter.find("input"); 15971 let cart_container = $(this).closest(".product-counter"); 15972 let currentValue = parseInt(input.val(), 10) || 0; 15973 let ratio,realRatio = cart_btn.data("ratio"); 15974 let step = $(this).data("step"); 15975 ratio = ratio>1?ratio:step>1?step:1; 15976 15977 var newValue = mainJs.changeQuantityBtnAction($(this).hasClass("_plus"), currentValue, ratio); 15978 let maxQuantity = cart_btn.data("max-quantity"); 15979 if(newValue >= maxQuantity){ 15980 console.log("newValue >= maxQuantity"); 15981 newValue = maxQuantity; 15982 //newValue = newValue%ratio==0?newValue:Math.floor(newValue / ratio) * ratio; 15983 }else{ 15984 if(realRatio > 1) 15985 newValue = newValue%ratio==0?newValue:Math.ceil(newValue / ratio) * ratio; 15986 else 15987 newValue = newValue%ratio==0?newValue:Math.floor(newValue / ratio) * ratio; 15988 } 15989 15990 input.val(newValue); 15991 mainJs.toggleCounter(counter, cart_btn, newValue); 15992 15993 mainJs.addListener("changeQuantityBtn", input, input); 15994 15995 }, 15996 changeQuantityBtnAction: function (isPlus, currentValue, ratio = 1) { 15997 if (isPlus) { 15998 return Math.max(0, currentValue + ratio); 15999 } else { 16000 return Math.max(0, currentValue - ratio); 16001 } 16002 }, 16003 toggleCounter: function(counter, basketBtn, quantity) { 16004 if (quantity == 0 && counter.hasClass("_active") && basketBtn.hasClass("_active")) { 16005 counter.removeClass("_active"); 16006 basketBtn.removeClass("_active"); 16007 } else { 16008 counter.addClass("_active"); 16009 basketBtn.addClass("_active"); 16010 } 16011 }, 16012
16013 copyEmail: function (e) { 16014 e.preventDefault(); 16015 var href = $(this).attr("href") || ""; 16016 var email = href.replace(/^(mailto:)+/i, "").split("?")[0].trim(); 16017 if (!email) return; 16018 var showCopied = function () { 16019 var $toast = $('<div class="notification"><div class="notification__content"><div class="notification__top"><svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none"><path d="M19.9997 36.6667C10.7949 36.6667 3.33301 29.2047 3.33301 20C3.33301 10.7952 10.7949 3.33333 19.9997 3.33333C29.2043 3.33333 36.6663 10.7952 36.6663 20C36.6663 29.2047 29.2043 36.6667 19.9997 36.6667ZM18.3373 26.6667L30.1225 14.8815L27.7655 12.5245L18.3373 21.9527L13.6234 17.2385L11.2663 19.5957L18.3373 26.6667Z" fill="#21BA4C" fill-opacity="0.83"/></svg><div class="notification__text">Email ÑкопиÑован в бÑÑÐµÑ Ð¾Ð±Ð¼ÐµÐ½Ð°</div></div></div></div>'); 16020 $(".notification-container").append($toast); 16021 setTimeout(function () { $toast.addClass("show"); }, 10); 16022 setTimeout(function () { 16023 $toast.addClass("fade-out"); 16024 setTimeout(function () { $toast.remove(); }, 500); 16025 }, 2500); 16026 }; 16027 if (navigator.clipboard && navigator.clipboard.writeText) { 16028 navigator.clipboard.writeText(email).then(showCopied); 16029 } else { 16030 var tmp = $("<input>").val(email).appendTo("body").select(); 16031 document.execCommand("copy"); 16032 tmp.remove(); 16033 showCopied(); 16034 } 16035 }, 16036 16037 CartAdd: function () { 16038 // var counter = $(this).closest(".product-counter"); 16039 // var input = counter.find("input"); 16040 // var productCount = parseInt(input.val(), 10) || 0; 16041 // var ratio = $(this).data("ratio"); 16042 // var newProductCount = productCount + ratio; 16043 // input.val(newProductCount); 16044 // mainJs.toggleCounter(counter, $(this), newProductCount); 16045 16046 }, 16047}; 16048sokJSLib.extend(mainJs); 16049 16050 16051/* End */ 16052; 16053; /* Start:"a:4:{s:4:"full";s:77:"/local/templates/rr-wheels_corp/js/modules/sale-order-ajax.js?177520238643645";s:6:"source";s:61:"/local/templates/rr-wheels_corp/js/modules/sale-order-ajax.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 16054sokJSLib.extend( 16055 (saleOrderAjax = { 16056 ajaxParams: {}, 16057 vueResult:{}, 16058 checkedItems:[], 16059 showForm: false, 16060 AJAX_ACTION: false, 16061 AJAX_ACTION_DATA: {}, 16062 IS_SEARCH_LOCATION: "N", 16063 IS_DELAY: "N", 16064 timeout: 0, 16065 search_location: "", 16066 current_location_text_update: "", 16067 AJAX_UPDATE: "Y", 16068 products: [], 16069 SAVE_ITEM: false, 16070 SAVE_BASKET: "N", 16071 alert: [], 16072 errors: [], 16073 error: [], 16074 events: { 16075 ready: { 16076 body: "ajaxLoadVue", 16077 }, 16078 change: { 16079 ".product-counter input": "changeInputItemQuantity", 16080 "input[data-entity='basket-coupon-input']": "changeInputCoupon", 16081 }, 16082 click: { 16083 ".make-order-tab input": "choosePersonType", 16084 ".input-select__list .input-select__option": "chooseProfile", 16085 16086 ".delivery-option input": "chooseDelivery", 16087 ".payment-option input": "choosePaySystem", 16088 "[data-save-button='true']": "saveOrder", 16089 ".profile-add, .input-select__option[data-value='0']": 16090 "showProfileFormAdd", 16091 ".make-order-profile-change": "showProfileFormChange", 16092 ".profile-cancel": "showProfileFormCancel", 16093 ".make-order-profile-remove": "RemoveProfile", 16094 16095 ".remove-btn": "RemoveItem", 16096 ".remove-unavailable--trigger": "removeUnavailableItems", 16097 ".remove-unavailable-item--trigger": "removeUnavailableItem", 16098 16099 ".cart-item-remove .cart-save": "SaveItem", 16100 ".cart-item-remove .cart-close": "CartRemove", 16101 16102 ".product-counter__control.order-cnt": "changeInputItemQuantity", 16103 ".text-coupon-remove": "couponRemove", 16104 ".location-select": "SelectLocation", 16105 16106 ".cart-item .input-checkbox .checked-list": "checkedProduct", 16107 "#ÑheckAll": "checkedAllProducts", 16108 ".make-order-address-list .ratio-list-item input": "chooseAddress", 16109 ".dropdown-click.location-input": "FocusLocation", 16110 }, 16111 input: { 16112 ".location-input .sale-search-field .location-input": "InputLocation", 16113 }, 16114 }, 16115 prepareVueResult:function(){ 16116 saleOrderAjax.IS_UNAVAILABLE = "N"; 16117 saleOrderAjax.IS_AVAILABLE = "N"; 16118 saleOrderAjax.CHECKED_ALL = 'Y';
16119 Object.values(saleOrderAjax.grid).forEach((grid_item) => { 16120 if (grid_item.CAN_BUY === "N" && grid_item.DELAY === "N") { 16121 saleOrderAjax.IS_UNAVAILABLE = "Y"; 16122 } else if (grid_item.DELAY === "Y") { 16123 saleOrderAjax.CHECKED_ALL = 'N'; 16124 saleOrderAjax.IS_DELAY = 'Y'; 16125 } else { 16126 saleOrderAjax.IS_AVAILABLE = "Y"; 16127 } 16128 }); 16129 saleOrderAjax.vueResult={ 16130 result: saleOrderAjax.result, 16131 grid: saleOrderAjax.grid, 16132 cart: saleOrderAjax.cart, 16133 locations: saleOrderAjax.locations, 16134 params: saleOrderAjax.params, 16135 action_uri: saleOrderAjax.action_uri, 16136 sessid: saleOrderAjax.sessid, 16137 showForm: saleOrderAjax.showForm, 16138 search_location: saleOrderAjax.search_location, 16139 current_location_text_update: saleOrderAjax.current_location_text_update, 16140 messages: saleOrderAjax.messages, 16141 alert: saleOrderAjax.alert, 16142 warning: saleOrderAjax.warning, 16143 error: saleOrderAjax.error, 16144 IS_UNAVAILABLE: saleOrderAjax.IS_UNAVAILABLE, 16145 IS_AVAILABLE: saleOrderAjax.IS_AVAILABLE, 16146 IS_DELAY: saleOrderAjax.IS_DELAY, 16147 IS_SEARCH_LOCATION: saleOrderAjax.IS_SEARCH_LOCATION, 16148 CHECKED_ALL: saleOrderAjax.CHECKED_ALL, 16149 products_cnt: saleOrderAjax.products, 16150 }; 16151 saleOrderAjax.IS_SEARCH_LOCATION = "N"; 16152 }, 16153 ajaxLoadVue: function () { 16154 saleOrderAjax.prepareVueResult(); 16155 saleOrderAjax.mountTemplate( 16156 "vue", 16157 saleOrderAjax.vueResult, 16158 "#order-placement" 16159 ); 16160 saleOrderAjax.checkedCartItems(); 16161 saleOrderAjax.AJAX_ACTION_DATA["PRODUCTS"] = saleOrderAjax.products; 16162 console.log('saleOrderAjax.productss', saleOrderAjax.products); 16163 16164 saleOrderAjax.total = saleOrderAjax.result.TOTAL.ORDER_TOTAL_PRICE; 16165 saleOrderAjax.price = saleOrderAjax.result.TOTAL.ORDER_PRICE; 16166 }, 16167 16168 ajaxUpdateVue: function () { 16169 saleOrderAjax.prepareVueResult(); 16170 saleOrderAjax.modifyTemplateData("vue", saleOrderAjax.vueResult); 16171 }, 16172 VueInitScripts: function () { 16173 saleOrderAjax.initPhoneMask(); 16174 saleOrderAjax.InitInputItemQuantity(); 16175 16176 viewTemplates.SelectInit(); 16177 viewTemplates.checkActiveAccordion(); 16178 if ($(".y-map").length > 0) { 16179 contactsList.init({ 16180 templateFolder: saleOrderAjax.templateFolder, 16181 arResultItems: mapsSale, 16182 }); 16183 } 16184 }, 16185 setDeep: function(obj, name, value){ 16186 // пÑевÑаÑаем "ORDER[PROP][ID]" -> ["ORDER","PROP","ID"] 16187 // и "COUPON[]" -> ["COUPON", ""] 16188 const keys = name.replace(/\]/g, '').split('['); 16189 16190 let curr = obj; 16191 let parent = null; 16192 let parentKey = null; 16193 16194 for (let i = 0; i < keys.length; i++) { 16195 const key = keys[i]; 16196 const last = i === keys.length - 1; 16197 16198 // ÐÑли ÑÑо "дÑÑка" [] â ÑабоÑаем Ñ Ð¼Ð°ÑÑивом на ÑÑовне ÑодиÑÐµÐ»Ñ 16199 if (key === '') { 16200 // обеÑпеÑиваем, ÑÑо ÑекÑÑий Ñзел â маÑÑив (инаÑе заменÑем Ñ ÑодиÑелÑ) 16201 if (!Array.isArray(curr)) { 16202 // еÑли еÑÑÑ ÑодиÑÐµÐ»Ñ â заменÑем его поле на маÑÑив 16203 if (parent && parentKey !== null) { 16204 parent[parentKey] = []; 16205 curr = parent[parentKey]; 16206 } else { 16207 // веÑÑ Ð½Ð¸Ð¹ ÑÑовенÑ: пÑевÑаÑаем obj в маÑÑив (Ñедко, но возможно) 16208 // NB: ÑÑда обÑÑно не попадÑм, Ñ.к. пеÑвÑй клÑÑ Ð¿Ð¾ÑÑи вÑегда ÑÑÑока 16209 // но на вÑÑкий ÑлÑÑай: 16210 if (!Array.isArray(obj)) { 16211 // оÑиÑÑим obj и Ñделаем маÑÑив 16212 // (в ÑеалÑноÑÑи веÑÑ Ð½Ð¸Ð¹ ÑÑÐ¾Ð²ÐµÐ½Ñ Ð¼Ð°ÑÑивом обÑÑно не нÑжен) 16213 } 16214 } 16215 } 16216 16217 if (last) { 16218 // items[] = value
16219 curr.push(value); 16220 } else { 16221 // items[][id] â пÑÑим обÑекÑ, в него пойдÑм далÑÑе 16222 if (curr.length === 0 || typeof curr[curr.length - 1] !== 'object') { 16223 curr.push({}); 16224 } 16225 parent = curr; 16226 parentKey = curr.length - 1; // Ð¸Ð½Ð´ÐµÐºÑ ÑолÑко ÑÑо добавленного обÑекÑа 16227 curr = curr[parentKey]; 16228 } 16229 continue; 16230 } 16231 16232 // ÐбÑÑнÑй клÑÑ 16233 if (last) { 16234 if (curr[key] === undefined) { 16235 curr[key] = value; 16236 } else if (Array.isArray(curr[key])) { 16237 curr[key].push(value); 16238 } else { 16239 curr[key] = [curr[key], value]; 16240 } 16241 } else { 16242 if (curr[key] === undefined || typeof curr[key] !== 'object') { 16243 curr[key] = {}; 16244 } 16245 parent = curr; 16246 parentKey = key; 16247 curr = curr[key]; 16248 } 16249 } 16250 }, 16251 getFormData: function (action) { 16252 console.log("getFormData action", action); 16253 16254 const formEl = document.getElementById('bx-soa-order-form'); 16255 if (!formEl) { 16256 console.warn('getFormData: form #bx-soa-order-form not found'); 16257 return; 16258 } 16259 const arFormData = $(formEl).serializeArray(); 16260 const formData = {}; 16261 arFormData.forEach(({ name, value }) => { 16262 if (name.includes('[')) { 16263 saleOrderAjax.setDeep(formData, name, value); 16264 } else { 16265 // пÑоÑÑое Ð¸Ð¼Ñ Ð±ÐµÐ· Ñкобок + поддеÑжка повÑоÑений 16266 if (formData[name] === undefined) { 16267 formData[name] = value; 16268 } else if (Array.isArray(formData[name])) { 16269 formData[name].push(value); 16270 } else { 16271 formData[name] = [formData[name], value]; 16272 } 16273 } 16274 }); 16275 16276 if (this?.params?.ACTION_VARIABLE) { 16277 formData[this.params.ACTION_VARIABLE] = action; 16278 } 16279 const sessid = (typeof BX !== 'undefined' && typeof BX.bitrix_sessid === 'function') 16280 ? BX.bitrix_sessid() 16281 : ''; 16282 16283 const coupon = saleOrderAjax?.AJAX_ACTION_DATA?.COUPON ?? ''; 16284 16285 formData[this.params.ACTION_VARIABLE] = action; 16286 this.ajaxParams = { 16287 order: formData, 16288 sessid: sessid, 16289 via_ajax: "Y", 16290 SITE_ID: this.siteID, 16291 signedParamsString: this.signedParamsString, 16292 AJAX_ACTION: saleOrderAjax?.AJAX_ACTION ?? false, 16293 AJAX_ACTION_DATA: saleOrderAjax?.AJAX_ACTION_DATA ?? {}, 16294 coupon: coupon, 16295 }; 16296 if (this?.params?.ACTION_VARIABLE) { 16297 this.ajaxParams[this.params.ACTION_VARIABLE] = action; 16298 } 16299 console.log("getFormData ajaxParams", this.ajaxParams); 16300 }, 16301 chooseProfile: function () { 16302 var el = BX('profile_change'); 16303 if (el) el.value = 'N'; 16304 saleOrderAjax.commonAjaxHandler("chooseProfile"); 16305 }, 16306 16307 choosePersonType: function () { 16308 saleOrderAjax.showForm = false; 16309 saleOrderAjax.commonAjaxHandler("choosePersonType"); 16310 }, 16311 16312 chooseDelivery: function () { 16313 saleOrderAjax.warning.DELIVERY = []; 16314 saleOrderAjax.commonAjaxHandler("chooseDelivery"); 16315 }, 16316 16317 choosePaySystem: function () { 16318 saleOrderAjax.warning.PAY_SYSTEM = []; 16319 saleOrderAjax.commonAjaxHandler("choosePaySystem"); 16320 }, 16321 16322 showProfileFormAdd: function () { 16323 // saleOrderAjax.PROFILE_ID = $("[name='PROFILE_ID']").val(); 16324 saleOrderAjax.showForm = "form"; 16325 saleOrderAjax.commonAjaxHandler("showProfileFormAdd"); 16326 }, 16327 16328 showProfileFormChange: function () { 16329 saleOrderAjax.showForm = "profile_change"; 16330 saleOrderAjax.commonAjaxHandler("showProfileFormChange"); 16331 }, 16332 16333 showProfileFormCancel: function () { 16334 saleOrderAjax.showForm = false; 16335 saleOrderAjax.ajaxUpdateVue(); 16336 }, 16337 CartRemove: function (e) { 16338 const cart_id = $(this).closest(".cart-item").attr("id"); 16339 delete saleOrderAjax.items_save[cart_id]; 16340 16341 // saleOrderAjax.items_save[cart_id]; 16342 saleOrderAjax.commonAjaxHandler("cartRemove"); 16343 }, 16344 commonAjaxHandler: function (action) { 16345 console.log(action, saleOrderAjax); 16346 saleOrderAjax.getFormData("refreshOrderAjax"); 16347 saleOrderAjax.sendRequest("refreshOrderAjaxDataCallback"); 16348 }, 16349 16350 //Ðе обÑзаÑелÑно делаÑÑ refreshOrderAjax 16351 //Ðе обÑзаÑелÑно делаÑÑ refreshOrderAjax 16352 SaveItem: function () { 16353 console.log("SaveItem"); 16354 let save_id = $(this).closest(".cart-item").attr("id");
16355 let save_cnt = $(this).data("count"); 16356 console.log("save_id", save_id); 16357 console.log("save_cnt", save_cnt); 16358 saleOrderAjax.SAVE_ITEM = true; 16359 16360 saleOrderAjax.AJAX_ACTION = "SAVE_ITEM"; 16361 saleOrderAjax.AJAX_ACTION_DATA["SAVE_DATA"] = saleOrderAjax.items_save[save_id]; 16362 delete saleOrderAjax.items_save[save_id]; 16363 // saleOrderAjax.AJAX_ACTION_DATA["ITEM_ID"] = save_id; 16364 // saleOrderAjax.AJAX_ACTION_DATA["SAVE_CNT"] = save_cnt; 16365 saleOrderAjax.getFormData("refreshOrderAjax"); 16366 saleOrderAjax.sendRequest("refreshOrderAjaxData"); 16367 }, 16368 RemoveProfile: function () { 16369 saleOrderAjax.AJAX_ACTION = "REMOVE_PROFILE"; 16370 saleOrderAjax.getFormData("refreshOrderAjax"); 16371 saleOrderAjax.sendRequest("refreshOrderAjaxData"); 16372 16373 $("[name='PROFILE_ID']").css("display", "inline-block"); 16374 let profileId = $("[name='PROFILE_ID'] option").first().val(); 16375 $("[name='PROFILE_ID'] option").prop("selected", false); 16376 $("[name='PROFILE_ID'] option").first().prop("selected", true); 16377 $("[name='PROFILE_ID']").val(profileId).change(); 16378 16379 // $("[name='PROFILE_ID']").val(profileId) 16380 console.log("RemoveProfile", profileId); 16381 console.log( 16382 "RemoveProfile PROFILE_ID first", 16383 $("[name='PROFILE_ID'] option").first() 16384 ); 16385 $("[name='PROFILE_ID']").css("display", "none"); 16386 }, 16387 RemoveItem: function () { 16388 console.log("RemoveItem"); 16389 // let remove_id = $(this).closest(".cart-item").find(".checked-list").val(); 16390 let remove_id = $(this).closest(".cart-item").attr("cart-id"); 16391 16392 saleOrderAjax.SAVE_BASKET = "N"; 16393 saleOrderAjax.AJAX_ACTION = "REMOVE_ITEM"; 16394 saleOrderAjax.AJAX_ACTION_DATA["ITEM_ID"] = remove_id; 16395 saleOrderAjax.getFormData("refreshOrderAjax"); 16396 saleOrderAjax.sendRequest("refreshOrderAjaxDataCallback"); 16397 }, 16398 removeUnavailableItem: function () { 16399 console.log("removeUnavailableItem"); 16400 let remove_id = $(this).data("product-id"); 16401 16402 saleOrderAjax.AJAX_ACTION = "REMOVE_UNAVAILABLE_ITEM"; 16403 saleOrderAjax.AJAX_ACTION_DATA["ITEM_ID"] = remove_id; 16404 saleOrderAjax.getFormData("refreshOrderAjax"); 16405 saleOrderAjax.sendRequest("refreshOrderAjaxDataCallback"); 16406 }, 16407 removeUnavailableItems: function () { 16408 console.log("RremoveUnavailableItemsemoveItem"); 16409 16410 saleOrderAjax.AJAX_ACTION = "REMOVE_UNAVAILABLE_ITEMS"; 16411 saleOrderAjax.getFormData("refreshOrderAjax"); 16412 saleOrderAjax.sendRequest("refreshOrderAjaxDataCallback"); 16413 }, 16414 InitInputItemQuantity: function () { 16415 let product_counter = $(".product-counter"); 16416 product_counter.each(function () { 16417 let counter_input = $(this).find("input"); 16418 let currentValue = parseInt(counter_input.val(), 10); 16419 16420 if (currentValue <= 1) { 16421 $(this).find("._minus").addClass("product--disabled"); 16422 } else { 16423 $(this).find("._minus").removeClass("product--disabled"); 16424 } 16425 }); 16426 16427 }, 16428 changeInputItemQuantity: function () { 16429 console.log('changeInputItemQuantity'); 16430 clearTimeout(saleOrderAjax.timeout); 16431 if ($(this).hasClass("_plus") || $(this).hasClass("_minus")) { 16432 let counter = $(this).closest(".product-counter"); 16433 let input = counter.find("input"); 16434 let newValue = 1; 16435 counter.find("._minus").removeClass("product--disabled"); 16436 let currentValue = parseInt(input.val(), 10); 16437 if (isNaN(currentValue) || currentValue < 0) { 16438 currentValue = 0; 16439 } 16440 if ($(this).hasClass("_plus")) { 16441 newValue = Math.max(0, currentValue + 1); 16442 } else if ($(this).hasClass("_minus")) { 16443 newValue = Math.max(1, currentValue - 1); 16444 } 16445 if (newValue < 1) { 16446 counter.find("._minus").addClass("product--disabled"); 16447 } 16448 // УÑÑанавливаем новое знаÑение в инпÑÑ 16449 input.val(newValue); 16450 } 16451 16452 saleOrderAjax.timeout = setTimeout(() => { 16453 console.log("MinusItemQuantity"); 16454 let item_cnt = $(this).closest(".product-counter").find("input").val(); 16455 let item_id = $(this).closest(".cart-item").find(".checked-list").val(); 16456 16457 saleOrderAjax.SAVE_ITEM = true; 16458 saleOrderAjax.AJAX_ACTION = "SET_ITEM_QUANTITY"; 16459 16460 saleOrderAjax.AJAX_ACTION_DATA.ITEM_ID = item_id; 16461 saleOrderAjax.AJAX_ACTION_DATA.ITEM_CNT = item_cnt; 16462 16463 // saleOrderAjax.commonAjaxHandler("changeInputItemQuantity"); 16464 saleOrderAjax.getFormData("refreshOrderAjax"); 16465 // saleOrderAjax.sendRequest("refreshOrderAjaxData"); 16466 saleOrderAjax.sendRequest("refreshOrderAjaxDataCallback", { key: `qty:${item_id}`, debounceMs: 0 }); 16467 }, 0); 16468 16469 // }, 300); 16470 }, 16471 16472 couponRemove: function () { 16473 clearTimeout(saleOrderAjax.timeout); 16474 saleOrderAjax.timeout = setTimeout(() => { 16475 console.log("couponRemove");
16476 let coupon_text = $(this).data("coupon"); 16477 saleOrderAjax.AJAX_ACTION_DATA["COUPON"] = coupon_text; 16478 if (!saleOrderAjax.SAVE_ITEM) { 16479 saleOrderAjax.products = []; 16480 saleOrderAjax.checkedCartItems(); 16481 } 16482 saleOrderAjax.getFormData("removeCoupon"); 16483 saleOrderAjax.sendRequest("refreshOrderAjaxData"); 16484 }, 1000); 16485 }, 16486 changeInputCoupon: function () { 16487 clearTimeout(saleOrderAjax.timeout); 16488 saleOrderAjax.timeout = setTimeout(() => { 16489 console.log("changeInputCoupon"); 16490 let coupon_text = $(this).val(); 16491 // saleOrderAjax.AJAX_ACTION = "SET_COUPON"; 16492 saleOrderAjax.AJAX_ACTION_DATA["COUPON"] = coupon_text; 16493 16494 console.log("saleOrderAjax", saleOrderAjax); 16495 saleOrderAjax.getFormData("enterCoupon"); 16496 saleOrderAjax.sendRequest("refreshOrderAjaxData"); 16497 // saleOrderAjax.sendRequest("refreshOrderAjaxDataCallback"); 16498 }, 1000); 16499 }, 16500 SelectLocation: function () { 16501 let location = $(this).data("location"); 16502 console.log("location-value-input", location); 16503 $(".location-value-input").val(location); 16504 // $(".location-lastValue").val(location); 16505 saleOrderAjax.IS_SEARCH_LOCATION = "N"; 16506 let location_text = $(this).find(".bx-ui-sls-variant").text(); 16507 $("input.location-input").val(location_text); 16508 saleOrderAjax.current_location_text_update = location_text; 16509 console.log("SelectLocation location", location); 16510 saleOrderAjax.search_location = ''; 16511 saleOrderAjax.AJAX_ACTION = "UPDATE_LOCATION"; 16512 saleOrderAjax.AJAX_ACTION_DATA["LOCATION"] = location; 16513 saleOrderAjax.getFormData("refreshOrderAjax"); 16514 saleOrderAjax.sendRequest("refreshOrderAjaxData"); 16515 }, 16516 chooseAddress: function () { 16517 console.log("make-order-address chooseAddress"); 16518 // let store = $(this).data("store"); 16519 // $(".location-value-input").val(location); 16520 // let location_text = $(this).find(".bx-ui-sls-variant").text(); 16521 // saleOrderAjax.current_location_text_update = location_text; 16522 // console.log('SelectLocation location', location); 16523 // saleOrderAjax.AJAX_ACTION = "UPDATE_LOCATION"; 16524 // saleOrderAjax.AJAX_ACTION_DATA["LOCATION"] = location; 16525 // saleOrderAjax.getFormData("refreshOrderAjax"); 16526 // saleOrderAjax.sendRequest("refreshOrderAjaxData"); 16527 }, 16528 checkedProduct: function () { 16529 const allChecked = 16530 $("input.checked-list").length === 16531 $("input.checked-list:checked").length; 16532 16533 saleOrderAjax.products = []; 16534 saleOrderAjax.checkedCartItems(); 16535 16536 // УÑÑанавливаем ÑоÑÑоÑние ÑекбокÑа checkAll 16537 $("#ÑheckAll").prop("checked", allChecked); 16538 16539 // ÐолÑÑаем ÑекÑÑее знаÑение ÑекбокÑа, коÑоÑÑй вÑзвал ÑобÑÑие 16540 const currentCheckbox = $(this); 16541 const value = currentCheckbox.val(); 16542 if (currentCheckbox.is(":checked")) { 16543 console.log('currentCheckbox.is(":checked"'); 16544 if (!saleOrderAjax.products.includes(value)) { 16545 saleOrderAjax.products.push(value); 16546 } 16547 } else { 16548 console.log('currentCheckbox. !!! checked'); 16549 if (saleOrderAjax.products.length > 0) { 16550 16551 saleOrderAjax.products = saleOrderAjax.products.filter(function (item) { 16552 return item !== value; 16553 }); 16554 } 16555 } 16556 16557 console.log("Current products array:", saleOrderAjax.products); 16558 saleOrderAjax.AJAX_ACTION = "SET_PRODUCTS"; 16559 saleOrderAjax.AJAX_ACTION_DATA["PRODUCTS"] = saleOrderAjax.products; 16560 saleOrderAjax.getFormData("refreshOrderAjax"); 16561 saleOrderAjax.sendRequest("refreshOrderAjaxData"); 16562 }, 16563 checkedAllProducts: function () { 16564 $(".checked-list").prop("checked", this.checked); 16565 saleOrderAjax.checkedCartItems(); 16566 console.log("saleOrderAjax.products", saleOrderAjax.products); 16567 saleOrderAjax.AJAX_ACTION = "SET_PRODUCTS"; 16568 saleOrderAjax.AJAX_ACTION_DATA["PRODUCTS"] = saleOrderAjax.products; 16569 saleOrderAjax.getFormData("refreshOrderAjax"); 16570 saleOrderAjax.sendRequest("refreshOrderAjaxData"); 16571 }, 16572 FocusLocation: function (event) { 16573 $(this).find(".location-input").focus(); 16574 if (!$(event.target).closest(".dropdown-click__content").length) { 16575 $(this).removeClass("_active").addClass("_active"); 16576 } 16577 }, 16578 InputLocation: function () { 16579 let _this = this; // ÑÐ¾Ñ ÑанÑем конÑекÑÑ 16580 clearTimeout(saleOrderAjax.timeout); 16581 saleOrderAjax.timeout = setTimeout(() => { 16582 console.log("InputLocation $(this).val()", $(this).val()); 16583 if ($(this).val().length > 1) { 16584 const data = { 16585 select: { 16586 1: "CODE", 16587 2: "TYPE_ID", 16588 VALUE: "ID", 16589 DISPLAY: "NAME.NAME", 16590 }, 16591 additionals: { 1: "PATH" }, 16592 order: { SORT: "ASC", NAME: "ASC" }, 16593 filter: { 16594 "=PHRASE": $(this).val(), 16595 "=NAME.LANGUAGE_ID": "ru", 16596 "=TYPE_ID": "5", 16597 }, 16598 version: 2, 16599 // PAGE_SIZE: 0, 16600 PAGE_SIZE: 10, 16601 PAGE: 0, 16602 }; 16603 console.log("InputLocation data", data); 16604 16605 $.ajax({
16606 url: saleOrderAjax.search.ajaxUrl, 16607 type: "POST", 16608 data: data, 16609 dataFilter: (data) => data.replace(/'/g, '"'), 16610 dataType: "json", 16611 success: saleOrderAjax.InputLocationResponse.bind(_this), 16612 16613 error: saleOrderAjax.InputHandleError, 16614 }); 16615 } 16616 }, 100); 16617 16618 }, 16619 InputLocationResponse: function (response) { 16620 console.log("location response", response); 16621 $(".location-input.input-select").addClass("_active"); 16622 response.data.ITEMS.forEach((location) => { 16623 console.log("location", location); 16624 if (location.PATH.length > 0) { 16625 location.PATH.forEach((path) => { 16626 console.log("path", path); 16627 location.DISPLAY = 16628 location.DISPLAY + 16629 ", " + 16630 response.data.ETC.PATH_ITEMS[path].DISPLAY; 16631 }); 16632 } 16633 }); 16634 16635 saleOrderAjax.search_location = response; 16636 16637 console.log("InputLocation response", response); 16638 // saleOrderAjax.grid = saleOrderAjax.result.GRID.ROWS; 16639 saleOrderAjax.current_location_text_update = $(this).val(); 16640 saleOrderAjax.IS_SEARCH_LOCATION = "Y"; 16641 saleOrderAjax.ajaxUpdateVue(); 16642 // console.log("location response", response); 16643 // response.data.ITEMS.forEach((location) => { 16644 // /* considerable improvement with template literals instead of concatenation */ 16645 // location.DISPLAY = `${location.DISPLAY}${location.PATH.length > 0 ? 16646 // `, ${response.data.ETC.PATH_ITEMS[location.PATH[0]].DISPLAY}` : ''}`; 16647 // }); 16648 // saleOrderAjax.search_location = response; 16649 // saleOrderAjax.grid = saleOrderAjax.result.GRID.ROWS; 16650 // saleOrderAjax.current_location_text_update = $(this).val(); 16651 // saleOrderAjax.ajaxUpdateVue(); 16652 }, 16653 16654 InputHandleError: function (xhr, status, error) { 16655 console.error( 16656 "XHR status:", 16657 xhr, 16658 "Error status:", 16659 status, 16660 "Error message:", 16661 error 16662 ); 16663 }, 16664 16665 refreshOrderAjaxData: function (data) { 16666 if (!saleOrderAjax.SAVE_ITEM) { 16667 // console.log('saleOrderAjax.SAVE_ITEM ! Y'); 16668 saleOrderAjax.products = []; 16669 saleOrderAjax.checkedCartItems(); 16670 } 16671 if ( 16672 (data.order && data.order.AJAX_UPDATE == "N") || 16673 saleOrderAjax.AJAX_UPDATE == "N" 16674 ) { 16675 console.log("data.order.AJAX_UPDATE == N"); 16676 saleOrderAjax.result = data.order; 16677 saleOrderAjax.ajaxUpdateVue(); 16678 saleOrderAjax.AJAX_UPDATE = "Y"; 16679 saleOrderAjax.AJAX_ACTION = false; 16680 saleOrderAjax.AJAX_ACTION_DATA = { PRODUCTS: saleOrderAjax.products }; 16681 saleOrderAjax.SAVE_ITEM = false; 16682 var el = BX('profile_change'); 16683 if (el) el.value = 'N'; 16684 saleOrderAjax.VueInitScripts(); 16685 } else { 16686 if (saleOrderAjax.SAVE_BASKET == "Y") { 16687 saleOrderAjax.cart = data.order.CART; 16688 } 16689 saleOrderAjax.AJAX_UPDATE = "Y"; 16690 saleOrderAjax.AJAX_ACTION = false; 16691 saleOrderAjax.AJAX_ACTION_DATA = { PRODUCTS: saleOrderAjax.products }; 16692 saleOrderAjax.VueInitScripts(); 16693 saleOrderAjax.getFormData("refreshOrderAjax"); 16694 saleOrderAjax.sendRequest("refreshOrderAjaxDataCallback"); 16695 } 16696 }, 16697 refreshOrderAjaxDataCallback: function (data) { 16698 console.log("refreshOrderAjaxDataCallback", data); 16699 if (data.order) { 16700 if (saleOrderAjax.SAVE_BASKET != "Y") { 16701 saleOrderAjax.grid = data.order.BASKET.ITEMS; 16702 for (let key in data.order.BASKET.ITEMS) { 16703 if (data.order.BASKET.ITEMS.hasOwnProperty(key)) { 16704 saleOrderAjax.items_save[key] = data.order.BASKET.ITEMS[key]; 16705 } 16706 } 16707 console.log("saleOrderAjax.SAVE_BASKET ! == y"); 16708 saleOrderAjax.locations = data.locations; 16709 saleOrderAjax.cart = data.order.CART; 16710 16711 saleOrderAjax.result = data.order; 16712 saleOrderAjax.total = data.order.TOTAL.ORDER_TOTAL_PRICE; 16713 saleOrderAjax.price = data.order.TOTAL.ORDER_PRICE; 16714 } 16715 // saleOrderAjax.errors = data.order.ERROR; 16716 } 16717 console.log("saleOrderAjax.errors", saleOrderAjax.errors); 16718 // saleOrderAjax.alert = saleOrderAjax.alert + data.order.ERROR; 16719 // saleOrderAjax.alert.push(data.order.ERROR); 16720 console.log("saleOrderAjax.alert", saleOrderAjax.alert); 16721 // const formJquery = $("#bx-soa-order-form"); 16722 // saleOrderAjax.validate(formJquery); 16723 saleOrderAjax.alert = []; 16724 saleOrderAjax.warning = []; 16725 saleOrderAjax.error = []; 16726 saleOrderAjax.ajaxUpdateVue(); 16727 var el = BX('profile_change'); 16728 if (el) el.value = 'N'; 16729 saleOrderAjax.AJAX_UPDATE = "Y"; 16730 saleOrderAjax.AJAX_ACTION = false; 16731 saleOrderAjax.AJAX_ACTION_DATA = { PRODUCTS: saleOrderAjax.products }; 16732 saleOrderAjax.VueInitScripts(); 16733 saleOrderAjax.SAVE_BASKET = "N"; 16734 saleOrderAjax.SAVE_ITEM = false; 16735 }, 16736 16737 saveOrder: function (e) { 16738 console.log("saveOrder e", e); 16739 const saveOrderBtn = $(this); 16740 const formJquery = $("#bx-soa-order-form"); 16741 const form = BX("bx-soa-order-form"); 16742 saveOrderBtn.addClass("--disabled"); 16743 e.preventDefault(); 16744 console.log( 16745 "saleOrderAjax.params.MIN_SUMM_ORDER", 16746 saleOrderAjax.params.MIN_SUMM_ORDER 16747 ); 16748 console.log("saleOrderAjax.total", saleOrderAjax.total); 16749 console.log("saleOrderAjax.price", saleOrderAjax.price); 16750 16751 console.log("saleOrderAjaxsaleOrderAjax", saleOrderAjax); 16752 16753 clearTimeout(saleOrderAjax.timeout); 16754 saleOrderAjax.timeout = setTimeout(() => { 16755 if ( 16756 saleOrderAjax.validate(formJquery) && 16757 saleOrderAjax.products.length > 0 16758 ) { 16759 if (saleOrderAjax.params.MIN_SUMM_ORDER < saleOrderAjax.price) { 16760 saleOrderAjax.AJAX_ACTION_DATA["PRODUCTS"] = saleOrderAjax.products; 16761 saleOrderAjax.AJAX_UPDATE = "Y"; 16762 form.querySelector("input[type=hidden][name=sessid]").value = 16763 BX.bitrix_sessid();
16764 const arFormData = $(form).serializeArray(); 16765 const formData = {}; 16766 arFormData.forEach(({ name, value }) => { 16767 const matches = name.match(/^([^\[]+)\[([^\]]+)\]\[([^\]]+)\]$/); 16768 if (matches) { 16769 const [_, mainKey, subKey1, subKey2] = matches; 16770 formData[mainKey] = formData[mainKey] || {}; 16771 formData[mainKey][subKey1] = formData[mainKey][subKey1] || {}; 16772 formData[mainKey][subKey1][subKey2] = value; 16773 } else { 16774 formData[name] = value; 16775 } 16776 }); 16777 formData["via_ajax"] = "Y"; 16778 formData["action"] = "saveOrderAjax"; 16779 formData["sessid"] = BX.bitrix_sessid(); 16780 formData["SITE_ID"] = this.siteID; 16781 formData["signedParamsString"] = this.signedParamsString; 16782 formData["AJAX_ACTION_DATA"] = saleOrderAjax.AJAX_ACTION_DATA; 16783 16784 $.ajax({ 16785 url: this.ajaxUrl, 16786 type: "POST", 16787 data: formData, 16788 dataType: "json", 16789 success: function (response) { 16790 console.log("saveOrderCallback", response); 16791 if (!response.order.ERROR) { 16792 // data = JSON.parse(data); 16793 window.location.href = response.order.REDIRECT_URL; 16794 } else { 16795 saleOrderAjax.alert = []; 16796 saleOrderAjax.error = response.order.ERROR; 16797 16798 saleOrderAjax.ajaxUpdateVue(); 16799 saleOrderAjax.scrollToBlock($(".cart-alert")); 16800 } 16801 console.log(response); 16802 saveOrderBtn.removeClass("--disabled"); 16803 }, 16804 onfailure: function () { 16805 console.log("onfailure"); 16806 saveOrderBtn.removeClass("--disabled"); 16807 }, 16808 error: function (xhr, status, error) { 16809 // добавлÑем аÑгÑменÑÑ xhr, status и error 16810 console.log("XHR status:", xhr); 16811 console.log("Error status:", status); 16812 console.log("Error message:", error); 16813 saveOrderBtn.removeClass("--disabled"); 16814 }, 16815 }); 16816 } else { 16817 saleOrderAjax.ajaxUpdateVue(); 16818 saleOrderAjax.scrollToBlock($(".cart-alert")); 16819 saveOrderBtn.removeClass("--disabled"); 16820 } 16821 } else { 16822 saveOrderBtn.removeClass("--disabled"); 16823 } 16824 }, 1000); 16825 }, 16826 16827 initPhoneMask: function (event) { 16828 const phoneInputs = document.querySelectorAll(".js-phone-mask"); 16829 phoneInputs.forEach((input) => { 16830 IMask(input, { 16831 mask: "+{7}(000)000-00-00", 16832 }); 16833 }); 16834 }, 16835 //ÐалидаÑÐ¸Ñ 16836 InputErrorDraw: function (input, isError) { 16837 const container = input.closest(".input-text, .input-textarea"); 16838 container.toggleClass("input-error", isError); 16839 }, 16840 16841 addError: function (input, message) { 16842 console.log("addError"); 16843 const fieldset = input.closest("fieldset"); 16844 saleOrderAjax.InputErrorDraw(input, true); 16845 fieldset.find(".text-error").remove(); // УдалÑем пÑедÑдÑÑие оÑибки 16846 fieldset.append(`<span class='text-error'>${message}</span>`); 16847 console.log("addError message", message); 16848 saleOrderAjax.alert.push({ type: "error", message: message }); 16849 }, 16850 addErrorCheckbox: function (input, message) { 16851 console.log("addErrorCheckbox"); 16852 let input_container = input.closest(".form-container__nav"); 16853 input_container.find(".text-error").remove(); 16854 input_container.append(`<span class='text-error'>${message}</span>`); 16855 saleOrderAjax.alert.push({ type: "error", message: message }); 16856 }, 16857 removeError: function (input) { 16858 saleOrderAjax.InputErrorDraw(input, false); 16859 input.closest("fieldset").find(".text-error").remove(); 16860 }, 16861 validateField: function (input) { 16862 const value = input.val().trim(); 16863 const type = input.attr("type"); 16864 const name = input.attr("name"); 16865 let isValid = true; 16866 16867 // ÐÑовеÑка на required 16868 if (input.is("[required]") && value === "") { 16869 const fieldName = input.closest("fieldset").find("label").text(); 16870 saleOrderAjax.addError(input, `ÐаполниÑе поле ${fieldName}`); 16871 return false; 16872 } 16873 16874 // ÐÑовеÑка Ð´Ð»Ñ Email 16875 if ( 16876 type === "email" && 16877 value !== "" && 16878 !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value) 16879 ) { 16880 saleOrderAjax.addError(input, "ÐведиÑе коÑÑекÑнÑй email"); 16881 return false; 16882 } 16883 16884 // ÐÑовеÑка Ð´Ð»Ñ Checkbox 16885 if ( 16886 type === "checkbox" && 16887 !input.is(":checked") && 16888 input.is("[required]") 16889 ) { 16890 console.log("addErrorCheckboxaddErrorCheckbox"); 16891 let message = ""; 16892 if (input.attr("id") == "personal-data") { 16893 message = "СоглаÑиÑеÑÑ Ñ ÑÑловиÑми обÑабоÑки пеÑÑоналÑнÑÑ Ð´Ð°Ð½Ð½ÑÑ "; 16894 } else if (input.attr("id") == "public-offert") { 16895 message = "СоглаÑиÑеÑÑ Ñ Ð¿ÑблиÑной оÑеÑÑой"; 16896 } else { 16897 message = "СоглаÑиÑеÑÑ Ñ ÑÑловиÑми"; 16898 } 16899 saleOrderAjax.addErrorCheckbox(input, message); 16900 return false; 16901 } 16902 16903 // ÐÑовеÑка ÑелеÑона 16904 if (input.hasClass("js-phone-mask")) { 16905 const digitsOnly = value.replace(/\D/g, ""); 16906 if (digitsOnly.length < 11 && value !== "") { 16907 saleOrderAjax.addError(input, "ÐведиÑе коÑÑекÑнÑй Ð½Ð¾Ð¼ÐµÑ ÑелеÑона"); 16908 return false; 16909 } 16910 } 16911 16912 // ÐÑе пÑовеÑки пÑÐ¾Ð¹Ð´ÐµÐ½Ñ 16913 saleOrderAjax.removeError(input); 16914 return isValid; 16915 }, 16916 16917 // validate: function (event) { 16918 // const button = $(event.target); 16919 // const form = button.closest("form"); 16920 // let hasErrors = false; 16921 // saleOrderAjax.alert = []; 16922 16923 // // УдалÑем пÑедÑдÑÑие оÑибки 16924 // form.find(".text-error:not(.error-skip").remove(); 16925 16926 // // ÐÑовеÑÑем каждÑй input/textarea 16927 // form 16928 // .find("input:not(.validate-skip), textarea:not(.validate-skip)") 16929 // .each((_, element) => { 16930 // const input = $(element); 16931 // if (!saleOrderAjax.validateField(input)) { 16932 // hasErrors = true; // ФикÑиÑÑем налиÑие оÑибок 16933 // } 16934 // }); 16935 16936 // if (hasErrors) {
16937 // saleOrderAjax.errors.forEach(error => { 16938 // saleOrderAjax.alert.push({ type: error.type, message: error.message }); 16939 // }); 16940 // saleOrderAjax.ajaxUpdateVue(); 16941 // event.preventDefault(); // ÐлокиÑÑем оÑпÑÐ°Ð²ÐºÑ ÑоÑÐ¼Ñ 16942 // saleOrderAjax.scrollToBlock($(".cart-alert")); 16943 // } else { 16944 // return true; // УÑпеÑÐ½Ð°Ñ Ð¾ÑпÑавка ÑоÑÐ¼Ñ 16945 // } 16946 // }, 16947 validate: function (form) { 16948 if (!form) { 16949 console.error("ФоÑма не пеÑедана Ð´Ð»Ñ Ð²Ð°Ð»Ð¸Ð´Ð°Ñии"); 16950 return false; // ÐÑли ÑоÑма не пеÑедана, возвÑаÑаем false 16951 } 16952 16953 let hasErrors = false; 16954 saleOrderAjax.alert = []; 16955 16956 // УдалÑем пÑедÑдÑÑие оÑибки 16957 form.find(".text-error:not(.error-skip)").remove(); 16958 16959 // ÐÑовеÑÑем каждÑй input/textarea 16960 form 16961 .find("input:not(.validate-skip), textarea:not(.validate-skip)") 16962 .each((_, element) => { 16963 const input = $(element); 16964 if (!saleOrderAjax.validateField(input)) { 16965 hasErrors = true; // ФикÑиÑÑем налиÑие оÑибок 16966 } 16967 }); 16968 16969 if (hasErrors) { 16970 // saleOrderAjax.errors.forEach(error => { 16971 // saleOrderAjax.alert.push({ type: error.type, message: error.message }); 16972 // }); 16973 saleOrderAjax.ajaxUpdateVue(); 16974 saleOrderAjax.scrollToBlock($(".cart-alert")); 16975 return false; // ÐÑли еÑÑÑ Ð¾Ñибки 16976 } else { 16977 return true; // УÑпеÑÐ½Ð°Ñ Ð²Ð°Ð»Ð¸Ð´Ð°ÑÐ¸Ñ 16978 } 16979 }, 16980 16981 scrollToBlock: function (element) { 16982 if (element.length) { 16983 $("html, body").animate( 16984 { 16985 scrollTop: element.offset().top - $("header").outerHeight(true), 16986 }, 16987 600 16988 ); 16989 } else { 16990 $("html, body").animate( 16991 { 16992 scrollTop: $("html").offset().top - $("header").outerHeight(true), 16993 }, 16994 600 16995 ); 16996 } 16997 }, 16998 checkedCartItems: function () { 16999 // ÐÑÐ¾Ñ Ð¾Ð´Ð¸Ð¼ по ÐºÐ°Ð¶Ð´Ð¾Ð¼Ñ ÑлеменÑÑ Ñ ÐºÐ»Ð°ÑÑом .checked-list внÑÑÑи .cart-item 17000 saleOrderAjax.products = []; 17001 $(".cart-item .checked-list:checked").each(function () { 17002 var value = $(this).val(); 17003 if (value) { 17004 saleOrderAjax.products.push(value); 17005 } 17006 }); 17007 }, 17008 }) 17009); 17010 17011viewTemplates = { 17012 dropdown_timeout: 0, 17013 modal_timeout: 0, 17014 events: { 17015 click: { 17016 ".cart-section-container .dropdown-click": "dropdownClick", 17017 ".accordion-click .accordion-click__show": "accordionClick", 17018 ".close_field .close-text": "clearCloseField", 17019 17020 html: ["disableSelect", "dropdownClickDisable"], 17021 ".cart-section-container .input-select__option": "chooseSelect", 17022 // "[data-modal]": "openModalTrigger", 17023 // ".modal__overlay": "modalClose", 17024 // ".modal-close-trigger": "modalClose", 17025 }, 17026 input: { 17027 ".close_field input": "showCloseField", 17028 }, 17029 mouseenter: { 17030 ".cart-section-container .dropdown": "dropdownEnter", 17031 }, 17032 mouseleave: { 17033 ".cart-section-container .dropdown": "dropdownLeave", 17034 }, 17035 resize: { 17036 "window": "checkActiveAccordion", 17037 }, 17038 // ready: { 17039 // document: ["checkActiveAccordion", "modalInit"], 17040 // }, 17041 }, 17042 // modalInit: function () { 17043 // console.log('modalInit'); 17044 // if (!$("html").find(".sok--modal").length) { 17045 // $("body").append( 17046 // `<div class="sok--wrapper"> 17047 // <div class="sok--modal"> 17048 // <div class="modal__overlay"></div> 17049 // </div> 17050 // </div>` 17051 // ); 17052 // } 17053 // }, 17054 // openModalTrigger: function (event) { 17055 // console.log("openModalTrigger"); 17056 // event.preventDefault(); 17057 // $(".modal__dialog-container").remove(); 17058 // viewTemplates.AddModalBg(); 17059 // viewTemplates.modalOpen($(this)); 17060 // var _this = this; 17061 // $(_this).addClass("--disabled"); 17062 // viewTemplates.modal_timeout = setTimeout(function () { 17063 // $(_this).removeClass("--disabled"); 17064 // }, 1000); 17065 // }, 17066 // AddModalBg: function (event) { 17067 // $(".sok--modal").addClass("_active"); 17068 // $("body").addClass("sok--fixed"); 17069 // }, 17070 // RemoveModalBg: function (event) { 17071 // $(".sok--modal").removeClass("_active"); 17072 // $("body").removeClass("sok--fixed"); 17073 // }, 17074 // modalOpen: function (el, params) { 17075 // console.log("modalOpen"); 17076 // this.ajaxDataType = "html"; 17077 // if (!params || $.isEmptyObject(params)) { 17078 // var name = el.data("modal"); 17079 // var url = el.data("url"); 17080 // this.ajaxUrl = url ? url : `${saleOrderAjax.templateFolder}/modals/${name}.php`; 17081 // this.ajaxParams = 17082 // typeof el.data("params") != "undefined" ? el.data("params") : {}; 17083 // } else { 17084 // this.ajaxUrl = params.url; 17085 // this.ajaxParams = params.data; 17086 // } 17087 // console.log('ajaxParams', this.ajaxParams); 17088 // this.sendRequest("updateModalContent"); 17089 // }, 17090 // updateModalContent: function (response) { 17091 // console.log("updateModalContent", response); 17092 // var $html = $(response); 17093 // $(".sok--modal").append($html); 17094 // viewTemplates.SelectInit(); 17095 // if ($html.find(".js-phone-mask").length) {
17096 // console.log("$html.find( .js-phone-mask"); 17097 // saleOrderAjax.initPhoneMask(); 17098 // } 17099 // }, 17100 // modalClose: function () { 17101 // console.log('modalClose'); 17102 // $(".modal__dialog-container").remove(); 17103 // viewTemplates.RemoveModalBg(); 17104 // }, 17105 dropdownEnter: function () { 17106 console.log("dropdownEnter"); 17107 clearTimeout(viewTemplates.dropdown_timeout); 17108 $(".dropdown").removeClass("_active"); 17109 $(this).addClass("_active"); 17110 }, 17111 dropdownLeave: function () { 17112 var $this = $(this); 17113 viewTemplates.dropdown_timeout = setTimeout(function () { 17114 $this.removeClass("_active"); 17115 }, 600); 17116 }, 17117 dropdownClick: function (event) { 17118 if ($(event.target).closest(".dropdown-click__content").length) { 17119 return; // ÐÑли клик на доÑеÑнем ÑлеменÑе, ниÑего не делаем 17120 } 17121 17122 if ($(this).hasClass("_active")) { 17123 $(".dropdown-click").removeClass("_active"); 17124 $(this).addClass("_active"); 17125 } else { 17126 $(".dropdown-click").removeClass("_active"); 17127 } 17128 17129 // ТепеÑÑ toggleClass можно оÑÑавиÑÑ Ð´Ð»Ñ Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ ÐºÐ»Ð°ÑÑа к ÑекÑÑÐµÐ¼Ñ ÑлеменÑÑ 17130 $(this).toggleClass("_active"); 17131 }, 17132 17133 dropdownClickDisable: function (event) { 17134 if ( 17135 !$(event.target).closest(".cart-section-container .dropdown-click").length 17136 ) { 17137 $(".cart-section-container .dropdown-click").removeClass("_active"); 17138 } 17139 }, 17140 17141 disableSelect: function (event) { 17142 if ( 17143 !$(event.target).closest(".cart-section-container .input-select").length 17144 ) { 17145 $(".cart-section-container .input-select").removeClass("_active"); 17146 } 17147 }, 17148 chooseSelect: function (event) { 17149 console.log("chooseSelect"); 17150 let select = $(this).closest(".input-select"); 17151 select.find("select").val($(this).data("value")); 17152 select.find(".input-select__current").text($(this).text()); 17153 select.removeClass("_active"); 17154 console.log($(this).closest(".input-select").find("select").val()); 17155 }, 17156 17157 accordionClick: function (event) { 17158 console.log("accordionClick"); 17159 let $accordion = $(this).closest(".accordion-click"); 17160 let $content = $accordion.find(".accordion-click__content"); 17161 17162 // ÐÑовеÑка на оÑкÑÑÑое ÑоÑÑоÑние 17163 if ($accordion.hasClass("_active")) { 17164 // ÐÑли ÑейÑÐ°Ñ Ð¾ÑкÑÑÑо, ÑкÑÑваем конÑÐµÐ½Ñ 17165 $content.css("max-height", "0"); 17166 } else { 17167 $content.css("max-height", $content.prop("scrollHeight") + "px"); 17168 } 17169 $accordion.toggleClass("_active"); 17170 }, 17171 checkActiveAccordion: function (event) { 17172 let $accordion = $(".accordion-click._active"); 17173 let $content = $accordion.find(".accordion-click__content"); 17174 // ÐÑовеÑка на оÑкÑÑÑое ÑоÑÑоÑние 17175 if ($accordion) { 17176 $content.css("max-height", $content.prop("scrollHeight") + "px"); 17177 } 17178 }, 17179 showCloseField: function () { 17180 let close_field = $(this).closest(".close_field"); 17181 if ($(this).val().length > 0) { 17182 close_field.addClass("_fill"); 17183 } else { 17184 close_field.removeClass("_fill"); 17185 } 17186 }, 17187 clearCloseField: function () { 17188 let close_field = $(this).closest(".close_field"); 17189 close_field.find("input").val(""); 17190 close_field.removeClass("_fill"); 17191 }, 17192}; 17193sokJSLib.extend(viewTemplates); 17194viewTemplates.init(); 17195 17196/* End */ 17197; 17198; /* Start:"a:4:{s:4:"full";s:80:"/local/components/sok/profile.enter/templates/.default/script.js?177520238615669";s:6:"source";s:64:"/local/components/sok/profile.enter/templates/.default/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 17199profileEnter={ 17200 loginInfo:"", 17201 ajaxParams:{}, 17202 templatePath:"", 17203 signedParams:"", 17204 menuOpen:true, 17205 captchaId:false, 17206 captchaContainer:"popup-captcha-container", 17207 //object events section 17208 events:{ 17209 click:{ 17210 "#checkReg": "checkRegister", 17211 "#loginUser": "loginUser", 17212 "#restorePass": "restorePass", 17213 "#recoveryPass": "restorePassModalOpen", 17214 "#change_pass": "changePass", 17215 "#register": "registerUser", 17216 "#loginRegUser":"regModal", 17217 ".send_sms":"sendSms",
17218 "#modalClose":"closeSecondModal", 17219 }, 17220 keyup:{ 17221 "#check_code":"checkSms", 17222 // "#repeat_password":"checkPass", 17223 //"input": "checkCaptcha" 17224 }, 17225 custom:{ 17226 "onSokModalClosed": "destroyCaptcha", 17227 "onSokModalOpened": "loadCaptcha", 17228 "onSokModalOpen": "destroyCaptcha", 17229 "onSokModalBack": "loadCaptcha", 17230 }, 17231 17232 }, 17233 loadCaptcha:function(){ 17234 console.log("loadCaptchaScript", $("#"+profileEnter.captchaContainer).length); 17235 if($("#"+profileEnter.captchaContainer).length>0){ 17236 YandexSmartCaptcha.container=profileEnter.captchaContainer; 17237 profileEnter.captchaId=YandexSmartCaptcha.loadCaptchaScript(); 17238 } 17239 }, 17240 destroyCaptcha: function(){ 17241 console.log("destroyCaptcha"); 17242 if(profileEnter.captchaId!==false){ 17243 YandexSmartCaptcha.destroyWidget(profileEnter.captchaId); 17244 profileEnter.captchaId=false; 17245 } 17246 }, 17247 checkCaptcha:function(){ 17248 YandexSmartCaptcha.loadCallback(); 17249 }, 17250 checkRequire:function(form){ 17251 console.log("checkRequire STARTED"); //ÐаÑало ÑÑнкÑии 17252 let vaidate=true; 17253 form.find(".validate_form").html(""); 17254 form.find("input[required]:not(._validate_skip)").each(function () { 17255 if ($(this).val() === "") { 17256 17257 17258 17259 var fieldName = $(this).siblings("label").text(); 17260 console.log(fieldName); 17261 17262 form.find(".validate_form").append( 17263 "<p class='text-error'>*ÐаполниÑе поле " + fieldName + "</p>"); 17264 17265 17266 17267 vaidate=false; 17268 console.log("ne", $(this)); 17269 } else { 17270 console.log("da", $(this)); 17271 17272 } 17273 }); 17274 if(localStorage.getItem('NeedSms')!==null){ 17275 form.find(".validate_form").append( 17276 "<p class='text-error'>*ÐодÑвеÑдиÑе Ð²Ð°Ñ ÑелеÑон</p>"); 17277 vaidate=false; 17278 } 17279 console.log(vaidate); 17280 return vaidate; 17281 }, 17282 checkRegister: function(){ 17283 event.preventDefault(); 17284 //profileEnter.checkCaptcha(); 17285 let info=document.querySelector("#phone"); 17286 profileEnter.loginInfo=info.value; 17287 if(localStorage.getItem('NeedSms')!==null){ 17288 localStorage.removeItem("NeedSms"); 17289 } 17290 let checkInput=profileEnter.checkRequire($(this).parent()); 17291 var emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; 17292 var phonePattern = /^\+7\s\(\d{3}\)\s\d{3}-\d{2}-\d{2}$/; 17293 checkInputContent=(emailPattern.test(info.value) || phonePattern.test(info.value)); 17294 if(checkInput && checkInputContent){ 17295 profileEnter.ajaxParams={action:"checkRegister", signedParamsString:profileEnter.signedParams, is_ajax_post:'Y',infoUser:info.value}; 17296 profileEnter.sendRequest("checkRegisterCalback"); 17297 }else if(!checkInputContent){ 17298 //$("#phone").parents("fieldset").append("<p class='text-error'>*Ðе веÑнÑй ÑоÑÐ¼Ð°Ñ ÑелеÑона или email</p>"); 17299 } 17300 }, 17301 anonymizeEmail:function(email) { 17302 const atIndex = email.indexOf('@'); 17303 if (atIndex <= 3) { 17304 17305 return email.charAt(0) + '*'.repeat(atIndex - 1) + email.slice(atIndex); 17306 } else { 17307 17308 return email.slice(0, 3) + '*'.repeat(atIndex - 3) + email.slice(atIndex); 17309 } 17310 }, 17311 closeSecondModal:function(e){ 17312 e.preventDefault(); 17313 let modal= document.querySelector(".second-modal"); 17314 modal.remove(); 17315 },
17316 checkRegisterCalback: function(data){ 17317 console.log(data); 17318 let container =document.querySelector(".modal-container"); 17319 let content=document.querySelector("#modal-content"); 17320 data.result.login = data.result.USER.EMAIL; 17321 data.result.confirm=data.result.CONFIRM_PHONE==="Y"?"_active":""; 17322 data.result.disabled=localStorage.getItem("NOTSEND")==="Y"?"disabled":""; 17323 data.result.email=""; 17324 data.result.phone=""; 17325 data.result.TYPE==="EMAIL" ? data.result.email=data.result.INFO : data.result.phone=data.result.INFO; 17326 17327 17328 17329 if(data.result.USER!=false){ 17330 mainJs.modalOpen(false, {url:this.templatePath+"/auth.php", data:data.result}); 17331 } 17332 else{ 17333 mainJs.modalOpen(false, {url:this.templatePath+"/register.php", data:data.result}); 17334 if(data.result.confirm!=""){ 17335 localStorage.setItem("NeedSms", "Y"); 17336 localStorage.setItem("NOTSEND", "N"); 17337 } 17338 17339 content.style.maxWidth = "500px"; 17340 //profileEnter.initPhoneMask(); 17341 } 17342 }, 17343 loginUser: function(e){ 17344 e.preventDefault(); 17345 let login=document.querySelector('#login'); 17346 let password =document.querySelector('#password'); 17347 let check = profileEnter.checkRequire($(this).parent()); 17348 if(check){ 17349 profileEnter.ajaxParams={action:"loginUser", signedParamsString:profileEnter.signedParams, is_ajax_post:'Y',loginUser:login.value,passwordUser:password.value}; 17350 profileEnter.sendRequest("loginUserCalback"); 17351 } 17352 17353 }, 17354 startCountdown:function() { 17355 let timeLeft = 59; 17356 localStorage.setItem("NOTSEND", "Y"); 17357 const interval = setInterval(function() { 17358 const minutes = Math.floor(timeLeft / 60); 17359 let seconds = timeLeft % 60; 17360 17361 if (seconds < 10) { 17362 seconds = "0" + seconds; 17363 } 17364 17365 $(".new_code_container span.new_code_info").text("ÐолÑÑиÑÑ Ð½Ð¾Ð²Ñй код можно ÑеÑез " + minutes + ":" + seconds).removeClass(["send_sms", "link_underline"]); 17366 17367 if (timeLeft <= 0) { 17368 clearInterval(interval); 17369 $(".btn_tel_code_new").prop("disabled", false); 17370 $(".send_sms").prop("disabled", false); 17371 $(".new_code_container span.new_code_info").text("ÐолÑÑиÑÑ Ð½Ð¾Ð²Ñй код.").addClass(["send_sms", "link_underline"]); 17372 localStorage.setItem("NOTSEND", "N"); 17373 } else { 17374 timeLeft--; 17375 localStorage.setItem("NOTSEND", "Y"); 17376 } 17377 }, 1000); // ÐапÑÑкаем ÑÐ°Ð¹Ð¼ÐµÑ ÐºÐ°Ð¶Ð´ÑÑ ÑекÑÐ½Ð´Ñ 17378 }, 17379 loginUserCalback: function(data){ 17380 let error=document.querySelector(".validate_form"); 17381 if(data.result.AUTHORIZED===true){ 17382 window.location.reload(true); 17383 } 17384 else{ 17385 console.log("data.result", data.result); 17386 $(".password_field").parents("fieldset").find(".text-error").remove(); 17387 $(".password_field").parents("fieldset").append('<span class="text-error">'+data.result.AUTHORIZED.MESSAGE+'</span>'); 17388 17389 //error.innerHTML=data.result.AUTHORIZED.MESSAGE; 17390 } 17391 }, 17392 restorePass: function(){ 17393 let login=document.querySelector('#login'); 17394 17395 profileEnter.ajaxParams={action:"restorePass", signedParamsString:profileEnter.signedParams, is_ajax_post:'Y',loginUser:login.value}; 17396 profileEnter.sendRequest("restorePassCalback"); 17397 17398 17399 17400 }, 17401 restorePassCalback: function(){ 17402 data={}; 17403 container =$("#modal-content"); 17404 data.email =container.find('#user_email').val(); 17405 data.type = container.find('#type').val(); 17406 if(type!="EMAIL"){ 17407 data.email=profileEnter.anonymizeEmail(data.email); 17408 } 17409 mainJs.modalOpen(false, {url:profileEnter.templatePath+"/recovery_letter_sent.php", data:data}); 17410 }, 17411 restorePassModalOpen: function(e){
17412 e.preventDefault(); 17413 data={}; 17414 container =$(this).parents("#modal-content"); 17415 data.email=container.find('#user_email').val(); 17416 data.type = container.find('#type').val(); 17417 data.login = container.find('#login').val(); 17418 17419 if(data.type!="EMAIL"){ 17420 data.email=profileEnter.anonymizeEmail(data.email); 17421 } 17422 mainJs.modalOpen(false, {url:profileEnter.templatePath+"/password_recovery.php", data:data}); 17423 }, 17424 changePass: function(e){ 17425 console.log('changePass'); 17426 e.preventDefault(); 17427 let login=document.querySelector('#login'); 17428 let email=document.querySelector('#email'); 17429 17430 if (login == null || login == undefined) { 17431 login = email; 17432 } 17433 console.log("bek",login); 17434 let checkword=document.querySelector('#checkword'); 17435 let password=document.querySelector('#password'); 17436 if (formsJs.validate(e)) { 17437 profileEnter.ajaxParams={ 17438 action:"changePass", 17439 signedParamsString:profileEnter.signedParams, 17440 is_ajax_post:'Y', 17441 loginUser:login.value, 17442 checkwordUser:checkword.value, 17443 password:password.value, 17444 passwordRep:password.value 17445 }; 17446 console.log('formsJs changePass'); 17447 console.log('profileEnter.ajaxParams', profileEnter.ajaxParams); 17448 profileEnter.sendRequest("changePassCalback"); 17449 } else{ 17450 console.log('no changePass'); 17451 } 17452 17453 }, 17454 changePassCalback:function(data){ 17455 console.log('changePassCalback data', data); 17456 let form = $(".change_password_container .form_container"); 17457 let error = form.find(".validate_text") 17458 17459 console.log('errorcc', data.errors.length); 17460 if (data.errors.length > 0) { 17461 error.remove(); 17462 form.prepend( 17463 "<div class='validate_text'><span class='text-error'>" + data.errors +"</span></div>" 17464 ); 17465 } else{ 17466 window.location.href = '/'; 17467 } 17468 }, 17469 validateErrors:function(){ 17470 17471 }, 17472 registerUser:function(e){ 17473 e.preventDefault(); 17474 console.log("reguser STARTED"); //ÐаÑало ÑÑнкÑии 17475 let name = document.querySelector('#name'); 17476 let login=document.querySelector('#email'); 17477 let phone=document.querySelector('#tel'); 17478 let password=document.querySelector('#password'); 17479 let container =document.querySelector(".modal-container"); 17480 // let checkInput=profileEnter.checkRequire($(this).parent()); 17481 if (formsJs.validate(e)) { 17482 var button = $(e.target); 17483 button.addClass("disabled"); 17484 profileEnter.ajaxParams={action:"registerUser", signedParamsString:profileEnter.signedParams, is_ajax_post:'Y',loginUser:login.value,phoneUser:phone.value,password:password.value, name:name.value}; 17485 profileEnter.sendRequest("registerUserCalback"); 17486 17487 } 17488 17489 }, 17490 registerUserCalback:function(data){ 17491 console.log(data); 17492 if(data.result.INFO.TYPE=="OK"){ 17493 window.location.reload(true); 17494 //mainJs.modalOpen(false, {url:profileEnter.templatePath+"/register_success.php", data:data}); 17495 } 17496 else if(data.result.INFO.TYPE=="ERROR"){ 17497 let button=$('#register'); 17498 button.removeClass("disabled"); 17499 $(".common_errors").html('<span class="text-error">'+data.result.INFO.MESSAGE+'</span>'); 17500 } 17501 else{ 17502 mainJs.userPhone=data.result.DATA; 17503 mainJs.userLogin=data.result.LOGIN; 17504 mainJs.modalOpen(false, {url:profileEnter.templatePath+"/data_in_use.php", data:data.result}); 17505 } 17506 }, 17507 regModal:function(){ 17508 data={}; 17509 mainJs.modalOpen(false, {url:this.templatePath+"/auth.php", data:data}); 17510 }, 17511 sendSms:function(e){ 17512 // e.preventDefault(); 17513 // console.log('sendSms'); 17514 let input_phone=$('#tel'); 17515 let phone=input_phone[0]; 17516 17517 17518 formsJs.InputErrorDraw(input_phone, false); 17519 input_phone 17520 .closest("fieldset").find(".text-error").remove(); 17521 if(input_phone.hasClass("js-phone-mask") && (input_phone.val().replace(/\D/g, '').length < 11 || input_phone.val() == "")){ 17522 formsJs.InputErrorDraw(input_phone, true); 17523 input_phone 17524 .closest("fieldset").find(".text-error").remove(); 17525 input_phone 17526 .closest("fieldset") 17527 .append( 17528 "<span class='text-error'>*ÐаполниÑе коÑÑекÑнÑй Ð½Ð¾Ð¼ÐµÑ ÑелеÑона</span>" 17529 ); 17530 } else{ 17531 profileEnter.ajaxParams={action:"generateSmsCode", signedParamsString:profileEnter.signedParams, is_ajax_post:'Y',phone:phone.value}; 17532 profileEnter.sendRequest("sendSmsCalback"); 17533 } 17534 }, 17535 sendSmsCalback:function(data){ 17536 console.log("data", data); 17537 $(".new_code_container").removeClass("_hide"); 17538 $(".btn_tel_code").removeClass("_active"); 17539 $(".btn_tel_code_new").addClass("_active"); 17540 $(".modal_input._Ñode").addClass("_active"); 17541 $(".modal_input._tel").addClass("_basis"); 17542 profileEnter.startCountdown(); 17543 }, 17544 checkSms:function(){ 17545 console.log("mek",$(this)); 17546 let fieldValue = $(this).val(); 17547 if(fieldValue.length===4){ 17548 profileEnter.ajaxParams={action:"checkSms", signedParamsString:profileEnter.signedParams, is_ajax_post:'Y',sms_code:fieldValue}; 17549 profileEnter.sendRequest("checkSmsCalback"); 17550 17551 } 17552 17553 }, 17554 checkSmsCalback:function(data){ 17555 17556 if(data.result.CODE==="Y"){ 17557 console.log("da"); 17558 $("._Ñode").find(".text-error").addClass("_hide"); 17559 $(".btn_tel_code_new").removeClass("_active"); 17560 $("._Ñode").removeClass("_active"); 17561 $(".tel_confirmed").addClass("_active"); 17562 $(".modal_input._tel").removeClass("_basis"); 17563 $(".tel_get_code input").attr("readonly", true); 17564 $(".new_code_container").addClass("_hide"); 17565 localStorage.removeItem("NeedSms"); 17566 } 17567 else{ 17568 $("._Ñode").find(".text-error").removeClass("_hide"); 17569 $("#code").removeClass("_hide"); 17570 } 17571 17572 }, 17573 checkPass:function(){ 17574 let password=document.querySelector('#password'); 17575 let submitButton = document.querySelector('#change_pass'); 17576 let validateForm = document.querySelector('.validate_form'); 17577 if($(this)[0].value===password.value){ 17578 validateForm.innerHTML = ''; 17579 } 17580 else{ 17581 validateForm.innerHTML = '<p class="text-error">ÐаÑоли не ÑовпадаÑÑ</p>'; 17582 } 17583 } 17584}; 17585 17586sokJSLib.extend(profileEnter); 17587/* End */ 17588; 17589; /* Start:"a:4:{s:4:"full";s:111:"/local/templates/rr-wheels_corp/components/bitrix/sale.basket.basket.line/header_cart/script.js?178513646710863";s:6:"source";s:95:"/local/templates/rr-wheels_corp/components/bitrix/sale.basket.basket.line/header_cart/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 17590'use strict'; 17591 17592function BitrixSmallCart(){} 17593 17594BitrixSmallCart.prototype = { 17595 17596 activate: function () 17597 { 17598 this.cartElement = BX(this.cartId); 17599 this.fixedPosition = this.arParams.POSITION_FIXED == 'Y'; 17600 if (this.fixedPosition) 17601 { 17602 this.cartClosed = true; 17603 this.maxHeight = false;
17604 this.itemRemoved = false; 17605 this.verticalPosition = this.arParams.POSITION_VERTICAL; 17606 this.horizontalPosition = this.arParams.POSITION_HORIZONTAL; 17607 this.topPanelElement = BX("bx-panel"); 17608 17609 this.fixAfterRender(); // TODO onready 17610 this.fixAfterRenderClosure = this.closure('fixAfterRender'); 17611 17612 var fixCartClosure = this.closure('fixCart'); 17613 this.fixCartClosure = fixCartClosure; 17614 17615 if (this.topPanelElement && this.verticalPosition == 'top') 17616 BX.addCustomEvent(window, 'onTopPanelCollapse', fixCartClosure); 17617 17618 var resizeTimer = null; 17619 BX.bind(window, 'resize', function() { 17620 clearTimeout(resizeTimer); 17621 resizeTimer = setTimeout(fixCartClosure, 200); 17622 }); 17623 } 17624 this.setCartBodyClosure = this.closure('setCartBody'); 17625 BX.addCustomEvent(window, 'OnBasketChange', this.closure('refreshCart', {})); 17626 }, 17627 17628 fixAfterRender: function () 17629 { 17630 this.statusElement = BX(this.cartId + 'status'); 17631 if (this.statusElement) 17632 { 17633 if (this.cartClosed) 17634 this.statusElement.innerHTML = this.openMessage; 17635 else 17636 this.statusElement.innerHTML = this.closeMessage; 17637 } 17638 this.productsElement = BX(this.cartId + 'products'); 17639 this.fixCart(); 17640 }, 17641 17642 closure: function (fname, data) 17643 { 17644 var obj = this; 17645 return data 17646 ? function(){obj[fname](data)} 17647 : function(arg1){obj[fname](arg1)}; 17648 }, 17649 17650 toggleOpenCloseCart: function () 17651 { 17652 if (this.cartClosed) 17653 { 17654 BX.removeClass(this.cartElement, 'bx-closed'); 17655 BX.addClass(this.cartElement, 'bx-opener'); 17656 this.statusElement.innerHTML = this.closeMessage; 17657 this.cartClosed = false; 17658 this.fixCart(); 17659 } 17660 else // Opened 17661 { 17662 BX.addClass(this.cartElement, 'bx-closed'); 17663 BX.removeClass(this.cartElement, 'bx-opener'); 17664 BX.removeClass(this.cartElement, 'bx-max-height'); 17665 this.statusElement.innerHTML = this.openMessage; 17666 this.cartClosed = true; 17667 var itemList = this.cartElement.querySelector("[data-role='basket-item-list']"); 17668 if (itemList) 17669 itemList.style.top = "auto"; 17670 } 17671 setTimeout(this.fixCartClosure, 100); 17672 }, 17673 17674 setVerticalCenter: function(windowHeight) 17675 { 17676 var top = windowHeight/2 - (this.cartElement.offsetHeight/2); 17677 if (top < 5) 17678 top = 5; 17679 this.cartElement.style.top = top + 'px'; 17680 }, 17681 17682 fixCart: function() 17683 { 17684 // set horizontal center 17685 if (this.horizontalPosition == 'hcenter') 17686 { 17687 var windowWidth = 'innerWidth' in window 17688 ? window.innerWidth 17689 : document.documentElement.offsetWidth; 17690 var left = windowWidth/2 - (this.cartElement.offsetWidth/2); 17691 if (left < 5) 17692 left = 5; 17693 this.cartElement.style.left = left + 'px'; 17694 } 17695 17696 var windowHeight = 'innerHeight' in window 17697 ? window.innerHeight 17698 : document.documentElement.offsetHeight; 17699 17700 // set vertical position 17701 switch (this.verticalPosition) { 17702 case 'top': 17703 if (this.topPanelElement) 17704 this.cartElement.style.top = this.topPanelElement.offsetHeight + 5 + 'px'; 17705 break; 17706 case 'vcenter': 17707 this.setVerticalCenter(windowHeight); 17708 break; 17709 } 17710 17711 // toggle max height 17712 if (this.productsElement) 17713 { 17714 var itemList = this.cartElement.querySelector("[data-role='basket-item-list']"); 17715 if (this.cartClosed) 17716 { 17717 if (this.maxHeight) 17718 { 17719 BX.removeClass(this.cartElement, 'bx-max-height'); 17720 if (itemList) 17721 itemList.style.top = "auto"; 17722 this.maxHeight = false; 17723 } 17724 } 17725 else // Opened 17726 { 17727 if (this.maxHeight) 17728 { 17729 if (this.productsElement.scrollHeight == this.productsElement.clientHeight) 17730 { 17731 BX.removeClass(this.cartElement, 'bx-max-height'); 17732 if (itemList) 17733 itemList.style.top = "auto"; 17734 this.maxHeight = false; 17735 } 17736 } 17737 else 17738 { 17739 if (this.verticalPosition == 'top' || this.verticalPosition == 'vcenter') 17740 { 17741 if (this.cartElement.offsetTop + this.cartElement.offsetHeight >= windowHeight) 17742 { 17743 BX.addClass(this.cartElement, 'bx-max-height'); 17744 if (itemList) 17745 itemList.style.top = 82+"px"; 17746 this.maxHeight = true; 17747 } 17748 } 17749 else 17750 { 17751 if (this.cartElement.offsetHeight >= windowHeight) 17752 { 17753 BX.addClass(this.cartElement, 'bx-max-height'); 17754 if (itemList) 17755 itemList.style.top = 82+"px"; 17756 this.maxHeight = true; 17757 } 17758 } 17759 } 17760 } 17761 17762 if (this.verticalPosition == 'vcenter') 17763 this.setVerticalCenter(windowHeight); 17764 } 17765 }, 17766 17767 refreshCart: function (data) 17768 { 17769 if (this.itemRemoved) 17770 { 17771 this.itemRemoved = false;
17772 return; 17773 } 17774 data.sessid = BX.bitrix_sessid(); 17775 data.siteId = this.siteId; 17776 data.templateName = this.templateName; 17777 data.arParams = this.arParams; 17778 BX.ajax({ 17779 url: this.ajaxPath, 17780 method: 'POST', 17781 dataType: 'html', 17782 data: data, 17783 onsuccess: this.setCartBodyClosure 17784 }); 17785 }, 17786 17787 setCartBody: function (result) 17788 { 17789 if (this.cartElement) 17790 this.cartElement.innerHTML = result.replace(/#CURRENT_URL#/g, this.currentUrl); 17791 if (this.fixedPosition) 17792 setTimeout(this.fixAfterRenderClosure, 100); 17793 }, 17794 17795 removeItemFromCart: function (id) 17796 { 17797 this.refreshCart ({sbblRemoveItemFromCart: id}); 17798 this.itemRemoved = true; 17799 BX.onCustomEvent('OnBasketChange'); 17800 } 17801}; 17802sokJSLib.extend(smallBasket={ 17803 ajaxParams:{}, 17804 events:{ 17805 click:{ 17806 ".cart-btn": "addToBasket", 17807 ".product-counter .input-text":"checkZero", 17808 }, 17809 change:{ 17810 ".product-counter .input-text":"updateQuantity", 17811 }, 17812 focusout:{ 17813 ".product-counter .input-text":"setNumericQuantity", 17814 }, 17815 custom:{ 17816 "changeQuantityBtn": "updateQuantity", 17817 }, 17818 }, 17819 checkZero: function(){ 17820 if($(this).val()==0){ 17821 $(this).val(""); 17822 } 17823 }, 17824 setNumericQuantity:function(){ 17825 var quantity = parseInt($(this).val(), 10) || 0; 17826 if(quantity==0) 17827 $(this).val(quantity); 17828 }, 17829 updateQuantity: function(e, data){ 17830 data = typeof data !== 'undefined' ? $(data) : $(this); 17831 var container=data.parents(".product-counter").find(".cart-btn"); 17832 //var ratio = container.data("ratio"); 17833 var quantity = parseInt(data.val(), 10) || 0; 17834 console.log(quantity); 17835 $(this).val(quantity); 17836 var maxQuantity = container.data("max-quantity"); 17837 if(quantity >= maxQuantity){ 17838 quantity = maxQuantity; 17839 } 17840 // var step = $(this).data("step"); 17841 // ratio = ratio>1?ratio:step>1?step:1; 17842 // console.log("ratio", ratio); 17843 // if(quantity >= maxQuantity){ 17844 // quantity = maxQuantity; 17845 // newQuantity = quantity%ratio==0?quantity:Math.floor(quantity / ratio) * ratio; 17846 // }else{ 17847 // newQuantity = quantity%ratio==0?quantity:Math.ceil(quantity / ratio) * ratio; 17848 // } 17849 newQuantity = quantity; 17850 17851 17852 data.val(newQuantity); 17853 //mainJs.toggleCounter(data.parents(".product-counter"), container, newQuantity); 17854 17855 smallBasket.ajaxParams.sessid = BX.bitrix_sessid(); 17856 smallBasket.ajaxParams.siteId = smallBasket.siteId; 17857 smallBasket.ajaxParams.action="addToBasket"; 17858 smallBasket.ajaxParams.quantity=newQuantity; 17859 smallBasket.ajaxParams.id=container.data("product-id"); 17860 smallBasket.ajaxParams.stock=container.data("stock"); 17861 //smallBasket.ajaxParams.status=container.data("status"); 17862 smallBasket.sendRequest("updateQuantityCallback"); 17863 console.log(smallBasket.ajaxParams); 17864 }, 17865 updateQuantityCallback:function(data){ 17866 console.log("update data", data); 17867 window.BX && BX.onCustomEvent('OnBasketChange'); 17868 }, 17869 addToBasket: function(){ 17870 var counter = $(this).closest(".product-counter"); 17871 var input = counter.find("input"); 17872 var productCount = parseInt(input.val(), 10) || 0; 17873 var ratio = $(this).data("ratio"); 17874 var step = $(this).data("step"); 17875 ratio = ratio>1?ratio:step>1?step:1; 17876 //var newProductCount = productCount%ratio==0?productCount:Math.floor(productCount / ratio) * ratio; 17877 var maxQuantity = $(this).data("max-quantity"); 17878 console.log("maxQuantity", maxQuantity); 17879 if(ratio >= maxQuantity){ 17880 console.log("productCount >= maxQuantity"); 17881 newProductCount = maxQuantity; 17882 //newProductCount = productCount%ratio==0?productCount:Math.floor(productCount / ratio) * ratio; 17883 } 17884 else if(productCount == 0){ 17885 newProductCount = ratio; 17886 } 17887 else{ 17888 newProductCount = productCount%ratio==0?productCount:Math.ceil(productCount / ratio) * ratio; 17889 } 17890 input.val(newProductCount); 17891 mainJs.toggleCounter(counter, $(this), newProductCount); 17892 smallBasket.ajaxParams.sessid = BX.bitrix_sessid(); 17893 smallBasket.ajaxParams.siteId = smallBasket.siteId; 17894 smallBasket.ajaxParams.action="addToBasket"; 17895 smallBasket.ajaxParams.id=$(this).data("product-id"); 17896 smallBasket.ajaxParams.stock=$(this).data("stock"); 17897 smallBasket.ajaxParams.quantity=newProductCount; 17898 // smallBasket.ajaxParams.status=$(this).data("status"); 17899 smallBasket.ajaxDataType="html"; 17900 //console.log(smallBasket.ajaxParams); 17901 smallBasket.sendRequest("addToBasketCallback"); 17902 }, 17903 addToBasketCallback: function(data){ 17904 console.log("addToBasketCallback data", data); 17905 if(data.basketQuantity>0 && $(".header-menu .item__cart .menu-buttons__count").length==0){ 17906 $(".header-menu .item__cart").append("<span class='menu-buttons__count'></span>"); 17907 }else if(data.basketQuantity==0 && $(".header-menu .item__cart .menu-buttons__count").length>0){ 17908 $(".header-menu .item__cart .menu-buttons__count").remove(); 17909 } 17910 console.log('addToBasketCallback data', data); 17911 console.log('addToBasketCallback data2', data); 17912 $(".item__cart .menu-buttons__count").text(data.basketQuantity); 17913 notification.showNotification("cart-add"); 17914 window.BX && BX.onCustomEvent('OnBasketChange'); 17915 17916 // mainJS.CartAdd(); 17917 // mainJs.modalAddBg(); 17918 // mainJs.modalOpen(false, {url:this.templatePath+"/add_popup.php", data:data.itemData}); 17919 // console.log(data); 17920 }, 17921 checkListDetailQuantity: function(){ 17922 if (smallBasket.result.CATEGORIES?.READY?.length) { 17923 const arcart = smallBasket.result.CATEGORIES.READY; 17924 17925 $.each(arcart, function(_, item) { 17926 const $product = $(`[data-item="product-${item.PRODUCT_ID}"]`); 17927 if (!$product.length) return; // еÑли ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ð½Ðµ найден â пÑопÑÑкаем 17928 const $cartbtn = $product.find(`[data-stock="${item.STOCK}"]`); 17929 if (!$cartbtn.length) { 17930 return; 17931 }
17932 //const $counterWrapper = $product.find('.cart-counter-wrapper'); 17933 //const $productCounter = $product.find('.product-counter'); 17934 const $productCounter = $cartbtn.parents('.product-counter'); 17935 const $input = $productCounter.find('input'); 17936 const $cartButton=$product.find('.cart-btn'); 17937 17938 if ($productCounter.length) { 17939 $productCounter.addClass('_active'); 17940 } 17941 17942 if ($input.length) { 17943 $input.val(item.QUANTITY); 17944 } 17945 }); 17946 } 17947 17948 }, 17949}); 17950 17951 17952 17953 17954 17955 17956 17957 17958 17959/* End */ 17960;; /* /local/templates/rr-wheels_corp/js/swiper-bundle.min.js?1775202386139064*/ 17961; /* /local/templates/rr-wheels_corp/js/products-swiper.js?1775202386571*/ 17962; /* /local/templates/rr-wheels_corp/js/libs.min.js?1775202386296028*/ 17963; /* /local/templates/rr-wheels_corp/js/jquery-ui.min.js?177520238622229*/ 17964; /* /local/templates/rr-wheels_corp/js/jquery.fancybox.js?1775202386142360*/ 17965; /* /local/templates/rr-wheels_corp/js/fancybox.js?1775202386610*/ 17966; /* /local/templates/rr-wheels_corp/js/imask.js?1775202386135105*/ 17967; /* /local/templates/rr-wheels_corp/js/soklib.js?17752023867255*/ 17968; /* /local/templates/rr-wheels_corp/js/ui-kit.js?177520238610512*/ 17969; /* /local/templates/rr-wheels_corp/js/formJS.js?17752023867130*/ 17970; /* /local/templates/rr-wheels_corp/js/modal.js?17752023863668*/ 17971; /* /local/templates/rr-wheels_corp/components/bitrix/form.result.new/default/script.js?17854090512027*/ 17972; /* /local/templates/rr-wheels_corp/js/alerts.js?17752023862036*/ 17973; /* /local/templates/rr-wheels_corp/js/notification.js?17752023861838*/ 17974; /* /local/templates/rr-wheels_corp/js/catalog.js?17752023867824*/ 17975; /* /local/templates/rr-wheels_corp/js/y-map.js?177520238611269*/ 17976; /* /local/templates/rr-wheels_corp/js/main.js?17752023863881*/ 17977; /* /local/templates/rr-wheels_corp/js/modules/sale-order-ajax.js?177520238643645*/ 17978; /* /local/components/sok/profile.enter/templates/.default/script.js?177520238615669*/ 17979; /* /local/templates/rr-wheels_corp/components/bitrix/sale.basket.basket.line/header_cart/script.js?178513646710863*/
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.