vendor: 5,063 bytes, lines 1-45
1(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ 2var m0 = require("../src/modules/1.general/10.links/40.link-hotline/_40.link-hotline.2.js"); 3var m1 = require("../src/modules/1.general/10.links/50.link-anchor/_50.link-anchor.2.js"); 4var m2 = require("../src/modules/1.general/20.button/25.button-icon--scrollup/_25.button-icon--scrollup.2.js"); 5var m3 = require("../src/modules/1.general/50.forms-items/22.input--file/_22.input--file.2.js"); 6var m4 = require("../src/modules/1.general/50.forms-items/23.date-input/_23.date-input.2.js"); 7var m5 = require("../src/modules/1.general/50.forms-items/80.form-error/_80.form-error.2.js"); 8var m6 = require("../src/modules/1.general/50.forms-items/90.switch/_90.switch.2.js"); 9var m7 = require("../src/modules/1.general/50.forms-items/100.slider/_100.slider.2.js"); 10var m8 = require("../src/modules/1.general/51.forms-parts/140.search/_140.search.2.js"); 11var m9 = require("../src/modules/1.general/60.media/10.image-ext/_10.image-ext.2.js"); 12var m10 = require("../src/modules/1.general/60.media/90.picture-tag/_90.picture-tag.2.js"); 13var m11 = require("../src/modules/1.general/62.embedded/10.embedded-optin-yt/_10.embedded-optin-yt.2.js"); 14var m12 = require("../src/modules/1.general/80.messages/20.tooltip-ext/_20.tooltip-ext.2.js"); 15var m13 = require("../src/modules/1.general/80.messages/40.popup/_40.popup.2.js"); 16var m14 = require("../src/modules/1.general/80.messages/50.message-outdated/_50.message-outdated.2.js"); 17var m15 = require("../src/modules/1.general/90.accordion/10.accordion/_10.accordion.2.js"); 18var m16 = require("../src/modules/2.products/10.product-details/23.variant-switch/_23.variant-switch.2.js"); 19var m17 = require("../src/modules/2.products/10.product-details/71.product-rating--icon/_71.product-rating--icon.2.js"); 20var m18 = require("../src/modules/2.products/10.product-details/90.cost-overview/_90.cost-overview.2.js"); 21var m19 = require("../src/modules/2.products/11.offer-details/10.counter-time/_10.counter-time.2.js"); 22var m20 = require("../src/modules/2.products/20.product-boxes/62.product-info-box-text/_62.product-info-box-text.2.js"); 23var m21 = require("../src/modules/3.navigation/25.horizontal-nav/20.grid-slider/_20.grid-slider.2.js"); 24var m22 = require("../src/modules/2.products/20.product-boxes/110.product-detail-tariff-offer/_110.product-detail-tariff-offer.2.js"); 25var m23 = require("../src/modules/3.navigation/80.tabcontent/21.navigation-tabs--big/_21.navigation-tabs--big.2.js"); 26var m24 = require("../src/modules/3.navigation/80.tabcontent/20.navigation-tabs/_20.navigation-tabs.2.js"); 27var m25 = require("../src/modules/2.products/30.configurator/70.quick-start/_70.quick-start.2.js"); 28var m26 = require("../src/modules/2.products/30.configurator/71.quick-start-modern/_71.quick-start-modern.2.js"); 29var m27 = require("../src/modules/3.navigation/80.tabcontent/10.tabcontent/_10.tabcontent.2.js"); 30var m28 = require("../src/modules/2.products/30.configurator/80.config-list/_80.config-list.2.js"); 31var m29 = require("../src/modules/2.products/30.configurator/90.config-filter/_90.config-filter.2.js"); 32var m30 = require("../src/modules/2.products/30.configurator/100.config-variant/_100.config-variant.2.js"); 33var m31 = require("../src/modules/2.products/30.configurator/110.config-navigation/_110.config-navigation.2.js"); 34var m32 = require("../src/modules/2.products/40.detail-layer/10.tariff-detail-layer/_10.tariff-detail-layer.2.js"); 35var m33 = require("../src/modules/2.products/10.product-details/40.legal-texts/_40.legal-texts.2.js"); 36var m34 = require("../src/modules/3.navigation/110.nav-boxes/10.nav-box/_10.nav-box.2.js"); 37var m35 = require("../src/modules/5.content/40.steps/20.slider-steps/_20.slider-steps.2.js"); 38var m36 = require("../src/modules/5.content/90.overlays/10.content-overlay/_10.content-overlay.2.js"); 39var m37 = require("../src/modules/6.snippets/30.geo-location/10.location-search/_10.location-search.2.js"); 40var m38 = require("../src/modules/6.snippets/30.geo-location/20.location-results/_20.location-results.2.js"); 41var m39 = require("../src/modules/6.snippets/30.geo-location/30.location-map/_30.location-map.2.js"); 42var m40 = require("../src/modules/6.snippets/50.extern/10.trusted-shops-snippet/_10.trusted-shops-snippet.2.js"); 43var m41 = require("../src/modules/20.mobilcom/10.offer/31.md-campaign-box--expandable/_31.md-campaign-box--expandable.2.js"); 44var m42 = require("../src/modules/20.mobilcom/20.stage/20.md-stage-basic--bundle/_20.md-stage-basic--bundle.2.js"); 45var m43 = require("../src/modules/20.mobilcom/20.stage/30.md-stage-offer--pk/_30.md-stage-offer--pk.2.js");
46var m44 = require("../src/modules/20.mobilcom/40.general/40.md-header/_40.md-header.2.js"); 47var m45 = require("../src/modules/90.nofrills/10.offer/60.nf-offer-box-modern/_60.nf-offer-box-modern.2.js"); 48var m46 = require("../src/modules/90.nofrills/40.navigation/10.nf-navigation-tariff/_10.nf-navigation-tariff.2.js"); 49var m47 = require("../src/modules/99.sites/10.shop/_11.tariff-listing-page.2.js"); 50var m48 = require("../src/modules/3.navigation/40.plp-bar/_10.plp-bar.2.js"); 51var m49 = require("../src/modules/2.products/10.product-details/100.product-options/_100.product-options.2.js"); 52var m50 = require("../src/modules/2.products/10.product-details/110.product-crossselling/_110.product-crossselling.2.js"); 53 54},{"../src/modules/1.general/10.links/40.link-hotline/_40.link-hotline.2.js":85,"../src/modules/1.general/10.links/50.link-anchor/_50.link-anchor.2.js":86,"../src/modules/1.general/20.button/25.button-icon--scrollup/_25.button-icon--scrollup.2.js":87,"../src/modules/1.general/50.forms-items/100.slider/_100.slider.2.js":88,"../src/modules/1.general/50.forms-items/22.input--file/_22.input--file.2.js":89,"../src/modules/1.general/50.forms-items/23.date-input/_23.date-input.2.js":90,"../src/modules/1.general/50.forms-items/80.form-error/_80.form-error.2.js":91,"../src/modules/1.general/50.forms-items/90.switch/_90.switch.2.js":92,"../src/modules/1.general/51.forms-parts/140.search/_140.search.2.js":93,"../src/modules/1.general/60.media/10.image-ext/_10.image-ext.2.js":94,"../src/modules/1.general/60.media/90.picture-tag/_90.picture-tag.2.js":95,"../src/modules/1.general/62.embedded/10.embedded-optin-yt/_10.embedded-optin-yt.2.js":96,"../src/modules/1.general/80.messages/20.tooltip-ext/_20.tooltip-ext.2.js":97,"../src/modules/1.general/80.messages/40.popup/_40.popup.2.js":98,"../src/modules/1.general/80.messages/50.message-outdated/_50.message-outdated.2.js":99,"../src/modules/1.general/90.accordion/10.accordion/_10.accordion.2.js":100,"../src/modules/2.products/10.product-details/100.product-options/_100.product-options.2.js":101,"../src/modules/2.products/10.product-details/110.product-crossselling/_110.product-crossselling.2.js":102,"../src/modules/2.products/10.product-details/23.variant-switch/_23.variant-switch.2.js":103,"../src/modules/2.products/10.product-details/40.legal-texts/_40.legal-texts.2.js":104,"../src/modules/2.products/10.product-details/71.product-rating--icon/_71.product-rating--icon.2.js":105,"../src/modules/2.products/10.product-details/90.cost-overview/_90.cost-overview.2.js":106,"../src/modules/2.products/11.offer-details/10.counter-time/_10.counter-time.2.js":107,"../src/modules/2.products/20.product-boxes/110.product-detail-tariff-offer/_110.product-detail-tariff-offer.2.js":108,"../src/modules/2.products/20.product-boxes/62.product-info-box-text/_62.product-info-box-text.2.js":109,"../src/modules/2.products/30.configurator/100.config-variant/_100.config-variant.2.js":110,"../src/modules/2.products/30.configurator/110.config-navigation/_110.config-navigation.2.js":111,"../src/modules/2.products/30.configurator/70.quick-start/_70.quick-start.2.js":112,"../src/modules/2.products/30.configurator/71.quick-start-modern/_71.quick-start-modern.2.js":113,"../src/modules/2.products/30.configurator/80.config-list/_80.config-list.2.js":114,"../src/modules/2.products/30.configurator/90.config-filter/_90.config-filter.2.js":115,"../src/modules/2.products/40.detail-layer/10.tariff-detail-layer/_10.tariff-detail-layer.2.js":116,"../src/modules/20.mobilcom/10.offer/31.md-campaign-box--expandable/_31.md-campaign-box--expandable.2.js":117,"../src/modules/20.mobilcom/20.stage/20.md-stage-basic--bundle/_20.md-stage-basic--bundle.2.js":118,"../src/modules/20.mobilcom/20.stage/30.md-stage-offer--pk/_30.md-stage-offer--pk.2.js":119,"../src/modules/20.mobilcom/40.general/40.md-header/_40.md-header.2.js":120,"../src/modules/3.navigation/110.nav-boxes/10.nav-box/_10.nav-box.2.js":121,"../src/modules/3.navigation/25.horizontal-nav/20.grid-slider/_20.grid-slider.2.js":122,"../src/modules/3.navigation/40.plp-bar/_10.plp-bar.2.js":123,"../src/modules/3.navigation/80.tabcontent/10.tabcontent/_10.tabcontent.2.js":124,"../src/modules/3.navigation/80.tabcontent/20.navigation-tabs/_20.navigation-tabs.2.js":125,"../src/modules/3.navigation/80.tabcontent/21.navigation-tabs--big/_21.navigation-tabs--big.2.js":126,"../src/modules/5.content/40.steps/20.slider-steps/_20.slider-steps.2.js":127,"../src/modules/5.content/90.overlays/10.content-overlay/_10.content-overlay.2.js":128,"../src/modules/6.snippets/30.geo-location/10.location-search/_10.location-search.2.js":130,"../src/modules/6.snippets/30.geo-location/20.location-results/_20.location-results.2.js":132,"../src/modules/6.snippets/30.geo-location/30.location-map/_30.location-map.2.js":134,"../src/modules/6.snippets/50.extern/10.trusted-shops-snippet/_10.trusted-shops-snippet.2.js":135,"../src/modules/90.nofrills/10.offer/60.nf-offer-box-modern/_60.nf-offer-box-modern.2.js":136,"../src/modules/90.nofrills/40.navigation/10.nf-navigation-tariff/_10.nf-navigation-tariff.2.js":137,"../src/modules/99.sites/10.shop/_11.tariff-listing-page.2.js":138}],2:[function(require,module,exports){ 55function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 56/** 57 * @name MarkerClustererPlus for Google Maps V3 58 * @version 2.1.11 59 * @author Gary Little 60 * @fileoverview
61 * The library creates and manages per-zoom-level clusters for large amounts of markers. 62 * <p> 63 * This is an enhanced V3 implementation of the V2 MarkerClusterer by Xiaoxi Wu. It is 64 * based on the V3 MarkerClusterer port by Luke Mahe. MarkerClustererPlus was created 65 * by Gary Little. 66 * <p> 67 * v2.0 release: MarkerClustererPlus v2.0 is backward compatible with MarkerClusterer v1.0. It 68 * adds support for the <code>ignoreHidden</code>, <code>title</code>, <code>batchSizeIE</code>, 69 * and <code>calculator</code> properties as well as support for four more events. It also allows 70 * greater control over the styling of the text that appears on the cluster marker. The 71 * documentation has been significantly improved and the overall code has been simplified and 72 * polished. Very large numbers of markers can now be managed without causing Javascript timeout 73 * errors on Internet Explorer. Note that the name of the <code>clusterclick</code> event has been 74 * deprecated. The new name is <code>click</code>, so please change your application code now. 75 */ 76 77/** 78 * Licensed under the Apache License, Version 2.0 (the "License"); 79 * you may not use this file except in compliance with the License. 80 * You may obtain a copy of the License at 81 * 82 * http://www.apache.org/licenses/LICENSE-2.0 83 * 84 * Unless required by applicable law or agreed to in writing, software 85 * distributed under the License is distributed on an "AS IS" BASIS, 86 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 87 * See the License for the specific language governing permissions and 88 * limitations under the License. 89 */ 90 91/** 92 * @name ClusterIconStyle 93 * @class This class represents the object for values in the <code>styles</code> array passed 94 * to the {@link MarkerClusterer} constructor. The element in this array that is used to 95 * style the cluster icon is determined by calling the <code>calculator</code> function. 96 * 97 * @property {string} url The URL of the cluster icon image file. Required. 98 * @property {number} height The display height (in pixels) of the cluster icon. Required. 99 * @property {number} width The display width (in pixels) of the cluster icon. Required. 100 * @property {Array} [anchorText] The position (in pixels) from the center of the cluster icon to 101 * where the text label is to be centered and drawn. The format is <code>[yoffset, xoffset]</code> 102 * where <code>yoffset</code> increases as you go down from center and <code>xoffset</code> 103 * increases to the right of center. The default is <code>[0, 0]</code>. 104 * @property {Array} [anchorIcon] The anchor position (in pixels) of the cluster icon. This is the 105 * spot on the cluster icon that is to be aligned with the cluster position. The format is 106 * <code>[yoffset, xoffset]</code> where <code>yoffset</code> increases as you go down and 107 * <code>xoffset</code> increases to the right of the top-left corner of the icon. The default 108 * anchor position is the center of the cluster icon. 109 * @property {string} [textColor="black"] The color of the label text shown on the 110 * cluster icon. 111 * @property {number} [textSize=11] The size (in pixels) of the label text shown on the 112 * cluster icon. 113 * @property {string} [textDecoration="none"] The value of the CSS <code>text-decoration</code> 114 * property for the label text shown on the cluster icon. 115 * @property {string} [fontWeight="bold"] The value of the CSS <code>font-weight</code> 116 * property for the label text shown on the cluster icon. 117 * @property {string} [fontStyle="normal"] The value of the CSS <code>font-style</code> 118 * property for the label text shown on the cluster icon. 119 * @property {string} [fontFamily="Arial,sans-serif"] The value of the CSS <code>font-family</code> 120 * property for the label text shown on the cluster icon. 121 * @property {string} [backgroundPosition="0 0"] The position of the cluster icon image 122 * within the image defined by <code>url</code>. The format is <code>"xpos ypos"</code> 123 * (the same format as for the CSS <code>background-position</code> property). You must set 124 * this property appropriately when the image defined by <code>url</code> represents a sprite 125 * containing multiple images. Note that the position <i>must</i> be specified in px units. 126 */ 127/** 128 * @name ClusterIconInfo
129 * @class This class is an object containing general information about a cluster icon. This is 130 * the object that a <code>calculator</code> function returns. 131 * 132 * @property {string} text The text of the label to be shown on the cluster icon. 133 * @property {number} index The index plus 1 of the element in the <code>styles</code> 134 * array to be used to style the cluster icon. 135 * @property {string} title The tooltip to display when the mouse moves over the cluster icon. 136 * If this value is <code>undefined</code> or <code>""</code>, <code>title</code> is set to the 137 * value of the <code>title</code> property passed to the MarkerClusterer. 138 */ 139/** 140 * A cluster icon. 141 * 142 * @constructor 143 * @extends google.maps.OverlayView 144 * @param {Cluster} cluster The cluster with which the icon is to be associated. 145 * @param {Array} [styles] An array of {@link ClusterIconStyle} defining the cluster icons 146 * to use for various cluster sizes. 147 * @private 148 */ 149function ClusterIcon(cluster, styles) { 150 cluster.getMarkerClusterer().extend(ClusterIcon, google.maps.OverlayView); 151 this.cluster_ = cluster; 152 this.className_ = cluster.getMarkerClusterer().getClusterClass(); 153 this.styles_ = styles; 154 this.center_ = null; 155 this.div_ = null; 156 this.sums_ = null; 157 this.visible_ = false; 158 this.setMap(cluster.getMap()); // Note: this causes onAdd to be called 159} 160 161/** 162 * Adds the icon to the DOM. 163 */ 164ClusterIcon.prototype.onAdd = function () { 165 var cClusterIcon = this; 166 var cMouseDownInCluster; 167 var cDraggingMapByCluster; 168 var gmVersion = google.maps.version.split("."); 169 gmVersion = parseInt(gmVersion[0] * 100, 10) + parseInt(gmVersion[1], 10); 170 this.div_ = document.createElement("div"); 171 this.div_.className = this.className_; 172 if (this.visible_) { 173 this.show(); 174 } 175 this.getPanes().overlayMouseTarget.appendChild(this.div_); 176 177 // Fix for Issue 157 178 this.boundsChangedListener_ = google.maps.event.addListener(this.getMap(), "bounds_changed", function () { 179 cDraggingMapByCluster = cMouseDownInCluster; 180 }); 181 google.maps.event.addDomListener(this.div_, "mousedown", function () { 182 cMouseDownInCluster = true; 183 cDraggingMapByCluster = false; 184 }); 185 186 // March 1, 2018: Fix for this 3.32 exp bug, https://issuetracker.google.com/issues/73571522 187 // But it doesn't work with earlier releases so do a version check. 188 if (gmVersion >= 332) { 189 // Ugly version-dependent code 190 google.maps.event.addDomListener(this.div_, "touchstart", function (e) { 191 e.stopPropagation(); 192 }); 193 } 194 google.maps.event.addDomListener(this.div_, "click", function (e) { 195 cMouseDownInCluster = false; 196 if (!cDraggingMapByCluster) { 197 var theBounds; 198 var mz; 199 var mc = cClusterIcon.cluster_.getMarkerClusterer(); 200 /** 201 * This event is fired when a cluster marker is clicked. 202 * @name MarkerClusterer#click 203 * @param {Cluster} c The cluster that was clicked. 204 * @event 205 */ 206 google.maps.event.trigger(mc, "click", cClusterIcon.cluster_); 207 google.maps.event.trigger(mc, "clusterclick", cClusterIcon.cluster_); // deprecated name 208 209 // The default click handler follows. Disable it by setting 210 // the zoomOnClick property to false. 211 if (mc.getZoomOnClick()) { 212 // Zoom into the cluster. 213 mz = mc.getMaxZoom(); 214 theBounds = cClusterIcon.cluster_.getBounds(); 215 mc.getMap().fitBounds(theBounds); 216 // There is a fix for Issue 170 here: 217 setTimeout(function () { 218 mc.getMap().fitBounds(theBounds); 219 // Don't zoom beyond the max zoom level 220 if (mz !== null && mc.getMap().getZoom() > mz) { 221 mc.getMap().setZoom(mz + 1); 222 } 223 }, 100); 224 } 225 226 // Prevent event propagation to the map: 227 e.cancelBubble = true; 228 if (e.stopPropagation) { 229 e.stopPropagation(); 230 } 231 } 232 }); 233 google.maps.event.addDomListener(this.div_, "mouseover", function () { 234 var mc = cClusterIcon.cluster_.getMarkerClusterer(); 235 /** 236 * This event is fired when the mouse moves over a cluster marker. 237 * @name MarkerClusterer#mouseover 238 * @param {Cluster} c The cluster that the mouse moved over. 239 * @event 240 */ 241 google.maps.event.trigger(mc, "mouseover", cClusterIcon.cluster_); 242 }); 243 google.maps.event.addDomListener(this.div_, "mouseout", function () { 244 var mc = cClusterIcon.cluster_.getMarkerClusterer(); 245 /**
246 * This event is fired when the mouse moves out of a cluster marker. 247 * @name MarkerClusterer#mouseout 248 * @param {Cluster} c The cluster that the mouse moved out of. 249 * @event 250 */ 251 google.maps.event.trigger(mc, "mouseout", cClusterIcon.cluster_); 252 }); 253}; 254 255/** 256 * Removes the icon from the DOM. 257 */ 258ClusterIcon.prototype.onRemove = function () { 259 if (this.div_ && this.div_.parentNode) { 260 this.hide(); 261 google.maps.event.removeListener(this.boundsChangedListener_); 262 google.maps.event.clearInstanceListeners(this.div_); 263 this.div_.parentNode.removeChild(this.div_); 264 this.div_ = null; 265 } 266}; 267 268/** 269 * Draws the icon. 270 */ 271ClusterIcon.prototype.draw = function () { 272 if (this.visible_) { 273 var pos = this.getPosFromLatLng_(this.center_); 274 this.div_.style.top = pos.y + "px"; 275 this.div_.style.left = pos.x + "px"; 276 this.div_.style.zIndex = google.maps.Marker.MAX_ZINDEX + 1; // Put above all unclustered markers 277 } 278}; 279 280/** 281 * Hides the icon. 282 */ 283ClusterIcon.prototype.hide = function () { 284 if (this.div_) { 285 this.div_.style.display = "none"; 286 } 287 this.visible_ = false; 288}; 289 290/** 291 * Positions and shows the icon. 292 */ 293ClusterIcon.prototype.show = function () { 294 if (this.div_) { 295 var img = ""; 296 // NOTE: values must be specified in px units 297 var bp = this.backgroundPosition_.split(" "); 298 var spriteH = parseInt(bp[0].replace(/^\s+|\s+$/g, ""), 10); 299 var spriteV = parseInt(bp[1].replace(/^\s+|\s+$/g, ""), 10); 300 var pos = this.getPosFromLatLng_(this.center_); 301 this.div_.style.cssText = this.createCss(pos); 302 img = "<img src='" + this.url_ + "' style='position: absolute; top: " + spriteV + "px; left: " + spriteH + "px; "; 303 if (this.cluster_.getMarkerClusterer().enableRetinaIcons_) { 304 img += "width: " + this.width_ + "px; height: " + this.height_ + "px;"; 305 } else { 306 img += "clip: rect(" + -1 * spriteV + "px, " + (-1 * spriteH + this.width_) + "px, " + (-1 * spriteV + this.height_) + "px, " + -1 * spriteH + "px);"; 307 } 308 img += "'>"; 309 this.div_.innerHTML = img + "<div style='" + "position: absolute;" + "top: " + this.anchorText_[0] + "px;" + "left: " + this.anchorText_[1] + "px;" + "color: " + this.textColor_ + ";" + "font-size: " + this.textSize_ + "px;" + "font-family: " + this.fontFamily_ + ";" + "font-weight: " + this.fontWeight_ + ";" + "font-style: " + this.fontStyle_ + ";" + "text-decoration: " + this.textDecoration_ + ";" + "text-align: center;" + "width: " + this.width_ + "px;" + "line-height:" + this.height_ + "px;" + "'>" + this.sums_.text + "</div>"; 310 if (typeof this.sums_.title === "undefined" || this.sums_.title === "") { 311 this.div_.title = this.cluster_.getMarkerClusterer().getTitle(); 312 } else { 313 this.div_.title = this.sums_.title; 314 } 315 this.div_.style.display = ""; 316 } 317 this.visible_ = true; 318}; 319 320/** 321 * Sets the icon styles to the appropriate element in the styles array. 322 * 323 * @param {ClusterIconInfo} sums The icon label text and styles index. 324 */ 325ClusterIcon.prototype.useStyle = function (sums) { 326 this.sums_ = sums; 327 var index = Math.max(0, sums.index - 1); 328 index = Math.min(this.styles_.length - 1, index); 329 var style = this.styles_[index]; 330 this.url_ = style.url; 331 this.height_ = style.height; 332 this.width_ = style.width; 333 this.anchorText_ = style.anchorText || [0, 0]; 334 this.anchorIcon_ = style.anchorIcon || [parseInt(this.height_ / 2, 10), parseInt(this.width_ / 2, 10)]; 335 this.textColor_ = style.textColor || "black"; 336 this.textSize_ = style.textSize || 11; 337 this.textDecoration_ = style.textDecoration || "none"; 338 this.fontWeight_ = style.fontWeight || "bold"; 339 this.fontStyle_ = style.fontStyle || "normal"; 340 this.fontFamily_ = style.fontFamily || "Arial,sans-serif"; 341 this.backgroundPosition_ = style.backgroundPosition || "0 0"; 342}; 343 344/** 345 * Sets the position at which to center the icon. 346 * 347 * @param {google.maps.LatLng} center The latlng to set as the center. 348 */ 349ClusterIcon.prototype.setCenter = function (center) { 350 this.center_ = center; 351}; 352 353/** 354 * Creates the cssText style parameter based on the position of the icon. 355 * 356 * @param {google.maps.Point} pos The position of the icon. 357 * @return {string} The CSS style text. 358 */ 359ClusterIcon.prototype.createCss = function (pos) { 360 var style = []; 361 style.push("cursor: pointer;"); 362 style.push("position: absolute; top: " + pos.y + "px; left: " + pos.x + "px;"); 363 style.push("width: " + this.width_ + "px; height: " + this.height_ + "px;"); 364 style.push("-webkit-user-select: none;"); 365 style.push("-khtml-user-select: none;"); 366 style.push("-moz-user-select: none;"); 367 style.push("-o-user-select: none;"); 368 style.push("user-select: none;"); 369 return style.join(""); 370}; 371 372/** 373 * Returns the position at which to place the DIV depending on the latlng. 374 * 375 * @param {google.maps.LatLng} latlng The position in latlng. 376 * @return {google.maps.Point} The position in pixels. 377 */ 378ClusterIcon.prototype.getPosFromLatLng_ = function (latlng) { 379 var pos = this.getProjection().fromLatLngToDivPixel(latlng); 380 pos.x -= this.anchorIcon_[1]; 381 pos.y -= this.anchorIcon_[0]; 382 pos.x = parseInt(pos.x, 10); 383 pos.y = parseInt(pos.y, 10); 384 return pos; 385}; 386 387/** 388 * Creates a single cluster that manages a group of proximate markers. 389 * Used internally, do not call this constructor directly. 390 * @constructor 391 * @param {MarkerClusterer} mc The <code>MarkerClusterer</code> object with which this 392 * cluster is associated. 393 */ 394function Cluster(mc) { 395 this.markerClusterer_ = mc; 396 this.map_ = mc.getMap(); 397 this.gridSize_ = mc.getGridSize(); 398 this.minClusterSize_ = mc.getMinimumClusterSize(); 399 this.averageCenter_ = mc.getAverageCenter(); 400 this.markers_ = []; 401 this.center_ = null; 402 this.bounds_ = null; 403 this.clusterIcon_ = new ClusterIcon(this, mc.getStyles()); 404} 405 406/** 407 * Returns the number of markers managed by the cluster. You can call this from 408 * a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler 409 * for the <code>MarkerClusterer</code> object. 410 * 411 * @return {number} The number of markers in the cluster. 412 */ 413Cluster.prototype.getSize = function () { 414 return this.markers_.length; 415}; 416 417/** 418 * Returns the array of markers managed by the cluster. You can call this from 419 * a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler 420 * for the <code>MarkerClusterer</code> object. 421 * 422 * @return {Array} The array of markers in the cluster. 423 */ 424Cluster.prototype.getMarkers = function () { 425 return this.markers_; 426}; 427 428/** 429 * Returns the center of the cluster. You can call this from 430 * a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler 431 * for the <code>MarkerClusterer</code> object. 432 * 433 * @return {google.maps.LatLng} The center of the cluster. 434 */ 435Cluster.prototype.getCenter = function () { 436 return this.center_; 437}; 438 439/** 440 * Returns the map with which the cluster is associated. 441 * 442 * @return {google.maps.Map} The map. 443 * @ignore 444 */ 445Cluster.prototype.getMap = function () { 446 return this.map_; 447}; 448 449/** 450 * Returns the <code>MarkerClusterer</code> object with which the cluster is associated. 451 * 452 * @return {MarkerClusterer} The associated marker clusterer. 453 * @ignore 454 */ 455Cluster.prototype.getMarkerClusterer = function () { 456 return this.markerClusterer_; 457}; 458 459/** 460 * Returns the bounds of the cluster. 461 * 462 * @return {google.maps.LatLngBounds} the cluster bounds. 463 * @ignore 464 */ 465Cluster.prototype.getBounds = function () { 466 var i; 467 var bounds = new google.maps.LatLngBounds(this.center_, this.center_); 468 var markers = this.getMarkers(); 469 for (i = 0; i < markers.length; i++) { 470 bounds.extend(markers[i].getPosition()); 471 } 472 return bounds; 473}; 474 475/** 476 * Removes the cluster from the map. 477 * 478 * @ignore 479 */ 480Cluster.prototype.remove = function () { 481 this.clusterIcon_.setMap(null); 482 this.markers_ = []; 483 delete this.markers_; 484}; 485 486/** 487 * Adds a marker to the cluster. 488 * 489 * @param {google.maps.Marker} marker The marker to be added. 490 * @return {boolean} True if the marker was added. 491 * @ignore 492 */ 493Cluster.prototype.addMarker = function (marker) { 494 var i; 495 var mCount; 496 var mz; 497 if (this.isMarkerAlreadyAdded_(marker)) { 498 return false;
499 } 500 if (!this.center_) { 501 this.center_ = marker.getPosition(); 502 this.calculateBounds_(); 503 } else { 504 if (this.averageCenter_) { 505 var l = this.markers_.length + 1; 506 var lat = (this.center_.lat() * (l - 1) + marker.getPosition().lat()) / l; 507 var lng = (this.center_.lng() * (l - 1) + marker.getPosition().lng()) / l; 508 this.center_ = new google.maps.LatLng(lat, lng); 509 this.calculateBounds_(); 510 } 511 } 512 marker.isAdded = true; 513 this.markers_.push(marker); 514 mCount = this.markers_.length; 515 mz = this.markerClusterer_.getMaxZoom(); 516 if (mz !== null && this.map_.getZoom() > mz) { 517 // Zoomed in past max zoom, so show the marker. 518 if (marker.getMap() !== this.map_) { 519 marker.setMap(this.map_); 520 } 521 } else if (mCount < this.minClusterSize_) { 522 // Min cluster size not reached so show the marker. 523 if (marker.getMap() !== this.map_) { 524 marker.setMap(this.map_); 525 } 526 } else if (mCount === this.minClusterSize_) { 527 // Hide the markers that were showing. 528 for (i = 0; i < mCount; i++) { 529 this.markers_[i].setMap(null); 530 } 531 } else { 532 marker.setMap(null); 533 } 534 this.updateIcon_(); 535 return true; 536}; 537 538/** 539 * Determines if a marker lies within the cluster's bounds. 540 * 541 * @param {google.maps.Marker} marker The marker to check. 542 * @return {boolean} True if the marker lies in the bounds. 543 * @ignore 544 */ 545Cluster.prototype.isMarkerInClusterBounds = function (marker) { 546 return this.bounds_.contains(marker.getPosition()); 547}; 548 549/**
550 * Calculates the extended bounds of the cluster with the grid. 551 */ 552Cluster.prototype.calculateBounds_ = function () { 553 var bounds = new google.maps.LatLngBounds(this.center_, this.center_); 554 this.bounds_ = this.markerClusterer_.getExtendedBounds(bounds); 555}; 556 557/** 558 * Updates the cluster icon. 559 */ 560Cluster.prototype.updateIcon_ = function () { 561 var mCount = this.markers_.length; 562 var mz = this.markerClusterer_.getMaxZoom(); 563 if (mz !== null && this.map_.getZoom() > mz) { 564 this.clusterIcon_.hide(); 565 return; 566 } 567 if (mCount < this.minClusterSize_) { 568 // Min cluster size not yet reached. 569 this.clusterIcon_.hide(); 570 return; 571 } 572 var numStyles = this.markerClusterer_.getStyles().length; 573 var sums = this.markerClusterer_.getCalculator()(this.markers_, numStyles); 574 this.clusterIcon_.setCenter(this.center_); 575 this.clusterIcon_.useStyle(sums); 576 this.clusterIcon_.show(); 577}; 578 579/** 580 * Determines if a marker has already been added to the cluster. 581 * 582 * @param {google.maps.Marker} marker The marker to check. 583 * @return {boolean} True if the marker has already been added. 584 */ 585Cluster.prototype.isMarkerAlreadyAdded_ = function (marker) { 586 var i; 587 if (this.markers_.indexOf) { 588 return this.markers_.indexOf(marker) !== -1; 589 } else { 590 for (i = 0; i < this.markers_.length; i++) { 591 if (marker === this.markers_[i]) { 592 return true; 593 } 594 } 595 } 596 return false; 597}; 598 599/** 600 * @name MarkerClustererOptions 601 * @class This class represents the optional parameter passed to 602 * the {@link MarkerClusterer} constructor. 603 * @property {number} [gridSize=60] The grid size of a cluster in pixels. The grid is a square. 604 * @property {number} [maxZoom=null] The maximum zoom level at which clustering is enabled or 605 * <code>null</code> if clustering is to be enabled at all zoom levels. 606 * @property {boolean} [zoomOnClick=true] Whether to zoom the map when a cluster marker is 607 * clicked. You may want to set this to <code>false</code> if you have installed a handler 608 * for the <code>click</code> event and it deals with zooming on its own. 609 * @property {boolean} [averageCenter=false] Whether the position of a cluster marker should be 610 * the average position of all markers in the cluster. If set to <code>false</code>, the 611 * cluster marker is positioned at the location of the first marker added to the cluster. 612 * @property {number} [minimumClusterSize=2] The minimum number of markers needed in a cluster 613 * before the markers are hidden and a cluster marker appears. 614 * @property {boolean} [ignoreHidden=false] Whether to ignore hidden markers in clusters. You 615 * may want to set this to <code>true</code> to ensure that hidden markers are not included 616 * in the marker count that appears on a cluster marker (this count is the value of the 617 * <code>text</code> property of the result returned by the default <code>calculator</code>). 618 * If set to <code>true</code> and you change the visibility of a marker being clustered, be 619 * sure to also call <code>MarkerClusterer.repaint()</code>. 620 * @property {string} [title=""] The tooltip to display when the mouse moves over a cluster 621 * marker. (Alternatively, you can use a custom <code>calculator</code> function to specify a 622 * different tooltip for each cluster marker.) 623 * @property {function} [calculator=MarkerClusterer.CALCULATOR] The function used to determine 624 * the text to be displayed on a cluster marker and the index indicating which style to use 625 * for the cluster marker. The input parameters for the function are (1) the array of markers 626 * represented by a cluster marker and (2) the number of cluster icon styles. It returns a 627 * {@link ClusterIconInfo} object. The default <code>calculator</code> returns a 628 * <code>text</code> property which is the number of markers in the cluster and an 629 * <code>index</code> property which is one higher than the lowest integer such that 630 * <code>10^i</code> exceeds the number of markers in the cluster, or the size of the styles 631 * array, whichever is less. The <code>styles</code> array element used has an index of 632 * <code>index</code> minus 1. For example, the default <code>calculator</code> returns a 633 * <code>text</code> value of <code>"125"</code> and an <code>index</code> of <code>3</code> 634 * for a cluster icon representing 125 markers so the element used in the <code>styles</code> 635 * array is <code>2</code>. A <code>calculator</code> may also return a <code>title</code> 636 * property that contains the text of the tooltip to be used for the cluster marker. If 637 * <code>title</code> is not defined, the tooltip is set to the value of the <code>title</code> 638 * property for the MarkerClusterer. 639 * @property {string} [clusterClass="cluster"] The name of the CSS class defining general styles 640 * for the cluster markers. Use this class to define CSS styles that are not set up by the code 641 * that processes the <code>styles</code> array.
642 * @property {Array} [styles] An array of {@link ClusterIconStyle} elements defining the styles 643 * of the cluster markers to be used. The element to be used to style a given cluster marker 644 * is determined by the function defined by the <code>calculator</code> property. 645 * The default is an array of {@link ClusterIconStyle} elements whose properties are derived 646 * from the values for <code>imagePath</code>, <code>imageExtension</code>, and 647 * <code>imageSizes</code>. 648 * @property {boolean} [enableRetinaIcons=false] Whether to allow the use of cluster icons that 649 * have sizes that are some multiple (typically double) of their actual display size. Icons such 650 * as these look better when viewed on high-resolution monitors such as Apple's Retina displays. 651 * Note: if this property is <code>true</code>, sprites cannot be used as cluster icons. 652 * @property {number} [batchSize=MarkerClusterer.BATCH_SIZE] Set this property to the 653 * number of markers to be processed in a single batch when using a browser other than 654 * Internet Explorer (for Internet Explorer, use the batchSizeIE property instead). 655 * @property {number} [batchSizeIE=MarkerClusterer.BATCH_SIZE_IE] When Internet Explorer is 656 * being used, markers are processed in several batches with a small delay inserted between 657 * each batch in an attempt to avoid Javascript timeout errors. Set this property to the 658 * number of markers to be processed in a single batch; select as high a number as you can 659 * without causing a timeout error in the browser. This number might need to be as low as 100 660 * if 15,000 markers are being managed, for example. 661 * @property {string} [imagePath=MarkerClusterer.IMAGE_PATH] 662 * The full URL of the root name of the group of image files to use for cluster icons. 663 * The complete file name is of the form <code>imagePath</code>n.<code>imageExtension</code> 664 * where n is the image file number (1, 2, etc.). 665 * @property {string} [imageExtension=MarkerClusterer.IMAGE_EXTENSION] 666 * The extension name for the cluster icon image files (e.g., <code>"png"</code> or 667 * <code>"jpg"</code>). 668 * @property {Array} [imageSizes=MarkerClusterer.IMAGE_SIZES] 669 * An array of numbers containing the widths of the group of 670 * <code>imagePath</code>n.<code>imageExtension</code> image files. 671 * (The images are assumed to be square.) 672 */ 673/** 674 * Creates a MarkerClusterer object with the options specified in {@link MarkerClustererOptions}. 675 * @constructor 676 * @extends google.maps.OverlayView 677 * @param {google.maps.Map} map The Google map to attach to. 678 * @param {Array.<google.maps.Marker>} [opt_markers] The markers to be added to the cluster. 679 * @param {MarkerClustererOptions} [opt_options] The optional parameters. 680 */ 681function MarkerClusterer(map, opt_markers, opt_options) { 682 // MarkerClusterer implements google.maps.OverlayView interface. We use the 683 // extend function to extend MarkerClusterer with google.maps.OverlayView 684 // because it might not always be available when the code is defined so we 685 // look for it at the last possible moment. If it doesn't exist now then 686 // there is no point going ahead :) 687 this.extend(MarkerClusterer, google.maps.OverlayView); 688 opt_markers = opt_markers || []; 689 opt_options = opt_options || {}; 690 this.markers_ = []; 691 this.clusters_ = []; 692 this.listeners_ = []; 693 this.activeMap_ = null; 694 this.ready_ = false; 695 this.gridSize_ = opt_options.gridSize || 60; 696 this.minClusterSize_ = opt_options.minimumClusterSize || 2; 697 this.maxZoom_ = opt_options.maxZoom || null; 698 this.styles_ = opt_options.styles || []; 699 this.title_ = opt_options.title || ""; 700 this.zoomOnClick_ = true; 701 if (opt_options.zoomOnClick !== undefined) { 702 this.zoomOnClick_ = opt_options.zoomOnClick; 703 } 704 this.averageCenter_ = false; 705 if (opt_options.averageCenter !== undefined) { 706 this.averageCenter_ = opt_options.averageCenter; 707 } 708 this.ignoreHidden_ = false; 709 if (opt_options.ignoreHidden !== undefined) { 710 this.ignoreHidden_ = opt_options.ignoreHidden; 711 } 712 this.enableRetinaIcons_ = false; 713 if (opt_options.enableRetinaIcons !== undefined) { 714 this.enableRetinaIcons_ = opt_options.enableRetinaIcons; 715 } 716 this.imagePath_ = opt_options.imagePath || MarkerClusterer.IMAGE_PATH; 717 this.imageExtension_ = opt_options.imageExtension || MarkerClusterer.IMAGE_EXTENSION; 718 this.imageSizes_ = opt_options.imageSizes || MarkerClusterer.IMAGE_SIZES; 719 this.calculator_ = opt_options.calculator || MarkerClusterer.CALCULATOR; 720 this.batchSize_ = opt_options.batchSize || MarkerClusterer.BATCH_SIZE; 721 this.batchSizeIE_ = opt_options.batchSizeIE || MarkerClusterer.BATCH_SIZE_IE; 722 this.clusterClass_ = opt_options.clusterClass || "cluster"; 723 if (navigator.userAgent.toLowerCase().indexOf("msie") !== -1) { 724 // Try to avoid IE timeout when processing a huge number of markers: 725 this.batchSize_ = this.batchSizeIE_; 726 } 727 this.setupStyles_(); 728 this.addMarkers(opt_markers, true);
729 this.setMap(map); // Note: this causes onAdd to be called 730} 731 732/** 733 * Implementation of the onAdd interface method. 734 * @ignore 735 */ 736MarkerClusterer.prototype.onAdd = function () { 737 var cMarkerClusterer = this; 738 this.activeMap_ = this.getMap(); 739 this.ready_ = true; 740 this.repaint(); 741 this.prevZoom_ = this.getMap().getZoom(); 742 743 // Add the map event listeners 744 this.listeners_ = [google.maps.event.addListener(this.getMap(), "zoom_changed", function () { 745 // Fix for bug #407 746 // Determines map type and prevents illegal zoom levels 747 var zoom = this.getMap().getZoom(); 748 var minZoom = this.getMap().minZoom || 0; 749 var maxZoom = Math.min(this.getMap().maxZoom || 100, this.getMap().mapTypes[this.getMap().getMapTypeId()].maxZoom); 750 zoom = Math.min(Math.max(zoom, minZoom), maxZoom); 751 if (this.prevZoom_ != zoom) { 752 this.prevZoom_ = zoom; 753 this.resetViewport_(false); 754 } 755 }.bind(this)), google.maps.event.addListener(this.getMap(), "idle", function () { 756 cMarkerClusterer.redraw_(); 757 })]; 758}; 759 760/** 761 * Implementation of the onRemove interface method. 762 * Removes map event listeners and all cluster icons from the DOM. 763 * All managed markers are also put back on the map. 764 * @ignore 765 */ 766MarkerClusterer.prototype.onRemove = function () { 767 var i; 768 769 // Put all the managed markers back on the map: 770 for (i = 0; i < this.markers_.length; i++) { 771 if (this.markers_[i].getMap() !== this.activeMap_) { 772 this.markers_[i].setMap(this.activeMap_); 773 } 774 } 775 776 // Remove all clusters: 777 for (i = 0; i < this.clusters_.length; i++) { 778 this.clusters_[i].remove(); 779 } 780 this.clusters_ = []; 781 782 // Remove map event listeners: 783 for (i = 0; i < this.listeners_.length; i++) { 784 google.maps.event.removeListener(this.listeners_[i]); 785 } 786 this.listeners_ = []; 787 this.activeMap_ = null; 788 this.ready_ = false; 789}; 790 791/** 792 * Implementation of the draw interface method. 793 * @ignore 794 */ 795MarkerClusterer.prototype.draw = function () {}; 796 797/** 798 * Sets up the styles object. 799 */ 800MarkerClusterer.prototype.setupStyles_ = function () { 801 var i, size; 802 if (this.styles_.length > 0) { 803 return; 804 } 805 for (i = 0; i < this.imageSizes_.length; i++) { 806 size = this.imageSizes_[i]; 807 this.styles_.push({ 808 url: this.imagePath_ + (i + 1) + "." + this.imageExtension_, 809 height: size, 810 width: size 811 }); 812 } 813}; 814 815/** 816 * Fits the map to the bounds of the markers managed by the clusterer. 817 */ 818MarkerClusterer.prototype.fitMapToMarkers = function () { 819 var i; 820 var markers = this.getMarkers(); 821 var bounds = new google.maps.LatLngBounds(); 822 for (i = 0; i < markers.length; i++) { 823 // March 3, 2018: Bug fix -- honor the ignoreHidden property 824 if (markers[i].getVisible() || !this.getIgnoreHidden()) { 825 bounds.extend(markers[i].getPosition()); 826 } 827 } 828 this.getMap().fitBounds(bounds); 829}; 830 831/** 832 * Returns the value of the <code>gridSize</code> property. 833 * 834 * @return {number} The grid size. 835 */ 836MarkerClusterer.prototype.getGridSize = function () { 837 return this.gridSize_; 838}; 839 840/** 841 * Sets the value of the <code>gridSize</code> property. 842 * 843 * @param {number} gridSize The grid size. 844 */ 845MarkerClusterer.prototype.setGridSize = function (gridSize) { 846 this.gridSize_ = gridSize; 847}; 848 849/** 850 * Returns the value of the <code>minimumClusterSize</code> property. 851 * 852 * @return {number} The minimum cluster size. 853 */ 854MarkerClusterer.prototype.getMinimumClusterSize = function () { 855 return this.minClusterSize_; 856}; 857 858/** 859 * Sets the value of the <code>minimumClusterSize</code> property. 860 * 861 * @param {number} minimumClusterSize The minimum cluster size. 862 */ 863MarkerClusterer.prototype.setMinimumClusterSize = function (minimumClusterSize) { 864 this.minClusterSize_ = minimumClusterSize; 865}; 866 867/** 868 * Returns the value of the <code>maxZoom</code> property. 869 * 870 * @return {number} The maximum zoom level. 871 */ 872MarkerClusterer.prototype.getMaxZoom = function () { 873 return this.maxZoom_; 874}; 875 876/** 877 * Sets the value of the <code>maxZoom</code> property. 878 * 879 * @param {number} maxZoom The maximum zoom level. 880 */ 881MarkerClusterer.prototype.setMaxZoom = function (maxZoom) { 882 this.maxZoom_ = maxZoom; 883}; 884 885/** 886 * Returns the value of the <code>styles</code> property. 887 * 888 * @return {Array} The array of styles defining the cluster markers to be used. 889 */ 890MarkerClusterer.prototype.getStyles = function () { 891 return this.styles_; 892}; 893 894/** 895 * Sets the value of the <code>styles</code> property. 896 * 897 * @param {Array.<ClusterIconStyle>} styles The array of styles to use. 898 */ 899MarkerClusterer.prototype.setStyles = function (styles) { 900 this.styles_ = styles; 901}; 902 903/** 904 * Returns the value of the <code>title</code> property. 905 * 906 * @return {string} The content of the title text. 907 */ 908MarkerClusterer.prototype.getTitle = function () { 909 return this.title_; 910}; 911 912/** 913 * Sets the value of the <code>title</code> property. 914 * 915 * @param {string} title The value of the title property. 916 */ 917MarkerClusterer.prototype.setTitle = function (title) { 918 this.title_ = title; 919}; 920 921/** 922 * Returns the value of the <code>zoomOnClick</code> property. 923 * 924 * @return {boolean} True if zoomOnClick property is set. 925 */ 926MarkerClusterer.prototype.getZoomOnClick = function () { 927 return this.zoomOnClick_; 928}; 929 930/** 931 * Sets the value of the <code>zoomOnClick</code> property. 932 * 933 * @param {boolean} zoomOnClick The value of the zoomOnClick property. 934 */ 935MarkerClusterer.prototype.setZoomOnClick = function (zoomOnClick) { 936 this.zoomOnClick_ = zoomOnClick; 937}; 938 939/** 940 * Returns the value of the <code>averageCenter</code> property. 941 * 942 * @return {boolean} True if averageCenter property is set. 943 */ 944MarkerClusterer.prototype.getAverageCenter = function () { 945 return this.averageCenter_; 946}; 947 948/** 949 * Sets the value of the <code>averageCenter</code> property. 950 * 951 * @param {boolean} averageCenter The value of the averageCenter property. 952 */ 953MarkerClusterer.prototype.setAverageCenter = function (averageCenter) { 954 this.averageCenter_ = averageCenter; 955}; 956 957/** 958 * Returns the value of the <code>ignoreHidden</code> property. 959 * 960 * @return {boolean} True if ignoreHidden property is set. 961 */ 962MarkerClusterer.prototype.getIgnoreHidden = function () { 963 return this.ignoreHidden_; 964}; 965 966/** 967 * Sets the value of the <code>ignoreHidden</code> property. 968 * 969 * @param {boolean} ignoreHidden The value of the ignoreHidden property. 970 */ 971MarkerClusterer.prototype.setIgnoreHidden = function (ignoreHidden) { 972 this.ignoreHidden_ = ignoreHidden; 973}; 974 975/** 976 * Returns the value of the <code>enableRetinaIcons</code> property. 977 * 978 * @return {boolean} True if enableRetinaIcons property is set. 979 */ 980MarkerClusterer.prototype.getEnableRetinaIcons = function () { 981 return this.enableRetinaIcons_; 982}; 983 984/** 985 * Sets the value of the <code>enableRetinaIcons</code> property. 986 * 987 * @param {boolean} enableRetinaIcons The value of the enableRetinaIcons property. 988 */ 989MarkerClusterer.prototype.setEnableRetinaIcons = function (enableRetinaIcons) { 990 this.enableRetinaIcons_ = enableRetinaIcons; 991}; 992 993/** 994 * Returns the value of the <code>imageExtension</code> property. 995 * 996 * @return {string} The value of the imageExtension property. 997 */ 998MarkerClusterer.prototype.getImageExtension = function () { 999 return this.imageExtension_; 1000}; 1001 1002/** 1003 * Sets the value of the <code>imageExtension</code> property. 1004 * 1005 * @param {string} imageExtension The value of the imageExtension property. 1006 */ 1007MarkerClusterer.prototype.setImageExtension = function (imageExtension) { 1008 this.imageExtension_ = imageExtension; 1009}; 1010 1011/** 1012 * Returns the value of the <code>imagePath</code> property. 1013 * 1014 * @return {string} The value of the imagePath property. 1015 */ 1016MarkerClusterer.prototype.getImagePath = function () { 1017 return this.imagePath_; 1018}; 1019 1020/** 1021 * Sets the value of the <code>imagePath</code> property. 1022 * 1023 * @param {string} imagePath The value of the imagePath property. 1024 */ 1025MarkerClusterer.prototype.setImagePath = function (imagePath) { 1026 this.imagePath_ = imagePath; 1027}; 1028 1029/** 1030 * Returns the value of the <code>imageSizes</code> property. 1031 * 1032 * @return {Array} The value of the imageSizes property. 1033 */ 1034MarkerClusterer.prototype.getImageSizes = function () { 1035 return this.imageSizes_; 1036}; 1037 1038/** 1039 * Sets the value of the <code>imageSizes</code> property. 1040 * 1041 * @param {Array} imageSizes The value of the imageSizes property. 1042 */ 1043MarkerClusterer.prototype.setImageSizes = function (imageSizes) { 1044 this.imageSizes_ = imageSizes; 1045}; 1046 1047/** 1048 * Returns the value of the <code>calculator</code> property. 1049 * 1050 * @return {function} the value of the calculator property. 1051 */ 1052MarkerClusterer.prototype.getCalculator = function () { 1053 return this.calculator_; 1054}; 1055 1056/** 1057 * Sets the value of the <code>calculator</code> property. 1058 * 1059 * @param {function(Array.<google.maps.Marker>, number)} calculator The value 1060 * of the calculator property. 1061 */ 1062MarkerClusterer.prototype.setCalculator = function (calculator) { 1063 this.calculator_ = calculator; 1064}; 1065 1066/** 1067 * Returns the value of the <code>batchSizeIE</code> property. 1068 * 1069 * @return {number} the value of the batchSizeIE property. 1070 */ 1071MarkerClusterer.prototype.getBatchSizeIE = function () { 1072 return this.batchSizeIE_; 1073}; 1074 1075/** 1076 * Sets the value of the <code>batchSizeIE</code> property. 1077 * 1078 * @param {number} batchSizeIE The value of the batchSizeIE property. 1079 */ 1080MarkerClusterer.prototype.setBatchSizeIE = function (batchSizeIE) { 1081 this.batchSizeIE_ = batchSizeIE; 1082}; 1083 1084/** 1085 * Returns the value of the <code>clusterClass</code> property. 1086 * 1087 * @return {string} the value of the clusterClass property. 1088 */ 1089MarkerClusterer.prototype.getClusterClass = function () { 1090 return this.clusterClass_; 1091}; 1092 1093/** 1094 * Sets the value of the <code>clusterClass</code> property. 1095 * 1096 * @param {string} clusterClass The value of the clusterClass property. 1097 */ 1098MarkerClusterer.prototype.setClusterClass = function (clusterClass) { 1099 this.clusterClass_ = clusterClass; 1100}; 1101 1102/** 1103 * Returns the array of markers managed by the clusterer. 1104 * 1105 * @return {Array} The array of markers managed by the clusterer. 1106 */ 1107MarkerClusterer.prototype.getMarkers = function () { 1108 return this.markers_; 1109}; 1110 1111/** 1112 * Returns the number of markers managed by the clusterer. 1113 * 1114 * @return {number} The number of markers. 1115 */ 1116MarkerClusterer.prototype.getTotalMarkers = function () { 1117 return this.markers_.length; 1118}; 1119 1120/**
1121 * Returns the current array of clusters formed by the clusterer. 1122 * 1123 * @return {Array} The array of clusters formed by the clusterer. 1124 */ 1125MarkerClusterer.prototype.getClusters = function () { 1126 return this.clusters_; 1127}; 1128 1129/** 1130 * Returns the number of clusters formed by the clusterer. 1131 * 1132 * @return {number} The number of clusters formed by the clusterer. 1133 */ 1134MarkerClusterer.prototype.getTotalClusters = function () { 1135 return this.clusters_.length; 1136}; 1137 1138/** 1139 * Adds a marker to the clusterer. The clusters are redrawn unless 1140 * <code>opt_nodraw</code> is set to <code>true</code>. 1141 * 1142 * @param {google.maps.Marker} marker The marker to add. 1143 * @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing. 1144 */ 1145MarkerClusterer.prototype.addMarker = function (marker, opt_nodraw) { 1146 this.pushMarkerTo_(marker); 1147 if (!opt_nodraw) { 1148 this.redraw_(); 1149 } 1150}; 1151 1152/** 1153 * Adds an array of markers to the clusterer. The clusters are redrawn unless 1154 * <code>opt_nodraw</code> is set to <code>true</code>. 1155 * 1156 * @param {Array.<google.maps.Marker>} markers The markers to add. 1157 * @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing. 1158 */ 1159MarkerClusterer.prototype.addMarkers = function (markers, opt_nodraw) { 1160 var key; 1161 for (key in markers) { 1162 if (markers.hasOwnProperty(key)) { 1163 this.pushMarkerTo_(markers[key]); 1164 } 1165 } 1166 if (!opt_nodraw) { 1167 this.redraw_(); 1168 } 1169}; 1170 1171/** 1172 * Pushes a marker to the clusterer. 1173 * 1174 * @param {google.maps.Marker} marker The marker to add. 1175 */ 1176MarkerClusterer.prototype.pushMarkerTo_ = function (marker) { 1177 // If the marker is draggable add a listener so we can update the clusters on the dragend: 1178 if (marker.getDraggable()) { 1179 var cMarkerClusterer = this; 1180 google.maps.event.addListener(marker, "dragend", function () { 1181 if (cMarkerClusterer.ready_) { 1182 this.isAdded = false; 1183 cMarkerClusterer.repaint(); 1184 } 1185 }); 1186 } 1187 marker.isAdded = false; 1188 this.markers_.push(marker); 1189}; 1190 1191/** 1192 * Removes a marker from the cluster. The clusters are redrawn unless 1193 * <code>opt_nodraw</code> is set to <code>true</code>. Returns <code>true</code> if the 1194 * marker was removed from the clusterer. 1195 * 1196 * @param {google.maps.Marker} marker The marker to remove. 1197 * @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing. 1198 * @return {boolean} True if the marker was removed from the clusterer. 1199 */ 1200MarkerClusterer.prototype.removeMarker = function (marker, opt_nodraw) { 1201 var removed = this.removeMarker_(marker); 1202 if (!opt_nodraw && removed) { 1203 this.repaint(); 1204 } 1205 return removed; 1206}; 1207 1208/** 1209 * Removes an array of markers from the cluster. The clusters are redrawn unless 1210 * <code>opt_nodraw</code> is set to <code>true</code>. Returns <code>true</code> if markers 1211 * were removed from the clusterer. 1212 * 1213 * @param {Array.<google.maps.Marker>} markers The markers to remove. 1214 * @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing. 1215 * @return {boolean} True if markers were removed from the clusterer. 1216 */ 1217MarkerClusterer.prototype.removeMarkers = function (markers, opt_nodraw) { 1218 var i, r; 1219 var removed = false; 1220 for (i = 0; i < markers.length; i++) { 1221 r = this.removeMarker_(markers[i]); 1222 removed = removed || r; 1223 } 1224 if (!opt_nodraw && removed) { 1225 this.repaint(); 1226 } 1227 return removed; 1228}; 1229 1230/** 1231 * Removes a marker and returns true if removed, false if not. 1232 * 1233 * @param {google.maps.Marker} marker The marker to remove 1234 * @return {boolean} Whether the marker was removed or not 1235 */ 1236MarkerClusterer.prototype.removeMarker_ = function (marker) { 1237 var i; 1238 var index = -1; 1239 if (this.markers_.indexOf) { 1240 index = this.markers_.indexOf(marker); 1241 } else { 1242 for (i = 0; i < this.markers_.length; i++) { 1243 if (marker === this.markers_[i]) { 1244 index = i; 1245 break; 1246 } 1247 } 1248 } 1249 if (index === -1) { 1250 // Marker is not in our list of markers, so do nothing: 1251 return false; 1252 } 1253 marker.setMap(null); 1254 this.markers_.splice(index, 1); // Remove the marker from the list of managed markers 1255 return true; 1256}; 1257 1258/**
1259 * Removes all clusters and markers from the map and also removes all markers 1260 * managed by the clusterer. 1261 */ 1262MarkerClusterer.prototype.clearMarkers = function () { 1263 this.resetViewport_(true); 1264 this.markers_ = []; 1265}; 1266 1267/** 1268 * Recalculates and redraws all the marker clusters from scratch. 1269 * Call this after changing any properties. 1270 */ 1271MarkerClusterer.prototype.repaint = function () { 1272 var oldClusters = this.clusters_.slice(); 1273 this.clusters_ = []; 1274 this.resetViewport_(false); 1275 this.redraw_(); 1276 1277 // Remove the old clusters. 1278 // Do it in a timeout to prevent blinking effect. 1279 setTimeout(function () { 1280 var i; 1281 for (i = 0; i < oldClusters.length; i++) { 1282 oldClusters[i].remove(); 1283 } 1284 }, 0); 1285}; 1286 1287/** 1288 * Returns the current bounds extended by the grid size. 1289 * 1290 * @param {google.maps.LatLngBounds} bounds The bounds to extend. 1291 * @return {google.maps.LatLngBounds} The extended bounds. 1292 * @ignore 1293 */ 1294MarkerClusterer.prototype.getExtendedBounds = function (bounds) { 1295 var projection = this.getProjection(); 1296 1297 // Turn the bounds into latlng. 1298 var tr = new google.maps.LatLng(bounds.getNorthEast().lat(), bounds.getNorthEast().lng());
1299 var bl = new google.maps.LatLng(bounds.getSouthWest().lat(), bounds.getSouthWest().lng()); 1300 1301 // Convert the points to pixels and the extend out by the grid size. 1302 var trPix = projection.fromLatLngToDivPixel(tr); 1303 trPix.x += this.gridSize_; 1304 trPix.y -= this.gridSize_; 1305 var blPix = projection.fromLatLngToDivPixel(bl); 1306 blPix.x -= this.gridSize_; 1307 blPix.y += this.gridSize_; 1308 1309 // Convert the pixel points back to LatLng 1310 var ne = projection.fromDivPixelToLatLng(trPix); 1311 var sw = projection.fromDivPixelToLatLng(blPix); 1312 1313 // Extend the bounds to contain the new bounds. 1314 bounds.extend(ne); 1315 bounds.extend(sw); 1316 return bounds; 1317}; 1318 1319/** 1320 * Redraws all the clusters. 1321 */ 1322MarkerClusterer.prototype.redraw_ = function () { 1323 this.createClusters_(0); 1324}; 1325 1326/** 1327 * Removes all clusters from the map. The markers are also removed from the map 1328 * if <code>opt_hide</code> is set to <code>true</code>. 1329 * 1330 * @param {boolean} [opt_hide] Set to <code>true</code> to also remove the markers 1331 * from the map. 1332 */ 1333MarkerClusterer.prototype.resetViewport_ = function (opt_hide) { 1334 var i, marker; 1335 // Remove all the clusters 1336 for (i = 0; i < this.clusters_.length; i++) { 1337 this.clusters_[i].remove(); 1338 } 1339 this.clusters_ = []; 1340 1341 // Reset the markers to not be added and to be removed from the map. 1342 for (i = 0; i < this.markers_.length; i++) { 1343 marker = this.markers_[i]; 1344 marker.isAdded = false; 1345 if (opt_hide) { 1346 marker.setMap(null); 1347 } 1348 } 1349}; 1350 1351/** 1352 * Calculates the distance between two latlng locations in km. 1353 * 1354 * @param {google.maps.LatLng} p1 The first lat lng point. 1355 * @param {google.maps.LatLng} p2 The second lat lng point. 1356 * @return {number} The distance between the two points in km. 1357 * @see http://www.movable-type.co.uk/scripts/latlong.html 1358*/ 1359MarkerClusterer.prototype.distanceBetweenPoints_ = function (p1, p2) { 1360 var R = 6371; // Radius of the Earth in km 1361 var dLat = (p2.lat() - p1.lat()) * Math.PI / 180; 1362 var dLon = (p2.lng() - p1.lng()) * Math.PI / 180; 1363 var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(p1.lat() * Math.PI / 180) * Math.cos(p2.lat() * Math.PI / 180) * Math.sin(dLon / 2) * Math.sin(dLon / 2); 1364 var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); 1365 var d = R * c; 1366 return d; 1367}; 1368 1369/** 1370 * Determines if a marker is contained in a bounds. 1371 * 1372 * @param {google.maps.Marker} marker The marker to check. 1373 * @param {google.maps.LatLngBounds} bounds The bounds to check against. 1374 * @return {boolean} True if the marker is in the bounds. 1375 */ 1376MarkerClusterer.prototype.isMarkerInBounds_ = function (marker, bounds) { 1377 return bounds.contains(marker.getPosition()); 1378}; 1379 1380/** 1381 * Adds a marker to a cluster, or creates a new cluster. 1382 * 1383 * @param {google.maps.Marker} marker The marker to add. 1384 */ 1385MarkerClusterer.prototype.addToClosestCluster_ = function (marker) { 1386 var i, d, cluster, center; 1387 var distance = 40000; // Some large number 1388 var clusterToAddTo = null; 1389 for (i = 0; i < this.clusters_.length; i++) { 1390 cluster = this.clusters_[i]; 1391 center = cluster.getCenter(); 1392 if (center) { 1393 d = this.distanceBetweenPoints_(center, marker.getPosition()); 1394 if (d < distance) { 1395 distance = d; 1396 clusterToAddTo = cluster; 1397 } 1398 } 1399 } 1400 if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)) { 1401 clusterToAddTo.addMarker(marker); 1402 } else { 1403 cluster = new Cluster(this); 1404 cluster.addMarker(marker); 1405 this.clusters_.push(cluster); 1406 } 1407}; 1408 1409/** 1410 * Creates the clusters. This is done in batches to avoid timeout errors 1411 * in some browsers when there is a huge number of markers. 1412 * 1413 * @param {number} iFirst The index of the first marker in the batch of 1414 * markers to be added to clusters. 1415 */ 1416MarkerClusterer.prototype.createClusters_ = function (iFirst) { 1417 var i, marker; 1418 var mapBounds; 1419 var cMarkerClusterer = this; 1420 if (!this.ready_) { 1421 return; 1422 } 1423 1424 // Cancel previous batch processing if we're working on the first batch: 1425 if (iFirst === 0) { 1426 /** 1427 * This event is fired when the <code>MarkerClusterer</code> begins 1428 * clustering markers. 1429 * @name MarkerClusterer#clusteringbegin 1430 * @param {MarkerClusterer} mc The MarkerClusterer whose markers are being clustered. 1431 * @event 1432 */ 1433 google.maps.event.trigger(this, "clusteringbegin", this); 1434 if (typeof this.timerRefStatic !== "undefined") { 1435 clearTimeout(this.timerRefStatic); 1436 delete this.timerRefStatic; 1437 } 1438 } 1439 1440 // Get our current map view bounds. 1441 // Create a new bounds object so we don't affect the map. 1442 // 1443 // See Comments 9 & 11 on Issue 3651 relating to this workaround for a Google Maps bug: 1444 if (this.getMap().getZoom() > 3) { 1445 mapBounds = new google.maps.LatLngBounds(this.getMap().getBounds().getSouthWest
1445(), this.getMap().getBounds().getNorthEast()); 1446 } else { 1447 mapBounds = new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472, -178.48388434375), new google.maps.LatLng(-85.08136444384544, 178.00048865625)); 1448 } 1449 var bounds = this.getExtendedBounds(mapBounds); 1450 var iLast = Math.min(iFirst + this.batchSize_, this.markers_.length); 1451 for (i = iFirst; i < iLast; i++) { 1452 marker = this.markers_[i]; 1453 if (!marker.isAdded && this.isMarkerInBounds_(marker, bounds)) { 1454 if (!this.ignoreHidden_ || this.ignoreHidden_ && marker.getVisible()) { 1455 this.addToClosestCluster_(marker); 1456 } 1457 } 1458 } 1459 if (iLast < this.markers_.length) { 1460 this.timerRefStatic = setTimeout(function () { 1461 cMarkerClusterer.createClusters_(iLast); 1462 }, 0); 1463 } else { 1464 delete this.timerRefStatic; 1465 1466 /** 1467 * This event is fired when the <code>MarkerClusterer</code> stops 1468 * clustering markers. 1469 * @name MarkerClusterer#clusteringend 1470 * @param {MarkerClusterer} mc The MarkerClusterer whose markers are being clustered. 1471 * @event 1472 */ 1473 google.maps.event.trigger(this, "clusteringend", this); 1474 } 1475}; 1476 1477/** 1478 * Extends an object's prototype by another's. 1479 * 1480 * @param {Object} obj1 The object to be extended. 1481 * @param {Object} obj2 The object to extend with. 1482 * @return {Object} The new extended object. 1483 * @ignore 1484 */ 1485MarkerClusterer.prototype.extend = function (obj1, obj2) { 1486 return function (object) { 1487 var property; 1488 for (property in object.prototype) { 1489 this.prototype[property] = object.prototype[property]; 1490 } 1491 return this; 1492 }.apply(obj1, [obj2]); 1493}; 1494 1495/** 1496 * The default function for determining the label text and style 1497 * for a cluster icon. 1498 * 1499 * @param {Array.<google.maps.Marker>} markers The array of markers represented by the cluster. 1500 * @param {number} numStyles The number of marker styles available. 1501 * @return {ClusterIconInfo} The information resource for the cluster. 1502 * @constant 1503 * @ignore 1504 */ 1505MarkerClusterer.CALCULATOR = function (markers, numStyles) { 1506 var index = 0; 1507 var title = ""; 1508 var count = markers.length.toString(); 1509 var dv = count; 1510 while (dv !== 0) { 1511 dv = parseInt(dv / 10, 10); 1512 index++; 1513 } 1514 index = Math.min(index, numStyles); 1515 return { 1516 text: count, 1517 index: index, 1518 title: title 1519 }; 1520}; 1521 1522/** 1523 * The number of markers to process in one batch. 1524 * 1525 * @type {number} 1526 * @constant 1527 */ 1528MarkerClusterer.BATCH_SIZE = 2000; 1529 1530/** 1531 * The number of markers to process in one batch (IE only). 1532 * 1533 * @type {number} 1534 * @constant 1535 */ 1536MarkerClusterer.BATCH_SIZE_IE = 500; 1537 1538/** 1539 * The default root name for the marker cluster images. 1540 * 1541 * @type {string} 1542 * @constant 1543 */ 1544MarkerClusterer.IMAGE_PATH = "https://cdn.rawgit.com/googlemaps/js-marker-clusterer/gh-pages/images/m"; 1545 1546/** 1547 * The default extension name for the marker cluster images. 1548 * 1549 * @type {string} 1550 * @constant 1551 */ 1552MarkerClusterer.IMAGE_EXTENSION = "png"; 1553 1554/** 1555 * The default array of sizes for the marker cluster images. 1556 * 1557 * @type {Array.<number>} 1558 * @constant 1559 */ 1560MarkerClusterer.IMAGE_SIZES = [53, 56, 66, 78, 90]; 1561if ((typeof module === "undefined" ? "undefined" : _typeof(module)) == 'object') { 1562 module.exports = MarkerClusterer; 1563} 1564 1565},{}],3:[function(require,module,exports){ 1566(function (global){(function (){ 1567function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 1568/* 1569 * jQuery File Upload Plugin 1570 * https://github.com/blueimp/jQuery-File-Upload 1571 * 1572 * Copyright 2010, Sebastian Tschan 1573 * https://blueimp.net 1574 * 1575 * Licensed under the MIT license: 1576 * https://opensource.org/licenses/MIT 1577 */ 1578 1579/* global define, require */ 1580/* eslint-disable new-cap */ 1581 1582(function (factory) { 1583 'use strict'; 1584 1585 if (typeof define === 'function' && define.amd) { 1586 // Register as an anonymous AMD module: 1587 define(['jquery', 'jquery-ui/ui/widget'], factory); 1588 } else if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object') { 1589 // Node/CommonJS: 1590 factory((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null), require('./vendor/jquery.ui.widget')); 1591 } else { 1592 // Browser globals: 1593 factory(window.jQuery); 1594 } 1595})(function ($) { 1596 'use strict'; 1597 1598 // Detect file input support, based on 1599 // https://viljamis.com/2012/file-upload-support-on-mobile/ 1600 $.support.fileInput = !(new RegExp( 1601 // Handle devices which give false positives for the feature detection: 1602 '(Android (1\\.[0156]|2\\.[01]))' + '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' + '|(w(eb)?OSBrowser)|(webOS)' + '|(Kindle/(1\\.0|2\\.[05]|3\\.0))').test(window.navigator.userAgent) || 1603 // Feature detection for all other devices: 1604 $('<input type="file"/>').prop('disabled')); 1605 1606 // The FileReader API is not actually used, but works as feature detection,
1607 // as some Safari versions (5?) support XHR file uploads via the FormData API, 1608 // but not non-multipart XHR file uploads. 1609 // window.XMLHttpRequestUpload is not available on IE10, so we check for 1610 // window.ProgressEvent instead to detect XHR2 file upload capability: 1611 $.support.xhrFileUpload = !!(window.ProgressEvent && window.FileReader); 1612 $.support.xhrFormDataFileUpload = !!window.FormData; 1613 1614 // Detect support for Blob slicing (required for chunked uploads): 1615 $.support.blobSlice = window.Blob && (Blob.prototype.slice || Blob.prototype.webkitSlice || Blob.prototype.mozSlice); 1616 1617 /** 1618 * Helper function to create drag handlers for dragover/dragenter/dragleave 1619 * 1620 * @param {string} type Event type 1621 * @returns {Function} Drag handler 1622 */ 1623 function getDragHandler(type) { 1624 var isDragOver = type === 'dragover'; 1625 return function (e) { 1626 e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; 1627 var dataTransfer = e.dataTransfer; 1628 if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 && this._trigger(type, $.Event(type, { 1629 delegatedEvent: e 1630 })) !== false) { 1631 e.preventDefault(); 1632 if (isDragOver) { 1633 dataTransfer.dropEffect = 'copy'; 1634 } 1635 } 1636 }; 1637 } 1638 1639 // The fileupload widget listens for change events on file input fields defined 1640 // via fileInput setting and paste or drop events of the given dropZone. 1641 // In addition to the default jQuery Widget methods, the fileupload widget 1642 // exposes the "add" and "send" methods, to add or directly send files using 1643 // the fileupload API. 1644 // By default, files added via file input selection, paste, drag & drop or 1645 // "add" method are uploaded immediately, but it is possible to override 1646 // the "add" callback option to queue file uploads. 1647 $.widget('blueimp.fileupload', { 1648 options: { 1649 // The drop target element(s), by the default the complete document. 1650 // Set to null to disable drag & drop support: 1651 dropZone: $(document), 1652 // The paste target element(s), by the default undefined. 1653 // Set to a DOM node or jQuery object to enable file pasting: 1654 pasteZone: undefined, 1655 // The file input field(s), that are listened to for change events. 1656 // If undefined, it is set to the file input fields inside 1657 // of the widget element on plugin initialization. 1658 // Set to null to disable the change listener. 1659 fileInput: undefined, 1660 // By default, the file input field is replaced with a clone after 1661 // each input field change event. This is required for iframe transport 1662 // queues and allows change events to be fired for the same file 1663 // selection, but can be disabled by setting the following option to false: 1664 replaceFileInput: true, 1665 // The parameter name for the file form data (the request argument name). 1666 // If undefined or empty, the name property of the file input field is 1667 // used, or "files[]" if the file input name property is also empty, 1668 // can be a string or an array of strings: 1669 paramName: undefined, 1670 // By default, each file of a selection is uploaded using an individual 1671 // request for XHR type uploads. Set to false to upload file 1672 // selections in one request each: 1673 singleFileUploads: true, 1674 // To limit the number of files uploaded with one XHR request, 1675 // set the following option to an integer greater than 0: 1676 limitMultiFileUploads: undefined, 1677 // The following option limits the number of files uploaded with one 1678 // XHR request to keep the request size under or equal to the defined 1679 // limit in bytes: 1680 limitMultiFileUploadSize: undefined, 1681 // Multipart file uploads add a number of bytes to each uploaded file, 1682 // therefore the following option adds an overhead for each file used 1683 // in the limitMultiFileUploadSize configuration: 1684 limitMultiFileUploadSizeOverhead: 512, 1685 // Set the following option to true to issue all file upload requests 1686 // in a sequential order: 1687 sequentialUploads: false, 1688 // To limit the number of concurrent uploads, 1689 // set the following option to an integer greater than 0: 1690 limitConcurrentUploads: undefined, 1691 // Set the following option to true to force iframe transport uploads: 1692 forceIframeTransport: false, 1693 // Set the following option to the location of a redirect url on the 1694 // origin server, for cross-domain iframe transport uploads: 1695 redirect: undefined, 1696 // The parameter name for the redirect url, sent as part of the form 1697 // data and set to 'redirect' if this option is empty: 1698 redirectParamName: undefined, 1699 // Set the following option to the location of a postMessage window, 1700 // to enable postMessage transport uploads: 1701 postMessage: undefined, 1702 // By default, XHR file uploads are sent as multipart/form-data. 1703 // The iframe transport is always using multipart/form-data. 1704 // Set to false to enable non-multipart XHR uploads: 1705 multipart: true, 1706 // To upload large files in smaller chunks, set the following option 1707 // to a preferred maximum chunk size. If set to 0, null or undefined, 1708 // or the browser does not support the required Blob API, files will 1709 // be uploaded as a whole. 1710 maxChunkSize: undefined, 1711 // When a non-multipart upload or a chunked multipart upload has been 1712 // aborted, this option can be used to resume the upload by setting 1713 // it to the size of the already uploaded bytes. This option is most 1714 // useful when modifying the options object inside of the "add" or 1715 // "send" callbacks, as the options are cloned for each file upload. 1716 uploadedBytes: undefined, 1717 // By default, failed (abort or error) file uploads are removed from the 1718 // global progress calculation. Set the following option to fal
1718se to 1719 // prevent recalculating the global progress data: 1720 recalculateProgress: true, 1721 // Interval in milliseconds to calculate and trigger progress events: 1722 progressInterval: 100, 1723 // Interval in milliseconds to calculate progress bitrate: 1724 bitrateInterval: 500, 1725 // By default, uploads are started automatically when adding files: 1726 autoUpload: true, 1727 // By default, duplicate file names are expected to be handled on 1728 // the server-side. If this is not possible (e.g. when uploading 1729 // files directly to Amazon S3), the following option can be set to 1730 // an empty object or an object mapping existing filenames, e.g.: 1731 // { "image.jpg": true, "image (1).jpg": true } 1732 // If it is set, all files will be uploaded with unique filenames, 1733 // adding increasing number suffixes if necessary, e.g.: 1734 // "image (2).jpg" 1735 uniqueFilenames: undefined, 1736 // Error and info messages: 1737 messages: { 1738 uploadedBytes: 'Uploaded bytes exceed file size' 1739 }, 1740 // Translation function, gets the message key to be translated 1741 // and an object with context specific data as arguments: 1742 i18n: function i18n(message, context) { 1743 // eslint-disable-next-line no-param-reassign 1744 message = this.messages[message] || message.toString(); 1745 if (context) { 1746 $.each(context, function (key, value) { 1747 // eslint-disable-next-line no-param-reassign 1748 message = message.replace('{' + key + '}', value); 1749 }); 1750 } 1751 return message; 1752 }, 1753 // Additional form data to be sent along with the file uploads can be set 1754 // using this option, which accepts an array of objects with name and 1755 // value properties, a function returning such an array, a FormData 1756 // object (for XHR file uploads), or a simple object. 1757 // The form of the first fileInput is given as parameter to the function: 1758 formData: function formData(form) { 1759 return form.serializeArray(); 1760 }, 1761 // The add callback is invoked as soon as files are added to the fileupload 1762 // widget (via file input selection, drag & drop, paste or add API call). 1763 // If the singleFileUploads option is enabled, this callback will be 1764 // called once for each file in the selection for XHR file uploads, else 1765 // once for each file selection. 1766 // 1767 // The upload starts when the submit method is invoked on the data parameter. 1768 // The data object contains a files property holding the added files 1769 // and allows you to override plugin options as well as define ajax settings. 1770 // 1771 // Listeners for this callback can also be bound the following way: 1772 // .on('fileuploadadd', func); 1773 // 1774 // data.submit() returns a Promise object and allows to attach additional 1775 // handlers using jQuery's Deferred callbacks: 1776 // data.submit().done(func).fail(func).always(func); 1777 add: function add(e, data) { 1778 if (e.isDefaultPrevented()) { 1779 return false; 1780 } 1781 if (data.autoUpload || data.autoUpload !== false && $(this).fileupload('option', 'autoUpload')) { 1782 data.process().done(function () { 1783 data.submit(); 1784 }); 1785 } 1786 }, 1787 // Other callbacks: 1788 1789 // Callback for the submit event of each file upload: 1790 // submit: function (e, data) {}, // .on('fileuploadsubmit', func); 1791 1792 // Callback for the start of each file upload request: 1793 // send: function (e, data) {}, // .on('fileuploadsend', func); 1794 1795 // Callback for successful uploads: 1796 // done: function (e, data) {}, // .on('fileuploaddone', func); 1797 1798 // Callback for failed (abort or error) uploads: 1799 // fail: function (e, data) {}, // .on('fileuploadfail', func); 1800 1801 // Callback for completed (success, abort or error) requests: 1802 // always: function (e, data) {}, // .on('fileuploadalways', func); 1803 1804 // Callback for upload progress events: 1805 // progress: function (e, data) {}, // .on('fileuploadprogress', func); 1806 1807 // Callback for global upload progress events: 1808 // progressall: function (e, data) {}, // .on('fileuploadprogressall', func); 1809 1810 // Callback for uploads start, equivalent to the global ajaxStart event: 1811 // start: function (e) {}, // .on('fileuploadstart', func); 1812 1813 // Callback for uploads stop, equivalent to the global ajaxStop event: 1814 // stop: function (e) {}, // .on('fileuploadstop', func); 1815 1816 // Callback for change events of the fileInput(s): 1817 // change: function (e, data) {}, // .on('fileuploadchange', func); 1818 1819 // Callback for paste events to the pasteZone(s): 1820 // paste: function (e, data) {}, // .on('fileuploadpaste', func); 1821 1822 // Callback for drop events of the dropZone(s): 1823 // drop: function (e, data) {}, // .on('fileuploaddrop', func); 1824 1825 // Callback for dragover events of the dropZone(s): 1826 // dragover: function (e) {}, // .on('fileuploaddragover', func); 1827 1828 // Callback before the start of each chunk upload request (before form data initialization): 1829 // chunkbeforesend: function (e, data) {}, // .on('fileuploadchunkbeforesend', func); 1830 1831 // Callback for the start of each chunk upload request: 1832 // chunksend: function (e, data) {}, // .on('fileuploadchunksend', func); 1833 1834 // Callback for successful chunk uploads: 1835 // chunkdone: function (e, data) {}, // .on('fileuploadchunkdone', func); 1836 1837 // Callback for failed (abort or error) chunk uploads: 1838 // chunkfail: function (e, data) {}, // .on('fileuploadchunkfail', func); 1839 1840 // Callback for completed (success, abort or error) chunk upload requests: 1841 // chunkalways: function (e, data) {}, // .on('fileuploadchunkalways', func); 1842 1843 // The plugin options are used as settings object for the ajax calls. 1844 // The following are jQuery ajax settings required for the file uploads: 1845 processData: false, 1846 contentType: false, 1847 cache: false, 1848 timeout: 0 1849 }, 1850 // jQuery versions before 1.8 require promise.pipe if the return value is 1851 // used, as promise.then in older versions has a different behavior, see: 1852 // https://blog.jquery.com/2012/08/09/jquery-1-8-released/ 1853 // https://bugs.jquery.com/ticket/11010 1854 // https://github.com/blueimp/jQuery-File-Upload/pull/3435 1855 _promisePipe: function () { 1856 var parts = $.fn.jquery.split('.'); 1857 return Number(parts[0]) > 1 || Number(parts[1]) > 7 ? 'then' : 'pipe'; 1858 }(), 1859 // A list of options that require reinitializing event listeners and/or 1860 // special initialization code: 1861 _specialOptions: ['fileInput', 'dropZone', 'pasteZone', 'multipart', 'forceIframeTransport'], 1862 _blobSlice: $.support.blobSlice && function () { 1863 var slice = this.slice || this.webkitSlice || this.mozSlice; 1864 return slice.apply(this, arguments); 1865 }, 1866 _BitrateTimer: function _BitrateTimer() { 1867 this.timestamp = Date.now ? Date.now() : new Date().getTime(); 1868 this.loaded = 0; 1869 this.bitrate = 0; 1870 this.getBitrate = function (now, loaded, interval) { 1871 var timeDiff = now - this.timestamp; 1872 if (!this.bitrate || !interval || timeDiff > interval) { 1873 this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8; 1874 this.loaded = loaded; 1875 this.timestamp = now; 1876 } 1877 return this.bitrate; 1878 }; 1879 }, 1880 _isXHRUpload: function _isXHRUpload(options) { 1881 return !options.forceIframeTransport && (!options.multipart && $.support.xhrFileUpload || $.support.xhrFormDataFileUpload); 1882 }, 1883 _getFormData: function _getFormData(options) { 1884 var formData; 1885 if ($.type(options.formData) === 'function') { 1886 return options.formData(options.form); 1887 } 1888 if ($.isArray(options.formData)) { 1889 return options.formData; 1890 } 1891 if ($.type(options.formData) === 'object') { 1892 formData = []; 1893 $.each(options.formData, function (name, value) { 1894 formData.push({ 1895 name: name, 1896 value: value 1897 }); 1898 }); 1899 return formData; 1900 } 1901 return []; 1902 }, 1903 _getTotal: function _getTotal(files) { 1904 var total = 0; 1905 $.each(files, function (index, file) { 1906 total += file.size || 1; 1907 }); 1908 return total; 1909 }, 1910 _initProgressObject: function _initProgressObject(obj) { 1911 var progress = { 1912 loaded: 0, 1913 total: 0, 1914 bitrate: 0 1915 }; 1916 if (obj._progress) { 1917 $.extend(obj._progress, progress); 1918 } else { 1919 obj._progress = progress; 1920 } 1921 }, 1922 _initResponseObject: function _initResponseObject(obj) { 1923 var prop; 1924 if (obj._response) { 1925 for (prop in obj._response) { 1926 if (Object.prototype.hasOwnProperty.call(obj._response, prop)) { 1927 delete obj._response[prop]; 1928 } 1929 } 1930 } else { 1931 obj._response = {}; 1932 } 1933 }, 1934 _onProgress: function _onProgress(e, data) { 1935 if (e.lengthComputable) { 1936 var now = Date.now ? Date.now() : new Date().getTime(), 1937 loaded; 1938 if (data._time && data.progressInterval && now - data._time < data.progressInterval && e.loaded !== e.total) { 1939 return; 1940 } 1941 data._time = now; 1942 loaded = Math.floor(e.loaded / e.total * (data.chunkSize || data._progress.total)) + (data.uploadedBytes || 0); 1943 // Add the difference from the previously loaded state 1944 // to the global loaded counter: 1945 this._progress.loaded += loaded - data._progress.loaded; 1946 this._progress.bitrate = this._bitrateTimer.getBitrate(now, this._progress.loaded, data.bitrateInterval); 1947 data._progress.loaded = data.loaded = loaded; 1948 data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate(now, loaded, data.bitrateInterval); 1949 // Trigger a custom progress event with a total data property set 1950 // to the file size(s) of the current upload and a loaded data 1951 // property calculated accordingly: 1952 this._trigger('progress', $.Event('progress', { 1953 delegatedEvent: e 1954 }), data); 1955 // Trigger a global progress event for all current file uploads, 1956 // including ajax calls queued for sequential file uploads: 1957 this._trigger('progressall', $.Event('progressall', { 1958 delegatedEvent: e 1959 }), this._progress); 1960 } 1961 }, 1962 _initProgressListener: function _initProgressListener(options) { 1963 var that = this, 1964 xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr(); 1965 // Access to the native XHR object is required to add event listeners 1966 // for the upload progress event: 1967 if (xhr.upload) { 1968 $(xhr.upload).on('progress', function (e) { 1969 var oe = e.originalEvent; 1970 // Make sure the progress event properties get copied over: 1971 e.lengthComputable = oe.lengthComputable; 1972 e.loaded = oe.loaded; 1973 e.total = oe.total; 1974 that._onProgress(e, options); 1975 }); 1976 options.xhr = function () { 1977 return xhr; 1978 }; 1979 } 1980 }, 1981 _deinitProgressListener: function _deinitProgressListener(options) { 1982 var xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr(); 1983 if (xhr.upload) { 1984 $(xhr.upload).off('progress'); 1985 } 1986 }, 1987 _isInstanceOf: function _isInstanceOf(type, obj) { 1988 // Cross-frame instanceof check 1989 return Object.prototype.toString.call(obj) === '[object ' + type + ']'; 1990 }, 1991 _getUniqueFilename: function _getUniqueFilename(name, map) { 1992 // eslint-disable-next-line no-param-reassign 1993 name = String(name); 1994 if (map[name]) { 1995 // eslint-disable-next-line no-param-reassign 1996 name = name.replace(/(?: \(([\d]+)\))?(\.[^.]+)?$/, function (_, p1, p2) { 1997 var index = p1 ? Number(p1) + 1 : 1; 1998 var ext = p2 || ''; 1999 return ' (' + index + ')' + ext; 2000 }); 2001 return this._getUniqueFilename(name, map); 2002 } 2003 map[name] = true; 2004 return name; 2005 }, 2006 _initXHRData: function _initXHRData(options) { 2007 var that = this, 2008 formData, 2009 file = options.files[0], 2010 // Ignore non-multipart setting if not supported:
2011 multipart = options.multipart || !$.support.xhrFileUpload, 2012 paramName = $.type(options.paramName) === 'array' ? options.paramName[0] : options.paramName; 2013 options.headers = $.extend({}, options.headers); 2014 if (options.contentRange) { 2015 options.headers['Content-Range'] = options.contentRange; 2016 } 2017 if (!multipart || options.blob || !this._isInstanceOf('File', file)) { 2018 options.headers['Content-Disposition'] = 'attachment; filename="' + encodeURI(file.uploadName || file.name) + '"'; 2019 } 2020 if (!multipart) { 2021 options.contentType = file.type || 'application/octet-stream'; 2022 options.data = options.blob || file; 2023 } else if ($.support.xhrFormDataFileUpload) { 2024 if (options.postMessage) { 2025 // window.postMessage does not allow sending FormData 2026 // objects, so we just add the File/Blob objects to 2027 // the formData array and let the postMessage window 2028 // create the FormData object out of this array: 2029 formData = this._getFormData(options); 2030 if (options.blob) { 2031 formData.push({ 2032 name: paramName, 2033 value: options.blob 2034 }); 2035 } else { 2036 $.each(options.files, function (index, file) { 2037 formData.push({ 2038 name: $.type(options.paramName) === 'array' && options.paramName[index] || paramName, 2039 value: file 2040 }); 2041 }); 2042 } 2043 } else { 2044 if (that._isInstanceOf('FormData', options.formData)) { 2045 formData = options.formData; 2046 } else { 2047 formData = new FormData(); 2048 $.each(this._getFormData(options), function (index, field) { 2049 formData.append(field.name, field.value); 2050 }); 2051 } 2052 if (options.blob) { 2053 formData.append(paramName, options.blob, file.uploadName || file.name); 2054 } else { 2055 $.each(options.files, function (index, file) { 2056 // This check allows the tests to run with 2057 // dummy objects: 2058 if (that._isInstanceOf('File', file) || that._isInstanceOf('Blob', file)) { 2059 var fileName = file.uploadName || file.name; 2060 if (options.uniqueFilenames) { 2061 fileName = that._getUniqueFilename(fileName, options.uniqueFilenames); 2062 } 2063 formData.append($.type(options.paramName) === 'array' && options.paramName[index] || paramName, file, fileName); 2064 } 2065 }); 2066 } 2067 } 2068 options.data = formData; 2069 } 2070 // Blob reference is not needed anymore, free memory: 2071 options.blob = null; 2072 }, 2073 _initIframeSettings: function _initIframeSettings(options) { 2074 var targetHost = $('<a></a>').prop('href', options.url).prop('host'); 2075 // Setting the dataType to iframe enables the iframe transport: 2076 options.dataType = 'iframe ' + (options.dataType || ''); 2077 // The iframe transport accepts a serialized array as form data: 2078 options.formData = this._getFormData(options); 2079 // Add redirect url to form data on cross-domain uploads: 2080 if (options.redirect && targetHost && targetHost !== location.host) { 2081 options.formData.push({ 2082 name: options.redirectParamName || 'redirect', 2083 value: options.redirect 2084 }); 2085 } 2086 }, 2087 _initDataSettings: function _initDataSettings(options) { 2088 if (this._isXHRUpload(options)) { 2089 if (!this._chunkedUpload(options, true)) { 2090 if (!options.data) { 2091 this._initXHRData(options); 2092 } 2093 this._initProgressListener(options); 2094 } 2095 if (options.postMessage) { 2096 // Setting the dataType to postmessage enables the 2097 // postMessage transport: 2098 options.dataType = 'postmessage ' + (options.dataType || ''); 2099 } 2100 } else { 2101 this._initIframeSettings(options); 2102 } 2103 }, 2104 _getParamName: function _getParamName(options) { 2105 var fileInput = $(options.fileInput), 2106 paramName = options.paramName; 2107 if (!paramName) { 2108 paramName = []; 2109 fileInput.each(function () { 2110 var input = $(this), 2111 name = input.prop('name') || 'files[]', 2112 i = (input.prop('files') || [1]).length; 2113 while (i) { 2114 paramName.push(name); 2115 i -= 1; 2116 } 2117 }); 2118 if (!paramName.length) { 2119 paramName = [fileInput.prop('name') || 'files[]']; 2120 } 2121 } else if (!$.isArray(paramName)) { 2122 paramName = [paramName]; 2123 } 2124 return paramName; 2125 }, 2126 _initFormSettings: function _initFormSettings(options) { 2127 // Retrieve missing options from the input field and the 2128 // associated form, if available: 2129 if (!options.form || !options.form.length) { 2130 options.form = $(options.fileInput.prop('form')); 2131 // If the given file input doesn't have an associated form, 2132 // use the default widget file input's form: 2133 if (!options.form.length) { 2134 options.form = $(this.options.fileInput.prop('form')); 2135 } 2136 } 2137 options.paramName = this._getParamName(options); 2138 if (!options.url) { 2139 options.url = options.form.prop('action') || location.href; 2140 } 2141 // The HTTP request method must be "POST" or "PUT": 2142 options.type = (options.type || $.type(options.form.prop('method')) === 'string' && options.form.prop('method') || '').toUpperCase(); 2143 if (options.type !== 'POST' && options.type !== 'PUT' && options.type !== 'PATCH') { 2144 options.type = 'POST'; 2145 } 2146 if (!options.formAcceptCharset) { 2147 options.formAcceptCharset = options.form.attr('accept-charset'); 2148 } 2149 }, 2150 _getAJAXSettings: function _getAJAXSettings(data) { 2151 var options = $.extend({}, this.options, data); 2152 this._initFormSettings(options); 2153 this._initDataSettings(options); 2154 return options; 2155 }, 2156 // jQuery 1.6 doesn't provide .state(), 2157 // while jQuery 1.8+ removed .isRejected() and .isResolved(): 2158 _getDeferredState: function _getDeferredState(deferred) { 2159 if (deferred.state) { 2160 return deferred.state(); 2161 } 2162 if (deferred.isResolved()) { 2163 return 'resolved'; 2164 } 2165 if (deferred.isRejected()) { 2166 return 'rejected'; 2167 } 2168 return 'pending'; 2169 }, 2170 // Maps jqXHR callbacks to the equivalent 2171 // methods of the given Promise object: 2172 _enhancePromise: function _enhancePromise(promise) { 2173 promise.success = promise.done; 2174 promise.error = promise.fail; 2175 promise.complete = promise.always; 2176 return promise; 2177 }, 2178 // Creates and returns a Promise object enhanced with 2179 // the jqXHR methods abort, success, error and complete: 2180 _getXHRPromise: function _getXHRPromise(resolveOrReject, context, args
2180) { 2181 var dfd = $.Deferred(), 2182 promise = dfd.promise(); 2183 // eslint-disable-next-line no-param-reassign 2184 context = context || this.options.context || promise; 2185 if (resolveOrReject === true) { 2186 dfd.resolveWith(context, args); 2187 } else if (resolveOrReject === false) { 2188 dfd.rejectWith(context, args); 2189 } 2190 promise.abort = dfd.promise; 2191 return this._enhancePromise(promise); 2192 }, 2193 // Adds convenience methods to the data callback argument: 2194 _addConvenienceMethods: function _addConvenienceMethods(e, data) { 2195 var that = this, 2196 getPromise = function getPromise(args) { 2197 return $.Deferred().resolveWith(that, args).promise(); 2198 }; 2199 data.process = function (resolveFunc, rejectFunc) { 2200 if (resolveFunc || rejectFunc) { 2201 data._processQueue = this._processQueue = (this._processQueue || getPromise([this]))[that._promisePipe](function () { 2202 if (data.errorThrown) { 2203 return $.Deferred().rejectWith(that, [data]).promise(); 2204 } 2205 return getPromise(arguments); 2206 })[that._promisePipe](resolveFunc, rejectFunc); 2207 } 2208 return this._processQueue || getPromise([this]); 2209 }; 2210 data.submit = function () { 2211 if (this.state() !== 'pending') { 2212 data.jqXHR = this.jqXHR = that._trigger('submit', $.Event('submit', { 2213 delegatedEvent: e 2214 }), this) !== false && that._onSend(e, this); 2215 } 2216 return this.jqXHR || that._getXHRPromise(); 2217 }; 2218 data.abort = function () { 2219 if (this.jqXHR) { 2220 return this.jqXHR.abort(); 2221 } 2222 this.errorThrown = 'abort'; 2223 that._trigger('fail', null, this); 2224 return that._getXHRPromise(false); 2225 }; 2226 data.state = function () { 2227 if (this.jqXHR) { 2228 return that._getDeferredState(this.jqXHR); 2229 } 2230 if (this._processQueue) { 2231 return that._getDeferredState(this._processQueue); 2232 } 2233 }; 2234 data.processing = function () { 2235 return !this.jqXHR && this._processQueue && that._getDeferredState(this._processQueue) === 'pending'; 2236 }; 2237 data.progress = function () { 2238 return this._progress; 2239 }; 2240 data.response = function () { 2241 return this._response; 2242 }; 2243 }, 2244 // Parses the Range header from the server response 2245 // and returns the uploaded bytes: 2246 _getUploadedBytes: function _getUploadedBytes(jqXHR) { 2247 var range = jqXHR.getResponseHeader('Range'), 2248 parts = range && range.split('-'), 2249 upperBytesPos = parts && parts.length > 1 && parseInt(parts[1], 10); 2250 return upperBytesPos && upperBytesPos + 1; 2251 }, 2252 // Uploads a file in multiple, sequential requests 2253 // by splitting the file up in multiple blob chunks. 2254 // If the second parameter is true, only tests if the file 2255 // should be uploaded in chunks, but does not invoke any 2256 // upload requests: 2257 _chunkedUpload: function _chunkedUpload(options, testOnly) { 2258 options.uploadedBytes = options.uploadedBytes || 0; 2259 var that = this, 2260 file = options.files[0], 2261 fs = file.size, 2262 ub = options.uploadedBytes, 2263 mcs = options.maxChunkSize || fs, 2264 slice = this._blobSlice, 2265 dfd = $.Deferred(), 2266 promise = dfd.promise(), 2267 jqXHR, 2268 _upload; 2269 if (!(this._isXHRUpload(options) && slice && (ub || ($.type(mcs) === 'function' ? mcs(options) : mcs) < fs)) || options.data) { 2270 return false; 2271 } 2272 if (testOnly) { 2273 return true; 2274 } 2275 if (ub >= fs) { 2276 file.error = options.i18n('uploadedBytes'); 2277 return this._getXHRPromise(false, options.context, [null, 'error', file.error]); 2278 } 2279 // The chunk upload method: 2280 _upload = function upload() { 2281 // Clone the options object for each chunk upload: 2282 var o = $.extend({}, options), 2283 currentLoaded = o._progress.loaded; 2284 o.blob = slice.call(file, ub, ub + ($.type(mcs) === 'function' ? mcs(o) : mcs), file.type); 2285 // Store the current chunk size, as the blob itself 2286 // will be dereferenced after data processing: 2287 o.chunkSize = o.blob.size; 2288 // Expose the chunk bytes position range: 2289 o.contentRange = 'bytes ' + ub + '-' + (ub + o.chunkSize - 1) + '/' + fs; 2290 // Trigger chunkbeforesend to allow form data to be updated for this chunk 2291 that._trigger('chunkbeforesend', null, o); 2292 // Process the upload data (the blob and potential form data): 2293 that._initXHRData(o); 2294 // Add progress listeners for this chunk upload: 2295 that._initProgressListener(o);
2296 jqXHR = (that._trigger('chunksend', null, o) !== false && $.ajax(o) || that._getXHRPromise(false, o.context)).done(function (result, textStatus, jqXHR) { 2297 ub = that._getUploadedBytes(jqXHR) || ub + o.chunkSize; 2298 // Create a progress event if no final progress event 2299 // with loaded equaling total has been triggered 2300 // for this chunk: 2301 if (currentLoaded + o.chunkSize - o._progress.loaded) { 2302 that._onProgress($.Event('progress', { 2303 lengthComputable: true, 2304 loaded: ub - o.uploadedBytes, 2305 total: ub - o.uploadedBytes 2306 }), o); 2307 } 2308 options.uploadedBytes = o.uploadedBytes = ub; 2309 o.result = result; 2310 o.textStatus = textStatus; 2311 o.jqXHR = jqXHR; 2312 that._trigger('chunkdone', null, o); 2313 that._trigger('chunkalways', null, o); 2314 if (ub < fs) { 2315 // File upload not yet complete, 2316 // continue with the next chunk: 2317 _upload(); 2318 } else { 2319 dfd.resolveWith(o.context, [result, textStatus, jqXHR]); 2320 } 2321 }).fail(function (jqXHR, textStatus, errorThrown) { 2322 o.jqXHR = jqXHR; 2323 o.textStatus = textStatus; 2324 o.errorThrown = errorThrown; 2325 that._trigger('chunkfail', null, o); 2326 that._trigger('chunkalways', null, o); 2327 dfd.rejectWith(o.context, [jqXHR, textStatus, errorThrown]); 2328 }).always(function () { 2329 that._deinitProgressListener(o); 2330 }); 2331 }; 2332 this._enhancePromise(promise); 2333 promise.abort = function () { 2334 return jqXHR.abort(); 2335 }; 2336 _upload(); 2337 return promise; 2338 }, 2339 _beforeSend: function _beforeSend(e, data) { 2340 if (this._active === 0) { 2341 // the start callback is triggered when an upload starts 2342 // and no other uploads are currently running, 2343 // equivalent to the global ajaxStart event: 2344 this._trigger('start'); 2345 // Set timer for global bitrate progress calculation: 2346 this._bitrateTimer = new this._BitrateTimer(); 2347 // Reset the global progress values: 2348 this._progress.loaded = this._progress.total = 0; 2349 this._progress.bitrate = 0; 2350 } 2351 // Make sure the container objects for the .response() and 2352 // .progress() methods on the data object are available 2353 // and reset to their initial state: 2354 this._initResponseObject(data); 2355 this._initProgressObject(data); 2356 data._progress.loaded = data.loaded = data.uploadedBytes || 0; 2357 data._progress.total = data.total = this._getTotal(data.files) || 1; 2358 data._progress.bitrate = data.bitrate = 0; 2359 this._active += 1; 2360 // Initialize the global progress values: 2361 this._progress.loaded += data.loaded; 2362 this._progress.total += data.total; 2363 }, 2364 _onDone: function _onDone(result, textStatus, jqXHR, options) { 2365 var total = options._progress.total, 2366 response = options._response; 2367 if (options._progress.loaded < total) { 2368 // Create a progress event if no final progress event 2369 // with loaded equaling total has been triggered: 2370 this._onProgress($.Event('progress', { 2371 lengthComputable: true, 2372 loaded: total, 2373 total: total 2374 }), options); 2375 } 2376 response.result = options.result = result; 2377 response.textStatus = options.textStatus = textStatus; 2378 response.jqXHR = options.jqXHR = jqXHR; 2379 this._trigger('done', null, options); 2380 }, 2381 _onFail: function _onFail(jqXHR, textStatus, errorThrown, options) { 2382 var response = options._response; 2383 if (options.recalculateProgress) { 2384 // Remove the failed (error or abort) file upload from 2385 // the global progress calculation: 2386 this._progress.loaded -= options._progress.loaded; 2387 this._progress.total -= options._progress.total; 2388 } 2389 response.jqXHR = options.jqXHR = jqXHR; 2390 response.textStatus = options.textStatus = textStatus; 2391 response.errorThrown = options.errorThrown = errorThrown; 2392 this._trigger('fail', null, options); 2393 }, 2394 _onAlways: function _onAlways(jqXHRorResult, textStatus, jqXHR
2394orError, options) { 2395 // jqXHRorResult, textStatus and jqXHRorError are added to the 2396 // options object via done and fail callbacks 2397 this._trigger('always', null, options); 2398 }, 2399 _onSend: function _onSend(e, data) { 2400 if (!data.submit) { 2401 this._addConvenienceMethods(e, data); 2402 } 2403 var that = this, 2404 jqXHR, 2405 aborted, 2406 slot, 2407 pipe, 2408 options = that._getAJAXSettings(data), 2409 send = function send() { 2410 that._sending += 1; 2411 // Set timer for bitrate progress calculation: 2412 options._bitrateTimer = new that._BitrateTimer(); 2413 jqXHR = jqXHR || ((aborted || that._trigger('send', $.Event('send', { 2414 delegatedEvent: e 2415 }), options) === false) && that._getXHRPromise(false, options.context, aborted) || that._chunkedUpload(options) || $.ajax(options)).done(function (result, textStatus, jqXHR) { 2416 that._onDone(result, textStatus, jqXHR, options); 2417 }).fail(function (jqXHR, textStatus, errorThrown) { 2418 that._onFail(jqXHR, textStatus, errorThrown, options); 2419 }).always(function (jqXHRorResult, textStatus, jqXHRorError) { 2420 that._deinitProgressListener(options); 2421 that._onAlways(jqXHRorResult, textStatus, jqXHRorError, options); 2422 that._sending -= 1; 2423 that._active -= 1; 2424 if (options.limitConcurrentUploads && options.limitConcurrentUploads > that._sending) { 2425 // Start the next queued upload, 2426 // that has not been aborted: 2427 var nextSlot = that._slots.shift(); 2428 while (nextSlot) { 2429 if (that._getDeferredState(nextSlot) === 'pending') { 2430 nextSlot.resolve(); 2431 break; 2432 } 2433 nextSlot = that._slots.shift(); 2434 } 2435 } 2436 if (that._active === 0) { 2437 // The stop callback is triggered when all uploads have 2438 // been completed, equivalent to the global ajaxStop event: 2439 that._trigger('stop'); 2440 } 2441 }); 2442 return jqXHR; 2443 }; 2444 this._beforeSend(e, options); 2445 if (this.options.sequentialUploads || this.options.limitConcurrentUploads && this.options.limitConcurrentUploads <= this._sending) { 2446 if (this.options.limitConcurrentUploads > 1) { 2447 slot = $.Deferred(); 2448 this._slots.push(slot); 2449 pipe = slot[that._promisePipe](send); 2450 } else { 2451 this._sequence = this._sequence[that._promisePipe](send, send); 2452 pipe = this._sequence; 2453 } 2454 // Return the piped Promise object, enhanced with an abort method, 2455 // which is delegated to the jqXHR object of the current upload, 2456 // and jqXHR callbacks mapped to the equivalent Promise methods: 2457 pipe.abort = function () { 2458 aborted = [undefined, 'abort', 'abort']; 2459 if (!jqXHR) { 2460 if (slot) { 2461 slot.rejectWith(options.context, aborted); 2462 } 2463 return send(); 2464 } 2465 return jqXHR.abort(); 2466 }; 2467 return this._enhancePromise(pipe); 2468 } 2469 return send(); 2470 }, 2471 _onAdd: function _onAdd(e, data) { 2472 var that = this, 2473 result = true, 2474 options = $.extend({}, this.options, data), 2475 files = data.files, 2476 filesLength = files.length, 2477 limit = options.limitMultiFileUploads, 2478 limitSize = options.limitMultiFileUploadSize, 2479 overhead = options.limitMultiFileUploadSizeOverhead, 2480 batchSize = 0, 2481 paramName = this._getParamName(options), 2482 paramNameSet, 2483 paramNameSlice, 2484 fileSet, 2485 i, 2486 j = 0; 2487 if (!filesLength) { 2488 return false; 2489 } 2490 if (limitSize && files[0].size === undefined) { 2491 limitSize = undefined; 2492 } 2493 if (!(options.singleFileUploads || limit || limitSize) || !this._isXHRUpload(options)) { 2494 fileSet = [files]; 2495 paramNameSet = [paramName]; 2496 } else if (!(options.singleFileUploads || limitSize) && limit) { 2497 fileSet = []; 2498 paramNameSet = []; 2499 for (i = 0; i < filesLength; i += limit) { 2500 fileSet.push(files.slice(i, i + limit)); 2501 paramNameSlice = paramName.slice(i, i + limit); 2502 if (!paramNameSlice.length) { 2503 paramNameSlice = paramName; 2504 } 2505 paramNameSet.push(paramNameSlice); 2506 } 2507 } else if (!options.singleFileUploads && limitSize) { 2508 fileSet = []; 2509 paramNameSet = []; 2510 for (i = 0; i < filesLength; i = i + 1) {
2511 batchSize += files[i].size + overhead; 2512 if (i + 1 === filesLength || batchSize + files[i + 1].size + overhead > limitSize || limit && i + 1 - j >= limit) { 2513 fileSet.push(files.slice(j, i + 1)); 2514 paramNameSlice = paramName.slice(j, i + 1); 2515 if (!paramNameSlice.length) { 2516 paramNameSlice = paramName; 2517 } 2518 paramNameSet.push(paramNameSlice); 2519 j = i + 1; 2520 batchSize = 0; 2521 } 2522 } 2523 } else { 2524 paramNameSet = paramName; 2525 } 2526 data.originalFiles = files; 2527 $.each(fileSet || files, function (index, element) { 2528 var newData = $.extend({}, data); 2529 newData.files = fileSet ? element : [element]; 2530 newData.paramName = paramNameSet[index]; 2531 that._initResponseObject(newData); 2532 that._initProgressObject(newData); 2533 that._addConvenienceMethods(e, newData); 2534 result = that._trigger('add', $.Event('add', { 2535 delegatedEvent: e 2536 }), newData); 2537 return result; 2538 }); 2539 return result; 2540 }, 2541 _replaceFileInput: function _replaceFileInput(data) { 2542 var input = data.fileInput, 2543 inputClone = input.clone(true), 2544 restoreFocus = input.is(document.activeElement); 2545 // Add a reference for the new cloned file input to the data argument: 2546 data.fileInputClone = inputClone; 2547 $('<form></form>').append(inputClone)[0].reset(); 2548 // Detaching allows to insert the fileInput on another form 2549 // without losing the file input value: 2550 input.after(inputClone).detach(); 2551 // If the fileInput had focus before it was detached, 2552 // restore focus to the inputClone. 2553 if (restoreFocus) { 2554 inputClone.trigger('focus'); 2555 } 2556 // Avoid memory leaks with the detached file input: 2557 $.cleanData(input.off('remove')); 2558 // Replace the original file input element in the fileInput 2559 // elements set with the clone, which has been copied including 2560 // event handlers: 2561 this.options.fileInput = this.options.fileInput.map(function (i, el) { 2562 if (el === input[0]) { 2563 return inputClone[0]; 2564 } 2565 return el; 2566 }); 2567 // If the widget has been initialized on the file input itself, 2568 // override this.element with the file input clone: 2569 if (input[0] === this.element[0]) { 2570 this.element = inputClone; 2571 } 2572 }, 2573 _handleFileTreeEntry: function _handleFileTreeEntry(entry, path) { 2574 var that = this, 2575 dfd = $.Deferred(), 2576 entries = [], 2577 dirReader, 2578 errorHandler = function errorHandler(e) { 2579 if (e && !e.entry) { 2580 e.entry = entry; 2581 } 2582 // Since $.when returns immediately if one 2583 // Deferred is rejected, we use resolve instead. 2584 // This allows valid files and invalid items 2585 // to be returned together in one set: 2586 dfd.resolve([e]); 2587 }, 2588 successHandler = function successHandler(entries) { 2589 that._handleFileTreeEntries(entries, path + entry.name + '/').done(function (files) { 2590 dfd.resolve(files); 2591 }).fail(errorHandler); 2592 }, 2593 _readEntries = function readEntries() { 2594 dirReader.readEntries(function (results) { 2595 if (!results.length) { 2596 successHandler(entries); 2597 } else { 2598 entries = entries.concat(results); 2599 _readEntries(); 2600 } 2601 }, errorHandler); 2602 }; 2603 // eslint-disable-next-line no-param-reassign 2604 path = path || ''; 2605 if (entry.isFile) { 2606 if (entry._file) { 2607 // Workaround for Chrome bug #149735 2608 entry._file.relativePath = path; 2609 dfd.resolve(entry._file); 2610 } else { 2611 entry.file(function (file) { 2612 file.relativePath = path; 2613 dfd.resolve(file); 2614 }, errorHandler); 2615 } 2616 } else if (entry.isDirectory) { 2617 dirReader = entry.createReader(); 2618 _readEntries(); 2619 } else { 2620 // Return an empty list for file system items 2621 // other than files or directories: 2622 dfd.resolve([]); 2623 } 2624 return dfd.promise(); 2625 }, 2626 _handleFileTreeEntries: function _handleFileTreeEntries(entries, path) { 2627 var that = this; 2628 return $.when.apply($, $.map(entries, function (entry) { 2629 return that._handleFileTreeEntry(entry, path); 2630 }))[this._promisePipe](function () { 2631 return Array.prototype.concat.apply([], arguments); 2632 }); 2633 }, 2634 _getDroppedFiles: function _getDroppedFiles(dataTransfer) { 2635 // eslint-disable-next-line no-param-reassign 2636 dataTransfer = dataTransfer || {}; 2637 var items = dataTransfer.items; 2638 if (items && items.length && (items[0].webkitGetAsEntry || items[0].getAsEntry)) { 2639 return this._handleFileTreeEntries($.map(items, function (item) { 2640 var entry; 2641 if (item.webkitGetAsEntry) { 2642 entry = item.webkitGetAsEntry(); 2643 if (entry) { 2644 // Workaround for Chrome bug #149735: 2645 entry._file = item.getAsFile(); 2646 } 2647 return entry; 2648 } 2649 return item.getAsEntry(); 2650 })); 2651 } 2652 return $.Deferred().resolve($.makeArray(dataTransfer.files)).promise(); 2653 }, 2654 _getSingleFileInputFiles: function _getSingleFileInputFiles(fileInput) { 2655 // eslint-disable-next-line no-param-reassign 2656 fileInput = $(fileInput); 2657 var entries = fileInput.prop('entries'), 2658 files, 2659 value;
2660 if (entries && entries.length) { 2661 return this._handleFileTreeEntries(entries); 2662 } 2663 files = $.makeArray(fileInput.prop('files')); 2664 if (!files.length) { 2665 value = fileInput.prop('value'); 2666 if (!value) { 2667 return $.Deferred().resolve([]).promise(); 2668 } 2669 // If the files property is not available, the browser does not 2670 // support the File API and we add a pseudo File object with 2671 // the input value as name with path information removed: 2672 files = [{ 2673 name: value.replace(/^.*\\/, '') 2674 }]; 2675 } else if (files[0].name === undefined && files[0].fileName) { 2676 // File normalization for Safari 4 and Firefox 3: 2677 $.each(files, function (index, file) { 2678 file.name = file.fileName; 2679 file.size = file.fileSize; 2680 }); 2681 } 2682 return $.Deferred().resolve(files).promise(); 2683 }, 2684 _getFileInputFiles: function _getFileInputFiles(fileInput) { 2685 if (!(fileInput instanceof $) || fileInput.length === 1) { 2686 return this._getSingleFileInputFiles(fileInput); 2687 } 2688 return $.when.apply($, $.map(fileInput, this._getSingleFileInputFiles))[this._promisePipe](function () { 2689 return Array.prototype.concat.apply([], arguments); 2690 }); 2691 }, 2692 _onChange: function _onChange(e) { 2693 var that = this, 2694 data = { 2695 fileInput: $(e.target), 2696 form: $(e.target.form) 2697 }; 2698 this._getFileInputFiles(data.fileInput).always(function (files) { 2699 data.files = files; 2700 if (that.options.replaceFileInput) { 2701 that._replaceFileInput(data); 2702 } 2703 if (that._trigger('change', $.Event('change', { 2704 delegatedEvent: e 2705 }), data) !== false) { 2706 that._onAdd(e, data); 2707 } 2708 }); 2709 }, 2710 _onPaste: function _onPaste(e) { 2711 var items = e.originalEvent && e.originalEvent.clipboardData && e.originalEvent.clipboardData.items, 2712 data = { 2713 files: [] 2714 }; 2715 if (items && items.length) { 2716 $.each(items, function (index, item) { 2717 var file = item.getAsFile && item.getAsFile(); 2718 if (file) { 2719 data.files.push(file); 2720 } 2721 }); 2722 if (this._trigger('paste', $.Event('paste', { 2723 delegatedEvent: e 2724 }), data) !== false) { 2725 this._onAdd(e, data); 2726 } 2727 } 2728 }, 2729 _onDrop: function _onDrop(e) { 2730 e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; 2731 var that = this, 2732 dataTransfer = e.dataTransfer, 2733 data = {}; 2734 if (dataTransfer && dataTransfer.files && dataTransfer.files.length) { 2735 e.preventDefault(); 2736 this._getDroppedFiles(dataTransfer).always(function (files) { 2737 data.files = files; 2738 if (that._trigger('drop', $.Event('drop', { 2739 delegatedEvent: e 2740 }), data) !== false) { 2741 that._onAdd(e, data); 2742 } 2743 }); 2744 } 2745 }, 2746 _onDragOver: getDragHandler('dragover'), 2747 _onDragEnter: getDragHandler('dragenter'), 2748 _onDragLeave: getDragHandler('dragleave'), 2749 _initEventHandlers: function _initEventHandlers() { 2750 if (this._isXHRUpload(this.options)) { 2751 this._on(this.options.dropZone, { 2752 dragover: this._onDragOver, 2753 drop: this._onDrop, 2754 // event.preventDefault() on dragenter is required for IE10+: 2755 dragenter: this._onDragEnter, 2756 // dragleave is not required, but added for completeness: 2757 dragleave: this._onDragLeave 2758 }); 2759 this._on(this.options.pasteZone, { 2760 paste: this._onPaste 2761 }); 2762 } 2763 if ($.support.fileInput) { 2764 this._on(this.options.fileInput, { 2765 change: this._onChange 2766 }); 2767 } 2768 }, 2769 _destroyEventHandlers: function _destroyEventHandlers() { 2770 this._off(this.options.dropZone, 'dragenter dragleave dragover drop'); 2771 this._off(this.options.pasteZone, 'paste'); 2772 this._off(this.options.fileInput, 'change'); 2773 }, 2774 _destroy: function _destroy() { 2775 this._destroyEventHandlers(); 2776 }, 2777 _setOption: function _setOption(key, value) { 2778 var reinit = $.inArray(key, this._specialOptions) !== -1; 2779 if (reinit) { 2780 this._destroyEventHandlers(); 2781 } 2782 this._super(key, value); 2783 if (reinit) { 2784 this._initSpecialOptions(); 2785 this._initEventHandlers(); 2786 } 2787 }, 2788 _initSpecialOptions: function _initSpecialOptions() { 2789 var options = this.options; 2790 if (options.fileInput === undefined) { 2791 options.fileInput = this.element.is('input[type="file"]') ? this.element : this.element.find('input[type="file"]'); 2792 } else if (!(options.fileInput instanceof $)) { 2793 options.fileInput = $(options.fileInput); 2794 } 2795 if (!(options.dropZone instanceof $)) { 2796 options.dropZone = $(options.dropZone); 2797 } 2798 if (!(options.pasteZone instanceof $)) { 2799 options.pasteZone = $(options.pasteZone); 2800 } 2801 }, 2802 _getRegExp: function _getRegExp(str) { 2803 var parts = str.split('/'), 2804 modifiers = parts.pop(); 2805 parts.shift(); 2806 return new RegExp(parts.join('/'), modifiers); 2807 }, 2808 _isRegExpOption: function _isRegExpOption(key, value) { 2809 return key !== 'url' && $.type(value) === 'string' && /^\/.*\/[igm]{0,3}$/.test(value); 2810 }, 2811 _initDataAttributes: function _initDataAttributes() { 2812 var that = this, 2813 options = this.options, 2814 data = this.element.data(); 2815 // Initialize options set via HTML5 data-attributes: 2816 $.each(this.element[0].attributes, function (index, attr) { 2817 var key = attr.name.toLowerCase(), 2818 value; 2819 if (/^data-/.test(key)) { 2820 // Convert hyphen-ated key to camelCase: 2821 key = key.slice(5).replace(/-[a-z]/g, function (str) { 2822 return str.charAt(1).toUpperCase(); 2823 }); 2824 value = data[key]; 2825 if (that._isRegExpOption(key, value)) { 2826 value = that._getRegExp(value); 2827 } 2828 options[key] = value; 2829 } 2830 }); 2831 }, 2832 _create: function _create() { 2833 this._initDataAttributes(); 2834 this._initSpecialOptions(); 2835 this._slots = []; 2836 this._sequence = this._getXHRPromise(true); 2837 this._sending = this._active = 0; 2838 this._initProgressObject(this); 2839 this._initEventHandlers(); 2840 }, 2841 // This method is exposed to the widget API and allows to query 2842 // the number of active uploads: 2843 active: function active() { 2844 return this._active; 2845 }, 2846 // This method is exposed to the widget API and allows to query 2847 // the widget upload progress. 2848 // It returns an object with loaded, total and bitrate properties 2849 // for the running uploads: 2850 progress: function progress() { 2851 return this._progress; 2852 }, 2853 // This method is exposed to the widget API and allows adding files 2854 // using the fileupload API. The data parameter accepts an object which 2855 // must have a files property and can contain additional options: 2856 // .fileupload('add', {files: filesList}); 2857 add: function add(data) { 2858 var that = this; 2859 if (!data || this.options.disabled) { 2860 return; 2861 } 2862 if (data.fileInput && !data.files) { 2863 this._getFileInputFiles(data.fileInput).always(function (files) { 2864 data.files = files; 2865 that._onAdd(null, data); 2866 }); 2867 } else { 2868 data.files = $.makeArray(data.files); 2869 this._onAdd(null, data); 2870 } 2871 }, 2872 // This method is exposed to the widget API and allows sending files 2873 // using the fileupload API. The data parameter accepts an object which 2874 // must have a files or fileInput property and can contain additional options: 2875 // .fileupload('send', {files: filesList}); 2876 // The method returns a Promise object for the file upload call. 2877 send: function send(data) { 2878 if (data && !this.options.disabled) { 2879 if (data.fileInput && !data.files) { 2880 var that = this, 2881 dfd = $.Deferred(), 2882 promise = dfd.promise(), 2883 jqXHR, 2884 aborted; 2885 promise.abort = function () { 2886 aborted = true; 2887 if (jqXHR) { 2888 return jqXHR.abort(); 2889 } 2890 dfd.reject(null, 'abort', 'abort'); 2891 return promise; 2892 }; 2893 this._getFileInputFiles(data.fileInput).always(function (files) { 2894 if (aborted) { 2895 return; 2896 } 2897 if (!files.length) { 2898 dfd.reject(); 2899 return; 2900 } 2901 data.files = files; 2902 jqXHR = that._onSend(null, data); 2903 jqXHR.then(function (result, textStatus, jqXHR) { 2904 dfd.resolve(result, textStatus, jqXHR); 2905 }, function (jqXHR, textStatus, errorThrown) { 2906 dfd.reject(jqXHR, textStatus, errorThrown); 2907 }); 2908 }); 2909 return this._enhancePromise(promise); 2910 } 2911 data.files = $.makeArray(data.files); 2912 if (data.files.length) { 2913 return this._onSend(null, data); 2914 } 2915 } 2916 return this._getXHRPromise(false, data && data.context); 2917 } 2918 }); 2919}); 2920 2921}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 2922},{"./vendor/jquery.ui.widget":5}],4:[function(require,module,exports){ 2923(function (global){(function (){ 2924function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 2925/* 2926 * jQuery Iframe Transport Plugin 2927 * https://github.com/blueimp/jQuery-File-Upload 2928 * 2929 * Copyright 2011, Sebastian Tschan 2930 * https://blueimp.net 2931 * 2932 * Licensed under the MIT license: 2933 * https://opensource.org/licenses/MIT 2934 */ 2935 2936/* global define, require */ 2937 2938(function (factory) { 2939 'use strict'; 2940 2941 if (typeof define === 'function' && define.amd) { 2942 // Register as an anonymous AMD module: 2943 define(['jquery'], factory); 2944 } else if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object') { 2945 // Node/CommonJS: 2946 factory((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 2947 } else { 2948 // Browser globals: 2949 factory(window.jQuery); 2950 } 2951})(function ($) { 2952 'use strict'; 2953 2954 // Helper variable to create unique names for the transport iframes: 2955 var counter = 0, 2956 jsonAPI = $, 2957 jsonParse = 'parseJSON'; 2958 if ('JSON' in window && 'parse' in JSON) { 2959 jsonAPI = JSON; 2960 jsonParse = 'parse'; 2961 } 2962 2963 // The iframe transport accepts four additional options: 2964 // options.fileInput: a jQuery collection of file input fields 2965 // options.paramName: the parameter name for the file form data, 2966 // overrides the name property of the file input field(s),
2967 // can be a string or an array of strings. 2968 // options.formData: an array of objects with name and value properties, 2969 // equivalent to the return data of .serializeArray(), e.g.: 2970 // [{name: 'a', value: 1}, {name: 'b', value: 2}] 2971 // options.initialIframeSrc: the URL of the initial iframe src, 2972 // by default set to "javascript:false;" 2973 $.ajaxTransport('iframe', function (options) { 2974 if (options.async) { 2975 // javascript:false as initial iframe src 2976 // prevents warning popups on HTTPS in IE6: 2977 // eslint-disable-next-line no-script-url 2978 var initialIframeSrc = options.initialIframeSrc || 'javascript:false;', 2979 form, 2980 iframe, 2981 addParamChar; 2982 return { 2983 send: function send(_, completeCallback) { 2984 form = $('<form style="display:none;"></form>'); 2985 form.attr('accept-charset', options.formAcceptCharset); 2986 addParamChar = /\?/.test(options.url) ? '&' : '?'; 2987 // XDomainRequest only supports GET and POST: 2988 if (options.type === 'DELETE') { 2989 options.url = options.url + addParamChar + '_method=DELETE'; 2990 options.type = 'POST'; 2991 } else if (options.type === 'PUT') { 2992 options.url = options.url + addParamChar + '_method=PUT'; 2993 options.type = 'POST'; 2994 } else if (options.type === 'PATCH') { 2995 options.url = options.url + addParamChar + '_method=PATCH'; 2996 options.type = 'POST'; 2997 } 2998 // IE versions below IE8 cannot set the name property of 2999 // elements that have already been added to the DOM, 3000 // so we set the name along with the iframe HTML markup: 3001 counter += 1; 3002 iframe = $('<iframe src="' + initialIframeSrc + '" name="iframe-transport-' + counter + '"></iframe>').on('load', function () { 3003 var fileInputClones, 3004 paramNames = $.isArray(options.paramName) ? options.paramName : [options.paramName]; 3005 iframe.off('load').on('load', function () { 3006 var response; 3007 // Wrap in a try/catch block to catch exceptions thrown 3008 // when trying to access cross-domain iframe contents: 3009 try { 3010 response = iframe.contents(); 3011 // Google Chrome and Firefox do not throw an 3012 // exception when calling iframe.contents() on 3013 // cross-domain requests, so we unify the response: 3014 if (!response.length || !response[0].firstChild) { 3015 throw new Error(); 3016 } 3017 } catch (e) { 3018 response = undefined; 3019 } 3020 // The complete callback returns the 3021 // iframe content document as response object: 3022 completeCallback(200, 'success', { 3023 iframe: response 3024 }); 3025 // Fix for IE endless progress bar activity bug 3026 // (happens on form submits to iframe targets): 3027 $('<iframe src="' + initialIframeSrc + '"></iframe>').appendTo(form); 3028 window.setTimeout(function () { 3029 // Removing the form in a setTimeout call 3030 // allows Chrome's developer tools to display 3031 // the response result 3032 form.remove(); 3033 }, 0); 3034 }); 3035 form.prop('target', iframe.prop('name')).prop('action', options.url).prop('method', options.type); 3036 if (options.formData) { 3037 $.each(options.formData, function (index, field) { 3038 $('<input type="hidden"/>').prop('name', field.name).val(field.value).appendTo(form); 3039 }); 3040 } 3041 if (options.fileInput && options.fileInput.length && options.type === 'POST') { 3042 fileInputClones = options.fileInput.clone(); 3043 // Insert a clone for each file input field: 3044 options.fileInput.after(function (index) { 3045 return fileInputClones[index]; 3046 }); 3047 if (options.paramName) { 3048 options.fileInput.each(function (index) { 3049 $(this).prop('name', paramNames[index] || options.paramName); 3050 }); 3051 } 3052 // Appending the file input fields to the hidden form 3053 // removes them from their original location: 3054 form.append(options.fileInput).prop('enctype', 'multipart/form-data') 3055 // enctype must be set as encoding for IE: 3056 .prop('encoding', 'multipart/form-data'); 3057 // Remove the HTML5 form attribute from the input(s): 3058 options.fileInput.removeAttr('form'); 3059 } 3060 window.setTimeout(function () { 3061 // Submitting the form in a setTimeout call fixes an issue with 3062 // Safari 13 not triggering the iframe load event after resetting 3063 // the load event handler, see also: 3064 // https://github.com/blueimp/jQuery-File-Upload/issues/3633 3065 form.submit(); 3066 // Insert the file input fields at their original location 3067 // by replacing the clones with the originals: 3068 if (fileInputClones && fileInputClones.length) { 3069 options.fileInput.each(function (index, input) { 3070 var clone = $(fileInputClones[index]); 3071 // Restore the original name and form properties: 3072 $(input).prop('name', clone.prop('name')).attr('form', clone.attr('form')); 3073 clone.replaceWith(input); 3074 }); 3075 } 3076 }, 0); 3077 }); 3078 form.append(iframe).appendTo(document.body); 3079 }, 3080 abort: function abort() { 3081 if (iframe) { 3082 // javascript:false as iframe src aborts the request 3083 // and prevents warning popups on HTTPS in IE6. 3084 iframe.off('load').prop('src', initialIframeSrc); 3085 } 3086 if (form) { 3087 form.remove(); 3088 } 3089 } 3090 }; 3091 } 3092 }); 3093 3094 // The iframe transport returns the iframe content document as response. 3095 // The following adds converters from iframe to text, json, html, xml 3096 // and script. 3097 // Please note that the Content-Type for JSON responses has to be text/plain 3098 // or text/html, if the browser doesn't include application/json in the 3099 // Accept header, else IE will show a download dialog. 3100 // The Content-Type for XML responses on the other hand has to be al
3100ways 3101 // application/xml or text/xml, so IE properly parses the XML response. 3102 // See also 3103 // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation 3104 $.ajaxSetup({ 3105 converters: { 3106 'iframe text': function iframe_text(iframe) { 3107 return iframe && $(iframe[0].body).text(); 3108 }, 3109 'iframe json': function iframe_json(iframe) { 3110 return iframe && jsonAPI[jsonParse]($(iframe[0].body).text()); 3111 }, 3112 'iframe html': function iframe_html(iframe) { 3113 return iframe && $(iframe[0].body).html(); 3114 }, 3115 'iframe xml': function iframe_xml(iframe) { 3116 var xmlDoc = iframe && iframe[0]; 3117 return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc : $.parseXML(xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml || $(xmlDoc.body).html()); 3118 }, 3119 'iframe script': function iframe_script(iframe) { 3120 return iframe && $.globalEval($(iframe[0].body).text()); 3121 } 3122 } 3123 }); 3124}); 3125 3126}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 3127},{}],5:[function(require,module,exports){ 3128(function (global){(function (){ 3129function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 3130/*! jQuery UI - v1.12.1+0b7246b6eeadfa9e2696e22f3230f6452f8129dc - 2020-02-20 3131 * http://jqueryui.com 3132 * Includes: widget.js 3133 * Copyright jQuery Foundation and other contributors; Licensed MIT */ 3134 3135/* global define, require */ 3136/* eslint-disable no-param-reassign, new-cap, jsdoc/require-jsdoc */ 3137 3138(function (factory) { 3139 'use strict'; 3140 3141 if (typeof define === 'function' && define.amd) { 3142 // AMD. Register as an anonymous module. 3143 define(['jquery'], factory); 3144 } else if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object') { 3145 // Node/CommonJS 3146 factory((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 3147 } else { 3148 // Browser globals 3149 factory(window.jQuery); 3150 } 3151})(function ($) { 3152 'use strict'; 3153 $.ui = $.ui || {}; 3154 $.ui.version = '1.12.1'; 3155 3156 /*! 3157 * jQuery UI Widget 1.12.1 3158 * http://jqueryui.com 3159 * 3160 * Copyright jQuery Foundation and other contributors 3161 * Released under the MIT license. 3162 * http://jquery.org/license 3163 */ 3164 3165 //>>label: Widget 3166 //>>group: Core 3167 //>>description: Provides a factory for creating stateful widgets with a common API. 3168 //>>docs: http://api.jqueryui.com/jQuery.widget/ 3169 //>>demos: http://jqueryui.com/widget/ 3170 3171 // Support: jQuery 1.9.x or older 3172 // $.expr[ ":" ] is deprecated. 3173 if (!$.expr.pseudos) { 3174 $.expr.pseudos = $.expr[':']; 3175 } 3176 3177 // Support: jQuery 1.11.x or older 3178 // $.unique has been renamed to $.uniqueSort 3179 if (!$.uniqueSort) { 3180 $.uniqueSort = $.unique; 3181 } 3182 var widgetUuid = 0; 3183 var widgetHasOwnProperty = Array.prototype.hasOwnProperty; 3184 var widgetSlice = Array.prototype.slice; 3185 $.cleanData = function (orig) { 3186 return function (elems) { 3187 var events, elem, i; 3188 // eslint-disable-next-line eqeqeq 3189 for (i = 0; (elem = elems[i]) != null; i++) { 3190 // Only trigger remove when necessary to save time 3191 events = $._data(elem, 'events'); 3192 if (events && events.remove) { 3193 $(elem).triggerHandler('remove'); 3194 } 3195 } 3196 orig(elems); 3197 }; 3198 }($.cleanData); 3199 $.widget = function (name, base, prototype) { 3200 var existingConstructor, constructor, basePrototype; 3201 3202 // ProxiedPrototype allows the provided prototype to remain unmodified 3203 // so that it can be used as a mixin for multiple widgets (#8876) 3204 var proxiedPrototype = {}; 3205 var namespace = name.split('.')[0]; 3206 name = name.split('.')[1]; 3207 var fullName = namespace + '-' + name; 3208 if (!prototype) { 3209 prototype = base; 3210 base = $.Widget; 3211 } 3212 if ($.isArray(prototype)) { 3213 prototype = $.extend.apply(null, [{}].concat(prototype)); 3214 } 3215 3216 // Create selector for plugin 3217 $.expr.pseudos[fullName.toLowerCase()] = function (elem) { 3218 return !!$.data(elem, fullName); 3219 }; 3220 $[namespace] = $[namespace] || {}; 3221 existingConstructor = $[namespace][name]; 3222 constructor = $[namespace][name] = function (options, element) { 3223 // Allow instantiation without "new" keyword 3224 if (!this._createWidget) { 3225 return new constructor(options, element); 3226 } 3227 3228 // Allow instantiation without initializing for simple inheritance 3229 // must use "new" keyword (the code above always passes args) 3230 if (arguments.length) { 3231 this._createWidget(options, element); 3232 } 3233 }; 3234 3235 // Extend with the existing constructor to carry over any static properties 3236 $.extend(constructor, existingConstructor, { 3237 version: prototype.version, 3238 // Copy the object used to create the prototype in case we need to 3239 // redefine the widget later 3240 _proto: $.extend({}, prototype), 3241 // Track widgets that inherit from this widget in case this widget is 3242 // redefined after a widget inherits from it 3243 _childConstructors: [] 3244 }); 3245 basePrototype = new base(); 3246 3247 // We need to make the options hash a property directly on the new instance 3248 // otherwise we'll modify the options hash on the prototype that we're 3249 // inheriting from 3250 basePrototype.options = $.widget.extend({}, basePrototype.options); 3251 $.each(prototype, function (prop, value) { 3252 if (!$.isFunction(value)) { 3253 proxiedPrototype[prop] = value; 3254 return; 3255 } 3256 proxiedPrototype[prop] = function () { 3257 function _super() { 3258 return base.prototype[prop].apply(this, arguments); 3259 } 3260 function _superApply(args) { 3261 return base.prototype[prop].apply(this, args); 3262 } 3263 return function () { 3264 var __super = this._super; 3265 var __superApply = this._superApply; 3266 var returnValue; 3267 this._super = _super; 3268 this._superApply = _superApply;
vendor: 5,640 bytes, lines 3269-3419
3269 returnValue = value.apply(this, arguments); 3270 this._super = __super; 3271 this._superApply = __superApply; 3272 return returnValue; 3273 }; 3274 }(); 3275 }); 3276 constructor.prototype = $.widget.extend(basePrototype, { 3277 // TODO: remove support for widgetEventPrefix 3278 // always use the name + a colon as the prefix, e.g., draggable:start 3279 // don't prefix for widgets that aren't DOM-based 3280 widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix || name : name 3281 }, proxiedPrototype, { 3282 constructor: constructor, 3283 namespace: namespace, 3284 widgetName: name, 3285 widgetFullName: fullName 3286 }); 3287 3288 // If this widget is being redefined then we need to find all widgets that 3289 // are inheriting from it and redefine all of them so that they inherit from 3290 // the new version of this widget. We're essentially trying to replace one 3291 // level in the prototype chain. 3292 if (existingConstructor) { 3293 $.each(existingConstructor._childConstructors, function (i, child) { 3294 var childPrototype = child.prototype; 3295 3296 // Redefine the child widget using the same prototype that was 3297 // originally used, but inherit from the new version of the base 3298 $.widget(childPrototype.namespace + '.' + childPrototype.widgetName, constructor, child._proto); 3299 }); 3300 3301 // Remove the list of existing child constructors from the old constructor 3302 // so the old child constructors can be garbage collected 3303 delete existingConstructor._childConstructors; 3304 } else { 3305 base._childConstructors.push(constructor); 3306 } 3307 $.widget.bridge(name, constructor); 3308 return constructor; 3309 }; 3310 $.widget.extend = function (target) { 3311 var input = widgetSlice.call(arguments, 1); 3312 var inputIndex = 0; 3313 var inputLength = input.length; 3314 var key; 3315 var value; 3316 for (; inputIndex < inputLength; inputIndex++) { 3317 for (key in input[inputIndex]) { 3318 value = input[inputIndex][key]; 3319 if (widgetHasOwnProperty.call(input[inputIndex], key) && value !== undefined) { 3320 // Clone objects 3321 if ($.isPlainObject(value)) { 3322 target[key] = $.isPlainObject(target[key]) ? $.widget.extend({}, target[key], value) : 3323 // Don't extend strings, arrays, etc. with objects 3324 $.widget.extend({}, value); 3325 3326 // Copy everything else by reference 3327 } else { 3328 target[key] = value; 3329 } 3330 } 3331 } 3332 } 3333 return target; 3334 }; 3335 $.widget.bridge = function (name, object) { 3336 var fullName = object.prototype.widgetFullName || name; 3337 $.fn[name] = function (options) { 3338 var isMethodCall = typeof options === 'string'; 3339 var args = widgetSlice.call(arguments, 1); 3340 var returnValue = this; 3341 if (isMethodCall) { 3342 // If this is an empty collection, we need to have the instance method 3343 // return undefined instead of the jQuery instance 3344 if (!this.length && options === 'instance') { 3345 returnValue = undefined; 3346 } else { 3347 this.each(function () { 3348 var methodValue; 3349 var instance = $.data(this, fullName); 3350 if (options === 'instance') { 3351 returnValue = instance; 3352 return false; 3353 } 3354 if (!instance) { 3355 return $.error('cannot call methods on ' + name + ' prior to initialization; ' + "attempted to call method '" + options + "'"); 3356 } 3357 if (!$.isFunction(instance[options]) || options.charAt(0) === '_') { 3358 return $.error("no such method '" + options + "' for " + name + ' widget instance'); 3359 } 3360 methodValue = instance[options].apply(instance, args); 3361 if (methodValue !== instance && methodValue !== undefined) { 3362 returnValue = methodValue && methodValue.jquery ? returnValue.pushStack(methodValue.get()) : methodValue; 3363 return false; 3364 } 3365 }); 3366 } 3367 } else { 3368 // Allow multiple hashes to be passed on init 3369 if (args.length) { 3370 options = $.widget.extend.apply(null, [options].concat(args)); 3371 } 3372 this.each(function () { 3373 var instance = $.data(this, fullName); 3374 if (instance) { 3375 instance.option(options || {}); 3376 if (instance._init) { 3377 instance._init(); 3378 } 3379 } else { 3380 $.data(this, fullName, new object(options, this)); 3381 } 3382 }); 3383 } 3384 return returnValue; 3385 }; 3386 }; 3387 $.Widget = function /* options, element */ () {}; 3388 $.Widget._childConstructors = []; 3389 $.Widget.prototype = { 3390 widgetName: 'widget', 3391 widgetEventPrefix: '', 3392 defaultElement: '<div>', 3393 options: { 3394 classes: {}, 3395 disabled: false, 3396 // Callbacks 3397 create: null 3398 }, 3399 _createWidget: function _createWidget(options, element) { 3400 element = $(element || this.defaultElement || this)[0]; 3401 this.element = $(element); 3402 this.uuid = widgetUuid++; 3403 this.eventNamespace = '.' + this.widgetName + this.uuid; 3404 this.bindings = $(); 3405 this.hoverable = $(); 3406 this.focusable = $(); 3407 this.classesElementLookup = {}; 3408 if (element !== this) { 3409 $.data(element, this.widgetFullName, this); 3410 this._on(true, this.element, { 3411 remove: function remove(event) { 3412 if (event.target === element) { 3413 this.destroy(); 3414 } 3415 } 3416 }); 3417 this.document = $(element.style ? 3418 // Element within the document 3419 element.ownerDocument :
vendor: 7,694 bytes, lines 3420-3636
3420 // Element is window or document 3421 element.document || element); 3422 this.window = $(this.document[0].defaultView || this.document[0].parentWindow); 3423 } 3424 this.options = $.widget.extend({}, this.options, this._getCreateOptions(), options); 3425 this._create(); 3426 if (this.options.disabled) { 3427 this._setOptionDisabled(this.options.disabled); 3428 } 3429 this._trigger('create', null, this._getCreateEventData()); 3430 this._init(); 3431 }, 3432 _getCreateOptions: function _getCreateOptions() { 3433 return {}; 3434 }, 3435 _getCreateEventData: $.noop, 3436 _create: $.noop, 3437 _init: $.noop, 3438 destroy: function destroy() { 3439 var that = this; 3440 this._destroy(); 3441 $.each(this.classesElementLookup, function (key, value) { 3442 that._removeClass(value, key); 3443 }); 3444 3445 // We can probably remove the unbind calls in 2.0 3446 // all event bindings should go through this._on() 3447 this.element.off(this.eventNamespace).removeData(this.widgetFullName); 3448 this.widget().off(this.eventNamespace).removeAttr('aria-disabled'); 3449 3450 // Clean up events and states 3451 this.bindings.off(this.eventNamespace); 3452 }, 3453 _destroy: $.noop, 3454 widget: function widget() { 3455 return this.element; 3456 }, 3457 option: function option(key, value) { 3458 var options = key; 3459 var parts; 3460 var curOption; 3461 var i; 3462 if (arguments.length === 0) { 3463 // Don't return a reference to the internal hash 3464 return $.widget.extend({}, this.options); 3465 } 3466 if (typeof key === 'string') { 3467 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 3468 options = {}; 3469 parts = key.split('.'); 3470 key = parts.shift(); 3471 if (parts.length) { 3472 curOption = options[key] = $.widget.extend({}, this.options[key]); 3473 for (i = 0; i < parts.length - 1; i++) { 3474 curOption[parts[i]] = curOption[parts[i]] || {}; 3475 curOption = curOption[parts[i]]; 3476 } 3477 key = parts.pop(); 3478 if (arguments.length === 1) { 3479 return curOption[key] === undefined ? null : curOption[key]; 3480 } 3481 curOption[key] = value; 3482 } else { 3483 if (arguments.length === 1) { 3484 return this.options[key] === undefined ? null : this.options[key]; 3485 } 3486 options[key] = value; 3487 } 3488 } 3489 this._setOptions(options); 3490 return this; 3491 }, 3492 _setOptions: function _setOptions(options) { 3493 var key; 3494 for (key in options) { 3495 this._setOption(key, options[key]); 3496 } 3497 return this; 3498 }, 3499 _setOption: function _setOption(key, value) { 3500 if (key === 'classes') { 3501 this._setOptionClasses(value); 3502 } 3503 this.options[key] = value; 3504 if (key === 'disabled') { 3505 this._setOptionDisabled(value); 3506 } 3507 return this; 3508 }, 3509 _setOptionClasses: function _setOptionClasses(value) { 3510 var classKey, elements, currentElements; 3511 for (classKey in value) { 3512 currentElements = this.classesElementLookup[classKey]; 3513 if (value[classKey] === this.options.classes[classKey] || !currentElements || !currentElements.length) { 3514 continue; 3515 } 3516 3517 // We are doing this to create a new jQuery object because the _removeClass() call 3518 // on the next line is going to destroy the reference to the current elements being 3519 // tracked. We need to save a copy of this collection so that we can add the new classes 3520 // below. 3521 elements = $(currentElements.get()); 3522 this._removeClass(currentElements, classKey); 3523 3524 // We don't use _addClass() here, because that uses this.options.classes 3525 // for generating the string of classes. We want to use the value passed in from 3526 // _setOption(), this is the new value of the classes option which was passed to 3527 // _setOption(). We pass this value directly to _classes(). 3528 elements.addClass(this._classes({ 3529 element: elements, 3530 keys: classKey, 3531 classes: value, 3532 add: true 3533 })); 3534 } 3535 }, 3536 _setOptionDisabled: function _setOptionDisabled(value) { 3537 this._toggleClass(this.widget(), this.widgetFullName + '-disabled', null, !!value); 3538 3539 // If the widget is becoming disabled, then nothing is interactive 3540 if (value) { 3541 this._removeClass(this.hoverable, null, 'ui-state-hover'); 3542 this._removeClass(this.focusable, null, 'ui-state-focus'); 3543 } 3544 }, 3545 enable: function enable() { 3546 return this._setOptions({ 3547 disabled: false 3548 }); 3549 }, 3550 disable: function disable() { 3551 return this._setOptions({ 3552 disabled: true 3553 }); 3554 }, 3555 _classes: function _classes(options) { 3556 var full = []; 3557 var that = this; 3558 options = $.extend({ 3559 element: this.element, 3560 classes: this.options.classes || {} 3561 }, options); 3562 function bindRemoveEvent() { 3563 options.element.each(function (_, element) { 3564 var isTracked = $.map(that.classesElementLookup, function (elements) { 3565 return elements; 3566 }).some(function (elements) { 3567 return elements.is(element); 3568 }); 3569 if (!isTracked) { 3570 that._on($(element), { 3571 remove: '_untrackClassesElement' 3572 }); 3573 } 3574 }); 3575 } 3576 function processClassString(classes, checkOption) { 3577 var current, i; 3578 for (i = 0; i < classes.length; i++) { 3579 current = that.classesElementLookup[classes[i]] || $(); 3580 if (options.add) { 3581 bindRemoveEvent(); 3582 current = $($.uniqueSort(current.get().concat(options.element.get()))); 3583 } else { 3584 current = $(current.not(options.element).get()); 3585 } 3586 that.classesElementLookup[classes[i]] = current; 3587 full.push(classes[i]); 3588 if (checkOption && options.classes[classes[i]]) { 3589 full.push(options.classes[classes[i]]); 3590 } 3591 } 3592 } 3593 if (options.keys) { 3594 processClassString(options.keys.match(/\S+/g) || [], true); 3595 } 3596 if (options.extra) { 3597 processClassString(options.extra.match(/\S+/g) || []); 3598 } 3599 return full.join(' '); 3600 }, 3601 _untrackClassesElement: function _untrackClassesElement(event) { 3602 var that = this; 3603 $.each(that.classesElementLookup, function (key, value) { 3604 if ($.inArray(event.target, value) !== -1) { 3605 that.classesElementLookup[key] = $(value.not(event.target).get()); 3606 } 3607 }); 3608 this._off($(event.target)); 3609 }, 3610 _removeClass: function _removeClass(element, keys, extra) { 3611 return this._toggleClass(element, keys, extra, false); 3612 }, 3613 _addClass: function _addClass(element, keys, extra) { 3614 return this._toggleClass(element, keys, extra, true); 3615 }, 3616 _toggleClass: function _toggleClass(element, keys, extra, add) { 3617 add = typeof add === 'boolean' ? add : extra; 3618 var shift = typeof element === 'string' || element === null, 3619 options = { 3620 extra: shift ? keys : extra, 3621 keys: shift ? element : keys, 3622 element: shift ? this.element : element, 3623 add: add 3624 }; 3625 options.element.toggleClass(this._classes(options), add); 3626 return this; 3627 }, 3628 _on: function _on(suppressDisabledCheck, element, handlers) { 3629 var delegateElement; 3630 var instance = this; 3631 3632 // No suppressDisabledCheck flag, shuffle arguments 3633 if (typeof suppressDisabledCheck !== 'boolean') { 3634 handlers = element; 3635 element = suppressDisabledCheck; 3636 suppressDisabledCheck = false;
3637 } 3638 3639 // No element argument, shuffle and use this.element 3640 if (!handlers) { 3641 handlers = element; 3642 element = this.element; 3643 delegateElement = this.widget(); 3644 } else { 3645 element = delegateElement = $(element); 3646 this.bindings = this.bindings.add(element); 3647 } 3648 $.each(handlers, function (event, handler) { 3649 function handlerProxy() { 3650 // Allow widgets to customize the disabled handling 3651 // - disabled as an array instead of boolean 3652 // - disabled class as method for disabling individual parts 3653 if (!suppressDisabledCheck && (instance.options.disabled === true || $(this).hasClass('ui-state-disabled'))) { 3654 return; 3655 } 3656 return (typeof handler === 'string' ? instance[handler] : handler).apply(instance, arguments); 3657 } 3658 3659 // Copy the guid so direct unbinding works 3660 if (typeof handler !== 'string') { 3661 handlerProxy.guid = handler.guid = handler.guid || handlerProxy.guid || $.guid++; 3662 } 3663 var match = event.match(/^([\w:-]*)\s*(.*)$/); 3664 var eventName = match[1] + instance.eventNamespace; 3665 var selector = match[2]; 3666 if (selector) { 3667 delegateElement.on(eventName, selector, handlerProxy); 3668 } else { 3669 element.on(eventName, handlerProxy); 3670 } 3671 }); 3672 }, 3673 _off: function _off(element, eventName) { 3674 eventName = (eventName || '').split(' ').join(this.eventNamespace + ' ') + this.eventNamespace; 3675 element.off(eventName); 3676 3677 // Clear the stack to avoid memory leaks (#10056) 3678 this.bindings = $(this.bindings.not(element).get()); 3679 this.focusable = $(this.focusable.not(element).get()); 3680 this.hoverable = $(this.hoverable.not(element).get()); 3681 }, 3682 _delay: function _delay(handler, delay) { 3683 var instance = this; 3684 function handlerProxy() { 3685 return (typeof handler === 'string' ? instance[handler] : handler).apply(instance, arguments); 3686 } 3687 return setTimeout(handlerProxy, delay || 0); 3688 }, 3689 _hoverable: function _hoverable(element) { 3690 this.hoverable = this.hoverable.add(element); 3691 this._on(element, { 3692 mouseenter: function mouseenter(event) { 3693 this._addClass($(event.currentTarget), null, 'ui-state-hover'); 3694 }, 3695 mouseleave: function mouseleave(event) { 3696 this._removeClass($(event.currentTarget), null, 'ui-state-hover'); 3697 } 3698 }); 3699 }, 3700 _focusable: function _focusable(element) { 3701 this.focusable = this.focusable.add(element); 3702 this._on(element, { 3703 focusin: function focusin(event) { 3704 this._addClass($(event.currentTarget), null, 'ui-state-focus'); 3705 }, 3706 focusout: function focusout(event) { 3707 this._removeClass($(event.currentTarget), null, 'ui-state-focus'); 3708 } 3709 }); 3710 }, 3711 _trigger: function _trigger(type, event, data) { 3712 var prop, orig; 3713 var callback = this.options[type]; 3714 data = data || {}; 3715 event = $.Event(event); 3716 event.type = (type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type).toLowerCase(); 3717 3718 // The original event may come from any element 3719 // so we need to reset the target on the new event 3720 event.target = this.element[0]; 3721 3722 // Copy original event properties over to the new event 3723 orig = event.originalEvent; 3724 if (orig) { 3725 for (prop in orig) { 3726 if (!(prop in event)) { 3727 event[prop] = orig[prop]; 3728 } 3729 } 3730 } 3731 this.element.trigger(event, data); 3732 return !($.isFunction(callback) && callback.apply(this.element[0], [event].concat(data)) === false || event.isDefaultPrevented()); 3733 } 3734 }; 3735 $.each({ 3736 show: 'fadeIn', 3737 hide: 'fadeOut' 3738 }, function (method, defaultEffect) { 3739 $.Widget.prototype['_' + method] = function (element, options, callback) { 3740 if (typeof options === 'string') { 3741 options = { 3742 effect: options 3743 }; 3744 } 3745 var hasOptions; 3746 var effectName = !options ? method : options === true || typeof options === 'number' ? defaultEffect : options.effect || defaultEffect; 3747 options = options || {}; 3748 if (typeof options === 'number') { 3749 options = { 3750 duration: options 3751 }; 3752 } 3753 hasOptions = !$.isEmptyObject(options); 3754 options.complete = callback; 3755 if (options.delay) { 3756 element.delay(options.delay); 3757 } 3758 if (hasOptions && $.effects && $.effects.effect[effectName]) { 3759 element[method](options); 3760 } else if (effectName !== method && element[effectName]) { 3761 element[effectName](options.duration, options.easing, callback); 3762 } else { 3763 element.queue(function (next) { 3764 $(this)[method](); 3765 if (callback) { 3766 callback.call(element[0]); 3767 } 3768 next(); 3769 }); 3770 } 3771 }; 3772 }); 3773}); 3774 3775}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 3776},{}],6:[function(require,module,exports){ 3777!function (e, o) { 3778 if ("function" == typeof define && define.amd) define(["exports"], o);
3778else if ("undefined" != typeof exports) o(exports);else { 3779 var t = {}; 3780 o(t), e.bodyScrollLock = t; 3781 } 3782}(this, function (exports) { 3783 "use strict"; 3784 3785 Object.defineProperty(exports, "__esModule", { 3786 value: !0 3787 }); 3788 var t = !1; 3789 if ("undefined" != typeof window) { 3790 var e = { 3791 get passive() { 3792 t = !0; 3793 } 3794 }; 3795 window.addEventListener("testPassive", null, e), window.removeEventListener("testPassive", null, e); 3796 } 3797 function l(o) { 3798 return c.some(function (e) { 3799 return !(!e.options.allowTouchMove || !e.options.allowTouchMove(o)); 3800 }); 3801 } 3802 function d(e) { 3803 var o = e || window.event; 3804 return !!l(o.target) || 1 < o.touches.length || (o.preventDefault && o.preventDefault(), !1); 3805 } 3806 function n() { 3807 void 0 !== v && (document.body.style.paddingRight = v, v = void 0), void 0 !== s && (document.body.style.overflow = s, s = void 0); 3808 } 3809 var i = "undefined" != typeof window && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || "MacIntel" === window.navigator.platform && 1 < window.navigator.maxTouchPoints), 3810 c = [], 3811 a = !1, 3812 u = -1, 3813 s = void 0, 3814 v = void 0; 3815 exports.disableBodyScroll = function (r, e) { 3816 if (r) { 3817 if (!c.some(function (e) { 3818 return e.targetElement === r; 3819 })) { 3820 var o = { 3821 targetElement: r, 3822 options: e || {} 3823 }; 3824 c = [].concat(function (e) { 3825 if (Array.isArray(e)) { 3826 for (var o = 0, t = Array(e.length); o < e.length; o++) t[o] = e[o]; 3827 return t; 3828 } 3829 return Array.from(e); 3830 }(c), [o]), i ? (r.ontouchstart = function (e) { 3831 1 === e.targetTouches.length && (u = e.targetTouches[0].clientY); 3832 }, r.ontouchmove = function (e) { 3833 var o, t, n, i; 3834 1 === e.targetTouches.length && (t = r, i = (o = e).targetTouches[0].clientY - u, l(o.target) || (t && 0 === t.scrollTop && 0 < i || (n = t) && n.scrollHeight - n.scrollTop <= n.clientHeight && i < 0 ? d(o) : o.stopPropagation())); 3835 }, a || (document.addEventListener("touchmove", d, t ? { 3836 passive: !1 3837 } : void 0), a = !0)) : function (e) { 3838 if (void 0 === v) { 3839 var o = !!e && !0 === e.reserveScrollBarGap, 3840 t = window.innerWidth - document.documentElement.clientWidth; 3841 o && 0 < t && (v = document.body.style.paddingRight, document.body.style.paddingRight = t + "px"); 3842 } 3843 void 0 === s && (s = document.body.style.overflow, document.body.style.overflow = "hidden"); 3844 }(e); 3845 } 3846 } else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices."); 3847 }, exports.clearAllBodyScrollLocks = function () { 3848 i ? (c.forEach(function (e) { 3849 e.targetElement.ontouchstart = null, e.targetElement.ontouchmove = null; 3850 }), a && (document.removeEventListener("touchmove", d, t ? { 3851 passive: !1 3852 } : void 0), a = !1), u = -1) : n(), c = []; 3853 }, exports.enableBodyScroll = function (o) { 3854 o ? (c = c.filter(function (e) { 3855 return e.targetElement !== o; 3856 }), i ? (o.ontouchstart = null, o.ontouchmove = null, a && 0 === c.length && (document.removeEventListener("touchmove", d, t ? { 3857 passive: !1 3858 } : void 0), a = !1)) : c.length || n()) : console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices."); 3859 }; 3860}); 3861 3862},{}],7:[function(require,module,exports){ 3863(function (process){(function (){ 3864function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 3865(function (global, factory) { 3866 (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.browserDetect = factory(); 3867})(this, function () { 3868 'use strict'; 3869 3870 /*! ***************************************************************************** 3871 Copyright (c) Microsoft Corporation. All rights reserved. 3872 Licensed under the Apache License, Version 2.0 (the "License");
3872 you may not use 3873 this file except in compliance with the License. You may obtain a copy of the 3874 License at http://www.apache.org/licenses/LICENSE-2.0 3875 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 3876 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 3877 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 3878 MERCHANTABLITY OR NON-INFRINGEMENT. 3879 See the Apache Version 2.0 License for specific language governing permissions 3880 and limitations under the License. 3881 ***************************************************************************** */ 3882 var __assign = Object.assign || function __assign(t) { 3883 for (var s, i = 1, n = arguments.length; i < n; i++) { 3884 s = arguments[i]; 3885 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 3886 } 3887 return t; 3888 }; 3889 var browsers = [['firefox', /Firefox\/([0-9\.]+)(?:\s|$)/], ['opera', /Opera\/([0-9\.]+)(?:\s|$)/], ['opera', /OPR\/([0-9\.]+)(:?\s|$)$/], ['edge', /Edge\/([0-9\._]+)/], ['ie', /Trident\/7\.0.*rv\:([0-9\.]+)\).*Gecko$/], ['ie', /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/], ['ie', /MSIE\s(7\.0)/], ['safari', /Version\/([0-9\._]+).*Safari/], ['chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/], ['bb10', /BB10;\sTouch.*Version\/([0-9\.]+)/], ['android', /Android\s([0-9\.]+)/], ['ios', /Version\/([0-9\._]+).*Mobile.*Safari.*/], ['yandexbrowser', /YaBrowser\/([0-9\._]+)/], ['crios', /CriOS\/([0-9\.]+)(:?\s|$)/]]; 3890 var os = ['Windows Phone', 'Android', 'CentOS', { 3891 name: 'Chrome OS', 3892 pattern: 'CrOS' 3893 }, 'Debian', 'Fedora', 'FreeBSD', 'Gentoo', 'Haiku', 'Kubuntu', 'Linux Mint', 'OpenBSD', 'Red Hat', 'SuSE', 'Ubuntu', 'Xubuntu', 'Cygwin', 'Symbian OS', 'hpwOS', 'webOS ', 'webOS', 'Tablet OS', 'Tizen', 'Linux', 'Mac OS X', 'Macintosh', 'Mac', 'Windows 98;', 'Windows ']; 3894 var osVersions = { 3895 '10.0': '10', 3896 '6.4': '10 Technical Preview', 3897 '6.3': '8.1', 3898 '6.2': '8', 3899 '6.1': 'Server 2008 R2 / 7', 3900 '6.0': 'Server 2008 / Vista', 3901 '5.2': 'Server 2003 / XP 64-bit', 3902 '5.1': 'XP', 3903 '5.01': '2000 SP1', 3904 '5.0': '2000', 3905 '4.0': 'NT', 3906 '4.90': 'ME' 3907 }; 3908 var mobileRegExp = new RegExp(['(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|', 'compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|', 'midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)', '\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|', 'wap|windows ce|xda|xiino'].join(''), 'i'); 3909 var mobilePrefixRegExp = new RegExp(['1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|', 'ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|', 'avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|', 'cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|', 'ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|', 'g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|', 'hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|', 'i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|', 'kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])', '|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|', 'mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|', 'n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|', 'op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|', 'po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|', 'raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|', 'se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|k\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|', 'so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|', 'tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|', 'veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|', 'w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-'].join(''), 'i'); 3910 var Detector = /** @class */function () { 3911 function Detector(userAgent, navigator, process) { 3912 this.navigator = navigator; 3913 this.process = process; 3914 this.userAgent = userAgent ? userAgent : this.navigator ? navigator.userAgent || navigator.vendor : ''; 3915 } 3916 Detector.prototype.detect = function () { 3917 if (this.process && !this.userAgent) { 3918 var version = this.process.version.slice(1).split('.').slice(0, 3); 3919 var versionTail = Array.prototype.slice.call(version, 1).join('') || '0'; 3920 return { 3921 name: 'node', 3922 version: version.join('.'), 3923 versionNumber: parseFloat(version[0] + "." + versionTail), 3924 mobile: false, 3925 os: this.process.platform 3926 }; 3927 } 3928 if (!this.userAgent) this.handleMissingError(); 3929 return __assign({}, this.checkBrowser(), this.checkMobile(), this.checkOs()); 3930 }; 3931 Detector.prototype.checkBrowser = function () { 3932 var _this = this; 3933 return browsers.filter(function (definition) { 3934 return definition[1].test(_this.userAgent); 3935 }).map(function (definition) { 3936 var match = definition[1].exec(_this.userAgent); 3937 var version = match && match[1].split(/[._]/).slice(0, 3);
3938 var versionTails = Array.prototype.slice.call(version, 1).join('') || '0'; 3939 if (version && version.length < 3) Array.prototype.push.apply(version, version.length === 1 ? [0, 0] : [0]); 3940 return { 3941 name: String(definition[0]), 3942 version: version.join('.'), 3943 versionNumber: Number(version[0] + "." + versionTails) 3944 }; 3945 }).shift(); 3946 }; 3947 Detector.prototype.checkMobile = function () { 3948 var agentPrefix = this.userAgent.substr(0, 4); 3949 var mobile = mobileRegExp.test(this.userAgent) || mobilePrefixRegExp.test(agentPrefix); 3950 return { 3951 mobile: mobile 3952 }; 3953 }; 3954 Detector.prototype.checkOs = function () { 3955 var _this = this; 3956 return os.map(function (definition) { 3957 var name = definition.name || definition; 3958 var pattern = _this.getOsPattern(definition); 3959 return { 3960 name: name, 3961 pattern: pattern, 3962 value: RegExp("\\b" + pattern.replace(/([ -])(?!$)/g, '$1?') + "(?:x?[\\d._]+|[ \\w.]*)", 'i').exec(_this.userAgent) 3963 }; 3964 }).filter(function (definition) { 3965 return definition.value; 3966 }).map(function (definition) { 3967 var os$$1 = definition.value[0] || ''; 3968 var osSuffix; 3969 if (definition.pattern && definition.name && /^Win/i.test(os$$1) && !/^Windows Phone /i.test(os$$1) && (osSuffix = osVersions[os$$1.replace(/[^\d.]/g, '')])) os$$1 = "Windows " + osSuffix; 3970 if (definition.pattern && definition.name) os$$1 = os$$1.replace(RegExp(definition.pattern, 'i'), definition.name); 3971 os$$1 = os$$1.replace(/ ce$/i, ' CE').replace(/\bhpw/i, 'web').replace(/\bMacintosh\b/, 'Mac OS').replace(/_PowerPC\b/i, ' OS').replace(/\b(OS X) [^ \d]+/i, '$1').replace(/\bMac (OS X)\b/, '$1').replace(/\/(\d)/, ' $1').replace(/_/g, '.').replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '').replace(/\bx86\.64\b/gi, 'x86_64').replace(/\b(Windows Phone) OS\b/, '$1').replace(/\b(Chrome OS \w+) [\d.]+\b/, '$1').split(' on ')[0].trim(); 3972 os$$1 = /^(?:webOS|i(?:OS|P))/.test(os$$1) ? os$$1 : os$$1.charAt(0).toUpperCase() + os$$1.slice(1); 3973 return { 3974 os: os$$1 3975 }; 3976 }).shift(); 3977 }; 3978 Detector.prototype.getOsPattern = function (definition) { 3979 var definitionInterface = definition; 3980 return (typeof definition === 'string' ? definition : undefined) || definitionInterface.pattern || definitionInterface.name; 3981 }; 3982 Detector.prototype.handleMissingError = function () { 3983 throw new Error('Please give user-agent.\n> browser(navigator.userAgent or res.headers[\'user-agent\']).'); 3984 }; 3985 return Detector; 3986 }(); 3987 function createCommonjsModule(fn, module) { 3988 return module = { 3989 exports: {} 3990 }, fn(module, module.exports), module.exports; 3991 } 3992 var _global = createCommonjsModule(function (module) { 3993 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 3994 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self 3995 // eslint-disable-next-line no-new-func 3996 : Function('return this')(); 3997 if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef 3998 }); 3999 var _core = createCommonjsModule(function (module) { 4000 var core = module.exports = { 4001 version: '2.5.7' 4002 }; 4003 if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef 4004 }); 4005 var _core_1 = _core.version; 4006 var _isObject = function _isObject(it) { 4007 return _typeof(it) === 'object' ? it !== null : typeof it === 'function'; 4008 }; 4009 var _anObject = function _anObject(it) { 4010 if (!_isObject(it)) throw TypeError(it + ' is not an object!'); 4011 return it; 4012 }; 4013 var _fails = function _fails(exec) { 4014 try { 4015 return !!exec(); 4016 } catch (e) { 4017 return true; 4018 } 4019 }; 4020 4021 // Thank's IE8 for his funny defineProperty 4022 var _descriptors = !_fails(function () { 4023 return Object.defineProperty({}, 'a', { 4024 get: function get() { 4025 return 7; 4026 } 4027 }).a != 7; 4028 }); 4029 var document = _global.document; 4030 // typeof document.createElement is 'object' in old IE 4031 var is = _isObject(document) && _isObject(document.createElement); 4032 var _domCreate = function _domCreate(it) { 4033 return is ? document.createElement(it) : {}; 4034 }; 4035 var _ie8DomDefine = !_descriptors && !_fails(function () { 4036 return Object.defineProperty(_domCreate('div'), 'a', { 4037 get: function get() { 4038 return 7; 4039 } 4040 }).a != 7; 4041 }); 4042 4043 // 7.1.1 ToPrimitive(input [, PreferredType]) 4044 4045 // instead of the ES6 spec version, we didn't implement @@toPrimitive case 4046 // and the second argument - flag - preferred type is a string 4047 var _toPrimitive = function _toPrimitive(it, S) { 4048 if (!_isObject(it)) return it; 4049 var fn, val; 4050 if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; 4051 if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val; 4052 if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; 4053 throw TypeError("Can't convert object to primitive value"); 4054 }; 4055 var dP = Object.defineProperty; 4056 var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) { 4057 _anObject(O); 4058 P = _toPrimitive(P, true); 4059 _anObject(Attributes); 4060 if (_ie8DomDefine) try { 4061 return dP(O, P, Attributes); 4062 } catch (e) {/* empty */} 4063 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); 4064 if ('value' in Attributes) O[P] = Attributes.value; 4065 return O; 4066 }; 4067 var _objectDp = { 4068 f: f 4069 }; 4070 var _propertyDesc = function _propertyDesc(bitmap, value) { 4071 return { 4072 enumerable: !(bitmap & 1), 4073 configurable: !(bitmap & 2), 4074 writable: !(bitmap & 4), 4075 value: value 4076 }; 4077 }; 4078 var _hide = _descriptors ? function (object, key, value) { 4079 return _objectDp.f(object, key, _propertyDesc(1, value)); 4080 } : function (object, key, value) { 4081 object[key] = value; 4082 return object; 4083 }; 4084 var hasOwnProperty = {}.hasOwnProperty; 4085 var _has = function _has(it, key) { 4086 return hasOwnProperty.call(it, key); 4087 }; 4088 var id = 0; 4089 var px = Math.random(); 4090 var _uid = function _uid(key) { 4091 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); 4092 }; 4093 var _redefine = createCommonjsModule(function (module) { 4094 var SRC = _uid('src'); 4095 var TO_STRING = 'toString'; 4096 var $toString = Function[TO_STRING]; 4097 var TPL = ('' + $toString).split(TO_STRING); 4098 _core.inspectSource = function (it) { 4099 return $toString.call(it); 4100 }; 4101 (module.exports = function (O, key, val, safe) { 4102 var isFunction = typeof val == 'function'; 4103 if (isFunction) _has(val, 'name') || _hide(val, 'name', key); 4104 if (O[key] === val) return; 4105 if (isFunction) _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); 4106 if (O === _global) { 4107 O[key] = val; 4108 } else if (!safe) { 4109 delete O[key]; 4110 _hide(O, key, val); 4111 } else if (O[key]) { 4112 O[key] = val; 4113 } else { 4114 _hide(O, key, val); 4115 } 4116 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative 4117 })(Function.prototype, TO_STRING, function toString() { 4118 return typeof this == 'function' && this[SRC] || $toString.call(this); 4119 }); 4120 }); 4121 var _aFunction = function _aFunction(it) { 4122 if (typeof it != 'function') throw TypeError(it + ' is not a function!'); 4123 return it; 4124 }; 4125
vendor: 1,954 bytes, lines 4126-4182
4126 // optional / simple context binding 4127 4128 var _ctx = function _ctx(fn, that, length) { 4129 _aFunction(fn); 4130 if (that === undefined) return fn; 4131 switch (length) { 4132 case 1: 4133 return function (a) { 4134 return fn.call(that, a); 4135 }; 4136 case 2: 4137 return function (a, b) { 4138 return fn.call(that, a, b); 4139 }; 4140 case 3: 4141 return function (a, b, c) { 4142 return fn.call(that, a, b, c); 4143 }; 4144 } 4145 return function /* ...args */ 4146 () { 4147 return fn.apply(that, arguments); 4148 }; 4149 }; 4150 var PROTOTYPE = 'prototype'; 4151 var _$export = function $export(type, name, source) { 4152 var IS_FORCED = type & _$export.F; 4153 var IS_GLOBAL = type & _$export.G; 4154 var IS_STATIC = type & _$export.S; 4155 var IS_PROTO = type & _$export.P; 4156 var IS_BIND = type & _$export.B; 4157 var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE]; 4158 var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {}); 4159 var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); 4160 var key, own, out, exp; 4161 if (IS_GLOBAL) source = name; 4162 for (key in source) { 4163 // contains in native 4164 own = !IS_FORCED && target && target[key] !== undefined; 4165 // export native or passed 4166 out = (own ? target : source)[key]; 4167 // bind timers to global for call from export context 4168 exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out; 4169 // extend global 4170 if (target) _redefine(target, key, out, type & _$export.U); 4171 // export 4172 if (exports[key] != out) _hide(exports, key, exp); 4173 if (IS_PROTO && expProto[key] != out) expProto[key] = out; 4174 } 4175 }; 4176 _global.core = _core; 4177 // type bitmap 4178 _$export.F = 1; // forced 4179 _$export.G = 2; // global 4180 _$export.S = 4; // static 4181 _$export.P = 8; // proto 4182 _$export.B = 16; // bind
4183 _$export.W = 32; // wrap 4184 _$export.U = 64; // safe 4185 _$export.R = 128; // real proto method for `library` 4186 var _export = _$export; 4187 var toString = {}.toString; 4188 var _cof = function _cof(it) { 4189 return toString.call(it).slice(8, -1); 4190 }; 4191 4192 // fallback for non-array-like ES3 and non-enumerable old V8 strings 4193 4194 // eslint-disable-next-line no-prototype-builtins 4195 var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) { 4196 return _cof(it) == 'String' ? it.split('') : Object(it); 4197 }; 4198 4199 // 7.2.1 RequireObjectCoercible(argument) 4200 var _defined = function _defined(it) { 4201 if (it == undefined) throw TypeError("Can't call method on " + it); 4202 return it; 4203 }; 4204 4205 // 7.1.13 ToObject(argument) 4206 4207 var _toObject = function _toObject(it) { 4208 return Object(_defined(it)); 4209 }; 4210 4211 // 7.1.4 ToInteger 4212 var ceil = Math.ceil; 4213 var floor = Math.floor; 4214 var _toInteger = function _toInteger(it) { 4215 return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); 4216 }; 4217 4218 // 7.1.15 ToLength 4219 4220 var min = Math.min; 4221 var _toLength = function _toLength(it) { 4222 return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 4223 }; 4224 4225 // 7.2.2 IsArray(argument) 4226 4227 var _isArray = Array.isArray || function isArray(arg) { 4228 return _cof(arg) == 'Array'; 4229 }; 4230 var _shared = createCommonjsModule(function (module) { 4231 var SHARED = '__core-js_shared__'; 4232 var store = _global[SHARED] || (_global[SHARED] = {}); 4233 (module.exports = function (key, value) { 4234 return store[key] || (store[key] = value !== undefined ? value : {}); 4235 })('versions', []).push({ 4236 version: _core.version, 4237 mode: 'global', 4238 copyright: '© 2018 Denis Pushkarev (zloirock.ru)' 4239 }); 4240 }); 4241 var _wks = createCommonjsModule(function (module) { 4242 var store = _shared('wks'); 4243 var _Symbol = _global.Symbol; 4244 var USE_SYMBOL = typeof _Symbol == 'function'; 4245 var $exports = module.exports = function (name) { 4246 return store[name] || (store[name] = USE_SYMBOL && _Symbol[name] || (USE_SYMBOL ? _Symbol : _uid)('Symbol.' + name)); 4247 }; 4248 $exports.store = store; 4249 }); 4250 var SPECIES = _wks('species'); 4251 var _arraySpeciesConstructor = function _arraySpeciesConstructor(original) { 4252 var C; 4253 if (_isArray(original)) { 4254 C = original.constructor; 4255 // cross-realm fallback 4256 if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined; 4257 if (_isObject(C)) { 4258 C = C[SPECIES]; 4259 if (C === null) C = undefined; 4260 } 4261 } 4262 return C === undefined ? Array : C; 4263 }; 4264 4265 // 9.4.2.3 ArraySpeciesCreate(originalArray, length) 4266 4267 var _arraySpeciesCreate = function _arraySpeciesCreate(original, length) { 4268 return new (_arraySpeciesConstructor(original))(length); 4269 }; 4270 4271 // 0 -> Array#forEach 4272 // 1 -> Array#map 4273 // 2 -> Array#filter 4274 // 3 -> Array#some 4275 // 4 -> Array#every 4276 // 5 -> Array#find 4277 // 6 -> Array#findIndex 4278 4279 var _arrayMethods = function _arrayMethods(TYPE, $create) { 4280 var IS_MAP = TYPE == 1; 4281 var IS_FILTER = TYPE == 2; 4282 var IS_SOME = TYPE == 3; 4283 var IS_EVERY = TYPE == 4; 4284 var IS_FIND_INDEX = TYPE == 6; 4285 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; 4286 var create = $create || _arraySpeciesCreate; 4287 return function ($this, callbackfn, that) { 4288 var O = _toObject($this); 4289 var self = _iobject(O); 4290 var f = _ctx(callbackfn, that, 3); 4291 var length = _toLength(self.length); 4292 var index = 0; 4293 var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; 4294 var val, res; 4295 for (; length > index; index++) if (NO_HOLES || index in self) { 4296 val = self[index]; 4297 res = f(val, index, O); 4298 if (TYPE) { 4299 if (IS_MAP) result[index] = res; // map 4300 else if (res) switch (TYPE) { 4301 case 3: 4302 return true; 4303 // some 4304 case 5: 4305 return val; 4306 // find 4307 case 6: 4308 return index; 4309 // findIndex 4310 case 2: 4311 result.push(val); 4312 // filter 4313 } else if (IS_EVERY) return false; // every 4314 } 4315 } 4316 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; 4317 }; 4318 }; 4319 var _strictMethod = function _strictMethod(method, arg) { 4320 return !!method && _fails(function () { 4321 // eslint-disable-next-line no-useless-call 4322 arg ? method.call(null, function () {/* empty */}, 1) : method.call(null); 4323 }); 4324 }; 4325 var $filter = _arrayMethods(2); 4326 _export(_export.P + _export.F * !_strictMethod([].filter, true), 'Array', { 4327 // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) 4328 filter: function filter(callbackfn /* , thisArg */) { 4329 return $filter(this, callbackfn, arguments[1]); 4330 } 4331 }); 4332 var filter = _core.Array.filter; 4333 var $map = _arrayMethods(1); 4334 _export(_export.P + _export.F * !_strictMethod([].map, true), 'Array', { 4335 // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) 4336 map: function map(callbackfn /* , thisArg */) { 4337 return $map(this, callbackfn, arguments[1]); 4338 } 4339 });
4340 var map = _core.Array.map; 4341 var _stringWs = "\t\n\x0B\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003" + "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF"; 4342 var space = '[' + _stringWs + ']'; 4343 var non = "\u200B\x85"; 4344 var ltrim = RegExp('^' + space + space + '*'); 4345 var rtrim = RegExp(space + space + '*$'); 4346 var exporter = function exporter(KEY, exec, ALIAS) { 4347 var exp = {}; 4348 var FORCE = _fails(function () { 4349 return !!_stringWs[KEY]() || non[KEY]() != non; 4350 }); 4351 var fn = exp[KEY] = FORCE ? exec(trim) : _stringWs[KEY]; 4352 if (ALIAS) exp[ALIAS] = fn; 4353 _export(_export.P + _export.F * FORCE, 'String', exp); 4354 }; 4355 4356 // 1 -> String#trimLeft 4357 // 2 -> String#trimRight 4358 // 3 -> String#trim 4359 var trim = exporter.trim = function (string, TYPE) { 4360 string = String(_defined(string)); 4361 if (TYPE & 1) string = string.replace(ltrim, ''); 4362 if (TYPE & 2) string = string.replace(rtrim, ''); 4363 return string; 4364 }; 4365 var _stringTrim = exporter; 4366 4367 // 21.1.3.25 String.prototype.trim() 4368 _stringTrim('trim', function ($trim) { 4369 return function trim() { 4370 return $trim(this, 3); 4371 }; 4372 }); 4373 var trim$1 = _core.String.trim; 4374 var injectableNavigator = typeof window !== 'undefined' ? window.navigator : undefined; 4375 var injectableProcess = typeof process !== 'undefined' ? process : undefined; 4376 function browserDetect(userAgent) { 4377 var detector = new Detector(userAgent, injectableNavigator, injectableProcess); 4378 return detector.detect(); 4379 } 4380 return browserDetect; 4381}); 4382 4383}).call(this)}).call(this,require('_process')) 4384},{"_process":33}],8:[function(require,module,exports){ 4385'use strict'; 4386 4387function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 4388var token = '%[a-f0-9]{2}'; 4389var singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi'); 4390var multiMatcher = new RegExp('(' + token + ')+', 'gi'); 4391function decodeComponents(components, split) { 4392 try { 4393 // Try to decode the entire string first 4394 return [decodeURIComponent(components.join(''))]; 4395 } catch (err) { 4396 // Do nothing 4397 } 4398 if (components.length === 1) { 4399 return components; 4400 } 4401 split = split || 1; 4402 4403 // Split the array in 2 parts 4404 var left = components.slice(0, split); 4405 var right = components.slice(split); 4406 return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right)); 4407} 4408function decode(input) { 4409 try { 4410 return decodeURIComponent(input); 4411 } catch (err) { 4412 var tokens = input.match(singleMatcher) || []; 4413 for (var i = 1; i < tokens.length; i++) { 4414 input = decodeComponents(tokens, i).join(''); 4415 tokens = input.match(singleMatcher) || []; 4416 } 4417 return input; 4418 } 4419} 4420function customDecodeURIComponent(input) { 4421 // Keep track of all the replacements and prefill the map with the `BOM` 4422 var replaceMap = { 4423 '%FE%FF': "\uFFFD\uFFFD", 4424 '%FF%FE': "\uFFFD\uFFFD" 4425 }; 4426 var match = multiMatcher.exec(input); 4427 while (match) { 4428 try { 4429 // Decode as big chunks as possible 4430 replaceMap[match[0]] = decodeURIComponent(match[0]); 4431 } catch (err) { 4432 var result = decode(match[0]); 4433 if (result !== match[0]) { 4434 replaceMap[match[0]] = result; 4435 } 4436 } 4437 match = multiMatcher.exec(input); 4438 } 4439 4440 // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else 4441 replaceMap['%C2'] = "\uFFFD"; 4442 var entries = Object.keys(replaceMap); 4443 for (var i = 0; i < entries.length; i++) { 4444 // Replace all decoded components 4445 var key = entries[i]; 4446 input = input.replace(new RegExp(key, 'g'), replaceMap[key]); 4447 } 4448 return input; 4449} 4450module.exports = function (encodedURI) { 4451 if (typeof encodedURI !== 'string') { 4452 throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + _typeof(encodedURI) + '`'); 4453 } 4454 try { 4455 encodedURI = encodedURI.replace(/\+/g, ' '); 4456 4457 // Try the built in decoder first 4458 return decodeURIComponent(encodedURI); 4459 } catch (err) { 4460 // Fallback to a more advanced decoder 4461 return customDecodeURIComponent(encodedURI); 4462 } 4463}; 4464 4465},{}],9:[function(require,module,exports){ 4466function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 4467/** 4468 * Dragdealer.js 0.10.0 4469 * http://github.com/skidding/dragdealer 4470 * 4471 * (c) 2010+ Ovidiu Cherecheș 4472 * http://skidding.mit-license.org 4473 */ 4474 4475(function (root, factory) { 4476 if (typeof define === 'function' && define.amd) { 4477 // AMD. Register as an anonymous module. 4478 define(factory); 4479 } else if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === 'object' && module.exports) { 4480 // Node. Does not work with strict CommonJS, but 4481 // only CommonJS-like enviroments that support module.exports, 4482 // like Node. 4483 module.exports.Dragdealer = factory(); 4484 } else { 4485 // Browser globals 4486 root.Dragdealer = factory(); 4487 } 4488})(this, function () { 4489 var Dragdealer = function Dragdealer(wrapper, options) { 4490 /** 4491 * Drag-based component that works around two basic DOM elements. 4492 * 4493 * - The wrapper: The top-level element with the .dragdealer class. We 4494 * create a Dragdealer instance with the wrapper as the 4495 * first constructor parameter (it can either receive the ID 4496 * of the wrapper, or the element itself.) The wrapper 4497 * establishes the dragging bounds. 4498 * 4499 * - The handle: A child of the wrapper element, div with a required 4500 * .handle class (may be overridden in options). This will be 4501 * the dragged element, constrained by the wrapper's bounds. 4502 * 4503 * 4504 * The handle can be both smaller or bigger than the wrapper. 4505 * 4506 * - When the handle is smaller, Dragdealer will act as a regular slider, 4507 * enabling the handle to be dragged from one side of the wrapper to 4508 * another. 4509 * 4510 * - When the handle is bigger, Dragdealer will act a mask for a draggable 4511 * surface, where the handle is the draggable surface contrained by the 4512 * smaller bounds of the wrapper. The drag action in this case is used 4513 * to reveal and "discover" partial content at a time. 4514 * 4515 * 4516 * Simple usage: 4517 * 4518 * // JavaScript 4519 * new Dragdealer('simple-slider'); 4520 * 4521 * <!-- HTML --> 4522 * <div id="simple-slider" class="dragdealer"> 4523 * <div class="handle">drag me</div> 4524 * </div> 4525 * 4526 * 4527 * The second parameter of the Dragdealer constructor is an object used for 4528 * specifying any of the supported options. All of them are optional. 4529 * 4530 * - bool disabled=false: Init Dragdealer in a disabled state. The handle 4531 * will have a .disabled class. 4532 * 4533 * - bool horizontal=true: Enable horizontal dragging. 4534 * 4535 * - bool vertical=false: Enable vertical dragging. 4536 * 4537 * - number x=0: Initial horizontal (left) position. Accepts a float number 4538 * value between 0 and 1. Read below about positioning in 4539 * Dragdealer. 4540 * 4541 * - number y=0: Initial vertical (top) position. Accepts a float number 4542 * value between 0 and 1. Read below about positoning in 4543 * Dragdealer. 4544 * 4545 * - number steps=0: Limit the positioning of the handle within the bounds 4546 * of the wrapper, by defining a virtual grid made out of 4547 * a number of equally-spaced steps. This restricts 4548 * placing the handle anywhere in-between these steps. 4549 * E.g. setting 3 steps to a regular slider will only 4550 * allow you to move it to the left, to the right or 4551 * exactly in the middle. 4552 * 4553 * - bool snap=false: When a number of steps is set, snap the position of 4554 * the handle to its closest step instantly, even when 4555 * dragging. 4556 * 4557 * - number speed=0.1: Speed can be set between 0 and 1, with 1 being the 4558 * fastest. It represents how fast the handle will slide 4559 * to position after you mouse up. 4560 * 4561 * - bool slide=true: Slide handle after releasing it, depending on the 4562 * movement speed before the mouse/touch release. The 4563 * formula for calculating how much will the handle 4564 * slide after releasing it is defined by simply 4565 * extending the movement of the handle in the current 4566 * direction, with the last movement unit times four (a 4567 * movement unit is considered the distance crossed 4568 * since the last animation loop, which is currently
4569 * 25ms.) So if you were to drag the handle 50px in the 4570 * blink of an eye, it will slide another 200px in the 4571 * same direction. Steps interfere with this formula, as 4572 * the closest step is calculated before the sliding 4573 * distance. 4574 * 4575 * - bool loose=false: Loosen-up wrapper boundaries when dragging. This 4576 * allows the handle to be *slightly* dragged outside 4577 * the bounds of the wrapper, but slides it back to the 4578 * margins of the wrapper upon release. The formula for 4579 * calculating how much the handle exceeds the wrapper 4580 * bounds is made out of the actual drag distance 4581 * divided by 4. E.g. Pulling a slider outside its 4582 * frame by 100px will only position it 25px outside 4583 * the frame. 4584 * 4585 * - number top=0: Top padding between the wrapper and the handle. 4586 * 4587 * - number bottom=0: Bottom padding between the wrapper and the handle. 4588 * 4589 * - number left=0: Left padding between the wrapper and the handle. 4590 * 4591 * - number right=0: Right padding between the wrapper and the handle. 4592 * 4593 * - fn callback(x, y): Called when releasing handle, with the projected 4594 * x, y position of the handle. Projected value means 4595 * the value the slider will have after finishing a 4596 * sliding animation, caused by either a step 4597 * restriction or drag motion (see steps and slide 4598 * options.) This implies that the actual position of 4599 * the handle at the time this callback is called 4600 * might not yet reflect the x, y values received. 4601 * 4602 * - fn dragStopCallback(x,y): Same as callback(x,y) but only called after 4603 * a drag motion, not after setting the step 4604 * manually. 4605 * 4606 * - fn dragStartCallback(x,y): Same as dragStopCallback(x,y) but called at 4607 * the beginning of a drag motion and with the 4608 * sliders initial x, y values. 4609 * 4610 * - fn animationCallback(x, y): Called every animation loop, as long as 4611 * the handle is being dragged or in the 4612 * process of a sliding animation. The x, y 4613 * positional values received by this 4614 * callback reflect the exact position of the 4615 * handle DOM element, which includes 4616 * exceeding values (even negative values) 4617 * when the loose option is set true. 4618 * 4619 * - string handleClass='handle': Custom class of handle element. 4620 * 4621 * - bool css3=true: Use css3 transform in modern browsers instead of 4622 * absolute positioning. 4623 * 4624 * - fn customRequestAnimationFrame: Provide custom requestAnimationFrame 4625 * function (used in tests). 4626 * - fn customCancelAnimationFrame: Provide custom cancelAnimationFrame 4627 * function (used in tests). 4628 * 4629 * Dragdealer also has a few methods to interact with, post-initialization. 4630 * 4631 * - disable: Disable dragging of a Dragdealer instance. Just as with the 4632 * disabled option, the handle will receive a .disabled class 4633 * 4634 * - enable: Enable dragging of a Dragdealer instance. The .disabled class 4635 * of the handle will be removed. 4636 * 4637 * - reflow: Recalculate the wrapper bounds of a Dragdealer instance, used 4638 * when the wrapper is responsive and its parent container 4639 * changed its size, or after changing the size of the wrapper 4640 * directly. 4641 * 4642 * - getValue: Get the value of a Dragdealer instance programatically. The 4643 * value is returned as an [x, y] tuple and is the equivalent 4644 * of the (projected) value returned by the regular callback, 4645 * not animationCallback. 4646 * 4647 * - getStep: Same as getValue, but the value returned is in step 4648 * increments (see steps option) 4649 * 4650 * - setValue(x, y, snap=false): Set the value of a Dragdealer instance 4651 * programatically. The 3rd parameter allows 4652 * to snap the handle directly to the desired 4653 * value, without any sliding transition. 4654 * 4655 * - setStep(x, y, snap=false): Same as setValue, but the value is received 4656 * in step increments (see steps option) 4657 * 4658 * 4659 * Positioning in Dragdealer: 4660 * 4661 * Besides the top, bottom, left and right paddings, which represent a 4662 * number of pixels, Dragdealer uses a [0, 1]-based positioning. Both 4663 * horizontal and vertical positions are represented by ratios between 0 4664 * and 1. This allows the Dragdealer wrapper to have a responsive size and 4665 * not revolve around a specific number of pixels. This is how the x, y 4666 * options are set, what the callback args contain and what values the 4667 * setValue method expects. Once picked up, the ratios can be scaled and 4668 * mapped to match any real-life system of coordinates or dimensions. 4669 */ 4670 this.options = this.applyDefaults(options || {}); 4671 this.bindMethods(); 4672 this.wrapper = this.getWrapperElement(wrapper); 4673 if (!this.wrapper) { 4674 return; 4675 } 4676 this.handle = this.getHandleElement(this.wrapper, this.options.handleClass); 4677 if (!this.handle) { 4678 return; 4679 } 4680 this.init(); 4681 this.bindEventListeners(); 4682 }; 4683 Dragdealer.prototype = { 4684 defaults: { 4685 disabled: false, 4686 horizontal: true, 4687 vertical: false, 4688 slide: true, 4689 steps: 0, 4690 snap: false, 4691 loose: false, 4692 speed: 0.1, 4693 xPrecision: 0, 4694 yPrecision: 0, 4695 handleClass: 'handle', 4696 css3: true, 4697 activeClass: 'active', 4698 tapping: true 4699 },
4700 init: function init() { 4701 if (this.options.css3) { 4702 triggerWebkitHardwareAcceleration(this.handle); 4703 } 4704 this.value = { 4705 prev: [-1, -1], 4706 current: [this.options.x || 0, this.options.y || 0], 4707 target: [this.options.x || 0, this.options.y || 0] 4708 }; 4709 this.offset = { 4710 wrapper: [0, 0], 4711 mouse: [0, 0], 4712 prev: [-999999, -999999], 4713 current: [0, 0], 4714 target: [0, 0] 4715 }; 4716 this.dragStartPosition = { 4717 x: 0, 4718 y: 0 4719 }; 4720 this.change = [0, 0]; 4721 this.stepRatios = this.calculateStepRatios(); 4722 this.activity = false; 4723 this.dragging = false; 4724 this.tapping = false; 4725 this.reflow(); 4726 if (this.options.disabled) { 4727 this.disable(); 4728 } 4729 }, 4730 applyDefaults: function applyDefaults(options) { 4731 for (var k in this.defaults) { 4732 if (!options.hasOwnProperty(k)) { 4733 options[k] = this.defaults[k]; 4734 } 4735 } 4736 return options; 4737 }, 4738 getWrapperElement: function getWrapperElement(wrapper) { 4739 if (typeof wrapper == 'string') { 4740 return document.getElementById(wrapper); 4741 } else { 4742 return wrapper; 4743 } 4744 }, 4745 getHandleElement: function getHandleElement(wrapper, handleClass) { 4746 var childElements, handleClassMatcher, i; 4747 if (wrapper.getElementsByClassName) { 4748 childElements = wrapper.getElementsByClassName(handleClass); 4749 if (childElements.length > 0) { 4750 return childElements[0]; 4751 } 4752 } else { 4753 handleClassMatcher = new RegExp('(^|\\s)' + handleClass + '(\\s|$)'); 4754 childElements = wrapper.getElementsByTagName('*'); 4755 for (i = 0; i < childElements.length; i++) { 4756 if (handleClassMatcher.test(childElements[i].className)) { 4757 return childElements[i]; 4758 } 4759 } 4760 } 4761 }, 4762 calculateStepRatios: function calculateStepRatios() { 4763 var stepRatios = []; 4764 if (this.options.steps >= 1) { 4765 for (var i = 0; i <= this.options.steps - 1; i++) { 4766 if (this.options.steps > 1) { 4767 stepRatios[i] = i / (this.options.steps - 1); 4768 } else { 4769 // A single step will always have a 0 value 4770 stepRatios[i] = 0; 4771 } 4772 } 4773 } 4774 return stepRatios; 4775 }, 4776 setWrapperOffset: function setWrapperOffset() { 4777 this.offset.wrapper = Position.get(this.wrapper); 4778 }, 4779 calculateBounds: function calculateBounds() { 4780 // Apply top/bottom/left and right padding options to wrapper extremities 4781 // when calculating its bounds 4782 var bounds = { 4783 top: this.options.top || 0, 4784 bottom: -(this.options.bottom || 0) + this.wrapper.offsetHeight, 4785 left: this.options.left || 0, 4786 right: -(this.options.right || 0) + this.wrapper.offsetWidth 4787 }; 4788 // The available width and height represents the horizontal and vertical 4789 // space the handle has for moving. It is determined by the width and 4790 // height of the wrapper, minus the width and height of the handle 4791 bounds.availWidth = bounds.right - bounds.left - this.handle.offsetWidth; 4792 bounds.availHeight = bounds.bottom - bounds.top - this.handle.offsetHeight; 4793 return bounds; 4794 }, 4795 calculateValuePrecision: function calculateValuePrecision() { 4796 // The sliding transition works by dividing itself until it reaches a min 4797 // value step; because Dragdealer works with [0-1] values, we need this 4798 // "min value step" to represent a pixel when applied to the real handle 4799 // position within the DOM. The xPrecision/yPrecision options can be 4800 // specified to increase the granularity when we're controlling larger 4801 // objects from one of the callbacks 4802 var xPrecision = this.options.xPrecision || Math.abs(this.bounds.availWidth), 4803 yPrecision = this.options.yPrecision || Math.abs(this.bounds.availHeight); 4804 return [xPrecision ? 1 / xPrecision : 0, yPrecision ? 1 / yPrecision : 0]; 4805 }, 4806 bindMethods: function bindMethods() { 4807 if (typeof this.options.customRequestAnimationFrame === 'function') { 4808 this.requestAnimationFrame = bind(this.options.customRequestAnimationFrame, window); 4809 } else { 4810 this.requestAnimationFrame = bind(requestAnimationFrame, window); 4811 } 4812 if (typeof this.options.customCancelAnimationFrame === 'function') { 4813 this.cancelAnimationFrame = bind(this.options.customCancelAnimationFrame, window); 4814 } else { 4815 this.cancelAnimationFrame = bind(cancelAnimationFrame, window); 4816 } 4817 this.animateWithRequestAnimationFrame = bind(this.animateWithRequestAnimationFrame, this); 4818 this.animate = bind(this.animate, this); 4819 this.onHandleMouseDown = bind(this.onHandleMouseDown, this); 4820 this.onHandleTouchStart = bind(this.onHandleTouchStart, this); 4821 this.onDocumentMouseMove = bind(this.onDocumentMouseMove, this); 4822 this.onWrapperTouchMove = bind(this.onWrapperTouchMove, this); 4823 this.onWrapperMouseDown = bind(this.onWrapperMouseDown, this); 4824 this.onWrapperTouchStart = bind(this.onWrapperTouchStart, this); 4825 this.onDocumentMouseUp = bind(this.onDocumentMouseUp, this); 4826 this.onDocumentTouchEnd = bind(this.onDocumentTouchEnd, this); 4827 this.onHandleClick = bind(this.onHandleClick, this); 4828 this.onWindowResize = bind(this.onWindowResize, this); 4829 }, 4830 bindEventListeners: function bindEventListeners() { 4831 // Start dragging 4832 addEventListener(this.handle, 'mousedown', this.onHandleMouseDown); 4833 addEventListener(this.handle, 'touchstart', this.onHandleTouchStart); 4834 // While dragging 4835 addEventListener(document, 'mousemove', this.onDocumentMouseMove); 4836 addEventListener(this.wrapper, 'touchmove', this.onWrapperTouchMove); 4837 // Start tapping 4838 addEventListener(this.wrapper, 'mousedown', this.onWrapperMouseDown); 4839 addEventListener(this.wrapper, 'touchstart', this.onWrapperTouchStart); 4840 // Stop dragging/tapping 4841 addEventListener(document, 'mouseup', this.onDocumentMouseUp); 4842 addEventListener(document, 'touchend', this.onDocumentTouchEnd); 4843 addEventListener(this.handle, 'click', this.onHandleClick); 4844 addEventListener(window, 'resize', this.onWindowResize); 4845 this.animate(false, true); 4846 this.interval = this.requestAnimationFrame(this.animateWithRequestAnimationFrame); 4847 }, 4848 unbindEventListeners: function unbindEventListeners() { 4849 removeEventListener(this.handle, 'mousedown', this.onHandleMouseDown); 4850 removeEventListener(this.handle, 'touchstart', this.onHandleTouchStart); 4851 removeEventListener(document, 'mousemove', this.onDocumentMouseMove); 4852 removeEventListener(this.wrapper, 'touchmove', this.onWrapperTouchMove); 4853 removeEventListener(this.wrapper, 'mousedown', this.onWrapperMouseDown); 4854 removeEventListener(this.wrapper, 'touchstart', this.onWrapperTouchStart); 4855 removeEventListener(document, 'mouseup', this.onDocumentMouseUp); 4856 removeEventListener(document, 'touchend', this.onDocumentTouchEnd); 4857 removeEventListener(this.handle, 'click', this.onHandleClick); 4858 removeEventListener(window, 'resize', this.onWindowResize); 4859 this.cancelAnimationFrame(this.interval); 4860 }, 4861 onHandleMouseDown: function onHandleMouseDown(e) { 4862 Cursor.refresh(e); 4863 preventEventDefaults(e); 4864 stopEventPropagation(e); 4865 this.activity = false;
4866 this.startDrag(); 4867 }, 4868 onHandleTouchStart: function onHandleTouchStart(e) { 4869 Cursor.refresh(e); 4870 // Unlike in the `mousedown` event handler, we don't prevent defaults here, 4871 // because this would disable the dragging altogether. Instead, we prevent 4872 // it in the `touchmove` handler. Read more about touch events 4873 // https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Touch_events#Handling_clicks 4874 stopEventPropagation(e); 4875 this.activity = false; 4876 this.startDrag(); 4877 }, 4878 onDocumentMouseMove: function onDocumentMouseMove(e) { 4879 if (e.clientX - this.dragStartPosition.x === 0 && e.clientY - this.dragStartPosition.y === 0) { 4880 // This is required on some Windows8 machines that get mouse move events without actual mouse movement 4881 return; 4882 } 4883 Cursor.refresh(e); 4884 if (this.dragging) { 4885 this.activity = true; 4886 preventEventDefaults(e); 4887 } 4888 }, 4889 onWrapperTouchMove: function onWrapperTouchMove(e) { 4890 Cursor.refresh(e); 4891 // Dragging on a disabled axis (horizontal or vertical) shouldn't prevent 4892 // defaults on touch devices. !this.activity denotes this is the first move 4893 // inside a drag action; you can drag in any direction after this point if 4894 // the dragging wasn't stopped 4895 if (!this.activity && this.draggingOnDisabledAxis()) { 4896 if (this.dragging) {
4897 this.stopDrag(); 4898 } 4899 return; 4900 } 4901 // Read comment in `onHandleTouchStart` above, to understand why we're 4902 // preventing defaults here and not there 4903 preventEventDefaults(e); 4904 this.activity = true; 4905 }, 4906 onWrapperMouseDown: function onWrapperMouseDown(e) { 4907 Cursor.refresh(e); 4908 preventEventDefaults(e); 4909 this.startTap(); 4910 }, 4911 onWrapperTouchStart: function onWrapperTouchStart(e) { 4912 Cursor.refresh(e); 4913 preventEventDefaults(e); 4914 this.startTap(); 4915 }, 4916 onDocumentMouseUp: function onDocumentMouseUp(e) { 4917 this.stopDrag(); 4918 this.stopTap(); 4919 }, 4920 onDocumentTouchEnd: function onDocumentTouchEnd(e) { 4921 this.stopDrag(); 4922 this.stopTap(); 4923 }, 4924 onHandleClick: function onHandleClick(e) { 4925 // We keep track if any dragging activity has been made between the 4926 // mouse/touch down and up events; based on this we allow or cancel a click 4927 // event from inside the handle. i.e. Click events shouldn't be triggered 4928 // when dragging, but should be allowed when clicking still 4929 if (this.activity) { 4930 preventEventDefaults(e); 4931 stopEventPropagation(e); 4932 } 4933 }, 4934 onWindowResize: function onWindowResize(e) { 4935 this.reflow(); 4936 }, 4937 enable: function enable() { 4938 this.disabled = false; 4939 this.handle.className = this.handle.className.replace(/\s?disabled/g, ''); 4940 }, 4941 disable: function disable() { 4942 this.disabled = true; 4943 this.handle.className += ' disabled'; 4944 }, 4945 reflow: function reflow() { 4946 this.setWrapperOffset(); 4947 this.bounds = this.calculateBounds(); 4948 this.valuePrecision = this.calculateValuePrecision(); 4949 this.updateOffsetFromValue(); 4950 }, 4951 getStep: function getStep() { 4952 return [this.getStepNumber(this.value.target[0]), this.getStepNumber(this.value.target[1])]; 4953 }, 4954 getStepWidth: function getStepWidth() { 4955 return Math.abs(this.bounds.availWidth / this.options.steps); 4956 }, 4957 getValue: function getValue() { 4958 return this.value.target; 4959 }, 4960 setStep: function setStep(x, y, snap) { 4961 this.setValue(this.options.steps && x > 1 ? (x - 1) / (this.options.steps - 1) : 0, this.options.steps && y > 1 ? (y - 1) / (this.options.steps - 1) : 0, snap); 4962 }, 4963 setValue: function setValue(x, y, snap) { 4964 this.setTargetValue([x, y || 0]); 4965 if (snap) { 4966 this.groupCopy(this.value.current, this.value.target); 4967 // Since the current value will be equal to the target one instantly, the 4968 // animate function won't get to run so we need to update the positions 4969 // and call the callbacks manually 4970 this.updateOffsetFromValue(); 4971 this.callAnimationCallback(); 4972 } 4973 }, 4974 startTap: function startTap() { 4975 if (this.disabled || !this.options.tapping) { 4976 return; 4977 } 4978 this.tapping = true; 4979 this.setWrapperOffset(); 4980 4981 //Check if the slider is a stepped snap slider: 4982 if (this.options.snap && this.options.steps) { 4983 //If we have a snap slider, it makes more sense that when a user click on the wrapper 4984 //the handle will snap to the closest step, instead of moving with a ratio until it 4985 //reaches the step. 4986 //Check for the closest step and set it as the current value 4987 var cursorXRatio = (Cursor.x - this.offset.wrapper[0]) / this.bounds.availWidth; 4988 var cursorYRatio = (Cursor.y - this.offset.wrapper[1]) / this.bounds.availHeight; 4989 this.setValue(this.getClosestStep(cursorXRatio), this.getClosestStep(cursorYRatio), true); 4990 } else { 4991 this.setTargetValueByOffset([Cursor.x - this.offset.wrapper[0] - this.handle.offsetWidth / 2, Cursor.y - this.offset.wrapper[1] - this.handle.offsetHeight / 2]); 4992 } 4993 }, 4994 stopTap: function stopTap() { 4995 if (this.disabled || !this.tapping) { 4996 return; 4997 } 4998 this.tapping = false; 4999 this.setTargetValue(this.value.current); 5000 }, 5001 startDrag: function startDrag() { 5002 if (this.disabled) { 5003 return; 5004 } 5005 this.dragging = true; 5006 this.setWrapperOffset(); 5007 this.dragStartPosition = { 5008 x: Cursor.x, 5009 y: Cursor.y 5010 }; 5011 this.offset.mouse = [Cursor.x - Position.get(this.handle)[0], Cursor.y - Position.get(this.handle)[1]]; 5012 if (!this.wrapper.className.match(this.options.activeClass)) { 5013 this.wrapper.className += ' ' + this.options.activeClass; 5014 } 5015 this.callDragStartCallback(); 5016 },
5017 stopDrag: function stopDrag() { 5018 if (this.disabled || !this.dragging) { 5019 return; 5020 } 5021 this.dragging = false; 5022 var deltaX = this.bounds.availWidth === 0 ? 0 : (Cursor.x - this.dragStartPosition.x) / this.bounds.availWidth, 5023 deltaY = this.bounds.availHeight === 0 ? 0 : (Cursor.y - this.dragStartPosition.y) / this.bounds.availHeight, 5024 delta = [deltaX, deltaY]; 5025 var target = this.groupClone(this.value.current); 5026 if (this.options.slide) { 5027 var ratioChange = this.change; 5028 target[0] += ratioChange[0] * 4; 5029 target[1] += ratioChange[1] * 4; 5030 } 5031 this.setTargetValue(target); 5032 this.wrapper.className = this.wrapper.className.replace(' ' + this.options.activeClass, ''); 5033 this.callDragStopCallback(delta); 5034 }, 5035 callAnimationCallback: function callAnimationCallback() { 5036 var value = this.value.current; 5037 if (this.options.snap && this.options.steps > 1) { 5038 value = this.getClosestSteps(value); 5039 } 5040 if (!this.groupCompare(value, this.value.prev)) { 5041 if (typeof this.options.animationCallback == 'function') { 5042 this.options.animationCallback.call(this, value[0], value[1]); 5043 } 5044 this.groupCopy(this.value.prev, value); 5045 } 5046 }, 5047 callTargetCallback: function callTargetCallback() { 5048 if (typeof this.options.callback == 'function') { 5049 this.options.callback.call(this, this.value.target[0], this.value.target[1]); 5050 } 5051 }, 5052 callDragStartCallback: function callDragStartCallback() { 5053 if (typeof this.options.dragStartCallback == 'function') { 5054 this.options.dragStartCallback.call(this, this.value.target[0], this.value.target[1]); 5055 } 5056 }, 5057 callDragStopCallback: function callDragStopCallback(delta) { 5058 if (typeof this.options.dragStopCallback == 'function') { 5059 this.options.dragStopCallback.call(this, this.value.target[0], this.value.target[1], delta); 5060 } 5061 }, 5062 animateWithRequestAnimationFrame: function animateWithRequestAnimationFrame(time) { 5063 if (time) { 5064 // using requestAnimationFrame 5065 this.timeOffset = this.timeStamp ? time - this.timeStamp : 0; 5066 this.timeStamp = time; 5067 } else { 5068 // using setTimeout(callback, 25) polyfill 5069 this.timeOffset = 25; 5070 } 5071 this.animate(); 5072 this.interval = this.requestAnimationFrame(this.animateWithRequestAnimationFrame); 5073 }, 5074 animate: function animate(direct, first) { 5075 if (direct && !this.dragging) { 5076 return; 5077 } 5078 if (this.dragging) { 5079 var prevTarget = this.groupClone(this.value.target); 5080 var offset = [Cursor.x - this.offset.wrapper[0] - this.offset.mouse[0], Cursor.y - this.offset.wrapper[1] - this.offset.mouse[1]]; 5081 this.setTargetValueByOffset(offset, this.options.loose); 5082 this.change = [this.value.target[0] - prevTarget[0], this.value.target[1] - prevTarget[1]]; 5083 } 5084 if (this.dragging || first) { 5085 this.groupCopy(this.value.current, this.value.target); 5086 } 5087 if (this.dragging || this.glide() || first) { 5088 this.updateOffsetFromValue(); 5089 this.callAnimationCallback(); 5090 } 5091 }, 5092 glide: function glide() { 5093 var diff = [this.value.target[0] - this.value.current[0], this.value.target[1] - this.value.current[1]]; 5094 if (!diff[0] && !diff[1]) { 5095 return false; 5096 } 5097 if (Math.abs(diff[0]) > this.valuePrecision[0] || Math.abs(diff[1]) > this.valuePrecision[1]) { 5098 this.value.current[0] += diff[0] * Math.min(this.options.speed * this.timeOffset / 25, 1); 5099 this.value.current[1] += diff[1] * Math.min(this.options.speed * this.timeOffset / 25, 1); 5100 } else { 5101 this.groupCopy(this.value.current, this.value.target); 5102 } 5103 return true; 5104 }, 5105 updateOffsetFromValue: function updateOffsetFromValue() { 5106 if (!this.options.snap) { 5107 this.offset.current = this.getOffsetsByRatios(this.value.current); 5108 } else { 5109 this.offset.current = this.getOffsetsByRatios(this.getClosestSteps(this.value.current)); 5110 } 5111 if (!this.groupCompare(this.offset.current, this.offset.prev)) { 5112 this.renderHandlePosition(); 5113 this.groupCopy(this.offset.prev, this.offset.current); 5114 } 5115 }, 5116 renderHandlePosition: function renderHandlePosition() { 5117 var transform = ''; 5118 if (this.options.css3 && StylePrefix.transform) { 5119 if (this.options.horizontal) { 5120 transform += 'translateX(' + this.offset.current[0] + 'px)'; 5121 } 5122 if (this.options.vertical) { 5123 transform += ' translateY(' + this.offset.current[1] + 'px)'; 5124 } 5125 this.handle.style[StylePrefix.transform] = transform; 5126 return; 5127 } 5128 if (this.options.horizontal) { 5129 this.handle.style.left = this.offset.current[0] + 'px'; 5130 } 5131 if (this.options.vertical) { 5132 this.handle.style.top = this.offset.current[1] + 'px'; 5133 } 5134 }, 5135 setTargetValue: function setTargetValue(value, loose) { 5136 var target = loose ? this.getLooseValue(value) : this.getProperValue(value); 5137 this.groupCopy(this.value.target, target); 5138 this.offset.target = this.getOffsetsByRatios(target); 5139 this.callTargetCallback(); 5140 }, 5141 setTargetValueByOffset: function setTargetValueByOffset(offset, loose) { 5142 var value = this.getRatiosByOffsets(offset); 5143 var target = loose ? this.getLooseValue(value) : this.getProperValue(value); 5144 this.groupCopy(this.value.target, target); 5145 this.offset.target = this.getOffsetsByRatios(target); 5146 }, 5147 getLooseValue: function getLooseValue(value) { 5148 var proper = this.getProperValue(value); 5149 return [proper[0] + (value[0] - proper[0]) / 4, proper[1] + (value[1] - proper[1]) / 4]; 5150 }, 5151 getProperValue: function getProperValue(value) { 5152 var proper = this.groupClone(value); 5153 proper[0] = Math.max(proper[0], 0); 5154 proper[1] = Math.max(proper[1], 0); 5155 proper[0] = Math.min(proper[0], 1); 5156 proper[1] = Math.min(proper[1], 1); 5157 if (!this.dragging && !this.tapping || this.options.snap) { 5158 if (this.options.steps > 1) { 5159 proper = this.getClosestSteps(proper); 5160 } 5161 } 5162 return proper; 5163 }, 5164 getRatiosByOffsets: function getRatiosByOffsets(group) { 5165 return [this.getRatioByOffset(group[0], this.bounds.availWi
5165dth, this.bounds.left), this.getRatioByOffset(group[1], this.bounds.availHeight, this.bounds.top)]; 5166 }, 5167 getRatioByOffset: function getRatioByOffset(offset, range, padding) { 5168 return range ? (offset - padding) / range : 0; 5169 }, 5170 getOffsetsByRatios: function getOffsetsByRatios(group) { 5171 return [this.getOffsetByRatio(group[0], this.bounds.availWidth, this.bounds.left), this.getOffsetByRatio(group[1], this.bounds.availHeight, this.bounds.top)]; 5172 }, 5173 getOffsetByRatio: function getOffsetByRatio(ratio, range, padding) { 5174 return Math.round(ratio * range) + padding; 5175 }, 5176 getStepNumber: function getStepNumber(value) { 5177 // Translate a [0-1] value into a number from 1 to N steps (set using the 5178 // "steps" option) 5179 return this.getClosestStep(value) * (this.options.steps - 1) + 1; 5180 }, 5181 getClosestSteps: function getClosestSteps(group) { 5182 return [this.getClosestStep(group[0]), this.getClosestStep(group[1])]; 5183 }, 5184 getClosestStep: function getClosestStep(value) { 5185 var k = 0; 5186 var min = 1; 5187 for (var i = 0; i <= this.options.steps - 1; i++) { 5188 if (Math.abs(this.stepRatios[i] - value) < min) { 5189 min = Math.abs(this.stepRatios[i] - value); 5190 k = i; 5191 } 5192 } 5193 return this.stepRatios[k]; 5194 }, 5195 groupCompare: function groupCompare(a, b) { 5196 return a[0] == b[0] && a[1] == b[1]; 5197 }, 5198 groupCopy: function groupCopy(a, b) { 5199 a[0] = b[0]; 5200 a[1] = b[1]; 5201 }, 5202 groupClone: function groupClone(a) { 5203 return [a[0], a[1]]; 5204 }, 5205 draggingOnDisabledAxis: function draggingOnDisabledAxis() { 5206 return !this.options.horizontal && Cursor.xDiff > Cursor.yDiff || !this.options.vertical && Cursor.yDiff > Cursor.xDiff; 5207 } 5208 }; 5209 var bind = function bind(fn, context) { 5210 /** 5211 * CoffeeScript-like function to bind the scope of a method to an instance, 5212 * the context of that method, regardless from where it is called 5213 */ 5214 return function () { 5215 return fn.apply(context, arguments); 5216 }; 5217 }; 5218 5219 // Cross-browser vanilla JS event handling 5220 5221 var addEventListener = function addEventListener(element, type, callback) { 5222 if (element.addEventListener) { 5223 element.addEventListener(type, callback, false); 5224 } else if (element.attachEvent) { 5225 element.attachEvent('on' + type, callback); 5226 } 5227 }; 5228 var removeEventListener = function removeEventListener(element, type, callback) { 5229 if (element.removeEventListener) { 5230 element.removeEventListener(type, callback, false); 5231 } else if (element.detachEvent) { 5232 element.detachEvent('on' + type, callback); 5233 } 5234 }; 5235 var preventEventDefaults = function preventEventDefaults(e) { 5236 if (!e) { 5237 e = window.event; 5238 } 5239 if (e.preventDefault) { 5240 e.preventDefault(); 5241 } 5242 e.returnValue = false; 5243 }; 5244 var stopEventPropagation = function stopEventPropagation(e) { 5245 if (!e) { 5246 e = window.event; 5247 } 5248 if (e.stopPropagation) { 5249 e.stopPropagation(); 5250 } 5251 e.cancelBubble = true; 5252 }; 5253 var Cursor = { 5254 /** 5255 * Abstraction for making the combined mouse or touch position available at 5256 * any time. 5257 * 5258 * It picks up the "move" events as an independent component and simply makes 5259 * the latest x and y mouse/touch position of the user available at any time, 5260 * which is requested with Cursor.x and Cursor.y respectively. 5261 * 5262 * It can receive both mouse and touch events consecutively, extracting the 5263 * relevant meta data from each type of event. 5264 * 5265 * Cursor.refresh(e) is called to update the global x and y values, with a 5266 * genuine MouseEvent or a TouchEvent from an event listener, e.g. 5267 * mousedown/up or touchstart/end 5268 */ 5269 x: 0, 5270 y: 0, 5271 xDiff: 0, 5272 yDiff: 0, 5273 refresh: function refresh(e) { 5274 if (!e) { 5275 e = window.event; 5276 } 5277 if (e.type == 'mousemove') { 5278 this.set(e); 5279 } else if (e.touches) { 5280 this.set(e.touches[0]); 5281 } 5282 }, 5283 set: function set(e) { 5284 var lastX = this.x, 5285 lastY = this.y; 5286 if (e.clientX || e.clientY) { 5287 this.x = e.clientX; 5288 this.y = e.clientY; 5289 } else if (e.pageX || e.pageY) { 5290 this.x = e.pageX - document.body.scrollLeft - document.documentElement.scrollLeft; 5291 this.y = e.pageY - document.body.scrollTop - document.documentElement.scrollTop; 5292 } 5293 this.xDiff = Math.abs(this.x - lastX); 5294 this.yDiff = Math.abs(this.y - lastY); 5295 } 5296 }; 5297 var Position = { 5298 /** 5299 * Helper for extracting position of a DOM element, relative to the viewport 5300 * 5301 * The get(obj) method accepts a DOM element as the only parameter, and 5302 * returns the position under a (x, y) tuple, as an array with two elements. 5303 */ 5304 get: function get(obj) { 5305 // Dragdealer relies on getBoundingClientRect to calculate element offsets, 5306 // but we want to be sure we don't throw any unhandled exceptions and break 5307 // other code from the page if running from in very old browser that doesn't 5308 // support this method 5309 var rect = { 5310 left: 0, 5311 top: 0 5312 }; 5313 if (obj.getBoundingClientRect !== undefined) { 5314 rect = obj.getBoundingClientRect(); 5315 } 5316 return [rect.left, rect.top]; 5317 } 5318 }; 5319 var StylePrefix = { 5320 transform: getPrefixedStylePropName('transform'), 5321 perspective: getPrefixedStylePropName('perspective'), 5322 backfaceVisibility: getPrefixedStylePropName('backfaceVisibility') 5323 }; 5324 function getPrefixedStylePropName(propName) { 5325 var domPrefixes = 'Webkit Moz ms O'.split(' '), 5326 elStyle = document.documentElement.style; 5327 if (elStyle[propName] !== undefined) return propName; // Is supported unprefixed 5328 propName = propName.charAt(0).toUpperCase() + propName.substr(1); 5329 for (var i = 0; i < domPrefixes.length; i++) { 5330 if (elStyle[domPrefixes[i] + propName] !== undefined) { 5331 return domPrefixes[i] + propName; // Is supported with prefix 5332 } 5333 } 5334 } 5335 ; 5336 function triggerWebkitHardwareAcceleration(element) { 5337 if (StylePrefix.backfaceVisibility && StylePrefix.perspective) { 5338 element.style[StylePrefix.perspective] = '1000px'; 5339 element.style[StylePrefix.backfaceVisibility] = 'hidden'; 5340 } 5341 } 5342 ; 5343 var vendors = ['webkit', 'moz']; 5344 var requestAnimationFrame = window.requestAnimationFrame; 5345 var cancelAnimationFrame = window.cancelAnimationFrame; 5346 for (var x = 0; x < vendors.length && !requestAnimationFrame; ++x) { 5347 requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; 5348 cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; 5349 } 5350 if (!requestAnimationFrame) { 5351 requestAnimationFrame = function requestAnimationFrame(callback) { 5352 return setTimeout(callback, 25); 5353 }; 5354 cancelAnimationFrame = clearTimeout; 5355 } 5356 return Dragdealer; 5357}); 5358 5359},{}],10:[function(require,module,exports){ 5360(function (factory) { 5361 if (typeof define === "function" && define.amd) { 5362 define(factory); 5363 } else if (typeof module !== "undefined" && module.exports) { 5364 module.exports = factory(); 5365 } else {
5366 window.enterView = factory.call(this); 5367 } 5368})(function () { 5369 var lib = function lib(_ref) { 5370 var selector = _ref.selector, 5371 _ref$enter = _ref.enter, 5372 enter = _ref$enter === void 0 ? function () {} : _ref$enter, 5373 _ref$exit = _ref.exit, 5374 exit = _ref$exit === void 0 ? function () {} : _ref$exit, 5375 _ref$progress = _ref.progress, 5376 progress = _ref$progress === void 0 ? function () {} : _ref$progress, 5377 _ref$offset = _ref.offset, 5378 offset = _ref$offset === void 0 ? 0 : _ref$offset, 5379 _ref$once = _ref.once, 5380 once = _ref$once === void 0 ? false : _ref$once; 5381 var raf = null; 5382 var ticking = false; 5383 var elements = []; 5384 var height = 0; 5385 function setupRaf() { 5386 raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) { 5387 return setTimeout(callback, 1e3 / 60); 5388 }; 5389 } 5390 function getOffsetHeight() { 5391 if (offset && typeof offset === "number") { 5392 var fraction = Math.min(Math.max(0, offset), 1); 5393 return height - fraction * height; 5394 } 5395 return height; 5396 } 5397 function updateHeight() { 5398 var cH = document.documentElement.clientHeight; 5399 var wH = window.innerHeight || 0; 5400 height = Math.max(cH, wH); 5401 } 5402 function updateScroll() { 5403 ticking = false; 5404 var targetFromTop = getOffsetHeight(); 5405 elements = elements.filter(function (el) { 5406 var _el$getBoundingClient = el.getBoundingClientRect(), 5407 top = _el$getBoundingClient.top, 5408 bottom = _el$getBoundingClient.bottom, 5409 height = _el$getBoundingClient.height; 5410 var entered = top < targetFromTop; 5411 var exited = bottom < targetFromTop; 5412 if (entered && !el.__ev_entered) { 5413 enter(el); 5414 el.__ev_progress = 0; 5415 progress(el, el.__ev_progress); 5416 if (once) return false; 5417 } else if (!entered && el.__ev_entered) { 5418 el.__ev_progress = 0; 5419 progress(el, el.__ev_progress); 5420 exit(el); 5421 } 5422 if (entered && !exited) { 5423 var delta = (targetFromTop - top) / height; 5424 el.__ev_progress = Math.min(1, Math.max(0, delta)); 5425 progress(el, el.__ev_progress); 5426 } 5427 if (entered && exited && el.__ev_progress !== 1) { 5428 el.__ev_progress = 1; 5429 progress(el, el.__ev_progress); 5430 } 5431 el.__ev_entered = entered; 5432 return true; 5433 }); 5434 if (!elements.length) { 5435 window.removeEventListener("scroll", onScroll, true); 5436 window.removeEventListener("resize", onResize, true); 5437 window.removeEventListener("load", onLoad, true); 5438 } 5439 } 5440 function onScroll() { 5441 if (!ticking) { 5442 ticking = true; 5443 raf(updateScroll); 5444 } 5445 } 5446 function onResize() { 5447 updateHeight(); 5448 updateScroll(); 5449 } 5450 function onLoad() { 5451 updateHeight(); 5452 updateScroll(); 5453 } 5454 function selectionToArray(selection) { 5455 var len = selection.length; 5456 var result = []; 5457 for (var i = 0; i < len; i += 1) { 5458 result.push(selection[i]); 5459 } 5460 return result; 5461 } 5462 function selectAll(selector) { 5463 var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; 5464 if (typeof selector === "string") { 5465 return selectionToArray(parent.querySelectorAll(selector)); 5466 } else if (selector instanceof NodeList) { 5467 return selectionToArray(selector); 5468 } else if (selector instanceof Array) { 5469 return selector; 5470 } 5471 } 5472 function setupElements() { 5473 elements = selectAll(selector); 5474 } 5475 function setupEvents() { 5476 window.addEventListener("resize", onResize, true); 5477 window.addEventListener("scroll", onScroll, true); 5478 window.addEventListener("load", onLoad, true); 5479 onResize(); 5480 } 5481 function init() { 5482 if (!selector) { 5483 console.error("must pass a selector"); 5484 return false; 5485 } 5486 setupElements(); 5487 if (!elements || !elements.length) { 5488 console.error("no selector elements found"); 5489 return false;
5490 } 5491 setupRaf(); 5492 setupEvents(); 5493 updateScroll(); 5494 } 5495 init(); 5496 }; 5497 return lib; 5498}); 5499 5500},{}],11:[function(require,module,exports){ 5501(function (process,global){(function (){ 5502function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 5503/*! 5504 * @overview es6-promise - a tiny implementation of Promises/A+. 5505 * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) 5506 * @license Licensed under MIT license 5507 * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE 5508 * @version v4.2.8+1e68dce6 5509 */ 5510 5511(function (global, factory) { 5512 (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.ES6Promise = factory(); 5513})(this, function () { 5514 'use strict'; 5515 5516 function objectOrFunction(x) { 5517 var type = _typeof(x); 5518 return x !== null && (type === 'object' || type === 'function'); 5519 } 5520 function isFunction(x) { 5521 return typeof x === 'function'; 5522 } 5523 var _isArray = void 0; 5524 if (Array.isArray) { 5525 _isArray = Array.isArray; 5526 } else { 5527 _isArray = function _isArray(x) { 5528 return Object.prototype.toString.call(x) === '[object Array]'; 5529 }; 5530 } 5531 var isArray = _isArray; 5532 var len = 0; 5533 var vertxNext = void 0; 5534 var customSchedulerFn = void 0; 5535 var asap = function asap(callback, arg) { 5536 queue[len] = callback; 5537 queue[len + 1] = arg; 5538 len += 2; 5539 if (len === 2) { 5540 // If len is 2, that means that we need to schedule an async flush. 5541 // If additional callbacks are queued before the queue is flushed, they 5542 // will be processed by this flush that we are scheduling. 5543 if (customSchedulerFn) { 5544 customSchedulerFn(flush); 5545 } else { 5546 scheduleFlush(); 5547 } 5548 } 5549 }; 5550 function setScheduler(scheduleFn) { 5551 customSchedulerFn = scheduleFn; 5552 } 5553 function setAsap(asapFn) { 5554 asap = asapFn; 5555 } 5556 var browserWindow = typeof window !== 'undefined' ? window : undefined; 5557 var browserGlobal = browserWindow || {}; 5558 var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; 5559 var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; 5560 5561 // test for web worker but not in IE10 5562 var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; 5563 5564 // node 5565 function useNextTick() { 5566 // node version 0.10.x displays a deprecation warning when nextTick is used recursively 5567 // see https://github.com/cujojs/when/issues/410 for details 5568 return function () { 5569 return process.nextTick(flush); 5570 }; 5571 } 5572 5573 // vertx 5574 function useVertxTimer() { 5575 if (typeof vertxNext !== 'undefined') { 5576 return function () { 5577 vertxNext(flush); 5578 }; 5579 } 5580 return useSetTimeout(); 5581 } 5582 function useMutationObserver() { 5583 var iterations = 0; 5584 var observer = new BrowserMutationObserver(flush); 5585 var node = document.createTextNode(''); 5586 observer.observe(node, { 5587 characterData: true 5588 }); 5589 return function () { 5590 node.data = iterations = ++iterations % 2; 5591 }; 5592 } 5593 5594 // web worker 5595 function useMessageChannel() { 5596 var channel = new MessageChannel(); 5597 channel.port1.onmessage = flush; 5598 return function () { 5599 return channel.port2.postMessage(0); 5600 }; 5601 } 5602 function useSetTimeout() { 5603 // Store setTimeout reference so es6-promise will be unaffected by 5604 // other code modifying setTimeout (like sinon.useFakeTimers()) 5605 var globalSetTimeout = setTimeout; 5606 return function () { 5607 return globalSetTimeout(flush, 1); 5608 }; 5609 } 5610 var queue = new Array(1000); 5611 function flush() { 5612 for (var i = 0; i < len; i += 2) { 5613 var callback = queue[i]; 5614 var arg = queue[i + 1]; 5615 callback(arg); 5616 queue[i] = undefined; 5617 queue[i + 1] = undefined; 5618 } 5619 len = 0; 5620 } 5621 function attemptVertx() { 5622 try { 5623 var vertx = Function('return this')().require('vertx'); 5624 vertxNext = vertx.runOnLoop || vertx.runOnContext; 5625 return useVertxTimer(); 5626 } catch (e) { 5627 return useSetTimeout(); 5628 } 5629 } 5630 var scheduleFlush = void 0; 5631 // Decide what async method to use to triggering processing of queued callbacks: 5632 if (isNode) { 5633 scheduleFlush = useNextTick(); 5634 } else if (BrowserMutationObserver) { 5635 scheduleFlush = useMutationObserver(); 5636 } else if (isWorker) {
vendor: 13,120 bytes, lines 5637-6084
5637 scheduleFlush = useMessageChannel(); 5638 } else if (browserWindow === undefined && typeof require === 'function') { 5639 scheduleFlush = attemptVertx(); 5640 } else { 5641 scheduleFlush = useSetTimeout(); 5642 } 5643 function then(onFulfillment, onRejection) { 5644 var parent = this; 5645 var child = new this.constructor(noop); 5646 if (child[PROMISE_ID] === undefined) { 5647 makePromise(child); 5648 } 5649 var _state = parent._state; 5650 if (_state) { 5651 var callback = arguments[_state - 1]; 5652 asap(function () { 5653 return invokeCallback(_state, child, callback, parent._result); 5654 }); 5655 } else { 5656 subscribe(parent, child, onFulfillment, onRejection); 5657 } 5658 return child; 5659 } 5660 5661 /** 5662 `Promise.resolve` returns a promise that will become resolved with the 5663 passed `value`. It is shorthand for the following: 5664 5665 ```javascript 5666 let promise = new Promise(function(resolve, reject){ 5667 resolve(1); 5668 }); 5669 5670 promise.then(function(value){ 5671 // value === 1 5672 }); 5673 ``` 5674 5675 Instead of writing the above, your code now simply becomes the following: 5676 5677 ```javascript 5678 let promise = Promise.resolve(1); 5679 5680 promise.then(function(value){ 5681 // value === 1 5682 }); 5683 ``` 5684 5685 @method resolve 5686 @static 5687 @param {Any} value value that the returned promise will be resolved with 5688 Useful for tooling. 5689 @return {Promise} a promise that will become fulfilled with the given 5690 `value` 5691 */ 5692 function resolve$1(object) { 5693 /*jshint validthis:true */ 5694 var Constructor = this; 5695 if (object && _typeof(object) === 'object' && object.constructor === Constructor) { 5696 return object; 5697 } 5698 var promise = new Constructor(noop); 5699 resolve(promise, object); 5700 return promise; 5701 } 5702 var PROMISE_ID = Math.random().toString(36).substring(2); 5703 function noop() {} 5704 var PENDING = void 0; 5705 var FULFILLED = 1; 5706 var REJECTED = 2; 5707 function selfFulfillment() { 5708 return new TypeError("You cannot resolve a promise with itself"); 5709 } 5710 function cannotReturnOwn() { 5711 return new TypeError('A promises callback cannot return that same promise.'); 5712 } 5713 function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { 5714 try { 5715 then$$1.call(value, fulfillmentHandler, rejectionHandler); 5716 } catch (e) { 5717 return e; 5718 } 5719 } 5720 function handleForeignThenable(promise, thenable, then$$1) { 5721 asap(function (promise) { 5722 var sealed = false; 5723 var error = tryThen(then$$1, thenable, function (value) { 5724 if (sealed) { 5725 return; 5726 } 5727 sealed = true; 5728 if (thenable !== value) { 5729 resolve(promise, value); 5730 } else { 5731 fulfill(promise, value); 5732 } 5733 }, function (reason) { 5734 if (sealed) { 5735 return; 5736 } 5737 sealed = true; 5738 reject(promise, reason); 5739 }, 'Settle: ' + (promise._label || ' unknown promise')); 5740 if (!sealed && error) { 5741 sealed = true; 5742 reject(promise, error); 5743 } 5744 }, promise); 5745 } 5746 function handleOwnThenable(promise, thenable) { 5747 if (thenable._state === FULFILLED) { 5748 fulfill(promise, thenable._result); 5749 } else if (thenable._state === REJECTED) { 5750 reject(promise, thenable._result); 5751 } else { 5752 subscribe(thenable, undefined, function (value) { 5753 return resolve(promise, value); 5754 }, function (reason) { 5755 return reject(promise, reason); 5756 }); 5757 } 5758 } 5759 function handleMaybeThenable(promise, maybeThenable, then$$1) { 5760 if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { 5761 handleOwnThenable(promise, maybeThenable); 5762 } else { 5763 if (then$$1 === undefined) { 5764 fulfill(promise, maybeThenable); 5765 } else if (isFunction(then$$1)) { 5766 handleForeignThenable(promise, maybeThenable, then$$1); 5767 } else { 5768 fulfill(promise, maybeThenable); 5769 } 5770 } 5771 } 5772 function resolve(promise, value) { 5773 if (promise === value) { 5774 reject(promise, selfFulfillment()); 5775 } else if (objectOrFunction(value)) { 5776 var then$$1 = void 0; 5777 try { 5778 then$$1 = value.then; 5779 } catch (error) { 5780 reject(promise, error); 5781 return; 5782 } 5783 handleMaybeThenable(promise, value, then$$1); 5784 } else { 5785 fulfill(promise, value); 5786 } 5787 } 5788 function publishRejection(promise) { 5789 if (promise._onerror) { 5790 promise._onerror(promise._result); 5791 } 5792 publish(promise); 5793 } 5794 function fulfill(promise, value) { 5795 if (promise._state !== PENDING) { 5796 return; 5797 } 5798 promise._result = value; 5799 promise._state = FULFILLED; 5800 if (promise._subscribers.length !== 0) { 5801 asap(publish, promise); 5802 } 5803 } 5804 function reject(promise, reason) { 5805 if (promise._state !== PENDING) { 5806 return; 5807 } 5808 promise._state = REJECTED; 5809 promise._result = reason; 5810 asap(publishRejection, promise); 5811 } 5812 function subscribe(parent, child, onFulfillment, onRejection) { 5813 var _subscribers = parent._subscribers; 5814 var length = _subscribers.length; 5815 parent._onerror = null; 5816 _subscribers[length] = child; 5817 _subscribers[length + FULFILLED] = onFulfillment; 5818 _subscribers[length + REJECTED] = onRejection; 5819 if (length === 0 && parent._state) { 5820 asap(publish, parent); 5821 } 5822 } 5823 function publish(promise) { 5824 var subscribers = promise._subscribers; 5825 var settled = promise._state; 5826 if (subscribers.length === 0) { 5827 return; 5828 } 5829 var child = void 0, 5830 callback = void 0, 5831 detail = promise._result; 5832 for (var i = 0; i < subscribers.length; i += 3) { 5833 child = subscribers[i]; 5834 callback = subscribers[i + settled]; 5835 if (child) { 5836 invokeCallback(settled, child, callback, detail); 5837 } else { 5838 callback(detail); 5839 } 5840 } 5841 promise._subscribers.length = 0; 5842 } 5843 function invokeCallback(settled, promise, callback, detail) { 5844 var hasCallback = isFunction(callback), 5845 value = void 0, 5846 error = void 0, 5847 succeeded = true; 5848 if (hasCallback) { 5849 try { 5850 value = callback(detail); 5851 } catch (e) { 5852 succeeded = false; 5853 error = e; 5854 } 5855 if (promise === value) { 5856 reject(promise, cannotReturnOwn()); 5857 return; 5858 } 5859 } else { 5860 value = detail; 5861 } 5862 if (promise._state !== PENDING) { 5863 // noop 5864 } else if (hasCallback && succeeded) { 5865 resolve(promise, value); 5866 } else if (succeeded === false) { 5867 reject(promise, error); 5868 } else if (settled === FULFILLED) { 5869 fulfill(promise, value); 5870 } else if (settled === REJECTED) { 5871 reject(promise, value); 5872 } 5873 } 5874 function initializePromise(promise, resolver) { 5875 try { 5876 resolver(function resolvePromise(value) { 5877 resolve(promise, value); 5878 }, function rejectPromise(reason) { 5879 reject(promise, reason); 5880 }); 5881 } catch (e) { 5882 reject(promise, e); 5883 } 5884 } 5885 var id = 0; 5886 function nextId() { 5887 return id++; 5888 } 5889 function makePromise(promise) { 5890 promise[PROMISE_ID] = id++; 5891 promise._state = undefined; 5892 promise._result = undefined; 5893 promise._subscribers = []; 5894 } 5895 function validationError() { 5896 return new Error('Array Methods must be provided an Array'); 5897 } 5898 var Enumerator = function () { 5899 function Enumerator(Constructor, input) { 5900 this._instanceConstructor = Constructor; 5901 this.promise = new Constructor(noop); 5902 if (!this.promise[PROMISE_ID]) { 5903 makePromise(this.promise); 5904 } 5905 if (isArray(input)) { 5906 this.length = input.length; 5907 this._remaining = input.length; 5908 this._result = new Array(this.length); 5909 if (this.length === 0) { 5910 fulfill(this.promise, this._result); 5911 } else { 5912 this.length = this.length || 0; 5913 this._enumerate(input); 5914 if (this._remaining === 0) { 5915 fulfill(this.promise, this._result); 5916 } 5917 } 5918 } else { 5919 reject(this.promise, validationError()); 5920 } 5921 } 5922 Enumerator.prototype._enumerate = function _enumerate(input) { 5923 for (var i = 0; this._state === PENDING && i < input.length; i++) { 5924 this._eachEntry(input[i], i); 5925 } 5926 }; 5927 Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { 5928 var c = this._instanceConstructor; 5929 var resolve$$1 = c.resolve; 5930 if (resolve$$1 === resolve$1) { 5931 var _then = void 0; 5932 var error = void 0; 5933 var didError = false; 5934 try { 5935 _then = entry.then; 5936 } catch (e) { 5937 didError = true; 5938 error = e; 5939 } 5940 if (_then === then && entry._state !== PENDING) { 5941 this._settledAt(entry._state, i, entry._result); 5942 } else if (typeof _then !== 'function') { 5943 this._remaining--; 5944 this._result[i] = entry; 5945 } else if (c === Promise$1) { 5946 var promise = new c(noop); 5947 if (didError) { 5948 reject(promise, error); 5949 } else { 5950 handleMaybeThenable(promise, entry, _then); 5951 } 5952 this._willSettleAt(promise, i); 5953 } else { 5954 this._willSettleAt(new c(function (resolve$$1) { 5955 return resolve$$1(entry); 5956 }), i); 5957 } 5958 } else { 5959 this._willSettleAt(resolve$$1(entry), i); 5960 } 5961 }; 5962 Enumerator.prototype._settledAt = function _settledAt(state, i, value) { 5963 var promise = this.promise; 5964 if (promise._state === PENDING) { 5965 this._remaining--; 5966 if (state === REJECTED) { 5967 reject(promise, value); 5968 } else { 5969 this._result[i] = value; 5970 } 5971 } 5972 if (this._remaining === 0) { 5973 fulfill(promise, this._result); 5974 } 5975 }; 5976 Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { 5977 var enumerator = this; 5978 subscribe(promise, undefined, function (value) { 5979 return enumerator._settledAt(FULFILLED, i, value); 5980 }, function (reason) { 5981 return enumerator._settledAt(REJECTED, i, reason); 5982 }); 5983 }; 5984 return Enumerator; 5985 }(); 5986 5987 /** 5988 `Promise.all` accepts an array of promises, and returns a new promise which 5989 is fulfilled with an array of fulfillment values for the passed promises, or 5990 rejected with the reason of the first passed promise to be rejected. It casts all 5991 elements of the passed iterable to promises as it runs this algorithm. 5992 5993 Example: 5994 5995 ```javascript 5996 let promise1 = resolve(1); 5997 let promise2 = resolve(2); 5998 let promise3 = resolve(3); 5999 let promises = [ promise1, promise2, promise3 ]; 6000 6001 Promise.all(promises).then(function(array){ 6002 // The array here would be [ 1, 2, 3 ]; 6003 }); 6004 ``` 6005 6006 If any of the `promises` given to `all` are rejected, the first promise 6007 that is rejected will be given as an argument to the returned promises's 6008 rejection handler. For example: 6009 6010 Example: 6011 6012 ```javascript 6013 let promise1 = resolve(1); 6014 let promise2 = reject(new Error("2")); 6015 let promise3 = reject(new Error("3")); 6016 let promises = [ promise1, promise2, promise3 ]; 6017 6018 Promise.all(promises).then(function(array){ 6019 // Code here never runs because there are rejected promises! 6020 }, function(error) { 6021 // error.message === "2" 6022 }); 6023 ``` 6024 6025 @method all 6026 @static 6027 @param {Array} entries array of promises 6028 @param {String} label optional string for labeling the promise. 6029 Useful for tooling. 6030 @return {Promise} promise that is fulfilled when all `promises` have been 6031 fulfilled, or rejected if any of them become rejected. 6032 @static 6033 */ 6034 function all(entries) { 6035 return new Enumerator(this, entries).promise; 6036 } 6037 6038 /** 6039 `Promise.race` returns a new promise which is settled in the same way as the 6040 first passed promise to settle. 6041 6042 Example: 6043 6044 ```javascript 6045 let promise1 = new Promise(function(resolve, reject){ 6046 setTimeout(function(){ 6047 resolve('promise 1'); 6048 }, 200); 6049 }); 6050 6051 let promise2 = new Promise(function(resolve, reject){ 6052 setTimeout(function(){ 6053 resolve('promise 2'); 6054 }, 100); 6055 }); 6056 6057 Promise.race([promise1, promise2]).then(function(result){ 6058 // result === 'promise 2' because it was resolved before promise1 6059 // was resolved. 6060 }); 6061 ``` 6062 6063 `Promise.race` is deterministic in that only the state of the first 6064 settled promise matters. For example, even if other promises given to the 6065 `promises` array argument are resolved, but the first settled promise has 6066 become rejected before the other promises became fulfilled, the returned 6067 promise will become rejected: 6068 6069 ```javascript 6070 let promise1 = new Promise(function(resolve, reject){ 6071 setTimeout(function(){ 6072 resolve('promise 1'); 6073 }, 200); 6074 }); 6075 6076 let promise2 = new Promise(function(resolve, reject){ 6077 setTimeout(function(){ 6078 reject(new Error('promise 2')); 6079 }, 100); 6080 }); 6081 6082 Promise.race([promise1, promise2]).then(function(result){ 6083 // Code here never runs 6084 }, function(reason){
6085 // reason.message === 'promise 2' because promise 2 became rejected before 6086 // promise 1 became fulfilled 6087 }); 6088 ``` 6089 6090 An example real-world use case is implementing timeouts: 6091 6092 ```javascript 6093 Promise.race([ajax('foo.json'), timeout(5000)]) 6094 ``` 6095 6096 @method race 6097 @static 6098 @param {Array} promises array of promises to observe 6099 Useful for tooling. 6100 @return {Promise} a promise which settles in the same way as the first passed 6101 promise to settle. 6102 */ 6103 function race(entries) { 6104 /*jshint validthis:true */ 6105 var Constructor = this; 6106 if (!isArray(entries)) { 6107 return new Constructor(function (_, reject) { 6108 return reject(new TypeError('You must pass an array to race.')); 6109 }); 6110 } else { 6111 return new Constructor(function (resolve, reject) { 6112 var length = entries.length; 6113 for (var i = 0; i < length; i++) { 6114 Constructor.resolve(entries[i]).then(resolve, reject); 6115 } 6116 }); 6117 } 6118 } 6119 6120 /** 6121 `Promise.reject` returns a promise rejected with the passed `reason`. 6122 It is shorthand for the following: 6123 6124 ```javascript 6125 let promise = new Promise(function(resolve, reject){ 6126 reject(new Error('WHOOPS')); 6127 }); 6128 6129 promise.then(function(value){ 6130 // Code here doesn't run because the promise is rejected! 6131 }, function(reason){ 6132 // reason.message === 'WHOOPS' 6133 }); 6134 ``` 6135 6136 Instead of writing the above, your code now simply becomes the following: 6137 6138 ```javascript 6139 let promise = Promise.reject(new Error('WHOOPS')); 6140 6141 promise.then(function(value){ 6142 // Code here doesn't run because the promise is rejected! 6143 }, function(reason){ 6144 // reason.message === 'WHOOPS' 6145 }); 6146 ``` 6147 6148 @method reject 6149 @static 6150 @param {Any} reason value that the returned promise will be rejected with. 6151 Useful for tooling. 6152 @return {Promise} a promise rejected with the given `reason`. 6153 */ 6154 function reject$1(reason) { 6155 /*jshint validthis:true */ 6156 var Constructor = this; 6157 var promise = new Constructor(noop); 6158 reject(promise, reason); 6159 return promise; 6160 } 6161 function needsResolver() { 6162 throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); 6163 } 6164 function needsNew() { 6165 throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object c
6165onstructor cannot be called as a function."); 6166 } 6167 6168 /** 6169 Promise objects represent the eventual result of an asynchronous operation. The 6170 primary way of interacting with a promise is through its `then` method, which 6171 registers callbacks to receive either a promise's eventual value or the reason 6172 why the promise cannot be fulfilled. 6173 6174 Terminology 6175 ----------- 6176 6177 - `promise` is an object or function with a `then` method whose behavior conforms to this specification. 6178 - `thenable` is an object or function that defines a `then` method. 6179 - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). 6180 - `exception` is a value that is thrown using the throw statement. 6181 - `reason` is a value that indicates why a promise was rejected. 6182 - `settled` the final resting state of a promise, fulfilled or rejected. 6183 6184 A promise can be in one of three states: pending, fulfilled, or rejected. 6185 6186 Promises that are fulfilled have a fulfillment value and are in the fulfilled 6187 state. Promises that are rejected have a rejection reason and are in the 6188 rejected state. A fulfillment value is never a thenable. 6189 6190 Promises can also be said to *resolve* a value. If this value is also a 6191 promise, then the original promise's settled state will match the value's 6192 settled state. So a promise that *resolves* a promise that rejects will 6193 itself reject, and a promise that *resolves* a promise that fulfills will 6194 itself fulfill. 6195 6196 6197 Basic Usage: 6198 ------------ 6199 6200 ```js 6201 let promise = new Promise(function(resolve, reject) { 6202 // on success 6203 resolve(value); 6204 6205 // on failure 6206 reject(reason); 6207 }); 6208 6209 promise.then(function(value) { 6210 // on fulfillment 6211 }, function(reason) { 6212 // on rejection 6213 }); 6214 ``` 6215 6216 Advanced Usage: 6217 --------------- 6218 6219 Promises shine when abstracting away asynchronous interactions such as 6220 `XMLHttpRequest`s. 6221 6222 ```js 6223 function getJSON(url) { 6224 return new Promise(function(resolve, reject){ 6225 let xhr = new XMLHttpRequest(); 6226 6227 xhr.open('GET', url); 6228 xhr.onreadystatechange = handler; 6229 xhr.responseType = 'json'; 6230 xhr.setRequestHeader('Accept', 'application/json'); 6231 xhr.send(); 6232 6233 function handler() { 6234 if (this.readyState === this.DONE) { 6235 if (this.status === 200) { 6236 resolve(this.response); 6237 } else { 6238 reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); 6239 } 6240 } 6241 }; 6242 }); 6243 } 6244 6245 getJSON('/posts.json').then(function(json) { 6246 // on fulfillment 6247 }, function(reason) { 6248 // on rejection 6249 }); 6250 ``` 6251 6252 Unlike callbacks, promises are great composable primitives. 6253 6254 ```js 6255 Promise.all([ 6256 getJSON('/posts'), 6257 getJSON('/comments') 6258 ]).then(function(values){ 6259 values[0] // => postsJSON 6260 values[1] // => commentsJSON 6261 6262 return values; 6263 }); 6264 ``` 6265 6266 @class Promise 6267 @param {Function} resolver 6268 Useful for tooling. 6269 @constructor 6270 */ 6271 6272 var Promise$1 = function () { 6273 function Promise(resolver) { 6274 this[PROMISE_ID] = nextId(); 6275 this._result = this._state = undefined; 6276 this._subscribers = []; 6277 if (noop !== resolver) { 6278 typeof resolver !== 'function' && needsResolver(); 6279 this instanceof Promise ? initializePromise(this, resolver) : needsNew(); 6280 } 6281 } 6282 6283 /** 6284 The primary way of interacting with a promise is through its `then` method, 6285 which registers callbacks to receive either a promise's eventual value or the 6286 reason why the promise cannot be fulfilled. 6287 ```js 6288 findUser().then(function(user){ 6289 // user is available 6290 }, function(reason){ 6291 // user is unavailable, and you are given the reason why 6292 }); 6293 ``` 6294 Chaining 6295 -------- 6296 The return value of `then` is itself a promise. This second, 'downstream' 6297 promise is resolved with the return value of the first promise's fulfillment 6298 or rejection handler, or rejected if the handler throws an exception. 6299 ```js 6300 findUser().then(function (user) { 6301 return user.name; 6302 }, function (reason) { 6303 return 'default name'; 6304 }).then(function (userName) { 6305 // If `findUser` fulfilled, `userName` will be the user's name, otherwise it 6306 // will be `'default name'` 6307 }); 6308 findUser().then(function (user) { 6309 throw new Error('Found user, but still unhappy'); 6310 }, function (reason) { 6311 throw new Error('`findUser` rejected and we're unhappy'); 6312 }).then(function (value) { 6313 // never reached 6314 }, function (reason) { 6315 // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. 6316 // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. 6317 }); 6318 ``` 6319 If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. 6320 ```js 6321 findUser().then(function (user) { 6322 throw new PedagogicalException('Upstream error'); 6323 }).then(function (value) { 6324 // never reached 6325 }).then(function (value) { 6326 // never reached 6327 }, function (reason) { 6328 // The `PedgagocialException` is propagated all the way down to here 6329 }); 6330 ``` 6331 Assimilation 6332 ------------ 6333 Sometimes the value you want to propagate to a downstream promise can only be 6334 retrieved asynchronously. This can be achieved by returning a promise in the 6335 fulfillment or rejection handler. The downstream promise will then be pending 6336 until the returned promise is settled. This is called *assimilation*. 6337 ```js 6338 findUser().then(function (user) { 6339 return findCommentsByAuthor(user); 6340 }).then(function (comments) { 6341 // The user's comments are now available 6342 }); 6343 ``` 6344 If the assimliated promise rejects, then the downstream promise will also reject. 6345 ```js 6346 findUser().then(function (user) { 6347 return findCommentsByAuthor(user); 6348 }).then(function (comments) { 6349 // If `findCommentsByAuthor` fulfills, we'll have the value here 6350 }, function (reason) { 6351 // If `findCommentsByAuthor` rejects, we'll have the reason here 6352 }); 6353 ```
6354 Simple Example 6355 -------------- 6356 Synchronous Example 6357 ```javascript 6358 let result; 6359 try { 6360 result = findResult(); 6361 // success 6362 } catch(reason) { 6363 // failure 6364 } 6365 ``` 6366 Errback Example 6367 ```js 6368 findResult(function(result, err){ 6369 if (err) { 6370 // failure 6371 } else { 6372 // success 6373 } 6374 }); 6375 ``` 6376 Promise Example; 6377 ```javascript 6378 findResult().then(function(result){ 6379 // success 6380 }, function(reason){ 6381 // failure 6382 }); 6383 ``` 6384 Advanced Example 6385 -------------- 6386 Synchronous Example 6387 ```javascript 6388 let author, books; 6389 try { 6390 author = findAuthor(); 6391 books = findBooksByAuthor(author); 6392 // success 6393 } catch(reason) { 6394 // failure 6395 } 6396 ``` 6397 Errback Example 6398 ```js 6399 function foundBooks(books) { 6400 } 6401 function failure(reason) { 6402 } 6403 findAuthor(function(author, err){ 6404 if (err) { 6405 failure(err); 6406 // failure 6407 } else { 6408 try { 6409 findBoooksByAuthor(author, function(books, err) { 6410 if (err) { 6411 failure(err); 6412 } else { 6413 try { 6414 foundBooks(books); 6415 } catch(reason) { 6416 failure(reason); 6417 } 6418 } 6419 }); 6420 } catch(error) { 6421 failure(err); 6422 } 6423 // success 6424 } 6425 }); 6426 ``` 6427 Promise Example; 6428 ```javascript 6429 findAuthor(). 6430 then(findBooksByAuthor). 6431 then(function(books){ 6432 // found books 6433 }).catch(function(reason){ 6434 // something went wrong 6435 }); 6436 ``` 6437 @method then 6438 @param {Function} onFulfilled 6439 @param {Function} onRejected 6440 Useful for tooling. 6441 @return {Promise} 6442 */ 6443 6444 /** 6445 `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same 6446 as the catch block of a try/catch statement. 6447 ```js 6448 function findAuthor(){ 6449 throw new Error('couldn't find that author'); 6450 } 6451 // synchronous 6452 try { 6453 findAuthor(); 6454 } catch(reason) { 6455 // something went wrong 6456 } 6457 // async with promises 6458 findAuthor().catch(function(reason){ 6459 // something went wrong 6460 }); 6461 ``` 6462 @method catch 6463 @param {Function} onRejection 6464 Useful for tooling. 6465 @return {Promise} 6466 */ 6467 6468 Promise.prototype["catch"] = function _catch(onRejection) { 6469 return this.then(null, onRejection); 6470 }; 6471 6472 /** 6473 `finally` will be invoked regardless of the promise's fate just as native 6474 try/catch/finally behaves 6475 6476 Synchronous example: 6477 6478 ```js 6479 findAuthor() { 6480 if (Math.random() > 0.5) { 6481 throw new Error(); 6482 } 6483 return new Author(); 6484 } 6485 6486 try { 6487 return findAuthor(); // succeed or fail 6488 } catch(error) { 6489 return findOtherAuther(); 6490 } finally { 6491 // always runs 6492 // doesn't affect the return value 6493 } 6494 ``` 6495 6496 Asynchronous example: 6497 6498 ```js 6499 findAuthor().catch(function(reason){ 6500 return findOtherAuther(); 6501 }).finally(function(){ 6502 // author was either found, or not 6503 }); 6504 ``` 6505 6506 @method finally 6507 @param {Function} callback 6508 @return {Promise} 6509 */ 6510 6511 Promise.prototype["finally"] = function _finally(callback) { 6512 var promise = this; 6513 var constructor = promise.constructor; 6514 if (isFunction(callback)) { 6515 return promise.then(function (value) { 6516 return constructor.resolve(callback()).then(function () { 6517 return value; 6518 }); 6519 }, function (reason) { 6520 return constructor.resolve(callback()).then(function () { 6521 throw reason; 6522 }); 6523 }); 6524 } 6525 return promise.then(callback, callback); 6526 }; 6527 return Promise; 6528 }(); 6529 Promise$1.prototype.then = then; 6530 Promise$1.all = all; 6531 Promise$1.race = race; 6532 Promise$1.resolve = resolve$1; 6533 Promise$1.reject = reject$1; 6534 Promise$1._setScheduler = setScheduler; 6535 Promise$1._setAsap = setAsap; 6536 Promise$1._asap = asap; 6537 6538 /*global self*/ 6539 function polyfill() { 6540 var local = void 0; 6541 if (typeof global !== 'undefined') { 6542 local = global; 6543 } else if (typeof self !== 'undefined') { 6544 local = self; 6545 } else {
6546 try { 6547 local = Function('return this')(); 6548 } catch (e) { 6549 throw new Error('polyfill failed because global object is unavailable in this environment'); 6550 } 6551 } 6552 var P = local.Promise; 6553 if (P) { 6554 var promiseToString = null; 6555 try { 6556 promiseToString = Object.prototype.toString.call(P.resolve()); 6557 } catch (e) { 6558 // silently ignored 6559 } 6560 if (promiseToString === '[object Promise]' && !P.cast) { 6561 return; 6562 } 6563 } 6564 local.Promise = Promise$1; 6565 } 6566 6567 // Strange compat.. 6568 Promise$1.polyfill = polyfill; 6569 Promise$1.Promise = Promise$1; 6570 return Promise$1; 6571}); 6572 6573}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 6574},{"_process":33}],12:[function(require,module,exports){ 6575function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 6576function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 6577/* flatpickr v4.6.13, @license MIT */ 6578(function (global, factory) { 6579 (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.flatpickr = factory()); 6580})(this, function () { 6581 'use strict'; 6582 6583 /*! ***************************************************************************** 6584 Copyright (c) Microsoft Corporation. 6585 Permission to use, copy, modify, and/or distribute this software for any 6586 purpose with or without fee is hereby granted. 6587 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 6588 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 6589 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 6590 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 6591 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 6592 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 6593 PERFORMANCE OF THIS SOFTWARE. 6594 ***************************************************************************** */ 6595 var _assign = function __assign() { 6596 _assign = Object.assign || function __assign(t) { 6597 for (var s, i = 1, n = arguments.length; i < n; i++) { 6598 s = arguments[i]; 6599 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 6600 } 6601 return t; 6602 }; 6603 return _assign.apply(this, arguments); 6604 }; 6605 function __spreadArrays() { 6606 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; 6607 for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; 6608 return r; 6609 } 6610 var HOOKS = ["onChange", "onClose", "onDayCreate", "onDestroy", "onKeyDown", "onMonthChange", "onOpen", "onParseConfig", "onReady", "onValueUpdate", "onYearChange", "onPreCalendarPosition"]; 6611 var defaults = { 6612 _disable: [], 6613 allowInput: false, 6614 allowInvalidPreload: false, 6615 altFormat: "F j, Y", 6616 altInput: false, 6617 altInputClass: "form-control input", 6618 animate: (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && window.navigator.userAgent.indexOf("MSIE") === -1, 6619 ariaDateFormat: "F j, Y", 6620 autoFillDefaultTime: true, 6621 clickOpens: true, 6622 closeOnSelect: true, 6623 conjunction: ", ", 6624 dateFormat: "Y-m-d", 6625 defaultHour: 12, 6626 defaultMinute: 0, 6627 defaultSeconds: 0, 6628 disable: [], 6629 disableMobile: false, 6630 enableSeconds: false, 6631 enableTime: false, 6632 errorHandler: function errorHandler(err) { 6633 return typeof console !== "undefined" && console.warn(err); 6634 }, 6635 getWeek: function getWeek(givenDate) { 6636 var date = new Date(givenDate.getTime()); 6637 date.setHours(0, 0, 0, 0); 6638 // Thursday in current week decides the year. 6639 date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7); 6640 // January 4 is always in week 1. 6641 var week1 = new Date(date.getFullYear(), 0, 4); 6642 // Adjust to Thursday in week 1 and count number of weeks from date to week1. 6643 return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7); 6644 }, 6645 hourIncrement: 1, 6646 ignoredFocusElements: [], 6647 inline: false, 6648 locale: "default", 6649 minuteIncrement: 5, 6650 mode: "single", 6651 monthSelectorType: "dropdown", 6652 nextArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewB
6652ox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>", 6653 noCalendar: false, 6654 now: new Date(), 6655 onChange: [], 6656 onClose: [], 6657 onDayCreate: [], 6658 onDestroy: [], 6659 onKeyDown: [], 6660 onMonthChange: [], 6661 onOpen: [], 6662 onParseConfig: [], 6663 onReady: [], 6664 onValueUpdate: [], 6665 onYearChange: [], 6666 onPreCalendarPosition: [], 6667 plugins: [], 6668 position: "auto", 6669 positionElement: undefined, 6670 prevArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>", 6671 shorthandCurrentMonth: false, 6672 showMonths: 1, 6673 "static": false, 6674 time_24hr: false, 6675 weekNumbers: false, 6676 wrap: false 6677 }; 6678 var english = { 6679 weekdays: { 6680 shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 6681 longhand: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] 6682 }, 6683 months: { 6684 shorthand: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], 6685 longhand: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
6685November", "December"] 6686 }, 6687 daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], 6688 firstDayOfWeek: 0, 6689 ordinal: function ordinal(nth) { 6690 var s = nth % 100; 6691 if (s > 3 && s < 21) return "th"; 6692 switch (s % 10) { 6693 case 1: 6694 return "st"; 6695 case 2: 6696 return "nd"; 6697 case 3: 6698 return "rd"; 6699 default: 6700 return "th"; 6701 } 6702 }, 6703 rangeSeparator: " to ", 6704 weekAbbreviation: "Wk", 6705 scrollTitle: "Scroll to increment", 6706 toggleTitle: "Click to toggle", 6707 amPM: ["AM", "PM"], 6708 yearAriaLabel: "Year", 6709 monthAriaLabel: "Month", 6710 hourAriaLabel: "Hour", 6711 minuteAriaLabel: "Minute", 6712 time_24hr: false 6713 }; 6714 var pad = function pad(number, length) { 6715 if (length === void 0) { 6716 length = 2; 6717 } 6718 return ("000" + number).slice(length * -1); 6719 }; 6720 var _int = function _int(bool) { 6721 return bool === true ? 1 : 0; 6722 }; 6723 /* istanbul ignore next */ 6724 function debounce(fn, wait) { 6725 var t; 6726 return function () { 6727 var _this = this; 6728 var args = arguments; 6729 clearTimeout(t); 6730 t = setTimeout(function () { 6731 return fn.apply(_this, args); 6732 }, wait); 6733 }; 6734 } 6735 var arrayify = function arrayify(obj) { 6736 return obj instanceof Array ? obj : [obj]; 6737 }; 6738 function toggleClass(elem, className, bool) { 6739 if (bool === true) return elem.classList.add(className); 6740 elem.classList.remove(className); 6741 } 6742 function createElement(tag, className, content) { 6743 var e = window.document.createElement(tag); 6744 className = className || ""; 6745 content = content || ""; 6746 e.className = className; 6747 if (content !== undefined) e.textContent = content; 6748 return e; 6749 } 6750 function clearNode(node) { 6751 while (node.firstChild) node.removeChild(node.firstChild); 6752 } 6753 function findParent(node, condition) { 6754 if (condition(node)) return node;else if (node.parentNode) return findParent(node.parentNode, condition); 6755 return undefined; // nothing found 6756 } 6757 function createNumberInput(inputClassName, opts) { 6758 var wrapper = createElement("div", "numInputWrapper"), 6759 numInput = createElement("input", "numInput " + inputClassName), 6760 arrowUp = createElement("span", "arrowUp"), 6761 arrowDown = createElement("span", "arrowDown"); 6762 if (navigator.userAgent.indexOf("MSIE 9.0") === -1) { 6763 numInput.type = "number"; 6764 } else { 6765 numInput.type = "text"; 6766 numInput.pattern = "\\d*"; 6767 } 6768 if (opts !== undefined) for (var key in opts) numInput.setAttribute(key, opts[key]); 6769 wrapper.appendChild(numInput); 6770 wrapper.appendChild(arrowUp); 6771 wrapper.appendChild(arrowDown); 6772 return wrapper; 6773 } 6774 function getEventTarget(event) { 6775 try { 6776 if (typeof event.composedPath === "function") { 6777 var path = event.composedPath(); 6778 return path[0]; 6779 } 6780 return event.target; 6781 } catch (error) { 6782 return event.target; 6783 } 6784 } 6785 var doNothing = function doNothing() { 6786 return undefined; 6787 }; 6788 var monthToStr = function monthToStr(monthNumber, shorthand, locale) { 6789 return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; 6790 }; 6791 var revFormat = { 6792 D: doNothing, 6793 F: function F(dateObj, monthName, locale) { 6794 dateObj.setMonth(locale.months.longhand.indexOf(monthName)); 6795 }, 6796 G: function G(dateObj, hour) { 6797 dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour)); 6798 }, 6799 H: function H(dateObj, hour) { 6800 dateObj.setHours(parseFloat(hour)); 6801 }, 6802 J: function J(dateObj, day) { 6803 dateObj.setDate(parseFloat(day)); 6804 }, 6805 K: function K(dateObj, amPM, locale) { 6806 dateObj.setHours(dateObj.getHours() % 12 + 12 * _int(new RegExp(locale.amPM[1], "i").test(amPM))); 6807 }, 6808 M: function M(dateObj, shortMonth, locale) { 6809 dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth)); 6810 }, 6811 S: function S(dateObj, seconds) { 6812 dateObj.setSeconds(parseFloat(seconds)); 6813 }, 6814 U: function U(_, unixSeconds) { 6815 return new Date(parseFloat(unixSeconds) * 1000); 6816 }, 6817 W: function W(dateObj, weekNum, locale) { 6818 var weekNumber = parseInt(weekNum); 6819 var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0); 6820 date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek); 6821 return date; 6822 }, 6823 Y: function Y(dateObj, year) { 6824 dateObj.setFullYear(parseFloat(year)); 6825 }, 6826 Z: function Z(_, ISODate) { 6827 return new Date(ISODate); 6828 }, 6829 d: function d(dateObj, day) { 6830 dateObj.setDate(parseFloat(day)); 6831 }, 6832 h: function h(dateObj, hour) { 6833 dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour)); 6834 }, 6835 i: function i(dateObj, minutes) { 6836 dateObj.setMinutes(parseFloat(minutes)); 6837 }, 6838 j: function j(dateObj, day) { 6839 dateObj.setDate(parseFloat(day)); 6840 }, 6841 l: doNothing, 6842 m: function m(dateObj, month) { 6843 dateObj.setMonth(parseFloat(month) - 1); 6844 }, 6845 n: function n(dateObj, month) { 6846 dateObj.setMonth(parseFloat(month) - 1); 6847 }, 6848 s: function s(dateObj, seconds) { 6849 dateObj.setSeconds(parseFloat(seconds)); 6850 }, 6851 u: function u(_, unixMillSeconds) { 6852 return new Date(parseFloat(unixMillSeconds)); 6853 }, 6854 w: doNothing, 6855 y: function y(dateObj, year) { 6856 dateObj.setFullYear(2000 + parseFloat(year)); 6857 } 6858 }; 6859 var tokenRegex = { 6860 D: "", 6861 F: "", 6862 G: "(\\d\\d|\\d)", 6863 H: "(\\d\\d|\\d)", 6864 J: "(\\d\\d|\\d)\\w+", 6865 K: "", 6866 M: "", 6867 S: "(\\d\\d|\\d)", 6868 U: "(.+)", 6869 W: "(\\d\\d|\\d)", 6870 Y: "(\\d{4})", 6871 Z: "(.+)", 6872 d: "(\\d\\d|\\d)", 6873 h: "(\\d\\d|\\d)", 6874 i: "(\\d\\d|\\d)", 6875 j: "(\\d\\d|\\d)", 6876 l: "", 6877 m: "(\\d\\d|\\d)", 6878 n: "(\\d\\d|\\d)", 6879 s: "(\\d\\d|\\d)", 6880 u: "(.+)", 6881 w: "(\\d\\d|\\d)", 6882 y: "(\\d{2})" 6883 }; 6884 var formats = { 6885 // get the date in UTC 6886 Z: function Z(date) { 6887 return date.toISOString(); 6888 }, 6889 // weekday name, short, e.g. Thu 6890 D: function D(date, locale, options) { 6891 return locale.weekdays.shorthand[formats.w(date, locale, options)]; 6892 }, 6893 // full month name e.g. January 6894 F: function F(date, locale, options) { 6895 return monthToStr(formats.n(date, locale, options) - 1, false, locale); 6896 }, 6897 // padded hour 1-12 6898 G: function G(date, locale, options) { 6899 return pad(formats.h(date, locale, options)); 6900 }, 6901 // hours with leading zero e.g. 03 6902 H: function H(date) { 6903 return pad(date.getHours()); 6904 }, 6905 // day (1-30) with ordinal suffix e.g. 1st, 2nd
vendor: 9,112 bytes, lines 6906-7168
6906 J: function J(date, locale) { 6907 return locale.ordinal !== undefined ? date.getDate() + locale.ordinal(date.getDate()) : date.getDate(); 6908 }, 6909 // AM/PM 6910 K: function K(date, locale) { 6911 return locale.amPM[_int(date.getHours() > 11)]; 6912 }, 6913 // shorthand month e.g. Jan, Sep, Oct, etc 6914 M: function M(date, locale) { 6915 return monthToStr(date.getMonth(), true, locale); 6916 }, 6917 // seconds 00-59 6918 S: function S(date) { 6919 return pad(date.getSeconds()); 6920 }, 6921 // unix timestamp 6922 U: function U(date) { 6923 return date.getTime() / 1000; 6924 }, 6925 W: function W(date, _, options) { 6926 return options.getWeek(date); 6927 }, 6928 // full year e.g. 2016, padded (0001-9999) 6929 Y: function Y(date) { 6930 return pad(date.getFullYear(), 4); 6931 }, 6932 // day in month, padded (01-30) 6933 d: function d(date) { 6934 return pad(date.getDate()); 6935 }, 6936 // hour from 1-12 (am/pm) 6937 h: function h(date) { 6938 return date.getHours() % 12 ? date.getHours() % 12 : 12; 6939 }, 6940 // minutes, padded with leading zero e.g. 09 6941 i: function i(date) { 6942 return pad(date.getMinutes()); 6943 }, 6944 // day in month (1-30) 6945 j: function j(date) { 6946 return date.getDate(); 6947 }, 6948 // weekday name, full, e.g. Thursday 6949 l: function l(date, locale) { 6950 return locale.weekdays.longhand[date.getDay()]; 6951 }, 6952 // padded month number (01-12) 6953 m: function m(date) { 6954 return pad(date.getMonth() + 1); 6955 }, 6956 // the month number (1-12) 6957 n: function n(date) { 6958 return date.getMonth() + 1; 6959 }, 6960 // seconds 0-59 6961 s: function s(date) { 6962 return date.getSeconds(); 6963 }, 6964 // Unix Milliseconds 6965 u: function u(date) { 6966 return date.getTime(); 6967 }, 6968 // number of the day of the week 6969 w: function w(date) { 6970 return date.getDay(); 6971 }, 6972 // last two digits of year e.g. 16 for 2016 6973 y: function y(date) { 6974 return String(date.getFullYear()).substring(2); 6975 } 6976 }; 6977 var createDateFormatter = function createDateFormatter(_a) { 6978 var _b = _a.config, 6979 config = _b === void 0 ? defaults : _b, 6980 _c = _a.l10n, 6981 l10n = _c === void 0 ? english : _c, 6982 _d = _a.isMobile, 6983 isMobile = _d === void 0 ? false : _d; 6984 return function (dateObj, frmt, overrideLocale) { 6985 var locale = overrideLocale || l10n; 6986 if (config.formatDate !== undefined && !isMobile) { 6987 return config.formatDate(dateObj, frmt, locale); 6988 } 6989 return frmt.split("").map(function (c, i, arr) { 6990 return formats[c] && arr[i - 1] !== "\\" ? formats[c](dateObj, locale, config) : c !== "\\" ? c : ""; 6991 }).join(""); 6992 }; 6993 }; 6994 var createDateParser = function createDateParser(_a) { 6995 var _b = _a.config, 6996 config = _b === void 0 ? defaults : _b, 6997 _c = _a.l10n, 6998 l10n = _c === void 0 ? english : _c; 6999 return function (date, givenFormat, timeless, customLocale) { 7000 if (date !== 0 && !date) return undefined; 7001 var locale = customLocale || l10n; 7002 var parsedDate; 7003 var dateOrig = date; 7004 if (date instanceof Date) parsedDate = new Date(date.getTime());else if (typeof date !== "string" && date.toFixed !== undefined // timestamp 7005 ) 7006 // create a copy 7007 parsedDate = new Date(date);else if (typeof date === "string") { 7008 // date string 7009 var format = givenFormat || (config || defaults).dateFormat; 7010 var datestr = String(date).trim(); 7011 if (datestr === "today") { 7012 parsedDate = new Date(); 7013 timeless = true; 7014 } else if (config && config.parseDate) { 7015 parsedDate = config.parseDate(date, format); 7016 } else if (/Z$/.test(datestr) || /GMT$/.test(datestr) // datestrings w/ timezone 7017 ) { 7018 parsedDate = new Date(date); 7019 } else { 7020 var matched = void 0, 7021 ops = []; 7022 for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) { 7023 var token_1 = format[i]; 7024 var isBackSlash = token_1 === "\\"; 7025 var escaped = format[i - 1] === "\\" || isBackSlash; 7026 if (tokenRegex[token_1] && !escaped) { 7027 regexStr += tokenRegex[token_1]; 7028 var match = new RegExp(regexStr).exec(date); 7029 if (match && (matched = true)) { 7030 ops[token_1 !== "Y" ? "push" : "unshift"]({ 7031 fn: revFormat[token_1], 7032 val: match[++matchIndex] 7033 }); 7034 } 7035 } else if (!isBackSlash) regexStr += "."; // don't really care 7036 } 7037 parsedDate = !config || !config.noCalendar ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) : new Date(new Date().setHours(0, 0, 0, 0)); 7038 ops.forEach(function (_a) { 7039 var fn = _a.fn, 7040 val = _a.val; 7041 return parsedDate = fn(parsedDate, val, locale) || parsedDate; 7042 }); 7043 parsedDate = matched ? parsedDate : undefined; 7044 } 7045 } 7046 /* istanbul ignore next */ 7047 if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) { 7048 config.errorHandler(new Error("Invalid date provided: " + dateOrig)); 7049 return undefined; 7050 } 7051 if (timeless === true) parsedDate.setHours(0, 0, 0, 0); 7052 return parsedDate; 7053 }; 7054 }; 7055 /** 7056 * Compute the difference in dates, measured in ms 7057 */ 7058 function compareDates(date1, date2, timeless) { 7059 if (timeless === void 0) { 7060 timeless = true; 7061 } 7062 if (timeless !== false) { 7063 return new Date(date1.getTime()).setHours(0, 0, 0, 0) - new Date(date2.getTime()).setHours(0, 0, 0, 0); 7064 } 7065 return date1.getTime() - date2.getTime(); 7066 } 7067 var isBetween = function isBetween(ts, ts1, ts2) { 7068 return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2); 7069 }; 7070 var calculateSecondsSinceMidnight = function calculateSecondsSinceMidnight(hours, minutes, seconds) { 7071 return hours * 3600 + minutes * 60 + seconds; 7072 }; 7073 var parseSeconds = function parseSeconds(secondsSinceMidnight) { 7074 var hours = Math.floor(secondsSinceMidnight / 3600), 7075 minutes = (secondsSinceMidnight - hours * 3600) / 60; 7076 return [hours, minutes, secondsSinceMidnight - hours * 3600 - minutes * 60]; 7077 }; 7078 var duration = { 7079 DAY: 86400000 7080 }; 7081 function getDefaultHours(config) { 7082 var hours = config.defaultHour; 7083 var minutes = config.defaultMinute; 7084 var seconds = config.defaultSeconds; 7085 if (config.minDate !== undefined) { 7086 var minHour = config.minDate.getHours(); 7087 var minMinutes = config.minDate.getMinutes(); 7088 var minSeconds = config.minDate.getSeconds(); 7089 if (hours < minHour) { 7090 hours = minHour; 7091 } 7092 if (hours === minHour && minutes < minMinutes) { 7093 minutes = minMinutes; 7094 } 7095 if (hours === minHour && minutes === minMinutes && seconds < minSeconds) seconds = config.minDate.getSeconds(); 7096 } 7097 if (config.maxDate !== undefined) { 7098 var maxHr = config.maxDate.getHours(); 7099 var maxMinutes = config.maxDate.getMinutes(); 7100 hours = Math.min(hours, maxHr); 7101 if (hours === maxHr) minutes = Math.min(maxMinutes, minutes); 7102 if (hours === maxHr && minutes === maxMinutes) seconds = config.maxDate.getSeconds(); 7103 } 7104 return { 7105 hours: hours, 7106 minutes: minutes, 7107 seconds: seconds 7108 }; 7109 } 7110 if (typeof Object.assign !== "function") { 7111 Object.assign = function (target) { 7112 var args = []; 7113 for (var _i = 1; _i < arguments.length; _i++) { 7114 args[_i - 1] = arguments[_i]; 7115 } 7116 if (!target) { 7117 throw TypeError("Cannot convert undefined or null to object"); 7118 } 7119 var _loop_1 = function _loop_1(source) { 7120 if (source) { 7121 Object.keys(source).forEach(function (key) { 7122 return target[key] = source[key]; 7123 }); 7124 } 7125 }; 7126 for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { 7127 var source = args_1[_a]; 7128 _loop_1(source); 7129 } 7130 return target; 7131 }; 7132 } 7133 var DEBOUNCED_CHANGE_MS = 300; 7134 function FlatpickrInstance(element, instanceConfig) { 7135 var self = { 7136 config: _assign(_assign({}, defaults), flatpickr.defaultConfig), 7137 l10n: english 7138 }; 7139 self.parseDate = createDateParser({ 7140 config: self.config, 7141 l10n: self.l10n 7142 }); 7143 self._handlers = []; 7144 self.pluginElements = []; 7145 self.loadedPlugins = []; 7146 self._bind = bind; 7147 self._setHoursFromDate = setHoursFromDate; 7148 self._positionCalendar = positionCalendar; 7149 self.changeMonth = changeMonth; 7150 self.changeYear = changeYear; 7151 self.clear = clear; 7152 self.close = close; 7153 self.onMouseOver = onMouseOver; 7154 self._createElement = createElement; 7155 self.createDay = createDay; 7156 self.destroy = destroy; 7157 self.isEnabled = isEnabled; 7158 self.jumpToDate = jumpToDate; 7159 self.updateValue = updateValue; 7160 self.open = open; 7161 self.redraw = redraw; 7162 self.set = set; 7163 self.setDate = setDate; 7164 self.toggle = toggle; 7165 function setupHelperFunctions() { 7166 self.utils = { 7167 getDaysInMonth: function getDaysInMonth(month, yr) { 7168 if (month === void 0) {
vendor: 9,341 bytes, lines 7169-7384
7169 month = self.currentMonth; 7170 } 7171 if (yr === void 0) { 7172 yr = self.currentYear; 7173 } 7174 if (month === 1 && (yr % 4 === 0 && yr % 100 !== 0 || yr % 400 === 0)) return 29; 7175 return self.l10n.daysInMonth[month]; 7176 } 7177 }; 7178 } 7179 function init() { 7180 self.element = self.input = element; 7181 self.isOpen = false; 7182 parseConfig(); 7183 setupLocale(); 7184 setupInputs(); 7185 setupDates(); 7186 setupHelperFunctions(); 7187 if (!self.isMobile) build(); 7188 bindEvents(); 7189 if (self.selectedDates.length || self.config.noCalendar) { 7190 if (self.config.enableTime) { 7191 setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj : undefined); 7192 } 7193 updateValue(false); 7194 } 7195 setCalendarWidth(); 7196 var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); 7197 /* TODO: investigate this further 7198 Currently, there is weird positioning behavior in safari causing pages 7199 to scroll up. https://github.com/chmln/flatpickr/issues/563 7200 However, most browsers are not Safari and positioning is expensive when used 7201 in scale. https://github.com/chmln/flatpickr/issues/1096 7202 */ 7203 if (!self.isMobile && isSafari) { 7204 positionCalendar(); 7205 } 7206 triggerEvent("onReady"); 7207 } 7208 function getClosestActiveElement() { 7209 var _a; 7210 return ((_a = self.calendarContainer) === null || _a === void 0 ? void 0 : _a.getRootNode()).activeElement || document.activeElement; 7211 } 7212 function bindToInstance(fn) { 7213 return fn.bind(self); 7214 } 7215 function setCalendarWidth() { 7216 var config = self.config; 7217 if (config.weekNumbers === false && config.showMonths === 1) { 7218 return; 7219 } else if (config.noCalendar !== true) { 7220 window.requestAnimationFrame(function () { 7221 if (self.calendarContainer !== undefined) { 7222 self.calendarContainer.style.visibility = "hidden"; 7223 self.calendarContainer.style.display = "block"; 7224 } 7225 if (self.daysContainer !== undefined) { 7226 var daysWidth = (self.days.offsetWidth + 1) * config.showMonths; 7227 self.daysContainer.style.width = daysWidth + "px"; 7228 self.calendarContainer.style.width = daysWidth + (self.weekWrapper !== undefined ? self.weekWrapper.offsetWidth : 0) + "px"; 7229 self.calendarContainer.style.removeProperty("visibility"); 7230 self.calendarContainer.style.removeProperty("display"); 7231 } 7232 }); 7233 } 7234 } 7235 /** 7236 * The handler for all events targeting the time inputs 7237 */ 7238 function updateTime(e) { 7239 if (self.selectedDates.length === 0) { 7240 var defaultDate = self.config.minDate === undefined || compareDates(new Date(), self.config.minDate) >= 0 ? new Date() : new Date(self.config.minDate.getTime()); 7241 var defaults = getDefaultHours(self.config); 7242 defaultDate.setHours(defaults.hours, defaults.minutes, defaults.seconds, defaultDate.getMilliseconds()); 7243 self.selectedDates = [defaultDate]; 7244 self.latestSelectedDateObj = defaultDate; 7245 } 7246 if (e !== undefined && e.type !== "blur") { 7247 timeWrapper(e); 7248 } 7249 var prevValue = self._input.value; 7250 setHoursFromInputs(); 7251 updateValue(); 7252 if (self._input.value !== prevValue) { 7253 self._debouncedChange(); 7254 } 7255 } 7256 function ampm2military(hour, amPM) { 7257 return hour % 12 + 12 * _int(amPM === self.l10n.amPM[1]); 7258 } 7259 function military2ampm(hour) { 7260 switch (hour % 24) { 7261 case 0: 7262 case 12: 7263 return 12; 7264 default: 7265 return hour % 12; 7266 } 7267 } 7268 /** 7269 * Syncs the selected date object time with user's time input 7270 */ 7271 function setHoursFromInputs() { 7272 if (self.hourElement === undefined || self.minuteElement === undefined) return; 7273 var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, 7274 minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, 7275 seconds = self.secondElement !== undefined ? (parseInt(self.secondElement.value, 10) || 0) % 60 : 0; 7276 if (self.amPM !== undefined) { 7277 hours = ampm2military(hours, self.amPM.textContent); 7278 } 7279 var limitMinHours = self.config.minTime !== undefined || self.config.minDate && self.minDateHasTime && self.latestSelectedDateObj && compareDates(self.latestSelectedDateObj, self.config.minDate, true) === 0; 7280 var limitMaxHours = self.config.maxTime !== undefined || self.config.maxDate && self.maxDateHasTime && self.latestSelectedDateObj && compareDates(self.latestSelectedDateObj, self.config.maxDate, true) === 0; 7281 if (self.config.maxTime !== undefined && self.config.minTime !== undefined && self.config.minTime > self.config.maxTime) { 7282 var minBound = calculateSecondsSinceMidnight(self.config.minTime.getHours(), self.config.minTime.getMinutes(), self.config.minTime.getSeconds()); 7283 var maxBound = calculateSecondsSinceMidnight(self.config.maxTime.getHours(), self.config.maxTime.getMinutes(), self.config.maxTime.getSeconds()); 7284 var currentTime = calculateSecondsSinceMidnight(hours, minutes, seconds); 7285 if (currentTime > maxBound && currentTime < minBound) { 7286 var result = parseSeconds(minBound); 7287 hours = result[0]; 7288 minutes = result[1]; 7289 seconds = result[2]; 7290 } 7291 } else { 7292 if (limitMaxHours) { 7293 var maxTime = self.config.maxTime !== undefined ? self.config.maxTime : self.config.maxDate; 7294 hours = Math.min(hours, maxTime.getHours()); 7295 if (hours === maxTime.getHours()) minutes = Math.min(minutes, maxTime.getMinutes()); 7296 if (minutes === maxTime.getMinutes()) seconds = Math.min(seconds, maxTime.getSeconds()); 7297 } 7298 if (limitMinHours) { 7299 var minTime = self.config.minTime !== undefined ? self.config.minTime : self.config.minDate; 7300 hours = Math.max(hours, minTime.getHours()); 7301 if (hours === minTime.getHours() && minutes < minTime.getMinutes()) minutes = minTime.getMinutes(); 7302 if (minutes === minTime.getMinutes()) seconds = Math.max(seconds, minTime.getSeconds()); 7303 } 7304 } 7305 setHours(hours, minutes, seconds); 7306 } 7307 /** 7308 * Syncs time input values with a date 7309 */ 7310 function setHoursFromDate(dateObj) { 7311 var date = dateObj || self.latestSelectedDateObj; 7312 if (date && date instanceof Date) { 7313 setHours(date.getHours(), date.getMinutes(), date.getSeconds()); 7314 } 7315 } 7316 /** 7317 * Sets the hours, minutes, and optionally seconds 7318 * of the latest selected date object and the 7319 * corresponding time inputs 7320 * @param {Number} hours the hour. whether its military 7321 * or am-pm gets inferred from config 7322 * @param {Number} minutes the minutes 7323 * @param {Number} seconds the seconds (optional) 7324 */ 7325 function setHours(hours, minutes, seconds) { 7326 if (self.latestSelectedDateObj !== undefined) { 7327 self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0); 7328 } 7329 if (!self.hourElement || !self.minuteElement || self.isMobile) return; 7330 self.hourElement.value = pad(!self.config.time_24hr ? (12 + hours) % 12 + 12 * _int(hours % 12 === 0) : hours); 7331 self.minuteElement.value = pad(minutes); 7332 if (self.amPM !== undefined) self.amPM.textContent = self.l10n.amPM[_int(hours >= 12)]; 7333 if (self.secondElement !== undefined) self.secondElement.value = pad(seconds); 7334 } 7335 /** 7336 * Handles the year input and incrementing events 7337 * @param {Event} event the keyup or increment event 7338 */ 7339 function onYearInput(event) { 7340 var eventTarget = getEventTarget(event); 7341 var year = parseInt(eventTarget.value) + (event.delta || 0); 7342 if (year / 1000 > 1 || event.key === "Enter" && !/[^\d]/.test(year.toString())) { 7343 changeYear(year); 7344 } 7345 } 7346 /** 7347 * Essentially addEventListener + tracking 7348 * @param {Element} element the element to addEventListener to 7349 * @param {String} event the event name 7350 * @param {Function} handler the event handler 7351 */ 7352 function bind(element, event, handler, options) { 7353 if (event instanceof Array) return event.forEach(function (ev) { 7354 return bind(element, ev, handler, options); 7355 }); 7356 if (element instanceof Array) return element.forEach(function (el) { 7357 return bind(el, event, handler, options); 7358 }); 7359 element.addEventListener(event, handler, options); 7360 self._handlers.push({ 7361 remove: function remove() { 7362 return element.removeEventListener(event, handler, options); 7363 } 7364 }); 7365 } 7366 function triggerChange() { 7367 triggerEvent("onChange"); 7368 } 7369 /** 7370 * Adds all the necessary event listeners 7371 */ 7372 function bindEvents() { 7373 if (self.config.wrap) { 7374 ["open", "close", "toggle", "clear"].forEach(function (evt) { 7375 Array.prototype.forEach.call(self.element.querySelectorAll("[data-" + evt + "]"), function (el) { 7376 return bind(el, "click", self[evt]); 7377 }); 7378 }); 7379 } 7380 if (self.isMobile) { 7381 setupMobile(); 7382 return; 7383 } 7384 var debouncedResize = debounce(onResize, 50);
vendor: 35,155 bytes, lines 7385-8109
7385 self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS); 7386 if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent)) bind(self.daysContainer, "mouseover", function (e) { 7387 if (self.config.mode === "range") onMouseOver(getEventTarget(e)); 7388 }); 7389 bind(self._input, "keydown", onKeyDown); 7390 if (self.calendarContainer !== undefined) { 7391 bind(self.calendarContainer, "keydown", onKeyDown); 7392 } 7393 if (!self.config.inline && !self.config["static"]) bind(window, "resize", debouncedResize); 7394 if (window.ontouchstart !== undefined) bind(window.document, "touchstart", documentClick);else bind(window.document, "mousedown", documentClick); 7395 bind(window.document, "focus", documentClick, { 7396 capture: true 7397 }); 7398 if (self.config.clickOpens === true) { 7399 bind(self._input, "focus", self.open); 7400 bind(self._input, "click", self.open); 7401 } 7402 if (self.daysContainer !== undefined) { 7403 bind(self.monthNav, "click", onMonthNavClick); 7404 bind(self.monthNav, ["keyup", "increment"], onYearInput); 7405 bind(self.daysContainer, "click", selectDate); 7406 } 7407 if (self.timeContainer !== undefined && self.minuteElement !== undefined && self.hourElement !== undefined) { 7408 var selText = function selText(e) { 7409 return getEventTarget(e).select(); 7410 }; 7411 bind(self.timeContainer, ["increment"], updateTime); 7412 bind(self.timeContainer, "blur", updateTime, { 7413 capture: true 7414 }); 7415 bind(self.timeContainer, "click", timeIncrement); 7416 bind([self.hourElement, self.minuteElement], ["focus", "click"], selText); 7417 if (self.secondElement !== undefined) bind(self.secondElement, "focus", function () { 7418 return self.secondElement && self.secondElement.select(); 7419 }); 7420 if (self.amPM !== undefined) { 7421 bind(self.amPM, "click", function (e) { 7422 updateTime(e); 7423 }); 7424 } 7425 } 7426 if (self.config.allowInput) { 7427 bind(self._input, "blur", onBlur); 7428 } 7429 } 7430 /** 7431 * Set the calendar view to a particular date. 7432 * @param {Date} jumpDate the date to set the view to 7433 * @param {boolean} triggerChange if change events should be triggered 7434 */ 7435 function jumpToDate(jumpDate, triggerChange) { 7436 var jumpTo = jumpDate !== undefined ? self.parseDate(jumpDate) : self.latestSelectedDateObj || (self.config.minDate && self.config.minDate > self.now ? self.config.minDate : self.config.maxDate && self.config.maxDate < self.now ? self.config.maxDate : self.now); 7437 var oldYear = self.currentYear; 7438 var oldMonth = self.currentMonth; 7439 try { 7440 if (jumpTo !== undefined) { 7441 self.currentYear = jumpTo.getFullYear(); 7442 self.currentMonth = jumpTo.getMonth(); 7443 } 7444 } catch (e) { 7445 /* istanbul ignore next */ 7446 e.message = "Invalid date supplied: " + jumpTo; 7447 self.config.errorHandler(e); 7448 } 7449 if (triggerChange && self.currentYear !== oldYear) { 7450 triggerEvent("onYearChange"); 7451 buildMonthSwitch(); 7452 } 7453 if (triggerChange && (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) { 7454 triggerEvent("onMonthChange"); 7455 } 7456 self.redraw(); 7457 } 7458 /** 7459 * The up/down arrow handler for time inputs 7460 * @param {Event} e the click event 7461 */ 7462 function timeIncrement(e) { 7463 var eventTarget = getEventTarget(e); 7464 if (~eventTarget.className.indexOf("arrow")) incrementNumInput(e, eventTarget.classList.contains("arrowUp") ? 1 : -1); 7465 } 7466 /** 7467 * Increments/decrements the value of input associ- 7468 * ated with the up/down arrow by dispatching an 7469 * "increment" event on the input. 7470 * 7471 * @param {Event} e the click event 7472 * @param {Number} delta the diff (usually 1 or -1) 7473 * @param {Element} inputElem the input element 7474 */ 7475 function incrementNumInput(e, delta, inputElem) { 7476 var target = e && getEventTarget(e); 7477 var input = inputElem || target && target.parentNode && target.parentNode.firstChild; 7478 var event = createEvent("increment"); 7479 event.delta = delta; 7480 input && input.dispatchEvent(event); 7481 } 7482 function build() { 7483 var fragment = window.document.createDocumentFragment(); 7484 self.calendarContainer = createElement("div", "flatpickr-calendar"); 7485 self.calendarContainer.tabIndex = -1; 7486 if (!self.config.noCalendar) { 7487 fragment.appendChild(buildMonthNav()); 7488 self.innerContainer = createElement("div", "flatpickr-innerContainer"); 7489 if (self.config.weekNumbers) { 7490 var _a = buildWeeks(), 7491 weekWrapper = _a.weekWrapper, 7492 weekNumbers = _a.weekNumbers; 7493 self.innerContainer.appendChild(weekWrapper); 7494 self.weekNumbers = weekNumbers; 7495 self.weekWrapper = weekWrapper; 7496 } 7497 self.rContainer = createElement("div", "flatpickr-rContainer"); 7498 self.rContainer.appendChild(buildWeekdays()); 7499 if (!self.daysContainer) { 7500 self.daysContainer = createElement("div", "flatpickr-days"); 7501 self.daysContainer.tabIndex = -1; 7502 } 7503 buildDays(); 7504 self.rContainer.appendChild(self.daysContainer); 7505 self.innerContainer.appendChild(self.rContainer); 7506 fragment.appendChild(self.innerContainer); 7507 } 7508 if (self.config.enableTime) { 7509 fragment.appendChild(buildTime()); 7510 } 7511 toggleClass(self.calendarContainer, "rangeMode", self.config.mode === "range"); 7512 toggleClass(self.calendarContainer, "animate", self.config.animate === true); 7513 toggleClass(self.calendarContainer, "multiMonth", self.config.showMonths > 1); 7514 self.calendarContainer.appendChild(fragment); 7515 var customAppend = self.config.appendTo !== undefined && self.config.appendTo.nodeType !== undefined; 7516 if (self.config.inline || self.config["static"]) { 7517 self.calendarContainer.classList.add(self.config.inline ? "inline" : "static"); 7518 if (self.config.inline) { 7519 if (!customAppend && self.element.parentNode) self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);else if (self.config.appendTo !== undefined) self.config.appendTo.appendChild(self.calendarContainer); 7520 } 7521 if (self.config["static"]) { 7522 var wrapper = createElement("div", "flatpickr-wrapper"); 7523 if (self.element.parentNode) self.element.parentNode.insertBefore(wrapper, self.element); 7524 wrapper.appendChild(self.element); 7525 if (self.altInput) wrapper.appendChild(self.altInput); 7526 wrapper.appendChild(self.calendarContainer); 7527 } 7528 } 7529 if (!self.config["static"] && !self.config.inline) (self.config.appendTo !== undefined ? self.config.appendTo : window.document.body).appendChild(self.calendarContainer); 7530 } 7531 function createDay(className, date, _dayNumber, i) { 7532 var dateIsEnabled = isEnabled(date, true), 7533 dayElement = createElement("span", className, date.getDate().toString()); 7534 dayElement.dateObj = date; 7535 dayElement.$i = i; 7536 dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat)); 7537 if (className.indexOf("hidden") === -1 && compareDates(date, self.now) === 0) { 7538 self.todayDateElem = dayElement; 7539 dayElement.classList.add("today"); 7540 dayElement.setAttribute("aria-current", "date"); 7541 } 7542 if (dateIsEnabled) { 7543 dayElement.tabIndex = -1; 7544 if (isDateSelected(date)) { 7545 dayElement.classList.add("selected"); 7546 self.selectedDateElem = dayElement; 7547 if (self.config.mode === "range") { 7548 toggleClass(dayElement, "startRange", self.selectedDates[0] && compareDates(date, self.selectedDates[0], true) === 0); 7549 toggleClass(dayElement, "endRange", self.selectedDates[1] && compareDates(date, self.selectedDates[1], true) === 0); 7550 if (className === "nextMonthDay") dayElement.classList.add("inRange"); 7551 } 7552 } 7553 } else { 7554 dayElement.classList.add("flatpickr-disabled"); 7555 } 7556 if (self.config.mode === "range") { 7557 if (isDateInRange(date) && !isDateSelected(date)) dayElement.classList.add("inRange"); 7558 } 7559 if (self.weekNumbers && self.config.showMonths === 1 && className !== "prevMonthDay" && i % 7 === 6) { 7560 self.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + self.config.getWeek(date) + "</span>"); 7561 } 7562 triggerEvent("onDayCreate", dayElement); 7563 return dayElement; 7564 } 7565 function focusOnDayElem(targetNode) { 7566 targetNode.focus(); 7567 if (self.config.mode === "range") onMouseOver(targetNode); 7568 } 7569 function getFirstAvailableDay(delta) { 7570 var startMonth = delta > 0 ? 0 : self.config.showMonths - 1; 7571 var endMonth = delta > 0 ? self.config.showMonths : -1; 7572 for (var m = startMonth; m != endMonth; m += delta) { 7573 var month = self.daysContainer.children[m]; 7574 var startIndex = delta > 0 ? 0 : month.children.length - 1; 7575 var endIndex = delta > 0 ? month.children.length : -1; 7576 for (var i = startIndex; i != endIndex; i += delta) { 7577 var c = month.children[i]; 7578 if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj)) return c; 7579 } 7580 } 7581 return undefined; 7582 } 7583 function getNextAvailableDay(current, delta) { 7584 var givenMonth = current.className.indexOf("Month") === -1 ? current.dateObj.getMonth() : self.currentMonth; 7585 var endMonth = delta > 0 ? self.config.showMonths : -1; 7586 var loopDelta = delta > 0 ? 1 : -1; 7587 for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) { 7588 var month = self.daysContainer.children[m]; 7589 var startIndex = givenMonth - self.currentMonth === m ? current.$i + delta : delta < 0 ? month.children.length - 1 : 0; 7590 var numMonthDays = month.children.length; 7591 for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) { 7592 var c = month.children[i]; 7593 if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj) && Math.abs(current.$i - i) >= Math.abs(delta)) return focusOnDayElem(c); 7594 } 7595 } 7596 self.changeMonth(loopDelta); 7597 focusOnDay(getFirstAvailableDay(loopDelta), 0); 7598 return undefined; 7599 } 7600 function focusOnDay(current, offset) { 7601 var activeElement = getClosestActiveElement(); 7602 var dayFocused = isInView(activeElement || document.body); 7603 var startElem = current !== undefined ? current : dayFocused ? activeElement : self.selectedDateElem !== undefined && isInView(self.selectedDateElem) ? self.selectedDateElem : self.todayDateElem !== undefined && isInView(self.todayDateElem) ? self.todayDateElem : getFirstAvailableDay(offset > 0 ? 1 : -1); 7604 if (startElem === undefined) { 7605 self._input.focus(); 7606 } else if (!dayFocused) { 7607 focusOnDayElem(startElem); 7608 } else { 7609 getNextAvailableDay(startElem, offset); 7610 } 7611 } 7612 function buildMonthDays(year, month) { 7613 var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7; 7614 var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12, year); 7615 var daysInMonth = self.utils.getDaysInMonth(month, year), 7616 days = window.document.createDocumentFragment(), 7617 isMultiMonth = self.config.showMonths > 1, 7618 prevMonthDayClass = isMultiMonth ? "prevMonthDay hidden" : "prevMonthDay", 7619 nextMonthDayClass = isMultiMonth ? "nextMonthDay hidden" : "nextMonthDay"; 7620 var dayNumber = prevMonthDays + 1 - firstOfMonth, 7621 dayIndex = 0; 7622 // prepend days from the ending of previous month 7623 for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) { 7624 days.appendChild(createDay("flatpickr-day " + prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex)); 7625 } 7626 // Start at 1 since there is no 0th day 7627 for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) { 7628 days.appendChild(createDay("flatpickr-day", new Date(year, month, dayNumber), dayNumber, dayIndex)); 7629 } 7630 // append days from the next month 7631 for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth && (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) { 7632 days.appendChild(createDay("flatpickr-day " + nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex)); 7633 } 7634 //updateNavigationCurrentMonth(); 7635 var dayContainer = createElement("div", "dayContainer"); 7636 dayContainer.appendChild(days); 7637 return dayContainer; 7638 } 7639 function buildDays() { 7640 if (self.daysContainer === undefined) { 7641 return; 7642 } 7643 clearNode(self.daysContainer); 7644 // TODO: week numbers for each month 7645 if (self.weekNumbers) clearNode(self.weekNumbers); 7646 var frag = document.createDocumentFragment(); 7647 for (var i = 0; i < self.config.showMonths; i++) { 7648 var d = new Date(self.currentYear, self.currentMonth, 1); 7649 d.setMonth(self.currentMonth + i); 7650 frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth())); 7651 } 7652 self.daysContainer.appendChild(frag); 7653 self.days = self.daysContainer.firstChild; 7654 if (self.config.mode === "range" && self.selectedDates.length === 1) { 7655 onMouseOver(); 7656 } 7657 } 7658 function buildMonthSwitch() { 7659 if (self.config.showMonths > 1 || self.config.monthSelectorType !== "dropdown") return; 7660 var shouldBuildMonth = function shouldBuildMonth(month) { 7661 if (self.config.minDate !== undefined && self.currentYear === self.config.minDate.getFullYear() && month < self.config.minDate.getMonth()) { 7662 return false; 7663 } 7664 return !(self.config.maxDate !== undefined && self.currentYear === self.config.maxDate.getFullYear() && month > self.config.maxDate.getMonth()); 7665 }; 7666 self.monthsDropdownContainer.tabIndex = -1; 7667 self.monthsDropdownContainer.innerHTML = ""; 7668 for (var i = 0; i < 12; i++) { 7669 if (!shouldBuildMonth(i)) continue; 7670 var month = createElement("option", "flatpickr-monthDropdown-month"); 7671 month.value = new Date(self.currentYear, i).getMonth().toString(); 7672 month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n); 7673 month.tabIndex = -1; 7674 if (self.currentMonth === i) { 7675 month.selected = true; 7676 } 7677 self.monthsDropdownContainer.appendChild(month); 7678 } 7679 } 7680 function buildMonth() { 7681 var container = createElement("div", "flatpickr-month"); 7682 var monthNavFragment = window.document.createDocumentFragment(); 7683 var monthElement; 7684 if (self.config.showMonths > 1 || self.config.monthSelectorType === "static") { 7685 monthElement = createElement("span", "cur-month"); 7686 } else { 7687 self.monthsDropdownContainer = createElement("select", "flatpickr-monthDropdown-months"); 7688 self.monthsDropdownContainer.setAttribute("aria-label", self.l10n.monthAriaLabel); 7689 bind(self.monthsDropdownContainer, "change", function (e) { 7690 var target = getEventTarget(e); 7691 var selectedMonth = parseInt(target.value, 10); 7692 self.changeMonth(selectedMonth - self.currentMonth); 7693 triggerEvent("onMonthChange"); 7694 }); 7695 buildMonthSwitch(); 7696 monthElement = self.monthsDropdownContainer; 7697 } 7698 var yearInput = createNumberInput("cur-year", { 7699 tabindex: "-1" 7700 }); 7701 var yearElement = yearInput.getElementsByTagName("input")[0]; 7702 yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel); 7703 if (self.config.minDate) { 7704 yearElement.setAttribute("min", self.config.minDate.getFullYear().toString()); 7705 } 7706 if (self.config.maxDate) { 7707 yearElement.setAttribute("max", self.config.maxDate.getFullYear().toString()); 7708 yearElement.disabled = !!self.config.minDate && self.config.minDate.getFullYear() === self.config.maxDate.getFullYear(); 7709 } 7710 var currentMonth = createElement("div", "flatpickr-current-month"); 7711 currentMonth.appendChild(monthElement); 7712 currentMonth.appendChild(yearInput); 7713 monthNavFragment.appendChild(currentMonth); 7714 container.appendChild(monthNavFragment); 7715 return { 7716 container: container, 7717 yearElement: yearElement, 7718 monthElement: monthElement 7719 }; 7720 } 7721 function buildMonths() { 7722 clearNode(self.monthNav); 7723 self.monthNav.appendChild(self.prevMonthNav); 7724 if (self.config.showMonths) { 7725 self.yearElements = []; 7726 self.monthElements = []; 7727 } 7728 for (var m = self.config.showMonths; m--;) { 7729 var month = buildMonth(); 7730 self.yearElements.push(month.yearElement); 7731 self.monthElements.push(month.monthElement); 7732 self.monthNav.appendChild(month.container); 7733 } 7734 self.monthNav.appendChild(self.nextMonthNav); 7735 } 7736 function buildMonthNav() { 7737 self.monthNav = createElement("div", "flatpickr-months"); 7738 self.yearElements = []; 7739 self.monthElements = []; 7740 self.prevMonthNav = createElement("span", "flatpickr-prev-month"); 7741 self.prevMonthNav.innerHTML = self.config.prevArrow; 7742 self.nextMonthNav = createElement("span", "flatpickr-next-month"); 7743 self.nextMonthNav.innerHTML = self.config.nextArrow; 7744 buildMonths(); 7745 Object.defineProperty(self, "_hidePrevMonthArrow", { 7746 get: function get() { 7747 return self.__hidePrevMonthArrow; 7748 }, 7749 set: function set(bool) { 7750 if (self.__hidePrevMonthArrow !== bool) { 7751 toggleClass(self.prevMonthNav, "flatpickr-disabled", bool); 7752 self.__hidePrevMonthArrow = bool; 7753 } 7754 } 7755 }); 7756 Object.defineProperty(self, "_hideNextMonthArrow", { 7757 get: function get() { 7758 return self.__hideNextMonthArrow; 7759 }, 7760 set: function set(bool) { 7761 if (self.__hideNextMonthArrow !== bool) { 7762 toggleClass(self.nextMonthNav, "flatpickr-disabled", bool); 7763 self.__hideNextMonthArrow = bool; 7764 } 7765 } 7766 }); 7767 self.currentYearElement = self.yearElements[0]; 7768 updateNavigationCurrentMonth(); 7769 return self.monthNav; 7770 } 7771 function buildTime() { 7772 self.calendarContainer.classList.add("hasTime"); 7773 if (self.config.noCalendar) self.calendarContainer.classList.add("noCalendar"); 7774 var defaults = getDefaultHours(self.config); 7775 self.timeContainer = createElement("div", "flatpickr-time"); 7776 self.timeContainer.tabIndex = -1; 7777 var separator = createElement("span", "flatpickr-time-separator", ":"); 7778 var hourInput = createNumberInput("flatpickr-hour", { 7779 "aria-label": self.l10n.hourAriaLabel 7780 }); 7781 self.hourElement = hourInput.getElementsByTagName("input")[0]; 7782 var minuteInput = createNumberInput("flatpickr-minute", { 7783 "aria-label": self.l10n.minuteAriaLabel 7784 }); 7785 self.minuteElement = minuteInput.getElementsByTagName("input")[0]; 7786 self.hourElement.tabIndex = self.minuteElement.tabIndex = -1; 7787 self.hourElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getHours() : self.config.time_24hr ? defaults.hours : military2ampm(defaults.hours)); 7788 self.minuteElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getMinutes() : defaults.minutes); 7789 self.hourElement.setAttribute("step", self.config.hourIncrement.toString()); 7790 self.minuteElement.setAttribute("step", self.config.minuteIncrement.toString()); 7791 self.hourElement.setAttribute("min", self.config.time_24hr ? "0" : "1"); 7792 self.hourElement.setAttribute("max", self.config.time_24hr ? "23" : "12"); 7793 self.hourElement.setAttribute("maxlength", "2"); 7794 self.minuteElement.setAttribute("min", "0"); 7795 self.minuteElement.setAttribute("max", "59"); 7796 self.minuteElement.setAttribute("maxlength", "2"); 7797 self.timeContainer.appendChild(hourInput); 7798 self.timeContainer.appendChild(separator); 7799 self.timeContainer.appendChild(minuteInput); 7800 if (self.config.time_24hr) self.timeContainer.classList.add("time24hr"); 7801 if (self.config.enableSeconds) { 7802 self.timeContainer.classList.add("hasSeconds"); 7803 var secondInput = createNumberInput("flatpickr-second"); 7804 self.secondElement = secondInput.getElementsByTagName("input")[0]; 7805 self.secondElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getSeconds() : defaults.seconds); 7806 self.secondElement.setAttribute("step", self.minuteElement.getAttribute("step")); 7807 self.secondElement.setAttribute("min", "0"); 7808 self.secondElement.setAttribute("max", "59"); 7809 self.secondElement.setAttribute("maxlength", "2"); 7810 self.timeContainer.appendChild(createElement("span", "flatpickr-time-separator", ":")); 7811 self.timeContainer.appendChild(secondInput); 7812 } 7813 if (!self.config.time_24hr) { 7814 // add self.amPM if appropriate 7815 self.amPM = createElement("span", "flatpickr-am-pm", self.l10n.amPM[_int((self.latestSelectedDateObj ? self.hourElement.value : self.config.defaultHour) > 11)]); 7816 self.amPM.title = self.l10n.toggleTitle; 7817 self.amPM.tabIndex = -1; 7818 self.timeContainer.appendChild(self.amPM); 7819 } 7820 return self.timeContainer; 7821 } 7822 function buildWeekdays() { 7823 if (!self.weekdayContainer) self.weekdayContainer = createElement("div", "flatpickr-weekdays");else clearNode(self.weekdayContainer); 7824 for (var i = self.config.showMonths; i--;) { 7825 var container = createElement("div", "flatpickr-weekdaycontainer"); 7826 self.weekdayContainer.appendChild(container); 7827 } 7828 updateWeekdays(); 7829 return self.weekdayContainer; 7830 } 7831 function updateWeekdays() { 7832 if (!self.weekdayContainer) { 7833 return; 7834 } 7835 var firstDayOfWeek = self.l10n.firstDayOfWeek; 7836 var weekdays = __spreadArrays(self.l10n.weekdays.shorthand); 7837 if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) { 7838 weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek)); 7839 } 7840 for (var i = self.config.showMonths; i--;) { 7841 self.weekdayContainer.children[i].innerHTML = "\n <span class='flatpickr-weekday'>\n " + weekdays.join("</span><span class='flatpickr-weekday'>") + "\n </span>\n "; 7842 } 7843 } 7844 /* istanbul ignore next */ 7845 function buildWeeks() { 7846 self.calendarContainer.classList.add("hasWeeks"); 7847 var weekWrapper = createElement("div", "flatpickr-weekwrapper"); 7848 weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation)); 7849 var weekNumbers = createElement("div", "flatpickr-weeks"); 7850 weekWrapper.appendChild(weekNumbers); 7851 return { 7852 weekWrapper: weekWrapper, 7853 weekNumbers: weekNumbers 7854 }; 7855 } 7856 function changeMonth(value, isOffset) { 7857 if (isOffset === void 0) { 7858 isOffset = true; 7859 } 7860 var delta = isOffset ? value : value - self.currentMonth; 7861 if (delta < 0 && self._hidePrevMonthArrow === true || delta > 0 && self._hideNextMonthArrow === true) return; 7862 self.currentMonth += delta; 7863 if (self.currentMonth < 0 || self.currentMonth > 11) { 7864 self.currentYear += self.currentMonth > 11 ? 1 : -1; 7865 self.currentMonth = (self.currentMonth + 12) % 12; 7866 triggerEvent("onYearChange"); 7867 buildMonthSwitch(); 7868 } 7869 buildDays(); 7870 triggerEvent("onMonthChange"); 7871 updateNavigationCurrentMonth(); 7872 } 7873 function clear(triggerChangeEvent, toInitial) { 7874 if (triggerChangeEvent === void 0) { 7875 triggerChangeEvent = true; 7876 } 7877 if (toInitial === void 0) { 7878 toInitial = true; 7879 } 7880 self.input.value = ""; 7881 if (self.altInput !== undefined) self.altInput.value = ""; 7882 if (self.mobileInput !== undefined) self.mobileInput.value = ""; 7883 self.selectedDates = []; 7884 self.latestSelectedDateObj = undefined; 7885 if (toInitial === true) { 7886 self.currentYear = self._initialDate.getFullYear(); 7887 self.currentMonth = self._initialDate.getMonth(); 7888 } 7889 if (self.config.enableTime === true) { 7890 var _a = getDefaultHours(self.config), 7891 hours = _a.hours, 7892 minutes = _a.minutes, 7893 seconds = _a.seconds; 7894 setHours(hours, minutes, seconds); 7895 } 7896 self.redraw(); 7897 if (triggerChangeEvent) 7898 // triggerChangeEvent is true (default) or an Event 7899 triggerEvent("onChange"); 7900 } 7901 function close() { 7902 self.isOpen = false; 7903 if (!self.isMobile) { 7904 if (self.calendarContainer !== undefined) { 7905 self.calendarContainer.classList.remove("open"); 7906 } 7907 if (self._input !== undefined) { 7908 self._input.classList.remove("active"); 7909 } 7910 } 7911 triggerEvent("onClose"); 7912 } 7913 function destroy() { 7914 if (self.config !== undefined) triggerEvent("onDestroy"); 7915 for (var i = self._handlers.length; i--;) { 7916 self._handlers[i].remove(); 7917 } 7918 self._handlers = []; 7919 if (self.mobileInput) { 7920 if (self.mobileInput.parentNode) self.mobileInput.parentNode.removeChild(self.mobileInput); 7921 self.mobileInput = undefined; 7922 } else if (self.calendarContainer && self.calendarContainer.parentNode) { 7923 if (self.config["static"] && self.calendarContainer.parentNode) { 7924 var wrapper = self.calendarContainer.parentNode; 7925 wrapper.lastChild && wrapper.removeChild(wrapper.lastChild); 7926 if (wrapper.parentNode) { 7927 while (wrapper.firstChild) wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper); 7928 wrapper.parentNode.removeChild(wrapper); 7929 } 7930 } else self.calendarContainer.parentNode.removeChild(self.calendarContainer); 7931 } 7932 if (self.altInput) { 7933 self.input.type = "text"; 7934 if (self.altInput.parentNode) self.altInput.parentNode.removeChild(self.altInput); 7935 delete self.altInput; 7936 } 7937 if (self.input) { 7938 self.input.type = self.input._type; 7939 self.input.classList.remove("flatpickr-input"); 7940 self.input.removeAttribute("readonly"); 7941 } 7942 ["_showTimeInput", "latestSelectedDateObj", "_hideNextMonthArrow", "_hidePrevMonthArrow", "__hideNextMonthArrow", "__hidePrevMonthArrow", "isMobile", "isOpen", "selectedDateElem", "minDateHasTime", "maxDateHasTime", "days", "daysContainer", "_input", "_positionElement", "innerContainer", "rContainer", "monthNav", "todayDateElem", "calendarContainer", "weekdayContainer", "prevMonthNav", "nextMonthNav", "monthsDropdownContainer", "currentMonthElement", "currentYearElement", "navigationCurrentMonth", "selectedDateElem", "config"].forEach(function (k) { 7943 try { 7944 delete self[k]; 7945 } catch (_) {} 7946 }); 7947 } 7948 function isCalendarElem(elem) { 7949 return self.calendarContainer.contains(elem); 7950 } 7951 function documentClick(e) { 7952 if (self.isOpen && !self.config.inline) { 7953 var eventTarget_1 = getEventTarget(e); 7954 var isCalendarElement = isCalendarElem(eventTarget_1); 7955 var isInput = eventTarget_1 === self.input || eventTarget_1 === self.altInput || self.element.contains(eventTarget_1) || 7956 // web components 7957 // e.path is not present in all browsers. circumventing typechecks 7958 e.path && e.path.indexOf && (~e.path.indexOf(self.input) || ~e.path.indexOf(self.altInput)); 7959 var lostFocus = !isInput && !isCalendarElement && !isCalendarElem(e.relatedTarget); 7960 var isIgnored = !self.config.ignoredFocusElements.some(function (elem) { 7961 return elem.contains(eventTarget_1); 7962 }); 7963 if (lostFocus && isIgnored) { 7964 if (self.config.allowInput) { 7965 self.setDate(self._input.value, false, self.config.altInput ? self.config.altFormat : self.config.dateFormat); 7966 } 7967 if (self.timeContainer !== undefined && self.minuteElement !== undefined && self.hourElement !== undefined && self.input.value !== "" && self.input.value !== undefined) { 7968 updateTime(); 7969 } 7970 self.close(); 7971 if (self.config && self.config.mode === "range" && self.selectedDates.length === 1) self.clear(false); 7972 } 7973 } 7974 } 7975 function changeYear(newYear) { 7976 if (!newYear || self.config.minDate && newYear < self.config.minDate.getFullYear() || self.config.maxDate && newYear > self.config.maxDate.getFullYear()) return; 7977 var newYearNum = newYear, 7978 isNewYear = self.currentYear !== newYearNum; 7979 self.currentYear = newYearNum || self.currentYear; 7980 if (self.config.maxDate && self.currentYear === self.config.maxDate.getFullYear()) { 7981 self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth); 7982 } else if (self.config.minDate && self.currentYear === self.config.minDate.getFullYear()) { 7983 self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth); 7984 } 7985 if (isNewYear) { 7986 self.redraw(); 7987 triggerEvent("onYearChange"); 7988 buildMonthSwitch(); 7989 } 7990 } 7991 function isEnabled(date, timeless) { 7992 var _a; 7993 if (timeless === void 0) { 7994 timeless = true; 7995 } 7996 var dateToCheck = self.parseDate(date, undefined, timeless); // timeless 7997 if (self.config.minDate && dateToCheck && compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0 || self.config.maxDate && dateToCheck && compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0) return false; 7998 if (!self.config.enable && self.config.disable.length === 0) return true; 7999 if (dateToCheck === undefined) return false; 8000 var bool = !!self.config.enable, 8001 array = (_a = self.config.enable) !== null && _a !== void 0 ? _a : self.config.disable; 8002 for (var i = 0, d = void 0; i < array.length; i++) { 8003 d = array[i]; 8004 if (typeof d === "function" && d(dateToCheck) // disabled by function 8005 ) return bool;else if (d instanceof Date && dateToCheck !== undefined && d.getTime() === dateToCheck.getTime()) 8006 // disabled by date 8007 return bool;else if (typeof d === "string") { 8008 // disabled by date string 8009 var parsed = self.parseDate(d, undefined, true); 8010 return parsed && parsed.getTime() === dateToCheck.getTime() ? bool : !bool; 8011 } else if ( 8012 // disabled by range 8013 _typeof(d) === "object" && dateToCheck !== undefined && d.from && d.to && dateToCheck.getTime() >= d.from.getTime() && dateToCheck.getTime() <= d.to.getTime()) return bool; 8014 } 8015 return !bool; 8016 } 8017 function isInView(elem) { 8018 if (self.daysContainer !== undefined) return elem.className.indexOf("hidden") === -1 && elem.className.indexOf("flatpickr-disabled") === -1 && self.daysContainer.contains(elem); 8019 return false; 8020 } 8021 function onBlur(e) { 8022 var isInput = e.target === self._input; 8023 var valueChanged = self._input.value.trimEnd() !== getDateStr(); 8024 if (isInput && valueChanged && !(e.relatedTarget && isCalendarElem(e.relatedTarget))) { 8025 self.setDate(self._input.value, true, e.target === self.altInput ? self.config.altFormat : self.config.dateFormat); 8026 } 8027 } 8028 function onKeyDown(e) { 8029 // e.key e.keyCode 8030 // "Backspace" 8 8031 // "Tab" 9 8032 // "Enter" 13 8033 // "Escape" (IE "Esc") 27 8034 // "ArrowLeft" (IE "Left") 37 8035 // "ArrowUp" (IE "Up") 38 8036 // "ArrowRight" (IE "Right") 39 8037 // "ArrowDown" (IE "Down") 40 8038 // "Delete" (IE "Del") 46 8039 var eventTarget = getEventTarget(e); 8040 var isInput = self.config.wrap ? element.contains(eventTarget) : eventTarget === self._input; 8041 var allowInput = self.config.allowInput; 8042 var allowKeydown = self.isOpen && (!allowInput || !isInput); 8043 var allowInlineKeydown = self.config.inline && isInput && !allowInput; 8044 if (e.keyCode === 13 && isInput) { 8045 if (allowInput) { 8046 self.setDate(self._input.value, true, eventTarget === self.altInput ? self.config.altFormat : self.config.dateFormat); 8047 self.close(); 8048 return eventTarget.blur(); 8049 } else { 8050 self.open(); 8051 } 8052 } else if (isCalendarElem(eventTarget) || allowKeydown || allowInlineKeydown) { 8053 var isTimeObj = !!self.timeContainer && self.timeContainer.contains(eventTarget); 8054 switch (e.keyCode) { 8055 case 13: 8056 if (isTimeObj) { 8057 e.preventDefault(); 8058 updateTime(); 8059 focusAndClose(); 8060 } else selectDate(e); 8061 break; 8062 case 27: 8063 // escape 8064 e.preventDefault(); 8065 focusAndClose(); 8066 break; 8067 case 8: 8068 case 46: 8069 if (isInput && !self.config.allowInput) { 8070 e.preventDefault(); 8071 self.clear(); 8072 } 8073 break; 8074 case 37: 8075 case 39: 8076 if (!isTimeObj && !isInput) { 8077 e.preventDefault(); 8078 var activeElement = getClosestActiveElement(); 8079 if (self.daysContainer !== undefined && (allowInput === false || activeElement && isInView(activeElement))) { 8080 var delta_1 = e.keyCode === 39 ? 1 : -1; 8081 if (!e.ctrlKey) focusOnDay(undefined, delta_1);else { 8082 e.stopPropagation(); 8083 changeMonth(delta_1); 8084 focusOnDay(getFirstAvailableDay(1), 0); 8085 } 8086 } 8087 } else if (self.hourElement) self.hourElement.focus(); 8088 break; 8089 case 38: 8090 case 40: 8091 e.preventDefault(); 8092 var delta = e.keyCode === 40 ? 1 : -1; 8093 if (self.daysContainer && eventTarget.$i !== undefined || eventTarget === self.input || eventTarget === self.altInput) { 8094 if (e.ctrlKey) { 8095 e.stopPropagation(); 8096 changeYear(self.currentYear - delta); 8097 focusOnDay(getFirstAvailableDay(1), 0); 8098 } else if (!isTimeObj) focusOnDay(undefined, delta * 7); 8099 } else if (eventTarget === self.currentYearElement) { 8100 changeYear(self.currentYear - delta); 8101 } else if (self.config.enableTime) { 8102 if (!isTimeObj && self.hourElement) self.hourElement.focus(); 8103 updateTime(e); 8104 self._debouncedChange(); 8105 } 8106 break; 8107 case 9: 8108 if (isTimeObj) { 8109 var elems = [self.hourElement, self.minuteElement, self.secondElement, self.amPM
vendor: 5,679 bytes, lines 8109-8236
8109].concat(self.pluginElements).filter(function (x) { 8110 return x; 8111 }); 8112 var i = elems.indexOf(eventTarget); 8113 if (i !== -1) { 8114 var target = elems[i + (e.shiftKey ? -1 : 1)]; 8115 e.preventDefault(); 8116 (target || self._input).focus(); 8117 } 8118 } else if (!self.config.noCalendar && self.daysContainer && self.daysContainer.contains(eventTarget) && e.shiftKey) { 8119 e.preventDefault(); 8120 self._input.focus(); 8121 } 8122 break; 8123 } 8124 } 8125 if (self.amPM !== undefined && eventTarget === self.amPM) { 8126 switch (e.key) { 8127 case self.l10n.amPM[0].charAt(0): 8128 case self.l10n.amPM[0].charAt(0).toLowerCase(): 8129 self.amPM.textContent = self.l10n.amPM[0]; 8130 setHoursFromInputs(); 8131 updateValue(); 8132 break; 8133 case self.l10n.amPM[1].charAt(0): 8134 case self.l10n.amPM[1].charAt(0).toLowerCase(): 8135 self.amPM.textContent = self.l10n.amPM[1]; 8136 setHoursFromInputs(); 8137 updateValue(); 8138 break; 8139 } 8140 } 8141 if (isInput || isCalendarElem(eventTarget)) { 8142 triggerEvent("onKeyDown", e); 8143 } 8144 } 8145 function onMouseOver(elem, cellClass) { 8146 if (cellClass === void 0) { 8147 cellClass = "flatpickr-day"; 8148 } 8149 if (self.selectedDates.length !== 1 || elem && (!elem.classList.contains(cellClass) || elem.classList.contains("flatpickr-disabled"))) return; 8150 var hoverDate = elem ? elem.dateObj.getTime() : self.days.firstElementChild.dateObj.getTime(), 8151 initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), 8152 rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), 8153 rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime()); 8154 var containsDisabled = false; 8155 var minRange = 0, 8156 maxRange = 0; 8157 for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) { 8158 if (!isEnabled(new Date(t), true)) { 8159 containsDisabled = containsDisabled || t > rangeStartDate && t < rangeEndDate; 8160 if (t < initialDate && (!minRange || t > minRange)) minRange = t;else if (t > initialDate && (!maxRange || t < maxRange)) maxRange = t; 8161 } 8162 } 8163 var hoverableCells = Array.from(self.rContainer.querySelectorAll("*:nth-child(-n+" + self.config.showMonths + ") > ." + cellClass)); 8164 hoverableCells.forEach(function (dayElem) { 8165 var date = dayElem.dateObj; 8166 var timestamp = date.getTime(); 8167 var outOfRange = minRange > 0 && timestamp < minRange || maxRange > 0 && timestamp > maxRange; 8168 if (outOfRange) { 8169 dayElem.classList.add("notAllowed"); 8170 ["inRange", "startRange", "endRange"].forEach(function (c) { 8171 dayElem.classList.remove(c); 8172 }); 8173 return; 8174 } else if (containsDisabled && !outOfRange) return; 8175 ["startRange", "inRange", "endRange", "notAllowed"].forEach(function (c) { 8176 dayElem.classList.remove(c); 8177 }); 8178 if (elem !== undefined) { 8179 elem.classList.add(hoverDate <= self.selectedDates[0].getTime() ? "startRange" : "endRange"); 8180 if (initialDate < hoverDate && timestamp === initialDate) dayElem.classList.add("startRange");else if (initialDate > hoverDate && timestamp === initialDate) dayElem.classList.add("endRange"); 8181 if (timestamp >= minRange && (maxRange === 0 || timestamp <= maxRange) && isBetween(timestamp, initialDate, hoverDate)) dayElem.classList.add("inRange"); 8182 } 8183 }); 8184 } 8185 function onResize() { 8186 if (self.isOpen && !self.config["static"] && !self.config.inline) positionCalendar(); 8187 } 8188 function open(e, positionElement) { 8189 if (positionElement === void 0) { 8190 positionElement = self._positionElement; 8191 } 8192 if (self.isMobile === true) { 8193 if (e) { 8194 e.preventDefault(); 8195 var eventTarget = getEventTarget(e); 8196 if (eventTarget) { 8197 eventTarget.blur(); 8198 } 8199 } 8200 if (self.mobileInput !== undefined) { 8201 self.mobileInput.focus(); 8202 self.mobileInput.click(); 8203 } 8204 triggerEvent("onOpen"); 8205 return; 8206 } else if (self._input.disabled || self.config.inline) { 8207 return; 8208 } 8209 var wasOpen = self.isOpen; 8210 self.isOpen = true; 8211 if (!wasOpen) { 8212 self.calendarContainer.classList.add("open"); 8213 self._input.classList.add("active"); 8214 triggerEvent("onOpen"); 8215 positionCalendar(positionElement); 8216 } 8217 if (self.config.enableTime === true && self.config.noCalendar === true) { 8218 if (self.config.allowInput === false && (e === undefined || !self.timeContainer.contains(e.relatedTarget))) { 8219 setTimeout(function () { 8220 return self.hourElement.select(); 8221 }, 50); 8222 } 8223 } 8224 } 8225 function minMaxDateSetter(type) { 8226 return function (date) { 8227 var dateObj = self.config["_" + type + "Date"] = self.parseDate(date, self.config.dateFormat); 8228 var inverseDateObj = self.config["_" + (type === "min" ? "max" : "min") + "Date"]; 8229 if (dateObj !== undefined) { 8230 self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] = dateObj.getHours() > 0 || dateObj.getMinutes() > 0 || dateObj.getSeconds() > 0; 8231 } 8232 if (self.selectedDates) { 8233 self.selectedDates = self.selectedDates.filter(function (d) { 8234 return isEnabled(d); 8235 }); 8236 if (!self.selectedDates.length && type === "min") setHoursFromDate(dateObj);
8237 updateValue(); 8238 } 8239 if (self.daysContainer) { 8240 redraw(); 8241 if (dateObj !== undefined) self.currentYearElement[type] = dateObj.getFullYear().toString();else self.currentYearElement.removeAttribute(type); 8242 self.currentYearElement.disabled = !!inverseDateObj && dateObj !== undefined && inverseDateObj.getFullYear() === dateObj.getFullYear(); 8243 } 8244 }; 8245 } 8246 function parseConfig() { 8247 var boolOpts = ["wrap", "weekNumbers", "allowInput", "allowInvalidPreload", "clickOpens", "time_24hr", "enableTime", "noCalendar", "altInput", "shorthandCurrentMonth", "inline", "static", "enableSeconds", "disableMobile"]; 8248 var userConfig = _assign(_assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig); 8249 var formats = {}; 8250 self.config.parseDate = userConfig.parseDate; 8251 self.config.formatDate = userConfig.formatDate; 8252 Object.defineProperty(self.config, "enable", { 8253 get: function get() { 8254 return self.config._enable; 8255 }, 8256 set: function set(dates) { 8257 self.config._enable = parseDateRules(dates); 8258 } 8259 }); 8260 Object.defineProperty(self.config, "disable", { 8261 get: function get() { 8262 return self.config._disable; 8263 }, 8264 set: function set(dates) { 8265 self.config._disable = parseDateRules(dates); 8266 } 8267 }); 8268 var timeMode = userConfig.mode === "time"; 8269 if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) { 8270 var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat; 8271 formats.dateFormat = userConfig.noCalendar || timeMode ? "H:i" + (userConfig.enableSeconds ? ":S" : "") : defaultDateFormat + " H:i" + (userConfig.enableSeconds ? ":S" : ""); 8272 } 8273 if (userConfig.altInput && (userConfig.enableTime || timeMode) && !userConfig.altFormat) { 8274 var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat; 8275 formats.altFormat = userConfig.noCalendar || timeMode ? "h:i" + (userConfig.enableSeconds ? ":S K" : " K") : defaultAltFormat + (" h:i"
8275+ (userConfig.enableSeconds ? ":S" : "") + " K"); 8276 } 8277 Object.defineProperty(self.config, "minDate", { 8278 get: function get() { 8279 return self.config._minDate; 8280 }, 8281 set: minMaxDateSetter("min") 8282 }); 8283 Object.defineProperty(self.config, "maxDate", { 8284 get: function get() { 8285 return self.config._maxDate; 8286 }, 8287 set: minMaxDateSetter("max") 8288 }); 8289 var minMaxTimeSetter = function minMaxTimeSetter(type) { 8290 return function (val) { 8291 self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i:S"); 8292 }; 8293 }; 8294 Object.defineProperty(self.config, "minTime", { 8295 get: function get() { 8296 return self.config._minTime; 8297 }, 8298 set: minMaxTimeSetter("min") 8299 }); 8300 Object.defineProperty(self.config, "maxTime", { 8301 get: function get() { 8302 return self.config._maxTime; 8303 }, 8304 set: minMaxTimeSetter("max") 8305 }); 8306 if (userConfig.mode === "time") { 8307 self.config.noCalendar = true; 8308 self.config.enableTime = true; 8309 } 8310 _extends(self.config, formats, userConfig); 8311 for (var i = 0; i < boolOpts.length; i++) 8312 // https://github.com/microsoft/TypeScript/issues/31663 8313 self.config[boolOpts[i]] = self.config[boolOpts[i]] === true || self.config[boolOpts[i]] === "true"; 8314 HOOKS.filter(function (hook) { 8315 return self.config[hook] !== undefined; 8316 }
vendor: 9,824 bytes, lines 8316-8506
8316).forEach(function (hook) { 8317 self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance); 8318 }); 8319 self.isMobile = !self.config.disableMobile && !self.config.inline && self.config.mode === "single" && !self.config.disable.length && !self.config.enable && !self.config.weekNumbers && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 8320 for (var i = 0; i < self.config.plugins.length; i++) { 8321 var pluginConf = self.config.plugins[i](self) || {}; 8322 for (var key in pluginConf) { 8323 if (HOOKS.indexOf(key) > -1) { 8324 self.config[key] = arrayify(pluginConf[key]).map(bindToInstance).concat(self.config[key]); 8325 } else if (typeof userConfig[key] === "undefined") self.config[key] = pluginConf[key]; 8326 } 8327 } 8328 if (!userConfig.altInputClass) { 8329 self.config.altInputClass = getInputElem().className + " " + self.config.altInputClass; 8330 } 8331 triggerEvent("onParseConfig"); 8332 } 8333 function getInputElem() { 8334 return self.config.wrap ? element.querySelector("[data-input]") : element; 8335 } 8336 function setupLocale() { 8337 if (_typeof(self.config.locale) !== "object" && typeof flatpickr.l10ns[self.config.locale] === "undefined") self.config.errorHandler(new Error("flatpickr: invalid locale " + self.config.locale)); 8338 self.l10n = _assign(_assign({}, flatpickr.l10ns["default"]), _typeof(self.config.locale) === "object" ? self.config.locale : self.config.locale !== "default" ? flatpickr.l10ns[self.config.locale] : undefined); 8339 tokenRegex.D = "(" + self.l10n.weekdays.shorthand.join("|") + ")"; 8340 tokenRegex.l = "(" + self.l10n.weekdays.longhand.join("|") + ")"; 8341 tokenRegex.M = "(" + self.l10n.months.shorthand.join("|") + ")"; 8342 tokenRegex.F = "(" + self.l10n.months.longhand.join("|") + ")"; 8343 tokenRegex.K = "(" + self.l10n.amPM[0] + "|" + self.l10n.amPM[1] + "|" + self.l10n.amPM[0].toLowerCase() + "|" + self.l10n.amPM[1].toLowerCase() + ")"; 8344 var userConfig = _assign(_assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {}))); 8345 if (userConfig.time_24hr === undefined && flatpickr.defaultConfig.time_24hr === undefined) { 8346 self.config.time_24hr = self.l10n.time_24hr; 8347 } 8348 self.formatDate = createDateFormatter(self); 8349 self.parseDate = createDateParser({ 8350 config: self.config, 8351 l10n: self.l10n 8352 }); 8353 } 8354 function positionCalendar(customPositionElement) { 8355 if (typeof self.config.position === "function") { 8356 return void self.config.position(self, customPositionElement); 8357 } 8358 if (self.calendarContainer === undefined) return; 8359 triggerEvent("onPreCalendarPosition"); 8360 var positionElement = customPositionElement || self._positionElement; 8361 var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, function (acc, child) { 8362 return acc + child.offsetHeight; 8363 }, 0), 8364 calendarWidth = self.calendarContainer.offsetWidth, 8365 configPos = self.config.position.split(" "), 8366 configPosVertical = configPos[0], 8367 configPosHorizontal = configPos.length > 1 ? configPos[1] : null, 8368 inputBounds = positionElement.getBoundingClientRect(), 8369 distanceFromBottom = window.innerHeight - inputBounds.bottom, 8370 showOnTop = configPosVertical === "above" || configPosVertical !== "below" && distanceFromBottom < calendarHeight && inputBounds.top > calendarHeight; 8371 var top = window.pageYOffset + inputBounds.top + (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2); 8372 toggleClass(self.calendarContainer, "arrowTop", !showOnTop); 8373 toggleClass(self.calendarContainer, "arrowBottom", showOnTop); 8374 if (self.config.inline) return; 8375 var left = window.pageXOffset + inputBounds.left; 8376 var isCenter = false; 8377 var isRight = false; 8378 if (configPosHorizontal === "center") { 8379 left -= (calendarWidth - inputBounds.width) / 2; 8380 isCenter = true; 8381 } else if (configPosHorizontal === "right") { 8382 left -= calendarWidth - inputBounds.width; 8383 isRight = true; 8384 } 8385 toggleClass(self.calendarContainer, "arrowLeft", !isCenter && !isRight); 8386 toggleClass(self.calendarContainer, "arrowCenter", isCenter); 8387 toggleClass(self.calendarContainer, "arrowRight", isRight); 8388 var right = window.document.body.offsetWidth - (window.pageXOffset + inputBounds.right); 8389 var rightMost = left + calendarWidth > window.document.body.offsetWidth; 8390 var centerMost = right + calendarWidth > window.document.body.offsetWidth; 8391 toggleClass(self.calendarContainer, "rightMost", rightMost); 8392 if (self.config["static"]) return; 8393 self.calendarContainer.style.top = top + "px"; 8394 if (!rightMost) { 8395 self.calendarContainer.style.left = left + "px"; 8396 self.calendarContainer.style.right = "auto"; 8397 } else if (!centerMost) { 8398 self.calendarContainer.style.left = "auto"; 8399 self.calendarContainer.style.right = right + "px"; 8400 } else { 8401 var doc = getDocumentStyleSheet(); 8402 // some testing environments don't have css support 8403 if (doc === undefined) return; 8404 var bodyWidth = window.document.body.offsetWidth; 8405 var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2); 8406 var centerBefore = ".flatpickr-calendar.centerMost:before"; 8407 var centerAfter = ".flatpickr-calendar.centerMost:after"; 8408 var centerIndex = doc.cssRules.length; 8409 var centerStyle = "{left:" + inputBounds.left + "px;right:auto;}"; 8410 toggleClass(self.calendarContainer, "rightMost", false); 8411 toggleClass(self.calendarContainer, "centerMost", true); 8412 doc.insertRule(centerBefore + "," + centerAfter + centerStyle, centerIndex); 8413 self.calendarContainer.style.left = centerLeft + "px"; 8414 self.calendarContainer.style.right = "auto"; 8415 } 8416 } 8417 function getDocumentStyleSheet() { 8418 var editableSheet = null; 8419 for (var i = 0; i < document.styleSheets.length; i++) { 8420 var sheet = document.styleSheets[i]; 8421 if (!sheet.cssRules) continue; 8422 try { 8423 sheet.cssRules; 8424 } catch (err) { 8425 continue; 8426 } 8427 editableSheet = sheet; 8428 break; 8429 } 8430 return editableSheet != null ? editableSheet : createStyleSheet(); 8431 } 8432 function createStyleSheet() { 8433 var style = document.createElement("style"); 8434 document.head.appendChild(style); 8435 return style.sheet; 8436 } 8437 function redraw() { 8438 if (self.config.noCalendar || self.isMobile) return; 8439 buildMonthSwitch(); 8440 updateNavigationCurrentMonth(); 8441 buildDays(); 8442 } 8443 function focusAndClose() { 8444 self._input.focus(); 8445 if (window.navigator.userAgent.indexOf("MSIE") !== -1 || navigator.msMaxTouchPoints !== undefined) { 8446 // hack - bugs in the way IE handles focus keeps the calendar open 8447 setTimeout(self.close, 0); 8448 } else { 8449 self.close(); 8450 } 8451 } 8452 function selectDate(e) { 8453 e.preventDefault(); 8454 e.stopPropagation(); 8455 var isSelectable = function isSelectable(day) { 8456 return day.classList && day.classList.contains("flatpickr-day") && !day.classList.contains("flatpickr-disabled") && !day.classList.contains("notAllowed"); 8457 }; 8458 var t = findParent(getEventTarget(e), isSelectable); 8459 if (t === undefined) return; 8460 var target = t; 8461 var selectedDate = self.latestSelectedDateObj = new Date(target.dateObj.getTime()); 8462 var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth || selectedDate.getMonth() > self.currentMonth + self.config.showMonths - 1) && self.config.mode !== "range"; 8463 self.selectedDateElem = target; 8464 if (self.config.mode === "single") self.selectedDates = [selectedDate];else if (self.config.mode === "multiple") { 8465 var selectedIndex = isDateSelected(selectedDate); 8466 if (selectedIndex) self.selectedDates.splice(parseInt(selectedIndex), 1);else self.selectedDates.push(selectedDate); 8467 } else if (self.config.mode === "range") { 8468 if (self.selectedDates.length === 2) { 8469 self.clear(false, false); 8470 } 8471 self.latestSelectedDateObj = selectedDate; 8472 self.selectedDates.push(selectedDate); 8473 // unless selecting same date twice, sort ascendingly 8474 if (compareDates(selectedDate, self.selectedDates[0], true) !== 0) self.selectedDates.sort(function (a, b) { 8475 return a.getTime() - b.getTime(); 8476 }); 8477 } 8478 setHoursFromInputs(); 8479 if (shouldChangeMonth) { 8480 var isNewYear = self.currentYear !== selectedDate.getFullYear(); 8481 self.currentYear = selectedDate.getFullYear(); 8482 self.currentMonth = selectedDate.getMonth(); 8483 if (isNewYear) { 8484 triggerEvent("onYearChange"); 8485 buildMonthSwitch(); 8486 } 8487 triggerEvent("onMonthChange"); 8488 } 8489 updateNavigationCurrentMonth(); 8490 buildDays(); 8491 updateValue(); 8492 // maintain focus 8493 if (!shouldChangeMonth && self.config.mode !== "range" && self.config.showMonths === 1) focusOnDayElem(target);else if (self.selectedDateElem !== undefined && self.hourElement === undefined) { 8494 self.selectedDateElem && self.selectedDateElem.focus(); 8495 } 8496 if (self.hourElement !== undefined) self.hourElement !== undefined && self.hourElement.focus(); 8497 if (self.config.closeOnSelect) { 8498 var single = self.config.mode === "single" && !self.config.enableTime; 8499 var range = self.config.mode === "range" && self.selectedDates.length === 2 && !self.config.enableTime; 8500 if (single || range) { 8501 focusAndClose(); 8502 } 8503 } 8504 triggerChange(); 8505 } 8506 var CALLBACKS = {
vendor: 6,393 bytes, lines 8507-8638
8507 locale: [setupLocale, updateWeekdays], 8508 showMonths: [buildMonths, setCalendarWidth, buildWeekdays], 8509 minDate: [jumpToDate], 8510 maxDate: [jumpToDate], 8511 positionElement: [updatePositionElement], 8512 clickOpens: [function () { 8513 if (self.config.clickOpens === true) { 8514 bind(self._input, "focus", self.open); 8515 bind(self._input, "click", self.open); 8516 } else { 8517 self._input.removeEventListener("focus", self.open); 8518 self._input.removeEventListener("click", self.open); 8519 } 8520 }] 8521 }; 8522 function set(option, value) { 8523 if (option !== null && _typeof(option) === "object") { 8524 _extends(self.config, option); 8525 for (var key in option) { 8526 if (CALLBACKS[key] !== undefined) CALLBACKS[key].forEach(function (x) { 8527 return x(); 8528 }); 8529 } 8530 } else { 8531 self.config[option] = value; 8532 if (CALLBACKS[option] !== undefined) CALLBACKS[option].forEach(function (x) { 8533 return x(); 8534 });else if (HOOKS.indexOf(option) > -1) self.config[option] = arrayify(value); 8535 } 8536 self.redraw(); 8537 updateValue(true); 8538 } 8539 function setSelectedDate(inputDate, format) { 8540 var dates = []; 8541 if (inputDate instanceof Array) dates = inputDate.map(function (d) { 8542 return self.parseDate(d, format); 8543 });else if (inputDate instanceof Date || typeof inputDate === "number") dates = [self.parseDate(inputDate, format)];else if (typeof inputDate === "string") { 8544 switch (self.config.mode) { 8545 case "single": 8546 case "time": 8547 dates = [self.parseDate(inputDate, format)]; 8548 break; 8549 case "multiple": 8550 dates = inputDate.split(self.config.conjunction).map(function (date) { 8551 return self.parseDate(date, format); 8552 }); 8553 break; 8554 case "range": 8555 dates = inputDate.split(self.l10n.rangeSeparator).map(function (date) { 8556 return self.parseDate(date, format); 8557 }); 8558 break; 8559 } 8560 } else self.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(inputDate))); 8561 self.selectedDates = self.config.allowInvalidPreload ? dates : dates.filter(function (d) { 8562 return d instanceof Date && isEnabled(d, false); 8563 }); 8564 if (self.config.mode === "range") self.selectedDates.sort(function (a, b) { 8565 return a.getTime() - b.getTime(); 8566 }); 8567 } 8568 function setDate(date, triggerChange, format) { 8569 if (triggerChange === void 0) { 8570 triggerChange = false; 8571 } 8572 if (format === void 0) { 8573 format = self.config.dateFormat; 8574 } 8575 if (date !== 0 && !date || date instanceof Array && date.length === 0) return self.clear(triggerChange); 8576 setSelectedDate(date, format); 8577 self.latestSelectedDateObj = self.selectedDates[self.selectedDates.length - 1]; 8578 self.redraw(); 8579 jumpToDate(undefined, triggerChange); 8580 setHoursFromDate(); 8581 if (self.selectedDates.length === 0) { 8582 self.clear(false); 8583 } 8584 updateValue(triggerChange); 8585 if (triggerChange) triggerEvent("onChange"); 8586 } 8587 function parseDateRules(arr) { 8588 return arr.slice().map(function (rule) { 8589 if (typeof rule === "string" || typeof rule === "number" || rule instanceof Date) { 8590 return self.parseDate(rule, undefined, true); 8591 } else if (rule && _typeof(rule) === "object" && rule.from && rule.to) return { 8592 from: self.parseDate(rule.from, undefined), 8593 to: self.parseDate(rule.to, undefined) 8594 }; 8595 return rule; 8596 }).filter(function (x) { 8597 return x; 8598 }); // remove falsy values 8599 } 8600 function setupDates() { 8601 self.selectedDates = []; 8602 self.now = self.parseDate(self.config.now) || new Date(); 8603 // Workaround IE11 setting placeholder as the input's value 8604 var preloadedDate = self.config.defaultDate || ((self.input.nodeName === "INPUT" || self.input.nodeName === "TEXTAREA") && self.input.placeholder && self.input.value === self.input.placeholder ? null : self.input.value); 8605 if (preloadedDate) setSelectedDate(preloadedDate, self.config.dateFormat); 8606 self._initialDate = self.selectedDates.length > 0 ? self.selectedDates[0] : self.config.minDate && self.config.minDate.getTime() > self.now.getTime() ? self.config.minDate : self.config.maxDate && self.config.maxDate.getTime() < self.now.getTime() ? self.config.maxDate : self.now; 8607 self.currentYear = self._initialDate.getFullYear(); 8608 self.currentMonth = self._initialDate.getMonth(); 8609 if (self.selectedDates.length > 0) self.latestSelectedDateObj = self.selectedDates[0]; 8610 if (self.config.minTime !== undefined) self.config.minTime = self.parseDate(self.config.minTime, "H:i"); 8611 if (self.config.maxTime !== undefined) self.config.maxTime = self.parseDate(self.config.maxTime, "H:i"); 8612 self.minDateHasTime = !!self.config.minDate && (self.config.minDate.getHours() > 0 || self.config.minDate.getMinutes() > 0 || self.config.minDate.getSeconds() > 0); 8613 self.maxDateHasTime = !!self.config.maxDate && (self.config.maxDate.getHours() > 0 || self.config.maxDate.getMinutes() > 0 || self.config.maxDate.getSeconds() > 0); 8614 } 8615 function setupInputs() { 8616 self.input = getInputElem(); 8617 /* istanbul ignore next */ 8618 if (!self.input) { 8619 self.config.errorHandler(new Error("Invalid input element specified")); 8620 return; 8621 } 8622 // hack: store previous type to restore it after destroy() 8623 self.input._type = self.input.type; 8624 self.input.type = "text"; 8625 self.input.classList.add("flatpickr-input"); 8626 self._input = self.input; 8627 if (self.config.altInput) { 8628 // replicate self.element 8629 self.altInput = createElement(self.input.nodeName, self.config.altInputClass); 8630 self._input = self.altInput; 8631 self.altInput.placeholder = self.input.placeholder; 8632 self.altInput.disabled = self.input.disabled; 8633 self.altInput.required = self.input.required; 8634 self.altInput.tabIndex = self.input.tabIndex; 8635 self.altInput.type = "text"; 8636 self.input.setAttribute("type", "hidden"); 8637 if (!self.config["static"] && self.input.parentNode) self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling); 8638 }
vendor: 4,269 bytes, lines 8639-8717
8639 if (!self.config.allowInput) self._input.setAttribute("readonly", "readonly"); 8640 updatePositionElement(); 8641 } 8642 function updatePositionElement() { 8643 self._positionElement = self.config.positionElement || self._input; 8644 } 8645 function setupMobile() { 8646 var inputType = self.config.enableTime ? self.config.noCalendar ? "time" : "datetime-local" : "date"; 8647 self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile"); 8648 self.mobileInput.tabIndex = 1; 8649 self.mobileInput.type = inputType; 8650 self.mobileInput.disabled = self.input.disabled; 8651 self.mobileInput.required = self.input.required; 8652 self.mobileInput.placeholder = self.input.placeholder; 8653 self.mobileFormatStr = inputType === "datetime-local" ? "Y-m-d\\TH:i:S" : inputType === "date" ? "Y-m-d" : "H:i:S"; 8654 if (self.selectedDates.length > 0) { 8655 self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr); 8656 } 8657 if (self.config.minDate) self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d"); 8658 if (self.config.maxDate) self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d"); 8659 if (self.input.getAttribute("step")) self.mobileInput.step = String(self.input.getAttribute("step")); 8660 self.input.type = "hidden"; 8661 if (self.altInput !== undefined) self.altInput.type = "hidden"; 8662 try { 8663 if (self.input.parentNode) self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling); 8664 } catch (_a) {} 8665 bind(self.mobileInput, "change", function (e) { 8666 self.setDate(getEventTarget(e).value, false, self.mobileFormatStr); 8667 triggerEvent("onChange"); 8668 triggerEvent("onClose"); 8669 }); 8670 } 8671 function toggle(e) { 8672 if (self.isOpen === true) return self.close(); 8673 self.open(e); 8674 } 8675 function triggerEvent(event, data) { 8676 // If the instance has been destroyed already, all hooks have been removed 8677 if (self.config === undefined) return; 8678 var hooks = self.config[event]; 8679 if (hooks !== undefined && hooks.length > 0) { 8680 for (var i = 0; hooks[i] && i < hooks.length; i++) hooks[i](self.selectedDates, self.input.value, self, data); 8681 } 8682 if (event === "onChange") { 8683 self.input.dispatchEvent(createEvent("change")); 8684 // many front-end frameworks bind to the input event 8685 self.input.dispatchEvent(createEvent("input")); 8686 } 8687 } 8688 function createEvent(name) { 8689 var e = document.createEvent("Event"); 8690 e.initEvent(name, true, true); 8691 return e; 8692 } 8693 function isDateSelected(date) { 8694 for (var i = 0; i < self.selectedDates.length; i++) { 8695 var selectedDate = self.selectedDates[i]; 8696 if (selectedDate instanceof Date && compareDates(selectedDate, date) === 0) return "" + i; 8697 } 8698 return false; 8699 } 8700 function isDateInRange(date) { 8701 if (self.config.mode !== "range" || self.selectedDates.length < 2) return false; 8702 return compareDates(date, self.selectedDates[0]) >= 0 && compareDates(date, self.selectedDates[1]) <= 0; 8703 } 8704 function updateNavigationCurrentMonth() { 8705 if (self.config.noCalendar || self.isMobile || !self.monthNav) return; 8706 self.yearElements.forEach(function (yearElement, i) { 8707 var d = new Date(self.currentYear, self.currentMonth, 1); 8708 d.setMonth(self.currentMonth + i); 8709 if (self.config.showMonths > 1 || self.config.monthSelectorType === "static") { 8710 self.monthElements[i].textContent = monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + " "; 8711 } else { 8712 self.monthsDropdownContainer.value = d.getMonth().toString(); 8713 } 8714 yearElement.value = d.getFullYear().toString(); 8715 }); 8716 self._hidePrevMonthArrow = self.config.minDate !== undefined && (self.currentYear === self.config.minDate.getFullYear() ? self.currentMonth <= self.config.minDate.getMonth() : self.currentYear < self.config.minDate.getFullYear()); 8717 self._hideNextMonthArrow = self.config.maxDate !== undefined && (self.currentYear === self.config.maxDate.getFullYear() ? self.currentMonth + 1 > self.config.maxDate.getMonth() : self.currentYear >
8717 self.config.maxDate.getFullYear()); 8718 } 8719 function getDateStr(specificFormat) { 8720 var format = specificFormat || (self.config.altInput ? self.config.altFormat : self.config.dateFormat); 8721 return self.selectedDates.map(function (dObj) { 8722 return self.formatDate(dObj, format); 8723 }).filter(function (d, i, arr) { 8724 return self.config.mode !== "range" || self.config.enableTime || arr.indexOf(d) === i; 8725 }).join(self.config.mode !== "range" ? self.config.conjunction : self.l10n.rangeSeparator); 8726 } 8727 /** 8728 * Updates the values of inputs associated with the calendar 8729 */ 8730 function updateValue(triggerChange) { 8731 if (triggerChange === void 0) { 8732 triggerChange = true; 8733 } 8734 if (self.mobileInput !== undefined && self.mobileFormatStr) { 8735 self.mobileInput.value = self.latestSelectedDateObj !== undefined ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr) : ""; 8736 } 8737 self.input.value = getDateStr(self.config.dateFormat); 8738 if (self.altInput !== undefined) { 8739 self.altInput.value = getDateStr(self.config.altFormat); 8740 } 8741 if (triggerChange !== false) triggerEvent("onValueUpdate"); 8742 } 8743 function onMonthNavClick(e) { 8744 var eventTarget = getEventTarget(e); 8745 var isPrevMonth = self.prevMonthNav.contains(eventTarget); 8746 var isNextMonth = self.nextMonthNav.contains(eventTarget); 8747 if (isPrevMonth || isNextMonth) { 8748 changeMonth(isPrevMonth ? -1 : 1); 8749 } else if (self.yearElements.indexOf(eventTarget) >= 0) { 8750 eventTarget.select(); 8751 } else if (eventTarget.classList.contains("arrowUp")) { 8752 self.changeYear(self.currentYear + 1); 8753 } else if (eventTarget.classList.contains("arrowDown")) { 8754 self.changeYear(self.currentYear - 1); 8755 } 8756 } 8757 function timeWrapper(e) { 8758 e.preventDefault(); 8759 var isKeyDown = e.type === "keydown", 8760 eventTarget = getEventTarget(e), 8761 input = eventTarget; 8762 if (self.amPM !== undefined && eventTarget === self.amPM) { 8763 self.amPM.textContent = self.l10n.amPM[_int(self.amPM.textContent === self.l10n.amPM[0])]; 8764 } 8765 var min = parseFloat(input.getAttribute("min")), 8766 max = parseFloat(input.getAttribute("max")), 8767 step = parseFloat(input.getAttribute("step")), 8768 curValue = parseInt(input.value, 10), 8769 delta = e.delta || (isKeyDown ? e.which === 38 ? 1 : -1 : 0); 8770 var newValue = curValue + step * delta; 8771 if (typeof input.value !== "undefined" && input.value.length === 2) { 8772 var isHourElem = input === self.hourElement, 8773 isMinuteElem = input === self.minuteElement; 8774 if (newValue < min) { 8775 newValue = max + newValue + _int(!isHourElem) + (_int(isHourElem) && _int(!self.amPM)); 8776 if (isMinuteElem) incrementNumInput(undefined, -1, self.hourElement); 8777 } else if (newValue > max) { 8778 newValue = input === self.hourElement ? newValue - max - _int(!self.amPM) : min; 8779 if (isMinuteElem) incrementNumInput(undefined, 1, self.hourElement); 8780 } 8781 if (self.amPM && isHourElem && (step === 1 ? newValue + curValue === 23 : Math.abs(newValue - curValue) > step)) { 8782 self.amPM.textContent = self.l10n.amPM[_int(self.amPM.textContent === self.l10n.amPM[0])]; 8783 } 8784 input.value = pad(newValue); 8785 } 8786 } 8787 init(); 8788 return self; 8789 } 8790 /* istanbul ignore next */ 8791 function _flatpickr(nodeList, config) { 8792 // static list 8793 var nodes = Array.prototype.slice.call(nodeList).filter(function (x) { 8794 return x instanceof HTMLElement; 8795 }); 8796 var instances = []; 8797 for (var i = 0; i < nodes.length; i++) { 8798 var node = nodes[i]; 8799 try { 8800 if (node.getAttribute("data-fp-omit") !== null) continue; 8801 if (node._flatpickr !== undefined) { 8802 node._flatpickr.destroy(); 8803 node._flatpickr = undefined; 8804 } 8805 node._flatpickr = FlatpickrInstance(node, config || {}); 8806 instances.push(node._flatpickr); 8807 } catch (e) { 8808 console.error(e); 8809 } 8810 } 8811 return instances.length === 1 ? instances[0] : instances; 8812 } 8813 /* istanbul ignore next */ 8814 if (typeof HTMLElement !== "undefined" && typeof HTMLCollection !== "undefined" && typeof NodeList !== "undefined") { 8815 // browser env 8816 HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) { 8817 return _flatpickr(this, config); 8818 }; 8819 HTMLElement.prototype.flatpickr = function (config) { 8820 return _flatpickr([this], config); 8821 }; 8822 } 8823 /* istanbul ignore next */ 8824 var flatpickr = function flatpickr(selector, config) { 8825 if (typeof selector === "string") { 8826 return _flatpickr(window.document.querySelectorAll(selector), config); 8827 } else if (selector instanceof Node) { 8828 return _flatpickr([selector], config); 8829 } else { 8830 return _flatpickr(selector, config); 8831 } 8832 }; 8833 /* istanbul ignore next */ 8834 flatpickr.defaultConfig = {}; 8835 flatpickr.l10ns = { 8836 en: _assign({}, english), 8837 "default": _assign({}, english) 8838 }; 8839 flatpickr.localize = function (l10n) { 8840 flatpickr.l10ns["default"] = _assign(_assign({}, flatpickr.l10ns["default"]), l10n); 8841 }; 8842 flatpickr.setDefaults = function (config) { 8843 flatpickr.defaultConfig = _assign(_assign({}, flatpickr.defaultConfig), config); 8844 }; 8845 flatpickr.parseDate = createDateParser({}); 8846 flatpickr.formatDate = createDateFormatter({}); 8847 flatpickr.compareDates = compareDates; 8848 /* istanbul ignore next */ 8849 if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") { 8850 jQuery.fn.flatpickr = function (config) { 8851 return _flatpickr(this, config); 8852 }; 8853 } 8854 Date.prototype.fp_incr = function (days) { 8855 return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === "string" ? parseInt(days, 10) : days)); 8856 }; 8857 if (typeof window !== "undefined") { 8858 window.flatpickr = flatpickr; 8859 } 8860 return flatpickr; 8861}); 8862 8863},{}],13:[function(require,module,exports){ 8864function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 8865(function (global, factory) { 8866 (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.de = {})); 8867})(this, function (exports) { 8868 'use strict'; 8869 8870 var fp = typeof window !== "undefined" && window.flatpickr !== undefined ? window.flatpickr : { 8871 l10ns: {} 8872 }; 8873 var German = { 8874 weekdays: { 8875 shorthand: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], 8876 longhand: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"] 8877 }, 8878 months: { 8879 shorthand: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"], 8880 longhand: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "
8880November", "Dezember"] 8881 }, 8882 firstDayOfWeek: 1, 8883 weekAbbreviation: "KW", 8884 rangeSeparator: " bis ", 8885 scrollTitle: "Zum Ändern scrollen", 8886 toggleTitle: "Zum Umschalten klicken", 8887 time_24hr: true 8888 }; 8889 fp.l10ns.de = German; 8890 var de = fp.l10ns; 8891 exports.German = German; 8892 exports["default"] = de; 8893 Object.defineProperty(exports, '__esModule', { 8894 value: true 8895 }); 8896}); 8897 8898},{}],14:[function(require,module,exports){ 8899/*! 8900* focus-trap 7.8.0 8901* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE 8902*/ 8903'use strict'; 8904 8905function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 8906var tabbable = require('tabbable'); 8907function _arrayLikeToArray(r, a) { 8908 (null == a || a > r.length) && (a = r.length); 8909 for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; 8910 return n; 8911} 8912function _arrayWithoutHoles(r) { 8913 if (Array.isArray(r)) return _arrayLikeToArray(r); 8914} 8915function _createForOfIteratorHelper(r, e) { 8916 var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 8917 if (!t) { 8918 if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { 8919 t && (r = t); 8920 var _n = 0, 8921 F = function F() {}; 8922 return { 8923 s: F, 8924 n: function n() { 8925 return _n >= r.length ? { 8926 done: true 8927 } : { 8928 done: false, 8929 value: r[_n++] 8930 }; 8931 }, 8932 e: function e(r) { 8933 throw r; 8934 }, 8935 f: F 8936 }; 8937 } 8938 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 8939 } 8940 var o, 8941 a = true, 8942 u = false; 8943 return { 8944 s: function s() { 8945 t = t.call(r); 8946 }, 8947 n: function n() { 8948 var r = t.next(); 8949 return a = r.done, r; 8950 }, 8951 e: function e(r) { 8952 u = true, o = r; 8953 }, 8954 f: function f() { 8955 try { 8956 a || null == t["return"] || t["return"](); 8957 } finally { 8958 if (u) throw o; 8959 } 8960 } 8961 }; 8962} 8963function _defineProperty(e, r, t) { 8964 return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { 8965 value: t, 8966 enumerable: true, 8967 configurable: true, 8968 writable: true 8969 }) : e[r] = t, e; 8970} 8971function _iterableToArray(r) { 8972 if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); 8973} 8974function _nonIterableSpread() { 8975 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 8976} 8977function ownKeys(e, r) { 8978 var t = Object.keys(e); 8979 if (Object.getOwnPropertySymbols) { 8980 var o = Object.getOwnPropertySymbols(e); 8981 r && (o = o.filter(function (r) { 8982 return Object.getOwnPropertyDescriptor(e, r).enumerable; 8983 })), t.push.apply(t, o); 8984 } 8985 return t; 8986} 8987function _objectSpread2(e) { 8988 for (var r = 1; r < arguments.length; r++) { 8989 var t = null != arguments[r] ? arguments[r] : {}; 8990 r % 2 ? ownKeys(Object(t), true).forEach(function (r) { 8991 _defineProperty(e, r, t[r]); 8992 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { 8993 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); 8994 }); 8995 } 8996 return e; 8997} 8998function _toConsumableArray(r) { 8999 return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); 9000} 9001function _toPrimitive(t, r) { 9002 if ("object" != _typeof(t) || !t) return t; 9003 var e = t[Symbol.toPrimitive]; 9004 if (void 0 !== e) { 9005 var i = e.call(t, r); 9006 if ("object" != _typeof(i)) return i; 9007 throw new TypeError("@@toPrimitive must return a primitive value."); 9008 } 9009 return ("string" === r ? String : Number)(t); 9010} 9011function _toPropertyKey(t) { 9012 var i = _toPrimitive(t, "string"); 9013 return "symbol" == _typeof(i) ? i : i + ""; 9014} 9015function _unsupportedIterableToArray(r, a) { 9016 if (r) { 9017 if ("string" == typeof r) return _arrayLikeToArray(r, a); 9018 var t = {}.toString.call(r).slice(8, -1); 9019 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; 9020 } 9021}
vendor: 3,887 bytes, lines 9021-9113
9021 9022var activeFocusTraps = { 9023 // Returns the trap from the top of the stack. 9024 getActiveTrap: function getActiveTrap(trapStack) { 9025 if ((trapStack === null || trapStack === void 0 ? void 0 : trapStack.length) > 0) { 9026 return trapStack[trapStack.length - 1]; 9027 } 9028 return null; 9029 }, 9030 // Pauses the currently active trap, then adds a new trap to the stack. 9031 activateTrap: function activateTrap(trapStack, trap) { 9032 var activeTrap = activeFocusTraps.getActiveTrap(trapStack); 9033 if (trap !== activeTrap) { 9034 activeFocusTraps.pauseTrap(trapStack); 9035 } 9036 var trapIndex = trapStack.indexOf(trap); 9037 if (trapIndex === -1) { 9038 trapStack.push(trap); 9039 } else { 9040 // move this existing trap to the front of the queue 9041 trapStack.splice(trapIndex, 1); 9042 trapStack.push(trap); 9043 } 9044 }, 9045 // Removes the trap from the top of the stack, then unpauses the next trap down. 9046 deactivateTrap: function deactivateTrap(trapStack, trap) { 9047 var trapIndex = trapStack.indexOf(trap); 9048 if (trapIndex !== -1) { 9049 trapStack.splice(trapIndex, 1); 9050 } 9051 activeFocusTraps.unpauseTrap(trapStack); 9052 }, 9053 // Pauses the trap at the top of the stack. 9054 pauseTrap: function pauseTrap(trapStack) { 9055 var activeTrap = activeFocusTraps.getActiveTrap(trapStack); 9056 activeTrap === null || activeTrap === void 0 || activeTrap._setPausedState(true); 9057 }, 9058 // Unpauses the trap at the top of the stack. 9059 unpauseTrap: function unpauseTrap(trapStack) { 9060 var activeTrap = activeFocusTraps.getActiveTrap(trapStack); 9061 if (activeTrap && !activeTrap._isManuallyPaused()) { 9062 activeTrap._setPausedState(false); 9063 } 9064 } 9065}; 9066var isSelectableInput = function isSelectableInput(node) { 9067 return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function'; 9068}; 9069var isEscapeEvent = function isEscapeEvent(e) { 9070 return (e === null || e === void 0 ? void 0 : e.key) === 'Escape' || (e === null || e === void 0 ? void 0 : e.key) === 'Esc' || (e === null || e === void 0 ? void 0 : e.keyCode) === 27; 9071}; 9072var isTabEvent = function isTabEvent(e) { 9073 return (e === null || e === void 0 ? void 0 : e.key) === 'Tab' || (e === null || e === void 0 ? void 0 : e.keyCode) === 9; 9074}; 9075 9076// checks for TAB by default 9077var isKeyForward = function isKeyForward(e) { 9078 return isTabEvent(e) && !e.shiftKey; 9079}; 9080 9081// checks for SHIFT+TAB by default 9082var isKeyBackward = function isKeyBackward(e) { 9083 return isTabEvent(e) && e.shiftKey; 9084}; 9085var delay = function delay(fn) { 9086 return setTimeout(fn, 0); 9087}; 9088 9089/** 9090 * Get an option's value when it could be a plain value, or a handler that provides 9091 * the value. 9092 * @param {*} value Option's value to check. 9093 * @param {...*} [params] Any parameters to pass to the handler, if `value` is a function. 9094 * @returns {*} The `value`, or the handler's returned value. 9095 */ 9096var valueOrHandler = function valueOrHandler(value) { 9097 for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 9098 params[_key - 1] = arguments[_key]; 9099 } 9100 return typeof value === 'function' ? value.apply(void 0, params) : value; 9101}; 9102var getActualTarget = function getActualTarget(event) { 9103 // NOTE: If the trap is _inside_ a shadow DOM, event.target will always be the 9104 // shadow host. However, event.target.composedPath() will be an array of 9105 // nodes "clicked" from inner-most (the actual element inside the shadow) to 9106 // outer-most (the host HTML document). If we have access to composedPath(), 9107 // then use its first element; otherwise, fall back to event.target (and 9108 // this only works for an _open_ shadow DOM; otherwise, 9109 // composedPath()[0] === event.target always). 9110 return event.target.shadowRoot && typeof event.composedPath === 'function' ? event.composedPath()[0] : event.target; 9111}; 9112 9113// NOTE: this must be _outside_ `createFocusTrap()` to make sure all traps in this
vendor: 5,074 bytes, lines 9114-9207
9114// current instance use the same stack if `userOptions.trapStack` isn't specified 9115var internalTrapStack = []; 9116var createFocusTrap = function createFocusTrap(elements, userOptions) { 9117 // SSR: a live trap shouldn't be created in this type of environment so this 9118 // should be safe code to execute if the `document` option isn't specified 9119 var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document; 9120 var trapStack = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.trapStack) || internalTrapStack; 9121 var config = _objectSpread2({ 9122 returnFocusOnDeactivate: true, 9123 escapeDeactivates: true, 9124 delayInitialFocus: true, 9125 isolateSubtrees: false, 9126 isKeyForward: isKeyForward, 9127 isKeyBackward: isKeyBackward 9128 }, userOptions); 9129 var state = { 9130 // containers given to createFocusTrap() 9131 /** @type {Array<HTMLElement>} */ 9132 containers: [], 9133 // list of objects identifying tabbable nodes in `containers` in the trap 9134 // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap 9135 // is active, but the trap should never get to a state where there isn't at least one group 9136 // with at least one tabbable node in it (that would lead to an error condition that would 9137 // result in an error being thrown) 9138 /** @type {Array<{ 9139 * container: HTMLElement, 9140 * tabbableNodes: Array<HTMLElement>, // empty if none 9141 * focusableNodes: Array<HTMLElement>, // empty if none 9142 * posTabIndexesFound: boolean, 9143 * firstTabbableNode: HTMLElement|undefined, 9144 * lastTabbableNode: HTMLElement|undefined, 9145 * firstDomTabbableNode: HTMLElement|undefined, 9146 * lastDomTabbableNode: HTMLElement|undefined, 9147 * nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined 9148 * }>} 9149 */ 9150 containerGroups: [], 9151 // same order/length as `containers` list 9152 9153 // references to objects in `containerGroups`, but only those that actually have 9154 // tabbable nodes in them 9155 // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__ 9156 // the same length 9157 tabbableGroups: [], 9158 // references to nodes that are siblings to the ancestors of this trap's containers. 9159 /** @type {Set<HTMLElement>} */ 9160 adjacentElements: new Set(), 9161 // references to nodes that were inert or aria-hidden before the trap was activated. 9162 /** @type {Set<HTMLElement>} */ 9163 alreadySilent: new Set(), 9164 nodeFocusedBeforeActivation: null, 9165 mostRecentlyFocusedNode: null, 9166 active: false, 9167 paused: false, 9168 manuallyPaused: false, 9169 // timer ID for when delayInitialFocus is true and initial focus in this trap 9170 // has been delayed during activation 9171 delayInitialFocusTimer: undefined, 9172 // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any 9173 recentNavEvent: undefined 9174 }; 9175 var trap; // eslint-disable-line prefer-const -- some private functions reference it, and its methods reference private functions, so we must declare here and define later 9176 9177 /** 9178 * Gets a configuration option value. 9179 * @param {Object|undefined} configOverrideOptions If true, and option is defined in this set, 9180 * value will be taken from this object. Otherwise, value will be taken from base configuration. 9181 * @param {string} optionName Name of the option whose value is sought. 9182 * @param {string|undefined} [configOptionName] Name of option to use __instead of__ `optionName` 9183 * IIF `configOverrideOptions` is not defined. Otherwise, `optionName` is used. 9184 */ 9185 var getOption = function getOption(configOverrideOptions, optionName, configOptionName) { 9186 return configOverrideOptions && configOverrideOptions[optionName] !== undefined ? configOverrideOptions[optionName] : config[configOptionName || optionName]; 9187 }; 9188 9189 /** 9190 * Finds the index of the container that contains the element. 9191 * @param {HTMLElement} element 9192 * @param {Event} [event] If available, and `element` isn't directly found in any container, 9193 * the event's composed path is used to see if includes any known trap containers in the 9194 * case where the element is inside a Shadow DOM. 9195 * @returns {number} Index of the container in either `state.containers` or 9196 * `state.containerGroups` (the order/length of these lists are the same); -1 9197 * if the element isn't found. 9198 */ 9199 var findContainerIndex = function findContainerIndex(element, event) { 9200 var composedPath = typeof (event === null || event === void 0 ? void 0 : event.composedPath) === 'function' ? event.composedPath() : undefined; 9201 // NOTE: search `containerGroups` because it's possible a group contains no tabbable 9202 // nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`) 9203 // and we still need to find the element in there 9204 return state.containerGroups.findIndex(function (_ref) { 9205 var container = _ref.container, 9206 tabbableNodes = _ref.tabbableNodes; 9207 return container.contains(element) || (
vendor: 6,642 bytes, lines 9207-9337
9207 9208 // fall back to explicit tabbable search which will take into consideration any 9209 // web components if the `tabbableOptions.getShadowRoot` option was used for 9210 // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't 9211 // look inside web components even if open) 9212 composedPath === null || composedPath === void 0 ? void 0 : composedPath.includes(container)) || tabbableNodes.find(function (node) { 9213 return node === element; 9214 }); 9215 }); 9216 }; 9217 9218 /** 9219 * Gets the node for the given option, which is expected to be an option that 9220 * can be either a DOM node, a string that is a selector to get a node, `false` 9221 * (if a node is explicitly NOT given), or a function that returns any of these 9222 * values. 9223 * @param {string} optionName 9224 * @param {Object} options 9225 * @param {boolean} [options.hasFallback] True if the option could be a selector string 9226 * and the option allows for a fallback scenario in the case where the selector is 9227 * valid but does not match a node (i.e. the queried node doesn't exist in the DOM). 9228 * @param {Array} [options.params] Params to pass to the option if it's a function. 9229 * @returns {undefined | null | false | HTMLElement | SVGElement} Returns 9230 * `undefined` if the option is not specified; `null` if the option didn't resolve 9231 * to a node but `options.hasFallback=true`, `false` if the option resolved to `false` 9232 * (node explicitly not given); otherwise, the resolved DOM node. 9233 * @throws {Error} If the option is set, not `false`, and is not, or does not 9234 * resolve to a node, unless the option is a selector string and `options.hasFallback=true`. 9235 */ 9236 var getNodeForOption = function getNodeForOption(optionName) { 9237 var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, 9238 _ref2$hasFallback = _ref2.hasFallback, 9239 hasFallback = _ref2$hasFallback === void 0 ? false : _ref2$hasFallback, 9240 _ref2$params = _ref2.params, 9241 params = _ref2$params === void 0 ? [] : _ref2$params; 9242 var optionValue = config[optionName]; 9243 if (typeof optionValue === 'function') { 9244 optionValue = optionValue.apply(void 0, _toConsumableArray(params)); 9245 } 9246 if (optionValue === true) { 9247 optionValue = undefined; // use default value 9248 } 9249 if (!optionValue) { 9250 if (optionValue === undefined || optionValue === false) { 9251 return optionValue; 9252 } 9253 // else, empty string (invalid), null (invalid), 0 (invalid) 9254 9255 throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node")); 9256 } 9257 var node = optionValue; // could be HTMLElement, SVGElement, or non-empty string at this point 9258 9259 if (typeof optionValue === 'string') { 9260 try { 9261 node = doc.querySelector(optionValue); // resolve to node, or null if fails 9262 } catch (err) { 9263 throw new Error("`".concat(optionName, "` appears to be an invalid selector; error=\"").concat(err.message, "\"")); 9264 } 9265 if (!node) { 9266 if (!hasFallback) { 9267 throw new Error("`".concat(optionName, "` as selector refers to no known node")); 9268 } 9269 // else, `node` MUST be `null` because that's what `Document.querySelector()` returns 9270 // if the selector is valid but doesn't match anything 9271 } 9272 } 9273 return node; 9274 }; 9275 var getInitialFocusNode = function getInitialFocusNode() { 9276 var node = getNodeForOption('initialFocus', { 9277 hasFallback: true 9278 }); 9279 9280 // false explicitly indicates we want no initialFocus at all 9281 if (node === false) { 9282 return false; 9283 } 9284 if (node === undefined || node && !tabbable.isFocusable(node, config.tabbableOptions)) { 9285 // option not specified nor focusable: use fallback options 9286 if (findContainerIndex(doc.activeElement) >= 0) { 9287 node = doc.activeElement; 9288 } else { 9289 var firstTabbableGroup = state.tabbableGroups[0]; 9290 var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode; 9291 9292 // NOTE: `fallbackFocus` option function cannot return `false` (not supported) 9293 node = firstTabbableNode || getNodeForOption('fallbackFocus'); 9294 } 9295 } else if (node === null) { 9296 // option is a VALID selector string that doesn't yield a node: use the `fallbackFocus` 9297 // option instead of the default behavior when the option isn't specified at all 9298 node = getNodeForOption('fallbackFocus'); 9299 } 9300 if (!node) { 9301 throw new Error('Your focus-trap needs to have at least one focusable element'); 9302 } 9303 return node; 9304 }; 9305 var updateTabbableNodes = function updateTabbableNodes() { 9306 state.containerGroups = state.containers.map(function (container) { 9307 var tabbableNodes = tabbable.tabbable(container, config.tabbableOptions); 9308 9309 // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes 9310 // are a superset of tabbable nodes since nodes with negative `tabindex` attributes 9311 // are focusable but not tabbable 9312 var focusableNodes = tabbable.focusable(container, config.tabbableOptions); 9313 var firstTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[0] : undefined; 9314 var lastTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : undefined; 9315 var firstDomTabbableNode = focusableNodes.find(function (node) { 9316 return tabbable.isTabbable(node); 9317 }); 9318 var lastDomTabbableNode = focusableNodes.slice().reverse().find(function (node) { 9319 return tabbable.isTabbable(node); 9320 }); 9321 var posTabIndexesFound = !!tabbableNodes.find(function (node) { 9322 return tabbable.getTabIndex(node) > 0; 9323 }); 9324 return { 9325 container: container, 9326 tabbableNodes: tabbableNodes, 9327 focusableNodes: focusableNodes, 9328 /** True if at least one node with positive `tabindex` was found in this container. */ 9329 posTabIndexesFound: posTabIndexesFound, 9330 /** First tabbable node in container, __tabindex__ order; `undefined` if none. */ 9331 firstTabbableNode: firstTabbableNode, 9332 /** Last tabbable node in container, __tabindex__ order; `undefined` if none. */ 9333 lastTabbableNode: lastTabbableNode, 9334 // NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out 9335 // would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition 9336 // because that API doesn't work with Shadow DOM as well as it should (@see 9337 // https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
vendor: 6,152 bytes, lines 9338-9466
9338 // to address an edge case related to positive tabindex support, this seems like a much easier, 9339 // "close enough most of the time" alternative for positive tabindexes which should generally 9340 // be avoided anyway... 9341 /** First tabbable node in container, __DOM__ order; `undefined` if none. */ 9342 firstDomTabbableNode: firstDomTabbableNode, 9343 /** Last tabbable node in container, __DOM__ order; `undefined` if none. */ 9344 lastDomTabbableNode: lastDomTabbableNode, 9345 /** 9346 * Finds the __tabbable__ node that follows the given node in the specified direction, 9347 * in this container, if any. 9348 * @param {HTMLElement} node 9349 * @param {boolean} [forward] True if going in forward tab order; false if going 9350 * in reverse. 9351 * @returns {HTMLElement|undefined} The next tabbable node, if any. 9352 */ 9353 nextTabbableNode: function nextTabbableNode(node) { 9354 var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 9355 var nodeIdx = tabbableNodes.indexOf(node); 9356 if (nodeIdx < 0) { 9357 // either not tabbable nor focusable, or was focused but not tabbable (negative tabindex): 9358 // since `node` should at least have been focusable, we assume that's the case and mimic 9359 // what browsers do, which is set focus to the next node in __document position order__, 9360 // regardless of positive tabindexes, if any -- and for reasons explained in the NOTE 9361 // above related to `firstDomTabbable` and `lastDomTabbable` properties, we fall back to 9362 // basic DOM order 9363 if (forward) { 9364 return focusableNodes.slice(focusableNodes.indexOf(node) + 1).find(function (el) { 9365 return tabbable.isTabbable(el); 9366 }); 9367 } 9368 return focusableNodes.slice(0, focusableNodes.indexOf(node)).reverse().find(function (el) { 9369 return tabbable.isTabbable(el); 9370 }); 9371 } 9372 return tabbableNodes[nodeIdx + (forward ? 1 : -1)]; 9373 } 9374 }; 9375 }); 9376 state.tabbableGroups = state.containerGroups.filter(function (group) { 9377 return group.tabbableNodes.length > 0; 9378 }); 9379 9380 // throw if no groups have tabbable nodes and we don't have a fallback focus node either 9381 if (state.tabbableGroups.length <= 0 && !getNodeForOption('fallbackFocus') // returning false not supported for this option 9382 ) { 9383 throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times'); 9384 } 9385 9386 // NOTE: Positive tabindexes are only properly supported in single-container traps because 9387 // doing it across multiple containers where tabindexes could be all over the place 9388 // would require Tabbable to support multiple containers, would require additional 9389 // specialized Shadow DOM support, and would require Tabbable's multi-container support 9390 // to look at those containers in document position order rather than user-provided 9391 // order (as they are treated in Focus-trap, for legacy reasons). See discussion on 9392 // https://github.com/focus-trap/focus-trap/issues/375 for more details. 9393 if (state.containerGroups.find(function (g) { 9394 return g.posTabIndexesFound; 9395 }) && state.containerGroups.length > 1) { 9396 throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps."); 9397 } 9398 }; 9399 9400 /** 9401 * Gets the current activeElement. If it's a web-component and has open shadow-root 9402 * it will recursively search inside shadow roots for the "true" activeElement. 9403 * 9404 * @param {Document | ShadowRoot} el 9405 * 9406 * @returns {HTMLElement} The element that currently has the focus 9407 **/ 9408 var _getActiveElement = function getActiveElement(el) { 9409 var activeElement = el.activeElement; 9410 if (!activeElement) { 9411 return; 9412 } 9413 if (activeElement.shadowRoot && activeElement.shadowRoot.activeElement !== null) { 9414 return _getActiveElement(activeElement.shadowRoot); 9415 } 9416 return activeElement; 9417 }; 9418 var _tryFocus = function tryFocus(node) { 9419 if (node === false) { 9420 return; 9421 } 9422 if (node === _getActiveElement(document)) { 9423 return; 9424 } 9425 if (!node || !node.focus) { 9426 _tryFocus(getInitialFocusNode()); 9427 return; 9428 } 9429 node.focus({ 9430 preventScroll: !!config.preventScroll 9431 }); 9432 // NOTE: focus() API does not trigger focusIn event so set MRU node manually 9433 state.mostRecentlyFocusedNode = node; 9434 if (isSelectableInput(node)) { 9435 node.select(); 9436 } 9437 }; 9438 var getReturnFocusNode = function getReturnFocusNode(previousActiveElement) { 9439 var node = getNodeForOption('setReturnFocus', { 9440 params: [previousActiveElement] 9441 }); 9442 return node ? node : node === false ? false : previousActiveElement; 9443 }; 9444 9445 /** 9446 * Finds the next node (in either direction) where focus should move according to a 9447 * keyboard focus-in event. 9448 * @param {Object} params 9449 * @param {Node} [params.target] Known target __from which__ to navigate, if any. 9450 * @param {KeyboardEvent|FocusEvent} [params.event] Event to use if `target` isn't known (event 9451 * will be used to determine the `target`). Ignored if `target` is specified. 9452 * @param {boolean} [params.isBackward] True if focus should move backward. 9453 * @returns {Node|undefined} The next node, or `undefined` if a next node couldn't be 9454 * determined given the current state of the trap. 9455 */ 9456 var findNextNavNode = function findNextNavNode(_ref3) { 9457 var target = _ref3.target, 9458 event = _ref3.event, 9459 _ref3$isBackward = _ref3.isBackward, 9460 isBackward = _ref3$isBackward === void 0 ? false : _ref3$isBackward; 9461 target = target || getActualTarget(event); 9462 updateTabbableNodes(); 9463 var destinationNode = null; 9464 if (state.tabbableGroups.length > 0) { 9465 // make sure the target is actually contained in a group 9466 // NOTE: the target may also be the container itself if it's focu
vendor: 5,180 bytes, lines 9466-9552
9466sable 9467 // with tabIndex='-1' and was given initial focus 9468 var containerIndex = findContainerIndex(target, event); 9469 var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined; 9470 if (containerIndex < 0) { 9471 // target not found in any group: quite possible focus has escaped the trap, 9472 // so bring it back into... 9473 if (isBackward) { 9474 // ...the last node in the last group 9475 destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode; 9476 } else { 9477 // ...the first node in the first group 9478 destinationNode = state.tabbableGroups[0].firstTabbableNode; 9479 } 9480 } else if (isBackward) { 9481 // REVERSE 9482 9483 // is the target the first tabbable node in a group? 9484 var startOfGroupIndex = state.tabbableGroups.findIndex(function (_ref4) { 9485 var firstTabbableNode = _ref4.firstTabbableNode; 9486 return target === firstTabbableNode; 9487 }); 9488 if (startOfGroupIndex < 0 && (containerGroup.container === target || tabbable.isFocusable(target, config.tabbableOptions) && !tabbable.isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) { 9489 // an exception case where the target is either the container itself, or 9490 // a non-tabbable node that was given focus (i.e. tabindex is negative 9491 // and user clicked on it or node was programmatically given focus) 9492 // and is not followed by any other tabbable node, in which 9493 // case, we should handle shift+tab as if focus were on the container's 9494 // first tabbable node, and go to the last tabbable node of the LAST group 9495 startOfGroupIndex = containerIndex; 9496 } 9497 if (startOfGroupIndex >= 0) { 9498 // YES: then shift+tab should go to the last tabbable node in the 9499 // previous group (and wrap around to the last tabbable node of 9500 // the LAST group if it's the first tabbable node of the FIRST group) 9501 var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1; 9502 var destinationGroup = state.tabbableGroups[destinationGroupIndex]; 9503 destinationNode = tabbable.getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode; 9504 } else if (!isTabEvent(event)) { 9505 // user must have customized the nav keys so we have to move focus manually _within_ 9506 // the active group: do this based on the order determined by tabbable() 9507 destinationNode = containerGroup.nextTabbableNode(target, false); 9508 } 9509 } else { 9510 // FORWARD 9511 9512 // is the target the last tabbable node in a group? 9513 var lastOfGroupIndex = state.tabbableGroups.findIndex(function (_ref5) { 9514 var lastTabbableNode = _ref5.lastTabbableNode; 9515 return target === lastTabbableNode; 9516 }); 9517 if (lastOfGroupIndex < 0 && (containerGroup.container === target || tabbable.isFocusable(target, config.tabbableOptions) && !tabbable.isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) { 9518 // an exception case where the target is the container itself, or 9519 // a non-tabbable node that was given focus (i.e. tabindex is negative 9520 // and user clicked on it or node was programmatically given focus) 9521 // and is not followed by any other tabbable node, in which 9522 // case, we should handle tab as if focus were on the container's 9523 // last tabbable node, and go to the first tabbable node of the FIRST group 9524 lastOfGroupIndex = containerIndex; 9525 } 9526 if (lastOfGroupIndex >= 0) { 9527 // YES: then tab should go to the first tabbable node in the next 9528 // group (and wrap around to the first tabbable node of the FIRST 9529 // group if it's the last tabbable node of the LAST group) 9530 var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1; 9531 var _destinationGroup = state.tabbableGroups[_destinationGroupIndex]; 9532 destinationNode = tabbable.getTabIndex(target) >= 0 ? _destinationGroup.firstTabbableNode : _destinationGroup.firstDomTabbableNode; 9533 } else if (!isTabEvent(event)) { 9534 // user must have customized the nav keys so we have to move focus manually _within_ 9535 // the active group: do this based on the order determined by tabbable() 9536 destinationNode = containerGroup.nextTabbableNode(target); 9537 } 9538 } 9539 } else { 9540 // no groups available 9541 // NOTE: the fallbackFocus option does not support returning false to opt-out 9542 destinationNode = getNodeForOption('fallbackFocus'); 9543 } 9544 return destinationNode; 9545 }; 9546 9547 // This needs to be done on mousedown and touchstart instead of click 9548 // so that it precedes the focus event. 9549 var checkPointerDown = function checkPointerDown(e) { 9550 var target = getActualTarget(e); 9551 if (findContainerIndex(target, e) >= 0) { 9552 // allow the click since it o
vendor: 6,706 bytes, lines 9552-9685
9552curred inside the trap 9553 return; 9554 } 9555 if (valueOrHandler(config.clickOutsideDeactivates, e)) { 9556 // immediately deactivate the trap 9557 trap.deactivate({ 9558 // NOTE: by setting `returnFocus: false`, deactivate() will do nothing, 9559 // which will result in the outside click setting focus to the node 9560 // that was clicked (and if not focusable, to "nothing"); by setting 9561 // `returnFocus: true`, we'll attempt to re-focus the node originally-focused 9562 // on activation (or the configured `setReturnFocus` node), whether the 9563 // outside click was on a focusable node or not 9564 returnFocus: config.returnFocusOnDeactivate 9565 }); 9566 return; 9567 } 9568 9569 // This is needed for mobile devices. 9570 // (If we'll only let `click` events through, 9571 // then on mobile they will be blocked anyways if `touchstart` is blocked.) 9572 if (valueOrHandler(config.allowOutsideClick, e)) { 9573 // allow the click outside the trap to take place 9574 return; 9575 } 9576 9577 // otherwise, prevent the click 9578 e.preventDefault(); 9579 }; 9580 9581 // In case focus escapes the trap for some strange reason, pull it back in. 9582 // NOTE: the focusIn event is NOT cancelable, so if focus escapes, it may cause unexpected 9583 // scrolling if the node that got focused was out of view; there's nothing we can do to 9584 // prevent that from happening by the time we discover that focus escaped 9585 var checkFocusIn = function checkFocusIn(event) { 9586 var target = getActualTarget(event); 9587 var targetContained = findContainerIndex(target, event) >= 0; 9588 9589 // In Firefox when you Tab out of an iframe the Document is briefly focused. 9590 if (targetContained || target instanceof Document) { 9591 if (targetContained) { 9592 state.mostRecentlyFocusedNode = target; 9593 } 9594 } else { 9595 // escaped! pull it back in to where it just left 9596 event.stopImmediatePropagation(); 9597 9598 // focus will escape if the MRU node had a positive tab index and user tried to nav forward; 9599 // it will also escape if the MRU node had a 0 tab index and user tried to nav backward 9600 // toward a node with a positive tab index 9601 var nextNode; // next node to focus, if we find one 9602 var navAcrossContainers = true; 9603 if (state.mostRecentlyFocusedNode) { 9604 if (tabbable.getTabIndex(state.mostRecentlyFocusedNode) > 0) { 9605 // MRU container index must be >=0 otherwise we wouldn't have it as an MRU node... 9606 var mruContainerIdx = findContainerIndex(state.mostRecentlyFocusedNode); 9607 // there MAY not be any tabbable nodes in the container if there are at least 2 containers 9608 // and the MRU node is focusable but not tabbable (focus-trap requires at least 1 container 9609 // with at least one tabbable node in order to function, so this could be the other container 9610 // with nothing tabbable in it) 9611 var tabbableNodes = state.containerGroups[mruContainerIdx].tabbableNodes; 9612 if (tabbableNodes.length > 0) { 9613 // MRU tab index MAY not be found if the MRU node is focusable but not tabbable 9614 var mruTabIdx = tabbableNodes.findIndex(function (node) { 9615 return node === state.mostRecentlyFocusedNode; 9616 }); 9617 if (mruTabIdx >= 0) { 9618 if (config.isKeyForward(state.recentNavEvent)) { 9619 if (mruTabIdx + 1 < tabbableNodes.length) { 9620 nextNode = tabbableNodes[mruTabIdx + 1]; 9621 navAcrossContainers = false; 9622 } 9623 // else, don't wrap within the container as focus should move to next/previous 9624 // container 9625 } else { 9626 if (mruTabIdx - 1 >= 0) { 9627 nextNode = tabbableNodes[mruTabIdx - 1]; 9628 navAcrossContainers = false; 9629 } 9630 // else, don't wrap within the container as focus should move to next/previous 9631 // container 9632 } 9633 // else, don't find in container order without considering direction too 9634 } 9635 } 9636 // else, no tabbable nodes in that container (which means we must have at least one other 9637 // container with at least one tabbable node in it, otherwise focus-trap would've thrown 9638 // an error the last time updateTabbableNodes() was run): find next node among all known 9639 // containers 9640 } else { 9641 // check to see if there's at least one tabbable node with a positive tab index inside 9642 // the trap because focus seems to escape when navigating backward from a tabbable node 9643 // with tabindex=0 when this is the case (instead of wrapping to the tabbable node with 9644 // the greatest positive tab index like it should) 9645 if (!state.containerGroups.some(function (g) { 9646 return g.tabbableNodes.some(function (n) { 9647 return tabbable.getTabIndex(n) > 0; 9648 }); 9649 })) { 9650 // no containers with tabbable nodes with positive tab indexes which means the focus 9651 // escaped for some other reason and we should just execute the fallback to the 9652 // MRU node or initial focus node, if any 9653 navAcrossContainers = false; 9654 } 9655 } 9656 } else { 9657 // no MRU node means we're likely in some initial condition when the trap has just 9658 // been activated and initial focus hasn't been given yet, in which case we should 9659 // fall through to trying to focus the initial focus node, which is what should 9660 // happen below at this point in the logic 9661 navAcrossContainers = false; 9662 } 9663 if (navAcrossContainers) { 9664 nextNode = findNextNavNode({ 9665 // move FROM the MRU node, not event-related node (which will be the node that is 9666 // outside the trap causing the focus escape we're trying to fix) 9667 target: state.mostRecentlyFocusedNode, 9668 isBackward: config.isKeyBackward(state.recentNavEvent) 9669 }); 9670 } 9671 if (nextNode) { 9672 _tryFocus(nextNode); 9673 } else { 9674 _tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode()); 9675 } 9676 } 9677 state.recentNavEvent = undefined; // clear 9678 }; 9679 9680 // Hijack key nav events on the first and last focusable nodes of the trap, 9681 // in order to prevent focus from escaping. If it escapes for even a 9682 // moment it can end up scrolling the page and causing confusion so we 9683 // kind of need to capture the action at the keydown phase. 9684 var checkKeyNav = function checkKeyNav(event) { 9685 var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
vendor: 15,344 bytes, lines 9686-10093
9686 state.recentNavEvent = event; 9687 var destinationNode = findNextNavNode({ 9688 event: event, 9689 isBackward: isBackward 9690 }); 9691 if (destinationNode) { 9692 if (isTabEvent(event)) { 9693 // since tab natively moves focus, we wouldn't have a destination node unless we 9694 // were on the edge of a container and had to move to the next/previous edge, in 9695 // which case we want to prevent default to keep the browser from moving focus 9696 // to where it normally would 9697 event.preventDefault(); 9698 } 9699 _tryFocus(destinationNode); 9700 } 9701 // else, let the browser take care of [shift+]tab and move the focus 9702 }; 9703 var checkTabKey = function checkTabKey(event) { 9704 if (config.isKeyForward(event) || config.isKeyBackward(event)) { 9705 checkKeyNav(event, config.isKeyBackward(event)); 9706 } 9707 }; 9708 9709 // we use a different event phase for the Escape key to allow canceling the event and checking for this in escapeDeactivates 9710 var checkEscapeKey = function checkEscapeKey(event) { 9711 if (isEscapeEvent(event) && valueOrHandler(config.escapeDeactivates, event) !== false) { 9712 event.preventDefault(); 9713 trap.deactivate(); 9714 } 9715 }; 9716 var checkClick = function checkClick(e) { 9717 var target = getActualTarget(e); 9718 if (findContainerIndex(target, e) >= 0) { 9719 return; 9720 } 9721 if (valueOrHandler(config.clickOutsideDeactivates, e)) { 9722 return; 9723 } 9724 if (valueOrHandler(config.allowOutsideClick, e)) { 9725 return; 9726 } 9727 e.preventDefault(); 9728 e.stopImmediatePropagation(); 9729 }; 9730 9731 // 9732 // EVENT LISTENERS 9733 // 9734 9735 var addListeners = function addListeners() { 9736 if (!state.active) { 9737 return; 9738 } 9739 9740 // There can be only one listening focus trap at a time 9741 activeFocusTraps.activateTrap(trapStack, trap); 9742 9743 // Delay ensures that the focused element doesn't capture the event 9744 // that caused the focus trap activation. 9745 state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function () { 9746 _tryFocus(getInitialFocusNode()); 9747 }) : _tryFocus(getInitialFocusNode()); 9748 doc.addEventListener('focusin', checkFocusIn, true); 9749 doc.addEventListener('mousedown', checkPointerDown, { 9750 capture: true, 9751 passive: false 9752 }); 9753 doc.addEventListener('touchstart', checkPointerDown, { 9754 capture: true, 9755 passive: false 9756 }); 9757 doc.addEventListener('click', checkClick, { 9758 capture: true, 9759 passive: false 9760 }); 9761 doc.addEventListener('keydown', checkTabKey, { 9762 capture: true, 9763 passive: false 9764 }); 9765 doc.addEventListener('keydown', checkEscapeKey); 9766 return trap; 9767 }; 9768 9769 /** 9770 * Traverses up the DOM from each of `containers`, collecting references to 9771 * the elements that are siblings to `container` or an ancestor of `container`. 9772 * @param {Array<HTMLElement>} containers 9773 */ 9774 var collectAdjacentElements = function collectAdjacentElements(containers) { 9775 // Re-activate all adjacent elements & clear previous collection. 9776 if (state.active && !state.paused) { 9777 trap._setSubtreeIsolation(false); 9778 } 9779 state.adjacentElements.clear(); 9780 state.alreadySilent.clear(); 9781 9782 // Collect all ancestors of all containers to avoid redundant processing. 9783 var containerAncestors = new Set(); 9784 var adjacentElements = new Set(); 9785 9786 // Compile all elements adjacent to the focus trap containers & lineage. 9787 var _iterator = _createForOfIteratorHelper(containers), 9788 _step; 9789 try { 9790 for (_iterator.s(); !(_step = _iterator.n()).done;) { 9791 var container = _step.value; 9792 containerAncestors.add(container); 9793 var insideShadowRoot = typeof ShadowRoot !== 'undefined' && container.getRootNode() instanceof ShadowRoot; 9794 var current = container; 9795 while (current) { 9796 containerAncestors.add(current); 9797 var parent = current.parentElement; 9798 var siblings = []; 9799 if (parent) { 9800 siblings = parent.children; 9801 } else if (!parent && insideShadowRoot) { 9802 siblings = current.getRootNode().children; 9803 parent = current.getRootNode().host; 9804 insideShadowRoot = typeof ShadowRoot !== 'undefined' && parent.getRootNode() instanceof ShadowRoot; 9805 } 9806 9807 // Add all the children, we'll remove container lineage later. 9808 var _iterator2 = _createForOfIteratorHelper(siblings), 9809 _step2; 9810 try { 9811 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 9812 var child = _step2.value; 9813 adjacentElements.add(child); 9814 } 9815 } catch (err) { 9816 _iterator2.e(err); 9817 } finally { 9818 _iterator2.f(); 9819 } 9820 current = parent; 9821 } 9822 } 9823 9824 // Multi-container traps may overlap. 9825 // Remove elements within container lineages. 9826 } catch (err) { 9827 _iterator.e(err); 9828 } finally { 9829 _iterator.f(); 9830 } 9831 containerAncestors.forEach(function (el) { 9832 adjacentElements["delete"](el); 9833 }); 9834 state.adjacentElements = adjacentElements; 9835 }; 9836 var removeListeners = function removeListeners() { 9837 if (!state.active) { 9838 return; 9839 } 9840 doc.removeEventListener('focusin', checkFocusIn, true); 9841 doc.removeEventListener('mousedown', checkPointerDown, true); 9842 doc.removeEventListener('touchstart', checkPointerDown, true); 9843 doc.removeEventListener('click', checkClick, true); 9844 doc.removeEventListener('keydown', checkTabKey, true); 9845 doc.removeEventListener('keydown', checkEscapeKey); 9846 return trap; 9847 }; 9848 9849 // 9850 // MUTATION OBSERVER 9851 // 9852 9853 var checkDomRemoval = function checkDomRemoval(mutations) { 9854 var isFocusedNodeRemoved = mutations.some(function (mutation) { 9855 var removedNodes = Array.from(mutation.removedNodes); 9856 return removedNodes.some(function (node) { 9857 return node === state.mostRecentlyFocusedNode; 9858 }); 9859 }); 9860 9861 // If the currently focused is removed then browsers will move focus to the 9862 // <body> element. If this happens, try to move focus back into the trap. 9863 if (isFocusedNodeRemoved) { 9864 _tryFocus(getInitialFocusNode()); 9865 } 9866 }; 9867 9868 // Use MutationObserver - if supported - to detect if focused node is removed 9869 // from the DOM. 9870 var mutationObserver = typeof window !== 'undefined' && 'MutationObserver' in window ? new MutationObserver(checkDomRemoval) : undefined; 9871 var updateObservedNodes = function updateObservedNodes() { 9872 if (!mutationObserver) { 9873 return; 9874 } 9875 mutationObserver.disconnect(); 9876 if (state.active && !state.paused) { 9877 state.containers.map(function (container) { 9878 mutationObserver.observe(container, { 9879 subtree: true, 9880 childList: true 9881 }); 9882 }); 9883 } 9884 }; 9885 9886 // 9887 // TRAP DEFINITION 9888 // 9889 9890 trap = { 9891 get active() { 9892 return state.active; 9893 }, 9894 get paused() { 9895 return state.paused; 9896 }, 9897 activate: function activate(activateOptions) { 9898 if (state.active) { 9899 return this; 9900 } 9901 var onActivate = getOption(activateOptions, 'onActivate'); 9902 var onPostActivate = getOption(activateOptions, 'onPostActivate'); 9903 var checkCanFocusTrap = getOption(activateOptions, 'checkCanFocusTrap'); 9904 9905 // If a currently-active trap is isolating its subtree, we need to remove 9906 // that isolation to allow the new trap to find tabbable nodes. 9907 var preexistingTrap = activeFocusTraps.getActiveTrap(trapStack); 9908 var revertState = false; 9909 if (preexistingTrap && !preexistingTrap.paused) { 9910 var _preexistingTrap$_set; 9911 // [#1729] method MAY not exist if using `trapStack` option to share stack with older 9912 // versions of Focus-trap in the same DOM so use optional chaining here just in case 9913 // since this is a trap we may not have created from this instance of the library 9914 (_preexistingTrap$_set = preexistingTrap._setSubtreeIsolation) === null || _preexistingTrap$_set === void 0 || _preexistingTrap$_set.call(preexistingTrap, false); 9915 revertState = true; 9916 } 9917 try { 9918 if (!checkCanFocusTrap) { 9919 updateTabbableNodes(); 9920 } 9921 state.active = true; 9922 state.paused = false; 9923 state.nodeFocusedBeforeActivation = _getActiveElement(doc); 9924 onActivate === null || onActivate === void 0 || onActivate(); 9925 var finishActivation = function finishActivation() { 9926 if (checkCanFocusTrap) { 9927 updateTabbableNodes(); 9928 } 9929 addListeners(); 9930 updateObservedNodes(); 9931 if (config.isolateSubtrees) { 9932 trap._setSubtreeIsolation(true); 9933 } 9934 onPostActivate === null || onPostActivate === void 0 || onPostActivate(); 9935 }; 9936 if (checkCanFocusTrap) { 9937 checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation); 9938 return this; 9939 } 9940 finishActivation(); 9941 } catch (error) { 9942 // If our activation throws an exception and the stack hasn't changed, 9943 // we need to re-enable the prior trap's subtree isolation. 9944 if (preexistingTrap === activeFocusTraps.getActiveTrap(trapStack) && revertState) { 9945 var _preexistingTrap$_set2; 9946 // [#1729] method MAY not exist if using `trapStack` option to share stack with older 9947 // versions of Focus-trap in the same DOM so use optional chaining here just in case 9948 // since this is a trap we may not have created from this instance of the library 9949 (_preexistingTrap$_set2 = preexistingTrap._setSubtreeIsolation) === null || _preexistingTrap$_set2 === void 0 || _preexistingTrap$_set2.call(preexistingTrap, true); 9950 } 9951 throw error; 9952 } 9953 return this; 9954 }, 9955 deactivate: function deactivate(deactivateOptions) { 9956 if (!state.active) { 9957 return this; 9958 } 9959 var options = _objectSpread2({ 9960 onDeactivate: config.onDeactivate, 9961 onPostDeactivate: config.onPostDeactivate, 9962 checkCanReturnFocus: config.checkCanReturnFocus 9963 }, deactivateOptions); 9964 clearTimeout(state.delayInitialFocusTimer); // noop if undefined 9965 state.delayInitialFocusTimer = undefined; 9966 9967 // Prior to removing this trap from the trapStack, we need to remove any applications of `inert`. 9968 // This allows the next trap down to update its tabbable nodes properly. 9969 // 9970 // If this trap is not top of the stack, don't change any current isolation. 9971 if (!state.paused) { 9972 trap._setSubtreeIsolation(false); 9973 } 9974 state.alreadySilent.clear(); 9975 removeListeners(); 9976 state.active = false; 9977 state.paused = false; 9978 updateObservedNodes(); 9979 activeFocusTraps.deactivateTrap(trapStack, trap); 9980 var onDeactivate = getOption(options, 'onDeactivate'); 9981 var onPostDeactivate = getOption(options, 'onPostDeactivate'); 9982 var checkCanReturnFocus = getOption(options, 'checkCanReturnFocus'); 9983 var returnFocus = getOption(options, 'returnFocus', 'returnFocusOnDeactivate'); 9984 onDeactivate === null || onDeactivate === void 0 || onDeactivate(); 9985 var finishDeactivation = function finishDeactivation() { 9986 delay(function () { 9987 if (returnFocus) { 9988 _tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)); 9989 } 9990 onPostDeactivate === null || onPostDeactivate === void 0 || onPostDeactivate(); 9991 }); 9992 }; 9993 if (returnFocus && checkCanReturnFocus) { 9994 checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation); 9995 return this; 9996 } 9997 finishDeactivation(); 9998 return this; 9999 }, 10000 pause: function pause(pauseOptions) { 10001 if (!state.active) { 10002 return this; 10003 } 10004 state.manuallyPaused = true; 10005 return this._setPausedState(true, pauseOptions); 10006 }, 10007 unpause: function unpause(unpauseOptions) { 10008 if (!state.active) { 10009 return this; 10010 } 10011 state.manuallyPaused = false; 10012 if (trapStack[trapStack.length - 1] !== this) { 10013 return this; 10014 } 10015 return this._setPausedState(false, unpauseOptions); 10016 }, 10017 updateContainerElements: function updateContainerElements(containerElements) { 10018 var elementsAsArray = [].concat(containerElements).filter(Boolean); 10019 state.containers = elementsAsArray.map(function (element) { 10020 return typeof element === 'string' ? doc.querySelector(element) : element; 10021 }); 10022 if (config.isolateSubtrees) { 10023 collectAdjacentElements(state.containers); 10024 } 10025 if (state.active) { 10026 updateTabbableNodes(); 10027 if (config.isolateSubtrees && !state.paused) { 10028 trap._setSubtreeIsolation(true); 10029 } 10030 } 10031 updateObservedNodes(); 10032 return this; 10033 } 10034 }; 10035 Object.defineProperties(trap, { 10036 _isManuallyPaused: { 10037 value: function value() { 10038 return state.manuallyPaused; 10039 } 10040 }, 10041 _setPausedState: { 10042 value: function value(paused, options) { 10043 if (state.paused === paused) { 10044 return this; 10045 } 10046 state.paused = paused; 10047 if (paused) { 10048 var onPause = getOption(options, 'onPause'); 10049 var onPostPause = getOption(options, 'onPostPause'); 10050 onPause === null || onPause === void 0 || onPause(); 10051 removeListeners(); 10052 updateObservedNodes(); 10053 trap._setSubtreeIsolation(false); 10054 onPostPause === null || onPostPause === void 0 || onPostPause(); 10055 } else { 10056 var onUnpause = getOption(options, 'onUnpause'); 10057 var onPostUnpause = getOption(options, 'onPostUnpause'); 10058 onUnpause === null || onUnpause === void 0 || onUnpause(); 10059 trap._setSubtreeIsolation(true); 10060 updateTabbableNodes(); 10061 addListeners(); 10062 updateObservedNodes(); 10063 onPostUnpause === null || onPostUnpause === void 0 || onPostUnpause(); 10064 } 10065 return this; 10066 } 10067 }, 10068 _setSubtreeIsolation: { 10069 value: function value(isEnabled) { 10070 if (config.isolateSubtrees) { 10071 state.adjacentElements.forEach(function (el) { 10072 var _el$getAttribute; 10073 if (isEnabled) { 10074 switch (config.isolateSubtrees) { 10075 case 'aria-hidden': 10076 // check both attribute and property to ensure initial state is captured 10077 // correctly across different browsers and test environments (like JSDOM) 10078 if (el.ariaHidden === 'true' || ((_el$getAttribute = el.getAttribute('aria-hidden')) === null || _el$getAttribute === void 0 ? void 0 : _el$getAttribute.toLowerCase()) === 'true') { 10079 state.alreadySilent.add(el); 10080 } 10081 el.setAttribute('aria-hidden', 'true'); 10082 break; 10083 default: 10084 // check both attribute and property to ensure initial state is captured 10085 // correctly across different browsers and test environments (like JSDOM) 10086 if (el.inert || el.hasAttribute('inert')) { 10087 state.alreadySilent.add(el); 10088 } 10089 el.setAttribute('inert', true); 10090 break; 10091 } 10092 } else { 10093 if (state.alreadySilent.has(el)) ;
vendor: 25,176 bytes, lines 10093-10792
10093else { 10094 switch (config.isolateSubtrees) { 10095 case 'aria-hidden': 10096 el.removeAttribute('aria-hidden'); 10097 break; 10098 default: 10099 el.removeAttribute('inert'); 10100 break; 10101 } 10102 } 10103 } 10104 }); 10105 } 10106 } 10107 } 10108 }); 10109 10110 // initialize container elements 10111 trap.updateContainerElements(elements); 10112 return trap; 10113}; 10114exports.createFocusTrap = createFocusTrap; 10115 10116},{"tabbable":71}],15:[function(require,module,exports){ 10117(function (global){(function (){ 10118"use strict"; 10119 10120function _typeof(o) { 10121 "@babel/helpers - typeof"; 10122 10123 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { 10124 return typeof o; 10125 } : function (o) { 10126 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 10127 }, _typeof(o); 10128} 10129Object.defineProperty(exports, "__esModule", { 10130 value: true 10131}); 10132exports.Abide = void 0; 10133var _jquery = _interopRequireDefault((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 10134var _foundationCore = require("./foundation.core.plugin"); 10135var _foundationCore2 = require("./foundation.core.utils"); 10136function _interopRequireDefault(e) { 10137 return e && e.__esModule ? e : { 10138 "default": e 10139 }; 10140} 10141function _classCallCheck(a, n) { 10142 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); 10143} 10144function _defineProperties(e, r) { 10145 for (var t = 0; t < r.length; t++) { 10146 var o = r[t]; 10147 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); 10148 } 10149} 10150function _createClass(e, r, t) { 10151 return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { 10152 writable: !1 10153 }), e; 10154} 10155function _toPropertyKey(t) { 10156 var i = _toPrimitive(t, "string"); 10157 return "symbol" == _typeof(i) ? i : i + ""; 10158} 10159function _toPrimitive(t, r) { 10160 if ("object" != _typeof(t) || !t) return t; 10161 var e = t[Symbol.toPrimitive]; 10162 if (void 0 !== e) { 10163 var i = e.call(t, r || "default"); 10164 if ("object" != _typeof(i)) return i; 10165 throw new TypeError("@@toPrimitive must return a primitive value."); 10166 } 10167 return ("string" === r ? String : Number)(t); 10168} 10169function _callSuper(t, o, e) { 10170 return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); 10171} 10172function _possibleConstructorReturn(t, e) { 10173 if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; 10174 if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); 10175 return _assertThisInitialized(t); 10176} 10177function _assertThisInitialized(e) { 10178 if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 10179 return e; 10180} 10181function _isNativeReflectConstruct() { 10182 try { 10183 var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); 10184 } catch (t) {} 10185 return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { 10186 return !!t; 10187 })(); 10188} 10189function _getPrototypeOf(t) { 10190 return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { 10191 return t.__proto__ || Object.getPrototypeOf(t); 10192 }, _getPrototypeOf(t); 10193} 10194function _inherits(t, e) { 10195 if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); 10196 t.prototype = Object.create(e && e.prototype, { 10197 constructor: { 10198 value: t, 10199 writable: !0, 10200 configurable: !0 10201 } 10202 }), Object.defineProperty(t, "prototype", { 10203 writable: !1 10204 }), e && _setPrototypeOf(t, e); 10205} 10206function _setPrototypeOf(t, e) { 10207 return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { 10208 return t.__proto__ = e, t; 10209 }, _setPrototypeOf(t, e); 10210} 10211/** 10212 * Abide module. 10213 * @module foundation.abide 10214 */ 10215var Abide = exports.Abide = /*#__PURE__*/function (_Plugin) { 10216 function Abide() { 10217 _classCallCheck(this, Abide); 10218 return _callSuper(this, Abide, arguments); 10219 } 10220 _inherits(Abide, _Plugin); 10221 return _createClass(Abide, [{ 10222 key: "_setup", 10223 value: 10224 /** 10225 * Creates a new instance of Abide. 10226 * @class 10227 * @name Abide 10228 * @fires Abide#init 10229 * @param {Object} element - jQuery object to add the trigger to. 10230 * @param {Object} options - Overrides to the default plugin settings. 10231 */ 10232 function _setup(element) { 10233 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 10234 this.$element = element; 10235 this.options = _jquery["default"].extend(true, {}, Abide.defaults, this.$element.data(), options); 10236 this.isEnabled = true; 10237 this.formnovalidate = null; 10238 this.className = 'Abide'; // ie9 back compat 10239 this._init(); 10240 } 10241 10242 /** 10243 * Initializes the Abide plugin and calls functions to get Abide functioning on load. 10244 * @private 10245 */ 10246 }, { 10247 key: "_init", 10248 value: function _init() { 10249 var _this2 = this; 10250 this.$inputs = _jquery["default"].merge( 10251 // Consider as input to validate: 10252 this.$element.find('input').not('[type="submit"]'), 10253 // * all input fields expect submit 10254 this.$element.find('textarea, select') // * all textareas and select fields 10255 ); 10256 this.$submits = this.$element.find('[type="submit"]'); 10257 var $globalErrors = this.$element.find('[data-abide-error]'); 10258 10259 // Add a11y attributes to all fields 10260 if (this.options.a11yAttributes) { 10261 this.$inputs.each(function (i, input) { 10262 return _this2.addA11yAttributes((0, _jquery["default"])(input)); 10263 }); 10264 $globalErrors.each(function (i, error) { 10265 return _this2.addGlobalErrorA11yAttributes((0, _jquery["default"])(error)); 10266 }); 10267 } 10268 this._events(); 10269 } 10270 10271 /** 10272 * Initializes events for Abide. 10273 * @private 10274 */ 10275 }, { 10276 key: "_events", 10277 value: function _events() { 10278 var _this3 = this; 10279 this.$element.off('.abide').on('reset.zf.abide', function () { 10280 _this3.resetForm(); 10281 }).on('submit.zf.abide', function () { 10282 return _this3.validateForm(); 10283 }); 10284 this.$submits.off('click.zf.abide keydown.zf.abide').on('click.zf.abide keydown.zf.abide', function (e) { 10285 if (!e.key || e.key === ' ' || e.key === 'Enter') { 10286 e.preventDefault(); 10287 _this3.formnovalidate = e.target.getAttribute('formnovalidate') !== null; 10288 _this3.$element.submit(); 10289 } 10290 }); 10291 if (this.options.validateOn === 'fieldChange') { 10292 this.$inputs.off('change.zf.abide').on('change.zf.abide', function (e) { 10293 _this3.validateInput((0, _jquery["default"])(e.target)); 10294 }); 10295 } 10296 if (this.options.liveValidate) { 10297 this.$inputs.off('input.zf.abide').on('input.zf.abide', function (e) { 10298 _this3.validateInput((0, _jquery["default"])(e.target)); 10299 }); 10300 } 10301 if (this.options.validateOnBlur) { 10302 this.$inputs.off('blur.zf.abide').on('blur.zf.abide', function (e) { 10303 _this3.validateInput((0, _jquery["default"])(e.target)); 10304 }); 10305 } 10306 } 10307 10308 /** 10309 * Calls necessary functions to update Abide upon DOM change 10310 * @private 10311 */ 10312 }, { 10313 key: "_reflow", 10314 value: function _reflow() { 10315 this._init(); 10316 } 10317 10318 /** 10319 * Checks whether the submitted form should be validated or not, consodering formnovalidate and isEnabled 10320 * @returns {Boolean} 10321 * @private 10322 */ 10323 }, { 10324 key: "_validationIsDisabled", 10325 value: function _validationIsDisabled() { 10326 if (this.isEnabled === false) { 10327 // whole validation disabled 10328 return true; 10329 } else if (typeof this.formnovalidate === 'boolean') { 10330 // triggered by $submit 10331 return this.formnovalidate; 10332 } 10333 // triggered by Enter in non-submit input 10334 return this.$submits.length ? this.$submits[0].getAttribute('formnovalidate') !== null : false; 10335 } 10336 10337 /** 10338 * Enables the whole validation 10339 */ 10340 }, { 10341 key: "enableValidation", 10342 value: function enableValidation() { 10343 this.isEnabled = true; 10344 } 10345 10346 /** 10347 * Disables the whole validation 10348 */ 10349 }, { 10350 key: "disableValidation", 10351 value: function disableValidation() { 10352 this.isEnabled = false; 10353 } 10354 10355 /** 10356 * Checks whether or not a form element has the required attribute and if it's checked or not 10357 * @param {Object} element - jQuery object to check for required attribute 10358 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 10359 */ 10360 }, { 10361 key: "requiredCheck", 10362 value: function requiredCheck($el) { 10363 if (!$el.attr('required')) return true; 10364 var isGood = true; 10365 switch ($el[0].type) { 10366 case 'checkbox': 10367 isGood = $el[0].checked; 10368 break; 10369 case 'select': 10370 case 'select-one': 10371 case 'select-multiple': 10372 var opt = $el.find('option:selected'); 10373 if (!opt.length || !opt.val()) isGood = false; 10374 break; 10375 default: 10376 if (!$el.val() || !$el.val().length) isGood = false; 10377 } 10378 return isGood; 10379 } 10380 10381 /** 10382 * Get: 10383 * - Based on $el, the first element(s) corresponding to `formErrorSelector` in this order: 10384 * 1. The element's direct sibling('s). 10385 * 2. The element's parent's children. 10386 * - Element(s) with the attribute `[data-form-error-for]` set with the element's id. 10387 * 10388 * This allows for multiple form errors per input, though if none are found, no form errors will be shown. 10389 * 10390 * @param {Object} $el - jQuery object to use as reference to find the form error selector. 10391 * @param {String[]} [failedValidators] - List of failed validators. 10392 * @returns {Object} jQuery object with the selector. 10393 */ 10394 }, { 10395 key: "findFormError", 10396 value: function findFormError($el, failedValidators) { 10397 var _this4 = this; 10398 var id = $el.length ? $el[0].id : ''; 10399 var $error = $el.siblings(this.options.formErrorSelector); 10400 if (!$error.length) { 10401 $error = $el.parent().find(this.options.formErrorSelector); 10402 } 10403 if (id) { 10404 $error = $error.add(this.$element.find("[data-form-error-for=\"".concat(id, "\"]"))); 10405 } 10406 if (!!failedValidators) { 10407 $error = $error.not('[data-form-error-on]'); 10408 failedValidators.forEach(function (v) { 10409 $error = $error.add($el.siblings("[data-form-error-on=\"".concat(v, "\"]"))); 10410 $error = $error.add(_this4.$element.find("[data-form-error-for=\"".concat(id, "\"][data-form-error-on=\"").concat(v, "\"]"))); 10411 }); 10412 } 10413 return $error; 10414 } 10415 10416 /** 10417 * Get the first element in this order: 10418 * 2. The <label> with the attribute `[for="someInputId"]` 10419 * 3. The `.closest()` <label> 10420 * 10421 * @param {Object} $el - jQuery object to check for required attribute 10422 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 10423 */ 10424 }, { 10425 key: "findLabel", 10426 value: function findLabel($el) { 10427 var id = $el[0].id; 10428 var $label = this.$element.find("label[for=\"".concat(id, "\"]")); 10429 if (!$label.length) { 10430 return $el.closest('label'); 10431 } 10432 return $label; 10433 } 10434 10435 /** 10436 * Get the set of labels associated with a set of radio els in this order 10437 * 2. The <label> with the attribute `[for="someInputId"]` 10438 * 3. The `.closest()` <label> 10439 * 10440 * @param {Object} $el - jQuery object to check for required attribute 10441 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 10442 */ 10443 }, { 10444 key: "findRadioLabels", 10445 value: function findRadioLabels($els) { 10446 var _this5 = this; 10447 var labels = $els.map(function (i, el) { 10448 var id = el.id; 10449 var $label = _this5.$element.find("label[for=\"".concat(id, "\"]")); 10450 if (!$label.length) { 10451 $label = (0, _jquery["default"])(el).closest('label'); 10452 } 10453 return $label[0]; 10454 }); 10455 return (0, _jquery["default"])(labels); 10456 } 10457 10458 /** 10459 * Get the set of labels associated with a set of checkbox els in this order 10460 * 2. The <label> with the attribute `[for="someInputId"]` 10461 * 3. The `.closest()` <label> 10462 * 10463 * @param {Object} $el - jQuery object to check for required attribute 10464 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 10465 */ 10466 }, { 10467 key: "findCheckboxLabels", 10468 value: function findCheckboxLabels($els) { 10469 var _this6 = this; 10470 var labels = $els.map(function (i, el) { 10471 var id = el.id; 10472 var $label = _this6.$element.find("label[for=\"".concat(id, "\"]")); 10473 if (!$label.length) { 10474 $label = (0, _jquery["default"])(el).closest('label'); 10475 } 10476 return $label[0]; 10477 }); 10478 return (0, _jquery["default"])(labels); 10479 } 10480 10481 /** 10482 * Adds the CSS error class as specified by the Abide settings to the label, input, and the form 10483 * @param {Object} $el - jQuery object to add the class to 10484 * @param {String[]} [failedValidators] - List of failed validators. 10485 */ 10486 }, { 10487 key: "addErrorClasses", 10488 value: function addErrorClasses($el, failedValidators) { 10489 var $label = this.findLabel($el); 10490 var $formError = this.findFormError($el, failedValidators); 10491 if ($label.length) { 10492 $label.addClass(this.options.labelErrorClass); 10493 } 10494 if ($formError.length) { 10495 $formError.addClass(this.options.formErrorClass); 10496 } 10497 $el.addClass(this.options.inputErrorClass).attr({ 10498 'data-invalid': '', 10499 'aria-invalid': true 10500 }); 10501 if ($formError.filter(':visible').length) { 10502 this.addA11yErrorDescribe($el, $formError); 10503 } 10504 } 10505 10506 /** 10507 * Adds [for] and [role=alert] attributes to all form error targetting $el, 10508 * and [aria-describedby] attribute to $el toward the first form error. 10509 * @param {Object} $el - jQuery object 10510 */ 10511 }, { 10512 key: "addA11yAttributes", 10513 value: function addA11yAttributes($el) { 10514 var $errors = this.findFormError($el); 10515 var $labels = $errors.filter('label'); 10516 if (!$errors.length) return; 10517 var $error = $errors.filter(':visible').first(); 10518 if ($error.length) { 10519 this.addA11yErrorDescribe($el, $error); 10520 } 10521 if ($labels.filter('[for]').length < $labels.length) { 10522 // Get the input ID or create one 10523 var elemId = $el.attr('id'); 10524 if (typeof elemId === 'undefined') { 10525 elemId = (0, _foundationCore2.GetYoDigits)(6, 'abide-input'); 10526 $el.attr('id', elemId); 10527 } 10528 10529 // For each label targeting $el, set [for] if it is not set. 10530 $labels.each(function (i, label) { 10531 var $label = (0, _jquery["default"])(label); 10532 if (typeof $label.attr('for') === 'undefined') $label.attr('for', elemId); 10533 }); 10534 } 10535 10536 // For each error targeting $el, set [role=alert] if it is not set. 10537 $errors.each(function (i, label) { 10538 var $label = (0, _jquery["default"])(label); 10539 if (typeof $label.attr('role') === 'undefined') $label.attr('role', 'alert'); 10540 }).end(); 10541 } 10542 }, { 10543 key: "addA11yErrorDescribe", 10544 value: function addA11yErrorDescribe($el, $error) { 10545 if ($el.attr('type') === 'hidden') return; 10546 if (typeof $el.attr('aria-describedby') !== 'undefined') return; 10547 10548 // Set [aria-describedby] on the input toward the first form error if it is not set 10549 // Get the first error ID or create one 10550 var errorId = $error.attr('id'); 10551 if (typeof errorId === 'undefined') { 10552 errorId = (0, _foundationCore2.GetYoDigits)(6, 'abide-error'); 10553 $error.attr('id', errorId); 10554 } 10555 $el.attr('aria-describedby', errorId).data('abide-describedby', true); 10556 } 10557 10558 /** 10559 * Adds [aria-live] attribute to the given global form error $el. 10560 * @param {Object} $el - jQuery object to add the attribute to 10561 */ 10562 }, { 10563 key: "addGlobalErrorA11yAttributes", 10564 value: function addGlobalErrorA11yAttributes($el) { 10565 if (typeof $el.attr('aria-live') === 'undefined') $el.attr('aria-live', this.options.a11yErrorLevel); 10566 } 10567 10568 /** 10569 * Remove CSS error classes etc from an entire radio button group 10570 * @param {String} groupName - A string that specifies the name of a radio button group 10571 * 10572 */ 10573 }, { 10574 key: "removeRadioErrorClasses", 10575 value: function removeRadioErrorClasses(groupName) { 10576 var $els = this.$element.find(":radio[name=\"".concat(groupName, "\"]")); 10577 var $labels = this.findRadioLabels($els); 10578 var $formErrors = this.findFormError($els); 10579 if ($labels.length) { 10580 $labels.removeClass(this.options.labelErrorClass); 10581 } 10582 if ($formErrors.length) { 10583 $formErrors.removeClass(this.options.formErrorClass); 10584 } 10585 $els.removeClass(this.options.inputErrorClass).attr({ 10586 'data-invalid': null, 10587 'aria-invalid': null 10588 }); 10589 } 10590 10591 /** 10592 * Remove CSS error classes etc from an entire checkbox group 10593 * @param {String} groupName - A string that specifies the name of a checkbox group 10594 * 10595 */ 10596 }, { 10597 key: "removeCheckboxErrorClasses", 10598 value: function removeCheckboxErrorClasses(groupName) { 10599 var $els = this.$element.find(":checkbox[name=\"".concat(groupName, "\"]")); 10600 var $labels = this.findCheckboxLabels($els); 10601 var $formErrors = this.findFormError($els); 10602 if ($labels.length) { 10603 $labels.removeClass(this.options.labelErrorClass); 10604 } 10605 if ($formErrors.length) { 10606 $formErrors.removeClass(this.options.formErrorClass); 10607 } 10608 $els.removeClass(this.options.inputErrorClass).attr({ 10609 'data-invalid': null, 10610 'aria-invalid': null 10611 }); 10612 } 10613 10614 /** 10615 * Removes CSS error class as specified by the Abide settings from the label, input, and the form 10616 * @param {Object} $el - jQuery object to remove the class from 10617 */ 10618 }, { 10619 key: "removeErrorClasses", 10620 value: function removeErrorClasses($el) { 10621 // radios need to clear all of the els 10622 if ($el[0].type === 'radio') { 10623 return this.removeRadioErrorClasses($el.attr('name')); 10624 } 10625 // checkboxes need to clear all of the els 10626 else if ($el[0].type === 'checkbox') { 10627 return this.removeCheckboxErrorClasses($el.attr('name')); 10628 } 10629 var $label = this.findLabel($el); 10630 var $formError = this.findFormError($el); 10631 if ($label.length) { 10632 $label.removeClass(this.options.labelErrorClass); 10633 } 10634 if ($formError.length) { 10635 $formError.removeClass(this.options.formErrorClass); 10636 } 10637 $el.removeClass(this.options.inputErrorClass).attr({ 10638 'data-invalid': null, 10639 'aria-invalid': null 10640 }); 10641 if ($el.data('abide-describedby')) { 10642 $el.removeAttr('aria-describedby').removeData('abide-describedby'); 10643 } 10644 } 10645 10646 /** 10647 * Goes through a form to find inputs and proceeds to validate them in ways specific to their type. 10648 * Ignores inputs with data-abide-ignore, type="hidden" or disabled attributes set 10649 * @fires Abide#invalid 10650 * @fires Abide#valid 10651 * @param {Object} element - jQuery object to validate, should be an HTML input 10652 * @returns {Boolean} goodToGo - If the input is valid or not. 10653 */ 10654 }, { 10655 key: "validateInput", 10656 value: function validateInput($el) { 10657 var _this7 = this; 10658 var clearRequire = this.requiredCheck($el), 10659 validator = $el.attr('data-validator'), 10660 failedValidators = [], 10661 manageErrorClasses = true; 10662 10663 // skip validation if disabled 10664 if (this._validationIsDisabled()) { 10665 return true; 10666 } 10667 10668 // don't validate ignored inputs or hidden inputs or disabled inputs 10669 if ($el.is('[data-abide-ignore]') || $el.is('[type="hidden"]') || $el.is('[disabled]')) { 10670 return true; 10671 } 10672 switch ($el[0].type) { 10673 case 'radio': 10674 this.validateRadio($el.attr('name')) || failedValidators.push('required'); 10675 break; 10676 case 'checkbox': 10677 this.validateCheckbox($el.attr('name')) || failedValidators.push('required'); 10678 // validateCheckbox() adds/removes error classes 10679 manageErrorClasses = false; 10680 break; 10681 case 'select': 10682 case 'select-one': 10683 case 'select-multiple': 10684 clearRequire || failedValidators.push('required'); 10685 break; 10686 default: 10687 clearRequire || failedValidators.push('required'); 10688 this.validateText($el) || failedValidators.push('pattern'); 10689 } 10690 if (validator) { 10691 var required = $el.attr('required') ? true : false; 10692 validator.split(' ').forEach(function (v) { 10693 _this7.options.validators[v]($el, required, $el.parent()) || failedValidators.push(v); 10694 }); 10695 } 10696 if ($el.attr('data-equalto')) { 10697 this.options.validators.equalTo($el) || failedValidators.push('equalTo'); 10698 } 10699 var goodToGo = failedValidators.length === 0; 10700 var message = (goodToGo ? 'valid' : 'invalid') + '.zf.abide'; 10701 if (goodToGo) { 10702 // Re-validate inputs that depend on this one with equalto 10703 var dependentElements = this.$element.find("[data-equalto=\"".concat($el.attr('id'), "\"]")); 10704 if (dependentElements.length) { 10705 var _this = this; 10706 dependentElements.each(function () { 10707 if ((0, _jquery["default"])(this).val()) { 10708 _this.validateInput((0, _jquery["default"])(this)); 10709 } 10710 }); 10711 } 10712 } 10713 if (manageErrorClasses) { 10714 this.removeErrorClasses($el); 10715 if (!goodToGo) { 10716 this.addErrorClasses($el, failedValidators); 10717 } 10718 } 10719 10720 /** 10721 * Fires when the input is done checking for validation. Event trigger is either `valid.zf.abide` or `invalid.zf.abide` 10722 * Trigger includes the DOM element of the input. 10723 * @event Abide#valid 10724 * @event Abide#invalid 10725 */ 10726 $el.trigger(message, [$el]); 10727 return goodToGo; 10728 } 10729 10730 /** 10731 * Goes through a form and if there are any invalid inputs, it will display the form error element 10732 * @returns {Boolean} noError - true if no errors were detected... 10733 * @fires Abide#formvalid 10734 * @fires Abide#forminvalid 10735 */ 10736 }, { 10737 key: "validateForm", 10738 value: function validateForm() { 10739 var _this8 = this; 10740 var acc = []; 10741 var _this = this; 10742 var checkboxGroupName; 10743 10744 // Remember first form submission to prevent specific checkbox validation (more than one required) until form got initially submitted 10745 if (!this.initialized) { 10746 this.initialized = true; 10747 } 10748 10749 // skip validation if disabled 10750 if (this._validationIsDisabled()) { 10751 this.formnovalidate = null; 10752 return true; 10753 } 10754 this.$inputs.each(function () { 10755 // Only use one checkbox per group since validateCheckbox() iterates over all associated checkboxes 10756 if ((0, _jquery["default"])(this)[0].type === 'checkbox') { 10757 if ((0, _jquery["default"])(this).attr('name') === checkboxGroupName) return true; 10758 checkboxGroupName = (0, _jquery["default"])(this).attr('name'); 10759 } 10760 acc.push(_this.validateInput((0, _jquery["default"])(this))); 10761 }); 10762 var noError = acc.indexOf(false) === -1; 10763 this.$element.find('[data-abide-error]').each(function (i, elem) { 10764 var $elem = (0, _jquery["default"])(elem); 10765 // Ensure a11y attributes are set 10766 if (_this8.options.a11yAttributes) _this8.addGlobalErrorA11yAttributes($elem); 10767 // Show or hide the error 10768 $elem.css('display', noError ? 'none' : 'block'); 10769 }); 10770 10771 /** 10772 * Fires when the form is finished validating. Event trigger is either `formvalid.zf.abide` or `forminvalid.zf.abide`. 10773 * Trigger includes the element of the form. 10774 * @event Abide#formvalid 10775 * @event Abide#forminvalid 10776 */ 10777 this.$element.trigger((noError ? 'formvalid' : 'forminvalid') + '.zf.abide', [this.$element]); 10778 return noError; 10779 } 10780 10781 /** 10782 * Determines whether or a not a text input is valid based on the pattern specified in the attribute. If no matching pattern is found, returns true. 10783 * @param {Object} $el - jQuery object to validate, should be a text input HTML element 10784 * @param {String} pattern - string value of one of the RegEx patterns in Abide.options.patterns 10785 * @returns {Boolean} Boolean value depends on whether or not the input value matches the pattern specified 10786 */ 10787 }, { 10788 key: "validateText", 10789 value: function validateText($el, pattern) { 10790 // A pattern can be passed to this function, or it will be infered from the input's "pattern" attribute, or it's "type" attribute 10791 pattern = pattern || $el.attr('data-pattern') || $el.attr('pattern') || $el.attr('type'); 10792 var inputText = $el.val();
10793 var valid = true; 10794 if (inputText.length) { 10795 // If the pattern attribute on the element is in Abide's list of patterns, then test that regexp 10796 if (this.options.patterns.hasOwnProperty(pattern)) { 10797 valid = this.options.patterns[pattern].test(inputText); 10798 } 10799 // If the pattern name isn't also the type attribute of the field, then test it as a regexp 10800 else if (pattern !== $el.attr('type')) { 10801 valid = new RegExp(pattern).test(inputText); 10802 } 10803 } 10804 return valid; 10805 } 10806 10807 /** 10808 * Determines whether or a not a radio input is valid based on whether or not it is required and selected. Although the function targets a single `<input>`, it validates by checking the `required` and `checked` properties of all radio buttons in its group. 10809 * @param {String} groupName - A string that specifies the name of a radio button group 10810 * @returns {Boolean} Boolean value depends on whether or not at least one radio input has been selected (if it's required) 10811 */ 10812 }, { 10813 key: "validateRadio", 10814 value: function validateRadio(groupName) { 10815 // If at least one radio in the group has the `required` attribute, the group is considered required 10816 // Per W3C spec, all radio buttons in a group should have `required`, but we're being nice 10817 var $group = this.$element.find(":radio[name=\"".concat(groupName, "\"]")); 10818 var valid = false, 10819 required = false; 10820 10821 // For the group to be required, at least one radio needs to be required 10822 $group.each(function (i, e) { 10823 if ((0, _jquery["default"])(e).attr('required')) { 10824 required = true; 10825 } 10826 }); 10827 if (!required) valid = true; 10828 if (!valid) { 10829 // For the group to be valid, at least one radio needs to be checked 10830 $group.each(function (i, e) { 10831 if ((0, _jquery["default"])(e).prop('checked')) { 10832 valid = true; 10833 } 10834 }); 10835 } 10836 return valid; 10837 } 10838 10839 /** 10840 * Determines whether or a not a checkbox input is valid based on whether or not it is required and checked. Although the function targets a single `<input>`, it validates by checking the `required` and `checked` properties of all checkboxes in its group. 10841 * @param {String} groupName - A string that specifies the name of a checkbox group 10842 * @returns {Boolean} Boolean value depends on whether or not at least one checkbox input has been checked (if it's required) 10843 */ 10844 }, { 10845 key: "validateCheckbox", 10846 value: function validateCheckbox(groupName) { 10847 var _this9 = this; 10848 // If at least one checkbox in the group has the `required` attribute, the group is considered required 10849 // Per W3C spec, all checkboxes in a group should have `required`, but we're being nice 10850 var $group = this.$element.find(":checkbox[name=\"".concat(groupName, "\"]")); 10851 var valid = false, 10852 required = false, 10853 minRequired = 1, 10854 checked = 0; 10855 10856 // For the group to be required, at least one checkbox needs to be required 10857 $group.each(function (i, e) { 10858 if ((0, _jquery["default"])(e).attr('required')) { 10859 required = true; 10860 } 10861 }); 10862 if (!required) valid = true; 10863 if (!valid) { 10864 // Count checked checkboxes within the group 10865 // Use data-min-required if available (default: 1) 10866 $group.each(function (i, e) { 10867 if ((0, _jquery["default"])(e).prop('checked')) { 10868 checked++; 10869 } 10870 if (typeof (0, _jquery["default"])(e).attr('data-min-required') !== 'undefined') { 10871 minRequired = parseInt((0, _jquery["default"])(e).attr('data-min-required'), 10); 10872 } 10873 }); 10874 10875 // For the group to be valid, the minRequired amount of checkboxes have to be checked 10876 if (checked >= minRequired) { 10877 valid = true; 10878 } 10879 } 10880 10881 // Skip validation if more than 1 checkbox have to be checked AND if the form hasn't got submitted yet (otherwise it will already show an error during the first fill in) 10882 if (this.initialized !== true && minRequired > 1) { 10883 return true; 10884 } 10885 10886 // Refresh error class for all input 10887 $group.each(function (i, e) { 10888 if (!valid) { 10889 _this9.addErrorClasses((0, _jquery["default"])(e), ['required']); 10890 } else { 10891 _this9.removeErrorClasses((0, _jquery["default"])(e)); 10892 } 10893 }); 10894 return valid; 10895 } 10896 10897 /** 10898 * Determines if a selected input passes a custom validation function. Multiple validations can be used, if passed to the element with `data-validator="foo bar baz"` in a space separated listed. 10899 * @param {Object} $el - jQuery input element. 10900 * @param {String} validators - a string of function names matching functions in the Abide.options.validators object. 10901 * @param {Boolean} required - self explanatory? 10902 * @returns {Boolean} - true if validations passed. 10903 */ 10904 }, { 10905 key: "matchValidation", 10906 value: function matchValidation($el, validators, required) { 10907 var _this0 = this; 10908 required = required ? true : false;
10909 var clear = validators.split(' ').map(function (v) { 10910 return _this0.options.validators[v]($el, required, $el.parent()); 10911 }); 10912 return clear.indexOf(false) === -1; 10913 } 10914 10915 /** 10916 * Resets form inputs and styles 10917 * @fires Abide#formreset 10918 */ 10919 }, { 10920 key: "resetForm", 10921 value: function resetForm() { 10922 var $form = this.$element, 10923 opts = this.options; 10924 (0, _jquery["default"])(".".concat(opts.labelErrorClass), $form).not('small').removeClass(opts.labelErrorClass); 10925 (0, _jquery["default"])(".".concat(opts.inputErrorClass), $form).not('small').removeClass(opts.inputErrorClass); 10926 (0, _jquery["default"])("".concat(opts.formErrorSelector, ".").concat(opts.formErrorClass)).removeClass(opts.formErrorClass); 10927 $form.find('[data-abide-error]').css('display', 'none'); 10928 (0, _jquery["default"])(':input', $form).not(':button, :submit, :reset, :hidden, :radio, :checkbox, [data-abide-ignore]').val('').attr({ 10929 'data-invalid': null, 10930 'aria-invalid': null 10931 }); 10932 (0, _jquery["default"])(':input:radio', $form).not('[data-abide-ignore]').prop('checked', false).attr({ 10933 'data-invalid': null, 10934 'aria-invalid': null 10935 }); 10936 (0, _jquery["default"])(':input:checkbox', $form).not('[data-abide-ignore]').prop('checked', false).attr({ 10937 'data-invalid': null, 10938 'aria-invalid': null 10939 }); 10940 /** 10941 * Fires when the form has been reset. 10942 * @event Abide#formreset 10943 */ 10944 $form.trigger('formreset.zf.abide', [$form]); 10945 } 10946 10947 /** 10948 * Destroys an instance of Abide. 10949 * Removes error styles and classes from elements, without resetting their values. 10950 */ 10951 }, { 10952 key: "_destroy", 10953 value: function _destroy() { 10954 var _this = this; 10955 this.$element.off('.abide').find('[data-abide-error]').css('display', 'none'); 10956 this.$inputs.off('.abide').each(function () { 10957 _this.removeErrorClasses((0, _jquery["default"])(this)); 10958 }); 10959 this.$submits.off('.abide'); 10960 } 10961 }]); 10962}
10962(_foundationCore.Plugin); 10963/** 10964 * Default settings for plugin 10965 */ 10966Abide.defaults = { 10967 /** 10968 * The default event to validate inputs. Checkboxes and radios validate immediately. 10969 * Remove or change this value for manual validation. 10970 * @option 10971 * @type {?string} 10972 * @default 'fieldChange' 10973 */ 10974 validateOn: 'fieldChange', 10975 /** 10976 * Class to be applied to input labels on failed validation. 10977 * @option 10978 * @type {string} 10979 * @default 'is-invalid-label' 10980 */ 10981 labelErrorClass: 'is-invalid-label', 10982 /** 10983 * Class to be applied to inputs on failed validation. 10984 * @option 10985 * @type {string} 10986 * @default 'is-invalid-input' 10987 */ 10988 inputErrorClass: 'is-invalid-input', 10989 /** 10990 * Class selector to use to target Form Errors for show/hide. 10991 * @option 10992 * @type {string} 10993 * @default '.form-error' 10994 */ 10995 formErrorSelector: '.form-error', 10996 /** 10997 * Class added to Form Errors on failed validation. 10998 * @option 10999 * @type {string} 11000 * @default 'is-visible' 11001 */ 11002 formErrorClass: 'is-visible', 11003 /** 11004 * If true, automatically insert when possible: 11005 * - `[aria-describedby]` on fields 11006 * - `[role=alert]` on form errors and `[for]` on form error labels 11007 * - `[aria-live]` on global errors `[data-abide-error]` (see option `a11yErrorLevel`). 11008 * @option 11009 * @type {boolean} 11010 * @default true 11011 */ 11012 a11yAttributes: true, 11013 /** 11014 * [aria-live] attribute value to be applied on global errors `[data-abide-error]`. 11015 * Options are: 'assertive', 'polite' and 'off'/null 11016 * @option 11017 * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions 11018 * @type {string} 11019 * @default 'assertive' 11020 */ 11021 a11yErrorLevel: 'assertive', 11022 /** 11023 * Set to true to validate text inputs on any value change. 11024 * @option 11025 * @type {boolean} 11026 * @default false 11027 */ 11028 liveValidate: false, 11029 /** 11030 * Set to true to validate inputs on blur. 11031 * @option 11032 * @type {boolean} 11033 * @default false 11034 */ 11035 validateOnBlur: false, 11036 patterns: { 11037 alpha: /^[a-zA-Z]+$/, 11038 // eslint-disable-next-line camelcase 11039 alpha_numeric: /^[a-zA-Z0-9]+$/, 11040 integer: /^[-+]?\d+$/, 11041 number: /^[-+]?\d*(?:[\.\,]\d+)?$/, 11042 // amex, visa, diners 11043 card: /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(?:222[1-9]|2[3-6][0-9]{2}|27[0-1][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/, 11044 cvv: /^([0-9]){3,4}$/, 11045 // http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address 11046 email: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/,
11047 // From CommonRegexJS (@talyssonoc) 11048 // https://github.com/talyssonoc/CommonRegexJS/blob/e2901b9f57222bc14069dc8f0598d5f412555411/lib/commonregex.js#L76 11049 // For more restrictive URL Regexs, see https://mathiasbynens.be/demo/url-regex. 11050 url: /^((?:(https?|ftps?|file|ssh|sftp):\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))*\))+(?:\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?\xab\xbb\u201c\u201d\u2018\u2019]))$/, 11051 // abc.de 11052 domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/, 11053 datetime: /^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/, 11054 // YYYY-MM-DD 11055 date: /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$/, 11056 // HH:MM:SS 11057 time: /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/, 11058 dateISO: /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/, 11059 // MM/DD/YYYY 11060 // eslint-disable-next-line camelcase 11061 month_day_year: /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/, 11062 // DD/MM/YYYY 11063 // eslint-disable-next-line camelcase 11064 day_month_year: /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/, 11065 // #FFF or #FFFFFF 11066 color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/, 11067 // Domain || URL 11068 website: { 11069 test: function test(text) { 11070 return Abide.defaults.patterns.domain.test(text) || Abide.defaults.patterns.url.test(text); 11071 } 11072 } 11073 }, 11074 /** 11075 * Optional validation functions to be used. `equalTo` being the only default included function. 11076 * Functions should return only a boolean if the input is valid or not. Functions are given the following arguments: 11077 * el : The jQuery element to validate. 11078 * @option 11079 */ 11080 validators: { 11081 equalTo: function equalTo(el) { 11082 return (0, _jquery["default"])("#".concat(el.attr('data-equalto'))).val() === el.val(); 11083 } 11084 } 11085}; 11086 11087}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 11088},{"./foundation.core.plugin":18,"./foundation.core.utils":19}],16:[function(require,module,exports){ 11089(function (global){(function (){ 11090"use strict"; 11091 11092function _typeof(o) { 11093 "@babel/helpers - typeof"; 11094 11095 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { 11096 return typeof o; 11097 } : function (o) { 11098 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 11099 }, _typeof(o); 11100} 11101Object.defineProperty(exports, "__esModule", { 11102 value: true 11103}); 11104exports.Accordion = void 0; 11105var _jquery = _interopRequireDefault((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 11106var _foundationCore = require("./foundation.core.plugin"); 11107var _foundationCore2 = require("./foundation.core.utils"); 11108var _foundationUtil = require("./foundation.util.keyboard"); 11109function _interopRequireDefault(e) { 11110 return e && e.__esModule ? e : { 11111 "default": e 11112 }; 11113} 11114function _classCallCheck(a, n) { 11115 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); 11116} 11117function _defineProperties(e, r) { 11118 for (var t = 0; t < r.length; t++) { 11119 var o = r[t]; 11120 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); 11121 } 11122} 11123function _createClass(e, r, t) { 11124 return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { 11125 writable: !1 11126 }), e; 11127} 11128function _toPropertyKey(t) { 11129 var i = _toPrimitive(t, "string"); 11130 return "symbol" == _typeof(i) ? i : i + ""; 11131} 11132function _toPrimitive(t, r) { 11133 if ("object" != _typeof(t) || !t) return t; 11134 var e = t[Symbol.toPrimitive]; 11135 if (void 0 !== e) { 11136 var i = e.call(t, r || "default"); 11137 if ("object" != _typeof(i)) return i; 11138 throw new TypeError("@@toPrimitive must return a primitive value."); 11139 } 11140 return ("string" === r ? String : Number)(t); 11141} 11142function _callSuper(t, o, e) {
vendor: 9,452 bytes, lines 11143-11405
11143 return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); 11144} 11145function _possibleConstructorReturn(t, e) { 11146 if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; 11147 if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); 11148 return _assertThisInitialized(t); 11149} 11150function _assertThisInitialized(e) { 11151 if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 11152 return e; 11153} 11154function _isNativeReflectConstruct() { 11155 try { 11156 var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); 11157 } catch (t) {} 11158 return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { 11159 return !!t; 11160 })(); 11161} 11162function _getPrototypeOf(t) { 11163 return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { 11164 return t.__proto__ || Object.getPrototypeOf(t); 11165 }, _getPrototypeOf(t); 11166} 11167function _inherits(t, e) { 11168 if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); 11169 t.prototype = Object.create(e && e.prototype, { 11170 constructor: { 11171 value: t, 11172 writable: !0, 11173 configurable: !0 11174 } 11175 }), Object.defineProperty(t, "prototype", { 11176 writable: !1 11177 }), e && _setPrototypeOf(t, e); 11178} 11179function _setPrototypeOf(t, e) { 11180 return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { 11181 return t.__proto__ = e, t; 11182 }, _setPrototypeOf(t, e); 11183} 11184/** 11185 * Accordion module. 11186 * @module foundation.accordion 11187 * @requires foundation.util.keyboard 11188 */ 11189var Accordion = exports.Accordion = /*#__PURE__*/function (_Plugin) { 11190 function Accordion() { 11191 _classCallCheck(this, Accordion); 11192 return _callSuper(this, Accordion, arguments); 11193 } 11194 _inherits(Accordion, _Plugin); 11195 return _createClass(Accordion, [{ 11196 key: "_setup", 11197 value: 11198 /** 11199 * Creates a new instance of an accordion. 11200 * @class 11201 * @name Accordion 11202 * @fires Accordion#init 11203 * @param {jQuery} element - jQuery object to make into an accordion. 11204 * @param {Object} options - a plain object with settings to override the default options. 11205 */ 11206 function _setup(element, options) { 11207 this.$element = element; 11208 this.options = _jquery["default"].extend({}, Accordion.defaults, this.$element.data(), options); 11209 this.className = 'Accordion'; // ie9 back compat 11210 this._init(); 11211 _foundationUtil.Keyboard.register('Accordion', { 11212 'ENTER': 'toggle', 11213 'SPACE': 'toggle', 11214 'ARROW_DOWN': 'next', 11215 'ARROW_UP': 'previous', 11216 'HOME': 'first', 11217 'END': 'last' 11218 }); 11219 } 11220 11221 /** 11222 * Initializes the accordion by animating the preset active pane(s). 11223 * @private 11224 */ 11225 }, { 11226 key: "_init", 11227 value: function _init() { 11228 var _this2 = this; 11229 this._isInitializing = true; 11230 this.$tabs = this.$element.children('[data-accordion-item]'); 11231 this.$tabs.each(function (idx, el) { 11232 var $el = (0, _jquery["default"])(el), 11233 $content = $el.children('[data-tab-content]'), 11234 id = $content[0].id || (0, _foundationCore2.GetYoDigits)(6, 'accordion'), 11235 linkId = el.id ? "".concat(el.id, "-label") : "".concat(id, "-label"); 11236 $el.find('a:first').attr({ 11237 'aria-controls': id, 11238 'id': linkId, 11239 'aria-expanded': false 11240 }); 11241 $content.attr({ 11242 'role': 'region', 11243 'aria-labelledby': linkId, 11244 'aria-hidden': true, 11245 'id': id 11246 }); 11247 }); 11248 var $initActive = this.$element.find('.is-active').children('[data-tab-content]'); 11249 if ($initActive.length) { 11250 // Save up the initial hash to return to it later when going back in history 11251 this._initialAnchor = $initActive.prev('a').attr('href'); 11252 this._openSingleTab($initActive); 11253 } 11254 this._checkDeepLink = function () { 11255 var anchor = window.location.hash; 11256 if (!anchor.length) { 11257 // If we are still initializing and there is no anchor, then there is nothing to do 11258 if (_this2._isInitializing) return; 11259 // Otherwise, move to the initial anchor 11260 if (_this2._initialAnchor) anchor = _this2._initialAnchor; 11261 } 11262 var $anchor = anchor && (0, _jquery["default"])(anchor); 11263 var $link = anchor && _this2.$element.find("[href$=\"".concat(anchor, "\"]")); 11264 // Whether the anchor element that has been found is part of this element 11265 var isOwnAnchor = !!($anchor.length && $link.length); 11266 if (isOwnAnchor) { 11267 // If there is an anchor for the hash, open it (if not already active) 11268 if ($anchor && $link && $link.length) { 11269 if (!$link.parent('[data-accordion-item]').hasClass('is-active')) { 11270 _this2._openSingleTab($anchor); 11271 } 11272 } 11273 // Otherwise, close everything 11274 else { 11275 _this2._closeAllTabs(); 11276 } 11277 11278 // Roll up a little to show the titles 11279 if (_this2.options.deepLinkSmudge) { 11280 (0, _foundationCore2.onLoad)((0, _jquery["default"])(window), function () { 11281 var offset = _this2.$element.offset(); 11282 (0, _jquery["default"])('html, body').animate({ 11283 scrollTop: offset.top - _this2.options.deepLinkSmudgeOffset 11284 }, _this2.options.deepLinkSmudgeDelay); 11285 }); 11286 } 11287 11288 /** 11289 * Fires when the plugin has deeplinked at pageload 11290 * @event Accordion#deeplink 11291 */ 11292 _this2.$element.trigger('deeplink.zf.accordion', [$link, $anchor]); 11293 } 11294 }; 11295 11296 //use browser to open a tab, if it exists in this tabset 11297 if (this.options.deepLink) { 11298 this._checkDeepLink(); 11299 } 11300 this._events(); 11301 this._isInitializing = false; 11302 } 11303 11304 /** 11305 * Adds event handlers for items within the accordion. 11306 * @private 11307 */ 11308 }, { 11309 key: "_events", 11310 value: function _events() { 11311 var _this = this; 11312 this.$tabs.each(function () { 11313 var $elem = (0, _jquery["default"])(this); 11314 var $tabContent = $elem.children('[data-tab-content]'); 11315 if ($tabContent.length) { 11316 $elem.children('a').off('click.zf.accordion keydown.zf.accordion').on('click.zf.accordion', function (e) { 11317 e.preventDefault(); 11318 _this.toggle($tabContent); 11319 }).on('keydown.zf.accordion', function (e) { 11320 _foundationUtil.Keyboard.handleKey(e, 'Accordion', { 11321 toggle: function toggle() { 11322 _this.toggle($tabContent); 11323 }, 11324 next: function next() { 11325 var $a = $elem.next().find('a').focus(); 11326 if (!_this.options.multiExpand) { 11327 $a.trigger('click.zf.accordion'); 11328 } 11329 }, 11330 previous: function previous() { 11331 var $a = $elem.prev().find('a').focus(); 11332 if (!_this.options.multiExpand) { 11333 $a.trigger('click.zf.accordion'); 11334 } 11335 }, 11336 first: function first() { 11337 var $a = _this.$tabs.first().find('.accordion-title').focus(); 11338 if (!_this.options.multiExpand) { 11339 $a.trigger('click.zf.accordion'); 11340 } 11341 }, 11342 last: function last() { 11343 var $a = _this.$tabs.last().find('.accordion-title').focus(); 11344 if (!_this.options.multiExpand) { 11345 $a.trigger('click.zf.accordion'); 11346 } 11347 }, 11348 handled: function handled() { 11349 e.preventDefault(); 11350 } 11351 }); 11352 }); 11353 } 11354 }); 11355 if (this.options.deepLink) { 11356 (0, _jquery["default"])(window).on('hashchange', this._checkDeepLink); 11357 } 11358 } 11359 11360 /** 11361 * Toggles the selected content pane's open/close state. 11362 * @param {jQuery} $target - jQuery object of the pane to toggle (`.accordion-content`). 11363 * @function 11364 */ 11365 }, { 11366 key: "toggle", 11367 value: function toggle($target) { 11368 if ($target.closest('[data-accordion]').is('[disabled]')) { 11369 console.info('Cannot toggle an accordion that is disabled.'); 11370 return; 11371 } 11372 if ($target.parent().hasClass('is-active')) { 11373 this.up($target); 11374 } else { 11375 this.down($target); 11376 } 11377 //either replace or update browser history 11378 if (this.options.deepLink) { 11379 var anchor = $target.prev('a').attr('href'); 11380 if (this.options.updateHistory) { 11381 history.pushState({}, '', anchor); 11382 } else { 11383 history.replaceState({}, '', anchor); 11384 } 11385 } 11386 } 11387 11388 /** 11389 * Opens the accordion tab defined by `$target`. 11390 * @param {jQuery} $target - Accordion pane to open (`.accordion-content`). 11391 * @fires Accordion#down 11392 * @function 11393 */ 11394 }, { 11395 key: "down", 11396 value: function down($target) { 11397 if ($target.closest('[data-accordion]').is('[disabled]')) { 11398 console.info('Cannot call down on an accordion that is disabled.'); 11399 return; 11400 } 11401 if (this.options.multiExpand) this._openTab($target);else this._openSingleTab($target); 11402 } 11403 11404 /** 11405 * Closes the tab defined by `$target`.
11406 * It may be ignored if the Accordion options don't allow it. 11407 * 11408 * @param {jQuery} $target - Accordion tab to close (`.accordion-content`). 11409 * @fires Accordion#up 11410 * @function 11411 */ 11412 }, { 11413 key: "up", 11414 value: function up($target) { 11415 if (this.$element.is('[disabled]')) { 11416 console.info('Cannot call up on an accordion that is disabled.'); 11417 return; 11418 } 11419 11420 // Don't close the item if it is already closed 11421 var $targetItem = $target.parent(); 11422 if (!$targetItem.hasClass('is-active')) return; 11423 11424 // Don't close the item if there is no other active item (unless with `allowAllClosed`) 11425 var $othersItems = $targetItem.siblings(); 11426 if (!this.options.allowAllClosed && !$othersItems.hasClass('is-active')) return; 11427 this._closeTab($target); 11428 } 11429 11430 /** 11431 * Make the tab defined by `$target` the only opened tab, closing all others tabs. 11432 * @param {jQuery} $target - Accordion tab to open (`.accordion-content`). 11433 * @function 11434 * @private 11435 */ 11436 }, { 11437 key: "_openSingleTab", 11438 value: function _openSingleTab($target) { 11439 // Close all the others active tabs. 11440 var $activeContents = this.$element.children('.is-active').children('[data-tab-content]'); 11441 if ($activeContents.length) { 11442 this._closeTab($activeContents.not($target)); 11443 } 11444 11445 // Then open the target. 11446 this._openTab($target); 11447 } 11448 11449 /** 11450 * Opens the tab defined by `$target`. 11451 * @param {jQuery} $target - Accordion tab to open (`.accordion-content`). 11452 * @fires Accordion#down 11453 * @function 11454 * @private 11455 */ 11456 }, { 11457 key: "_openTab", 11458 value: function _openTab($target) { 11459 var _this3 = this; 11460 var $targetItem = $target.parent(); 11461 var targetContentId = $target.attr('aria-labelledby'); 11462 $target.attr('aria-hidden', false); 11463 $targetItem.addClass('is-active'); 11464 (0, _jquery["default"])("#".concat(targetContentId)).attr({ 11465 'aria-expanded': true 11466 }); 11467 $target.finish().slideDown(this.options.slideSpeed, function () { 11468 /** 11469 * Fires when the tab is done opening. 11470 * @event Accordion#down 11471 */ 11472 _this3.$element.trigger('down.zf.accordion', [$target]); 11473 }); 11474 } 11475 11476 /** 11477 * Closes the tab defined by `$target`. 11478 * @param {jQuery} $target - Accordion tab to close (`.accordion-content`). 11479 * @fires Accordion#up 11480 * @function 11481 * @private 11482 */ 11483 }, { 11484 key: "_closeTab", 11485 value: function _closeTab($target) { 11486 var _this4 = this; 11487 var $targetItem = $target.parent(); 11488 var targetContentId = $target.attr('aria-labelledby'); 11489 $target.attr('aria-hidden', true); 11490 $targetItem.removeClass('is-active'); 11491 (0, _jquery["default"])("#".concat(targetContentId)).attr({ 11492 'aria-expanded': false 11493 }); 11494 $target.finish().slideUp(this.options.slideSpeed, function () { 11495 /** 11496 * Fires when the tab is done collapsing up. 11497 * @event Accordion#up 11498 */ 11499 _this4.$element.trigger('up.zf.accordion', [$target]); 11500 }); 11501 } 11502 11503 /** 11504 * Closes all active tabs 11505 * @fires Accordion#up 11506 * @function 11507 * @private 11508 */ 11509 }, { 11510 key: "_closeAllTabs", 11511 value: function _closeAllTabs() { 11512 var $activeTabs = this.$element.children('.is-active').children('[data-tab-content]'); 11513 if ($activeTabs.length) { 11514 this._closeTab($activeTabs); 11515 } 11516 } 11517 11518 /** 11519 * Destroys an instance of an accordion. 11520 * @fires Accordion#destroyed 11521 * @function 11522 */ 11523 }, { 11524 key: "_destroy", 11525 value: function _destroy() { 11526 this.$element.find('[data-tab-content]').stop(true).slideUp(0).css('display', ''); 11527 this.$element.find('a').off('.zf.accordion'); 11528 if (this.options.deepLink) { 11529 (0, _jquery["default"])(window).off('hashchange', this._checkDeepLink); 11530 } 11531 } 11532 }]); 11533}
11533(_foundationCore.Plugin); 11534Accordion.defaults = { 11535 /** 11536 * Amount of time to animate the opening of an accordion pane. 11537 * @option 11538 * @type {number} 11539 * @default 250 11540 */ 11541 slideSpeed: 250, 11542 /** 11543 * Allow the accordion to have multiple open panes. 11544 * @option 11545 * @type {boolean} 11546 * @default false 11547 */ 11548 multiExpand: false, 11549 /** 11550 * Allow the accordion to close all panes. 11551 * @option 11552 * @type {boolean} 11553 * @default false 11554 */ 11555 allowAllClosed: false, 11556 /** 11557 * Link the location hash to the open pane. 11558 * Set the location hash when the opened pane changes, and open and scroll to the corresponding pane when the location changes. 11559 * @option 11560 * @type {boolean} 11561 * @default false 11562 */ 11563 deepLink: false, 11564 /** 11565 * If `deepLink` is enabled, adjust the deep link scroll to make sure the top of the accordion panel is visible 11566 * @option 11567 * @type {boolean} 11568 * @default false 11569 */ 11570 deepLinkSmudge: false, 11571 /** 11572 * If `deepLinkSmudge` is enabled, animation time (ms) for the deep link adjustment 11573 * @option 11574 * @type {number} 11575 * @default 300 11576 */ 11577 deepLinkSmudgeDelay: 300, 11578 /** 11579 * If `deepLinkSmudge` is enabled, the offset for scrollToTtop to prevent overlap by a sticky element at the top of the page 11580 * @option 11581 * @type {number} 11582 * @default 0 11583 */ 11584 deepLinkSmudgeOffset: 0, 11585 /** 11586 * If `deepLink` is enabled, update the browser history with the open accordion 11587 * @option 11588 * @type {boolean} 11589 * @default false 11590 */ 11591 updateHistory: false 11592}; 11593 11594}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 11595},{"./foundation.core.plugin":18,"./foundation.core.utils":19,"./foundation.util.keyboard":23}],17:[function(require,module,exports){ 11596(function (global){(function (){ 11597"use strict"; 11598 11599Object.defineProperty(exports, "__esModule", { 11600 value: true 11601}); 11602exports.Foundation = void 0; 11603var _jquery = _interopRequireDefault((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 11604var _foundationCore = require("./foundation.core.utils"); 11605var _foundationUtil = require("./foundation.util.mediaQuery"); 11606function _interopRequireDefault(e) { 11607 return e && e.__esModule ? e : { 11608 "default": e 11609 }; 11610} 11611function _typeof(o) { 11612 "@babel/helpers - typeof"; 11613 11614 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { 11615 return typeof o; 11616 } : function (o) { 11617 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 11618 }, _typeof(o); 11619} 11620var FOUNDATION_VERSION = '6.9.0'; 11621 11622// Global Foundation object 11623// This is attached to the window, or used as a module for AMD/Browserify 11624var Foundation = exports.Foundation = { 11625 version: FOUNDATION_VERSION, 11626 /** 11627 * Stores initialized plugins. 11628 */ 11629 _plugins: {}, 11630 /** 11631 * Stores generated unique ids for plugin instances 11632 */ 11633 _uuids: [], 11634 /** 11635 * Defines a Foundation plugin, adding it to the `Foundation` namespace and the list of plugins to initialize when reflowing. 11636 * @param {Object} plugin - The constructor of the plugin. 11637 */ 11638 plugin: function plugin(_plugin, name) { 11639 // Object key to use when adding to global Foundation object 11640 // Examples: Foundation.Reveal, Foundation.OffCanvas 11641 var className = name || functionName(_plugin); 11642 // Object key to use when storing the plugin, also used to create the identifying data attribute for the plugin 11643 // Examples: data-reveal, data-off-canvas 11644 var attrName = hyphenate(className); 11645 11646 // Add to the Foundation object and the plugins list (for reflowing) 11647 this._plugins[attrName] = this[className] = _plugin; 11648 }, 11649 /** 11650 * @function 11651 * Populates the _uuids array with pointers to each individual plugin instance. 11652 * Adds the `zfPlugin` data-attribute to programmatically created plugins to allow use of $(selector).foundation(method) calls. 11653 * Also fires the initialization event for each plugin, consolidating repetitive code. 11654 * @param {Object} plugin - an instance of a plugin, usually `this` in context. 11655 * @param {String} name - the name of the plugin, passed as a camelCased string. 11656 * @fires Plugin#init 11657 */ 11658 registerPlugin: function registerPlugin(plugin, name) { 11659 var pluginName = name ? hyphenate(name) : functionName(plugin.constructor).toLowerCase(); 11660 plugin.uuid = (0, _foundationCore.GetYoDigits)(6, pluginName); 11661 if (!plugin.$element.attr("data-".concat(pluginName))) { 11662 plugin.$element.attr("data-".concat(pluginName), plugin.uuid); 11663 } 11664 if (!plugin.$element.data('zfPlugin')) { 11665 plugin.$element.data('zfPlugin', plugin); 11666 } 11667 /** 11668 * Fires when the plugin has initialized. 11669 * @event Plugin#init 11670 */ 11671 plugin.$element.trigger("init.zf.".concat(pluginName)); 11672 this._uuids.push(plugin.uuid); 11673 return; 11674 }, 11675 /** 11676 * @function 11677 * Removes the plugins uuid from the _uuids array.
11678 * Removes the zfPlugin data attribute, as well as the data-plugin-name attribute. 11679 * Also fires the destroyed event for the plugin, consolidating repetitive code. 11680 * @param {Object} plugin - an instance of a plugin, usually `this` in context. 11681 * @fires Plugin#destroyed 11682 */ 11683 unregisterPlugin: function unregisterPlugin(plugin) { 11684 var pluginName = hyphenate(functionName(plugin.$element.data('zfPlugin').constructor)); 11685 this._uuids.splice(this._uuids.indexOf(plugin.uuid), 1); 11686 plugin.$element.removeAttr("data-".concat(pluginName)).removeData('zfPlugin') 11687 /** 11688 * Fires when the plugin has been destroyed. 11689 * @event Plugin#destroyed 11690 */.trigger("destroyed.zf.".concat(pluginName)); 11691 for (var prop in plugin) { 11692 if (typeof plugin[prop] === 'function') { 11693 plugin[prop] = null; //clean up script to prep for garbage collection. 11694 } 11695 } 11696 return; 11697 }, 11698 /** 11699 * @function 11700 * Causes one or more active plugins to re-initialize, resetting event listeners, recalculating positions, etc. 11701 * @param {String} plugins - optional string of an individual plugin key, attained by calling `$(element).data('pluginName')`, or string of a plugin class i.e. `'dropdown'` 11702 * @default If no argument is passed, reflow all currently active plugins. 11703 */ 11704 reInit: function reInit(plugins) { 11705 var isJQ = plugins instanceof _jquery["default"]; 11706 try { 11707 if (isJQ) { 11708 plugins.each(function () { 11709 (0, _jquery["default"])(this).data('zfPlugin')._init(); 11710 }); 11711 } else { 11712 var type = _typeof(plugins), 11713 _this = this, 11714 fns = { 11715 'object': function object(plgs) { 11716 plgs.forEach(function (p) { 11717 p = hyphenate(p); 11718 (0, _jquery["default"])('[data-' + p + ']').foundation('_init'); 11719 }); 11720 }, 11721 'string': function string() { 11722 plugins = hyphenate(plugins); 11723 (0, _jquery["default"])('[data-' + plugins + ']').foundation('_init'); 11724 }, 11725 'undefined': function undefined() { 11726 this.object(Object.keys(_this._plugins)); 11727 } 11728 }; 11729 fns[type](plugins); 11730 } 11731 } catch (err) { 11732 console.error(err); 11733 } finally { 11734 return plugins; 11735 } 11736 }, 11737 /** 11738 * Initialize plugins on any elements within `elem` (and `elem` itself) that aren't already initialized. 11739 * @param {Object} elem - jQuery object containing the element to check inside. Also checks the element itself, unless it's the `document` object. 11740 * @param {String|Array} plugins - A list of plugins to initialize. Leave this out to initialize everything. 11741 */ 11742 reflow: function reflow(elem, plugins) { 11743 // If plugins is undefined, just grab everything 11744 if (typeof plugins === 'undefined') { 11745 plugins = Object.keys(this._plugins); 11746 } 11747 // If plugins is a string, convert it to an array with one item 11748 else if (typeof plugins === 'string') { 11749 plugins = [plugins]; 11750 } 11751 var _this = this; 11752 11753 // Iterate through each plugin 11754 _jquery["default"].each(plugins, function (i, name) { 11755 // Get the current plugin 11756 var plugin = _this._plugins[name]; 11757 11758 // Localize the search to all elements inside elem, as well as elem itself, unless elem === document 11759 var $elem = (0, _jquery["default"])(elem).find('[data-' + name + ']').addBack('[data-' + name + ']').filter(function () { 11760 return typeof (0, _jquery["default"])(this).data("zfPlugin") === 'undefined'; 11761 }); 11762 11763 // For each plugin found, initialize it 11764 $elem.each(function () { 11765 var $el = (0, _jquery["default"])(this), 11766 opts = { 11767 reflow: true 11768 }; 11769 if ($el.attr('data-options')) { 11770 $el.attr('data-options').split(';').forEach(function (option) { 11771 var opt = option.split(':').map(function (el) { 11772 return el.trim(); 11773 }); 11774 if (opt[0]) opts[opt[0]] = parseValue(opt[1]); 11775 }); 11776 } 11777 try { 11778 $el.data('zfPlugin', new plugin((0, _jquery["default"])(this), opts)); 11779 } catch (er) { 11780 console.error(er); 11781 } finally { 11782 return; 11783 } 11784 }); 11785 }); 11786 }, 11787 getFnName: functionName, 11788 addToJquery: function addToJquery() { 11789 // TODO: consider not making this a jQuery function 11790 // TODO: need way to reflow vs. re-initialize 11791 /** 11792 * The Foundation jQuery method. 11793 * @param {String|Array} method - An action to perform on the current jQuery object. 11794 */ 11795 var foundation = function foundation(method) { 11796 var type = _typeof(method), 11797 $noJS = (0, _jquery["default"])('.no-js'); 11798 if ($noJS.length) { 11799 $noJS.removeClass('no-js'); 11800 } 11801 if (type === 'undefined') { 11802 //needs to initialize the Foundation object, or an individual plugin. 11803 _foundationUtil.MediaQuery._init(); 11804 Foundation.reflow(this); 11805 } else if (type === 'string') { 11806 //an individual method to invoke on a plugin or group of plugins 11807 var args = Array.prototype.slice.call(arguments, 1); //collect all the arguments, if necessary 11808 var plugClass = this.data('zfPlugin'); //determine the class of plugin 11809 11810 if (typeof plugClass !== 'undefined' && typeof plugClass[method] !== 'undefined') { 11811 //make sure both the class and method exist 11812 if (this.length === 1) { 11813 //if there's only one, call it directly.
vendor: 4,335 bytes, lines 11814-11937
11814 plugClass[method].apply(plugClass, args); 11815 } else { 11816 this.each(function (i, el) { 11817 //otherwise loop through the jQuery collection and invoke the method on each 11818 plugClass[method].apply((0, _jquery["default"])(el).data('zfPlugin'), args); 11819 }); 11820 } 11821 } else { 11822 //error for no class or no method 11823 throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.'); 11824 } 11825 } else { 11826 //error for invalid argument type 11827 throw new TypeError("We're sorry, ".concat(type, " is not a valid parameter. You must use a string representing the method you wish to invoke.")); 11828 } 11829 return this; 11830 }; 11831 _jquery["default"].fn.foundation = foundation; 11832 return _jquery["default"]; 11833 } 11834}; 11835Foundation.util = { 11836 /** 11837 * Function for applying a debounce effect to a function call. 11838 * @function 11839 * @param {Function} func - Function to be called at end of timeout. 11840 * @param {Number} delay - Time in ms to delay the call of `func`. 11841 * @returns function 11842 */ 11843 throttle: function throttle(func, delay) { 11844 var timer = null; 11845 return function () { 11846 var context = this, 11847 args = arguments; 11848 if (timer === null) { 11849 timer = setTimeout(function () { 11850 func.apply(context, args); 11851 timer = null; 11852 }, delay); 11853 } 11854 }; 11855 } 11856}; 11857window.Foundation = Foundation; 11858 11859// Polyfill for requestAnimationFrame 11860(function () { 11861 if (!Date.now || !window.Date.now) window.Date.now = Date.now = function () { 11862 return new Date().getTime(); 11863 }; 11864 var vendors = ['webkit', 'moz']; 11865 for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) { 11866 var vp = vendors[i]; 11867 window.requestAnimationFrame = window[vp + 'RequestAnimationFrame']; 11868 window.cancelAnimationFrame = window[vp + 'CancelAnimationFrame'] || window[vp + 'CancelRequestAnimationFrame']; 11869 } 11870 if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) { 11871 var lastTime = 0; 11872 window.requestAnimationFrame = function (callback) { 11873 var now = Date.now(); 11874 var nextTime = Math.max(lastTime + 16, now); 11875 return setTimeout(function () { 11876 callback(lastTime = nextTime); 11877 }, nextTime - now); 11878 }; 11879 window.cancelAnimationFrame = clearTimeout; 11880 } 11881 /** 11882 * Polyfill for performance.now, required by rAF 11883 */ 11884 if (!window.performance || !window.performance.now) { 11885 window.performance = { 11886 start: Date.now(), 11887 now: function now() { 11888 return Date.now() - this.start; 11889 } 11890 }; 11891 } 11892})(); 11893if (!Function.prototype.bind) { 11894 /* eslint-disable no-extend-native */ 11895 Function.prototype.bind = function (oThis) { 11896 if (typeof this !== 'function') { 11897 // closest thing possible to the ECMAScript 5 11898 // internal IsCallable function 11899 throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); 11900 } 11901 var aArgs = Array.prototype.slice.call(arguments, 1), 11902 fToBind = this, 11903 fNOP = function fNOP() {}, 11904 fBound = function fBound() { 11905 return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); 11906 }; 11907 if (this.prototype) { 11908 // native functions don't have a prototype 11909 fNOP.prototype = this.prototype; 11910 } 11911 fBound.prototype = new fNOP(); 11912 return fBound; 11913 }; 11914} 11915// Polyfill to get the name of a function in IE9 11916function functionName(fn) { 11917 if (typeof Function.prototype.name === 'undefined') { 11918 var funcNameRegex = /function\s([^(]{1,})\(/; 11919 var results = funcNameRegex.exec(fn.toString()); 11920 return results && results.length > 1 ? results[1].trim() : ""; 11921 } else if (typeof fn.prototype === 'undefined') { 11922 return fn.constructor.name; 11923 } else { 11924 return fn.prototype.constructor.name; 11925 } 11926} 11927function parseValue(str) { 11928 if ('true' === str) return true;else if ('false' === str) return false;else if (!isNaN(str * 1)) return parseFloat(str); 11929 return str; 11930} 11931// Convert PascalCase to kebab-case 11932// Thank you: http://stackoverflow.com/a/8955580 11933function hyphenate(str) { 11934 return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); 11935} 11936 11937}
11937).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 11938},{"./foundation.core.utils":19,"./foundation.util.mediaQuery":24}],18:[function(require,module,exports){ 11939"use strict"; 11940 11941Object.defineProperty(exports, "__esModule", { 11942 value: true 11943}); 11944exports.Plugin = void 0; 11945var _foundationCore = require("./foundation.core.utils"); 11946function _typeof(o) { 11947 "@babel/helpers - typeof"; 11948 11949 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { 11950 return typeof o; 11951 } : function (o) { 11952 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 11953 }, _typeof(o); 11954} 11955function _classCallCheck(a, n) { 11956 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); 11957} 11958function _defineProperties(e, r) { 11959 for (var t = 0; t < r.length; t++) { 11960 var o = r[t]; 11961 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); 11962 } 11963} 11964function _createClass(e, r, t) { 11965 return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { 11966 writable: !1 11967 }), e; 11968} 11969function _toPropertyKey(t) { 11970 var i = _toPrimitive(t, "string"); 11971 return "symbol" == _typeof(i) ? i : i + ""; 11972} 11973function _toPrimitive(t, r) { 11974 if ("object" != _typeof(t) || !t) return t; 11975 var e = t[Symbol.toPrimitive]; 11976 if (void 0 !== e) { 11977 var i = e.call(t, r || "default"); 11978 if ("object" != _typeof(i)) return i; 11979 throw new TypeError("@@toPrimitive must return a primitive value."); 11980 } 11981 return ("string" === r ? String : Number)(t); 11982} 11983// Abstract class for providing lifecycle hooks. Expect plugins to define AT LEAST 11984// {function} _setup (replaces previous constructor), 11985// {function} _destroy (replaces previous destroy) 11986var Plugin = exports.Plugin = /*#__PURE__*/function () { 11987 function Plugin(element, options) { 11988 _classCallCheck(this, Plugin); 11989 this._setup(element, options); 11990 var pluginName = getPluginName(this); 11991 this.uuid = (0, _foundationCore.GetYoDigits)(6, pluginName); 11992 if (!this.$element.attr("data-".concat(pluginName))) { 11993 this.$element.attr("data-".concat(pluginName), this.uuid); 11994 } 11995 if (!this.$element.data('zfPlugin')) { 11996 this.$element.data('zfPlugin', this); 11997 } 11998 /** 11999 * Fires when the plugin has initialized. 12000 * @event Plugin#init 12001 */ 12002 this.$element.trigger("init.zf.".concat(pluginName)); 12003 } 12004 return _createClass(Plugin, [{ 12005 key: "destroy", 12006 value: function destroy() { 12007 this._destroy(); 12008 var pluginName = getPluginName(this); 12009 this.$element.removeAttr("data-".concat(pluginName)).removeData('zfPlugin') 12010 /** 12011 * Fires when the plugin has been destroyed. 12012 * @event Plugin#destroyed 12013 */.trigger("destroyed.zf.".concat(pluginName)); 12014 for (var prop in this) { 12015 if (this.hasOwnProperty(prop)) { 12016 this[prop] = null; //clean up script to prep for garbage collection. 12017 } 12018 } 12019 } 12020 }]); 12021}(); // Convert PascalCase to kebab-case 12022// Thank you: http://stackoverflow.com/a/8955580 12023function hyphenate(str) { 12024 return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); 12025} 12026function getPluginName(obj) { 12027 return hyphenate(obj.className); 12028} 12029 12030},{"./foundation.core.utils":19}],19:[function(require,module,exports){ 12031(function (global){(function (){ 12032"use strict"; 12033 12034Object.defineProperty(exports, "__esModule", { 12035 value: true 12036}); 12037exports.GetYoDigits = GetYoDigits; 12038exports.RegExpEscape = RegExpEscape; 12039exports.ignoreMousedisappear = ignoreMousedisappear; 12040exports.onLoad = onLoad; 12041exports.rtl = rtl; 12042exports.transitionend = transitionend; 12043var _jquery = _interopRequireDefault((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 12044function _interopRequireDefault(e) { 12045 return e && e.__esModule ? e : { 12046 "default": e 12047 }; 12048} 12049// Core Foundation Utilities, utilized in a number of places. 12050 12051/**
vendor: 5,581 bytes, lines 12052-12195
12052 * Returns a boolean for RTL support 12053 */ 12054function rtl() { 12055 return (0, _jquery["default"])('html').attr('dir') === 'rtl'; 12056} 12057 12058/** 12059 * returns a random base-36 uid with namespacing 12060 * @function 12061 * @param {Number} length - number of random base-36 digits desired. Increase for more random strings. 12062 * @param {String} namespace - name of plugin to be incorporated in uid, optional. 12063 * @default {String} '' - if no plugin name is provided, nothing is appended to the uid. 12064 * @returns {String} - unique id 12065 */ 12066function GetYoDigits() { 12067 var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 6; 12068 var namespace = arguments.length > 1 ? arguments[1] : undefined; 12069 var str = ''; 12070 var chars = '0123456789abcdefghijklmnopqrstuvwxyz'; 12071 var charsLength = chars.length; 12072 for (var i = 0; i < length; i++) { 12073 str += chars[Math.floor(Math.random() * charsLength)]; 12074 } 12075 return namespace ? "".concat(str, "-").concat(namespace) : str; 12076} 12077 12078/** 12079 * Escape a string so it can be used as a regexp pattern 12080 * @function 12081 * @see https://stackoverflow.com/a/9310752/4317384 12082 * 12083 * @param {String} str - string to escape. 12084 * @returns {String} - escaped string 12085 */ 12086function RegExpEscape(str) { 12087 return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); 12088} 12089function transitionend($elem) { 12090 var transitions = { 12091 'transition': 'transitionend', 12092 'WebkitTransition': 'webkitTransitionEnd', 12093 'MozTransition': 'transitionend', 12094 'OTransition': 'otransitionend' 12095 }; 12096 var elem = document.createElement('div'), 12097 end; 12098 for (var transition in transitions) { 12099 if (typeof elem.style[transition] !== 'undefined') { 12100 end = transitions[transition]; 12101 } 12102 } 12103 if (end) { 12104 return end; 12105 } else { 12106 setTimeout(function () { 12107 $elem.triggerHandler('transitionend', [$elem]); 12108 }, 1); 12109 return 'transitionend'; 12110 } 12111} 12112 12113/** 12114 * Return an event type to listen for window load. 12115 * 12116 * If `$elem` is passed, an event will be triggered on `$elem`. If window is already loaded, the event will still be triggered. 12117 * If `handler` is passed, attach it to the event on `$elem`. 12118 * Calling `onLoad` without handler allows you to get the event type that will be triggered before attaching the handler by yourself. 12119 * @function 12120 * 12121 * @param {Object} [] $elem - jQuery element on which the event will be triggered if passed. 12122 * @param {Function} [] handler - function to attach to the event. 12123 * @returns {String} - event type that should or will be triggered. 12124 */ 12125function onLoad($elem, handler) { 12126 var didLoad = document.readyState === 'complete'; 12127 var eventType = (didLoad ? '_didLoad' : 'load') + '.zf.util.onLoad'; 12128 var cb = function cb() { 12129 return $elem.triggerHandler(eventType); 12130 }; 12131 if ($elem) { 12132 if (handler) $elem.one(eventType, handler); 12133 if (didLoad) setTimeout(cb);else (0, _jquery["default"])(window).one('load', cb); 12134 } 12135 return eventType; 12136} 12137 12138/** 12139 * Retuns an handler for the `mouseleave` that ignore disappeared mouses. 12140 * 12141 * If the mouse "disappeared" from the document (like when going on a browser UI element, See https://git.io/zf-11410), 12142 * the event is ignored. 12143 * - If the `ignoreLeaveWindow` is `true`, the event is ignored when the user actually left the window 12144 * (like by switching to an other window with [Alt]+[Tab]). 12145 * - If the `ignoreReappear` is `true`, the event will be ignored when the mouse will reappear later on the document 12146 * outside of the element it left. 12147 * 12148 * @function 12149 * 12150 * @param {Function} [] handler - handler for the filtered `mouseleave` event to watch. 12151 * @param {Object} [] options - object of options: 12152 * - {Boolean} [false] ignoreLeaveWindow - also ignore when the user switched windows. 12153 * - {Boolean} [false] ignoreReappear - also ignore when the mouse reappeared outside of the element it left. 12154 * @returns {Function} - filtered handler to use to listen on the `mouseleave` event. 12155 */ 12156function ignoreMousedisappear(handler) { 12157 var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, 12158 _ref$ignoreLeaveWindo = _ref.ignoreLeaveWindow, 12159 ignoreLeaveWindow = _ref$ignoreLeaveWindo === void 0 ? false : _ref$ignoreLeaveWindo, 12160 _ref$ignoreReappear = _ref.ignoreReappear, 12161 ignoreReappear = _ref$ignoreReappear === void 0 ? false : _ref$ignoreReappear; 12162 return function leaveEventHandler(eLeave) { 12163 for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 12164 rest[_key - 1] = arguments[_key]; 12165 } 12166 var callback = handler.bind.apply(handler, [this, eLeave].concat(rest)); 12167 12168 // The mouse left: call the given callback if the mouse entered elsewhere 12169 if (eLeave.relatedTarget !== null) { 12170 return callback(); 12171 } 12172 12173 // Otherwise, check if the mouse actually left the window. 12174 // In firefox if the user switched between windows, the window sill have the focus by the time 12175 // the event is triggered. We have to debounce the event to test this case. 12176 setTimeout(function leaveEventDebouncer() { 12177 if (!ignoreLeaveWindow && document.hasFocus && !document.hasFocus()) { 12178 return callback(); 12179 } 12180 12181 // Otherwise, wait for the mouse to reeapear outside of the element, 12182 if (!ignoreReappear) { 12183 (0, _jquery["default"])(document).one('mouseenter', function reenterEventHandler(eReenter) { 12184 if (!(0, _jquery["default"])(eLeave.currentTarget).has(eReenter.target).length) { 12185 // Fill where the mouse finally entered. 12186 eLeave.relatedTarget = eReenter.target; 12187 callback(); 12188 } 12189 }); 12190 } 12191 }, 0); 12192 }; 12193} 12194 12195}
12195).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 12196},{}],20:[function(require,module,exports){ 12197(function (global){(function (){ 12198"use strict"; 12199 12200function _typeof(o) { 12201 "@babel/helpers - typeof"; 12202 12203 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { 12204 return typeof o; 12205 } : function (o) { 12206 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 12207 }, _typeof(o); 12208} 12209Object.defineProperty(exports, "__esModule", { 12210 value: true 12211}); 12212exports.Slider = void 0; 12213var _jquery = _interopRequireDefault((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 12214var _foundationUtil = require("./foundation.util.keyboard"); 12215var _foundationUtil2 = require("./foundation.util.motion"); 12216var _foundationCore = require("./foundation.core.utils"); 12217var _foundationCore2 = require("./foundation.core.plugin"); 12218var _foundationUtil3 = require("./foundation.util.touch"); 12219var _foundationUtil4 = require("./foundation.util.triggers"); 12220function _interopRequireDefault(e) { 12221 return e && e.__esModule ? e : { 12222 "default": e 12223 }; 12224} 12225function _classCallCheck(a, n) { 12226 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); 12227} 12228function _defineProperties(e, r) { 12229 for (var t = 0; t < r.length; t++) { 12230 var o = r[t]; 12231 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); 12232 } 12233} 12234function _createClass(e, r, t) { 12235 return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { 12236 writable: !1 12237 }), e; 12238} 12239function _toPropertyKey(t) { 12240 var i = _toPrimitive(t, "string"); 12241 return "symbol" == _typeof(i) ? i : i + ""; 12242} 12243function _toPrimitive(t, r) { 12244 if ("object" != _typeof(t) || !t) return t; 12245 var e = t[Symbol.toPrimitive]; 12246 if (void 0 !== e) { 12247 var i = e.call(t, r || "default"); 12248 if ("object" != _typeof(i)) return i; 12249 throw new TypeError("@@toPrimitive must return a primitive value."); 12250 } 12251 return ("string" === r ? String : Number)(t); 12252} 12253function _callSuper(t, o, e) { 12254 return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); 12255} 12256function _possibleConstructorReturn(t, e) { 12257 if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; 12258 if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); 12259 return _assertThisInitialized(t); 12260} 12261function _assertThisInitialized(e) { 12262 if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 12263 return e; 12264} 12265function _isNativeReflectConstruct() { 12266 try { 12267 var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); 12268 } catch (t) {} 12269 return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { 12270 return !!t; 12271 })(); 12272} 12273function _getPrototypeOf(t) { 12274 return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { 12275 return t.__proto__ || Object.getPrototypeOf(t); 12276 }, _getPrototypeOf(t); 12277} 12278function _inherits(t, e) { 12279 if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); 12280 t.prototype = Object.create(e && e.prototype, { 12281 constructor: { 12282 value: t, 12283 writable: !0, 12284 configurable: !0 12285 } 12286 }), Object.defineProperty(t, "prototype", { 12287 writable: !1 12288 }), e && _setPrototypeOf(t, e); 12289} 12290function _setPrototypeOf(t, e) { 12291 return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { 12292 return t.__proto__ = e, t; 12293 }, _setPrototypeOf(t, e); 12294} 12295/** 12296 * Slider module. 12297 * @module foundation.slider 12298 * @requires foundation.util.motion 12299 * @requires foundation.util.triggers 12300 * @requires foundation.util.keyboard 12301 * @requires foundation.util.touch 12302 */ 12303var Slider = exports.Slider = /*#__PURE__*/function (_Plugin) { 12304 function Slider() { 12305 _classCallCheck(this, Slider); 12306 return _callSuper(this, Slider, arguments); 12307 } 12308 _inherits(Slider, _Plugin); 12309 return _createClass(Slider, [{ 12310 key: "_setup", 12311 value: 12312 /** 12313 * Creates a new instance of a slider control. 12314 * @class 12315 * @name Slider 12316 * @param {jQuery} element - jQuery object to make into a slider control. 12317 * @param {Object} options - Overrides to the default plugin settings. 12318 */ 12319 function _setup(element, options) { 12320 this.$element = element; 12321 this.options = _jquery["default"].extend({}, Slider.defaults, this.$element.data(), options); 12322 this.className = 'Slider'; // ie9 back compat 12323 this.initialized = false;
vendor: 7,776 bytes, lines 12324-12527
12324 12325 // Touch and Triggers inits are idempotent, we just need to make sure it's initialied. 12326 _foundationUtil3.Touch.init(_jquery["default"]); 12327 _foundationUtil4.Triggers.init(_jquery["default"]); 12328 this._init(); 12329 _foundationUtil.Keyboard.register('Slider', { 12330 'ltr': { 12331 'ARROW_RIGHT': 'increase', 12332 'ARROW_UP': 'increase', 12333 'ARROW_DOWN': 'decrease', 12334 'ARROW_LEFT': 'decrease', 12335 'SHIFT_ARROW_RIGHT': 'increaseFast', 12336 'SHIFT_ARROW_UP': 'increaseFast', 12337 'SHIFT_ARROW_DOWN': 'decreaseFast', 12338 'SHIFT_ARROW_LEFT': 'decreaseFast', 12339 'HOME': 'min', 12340 'END': 'max' 12341 }, 12342 'rtl': { 12343 'ARROW_LEFT': 'increase', 12344 'ARROW_RIGHT': 'decrease', 12345 'SHIFT_ARROW_LEFT': 'increaseFast', 12346 'SHIFT_ARROW_RIGHT': 'decreaseFast' 12347 } 12348 }); 12349 } 12350 12351 /** 12352 * Initilizes the plugin by reading/setting attributes, creating collections and setting the initial position of the handle(s). 12353 * @function 12354 * @private 12355 */ 12356 }, { 12357 key: "_init", 12358 value: function _init() { 12359 this.inputs = this.$element.find('input'); 12360 this.handles = this.$element.find('[data-slider-handle]'); 12361 this.$handle = this.handles.eq(0); 12362 this.$input = this.inputs.length ? this.inputs.eq(0) : (0, _jquery["default"])("#".concat(this.$handle.attr('aria-controls'))); 12363 this.$fill = this.$element.find('[data-slider-fill]').css(this.options.vertical ? 'height' : 'width', 0); 12364 if (this.options.disabled || this.$element.hasClass(this.options.disabledClass)) { 12365 this.options.disabled = true; 12366 this.$element.addClass(this.options.disabledClass); 12367 } 12368 if (!this.inputs.length) { 12369 this.inputs = (0, _jquery["default"])().add(this.$input); 12370 this.options.binding = true; 12371 } 12372 this._setInitAttr(0); 12373 if (this.handles[1]) { 12374 this.options.doubleSided = true; 12375 this.$handle2 = this.handles.eq(1); 12376 this.$input2 = this.inputs.length > 1 ? this.inputs.eq(1) : (0, _jquery["default"])("#".concat(this.$handle2.attr('aria-controls'))); 12377 if (!this.inputs[1]) { 12378 this.inputs = this.inputs.add(this.$input2); 12379 } 12380 12381 // this.$handle.triggerHandler('click.zf.slider'); 12382 this._setInitAttr(1); 12383 } 12384 12385 // Set handle positions 12386 this.setHandles(); 12387 this._events(); 12388 this.initialized = true; 12389 } 12390 }, { 12391 key: "setHandles", 12392 value: function setHandles() { 12393 var _this2 = this; 12394 if (this.handles[1]) { 12395 this._setHandlePos(this.$handle, this.inputs.eq(0).val(), function () { 12396 _this2._setHandlePos(_this2.$handle2, _this2.inputs.eq(1).val()); 12397 }); 12398 } else { 12399 this._setHandlePos(this.$handle, this.inputs.eq(0).val()); 12400 } 12401 } 12402 }, { 12403 key: "_reflow", 12404 value: function _reflow() { 12405 this.setHandles(); 12406 } 12407 /** 12408 * @function 12409 * @private 12410 * @param {Number} value - floating point (the value) to be transformed using to a relative position on the slider (the inverse of _value) 12411 */ 12412 }, { 12413 key: "_pctOfBar", 12414 value: function _pctOfBar(value) { 12415 var pctOfBar = percent(value - this.options.start, this.options.end - this.options.start); 12416 switch (this.options.positionValueFunction) { 12417 case "pow": 12418 pctOfBar = this._logTransform(pctOfBar); 12419 break; 12420 case "log": 12421 pctOfBar = this._powTransform(pctOfBar); 12422 break; 12423 } 12424 return pctOfBar.toFixed(2); 12425 } 12426 12427 /** 12428 * @function 12429 * @private 12430 * @param {Number} pctOfBar - floating point, the relative position of the slider (typically between 0-1) to be transformed to a value 12431 */ 12432 }, { 12433 key: "_value", 12434 value: function _value(pctOfBar) { 12435 switch (this.options.positionValueFunction) { 12436 case "pow": 12437 pctOfBar = this._powTransform(pctOfBar); 12438 break; 12439 case "log": 12440 pctOfBar = this._logTransform(pctOfBar); 12441 break; 12442 } 12443 var value; 12444 if (this.options.vertical) { 12445 // linear interpolation which is working with negative values for start 12446 // https://math.stackexchange.com/a/1019084 12447 value = parseFloat(this.options.end) + pctOfBar * (this.options.start - this.options.end); 12448 } else { 12449 value = (this.options.end - this.options.start) * pctOfBar + parseFloat(this.options.start); 12450 } 12451 return value; 12452 } 12453 12454 /** 12455 * @function 12456 * @private 12457 * @param {Number} value - floating point (typically between 0-1) to be transformed using the log function 12458 */ 12459 }, { 12460 key: "_logTransform", 12461 value: function _logTransform(value) { 12462 return baseLog(this.options.nonLinearBase, value * (this.options.nonLinearBase - 1) + 1); 12463 } 12464 12465 /** 12466 * @function 12467 * @private 12468 * @param {Number} value - floating point (typically between 0-1) to be transformed using the power function 12469 */ 12470 }, { 12471 key: "_powTransform", 12472 value: function _powTransform(value) { 12473 return (Math.pow(this.options.nonLinearBase, value) - 1) / (this.options.nonLinearBase - 1); 12474 } 12475 12476 /** 12477 * Sets the position of the selected handle and fill bar. 12478 * @function 12479 * @private 12480 * @param {jQuery} $hndl - the selected handle to move. 12481 * @param {Number} location - floating point between the start and end values of the slider bar. 12482 * @param {Function} cb - callback function to fire on completion. 12483 * @fires Slider#moved 12484 * @fires Slider#changed 12485 */ 12486 }, { 12487 key: "_setHandlePos", 12488 value: function _setHandlePos($hndl, location, cb) { 12489 // don't move if the slider has been disabled since its initialization 12490 if (this.$element.hasClass(this.options.disabledClass)) { 12491 return; 12492 } 12493 //might need to alter that slightly for bars that will have odd number selections. 12494 location = parseFloat(location); //on input change events, convert string to number...grumble. 12495 12496 // prevent slider from running out of bounds, if value exceeds the limits set through options, override the value to min/max 12497 if (location < this.options.start) { 12498 location = this.options.start; 12499 } else if (location > this.options.end) { 12500 location = this.options.end; 12501 } 12502 var isDbl = this.options.doubleSided; 12503 if (isDbl) { 12504 //this block is to prevent 2 handles from crossing eachother. Could/should be improved. 12505 if (this.handles.index($hndl) === 0) { 12506 var h2Val = parseFloat(this.$handle2.attr('aria-valuenow')); 12507 location = location >= h2Val ? h2Val - this.options.step : location; 12508 } else { 12509 var h1Val = parseFloat(this.$handle.attr('aria-valuenow')); 12510 location = location <= h1Val ? h1Val + this.options.step : location; 12511 } 12512 } 12513 var _this = this, 12514 vert = this.options.vertical, 12515 hOrW = vert ? 'height' : 'width', 12516 lOrT = vert ? 'top' : 'left', 12517 handleDim = $hndl[0].getBoundingClientRect()[hOrW], 12518 elemDim = this.$element[0].getBoundingClientRect()[hOrW], 12519 //percentage of bar min/max value based on click or drag point 12520 pctOfBar = this._pctOfBar(location), 12521 //number of actual pixels to shift the handle, based on the percentage obtained above 12522 pxToMove = (elemDim - handleDim) * pctOfBar, 12523 //percentage of bar to shift the handle 12524 movement = (percent(pxToMove, elemDim) * 100).toFixed(this.options.decimal); 12525 //fixing the decimal value for the location number, is passed to other methods as a fixed floating-point value 12526 location = parseFloat(location.toFixed(this.options.decimal)); 12527 // declare empty object for css adjustments, only used with 2 handled-sli
vendor: 13,166 bytes, lines 12527-12865
12527ders 12528 var css = {}; 12529 this._setValues($hndl, location); 12530 12531 // TODO update to calculate based on values set to respective inputs?? 12532 if (isDbl) { 12533 var isLeftHndl = this.handles.index($hndl) === 0, 12534 //empty variable, will be used for min-height/width for fill bar 12535 dim, 12536 //percentage w/h of the handle compared to the slider bar 12537 handlePct = Math.floor(percent(handleDim, elemDim) * 100); 12538 //if left handle, the math is slightly different than if it's the right handle, and the left/top property needs to be changed for the fill bar 12539 if (isLeftHndl) { 12540 //left or top percentage value to apply to the fill bar. 12541 css[lOrT] = "".concat(movement, "%"); 12542 //calculate the new min-height/width for the fill bar. 12543 dim = parseFloat(this.$handle2[0].style[lOrT]) - movement + handlePct; 12544 //this callback is necessary to prevent errors and allow the proper placement and initialization of a 2-handled slider 12545 //plus, it means we don't care if 'dim' isNaN on init, it won't be in the future. 12546 if (cb && typeof cb === 'function') { 12547 cb(); 12548 } //this is only needed for the initialization of 2 handled sliders 12549 } else { 12550 //just caching the value of the left/bottom handle's left/top property 12551 var handlePos = parseFloat(this.$handle[0].style[lOrT]); 12552 //calculate the new min-height/width for the fill bar. Use isNaN to prevent false positives for numbers <= 0 12553 //based on the percentage of movement of the handle being manipulated, less the opposing handle's left/top position, plus the percentage w/h of the handle itself 12554 dim = movement - (isNaN(handlePos) ? (this.options.initialStart - this.options.start) / ((this.options.end - this.options.start) / 100) : handlePos) + handlePct; 12555 } 12556 // assign the min-height/width to our css object 12557 css["min-".concat(hOrW)] = "".concat(dim, "%"); 12558 } 12559 12560 //because we don't know exactly how the handle will be moved, check the amount of time it should take to move. 12561 var moveTime = this.$element.data('dragging') ? 1000 / 60 : this.options.moveTime; 12562 (0, _foundationUtil2.Move)(moveTime, $hndl, function () { 12563 // adjusting the left/top property of the handle, based on the percentage calculated above 12564 // if movement isNaN, that is because the slider is hidden and we cannot determine handle width, 12565 // fall back to next best guess. 12566 if (isNaN(movement)) { 12567 $hndl.css(lOrT, "".concat(pctOfBar * 100, "%")); 12568 } else { 12569 $hndl.css(lOrT, "".concat(movement, "%")); 12570 } 12571 if (!_this.options.doubleSided) { 12572 //if single-handled, a simple method to expand the fill bar 12573 _this.$fill.css(hOrW, "".concat(pctOfBar * 100, "%")); 12574 } else { 12575 //otherwise, use the css object we created above 12576 _this.$fill.css(css); 12577 } 12578 }); 12579 if (this.initialized) { 12580 this.$element.one('finished.zf.animate', function () { 12581 /** 12582 * Fires when the handle is done moving. 12583 * @event Slider#moved 12584 */ 12585 _this.$element.trigger('moved.zf.slider', [$hndl]); 12586 }); 12587 /** 12588 * Fires when the value has not been change for a given time. 12589 * @event Slider#changed 12590 */ 12591 clearTimeout(_this.timeout); 12592 _this.timeout = setTimeout(function () { 12593 _this.$element.trigger('changed.zf.slider', [$hndl]); 12594 }, _this.options.changedDelay); 12595 } 12596 } 12597 12598 /** 12599 * Sets the initial attribute for the slider element. 12600 * @function 12601 * @private 12602 * @param {Number} idx - index of the current handle/input to use. 12603 */ 12604 }, { 12605 key: "_setInitAttr", 12606 value: function _setInitAttr(idx) { 12607 var initVal = idx === 0 ? this.options.initialStart : this.options.initialEnd; 12608 var id = this.inputs.eq(idx).attr('id') || (0, _foundationCore.GetYoDigits)(6, 'slider'); 12609 this.inputs.eq(idx).attr({ 12610 'id': id, 12611 'max': this.options.end, 12612 'min': this.options.start, 12613 'step': this.options.step 12614 }); 12615 this.inputs.eq(idx).val(initVal); 12616 this.handles.eq(idx).attr({ 12617 'role': 'slider', 12618 'aria-controls': id, 12619 'aria-valuemax': this.options.end, 12620 'aria-valuemin': this.options.start, 12621 'aria-valuenow': initVal, 12622 'aria-orientation': this.options.vertical ? 'vertical' : 'horizontal', 12623 'tabindex': 0 12624 }); 12625 } 12626 12627 /** 12628 * Sets the input and `aria-valuenow` values for the slider element. 12629 * @function 12630 * @private 12631 * @param {jQuery} $handle - the currently selected handle. 12632 * @param {Number} val - floating point of the new value. 12633 */ 12634 }, { 12635 key: "_setValues", 12636 value: function _setValues($handle, val) { 12637 var idx = this.options.doubleSided ? this.handles.index($handle) : 0; 12638 this.inputs.eq(idx).val(val); 12639 $handle.attr('aria-valuenow', val); 12640 } 12641 12642 /** 12643 * Handles events on the slider element. 12644 * Calculates the new location of the current handle. 12645 * If there are two handles and the bar was clicked, it determines which handle to move. 12646 * @function 12647 * @private 12648 * @param {Object} e - the `event` object passed from the listener. 12649 * @param {jQuery} $handle - the current handle to calculate for, if selected. 12650 * @param {Number} val - floating point number for the new value of the slider. 12651 * TODO clean this up, there's a lot of repeated code between this and the _setHandlePos fn. 12652 */ 12653 }, { 12654 key: "_handleEvent", 12655 value: function _handleEvent(e, $handle, val) { 12656 var value; 12657 if (!val) { 12658 //click or drag events 12659 e.preventDefault(); 12660 var _this = this, 12661 vertical = this.options.vertical, 12662 param = vertical ? 'height' : 'width', 12663 direction = vertical ? 'top' : 'left', 12664 eventOffset = vertical ? e.pageY : e.pageX, 12665 barDim = this.$element[0].getBoundingClientRect()[param], 12666 windowScroll = vertical ? (0, _jquery["default"])(window).scrollTop() : (0, _jquery["default"])(window).scrollLeft(); 12667 var elemOffset = this.$element.offset()[direction]; 12668 12669 // touch events emulated by the touch util give position relative to screen, add window.scroll to event coordinates... 12670 // best way to guess this is simulated is if clientY == pageY 12671 if (e.clientY === e.pageY) { 12672 eventOffset = eventOffset + windowScroll; 12673 } 12674 var eventFromBar = eventOffset - elemOffset; 12675 var barXY; 12676 if (eventFromBar < 0) { 12677 barXY = 0; 12678 } else if (eventFromBar > barDim) { 12679 barXY = barDim; 12680 } else { 12681 barXY = eventFromBar; 12682 } 12683 var offsetPct = percent(barXY, barDim); 12684 value = this._value(offsetPct); 12685 12686 // turn everything around for RTL, yay math! 12687 if ((0, _foundationCore.rtl)() && !this.options.vertical) { 12688 value = this.options.end - value; 12689 } 12690 value = _this._adjustValue(null, value); 12691 if (!$handle) { 12692 //figure out which handle it is, pass it to the next function. 12693 var firstHndlPos = absPosition(this.$handle, direction, barXY, param), 12694 secndHndlPos = absPosition(this.$handle2, direction, barXY, param); 12695 $handle = firstHndlPos <= secndHndlPos ? this.$handle : this.$handle2; 12696 } 12697 } else { 12698 //change event on input 12699 value = this._adjustValue(null, val); 12700 } 12701 this._setHandlePos($handle, value); 12702 } 12703 12704 /** 12705 * Adjustes value for handle in regard to step value. returns adjusted value 12706 * @function 12707 * @private 12708 * @param {jQuery} $handle - the selected handle. 12709 * @param {Number} value - value to adjust. used if $handle is falsy 12710 */ 12711 }, { 12712 key: "_adjustValue", 12713 value: function _adjustValue($handle, value) { 12714 var val, 12715 step = this.options.step, 12716 div = parseFloat(step / 2), 12717 left, 12718 previousVal, 12719 nextVal; 12720 if (!!$handle) { 12721 val = parseFloat($handle.attr('aria-valuenow')); 12722 } else { 12723 val = value; 12724 } 12725 if (val >= 0) { 12726 left = val % step; 12727 } else { 12728 left = step + val % step; 12729 } 12730 previousVal = val - left; 12731 nextVal = previousVal + step; 12732 if (left === 0) { 12733 return val; 12734 } 12735 val = val >= previousVal + div ? nextVal : previousVal; 12736 return val; 12737 } 12738 12739 /** 12740 * Adds event listeners to the slider elements. 12741 * @function 12742 * @private 12743 */ 12744 }, { 12745 key: "_events", 12746 value: function _events() { 12747 this._eventsForHandle(this.$handle); 12748 if (this.handles[1]) { 12749 this._eventsForHandle(this.$handle2); 12750 } 12751 } 12752 12753 /** 12754 * Adds event listeners a particular handle 12755 * @function 12756 * @private 12757 * @param {jQuery} $handle - the current handle to apply listeners to. 12758 */ 12759 }, { 12760 key: "_eventsForHandle", 12761 value: function _eventsForHandle($handle) { 12762 var _this = this, 12763 curHandle; 12764 var handleChangeEvent = function handleChangeEvent(e) { 12765 var idx = _this.inputs.index((0, _jquery["default"])(this)); 12766 _this._handleEvent(e, _this.handles.eq(idx), (0, _jquery["default"])(this).val()); 12767 }; 12768 12769 // IE only triggers the change event when the input loses focus which strictly follows the HTML specification 12770 // listen for the enter key and trigger a change 12771 // @see https://html.spec.whatwg.org/multipage/input.html#common-input-element-events 12772 this.inputs.off('keyup.zf.slider').on('keyup.zf.slider', function (e) { 12773 if (e.keyCode === 13) handleChangeEvent.call(this, e); 12774 }); 12775 this.inputs.off('change.zf.slider').on('change.zf.slider', handleChangeEvent); 12776 if (this.options.clickSelect) { 12777 this.$element.off('click.zf.slider').on('click.zf.slider', function (e) { 12778 if (_this.$element.data('dragging')) { 12779 return false; 12780 } 12781 if (!(0, _jquery["default"])(e.target).is('[data-slider-handle]')) { 12782 if (_this.options.doubleSided) { 12783 _this._handleEvent(e); 12784 } else { 12785 _this._handleEvent(e, _this.$handle); 12786 } 12787 } 12788 }); 12789 } 12790 if (this.options.draggable) { 12791 this.handles.addTouch(); 12792 var $body = (0, _jquery["default"])('body'); 12793 $handle.off('mousedown.zf.slider').on('mousedown.zf.slider', function (e) { 12794 $handle.addClass('is-dragging'); 12795 _this.$fill.addClass('is-dragging'); // 12796 _this.$element.data('dragging', true); 12797 curHandle = (0, _jquery["default"])(e.currentTarget); 12798 $body.on('mousemove.zf.slider', function (ev) { 12799 ev.preventDefault(); 12800 _this._handleEvent(ev, curHandle); 12801 }).on('mouseup.zf.slider', function (ev) { 12802 _this._handleEvent(ev, curHandle); 12803 $handle.removeClass('is-dragging'); 12804 _this.$fill.removeClass('is-dragging'); 12805 _this.$element.data('dragging', false); 12806 $body.off('mousemove.zf.slider mouseup.zf.slider'); 12807 }); 12808 }) 12809 // prevent events triggered by touch 12810 .on('selectstart.zf.slider touchmove.zf.slider', function (e) { 12811 e.preventDefault(); 12812 }); 12813 } 12814 $handle.off('keydown.zf.slider').on('keydown.zf.slider', function (e) { 12815 var _$handle = (0, _jquery["default"])(this), 12816 idx = _this.options.doubleSided ? _this.handles.index(_$handle) : 0, 12817 oldValue = parseFloat($handle.attr('aria-valuenow')), 12818 newValue; 12819 12820 // handle keyboard event with keyboard util 12821 _foundationUtil.Keyboard.handleKey(e, 'Slider', { 12822 decrease: function decrease() { 12823 newValue = oldValue - _this.options.step; 12824 }, 12825 increase: function increase() { 12826 newValue = oldValue + _this.options.step; 12827 }, 12828 decreaseFast: function decreaseFast() { 12829 newValue = oldValue - _this.options.step * 10; 12830 }, 12831 increaseFast: function increaseFast() { 12832 newValue = oldValue + _this.options.step * 10; 12833 }, 12834 min: function min() { 12835 newValue = _this.options.start; 12836 }, 12837 max: function max() { 12838 newValue = _this.options.end; 12839 }, 12840 handled: function handled() { 12841 // only set handle pos when event was handled specially 12842 e.preventDefault(); 12843 _this._setHandlePos(_$handle, newValue); 12844 } 12845 }); 12846 /*if (newValue) { // if pressed key has special function, update value 12847 e.preventDefault(); 12848 _this._setHandlePos(_$handle, newValue); 12849 }*/ 12850 }); 12851 } 12852 12853 /** 12854 * Destroys the slider plugin. 12855 */ 12856 }, { 12857 key: "_destroy", 12858 value: function _destroy() { 12859 this.handles.off('.zf.slider'); 12860 this.inputs.off('.zf.slider'); 12861 this.$element.off('.zf.slider'); 12862 clearTimeout(this.timeout); 12863 } 12864 }]); 12865}
12865(_foundationCore2.Plugin); 12866Slider.defaults = { 12867 /** 12868 * Minimum value for the slider scale. 12869 * @option 12870 * @type {number} 12871 * @default 0 12872 */ 12873 start: 0, 12874 /** 12875 * Maximum value for the slider scale. 12876 * @option 12877 * @type {number} 12878 * @default 100 12879 */ 12880 end: 100, 12881 /** 12882 * Minimum value change per change event. 12883 * @option 12884 * @type {number} 12885 * @default 1 12886 */ 12887 step: 1, 12888 /** 12889 * Value at which the handle/input *(left handle/first input)* should be set to on initialization. 12890 * @option 12891 * @type {number} 12892 * @default 0 12893 */ 12894 initialStart: 0, 12895 /** 12896 * Value at which the right handle/second input should be set to on initialization. 12897 * @option 12898 * @type {number} 12899 * @default 100 12900 */ 12901 initialEnd: 100, 12902 /** 12903 * Allows the input to be located outside the container and visible. Set to by the JS 12904 * @option 12905 * @type {boolean} 12906 * @default false 12907 */ 12908 binding: false, 12909 /** 12910 * Allows the user to click/tap on the slider bar to select a value. 12911 * @option 12912 * @type {boolean} 12913 * @default true 12914 */ 12915 clickSelect: true, 12916 /** 12917 * Set to true and use the `vertical` class to change alignment to vertical. 12918 * @option 12919 * @type {boolean} 12920 * @default false 12921 */ 12922 vertical: false, 12923 /** 12924 * Allows the user to drag the slider handle(s) to select a value. 12925 * @option 12926 * @type {boolean} 12927 * @default true 12928 */ 12929 draggable: true, 12930 /** 12931 * Disables the slider and prevents event listeners from being applied. Double checked by JS with `disabledClass`. 12932 * @option 12933 * @type {boolean} 12934 * @default false 12935 */ 12936 disabled: false, 12937 /** 12938 * Allows the use of two handles. Double checked by the JS. Changes some logic handling. 12939 * @option 12940 * @type {boolean} 12941 * @default false 12942 */ 12943 doubleSided: false, 12944 /** 12945 * Potential future feature. 12946 */ 12947 // steps: 100, 12948 /** 12949 * Number of decimal places the plugin should go to for floating point precision. 12950 * @option 12951 * @type {number} 12952 * @default 2 12953 */ 12954 decimal: 2, 12955 /** 12956 * Time delay for dragged elements. 12957 */ 12958 // dragDelay: 0, 12959 /** 12960 * Time, in ms, to animate the movement of a slider handle if user clicks/taps on the bar. Needs to be manually set if updating the transition time in the Sass settings. 12961 * @option 12962 * @type {number} 12963 * @default 200 12964 */ 12965 moveTime: 200, 12966 //update this if changing the transition time in the sass 12967 /** 12968 * Class applied to disabled sliders. 12969 * @option 12970 * @type {string} 12971 * @default 'disabled' 12972 */ 12973 disabledClass: 'disabled', 12974 /** 12975 * Will invert the default layout for a vertical<span data-tooltip title="who would do this???"> </span>slider. 12976 * @option 12977 * @type {boolean} 12978 * @default false 12979 */ 12980 invertVertical: false, 12981 /** 12982 * Milliseconds before the `changed.zf-slider` event is triggered after value change. 12983 * @option 12984 * @type {number} 12985 * @default 500 12986 */ 12987 changedDelay: 500, 12988 /** 12989 * Basevalue for non-linear sliders 12990 * @option 12991 * @type {number} 12992 * @default 5 12993 */ 12994 nonLinearBase: 5, 12995 /** 12996 * Basevalue for non-linear sliders, possible values are: `'linear'`, `'pow'` & `'log'`. Pow and Log use the nonLinearBase setting. 12997 * @option 12998 * @type {string} 12999 * @default 'linear' 13000 */ 13001 positionValueFunction: 'linear' 13002}; 13003function percent(frac, num) { 13004 return frac / num; 13005} 13006function absPosition($handle, dir, clickPos, param) { 13007 return Math.abs($handle.position()[dir] + $handle[param]() / 2 - clickPos); 13008} 13009function baseLog(base, value) { 13010 return Math.log(value) / Math.log(base); 13011} 13012 13013}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 13014},{"./foundation.core.plugin":18,"./foundation.core.utils":19,"./foundation.util.keyboard":23,"./foundation.util.motion":25,"./foundation.util.touch":28,"./foundation.util.triggers":29}],21:[function(require,module,exports){ 13015"use strict"; 13016 13017Object.defineProperty(exports, "__esModule", { 13018 value: true 13019}); 13020exports.Box = void 0; 13021var Box = exports.
vendor: 6,307 bytes, lines 13021-13189
13021Box = { 13022 ImNotTouchingYou: ImNotTouchingYou, 13023 OverlapArea: OverlapArea, 13024 GetDimensions: GetDimensions, 13025 GetExplicitOffsets: GetExplicitOffsets 13026}; 13027 13028/** 13029 * Compares the dimensions of an element to a container and determines collision events with container. 13030 * @function 13031 * @param {jQuery} element - jQuery object to test for collisions. 13032 * @param {jQuery} parent - jQuery object to use as bounding container. 13033 * @param {Boolean} lrOnly - set to true to check left and right values only. 13034 * @param {Boolean} tbOnly - set to true to check top and bottom values only. 13035 * @default if no parent object passed, detects collisions with `window`. 13036 * @returns {Boolean} - true if collision free, false if a collision in any direction. 13037 */ 13038function ImNotTouchingYou(element, parent, lrOnly, tbOnly, ignoreBottom) { 13039 return OverlapArea(element, parent, lrOnly, tbOnly, ignoreBottom) === 0; 13040} 13041function OverlapArea(element, parent, lrOnly, tbOnly, ignoreBottom) { 13042 var eleDims = GetDimensions(element), 13043 topOver, 13044 bottomOver, 13045 leftOver, 13046 rightOver; 13047 if (parent) { 13048 var parDims = GetDimensions(parent); 13049 bottomOver = parDims.height + parDims.offset.top - (eleDims.offset.top + eleDims.height); 13050 topOver = eleDims.offset.top - parDims.offset.top; 13051 leftOver = eleDims.offset.left - parDims.offset.left; 13052 rightOver = parDims.width + parDims.offset.left - (eleDims.offset.left + eleDims.width); 13053 } else { 13054 bottomOver = eleDims.windowDims.height + eleDims.windowDims.offset.top - (eleDims.offset.top + eleDims.height); 13055 topOver = eleDims.offset.top - eleDims.windowDims.offset.top; 13056 leftOver = eleDims.offset.left - eleDims.windowDims.offset.left; 13057 rightOver = eleDims.windowDims.width - (eleDims.offset.left + eleDims.width); 13058 } 13059 bottomOver = ignoreBottom ? 0 : Math.min(bottomOver, 0); 13060 topOver = Math.min(topOver, 0); 13061 leftOver = Math.min(leftOver, 0); 13062 rightOver = Math.min(rightOver, 0); 13063 if (lrOnly) { 13064 return leftOver + rightOver; 13065 } 13066 if (tbOnly) { 13067 return topOver + bottomOver; 13068 } 13069 13070 // use sum of squares b/c we care about overlap area. 13071 return Math.sqrt(topOver * topOver + bottomOver * bottomOver + leftOver * leftOver + rightOver * rightOver); 13072} 13073 13074/** 13075 * Uses native methods to return an object of dimension values. 13076 * @function 13077 * @param {jQuery || HTML} element - jQuery object or DOM element for which to get the dimensions. Can be any element other that document or window. 13078 * @returns {Object} - nested object of integer pixel values 13079 * TODO - if element is window, return only those values. 13080 */ 13081function GetDimensions(elem) { 13082 elem = elem.length ? elem[0] : elem; 13083 if (elem === window || elem === document) { 13084 throw new Error("I'm sorry, Dave. I'm afraid I can't do that."); 13085 } 13086 var rect = elem.getBoundingClientRect(), 13087 parRect = elem.parentNode.getBoundingClientRect(), 13088 winRect = document.body.getBoundingClientRect(), 13089 winY = window.pageYOffset, 13090 winX = window.pageXOffset; 13091 return { 13092 width: rect.width, 13093 height: rect.height, 13094 offset: { 13095 top: rect.top + winY, 13096 left: rect.left + winX 13097 }, 13098 parentDims: { 13099 width: parRect.width, 13100 height: parRect.height, 13101 offset: { 13102 top: parRect.top + winY, 13103 left: parRect.left + winX 13104 } 13105 }, 13106 windowDims: { 13107 width: winRect.width, 13108 height: winRect.height, 13109 offset: { 13110 top: winY, 13111 left: winX 13112 } 13113 } 13114 }; 13115} 13116 13117/** 13118 * Returns an object of top and left integer pixel values for dynamically rendered elements, 13119 * such as: Tooltip, Reveal, and Dropdown. Maintained for backwards compatibility, and where 13120 * you don't know alignment, but generally from 13121 * 6.4 forward you should use GetExplicitOffsets, as GetOffsets conflates position and alignment. 13122 * @function 13123 * @param {jQuery} element - jQuery object for the element being positioned. 13124 * @param {jQuery} anchor - jQuery object for the element's anchor point. 13125 * @param {String} position - a string relating to the desired position of the element, relative to it's anchor 13126 * @param {Number} vOffset - integer pixel value of desired vertical separation between anchor and element. 13127 * @param {Number} hOffset - integer pixel value of desired horizontal separation between anchor and element. 13128 * @param {Boolean} isOverflow - if a collision event is detected, sets to true to default the element to full width - any desired offset. 13129 * TODO alter/rewrite to work with `em` values as well/instead of pixels 13130 */ 13131function GetExplicitOffsets(element, anchor, position, alignment, vOffset, hOffset, isOverflow) { 13132 var $eleDims = GetDimensions(element), 13133 $anchorDims = anchor ? GetDimensions(anchor) : null; 13134 var topVal, leftVal; 13135 if ($anchorDims !== null) { 13136 // set position related attribute 13137 switch (position) { 13138 case 'top': 13139 topVal = $anchorDims.offset.top - ($eleDims.height + vOffset); 13140 break; 13141 case 'bottom': 13142 topVal = $anchorDims.offset.top + $anchorDims.height + vOffset; 13143 break; 13144 case 'left': 13145 leftVal = $anchorDims.offset.left - ($eleDims.width + hOffset); 13146 break; 13147 case 'right': 13148 leftVal = $anchorDims.offset.left + $anchorDims.width + hOffset; 13149 break; 13150 } 13151 13152 // set alignment related attribute 13153 switch (position) { 13154 case 'top': 13155 case 'bottom': 13156 switch (alignment) { 13157 case 'left': 13158 leftVal = $anchorDims.offset.left + hOffset; 13159 break; 13160 case 'right': 13161 leftVal = $anchorDims.offset.left - $eleDims.width + $anchorDims.width - hOffset; 13162 break; 13163 case 'center': 13164 leftVal = isOverflow ? hOffset : $anchorDims.offset.left + $anchorDims.width / 2 - $eleDims.width / 2 + hOffset; 13165 break; 13166 } 13167 break; 13168 case 'right': 13169 case 'left': 13170 switch (alignment) { 13171 case 'bottom': 13172 topVal = $anchorDims.offset.top - vOffset + $anchorDims.height - $eleDims.height; 13173 break; 13174 case 'top': 13175 topVal = $anchorDims.offset.top + vOffset; 13176 break; 13177 case 'center': 13178 topVal = $anchorDims.offset.top + vOffset + $anchorDims.height / 2 - $eleDims.height / 2; 13179 break; 13180 } 13181 break; 13182 } 13183 } 13184 return { 13185 top: topVal, 13186 left: leftVal 13187 }; 13188} 13189
13190},{}],22:[function(require,module,exports){ 13191(function (global){(function (){ 13192"use strict"; 13193 13194Object.defineProperty(exports, "__esModule", { 13195 value: true 13196}); 13197exports.onImagesLoaded = onImagesLoaded; 13198var _jquery = _interopRequireDefault((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 13199function _interopRequireDefault(e) { 13200 return e && e.__esModule ? e : { 13201 "default": e 13202 }; 13203} 13204/** 13205 * Runs a callback function when images are fully loaded. 13206 * @param {Object} images - Image(s) to check if loaded. 13207 * @param {Func} callback - Function to execute when image is fully loaded. 13208 */ 13209function onImagesLoaded(images, callback) { 13210 var unloaded = images.length; 13211 if (unloaded === 0) { 13212 callback(); 13213 } 13214 images.each(function () { 13215 // Check if image is loaded 13216 if (this.complete && typeof this.naturalWidth !== 'undefined') { 13217 singleImageLoaded(); 13218 } else { 13219 // If the above check failed, simulate loading on detached element. 13220 var image = new Image(); 13221 // Still count image as loaded if it finalizes with an error. 13222 var events = "load.zf.images error.zf.images"; 13223 (0, _jquery["default"])(image).one(events, function me() { 13224 // Unbind the event listeners. We're using 'one' but only one of the two events will have fired. 13225 (0, _jquery["default"])(this).off(events, me); 13226 singleImageLoaded(); 13227 }); 13228 image.src = (0, _jquery["default"])(this).attr('src'); 13229 } 13230 }); 13231 function singleImageLoaded() { 13232 unloaded--; 13233 if (unloaded === 0) { 13234 callback(); 13235 } 13236 } 13237} 13238 13239}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 13240},{}],23:[function(require,module,exports){ 13241(function (global){(function (){ 13242"use strict"; 13243 13244Object.defineProperty(exports, "__esModule", { 13245 value: true 13246}); 13247exports.Keyboard = void 0; 13248var _jquery = _interopRequireDefault((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 13249var _foundationCore = require("./foundation.core.utils"); 13250function _interopRequireDefault(e) { 13251 return e && e.__esModule ? e : { 13252 "default": e 13253 }; 13254} 13255/******************************************* 13256 * * 13257 * This util was created by Marius Olbertz * 13258 * Please thank Marius on GitHub /owlbertz * 13259 * or the web http://www.mariusolbertz.de/ * 13260 * * 13261 ******************************************/ 13262 13263var keyCodes = { 13264 9: 'TAB', 13265 13: 'ENTER', 13266 27: 'ESCAPE', 13267 32: 'SPACE', 13268 35: 'END', 13269 36: 'HOME', 13270 37: 'ARROW_LEFT', 13271 38: 'ARROW_UP', 13272 39: 'ARROW_RIGHT', 13273 40: 'ARROW_DOWN' 13274}; 13275var commands = {}; 13276 13277// Functions pulled out to be referenceable from internals 13278function findFocusable($element) { 13279 if (!$element) { 13280 return false;
13281 } 13282 return $element.find('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]').filter(function () { 13283 if (!(0, _jquery["default"])(this).is(':visible') || (0, _jquery["default"])(this).attr('tabindex') < 0) { 13284 return false; 13285 } //only have visible elements and those that have a tabindex greater or equal 0 13286 return true; 13287 }).sort(function (a, b) { 13288 if ((0, _jquery["default"])(a).attr('tabindex') === (0, _jquery["default"])(b).attr('tabindex')) { 13289 return 0; 13290 } 13291 var aTabIndex = parseInt((0, _jquery["default"])(a).attr('tabindex'), 10), 13292 bTabIndex = parseInt((0, _jquery["default"])(b).attr('tabindex'), 10); 13293 // Undefined is treated the same as 0 13294 if (typeof (0, _jquery["default"])(a).attr('tabindex') === 'undefined' && bTabIndex > 0) { 13295 return 1; 13296 } 13297 if (typeof (0, _jquery["default"])(b).attr('tabindex') === 'undefined' && aTabIndex > 0) { 13298 return -1; 13299 } 13300 if (aTabIndex === 0 && bTabIndex > 0) { 13301 return 1; 13302 } 13303 if (bTabIndex === 0 && aTabIndex > 0) { 13304 return -1; 13305 } 13306 if (aTabIndex < bTabIndex) { 13307 return -1; 13308 } 13309 if (aTabIndex > bTabIndex) { 13310 return 1; 13311 } 13312 }); 13313} 13314function parseKey(event) { 13315 var key = keyCodes[event.which || event.keyCode] || String.fromCharCode(event.which).toUpperCase(); 13316 13317 // Remove un-printable characters, e.g. for `fromCharCode` calls for CTRL only events 13318 key = key.replace(/\W+/, ''); 13319 if (event.shiftKey) key = "SHIFT_".concat(key); 13320 if (event.ctrlKey) key = "CTRL_".concat(key); 13321 if (event.altKey) key = "ALT_".concat(key); 13322 13323 // Remove trailing underscore, in case only modifiers were used (e.g. only `CTRL_ALT`) 13324 key = key.replace(/_$/, ''); 13325 return key; 13326} 13327var Keyboard = exports.Keyboard = { 13328 keys: getKeyCodes(keyCodes), 13329 /** 13330 * Parses the (keyboard) event and returns a String that represents its key 13331 * Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE 13332 * @param {Event} event - the event generated by the event handler 13333 * @return String key - String that represents the key pressed 13334 */ 13335 parseKey: parseKey, 13336 /** 13337 * Handles the given (keyboard) event 13338 * @param {Event} event - the event generated by the event handler 13339 * @param {String} component - Foundation component's name, e.g. Slider or Reveal 13340 * @param {Objects} functions - collection of functions that are to be executed 13341 */ 13342 handleKey: function handleKey(event, component, functions) { 13343 var commandList = commands[component], 13344 keyCode = this.parseKey(event), 13345 cmds, 13346 command, 13347 fn; 13348 if (!commandList) return console.warn('Component not defined!'); 13349 13350 // Ignore the event if it was already handled 13351 if (event.zfIsKeyHandled === true) return; 13352 13353 // This component does not differentiate between ltr and rtl 13354 if (typeof commandList.ltr === 'undefined') { 13355 cmds = commandList; // use plain list 13356 } else { 13357 // merge ltr and rtl: if document is rtl, rtl overwrites ltr and vice versa 13358 if ((0, _foundationCore.rtl)()) cmds = _jquery["default"].extend({}, commandList.ltr, commandList.rtl);else cmds = _jquery["default"].extend({}, commandList.rtl, commandList.ltr); 13359 } 13360 command = cmds[keyCode]; 13361 fn = functions[command]; 13362 // Execute the handler if found 13363 if (fn && typeof fn === 'function') { 13364 var returnValue = fn.apply(); 13365 13366 // Mark the event as "handled" to prevent future handlings 13367 event.zfIsKeyHandled = true; 13368 13369 // Execute function when event was handled 13370 if (functions.handled || typeof functions.handled === 'function') { 13371 functions.handled(returnValue); 13372 } 13373 } else { 13374 // Execute function when event was not handled 13375 if (functions.unhandled || typeof functions.unhandled === 'function') { 13376 functions.unhandled(); 13377 } 13378 } 13379 }, 13380 /** 13381 * Finds all focusable elements within the given `$element` 13382 * @param {jQuery} $element - jQuery object to search within 13383 * @return {jQuery} $focusable - all focusable elements within `$element` 13384 */ 13385 13386 findFocusable: findFocusable, 13387 /** 13388 * Returns the component name name 13389 * @param {Object} component - Foundation component, e.g. Slider or Reveal 13390 * @return String componentName 13391 */ 13392 register: function register(componentName, cmds) { 13393 commands[componentName] = cmds; 13394 }, 13395 // TODO9438: These references to Keyboard need to not require global. Will 'this' work in this context? 13396 // 13397 /** 13398 * Traps the focus in the given element. 13399 * @param {jQuery} $element jQuery object to trap the foucs into. 13400 */ 13401 trapFocus: function trapFocus($element) {
13402 var $focusable = findFocusable($element), 13403 $firstFocusable = $focusable.eq(0), 13404 $lastFocusable = $focusable.eq(-1); 13405 $element.on('keydown.zf.trapfocus', function (event) { 13406 if (event.target === $lastFocusable[0] && parseKey(event) === 'TAB') { 13407 event.preventDefault(); 13408 $firstFocusable.focus(); 13409 } else if (event.target === $firstFocusable[0] && parseKey(event) === 'SHIFT_TAB') { 13410 event.preventDefault(); 13411 $lastFocusable.focus(); 13412 } 13413 }); 13414 }, 13415 /** 13416 * Releases the trapped focus from the given element. 13417 * @param {jQuery} $element jQuery object to release the focus for. 13418 */ 13419 releaseFocus: function releaseFocus($element) { 13420 $element.off('keydown.zf.trapfocus'); 13421 } 13422}; 13423 13424/* 13425 * Constants for easier comparing. 13426 * Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE 13427 */ 13428function getKeyCodes(kcs) { 13429 var k = {}; 13430 for (var kc in kcs) { 13431 if (kcs.hasOwnProperty(kc)) k[kcs[kc]] = kcs[kc]; 13432 } 13433 return k; 13434} 13435 13436}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 13437},{"./foundation.core.utils":19}],24:[function(require,module,exports){ 13438(function (global){(function (){ 13439"use strict"; 13440 13441Object.defineProperty(exports, "__esModule", { 13442 value: true 13443}); 13444exports.MediaQuery = void 0; 13445var _jquery = _interopRequireDefault((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 13446function _interopRequireDefault(e) { 13447 return e && e.__esModule ? e : { 13448 "default": e 13449 }; 13450} 13451function _typeof(o) { 13452 "@babel/helpers - typeof"; 13453 13454 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { 13455 return typeof o; 13456 } : function (o) { 13457 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 13458 }, _typeof(o); 13459} 13460function _slicedToArray(r, e) { 13461 return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); 13462} 13463function _nonIterableRest() { 13464 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 13465} 13466function _unsupportedIterableToArray(r, a) { 13467 if (r) { 13468 if ("string" == typeof r) return _arrayLikeToArray(r, a); 13469 var t = {}.toString.call(r).slice(8, -1); 13470 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; 13471 } 13472} 13473function _arrayLikeToArray(r, a) { 13474 (null == a || a > r.length) && (a = r.length); 13475 for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; 13476 return n; 13477} 13478function _iterableToArrayLimit(r, l) { 13479 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 13480 if (null != t) { 13481 var e, 13482 n, 13483 i, 13484 u, 13485 a = [], 13486 f = !0, 13487 o = !1; 13488 try { 13489 if (i = (t = t.call(r)).next, 0 === l) { 13490 if (Object(t) !== t) return; 13491 f = !1; 13492 } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); 13493 } catch (r) { 13494 o = !0, n = r; 13495 } finally { 13496 try { 13497 if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; 13498 } finally { 13499 if (o) throw n; 13500 } 13501 } 13502 return a; 13503 } 13504} 13505function _arrayWithHoles(r) { 13506 if (Array.isArray(r)) return r; 13507} 13508// Default set of media queries 13509// const defaultQueries = { 13510// 'default' : 'only screen', 13511// landscape : 'only screen and (orientation: landscape)', 13512// portrait : 'only screen and (orientation: portrait)', 13513// retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' + 13514// 'only screen and (min--moz-device-pixel-ratio: 2),' + 13515// 'only screen and (-o-min-device-pixel-ratio: 2/1),' + 13516// 'only screen and (min-device-pixel-ratio: 2),' + 13517// 'only screen and (min-resolution: 192dpi),' + 13518// 'only screen and (min-resolution: 2dppx)' 13519// }; 13520 13521// matchMedia() polyfill - Test a CSS media type/query in JS. 13522// Authors & copyright © 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. MIT license 13523/* eslint-disable */ 13524window.matchMedia || (window.matchMedia = function () { 13525 "use strict"; 13526 13527 // For browsers that support matchMedium api such as IE 9 and webkit 13528 var styleMedia = window.styleMedia || window.media; 13529 13530 // For those that don't support matchMedium 13531 if (!styleMedia) { 13532 var style = document.createElement('style'), 13533 script = document.getElementsByTagName('script')[0], 13534 info = null; 13535 style.type = 'text/css'; 13536 style.id = 'matchmediajs-test'; 13537 if (!script) { 13538 document.head.appendChild(style); 13539 } else { 13540 script.parentNode.insertBefore(style, script); 13541 } 13542 13543 // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers 13544 info = 'getComputedStyle' in window && window.getComputedStyle(style, null) || style.currentStyle; 13545 styleMedia = { 13546 matchMedium: function matchMedium(media) { 13547 var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; 13548 13549 // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers 13550 if (style.styleSheet) { 13551 style.styleSheet.cssText = text; 13552 } else { 13553 style.textContent = text; 13554 } 13555 13556 // Test if media query is true or false 13557 return info.width === '1px'; 13558 } 13559 }; 13560 } 13561 return function (media) { 13562 return { 13563 matches: styleMedia.matchMedium(media || 'all'), 13564 media: media || 'all' 13565 }; 13566 }; 13567}()); 13568/* eslint-enable */ 13569 13570var MediaQuery = exports.MediaQuery = { 13571 queries: [], 13572 current: '', 13573 /** 13574 * Initializes the media query helper, by extracting the breakpoint list from the CSS and activating the breakpoint watcher. 13575 * @function 13576 * @private 13577 */ 13578 _init: function _init() { 13579 // make sure the initialization is only done once when calling _init() several times 13580 if (this.isInitialized === true) { 13581 return this; 13582 } else { 13583 this.isInitialized = true; 13584 } 13585 var self = this; 13586 var $meta = (0, _jquery["default"])('meta.foundation-mq'); 13587 if (!$meta.length) { 13588 (0, _jquery["default"])('<meta class="foundation-mq" name="foundation-mq" content>').appendTo(document.head); 13589 } 13590 var extractedStyles = (0, _jquery["default"]
vendor: 5,816 bytes, lines 13590-13754
13590)('.foundation-mq').css('font-family'); 13591 var namedQueries; 13592 namedQueries = parseStyleToObject(extractedStyles); 13593 self.queries = []; // reset 13594 13595 for (var key in namedQueries) { 13596 if (namedQueries.hasOwnProperty(key)) { 13597 self.queries.push({ 13598 name: key, 13599 value: "only screen and (min-width: ".concat(namedQueries[key], ")") 13600 }); 13601 } 13602 } 13603 this.current = this._getCurrentSize(); 13604 this._watcher(); 13605 }, 13606 /** 13607 * Reinitializes the media query helper. 13608 * Useful if your CSS breakpoint configuration has just been loaded or has changed since the initialization. 13609 * @function 13610 * @private 13611 */ 13612 _reInit: function _reInit() { 13613 this.isInitialized = false; 13614 this._init(); 13615 }, 13616 /** 13617 * Checks if the screen is at least as wide as a breakpoint. 13618 * @function 13619 * @param {String} size - Name of the breakpoint to check. 13620 * @returns {Boolean} `true` if the breakpoint matches, `false` if it's smaller. 13621 */ 13622 atLeast: function atLeast(size) { 13623 var query = this.get(size); 13624 if (query) { 13625 return window.matchMedia(query).matches; 13626 } 13627 return false; 13628 }, 13629 /** 13630 * Checks if the screen is within the given breakpoint. 13631 * If smaller than the breakpoint of larger than its upper limit it returns false. 13632 * @function 13633 * @param {String} size - Name of the breakpoint to check. 13634 * @returns {Boolean} `true` if the breakpoint matches, `false` otherwise. 13635 */ 13636 only: function only(size) { 13637 return size === this._getCurrentSize(); 13638 }, 13639 /** 13640 * Checks if the screen is within a breakpoint or smaller. 13641 * @function 13642 * @param {String} size - Name of the breakpoint to check. 13643 * @returns {Boolean} `true` if the breakpoint matches, `false` if it's larger. 13644 */ 13645 upTo: function upTo(size) { 13646 var nextSize = this.next(size); 13647 13648 // If the next breakpoint does not match, the screen is smaller than 13649 // the upper limit of this breakpoint. 13650 if (nextSize) { 13651 return !this.atLeast(nextSize); 13652 } 13653 13654 // If there is no next breakpoint, the "size" breakpoint does not have 13655 // an upper limit and the screen will always be within it or smaller. 13656 return true; 13657 }, 13658 /** 13659 * Checks if the screen matches to a breakpoint. 13660 * @function 13661 * @param {String} size - Name of the breakpoint to check, either 'small only' or 'small'. Omitting 'only' falls back to using atLeast() method. 13662 * @returns {Boolean} `true` if the breakpoint matches, `false` if it does not. 13663 */ 13664 is: function is(size) { 13665 var parts = size.trim().split(' ').filter(function (p) { 13666 return !!p.length; 13667 }); 13668 var _parts = _slicedToArray(parts, 2), 13669 bpSize = _parts[0], 13670 _parts$ = _parts[1], 13671 bpModifier = _parts$ === void 0 ? '' : _parts$; 13672 13673 // Only the breakpont 13674 if (bpModifier === 'only') { 13675 return this.only(bpSize); 13676 } 13677 // At least the breakpoint (included) 13678 if (!bpModifier || bpModifier === 'up') { 13679 return this.atLeast(bpSize); 13680 } 13681 // Up to the breakpoint (included) 13682 if (bpModifier === 'down') { 13683 return this.upTo(bpSize); 13684 } 13685 throw new Error("\n Invalid breakpoint passed to MediaQuery.is().\n Expected a breakpoint name formatted like \"<size> <modifier>\", got \"".concat(size, "\".\n ")); 13686 }, 13687 /** 13688 * Gets the media query of a breakpoint. 13689 * @function 13690 * @param {String} size - Name of the breakpoint to get. 13691 * @returns {String|null} - The media query of the breakpoint, or `null` if the breakpoint doesn't exist. 13692 */ 13693 get: function get(size) { 13694 for (var i in this.queries) { 13695 if (this.queries.hasOwnProperty(i)) { 13696 var query = this.queries[i]; 13697 if (size === query.name) return query.value; 13698 } 13699 } 13700 return null; 13701 }, 13702 /** 13703 * Get the breakpoint following the given breakpoint. 13704 * @function 13705 * @param {String} size - Name of the breakpoint. 13706 * @returns {String|null} - The name of the following breakpoint, or `null` if the passed breakpoint was the last one. 13707 */ 13708 next: function next(size) { 13709 var _this = this; 13710 var queryIndex = this.queries.findIndex(function (q) { 13711 return _this._getQueryName(q) === size; 13712 }); 13713 if (queryIndex === -1) { 13714 throw new Error("\n Unknown breakpoint \"".concat(size, "\" passed to MediaQuery.next().\n Ensure it is present in your Sass \"$breakpoints\" setting.\n ")); 13715 } 13716 var nextQuery = this.queries[queryIndex + 1]; 13717 return nextQuery ? nextQuery.name : null; 13718 }, 13719 /** 13720 * Returns the name of the breakpoint related to the given value. 13721 * @function 13722 * @private 13723 * @param {String|Object} value - Breakpoint name or query object. 13724 * @returns {String} Name of the breakpoint. 13725 */ 13726 _getQueryName: function _getQueryName(value) { 13727 if (typeof value === 'string') return value; 13728 if (_typeof(value) === 'object') return value.name; 13729 throw new TypeError("\n Invalid value passed to MediaQuery._getQueryName().\n Expected a breakpoint name (String) or a breakpoint query (Object), got \"".concat(value, "\" (").concat(_typeof(value), ")\n ")); 13730 }, 13731 /** 13732 * Gets the current breakpoint name by testing every breakpoint and returning the last one to match (the biggest one). 13733 * @function 13734 * @private 13735 * @returns {String} Name of the current breakpoint. 13736 */ 13737 _getCurrentSize: function _getCurrentSize() { 13738 var matched; 13739 for (var i = 0; i < this.queries.length; i++) { 13740 var query = this.queries[i]; 13741 if (window.matchMedia(query.value).matches) { 13742 matched = query; 13743 } 13744 } 13745 return matched && this._getQueryName(matched); 13746 }, 13747 /** 13748 * Activates the breakpoint watcher, which fires an event on the window whenever the breakpoint changes. 13749 * @function 13750 * @private 13751 */ 13752 _watcher: function _watcher() { 13753 var _this2 = this; 13754
13754(0, _jquery["default"])(window).on('resize.zf.trigger', function () { 13755 var newSize = _this2._getCurrentSize(), 13756 currentSize = _this2.current; 13757 if (newSize !== currentSize) { 13758 // Change the current media query 13759 _this2.current = newSize; 13760 13761 // Broadcast the media query change on the window 13762 (0, _jquery["default"])(window).trigger('changed.zf.mediaquery', [newSize, currentSize]); 13763 } 13764 }); 13765 } 13766}; 13767 13768// Thank you: https://github.com/sindresorhus/query-string 13769function parseStyleToObject(str) { 13770 var styleObject = {}; 13771 if (typeof str !== 'string') { 13772 return styleObject; 13773 } 13774 str = str.trim().slice(1, -1); // browsers re-quote string style values 13775 13776 if (!str) { 13777 return styleObject; 13778 } 13779 styleObject = str.split('&').reduce(function (ret, param) { 13780 var parts = param.replace(/\+/g, ' ').split('='); 13781 var key = parts[0]; 13782 var val = parts[1]; 13783 key = decodeURIComponent(key); 13784 13785 // missing `=` should be `null`: 13786 // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters 13787 val = typeof val === 'undefined' ? null : decodeURIComponent(val); 13788 if (!ret.hasOwnProperty(key)) { 13789 ret[key] = val; 13790 } else if (Array.isArray(ret[key])) { 13791 ret[key].push(val); 13792 } else { 13793 ret[key] = [ret[key], val]; 13794 } 13795 return ret; 13796 }, {}); 13797 return styleObject; 13798} 13799 13800}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 13801},{}],25:[function(require,module,exports){ 13802(function (global){(function (){ 13803"use strict"; 13804 13805Object.defineProperty(exports, "__esModule", { 13806 value: true 13807}); 13808exports.Motion = void 0; 13809exports.Move = Move; 13810var _jquery = _interopRequireDefault((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 13811var _foundationCore = require("./foundation.core.utils"); 13812function _interopRequireDefault(e) { 13813 return e && e.__esModule ? e : { 13814 "default": e 13815 }; 13816} 13817/** 13818 * Motion module. 13819 * @module foundation.motion 13820 */ 13821 13822var initClasses = ['mui-enter', 'mui-leave']; 13823var activeClasses = ['mui-enter-active', 'mui-leave-active']; 13824var Motion = exports.Motion = { 13825 animateIn: function animateIn(element, animation, cb) { 13826 animate(true, element, animation, cb); 13827 }, 13828 animateOut: function animateOut(element, animation, cb) { 13829 animate(false, element, animation, cb); 13830 } 13831}; 13832function Move(duration, elem, fn) { 13833 var anim, 13834 prog, 13835 start = null; 13836 if (duration === 0) { 13837 fn.apply(elem); 13838 elem.trigger('finished.zf.animate', [elem]).triggerHandler('finished.zf.animate', [elem]); 13839 return; 13840 } 13841 function move(ts) { 13842 if (!start) start = ts; 13843 prog = ts - start; 13844 fn.apply(elem); 13845 if (prog < duration) { 13846 anim = window.requestAnimationFrame(move, elem); 13847 } else { 13848 window.cancelAnimationFrame(anim); 13849 elem.trigger('finished.zf.animate', [elem]).triggerHandler('finished.zf.animate', [elem]); 13850 } 13851 } 13852 anim = window.requestAnimationFrame(move); 13853} 13854 13855/** 13856 * Animates an element in or out using a CSS transition class. 13857 * @function 13858 * @private 13859 * @param {Boolean} isIn - Defines if the animation is in or out. 13860 * @param {Object} element - jQuery or HTML object to animate. 13861 * @param {String} animation - CSS class to use. 13862 * @param {Function} cb - Callback to run when animation is finished. 13863 */ 13864function animate(isIn, element, animation, cb) { 13865 element = (0, _jquery["default"])(element).eq(0); 13866 if (!element.length) return; 13867 var initClass = isIn ? initClasses[0] : initClasses[1]; 13868 var activeClass = isIn ? activeClasses[0] : activeClasses[1]; 13869 13870 // Set up the animation 13871 reset(); 13872 element.addClass(animation).css('transition', 'none'); 13873 requestAnimationFrame(function () { 13874 element.addClass(initClass); 13875 if (isIn) element.show(); 13876 }); 13877 13878 // Start the animation 13879 requestAnimationFrame(function () { 13880 // will trigger the browser to synchronously calculate the style and layout 13881 // also called reflow or layout thrashing 13882 // see https://gist.github.com/paulirish/5d52fb081b3570c81e3a 13883 element[0].offsetWidth; 13884 element.css('transition', '').addClass(activeClass); 13885 }); 13886 13887 // Clean up the animation when it finishes 13888 element.one((0, _foundationCore.transitionend)(element), finish); 13889 13890 // Hides the element (for out animations), resets the element, and runs a callback 13891 function finish() { 13892 if (!isIn) element.hide(); 13893 reset(); 13894 if (cb) cb.apply(element); 13895 } 13896 13897 // Resets transitions and removes motion-specific classes 13898 function reset() { 13899 element[0].style.transitionDuration = 0; 13900 element.removeClass("".concat(initClass, " ").concat(activeClass, " ").concat(animation)); 13901 } 13902} 13903 13904}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 13905},{"./foundation.core.utils":19}],26:[function(require,module,exports){ 13906(function (global){(function (){ 13907"use strict"; 13908 13909Object.defineProperty(exports, "__esModule", { 13910 value: true 13911}); 13912exports.Nest = void 0; 13913var _jquery = _interopRequireDefault((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 13914function _interopRequireDefault(e) {
13915 return e && e.__esModule ? e : { 13916 "default": e 13917 }; 13918} 13919var Nest = exports.Nest = { 13920 Feather: function Feather(menu) { 13921 var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'zf'; 13922 menu.attr('role', 'menubar'); 13923 menu.find('a').attr({ 13924 'role': 'menuitem' 13925 }); 13926 var items = menu.find('li').attr({ 13927 'role': 'none' 13928 }), 13929 subMenuClass = "is-".concat(type, "-submenu"), 13930 subItemClass = "".concat(subMenuClass, "-item"), 13931 hasSubClass = "is-".concat(type, "-submenu-parent"), 13932 applyAria = type !== 'accordion'; // Accordions handle their own ARIA attriutes. 13933 13934 items.each(function () { 13935 var $item = (0, _jquery["default"])(this), 13936 $sub = $item.children('ul'); 13937 if ($sub.length) { 13938 $item.addClass(hasSubClass); 13939 if (applyAria) { 13940 var firstItem = $item.children('a:first'); 13941 firstItem.attr({ 13942 'aria-haspopup': true, 13943 'aria-label': firstItem.attr('aria-label') || firstItem.text() 13944 }); 13945 // Note: Drilldowns behave differently in how they hide, and so need 13946 // additional attributes. We should look if this possibly over-generalized 13947 // utility (Nest) is appropriate when we rework menus in 6.4 13948 if (type === 'drilldown') { 13949 $item.attr({ 13950 'aria-expanded': false 13951 }); 13952 } 13953 } 13954 $sub.addClass("submenu ".concat(subMenuClass)).attr({ 13955 'data-submenu': '', 13956 'role': 'menubar' 13957 }); 13958 if (type === 'drilldown') { 13959 $sub.attr({ 13960 'aria-hidden': true 13961 }); 13962 } 13963 } 13964 if ($item.parent('[data-submenu]').length) { 13965 $item.addClass("is-submenu-item ".concat(subItemClass)); 13966 } 13967 }); 13968 return; 13969 }, 13970 Burn: function Burn(menu, type) { 13971 var 13972 //items = menu.find('li'), 13973 subMenuClass = "is-".concat(type, "-submenu"), 13974 subItemClass = "".concat(subMenuClass, "-item"), 13975 hasSubClass = "is-".concat(type, "-submenu-parent"); 13976 menu.find('>li, > li > ul, .menu, .menu > li, [data-submenu] > li').removeClass("".concat(subMenuClass, " ").concat(subItemClass, " ").concat(hasSubClass, " is-submenu-item submenu is-active")).removeAttr('data-submenu').css('display', ''); 13977 } 13978}; 13979 13980}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 13981},{}],27:[function(require,module,exports){ 13982"use strict"; 13983 13984Object.defineProperty(exports, "__esModule", { 13985 value: true 13986}); 13987exports.Timer = Timer; 13988function Timer(elem, options, cb) { 13989 var _this = this, 13990 duration = options.duration, 13991 //options is an object for easily adding features later. 13992 nameSpace = Object.keys(elem.data())[0] || 'timer', 13993 remain = -1, 13994 start, 13995 timer; 13996 this.isPaused = false; 13997 this.restart = function () { 13998 remain = -1; 13999 clearTimeout(timer); 14000 this.start(); 14001 }; 14002 this.start = function () { 14003 this.isPaused = false; 14004 // if(!elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things. 14005 clearTimeout(timer); 14006 remain = remain <= 0 ? duration : remain; 14007 elem.data('paused', false); 14008 start = Date.now(); 14009 timer = setTimeout(function () { 14010 if (options.infinite) { 14011 _this.restart(); //rerun the timer. 14012 } 14013 if (cb && typeof cb === 'function') { 14014 cb(); 14015 } 14016 }, remain); 14017 elem.trigger("timerstart.zf.".concat(nameSpace)); 14018 }; 14019 this.pause = function () { 14020 this.isPaused = true; 14021 //if(elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things. 14022 clearTimeout(timer); 14023 elem.data('paused', true); 14024 var end = Date.now(); 14025 remain = remain - (end - start); 14026 elem.trigger("timerpaused.zf.".concat(nameSpace)); 14027 }; 14028} 14029 14030},{}],28:[function(require,module,exports){ 14031(function (global){(function (){ 14032"use strict"; 14033 14034function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 14035Object.defineProperty(exports, "__esModule", { 14036 value: true 14037}); 14038exports.Touch = void 0; 14039var _jquery = _interopRequireDefault((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 14040function _interopRequireDefault(e) {
14041 return e && e.__esModule ? e : { 14042 "default": e 14043 }; 14044} 14045function _typeof(o) { 14046 "@babel/helpers - typeof"; 14047 14048 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { 14049 return typeof o; 14050 } : function (o) { 14051 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 14052 }, _typeof(o); 14053} 14054function _classCallCheck(a, n) { 14055 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); 14056} 14057function _defineProperties(e, r) { 14058 for (var t = 0; t < r.length; t++) { 14059 var o = r[t]; 14060 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); 14061 } 14062} 14063function _createClass(e, r, t) { 14064 return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { 14065 writable: !1 14066 }), e; 14067} 14068function _toPropertyKey(t) { 14069 var i = _toPrimitive(t, "string"); 14070 return "symbol" == _typeof(i) ? i : i + ""; 14071} 14072function _toPrimitive(t, r) { 14073 if ("object" != _typeof(t) || !t) return t; 14074 var e = t[Symbol.toPrimitive]; 14075 if (void 0 !== e) { 14076 var i = e.call(t, r || "default"); 14077 if ("object" != _typeof(i)) return i; 14078 throw new TypeError("@@toPrimitive must return a primitive value."); 14079 } 14080 return ("string" === r ? String : Number)(t); 14081} //************************************************** 14082//**Work inspired by multiple jquery swipe plugins** 14083//**Done by Yohai Ararat *************************** 14084//************************************************** 14085var Touch = exports.Touch = {}; 14086var startPosX, 14087 startTime, 14088 elapsedTime, 14089 startEvent, 14090 isMoving = false, 14091 didMoved = false; 14092function onTouchEnd(e) { 14093 this.removeEventListener('touchmove', onTouchMove); 14094 this.removeEventListener('touchend', onTouchEnd); 14095 14096 // If the touch did not move, consider it as a "tap" 14097 if (!didMoved) { 14098 var tapEvent = _jquery["default"].Event('tap', startEvent || e); 14099 (0, _jquery["default"])(this).trigger(tapEvent); 14100 } 14101 startEvent = null; 14102 isMoving = false; 14103 didMoved = false; 14104} 14105function onTouchMove(e) { 14106 if (true === _jquery["default"].spotSwipe.preventDefault) { 14107 e.preventDefault(); 14108 } 14109 if (isMoving) { 14110 var x = e.touches[0].pageX; 14111 // var y = e.touches[0].pageY; 14112 var dx = startPosX - x; 14113 // var dy = startPosY - y; 14114 var dir; 14115 didMoved = true; 14116 elapsedTime = new Date().getTime() - startTime; 14117 if (Math.abs(dx) >= _jquery["default"].spotSwipe.moveThreshold && elapsedTime <= _jquery["default"].spotSwipe.timeThreshold) { 14118 dir = dx > 0 ? 'left' : 'right'; 14119 } 14120 // else if(Math.abs(dy) >= $.spotSwipe.moveThreshold && elapsedTime <= $.spotSwipe.timeThreshold) { 14121 // dir = dy > 0 ? 'down' : 'up'; 14122 // } 14123 if (dir) { 14124 e.preventDefault(); 14125 onTouchEnd.apply(this, arguments); 14126 (0, _jquery["default"])(this).trigger(_jquery["default"].Event('swipe', _extends({}, e)), dir).trigger(_jquery["default"].Event("swipe".concat(dir), _extends({}, e))); 14127 } 14128 } 14129} 14130function onTouchStart(e) { 14131 if (e.touches.length === 1) { 14132 startPosX = e.touches[0].pageX; 14133 startEvent = e; 14134 isMoving = true; 14135 didMoved = false; 14136 startTime = new Date().getTime(); 14137 this.addEventListener('touchmove', onTouchMove, { 14138 passive: true === _jquery["default"].spotSwipe.preventDefault 14139 }); 14140 this.addEventListener('touchend', onTouchEnd, false); 14141 } 14142} 14143function init() { 14144 this.addEventListener && this.addEventListener('touchstart', onTouchStart, { 14145 passive: true 14146 }); 14147} 14148 14149// function teardown() { 14150// this.removeEventListener('touchstart', onTouchStart); 14151// } 14152var SpotSwipe = /*#__PURE__*/function () { 14153 function SpotSwipe() { 14154 _classCallCheck(this, SpotSwipe); 14155 this.version = '1.0.0'; 14156 this.enabled = 'ontouchstart' in document.documentElement; 14157 this.preventDefault = false;
14158 this.moveThreshold = 75; 14159 this.timeThreshold = 200; 14160 this._init(); 14161 } 14162 return _createClass(SpotSwipe, [{ 14163 key: "_init", 14164 value: function _init() { 14165 _jquery["default"].event.special.swipe = { 14166 setup: init 14167 }; 14168 _jquery["default"].event.special.tap = { 14169 setup: init 14170 }; 14171 _jquery["default"].each(['left', 'up', 'down', 'right'], function () { 14172 _jquery["default"].event.special["swipe".concat(this)] = { 14173 setup: function setup() { 14174 (0, _jquery["default"])(this).on('swipe', _jquery["default"].noop); 14175 } 14176 }; 14177 }); 14178 } 14179 }]); 14180}(); 14181/**************************************************** 14182 * As far as I can tell, both setupSpotSwipe and * 14183 * setupTouchHandler should be idempotent, * 14184 * because they directly replace functions & * 14185 * values, and do not add event handlers directly. * 14186 ****************************************************/ 14187Touch.setupSpotSwipe = function () { 14188 _jquery["default"].spotSwipe = new SpotSwipe(_jquery["default"]); 14189}; 14190 14191/**************************************************** 14192 * Method for adding pseudo drag events to elements * 14193 ***************************************************/ 14194Touch.setupTouchHandler = function () { 14195 _jquery["default"].fn.addTouch = function () { 14196 this.each(function (i, el) { 14197 (0, _jquery["default"])(el).bind('touchstart touchmove touchend touchcancel', function (event) { 14198 //we pass the original event object because the jQuery event 14199 //object is normalized to w3c specs and does not provide the TouchList 14200 handleTouch(event); 14201 }); 14202 }); 14203 var handleTouch = function handleTouch(event) { 14204 var touches = event.changedTouches, 14205 first = touches[0], 14206 eventTypes = { 14207 touchstart: 'mousedown', 14208 touchmove: 'mousemove', 14209 touchend: 'mouseup' 14210 }, 14211 type = eventTypes[event.type], 14212 simulatedEvent; 14213 if ('MouseEvent' in window && typeof window.MouseEvent === 'function') { 14214 simulatedEvent = new window.MouseEvent(type, { 14215 'bubbles': true, 14216 'cancelable': true, 14217 'screenX': first.screenX, 14218 'screenY': first.screenY, 14219 'clientX': first.clientX, 14220 'clientY': first.clientY 14221 }); 14222 } else { 14223 simulatedEvent = document.createEvent('MouseEvent'); 14224 simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0 /*left*/, null); 14225 } 14226 first.target.dispatchEvent(simulatedEvent); 14227 }; 14228 }; 14229}; 14230Touch.init = function () { 14231 if (typeof _jquery["default"].spotSwipe === 'undefined') { 14232 Touch.setupSpotSwipe(_jquery["default"]); 14233 Touch.setupTouchHandler(_jquery["default"]); 14234 } 14235}; 14236 14237}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 14238},{}],29:[function(require,module,exports){ 14239(function (global){(function (){ 14240"use strict"; 14241 14242Object.defineProperty(exports, "__esModule", { 14243 value: true 14244}); 14245exports.Triggers = void 0; 14246var _jquery = _interopRequireDefault((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 14247var _foundationCore = require("./foundation.core.utils"); 14248var _foundationUtil = require("./foundation.util.motion"); 14249function _interopRequireDefault(e) { 14250 return e && e.__esModule ? e : { 14251 "default": e 14252 }; 14253} 14254function _typeof(o) { 14255 "@babel/helpers - typeof"; 14256 14257 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { 14258 return typeof o; 14259 } : function (o) { 14260 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 14261 }, _typeof(o); 14262} 14263var MutationObserver = function () { 14264 var prefixes = ['WebKit', 'Moz', 'O', 'Ms', '']; 14265 for (var i = 0; i < prefixes.length; i++) { 14266 if ("".concat(prefixes[i], "MutationObserver") in window) { 14267 return window["".concat(prefixes[i], "MutationObserver")]; 14268 } 14269 } 14270 return false;
14271}(); 14272var triggers = function triggers(el, type) { 14273 el.data(type).split(' ').forEach(function (id) { 14274 (0, _jquery["default"])("#".concat(id))[type === 'close' ? 'trigger' : 'triggerHandler']("".concat(type, ".zf.trigger"), [el]); 14275 }); 14276}; 14277var Triggers = exports.Triggers = { 14278 Listeners: { 14279 Basic: {}, 14280 Global: {} 14281 }, 14282 Initializers: {} 14283}; 14284Triggers.Listeners.Basic = { 14285 openListener: function openListener() { 14286 triggers((0, _jquery["default"])(this), 'open'); 14287 }, 14288 closeListener: function closeListener() { 14289 var id = (0, _jquery["default"])(this).data('close'); 14290 if (id) { 14291 triggers((0, _jquery["default"])(this), 'close'); 14292 } else { 14293 (0, _jquery["default"])(this).trigger('close.zf.trigger'); 14294 } 14295 }, 14296 toggleListener: function toggleListener() { 14297 var id = (0, _jquery["default"])(this).data('toggle'); 14298 if (id) { 14299 triggers((0, _jquery["default"])(this), 'toggle'); 14300 } else { 14301 (0, _jquery["default"])(this).trigger('toggle.zf.trigger'); 14302 } 14303 }, 14304 closeableListener: function closeableListener(e) { 14305 var animation = (0, _jquery["default"])(this).data('closable'); 14306 14307 // Only close the first closable element. See https://git.io/zf-7833 14308 e.stopPropagation(); 14309 if (animation !== '') { 14310 _foundationUtil.Motion.animateOut((0, _jquery["default"])(this), animation, function () { 14311 (0, _jquery["default"])(this).trigger('closed.zf'); 14312 }); 14313 } else { 14314 (0, _jquery["default"])(this).fadeOut().trigger('closed.zf'); 14315 } 14316 }, 14317 toggleFocusListener: function toggleFocusListener() { 14318 var id = (0, _jquery["default"])(this).data('toggle-focus'); 14319 (0, _jquery["default"])("#".concat(id)).triggerHandler('toggle.zf.trigger', [(0, _jquery["default"])(this)]); 14320 } 14321}; 14322 14323// Elements with [data-open] will reveal a plugin that supports it when clicked. 14324Triggers.Initializers.addOpenListener = function ($elem) { 14325 $elem.off('click.zf.trigger', Triggers.Listeners.Basic.openListener); 14326 $elem.on('click.zf.trigger', '[data-open]', Triggers.Listeners.Basic.openListener); 14327}; 14328 14329// Elements with [data-close] will close a plugin that supports it when clicked. 14330// If used without a value on [data-close], the event will bubble, allowing it to close a parent component. 14331Triggers.Initializers.addCloseListener = function ($elem) { 14332 $elem.off('click.zf.trigger', Triggers.Listeners.Basic.closeListener); 14333 $elem.on('click.zf.trigger', '[data-close]', Triggers.Listeners.Basic.closeListener); 14334}; 14335 14336// Elements with [data-toggle] will toggle a plugin that supports it when clicked. 14337Triggers.Initializers.addToggleListener = function ($elem) { 14338 $elem.off('click.zf.trigger', Triggers.Listeners.Basic.toggleListener); 14339 $elem.on('click.zf.trigger', '[data-toggle]', Triggers.Listeners.Basic.toggleListener); 14340}; 14341 14342// Elements with [data-closable] will respond to close.zf.trigger events. 14343Triggers.Initializers.addCloseableListener = function ($elem) { 14344 $elem.off('close.zf.trigger', Triggers.Listeners.Basic.closeableListener); 14345 $elem.on('close.zf.trigger', '[data-closeable], [data-closable]', Triggers.Listeners.Basic.closeableListener); 14346}; 14347 14348// Elements with [data-toggle-focus] will respond to coming in and out of focus 14349Triggers.Initializers.addToggleFocusListener = function ($elem) { 14350 $elem.off('focus.zf.trigger blur.zf.trigger', Triggers.Listeners.Basic.toggleFocusListener); 14351 $elem.on('focus.zf.trigger blur.zf.trigger', '[data-toggle-focus]', Triggers.Listeners.Basic.toggleFocusListener); 14352}; 14353 14354// More Global/complex listeners and triggers 14355Triggers.Listeners.Global = { 14356 resizeListener: function resizeListener($nodes) { 14357 if (!MutationObserver) { 14358 //fallback for IE 9 14359 $nodes.each(function () { 14360 (0, _jquery["default"])(this).triggerHandler('resizeme.zf.trigger'); 14361 }); 14362 } 14363 //trigger all listening elements and signal a resize event 14364 $nodes.attr('data-events', "resize"); 14365 }, 14366 scrollListener: function scrollListener($nodes) { 14367 if (!MutationObserver) { 14368 //fallback for IE 9 14369 $nodes.each(function () { 14370 (0, _jquery["default"])(this).triggerHandler('scrollme.zf.trigger'); 14371 }); 14372 } 14373 //trigger all listening elements and signal a scroll event 14374 $nodes.attr('data-events', "scroll"); 14375 }, 14376 closeMeListener: function closeMeListener(e, pluginId) { 14377 var plugin = e.namespace.split('.')[0]; 14378 var plugins = (0, _jquery["default"])("[data-".concat(plugin, "]")).not("[data-yeti-box=\"".concat(pluginId, "\"]")); 14379 plugins.each(function () { 14380 var _this = (0, _jquery["default"])(this); 14381 _this.triggerHandler('close.zf.trigger', [_this]); 14382 }); 14383 } 14384}; 14385 14386// Global, parses whole document.
vendor: 4,102 bytes, lines 14387-14486
14387Triggers.Initializers.addClosemeListener = function (pluginName) { 14388 var yetiBoxes = (0, _jquery["default"])('[data-yeti-box]'), 14389 plugNames = ['dropdown', 'tooltip', 'reveal']; 14390 if (pluginName) { 14391 if (typeof pluginName === 'string') { 14392 plugNames.push(pluginName); 14393 } else if (_typeof(pluginName) === 'object' && typeof pluginName[0] === 'string') { 14394 plugNames = plugNames.concat(pluginName); 14395 } else { 14396 console.error('Plugin names must be strings'); 14397 } 14398 } 14399 if (yetiBoxes.length) { 14400 var listeners = plugNames.map(function (name) { 14401 return "closeme.zf.".concat(name); 14402 }).join(' '); 14403 (0, _jquery["default"])(window).off(listeners).on(listeners, Triggers.Listeners.Global.closeMeListener); 14404 } 14405}; 14406function debounceGlobalListener(debounce, trigger, listener) { 14407 var timer, 14408 args = Array.prototype.slice.call(arguments, 3); 14409 (0, _jquery["default"])(window).on(trigger, function () { 14410 if (timer) { 14411 clearTimeout(timer); 14412 } 14413 timer = setTimeout(function () { 14414 listener.apply(null, args); 14415 }, debounce || 10); //default time to emit scroll event 14416 }); 14417} 14418Triggers.Initializers.addResizeListener = function (debounce) { 14419 var $nodes = (0, _jquery["default"])('[data-resize]'); 14420 if ($nodes.length) { 14421 debounceGlobalListener(debounce, 'resize.zf.trigger', Triggers.Listeners.Global.resizeListener, $nodes); 14422 } 14423}; 14424Triggers.Initializers.addScrollListener = function (debounce) { 14425 var $nodes = (0, _jquery["default"])('[data-scroll]'); 14426 if ($nodes.length) { 14427 debounceGlobalListener(debounce, 'scroll.zf.trigger', Triggers.Listeners.Global.scrollListener, $nodes); 14428 } 14429}; 14430Triggers.Initializers.addMutationEventsListener = function ($elem) { 14431 if (!MutationObserver) { 14432 return false; 14433 } 14434 var $nodes = $elem.find('[data-resize], [data-scroll], [data-mutate]'); 14435 14436 //element callback 14437 var listeningElementsMutation = function listeningElementsMutation(mutationRecordsList) { 14438 var $target = (0, _jquery["default"])(mutationRecordsList[0].target); 14439 14440 //trigger the event handler for the element depending on type 14441 switch (mutationRecordsList[0].type) { 14442 case "attributes": 14443 if ($target.attr("data-events") === "scroll" && mutationRecordsList[0].attributeName === "data-events") { 14444 $target.triggerHandler('scrollme.zf.trigger', [$target, window.pageYOffset]); 14445 } 14446 if ($target.attr("data-events") === "resize" && mutationRecordsList[0].attributeName === "data-events") { 14447 $target.triggerHandler('resizeme.zf.trigger', [$target]); 14448 } 14449 if (mutationRecordsList[0].attributeName === "style") { 14450 $target.closest("[data-mutate]").attr("data-events", "mutate"); 14451 $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]); 14452 } 14453 break; 14454 case "childList": 14455 $target.closest("[data-mutate]").attr("data-events", "mutate"); 14456 $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]); 14457 break; 14458 default: 14459 return false; 14460 //nothing 14461 } 14462 }; 14463 if ($nodes.length) { 14464 //for each element that needs to listen for resizing, scrolling, or mutation add a single observer 14465 for (var i = 0; i <= $nodes.length - 1; i++) { 14466 var elementObserver = new MutationObserver(listeningElementsMutation); 14467 elementObserver.observe($nodes[i], { 14468 attributes: true, 14469 childList: true, 14470 characterData: false, 14471 subtree: true, 14472 attributeFilter: ["data-events", "style"] 14473 }); 14474 } 14475 } 14476}; 14477Triggers.Initializers.addSimpleListeners = function () { 14478 var $document = (0, _jquery["default"])(document); 14479 Triggers.Initializers.addOpenListener($document); 14480 Triggers.Initializers.addCloseListener($document); 14481 Triggers.Initializers.addToggleListener($document); 14482 Triggers.Initializers.addCloseableListener($document); 14483 Triggers.Initializers.addToggleFocusListener($document); 14484}; 14485Triggers.Initializers.addGlobalListeners = function () { 14486 var $document = (0, _jquery["default"])(document);
14487 Triggers.Initializers.addMutationEventsListener($document); 14488 Triggers.Initializers.addResizeListener(250); 14489 Triggers.Initializers.addScrollListener(); 14490 Triggers.Initializers.addClosemeListener(); 14491}; 14492Triggers.init = function (__, Foundation) { 14493 (0, _foundationCore.onLoad)((0, _jquery["default"])(window), function () { 14494 if (_jquery["default"].triggersInitialized !== true) { 14495 Triggers.Initializers.addSimpleListeners(); 14496 Triggers.Initializers.addGlobalListeners(); 14497 _jquery["default"].triggersInitialized = true; 14498 } 14499 }); 14500 if (Foundation) { 14501 Foundation.Triggers = Triggers; 14502 // Legacy included to be backwards compatible for now. 14503 Foundation.IHearYou = Triggers.Initializers.addGlobalListeners; 14504 } 14505}; 14506 14507}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 14508},{"./foundation.core.utils":19,"./foundation.util.motion":25}],30:[function(require,module,exports){ 14509function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 14510/*! js-cookie v3.0.8 | MIT */ 14511; 14512(function (global, factory) { 14513 (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, function () { 14514 var current = global.Cookies; 14515 var exports = global.Cookies = factory(); 14516 exports.noConflict = function () { 14517 global.Cookies = current; 14518 return exports; 14519 }; 14520 }()); 14521})(this, function () { 14522 'use strict'; 14523 14524 function assign(target) { 14525 for (var i = 1; i < arguments.length; i++) { 14526 var source = arguments[i]; 14527 for (var key in source) { 14528 if (key === '__proto__') continue; 14529 target[key] = source[key]; 14530 } 14531 } 14532 return target; 14533 } 14534 var defaultConverter = { 14535 read: function read(value) { 14536 if (value[0] === '"') { 14537 value = value.slice(1, -1); 14538 } 14539 return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent); 14540 }, 14541 write: function write(value) { 14542 return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent); 14543 } 14544 }; 14545 function init(converter, defaultAttributes) { 14546 function set(name, value, attributes) { 14547 if (typeof document === 'undefined') { 14548 return; 14549 } 14550 attributes = assign({}, defaultAttributes, attributes); 14551 if (typeof attributes.expires === 'number') { 14552 attributes.expires = new Date(Date.now() + attributes.expires * 864e5); 14553 } 14554 if (attributes.expires) { 14555 attributes.expires = attributes.expires.toUTCString(); 14556 } 14557 name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape); 14558 var stringifiedAttributes = ''; 14559 for (var attributeName in attributes) { 14560 if (!attributes[attributeName]) { 14561 continue; 14562 } 14563 stringifiedAttributes += '; ' + attributeName; 14564 if (attributes[attributeName] === true) { 14565 continue; 14566 } 14567 14568 // Considers RFC 6265 section 5.2: 14569 // ... 14570 // 3. If the remaining unparsed-attributes contains a %x3B (";") 14571 // character: 14572 // Consume the characters of the unparsed-attributes up to, 14573 // not including, the first %x3B (";") character. 14574 // ... 14575 stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; 14576 } 14577 return document.cookie = name + '=' + converter.write(value, name) + stringifiedAttributes; 14578 } 14579 function get(name) { 14580 if (typeof document === 'undefined' || arguments.length && !name) { 14581 return; 14582 } 14583 14584 // To prevent the for loop in the first place assign an empty array 14585 // in case there are no cookies at all. 14586 var cookies = document.cookie ? document.cookie.split('; ') : []; 14587 var jar = {}; 14588 for (var i = 0; i < cookies.length; i++) { 14589 var parts = cookies[i].split('='); 14590 var value = parts.slice(1).join('='); 14591 try { 14592 var found = decodeURIComponent(parts[0]); 14593 if (!(found in jar)) jar[found] = converter.read(value, found);
14594 if (name === found) { 14595 break; 14596 } 14597 } catch (_e) { 14598 // Do nothing... 14599 } 14600 } 14601 return name ? jar[name] : jar; 14602 } 14603 return Object.create({ 14604 set: set, 14605 get: get, 14606 remove: function remove(name, attributes) { 14607 set(name, '', assign({}, attributes, { 14608 expires: -1 14609 })); 14610 }, 14611 withAttributes: function withAttributes(attributes) { 14612 return init(this.converter, assign({}, this.attributes, attributes)); 14613 }, 14614 withConverter: function withConverter(converter) { 14615 return init(assign({}, this.converter, converter), this.attributes); 14616 } 14617 }, { 14618 attributes: { 14619 value: Object.freeze(defaultAttributes) 14620 }, 14621 converter: { 14622 value: Object.freeze(converter) 14623 } 14624 }); 14625 } 14626 var api = init(defaultConverter, { 14627 path: '/' 14628 }); 14629 return api; 14630}); 14631 14632},{}],31:[function(require,module,exports){ 14633function _typeof2(o) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof2(o); } 14634(function (global, factory) { 14635 (typeof exports === "undefined" ? "undefined" : _typeof2(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.Jump = factory(); 14636})(this, function () { 14637 'use strict'; 14638 14639 // Robert Penner's easeInOutQuad 14640 14641 // find the rest of his easing functions here: http://robertpenner.com/easing/ 14642 // find them exported for ES6 consumption here: https://github.com/jaxgeller/ez.js 14643 var easeInOutQuad = function easeInOutQuad(t, b, c, d) { 14644 t /= d / 2; 14645 if (t < 1) return c / 2 * t * t + b; 14646 t--; 14647 return -c / 2 * (t * (t - 2) - 1) + b; 14648 }; 14649 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) { 14650 return _typeof2(obj); 14651 } : function (obj) { 14652 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); 14653 }; 14654 var jumper = function jumper() { 14655 // private variable cache 14656 // no variables are created during a jump, preventing memory leaks 14657 14658 var element = void 0; // element to scroll to (node) 14659 14660 var start = void 0; // where scroll starts (px) 14661 var stop = void 0; // where scroll stops (px) 14662 14663 var offset = void 0; // adjustment from the stop position (px) 14664 var easing = void 0; // easing function (function) 14665 var a11y = void 0; // accessibility support flag (boolean) 14666 14667 var distance = void 0; // distance of scroll (px) 14668 var duration = void 0; // scroll duration (ms) 14669 14670 var timeStart = void 0; // time scroll started (ms) 14671 var timeElapsed = void 0; // time spent scrolling thus far (ms) 14672 14673 var next = void 0; // next scroll position (px) 14674 14675 var callback = void 0; // to call when done scrolling (function) 14676 14677 // scroll position helper 14678 14679 function location() { 14680 return window.scrollY || window.pageYOffset; 14681 } 14682 14683 // element offset helper 14684 14685 function top(element) { 14686 return element.getBoundingClientRect().top + start; 14687 } 14688 14689 // rAF loop helper 14690 14691 function loop(timeCurrent) { 14692 // store time scroll started, if not started already 14693 if (!timeStart) { 14694 timeStart = timeCurrent; 14695 } 14696 14697 // determine time spent scrolling so far 14698 timeElapsed = timeCurrent - timeStart; 14699 14700 // calculate next scroll position 14701 next = easing(timeElapsed, start, distance, duration); 14702 14703 // scroll to it 14704 window.scrollTo(0, next); 14705 14706 // check progress 14707 timeElapsed < duration ? window.requestAnimationFrame(loop) // continue scroll loop 14708 : done(); // scrolling is done 14709 } 14710 14711 // scroll finished helper 14712 14713 function done() { 14714 // account for rAF time rounding inaccuracies 14715 window.scrollTo(0, start + distance); 14716 14717 // if scrolling to an element, and accessibility is enabled 14718 if (element && a11y) { 14719 // add tabindex indicating programmatic focus 14720 element.setAttribute('tabindex', '-1'); 14721 14722 // focus the element 14723 element.focus(); 14724 } 14725 14726 // if it exists, fire the callback 14727 if (typeof callback === 'function') { 14728 callback(); 14729 } 14730 14731 // reset time for next jump 14732 timeStart = false;
14733 } 14734 14735 // API 14736 14737 function jump(target) { 14738 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 14739 14740 // resolve options, or use defaults 14741 duration = options.duration || 1000; 14742 offset = options.offset || 0; 14743 callback = options.callback; // "undefined" is a suitable default, and won't be called 14744 easing = options.easing || easeInOutQuad; 14745 a11y = options.a11y || false; 14746 14747 // cache starting position 14748 start = location(); 14749 14750 // resolve target 14751 switch (typeof target === 'undefined' ? 'undefined' : _typeof(target)) { 14752 // scroll from current position 14753 case 'number': 14754 element = undefined; // no element to scroll to 14755 a11y = false; // make sure accessibility is off 14756 stop = start + target; 14757 break; 14758 14759 // scroll to element (node) 14760 // bounding rect is relative to the viewport 14761 case 'object': 14762 element = target; 14763 stop = top(element); 14764 break; 14765 14766 // scroll to element (selector) 14767 // bounding rect is relative to the viewport 14768 case 'string': 14769 element = document.querySelector(target); 14770 stop = top(element); 14771 break; 14772 } 14773 14774 // resolve scroll distance, accounting for offset 14775 distance = stop - start + offset; 14776 14777 // resolve duration 14778 switch (_typeof(options.duration)) { 14779 // number in ms 14780 case 'number': 14781 duration = options.duration; 14782 break; 14783 14784 // function passed the distance of the scroll 14785 case 'function': 14786 duration = options.duration(distance); 14787 break; 14788 } 14789 14790 // start the loop 14791 window.requestAnimationFrame(loop); 14792 } 14793 14794 // expose only the jump method 14795 return jump; 14796 }; 14797 14798 // export singleton 14799 14800 var singleton = jumper(); 14801 return singleton; 14802}); 14803 14804},{}],32:[function(require,module,exports){ 14805/* 14806object-assign 14807(c) Sindre Sorhus 14808@license MIT
vendor: 5,554 bytes, lines 14809-14973
14809*/ 14810 14811'use strict'; 14812 14813/* eslint-disable no-unused-vars */ 14814function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 14815var getOwnPropertySymbols = Object.getOwnPropertySymbols; 14816var hasOwnProperty = Object.prototype.hasOwnProperty; 14817var propIsEnumerable = Object.prototype.propertyIsEnumerable; 14818function toObject(val) { 14819 if (val === null || val === undefined) { 14820 throw new TypeError('Object.assign cannot be called with null or undefined'); 14821 } 14822 return Object(val); 14823} 14824function shouldUseNative() { 14825 try { 14826 if (!Object.assign) { 14827 return false; 14828 } 14829 14830 // Detect buggy property enumeration order in older V8 versions. 14831 14832 // https://bugs.chromium.org/p/v8/issues/detail?id=4118 14833 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers 14834 test1[5] = 'de'; 14835 if (Object.getOwnPropertyNames(test1)[0] === '5') { 14836 return false; 14837 } 14838 14839 // https://bugs.chromium.org/p/v8/issues/detail?id=3056 14840 var test2 = {}; 14841 for (var i = 0; i < 10; i++) { 14842 test2['_' + String.fromCharCode(i)] = i; 14843 } 14844 var order2 = Object.getOwnPropertyNames(test2).map(function (n) { 14845 return test2[n]; 14846 }); 14847 if (order2.join('') !== '0123456789') { 14848 return false; 14849 } 14850 14851 // https://bugs.chromium.org/p/v8/issues/detail?id=3056 14852 var test3 = {}; 14853 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { 14854 test3[letter] = letter; 14855 }); 14856 if (Object.keys(_extends({}, test3)).join('') !== 'abcdefghijklmnopqrst') { 14857 return false; 14858 } 14859 return true; 14860 } catch (err) { 14861 // We don't expect any of the above to throw, but better to be safe. 14862 return false; 14863 } 14864} 14865module.exports = shouldUseNative() ? Object.assign : function (target, source) { 14866 var from; 14867 var to = toObject(target); 14868 var symbols; 14869 for (var s = 1; s < arguments.length; s++) { 14870 from = Object(arguments[s]); 14871 for (var key in from) { 14872 if (hasOwnProperty.call(from, key)) { 14873 to[key] = from[key]; 14874 } 14875 } 14876 if (getOwnPropertySymbols) { 14877 symbols = getOwnPropertySymbols(from); 14878 for (var i = 0; i < symbols.length; i++) { 14879 if (propIsEnumerable.call(from, symbols[i])) { 14880 to[symbols[i]] = from[symbols[i]]; 14881 } 14882 } 14883 } 14884 } 14885 return to; 14886}; 14887 14888},{}],33:[function(require,module,exports){ 14889// shim for using process in browser 14890var process = module.exports = {}; 14891 14892// cached from whatever global is present so that test runners that stub it 14893// don't break things. But we need to wrap it in a try catch in case it is 14894// wrapped in strict mode code which doesn't define any globals. It's inside a 14895// function because try/catches deoptimize in certain engines. 14896 14897var cachedSetTimeout; 14898var cachedClearTimeout; 14899function defaultSetTimout() { 14900 throw new Error('setTimeout has not been defined'); 14901} 14902function defaultClearTimeout() { 14903 throw new Error('clearTimeout has not been defined'); 14904} 14905(function () { 14906 try { 14907 if (typeof setTimeout === 'function') { 14908 cachedSetTimeout = setTimeout; 14909 } else { 14910 cachedSetTimeout = defaultSetTimout; 14911 } 14912 } catch (e) { 14913 cachedSetTimeout = defaultSetTimout; 14914 } 14915 try { 14916 if (typeof clearTimeout === 'function') { 14917 cachedClearTimeout = clearTimeout; 14918 } else { 14919 cachedClearTimeout = defaultClearTimeout; 14920 } 14921 } catch (e) { 14922 cachedClearTimeout = defaultClearTimeout; 14923 } 14924})(); 14925function runTimeout(fun) { 14926 if (cachedSetTimeout === setTimeout) { 14927 //normal enviroments in sane situations 14928 return setTimeout(fun, 0); 14929 } 14930 // if setTimeout wasn't available but was latter defined 14931 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 14932 cachedSetTimeout = setTimeout; 14933 return setTimeout(fun, 0); 14934 } 14935 try { 14936 // when when somebody has screwed with setTimeout but no I.E. maddness 14937 return cachedSetTimeout(fun, 0); 14938 } catch (e) { 14939 try { 14940 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 14941 return cachedSetTimeout.call(null, fun, 0); 14942 } catch (e) { 14943 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error 14944 return cachedSetTimeout.call(this, fun, 0); 14945 } 14946 } 14947} 14948function runClearTimeout(marker) { 14949 if (cachedClearTimeout === clearTimeout) { 14950 //normal enviroments in sane situations 14951 return clearTimeout(marker); 14952 } 14953 // if clearTimeout wasn't available but was latter defined 14954 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 14955 cachedClearTimeout = clearTimeout; 14956 return clearTimeout(marker); 14957 } 14958 try { 14959 // when when somebody has screwed with setTimeout but no I.E. maddness 14960 return cachedClearTimeout(marker); 14961 } catch (e) { 14962 try { 14963 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 14964 return cachedClearTimeout.call(null, marker); 14965 } catch (e) { 14966 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. 14967 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 14968 return cachedClearTimeout.call(this, marker); 14969 } 14970 } 14971} 14972var queue = []; 14973var draining = false;
14974var currentQueue; 14975var queueIndex = -1; 14976function cleanUpNextTick() { 14977 if (!draining || !currentQueue) { 14978 return; 14979 } 14980 draining = false; 14981 if (currentQueue.length) { 14982 queue = currentQueue.concat(queue); 14983 } else { 14984 queueIndex = -1; 14985 } 14986 if (queue.length) { 14987 drainQueue(); 14988 } 14989} 14990function drainQueue() { 14991 if (draining) { 14992 return; 14993 } 14994 var timeout = runTimeout(cleanUpNextTick); 14995 draining = true; 14996 var len = queue.length; 14997 while (len) { 14998 currentQueue = queue; 14999 queue = []; 15000 while (++queueIndex < len) { 15001 if (currentQueue) { 15002 currentQueue[queueIndex].run(); 15003 } 15004 } 15005 queueIndex = -1; 15006 len = queue.length; 15007 } 15008 currentQueue = null; 15009 draining = false; 15010 runClearTimeout(timeout); 15011} 15012process.nextTick = function (fun) { 15013 var args = new Array(arguments.length - 1); 15014 if (arguments.length > 1) { 15015 for (var i = 1; i < arguments.length; i++) { 15016 args[i - 1] = arguments[i]; 15017 } 15018 } 15019 queue.push(new Item(fun, args)); 15020 if (queue.length === 1 && !draining) { 15021 runTimeout(drainQueue); 15022 } 15023}; 15024 15025// v8 likes predictible objects 15026function Item(fun, array) { 15027 this.fun = fun; 15028 this.array = array; 15029} 15030Item.prototype.run = function () { 15031 this.fun.apply(null, this.array); 15032}; 15033process.title = 'browser'; 15034process.browser = true; 15035process.env = {}; 15036process.argv = []; 15037process.version = ''; // empty string to avoid regexp issues 15038process.versions = {}; 15039function noop() {} 15040process.on = noop; 15041process.addListener = noop; 15042process.once = noop; 15043process.off = noop; 15044process.removeListener = noop; 15045process.removeAllListeners = noop; 15046process.emit = noop; 15047process.prependListener = noop; 15048process.prependOnceListener = noop; 15049process.listeners = function (name) { 15050 return []; 15051}; 15052process.binding = function (name) { 15053 throw new Error('process.binding is not supported'); 15054}; 15055process.cwd = function () { 15056 return '/'; 15057}; 15058process.chdir = function (dir) { 15059 throw new Error('process.chdir is not supported'); 15060}; 15061process.umask = function () { 15062 return 0; 15063}; 15064 15065},{}],34:[function(require,module,exports){ 15066'use strict'; 15067 15068function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 15069var strictUriEncode = require('strict-uri-encode'); 15070var objectAssign = require('object-assign'); 15071var decodeComponent = require('decode-uri-component'); 15072function encoderForArrayFormat(opts) { 15073 switch (opts.arrayFormat) { 15074 case 'index': 15075 return function (key, value, index) { 15076 return value === null ? [encode(key, opts), '[', index, ']'].join('') : [encode(key, opts), '[', encode(index, opts), ']=', encode(value, opts)].join(''); 15077 }; 15078 case 'bracket': 15079 return function (key, value) { 15080 return value === null ? encode(key, opts) : [encode(key, opts), '[]=', encode(value, opts)].join(''); 15081 }; 15082 default: 15083 return function (key, value) { 15084 return value === null ? encode(key, opts) : [encode(key, opts), '=', encode(value, opts)].join(''); 15085 }; 15086 } 15087} 15088function parserForArrayFormat(opts) { 15089 var result; 15090 switch (opts.arrayFormat) { 15091 case 'index': 15092 return function (key, value, accumulator) { 15093 result = /\[(\d*)\]$/.exec(key); 15094 key = key.replace(/\[\d*\]$/, ''); 15095 if (!result) { 15096 accumulator[key] = value; 15097 return; 15098 } 15099 if (accumulator[key] === undefined) { 15100 accumulator[key] = {}; 15101 } 15102 accumulator[key][result[1]] = value; 15103 }; 15104 case 'bracket': 15105 return function (key, value, accumulator) { 15106 result = /(\[\])$/.exec(key); 15107 key = key.replace(/\[\]$/, ''); 15108 if (!result) { 15109 accumulator[key] = value; 15110 return; 15111 } else if (accumulator[key] === undefined) { 15112 accumulator[key] = [value]; 15113 return; 15114 } 15115 accumulator[key] = [].concat(accumulator[key], value); 15116 }; 15117 default: 15118 return function (key, value, accumulator) { 15119 if (accumulator[key] === undefined) { 15120 accumulator[key] = value; 15121 return; 15122 } 15123 accumulator[key] = [].concat(accumulator[key], value); 15124 }; 15125 } 15126} 15127function encode(value, opts) { 15128 if (opts.encode) {
15129 return opts.strict ? strictUriEncode(value) : encodeURIComponent(value); 15130 } 15131 return value; 15132} 15133function keysSorter(input) { 15134 if (Array.isArray(input)) { 15135 return input.sort(); 15136 } else if (_typeof(input) === 'object') { 15137 return keysSorter(Object.keys(input)).sort(function (a, b) { 15138 return Number(a) - Number(b); 15139 }).map(function (key) { 15140 return input[key]; 15141 }); 15142 } 15143 return input; 15144} 15145function extract(str) { 15146 var queryStart = str.indexOf('?'); 15147 if (queryStart === -1) { 15148 return ''; 15149 } 15150 return str.slice(queryStart + 1); 15151} 15152function parse(str, opts) { 15153 opts = objectAssign({ 15154 arrayFormat: 'none' 15155 }, opts); 15156 var formatter = parserForArrayFormat(opts); 15157 15158 // Create an object with no prototype 15159 // https://github.com/sindresorhus/query-string/issues/47 15160 var ret = Object.create(null); 15161 if (typeof str !== 'string') { 15162 return ret; 15163 } 15164 str = str.trim().replace(/^[?#&]/, ''); 15165 if (!str) { 15166 return ret; 15167 } 15168 str.split('&').forEach(function (param) { 15169 var parts = param.replace(/\+/g, ' ').split('='); 15170 // Firefox (pre 40) decodes `%3D` to `=` 15171 // https://github.com/sindresorhus/query-string/pull/37 15172 var key = parts.shift(); 15173 var val = parts.length > 0 ? parts.join('=') : undefined; 15174 15175 // missing `=` should be `null`: 15176 // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters 15177 val = val === undefined ? null : decodeComponent(val); 15178 formatter(decodeComponent(key), val, ret); 15179 }); 15180 return Object.keys(ret).sort().reduce(function (result, key) { 15181 var val = ret[key]; 15182 if (Boolean(val) && _typeof(val) === 'object' && !Array.isArray(val)) { 15183 // Sort object keys, not values 15184 result[key] = keysSorter(val); 15185 } else { 15186 result[key] = val; 15187 } 15188 return result; 15189 }, Object.create(null)); 15190} 15191exports.extract = extract; 15192exports.parse = parse; 15193exports.stringify = function (obj, opts) { 15194 var defaults = { 15195 encode: true, 15196 strict: true, 15197 arrayFormat: 'none' 15198 }; 15199 opts = objectAssign(defaults, opts); 15200 if (opts.sort === false) { 15201 opts.sort = function () {}; 15202 } 15203 var formatter = encoderForArrayFormat(opts); 15204 return obj ? Object.keys(obj).sort(opts.sort).map(function (key) { 15205 var val = obj[key]; 15206 if (val === undefined) { 15207 return ''; 15208 } 15209 if (val === null) { 15210 return encode(key, opts); 15211 } 15212 if (Array.isArray(val)) { 15213 var result = []; 15214 val.slice().forEach(function (val2) { 15215 if (val2 === undefined) { 15216 return; 15217 } 15218 result.push(formatter(key, val2, result.length)); 15219 }); 15220 return result.join('&'); 15221 } 15222 return encode(key, opts) + '=' + encode(val, opts); 15223 }).filter(function (x) { 15224 return x.length > 0; 15225 }).join('&') : ''; 15226}; 15227exports.parseUrl = function (str, opts) { 15228 return { 15229 url: str.split('?')[0] || '', 15230 query: parse(extract(str), opts) 15231 }; 15232}; 15233 15234},{"decode-uri-component":8,"object-assign":32,"strict-uri-encode":36}],35:[function(require,module,exports){ 15235(function (global){(function (){ 15236; var __browserify_shim_require__=require;(function browserifyShim(module, define, require) { 15237function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 15238/* 15239 _ _ _ _ 15240 ___| (_) ___| | __ (_)___ 15241/ __| | |/ __| |/ / | / __| 15242\__ \ | | (__| < _ | \__ \ 15243|___/_|_|\___|_|\_(_)/ |___/ 15244 |__/ 15245 15246 Version: 1.8.1 15247 Author: Ken Wheeler 15248 Website: http://kenwheeler.github.io 15249 Docs: http://kenwheeler.github.io/slick 15250 Repo: http://github.com/kenwheeler/slick 15251 Issues: http://github.com/kenwheeler/slick/issues 15252 15253 */ 15254/* global window, document, define, jQuery, setInterval, clearInterval */ 15255; 15256(function (factory) { 15257 'use strict'; 15258 15259 if (typeof define === 'function' && define.amd) { 15260 define(['jquery'], factory); 15261 } else if (typeof exports !== 'undefined') { 15262 module.exports = factory((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 15263 } else { 15264 factory(jQuery); 15265 } 15266})(function ($) { 15267 'use strict'; 15268 15269 var Slick = window.Slick || {}; 15270 Slick = function () { 15271 var instanceUid = 0; 15272 function Slick(element, settings) { 15273 var _ = this, 15274 dataSettings; 15275 _.defaults = { 15276 accessibility: true, 15277 adaptiveHeight: false, 15278 appendArrows: $(element), 15279 appendDots: $(element), 15280 arrows: true, 15281 asNavFor: null, 15282 prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 15283 nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>', 15284 autoplay: false, 15285 autoplaySpeed: 3000, 15286 centerMode: false, 15287 centerPadding: '50px', 15288 cssEase: 'ease', 15289 customPaging: function customPaging(slider, i) { 15290 return $('<button type="button" />').text(i + 1); 15291 }, 15292 dots: false, 15293 dotsClass: 'slick-dots', 15294 draggable: true, 15295 easing: 'linear', 15296 edgeFriction: 0.35, 15297 fade: false, 15298 focusOnSelect: false, 15299 focusOnChange: false, 15300 infinite: true, 15301 initialSlide: 0, 15302 lazyLoad: 'ondemand', 15303 mobileFirst: false, 15304 pauseOnHover: true, 15305 pauseOnFocus: true, 15306 pauseOnDotsHover: false, 15307 respondTo: 'window', 15308 responsive: null, 15309 rows: 1, 15310 rtl: false, 15311 slide: '', 15312 slidesPerRow: 1, 15313 slidesToShow: 1, 15314 slidesToScroll: 1, 15315 speed: 500, 15316 swipe: true, 15317 swipeToSlide: false, 15318 touchMove: true, 15319 touchThreshold: 5, 15320 useCSS: true, 15321 useTransform: true, 15322 variableWidth: false, 15323 vertical: false, 15324 verticalSwiping: false, 15325 waitForAnimate: true, 15326 zIndex: 1000 15327 }; 15328 _.initials = { 15329 animating: false, 15330 dragging: false, 15331 autoPlayTimer: null, 15332 currentDirection: 0, 15333 currentLeft: null, 15334 currentSlide: 0, 15335 direction: 1, 15336 $dots: null, 15337 listWidth: null, 15338 listHeight: null, 15339 loadIndex: 0, 15340 $nextArrow: null, 15341 $prevArrow: null, 15342 scrolling: false, 15343 slideCount: null, 15344 slideWidth: null, 15345 $slideTrack: null, 15346 $slides: null, 15347 sliding: false, 15348 slideOffset: 0, 15349 swipeLeft: null, 15350 swiping: false, 15351 $list: null, 15352 touchObject: {}, 15353 transformsEnabled: false,
15354 unslicked: false 15355 }; 15356 $.extend(_, _.initials); 15357 _.activeBreakpoint = null; 15358 _.animType = null; 15359 _.animProp = null; 15360 _.breakpoints = []; 15361 _.breakpointSettings = []; 15362 _.cssTransitions = false; 15363 _.focussed = false; 15364 _.interrupted = false; 15365 _.hidden = 'hidden'; 15366 _.paused = true; 15367 _.positionProp = null; 15368 _.respondTo = null; 15369 _.rowCount = 1; 15370 _.shouldClick = true; 15371 _.$slider = $(element); 15372 _.$slidesCache = null; 15373 _.transformType = null; 15374 _.transitionType = null; 15375 _.visibilityChange = 'visibilitychange'; 15376 _.windowWidth = 0; 15377 _.windowTimer = null; 15378 dataSettings = $(element).data('slick') || {}; 15379 _.options = $.extend({}, _.defaults, settings, dataSettings); 15380 _.currentSlide = _.options.initialSlide; 15381 _.originalSettings = _.options; 15382 if (typeof document.mozHidden !== 'undefined') { 15383 _.hidden = 'mozHidden'; 15384 _.visibilityChange = 'mozvisibilitychange'; 15385 } else if (typeof document.webkitHidden !== 'undefined') { 15386 _.hidden = 'webkitHidden'; 15387 _.visibilityChange = 'webkitvisibilitychange'; 15388 } 15389 _.autoPlay = $.proxy(_.autoPlay, _); 15390 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 15391 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 15392 _.changeSlide = $.proxy(_.changeSlide, _); 15393 _.clickHandler = $.proxy(_.clickHandler, _); 15394 _.selectHandler = $.proxy(_.selectHandler, _); 15395 _.setPosition = $.proxy(_.setPosition, _); 15396 _.swipeHandler = $.proxy(_.swipeHandler, _); 15397 _.dragHandler = $.proxy(_.dragHandler, _); 15398 _.keyHandler = $.proxy(_.keyHandler, _); 15399 _.instanceUid = instanceUid++; 15400 15401 // A simple way to check for HTML strings 15402 // Strict HTML recognition (must start with <) 15403 // Extracted from jQuery v1.11 source 15404 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 15405 _.registerBreakpoints(); 15406 _.init(true); 15407 } 15408 return Slick; 15409 }(); 15410 Slick.prototype.activateADA = function () { 15411 var _ = this; 15412 _.$slideTrack.find('.slick-active').attr({ 15413 'aria-hidden': 'false' 15414 }).find('a, input, button, select').attr({ 15415 'tabindex': '0' 15416 }); 15417 }; 15418 Slick.prototype.addSlide = Slick.prototype.slickAdd = function (markup, index, addBefore) { 15419 var _ = this; 15420 if (typeof index === 'boolean') { 15421 addBefore = index; 15422 index = null; 15423 } else if (index < 0 || index >= _.slideCount) { 15424 return false; 15425 } 15426 _.unload(); 15427 if (typeof index === 'number') { 15428 if (index === 0 && _.$slides.length === 0) { 15429 $(markup).appendTo(_.$slideTrack); 15430 } else if (addBefore) { 15431 $(markup).insertBefore(_.$slides.eq(index)); 15432 } else { 15433 $(markup).insertAfter(_.$slides.eq(index)); 15434 } 15435 } else { 15436 if (addBefore === true) { 15437 $(markup).prependTo(_.$slideTrack); 15438 } else { 15439 $(markup).appendTo(_.$slideTrack); 15440 } 15441 } 15442 _.$slides = _.$slideTrack.children(this.options.slide); 15443 _.$slideTrack.children(this.options.slide).detach(); 15444 _.$slideTrack.append(_.$slides); 15445 _.$slides.each(function (index, element) { 15446 $(element).attr('data-slick-index', index); 15447 }); 15448 _.$slidesCache = _.$slides; 15449 _.reinit(); 15450 }; 15451 Slick.prototype.animateHeight = function () { 15452 var _ = this; 15453 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 15454 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 15455 _.$list.animate({ 15456 height: targetHeight 15457 }, _.options.speed); 15458 } 15459 }; 15460 Slick.prototype.animateSlide = function (targetLeft, callback) { 15461 var animProps = {}, 15462 _ = this; 15463 _.animateHeight(); 15464 if (_.options.rtl === true && _.options.vertical === false) { 15465 targetLeft = -targetLeft; 15466 } 15467 if (_.transformsEnabled === false) { 15468 if (_.options.vertical === false) { 15469 _.$slideTrack.animate({ 15470 left: targetLeft 15471 }, _.options.speed, _.options.easing, callback); 15472 } else { 15473 _.$slideTrack.animate({ 15474 top: targetLeft 15475 }, _.options.speed, _.options.easing, callback); 15476 } 15477 } else { 15478 if (_.cssTransitions === false) { 15479 if (_.options.rtl === true) { 15480 _.currentLeft = -_.currentLeft; 15481 } 15482 $({ 15483 animStart: _.currentLeft 15484 }).animate({ 15485 animStart: targetLeft 15486 }, { 15487 duration: _.options.speed, 15488 easing: _.options.easing, 15489 step: function step(now) { 15490 now = Math.ceil(now); 15491 if (_.options.vertical === false) { 15492 animProps[_.animType] = 'translate(' + now + 'px, 0px)'; 15493 _.$slideTrack.css(animProps); 15494 } else { 15495 animProps[_.animType] = 'translate(0px,' + now + 'px)'; 15496 _.$slideTrack.css(animProps); 15497 } 15498 }, 15499 complete: function complete() { 15500 if (callback) { 15501 callback.call(); 15502 } 15503 } 15504 }); 15505 } else { 15506 _.applyTransition();
15507 targetLeft = Math.ceil(targetLeft); 15508 if (_.options.vertical === false) { 15509 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 15510 } else { 15511 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 15512 } 15513 _.$slideTrack.css(animProps); 15514 if (callback) { 15515 setTimeout(function () { 15516 _.disableTransition(); 15517 callback.call(); 15518 }, _.options.speed); 15519 } 15520 } 15521 } 15522 }; 15523 Slick.prototype.getNavTarget = function () { 15524 var _ = this, 15525 asNavFor = _.options.asNavFor; 15526 if (asNavFor && asNavFor !== null) { 15527 asNavFor = $(asNavFor).not(_.$slider); 15528 } 15529 return asNavFor; 15530 }; 15531 Slick.prototype.asNavFor = function (index) { 15532 var _ = this, 15533 asNavFor = _.getNavTarget(); 15534 if (asNavFor !== null && _typeof(asNavFor) === 'object') { 15535 asNavFor.each(function () { 15536 var target = $(this).slick('getSlick'); 15537 if (!target.unslicked) { 15538 target.slideHandler(index, true); 15539 } 15540 }); 15541 } 15542 }; 15543 Slick.prototype.applyTransition = function (slide) { 15544 var _ = this, 15545 transition = {}; 15546 if (_.options.fade === false) { 15547 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 15548 } else { 15549 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 15550 } 15551 if (_.options.fade === false) { 15552 _.$slideTrack.css(transition); 15553 } else { 15554 _.$slides.eq(slide).css(transition); 15555 } 15556 }; 15557 Slick.prototype.autoPlay = function () { 15558 var _ = this; 15559 _.autoPlayClear(); 15560 if (_.slideCount > _.options.slidesToShow) { 15561 _.autoPlayTimer = setInterval(_.autoPlayIterator, _.options.autoplaySpeed); 15562 } 15563 }; 15564 Slick.prototype.autoPlayClear = function () { 15565 var _ = this; 15566 if (_.autoPlayTimer) { 15567 clearInterval(_.autoPlayTimer); 15568 } 15569 }; 15570 Slick.prototype.autoPlayIterator = function () { 15571 var _ = this, 15572 slideTo = _.currentSlide + _.options.slidesToScroll; 15573 if (!_.paused && !_.interrupted && !_.focussed) { 15574 if (_.options.infinite === false) { 15575 if (_.direction === 1 && _.currentSlide + 1 === _.slideCount - 1) { 15576 _.direction = 0; 15577 } else if (_.direction === 0) { 15578 slideTo = _.currentSlide - _.options.slidesToScroll; 15579 if (_.currentSlide - 1 === 0) { 15580 _.direction = 1; 15581 } 15582 } 15583 } 15584 _.slideHandler(slideTo); 15585 } 15586 }; 15587 Slick.prototype.buildArrows = function () { 15588 var _ = this; 15589 if (_.options.arrows === true) { 15590 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 15591 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 15592 if (_.slideCount > _.options.slidesToShow) { 15593 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 15594 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 15595 if (_.htmlExpr.test(_.options.prevArrow)) { 15596 _.$prevArrow.prependTo(_.options.appendArrows); 15597 } 15598 if (_.htmlExpr.test(_.options.nextArrow)) { 15599 _.$nextArrow.appendTo(_.options.appendArrows); 15600 } 15601 if (_.options.infinite !== true) { 15602 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 15603 } 15604 } else { 15605 _.$prevArrow.add(_.$nextArrow).addClass('slick-hidden').attr({ 15606 'aria-disabled': 'true', 15607 'tabindex': '-1' 15608 }); 15609 } 15610 } 15611 }; 15612 Slick.prototype.buildDots = function () { 15613 var _ = this, 15614 i, 15615 dot; 15616 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 15617 _.$slider.addClass('slick-dotted'); 15618 dot = $('<ul />').addClass(_.options.dotsClass); 15619 for (i = 0; i <= _.getDotCount(); i += 1) { 15620 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 15621 } 15622 _.$dots = dot.appendTo(_.options.appendDots); 15623 _.$dots.find('li').first().addClass('slick-active'); 15624 } 15625 }; 15626 Slick.prototype.buildOut = function () { 15627 var _ = this; 15628 _.$slides = _.$slider.children(_.options.slide + ':not(.slick-cloned)').addClass('slick-slide'); 15629 _.slideCount = _.$slides.length; 15630 _.$slides.each(function (index, element) { 15631 $(element).attr('data-slick-index', index).data('originalStyling', $(element).attr('style') || ''); 15632 }); 15633 _.$slider.addClass('slick-slider'); 15634 _.$slideTrack = _.slideCount === 0 ? $('<div class="slick-track"/>').appendTo(_.$slider) : _.$slides.wrapAll('<div class="slick-track"/>').parent(); 15635 _.$list = _.$slideTrack.wrap('<div class="slick-list"/>').parent(); 15636 _.$slideTrack.css('opacity', 0); 15637 if (_.options.centerMode === true || _.options.swipeToSlide === true) {
15638 _.options.slidesToScroll = 1; 15639 } 15640 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 15641 _.setupInfinite(); 15642 _.buildArrows(); 15643 _.buildDots(); 15644 _.updateDots(); 15645 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 15646 if (_.options.draggable === true) { 15647 _.$list.addClass('draggable'); 15648 } 15649 }; 15650 Slick.prototype.buildRows = function () { 15651 var _ = this, 15652 a, 15653 b, 15654 c, 15655 newSlides, 15656 numOfSlides, 15657 originalSlides, 15658 slidesPerSection; 15659 newSlides = document.createDocumentFragment(); 15660 originalSlides = _.$slider.children(); 15661 if (_.options.rows > 0) { 15662 slidesPerSection = _.options.slidesPerRow * _.options.rows; 15663 numOfSlides = Math.ceil(originalSlides.length / slidesPerSection); 15664 for (a = 0; a < numOfSlides; a++) { 15665 var slide = document.createElement('div'); 15666 for (b = 0; b < _.options.rows; b++) { 15667 var row = document.createElement('div'); 15668 for (c = 0; c < _.options.slidesPerRow; c++) { 15669 var target = a * slidesPerSection + (b * _.options.slidesPerRow + c); 15670 if (originalSlides.get(target)) { 15671 row.appendChild(originalSlides.get(target)); 15672 } 15673 } 15674 slide.appendChild(row); 15675 } 15676 newSlides.appendChild(slide); 15677 } 15678 _.$slider.empty().append(newSlides); 15679 _.$slider.children().children().children().css({ 15680 'width': 100 / _.options.slidesPerRow + '%', 15681 'display': 'inline-block' 15682 }); 15683 } 15684 }; 15685 Slick.prototype.checkResponsive = function (initial, forceUpdate) { 15686 var _ = this, 15687 breakpoint, 15688 targetBreakpoint, 15689 respondToWidth, 15690 triggerBreakpoint = false; 15691 var sliderWidth = _.$slider.width(); 15692 var windowWidth = window.innerWidth || $(window).width(); 15693 if (_.respondTo === 'window') { 15694 respondToWidth = windowWidth; 15695 } else if (_.respondTo === 'slider') { 15696 respondToWidth = sliderWidth; 15697 } else if (_.respondTo === 'min') { 15698 respondToWidth = Math.min(windowWidth, sliderWidth); 15699 } 15700 if (_.options.responsive && _.options.responsive.length && _.options.responsive !== null) { 15701 targetBreakpoint = null; 15702 for (breakpoint in _.breakpoints) { 15703 if (_.breakpoints.hasOwnProperty(breakpoint)) { 15704 if (_.originalSettings.mobileFirst === false) { 15705 if (respondToWidth < _.breakpoints[breakpoint]) { 15706 targetBreakpoint = _.breakpoints[breakpoint]; 15707 } 15708 } else { 15709 if (respondToWidth > _.breakpoints[breakpoint]) { 15710 targetBreakpoint = _.breakpoints[breakpoint]; 15711 } 15712 } 15713 } 15714 } 15715 if (targetBreakpoint !== null) { 15716 if (_.activeBreakpoint !== null) { 15717 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 15718 _.activeBreakpoint = targetBreakpoint; 15719 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 15720 _.unslick(targetBreakpoint); 15721 } else { 15722 _.options = $.extend({}, _.originalSettings, _.breakpointSettings[targetBreakpoint]); 15723 if (initial === true) { 15724 _.currentSlide = _.options.initialSlide; 15725 } 15726 _.refresh(initial); 15727 } 15728 triggerBreakpoint = targetBreakpoint; 15729 } 15730 } else { 15731 _.activeBreakpoint = targetBreakpoint; 15732 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 15733 _.unslick(targetBreakpoint); 15734 } else { 15735 _.options = $.extend({}, _.originalSettings, _.breakpointSettings[targetBreakpoint]); 15736 if (initial === true) { 15737 _.currentSlide = _.options.initialSlide; 15738 } 15739 _.refresh(initial); 15740 } 15741 triggerBreakpoint = targetBreakpoint; 15742 } 15743 } else { 15744 if (_.activeBreakpoint !== null) { 15745 _.activeBreakpoint = null; 15746 _.options = _.originalSettings; 15747 if (initial === true) { 15748 _.currentSlide = _.options.initialSlide; 15749 } 15750 _.refresh(initial);
15751 triggerBreakpoint = targetBreakpoint; 15752 } 15753 } 15754 15755 // only trigger breakpoints during an actual break. not on initialize. 15756 if (!initial && triggerBreakpoint !== false) { 15757 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 15758 } 15759 } 15760 }; 15761 Slick.prototype.changeSlide = function (event, dontAnimate) { 15762 var _ = this, 15763 $target = $(event.currentTarget), 15764 indexOffset, 15765 slideOffset, 15766 unevenOffset; 15767 15768 // If target is a link, prevent default action. 15769 if ($target.is('a')) { 15770 event.preventDefault(); 15771 } 15772 15773 // If target is not the <li> element (ie: a child), find the <li>. 15774 if (!$target.is('li')) { 15775 $target = $target.closest('li'); 15776 } 15777 unevenOffset = _.slideCount % _.options.slidesToScroll !== 0; 15778 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 15779 switch (event.data.message) { 15780 case 'previous': 15781 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 15782 if (_.slideCount > _.options.slidesToShow) { 15783 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 15784 } 15785 break; 15786 case 'next': 15787 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 15788 if (_.slideCount > _.options.slidesToShow) { 15789 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 15790 } 15791 break; 15792 case 'index': 15793 var index = event.data.index === 0 ? 0 : event.data.index || $target.index() * _.options.slidesToScroll; 15794 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 15795 $target.children().trigger('focus'); 15796 break; 15797 default: 15798 return; 15799 } 15800 }; 15801 Slick.prototype.checkNavigable = function (index) { 15802 var _ = this, 15803 navigables, 15804 prevNavigable; 15805 navigables = _.getNavigableIndexes(); 15806 prevNavigable = 0; 15807 if (index > navigables[navigables.length - 1]) { 15808 index = navigables[navigables.length - 1]; 15809 } else { 15810 for (var n in navigables) { 15811 if (index < navigables[n]) { 15812 index = prevNavigable; 15813 break; 15814 } 15815 prevNavigable = navigables[n]; 15816 } 15817 } 15818 return index; 15819 }; 15820 Slick.prototype.cleanUpEvents = function () { 15821 var _ = this; 15822 if (_.options.dots && _.$dots !== null) { 15823 $('li', _.$dots).off('click.slick', _.changeSlide).off('mouseenter.slick', $.proxy(_.interrupt, _, true)).off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 15824 if (_.options.accessibility === true) { 15825 _.$dots.off('keydown.slick', _.keyHandler); 15826 } 15827 } 15828 _.$slider.off('focus.slick blur.slick'); 15829 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 15830 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 15831 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 15832 if (_.options.accessibility === true) { 15833 _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler); 15834 _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler); 15835 } 15836 } 15837 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 15838 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 15839 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
15840 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 15841 _.$list.off('click.slick', _.clickHandler); 15842 $(document).off(_.visibilityChange, _.visibility); 15843 _.cleanUpSlideEvents(); 15844 if (_.options.accessibility === true) { 15845 _.$list.off('keydown.slick', _.keyHandler); 15846 } 15847 if (_.options.focusOnSelect === true) { 15848 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 15849 } 15850 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 15851 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 15852 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 15853 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 15854 }; 15855 Slick.prototype.cleanUpSlideEvents = function () { 15856 var _ = this; 15857 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 15858 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 15859 }; 15860 Slick.prototype.cleanUpRows = function () { 15861 var _ = this, 15862 originalSlides; 15863 if (_.options.rows > 0) { 15864 originalSlides = _.$slides.children().children(); 15865 originalSlides.removeAttr('style'); 15866 _.$slider.empty().append(originalSlides); 15867 } 15868 }; 15869 Slick.prototype.clickHandler = function (event) { 15870 var _ = this; 15871 if (_.shouldClick === false) { 15872 event.stopImmediatePropagation(); 15873 event.stopPropagation(); 15874 event.preventDefault(); 15875 } 15876 }; 15877 Slick.prototype.destroy = function (refresh) { 15878 var _ = this; 15879 _.autoPlayClear(); 15880 _.touchObject = {}; 15881 _.cleanUpEvents(); 15882 $('.slick-cloned', _.$slider).detach(); 15883 if (_.$dots) { 15884 _.$dots.remove(); 15885 } 15886 if (_.$prevArrow && _.$prevArrow.length) { 15887 _.$prevArrow.removeClass('slick-disabled slick-arrow slick-hidden').removeAttr('aria-hidden aria-disabled tabindex').css('display', ''); 15888 if (_.htmlExpr.test(_.options.prevArrow)) { 15889 _.$prevArrow.remove(); 15890 } 15891 } 15892 if (_.$nextArrow && _.$nextArrow.length) { 15893 _.$nextArrow.removeClass('slick-disabled slick-arrow slick-hidden').removeAttr('aria-hidden aria-disabled tabindex').css('display', ''); 15894 if (_.htmlExpr.test(_.options.nextArrow)) { 15895 _.$nextArrow.remove(); 15896 } 15897 } 15898 if (_.$slides) { 15899 _.$slides.removeClass('slick-slide slick-active slick-center slick-visible slick-current').removeAttr('aria-hidden').removeAttr('data-slick-index').each(function () { 15900 $(this).attr('style', $(this).data('originalStyling')); 15901 }); 15902 _.$slideTrack.children(this.options.slide).detach(); 15903 _.$slideTrack.detach(); 15904 _.$list.detach(); 15905 _.$slider.append(_.$slides); 15906 } 15907 _.cleanUpRows(); 15908 _.$slider.removeClass('slick-slider'); 15909 _.$slider.removeClass('slick-initialized'); 15910 _.$slider.removeClass('slick-dotted'); 15911 _.unslicked = true; 15912 if (!refresh) { 15913 _.$slider.trigger('destroy', [_]); 15914 } 15915 }; 15916 Slick.prototype.disableTransition = function (slide) { 15917 var _ = this, 15918 transition = {}; 15919 transition[_.transitionType] = ''; 15920 if (_.options.fade === false) { 15921 _.$slideTrack.css(transition); 15922 } else { 15923 _.$slides.eq(slide).css(transition); 15924 } 15925 }; 15926 Slick.prototype.fadeSlide = function (slideIndex, callback) { 15927 var _ = this; 15928 if (_.cssTransitions === false) { 15929 _.$slides.eq(slideIndex).css({ 15930 zIndex: _.options.zIndex 15931 }); 15932 _.$slides.eq(slideIndex).animate({ 15933 opacity: 1 15934 }, _.options.speed, _.options.easing, callback); 15935 } else { 15936 _.applyTransition(slideIndex); 15937 _.$slides.eq(slideIndex).css({ 15938 opacity: 1, 15939 zIndex: _.options.zIndex 15940 }); 15941 if (callback) { 15942 setTimeout(function () { 15943 _.disableTransition(slideIndex); 15944 callback.call(); 15945 }, _.options.speed); 15946 } 15947 } 15948 }; 15949 Slick.prototype.fadeSlideOut = function (slideIndex) { 15950 var _ = this; 15951 if (_.cssTransitions === false) { 15952 _.$slides.eq(slideIndex).animate({ 15953 opacity: 0, 15954 zIndex: _.options.zIndex - 2 15955 }, _.options.speed, _.options.easing); 15956 } else { 15957 _.applyTransition(slideIndex); 15958 _.$slides.eq(slideIndex).css({ 15959 opacity: 0, 15960 zIndex: _.options.zIndex - 2 15961 }); 15962 } 15963 };
15964 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function (filter) { 15965 var _ = this; 15966 if (filter !== null) { 15967 _.$slidesCache = _.$slides; 15968 _.unload(); 15969 _.$slideTrack.children(this.options.slide).detach(); 15970 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 15971 _.reinit(); 15972 } 15973 }; 15974 Slick.prototype.focusHandler = function () { 15975 var _ = this; 15976 _.$slider.off('focus.slick blur.slick').on('focus.slick blur.slick', '*', function (event) { 15977 event.stopImmediatePropagation(); 15978 var $sf = $(this); 15979 setTimeout(function () { 15980 if (_.options.pauseOnFocus) { 15981 _.focussed = $sf.is(':focus'); 15982 _.autoPlay(); 15983 } 15984 }, 0); 15985 }); 15986 }; 15987 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function () { 15988 var _ = this; 15989 return _.currentSlide; 15990 }; 15991 Slick.prototype.getDotCount = function () { 15992 var _ = this; 15993 var breakPoint = 0; 15994 var counter = 0; 15995 var pagerQty = 0; 15996 if (_.options.infinite === true) { 15997 if (_.slideCount <= _.options.slidesToShow) { 15998 ++pagerQty; 15999 } else { 16000 while (breakPoint < _.slideCount) { 16001 ++pagerQty; 16002 breakPoint = counter + _.options.slidesToScroll; 16003 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 16004 } 16005 } 16006 } else if (_.options.centerMode === true) { 16007 pagerQty = _.slideCount; 16008 } else if (!_.options.asNavFor) { 16009 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 16010 } else { 16011 while (breakPoint < _.slideCount) { 16012 ++pagerQty; 16013 breakPoint = counter + _.options.slidesToScroll; 16014 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 16015 } 16016 } 16017 return pagerQty - 1; 16018 }; 16019 Slick.prototype.getLeft = function (slideIndex) { 16020 var _ = this, 16021 targetLeft, 16022 verticalHeight, 16023 verticalOffset = 0, 16024 targetSlide, 16025 coef; 16026 _.slideOffset = 0; 16027 verticalHeight = _.$slides.first().outerHeight(true); 16028 if (_.options.infinite === true) { 16029 if (_.slideCount > _.options.slidesToShow) { 16030 _.slideOffset = _.slideWidth * _.options.slidesToShow * -1; 16031 coef = -1; 16032 if (_.options.vertical === true && _.options.centerMode === true) { 16033 if (_.options.slidesToShow === 2) { 16034 coef = -1.5; 16035 } else if (_.options.slidesToShow === 1) { 16036 coef = -2; 16037 } 16038 } 16039 verticalOffset = verticalHeight * _.options.slidesToShow * coef; 16040 } 16041 if (_.slideCount % _.options.slidesToScroll !== 0) { 16042 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 16043 if (slideIndex > _.slideCount) {
16044 _.slideOffset = (_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth * -1; 16045 verticalOffset = (_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight * -1; 16046 } else { 16047 _.slideOffset = _.slideCount % _.options.slidesToScroll * _.slideWidth * -1; 16048 verticalOffset = _.slideCount % _.options.slidesToScroll * verticalHeight * -1; 16049 } 16050 } 16051 } 16052 } else { 16053 if (slideIndex + _.options.slidesToShow > _.slideCount) { 16054 _.slideOffset = (slideIndex + _.options.slidesToShow - _.slideCount) * _.slideWidth; 16055 verticalOffset = (slideIndex + _.options.slidesToShow - _.slideCount) * verticalHeight; 16056 } 16057 } 16058 if (_.slideCount <= _.options.slidesToShow) { 16059 _.slideOffset = 0; 16060 verticalOffset = 0; 16061 } 16062 if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) { 16063 _.slideOffset = _.slideWidth * Math.floor(_.options.slidesToShow) / 2 - _.slideWidth * _.slideCount / 2; 16064 } else if (_.options.centerMode === true && _.options.infinite === true) { 16065 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 16066 } else if (_.options.centerMode === true) { 16067 _.slideOffset = 0; 16068 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 16069 } 16070 if (_.options.vertical === false) { 16071 targetLeft = slideIndex * _.slideWidth * -1 + _.slideOffset; 16072 } else { 16073 targetLeft = slideIndex * verticalHeight * -1 + verticalOffset; 16074 } 16075 if (_.options.variableWidth === true) {
16076 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 16077 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 16078 } else { 16079 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 16080 } 16081 if (_.options.rtl === true) { 16082 if (targetSlide[0]) { 16083 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 16084 } else { 16085 targetLeft = 0; 16086 } 16087 } else { 16088 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 16089 } 16090 if (_.options.centerMode === true) { 16091 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 16092 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 16093 } else { 16094 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 16095 } 16096 if (_.options.rtl === true) { 16097 if (targetSlide[0]) { 16098 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 16099 } else { 16100 targetLeft = 0; 16101 } 16102 } else { 16103 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 16104 } 16105 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 16106 } 16107 } 16108 return targetLeft; 16109 }; 16110 Slick.prototype.getOption = Slick.prototype.slickGetOption = function (option) { 16111 var _ = this; 16112 return _.options[option]; 16113 }; 16114 Slick.prototype.getNavigableIndexes = function () { 16115 var _ = this, 16116 breakPoint = 0, 16117 counter = 0, 16118 indexes = [], 16119 max; 16120 if (_.options.infinite === false) { 16121 max = _.slideCount; 16122 } else { 16123 breakPoint = _.options.slidesToScroll * -1; 16124 counter = _.options.slidesToScroll * -1; 16125 max = _.slideCount * 2; 16126 } 16127 while (breakPoint < max) { 16128 indexes.push(breakPoint); 16129 breakPoint = counter + _.options.slidesToScroll; 16130 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 16131 } 16132 return indexes; 16133 }; 16134 Slick.prototype.getSlick = function () { 16135 return this; 16136 }; 16137 Slick.prototype.getSlideCount = function () { 16138 var _ = this, 16139 slidesTraversed, 16140 swipedSlide, 16141 centerOffset; 16142 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 16143 if (_.options.swipeToSlide === true) { 16144 _.$slideTrack.find('.slick-slide').each(function (index, slide) { 16145 if (slide.offsetLeft - centerOffset + $(slide).outerWidth() / 2 > _.swipeLeft * -1) { 16146 swipedSlide = slide; 16147 return false; 16148 } 16149 }); 16150 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 16151 return slidesTraversed; 16152 } else { 16153 return _.options.slidesToScroll; 16154 } 16155 }; 16156 Slick.prototype.goTo = Slick.prototype.slickGoTo = function (slide, dontAnimate) { 16157 var _ = this; 16158 _.changeSlide({ 16159 data: { 16160 message: 'index', 16161 index: parseInt(slide) 16162 } 16163 }, dontAnimate); 16164 }; 16165 Slick.prototype.init = function (creation) { 16166 var _ = this; 16167 if (!$(_.$slider).hasClass('slick-initialized')) { 16168 $(_.$slider).addClass('slick-initialized'); 16169 _.buildRows(); 16170 _.buildOut(); 16171 _.setProps(); 16172 _.startLoad(); 16173 _.loadSlider(); 16174 _.initializeEvents(); 16175 _.updateArrows(); 16176 _.updateDots(); 16177 _.checkResponsive(true); 16178 _.focusHandler(); 16179 } 16180 if (creation) { 16181 _.$slider.trigger('init', [_]); 16182 } 16183 if (_.options.accessibility === true) { 16184 _.initADA(); 16185 } 16186 if (_.options.autoplay) { 16187 _.paused = false; 16188 _.autoPlay(); 16189 } 16190 }; 16191 Slick.prototype.initADA = function () { 16192 var _ = this, 16193 numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow), 16194 tabControlIndexes = _.getNavigableIndexes().filter(function (val) { 16195 return val >= 0 && val < _.slideCount; 16196 }); 16197 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 16198 'aria-hidden': 'true', 16199 'tabindex': '-1' 16200 }).find('a, input, button, select').attr({ 16201 'tabindex': '-1' 16202 }); 16203 if (_.$dots !== null) { 16204 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function (i) {
16205 var slideControlIndex = tabControlIndexes.indexOf(i); 16206 $(this).attr({ 16207 'role': 'tabpanel', 16208 'id': 'slick-slide' + _.instanceUid + i, 16209 'tabindex': -1 16210 }); 16211 if (slideControlIndex !== -1) { 16212 var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex; 16213 if ($('#' + ariaButtonControl).length) { 16214 $(this).attr({ 16215 'aria-describedby': ariaButtonControl 16216 }); 16217 } 16218 } 16219 }); 16220 _.$dots.attr('role', 'tablist').find('li').each(function (i) { 16221 var mappedSlideIndex = tabControlIndexes[i]; 16222 $(this).attr({ 16223 'role': 'presentation' 16224 }); 16225 $(this).find('button').first().attr({ 16226 'role': 'tab', 16227 'id': 'slick-slide-control' + _.instanceUid + i, 16228 'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex, 16229 'aria-label': i + 1 + ' of ' + numDotGroups, 16230 'aria-selected': null, 16231 'tabindex': '-1' 16232 }); 16233 }).eq(_.currentSlide).find('button').attr({ 16234 'aria-selected': 'true', 16235 'tabindex': '0' 16236 }).end(); 16237 } 16238 for (var i = _.currentSlide, max = i + _.options.slidesToShow; i < max; i++) { 16239 if (_.options.focusOnChange) { 16240 _.$slides.eq(i).attr({ 16241 'tabindex': '0' 16242 }); 16243 } else { 16244 _.$slides.eq(i).removeAttr('tabindex'); 16245 } 16246 } 16247 _.activateADA(); 16248 }; 16249 Slick.prototype.initArrowEvents = function () { 16250 var _ = this; 16251 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 16252 _.$prevArrow.off('click.slick').on('click.slick', { 16253 message: 'previous' 16254 }, _.changeSlide); 16255 _.$nextArrow.off('click.slick').on('click.slick', { 16256 message: 'next' 16257 }, _.changeSlide); 16258 if (_.options.accessibility === true) { 16259 _.$prevArrow.on('keydown.slick', _.keyHandler); 16260 _.$nextArrow.on('keydown.slick', _.keyHandler); 16261 } 16262 } 16263 }; 16264 Slick.prototype.initDotEvents = function () { 16265 var _ = this; 16266 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 16267 $('li', _.$dots).on('click.slick', { 16268 message: 'index' 16269 }, _.changeSlide); 16270 if (_.options.accessibility === true) { 16271 _.$dots.on('keydown.slick', _.keyHandler); 16272 } 16273 } 16274 if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.slideCount > _.options.slidesToShow) { 16275 $('li', _.$dots).on('mouseenter.slick', $.proxy(_.interrupt, _, true)).on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 16276 } 16277 }; 16278 Slick.prototype.initSlideEvents = function () { 16279 var _ = this; 16280 if (_.options.pauseOnHover) { 16281 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 16282 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 16283 } 16284 }; 16285 Slick.prototype.initializeEvents = function () { 16286 var _ = this; 16287 _.initArrowEvents(); 16288 _.initDotEvents(); 16289 _.initSlideEvents(); 16290 _.$list.on('touchstart.slick mousedown.slick', { 16291 action: 'start' 16292 }, _.swipeHandler); 16293 _.$list.on('touchmove.slick mousemove.slick', { 16294 action: 'move' 16295 }, _.swipeHandler); 16296 _.$list.on('touchend.slick mouseup.slick', { 16297 action: 'end' 16298 }, _.swipeHandler);
16299 _.$list.on('touchcancel.slick mouseleave.slick', { 16300 action: 'end' 16301 }, _.swipeHandler); 16302 _.$list.on('click.slick', _.clickHandler); 16303 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 16304 if (_.options.accessibility === true) { 16305 _.$list.on('keydown.slick', _.keyHandler); 16306 } 16307 if (_.options.focusOnSelect === true) { 16308 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 16309 } 16310 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 16311 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 16312 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 16313 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 16314 $(_.setPosition); 16315 }; 16316 Slick.prototype.initUI = function () { 16317 var _ = this; 16318 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 16319 _.$prevArrow.show(); 16320 _.$nextArrow.show(); 16321 } 16322 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 16323 _.$dots.show(); 16324 } 16325 }; 16326 Slick.prototype.keyHandler = function (event) { 16327 var _ = this; 16328 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 16329 if (!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 16330 if (event.keyCode === 37 && _.options.accessibility === true) { 16331 _.changeSlide({ 16332 data: { 16333 message: _.options.rtl === true ? 'next' : 'previous' 16334 } 16335 }); 16336 } else if (event.keyCode === 39 && _.options.accessibility === true) { 16337 _.changeSlide({ 16338 data: { 16339 message: _.options.rtl === true ? 'previous' : 'next' 16340 } 16341 }); 16342 } 16343 } 16344 }; 16345 Slick.prototype.lazyLoad = function () { 16346 var _ = this, 16347 loadRange, 16348 cloneRange, 16349 rangeStart, 16350 rangeEnd; 16351 function loadImages(imagesScope) { 16352 $('img[data-lazy]', imagesScope).each(function () { 16353 var image = $(this), 16354 imageSource = $(this).attr('data-lazy'), 16355 imageSrcSet = $(this).attr('data-srcset'), 16356 imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'), 16357 imageToLoad = document.createElement('img'); 16358 imageToLoad.onload = function () { 16359 image.animate({ 16360 opacity: 0 16361 }, 100, function () { 16362 if (imageSrcSet) { 16363 image.attr('srcset', imageSrcSet); 16364 if (imageSizes) { 16365 image.attr('sizes', imageSizes); 16366 } 16367 } 16368 image.attr('src', imageSource).animate({ 16369 opacity: 1 16370 }, 200, function () { 16371 image.removeAttr('data-lazy data-srcset data-sizes').removeClass('slick-loading'); 16372 }); 16373 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 16374 }); 16375 }; 16376 imageToLoad.onerror = function () { 16377 image.removeAttr('data-lazy').removeClass('slick-loading').addClass('slick-lazyload-error'); 16378 _.$slider.trigger('lazyLoadError', [_, image, imageSource]); 16379 }; 16380 imageToLoad.src = imageSource; 16381 }); 16382 } 16383 if (_.options.centerMode === true) { 16384 if (_.options.infinite === true) { 16385 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 16386 rangeEnd = rangeStart + _.options.slidesToShow + 2; 16387 } else { 16388 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 16389 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 16390 } 16391 } else { 16392 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 16393 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 16394 if (_.options.fade === true) { 16395 if (rangeStart > 0) rangeStart--; 16396 if (rangeEnd <= _.slideCount) rangeEnd++; 16397 } 16398 } 16399 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 16400 if (_.options.lazyLoad === 'anticipated') { 16401 var prevSlide = rangeStart - 1, 16402 nextSlide = rangeEnd, 16403 $slides = _.$slider.find('.slick-slide'); 16404 for (var i = 0; i < _.options.slidesToScroll; i++) { 16405 if (prevSlide < 0) prevSlide = _.slideCount - 1; 16406 loadRange = loadRange.add($slides.eq(prevSlide)); 16407 loadRange = loadRange.add($slides.eq(nextSlide)); 16408 prevSlide--; 16409 nextSlide++; 16410 } 16411 } 16412 loadImages(loadRange); 16413 if (_.slideCount <= _.options.slidesToShow) { 16414 cloneRange = _.$slider.find('.slick-slide'); 16415 loadImages(cloneRange); 16416 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 16417 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 16418 loadImages(cloneRange); 16419 } else if (_.currentSlide === 0) { 16420 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 16421 loadImages(cloneRange); 16422 } 16423 }; 16424 Slick.prototype.loadSlider = function () { 16425 var _ = this; 16426 _.setPosition(); 16427 _.$slideTrack.css({ 16428 opacity: 1 16429 }); 16430 _.$slider.removeClass('slick-loading'); 16431 _.initUI(); 16432 if (_.options.lazyLoad === 'progressive') { 16433 _.progressiveLazyLoad(); 16434 } 16435 }; 16436 Slick.prototype.next = Slick.prototype.slickNext = function () { 16437 var _ = this; 16438 _.changeSlide({ 16439 data: { 16440 message: 'next' 16441 } 16442 }); 16443 }; 16444 Slick.prototype.orientationChange = function () { 16445 var _ = this; 16446 _.checkResponsive(); 16447 _.setPosition(); 16448 }; 16449 Slick.prototype.pause = Slick.prototype.slickPause = function () { 16450 var _ = this; 16451 _.autoPlayClear(); 16452 _.paused = true; 16453 }; 16454 Slick.prototype.play = Slick.prototype.slickPlay = function () { 16455 var _ = this; 16456 _.autoPlay(); 16457 _.options.autoplay = true; 16458 _.paused = false;
16459 _.focussed = false; 16460 _.interrupted = false; 16461 }; 16462 Slick.prototype.postSlide = function (index) { 16463 var _ = this; 16464 if (!_.unslicked) { 16465 _.$slider.trigger('afterChange', [_, index]); 16466 _.animating = false; 16467 if (_.slideCount > _.options.slidesToShow) { 16468 _.setPosition(); 16469 } 16470 _.swipeLeft = null; 16471 if (_.options.autoplay) { 16472 _.autoPlay(); 16473 } 16474 if (_.options.accessibility === true) { 16475 _.initADA(); 16476 if (_.options.focusOnChange) { 16477 var $currentSlide = $(_.$slides.get(_.currentSlide)); 16478 $currentSlide.attr('tabindex', 0).focus(); 16479 } 16480 } 16481 } 16482 }; 16483 Slick.prototype.prev = Slick.prototype.slickPrev = function () { 16484 var _ = this; 16485 _.changeSlide({ 16486 data: { 16487 message: 'previous' 16488 } 16489 }); 16490 }; 16491 Slick.prototype.preventDefault = function (event) { 16492 event.preventDefault(); 16493 }; 16494 Slick.prototype.progressiveLazyLoad = function (tryCount) { 16495 tryCount = tryCount || 1; 16496 var _ = this, 16497 $imgsToLoad = $('img[data-lazy]', _.$slider), 16498 image, 16499 imageSource, 16500 imageSrcSet, 16501 imageSizes, 16502 imageToLoad; 16503 if ($imgsToLoad.length) { 16504 image = $imgsToLoad.first(); 16505 imageSource = image.attr('data-lazy'); 16506 imageSrcSet = image.attr('data-srcset'); 16507 imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes'); 16508 imageToLoad = document.createElement('img'); 16509 imageToLoad.onload = function () { 16510 if (imageSrcSet) { 16511 image.attr('srcset', imageSrcSet); 16512 if (imageSizes) { 16513 image.attr('sizes', imageSizes); 16514 } 16515 } 16516 image.attr('src', imageSource).removeAttr('data-lazy data-srcset data-sizes').removeClass('slick-loading'); 16517 if (_.options.adaptiveHeight === true) { 16518 _.setPosition(); 16519 } 16520 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 16521 _.progressiveLazyLoad(); 16522 }; 16523 imageToLoad.onerror = function () { 16524 if (tryCount < 3) { 16525 /** 16526 * try to load the image 3 times, 16527 * leave a slight delay so we don't get 16528 * servers blocking the request. 16529 */ 16530 setTimeout(function () { 16531 _.progressiveLazyLoad(tryCount + 1); 16532 }, 500); 16533 } else { 16534 image.removeAttr('data-lazy').removeClass('slick-loading').addClass('slick-lazyload-error'); 16535 _.$slider.trigger('lazyLoadError', [_, image, imageSource]); 16536 _.progressiveLazyLoad(); 16537 } 16538 }; 16539 imageToLoad.src = imageSource; 16540 } else { 16541 _.$slider.trigger('allImagesLoaded', [_]); 16542 } 16543 }; 16544 Slick.prototype.refresh = function (initializing) { 16545 var _ = this, 16546 currentSlide, 16547 lastVisibleIndex; 16548 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 16549 16550 // in non-infinite sliders, we don't want to go past the 16551 // last visible index. 16552 if (!_.options.infinite && _.currentSlide > lastVisibleIndex) { 16553 _.currentSlide = lastVisibleIndex; 16554 } 16555 16556 // if less slides than to show, go to start. 16557 if (_.slideCount <= _.options.slidesToShow) { 16558 _.currentSlide = 0; 16559 } 16560 currentSlide = _.currentSlide; 16561 _.destroy(true); 16562 $.extend(_, _.initials, { 16563 currentSlide: currentSlide 16564 }); 16565 _.init(); 16566 if (!initializing) { 16567 _.changeSlide({ 16568 data: { 16569 message: 'index', 16570 index: currentSlide 16571 } 16572 }, false); 16573 } 16574 }; 16575 Slick.prototype.registerBreakpoints = function () { 16576 var _ = this, 16577 breakpoint, 16578 currentBreakpoint, 16579 l, 16580 responsiveSettings = _.options.responsive || null; 16581 if ($.type(responsiveSettings) === 'array' && responsiveSettings.length) { 16582 _.respondTo = _.options.respondTo || 'window'; 16583 for (breakpoint in responsiveSettings) { 16584 l = _.breakpoints.length - 1; 16585 if (responsiveSettings.hasOwnProperty(breakpoint)) { 16586 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 16587 16588 // loop through the breakpoints and cut out any existing 16589 // ones with the same breakpoint number, we don't want dupes. 16590 while (l >= 0) { 16591 if (_.breakpoints[l] && _.breakpoints[l] === currentBreakpoint) { 16592 _.breakpoints.splice(l, 1); 16593 } 16594 l--; 16595 } 16596 _.breakpoints.push(currentBreakpoint); 16597 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 16598 } 16599 } 16600 _.breakpoints.sort(function (a, b) { 16601 return _.options.mobileFirst ? a - b : b - a; 16602 }); 16603 } 16604 }; 16605 Slick.prototype.reinit = function () { 16606 var _ = this; 16607 _.$slides = _.$slideTrack.children(_.options.slide).addClass('slick-slide'); 16608 _.slideCount = _.$slides.length; 16609 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 16610 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 16611 } 16612 if (_.slideCount <= _.options.slidesToShow) { 16613 _.currentSlide = 0; 16614 } 16615 _.registerBreakpoints(); 16616 _.setProps(); 16617 _.setupInfinite(); 16618 _.buildArrows(); 16619 _.updateArrows(); 16620 _.initArrowEvents(); 16621 _.buildDots(); 16622 _.updateDots(); 16623 _.initDotEvents(); 16624 _.cleanUpSlideEvents(); 16625 _.initSlideEvents(); 16626 _.checkResponsive(false, true); 16627 if (_.options.focusOnSelect === true) { 16628 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 16629 } 16630 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 16631 _.setPosition(); 16632 _.focusHandler(); 16633 _.paused = !_.options.autoplay; 16634 _.autoPlay(); 16635 _.$slider.trigger('reInit', [_]); 16636 }; 16637 Slick.prototype.resize = function () { 16638 var _ = this; 16639 if ($(window).width() !== _.windowWidth) { 16640 clearTimeout(_.windowDelay); 16641 _.windowDelay = window.setTimeout(function () { 16642 _.windowWidth = $(window).width(); 16643 _.checkResponsive(); 16644 if (!_.unslicked) { 16645 _.setPosition(); 16646 } 16647 }, 50); 16648 } 16649 }; 16650 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function (index, removeBefore, removeAll) { 16651 var _ = this; 16652 if (typeof index === 'boolean') { 16653 removeBefore = index; 16654 index = removeBefore === true ? 0 : _.slideCount - 1; 16655 } else { 16656 index = removeBefore === true ? --index : index; 16657 } 16658 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 16659 return false;
16660 } 16661 _.unload(); 16662 if (removeAll === true) { 16663 _.$slideTrack.children().remove(); 16664 } else { 16665 _.$slideTrack.children(this.options.slide).eq(index).remove(); 16666 } 16667 _.$slides = _.$slideTrack.children(this.options.slide); 16668 _.$slideTrack.children(this.options.slide).detach(); 16669 _.$slideTrack.append(_.$slides); 16670 _.$slidesCache = _.$slides; 16671 _.reinit(); 16672 }; 16673 Slick.prototype.setCSS = function (position) { 16674 var _ = this, 16675 positionProps = {}, 16676 x, 16677 y; 16678 if (_.options.rtl === true) { 16679 position = -position; 16680 } 16681 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 16682 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 16683 positionProps[_.positionProp] = position; 16684 if (_.transformsEnabled === false) { 16685 _.$slideTrack.css(positionProps); 16686 } else { 16687 positionProps = {}; 16688 if (_.cssTransitions === false) { 16689 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 16690 _.$slideTrack.css(positionProps); 16691 } else { 16692 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 16693 _.$slideTrack.css(positionProps); 16694 } 16695 } 16696 }; 16697 Slick.prototype.setDimensions = function () { 16698 var _ = this; 16699 if (_.options.vertical === false) { 16700 if (_.options.centerMode === true) { 16701 _.$list.css({ 16702 padding: '0px ' + _.options.centerPadding 16703 }); 16704 } 16705 } else { 16706 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 16707 if (_.options.centerMode === true) { 16708 _.$list.css({ 16709 padding: _.options.centerPadding + ' 0px' 16710 }); 16711 } 16712 } 16713 _.listWidth = _.$list.width(); 16714 _.listHeight = _.$list.height(); 16715 if (_.options.vertical === false && _.options.variableWidth === false) { 16716 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 16717 _.$slideTrack.width(Math.ceil(_.slideWidth * _.$slideTrack.children('.slick-slide').length)); 16718 } else if (_.options.variableWidth === true) { 16719 _.$slideTrack.width(5000 * _.slideCount); 16720 } else { 16721 _.slideWidth = Math.ceil(_.listWidth); 16722 _.$slideTrack.height(Math.ceil(_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)); 16723 } 16724 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 16725 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 16726 }; 16727 Slick.prototype.setFade = function () { 16728 var _ = this, 16729 targetLeft; 16730 _.$slides.each(function (index, element) { 16731 targetLeft = _.slideWidth * index * -1; 16732 if (_.options.rtl === true) { 16733 $(element).css({ 16734 position: 'relative', 16735 right: targetLeft, 16736 top: 0, 16737 zIndex: _.options.zIndex - 2, 16738 opacity: 0 16739 }); 16740 } else { 16741 $(element).css({ 16742 position: 'relative', 16743 left: targetLeft, 16744 top: 0, 16745 zIndex: _.options.zIndex - 2, 16746 opacity: 0 16747 }); 16748 } 16749 }); 16750 _.$slides.eq(_.currentSlide).css({ 16751 zIndex: _.options.zIndex - 1, 16752 opacity: 1 16753 }); 16754 }; 16755 Slick.prototype.setHeight = function () { 16756 var _ = this; 16757 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 16758 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 16759 _.$list.css('height', targetHeight); 16760 } 16761 }; 16762 Slick.prototype.setOption = Slick.prototype.slickSetOption = function () { 16763 /** 16764 * accepts arguments in format of: 16765 * 16766 * - for changing a single option's value: 16767 * .slick("setOption", option, value, refresh ) 16768 * 16769 * - for changing a set of responsive options: 16770 * .slick("setOption", 'responsive', [{}, ...], refresh ) 16771 * 16772 * - for updating multiple values at once (not responsive) 16773 * .slick("setOption", { 'option': value, ... }, refresh ) 16774 */ 16775 16776 var _ = this, 16777 l, 16778 item, 16779 option, 16780 value, 16781 refresh = false, 16782 type; 16783 if ($.type(arguments[0]) === 'object') { 16784 option = arguments[0]; 16785 refresh = arguments[1]; 16786 type = 'multiple'; 16787 } else if ($.type(arguments[0]) === 'string') { 16788 option = arguments[0]; 16789 value = arguments[1]; 16790 refresh = arguments[2]; 16791 if (arguments[0] === 'responsive' && $.type(arguments[1]) === 'array') { 16792 type = 'responsive'; 16793 } else if (typeof arguments[1] !== 'undefined') { 16794 type = 'single'; 16795 } 16796 } 16797 if (type === 'single') {
16798 _.options[option] = value; 16799 } else if (type === 'multiple') { 16800 $.each(option, function (opt, val) { 16801 _.options[opt] = val; 16802 }); 16803 } else if (type === 'responsive') { 16804 for (item in value) { 16805 if ($.type(_.options.responsive) !== 'array') { 16806 _.options.responsive = [value[item]]; 16807 } else { 16808 l = _.options.responsive.length - 1; 16809 16810 // loop through the responsive object and splice out duplicates. 16811 while (l >= 0) { 16812 if (_.options.responsive[l].breakpoint === value[item].breakpoint) { 16813 _.options.responsive.splice(l, 1); 16814 } 16815 l--; 16816 } 16817 _.options.responsive.push(value[item]); 16818 } 16819 } 16820 } 16821 if (refresh) { 16822 _.unload(); 16823 _.reinit(); 16824 } 16825 }; 16826 Slick.prototype.setPosition = function () { 16827 var _ = this; 16828 _.setDimensions(); 16829 _.setHeight(); 16830 if (_.options.fade === false) { 16831 _.setCSS(_.getLeft(_.currentSlide)); 16832 } else { 16833 _.setFade(); 16834 } 16835 _.$slider.trigger('setPosition', [_]); 16836 }; 16837 Slick.prototype.setProps = function () { 16838 var _ = this, 16839 bodyStyle = document.body.style; 16840 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 16841 if (_.positionProp === 'top') { 16842 _.$slider.addClass('slick-vertical'); 16843 } else { 16844 _.$slider.removeClass('slick-vertical'); 16845 } 16846 if (bodyStyle.WebkitTransition !== undefined || bodyStyle.MozTransition !== undefined || bodyStyle.msTransition !== undefined) { 16847 if (_.options.useCSS === true) { 16848 _.cssTransitions = true; 16849 } 16850 } 16851 if (_.options.fade) { 16852 if (typeof _.options.zIndex === 'number') { 16853 if (_.options.zIndex < 3) { 16854 _.options.zIndex = 3; 16855 } 16856 } else { 16857 _.options.zIndex = _.defaults.zIndex; 16858 } 16859 } 16860 if (bodyStyle.OTransform !== undefined) { 16861 _.animType = 'OTransform'; 16862 _.transformType = '-o-transform'; 16863 _.transitionType = 'OTransition'; 16864 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
16865 } 16866 if (bodyStyle.MozTransform !== undefined) { 16867 _.animType = 'MozTransform'; 16868 _.transformType = '-moz-transform'; 16869 _.transitionType = 'MozTransition'; 16870 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 16871 } 16872 if (bodyStyle.webkitTransform !== undefined) { 16873 _.animType = 'webkitTransform'; 16874 _.transformType = '-webkit-transform'; 16875 _.transitionType = 'webkitTransition'; 16876 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 16877 } 16878 if (bodyStyle.msTransform !== undefined) { 16879 _.animType = 'msTransform'; 16880 _.transformType = '-ms-transform'; 16881 _.transitionType = 'msTransition'; 16882 if (bodyStyle.msTransform === undefined) _.animType = false; 16883 } 16884 if (bodyStyle.transform !== undefined && _.animType !== false) { 16885 _.animType = 'transform'; 16886 _.transformType = 'transform'; 16887 _.transitionType = 'transition'; 16888 } 16889 _.transformsEnabled = _.options.useTransform && _.animType !== null && _.animType !== false; 16890 }; 16891 Slick.prototype.setSlideClasses = function (index) { 16892 var _ = this, 16893 centerOffset, 16894 allSlides, 16895 indexOffset, 16896 remainder; 16897 allSlides = _.$slider.find('.slick-slide').removeClass('slick-active slick-center slick-current').attr('aria-hidden', 'true'); 16898 _.$slides.eq(index).addClass('slick-current'); 16899 if (_.options.centerMode === true) { 16900 var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0; 16901 centerOffset = Math.floor(_.options.slidesToShow / 2); 16902 if (_.options.infinite === true) { 16903 if (index >= centerOffset && index <= _.slideCount - 1 - centerOffset) { 16904 _.$slides.slice(index - centerOffset + evenCoef, index + centerOffset + 1).addClass('slick-active').attr('aria-hidden', 'false'); 16905 } else { 16906 indexOffset = _.options.slidesToShow + index; 16907 allSlides.slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2).addClass('slick-active').attr('aria-hidden', 'false'); 16908 } 16909 if (index === 0) { 16910 allSlides.eq(allSlides.length - 1 - _.options.slidesToShow).addClass('slick-center'); 16911 } else if (index === _.slideCount - 1) { 16912 allSlides.eq(_.options.slidesToShow).addClass('slick-center'); 16913 } 16914 } 16915 _.$slides.eq(index).addClass('slick-center'); 16916 } else { 16917 if (index >= 0 && index <= _.slideCount - _.options.slidesToShow) { 16918 _.$slides.slice(index, index + _.options.slidesToShow).addClass('slick-active').attr('aria-hidden', 'false'); 16919 } else if (allSlides.length <= _.options.slidesToShow) { 16920 allSlides.addClass('slick-active').attr('aria-hidden', 'false'); 16921 } else { 16922 remainder = _.slideCount % _.options.slidesToShow; 16923 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 16924 if (_.options.slidesToShow == _.options.slidesToScroll && _.slideCount - index < _.options.slidesToShow) { 16925 allSlides.slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder).addClass('slick-active').attr('aria-hidden', 'false'); 16926 } else { 16927 allSlides.slice(indexOffset, indexOffset + _.options.slidesToShow).addClass('slick-active').attr('aria-hidden', 'false'); 16928 } 16929 } 16930 } 16931 if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') { 16932 _.lazyLoad(); 16933 } 16934 }; 16935 Slick.prototype.setupInfinite = function () { 16936 var _ = this, 16937 i, 16938 slideIndex, 16939 infiniteCount; 16940 if (_.options.fade === true) { 16941 _.options.centerMode = false; 16942 } 16943 if (_.options.infinite === true && _.options.fade === false) { 16944 slideIndex = null; 16945 if (_.slideCount > _.options.slidesToShow) { 16946 if (_.options.centerMode === true) { 16947 infiniteCount = _.options.slidesToShow + 1; 16948 } else { 16949 infiniteCount = _.options.slidesToShow; 16950 } 16951 for (i = _.slideCount; i > _.slideCount - infiniteCount; i -= 1) { 16952 slideIndex = i - 1; 16953 $(_.$slides[slideIndex]).clone(true).attr('id', '').attr('data-slick-index', slideIndex - _.slideCount).prependTo(_.$slideTrack).addClass('slick-cloned'); 16954 } 16955 for (i = 0; i < infiniteCount + _.slideCount; i += 1) { 16956 slideIndex = i; 16957 $(_.$slides[slideIndex]).clone(true).attr('id', '').attr('data-slick-index', slideIndex + _.slideCount).appendTo(_.$slideTrack).addClass('slick-cloned'); 16958 } 16959 _.$slideTrack.find('.slick-cloned').find('[id]').each(function () { 16960 $(this).attr('id', ''); 16961 }); 16962 } 16963 } 16964 }; 16965 Slick.prototype.interrupt = function (toggle) { 16966 var _ = this; 16967 if (!toggle) { 16968 _.autoPlay(); 16969 } 16970 _.interrupted = toggle; 16971 }; 16972 Slick.prototype.selectHandler = function (event) { 16973 var _ = this; 16974 var targetElement = $(event.target).is('.slick-slide') ? $(event.target) : $(event.target).parents('.slick-slide'); 16975 var index = parseInt(targetElement.attr('data-slick-index')); 16976 if (!index) index = 0; 16977 if (_.slideCount <= _.options.slidesToShow) { 16978 _.slideHandler(index, false, true); 16979 return; 16980 } 16981 _.slideHandler(index); 16982 }; 16983 Slick.prototype.slideHandler = function (index, sync, dontAnimate) { 16984 var targetSlide, 16985 animSlide, 16986 oldSlide, 16987 slideLeft, 16988 targetLeft = null, 16989 _ = this, 16990 navTarget; 16991 sync = sync || false; 16992 if (_.animating === true && _.options.waitForAnimate === true) { 16993 return; 16994 } 16995 if (_.options.fade === true && _.currentSlide === index) { 16996 return; 16997 } 16998 if (sync === false) { 16999 _.asNavFor(index); 17000 } 17001 targetSlide = index; 17002 targetLeft = _.getLeft(targetSlide); 17003 slideLeft = _.getLeft(_.currentSlide); 17004 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 17005 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 17006 if (_.options.fade === false) { 17007 targetSlide = _.currentSlide; 17008 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 17009 _.animateSlide(slideLeft, function () { 17010 _.postSlide(targetSlide); 17011 }); 17012 } else { 17013 _.postSlide(targetSlide); 17014 } 17015 } 17016 return; 17017 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > _.slideCount - _.options.slidesToScroll)) { 17018 if (_.options.fade === false) { 17019 targetSlide = _.currentSlide; 17020 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 17021 _.animateSlide(slideLeft, function () { 17022 _.postSlide(targetSlide); 17023 }); 17024 } else { 17025 _.postSlide(targetSlide); 17026 } 17027 } 17028 return; 17029 } 17030 if (_.options.autoplay) { 17031 clearInterval(_.autoPlayTimer); 17032 }
17033 if (targetSlide < 0) { 17034 if (_.slideCount % _.options.slidesToScroll !== 0) { 17035 animSlide = _.slideCount - _.slideCount % _.options.slidesToScroll; 17036 } else { 17037 animSlide = _.slideCount + targetSlide; 17038 } 17039 } else if (targetSlide >= _.slideCount) { 17040 if (_.slideCount % _.options.slidesToScroll !== 0) { 17041 animSlide = 0; 17042 } else { 17043 animSlide = targetSlide - _.slideCount; 17044 } 17045 } else { 17046 animSlide = targetSlide; 17047 } 17048 _.animating = true; 17049 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 17050 oldSlide = _.currentSlide; 17051 _.currentSlide = animSlide; 17052 _.setSlideClasses(_.currentSlide); 17053 if (_.options.asNavFor) { 17054 navTarget = _.getNavTarget(); 17055 navTarget = navTarget.slick('getSlick'); 17056 if (navTarget.slideCount <= navTarget.options.slidesToShow) { 17057 navTarget.setSlideClasses(_.currentSlide); 17058 } 17059 } 17060 _.updateDots(); 17061 _.updateArrows(); 17062 if (_.options.fade === true) { 17063 if (dontAnimate !== true) { 17064 _.fadeSlideOut(oldSlide); 17065 _.fadeSlide(animSlide, function () { 17066 _.postSlide(animSlide); 17067 }); 17068 } else { 17069 _.postSlide(animSlide); 17070 } 17071 _.animateHeight(); 17072 return; 17073 } 17074 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 17075 _.animateSlide(targetLeft, function () { 17076 _.postSlide(animSlide); 17077 }); 17078 } else { 17079 _.postSlide(animSlide); 17080 } 17081 }; 17082 Slick.prototype.startLoad = function () { 17083 var _ = this; 17084 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 17085 _.$prevArrow.hide(); 17086 _.$nextArrow.hide(); 17087 } 17088 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 17089 _.$dots.hide(); 17090 } 17091 _.$slider.addClass('slick-loading'); 17092 }; 17093 Slick.prototype.swipeDirection = function () { 17094 var xDist, 17095 yDist, 17096 r, 17097 swipeAngle, 17098 _ = this; 17099 xDist = _.touchObject.startX - _.touchObject.curX; 17100 yDist = _.touchObject.startY - _.touchObject.curY; 17101 r = Math.atan2(yDist, xDist); 17102 swipeAngle = Math.round(r * 180 / Math.PI); 17103 if (swipeAngle < 0) { 17104 swipeAngle = 360 - Math.abs(swipeAngle); 17105 } 17106 if (swipeAngle <= 45 && swipeAngle >= 0) { 17107 return _.options.rtl === false ? 'left' : 'right'; 17108 } 17109 if (swipeAngle <= 360 && swipeAngle >= 315) { 17110 return _.options.rtl === false ? 'left' : 'right'; 17111 } 17112 if (swipeAngle >= 135 && swipeAngle <= 225) { 17113 return _.options.rtl === false ? 'right' : 'left'; 17114 } 17115 if (_.options.verticalSwiping === true) { 17116 if (swipeAngle >= 35 && swipeAngle <= 135) { 17117 return 'down'; 17118 } else { 17119 return 'up'; 17120 } 17121 } 17122 return 'vertical'; 17123 }; 17124 Slick.prototype.swipeEnd = function (event) { 17125 var _ = this, 17126 slideCount, 17127 direction; 17128 _.dragging = false; 17129 _.swiping = false; 17130 if (_.scrolling) { 17131 _.scrolling = false; 17132 return false; 17133 } 17134 _.interrupted = false; 17135 _.shouldClick = _.touchObject.swipeLength > 10 ? false : true; 17136 if (_.touchObject.curX === undefined) { 17137 return false; 17138 } 17139 if (_.touchObject.edgeHit === true) { 17140 _.$slider.trigger('edge', [_, _.swipeDirection()]); 17141 } 17142 if (_.touchObject.swipeLength >= _.touchObject.minSwipe) { 17143 direction = _.swipeDirection(); 17144 switch (direction) { 17145 case 'left': 17146 case 'down': 17147 slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide + _.getSlideCount()) : _.currentSlide + _.getSlideCount(); 17148 _.currentDirection = 0; 17149 break; 17150 case 'right': 17151 case 'up': 17152 slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide - _.getSlideCount()) : _.currentSlide - _.getSlideCount(); 17153 _.currentDirection = 1; 17154 break; 17155 default: 17156 } 17157 if (direction != 'vertical') { 17158 _.slideHandler(slideCount); 17159 _.touchObject = {}; 17160 _.$slider.trigger('swipe', [_, direction]); 17161 } 17162 } else { 17163 if (_.touchObject.startX !== _.touchObject.curX) { 17164 _.slideHandler(_.currentSlide); 17165 _.touchObject = {}; 17166 } 17167 } 17168 }; 17169 Slick.prototype.swipeHandler = function (event) { 17170 var _ = this; 17171 if (_.options.swipe === false || 'ontouchend' in document && _.options.swipe === false) { 17172 return; 17173 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 17174 return; 17175 } 17176 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? event.originalEvent.touches.length : 1; 17177 _.touchObject.minSwipe = _.listWidth / _.options.touchThreshold; 17178 if (_.options.verticalSwiping === true) { 17179 _.touchObject.minSwipe = _.listHeight / _.options.touchThreshold; 17180 } 17181 switch (event.data.action) { 17182 case 'start': 17183 _.swipeStart(event); 17184 break; 17185 case 'move': 17186 _.swipeMove(event); 17187 break; 17188 case 'end': 17189 _.swipeEnd(event); 17190 break; 17191 } 17192 }; 17193 Slick.prototype.swipeMove = function (event) { 17194 var _ = this, 17195 edgeWasHit = false, 17196 curLeft, 17197 swipeDirection, 17198 swipeLength, 17199 positionOffset, 17200 touches, 17201 verticalSwipeLength; 17202 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 17203 if (!_.dragging || _.scrolling || touches && touches.length !== 1) { 17204 return false;
17205 } 17206 curLeft = _.getLeft(_.currentSlide); 17207 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 17208 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 17209 _.touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 17210 verticalSwipeLength = Math.round(Math.sqrt(Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 17211 if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { 17212 _.scrolling = true; 17213 return false; 17214 } 17215 if (_.options.verticalSwiping === true) { 17216 _.touchObject.swipeLength = verticalSwipeLength; 17217 } 17218 swipeDirection = _.swipeDirection(); 17219 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 17220 _.swiping = true; 17221 event.preventDefault(); 17222 } 17223 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 17224 if (_.options.verticalSwiping === true) { 17225 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 17226 } 17227 swipeLength = _.touchObject.swipeLength; 17228 _.touchObject.edgeHit = false; 17229 if (_.options.infinite === false) { 17230 if (_.currentSlide === 0 && swipeDirection === 'right' || _.currentSlide >= _.getDotCount() && swipeDirection === 'left') { 17231 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 17232 _.touchObject.edgeHit = true; 17233 } 17234 } 17235 if (_.options.vertical === false) { 17236 _.swipeLeft = curLeft + swipeLength * positionOffset; 17237 } else { 17238 _.swipeLeft = curLeft + swipeLength * (_.$list.height() / _.listWidth) * positionOffset; 17239 } 17240 if (_.options.verticalSwiping === true) { 17241 _.swipeLeft = curLeft + swipeLength * positionOffset; 17242 } 17243 if (_.options.fade === true || _.options.touchMove === false) { 17244 return false; 17245 } 17246 if (_.animating === true) { 17247 _.swipeLeft = null; 17248 return false; 17249 } 17250 _.setCSS(_.swipeLeft); 17251 }; 17252 Slick.prototype.swipeStart = function (event) { 17253 var _ = this, 17254 touches; 17255 _.interrupted = true; 17256 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 17257 _.touchObject = {}; 17258 return false; 17259 } 17260 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 17261 touches = event.originalEvent.touches[0]; 17262 } 17263 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 17264 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 17265 _.dragging = true; 17266 }; 17267 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function () { 17268 var _ = this; 17269 if (_.$slidesCache !== null) { 17270 _.unload(); 17271 _.$slideTrack.children(this.options.slide).detach(); 17272 _.$slidesCache.appendTo(_.$slideTrack); 17273 _.reinit(); 17274 } 17275 }; 17276 Slick.prototype.unload = function () { 17277 var _ = this; 17278 $('.slick-cloned', _.$slider).remove(); 17279 if (_.$dots) { 17280 _.$dots.remove(); 17281 } 17282 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 17283 _.$prevArrow.remove(); 17284 } 17285 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 17286 _.$nextArrow.remove(); 17287 } 17288 _.$slides.removeClass('slick-slide slick-active slick-visible slick-current').attr('aria-hidden', 'true').css('width', ''); 17289 }; 17290 Slick.prototype.unslick = function (fromBreakpoint) { 17291 var _ = this; 17292 _.$slider.trigger('unslick', [_, fromBreakpoint]); 17293 _.destroy(); 17294 }; 17295 Slick.prototype.updateArrows = function () { 17296 var _ = this, 17297 centerOffset; 17298 centerOffset = Math.floor(_.options.slidesToShow / 2); 17299 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow && !_.options.infinite) { 17300 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 17301 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 17302 if (_.currentSlide === 0) { 17303 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 17304 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 17305 } else if (_.currentSlide >
17305= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 17306 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 17307 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 17308 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 17309 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 17310 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 17311 } 17312 } 17313 }; 17314 Slick.prototype.updateDots = function () { 17315 var _ = this; 17316 if (_.$dots !== null) { 17317 _.$dots.find('li').removeClass('slick-active').end(); 17318 _.$dots.find('li').eq(Math.floor(_.currentSlide / _.options.slidesToScroll)).addClass('slick-active'); 17319 } 17320 }; 17321 Slick.prototype.visibility = function () { 17322 var _ = this; 17323 if (_.options.autoplay) { 17324 if (document[_.hidden]) { 17325 _.interrupted = true; 17326 } else { 17327 _.interrupted = false; 17328 } 17329 } 17330 }; 17331 $.fn.slick = function () { 17332 var _ = this, 17333 opt = arguments[0], 17334 args = Array.prototype.slice.call(arguments, 1), 17335 l = _.length, 17336 i, 17337 ret; 17338 for (i = 0; i < l; i++) { 17339 if (_typeof(opt) == 'object' || typeof opt == 'undefined') _[i].slick = new Slick(_[i], opt);else ret = _[i].slick[opt].apply(_[i].slick, args); 17340 if (typeof ret != 'undefined') return ret; 17341 } 17342 return _; 17343 }; 17344}); 17345 17346}).call(global, module, undefined, undefined); 17347 17348}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 17349},{}],36:[function(require,module,exports){ 17350'use strict'; 17351 17352module.exports = function (str) { 17353 return encodeURIComponent(str).replace(/[!'()*]/g, function (c) { 17354 return '%' + c.charCodeAt(0).toString(16).toUpperCase(); 17355 }); 17356}; 17357 17358},{}],37:[function(require,module,exports){ 17359"use strict"; 17360 17361Object.defineProperty(exports, "__esModule", { 17362 value: true 17363}); 17364exports["default"] = A11y; 17365var _ssrWindowEsm = require("../shared/ssr-window.esm.mjs"); 17366var _classesToSelector = require("../shared/classes-to-selector.mjs"); 17367var _utils = require("../shared/utils.mjs"); 17368function A11y(_ref) { 17369 var swiper = _ref.swiper, 17370 extendParams = _ref.extendParams, 17371 on = _ref.on; 17372 extendParams({ 17373 a11y: { 17374 enabled: true, 17375 notificationClass: 'swiper-notification', 17376 prevSlideMessage: 'Previous slide', 17377 nextSlideMessage: 'Next slide', 17378 firstSlideMessage: 'This is the first slide', 17379 lastSlideMessage: 'This is the last slide', 17380 paginationBulletMessage: 'Go to slide {{index}}', 17381 slideLabelMessage: '{{index}} / {{slidesLength}}', 17382 containerMessage: null, 17383 containerRoleDescriptionMessage: null, 17384 containerRole: null, 17385 itemRoleDescriptionMessage: null, 17386 slideRole: 'group', 17387 id: null, 17388 scrollOnFocus: true, 17389 wrapperLiveRegion: true 17390 } 17391 }); 17392 swiper.a11y = { 17393 clicked: false 17394 }; 17395 var liveRegion = null; 17396 var preventFocusHandler; 17397 var focusTargetSlideEl; 17398 var visibilityChangedTimestamp = new Date().getTime(); 17399 function notify(message) { 17400 var notification = liveRegion; 17401 if (notification.length === 0) return; 17402 (0, _utils.s)(notification, message); 17403 } 17404 function getRandomNumber() { 17405 var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 16; 17406 var randomChar = function randomChar() { 17407 return Math.round(16 * Math.random()).toString(16); 17408 }; 17409 return 'x'.repeat(size).replace(/x/g, randomChar); 17410 } 17411 function makeElFocusable(el) { 17412 el = (0, _utils.m)(el); 17413 el.forEach(function (subEl) { 17414 subEl.setAttribute('tabIndex', '0'); 17415 }); 17416 } 17417 function makeElNotFocusable(el) { 17418 el = (0, _utils.m)(el); 17419 el.forEach(function (subEl) { 17420 subEl.setAttribute('tabIndex', '-1'); 17421 }); 17422 } 17423 function addElRole(el, role) { 17424 el = (0, _utils.m)(el); 17425 el.forEach(function (subEl) { 17426 subEl.setAttribute('role', role); 17427 }); 17428 } 17429 function addElRoleDescription(el, description) { 17430 el = (0, _utils.m)(el); 17431 el.forEach(function (subEl) { 17432 subEl.setAttribute('aria-roledescription', description); 17433 }); 17434 } 17435 function addElLabel(el, label) { 17436 el = (0, _utils.m)(el); 17437 el.forEach(function (subEl) { 17438 subEl.setAttribute('aria-label', label); 17439 }); 17440 } 17441 function addElId(el, id) { 17442 el = (0, _utils.m)(el); 17443 el.forEach(function (subEl) { 17444 subEl.setAttribute('id', id); 17445 }); 17446 } 17447 function addElLive(el, live) { 17448 el = (0, _utils.m)(el); 17449 el.forEach(function (subEl) { 17450 subEl.setAttribute('aria-live', live); 17451 }); 17452 } 17453 function disableEl(el) { 17454 el = (0, _utils.m)(el); 17455 el.forEach(function (subEl) { 17456 subEl.setAttribute('aria-disabled', true); 17457 }); 17458 } 17459 function enableEl(el) { 17460 el = (0, _utils.m)(el); 17461 el.forEach(function (subEl) { 17462 subEl.removeAttribute('aria-disabled'); 17463 }); 17464 } 17465 function onEnterOrSpaceKey(e) { 17466 if (e.keyCode !== 13 && e.keyCode !== 32) return; 17467 var params = swiper.params.a11y; 17468 var targetEl = e.target; 17469 if (swiper.pagination && swiper.pagination.el && (targetEl === swiper.pagination.el || swiper.pagination.el.contains(e.target))) { 17470 if (!e.target.matches((0, _classesToSelector.c)(swiper.params.pagination.bulletClass))) return; 17471 } 17472 if (swiper.navigation && swiper.navigation.prevEl && swiper.navigation.nextEl) { 17473 var prevEls = (0, _utils.m)(swiper.navigation.prevEl); 17474 var nextEls = (0, _utils.m)(swiper.navigation.nextEl); 17475 if (nextEls.includes(targetEl)) { 17476 if (!(swiper.isEnd && !swiper.params.loop)) { 17477 swiper.slideNext(); 17478 } 17479 if (swiper.isEnd) { 17480 notify(params.lastSlideMessage); 17481 } else { 17482 notify(params.nextSlideMessage); 17483 } 17484 } 17485 if (prevEls.includes(targetEl)) { 17486 if (!(swiper.isBeginning && !swiper.params.loop)) { 17487 swiper.slidePrev(); 17488 } 17489 if (swiper.isBeginning) { 17490 notify(params.firstSlideMessage); 17491 } else { 17492 notify(params.prevSlideMessage); 17493 } 17494 } 17495 } 17496 if (swiper.pagination && targetEl.matches((0, _classesToSelector.c)(swiper.params.pagination.bulletClass))) { 17497 targetEl.click(); 17498 } 17499 } 17500 function updateNavigation() { 17501 if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return; 17502 var _swiper$navigation = swiper.navigation, 17503 nextEl = _swiper$navigation.nextEl, 17504 prevEl = _swiper$navigation.prevEl; 17505 if (prevEl) { 17506 if (swiper.isBeginning) { 17507 disableEl(prevEl); 17508 makeElNotFocusable(prevEl); 17509 } else { 17510 enableEl(prevEl); 17511 makeElFocusable(prevEl); 17512 } 17513 } 17514 if (nextEl) { 17515 if (swiper.isEnd) { 17516 disableEl(nextEl); 17517 makeElNotFocusable(nextEl); 17518 } else { 17519 enableEl(nextEl); 17520 makeElFocusable(nextEl); 17521 } 17522 } 17523 } 17524 function hasPagination() { 17525 return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length; 17526 } 17527 function hasClickablePagination() { 17528 return hasPagination() && swiper.params.pagination.clickable; 17529 } 17530 function updatePagination() { 17531 var params = swiper.params.a11y; 17532 if (!hasPagination()) return;
17533 swiper.pagination.bullets.forEach(function (bulletEl) { 17534 if (swiper.params.pagination.clickable) { 17535 makeElFocusable(bulletEl); 17536 if (!swiper.params.pagination.renderBullet) { 17537 addElRole(bulletEl, 'button'); 17538 addElLabel(bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, (0, _utils.j)(bulletEl) + 1)); 17539 } 17540 } 17541 if (bulletEl.matches((0, _classesToSelector.c)(swiper.params.pagination.bulletActiveClass))) { 17542 bulletEl.setAttribute('aria-current', 'true'); 17543 } else { 17544 bulletEl.removeAttribute('aria-current'); 17545 } 17546 }); 17547 } 17548 var initNavEl = function initNavEl(el, wrapperId, message) { 17549 makeElFocusable(el); 17550 if (el.tagName !== 'BUTTON') { 17551 addElRole(el, 'button'); 17552 el.addEventListener('keydown', onEnterOrSpaceKey); 17553 } 17554 addElLabel(el, message); 17555 }; 17556 var handlePointerDown = function handlePointerDown(e) { 17557 if (focusTargetSlideEl && focusTargetSlideEl !== e.target && !focusTargetSlideEl.contains(e.target)) { 17558 preventFocusHandler = true; 17559 } 17560 swiper.a11y.clicked = true; 17561 }; 17562 var handlePointerUp = function handlePointerUp() { 17563 preventFocusHandler = false; 17564 requestAnimationFrame(function () { 17565 requestAnimationFrame(function () { 17566 if (!swiper.destroyed) { 17567 swiper.a11y.clicked = false; 17568 } 17569 }); 17570 }); 17571 }; 17572 var onVisibilityChange = function onVisibilityChange(e) { 17573 visibilityChangedTimestamp = new Date().getTime(); 17574 }; 17575 var handleFocus = function handleFocus(e) { 17576 if (swiper.a11y.clicked || !swiper.params.a11y.scrollOnFocus) return; 17577 if (new Date().getTime() - visibilityChangedTimestamp < 100) return; 17578 var slideEl = e.target.closest(".".concat(swiper.params.slideClass, ", swiper-slide")); 17579 if (!slideEl || !swiper.slides.includes(slideEl)) return; 17580 focusTargetSlideEl = slideEl; 17581 var isVirtual = swiper.virtual && swiper.params.virtual.enabled; 17582 var isActive = (isVirtual ? parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10) : swiper.slides.indexOf(slideEl)) === swiper.activeIndex; 17583 var isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl); 17584 if (isActive || isVisible) return; 17585 if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return; 17586 if (swiper.isHorizontal()) { 17587 swiper.el.scrollLeft = 0; 17588 } else { 17589 swiper.el.scrollTop = 0; 17590 } 17591 requestAnimationFrame(function () { 17592 if (preventFocusHandler) return; 17593 if (swiper.params.loop) { 17594 swiper.slideToLoop(swiper.getSlideIndexWhenGrid(parseInt(slideEl.getAttribute('data-swiper-slide-index'))), 0); 17595 } else if (isVirtual) { 17596 swiper.slideTo(swiper.getSlideIndexWhenGrid(parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10)), 0); 17597 } else { 17598 swiper.slideTo(swiper.getSlideIndexWhenGrid(swiper.slides.indexOf(slideEl)), 0); 17599 } 17600 preventFocusHandler = false; 17601 }); 17602 }; 17603 var initSlides = function initSlides() { 17604 var params = swiper.params.a11y; 17605 if (params.itemRoleDescriptionMessage) { 17606 addElRoleDescription(swiper.slides, params.itemRoleDescriptionMessage); 17607 } 17608 if (params.slideRole) { 17609 addElRole(swiper.slides, params.slideRole); 17610 } 17611 var slidesLength = swiper.slides.length; 17612 if (params.slideLabelMessage) { 17613 swiper.slides.forEach(function (slideEl, index) { 17614 var slideIndex = swiper.params.loop ? parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10) : index; 17615 var ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength); 17616 addElLabel(slideEl, ariaLabelMessage); 17617 }); 17618 } 17619 }; 17620 var init = function init() { 17621 var params = swiper.params.a11y; 17622 swiper.el.append(liveRegion); 17623 17624 // Container 17625 var containerEl = swiper.el; 17626 if (params.containerRoleDescriptionMessage) { 17627 addElRoleDescription(containerEl, params.containerRoleDescriptionMessage); 17628 } 17629 if (params.containerMessage) { 17630 addElLabel(containerEl, params.containerMessage); 17631 } 17632 if (params.containerRole) { 17633 addElRole(containerEl, params.containerRole); 17634 } 17635 17636 // Wrapper 17637 var wrapperEl = swiper.wrapperEl; 17638 var wrapperId = params.id || wrapperEl.getAttribute('id') || "swiper-wrapper-".concat(getRandomNumber(16)); 17639 addElId(wrapperEl, wrapperId); 17640 if (params.wrapperLiveRegion) { 17641 var live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite'; 17642 addElLive(wrapperEl, live); 17643 } 17644 17645 // Slide 17646 initSlides(); 17647 17648 // Navigation 17649 var _ref2 = swiper.navigation ? swiper.navigation : {}, 17650 nextEl = _ref2.nextEl, 17651 prevEl = _ref2.prevEl; 17652 nextEl = (0, _utils.m)(nextEl); 17653 prevEl = (0, _utils.m)(prevEl); 17654 if (nextEl) { 17655 nextEl.forEach(function (el) { 17656 return initNavEl(el, wrapperId, params.nextSlideMessage); 17657 }); 17658 } 17659 if (prevEl) { 17660 prevEl.forEach(function (el) { 17661 return initNavEl(el, wrapperId, params.prevSlideMessage); 17662 }); 17663 } 17664 17665 // Pagination 17666 if (hasClickablePagination()) { 17667 var paginationEl = (0, _utils.m)(swiper.pagination.el); 17668 paginationEl.forEach(function (el) { 17669 el.addEventListener('keydown', onEnterOrSpaceKey); 17670 }); 17671 } 17672 17673 // Tab focus 17674 var document = (0, _ssrWindowEsm.g)(); 17675 document.addEventListener('visibilitychange', onVisibilityChange); 17676 swiper.el.addEventListener('focus', handleFocus, true); 17677 swiper.el.addEventListener('pointerdown', handlePointerDown, true); 17678 swiper.el.addEventListener('pointerup', handlePointerUp, true); 17679 }; 17680 function destroy() { 17681 if (liveRegion) liveRegion.remove(); 17682 var _ref3 = swiper.navigation ? swiper.navigation : {}, 17683 nextEl = _ref3.nextEl, 17684 prevEl = _ref3.prevEl; 17685 nextEl = (0, _utils.m)(nextEl); 17686 prevEl = (0, _utils.m)(prevEl); 17687 if (nextEl) { 17688 nextEl.forEach(function (el) { 17689 return el.removeEventListener('keydown', onEnterOrSpaceKey); 17690 }); 17691 } 17692 if (prevEl) { 17693 prevEl.forEach(function (el) { 17694 return el.removeEventListener('keydown', onEnterOrSpaceKey); 17695 }); 17696 } 17697 17698 // Pagination 17699 if (hasClickablePagination()) { 17700 var paginationEl = (0, _utils.m)(swiper.pagination.el); 17701 paginationEl.forEach(function (el) { 17702 el.removeEventListener('keydown', onEnterOrSpaceKey); 17703 }); 17704 } 17705 var document = (0, _ssrWindowEsm.g)(); 17706 document.removeEventListener('visibilitychange', onVisibilityChange); 17707 // Tab focus 17708 if (swiper.el && typeof swiper.el !== 'string') { 17709 swiper.el.removeEventListener('focus', handleFocus, true); 17710 swiper.el.removeEventListener('pointerdown', handlePointerDown, true); 17711 swiper.el.removeEventListener('pointerup', handlePointerUp, true); 17712 } 17713 } 17714 on('beforeInit', function () { 17715 liveRegion = (0, _utils.c)('span', swiper.params.a11y.notificationClass); 17716 liveRegion.setAttribute('aria-live', 'assertive'); 17717 liveRegion.setAttribute('aria-atomic', 'true'); 17718 }); 17719 on('afterInit', function () { 17720 if (!swiper.params.a11y.enabled) return; 17721 init(); 17722 }); 17723 on('slidesLengthChange snapGridLengthChange slidesGridLengthChange', function () { 17724 if (!swiper.params.a11y.enabled) return; 17725 initSlides(); 17726 }); 17727 on('fromEdge toEdge afterInit lock unlock', function () { 17728 if (!swiper.params.a11y.enabled) return; 17729 updateNavigation(); 17730 }); 17731 on('paginationUpdate', function () { 17732 if (!swiper.params.a11y.enabled) return; 17733 updatePagination(); 17734 }); 17735 on('destroy', function () { 17736 if (!swiper.params.a11y.enabled) return; 17737 destroy(); 17738 }); 17739} 17740 17741},{"../shared/classes-to-selector.mjs":61,"../shared/ssr-window.esm.mjs":67,"../shared/utils.mjs":69}],38:[function(require,module,exports){ 17742"use strict"; 17743 17744Object.defineProperty(exports, "__esModule", { 17745 value: true 17746}); 17747exports["default"] = Autoplay; 17748var _ssrWindowEsm = require("../shared/ssr-window.esm.mjs"); 17749function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 17750/* eslint no-underscore-dangle: "off" */
17751/* eslint no-use-before-define: "off" */ 17752function Autoplay(_ref) { 17753 var swiper = _ref.swiper, 17754 extendParams = _ref.extendParams, 17755 on = _ref.on, 17756 emit = _ref.emit, 17757 params = _ref.params; 17758 swiper.autoplay = { 17759 running: false, 17760 paused: false, 17761 timeLeft: 0 17762 }; 17763 extendParams({ 17764 autoplay: { 17765 enabled: false, 17766 delay: 3000, 17767 waitForTransition: true, 17768 disableOnInteraction: false, 17769 stopOnLastSlide: false, 17770 reverseDirection: false, 17771 pauseOnMouseEnter: false 17772 } 17773 }); 17774 var timeout; 17775 var raf; 17776 var autoplayDelayTotal = params && params.autoplay ? params.autoplay.delay : 3000; 17777 var autoplayDelayCurrent = params && params.autoplay ? params.autoplay.delay : 3000; 17778 var autoplayTimeLeft; 17779 var autoplayStartTime = new Date().getTime(); 17780 var wasPaused; 17781 var isTouched; 17782 var pausedByTouch; 17783 var touchStartTimeout; 17784 var pausedByInteraction; 17785 var pausedByPointerEnter; 17786 function onTransitionEnd(e) { 17787 if (!swiper || swiper.destroyed || !swiper.wrapperEl) return; 17788 if (e.target !== swiper.wrapperEl) return; 17789 swiper.wrapperEl.removeEventListener('transitionend', onTransitionEnd); 17790 if (pausedByPointerEnter || e.detail && e.detail.bySwiperTouchMove) { 17791 return; 17792 } 17793 resume(); 17794 } 17795 var _calcTimeLeft = function calcTimeLeft() { 17796 if (swiper.destroyed || !swiper.autoplay.running) return; 17797 if (swiper.autoplay.paused) { 17798 wasPaused = true; 17799 } else if (wasPaused) { 17800 autoplayDelayCurrent = autoplayTimeLeft; 17801 wasPaused = false; 17802 } 17803 var timeLeft = swiper.autoplay.paused ? autoplayTimeLeft : autoplayStartTime + autoplayDelayCurrent - new Date().getTime(); 17804 swiper.autoplay.timeLeft = timeLeft; 17805 emit('autoplayTimeLeft', timeLeft, timeLeft / autoplayDelayTotal); 17806 raf = requestAnimationFrame(function () { 17807 _calcTimeLeft(); 17808 }); 17809 }; 17810 var getSlideDelay = function getSlideDelay() { 17811 var activeSlideEl; 17812 if (swiper.virtual && swiper.params.virtual.enabled) { 17813 activeSlideEl = swiper.slides.find(function (slideEl) { 17814 return slideEl.classList.contains('swiper-slide-active'); 17815 }); 17816 } else { 17817 activeSlideEl = swiper.slides[swiper.activeIndex]; 17818 } 17819 if (!activeSlideEl) return undefined; 17820 var currentSlideDelay = parseInt(activeSlideEl.getAttribute('data-swiper-autoplay'), 10); 17821 return currentSlideDelay; 17822 }; 17823 var getTotalDelay = function getTotalDelay() { 17824 var totalDelay = swiper.params.autoplay.delay; 17825 var currentSlideDelay = getSlideDelay(); 17826 if (!Number.isNaN(currentSlideDelay) && currentSlideDelay > 0) { 17827 totalDelay = currentSlideDelay; 17828 } 17829 return totalDelay; 17830 }; 17831 var _run = function run(delayForce) { 17832 if (swiper.destroyed || !swiper.autoplay.running) return; 17833 cancelAnimationFrame(raf); 17834 _calcTimeLeft(); 17835 var delay = delayForce; 17836 if (typeof delay === 'undefined') { 17837 delay = getTotalDelay(); 17838 autoplayDelayTotal = delay; 17839 autoplayDelayCurrent = delay; 17840 } 17841 autoplayTimeLeft = delay; 17842 var speed = swiper.params.speed; 17843 var proceed = function proceed() { 17844 if (!swiper || swiper.destroyed) return; 17845 if (swiper.params.autoplay.reverseDirection) { 17846 if (!swiper.isBeginning || swiper.params.loop || swiper.params.rewind) { 17847 swiper.slidePrev(speed, true, true); 17848 emit('autoplay'); 17849 } else if (!swiper.params.autoplay.stopOnLastSlide) { 17850 swiper.slideTo(swiper.slides.length - 1, speed, true, true); 17851 emit('autoplay'); 17852 } 17853 } else { 17854 if (!swiper.isEnd || swiper.params.loop || swiper.params.rewind) { 17855 swiper.slideNext(speed, true, true); 17856 emit('autoplay'); 17857 } else if (!swiper.params.autoplay.stopOnLastSlide) { 17858 swiper.slideTo(0, speed, true, true); 17859 emit('autoplay'); 17860 } 17861 } 17862 if (swiper.params.cssMode) { 17863 autoplayStartTime = new Date().getTime(); 17864 requestAnimationFrame(function () { 17865 _run(); 17866 }); 17867 } 17868 }; 17869 if (delay > 0) { 17870 clearTimeout(timeout); 17871 timeout = setTimeout(function () { 17872 proceed(); 17873 }, delay); 17874 } else { 17875 requestAnimationFrame(function () { 17876 proceed(); 17877 }); 17878 } 17879 17880 // eslint-disable-next-line 17881 return delay; 17882 }; 17883 var start = function start() { 17884 autoplayStartTime = new Date().getTime(); 17885 swiper.autoplay.running = true; 17886 _run(); 17887 emit('autoplayStart'); 17888 }; 17889 var stop = function stop() { 17890 swiper.autoplay.running = false;
17891 clearTimeout(timeout); 17892 cancelAnimationFrame(raf); 17893 emit('autoplayStop'); 17894 }; 17895 var pause = function pause(internal, reset) { 17896 if (swiper.destroyed || !swiper.autoplay.running) return; 17897 clearTimeout(timeout); 17898 if (!internal) { 17899 pausedByInteraction = true; 17900 } 17901 var proceed = function proceed() { 17902 emit('autoplayPause'); 17903 if (swiper.params.autoplay.waitForTransition) { 17904 swiper.wrapperEl.addEventListener('transitionend', onTransitionEnd); 17905 } else { 17906 resume(); 17907 } 17908 }; 17909 swiper.autoplay.paused = true; 17910 if (reset) { 17911 proceed(); 17912 return; 17913 } 17914 var delay = autoplayTimeLeft || swiper.params.autoplay.delay; 17915 autoplayTimeLeft = delay - (new Date().getTime() - autoplayStartTime); 17916 if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop) return; 17917 if (autoplayTimeLeft < 0) autoplayTimeLeft = 0; 17918 proceed(); 17919 }; 17920 var resume = function resume() { 17921 if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop || swiper.destroyed || !swiper.autoplay.running) return; 17922 autoplayStartTime = new Date().getTime(); 17923 if (pausedByInteraction) { 17924 pausedByInteraction = false; 17925 _run(autoplayTimeLeft); 17926 } else { 17927 _run(); 17928 } 17929 swiper.autoplay.paused = false; 17930 emit('autoplayResume'); 17931 }; 17932 var onVisibilityChange = function onVisibilityChange() { 17933 if (swiper.destroyed || !swiper.autoplay.running) return; 17934 var document = (0, _ssrWindowEsm.g)(); 17935 if (document.visibilityState === 'hidden') { 17936 pausedByInteraction = true; 17937 pause(true); 17938 } 17939 if (document.visibilityState === 'visible') { 17940 resume(); 17941 } 17942 }; 17943 var onPointerEnter = function onPointerEnter(e) { 17944 if (e.pointerType !== 'mouse') return; 17945 pausedByInteraction = true; 17946 pausedByPointerEnter = true; 17947 if (swiper.animating || swiper.autoplay.paused) return; 17948 pause(true); 17949 }; 17950 var onPointerLeave = function onPointerLeave(e) { 17951 if (e.pointerType !== 'mouse') return; 17952 pausedByPointerEnter = false; 17953 if (swiper.autoplay.paused) { 17954 resume(); 17955 } 17956 }; 17957 var attachMouseEvents = function attachMouseEvents() { 17958 if (swiper.params.autoplay.pauseOnMouseEnter) { 17959 swiper.el.addEventListener('pointerenter', onPointerEnter); 17960 swiper.el.addEventListener('pointerleave', onPointerLeave); 17961 } 17962 }; 17963 var detachMouseEvents = function detachMouseEvents() { 17964 if (swiper.el && typeof swiper.el !== 'string') { 17965 swiper.el.removeEventListener('pointerenter', onPointerEnter); 17966 swiper.el.removeEventListener('pointerleave', onPointerLeave); 17967 } 17968 }; 17969 var attachDocumentEvents = function attachDocumentEvents() { 17970 var document = (0, _ssrWindowEsm.g)(); 17971 document.addEventListener('visibilitychange', onVisibilityChange); 17972 }; 17973 var detachDocumentEvents = function detachDocumentEvents() { 17974 var document = (0, _ssrWindowEsm.g)(); 17975 document.removeEventListener('visibilitychange', onVisibilityChange); 17976 }; 17977 on('init', function () { 17978 if (swiper.params.autoplay.enabled) { 17979 attachMouseEvents(); 17980 attachDocumentEvents(); 17981 start(); 17982 } 17983 }); 17984 on('destroy', function () { 17985 detachMouseEvents(); 17986 detachDocumentEvents(); 17987 if (swiper.autoplay.running) { 17988 stop(); 17989 } 17990 }); 17991 on('_freeModeStaticRelease', function () { 17992 if (pausedByTouch || pausedByInteraction) { 17993 resume(); 17994 } 17995 }); 17996 on('_freeModeNoMomentumRelease', function () { 17997 if (!swiper.params.autoplay.disableOnInteraction) { 17998 pause(true, true); 17999 } else { 18000 stop(); 18001 } 18002 }); 18003 on('beforeTransitionStart', function (_s, speed, internal) { 18004 if (swiper.destroyed || !swiper.autoplay.running) return; 18005 if (internal || !swiper.params.autoplay.disableOnInteraction) { 18006 pause(true, true); 18007 } else { 18008 stop(); 18009 } 18010 }); 18011 on('sliderFirstMove', function () { 18012 if (swiper.destroyed || !swiper.autoplay.running) return; 18013 if (swiper.params.autoplay.disableOnInteraction) { 18014 stop(); 18015 return; 18016 } 18017 isTouched = true; 18018 pausedByTouch = false; 18019 pausedByInteraction = false; 18020 touchStartTimeout = setTimeout(function () { 18021 pausedByInteraction = true; 18022 pausedByTouch = true; 18023 pause(true); 18024 }, 200); 18025 }); 18026 on('touchEnd', function () { 18027 if (swiper.destroyed || !swiper.autoplay.running || !isTouched) return; 18028 clearTimeout(touchStartTimeout); 18029 clearTimeout(timeout); 18030 if (swiper.params.autoplay.disableOnInteraction) { 18031 pausedByTouch = false;
18032 isTouched = false; 18033 return; 18034 } 18035 if (pausedByTouch && swiper.params.cssMode) resume(); 18036 pausedByTouch = false; 18037 isTouched = false; 18038 }); 18039 on('slideChange', function () { 18040 if (swiper.destroyed || !swiper.autoplay.running) return; 18041 if (swiper.autoplay.paused) { 18042 autoplayTimeLeft = getTotalDelay(); 18043 autoplayDelayTotal = getTotalDelay(); 18044 } 18045 }); 18046 _extends(swiper.autoplay, { 18047 start: start, 18048 stop: stop, 18049 pause: pause, 18050 resume: resume 18051 }); 18052} 18053 18054},{"../shared/ssr-window.esm.mjs":67}],39:[function(require,module,exports){ 18055"use strict"; 18056 18057Object.defineProperty(exports, "__esModule", { 18058 value: true 18059}); 18060exports["default"] = Controller; 18061var _utils = require("../shared/utils.mjs"); 18062function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 18063function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } 18064function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 18065function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 18066function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } 18067function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } 18068function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 18069/* eslint no-bitwise: ["error", { "allow": [">>"] }] */ 18070function Controller(_ref) { 18071 var swiper = _ref.swiper, 18072 extendParams = _ref.extendParams, 18073 on = _ref.on; 18074 extendParams({ 18075 controller: { 18076 control: undefined, 18077 inverse: false, 18078 by: 'slide' // or 'container' 18079 } 18080 }); 18081 swiper.controller = { 18082 control: undefined 18083 }; 18084 function LinearSpline(x, y) { 18085 var binarySearch = function search() { 18086 var maxIndex; 18087 var minIndex; 18088 var guess; 18089 return function (array, val) { 18090 minIndex = -1; 18091 maxIndex = array.length; 18092 while (maxIndex - minIndex > 1) { 18093 guess = maxIndex + minIndex >> 1; 18094 if (array[guess] <= val) { 18095 minIndex = guess; 18096 } else { 18097 maxIndex = guess; 18098 } 18099 } 18100 return maxIndex; 18101 }; 18102 }(); 18103 this.x = x; 18104 this.y = y; 18105 this.lastIndex = x.length - 1; 18106 // Given an x value (x2), return the expected y2 value: 18107 // (x1,y1) is the known point before given value, 18108 // (x3,y3) is the known point after given value. 18109 var i1; 18110 var i3; 18111 this.interpolate = function interpolate(x2) { 18112 if (!x2) return 0; 18113 18114 // Get the indexes of x1 and x3 (the array indexes before and after given x2): 18115 i3 = binarySearch(this.x, x2); 18116 i1 = i3 - 1; 18117 18118 // We have our indexes i1 & i3, so we can calculate already: 18119 // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1 18120 return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1]; 18121 }; 18122 return this; 18123 } 18124 function getInterpolateFunction(c) { 18125 swiper.controller.spline = swiper.params.loop ? new LinearSpline(swiper.slidesGrid, c.slidesGrid) : new LinearSpline(swiper.snapGrid, c.snapGrid); 18126 } 18127 function setTranslate(_t, byController) { 18128 var controlled = swiper.controller.control; 18129 var multiplier; 18130 var controlledTranslate; 18131 var Swiper = swiper.constructor; 18132 function setControlledTranslate(c) { 18133 if (c.destroyed) return; 18134 18135 // this will create an Interpolate function based on the snapGrids 18136 // x is the Grid of the scrolled scroller and y will be the controlled scroller 18137 // it makes sense to create this only once and recall it for the interpolation 18138 // the function does a lot of value caching for performance 18139 var translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate; 18140 if (swiper.params.controller.by === 'slide') { 18141 getInterpolateFunction(c); 18142 // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid 18143 // but it did not work out
18144 controlledTranslate = -swiper.controller.spline.interpolate(-translate); 18145 } 18146 if (!controlledTranslate || swiper.params.controller.by === 'container') { 18147 multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate()); 18148 if (Number.isNaN(multiplier) || !Number.isFinite(multiplier)) { 18149 multiplier = 1; 18150 } 18151 controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate(); 18152 } 18153 if (swiper.params.controller.inverse) { 18154 controlledTranslate = c.maxTranslate() - controlledTranslate; 18155 } 18156 c.updateProgress(controlledTranslate); 18157 c.setTranslate(controlledTranslate, swiper); 18158 c.updateActiveIndex(); 18159 c.updateSlidesClasses(); 18160 } 18161 if (Array.isArray(controlled)) { 18162 for (var i = 0; i < controlled.length; i += 1) { 18163 if (controlled[i] !== byController && controlled[i] instanceof Swiper) { 18164 setControlledTranslate(controlled[i]); 18165 } 18166 } 18167 } else if (controlled instanceof Swiper && byController !== controlled) { 18168 setControlledTranslate(controlled); 18169 } 18170 } 18171 function setTransition(duration, byController) { 18172 var Swiper = swiper.constructor; 18173 var controlled = swiper.controller.control; 18174 var i; 18175 function setControlledTransition(c) { 18176 if (c.destroyed) return; 18177 c.setTransition(duration, swiper); 18178 if (duration !== 0) { 18179 c.transitionStart(); 18180 if (c.params.autoHeight) { 18181 (0, _utils.n)(function () { 18182 c.updateAutoHeight(); 18183 }); 18184 } 18185 (0, _utils.o)(c.wrapperEl, function () { 18186 if (!controlled) return; 18187 c.transitionEnd(); 18188 }); 18189 } 18190 } 18191 if (Array.isArray(controlled)) { 18192 for (i = 0; i < controlled.length; i += 1) { 18193 if (controlled[i] !== byController && controlled[i] instanceof Swiper) { 18194 setControlledTransition(controlled[i]); 18195 } 18196 } 18197 } else if (controlled instanceof Swiper && byController !== controlled) { 18198 setControlledTransition(controlled); 18199 } 18200 } 18201 function removeSpline() { 18202 if (!swiper.controller.control) return; 18203 if (swiper.controller.spline) { 18204 swiper.controller.spline = undefined; 18205 delete swiper.controller.spline; 18206 } 18207 } 18208 on('beforeInit', function () { 18209 if (typeof window !== 'undefined' && ( 18210 // eslint-disable-line 18211 typeof swiper.params.controller.control === 'string' || swiper.params.controller.control instanceof HTMLElement)) { 18212 var controlElements = typeof swiper.params.controller.control === 'string' ? _toConsumableArray(document.querySelectorAll(swiper.params.controller.control)) : [swiper.params.controller.control]; 18213 controlElements.forEach(function (controlElement) { 18214 if (!swiper.controller.control) swiper.controller.control = []; 18215 if (controlElement && controlElement.swiper) { 18216 swiper.controller.control.push(controlElement.swiper); 18217 } else if (controlElement) { 18218 var eventName = "".concat(swiper.params.eventsPrefix, "init"); 18219 var _onControllerSwiper = function onControllerSwiper(e) { 18220 swiper.controller.control.push(e.detail[0]); 18221 swiper.update(); 18222 controlElement.removeEventListener(eventName, _onControllerSwiper); 18223 }; 18224 controlElement.addEventListener(eventName, _onControllerSwiper); 18225 } 18226 }); 18227 return; 18228 } 18229 swiper.controller.control = swiper.params.controller.control; 18230 }); 18231 on('update', function () { 18232 removeSpline(); 18233 }); 18234 on('resize', function () { 18235 removeSpline(); 18236 }); 18237 on('observerUpdate', function () { 18238 removeSpline(); 18239 }); 18240 on('setTranslate', function (_s, translate, byController) { 18241 if (!swiper.controller.control || swiper.controller.control.destroyed) return; 18242 swiper.controller.setTranslate(translate, byController); 18243 }); 18244 on('setTransition', function (_s, duration, byController) { 18245 if (!swiper.controller.control || swiper.controller.control.destroyed) return; 18246 swiper.controller.setTransition(duration, byController); 18247 }); 18248 _extends(swiper.controller, { 18249 setTranslate: setTranslate, 18250 setTransition: setTransition 18251 }); 18252} 18253 18254},{"../shared/utils.mjs":69}],40:[function(require,module,exports){ 18255"use strict"; 18256 18257Object.defineProperty(exports, "__esModule", { 18258 value: true 18259}); 18260exports["default"] = EffectCards; 18261var _createShadow = require("../shared/create-shadow.mjs"); 18262var _effectInit = require("../shared/effect-init.mjs"); 18263var _effectTarget = require("../shared/effect-target.mjs"); 18264var _effectVirtualTransitionEnd = require("../shared/effect-virtual-transition-end.mjs"); 18265var _utils = require("../shared/utils.mjs"); 18266function EffectCards(_ref) { 18267 var swiper = _ref.swiper, 18268 extendParams = _ref.extendParams, 18269 on = _ref.on; 18270 extendParams({ 18271 cardsEffect: { 18272 slideShadows: true, 18273 rotate: true, 18274 perSlideRotate: 2, 18275 perSlideOffset: 8 18276 } 18277 }); 18278 var setTranslate = function setTranslate() { 18279 var slides = swiper.slides, 18280 activeIndex = swiper.activeIndex, 18281 rtl = swiper.rtlTranslate; 18282 var params = swiper.params.cardsEffect; 18283 var _swiper$touchEventsDa = swiper.touchEventsData, 18284 startTranslate = _swiper$touchEventsDa.startTranslate, 18285 isTouched = _swiper$touchEventsDa.isTouched; 18286 var currentTranslate = rtl ? -swiper.translate : swiper.translate; 18287 for (var i = 0; i < slides.length; i += 1) { 18288 var slideEl = slides[i]; 18289 var slideProgress = slideEl.progress; 18290 var progress = Math.min(Math.max(slideProgress, -4), 4); 18291 var offset = slideEl.swiperSlideOffset; 18292 if (swiper.params.centeredSlides && !swiper.params.cssMode) { 18293 swiper.wrapperEl.style.transform = "translateX(".concat(swiper.minTranslate(), "px)"); 18294 } 18295 if (swiper.params.centeredSlides && swiper.params.cssMode) { 18296 offset -= slides[0].swiperSlideOffset; 18297 } 18298 var tX = swiper.params.cssMode ? -offset - swiper.translate : -offset; 18299 var tY = 0; 18300 var tZ = -100 * Math.abs(progress); 18301 var scale = 1; 18302 var rotate = -params.perSlideRotate * progress; 18303 var tXAdd = params.perSlideOffset - Math.abs(progress) * 0.75; 18304 var slideIndex = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.from + i : i; 18305 var isSwipeToNext = (slideIndex === activeIndex || slideIndex === activeIndex - 1) && progress > 0 && progress < 1 && (isTouched || swiper.params.cssMode) && currentTranslate < startTranslate; 18306 var isSwipeToPrev = (slideIndex === activeIndex || slideIndex === activeIndex + 1) && progress < 0 && progress > -1 && (isTouched || swiper.params.cssMode) && currentTranslate > startTranslate; 18307 if (isSwipeToNext || isSwipeToPrev) { 18308 var subProgress = Math.pow(1 - Math.abs((Math.abs(progress) - 0.5) / 0.5), 0.5); 18309 rotate += -28 * progress * subProgress; 18310 scale += -0.5 * subProgress; 18311 tXAdd += 96 * subProgress; 18312 tY = "".concat((params.rotate || swiper.isHorizontal() ? -25
18312: 0) * subProgress * Math.abs(progress), "%"); 18313 } 18314 if (progress < 0) { 18315 // next 18316 tX = "calc(".concat(tX, "px ").concat(rtl ? '-' : '+', " (").concat(tXAdd * Math.abs(progress), "%))"); 18317 } else if (progress > 0) { 18318 // prev 18319 tX = "calc(".concat(tX, "px ").concat(rtl ? '-' : '+', " (-").concat(tXAdd * Math.abs(progress), "%))"); 18320 } else { 18321 tX = "".concat(tX, "px"); 18322 } 18323 if (!swiper.isHorizontal()) { 18324 var prevY = tY; 18325 tY = tX; 18326 tX = prevY; 18327 } 18328 var scaleString = progress < 0 ? "".concat(1 + (1 - scale) * progress) : "".concat(1 - (1 - scale) * progress); 18329 18330 /* eslint-disable */ 18331 var transform = "\n translate3d(".concat(tX, ", ").concat(tY, ", ").concat(tZ, "px)\n rotateZ(").concat(params.rotate ? rtl ? -rotate : rotate : 0, "deg)\n scale(").concat(scaleString, ")\n "); 18332 /* eslint-enable */ 18333 18334 if (params.slideShadows) { 18335 // Set shadows 18336 var shadowEl = slideEl.querySelector('.swiper-slide-shadow'); 18337 if (!shadowEl) { 18338 shadowEl = (0, _createShadow.c)('cards', slideEl); 18339 } 18340 if (shadowEl) shadowEl.style.opacity = Math.min(Math.max((Math.abs(progress) - 0.5) / 0.5, 0), 1); 18341 } 18342 slideEl.style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; 18343 var targetEl = (0, _effectTarget.e)(params, slideEl); 18344 targetEl.style.transform = transform; 18345 } 18346 }; 18347 var setTransition = function setTransition(duration) { 18348 var transformElements = swiper.slides.map(function (slideEl) { 18349 return (0, _utils.g)(slideEl); 18350 }); 18351 transformElements.forEach(function (el) { 18352 el.style.transitionDuration = "".concat(duration, "ms"); 18353 el.querySelectorAll('.swiper-slide-shadow').forEach(function (shadowEl) { 18354 shadowEl.style.transitionDuration = "".concat(duration, "ms"); 18355 }); 18356 }); 18357 (0, _effectVirtualTransitionEnd.e)({ 18358 swiper: swiper, 18359 duration: duration, 18360 transformElements: transformElements 18361 }); 18362 }; 18363 (0, _effectInit.e)({ 18364 effect: 'cards', 18365 swiper: swiper, 18366 on: on, 18367 setTranslate: setTranslate, 18368 setTransition: setTransition, 18369 perspective: function perspective() { 18370 return true; 18371 }, 18372 overwriteParams: function overwriteParams() { 18373 return { 18374 _loopSwapReset: false, 18375 watchSlidesProgress: true, 18376 loopAdditionalSlides: swiper.params.cardsEffect.rotate ? 3 : 2, 18377 centeredSlides: true, 18378 virtualTranslate: !swiper.params.cssMode 18379 }; 18380 } 18381 }); 18382} 18383 18384},{"../shared/create-shadow.mjs":63,"../shared/effect-init.mjs":64,"../shared/effect-target.mjs":65,"../shared/effect-virtual-transition-end.mjs":66,"../shared/utils.mjs":69}],41:[function(require,module,exports){ 18385"use strict"; 18386 18387Object.defineProperty(exports, "__esModule", { 18388 value: true 18389}); 18390exports["default"] = EffectCoverflow; 18391var _createShadow = require("../shared/create-shadow.mjs"); 18392var _effectInit = require("../shared/effect-init.mjs"); 18393var _effectTarget = require("../shared/effect-target.mjs"); 18394var _utils = require("../shared/utils.mjs"); 18395function EffectCoverflow(_ref) { 18396 var swiper = _ref.swiper, 18397 extendParams = _ref.extendParams, 18398 on = _ref.on; 18399 extendParams({ 18400 coverflowEffect: { 18401 rotate: 50, 18402 stretch: 0, 18403 depth: 100, 18404 scale: 1, 18405 modifier: 1, 18406 slideShadows: true 18407 } 18408 }); 18409 var setTranslate = function setTranslate() { 18410 var swiperWidth = swiper.width, 18411 swiperHeight = swiper.height, 18412 slides = swiper.slides, 18413 slidesSizesGrid = swiper.slidesSizesGrid; 18414 var params = swiper.params.coverflowEffect; 18415 var isHorizontal = swiper.isHorizontal(); 18416 var transform = swiper.translate; 18417 var center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2; 18418 var rotate = isHorizontal ? params.rotate : -params.rotate; 18419 var translate = params.depth; 18420 var r = (0, _utils.a)(swiper); 18421 // Each slide offset from center 18422 for (var i = 0, length = slides.length; i < length; i += 1) { 18423 var slideEl = slides[i]; 18424 var slideSize = slidesSizesGrid[i]; 18425 var slideOffset = slideEl.swiperSlideOffset; 18426 var centerOffset = (center - slideOffset - slideSize / 2) / slideSize; 18427 var offsetMultiplier = typeof params.modifier === 'function' ? params.modifier(centerOffset) : centerOffset * params.modifier; 18428 var rotateY = isHorizontal ? rotate * offsetMultiplier : 0; 18429 var rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; 18430 // var rotateZ = 0 18431 var translateZ = -translate * Math.abs(offsetMultiplier); 18432 var stretch = params.stretch; 18433 // Allow percentage to make a relative stretch for responsive sliders 18434 if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) { 18435 stretch = parseFloat(params.stretch) / 100 * slideSize; 18436 } 18437 var translateY = isHorizontal ? 0 : stretch * offsetMultiplier; 18438 var translateX = isHorizontal ? stretch * offsetMultiplier : 0; 18439 var scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier); 18440 18441 // Fix for ultra small values 18442 if (Math.abs(translateX) < 0.001) translateX = 0; 18443 if (Math.abs(translateY) < 0.001) translateY = 0; 18444 if (Math.abs(translateZ) < 0.001) translateZ = 0; 18445 if (Math.abs(rotateY) < 0.001) rotateY = 0; 18446 if (Math.abs(rotateX) < 0.001) rotateX = 0; 18447 if (Math.abs(scale) < 0.001) scale = 0; 18448 var slideTransform = "translate3d(".concat(translateX, "px,").concat(translateY, "px,").concat(translateZ, "px) rotateX(").concat(r(rotateX), "deg) rotateY(").concat(r(rotateY), "deg) scale(").concat(scale, ")"); 18449 var targetEl = (0, _effectTarget.e)(params, slideEl); 18450 targetEl.style.transform = slideTransform; 18451 slideEl.style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1; 18452 if (params.slideShadows) { 18453 // Set shadows 18454 var shadowBeforeEl = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top'); 18455 var shadowAfterEl = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom'); 18456 if (!shadowBeforeEl) { 18457 shadowBeforeEl = (0, _createShadow.c)('coverflow', slideEl, isHorizontal ? 'left' : 'top'); 18458 } 18459 if (!shadowAfterEl) { 18460 shadowAfterEl = (0, _createShadow.c)('coverflow', slideEl, isHorizontal ? 'right' : 'bottom'); 18461 } 18462 if (shadowBeforeEl) shadowBeforeEl.style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0; 18463 if (shadowAfterEl) shadowAfterEl.style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0; 18464 } 18465 } 18466 }; 18467 var setTransition = function setTransition(duration) { 18468 var transformElements = swiper.slides.map(function (slideEl) { 18469 return (0, _utils.g)(slideEl); 18470 });
18471 transformElements.forEach(function (el) { 18472 el.style.transitionDuration = "".concat(duration, "ms"); 18473 el.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(function (shadowEl) { 18474 shadowEl.style.transitionDuration = "".concat(duration, "ms"); 18475 }); 18476 }); 18477 }; 18478 (0, _effectInit.e)({ 18479 effect: 'coverflow', 18480 swiper: swiper, 18481 on: on, 18482 setTranslate: setTranslate, 18483 setTransition: setTransition, 18484 perspective: function perspective() { 18485 return true; 18486 }, 18487 overwriteParams: function overwriteParams() { 18488 return { 18489 watchSlidesProgress: true 18490 }; 18491 } 18492 }); 18493} 18494 18495},{"../shared/create-shadow.mjs":63,"../shared/effect-init.mjs":64,"../shared/effect-target.mjs":65,"../shared/utils.mjs":69}],42:[function(require,module,exports){ 18496"use strict"; 18497 18498Object.defineProperty(exports, "__esModule", { 18499 value: true 18500}); 18501exports["default"] = EffectCreative; 18502var _createShadow = require("../shared/create-shadow.mjs"); 18503var _effectInit = require("../shared/effect-init.mjs"); 18504var _effectTarget = require("../shared/effect-target.mjs"); 18505var _effectVirtualTransitionEnd = require("../shared/effect-virtual-transition-end.mjs"); 18506var _utils = require("../shared/utils.mjs"); 18507function EffectCreative(_ref) { 18508 var swiper = _ref.swiper, 18509 extendParams = _ref.extendParams, 18510 on = _ref.on; 18511 extendParams({ 18512 creativeEffect: { 18513 limitProgress: 1, 18514 shadowPerProgress: false, 18515 progressMultiplier: 1, 18516 perspective: true, 18517 prev: { 18518 translate: [0, 0, 0], 18519 rotate: [0, 0, 0], 18520 opacity: 1, 18521 scale: 1 18522 }, 18523 next: { 18524 translate: [0, 0, 0], 18525 rotate: [0, 0, 0], 18526 opacity: 1, 18527 scale: 1 18528 } 18529 } 18530 }); 18531 var getTranslateValue = function getTranslateValue(value) { 18532 if (typeof value === 'string') return value; 18533 return "".concat(value, "px"); 18534 }; 18535 var setTranslate = function setTranslate() { 18536 var slides = swiper.slides, 18537 wrapperEl = swiper.wrapperEl, 18538 slidesSizesGrid = swiper.slidesSizesGrid; 18539 var params = swiper.params.creativeEffect; 18540 var multiplier = params.progressMultiplier; 18541 var isCenteredSlides = swiper.params.centeredSlides; 18542 var rotateFix = (0, _utils.a)(swiper); 18543 if (isCenteredSlides) { 18544 var margin = slidesSizesGrid[0] / 2 - swiper.params.slidesOffsetBefore || 0; 18545 wrapperEl.style.transform = "translateX(calc(50% - ".concat(margin, "px))"); 18546 } 18547 var _loop = function _loop() { 18548 var slideEl = slides[i]; 18549 var slideProgress = slideEl.progress; 18550 var progress = Math.min(Math.max(slideEl.progress, -params.limitProgress), params.limitProgress); 18551 var originalProgress = progress; 18552 if (!isCenteredSlides) { 18553 originalProgress = Math.min(Math.max(slideEl.originalProgress, -params.limitProgress), params.limitProgress); 18554 } 18555 var offset = slideEl.swiperSlideOffset; 18556 var t = [swiper.params.cssMode ? -offset - swiper.translate : -offset, 0, 0]; 18557 var r = [0, 0, 0]; 18558 var custom = false; 18559 if (!swiper.isHorizontal()) { 18560 t[1] = t[0]; 18561 t[0] = 0; 18562 } 18563 var data = { 18564 translate: [0, 0, 0], 18565 rotate: [0, 0, 0], 18566 scale: 1, 18567 opacity: 1 18568 }; 18569 if (progress < 0) { 18570 data = params.next; 18571 custom = true; 18572 } else if (progress > 0) { 18573 data = params.prev; 18574 custom = true; 18575 } 18576 // set translate 18577 t.forEach(function (value, index) { 18578 t[index] = "calc(".concat(value, "px + (").concat(getTranslateValue(data.translate[index]), " * ").concat(Math.abs(progress * multiplier), "))"); 18579 }); 18580 // set rotates 18581 r.forEach(function (value, index) { 18582 var val = data.rotate[index] * Math.abs(progress * multiplier); 18583 r[index] = val; 18584 }); 18585 slideEl.style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; 18586 var translateString = t.join(', '); 18587 var rotateString = "rotateX(".concat(rotateFix(r[0]), "deg) rotateY(").concat(rotateFix(r[1]), "deg) rotateZ(").concat(rotateFix(r[2]), "deg)");
18588 var scaleString = originalProgress < 0 ? "scale(".concat(1 + (1 - data.scale) * originalProgress * multiplier, ")") : "scale(".concat(1 - (1 - data.scale) * originalProgress * multiplier, ")"); 18589 var opacityString = originalProgress < 0 ? 1 + (1 - data.opacity) * originalProgress * multiplier : 1 - (1 - data.opacity) * originalProgress * multiplier; 18590 var transform = "translate3d(".concat(translateString, ") ").concat(rotateString, " ").concat(scaleString); 18591 18592 // Set shadows 18593 if (custom && data.shadow || !custom) { 18594 var shadowEl = slideEl.querySelector('.swiper-slide-shadow'); 18595 if (!shadowEl && data.shadow) { 18596 shadowEl = (0, _createShadow.c)('creative', slideEl); 18597 } 18598 if (shadowEl) { 18599 var shadowOpacity = params.shadowPerProgress ? progress * (1 / params.limitProgress) : progress; 18600 shadowEl.style.opacity = Math.min(Math.max(Math.abs(shadowOpacity), 0), 1); 18601 } 18602 } 18603 var targetEl = (0, _effectTarget.e)(params, slideEl); 18604 targetEl.style.transform = transform; 18605 targetEl.style.opacity = opacityString; 18606 if (data.origin) { 18607 targetEl.style.transformOrigin = data.origin; 18608 } 18609 }; 18610 for (var i = 0; i < slides.length; i += 1) { 18611 _loop(); 18612 } 18613 }; 18614 var setTransition = function setTransition(duration) { 18615 var transformElements = swiper.slides.map(function (slideEl) { 18616 return (0, _utils.g)(slideEl); 18617 }); 18618 transformElements.forEach(function (el) { 18619 el.style.transitionDuration = "".concat(duration, "ms"); 18620 el.querySelectorAll('.swiper-slide-shadow').forEach(function (shadowEl) { 18621 shadowEl.style.transitionDuration = "".concat(duration, "ms"); 18622 }); 18623 }); 18624 (0, _effectVirtualTransitionEnd.e)({ 18625 swiper: swiper, 18626 duration: duration, 18627 transformElements: transformElements, 18628 allSlides: true 18629 }); 18630 }; 18631 (0, _effectInit.e)({ 18632 effect: 'creative', 18633 swiper: swiper, 18634 on: on, 18635 setTranslate: setTranslate, 18636 setTransition: setTransition, 18637 perspective: function perspective() { 18638 return swiper.params.creativeEffect.perspective; 18639 }, 18640 overwriteParams: function overwriteParams() { 18641 return { 18642 watchSlidesProgress: true, 18643 virtualTranslate: !swiper.params.cssMode 18644 }; 18645 } 18646 }); 18647} 18648 18649},{"../shared/create-shadow.mjs":63,"../shared/effect-init.mjs":64,"../shared/effect-target.mjs":65,"../shared/effect-virtual-transition-end.mjs":66,"../shared/utils.mjs":69}],43:[function(require,module,exports){ 18650"use strict"; 18651 18652Object.defineProperty(exports, "__esModule", { 18653 value: true 18654}); 18655exports["default"] = EffectCube; 18656var _effectInit = require("../shared/effect-init.mjs"); 18657var _utils = require("../shared/utils.mjs"); 18658function EffectCube(_ref) { 18659 var swiper = _ref.swiper, 18660 extendParams = _ref.extendParams, 18661 on = _ref.on; 18662 extendParams({ 18663 cubeEffect: { 18664 slideShadows: true, 18665 shadow: true, 18666 shadowOffset: 20, 18667 shadowScale: 0.94 18668 } 18669 }); 18670 var createSlideShadows = function createSlideShadows(slideEl, progress, isHorizontal) { 18671 var shadowBefore = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top'); 18672 var shadowAfter = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom'); 18673 if (!shadowBefore) { 18674 shadowBefore = (0, _utils.c)('div', "swiper-slide-shadow-cube swiper-slide-shadow-".concat(isHorizontal ? 'left' : 'top').split(' ')); 18675 slideEl.append(shadowBefore); 18676 } 18677 if (!shadowAfter) { 18678 shadowAfter = (0, _utils.c)('div', "swiper-slide-shadow-cube swiper-slide-shadow-".concat(isHorizontal ? 'right' : 'bottom').split(' ')); 18679 slideEl.append(shadowAfter); 18680 } 18681 if (shadowBefore) shadowBefore.style.opacity = Math.max(-progress, 0); 18682 if (shadowAfter) shadowAfter.style.opacity = Math.max(progress, 0); 18683 }; 18684 var recreateShadows = function recreateShadows() { 18685 // create new ones 18686 var isHorizontal = swiper.isHorizontal(); 18687 swiper.slides.forEach(function (slideEl) { 18688 var progress = Math.max(Math.min(slideEl.progress, 1), -1); 18689 createSlideShadows(slideEl, progress, isHorizontal); 18690 }); 18691 }; 18692 var setTranslate = function setTranslate() { 18693 var el = swiper.el, 18694 wrapperEl = swiper.wrapperEl, 18695 slides = swiper.slides, 18696 swiperWidth = swiper.width, 18697 swiperHeight = swiper.height, 18698 rtl = swiper.rtlTranslate, 18699 swiperSize = swiper.size, 18700 browser = swiper.browser; 18701 var r = (0, _utils.a)(swiper); 18702 var params = swiper.params.cubeEffect; 18703 var isHorizontal = swiper.isHorizontal(); 18704 var isVirtual = swiper.virtual && swiper.params.virtual.enabled; 18705 var wrapperRotate = 0; 18706 var cubeShadowEl; 18707 if (params.shadow) { 18708 if (isHorizontal) { 18709 cubeShadowEl = swiper.wrapperEl.querySelector('.swiper-cube-shadow'); 18710 if (!cubeShadowEl) { 18711 cubeShadowEl = (0, _utils.c)('div', 'swiper-cube-shadow'); 18712 swiper.wrapperEl.append(cubeShadowEl); 18713 } 18714 cubeShadowEl.style.height = "".concat(swiperWidth, "px"); 18715 } else { 18716 cubeShadowEl = el.querySelector('.swiper-cube-shadow'); 18717 if (!cubeShadowEl) { 18718 cubeShadowEl = (0, _utils.c)('div', 'swiper-cube-shadow'); 18719 el.append(cubeShadowEl); 18720 } 18721 } 18722 } 18723 for (var i = 0; i < slides.length; i += 1) { 18724 var slideEl = slides[i]; 18725 var slideIndex = i; 18726 if (isVirtual) { 18727 slideIndex = parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10); 18728 } 18729 var slideAngle = slideIndex * 90; 18730 var round = Math.floor(slideAngle / 360); 18731 if (rtl) { 18732 slideAngle = -slideAngle; 18733 round = Math.floor(-slideAngle / 360); 18734 } 18735 var progress = Math.max(Math.min(slideEl.progress, 1), -1); 18736 var tx = 0; 18737 var ty = 0; 18738 var tz = 0; 18739 if (slideIndex % 4 === 0) { 18740 tx = -round * 4 * swiperSize; 18741 tz = 0; 18742 } else if ((slideIndex - 1) % 4 === 0) { 18743 tx = 0; 18744 tz = -round * 4 * swiperSize; 18745 } else if ((slideIndex - 2) % 4 === 0) { 18746 tx = swiperSize + round * 4 * swiperSize; 18747 tz = swiperSize; 18748 } else if ((slideIndex - 3) % 4 === 0) { 18749 tx = -swiperSize; 18750 tz = 3 * swiperSize + swiperSize * 4 * round; 18751 } 18752 if (rtl) { 18753 tx = -tx; 18754 } 18755 if (!isHorizontal) { 18756 ty = tx; 18757 tx = 0; 18758 } 18759 var transform = "rotateX(".concat(r(isHorizontal ? 0 : -slideAngle), "deg) rotateY(").concat(r(isHorizontal ? slideAngle : 0), "deg) translate3d(").concat(tx, "px, ").concat(ty, "px, ").concat(tz, "px)"); 18760 if (progress <= 1 && progress > -1) { 18761 wrapperRotate = slideIndex * 90 + progress * 90; 18762 if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90; 18763 } 18764 slideEl.style.transform = transform; 18765 if (params.slideShadows) { 18766 createSlideShadows(slideEl, progress, isHorizontal); 18767 } 18768 } 18769 wrapperEl.style.transformOrigin = "50% 50% -".concat(swiperSize / 2, "px"); 18770 wrapperEl.style['-webkit-transform-origin'] = "50% 50% -".concat(swiperSize / 2, "px"); 18771 if (params.shadow) { 18772 if (isHorizontal) { 18773 cubeShadowEl.style.transform = "translate3d(0px, ".concat(swiperWidth / 2 + params.shadowOffset, "px, ").concat(-swiperWidth / 2, "px) rotateX(89.99deg) rotateZ(0deg) scale(").concat(params.shadowScale, ")"); 18774 } else { 18775 var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90; 18776 var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2); 18777 var scale1 = params.shadowScale; 18778 var scale2 = params.shadowScale / multiplier; 18779 var offset = params.shadowOffset; 18780 cubeShadowEl.style.transform = "scale3d(".concat(scale1, ", 1, ").concat(scale2, ") translate3d(0px, ").concat(swiperHeight / 2 + offset, "px, ").concat(-swiperHeight / 2 / scale2, "px) rotateX(-89.99deg)"); 18781 } 18782 } 18783 var zFactor = (browser.isSafari || browser.isWebView) && browser.needPerspectiveFix ? -swiperSize / 2 : 0; 18784 wrapperEl.style.transform = "translate3d(0px,0,".concat(zFactor, "px) rotateX(").concat(r(swiper.isHorizontal() ? 0 : wrapperRotate), "deg) rotateY(").concat(r(swiper.isHorizontal() ? -wrapperRotate : 0), "deg)"); 18785 wrapperEl.style.setProperty('--swiper-cube-translate-z', "".concat(zFactor, "px")); 18786 }; 18787 var setTransition = function setTransition(duration) { 18788 var el = swiper.el, 18789 slides = swiper.slides;
18790 slides.forEach(function (slideEl) { 18791 slideEl.style.transitionDuration = "".concat(duration, "ms"); 18792 slideEl.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(function (subEl) { 18793 subEl.style.transitionDuration = "".concat(duration, "ms"); 18794 }); 18795 }); 18796 if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) { 18797 var shadowEl = el.querySelector('.swiper-cube-shadow'); 18798 if (shadowEl) shadowEl.style.transitionDuration = "".concat(duration, "ms"); 18799 } 18800 }; 18801 (0, _effectInit.e)({ 18802 effect: 'cube', 18803 swiper: swiper, 18804 on: on, 18805 setTranslate: setTranslate, 18806 setTransition: setTransition, 18807 recreateShadows: recreateShadows, 18808 getEffectParams: function getEffectParams() { 18809 return swiper.params.cubeEffect; 18810 }, 18811 perspective: function perspective() { 18812 return true; 18813 }, 18814 overwriteParams: function overwriteParams() { 18815 return { 18816 slidesPerView: 1, 18817 slidesPerGroup: 1, 18818 watchSlidesProgress: true, 18819 resistanceRatio: 0, 18820 spaceBetween: 0, 18821 centeredSlides: false, 18822 virtualTranslate: true 18823 }; 18824 } 18825 }); 18826} 18827 18828},{"../shared/effect-init.mjs":64,"../shared/utils.mjs":69}],44:[function(require,module,exports){ 18829"use strict"; 18830 18831Object.defineProperty(exports, "__esModule", { 18832 value: true 18833}); 18834exports["default"] = EffectFade; 18835var _effectInit = require("../shared/effect-init.mjs"); 18836var _effectTarget = require("../shared/effect-target.mjs"); 18837var _effectVirtualTransitionEnd = require("../shared/effect-virtual-transition-end.mjs"); 18838var _utils = require("../shared/utils.mjs"); 18839function EffectFade(_ref) { 18840 var swiper = _ref.swiper, 18841 extendParams = _ref.extendParams, 18842 on = _ref.on; 18843 extendParams({ 18844 fadeEffect: { 18845 crossFade: false 18846 } 18847 }); 18848 var setTranslate = function setTranslate() { 18849 var slides = swiper.slides; 18850 var params = swiper.params.fadeEffect; 18851 for (var i = 0; i < slides.length; i += 1) { 18852 var slideEl = swiper.slides[i]; 18853 var offset = slideEl.swiperSlideOffset; 18854 var tx = -offset; 18855 if (!swiper.params.virtualTranslate) tx -= swiper.translate; 18856 var ty = 0; 18857 if (!swiper.isHorizontal()) { 18858 ty = tx; 18859 tx = 0; 18860 } 18861 var slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs(slideEl.progress), 0) : 1 + Math.min(Math.max(slideEl.progress, -1), 0); 18862 var targetEl = (0, _effectTarget.e)(params, slideEl); 18863 targetEl.style.opacity = slideOpacity; 18864 targetEl.style.transform = "translate3d(".concat(tx, "px, ").concat(ty, "px, 0px)"); 18865 } 18866 }; 18867 var setTransition = function setTransition(duration) { 18868 var transformElements = swiper.slides.map(function (slideEl) { 18869 return (0, _utils.g)(slideEl); 18870 }); 18871 transformElements.forEach(function (el) { 18872 el.style.transitionDuration = "".concat(duration, "ms"); 18873 }); 18874 (0, _effectVirtualTransitionEnd.e)({ 18875 swiper: swiper, 18876 duration: duration, 18877 transformElements: transformElements, 18878 allSlides: true 18879 }); 18880 }; 18881 (0, _effectInit.e)({ 18882 effect: 'fade', 18883 swiper: swiper, 18884 on: on, 18885 setTranslate: setTranslate, 18886 setTransition: setTransition, 18887 overwriteParams: function overwriteParams() { 18888 return { 18889 slidesPerView: 1, 18890 slidesPerGroup: 1, 18891 watchSlidesProgress: true, 18892 spaceBetween: 0, 18893 virtualTranslate: !swiper.params.cssMode 18894 }; 18895 } 18896 }); 18897} 18898 18899},{"../shared/effect-init.mjs":64,"../shared/effect-target.mjs":65,"../shared/effect-virtual-transition-end.mjs":66,"../shared/utils.mjs":69}],45:[function(require,module,exports){ 18900"use strict"; 18901 18902Object.defineProperty(exports, "__esModule", { 18903 value: true 18904}); 18905exports["default"] = EffectFlip; 18906var _createShadow = require("../shared/create-shadow.mjs"); 18907var _effectInit = require("../shared/effect-init.mjs"); 18908var _effectTarget = require("../shared/effect-target.mjs"); 18909var _effectVirtualTransitionEnd = require("../shared/effect-virtual-transition-end.mjs"); 18910var _utils = require("../shared/utils.mjs"); 18911function EffectFlip(_ref) { 18912 var swiper = _ref.swiper, 18913 extendParams = _ref.extendParams, 18914 on = _ref.on; 18915 extendParams({ 18916 flipEffect: { 18917 slideShadows: true, 18918 limitRotation: true 18919 } 18920 }); 18921 var createSlideShadows = function createSlideShadows(slideEl, progress) { 18922 var shadowBefore = swiper.isHorizontal() ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top'); 18923 var shadowAfter = swiper.isHorizontal() ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom'); 18924 if (!shadowBefore) { 18925 shadowBefore = (0, _createShadow.c)('flip', slideEl, swiper.isHorizontal() ? 'left' : 'top'); 18926 } 18927 if (!shadowAfter) { 18928 shadowAfter = (0, _createShadow.c)('flip', slideEl, swiper.isHorizontal() ? 'right' : 'bottom'); 18929 } 18930 if (shadowBefore) shadowBefore.style.opacity = Math.max(-progress, 0); 18931 if (shadowAfter) shadowAfter.style.opacity = Math.max(progress, 0); 18932 }; 18933 var recreateShadows = function recreateShadows() { 18934 // Set shadows 18935 swiper.params.flipEffect;
18936 swiper.slides.forEach(function (slideEl) { 18937 var progress = slideEl.progress; 18938 if (swiper.params.flipEffect.limitRotation) { 18939 progress = Math.max(Math.min(slideEl.progress, 1), -1); 18940 } 18941 createSlideShadows(slideEl, progress); 18942 }); 18943 }; 18944 var setTranslate = function setTranslate() { 18945 var slides = swiper.slides, 18946 rtl = swiper.rtlTranslate; 18947 var params = swiper.params.flipEffect; 18948 var rotateFix = (0, _utils.a)(swiper); 18949 for (var i = 0; i < slides.length; i += 1) { 18950 var slideEl = slides[i]; 18951 var progress = slideEl.progress; 18952 if (swiper.params.flipEffect.limitRotation) { 18953 progress = Math.max(Math.min(slideEl.progress, 1), -1); 18954 } 18955 var offset = slideEl.swiperSlideOffset; 18956 var rotate = -180 * progress; 18957 var rotateY = rotate; 18958 var rotateX = 0; 18959 var tx = swiper.params.cssMode ? -offset - swiper.translate : -offset; 18960 var ty = 0; 18961 if (!swiper.isHorizontal()) { 18962 ty = tx; 18963 tx = 0; 18964 rotateX = -rotateY; 18965 rotateY = 0; 18966 } else if (rtl) { 18967 rotateY = -rotateY; 18968 } 18969 slideEl.style.zIndex = -Math.abs(Math.round(progress)) + slides.length; 18970 if (params.slideShadows) { 18971 createSlideShadows(slideEl, progress); 18972 } 18973 var transform = "translate3d(".concat(tx, "px, ").concat(ty, "px, 0px) rotateX(").concat(rotateFix(rotateX), "deg) rotateY(").concat(rotateFix(rotateY), "deg)"); 18974 var targetEl = (0, _effectTarget.e)(params, slideEl); 18975 targetEl.style.transform = transform; 18976 } 18977 }; 18978 var setTransition = function setTransition(duration) { 18979 var transformElements = swiper.slides.map(function (slideEl) { 18980 return (0, _utils.g)(slideEl); 18981 }); 18982 transformElements.forEach(function (el) { 18983 el.style.transitionDuration = "".concat(duration, "ms"); 18984 el.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(function (shadowEl) { 18985 shadowEl.style.transitionDuration = "".concat(duration, "ms"); 18986 }); 18987 }); 18988 (0, _effectVirtualTransitionEnd.e)({ 18989 swiper: swiper, 18990 duration: duration, 18991 transformElements: transformElements 18992 }); 18993 }; 18994 (0, _effectInit.e)({ 18995 effect: 'flip', 18996 swiper: swiper, 18997 on: on, 18998 setTranslate: setTranslate, 18999 setTransition: setTransition, 19000 recreateShadows: recreateShadows, 19001 getEffectParams: function getEffectParams() { 19002 return swiper.params.flipEffect; 19003 }, 19004 perspective: function perspective() { 19005 return true; 19006 }, 19007 overwriteParams: function overwriteParams() { 19008 return { 19009 slidesPerView: 1, 19010 slidesPerGroup: 1, 19011 watchSlidesProgress: true, 19012 spaceBetween: 0, 19013 virtualTranslate: !swiper.params.cssMode 19014 }; 19015 } 19016 }); 19017} 19018 19019},{"../shared/create-shadow.mjs":63,"../shared/effect-init.mjs":64,"../shared/effect-target.mjs":65,"../shared/effect-virtual-transition-end.mjs":66,"../shared/utils.mjs":69}],46:[function(require,module,exports){ 19020"use strict"; 19021 19022Object.defineProperty(exports, "__esModule", { 19023 value: true 19024}); 19025exports["default"] = freeMode; 19026var _utils = require("../shared/utils.mjs"); 19027function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 19028function freeMode(_ref) { 19029 var swiper = _ref.swiper, 19030 extendParams = _ref.extendParams, 19031 emit = _ref.emit, 19032 once = _ref.once; 19033 extendParams({ 19034 freeMode: { 19035 enabled: false, 19036 momentum: true, 19037 momentumRatio: 1, 19038 momentumBounce: true, 19039 momentumBounceRatio: 1, 19040 momentumVelocityRatio: 1, 19041 sticky: false, 19042 minimumVelocity: 0.02 19043 } 19044 }); 19045 function onTouchStart() { 19046 if (swiper.params.cssMode) return; 19047 var translate = swiper.getTranslate(); 19048 swiper.setTranslate(translate); 19049 swiper.setTransition(0); 19050 swiper.touchEventsData.velocities.length = 0; 19051 swiper.freeMode.onTouchEnd({
19052 currentPos: swiper.rtl ? swiper.translate : -swiper.translate 19053 }); 19054 } 19055 function onTouchMove() { 19056 if (swiper.params.cssMode) return; 19057 var data = swiper.touchEventsData, 19058 touches = swiper.touches; 19059 // Velocity 19060 if (data.velocities.length === 0) { 19061 data.velocities.push({ 19062 position: touches[swiper.isHorizontal() ? 'startX' : 'startY'], 19063 time: data.touchStartTime 19064 }); 19065 } 19066 data.velocities.push({ 19067 position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'], 19068 time: (0, _utils.h)() 19069 }); 19070 } 19071 function onTouchEnd(_ref2) { 19072 var currentPos = _ref2.currentPos; 19073 if (swiper.params.cssMode) return; 19074 var params = swiper.params, 19075 wrapperEl = swiper.wrapperEl, 19076 rtl = swiper.rtlTranslate, 19077 snapGrid = swiper.snapGrid, 19078 data = swiper.touchEventsData; 19079 // Time diff 19080 var touchEndTime = (0, _utils.h)(); 19081 var timeDiff = touchEndTime - data.touchStartTime; 19082 if (currentPos < -swiper.minTranslate()) { 19083 swiper.slideTo(swiper.activeIndex); 19084 return; 19085 } 19086 if (currentPos > -swiper.maxTranslate()) { 19087 if (swiper.slides.length < snapGrid.length) { 19088 swiper.slideTo(snapGrid.length - 1); 19089 } else { 19090 swiper.slideTo(swiper.slides.length - 1); 19091 } 19092 return; 19093 } 19094 if (params.freeMode.momentum) { 19095 if (data.velocities.length > 1) { 19096 var lastMoveEvent = data.velocities.pop(); 19097 var velocityEvent = data.velocities.pop(); 19098 var distance = lastMoveEvent.position - velocityEvent.position; 19099 var time = lastMoveEvent.time - velocityEvent.time; 19100 swiper.velocity = distance / time; 19101 swiper.velocity /= 2; 19102 if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) { 19103 swiper.velocity = 0; 19104 } 19105 // this implies that the user stopped moving a finger then released. 19106 // There would be no events with distance zero, so the last event is stale. 19107 if (time > 150 || (0, _utils.h)() - lastMoveEvent.time > 300) { 19108 swiper.velocity = 0; 19109 } 19110 } else { 19111 swiper.velocity = 0; 19112 } 19113 swiper.velocity *= params.freeMode.momentumVelocityRatio; 19114 data.velocities.length = 0; 19115 var momentumDuration = 1000 * params.freeMode.momentumRatio; 19116 var momentumDistance = swiper.velocity * momentumDuration; 19117 var newPosition = swiper.translate + momentumDistance; 19118 if (rtl) newPosition = -newPosition; 19119 var doBounce = false; 19120 var afterBouncePosition; 19121 var bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio; 19122 var needsLoopFix; 19123 if (newPosition < swiper.maxTranslate()) { 19124 if (params.freeMode.momentumBounce) { 19125 if (newPosition + swiper.maxTranslate() < -bounceAmount) { 19126 newPosition = swiper.maxTranslate() - bounceAmount; 19127 } 19128 afterBouncePosition = swiper.maxTranslate(); 19129 doBounce = true; 19130 data.allowMomentumBounce = true; 19131 } else { 19132 newPosition = swiper.maxTranslate(); 19133 } 19134 if (params.loop && params.centeredSlides) needsLoopFix = true; 19135 } else if (newPosition > swiper.minTranslate()) { 19136 if (params.freeMode.momentumBounce) { 19137 if (newPosition - swiper.minTranslate() > bounceAmount) { 19138 newPosition = swiper.minTranslate() + bounceAmount; 19139 } 19140 afterBouncePosition = swiper.minTranslate(); 19141 doBounce = true; 19142 data.allowMomentumBounce = true; 19143 } else { 19144 newPosition = swiper.minTranslate(); 19145 } 19146 if (params.loop && params.centeredSlides) needsLoopFix = true; 19147 } else if (params.freeMode.sticky) { 19148 var nextSlide; 19149 for (var j = 0; j < snapGrid.length; j += 1) { 19150 if (snapGrid[j] > -newPosition) { 19151 nextSlide = j; 19152 break; 19153 } 19154 } 19155 if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') { 19156 newPosition = snapGrid[nextSlide]; 19157 } else { 19158 newPosition = snapGrid[nextSlide - 1]; 19159 } 19160 newPosition = -newPosition; 19161 } 19162 if (needsLoopFix) { 19163 once('transitionEnd', function () { 19164 swiper.loopFix(); 19165 }); 19166 } 19167 // Fix duration 19168 if (swiper.velocity !== 0) { 19169 if (rtl) { 19170 momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity); 19171 } else { 19172 momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity); 19173 } 19174 if (params.freeMode.sticky) { 19175 // If freeMode.sticky is active and the user ends a swipe with a slow-velocity 19176 // event, then durations can be 20+ seconds to slide one (or zero!) slides. 19177 // It's easy to see this when simulating touch with mouse events. To fix this, 19178 // limit single-slide swipes to the default slide duration. This also has the 19179 // nice side effect of matching slide speed if the user stopped moving before 19180 // lifting finger or mouse vs. moving slowly before lifting the finger/mouse. 19181 // For faster swipes, also apply limits (albeit higher ones). 19182 var moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate); 19183 var currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex]; 19184 if (moveDistance < currentSlideSize) { 19185 momentumDuration = params.speed; 19186 } else if (moveDistance < 2 * currentSlideSize) { 19187 momentumDuration = params.speed * 1.5; 19188 } else { 19189 momentumDuration = params.speed * 2.5; 19190 } 19191 } 19192 } else if (params.freeMode.sticky) { 19193 swiper.slideToClosest(); 19194 return; 19195 } 19196 if (params.freeMode.momentumBounce && doBounce) { 19197 swiper.updateProgress(afterBouncePosition); 19198 swiper.setTransition(momentumDuration); 19199 swiper.setTranslate(newPosition); 19200 swiper.transitionStart(true, swiper.swipeDirection); 19201 swiper.animating = true; 19202 (0, _utils.o)(wrapperEl, function () { 19203 if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return; 19204 emit('momentumBounce'); 19205 swiper.setTransition(params.speed); 19206 setTimeout(function () { 19207 swiper.setTranslate(afterBouncePosition); 19208 (0, _utils.o)(wrapperEl, function () { 19209 if (!swiper || swiper.destroyed) return; 19210 swiper.transitionEnd(); 19211 }); 19212 }, 0); 19213 }); 19214 } else if (swiper.velocity) { 19215 emit('_freeModeNoMomentumRelease'); 19216 swiper.updateProgress(newPosition); 19217 swiper.setTransition(momentumDuration); 19218 swiper.setTranslate(newPosition); 19219 swiper.transitionStart(true, swiper.swipeDirection); 19220 if (!swiper.animating) { 19221 swiper.animating = true; 19222 (0, _utils.o)(wrapperEl, function () { 19223 if (!swiper || swiper.destroyed) return; 19224 swiper.transitionEnd(); 19225 }); 19226 } 19227 } else { 19228 swiper.updateProgress(newPosition); 19229 } 19230 swiper.updateActiveIndex(); 19231 swiper.updateSlidesClasses(); 19232 } else if (params.freeMode.sticky) { 19233 swiper.slideToClosest(); 19234 return; 19235 } else if (params.freeMode) { 19236 emit('_freeModeNoMomentumRelease'); 19237 } 19238 if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) { 19239 emit('_freeModeStaticRelease'); 19240 swiper.updateProgress(); 19241 swiper.updateActiveIndex(); 19242 swiper.updateSlidesClasses(); 19243 } 19244 } 19245 _extends(swiper, { 19246 freeMode: { 19247 onTouchStart: onTouchStart, 19248 onTouchMove: onTouchMove, 19249 onTouchEnd: onTouchEnd 19250 } 19251 }); 19252} 19253 19254},{"../shared/utils.mjs":69}],47:[function(require,module,exports){ 19255"use strict"; 19256 19257Object.defineProperty(exports, "__esModule", { 19258 value: true 19259}); 19260exports["default"] = Grid; 19261function Grid(_ref) { 19262 var swiper = _ref.swiper, 19263 extendParams = _ref.extendParams, 19264 on = _ref.on; 19265 extendParams({ 19266 grid: { 19267 rows: 1, 19268 fill: 'column' 19269 } 19270 });
19271 var slidesNumberEvenToRows; 19272 var slidesPerRow; 19273 var numFullColumns; 19274 var wasMultiRow; 19275 var getSpaceBetween = function getSpaceBetween() { 19276 var spaceBetween = swiper.params.spaceBetween; 19277 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 19278 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size; 19279 } else if (typeof spaceBetween === 'string') { 19280 spaceBetween = parseFloat(spaceBetween); 19281 } 19282 return spaceBetween; 19283 }; 19284 var initSlides = function initSlides(slides) { 19285 var slidesPerView = swiper.params.slidesPerView; 19286 var _swiper$params$grid = swiper.params.grid, 19287 rows = _swiper$params$grid.rows, 19288 fill = _swiper$params$grid.fill; 19289 var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : slides.length; 19290 numFullColumns = Math.floor(slidesLength / rows); 19291 if (Math.floor(slidesLength / rows) === slidesLength / rows) { 19292 slidesNumberEvenToRows = slidesLength; 19293 } else { 19294 slidesNumberEvenToRows = Math.ceil(slidesLength / rows) * rows; 19295 } 19296 if (slidesPerView !== 'auto' && fill === 'row') { 19297 slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, Math.floor(slidesPerView) * rows); 19298 } 19299 slidesPerRow = slidesNumberEvenToRows / rows; 19300 }; 19301 var unsetSlides = function unsetSlides() { 19302 if (swiper.slides) { 19303 swiper.slides.forEach(function (slide) { 19304 if (slide.swiperSlideGridSet) { 19305 slide.style.height = ''; 19306 slide.style[swiper.getDirectionLabel('margin-top')] = ''; 19307 } 19308 }); 19309 } 19310 }; 19311 var updateSlide = function updateSlide(i, slide, slides) { 19312 var slidesPerGroup = swiper.params.slidesPerGroup; 19313 var spaceBetween = getSpaceBetween(); 19314 var _swiper$params$grid2 = swiper.params.grid, 19315 rows = _swiper$params$grid2.rows, 19316 fill = _swiper$params$grid2.fill; 19317 var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : slides.length; 19318 // Set slides order 19319 var newSlideOrderIndex; 19320 var column; 19321 var row; 19322 if (fill === 'row' && slidesPerGroup > 1) { 19323 var groupIndex = Math.floor(i / (slidesPerGroup * rows)); 19324 var slideIndexInGroup = i - rows * slidesPerGroup * groupIndex; 19325 var columnsInGroup = groupIndex === 0 ? slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * rows * slidesPerGroup) / rows), slidesPerGroup); 19326 row = Math.floor(slideIndexInGroup / columnsInGroup); 19327 column = slideIndexInGroup - row * columnsInGroup + groupIndex * slidesPerGroup; 19328 newSlideOrderIndex = column + row * slidesNumberEvenToRows / rows; 19329 slide.style.order = newSlideOrderIndex; 19330 } else if (fill === 'column') { 19331 column = Math.floor(i / rows); 19332 row = i - column * rows; 19333 if (column > numFullColumns || column === numFullColumns && row === rows - 1) { 19334 row += 1; 19335 if (row >= rows) { 19336 row = 0; 19337 column += 1; 19338 } 19339 } 19340 } else { 19341 row = Math.floor(i / slidesPerRow); 19342 column = i - row * slidesPerRow; 19343 } 19344 slide.row = row; 19345 slide.column = column; 19346 slide.style.height = "calc((100% - ".concat((rows - 1) * spaceBetween, "px) / ").concat(rows, ")"); 19347 slide.style[swiper.getDirectionLabel('margin-top')] = row !== 0 ? spaceBetween && "".concat(spaceBetween, "px") : ''; 19348 slide.swiperSlideGridSet = true; 19349 }; 19350 var updateWrapperSize = function updateWrapperSize(slideSize, snapGrid) { 19351 var _swiper$params = swiper.params, 19352 centeredSlides = _swiper$params.centeredSlides, 19353 roundLengths = _swiper$params.roundLengths; 19354 var spaceBetween = getSpaceBetween(); 19355 var rows = swiper.params.grid.rows; 19356 swiper.virtualSize = (slideSize + spaceBetween) * slidesNumberEvenToRows; 19357 swiper.virtualSize = Math.ceil(swiper.virtualSize / rows) - spaceBetween; 19358 if (!swiper.params.cssMode) { 19359 swiper.wrapperEl.style[swiper.getDirectionLabel('width')] = "".concat(swiper.virtualSize + spaceBetween, "px"); 19360 } 19361 if (centeredSlides) { 19362 var newSlidesGrid = []; 19363 for (var i = 0; i < snapGrid.length; i += 1) { 19364 var slidesGridItem = snapGrid[i]; 19365 if (roundLengths) slidesGridItem = Math.floor(slidesGridItem);
19366 if (snapGrid[i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem); 19367 } 19368 snapGrid.splice(0, snapGrid.length); 19369 snapGrid.push.apply(snapGrid, newSlidesGrid); 19370 } 19371 }; 19372 var onInit = function onInit() { 19373 wasMultiRow = swiper.params.grid && swiper.params.grid.rows > 1; 19374 }; 19375 var onUpdate = function onUpdate() { 19376 var params = swiper.params, 19377 el = swiper.el; 19378 var isMultiRow = params.grid && params.grid.rows > 1; 19379 if (wasMultiRow && !isMultiRow) { 19380 el.classList.remove("".concat(params.containerModifierClass, "grid"), "".concat(params.containerModifierClass, "grid-column")); 19381 numFullColumns = 1; 19382 swiper.emitContainerClasses(); 19383 } else if (!wasMultiRow && isMultiRow) { 19384 el.classList.add("".concat(params.containerModifierClass, "grid")); 19385 if (params.grid.fill === 'column') { 19386 el.classList.add("".concat(params.containerModifierClass, "grid-column")); 19387 } 19388 swiper.emitContainerClasses(); 19389 } 19390 wasMultiRow = isMultiRow; 19391 }; 19392 on('init', onInit); 19393 on('update', onUpdate); 19394 swiper.grid = { 19395 initSlides: initSlides, 19396 unsetSlides: unsetSlides, 19397 updateSlide: updateSlide, 19398 updateWrapperSize: updateWrapperSize 19399 }; 19400} 19401 19402},{}],48:[function(require,module,exports){ 19403"use strict"; 19404 19405Object.defineProperty(exports, "__esModule", { 19406 value: true 19407}); 19408exports["default"] = HashNavigation; 19409var _ssrWindowEsm = require("../shared/ssr-window.esm.mjs"); 19410var _utils = require("../shared/utils.mjs"); 19411function HashNavigation(_ref) { 19412 var swiper = _ref.swiper, 19413 extendParams = _ref.extendParams, 19414 emit = _ref.emit, 19415 on = _ref.on; 19416 var initialized = false; 19417 var document = (0, _ssrWindowEsm.g)(); 19418 var window = (0, _ssrWindowEsm.a)(); 19419 extendParams({ 19420 hashNavigation: { 19421 enabled: false, 19422 replaceState: false, 19423 watchState: false, 19424 getSlideIndex: function getSlideIndex(_s, hash) { 19425 if (swiper.virtual && swiper.params.virtual.enabled) { 19426 var slideWithHash = swiper.slides.find(function (slideEl) { 19427 return slideEl.getAttribute('data-hash') === hash; 19428 }); 19429 if (!slideWithHash) return 0; 19430 var index = parseInt(slideWithHash.getAttribute('data-swiper-slide-index'), 10); 19431 return index; 19432 } 19433 return swiper.getSlideIndex((0, _utils.e)(swiper.slidesEl, ".".concat(swiper.params.slideClass, "[data-hash=\"").concat(hash, "\"], swiper-slide[data-hash=\"").concat(hash, "\"]"))[0]); 19434 } 19435 } 19436 }); 19437 var onHashChange = function onHashChange() { 19438 emit('hashChange'); 19439 var newHash = document.location.hash.replace('#', ''); 19440 var activeSlideEl = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector("[data-swiper-slide-index=\"".concat(swiper.activeIndex, "\"]")) : swiper.slides[swiper.activeIndex]; 19441 var activeSlideHash = activeSlideEl ? activeSlideEl.getAttribute('data-hash') : ''; 19442 if (newHash !== activeSlideHash) { 19443 var newIndex = swiper.params.hashNavigation.getSlideIndex(swiper, newHash); 19444 if (typeof newIndex === 'undefined' || Number.isNaN(newIndex)) return; 19445 swiper.slideTo(newIndex); 19446 } 19447 }; 19448 var setHash = function setHash() { 19449 if (!initialized || !swiper.params.hashNavigation.enabled) return; 19450 var activeSlideEl = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector("[data-swiper-slide-index=\"".concat(swiper.activeIndex, "\"]")) : swiper.slides[swiper.activeIndex]; 19451 var activeSlideHash = activeSlideEl ? activeSlideEl.getAttribute('data-hash') || activeSlideEl.getAttribute('data-history') : ''; 19452 if (swiper.params.hashNavigation.replaceState && window.history && window.history.replaceState) { 19453 window.history.replaceState(null, null, "#".concat(activeSlideHash) || ''); 19454 emit('hashSet'); 19455 } else { 19456 document.location.hash = activeSlideHash || ''; 19457 emit('hashSet'); 19458 } 19459 }; 19460 var init = function init() { 19461 if (!swiper.params.hashNavigation.enabled || swiper.params.history && swiper.params.history.enabled) return; 19462 initialized = true; 19463 var hash = document.location.hash.replace('#', ''); 19464 if (hash) { 19465 var speed = 0; 19466 var index = swiper.params.hashNavigation.getSlideIndex(swiper, hash); 19467 swiper.slideTo(index || 0, speed, swiper.params.runCallbacksOnInit, true); 19468 } 19469 if (swiper.params.hashNavigation.watchState) { 19470 window.addEventListener('hashchange', onHashChange); 19471 } 19472 }; 19473 var destroy = function destroy() { 19474 if (swiper.params.hashNavigation.watchState) { 19475 window.removeEventListener('hashchange', onHashChange); 19476 } 19477 }; 19478 on('init', function () { 19479 if (swiper.params.hashNavigation.enabled) { 19480 init(); 19481 } 19482 }); 19483 on('destroy', function () { 19484 if (swiper.params.hashNavigation.enabled) { 19485 destroy(); 19486 } 19487 }); 19488 on('transitionEnd _freeModeNoMomentumRelease', function () { 19489 if (initialized) { 19490 setHash(); 19491 } 19492 }); 19493 on('slideChange', function () { 19494 if (initialized && swiper.params.cssMode) { 19495 setHash(); 19496 } 19497 }); 19498} 19499 19500},{"../shared/ssr-window.esm.mjs":67,"../shared/utils.mjs":69}],49:[function(require,module,exports){ 19501"use strict"; 19502 19503Object.defineProperty(exports, "__esModule", { 19504 value: true 19505}); 19506exports["default"] = History; 19507var _ssrWindowEsm = require("../shared/ssr-window.esm.mjs"); 19508function History(_ref) { 19509 var swiper = _ref.swiper, 19510 extendParams = _ref.extendParams, 19511 on = _ref.on; 19512 extendParams({ 19513 history: { 19514 enabled: false, 19515 root: '', 19516 replaceState: false, 19517 key: 'slides', 19518 keepQuery: false 19519 } 19520 }); 19521 var initialized = false;
19522 var paths = {}; 19523 var slugify = function slugify(text) { 19524 return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, ''); 19525 }; 19526 var getPathValues = function getPathValues(urlOverride) { 19527 var window = (0, _ssrWindowEsm.a)(); 19528 var location; 19529 if (urlOverride) { 19530 location = new URL(urlOverride); 19531 } else { 19532 location = window.location; 19533 } 19534 var pathArray = location.pathname.slice(1).split('/').filter(function (part) { 19535 return part !== ''; 19536 }); 19537 var total = pathArray.length; 19538 var key = pathArray[total - 2]; 19539 var value = pathArray[total - 1]; 19540 return { 19541 key: key, 19542 value: value 19543 }; 19544 }; 19545 var setHistory = function setHistory(key, index) { 19546 var window = (0, _ssrWindowEsm.a)(); 19547 if (!initialized || !swiper.params.history.enabled) return; 19548 var location; 19549 if (swiper.params.url) { 19550 location = new URL(swiper.params.url); 19551 } else { 19552 location = window.location; 19553 } 19554 var slide = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector("[data-swiper-slide-index=\"".concat(index, "\"]")) : swiper.slides[index]; 19555 var value = slugify(slide.getAttribute('data-history')); 19556 if (swiper.params.history.root.length > 0) { 19557 var root = swiper.params.history.root; 19558 if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1); 19559 value = "".concat(root, "/").concat(key ? "".concat(key, "/") : '').concat(value); 19560 } else if (!location.pathname.includes(key)) { 19561 value = "".concat(key ? "".concat(key, "/") : '').concat(value); 19562 } 19563 if (swiper.params.history.keepQuery) { 19564 value += location.search; 19565 } 19566 var currentState = window.history.state; 19567 if (currentState && currentState.value === value) { 19568 return; 19569 } 19570 if (swiper.params.history.replaceState) { 19571 window.history.replaceState({ 19572 value: value 19573 }, null, value); 19574 } else { 19575 window.history.pushState({ 19576 value: value 19577 }, null, value); 19578 } 19579 }; 19580 var scrollToSlide = function scrollToSlide(speed, value, runCallbacks) { 19581 if (value) { 19582 for (var i = 0, length = swiper.slides.length; i < length; i += 1) { 19583 var slide = swiper.slides[i]; 19584 var slideHistory = slugify(slide.getAttribute('data-history')); 19585 if (slideHistory === value) { 19586 var index = swiper.getSlideIndex(slide); 19587 swiper.slideTo(index, speed, runCallbacks); 19588 } 19589 } 19590 } else { 19591 swiper.slideTo(0, speed, runCallbacks); 19592 } 19593 }; 19594 var setHistoryPopState = function setHistoryPopState() { 19595 paths = getPathValues(swiper.params.url); 19596 scrollToSlide(swiper.params.speed, paths.value, false); 19597 }; 19598 var init = function init() { 19599 var window = (0, _ssrWindowEsm.a)(); 19600 if (!swiper.params.history) return; 19601 if (!window.history || !window.history.pushState) { 19602 swiper.params.history.enabled = false; 19603 swiper.params.hashNavigation.enabled = true; 19604 return; 19605 } 19606 initialized = true; 19607 paths = getPathValues(swiper.params.url); 19608 if (!paths.key && !paths.value) { 19609 if (!swiper.params.history.replaceState) { 19610 window.addEventListener('popstate', setHistoryPopState); 19611 } 19612 return; 19613 } 19614 scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit); 19615 if (!swiper.params.history.replaceState) { 19616 window.addEventListener('popstate', setHistoryPopState); 19617 } 19618 }; 19619 var destroy = function destroy() { 19620 var window = (0, _ssrWindowEsm.a)(); 19621 if (!swiper.params.history.replaceState) { 19622 window.removeEventListener('popstate', setHistoryPopState); 19623 } 19624 }; 19625 on('init', function () { 19626 if (swiper.params.history.enabled) { 19627 init(); 19628 } 19629 }); 19630 on('destroy', function () { 19631 if (swiper.params.history.enabled) { 19632 destroy(); 19633 } 19634 }); 19635 on('transitionEnd _freeModeNoMomentumRelease', function () { 19636 if (initialized) { 19637 setHistory(swiper.params.history.key, swiper.activeIndex); 19638 } 19639 }); 19640 on('slideChange', function () { 19641 if (initialized && swiper.params.cssMode) { 19642 setHistory(swiper.params.history.key, swiper.activeIndex); 19643 } 19644 }); 19645} 19646 19647},{"../shared/ssr-window.esm.mjs":67}],50:[function(require,module,exports){ 19648"use strict"; 19649 19650Object.defineProperty(exports, "__esModule", { 19651 value: true 19652}); 19653Object.defineProperty(exports, "A11y", { 19654 enumerable: true, 19655 get: function get() { 19656 return _a11y["default"]; 19657 } 19658}); 19659Object.defineProperty(exports, "Autoplay", { 19660 enumerable: true, 19661 get: function get() { 19662 return _autoplay["default"]; 19663 } 19664}); 19665Object.defineProperty(exports, "Controller", { 19666 enumerable: true, 19667 get: function get() { 19668 return _controller["default"]; 19669 } 19670}); 19671Object.defineProperty(exports, "EffectCards", { 19672 enumerable: true, 19673 get: function get() { 19674 return _effectCards["default"]; 19675 } 19676}); 19677Object.defineProperty(exports, "EffectCoverflow", { 19678 enumerable: true, 19679 get: function get() { 19680 return _effectCoverflow["default"]; 19681 } 19682}); 19683Object.defineProperty(exports, "EffectCreative", { 19684 enumerable: true, 19685 get: function get() { 19686 return _effectCreative["default"]; 19687 } 19688}); 19689Object.defineProperty(exports, "EffectCube", { 19690 enumerable: true, 19691 get: function get() { 19692 return _effectCube["default"]; 19693 } 19694}); 19695Object.defineProperty(exports, "EffectFade", { 19696 enumerable: true, 19697 get: function get() { 19698 return _effectFade["default"]; 19699 } 19700}); 19701Object.defineProperty(exports, "EffectFlip", { 19702 enumerable: true, 19703 get: function get() { 19704 return _effectFlip["default"]; 19705 } 19706}); 19707Object.defineProperty(exports, "FreeMode", { 19708 enumerable: true, 19709 get: function get() { 19710 return _freeMode["default"]; 19711 } 19712}); 19713Object.defineProperty(exports, "Grid", { 19714 enumerable: true, 19715 get: function get() { 19716 return _grid["default"]; 19717 } 19718}); 19719Object.defineProperty(exports, "HashNavigation", { 19720 enumerable: true, 19721 get: function get() { 19722 return _hashNavigation["default"]; 19723 } 19724}); 19725Object.defineProperty(exports, "History", { 19726 enumerable: true, 19727 get: function get() { 19728 return _history["default"]; 19729 } 19730}); 19731Object.defineProperty(exports, "Keyboard", { 19732 enumerable: true, 19733 get: function get() { 19734 return _keyboard["default"]; 19735 } 19736}); 19737Object.defineProperty(exports, "Manipulation", { 19738 enumerable: true, 19739 get: function get() { 19740 return _manipulation["default"]; 19741 } 19742}); 19743Object.defineProperty(exports, "Mousewheel", { 19744 enumerable: true, 19745 get: function get() {
19746 return _mousewheel["default"]; 19747 } 19748}); 19749Object.defineProperty(exports, "Navigation", { 19750 enumerable: true, 19751 get: function get() { 19752 return _navigation["default"]; 19753 } 19754}); 19755Object.defineProperty(exports, "Pagination", { 19756 enumerable: true, 19757 get: function get() { 19758 return _pagination["default"]; 19759 } 19760}); 19761Object.defineProperty(exports, "Parallax", { 19762 enumerable: true, 19763 get: function get() { 19764 return _parallax["default"]; 19765 } 19766}); 19767Object.defineProperty(exports, "Scrollbar", { 19768 enumerable: true, 19769 get: function get() { 19770 return _scrollbar["default"]; 19771 } 19772}); 19773Object.defineProperty(exports, "Thumbs", { 19774 enumerable: true, 19775 get: function get() { 19776 return _thumbs["default"]; 19777 } 19778}); 19779Object.defineProperty(exports, "Virtual", { 19780 enumerable: true, 19781 get: function get() { 19782 return _virtual["default"]; 19783 } 19784}); 19785Object.defineProperty(exports, "Zoom", { 19786 enumerable: true, 19787 get: function get() { 19788 return _zoom["default"]; 19789 } 19790}); 19791var _virtual = _interopRequireDefault(require("./virtual.mjs")); 19792var _keyboard = _interopRequireDefault(require("./keyboard.mjs")); 19793var _mousewheel = _interopRequireDefault(require("./mousewheel.mjs")); 19794var _navigation = _interopRequireDefault(require("./navigation.mjs")); 19795var _pagination = _interopRequireDefault(require("./pagination.mjs")); 19796var _scrollbar = _interopRequireDefault(require("./scrollbar.mjs")); 19797var _parallax = _interopRequireDefault(require("./parallax.mjs")); 19798var _zoom = _interopRequireDefault(require("./zoom.mjs")); 19799var _controller = _interopRequireDefault(require("./controller.mjs")); 19800var _a11y = _interopRequireDefault(require("./a11y.mjs")); 19801var _history = _interopRequireDefault(require("./history.mjs")); 19802var _hashNavigation = _interopRequireDefault(require("./hash-navigation.mjs")); 19803var _autoplay = _interopRequireDefault(require("./autoplay.mjs")); 19804var _thumbs = _interopRequireDefault(require("./thumbs.mjs")); 19805var _freeMode = _interopRequireDefault(require("./free-mode.mjs")); 19806var _grid = _interopRequireDefault(require("./grid.mjs")); 19807var _manipulation = _interopRequireDefault(require("./manipulation.mjs")); 19808var _effectFade = _interopRequireDefault(require("./effect-fade.mjs")); 19809var _effectCube = _interopRequireDefault(require("./effect-cube.mjs")); 19810var _effectFlip = _interopRequireDefault(require("./effect-flip.mjs")); 19811var _effectCoverflow = _interopRequireDefault(require("./effect-coverflow.mjs")); 19812var _effectCreative = _interopRequireDefault(require("./effect-creative.mjs")); 19813var _effectCards = _interopRequireDefault(require("./effect-cards.mjs")); 19814function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 19815 19816},{"./a11y.mjs":37,"./autoplay.mjs":38,"./controller.mjs":39,"./effect-cards.mjs":40,"./effect-coverflow.mjs":41,"./effect-creative.mjs":42,"./effect-cube.mjs":43,"./effect-fade.mjs":44,"./effect-flip.mjs":45,"./free-mode.mjs":46,"./grid.mjs":47,"./hash-navigation.mjs":48,"./history.mjs":49,"./keyboard.mjs":51,"./manipulation.mjs":52,"./mousewheel.mjs":53,"./navigation.mjs":54,"./pagination.mjs":55,"./parallax.mjs":56,"./scrollbar.mjs":57,"./thumbs.mjs":58,"./virtual.mjs":59,"./zoom.mjs":60}],51:[function(require,module,exports){ 19817"use strict"; 19818 19819Object.defineProperty(exports, "__esModule", { 19820 value: true 19821}); 19822exports["default"] = Keyboard; 19823var _ssrWindowEsm = require("../shared/ssr-window.esm.mjs"); 19824var _utils = require("../shared/utils.mjs"); 19825function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 19826/* eslint-disable consistent-return */ 19827function Keyboard(_ref) { 19828 var swiper = _ref.swiper, 19829 extendParams = _ref.extendParams, 19830 on = _ref.on, 19831 emit = _ref.emit; 19832 var document = (0, _ssrWindowEsm.g)(); 19833 var window = (0, _ssrWindowEsm.a)(); 19834 swiper.keyboard = { 19835 enabled: false 19836 }; 19837 extendParams({ 19838 keyboard: { 19839 enabled: false, 19840 onlyInViewport: true, 19841 pageUpDown: true, 19842 speed: undefined 19843 } 19844 }); 19845 function handle(event) { 19846 if (!swiper.enabled) return; 19847 var rtl = swiper.rtlTranslate; 19848 var e = event; 19849 if (e.originalEvent) e = e.originalEvent; // jquery fix 19850 var kc = e.keyCode || e.charCode; 19851 var pageUpDown = swiper.params.keyboard.pageUpDown; 19852 var isPageUp = pageUpDown && kc === 33; 19853 var isPageDown = pageUpDown && kc === 34; 19854 var isArrowLeft = kc === 37; 19855 var isArrowRight = kc === 39; 19856 var isArrowUp = kc === 38; 19857 var isArrowDown = kc === 40; 19858 // Directions locks 19859 if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) { 19860 return false;
19861 } 19862 if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) { 19863 return false; 19864 } 19865 if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) { 19866 return undefined; 19867 } 19868 if (document.activeElement && (document.activeElement.isContentEditable || document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea'))) { 19869 return undefined; 19870 } 19871 if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) { 19872 var inView = false; 19873 // Check that swiper should be inside of visible area of window 19874 if ((0, _utils.d)(swiper.el, ".".concat(swiper.params.slideClass, ", swiper-slide")).length > 0 && (0, _utils.d)(swiper.el, ".".concat(swiper.params.slideActiveClass)).length === 0) { 19875 return undefined; 19876 } 19877 var el = swiper.el; 19878 var swiperWidth = el.clientWidth; 19879 var swiperHeight = el.clientHeight; 19880 var windowWidth = window.innerWidth; 19881 var windowHeight = window.innerHeight; 19882 var swiperOffset = (0, _utils.f)(el); 19883 if (rtl) swiperOffset.left -= el.scrollLeft; 19884 var swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]]; 19885 for (var i = 0; i < swiperCoord.length; i += 1) { 19886 var point = swiperCoord[i]; 19887 if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) { 19888 if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line 19889 inView = true; 19890 } 19891 } 19892 if (!inView) return undefined; 19893 } 19894 var speed = swiper.params.keyboard.speed; 19895 if (swiper.isHorizontal()) { 19896 if (isPageUp || isPageDown || isArrowLeft || isArrowRight) { 19897 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 19898 } 19899 if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext(speed); 19900 if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev(speed); 19901 } else { 19902 if (isPageUp || isPageDown || isArrowUp || isArrowDown) { 19903 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 19904 } 19905 if (isPageDown || isArrowDown) swiper.slideNext(speed); 19906 if (isPageUp || isArrowUp) swiper.slidePrev(speed); 19907 } 19908 emit('keyPress', kc); 19909 return undefined; 19910 } 19911 function enable() { 19912 if (swiper.keyboard.enabled) return; 19913 document.addEventListener('keydown', handle); 19914 swiper.keyboard.enabled = true; 19915 } 19916 function disable() { 19917 if (!swiper.keyboard.enabled) return; 19918 document.removeEventListener('keydown', handle); 19919 swiper.keyboard.enabled = false; 19920 } 19921 on('init', function () { 19922 if (swiper.params.keyboard.enabled) { 19923 enable(); 19924 } 19925 }); 19926 on('destroy', function () { 19927 if (swiper.keyboard.enabled) { 19928 disable(); 19929 } 19930 }); 19931 _extends(swiper.keyboard, { 19932 enable: enable, 19933 disable: disable 19934 }); 19935} 19936 19937},{"../shared/ssr-window.esm.mjs":67,"../shared/utils.mjs":69}],52:[function(require,module,exports){ 19938"use strict"; 19939 19940Object.defineProperty(exports, "__esModule", { 19941 value: true 19942}); 19943exports["default"] = Manipulation; 19944var _utils = require("../shared/utils.mjs"); 19945function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 19946function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 19947function appendSlide(slides) { 19948 var swiper = this; 19949 var params = swiper.params, 19950 slidesEl = swiper.slidesEl; 19951 if (params.loop) { 19952 swiper.loopDestroy(); 19953 } 19954 var appendElement = function appendElement(slideEl) { 19955 if (typeof slideEl === 'string') { 19956 var tempDOM = document.createElement('div'); 19957 (0, _utils.s)(tempDOM, slideEl); 19958 slidesEl.append(tempDOM.children[0]); 19959 (0, _utils.s)(tempDOM, ''); 19960 } else { 19961 slidesEl.append(slideEl); 19962 } 19963 }; 19964 if (_typeof(slides) === 'object' && 'length' in slides) { 19965 for (var i = 0; i < slides.length; i += 1) { 19966 if (slides[i]) appendElement(slides[i]); 19967 } 19968 } else { 19969 appendElement(slides); 19970 } 19971 swiper.recalcSlides(); 19972 if (params.loop) { 19973 swiper.loopCreate(); 19974 } 19975 if (!params.observer || swiper.isElement) {
19976 swiper.update(); 19977 } 19978} 19979function prependSlide(slides) { 19980 var swiper = this; 19981 var params = swiper.params, 19982 activeIndex = swiper.activeIndex, 19983 slidesEl = swiper.slidesEl; 19984 if (params.loop) { 19985 swiper.loopDestroy(); 19986 } 19987 var newActiveIndex = activeIndex + 1; 19988 var prependElement = function prependElement(slideEl) { 19989 if (typeof slideEl === 'string') { 19990 var tempDOM = document.createElement('div'); 19991 (0, _utils.s)(tempDOM, slideEl); 19992 slidesEl.prepend(tempDOM.children[0]); 19993 (0, _utils.s)(tempDOM, ''); 19994 } else { 19995 slidesEl.prepend(slideEl); 19996 } 19997 }; 19998 if (_typeof(slides) === 'object' && 'length' in slides) { 19999 for (var i = 0; i < slides.length; i += 1) { 20000 if (slides[i]) prependElement(slides[i]); 20001 } 20002 newActiveIndex = activeIndex + slides.length; 20003 } else { 20004 prependElement(slides); 20005 } 20006 swiper.recalcSlides(); 20007 if (params.loop) { 20008 swiper.loopCreate(); 20009 } 20010 if (!params.observer || swiper.isElement) { 20011 swiper.update(); 20012 } 20013 swiper.slideTo(newActiveIndex, 0, false); 20014} 20015function addSlide(index, slides) { 20016 var swiper = this; 20017 var params = swiper.params, 20018 activeIndex = swiper.activeIndex, 20019 slidesEl = swiper.slidesEl; 20020 var activeIndexBuffer = activeIndex; 20021 if (params.loop) { 20022 activeIndexBuffer -= swiper.loopedSlides; 20023 swiper.loopDestroy(); 20024 swiper.recalcSlides(); 20025 } 20026 var baseLength = swiper.slides.length; 20027 if (index <= 0) { 20028 swiper.prependSlide(slides); 20029 return; 20030 } 20031 if (index >= baseLength) { 20032 swiper.appendSlide(slides); 20033 return; 20034 } 20035 var newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer; 20036 var slidesBuffer = []; 20037 for (var i = baseLength - 1; i >= index; i -= 1) { 20038 var currentSlide = swiper.slides[i]; 20039 currentSlide.remove(); 20040 slidesBuffer.unshift(currentSlide); 20041 } 20042 if (_typeof(slides) === 'object' && 'length' in slides) { 20043 for (var _i = 0; _i < slides.length; _i += 1) { 20044 if (slides[_i]) slidesEl.append(slides[_i]); 20045 } 20046 newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer; 20047 } else { 20048 slidesEl.append(slides); 20049 } 20050 for (var _i2 = 0; _i2 < slidesBuffer.length; _i2 += 1) { 20051 slidesEl.append(slidesBuffer[_i2]); 20052 } 20053 swiper.recalcSlides(); 20054 if (params.loop) { 20055 swiper.loopCreate(); 20056 } 20057 if (!params.observer || swiper.isElement) { 20058 swiper.update(); 20059 } 20060 if (params.loop) { 20061 swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); 20062 } else { 20063 swiper.slideTo(newActiveIndex, 0, false); 20064 } 20065} 20066function removeSlide(slidesIndexes) { 20067 var swiper = this; 20068 var params = swiper.params, 20069 activeIndex = swiper.activeIndex; 20070 var activeIndexBuffer = activeIndex; 20071 if (params.loop) { 20072 activeIndexBuffer -= swiper.loopedSlides; 20073 swiper.loopDestroy(); 20074 } 20075 var newActiveIndex = activeIndexBuffer; 20076 var indexToRemove; 20077 if (_typeof(slidesIndexes) === 'object' && 'length' in slidesIndexes) { 20078 for (var i = 0; i < slidesIndexes.length; i += 1) { 20079 indexToRemove = slidesIndexes[i]; 20080 if (swiper.slides[indexToRemove]) swiper.slides[indexToRemove].remove(); 20081 if (indexToRemove < newActiveIndex) newActiveIndex -= 1; 20082 } 20083 newActiveIndex = Math.max(newActiveIndex, 0); 20084 } else { 20085 indexToRemove = slidesIndexes; 20086 if (swiper.slides[indexToRemove]) swiper.slides[indexToRemove].remove(); 20087 if (indexToRemove < newActiveIndex) newActiveIndex -= 1; 20088 newActiveIndex = Math.max(newActiveIndex, 0); 20089 } 20090 swiper.recalcSlides(); 20091 if (params.loop) { 20092 swiper.loopCreate(); 20093 } 20094 if (!params.observer || swiper.isElement) { 20095 swiper.update(); 20096 } 20097 if (params.loop) { 20098 swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); 20099 } else { 20100 swiper.slideTo(newActiveIndex, 0, false); 20101 } 20102} 20103function removeAllSlides() { 20104 var swiper = this; 20105 var slidesIndexes = []; 20106 for (var i = 0; i < swiper.slides.length; i += 1) { 20107 slidesIndexes.push(i); 20108 } 20109 swiper.removeSlide(slidesIndexes); 20110} 20111function Manipulation(_ref) { 20112 var swiper = _ref.swiper; 20113 _extends(swiper, { 20114 appendSlide: appendSlide.bind(swiper), 20115 prependSlide: prependSlide.bind(swiper), 20116 addSlide: addSlide.bind(swiper), 20117 removeSlide: removeSlide.bind(swiper), 20118 removeAllSlides: removeAllSlides.bind(swiper) 20119 }); 20120} 20121 20122},{"../shared/utils.mjs":69}],53:[function(require,module,exports){ 20123"use strict"; 20124 20125Object.defineProperty(exports, "__esModule", { 20126 value: true 20127}); 20128exports["default"] = Mousewheel; 20129var _ssrWindowEsm = require("../shared/ssr-window.esm.mjs"); 20130var _utils = require("../shared/utils.mjs"); 20131function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 20132/* eslint-disable consistent-return */ 20133function Mousewheel(_ref) { 20134 var swiper = _ref.swiper, 20135 extendParams = _ref.extendParams, 20136 on = _ref.on, 20137 emit = _ref.emit; 20138 var window = (0, _ssrWindowEsm.a)(); 20139 extendParams({ 20140 mousewheel: { 20141 enabled: false, 20142 releaseOnEdges: false, 20143 invert: false,
vendor: 4,312 bytes, lines 20144-20289
20144 forceToAxis: false, 20145 sensitivity: 1, 20146 eventsTarget: 'container', 20147 thresholdDelta: null, 20148 thresholdTime: null, 20149 noMousewheelClass: 'swiper-no-mousewheel' 20150 } 20151 }); 20152 swiper.mousewheel = { 20153 enabled: false 20154 }; 20155 var timeout; 20156 var lastScrollTime = (0, _utils.h)(); 20157 var lastEventBeforeSnap; 20158 var recentWheelEvents = []; 20159 function normalize(e) { 20160 // Reasonable defaults 20161 var PIXEL_STEP = 10; 20162 var LINE_HEIGHT = 40; 20163 var PAGE_HEIGHT = 800; 20164 var sX = 0; 20165 var sY = 0; // spinX, spinY 20166 var pX = 0; 20167 var pY = 0; // pixelX, pixelY 20168 20169 // Legacy 20170 if ('detail' in e) { 20171 sY = e.detail; 20172 } 20173 if ('wheelDelta' in e) { 20174 sY = -e.wheelDelta / 120; 20175 } 20176 if ('wheelDeltaY' in e) { 20177 sY = -e.wheelDeltaY / 120; 20178 } 20179 if ('wheelDeltaX' in e) { 20180 sX = -e.wheelDeltaX / 120; 20181 } 20182 20183 // side scrolling on FF with DOMMouseScroll 20184 if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) { 20185 sX = sY; 20186 sY = 0; 20187 } 20188 pX = sX * PIXEL_STEP; 20189 pY = sY * PIXEL_STEP; 20190 if ('deltaY' in e) { 20191 pY = e.deltaY; 20192 } 20193 if ('deltaX' in e) { 20194 pX = e.deltaX; 20195 } 20196 if (e.shiftKey && !pX) { 20197 // if user scrolls with shift he wants horizontal scroll 20198 pX = pY; 20199 pY = 0; 20200 } 20201 if ((pX || pY) && e.deltaMode) { 20202 if (e.deltaMode === 1) { 20203 // delta in LINE units 20204 pX *= LINE_HEIGHT; 20205 pY *= LINE_HEIGHT; 20206 } else { 20207 // delta in PAGE units 20208 pX *= PAGE_HEIGHT; 20209 pY *= PAGE_HEIGHT; 20210 } 20211 } 20212 20213 // Fall-back if spin cannot be determined 20214 if (pX && !sX) { 20215 sX = pX < 1 ? -1 : 1; 20216 } 20217 if (pY && !sY) { 20218 sY = pY < 1 ? -1 : 1; 20219 } 20220 return { 20221 spinX: sX, 20222 spinY: sY, 20223 pixelX: pX, 20224 pixelY: pY 20225 }; 20226 } 20227 function handleMouseEnter() { 20228 if (!swiper.enabled) return; 20229 swiper.mouseEntered = true; 20230 } 20231 function handleMouseLeave() { 20232 if (!swiper.enabled) return; 20233 swiper.mouseEntered = false; 20234 } 20235 function animateSlider(newEvent) { 20236 if (swiper.params.mousewheel.thresholdDelta && newEvent.delta < swiper.params.mousewheel.thresholdDelta) { 20237 // Prevent if delta of wheel scroll delta is below configured threshold 20238 return false; 20239 } 20240 if (swiper.params.mousewheel.thresholdTime && (0, _utils.h)() - lastScrollTime < swiper.params.mousewheel.thresholdTime) { 20241 // Prevent if time between scrolls is below configured threshold 20242 return false; 20243 } 20244 20245 // If the movement is NOT big enough and 20246 // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider): 20247 // Don't go any further (avoid insignificant scroll movement). 20248 if (newEvent.delta >= 6 && (0, _utils.h)() - lastScrollTime < 60) { 20249 // Return false as a default 20250 return true; 20251 } 20252 // If user is scrolling towards the end: 20253 // If the slider hasn't hit the latest slide or 20254 // if the slider is a loop and 20255 // if the slider isn't moving right now: 20256 // Go to next slide and 20257 // emit a scroll event. 20258 // Else (the user is scrolling towards the beginning) and 20259 // if the slider hasn't hit the first slide or 20260 // if the slider is a loop and 20261 // if the slider isn't moving right now: 20262 // Go to prev slide and 20263 // emit a scroll event. 20264 if (newEvent.direction < 0) { 20265 if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) { 20266 swiper.slideNext(); 20267 emit('scroll', newEvent.raw); 20268 } 20269 } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) { 20270 swiper.slidePrev(); 20271 emit('scroll', newEvent.raw); 20272 } 20273 // If you got here is because an animation has been triggered so store the current time 20274 lastScrollTime = new window.Date().getTime(); 20275 // Return false as a default 20276 return false; 20277 } 20278 function releaseScroll(newEvent) { 20279 var params = swiper.params.mousewheel; 20280 if (newEvent.direction < 0) { 20281 if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) { 20282 // Return true to animate scroll on edges 20283 return true; 20284 } 20285 } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) { 20286 // Return true to animate scroll on edges 20287 return true; 20288 } 20289 return false;
20290 } 20291 function handle(event) { 20292 var e = event; 20293 var disableParentSwiper = true; 20294 if (!swiper.enabled) return; 20295 20296 // Ignore event if the target or its parents have the swiper-no-mousewheel class 20297 if (event.target.closest(".".concat(swiper.params.mousewheel.noMousewheelClass))) return; 20298 var params = swiper.params.mousewheel; 20299 if (swiper.params.cssMode) { 20300 e.preventDefault(); 20301 } 20302 var targetEl = swiper.el; 20303 if (swiper.params.mousewheel.eventsTarget !== 'container') { 20304 targetEl = document.querySelector(swiper.params.mousewheel.eventsTarget); 20305 } 20306 var targetElContainsTarget = targetEl && targetEl.contains(e.target); 20307 if (!swiper.mouseEntered && !targetElContainsTarget && !params.releaseOnEdges) return true; 20308 if (e.originalEvent) e = e.originalEvent; // jquery fix 20309 var delta = 0; 20310 var rtlFactor = swiper.rtlTranslate ? -1 : 1; 20311 var data = normalize(e); 20312 if (params.forceToAxis) { 20313 if (swiper.isHorizontal()) { 20314 if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor;else return true; 20315 } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY;else return true; 20316 } else { 20317 delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY; 20318 } 20319 if (delta === 0) return true; 20320 if (params.invert) delta = -delta; 20321 20322 // Get the scroll positions 20323 var positions = swiper.getTranslate() + delta * params.sensitivity; 20324 if (positions >= swiper.minTranslate()) positions = swiper.minTranslate(); 20325 if (positions <= swiper.maxTranslate()) positions = swiper.maxTranslate(); 20326 20327 // When loop is true: 20328 // the disableParentSwiper will be true. 20329 // When loop is false: 20330 // if the scroll positions is not on edge, 20331 // then the disableParentSwiper will be true. 20332 // if the scroll on edge positions, 20333 // then the disableParentSwiper will be false. 20334 disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate()); 20335 if (disableParentSwiper && swiper.params.nested) e.stopPropagation(); 20336 if (!swiper.params.freeMode || !swiper.params.freeMode.enabled) { 20337 // Register the new event in a variable which stores the relevant data 20338 var newEvent = { 20339 time: (0, _utils.h)(), 20340 delta: Math.abs(delta), 20341 direction: Math.sign(delta), 20342 raw: event 20343 }; 20344 20345 // Keep the most recent events 20346 if (recentWheelEvents.length >= 2) { 20347 recentWheelEvents.shift(); // only store the last N events 20348 } 20349 var prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; 20350 recentWheelEvents.push(newEvent); 20351 20352 // If there is at least one previous recorded event: 20353 // If direction has changed or 20354 // if the scroll is quicker than the previous one: 20355 // Animate the slider. 20356 // Else (this is the first time the wheel is moved): 20357 // Animate the slider. 20358 if (prevEvent) { 20359 if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) { 20360 animateSlider(newEvent); 20361 } 20362 } else { 20363 animateSlider(newEvent); 20364 } 20365 20366 // If it's time to release the scroll: 20367 // Return now so you don't hit the preventDefault. 20368 if (releaseScroll(newEvent)) { 20369 return true; 20370 } 20371 } else { 20372 // Freemode or scrollContainer: 20373 20374 // If we recently snapped after a momentum scroll, then ignore wheel events 20375 // to give time for the deceleration to finish. Stop ignoring after 500 msecs 20376 // or if it's a new scroll (larger delta or inverse sign as last event before 20377 // an end-of-momentum snap). 20378 var _newEvent = { 20379 time: (0, _utils.h)(), 20380 delta: Math.abs(delta), 20381 direction: Math.sign(delta) 20382 }; 20383 var ignoreWheelEvents = lastEventBeforeSnap && _newEvent.time < lastEventBeforeSnap.time + 500 && _newEvent.delta <= lastEventBeforeSnap.delta && _newEvent.direction === lastEventBeforeSnap.direction; 20384 if (!ignoreWheelEvents) { 20385 lastEventBeforeSnap = undefined; 20386 var position = swiper.getTranslate() + delta * params.sensitivity; 20387 var wasBeginning = swiper.isBeginning; 20388 var wasEnd = swiper.isEnd; 20389 if (position >= swiper.minTranslate()) position = swiper.minTranslate(); 20390 if (position <= swiper.maxTranslate()) position = swiper.maxTranslate(); 20391 swiper.setTransition(0); 20392 swiper.setTranslate(position); 20393 swiper.updateProgress(); 20394 swiper.updateActiveIndex(); 20395 swiper.updateSlidesClasses(); 20396 if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) { 20397 swiper.updateSlidesClasses(); 20398 } 20399 if (swiper.params.loop) { 20400 swiper.loopFix({ 20401 direction: _newEvent.direction < 0 ? 'next' : 'prev', 20402 byMousewheel: true 20403 }); 20404 } 20405 if (swiper.params.freeMode.sticky) { 20406 // When wheel scrolling starts with sticky (aka snap) enabled, then detect 20407 // the end of a momentum scroll by storing recent (N=15?) wheel events.
vendor: 4,190 bytes, lines 20408-20485
20408 // 1. do all N events have decreasing or same (absolute value) delta? 20409 // 2. did all N events arrive in the last M (M=500?) msecs? 20410 // 3. does the earliest event have an (absolute value) delta that's 20411 // at least P (P=1?) larger than the most recent event's delta? 20412 // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels? 20413 // If 1-4 are "yes" then we're near the end of a momentum scroll deceleration. 20414 // Snap immediately and ignore remaining wheel events in this scroll. 20415 // See comment above for "remaining wheel events in this scroll" determination. 20416 // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event. 20417 clearTimeout(timeout); 20418 timeout = undefined; 20419 if (recentWheelEvents.length >= 15) { 20420 recentWheelEvents.shift(); // only store the last N events 20421 } 20422 var _prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; 20423 var firstEvent = recentWheelEvents[0]; 20424 recentWheelEvents.push(_newEvent); 20425 if (_prevEvent && (_newEvent.delta > _prevEvent.delta || _newEvent.direction !== _prevEvent.direction)) { 20426 // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log. 20427 recentWheelEvents.splice(0); 20428 } else if (recentWheelEvents.length >= 15 && _newEvent.time - firstEvent.time < 500 && firstEvent.delta - _newEvent.delta >= 1 && _newEvent.delta <= 6) { 20429 // We're at the end of the deceleration of a momentum scroll, so there's no need 20430 // to wait for more events. Snap ASAP on the next tick. 20431 // Also, because there's some remaining momentum we'll bias the snap in the 20432 // direction of the ongoing scroll because it's better UX for the scroll to snap 20433 // in the same direction as the scroll instead of reversing to snap. Therefore, 20434 // if it's already scrolled more than 20% in the current direction, keep going. 20435 var snapToThreshold = delta > 0 ? 0.8 : 0.2; 20436 lastEventBeforeSnap = _newEvent; 20437 recentWheelEvents.splice(0); 20438 timeout = (0, _utils.n)(function () { 20439 if (swiper.destroyed || !swiper.params) return; 20440 swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); 20441 }, 0); // no delay; move on next tick 20442 } 20443 if (!timeout) { 20444 // if we get here, then we haven't detected the end of a momentum scroll, so 20445 // we'll consider a scroll "complete" when there haven't been any wheel events 20446 // for 500ms. 20447 timeout = (0, _utils.n)(function () { 20448 if (swiper.destroyed || !swiper.params) return; 20449 var snapToThreshold = 0.5; 20450 lastEventBeforeSnap = _newEvent; 20451 recentWheelEvents.splice(0); 20452 swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); 20453 }, 500); 20454 } 20455 } 20456 20457 // Emit event 20458 if (!ignoreWheelEvents) emit('scroll', e); 20459 20460 // Stop autoplay 20461 if (swiper.params.autoplay && swiper.params.autoplay.disableOnInteraction) swiper.autoplay.stop(); 20462 // Return page scroll on edge positions 20463 if (params.releaseOnEdges && (position === swiper.minTranslate() || position === swiper.maxTranslate())) { 20464 return true; 20465 } 20466 } 20467 } 20468 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 20469 return false; 20470 } 20471 function events(method) { 20472 var targetEl = swiper.el; 20473 if (swiper.params.mousewheel.eventsTarget !== 'container') { 20474 targetEl = document.querySelector(swiper.params.mousewheel.eventsTarget); 20475 } 20476 targetEl[method]('mouseenter', handleMouseEnter); 20477 targetEl[method]('mouseleave', handleMouseLeave); 20478 targetEl[method]('wheel', handle); 20479 } 20480 function enable() { 20481 if (swiper.params.cssMode) { 20482 swiper.wrapperEl.removeEventListener('wheel', handle); 20483 return true; 20484 } 20485 if (swiper.mousewheel.enabled) return false;
20486 events('addEventListener'); 20487 swiper.mousewheel.enabled = true; 20488 return true; 20489 } 20490 function disable() { 20491 if (swiper.params.cssMode) { 20492 swiper.wrapperEl.addEventListener(event, handle); 20493 return true; 20494 } 20495 if (!swiper.mousewheel.enabled) return false; 20496 events('removeEventListener'); 20497 swiper.mousewheel.enabled = false; 20498 return true; 20499 } 20500 on('init', function () { 20501 if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) { 20502 disable(); 20503 } 20504 if (swiper.params.mousewheel.enabled) enable(); 20505 }); 20506 on('destroy', function () { 20507 if (swiper.params.cssMode) { 20508 enable(); 20509 } 20510 if (swiper.mousewheel.enabled) disable(); 20511 }); 20512 _extends(swiper.mousewheel, { 20513 enable: enable, 20514 disable: disable 20515 }); 20516} 20517 20518},{"../shared/ssr-window.esm.mjs":67,"../shared/utils.mjs":69}],54:[function(require,module,exports){ 20519"use strict"; 20520 20521Object.defineProperty(exports, "__esModule", { 20522 value: true 20523}); 20524exports["default"] = Navigation; 20525var _createElementIfNotDefined = require("../shared/create-element-if-not-defined.mjs"); 20526var _utils = require("../shared/utils.mjs"); 20527function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 20528function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } 20529function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 20530function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 20531function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } 20532function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } 20533function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 20534var arrowSvg = "<svg class=\"swiper-navigation-icon\" width=\"11\" height=\"20\" viewBox=\"0 0 11 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M0.38296 20.0762C0.111788 19.805 0.111788 19.3654 0.38296 19.0942L9.19758 10.2796L0.38296 1.46497C0.111788 1.19379 0.111788 0.754138 0.38296 0.482966C0.654131 0.211794 1.09379 0.211794 1.36496 0.482966L10.4341 9.55214C10.8359 9.9539 10.8359 10.6053 10.4341 11.007L1.36496 20.0762C1.09379 20.3474 0.654131 20.3474 0.38296 20.0762Z\" fill=\"currentColor\"/></svg>"; 20535function Navigation(_ref) { 20536 var swiper = _ref.swiper, 20537 extendParams = _ref.extendParams, 20538 on = _ref.on, 20539 emit = _ref.emit; 20540 extendParams({ 20541 navigation: { 20542 nextEl: null, 20543 prevEl: null, 20544 addIcons: true, 20545 hideOnClick: false, 20546 disabledClass: 'swiper-button-disabled', 20547 hiddenClass: 'swiper-button-hidden', 20548 lockClass: 'swiper-button-lock', 20549 navigationDisabledClass: 'swiper-navigation-disabled' 20550 } 20551 }); 20552 swiper.navigation = { 20553 nextEl: null, 20554 prevEl: null, 20555 arrowSvg: arrowSvg 20556 }; 20557 function getEl(el) { 20558 var res; 20559 if (el && typeof el === 'string' && swiper.isElement) { 20560 res = swiper.el.querySelector(el) || swiper.hostEl.querySelector(el); 20561 if (res) return res; 20562 } 20563 if (el) { 20564 if (typeof el === 'string') res = _toConsumableArray(document.querySelectorAll(el)); 20565 if (swiper.params.uniqueNavElements && typeof el === 'string' && res && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) { 20566 res = swiper.el.querySelector(el); 20567 } else if (res && res.length === 1) { 20568 res = res[0]; 20569 } 20570 } 20571 if (el && !res) return el; 20572 // if (Array.isArray(res) && res.length === 1) res = res[0]; 20573 return res; 20574 } 20575 function toggleEl(el, disabled) { 20576 var params = swiper.params.navigation; 20577 el = (0, _utils.m)(el); 20578 el.forEach(function (subEl) { 20579 if (subEl) { 20580 var _subEl$classList; 20581 (_subEl$classList = subEl.classList)[disabled ? 'add' : 'remove'].apply(_subEl$classList, _toConsumableArray(params.disabledClass.split(' '))); 20582 if (subEl.tagName === 'BUTTON') subEl.disabled = disabled; 20583 if (swiper.params.watchOverflow && swiper.enabled) { 20584 subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass); 20585 } 20586 } 20587 }); 20588 }
20589 function update() { 20590 // Update Navigation Buttons 20591 var _swiper$navigation = swiper.navigation, 20592 nextEl = _swiper$navigation.nextEl, 20593 prevEl = _swiper$navigation.prevEl; 20594 if (swiper.params.loop) { 20595 toggleEl(prevEl, false); 20596 toggleEl(nextEl, false); 20597 return; 20598 } 20599 toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind); 20600 toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind); 20601 } 20602 function onPrevClick(e) { 20603 e.preventDefault(); 20604 if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return; 20605 swiper.slidePrev(); 20606 emit('navigationPrev'); 20607 } 20608 function onNextClick(e) { 20609 e.preventDefault(); 20610 if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return; 20611 swiper.slideNext(); 20612 emit('navigationNext'); 20613 } 20614 function init() { 20615 var params = swiper.params.navigation; 20616 swiper.params.navigation = (0, _createElementIfNotDefined.c)(swiper, swiper.originalParams.navigation, swiper.params.navigation, { 20617 nextEl: 'swiper-button-next', 20618 prevEl: 'swiper-button-prev' 20619 }); 20620 if (!(params.nextEl || params.prevEl)) return; 20621 var nextEl = getEl(params.nextEl); 20622 var prevEl = getEl(params.prevEl); 20623 _extends(swiper.navigation, { 20624 nextEl: nextEl, 20625 prevEl: prevEl 20626 }); 20627 nextEl = (0, _utils.m)(nextEl); 20628 prevEl = (0, _utils.m)(prevEl); 20629 var initButton = function initButton(el, dir) { 20630 if (el) { 20631 if (params.addIcons && el.matches('.swiper-button-next,.swiper-button-prev') && !el.querySelector('svg')) { 20632 var tempEl = document.createElement('div'); 20633 (0, _utils.s)(tempEl, arrowSvg); 20634 el.appendChild(tempEl.querySelector('svg')); 20635 tempEl.remove(); 20636 } 20637 el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick); 20638 } 20639 if (!swiper.enabled && el) { 20640 var _el$classList; 20641 (_el$classList = el.classList).add.apply(_el$classList, _toConsumableArray(params.lockClass.split(' '))); 20642 } 20643 }; 20644 nextEl.forEach(function (el) { 20645 return initButton(el, 'next'); 20646 }); 20647 prevEl.forEach(function (el) { 20648 return initButton(el, 'prev'); 20649 }); 20650 } 20651 function destroy() { 20652 var _swiper$navigation2 = swiper.navigation, 20653 nextEl = _swiper$navigation2.nextEl, 20654 prevEl = _swiper$navigation2.prevEl; 20655 nextEl = (0, _utils.m)(nextEl); 20656 prevEl = (0, _utils.m)(prevEl); 20657 var destroyButton = function destroyButton(el, dir) { 20658 var _el$classList2; 20659 el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick); 20660 (_el$classList2 = el.classList).remove.apply(_el$classList2, _toConsumableArray(swiper.params.navigation.disabledClass.split(' '))); 20661 }; 20662 nextEl.forEach(function (el) { 20663 return destroyButton(el, 'next'); 20664 }); 20665 prevEl.forEach(function (el) { 20666 return destroyButton(el, 'prev'); 20667 }); 20668 } 20669 on('init', function () { 20670 if (swiper.params.navigation.enabled === false) { 20671 // eslint-disable-next-line 20672 disable(); 20673 } else { 20674 init(); 20675 update(); 20676 } 20677 }); 20678 on('toEdge fromEdge lock unlock', function () { 20679 update(); 20680 }); 20681 on('destroy', function () { 20682 destroy(); 20683 }); 20684 on('enable disable', function () { 20685 var _swiper$navigation3 = swiper.navigation, 20686 nextEl = _swiper$navigation3.nextEl, 20687 prevEl = _swiper$navigation3.prevEl; 20688 nextEl = (0, _utils.m)(nextEl); 20689 prevEl = (0, _utils.m)(prevEl); 20690 if (swiper.enabled) { 20691 update(); 20692 return; 20693 } 20694 [].concat(_toConsumableArray(nextEl), _toConsumableArray(prevEl)).filter(function (el) { 20695 return !!el; 20696 }
20696).forEach(function (el) { 20697 return el.classList.add(swiper.params.navigation.lockClass); 20698 }); 20699 }); 20700 on('click', function (_s, e) { 20701 var _swiper$navigation4 = swiper.navigation, 20702 nextEl = _swiper$navigation4.nextEl, 20703 prevEl = _swiper$navigation4.prevEl; 20704 nextEl = (0, _utils.m)(nextEl); 20705 prevEl = (0, _utils.m)(prevEl); 20706 var targetEl = e.target; 20707 var targetIsButton = prevEl.includes(targetEl) || nextEl.includes(targetEl); 20708 if (swiper.isElement && !targetIsButton) { 20709 var path = e.path || e.composedPath && e.composedPath(); 20710 if (path) { 20711 targetIsButton = path.find(function (pathEl) { 20712 return nextEl.includes(pathEl) || prevEl.includes(pathEl); 20713 }); 20714 } 20715 } 20716 if (swiper.params.navigation.hideOnClick && !targetIsButton) { 20717 if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return; 20718 var isHidden; 20719 if (nextEl.length) { 20720 isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass); 20721 } else if (prevEl.length) { 20722 isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass); 20723 } 20724 if (isHidden === true) { 20725 emit('navigationShow'); 20726 } else { 20727 emit('navigationHide'); 20728 } 20729 [].concat(_toConsumableArray(nextEl), _toConsumableArray(prevEl)).filter(function (el) { 20730 return !!el; 20731 }
20731).forEach(function (el) { 20732 return el.classList.toggle(swiper.params.navigation.hiddenClass); 20733 }); 20734 } 20735 }); 20736 var enable = function enable() { 20737 var _swiper$el$classList; 20738 (_swiper$el$classList = swiper.el.classList).remove.apply(_swiper$el$classList, _toConsumableArray(swiper.params.navigation.navigationDisabledClass.split(' '))); 20739 init(); 20740 update(); 20741 }; 20742 var disable = function disable() { 20743 var _swiper$el$classList2; 20744 (_swiper$el$classList2 = swiper.el.classList).add.apply(_swiper$el$classList2, _toConsumableArray(swiper.params.navigation.navigationDisabledClass.split(' '))); 20745 destroy(); 20746 }; 20747 _extends(swiper.navigation, { 20748 enable: enable, 20749 disable: disable, 20750 update: update, 20751 init: init, 20752 destroy: destroy 20753 }); 20754} 20755 20756},{"../shared/create-element-if-not-defined.mjs":62,"../shared/utils.mjs":69}],55:[function(require,module,exports){ 20757"use strict"; 20758 20759Object.defineProperty(exports, "__esModule", { 20760 value: true 20761}); 20762exports["default"] = Pagination; 20763var _classesToSelector = require("../shared/classes-to-selector.mjs"); 20764var _createElementIfNotDefined = require("../shared/create-element-if-not-defined.mjs"); 20765var _utils = require("../shared/utils.mjs"); 20766function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 20767function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } 20768function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 20769function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 20770function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } 20771function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } 20772function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 20773function Pagination(_ref) { 20774 var swiper = _ref.swiper, 20775 extendParams = _ref.extendParams, 20776 on = _ref.on, 20777 emit = _ref.emit; 20778 var pfx = 'swiper-pagination'; 20779 extendParams({ 20780 pagination: { 20781 el: null, 20782 bulletElement: 'span', 20783 clickable: false, 20784 hideOnClick: false, 20785 renderBullet: null, 20786 renderProgressbar: null, 20787 renderFraction: null, 20788 renderCustom: null, 20789 progressbarOpposite: false, 20790 type: 'bullets', 20791 // 'bullets' or 'progressbar' or 'fraction' or 'custom' 20792 dynamicBullets: false, 20793 dynamicMainBullets: 1, 20794 formatFractionCurrent: function formatFractionCurrent(number) { 20795 return number; 20796 }, 20797 formatFractionTotal: function formatFractionTotal(number) { 20798 return number; 20799 }, 20800 bulletClass: "".concat(pfx, "-bullet"), 20801 bulletActiveClass: "".concat(pfx, "-bullet-active"), 20802 modifierClass: "".concat(pfx, "-"), 20803 currentClass: "".concat(pfx, "-current"), 20804 totalClass: "".concat(pfx, "-total"), 20805 hiddenClass: "".concat(pfx, "-hidden"), 20806 progressbarFillClass: "".concat(pfx, "-progressbar-fill"), 20807 progressbarOppositeClass: "".concat(pfx, "-progressbar-opposite"), 20808 clickableClass: "".concat(pfx, "-clickable"), 20809 lockClass: "".concat(pfx, "-lock"), 20810 horizontalClass: "".concat(pfx, "-horizontal"), 20811 verticalClass: "".concat(pfx, "-vertical"), 20812 paginationDisabledClass: "".concat(pfx, "-disabled") 20813 } 20814 }); 20815 swiper.pagination = { 20816 el: null, 20817 bullets: [] 20818 }; 20819 var bulletSize; 20820 var dynamicBulletIndex = 0; 20821 function isPaginationDisabled() { 20822 return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0; 20823 } 20824 function setSideBullets(bulletEl, position) { 20825 var bulletActiveClass = swiper.params.pagination.bulletActiveClass; 20826 if (!bulletEl) return; 20827 bulletEl = bulletEl["".concat(position === 'prev' ? 'previous' : 'next', "ElementSibling")]; 20828 if (bulletEl) { 20829 bulletEl.classList.add("".concat(bulletActiveClass, "-").concat(position)); 20830 bulletEl = bulletEl["".concat(position === 'prev' ? 'previous' : 'next', "ElementSibling")]; 20831 if (bulletEl) { 20832 bulletEl.classList.add("".concat(bulletActiveClass, "-").concat(position, "-").concat(position)); 20833 } 20834 } 20835 } 20836 function getMoveDirection(prevIndex, nextIndex, length) { 20837 prevIndex = prevIndex % length; 20838 nextIndex = nextIndex % length; 20839 if (nextIndex === prevIndex + 1) { 20840 return 'next'; 20841 } else if (nextIndex === prevIndex - 1) { 20842 return 'previous'; 20843 } 20844 return; 20845 } 20846 function onBulletClick(e) { 20847 var bulletEl = e.target.closest((0, _classesToSelector.c)(swiper.params.pagination.bulletClass)); 20848 if (!bulletEl) { 20849 return; 20850 } 20851 e.preventDefault(); 20852 var index = (0, _utils.j)(bulletEl) * swiper.params.slidesPerGroup; 20853 if (swiper.params.loop) { 20854 if (swiper.realIndex === index) return; 20855 var moveDirection = getMoveDirection(swiper.realIndex, index, swiper.slides.length); 20856 if (moveDirection === 'next') { 20857 swiper.slideNext(); 20858 } else if (moveDirection === 'previous') { 20859 swiper.slidePrev(); 20860 } else { 20861 swiper.slideToLoop(index); 20862 } 20863 } else { 20864 swiper.slideTo(index); 20865 } 20866 }
20867 function update() { 20868 // Render || Update Pagination bullets/items 20869 var rtl = swiper.rtl; 20870 var params = swiper.params.pagination; 20871 if (isPaginationDisabled()) return; 20872 var el = swiper.pagination.el; 20873 el = (0, _utils.m)(el); 20874 // Current/Total 20875 var current; 20876 var previousIndex; 20877 var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; 20878 var total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 20879 if (swiper.params.loop) { 20880 previousIndex = swiper.previousRealIndex || 0; 20881 current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex; 20882 } else if (typeof swiper.snapIndex !== 'undefined') { 20883 current = swiper.snapIndex; 20884 previousIndex = swiper.previousSnapIndex; 20885 } else { 20886 previousIndex = swiper.previousIndex || 0; 20887 current = swiper.activeIndex || 0; 20888 } 20889 // Types 20890 if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) { 20891 var bullets = swiper.pagination.bullets; 20892 var firstIndex; 20893 var lastIndex; 20894 var midIndex; 20895 if (params.dynamicBullets) { 20896 bulletSize = (0, _utils.i)(bullets[0], swiper.isHorizontal() ? 'width' : 'height', true); 20897 el.forEach(function (subEl) { 20898 subEl.style[swiper.isHorizontal() ? 'width' : 'height'] = "".concat(bulletSize * (params.dynamicMainBullets + 4), "px"); 20899 }); 20900 if (params.dynamicMainBullets > 1 && previousIndex !== undefined) { 20901 dynamicBulletIndex += current - (previousIndex || 0); 20902 if (dynamicBulletIndex > params.dynamicMainBullets - 1) { 20903 dynamicBulletIndex = params.dynamicMainBullets - 1; 20904 } else if (dynamicBulletIndex < 0) { 20905 dynamicBulletIndex = 0; 20906 } 20907 } 20908 firstIndex = Math.max(current - dynamicBulletIndex, 0); 20909 lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1); 20910 midIndex = (lastIndex + firstIndex) / 2; 20911 } 20912 bullets.forEach(function (bulletEl) { 20913 var _bulletEl$classList; 20914 var classesToRemove = _toConsumableArray(['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(function (suffix) { 20915 return "".concat(params.bulletActiveClass).concat(suffix); 20916 })).map(function (s) { 20917 return typeof s === 'string' && s.includes(' ') ? s.split(' ') : s; 20918 }).flat(); 20919 (_bulletEl$classList = bulletEl.classList).remove.apply(_bulletEl$classList, _toConsumableArray(classesToRemove)); 20920 }); 20921 if (el.length > 1) { 20922 bullets.forEach(function (bullet) { 20923 var bulletIndex = (0, _utils.j)(bullet); 20924 if (bulletIndex === current) { 20925 var _bullet$classList; 20926 (_bullet$classList = bullet.classList).add.apply(_bullet$classList, _toConsumableArray(params.bulletActiveClass.split(' '))); 20927 } else if (swiper.isElement) { 20928 bullet.setAttribute('part', 'bullet'); 20929 } 20930 if (params.dynamicBullets) { 20931 if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) { 20932 var _bullet$classList2; 20933 (_bullet$classList2 = bullet.classList).add.apply(_bullet$classList2, _toConsumableArray("".concat(params.bulletActiveClass, "-main").split(' '))); 20934 } 20935 if (bulletIndex === firstIndex) { 20936 setSideBullets(bullet, 'prev'); 20937 } 20938 if (bulletIndex === lastIndex) { 20939 setSideBullets(bullet, 'next'); 20940 } 20941 } 20942 }); 20943 } else { 20944 var bullet = bullets[current]; 20945 if (bullet) { 20946 var _bullet$classList3; 20947 (_bullet$classList3 = bullet.classList).add.apply(_bullet$classList3, _toConsumableArray(params.bulletActiveClass.split(' '))); 20948 } 20949 if (swiper.isElement) { 20950 bullets.forEach(function (bulletEl, bulletIndex) { 20951 bulletEl.setAttribute('part', bulletIndex === current ? 'bullet-active' : 'bullet'); 20952 }); 20953 } 20954 if (params.dynamicBullets) { 20955 var firstDisplayedBullet = bullets[firstIndex]; 20956 var lastDisplayedBullet = bullets[lastIndex]; 20957 for (var i = firstIndex; i <= lastIndex; i += 1) { 20958 if (bullets[i]) { 20959 var _bullets$i$classList; 20960 (_bullets$i$classList = bullets[i].classList).add.apply(_bullets$i$classList, _toConsumableArray("".concat(params.bulletActiveClass, "-main").split(' '))); 20961 } 20962 } 20963 setSideBullets(firstDisplayedBullet, 'prev'); 20964 setSideBullets(lastDisplayedBullet, 'next'); 20965 } 20966 } 20967 if (params.dynamicBullets) { 20968 var dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4); 20969 var bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize; 20970 var offsetProp = rtl ? 'right' : 'left';
20971 bullets.forEach(function (bullet) { 20972 bullet.style[swiper.isHorizontal() ? offsetProp : 'top'] = "".concat(bulletsOffset, "px"); 20973 }); 20974 } 20975 } 20976 el.forEach(function (subEl, subElIndex) { 20977 if (params.type === 'fraction') { 20978 subEl.querySelectorAll((0, _classesToSelector.c)(params.currentClass)).forEach(function (fractionEl) { 20979 fractionEl.textContent = params.formatFractionCurrent(current + 1); 20980 }); 20981 subEl.querySelectorAll((0, _classesToSelector.c)(params.totalClass)).forEach(function (totalEl) { 20982 totalEl.textContent = params.formatFractionTotal(total); 20983 }); 20984 } 20985 if (params.type === 'progressbar') { 20986 var progressbarDirection; 20987 if (params.progressbarOpposite) { 20988 progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal'; 20989 } else { 20990 progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical'; 20991 } 20992 var scale = (current + 1) / total; 20993 var scaleX = 1; 20994 var scaleY = 1; 20995 if (progressbarDirection === 'horizontal') { 20996 scaleX = scale; 20997 } else { 20998 scaleY = scale; 20999 } 21000 subEl.querySelectorAll((0, _classesToSelector.c)(params.progressbarFillClass)).forEach(function (progressEl) { 21001 progressEl.style.transform = "translate3d(0,0,0) scaleX(".concat(scaleX, ") scaleY(").concat(scaleY, ")"); 21002 progressEl.style.transitionDuration = "".concat(swiper.params.speed, "ms"); 21003 }); 21004 } 21005 if (params.type === 'custom' && params.renderCustom) { 21006 (0, _utils.s)(subEl, params.renderCustom(swiper, current + 1, total)); 21007 if (subElIndex === 0) emit('paginationRender', subEl); 21008 } else { 21009 if (subElIndex === 0) emit('paginationRender', subEl); 21010 emit('paginationUpdate', subEl); 21011 } 21012 if (swiper.params.watchOverflow && swiper.enabled) { 21013 subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass); 21014 } 21015 }); 21016 } 21017 function render() { 21018 // Render Container 21019 var params = swiper.params.pagination; 21020 if (isPaginationDisabled()) return; 21021 var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.grid && swiper.params.grid.rows > 1 ? swiper.slides.length / Math.ceil(swiper.params.grid.rows) : swiper.slides.length; 21022 var el = swiper.pagination.el; 21023 el = (0, _utils.m)(el); 21024 var paginationHTML = ''; 21025 if (params.type === 'bullets') { 21026 var numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 21027 if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) { 21028 numberOfBullets = slidesLength; 21029 } 21030 for (var i = 0; i < numberOfBullets; i += 1) { 21031 if (params.renderBullet) { 21032 paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass); 21033 } else { 21034 // prettier-ignore 21035 paginationHTML += "<".concat(params.bulletElement, " ").concat(swiper.isElement ? 'part="bullet"' : '', " class=\"").concat(params.bulletClass, "\"></").concat(params.bulletElement, ">"); 21036 } 21037 } 21038 } 21039 if (params.type === 'fraction') { 21040 if (params.renderFraction) { 21041 paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass); 21042 } else { 21043 paginationHTML = "<span class=\"".concat(params.currentClass, "\"></span>") + ' / ' + "<span class=\"".concat(params.totalClass, "\"></span>"); 21044 } 21045 } 21046 if (params.type === 'progressbar') { 21047 if (params.renderProgressbar) { 21048 paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass); 21049 } else { 21050 paginationHTML = "<span class=\"".concat(params.progressbarFillClass, "\"></span>"); 21051 } 21052 } 21053 swiper.pagination.bullets = []; 21054 el.forEach(function (subEl) { 21055 if (params.type !== 'custom') { 21056 (0, _utils.s)(subEl, paginationHTML || ''); 21057 } 21058 if (params.type === 'bullets') { 21059 var _swiper$pagination$bu; 21060 (_swiper$pagination$bu = swiper.pagination.bullets).push.apply(_swiper$pagination$bu, _toConsumableArray(subEl.querySelectorAll((0, _classesToSelector.c)(params.bulletClass)))); 21061 } 21062 }); 21063 if (params.type !== 'custom') { 21064 emit('paginationRender', el[0]); 21065 } 21066 }
21067 function init() { 21068 swiper.params.pagination = (0, _createElementIfNotDefined.c)(swiper, swiper.originalParams.pagination, swiper.params.pagination, { 21069 el: 'swiper-pagination' 21070 }); 21071 var params = swiper.params.pagination; 21072 if (!params.el) return; 21073 var el; 21074 if (typeof params.el === 'string' && swiper.isElement) { 21075 el = swiper.el.querySelector(params.el); 21076 } 21077 if (!el && typeof params.el === 'string') { 21078 el = _toConsumableArray(document.querySelectorAll(params.el)); 21079 } 21080 if (!el) { 21081 el = params.el; 21082 } 21083 if (!el || el.length === 0) return; 21084 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && Array.isArray(el) && el.length > 1) { 21085 el = _toConsumableArray(swiper.el.querySelectorAll(params.el)); 21086 // check if it belongs to another nested Swiper 21087 if (el.length > 1) { 21088 el = el.find(function (subEl) { 21089 if ((0, _utils.d)(subEl, '.swiper')[0] !== swiper.el) return false; 21090 return true; 21091 }); 21092 } 21093 } 21094 if (Array.isArray(el) && el.length === 1) el = el[0]; 21095 _extends(swiper.pagination, { 21096 el: el 21097 }); 21098 el = (0, _utils.m)(el); 21099 el.forEach(function (subEl) { 21100 if (params.type === 'bullets' && params.clickable) { 21101 var _subEl$classList; 21102 (_subEl$classList = subEl.classList).add.apply(_subEl$classList, _toConsumableArray((params.clickableClass || '').split(' '))); 21103 } 21104 subEl.classList.add(params.modifierClass + params.type); 21105 subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 21106 if (params.type === 'bullets' && params.dynamicBullets) { 21107 subEl.classList.add("".concat(params.modifierClass).concat(params.type, "-dynamic")); 21108 dynamicBulletIndex = 0; 21109 if (params.dynamicMainBullets < 1) { 21110 params.dynamicMainBullets = 1; 21111 } 21112 } 21113 if (params.type === 'progressbar' && params.progressbarOpposite) { 21114 subEl.classList.add(params.progressbarOppositeClass); 21115 } 21116 if (params.clickable) { 21117 subEl.addEventListener('click', onBulletClick); 21118 } 21119 if (!swiper.enabled) { 21120 subEl.classList.add(params.lockClass); 21121 } 21122 }); 21123 } 21124 function destroy() { 21125 var params = swiper.params.pagination; 21126 if (isPaginationDisabled()) return; 21127 var el = swiper.pagination.el; 21128 if (el) { 21129 el = (0, _utils.m)(el); 21130 el.forEach(function (subEl) { 21131 subEl.classList.remove(params.hiddenClass); 21132 subEl.classList.remove(params.modifierClass + params.type); 21133 subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 21134 if (params.clickable) { 21135 var _subEl$classList2; 21136 (_subEl$classList2 = subEl.classList).remove.apply(_subEl$classList2, _toConsumableArray((params.clickableClass || '').split(' '))); 21137 subEl.removeEventListener('click', onBulletClick); 21138 } 21139 }); 21140 } 21141 if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(function (subEl) { 21142 var _subEl$classList3; 21143 return (_subEl$classList3 = subEl.classList).remove.apply(_subEl$classList3, _toConsumableArray(params.bulletActiveClass.split(' '))); 21144 }); 21145 } 21146 on('changeDirection', function () { 21147 if (!swiper.pagination || !swiper.pagination.el) return; 21148 var params = swiper.params.pagination; 21149 var el = swiper.pagination.el; 21150 el = (0, _utils.m)(el); 21151 el.forEach(function (subEl) { 21152 subEl.classList.remove(params.horizontalClass, params.verticalClass); 21153 subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 21154 }); 21155 }); 21156 on('init', function () { 21157 if (swiper.params.pagination.enabled === false) { 21158 // eslint-disable-next-line 21159 disable(); 21160 } else { 21161 init(); 21162 render(); 21163 update(); 21164 } 21165 }); 21166 on('activeIndexChange', function () { 21167 if (typeof swiper.snapIndex === 'undefined') { 21168 update(); 21169 } 21170 }); 21171 on('snapIndexChange', function () { 21172 update(); 21173 }); 21174 on('snapGridLengthChange', function () { 21175 render(); 21176 update(); 21177 }); 21178 on('destroy', function () { 21179 destroy(); 21180 }); 21181 on('enable disable', function () { 21182 var el = swiper.pagination.el; 21183 if (el) { 21184 el = (0, _utils.m)(el); 21185 el.forEach(function (subEl) { 21186 return subEl.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.pagination.lockClass); 21187 }); 21188 } 21189 }); 21190 on('lock unlock', function () { 21191 update(); 21192 }); 21193 on('click', function (_s, e) { 21194 var targetEl = e.target; 21195 var el = (0, _utils.m)(swiper.pagination.el); 21196 if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) { 21197 if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return; 21198 var isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass); 21199 if (isHidden === true) { 21200 emit('paginationShow'); 21201 } else { 21202 emit('paginationHide'); 21203 } 21204 el.forEach(function (subEl) { 21205 return subEl.classList.toggle(swiper.params.pagination.hiddenClass); 21206 }); 21207 } 21208 }); 21209 var enable = function enable() { 21210 swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass); 21211 var el = swiper.pagination.el; 21212 if (el) { 21213 el = (0, _utils.m)(el); 21214 el.forEach(function (subEl) { 21215 return subEl.classList.remove(swiper.params.pagination.paginationDisabledClass); 21216 }); 21217 } 21218 init(); 21219 render(); 21220 update(); 21221 }; 21222 var disable = function disable() { 21223 swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass); 21224 var el = swiper.pagination.el; 21225 if (el) { 21226 el = (0, _utils.m)(el); 21227 el.forEach(function (subEl) { 21228 return subEl.classList.add(swiper.params.pagination.paginationDisabledClass); 21229 }); 21230 } 21231 destroy(); 21232 }; 21233 _extends(swiper.pagination, { 21234 enable: enable, 21235 disable: disable, 21236 render: render, 21237 update: update, 21238 init: init, 21239 destroy: destroy 21240 }); 21241} 21242 21243},{"../shared/classes-to-selector.mjs":61,"../shared/create-element-if-not-defined.mjs":62,"../shared/utils.mjs":69}],56:[function(require,module,exports){ 21244"use strict"; 21245 21246Object.defineProperty(exports, "__esModule", { 21247 value: true 21248}); 21249exports["default"] = Parallax; 21250var _utils = require("../shared/utils.mjs"); 21251function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } 21252function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 21253function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 21254function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } 21255function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } 21256function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 21257function Parallax(_ref) { 21258 var swiper = _ref.swiper, 21259 extendParams = _ref.extendParams, 21260 on = _ref.on; 21261 extendParams({ 21262 parallax: { 21263 enabled: false 21264 } 21265 }); 21266 var elementsSelector = '[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]'; 21267 var setTransform = function setTransform(el, progress) { 21268 var rtl = swiper.rtl; 21269 var rtlFactor = rtl ? -1 : 1; 21270 var p = el.getAttribute('data-swiper-parallax') || '0'; 21271 var x = el.getAttribute('data-swiper-parallax-x'); 21272 var y = el.getAttribute('data-swiper-parallax-y'); 21273 var scale = el.getAttribute('data-swiper-parallax-scale'); 21274 var opacity = el.getAttribute('data-swiper-parallax-opacity'); 21275 var rotate = el.getAttribute('data-swiper-parallax-rotate'); 21276 if (x || y) { 21277 x = x || '0'; 21278 y = y || '0'; 21279 } else if (swiper.isHorizontal()) { 21280 x = p; 21281 y = '0'; 21282 } else { 21283 y = p; 21284 x = '0'; 21285 } 21286 if (x.indexOf('%') >= 0) { 21287 x = "".concat(parseInt(x, 10) * progress * rtlFactor, "%"); 21288 } else { 21289 x = "".concat(x * progress * rtlFactor, "px"); 21290 } 21291 if (y.indexOf('%') >= 0) { 21292 y = "".concat(parseInt(y, 10) * progress, "%"); 21293 } else { 21294 y = "".concat(y * progress, "px"); 21295 } 21296 if (typeof opacity !== 'undefined' && opacity !== null) { 21297 var currentOpacity = opacity - (opacity - 1) * (1 - Math.abs(progress)); 21298 el.style.opacity = currentOpacity; 21299 } 21300 var transform = "translate3d(".concat(x, ", ").concat(y, ", 0px)"); 21301 if (typeof scale !== 'undefined' && scale !== null) { 21302 var currentScale = scale - (scale - 1) * (1 - Math.abs(progress)); 21303 transform += " scale(".concat(currentScale, ")"); 21304 } 21305 if (rotate && typeof rotate !== 'undefined' && rotate !== null) { 21306 var currentRotate = rotate * progress * -1; 21307 transform += " rotate(".concat(currentRotate, "deg)"); 21308 } 21309 el.style.transform = transform; 21310 }; 21311 var setTranslate = function setTranslate() { 21312 var el = swiper.el, 21313 slides = swiper.slides, 21314 progress = swiper.progress, 21315 snapGrid = swiper.snapGrid, 21316 isElement = swiper.isElement; 21317 var elements = (0, _utils.e)(el, elementsSelector); 21318 if (swiper.isElement) { 21319 elements.push.apply(elements, _toConsumableArray((0, _utils.e)(swiper.hostEl, elementsSelector))); 21320 }
21321 elements.forEach(function (subEl) { 21322 setTransform(subEl, progress); 21323 }); 21324 slides.forEach(function (slideEl, slideIndex) { 21325 var slideProgress = slideEl.progress; 21326 if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') { 21327 slideProgress += Math.ceil(slideIndex / 2) - progress * (snapGrid.length - 1); 21328 } 21329 slideProgress = Math.min(Math.max(slideProgress, -1), 1); 21330 slideEl.querySelectorAll("".concat(elementsSelector, ", [data-swiper-parallax-rotate]")).forEach(function (subEl) { 21331 setTransform(subEl, slideProgress); 21332 }); 21333 }); 21334 }; 21335 var setTransition = function setTransition() { 21336 var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : swiper.params.speed; 21337 var el = swiper.el, 21338 hostEl = swiper.hostEl; 21339 var elements = _toConsumableArray(el.querySelectorAll(elementsSelector)); 21340 if (swiper.isElement) { 21341 elements.push.apply(elements, _toConsumableArray(hostEl.querySelectorAll(elementsSelector))); 21342 } 21343 elements.forEach(function (parallaxEl) { 21344 var parallaxDuration = parseInt(parallaxEl.getAttribute('data-swiper-parallax-duration'), 10) || duration; 21345 if (duration === 0) parallaxDuration = 0; 21346 parallaxEl.style.transitionDuration = "".concat(parallaxDuration, "ms"); 21347 }); 21348 }; 21349 on('beforeInit', function () { 21350 if (!swiper.params.parallax.enabled) return; 21351 swiper.params.watchSlidesProgress = true; 21352 swiper.originalParams.watchSlidesProgress = true; 21353 }); 21354 on('init', function () { 21355 if (!swiper.params.parallax.enabled) return; 21356 setTranslate(); 21357 }); 21358 on('setTranslate', function () { 21359 if (!swiper.params.parallax.enabled) return; 21360 setTranslate(); 21361 }); 21362 on('setTransition', function (_swiper, duration) { 21363 if (!swiper.params.parallax.enabled) return; 21364 setTransition(duration); 21365 }); 21366} 21367 21368},{"../shared/utils.mjs":69}],57:[function(require,module,exports){ 21369"use strict"; 21370 21371Object.defineProperty(exports, "__esModule", { 21372 value: true 21373}); 21374exports["default"] = Scrollbar; 21375var _ssrWindowEsm = require("../shared/ssr-window.esm.mjs"); 21376var _utils = require("../shared/utils.mjs"); 21377var _createElementIfNotDefined = require("../shared/create-element-if-not-defined.mjs"); 21378var _classesToSelector = require("../shared/classes-to-selector.mjs"); 21379function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } 21380function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 21381function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 21382function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } 21383function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } 21384function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 21385function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 21386function Scrollbar(_ref) { 21387 var swiper = _ref.swiper, 21388 extendParams = _ref.extendParams, 21389 on = _ref.on, 21390 emit = _ref.emit; 21391 var document = (0, _ssrWindowEsm.g)(); 21392 var isTouched = false; 21393 var timeout = null; 21394 var dragTimeout = null; 21395 var dragStartPos; 21396 var dragSize; 21397 var trackSize; 21398 var divider; 21399 extendParams({ 21400 scrollbar: { 21401 el: null, 21402 dragSize: 'auto', 21403 hide: false, 21404 draggable: false, 21405 snapOnRelease: true, 21406 lockClass: 'swiper-scrollbar-lock', 21407 dragClass: 'swiper-scrollbar-drag', 21408 scrollbarDisabledClass: 'swiper-scrollbar-disabled', 21409 horizontalClass: "swiper-scrollbar-horizontal", 21410 verticalClass: "swiper-scrollbar-vertical" 21411 } 21412 }); 21413 swiper.scrollbar = { 21414 el: null, 21415 dragEl: null 21416 }; 21417 function setTranslate() { 21418 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 21419 var scrollbar = swiper.scrollbar, 21420 rtl = swiper.rtlTranslate; 21421 var dragEl = scrollbar.dragEl, 21422 el = scrollbar.el; 21423 var params = swiper.params.scrollbar; 21424 var progress = swiper.params.loop ? swiper.progressLoop : swiper.progress; 21425 var newSize = dragSize; 21426 var newPos = (trackSize - dragSize) * progress; 21427 if (rtl) { 21428 newPos = -newPos; 21429 if (newPos > 0) { 21430 newSize = dragSize - newPos; 21431 newPos = 0; 21432 } else if (-newPos + dragSize > trackSize) { 21433 newSize = trackSize + newPos; 21434 } 21435 } else if (newPos < 0) { 21436 newSize = dragSize + newPos; 21437 newPos = 0; 21438 } else if (newPos + dragSize > trackSize) { 21439 newSize = trackSize - newPos; 21440 } 21441 if (swiper.isHorizontal()) { 21442 dragEl.style.transform = "translate3d(".concat(newPos, "px, 0, 0)"); 21443 dragEl.style.width = "".concat(newSize, "px"); 21444 } else { 21445 dragEl.style.transform = "translate3d(0px, ".concat(newPos, "px, 0)"); 21446 dragEl.style.height = "".concat(newSize, "px"); 21447 } 21448 if (params.hide) { 21449 clearTimeout(timeout); 21450 el.style.opacity = 1; 21451 timeout = setTimeout(function () { 21452 el.style.opacity = 0; 21453 el.style.transitionDuration = '400ms'; 21454 }, 1000); 21455 } 21456 } 21457 function setTransition(duration) { 21458 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 21459 swiper.scrollbar.dragEl.style.transitionDuration = "".concat(duration, "ms"); 21460 } 21461 function updateSize() { 21462 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 21463 var scrollbar = swiper.scrollbar; 21464 var dragEl = scrollbar.dragEl, 21465 el = scrollbar.el; 21466 dragEl.style.width = ''; 21467 dragEl.style.height = ''; 21468 trackSize = swiper.isHorizontal() ? el.offsetWidth : el.offsetHeight; 21469 divider = swiper.size / (swiper.virtualSize + swiper.params.slidesOffsetBefore - (swiper.params.centeredSlides ? swiper.snapGrid[0] : 0)); 21470 if (swiper.params.scrollbar.dragSize === 'auto') { 21471 dragSize = trackSize * divider; 21472 } else { 21473 dragSize = parseInt(swiper.params.scrollbar.dragSize, 10); 21474 } 21475 if (swiper.isHorizontal()) { 21476 dragEl.style.width = "".concat(dragSize, "px"); 21477 } else { 21478 dragEl.style.height = "".concat(dragSize, "px"); 21479 } 21480 if (divider >= 1) { 21481 el.style.display = 'none'; 21482 } else { 21483 el.style.display = ''; 21484 } 21485 if (swiper.params.scrollbar.hide) { 21486 el.style.opacity = 0; 21487 } 21488 if (swiper.params.watchOverflow && swiper.enabled) { 21489 scrollbar.el.classList[swiper.isLocked ? 'add' : 'remove'](swiper.params.scrollbar.lockClass); 21490 } 21491 } 21492 function getPointerPosition(e) { 21493 return swiper.isHorizontal() ? e.clientX : e.clientY; 21494 } 21495 function setDragPosition(e) { 21496 var scrollbar = swiper.scrollbar, 21497 rtl = swiper.rtlTranslate; 21498 var el = scrollbar.el; 21499 var positionRatio; 21500 positionRatio = (getPointerPosition(e) - (0, _utils.f)(el)[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize); 21501 positionRatio = Math.max(Math.min(positionRatio, 1), 0); 21502 if (rtl) { 21503 positionRatio = 1 - positionRatio; 21504 } 21505 var position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio; 21506 swiper.updateProgress(position); 21507 swiper.setTranslate(position); 21508 swiper.updateActiveIndex(); 21509 swiper.updateSlidesClasses(); 21510 } 21511 function onDragStart(e) { 21512 var params = swiper.params.scrollbar; 21513 var scrollbar = swiper.scrollbar, 21514 wrapperEl = swiper.wrapperEl; 21515 var el = scrollbar.el, 21516 dragEl = scrollbar.dragEl; 21517 isTouched = true; 21518 dragStartPos = e.target === dragEl ? getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null; 21519 e.preventDefault(); 21520 e.stopPropagation(); 21521 wrapperEl.style.transitionDuration = '100ms'; 21522 dragEl.style.transitionDuration = '100ms'; 21523 setDragPosition(e); 21524 clearTimeout(dragTimeout); 21525 el.style.transitionDuration = '0ms'; 21526 if (params.hide) { 21527 el.style.opacity = 1; 21528 } 21529 if (swiper.params.cssMode) {
21530 swiper.wrapperEl.style['scroll-snap-type'] = 'none'; 21531 } 21532 emit('scrollbarDragStart', e); 21533 } 21534 function onDragMove(e) { 21535 var scrollbar = swiper.scrollbar, 21536 wrapperEl = swiper.wrapperEl; 21537 var el = scrollbar.el, 21538 dragEl = scrollbar.dragEl; 21539 if (!isTouched) return; 21540 if (e.preventDefault && e.cancelable) e.preventDefault();else e.returnValue = false; 21541 setDragPosition(e); 21542 wrapperEl.style.transitionDuration = '0ms'; 21543 el.style.transitionDuration = '0ms'; 21544 dragEl.style.transitionDuration = '0ms'; 21545 emit('scrollbarDragMove', e); 21546 } 21547 function onDragEnd(e) { 21548 var params = swiper.params.scrollbar; 21549 var scrollbar = swiper.scrollbar, 21550 wrapperEl = swiper.wrapperEl; 21551 var el = scrollbar.el; 21552 if (!isTouched) return; 21553 isTouched = false; 21554 if (swiper.params.cssMode) { 21555 swiper.wrapperEl.style['scroll-snap-type'] = ''; 21556 wrapperEl.style.transitionDuration = ''; 21557 } 21558 if (params.hide) { 21559 clearTimeout(dragTimeout); 21560 dragTimeout = (0, _utils.n)(function () { 21561 el.style.opacity = 0; 21562 el.style.transitionDuration = '400ms'; 21563 }, 1000); 21564 } 21565 emit('scrollbarDragEnd', e); 21566 if (params.snapOnRelease) { 21567 swiper.slideToClosest(); 21568 } 21569 } 21570 function events(method) { 21571 var scrollbar = swiper.scrollbar, 21572 params = swiper.params; 21573 var el = scrollbar.el; 21574 if (!el) return; 21575 var target = el; 21576 var activeListener = params.passiveListeners ? { 21577 passive: false, 21578 capture: false 21579 } : false; 21580 var passiveListener = params.passiveListeners ? { 21581 passive: true, 21582 capture: false 21583 } : false; 21584 if (!target) return; 21585 var eventMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; 21586 target[eventMethod]('pointerdown', onDragStart, activeListener); 21587 document[eventMethod]('pointermove', onDragMove, activeListener); 21588 document[eventMethod]('pointerup', onDragEnd, passiveListener); 21589 } 21590 function enableDraggable() { 21591 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 21592 events('on'); 21593 } 21594 function disableDraggable() { 21595 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 21596 events('off'); 21597 } 21598 function init() { 21599 var scrollbar = swiper.scrollbar, 21600 swiperEl = swiper.el; 21601 swiper.params.scrollbar = (0, _createElementIfNotDefined.c)(swiper, swiper.originalParams.scrollbar, swiper.params.scrollbar, { 21602 el: 'swiper-scrollbar' 21603 }); 21604 var params = swiper.params.scrollbar; 21605 if (!params.el) return; 21606 var el; 21607 if (typeof params.el === 'string' && swiper.isElement) { 21608 el = swiper.el.querySelector(params.el); 21609 } 21610 if (!el && typeof params.el === 'string') { 21611 el = document.querySelectorAll(params.el); 21612 if (!el.length) return; 21613 } else if (!el) { 21614 el = params.el; 21615 } 21616 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && el.length > 1 && swiperEl.querySelectorAll(params.el).length === 1) { 21617 el = swiperEl.querySelector(params.el); 21618 } 21619 if (el.length > 0) el = el[0]; 21620 el.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 21621 var dragEl; 21622 if (el) { 21623 dragEl = el.querySelector((0, _classesToSelector.c)(swiper.params.scrollbar.dragClass)); 21624 if (!dragEl) { 21625 dragEl = (0, _utils.c)('div', swiper.params.scrollbar.dragClass); 21626 el.append(dragEl); 21627 } 21628 } 21629 _extends(scrollbar, { 21630 el: el, 21631 dragEl: dragEl 21632 }); 21633 if (params.draggable) { 21634 enableDraggable(); 21635 } 21636 if (el) { 21637 var _el$classList; 21638 (_el$classList = el.classList)[swiper.enabled ? 'remove' : 'add'].apply(_el$classList, _toConsumableArray((0, _utils.k)(swiper.params.scrollbar.lockClass))); 21639 } 21640 } 21641 function destroy() { 21642 var params = swiper.params.scrollbar; 21643 var el = swiper.scrollbar.el; 21644 if (el) { 21645 var _el$classList2; 21646 (_el$classList2 = el.classList).remove.apply(_el$classList2, _toConsumableArray((0, _utils.k)(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass))); 21647 } 21648 disableDraggable(); 21649 } 21650 on('changeDirection', function () { 21651 if (!swiper.scrollbar || !swiper.scrollbar.el) return; 21652 var params = swiper.params.scrollbar; 21653 var el = swiper.scrollbar.el; 21654 el = (0, _utils.m)(el); 21655 el.forEach(function (subEl) { 21656 subEl.classList.remove(params.horizontalClass, params.verticalClass); 21657 subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 21658 }); 21659 }); 21660 on('init', function () { 21661 if (swiper.params.scrollbar.enabled === false) { 21662 // eslint-disable-next-line 21663 disable(); 21664 } else { 21665 init(); 21666 updateSize(); 21667 setTranslate(); 21668 } 21669 }); 21670 on('update resize observerUpdate lock unlock changeDirection', function () { 21671 updateSize(); 21672 }); 21673 on('setTranslate', function () { 21674 setTranslate(); 21675 }); 21676 on('setTransition', function (_s, duration) { 21677 setTransition(duration); 21678 }); 21679 on('enable disable', function () { 21680 var el = swiper.scrollbar.el; 21681 if (el) { 21682 var _el$classList3; 21683 (_el$classList3 = el.classList)[swiper.enabled ? 'remove' : 'add'].apply(_el$classList3, _toConsumableArray((0, _utils.k)(swiper.params.scrollbar.lockClass))); 21684 } 21685 }); 21686 on('destroy', function () { 21687 destroy(); 21688 }); 21689 var enable = function enable() { 21690 var _swiper$el$classList; 21691 (_swiper$el$classList = swiper.el.classList).remove.apply(_swiper$el$classList, _toConsumableArray((0, _utils.k)(swiper.params.scrollbar.scrollbarDisabledClass))); 21692 if (swiper.scrollbar.el) { 21693 var _swiper$scrollbar$el$; 21694 (_swiper$scrollbar$el$ = swiper.scrollbar.el.classList).remove.apply(_swiper$scrollbar$el$, _toConsumableArray((0, _utils.k)(swiper.params.scrollbar.scrollbarDisabledClass))); 21695 } 21696 init(); 21697 updateSize(); 21698 setTranslate(); 21699 }; 21700 var disable = function disable() { 21701 var _swiper$el$classList2; 21702 (_swiper$el$classList2 = swiper.el.classList).add.apply(_swiper$el$classList2, _toConsumableArray((0, _utils.k)(swiper.params.scrollbar.scrollbarDisabledClass))); 21703 if (swiper.scrollbar.el) { 21704 var _swiper$scrollbar$el$2; 21705 (_swiper$scrollbar$el$2 = swiper.scrollbar.el.classList).add.apply(_swiper$scrollbar$el$2, _toConsumableArray((0, _utils.k)(swiper.params.scrollbar.scrollbarDisabledClass))); 21706 } 21707 destroy(); 21708 }; 21709 _extends(swiper.scrollbar, { 21710 enable: enable, 21711 disable: disable, 21712 updateSize: updateSize, 21713 setTranslate: setTranslate, 21714 init: init, 21715 destroy: destroy 21716 }); 21717} 21718 21719},{"../shared/classes-to-selector.mjs":61,"../shared/create-element-if-not-defined.mjs":62,"../shared/ssr-window.esm.mjs":67,"../shared/utils.mjs":69}],58:[function(require,module,exports){ 21720"use strict"; 21721 21722Object.defineProperty(exports, "__esModule", { 21723 value: true 21724}); 21725exports["default"] = Thumb; 21726var _ssrWindowEsm = require("../shared/ssr-window.esm.mjs"); 21727var _utils = require("../shared/utils.mjs"); 21728function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 21729function Thumb(_ref) { 21730 var swiper = _ref.swiper, 21731 extendParams = _ref.extendParams, 21732 on = _ref.on; 21733 extendParams({ 21734 thumbs: { 21735 swiper: null, 21736 multipleActiveThumbs: true, 21737 autoScrollOffset: 0, 21738 slideThumbActiveClass: 'swiper-slide-thumb-active', 21739 thumbsContainerClass: 'swiper-thumbs' 21740 } 21741 }); 21742 var initialized = false;
21743 var swiperCreated = false; 21744 swiper.thumbs = { 21745 swiper: null 21746 }; 21747 function isVirtualEnabled() { 21748 var thumbsSwiper = swiper.thumbs.swiper; 21749 if (!thumbsSwiper || thumbsSwiper.destroyed) return false; 21750 return thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled; 21751 } 21752 function onThumbClick() { 21753 var thumbsSwiper = swiper.thumbs.swiper; 21754 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 21755 var clickedIndex = thumbsSwiper.clickedIndex; 21756 var clickedSlide = thumbsSwiper.clickedSlide; 21757 if (clickedSlide && clickedSlide.classList.contains(swiper.params.thumbs.slideThumbActiveClass)) return; 21758 if (typeof clickedIndex === 'undefined' || clickedIndex === null) return; 21759 var slideToIndex; 21760 if (thumbsSwiper.params.loop) { 21761 slideToIndex = parseInt(thumbsSwiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10); 21762 } else { 21763 slideToIndex = clickedIndex; 21764 } 21765 if (swiper.params.loop) { 21766 swiper.slideToLoop(slideToIndex); 21767 } else { 21768 swiper.slideTo(slideToIndex); 21769 } 21770 } 21771 function init() { 21772 var thumbsParams = swiper.params.thumbs; 21773 if (initialized) return false; 21774 initialized = true; 21775 var SwiperClass = swiper.constructor; 21776 if (thumbsParams.swiper instanceof SwiperClass) { 21777 if (thumbsParams.swiper.destroyed) { 21778 initialized = false; 21779 return false; 21780 } 21781 swiper.thumbs.swiper = thumbsParams.swiper; 21782 _extends(swiper.thumbs.swiper.originalParams, { 21783 watchSlidesProgress: true, 21784 slideToClickedSlide: false 21785 }); 21786 _extends(swiper.thumbs.swiper.params, { 21787 watchSlidesProgress: true, 21788 slideToClickedSlide: false 21789 }); 21790 swiper.thumbs.swiper.update(); 21791 } else if ((0, _utils.p)(thumbsParams.swiper)) { 21792 var thumbsSwiperParams = _extends({}, thumbsParams.swiper); 21793 _extends(thumbsSwiperParams, { 21794 watchSlidesProgress: true, 21795 slideToClickedSlide: false 21796 }); 21797 swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams); 21798 swiperCreated = true; 21799 } 21800 swiper.thumbs.swiper.el.classList.add(swiper.params.thumbs.thumbsContainerClass); 21801 swiper.thumbs.swiper.on('tap', onThumbClick); 21802 if (isVirtualEnabled()) { 21803 swiper.thumbs.swiper.on('virtualUpdate', function () { 21804 update(false, { 21805 autoScroll: false 21806 }); 21807 }); 21808 } 21809 return true; 21810 } 21811 function update(initial, p) { 21812 var _p$autoScroll; 21813 var thumbsSwiper = swiper.thumbs.swiper; 21814 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 21815 21816 // Activate thumbs 21817 var thumbsToActivate = 1; 21818 var thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass; 21819 if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) { 21820 thumbsToActivate = swiper.params.slidesPerView; 21821 } 21822 if (!swiper.params.thumbs.multipleActiveThumbs) { 21823 thumbsToActivate = 1; 21824 } 21825 thumbsToActivate = Math.floor(thumbsToActivate); 21826 thumbsSwiper.slides.forEach(function (slideEl) { 21827 return slideEl.classList.remove(thumbActiveClass); 21828 }); 21829 if (thumbsSwiper.params.loop || isVirtualEnabled()) { 21830 for (var i = 0; i < thumbsToActivate; i += 1) { 21831 (0, _utils.e)(thumbsSwiper.slidesEl, "[data-swiper-slide-index=\"".concat(swiper.realIndex + i, "\"]")).forEach(function (slideEl) { 21832 slideEl.classList.add(thumbActiveClass); 21833 }); 21834 } 21835 } else { 21836 for (var _i = 0; _i < thumbsToActivate; _i += 1) { 21837 if (thumbsSwiper.slides[swiper.realIndex + _i]) { 21838 thumbsSwiper.slides[swiper.realIndex + _i].classList.add(thumbActiveClass); 21839 } 21840 } 21841 } 21842 if ((_p$autoScroll = p === null || p === void 0 ? void 0 : p.autoScroll) !== null && _p$autoScroll !== void 0 ? _p$autoScroll : true) { 21843 autoScroll(initial ? 0 : undefined); 21844 } 21845 } 21846 function autoScroll(slideSpeed) { 21847 var thumbsSwiper = swiper.thumbs.swiper; 21848 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 21849 var slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView; 21850 var autoScrollOffset = swiper.params.thumbs.autoScrollOffset; 21851 var useOffset = autoScrollOffset && !thumbsSwiper.params.loop; 21852 if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) { 21853 var currentThumbsIndex = thumbsSwiper.activeIndex; 21854 var newThumbsIndex; 21855 var direction; 21856 if (thumbsSwiper.params.loop) { 21857 var newThumbsSlide = thumbsSwiper.slides.find(function (slideEl) { 21858 return slideEl.getAttribute('data-swiper-slide-index') === "".concat(swiper.realIndex); 21859 }); 21860 newThumbsIndex = thumbsSwiper.slides.indexOf(newThumbsSlide); 21861 direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev'; 21862 } else { 21863 newThumbsIndex = swiper.realIndex; 21864 direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev'; 21865 } 21866 if (useOffset) { 21867 newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset; 21868 } 21869 if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) { 21870 if (thumbsSwiper.params.centeredSlides) { 21871 if (newThumbsIndex > currentThumbsIndex) { 21872 newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1; 21873 } else { 21874 newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1; 21875 } 21876 } else if (newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup === 1) ; 21877 thumbsSwiper.slideTo(newThumbsIndex, slideSpeed); 21878 } 21879 } 21880 } 21881 on('beforeInit', function () { 21882 var thumbs = swiper.params.thumbs; 21883 if (!thumbs || !thumbs.swiper) return; 21884 if (typeof thumbs.swiper === 'string' || thumbs.swiper instanceof HTMLElement) { 21885 var document = (0, _ssrWindowEsm.g)(); 21886 var getThumbsElementAndInit = function getThumbsElementAndInit() { 21887 var thumbsElement = typeof thumbs.swiper === 'string' ? document.querySelector(thumbs.swiper) : thumbs.swiper; 21888 if (thumbsElement && thumbsElement.swiper) { 21889 thumbs.swiper = thumbsElement.swiper; 21890 init(); 21891 update(true); 21892 } else if (thumbsElement) { 21893 var eventName = "".concat(swiper.params.eventsPrefix, "init"); 21894 var _onThumbsSwiper = function onThumbsSwiper(e) { 21895 thumbs.swiper = e.detail[0]; 21896 thumbsElement.removeEventListener(eventName, _onThumbsSwiper); 21897 init(); 21898 update(true);
21899 thumbs.swiper.update(); 21900 swiper.update(); 21901 }; 21902 thumbsElement.addEventListener(eventName, _onThumbsSwiper); 21903 } 21904 return thumbsElement; 21905 }; 21906 var _watchForThumbsToAppear = function watchForThumbsToAppear() { 21907 if (swiper.destroyed) return; 21908 var thumbsElement = getThumbsElementAndInit(); 21909 if (!thumbsElement) { 21910 requestAnimationFrame(_watchForThumbsToAppear); 21911 } 21912 }; 21913 requestAnimationFrame(_watchForThumbsToAppear); 21914 } else { 21915 init(); 21916 update(true); 21917 } 21918 }); 21919 on('slideChange update resize observerUpdate', function () { 21920 update(); 21921 }); 21922 on('setTransition', function (_s, duration) { 21923 var thumbsSwiper = swiper.thumbs.swiper; 21924 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 21925 thumbsSwiper.setTransition(duration); 21926 }); 21927 on('beforeDestroy', function () { 21928 var thumbsSwiper = swiper.thumbs.swiper; 21929 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 21930 if (swiperCreated) { 21931 thumbsSwiper.destroy(); 21932 } 21933 }); 21934 _extends(swiper.thumbs, { 21935 init: init, 21936 update: update 21937 }); 21938} 21939 21940},{"../shared/ssr-window.esm.mjs":67,"../shared/utils.mjs":69}],59:[function(require,module,exports){ 21941"use strict"; 21942 21943Object.defineProperty(exports, "__esModule", { 21944 value: true 21945}); 21946exports["default"] = Virtual; 21947var _ssrWindowEsm = require("../shared/ssr-window.esm.mjs"); 21948var _utils = require("../shared/utils.mjs"); 21949function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } 21950function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 21951function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 21952function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } 21953function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } 21954function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 21955function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 21956function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 21957function Virtual(_ref) { 21958 var swiper = _ref.swiper, 21959 extendParams = _ref.extendParams, 21960 on = _ref.on, 21961 emit = _ref.emit; 21962 extendParams({ 21963 virtual: { 21964 enabled: false, 21965 slides: [], 21966 cache: true, 21967 slidesPerViewAutoSlideSize: 320, 21968 renderSlide: null, 21969 renderExternal: null, 21970 renderExternalUpdate: true, 21971 addSlidesBefore: 0, 21972 addSlidesAfter: 0 21973 } 21974 }); 21975 var cssModeTimeout; 21976 var document = (0, _ssrWindowEsm.g)(); 21977 swiper.virtual = { 21978 cache: {}, 21979 from: undefined, 21980 to: undefined, 21981 slides: [], 21982 offset: 0, 21983 slidesGrid: [] 21984 }; 21985 var tempDOM = document.createElement('div');
21986 function renderSlide(slide, index) { 21987 var params = swiper.params.virtual; 21988 if (params.cache && swiper.virtual.cache[index]) { 21989 return swiper.virtual.cache[index]; 21990 } 21991 // eslint-disable-next-line 21992 var slideEl; 21993 if (params.renderSlide) { 21994 slideEl = params.renderSlide.call(swiper, slide, index); 21995 if (typeof slideEl === 'string') { 21996 (0, _utils.s)(tempDOM, slideEl); 21997 slideEl = tempDOM.children[0]; 21998 } 21999 } else if (swiper.isElement) { 22000 slideEl = (0, _utils.c)('swiper-slide'); 22001 } else { 22002 slideEl = (0, _utils.c)('div', swiper.params.slideClass); 22003 } 22004 slideEl.setAttribute('data-swiper-slide-index', index); 22005 if (!params.renderSlide) { 22006 (0, _utils.s)(slideEl, slide); 22007 } 22008 if (params.cache) { 22009 swiper.virtual.cache[index] = slideEl; 22010 } 22011 return slideEl; 22012 } 22013 function update(force, beforeInit, forceActiveIndex) { 22014 var _swiper$params = swiper.params, 22015 slidesPerGroup = _swiper$params.slidesPerGroup, 22016 centeredSlides = _swiper$params.centeredSlides, 22017 slidesPerView = _swiper$params.slidesPerView, 22018 isLoop = _swiper$params.loop, 22019 initialSlide = _swiper$params.initialSlide; 22020 if (beforeInit && !isLoop && initialSlide > 0) { 22021 return; 22022 } 22023 var _swiper$params$virtua = swiper.params.virtual, 22024 addSlidesBefore = _swiper$params$virtua.addSlidesBefore, 22025 addSlidesAfter = _swiper$params$virtua.addSlidesAfter, 22026 slidesPerViewAutoSlideSize = _swiper$params$virtua.slidesPerViewAutoSlideSize; 22027 var _swiper$virtual = swiper.virtual, 22028 previousFrom = _swiper$virtual.from, 22029 previousTo = _swiper$virtual.to, 22030 slides = _swiper$virtual.slides, 22031 previousSlidesGrid = _swiper$virtual.slidesGrid, 22032 previousOffset = _swiper$virtual.offset; 22033 if (!swiper.params.cssMode) { 22034 swiper.updateActiveIndex(); 22035 } 22036 var activeIndex = typeof forceActiveIndex === 'undefined' ? swiper.activeIndex || 0 : forceActiveIndex; 22037 var offsetProp; 22038 if (swiper.rtlTranslate) offsetProp = 'right';else offsetProp = swiper.isHorizontal() ? 'left' : 'top'; 22039 var slidesPerViewNumeric; 22040 if (slidesPerView === 'auto') { 22041 if (slidesPerViewAutoSlideSize) { 22042 var swiperSize = swiper.size; 22043 if (!swiperSize) { 22044 swiperSize = swiper.isHorizontal() ? swiper.el.getBoundingClientRect().width : swiper.el.getBoundingClientRect().height; 22045 } 22046 slidesPerViewNumeric = Math.max(1, Math.ceil(swiperSize / slidesPerViewAutoSlideSize)); 22047 } else { 22048 slidesPerViewNumeric = 1; 22049 } 22050 } else { 22051 slidesPerViewNumeric = slidesPerView; 22052 } 22053 var slidesAfter; 22054 var slidesBefore; 22055 if (centeredSlides) { 22056 slidesAfter = Math.floor(slidesPerViewNumeric / 2) + slidesPerGroup + addSlidesAfter; 22057 slidesBefore = Math.floor(slidesPerViewNumeric / 2) + slidesPerGroup + addSlidesBefore; 22058 } else { 22059 slidesAfter = slidesPerViewNumeric + (slidesPerGroup - 1) + addSlidesAfter; 22060 slidesBefore = (isLoop ? slidesPerViewNumeric : slidesPerGroup) + addSlidesBefore; 22061 } 22062 var from = activeIndex - slidesBefore; 22063 var to = activeIndex + slidesAfter; 22064 if (!isLoop) { 22065 from = Math.max(from, 0); 22066 to = Math.min(to, slides.length - 1); 22067 } 22068 var offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0); 22069 if (isLoop && activeIndex >= slidesBefore) { 22070 from -= slidesBefore; 22071 if (!centeredSlides) offset += swiper.slidesGrid[0]; 22072 } else if (isLoop && activeIndex < slidesBefore) { 22073 from = -slidesBefore; 22074 if (centeredSlides) offset += swiper.slidesGrid[0]; 22075 } 22076 _extends(swiper.virtual, { 22077 from: from, 22078 to: to, 22079 offset: offset, 22080 slidesGrid: swiper.slidesGrid, 22081 slidesBefore: slidesBefore, 22082 slidesAfter: slidesAfter 22083 }); 22084 function onRendered() { 22085 swiper.updateSlides(); 22086 swiper.updateProgress(); 22087 swiper.updateSlidesClasses(); 22088 emit('virtualUpdate'); 22089 } 22090 if (previousFrom === from && previousTo === to && !force) { 22091 if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) {
22092 swiper.slides.forEach(function (slideEl) { 22093 slideEl.style[offsetProp] = "".concat(offset - Math.abs(swiper.cssOverflowAdjustment()), "px"); 22094 }); 22095 } 22096 swiper.updateProgress(); 22097 emit('virtualUpdate'); 22098 return; 22099 } 22100 if (swiper.params.virtual.renderExternal) { 22101 swiper.params.virtual.renderExternal.call(swiper, { 22102 offset: offset, 22103 from: from, 22104 to: to, 22105 slides: function getSlides() { 22106 var slidesToRender = []; 22107 for (var i = from; i <= to; i += 1) { 22108 slidesToRender.push(slides[i]); 22109 } 22110 return slidesToRender; 22111 }() 22112 }); 22113 if (swiper.params.virtual.renderExternalUpdate) { 22114 onRendered(); 22115 } else { 22116 emit('virtualUpdate'); 22117 } 22118 return; 22119 } 22120 var prependIndexes = []; 22121 var appendIndexes = []; 22122 var getSlideIndex = function getSlideIndex(index) { 22123 var slideIndex = index; 22124 if (index < 0) { 22125 slideIndex = slides.length + index; 22126 } else if (slideIndex >= slides.length) { 22127 // eslint-disable-next-line 22128 slideIndex = slideIndex - slides.length; 22129 } 22130 return slideIndex; 22131 }; 22132 if (force) { 22133 swiper.slides.filter(function (el) { 22134 return el.matches(".".concat(swiper.params.slideClass, ", swiper-slide")); 22135 }
22135).forEach(function (slideEl) { 22136 slideEl.remove(); 22137 }); 22138 } else { 22139 var _loop = function _loop() { 22140 if (i < from || i > to) { 22141 var slideIndex = getSlideIndex(i); 22142 swiper.slides.filter(function (el) { 22143 return el.matches(".".concat(swiper.params.slideClass, "[data-swiper-slide-index=\"").concat(slideIndex, "\"], swiper-slide[data-swiper-slide-index=\"").concat(slideIndex, "\"]")); 22144 }).forEach(function (slideEl) { 22145 slideEl.remove(); 22146 }); 22147 } 22148 }; 22149 for (var i = previousFrom; i <= previousTo; i += 1) { 22150 _loop(); 22151 } 22152 } 22153 var loopFrom = isLoop ? -slides.length : 0; 22154 var loopTo = isLoop ? slides.length * 2 : slides.length; 22155 for (var _i = loopFrom; _i < loopTo; _i += 1) { 22156 if (_i >= from && _i <= to) { 22157 var slideIndex = getSlideIndex(_i); 22158 if (typeof previousTo === 'undefined' || force) { 22159 appendIndexes.push(slideIndex); 22160 } else { 22161 if (_i > previousTo) appendIndexes.push(slideIndex); 22162 if (_i < previousFrom) prependIndexes.push(slideIndex); 22163 } 22164 } 22165 } 22166 appendIndexes.forEach(function (index) { 22167 swiper.slidesEl.append(renderSlide(slides[index], index)); 22168 }); 22169 if (isLoop) { 22170 for (var _i2 = prependIndexes.length - 1; _i2 >= 0; _i2 -= 1) { 22171 var index = prependIndexes[_i2]; 22172 swiper.slidesEl.prepend(renderSlide(slides[index], index)); 22173 } 22174 } else { 22175 prependIndexes.sort(function (a, b) { 22176 return b - a; 22177 }); 22178 prependIndexes.forEach(function (index) { 22179 swiper.slidesEl.prepend(renderSlide(slides[index], index)); 22180 }); 22181 } 22182 (0, _utils.e)(swiper.slidesEl, '.swiper-slide, swiper-slide').forEach(function (slideEl) { 22183 slideEl.style[offsetProp] = "".concat(offset - Math.abs(swiper.cssOverflowAdjustment()), "px"); 22184 }); 22185 onRendered(); 22186 } 22187 function appendSlide(slides) { 22188 if (_typeof(slides) === 'object' && 'length' in slides) { 22189 for (var i = 0; i < slides.length; i += 1) { 22190 if (slides[i]) swiper.virtual.slides.push(slides[i]); 22191 } 22192 } else { 22193 swiper.virtual.slides.push(slides); 22194 } 22195 update(true); 22196 } 22197 function prependSlide(slides) { 22198 var activeIndex = swiper.activeIndex; 22199 var newActiveIndex = activeIndex + 1; 22200 var numberOfNewSlides = 1; 22201 if (Array.isArray(slides)) { 22202 for (var i = 0; i < slides.length; i += 1) { 22203 if (slides[i]) swiper.virtual.slides.unshift(slides[i]); 22204 } 22205 newActiveIndex = activeIndex + slides.length; 22206 numberOfNewSlides = slides.length; 22207 } else { 22208 swiper.virtual.slides.unshift(slides); 22209 } 22210 if (swiper.params.virtual.cache) { 22211 var cache = swiper.virtual.cache; 22212 var newCache = {}; 22213 Object.keys(cache).forEach(function (cachedIndex) { 22214 var cachedEl = cache[cachedIndex]; 22215 var cachedElIndex = cachedEl.getAttribute('data-swiper-slide-index'); 22216 if (cachedElIndex) { 22217 cachedEl.setAttribute('data-swiper-slide-index', parseInt(cachedElIndex, 10) + numberOfNewSlides); 22218 } 22219 newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = cachedEl; 22220 }); 22221 swiper.virtual.cache = newCache; 22222 } 22223 update(true); 22224 swiper.slideTo(newActiveIndex, 0); 22225 } 22226 function removeSlide(slidesIndexes) { 22227 if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return; 22228 var activeIndex = swiper.activeIndex; 22229 if (Array.isArray(slidesIndexes)) { 22230 for (var i = slidesIndexes.length - 1; i >= 0; i -= 1) { 22231 if (swiper.params.virtual.cache) { 22232 delete swiper.virtual.cache[slidesIndexes[i]]; 22233 // shift cache indexes 22234 Object.keys(swiper.virtual.cache).forEach(function (key) { 22235 if (key > slidesIndexes) { 22236 swiper.virtual.cache[key - 1] = swiper.virtual.cache[key]; 22237 swiper.virtual.cache[key - 1].setAttribute('data-swiper-slide-index', key - 1); 22238 delete swiper.virtual.cache[key]; 22239 } 22240 }); 22241 } 22242 swiper.virtual.slides.splice(slidesIndexes[i], 1); 22243 if (slidesIndexes[i] < activeIndex) activeIndex -= 1; 22244 activeIndex = Math.max(activeIndex, 0); 22245 } 22246 } else { 22247 if (swiper.params.virtual.cache) { 22248 delete swiper.virtual.cache[slidesIndexes]; 22249 // shift cache indexes 22250 Object.keys(swiper.virtual.cache).forEach(function (key) { 22251 if (key > slidesIndexes) { 22252 swiper.virtual.cache[key - 1] = swiper.virtual.cache[key]; 22253 swiper.virtual.cache[key - 1].setAttribute('data-swiper-slide-index', key - 1); 22254 delete swiper.virtual.cache[key]; 22255 } 22256 }); 22257 } 22258 swiper.virtual.slides.splice(slidesIndexes, 1); 22259 if (slidesIndexes < activeIndex) activeIndex -= 1; 22260 activeIndex = Math.max(activeIndex, 0); 22261 } 22262 update(true); 22263 swiper.slideTo(activeIndex, 0); 22264 } 22265 function removeAllSlides() { 22266 swiper.virtual.slides = []; 22267 if (swiper.params.virtual.cache) { 22268 swiper.virtual.cache = {}; 22269 } 22270 update(true); 22271 swiper.slideTo(0, 0); 22272 } 22273 on('beforeInit', function () { 22274 if (!swiper.params.virtual.enabled) return; 22275 var domSlidesAssigned; 22276 if (typeof swiper.passedParams.virtual.slides === 'undefined') { 22277 var slides = _toConsumableArray(swiper.slidesEl.children).filter(function (el) { 22278 return el.matches(".".concat(swiper.params.slideClass, ", swiper-slide")); 22279 }); 22280 if (slides && slides.length) { 22281 swiper.virtual.slides = _toConsumableArray(slides); 22282 domSlidesAssigned = true;
22283 slides.forEach(function (slideEl, slideIndex) { 22284 slideEl.setAttribute('data-swiper-slide-index', slideIndex); 22285 swiper.virtual.cache[slideIndex] = slideEl; 22286 slideEl.remove(); 22287 }); 22288 } 22289 } 22290 if (!domSlidesAssigned) { 22291 swiper.virtual.slides = swiper.params.virtual.slides; 22292 } 22293 swiper.classNames.push("".concat(swiper.params.containerModifierClass, "virtual")); 22294 swiper.params.watchSlidesProgress = true; 22295 swiper.originalParams.watchSlidesProgress = true; 22296 update(false, true); 22297 }); 22298 on('setTranslate', function () { 22299 if (!swiper.params.virtual.enabled) return; 22300 if (swiper.params.cssMode && !swiper._immediateVirtual) { 22301 clearTimeout(cssModeTimeout); 22302 cssModeTimeout = setTimeout(function () { 22303 update(); 22304 }, 100); 22305 } else { 22306 update(); 22307 } 22308 }); 22309 on('init update resize', function () { 22310 if (!swiper.params.virtual.enabled) return; 22311 if (swiper.params.cssMode) { 22312 (0, _utils.b)(swiper.wrapperEl, '--swiper-virtual-size', "".concat(swiper.virtualSize, "px")); 22313 } 22314 }); 22315 _extends(swiper.virtual, { 22316 appendSlide: appendSlide, 22317 prependSlide: prependSlide, 22318 removeSlide: removeSlide, 22319 removeAllSlides: removeAllSlides, 22320 update: update 22321 }); 22322} 22323 22324},{"../shared/ssr-window.esm.mjs":67,"../shared/utils.mjs":69}],60:[function(require,module,exports){ 22325"use strict"; 22326 22327Object.defineProperty(exports, "__esModule", { 22328 value: true 22329}); 22330exports["default"] = Zoom; 22331var _ssrWindowEsm = require("../shared/ssr-window.esm.mjs"); 22332var _utils = require("../shared/utils.mjs"); 22333function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 22334function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } 22335function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 22336function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } 22337function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } 22338function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } 22339function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 22340function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 22341function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } 22342function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } 22343function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 22344function Zoom(_ref) { 22345 var swiper = _ref.swiper, 22346 extendParams = _ref.extendParams, 22347 on = _ref.on, 22348 emit = _ref.emit; 22349 var window = (0, _ssrWindowEsm.a)(); 22350 extendParams({ 22351 zoom: { 22352 enabled: false, 22353 limitToOriginalSize: false, 22354 maxRatio: 3, 22355 minRatio: 1, 22356 panOnMouseMove: false, 22357 toggle: true, 22358 containerClass: 'swiper-zoom-container', 22359 zoomedSlideClass: 'swiper-slide-zoomed' 22360 } 22361 }); 22362 swiper.zoom = { 22363 enabled: false 22364 }; 22365 var currentScale = 1; 22366 var isScaling = false;
22367 var isPanningWithMouse = false; 22368 var mousePanStart = { 22369 x: 0, 22370 y: 0 22371 }; 22372 var mousePanSensitivity = -3; // Negative to invert pan direction 22373 var fakeGestureTouched; 22374 var fakeGestureMoved; 22375 var evCache = []; 22376 var gesture = { 22377 originX: 0, 22378 originY: 0, 22379 slideEl: undefined, 22380 slideWidth: undefined, 22381 slideHeight: undefined, 22382 imageEl: undefined, 22383 imageWrapEl: undefined, 22384 maxRatio: 3 22385 }; 22386 var image = { 22387 isTouched: undefined, 22388 isMoved: undefined, 22389 currentX: undefined, 22390 currentY: undefined, 22391 minX: undefined, 22392 minY: undefined, 22393 maxX: undefined, 22394 maxY: undefined, 22395 width: undefined, 22396 height: undefined, 22397 startX: undefined, 22398 startY: undefined, 22399 touchesStart: {}, 22400 touchesCurrent: {} 22401 }; 22402 var velocity = { 22403 x: undefined, 22404 y: undefined, 22405 prevPositionX: undefined, 22406 prevPositionY: undefined, 22407 prevTime: undefined 22408 }; 22409 var scale = 1; 22410 Object.defineProperty(swiper.zoom, 'scale', { 22411 get: function get() { 22412 return scale; 22413 }, 22414 set: function set(value) { 22415 if (scale !== value) { 22416 var imageEl = gesture.imageEl; 22417 var slideEl = gesture.slideEl; 22418 emit('zoomChange', value, imageEl, slideEl); 22419 } 22420 scale = value; 22421 } 22422 }); 22423 function getDistanceBetweenTouches() { 22424 if (evCache.length < 2) return 1; 22425 var x1 = evCache[0].pageX; 22426 var y1 = evCache[0].pageY; 22427 var x2 = evCache[1].pageX; 22428 var y2 = evCache[1].pageY; 22429 var distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); 22430 return distance; 22431 } 22432 function getMaxRatio() { 22433 var params = swiper.params.zoom; 22434 var maxRatio = gesture.imageWrapEl.getAttribute('data-swiper-zoom') || params.maxRatio; 22435 if (params.limitToOriginalSize && gesture.imageEl && gesture.imageEl.naturalWidth) { 22436 var imageMaxRatio = gesture.imageEl.naturalWidth / gesture.imageEl.offsetWidth; 22437 return Math.min(imageMaxRatio, maxRatio); 22438 } 22439 return maxRatio; 22440 } 22441 function getScaleOrigin() { 22442 if (evCache.length < 2) return { 22443 x: null, 22444 y: null 22445 }; 22446 var box = gesture.imageEl.getBoundingClientRect(); 22447 return [(evCache[0].pageX + (evCache[1].pageX - evCache[0].pageX) / 2 - box.x - window.scrollX) / currentScale, (evCache[0].pageY + (evCache[1].pageY - evCache[0].pageY) / 2 - box.y - window.scrollY) / currentScale]; 22448 } 22449 function getSlideSelector() { 22450 return swiper.isElement ? "swiper-slide" : ".".concat(swiper.params.slideClass); 22451 } 22452 function eventWithinSlide(e) { 22453 var slideSelector = getSlideSelector(); 22454 if (e.target.matches(slideSelector)) return true; 22455 if (swiper.slides.filter(function (slideEl) { 22456 return slideEl.contains(e.target); 22457 }).length > 0) return true; 22458 return false; 22459 } 22460 function eventWithinZoomContainer(e) { 22461 var selector = ".".concat(swiper.params.zoom.containerClass); 22462 if (e.target.matches(selector)) return true; 22463 if (_toConsumableArray(swiper.hostEl.querySelectorAll(selector)).filter(function (containerEl) { 22464 return containerEl.contains(e.target); 22465 }).length > 0) return true; 22466 return false; 22467 } 22468 22469 // Events 22470 function onGestureStart(e) { 22471 if (e.pointerType === 'mouse') { 22472 evCache.splice(0, evCache.length); 22473 } 22474 if (!eventWithinSlide(e)) return; 22475 var params = swiper.params.zoom; 22476 fakeGestureTouched = false; 22477 fakeGestureMoved = false; 22478 evCache.push(e); 22479 if (evCache.length < 2) { 22480 return; 22481 } 22482 fakeGestureTouched = true; 22483 gesture.scaleStart = getDistanceBetweenTouches(); 22484 if (!gesture.slideEl) { 22485 gesture.slideEl = e.target.closest(".".concat(swiper.params.slideClass, ", swiper-slide")); 22486 if (!gesture.slideEl) gesture.slideEl = swiper.slides[swiper.activeIndex]; 22487 var imageEl = gesture.slideEl.querySelector(".".concat(params.containerClass)); 22488 if (imageEl) { 22489 imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0]; 22490 } 22491 gesture.imageEl = imageEl; 22492 if (imageEl) { 22493 gesture.imageWrapEl = (0, _utils.d)(gesture.imageEl, ".".concat(params.containerClass))[0]; 22494 } else { 22495 gesture.imageWrapEl = undefined; 22496 } 22497 if (!gesture.imageWrapEl) { 22498 gesture.imageEl = undefined; 22499 return; 22500 } 22501 gesture.maxRatio = getMaxRatio(); 22502 } 22503 if (gesture.imageEl) { 22504 var _getScaleOrigin = getScaleOrigin(), 22505 _getScaleOrigin2 = _slicedToArray(_getScaleOrigin, 2), 22506 originX = _getScaleOrigin2[0], 22507 originY = _getScaleOrigin2[1]; 22508 gesture.originX = originX; 22509 gesture.originY = originY; 22510 gesture.imageEl.style.transitionDuration = '0ms'; 22511 } 22512 isScaling = true; 22513 } 22514 function onGestureChange(e) { 22515 if (!eventWithinSlide(e)) return; 22516 var params = swiper.params.zoom; 22517 var zoom = swiper.zoom; 22518 var pointerIndex = evCache.findIndex(function (cachedEv) { 22519 return cachedEv.pointerId === e.pointerId; 22520 }); 22521 if (pointerIndex >= 0) evCache[pointerIndex] = e; 22522 if (evCache.length < 2) { 22523 return; 22524 } 22525 fakeGestureMoved = true; 22526 gesture.scaleMove = getDistanceBetweenTouches(); 22527 if (!gesture.imageEl) { 22528 return; 22529 } 22530 zoom.scale = gesture.scaleMove / gesture.scaleStart * currentScale; 22531 if (zoom.scale > gesture.maxRatio) { 22532 zoom.scale = gesture.maxRatio - 1 + Math.pow(zoom.scale - gesture.maxRatio + 1, 0.5); 22533 } 22534 if (zoom.scale < params.minRatio) { 22535 zoom.scale = params.minRatio + 1 - Math.pow(params.minRatio - zoom.scale + 1, 0.5); 22536 }
22537 gesture.imageEl.style.transform = "translate3d(0,0,0) scale(".concat(zoom.scale, ")"); 22538 } 22539 function onGestureEnd(e) { 22540 if (!eventWithinSlide(e)) return; 22541 if (e.pointerType === 'mouse' && e.type === 'pointerout') return; 22542 var params = swiper.params.zoom; 22543 var zoom = swiper.zoom; 22544 var pointerIndex = evCache.findIndex(function (cachedEv) { 22545 return cachedEv.pointerId === e.pointerId; 22546 }); 22547 if (pointerIndex >= 0) evCache.splice(pointerIndex, 1); 22548 if (!fakeGestureTouched || !fakeGestureMoved) { 22549 return; 22550 } 22551 fakeGestureTouched = false; 22552 fakeGestureMoved = false; 22553 if (!gesture.imageEl) return; 22554 zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio); 22555 gesture.imageEl.style.transitionDuration = "".concat(swiper.params.speed, "ms"); 22556 gesture.imageEl.style.transform = "translate3d(0,0,0) scale(".concat(zoom.scale, ")"); 22557 currentScale = zoom.scale; 22558 isScaling = false; 22559 if (zoom.scale > 1 && gesture.slideEl) { 22560 gesture.slideEl.classList.add("".concat(params.zoomedSlideClass)); 22561 } else if (zoom.scale <= 1 && gesture.slideEl) { 22562 gesture.slideEl.classList.remove("".concat(params.zoomedSlideClass)); 22563 } 22564 if (zoom.scale === 1) { 22565 gesture.originX = 0; 22566 gesture.originY = 0; 22567 gesture.slideEl = undefined; 22568 } 22569 } 22570 var allowTouchMoveTimeout; 22571 function allowTouchMove() { 22572 swiper.touchEventsData.preventTouchMoveFromPointerMove = false; 22573 } 22574 function preventTouchMove() { 22575 clearTimeout(allowTouchMoveTimeout); 22576 swiper.touchEventsData.preventTouchMoveFromPointerMove = true; 22577 allowTouchMoveTimeout = setTimeout(function () { 22578 if (swiper.destroyed) return; 22579 allowTouchMove(); 22580 }); 22581 } 22582 function onTouchStart(e) { 22583 var device = swiper.device; 22584 if (!gesture.imageEl) return; 22585 if (image.isTouched) return; 22586 if (device.android && e.cancelable) e.preventDefault(); 22587 image.isTouched = true; 22588 var event = evCache.length > 0 ? evCache[0] : e; 22589 image.touchesStart.x = event.pageX; 22590 image.touchesStart.y = event.pageY; 22591 } 22592 function onTouchMove(e) { 22593 var isMouseEvent = e.pointerType === 'mouse'; 22594 var isMousePan = isMouseEvent && swiper.params.zoom.panOnMouseMove; 22595 if (!eventWithinSlide(e) || !eventWithinZoomContainer(e)) { 22596 return; 22597 } 22598 var zoom = swiper.zoom; 22599 if (!gesture.imageEl) { 22600 return; 22601 } 22602 if (!image.isTouched || !gesture.slideEl) { 22603 if (isMousePan) onMouseMove(e); 22604 return; 22605 } 22606 if (isMousePan) { 22607 onMouseMove(e); 22608 return; 22609 } 22610 if (!image.isMoved) { 22611 image.width = gesture.imageEl.offsetWidth || gesture.imageEl.clientWidth; 22612 image.height = gesture.imageEl.offsetHeight || gesture.imageEl.clientHeight; 22613 image.startX = (0, _utils.l)(gesture.imageWrapEl, 'x') || 0; 22614 image.startY = (0, _utils.l)(gesture.imageWrapEl, 'y') || 0; 22615 gesture.slideWidth = gesture.slideEl.offsetWidth; 22616 gesture.slideHeight = gesture.slideEl.offsetHeight; 22617 gesture.imageWrapEl.style.transitionDuration = '0ms'; 22618 } 22619 // Define if we need image drag 22620 var scaledWidth = image.width * zoom.scale; 22621 var scaledHeight = image.height * zoom.scale; 22622 image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); 22623 image.maxX = -image.minX; 22624 image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); 22625 image.maxY = -image.minY; 22626 image.touchesCurrent.x = evCache.length > 0 ? evCache[0].pageX : e.pageX; 22627 image.touchesCurrent.y = evCache.length > 0 ? evCache[0].pageY : e.pageY; 22628 var touchesDiff = Math.max(Math.abs(image.touchesCurrent.x - image.touchesStart.x), Math.abs(image.touchesCurrent.y - image.touchesStart.y)); 22629 if (touchesDiff > 5) { 22630 swiper.allowClick = false; 22631 } 22632 if (!image.isMoved && !isScaling) { 22633 if (swiper.isHorizontal() && (Math.floor(image.minX) === Math.floor(image.startX) && image.touchesCurrent.x < image.touchesStart.x || Math.floor(image.maxX) === Math.floor(image.startX) && image.touchesCurrent.x > image.touchesStart.x)) { 22634 image.isTouched = false;
22635 allowTouchMove(); 22636 return; 22637 } 22638 if (!swiper.isHorizontal() && (Math.floor(image.minY) === Math.floor(image.startY) && image.touchesCurrent.y < image.touchesStart.y || Math.floor(image.maxY) === Math.floor(image.startY) && image.touchesCurrent.y > image.touchesStart.y)) { 22639 image.isTouched = false; 22640 allowTouchMove(); 22641 return; 22642 } 22643 } 22644 if (e.cancelable) { 22645 e.preventDefault(); 22646 } 22647 e.stopPropagation(); 22648 preventTouchMove(); 22649 image.isMoved = true; 22650 var scaleRatio = (zoom.scale - currentScale) / (gesture.maxRatio - swiper.params.zoom.minRatio); 22651 var originX = gesture.originX, 22652 originY = gesture.originY; 22653 image.currentX = image.touchesCurrent.x - image.touchesStart.x + image.startX + scaleRatio * (image.width - originX * 2); 22654 image.currentY = image.touchesCurrent.y - image.touchesStart.y + image.startY + scaleRatio * (image.height - originY * 2); 22655 if (image.currentX < image.minX) { 22656 image.currentX = image.minX + 1 - Math.pow(image.minX - image.currentX + 1, 0.8); 22657 } 22658 if (image.currentX > image.maxX) { 22659 image.currentX = image.maxX - 1 + Math.pow(image.currentX - image.maxX + 1, 0.8); 22660 } 22661 if (image.currentY < image.minY) { 22662 image.currentY = image.minY + 1 - Math.pow(image.minY - image.currentY + 1, 0.8); 22663 } 22664 if (image.currentY > image.maxY) { 22665 image.currentY = image.maxY - 1 + Math.pow(image.currentY - image.maxY + 1, 0.8); 22666 } 22667 22668 // Velocity 22669 if (!velocity.prevPositionX) velocity.prevPositionX = image.touchesCurrent.x; 22670 if (!velocity.prevPositionY) velocity.prevPositionY = image.touchesCurrent.y; 22671 if (!velocity.prevTime) velocity.prevTime = Date.now(); 22672 velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2; 22673 velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2; 22674 if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) velocity.x = 0; 22675 if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) velocity.y = 0; 22676 velocity.prevPositionX = image.touchesCurrent.x; 22677 velocity.prevPositionY = image.touchesCurrent.y; 22678 velocity.prevTime = Date.now(); 22679 gesture.imageWrapEl.style.transform = "translate3d(".concat(image.currentX, "px, ").concat(image.currentY, "px,0)"); 22680 } 22681 function onTouchEnd() { 22682 var zoom = swiper.zoom; 22683 evCache.length = 0; 22684 if (!gesture.imageEl) return; 22685 if (!image.isTouched || !image.isMoved) { 22686 image.isTouched = false; 22687 image.isMoved = false; 22688 return; 22689 } 22690 image.isTouched = false; 22691 image.isMoved = false; 22692 var momentumDurationX = 300; 22693 var momentumDurationY = 300; 22694 var momentumDistanceX = velocity.x * momentumDurationX; 22695 var newPositionX = image.currentX + momentumDistanceX; 22696 var momentumDistanceY = velocity.y * momentumDurationY; 22697 var newPositionY = image.currentY + momentumDistanceY; 22698 22699 // Fix duration 22700 if (velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x); 22701 if (velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y); 22702 var momentumDuration = Math.max(momentumDurationX, momentumDurationY); 22703 image.currentX = newPositionX; 22704 image.currentY = newPositionY; 22705 // Define if we need image drag 22706 var scaledWidth = image.width * zoom.scale; 22707 var scaledHeight = image.height * zoom.scale; 22708 image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); 22709 image.maxX = -image.minX; 22710 image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); 22711 image.maxY = -image.minY; 22712 image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX); 22713 image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY); 22714 gesture.imageWrapEl.style.transitionDuration = "".concat(momentumDuration, "ms"); 22715 gesture.imageWrapEl.style.transform = "translate3d(".concat(image.currentX, "px, ").concat(image.currentY, "px,0)"); 22716 } 22717 function onTransitionEnd() { 22718 var zoom = swiper.zoom; 22719 if (gesture.slideEl && swiper.activeIndex !== swiper.slides.indexOf(gesture.slideEl)) { 22720 if (gesture.imageEl) {
22721 gesture.imageEl.style.transform = 'translate3d(0,0,0) scale(1)'; 22722 } 22723 if (gesture.imageWrapEl) { 22724 gesture.imageWrapEl.style.transform = 'translate3d(0,0,0)'; 22725 } 22726 gesture.slideEl.classList.remove("".concat(swiper.params.zoom.zoomedSlideClass)); 22727 zoom.scale = 1; 22728 currentScale = 1; 22729 gesture.slideEl = undefined; 22730 gesture.imageEl = undefined; 22731 gesture.imageWrapEl = undefined; 22732 gesture.originX = 0; 22733 gesture.originY = 0; 22734 } 22735 } 22736 function onMouseMove(e) { 22737 // Only pan if zoomed in and mouse panning is enabled 22738 if (currentScale <= 1 || !gesture.imageWrapEl) return; 22739 if (!eventWithinSlide(e) || !eventWithinZoomContainer(e)) return; 22740 var currentTransform = window.getComputedStyle(gesture.imageWrapEl).transform; 22741 var matrix = new window.DOMMatrix(currentTransform); 22742 if (!isPanningWithMouse) { 22743 isPanningWithMouse = true; 22744 mousePanStart.x = e.clientX; 22745 mousePanStart.y = e.clientY; 22746 image.startX = matrix.e; 22747 image.startY = matrix.f; 22748 image.width = gesture.imageEl.offsetWidth || gesture.imageEl.clientWidth; 22749 image.height = gesture.imageEl.offsetHeight || gesture.imageEl.clientHeight; 22750 gesture.slideWidth = gesture.slideEl.offsetWidth; 22751 gesture.slideHeight = gesture.slideEl.offsetHeight; 22752 return; 22753 } 22754 var deltaX = (e.clientX - mousePanStart.x) * mousePanSensitivity; 22755 var deltaY = (e.clientY - mousePanStart.y) * mousePanSensitivity; 22756 var scaledWidth = image.width * currentScale; 22757 var scaledHeight = image.height * currentScale; 22758 var slideWidth = gesture.slideWidth; 22759 var slideHeight = gesture.slideHeight; 22760 var minX = Math.min(slideWidth / 2 - scaledWidth / 2, 0); 22761 var maxX = -minX; 22762 var minY = Math.min(slideHeight / 2 - scaledHeight / 2, 0); 22763 var maxY = -minY; 22764 var newX = Math.max(Math.min(image.startX + deltaX, maxX), minX); 22765 var newY = Math.max(Math.min(image.startY + deltaY, maxY), minY); 22766 gesture.imageWrapEl.style.transitionDuration = '0ms'; 22767 gesture.imageWrapEl.style.transform = "translate3d(".concat(newX, "px, ").concat(newY, "px, 0)"); 22768 mousePanStart.x = e.clientX; 22769 mousePanStart.y = e.clientY; 22770 image.startX = newX; 22771 image.startY = newY; 22772 image.currentX = newX; 22773 image.currentY = newY; 22774 } 22775 function zoomIn(e) { 22776 var zoom = swiper.zoom; 22777 var params = swiper.params.zoom; 22778 if (!gesture.slideEl) { 22779 if (e && e.target) { 22780 gesture.slideEl = e.target.closest(".".concat(swiper.params.slideClass, ", swiper-slide")); 22781 } 22782 if (!gesture.slideEl) { 22783 if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) { 22784 gesture.slideEl = (0, _utils.e)(swiper.slidesEl, ".".concat(swiper.params.slideActiveClass))[0]; 22785 } else { 22786 gesture.slideEl = swiper.slides[swiper.activeIndex]; 22787 } 22788 } 22789 var imageEl = gesture.slideEl.querySelector(".".concat(params.containerClass)); 22790 if (imageEl) { 22791 imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0]; 22792 } 22793 gesture.imageEl = imageEl; 22794 if (imageEl) { 22795 gesture.imageWrapEl = (0, _utils.d)(gesture.imageEl, ".".concat(params.containerClass))[0]; 22796 } else { 22797 gesture.imageWrapEl = undefined; 22798 } 22799 } 22800 if (!gesture.imageEl || !gesture.imageWrapEl) return; 22801 gesture.maxRatio = getMaxRatio(); 22802 if (swiper.params.cssMode) { 22803 swiper.wrapperEl.style.overflow = 'hidden'; 22804 swiper.wrapperEl.style.touchAction = 'none'; 22805 } 22806 gesture.slideEl.classList.add("".concat(params.zoomedSlideClass)); 22807 var touchX; 22808 var touchY; 22809 var offsetX; 22810 var offsetY; 22811 var diffX; 22812 var diffY; 22813 var translateX; 22814 var translateY; 22815 var imageWidth; 22816 var imageHeight; 22817 var scaledWidth; 22818 var scaledHeight; 22819 var translateMinX; 22820 var translateMinY; 22821 var translateMaxX; 22822 var translateMaxY; 22823 var slideWidth; 22824 var slideHeight; 22825 if (typeof image.touchesStart.x === 'undefined' && e) { 22826 touchX = e.pageX; 22827 touchY = e.pageY; 22828 } else { 22829 touchX = image.touchesStart.x; 22830 touchY = image.touchesStart.y; 22831 } 22832 var prevScale = currentScale; 22833 var forceZoomRatio = typeof e === 'number' ? e : null; 22834 if (currentScale === 1 && forceZoomRatio) { 22835 touchX = undefined; 22836 touchY = undefined; 22837 image.touchesStart.x = undefined; 22838 image.touchesStart.y = undefined; 22839 } 22840 var maxRatio = getMaxRatio(); 22841 zoom.scale = forceZoomRatio || maxRatio; 22842 currentScale = forceZoomRatio || maxRatio; 22843 if (e && !(currentScale === 1 && forceZoomRatio)) { 22844 slideWidth = gesture.slideEl.offsetWidth; 22845 slideHeight = gesture.slideEl.offsetHeight; 22846 offsetX = (0, _utils.f)(gesture.slideEl).left + window.scrollX; 22847 offsetY = (0, _utils.f)(gesture.slideEl).top + window.scrollY; 22848 diffX = offsetX + slideWidth / 2 - touchX; 22849 diffY = offsetY + slideHeight / 2 - touchY; 22850 imageWidth = gesture.imageEl.offsetWidth || gesture.imageEl.clientWidth; 22851 imageHeight = gesture.imageEl.offsetHeight || gesture.imageEl.clientHeight; 22852 scaledWidth = imageWidth * zoom.scale; 22853 scaledHeight = imageHeight * zoom.scale; 22854 translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0); 22855 translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0); 22856 translateMaxX = -translateMinX; 22857 translateMaxY = -translateMinY; 22858 if (prevScale > 0 && forceZoomRatio && typeof image.currentX === 'number' && typeof image.currentY === 'number') { 22859 translateX = image.currentX * zoom.scale / prevScale; 22860 translateY = image.currentY * zoom.scale / prevScale; 22861 } else { 22862 translateX = diffX * zoom.scale; 22863 translateY = diffY * zoom.scale; 22864 } 22865 if (translateX < translateMinX) { 22866 translateX = translateMinX; 22867 } 22868 if (translateX > translateMaxX) { 22869 translateX = translateMaxX; 22870 } 22871 if (translateY < translateMinY) { 22872 translateY = translateMinY; 22873 } 22874 if (translateY > translateMaxY) { 22875 translateY = translateMaxY; 22876 } 22877 } else { 22878 translateX = 0; 22879 translateY = 0; 22880 } 22881 if (forceZoomRatio && zoom.scale === 1) { 22882 gesture.originX = 0; 22883 gesture.originY = 0; 22884 } 22885 image.currentX = translateX; 22886 image.currentY = translateY; 22887 gesture.imageWrapEl.style.transitionDuration = '300ms'; 22888 gesture.imageWrapEl.style.transform = "translate3d(".concat(translateX, "px, ").concat(translateY, "px,0)"); 22889 gesture.imageEl.style.transitionDuration = '300ms';
22890 gesture.imageEl.style.transform = "translate3d(0,0,0) scale(".concat(zoom.scale, ")"); 22891 } 22892 function zoomOut() { 22893 var zoom = swiper.zoom; 22894 var params = swiper.params.zoom; 22895 if (!gesture.slideEl) { 22896 if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) { 22897 gesture.slideEl = (0, _utils.e)(swiper.slidesEl, ".".concat(swiper.params.slideActiveClass))[0]; 22898 } else { 22899 gesture.slideEl = swiper.slides[swiper.activeIndex]; 22900 } 22901 var imageEl = gesture.slideEl.querySelector(".".concat(params.containerClass)); 22902 if (imageEl) { 22903 imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0]; 22904 } 22905 gesture.imageEl = imageEl; 22906 if (imageEl) { 22907 gesture.imageWrapEl = (0, _utils.d)(gesture.imageEl, ".".concat(params.containerClass))[0]; 22908 } else { 22909 gesture.imageWrapEl = undefined; 22910 } 22911 } 22912 if (!gesture.imageEl || !gesture.imageWrapEl) return; 22913 gesture.maxRatio = getMaxRatio(); 22914 if (swiper.params.cssMode) { 22915 swiper.wrapperEl.style.overflow = ''; 22916 swiper.wrapperEl.style.touchAction = ''; 22917 } 22918 zoom.scale = 1; 22919 currentScale = 1; 22920 image.currentX = undefined; 22921 image.currentY = undefined; 22922 image.touchesStart.x = undefined; 22923 image.touchesStart.y = undefined; 22924 gesture.imageWrapEl.style.transitionDuration = '300ms'; 22925 gesture.imageWrapEl.style.transform = 'translate3d(0,0,0)'; 22926 gesture.imageEl.style.transitionDuration = '300ms'; 22927 gesture.imageEl.style.transform = 'translate3d(0,0,0) scale(1)'; 22928 gesture.slideEl.classList.remove("".concat(params.zoomedSlideClass)); 22929 gesture.slideEl = undefined; 22930 gesture.originX = 0; 22931 gesture.originY = 0; 22932 if (swiper.params.zoom.panOnMouseMove) { 22933 mousePanStart = { 22934 x: 0, 22935 y: 0 22936 }; 22937 if (isPanningWithMouse) { 22938 isPanningWithMouse = false; 22939 image.startX = 0; 22940 image.startY = 0; 22941 } 22942 } 22943 } 22944 22945 // Toggle Zoom 22946 function zoomToggle(e) { 22947 var zoom = swiper.zoom; 22948 if (zoom.scale && zoom.scale !== 1) { 22949 // Zoom Out 22950 zoomOut(); 22951 } else { 22952 // Zoom In 22953 zoomIn(e); 22954 } 22955 } 22956 function getListeners() { 22957 var passiveListener = swiper.params.passiveListeners ? { 22958 passive: true, 22959 capture: false 22960 } : false; 22961 var activeListenerWithCapture = swiper.params.passiveListeners ? { 22962 passive: false, 22963 capture: true 22964 } : true; 22965 return { 22966 passiveListener: passiveListener, 22967 activeListenerWithCapture: activeListenerWithCapture 22968 }; 22969 } 22970 22971 // Attach/Detach Events 22972 function enable() { 22973 var zoom = swiper.zoom; 22974 if (zoom.enabled) return; 22975 zoom.enabled = true; 22976 var _getListeners = getListeners(), 22977 passiveListener = _getListeners.passiveListener, 22978 activeListenerWithCapture = _getListeners.activeListenerWithCapture; 22979 22980 // Scale image 22981 swiper.wrapperEl.addEventListener('pointerdown', onGestureStart, passiveListener); 22982 swiper.wrapperEl.addEventListener('pointermove', onGestureChange, activeListenerWithCapture); 22983 ['pointerup', 'pointercancel', 'pointerout'].forEach(function (eventName) { 22984 swiper.wrapperEl.addEventListener(eventName, onGestureEnd, passiveListener); 22985 }); 22986 22987 // Move image 22988 swiper.wrapperEl.addEventListener('pointermove', onTouchMove, activeListenerWithCapture); 22989 } 22990 function disable() { 22991 var zoom = swiper.zoom; 22992 if (!zoom.enabled) return; 22993 zoom.enabled = false; 22994 var _getListeners2 = getListeners(), 22995 passiveListener = _getListeners2.passiveListener, 22996 activeListenerWithCapture = _getListeners2.activeListenerWithCapture; 22997 22998 // Scale image 22999 swiper.wrapperEl.removeEventListener('pointerdown', onGestureStart, passiveListener); 23000 swiper.wrapperEl.removeEventListener('pointermove', onGestureChange, activeListenerWithCapture); 23001 ['pointerup', 'pointercancel', 'pointerout'].forEach(function (eventName) { 23002 swiper.wrapperEl.removeEventListener(eventName, onGestureEnd, passiveListener); 23003 }); 23004 23005 // Move image 23006 swiper.wrapperEl.removeEventListener('pointermove', onTouchMove, activeListenerWithCapture); 23007 } 23008 on('init', function () { 23009 if (swiper.params.zoom.enabled) { 23010 enable(); 23011 } 23012 }); 23013 on('destroy', function () { 23014 disable(); 23015 }); 23016 on('touchStart', function (_s, e) { 23017 if (!swiper.zoom.enabled) return; 23018 onTouchStart(e); 23019 }); 23020 on('touchEnd', function (_s, e) { 23021 if (!swiper.zoom.enabled) return; 23022 onTouchEnd(); 23023 }); 23024 on('doubleTap', function (_s, e) { 23025 if (!swiper.animating && swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) { 23026 zoomToggle(e); 23027 } 23028 }); 23029 on('transitionEnd', function () { 23030 if (swiper.zoom.enabled && swiper.params.zoom.enabled) { 23031 onTransitionEnd(); 23032 } 23033 }); 23034 on('slideChange', function () { 23035 if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssMode) { 23036 onTransitionEnd(); 23037 } 23038 }); 23039 _extends(swiper.zoom, { 23040 enable: enable, 23041 disable: disable, 23042 "in": zoomIn, 23043 out: zoomOut, 23044 toggle: zoomToggle 23045 }); 23046} 23047 23048},{"../shared/ssr-window.esm.mjs":67,"../shared/utils.mjs":69}],61:[function(require,module,exports){ 23049"use strict"; 23050 23051Object.defineProperty(exports, "__esModule", { 23052 value: true 23053}); 23054exports.c = classesToSelector; 23055function classesToSelector() { 23056 var classes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; 23057 // Escape all CSS selector special characters 23058 return ".".concat(classes.trim().replace(/([\.:!+\/()[\]#>~*^$|=,'"@{}\\])/g, '\\$1') // eslint-disable-line 23059 .replace(/ /g, '.')); 23060} 23061 23062},{}],62:[function(require,module,exports){ 23063"use strict"; 23064 23065Object.defineProperty(exports, "__esModule", { 23066 value: true 23067}); 23068exports.c = createElementIfNotDefined; 23069var _utils = require("./utils.mjs"); 23070function createElementIfNotDefined(swiper, originalParams, params, checkProps) { 23071 if (swiper.params.createElements) {
23072 Object.keys(checkProps).forEach(function (key) { 23073 if (!params[key] && params.auto === true) { 23074 var element = (0, _utils.e)(swiper.el, ".".concat(checkProps[key]))[0]; 23075 if (!element) { 23076 element = (0, _utils.c)('div', checkProps[key]); 23077 element.className = checkProps[key]; 23078 swiper.el.append(element); 23079 } 23080 params[key] = element; 23081 originalParams[key] = element; 23082 } 23083 }); 23084 } 23085 return params; 23086} 23087 23088},{"./utils.mjs":69}],63:[function(require,module,exports){ 23089"use strict"; 23090 23091Object.defineProperty(exports, "__esModule", { 23092 value: true 23093}); 23094exports.c = createShadow; 23095var _utils = require("./utils.mjs"); 23096function createShadow(suffix, slideEl, side) { 23097 var shadowClass = "swiper-slide-shadow".concat(side ? "-".concat(side) : '').concat(suffix ? " swiper-slide-shadow-".concat(suffix) : ''); 23098 var shadowContainer = (0, _utils.g)(slideEl); 23099 var shadowEl = shadowContainer.querySelector(".".concat(shadowClass.split(' ').join('.'))); 23100 if (!shadowEl) { 23101 shadowEl = (0, _utils.c)('div', shadowClass.split(' ')); 23102 shadowContainer.append(shadowEl); 23103 } 23104 return shadowEl; 23105} 23106 23107},{"./utils.mjs":69}],64:[function(require,module,exports){ 23108"use strict"; 23109 23110Object.defineProperty(exports, "__esModule", { 23111 value: true 23112}); 23113exports.e = effectInit; 23114function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 23115function effectInit(params) { 23116 var effect = params.effect, 23117 swiper = params.swiper, 23118 on = params.on, 23119 setTranslate = params.setTranslate, 23120 setTransition = params.setTransition, 23121 overwriteParams = params.overwriteParams, 23122 perspective = params.perspective, 23123 recreateShadows = params.recreateShadows, 23124 getEffectParams = params.getEffectParams; 23125 on('beforeInit', function () { 23126 if (swiper.params.effect !== effect) return; 23127 swiper.classNames.push("".concat(swiper.params.containerModifierClass).concat(effect)); 23128 if (perspective && perspective()) { 23129 swiper.classNames.push("".concat(swiper.params.containerModifierClass, "3d")); 23130 } 23131 var overwriteParamsResult = overwriteParams ? overwriteParams() : {}; 23132 _extends(swiper.params, overwriteParamsResult); 23133 _extends(swiper.originalParams, overwriteParamsResult); 23134 }); 23135 on('setTranslate _virtualUpdated', function () { 23136 if (swiper.params.effect !== effect) return; 23137 setTranslate(); 23138 }); 23139 on('setTransition', function (_s, duration) { 23140 if (swiper.params.effect !== effect) return; 23141 setTransition(duration); 23142 }); 23143 on('transitionEnd', function () { 23144 if (swiper.params.effect !== effect) return; 23145 if (recreateShadows) { 23146 if (!getEffectParams || !getEffectParams().slideShadows) return; 23147 // remove shadows 23148 swiper.slides.forEach(function (slideEl) { 23149 slideEl.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(function (shadowEl) { 23150 return shadowEl.remove(); 23151 }); 23152 }); 23153 // create new one 23154 recreateShadows(); 23155 } 23156 }); 23157 var requireUpdateOnVirtual; 23158 on('virtualUpdate', function () { 23159 if (swiper.params.effect !== effect) return; 23160 if (!swiper.slides.length) { 23161 requireUpdateOnVirtual = true; 23162 } 23163 requestAnimationFrame(function () { 23164 if (requireUpdateOnVirtual && swiper.slides && swiper.slides.length) { 23165 setTranslate(); 23166 requireUpdateOnVirtual = false; 23167 } 23168 }); 23169 }); 23170} 23171 23172},{}],65:[function(require,module,exports){ 23173"use strict"; 23174 23175Object.defineProperty(exports, "__esModule", { 23176 value: true 23177}); 23178exports.e = effectTarget; 23179var _utils = require("./utils.mjs"); 23180function effectTarget(effectParams, slideEl) { 23181 var transformEl = (0, _utils.g)(slideEl); 23182 if (transformEl !== slideEl) { 23183 transformEl.style.backfaceVisibility = 'hidden'; 23184 transformEl.style['-webkit-backface-visibility'] = 'hidden'; 23185 } 23186 return transformEl; 23187} 23188 23189},{"./utils.mjs":69}],66:[function(require,module,exports){ 23190"use strict"; 23191 23192Object.defineProperty(exports, "__esModule", { 23193 value: true 23194}); 23195exports.e = effectVirtualTransitionEnd; 23196var _utils = require("./utils.mjs"); 23197function effectVirtualTransitionEnd(_ref) { 23198 var swiper = _ref.swiper, 23199 duration = _ref.duration, 23200 transformElements = _ref.transformElements, 23201 allSlides = _ref.allSlides; 23202 var activeIndex = swiper.activeIndex; 23203 var getSlide = function getSlide(el) { 23204 if (!el.parentElement) { 23205 // assume shadow root 23206 var slide = swiper.slides.find(function (slideEl) { 23207 return slideEl.shadowRoot && slideEl.shadowRoot === el.parentNode; 23208 }); 23209 return slide; 23210 } 23211 return el.parentElement; 23212 }; 23213 if (swiper.params.virtualTranslate && duration !== 0) { 23214 var eventTriggered = false;
23215 var transitionEndTarget; 23216 if (allSlides) { 23217 transitionEndTarget = transformElements; 23218 } else { 23219 transitionEndTarget = transformElements.filter(function (transformEl) { 23220 var el = transformEl.classList.contains('swiper-slide-transform') ? getSlide(transformEl) : transformEl; 23221 return swiper.getSlideIndex(el) === activeIndex; 23222 }); 23223 } 23224 transitionEndTarget.forEach(function (el) { 23225 (0, _utils.o)(el, function () { 23226 if (eventTriggered) return; 23227 if (!swiper || swiper.destroyed) return; 23228 eventTriggered = true; 23229 swiper.animating = false; 23230 var evt = new window.CustomEvent('transitionend', { 23231 bubbles: true, 23232 cancelable: true 23233 }); 23234 swiper.wrapperEl.dispatchEvent(evt); 23235 }); 23236 }); 23237 } 23238} 23239 23240},{"./utils.mjs":69}],67:[function(require,module,exports){ 23241"use strict"; 23242 23243Object.defineProperty(exports, "__esModule", { 23244 value: true 23245}); 23246exports.a = getWindow; 23247exports.g = getDocument; 23248function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 23249/** 23250 * SSR Window 5.0.1 23251 * Better handling for window object in SSR environment 23252 * https://github.com/nolimits4web/ssr-window 23253 * 23254 * Copyright 2025, Vladimir Kharlampidi 23255 * 23256 * Licensed under MIT 23257 * 23258 * Released on: June 27, 2025 23259 */ 23260/* eslint-disable no-param-reassign */ 23261function isObject(obj) { 23262 return obj !== null && _typeof(obj) === 'object' && 'constructor' in obj && obj.constructor === Object; 23263} 23264function extend() { 23265 var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 23266 var src = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 23267 var noExtend = ['__proto__', 'constructor', 'prototype']; 23268 Object.keys(src).filter(function (key) { 23269 return noExtend.indexOf(key) < 0; 23270 }).forEach(function (key) { 23271 if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) { 23272 extend(target[key], src[key]); 23273 } 23274 }); 23275} 23276var ssrDocument = { 23277 body: {}, 23278 addEventListener: function addEventListener() {}, 23279 removeEventListener: function removeEventListener() {}, 23280 activeElement: { 23281 blur: function blur() {}, 23282 nodeName: '' 23283 }, 23284 querySelector: function querySelector() { 23285 return null; 23286 }, 23287 querySelectorAll: function querySelectorAll() { 23288 return []; 23289 }, 23290 getElementById: function getElementById() { 23291 return null; 23292 }, 23293 createEvent: function createEvent() { 23294 return { 23295 initEvent: function initEvent() {} 23296 }; 23297 }, 23298 createElement: function createElement() { 23299 return { 23300 children: [], 23301 childNodes: [], 23302 style: {}, 23303 setAttribute: function setAttribute() {}, 23304 getElementsByTagName: function getElementsByTagName() { 23305 return []; 23306 } 23307 }; 23308 }, 23309 createElementNS: function createElementNS() { 23310 return {}; 23311 }, 23312 importNode: function importNode() { 23313 return null; 23314 }, 23315 location: { 23316 hash: '', 23317 host: '', 23318 hostname: '', 23319 href: '', 23320 origin: '', 23321 pathname: '', 23322 protocol: '', 23323 search: '' 23324 } 23325}; 23326function getDocument() { 23327 var doc = typeof document !== 'undefined' ? document : {}; 23328 extend(doc, ssrDocument); 23329 return doc; 23330} 23331var ssrWindow = { 23332 document: ssrDocument, 23333 navigator: { 23334 userAgent: '' 23335 }, 23336 location: { 23337 hash: '', 23338 host: '', 23339 hostname: '', 23340 href: '', 23341 origin: '', 23342 pathname: '', 23343 protocol: '', 23344 search: '' 23345 }, 23346 history: { 23347 replaceState: function replaceState() {}, 23348 pushState: function pushState() {}, 23349 go: function go() {}, 23350 back: function back() {} 23351 }, 23352 CustomEvent: function CustomEvent() { 23353 return this; 23354 }, 23355 addEventListener: function addEventListener() {}, 23356 removeEventListener: function removeEventListener() {}, 23357 getComputedStyle: function getComputedStyle() { 23358 return { 23359 getPropertyValue: function getPropertyValue() { 23360 return ''; 23361 } 23362 }; 23363 }, 23364 Image: function Image() {}, 23365 Date: function Date() {}, 23366 screen: {}, 23367 setTimeout: function setTimeout() {},
23368 clearTimeout: function clearTimeout() {}, 23369 matchMedia: function matchMedia() { 23370 return {}; 23371 }, 23372 requestAnimationFrame: function requestAnimationFrame(callback) { 23373 if (typeof setTimeout === 'undefined') { 23374 callback(); 23375 return null; 23376 } 23377 return setTimeout(callback, 0); 23378 }, 23379 cancelAnimationFrame: function cancelAnimationFrame(id) { 23380 if (typeof setTimeout === 'undefined') { 23381 return; 23382 } 23383 clearTimeout(id); 23384 } 23385}; 23386function getWindow() { 23387 var win = typeof window !== 'undefined' ? window : {}; 23388 extend(win, ssrWindow); 23389 return win; 23390} 23391 23392},{}],68:[function(require,module,exports){ 23393"use strict"; 23394 23395Object.defineProperty(exports, "__esModule", { 23396 value: true 23397}); 23398exports.d = exports.S = void 0; 23399var _ssrWindowEsm = require("./ssr-window.esm.mjs"); 23400var _utils = require("./utils.mjs"); 23401function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 23402function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 23403function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 23404function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 23405function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } 23406function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } 23407function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } 23408function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 23409function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 23410function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 23411function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } 23412function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 23413function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } 23414function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } 23415function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } 23416function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 23417function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 23418function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 23419function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } 23420function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } 23421var support; 23422function calcSupport() { 23423 var window = (0, _ssrWindowEsm.a)(); 23424 var document = (0, _ssrWindowEsm.g)(); 23425 return { 23426 smoothScroll: document.documentElement && document.documentElement.style && 'scrollBehavior' in document.documentElement.style, 23427 touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch) 23428 }; 23429}
23430function getSupport() { 23431 if (!support) { 23432 support = calcSupport(); 23433 } 23434 return support; 23435} 23436var deviceCached; 23437function calcDevice() { 23438 var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, 23439 userAgent = _ref.userAgent; 23440 var support = getSupport(); 23441 var window = (0, _ssrWindowEsm.a)(); 23442 var platform = window.navigator.platform; 23443 var ua = userAgent || window.navigator.userAgent; 23444 var device = { 23445 ios: false, 23446 android: false 23447 }; 23448 var screenWidth = window.screen.width; 23449 var screenHeight = window.screen.height; 23450 var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line 23451 var ipad = ua.match(/(iPad)(?!\1).*OS\s([\d_]+)/); 23452 var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/); 23453 var iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); 23454 var windows = platform === 'Win32'; 23455 var macos = platform === 'MacIntel'; 23456 23457 // iPadOs 13 fix 23458 var iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810']; 23459 if (!ipad && macos && support.touch && iPadScreens.indexOf("".concat(screenWidth, "x").concat(screenHeight)) >= 0) { 23460 ipad = ua.match(/(Version)\/([\d.]+)/); 23461 if (!ipad) ipad = [0, 1, '13_0_0']; 23462 macos = false; 23463 } 23464 23465 // Android 23466 if (android && !windows) { 23467 device.os = 'android'; 23468 device.android = true; 23469 } 23470 if (ipad || iphone || ipod) { 23471 device.os = 'ios'; 23472 device.ios = true; 23473 } 23474 23475 // Export object 23476 return device; 23477} 23478function getDevice() { 23479 var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 23480 if (!deviceCached) { 23481 deviceCached = calcDevice(overrides); 23482 } 23483 return deviceCached; 23484} 23485var browser; 23486function calcBrowser() { 23487 var window = (0, _ssrWindowEsm.a)(); 23488 var device = getDevice(); 23489 var needPerspectiveFix = false; 23490 function isSafari() { 23491 var ua = window.navigator.userAgent.toLowerCase(); 23492 return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0; 23493 } 23494 if (isSafari()) { 23495 var ua = String(window.navigator.userAgent); 23496 if (ua.includes('Version/')) { 23497 var _ua$split$1$split$0$s = ua.split('Version/')[1].split(' ')[0].split('.').map(function (num) { 23498 return Number(num); 23499 }), 23500 _ua$split$1$split$0$s2 = _slicedToArray(_ua$split$1$split$0$s, 2), 23501 major = _ua$split$1$split$0$s2[0], 23502 minor = _ua$split$1$split$0$s2[1]; 23503 needPerspectiveFix = major < 16 || major === 16 && minor < 2; 23504 } 23505 } 23506 var isWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent); 23507 var isSafariBrowser = isSafari(); 23508 var need3dFix = isSafariBrowser || isWebView && device.ios; 23509 return { 23510 isSafari: needPerspectiveFix || isSafariBrowser, 23511 needPerspectiveFix: needPerspectiveFix, 23512 need3dFix: need3dFix, 23513 isWebView: isWebView 23514 }; 23515} 23516function getBrowser() { 23517 if (!browser) { 23518 browser = calcBrowser(); 23519 } 23520 return browser; 23521} 23522function Resize(_ref2) { 23523 var swiper = _ref2.swiper, 23524 on = _ref2.on, 23525 emit = _ref2.emit; 23526 var window = (0, _ssrWindowEsm.a)(); 23527 var observer = null; 23528 var animationFrame = null; 23529 var resizeHandler = function resizeHandler() { 23530 if (!swiper || swiper.destroyed || !swiper.initialized) return; 23531 emit('beforeResize'); 23532 emit('resize'); 23533 }; 23534 var createObserver = function createObserver() { 23535 if (!swiper || swiper.destroyed || !swiper.initialized) return; 23536 observer = new ResizeObserver(function (entries) { 23537 animationFrame = window.requestAnimationFrame(function () { 23538 var width = swiper.width, 23539 height = swiper.height; 23540 var newWidth = width; 23541 var newHeight = height; 23542 entries.forEach(function (_ref3) { 23543 var contentBoxSize = _ref3.contentBoxSize, 23544 contentRect = _ref3.contentRect, 23545 target = _ref3.target; 23546 if (target && target !== swiper.el) return; 23547 newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize; 23548 newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize; 23549 }); 23550 if (newWidth !== width || newHeight !== height) { 23551 resizeHandler(); 23552 } 23553 }); 23554 }); 23555 observer.observe(swiper.el); 23556 }; 23557 var removeObserver = function removeObserver() { 23558 if (animationFrame) { 23559 window.cancelAnimationFrame(animationFrame); 23560 } 23561 if (observer && observer.unobserve && swiper.el) { 23562 observer.unobserve(swiper.el); 23563 observer = null; 23564 } 23565 }; 23566 var orientationChangeHandler = function orientationChangeHandler() { 23567 if (!swiper || swiper.destroyed || !swiper.initialized) return; 23568 emit('orientationchange'); 23569 }; 23570 on('init', function () { 23571 if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') { 23572 createObserver(); 23573 return; 23574 } 23575 window.addEventListener('resize', resizeHandler); 23576 window.addEventListener('orientationchange', orientationChangeHandler); 23577 }); 23578 on('destroy', function () { 23579 removeObserver(); 23580 window.removeEventListener('resize', resizeHandler); 23581 window.removeEventListener('orientationchange', orientationChangeHandler); 23582 }); 23583} 23584function Observer(_ref4) { 23585 var swiper = _ref4.swiper, 23586 extendParams = _ref4.extendParams, 23587 on = _ref4.on, 23588 emit = _ref4.emit; 23589 var observers = []; 23590 var window = (0, _ssrWindowEsm.a)(); 23591 var attach = function attach(target) { 23592 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 23593 var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver; 23594 var observer = new ObserverFunc(function (mutations) { 23595 // The observerUpdate event should only be triggered 23596 // once despite the number of mutations. Additional 23597 // triggers are redundant and are very costly 23598 if (swiper.__preventObserver__) return; 23599 if (mutations.length === 1) { 23600 emit('observerUpdate', mutations[0]); 23601 return; 23602 } 23603 var observerUpdate = function observerUpdate() { 23604 emit('observerUpdate', mutations[0]); 23605 }; 23606 if (window.requestAnimationFrame) { 23607 window.requestAnimationFrame(observerUpdate); 23608 } else { 23609 window.setTimeout(observerUpdate, 0); 23610 } 23611 }); 23612 observer.observe(target, { 23613 attributes: typeof options.attributes === 'undefined' ? true : options.attributes, 23614 childList: swiper.isElement || (typeof options.childList === 'undefined' ? true : options).childList, 23615 characterData: typeof options.characterData === 'undefined' ? true : options.characterData 23616 }); 23617 observers.push(observer); 23618 };
23619 var init = function init() { 23620 if (!swiper.params.observer) return; 23621 if (swiper.params.observeParents) { 23622 var containerParents = (0, _utils.d)(swiper.hostEl); 23623 for (var i = 0; i < containerParents.length; i += 1) { 23624 attach(containerParents[i]); 23625 } 23626 } 23627 // Observe container 23628 attach(swiper.hostEl, { 23629 childList: swiper.params.observeSlideChildren 23630 }); 23631 23632 // Observe wrapper 23633 attach(swiper.wrapperEl, { 23634 attributes: false 23635 }); 23636 }; 23637 var destroy = function destroy() { 23638 observers.forEach(function (observer) { 23639 observer.disconnect(); 23640 }); 23641 observers.splice(0, observers.length); 23642 }; 23643 extendParams({ 23644 observer: false, 23645 observeParents: false, 23646 observeSlideChildren: false 23647 }); 23648 on('init', init); 23649 on('destroy', destroy); 23650} 23651 23652/* eslint-disable no-underscore-dangle */ 23653 23654var eventsEmitter = { 23655 on: function on(events, handler, priority) { 23656 var self = this; 23657 if (!self.eventsListeners || self.destroyed) return self; 23658 if (typeof handler !== 'function') return self; 23659 var method = priority ? 'unshift' : 'push'; 23660 events.split(' ').forEach(function (event) { 23661 if (!self.eventsListeners[event]) self.eventsListeners[event] = []; 23662 self.eventsListeners[event][method](handler); 23663 }); 23664 return self; 23665 }, 23666 once: function once(events, handler, priority) { 23667 var self = this; 23668 if (!self.eventsListeners || self.destroyed) return self; 23669 if (typeof handler !== 'function') return self; 23670 function onceHandler() { 23671 self.off(events, onceHandler); 23672 if (onceHandler.__emitterProxy) { 23673 delete onceHandler.__emitterProxy; 23674 } 23675 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 23676 args[_key] = arguments[_key]; 23677 } 23678 handler.apply(self, args); 23679 } 23680 onceHandler.__emitterProxy = handler; 23681 return self.on(events, onceHandler, priority); 23682 }, 23683 onAny: function onAny(handler, priority) { 23684 var self = this; 23685 if (!self.eventsListeners || self.destroyed) return self; 23686 if (typeof handler !== 'function') return self; 23687 var method = priority ? 'unshift' : 'push'; 23688 if (self.eventsAnyListeners.indexOf(handler) < 0) { 23689 self.eventsAnyListeners[method](handler); 23690 } 23691 return self; 23692 }, 23693 offAny: function offAny(handler) { 23694 var self = this; 23695 if (!self.eventsListeners || self.destroyed) return self; 23696 if (!self.eventsAnyListeners) return self; 23697 var index = self.eventsAnyListeners.indexOf(handler); 23698 if (index >= 0) { 23699 self.eventsAnyListeners.splice(index, 1); 23700 } 23701 return self; 23702 }, 23703 off: function off(events, handler) { 23704 var self = this; 23705 if (!self.eventsListeners || self.destroyed) return self; 23706 if (!self.eventsListeners) return self; 23707 events.split(' ').forEach(function (event) { 23708 if (typeof handler === 'undefined') { 23709 self.eventsListeners[event] = []; 23710 } else if (self.eventsListeners[event]) { 23711 self.eventsListeners[event].forEach(function (eventHandler, index) { 23712 if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) { 23713 self.eventsListeners[event].splice(index, 1); 23714 } 23715 }); 23716 } 23717 }); 23718 return self; 23719 }, 23720 emit: function emit() { 23721 var self = this; 23722 if (!self.eventsListeners || self.destroyed) return self; 23723 if (!self.eventsListeners) return self; 23724 var events; 23725 var data; 23726 var context; 23727 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 23728 args[_key2] = arguments[_key2]; 23729 } 23730 if (typeof args[0] === 'string' || Array.isArray(args[0])) { 23731 events = args[0]; 23732 data = args.slice(1, args.length); 23733 context = self; 23734 } else { 23735 events = args[0].events; 23736 data = args[0].data; 23737 context = args[0].context || self; 23738 } 23739 data.unshift(context); 23740 var eventsArray = Array.isArray(events) ? events : events.split(' '); 23741 eventsArray.forEach(function (event) { 23742 if (self.eventsAnyListeners && self.eventsAnyListeners.length) {
23743 self.eventsAnyListeners.forEach(function (eventHandler) { 23744 eventHandler.apply(context, [event].concat(_toConsumableArray(data))); 23745 }); 23746 } 23747 if (self.eventsListeners && self.eventsListeners[event]) { 23748 self.eventsListeners[event].forEach(function (eventHandler) { 23749 eventHandler.apply(context, data); 23750 }); 23751 } 23752 }); 23753 return self; 23754 } 23755}; 23756function updateSize() { 23757 var swiper = this; 23758 var width; 23759 var height; 23760 var el = swiper.el; 23761 if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) { 23762 width = swiper.params.width; 23763 } else { 23764 width = el.clientWidth; 23765 } 23766 if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) { 23767 height = swiper.params.height; 23768 } else { 23769 height = el.clientHeight; 23770 } 23771 if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) { 23772 return; 23773 } 23774 23775 // Subtract paddings 23776 width = width - parseInt((0, _utils.q)(el, 'padding-left') || 0, 10) - parseInt((0, _utils.q)(el, 'padding-right') || 0, 10); 23777 height = height - parseInt((0, _utils.q)(el, 'padding-top') || 0, 10) - parseInt((0, _utils.q)(el, 'padding-bottom') || 0, 10); 23778 if (Number.isNaN(width)) width = 0; 23779 if (Number.isNaN(height)) height = 0; 23780 _extends(swiper, { 23781 width: width, 23782 height: height, 23783 size: swiper.isHorizontal() ? width : height 23784 }); 23785} 23786function updateSlides() { 23787 var swiper = this; 23788 function getDirectionPropertyValue(node, label) { 23789 return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0); 23790 } 23791 var params = swiper.params; 23792 var wrapperEl = swiper.wrapperEl, 23793 slidesEl = swiper.slidesEl, 23794 rtl = swiper.rtlTranslate, 23795 wrongRTL = swiper.wrongRTL; 23796 var isVirtual = swiper.virtual && params.virtual.enabled; 23797 var previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length; 23798 var slides = (0, _utils.e)(slidesEl, ".".concat(swiper.params.slideClass, ", swiper-slide")); 23799 var slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length; 23800 var snapGrid = []; 23801 var slidesGrid = []; 23802 var slidesSizesGrid = []; 23803 var offsetBefore = params.slidesOffsetBefore; 23804 if (typeof offsetBefore === 'function') { 23805 offsetBefore = params.slidesOffsetBefore.call(swiper); 23806 } 23807 var offsetAfter = params.slidesOffsetAfter; 23808 if (typeof offsetAfter === 'function') { 23809 offsetAfter = params.slidesOffsetAfter.call(swiper); 23810 } 23811 var previousSnapGridLength = swiper.snapGrid.length; 23812 var previousSlidesGridLength = swiper.slidesGrid.length; 23813 var swiperSize = swiper.size - offsetBefore - offsetAfter; 23814 var spaceBetween = params.spaceBetween; 23815 var slidePosition = -offsetBefore; 23816 var prevSlideSize = 0; 23817 var index = 0; 23818 if (typeof swiperSize === 'undefined') { 23819 return; 23820 } 23821 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 23822 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize; 23823 } else if (typeof spaceBetween === 'string') { 23824 spaceBetween = parseFloat(spaceBetween); 23825 } 23826 swiper.virtualSize = -spaceBetween - offsetBefore - offsetAfter; 23827 23828 // reset margins 23829 slides.forEach(function (slideEl) { 23830 if (rtl) { 23831 slideEl.style.marginLeft = ''; 23832 } else { 23833 slideEl.style.marginRight = ''; 23834 } 23835 slideEl.style.marginBottom = ''; 23836 slideEl.style.marginTop = ''; 23837 }); 23838 23839 // reset cssMode offsets 23840 if (params.centeredSlides && params.cssMode) { 23841 (0, _utils.b)(wrapperEl, '--swiper-centered-offset-before', ''); 23842 (0, _utils.b)(wrapperEl, '--swiper-centered-offset-after', ''); 23843 } 23844 23845 // set cssMode offsets 23846 if (params.cssMode) { 23847 (0, _utils.b)(wrapperEl, '--swiper-slides-offset-before', "".concat(offsetBefore, "px")); 23848 (0, _utils.b)(wrapperEl, '--swiper-slides-offset-after', "".concat(offsetAfter, "px")); 23849 } 23850 var gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid; 23851 if (gridEnabled) { 23852 swiper.grid.initSlides(slides); 23853 } else if (swiper.grid) { 23854 swiper.grid.unsetSlides(); 23855 } 23856 23857 // Calc slides 23858 var slideSize; 23859 var shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(function (key) { 23860 return typeof params.breakpoints[key].slidesPerView !== 'undefined'; 23861 }).length > 0; 23862 for (var i = 0; i < slidesLength; i += 1) { 23863 slideSize = 0; 23864 var _slide = slides[i]; 23865 if (_slide) { 23866 if (gridEnabled) { 23867 swiper.grid.updateSlide(i, _slide, slides); 23868 } 23869 if ((0, _utils.q)(_slide, 'display') === 'none') continue; // eslint-disable-line 23870 } 23871 if (isVirtual && params.slidesPerView === 'auto') { 23872 if (params.virtual.slidesPerViewAutoSlideSize) { 23873 slideSize = params.virtual.slidesPerViewAutoSlideSize; 23874 } 23875 if (slideSize && _slide) { 23876 if (params.roundLengths) slideSize = Math.floor(slideSize); 23877 _slide.style[swiper.getDirectionLabel('width')] = "".concat(slideSize, "px"); 23878 } 23879 } else if (params.slidesPerView === 'auto') { 23880 if (shouldResetSlideSize) { 23881 _slide.style[swiper.getDirectionLabel('width')] = ""; 23882 } 23883 var slideStyles = getComputedStyle(_slide); 23884 var currentTransform = _slide.style.transform; 23885 var currentWebKitTransform = _slide.style.webkitTransform; 23886 if (currentTransform) { 23887 _slide.style.transform = 'none'; 23888 } 23889 if (currentWebKitTransform) { 23890 _slide.style.webkitTransform = 'none'; 23891 } 23892 if (params.roundLengths) { 23893 slideSize = swiper.isHorizontal() ? (0, _utils.i)(_slide, 'width', true) : (0, _utils.i)(_slide, 'height', true); 23894 } else { 23895 // eslint-disable-next-line 23896 var width = getDirectionPropertyValue(slideStyles, 'width'); 23897 var paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left'); 23898 var paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right'); 23899 var marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left'); 23900 var marginRight = getDirectionPropertyValue(slideStyles, 'margin-right'); 23901 var boxSizing = slideStyles.getPropertyValue('box-sizing'); 23902 if (boxSizing && boxSizing === 'border-box') { 23903 slideSize = width + marginLeft + marginRight; 23904 } else { 23905 var clientWidth = _slide.clientWidth, 23906 offsetWidth = _slide.offsetWidth; 23907 slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth); 23908 } 23909 } 23910 if (currentTransform) { 23911 _slide.style.transform = currentTransform; 23912 } 23913 if (currentWebKitTransform) { 23914 _slide.style.webkitTransform = currentWebKitTransform; 23915 } 23916 if (params.roundLengths) slideSize = Math.floor(slideSize); 23917 } else { 23918 slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView; 23919 if (params.roundLengths) slideSize = Math.floor(slideSize); 23920 if (_slide) { 23921 _slide.style[swiper.getDirectionLabel('width')] = "".concat(slideSize, "px"); 23922 } 23923 } 23924 if (_slide) { 23925 _slide.swiperSlideSize = slideSize; 23926 } 23927 slidesSizesGrid.push(slideSize); 23928 if (params.centeredSlides) { 23929 slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween; 23930 if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 23931 if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 23932 if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0; 23933 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 23934 if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition); 23935 slidesGrid.push(slidePosition); 23936 } else { 23937 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 23938 if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition); 23939 slidesGrid.push(slidePosition); 23940 slidePosition = slidePosition + slideSize + spaceBetween; 23941 } 23942 swiper.virtualSize += slideSize + spaceBetween; 23943 prevSlideSize = slideSize; 23944 index += 1; 23945 } 23946 swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter; 23947 if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) { 23948 wrapperEl.style.width = "".concat(swiper.virtualSize + spaceBetween, "px"); 23949 } 23950 if (params.setWrapperSize) { 23951 wrapperEl.style[swiper.getDirectionLabel('width')] = "".concat(swiper.virtualSize + spaceBetween, "px"); 23952 } 23953 if (gridEnabled) { 23954 swiper.grid.updateWrapperSize(slideSize, snapGrid); 23955 } 23956 23957 // Remove last grid elements depending on width 23958 if (!params.centeredSlides) { 23959 // Check if snapToSlideEdge should be applied 23960 var isFractionalSlidesPerView = params.slidesPerView !== 'auto' && params.slidesPerView % 1 !== 0; 23961 var shouldSnapToSlideEdge = params.snapToSlideEdge && !params.loop && (params.slidesPerView === 'auto' || isFractionalSlidesPerView); 23962 23963 // Calculate the last allowed snap index when snapToSlideEdge is enabled 23964 // This ensures minimum slides are visible at the end 23965 var lastAllowedSnapIndex = snapGrid.length; 23966 if (shouldSnapToSlideEdge) { 23967 var minVisibleSlides; 23968 if (params.slidesPerView === 'auto') { 23969 // For 'auto' mode, calculate how many slides fit based on actual sizes 23970 minVisibleSlides = 1; 23971 var accumulatedSize = 0; 23972 for (var _i = slidesSizesGrid.length - 1; _i >= 0; _i -= 1) { 23973 accumulatedSize += slidesSizesGrid[_i] + (_i < slidesSizesGrid.length - 1 ? spaceBetween : 0); 23974 if (accumulatedSize <= swiperSize) { 23975 minVisibleSlides = slidesSizesGrid.length - _i; 23976 } else { 23977 break; 23978 } 23979 } 23980 } else { 23981 minVisibleSlides = Math.floor(params.slidesPerView); 23982 } 23983 lastAllowedSnapIndex = Math.max(slidesLength - minVisibleSlides, 0); 23984 } 23985 var newSlidesGrid = []; 23986 for (var _i2 = 0; _i2 < snapGrid.length; _i2 += 1) { 23987 var slidesGridItem = snapGrid[_i2]; 23988 if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem); 23989 if (shouldSnapToSlideEdge) { 23990 // When snapToSlideEdge is enabled, only keep snaps up to lastAllowedSnapIndex 23991 if (_i2 <= lastAllowedSnapIndex) { 23992 newSlidesGrid.push(slidesGridItem); 23993 } 23994 }
23994 else if (snapGrid[_i2] <= swiper.virtualSize - swiperSize) { 23995 // When snapToSlideEdge is disabled, keep snaps that fit within scrollable area 23996 newSlidesGrid.push(slidesGridItem); 23997 } 23998 } 23999 snapGrid = newSlidesGrid; 24000 if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) { 24001 // Only add edge-aligned snap if snapToSlideEdge is not enabled 24002 if (!shouldSnapToSlideEdge) { 24003 snapGrid.push(swiper.virtualSize - swiperSize); 24004 } 24005 } 24006 } 24007 if (isVirtual && params.loop) { 24008 var size = slidesSizesGrid[0] + spaceBetween; 24009 if (params.slidesPerGroup > 1) { 24010 var groups = Math.ceil((swiper.virtual.slidesBefore + swiper.virtual.slidesAfter) / params.slidesPerGroup); 24011 var groupSize = size * params.slidesPerGroup; 24012 for (var _i3 = 0; _i3 < groups; _i3 += 1) { 24013 snapGrid.push(snapGrid[snapGrid.length - 1] + groupSize); 24014 } 24015 } 24016 for (var _i4 = 0; _i4 < swiper.virtual.slidesBefore + swiper.virtual.slidesAfter; _i4 += 1) { 24017 if (params.slidesPerGroup === 1) { 24018 snapGrid.push(snapGrid[snapGrid.length - 1] + size); 24019 } 24020 slidesGrid.push(slidesGrid[slidesGrid.length - 1] + size); 24021 swiper.virtualSize += size; 24022 } 24023 } 24024 if (snapGrid.length === 0) snapGrid = [0]; 24025 if (spaceBetween !== 0) { 24026 var key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight'); 24027 slides.filter(function (_, slideIndex) { 24028 if (!params.cssMode || params.loop) return true; 24029 if (slideIndex === slides.length - 1) { 24030 return false; 24031 } 24032 return true; 24033 }
24033).forEach(function (slideEl) { 24034 slideEl.style[key] = "".concat(spaceBetween, "px"); 24035 }); 24036 } 24037 if (params.centeredSlides && params.centeredSlidesBounds) { 24038 var allSlidesSize = 0; 24039 slidesSizesGrid.forEach(function (slideSizeValue) { 24040 allSlidesSize += slideSizeValue + (spaceBetween || 0); 24041 }); 24042 allSlidesSize -= spaceBetween; 24043 var maxSnap = allSlidesSize > swiperSize ? allSlidesSize - swiperSize : 0; 24044 snapGrid = snapGrid.map(function (snap) { 24045 if (snap <= 0) return -offsetBefore; 24046 if (snap > maxSnap) return maxSnap + offsetAfter; 24047 return snap; 24048 }); 24049 } 24050 if (params.centerInsufficientSlides) { 24051 var _allSlidesSize = 0; 24052 slidesSizesGrid.forEach(function (slideSizeValue) { 24053 _allSlidesSize += slideSizeValue + (spaceBetween || 0); 24054 }); 24055 _allSlidesSize -= spaceBetween; 24056 if (_allSlidesSize < swiperSize) { 24057 var allSlidesOffset = (swiperSize - _allSlidesSize) / 2; 24058 snapGrid.forEach(function (snap, snapIndex) { 24059 snapGrid[snapIndex] = snap - allSlidesOffset; 24060 }); 24061 slidesGrid.forEach(function (snap, snapIndex) { 24062 slidesGrid[snapIndex] = snap + allSlidesOffset; 24063 }); 24064 } 24065 } 24066 _extends(swiper, { 24067 slides: slides, 24068 snapGrid: snapGrid, 24069 slidesGrid: slidesGrid, 24070 slidesSizesGrid: slidesSizesGrid 24071 }); 24072 if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) { 24073 (0, _utils.b)(wrapperEl, '--swiper-centered-offset-before', "".concat(-snapGrid[0], "px")); 24074 (0, _utils.b)(wrapperEl, '--swiper-centered-offset-after', "".concat(swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2, "px")); 24075 var addToSnapGrid = -swiper.snapGrid[0]; 24076 var addToSlidesGrid = -swiper.slidesGrid[0]; 24077 swiper.snapGrid = swiper.snapGrid.map(function (v) { 24078 return v + addToSnapGrid; 24079 }); 24080 swiper.slidesGrid = swiper.slidesGrid.map(function (v) { 24081 return v + addToSlidesGrid; 24082 }); 24083 } 24084 if (slidesLength !== previousSlidesLength) { 24085 swiper.emit('slidesLengthChange'); 24086 } 24087 if (snapGrid.length !== previousSnapGridLength) { 24088 if (swiper.params.watchOverflow) swiper.checkOverflow(); 24089 swiper.emit('snapGridLengthChange'); 24090 } 24091 if (slidesGrid.length !== previousSlidesGridLength) { 24092 swiper.emit('slidesGridLengthChange'); 24093 } 24094 if (params.watchSlidesProgress) { 24095 swiper.updateSlidesOffset(); 24096 } 24097 swiper.emit('slidesUpdated'); 24098 if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) { 24099 var backFaceHiddenClass = "".concat(params.containerModifierClass, "backface-hidden"); 24100 var hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass); 24101 if (slidesLength <= params.maxBackfaceHiddenSlides) { 24102 if (!hasClassBackfaceClassAdded) swiper.el.classList.add(backFaceHiddenClass); 24103 } else if (hasClassBackfaceClassAdded) { 24104 swiper.el.classList.remove(backFaceHiddenClass); 24105 } 24106 } 24107} 24108function updateAutoHeight(speed) { 24109 var swiper = this; 24110 var activeSlides = []; 24111 var isVirtual = swiper.virtual && swiper.params.virtual.enabled; 24112 var newHeight = 0; 24113 var i; 24114 if (typeof speed === 'number') { 24115 swiper.setTransition(speed); 24116 } else if (speed === true) { 24117 swiper.setTransition(swiper.params.speed); 24118 } 24119 var getSlideByIndex = function getSlideByIndex(index) { 24120 if (isVirtual) { 24121 return swiper.slides[swiper.getSlideIndexByData(index)]; 24122 } 24123 return swiper.slides[index]; 24124 }; 24125 // Find slides currently in view 24126 if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) { 24127 if (swiper.params.centeredSlides) { 24128 (swiper.visibleSlides || []).forEach(function (slide) { 24129 activeSlides.push(slide); 24130 }); 24131 } else { 24132 for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) { 24133 var index = swiper.activeIndex + i; 24134 if (index > swiper.slides.length && !isVirtual) break; 24135 activeSlides.push(getSlideByIndex(index)); 24136 } 24137 } 24138 } else { 24139 activeSlides.push(getSlideByIndex(swiper.activeIndex)); 24140 } 24141 24142 // Find new height from highest slide in view 24143 for (i = 0; i < activeSlides.length; i += 1) { 24144 if (typeof activeSlides[i] !== 'undefined') { 24145 var height = activeSlides[i].offsetHeight; 24146 newHeight = height > newHeight ? height : newHeight; 24147 } 24148 } 24149 24150 // Update Height 24151 if (newHeight || newHeight === 0) swiper.wrapperEl.style.height = "".concat(newHeight, "px"); 24152} 24153function updateSlidesOffset() { 24154 var swiper = this; 24155 var slides = swiper.slides; 24156 // eslint-disable-next-line 24157 var minusOffset = swiper.isElement ? swiper.isHorizontal() ? swiper.wrapperEl.offsetLeft : swiper.wrapperEl.offsetTop : 0; 24158 for (var i = 0; i < slides.length; i += 1) { 24159 slides[i].swiperSlideOffset = (swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop) - minu
24159sOffset - swiper.cssOverflowAdjustment(); 24160 } 24161} 24162var toggleSlideClasses$1 = function toggleSlideClasses$1(slideEl, condition, className) { 24163 if (condition && !slideEl.classList.contains(className)) { 24164 slideEl.classList.add(className); 24165 } else if (!condition && slideEl.classList.contains(className)) { 24166 slideEl.classList.remove(className); 24167 } 24168}; 24169function updateSlidesProgress() { 24170 var translate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this && this.translate || 0; 24171 var swiper = this; 24172 var params = swiper.params; 24173 var slides = swiper.slides, 24174 rtl = swiper.rtlTranslate, 24175 snapGrid = swiper.snapGrid; 24176 if (slides.length === 0) return; 24177 if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset(); 24178 var offsetCenter = -translate; 24179 if (rtl) offsetCenter = translate; 24180 swiper.visibleSlidesIndexes = []; 24181 swiper.visibleSlides = []; 24182 var spaceBetween = params.spaceBetween; 24183 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 24184 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size; 24185 } else if (typeof spaceBetween === 'string') { 24186 spaceBetween = parseFloat(spaceBetween); 24187 } 24188 for (var i = 0; i < slides.length; i += 1) { 24189 var _slide2 = slides[i]; 24190 var slideOffset = _slide2.swiperSlideOffset; 24191 if (params.cssMode && params.centeredSlides) { 24192 slideOffset -= slides[0].swiperSlideOffset; 24193 } 24194 var slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (_slide2.swiperSlideSize + spaceBetween); 24195 var originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (_slide2.swiperSlideSize + spaceBetween); 24196 var slideBefore = -(offsetCenter - slideOffset); 24197 var slideAfter = slideBefore + swiper.slidesSizesGrid[i]; 24198 var isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i]; 24199 var isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size; 24200 if (isVisible) { 24201 swiper.visibleSlides.push(_slide2); 24202 swiper.visibleSlidesIndexes.push(i); 24203 } 24204 toggleSlideClasses$1(_slide2, isVisible, params.slideVisibleClass); 24205 toggleSlideClasses$1(_slide2, isFullyVisible, params.slideFullyVisibleClass); 24206 _slide2.progress = rtl ? -slideProgress : slideProgress; 24207 _slide2.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress; 24208 } 24209} 24210function updateProgress(translate) { 24211 var swiper = this; 24212 if (typeof translate === 'undefined') { 24213 var multiplier = swiper.rtlTranslate ? -1 : 1; 24214 // eslint-disable-next-line 24215 translate = swiper && swiper.translate && swiper.translate * multiplier || 0; 24216 } 24217 var params = swiper.params; 24218 var translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 24219 var progress = swiper.progress, 24220 isBeginning = swiper.isBeginning, 24221 isEnd = swiper.isEnd, 24222 progressLoop = swiper.progressLoop; 24223 var wasBeginning = isBeginning; 24224 var wasEnd = isEnd; 24225 if (translatesDiff === 0) { 24226 progress = 0; 24227 isBeginning = true; 24228 isEnd = true; 24229 } else { 24230 progress = (translate - swiper.minTranslate()) / translatesDiff; 24231 var isBeginningRounded = Math.abs(translate - swiper.minTranslate()) < 1; 24232 var isEndRounded = Math.abs(translate - swiper.maxTranslate()) < 1; 24233 isBeginning = isBeginningRounded || progress <= 0; 24234 isEnd = isEndRounded || progress >= 1; 24235 if (isBeginningRounded) progress = 0; 24236 if (isEndRounded) progress = 1; 24237 } 24238 if (params.loop) { 24239 var firstSlideIndex = swiper.getSlideIndexByData(0); 24240 var lastSlideIndex = swiper.getSlideIndexByData(swiper.slides.length - 1); 24241 var firstSlideTranslate = swiper.slidesGrid[firstSlideIndex]; 24242 var lastSlideTranslate = swiper.slidesGrid[lastSlideIndex]; 24243 var translateMax = swiper.slidesGrid[swiper.slidesGrid.length - 1]; 24244 var translateAbs = Math.abs(translate); 24245 if (translateAbs >= firstSlideTranslate) { 24246 progressLoop = (translateAbs - firstSlideTranslate) / translateMax; 24247 } else { 24248 progressLoop = (translateAbs + translateMax - lastSlideTranslate) / translateMax; 24249 } 24250 if (progressLoop > 1) progressLoop -= 1; 24251 } 24252 _extends(swiper, { 24253 progress: progress, 24254 progressLoop: progressLoop, 24255 isBeginning: isBeginning, 24256 isEnd: isEnd 24257 }); 24258 if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate); 24259 if (isBeginning && !wasBeginning) { 24260 swiper.emit('reachBeginning toEdge'); 24261 } 24262 if (isEnd && !wasEnd) { 24263 swiper.emit('reachEnd toEdge'); 24264 } 24265 if (wasBeginning && !isBeginning || wasEnd && !isEnd) { 24266 swiper.emit('fromEdge'); 24267 } 24268 swiper.emit('progress', progress); 24269}
24270var toggleSlideClasses = function toggleSlideClasses(slideEl, condition, className) { 24271 if (condition && !slideEl.classList.contains(className)) { 24272 slideEl.classList.add(className); 24273 } else if (!condition && slideEl.classList.contains(className)) { 24274 slideEl.classList.remove(className); 24275 } 24276}; 24277function updateSlidesClasses() { 24278 var swiper = this; 24279 var slides = swiper.slides, 24280 params = swiper.params, 24281 slidesEl = swiper.slidesEl, 24282 activeIndex = swiper.activeIndex; 24283 var isVirtual = swiper.virtual && params.virtual.enabled; 24284 var gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 24285 var getFilteredSlide = function getFilteredSlide(selector) { 24286 return (0, _utils.e)(slidesEl, ".".concat(params.slideClass).concat(selector, ", swiper-slide").concat(selector))[0]; 24287 }; 24288 var activeSlide; 24289 var prevSlide; 24290 var nextSlide; 24291 if (isVirtual) { 24292 if (params.loop) { 24293 var slideIndex = activeIndex - swiper.virtual.slidesBefore; 24294 if (slideIndex < 0) slideIndex = swiper.virtual.slides.length + slideIndex; 24295 if (slideIndex >= swiper.virtual.slides.length) slideIndex -= swiper.virtual.slides.length; 24296 activeSlide = getFilteredSlide("[data-swiper-slide-index=\"".concat(slideIndex, "\"]")); 24297 } else { 24298 activeSlide = getFilteredSlide("[data-swiper-slide-index=\"".concat(activeIndex, "\"]")); 24299 } 24300 } else { 24301 if (gridEnabled) { 24302 activeSlide = slides.find(function (slideEl) { 24303 return slideEl.column === activeIndex; 24304 }); 24305 nextSlide = slides.find(function (slideEl) { 24306 return slideEl.column === activeIndex + 1; 24307 }); 24308 prevSlide = slides.find(function (slideEl) { 24309 return slideEl.column === activeIndex - 1; 24310 }); 24311 } else { 24312 activeSlide = slides[activeIndex]; 24313 } 24314 } 24315 if (activeSlide) { 24316 if (!gridEnabled) { 24317 // Next Slide 24318 nextSlide = (0, _utils.r)(activeSlide, ".".concat(params.slideClass, ", swiper-slide"))[0]; 24319 if (params.loop && !nextSlide) { 24320 nextSlide = slides[0]; 24321 } 24322 24323 // Prev Slide 24324 prevSlide = (0, _utils.t)(activeSlide, ".".concat(params.slideClass, ", swiper-slide"))[0]; 24325 if (params.loop && !prevSlide === 0) { 24326 prevSlide = slides[slides.length - 1]; 24327 } 24328 } 24329 } 24330 slides.forEach(function (slideEl) { 24331 toggleSlideClasses(slideEl, slideEl === activeSlide, params.slideActiveClass); 24332 toggleSlideClasses(slideEl, slideEl === nextSlide, params.slideNextClass); 24333 toggleSlideClasses(slideEl, slideEl === prevSlide, params.slidePrevClass); 24334 }); 24335 swiper.emitSlidesClasses(); 24336} 24337var processLazyPreloader = function processLazyPreloader(swiper, imageEl) { 24338 if (!swiper || swiper.destroyed || !swiper.params) return; 24339 var slideSelector = function slideSelector() { 24340 return swiper.isElement ? "swiper-slide" : ".".concat(swiper.params.slideClass); 24341 }; 24342 var slideEl = imageEl.closest(slideSelector()); 24343 if (slideEl) { 24344 var lazyEl = slideEl.querySelector(".".concat(swiper.params.lazyPreloaderClass)); 24345 if (!lazyEl && swiper.isElement) { 24346 if (slideEl.shadowRoot) { 24347 lazyEl = slideEl.shadowRoot.querySelector(".".concat(swiper.params.lazyPreloaderClass)); 24348 } else { 24349 // init later 24350 requestAnimationFrame(function () { 24351 if (slideEl.shadowRoot) { 24352 lazyEl = slideEl.shadowRoot.querySelector(".".concat(swiper.params.lazyPreloaderClass)); 24353 if (lazyEl && !lazyEl.lazyPreloaderManaged) lazyEl.remove(); 24354 } 24355 }); 24356 } 24357 } 24358 // Skip removal if managed by React/Vue component 24359 if (lazyEl && !lazyEl.lazyPreloaderManaged) lazyEl.remove(); 24360 } 24361}; 24362var unlazy = function unlazy(swiper, index) { 24363 if (!swiper.slides[index]) return; 24364 var imageEl = swiper.slides[index].querySelector('[loading="lazy"]'); 24365 if (imageEl) imageEl.removeAttribute('loading'); 24366}; 24367var preload = function preload(swiper) { 24368 if (!swiper || swiper.destroyed || !swiper.params) return; 24369 var amount = swiper.params.lazyPreloadPrevNext; 24370 var len = swiper.slides.length; 24371 if (!len || !amount || amount < 0) return; 24372 amount = Math.min(amount, len); 24373 var slidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(swiper.params.slidesPerView); 24374 var activeIndex = swiper.activeIndex; 24375 if (swiper.params.grid && swiper.params.grid.rows > 1) { 24376 var activeColumn = activeIndex; 24377 var preloadColumns = [activeColumn - amount];
24378 preloadColumns.push.apply(preloadColumns, _toConsumableArray(Array.from({ 24379 length: amount 24380 }).map(function (_, i) { 24381 return activeColumn + slidesPerView + i; 24382 }))); 24383 swiper.slides.forEach(function (slideEl, i) { 24384 if (preloadColumns.includes(slideEl.column)) unlazy(swiper, i); 24385 }); 24386 return; 24387 } 24388 var slideIndexLastInView = activeIndex + slidesPerView - 1; 24389 if (swiper.params.rewind || swiper.params.loop) { 24390 for (var i = activeIndex - amount; i <= slideIndexLastInView + amount; i += 1) { 24391 var realIndex = (i % len + len) % len; 24392 if (realIndex < activeIndex || realIndex > slideIndexLastInView) unlazy(swiper, realIndex); 24393 } 24394 } else { 24395 for (var _i5 = Math.max(activeIndex - amount, 0); _i5 <= Math.min(slideIndexLastInView + amount, len - 1); _i5 += 1) { 24396 if (_i5 !== activeIndex && (_i5 > slideIndexLastInView || _i5 < activeIndex)) { 24397 unlazy(swiper, _i5); 24398 } 24399 } 24400 } 24401}; 24402function getActiveIndexByTranslate(swiper) { 24403 var slidesGrid = swiper.slidesGrid, 24404 params = swiper.params; 24405 var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 24406 var activeIndex; 24407 for (var i = 0; i < slidesGrid.length; i += 1) { 24408 if (typeof slidesGrid[i + 1] !== 'undefined') { 24409 if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) { 24410 activeIndex = i; 24411 } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) { 24412 activeIndex = i + 1; 24413 } 24414 } else if (translate >= slidesGrid[i]) { 24415 activeIndex = i; 24416 } 24417 } 24418 // Normalize slideIndex 24419 if (params.normalizeSlideIndex) { 24420 if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0; 24421 } 24422 return activeIndex; 24423} 24424function updateActiveIndex(newActiveIndex) { 24425 var swiper = this; 24426 var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 24427 var snapGrid = swiper.snapGrid, 24428 params = swiper.params, 24429 previousIndex = swiper.activeIndex, 24430 previousRealIndex = swiper.realIndex, 24431 previousSnapIndex = swiper.snapIndex; 24432 var activeIndex = newActiveIndex; 24433 var snapIndex; 24434 var getVirtualRealIndex = function getVirtualRealIndex(aIndex) { 24435 var realIndex = aIndex - swiper.virtual.slidesBefore; 24436 if (realIndex < 0) { 24437 realIndex = swiper.virtual.slides.length + realIndex; 24438 } 24439 if (realIndex >= swiper.virtual.slides.length) { 24440 realIndex -= swiper.virtual.slides.length; 24441 } 24442 return realIndex; 24443 }; 24444 if (typeof activeIndex === 'undefined') { 24445 activeIndex = getActiveIndexByTranslate(swiper); 24446 } 24447 if (snapGrid.indexOf(translate) >= 0) { 24448 snapIndex = snapGrid.indexOf(translate); 24449 } else { 24450 var skip = Math.min(params.slidesPerGroupSkip, activeIndex); 24451 snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup); 24452 } 24453 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 24454 if (activeIndex === previousIndex && !swiper.params.loop) { 24455 if (snapIndex !== previousSnapIndex) { 24456 swiper.snapIndex = snapIndex; 24457 swiper.emit('snapIndexChange'); 24458 } 24459 return; 24460 } 24461 if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) { 24462 swiper.realIndex = getVirtualRealIndex(activeIndex); 24463 return; 24464 } 24465 var gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 24466 24467 // Get real index 24468 var realIndex; 24469 if (swiper.virtual && params.virtual.enabled) { 24470 if (params.loop) { 24471 realIndex = getVirtualRealIndex(activeIndex); 24472 } else { 24473 realIndex = activeIndex; 24474 } 24475 } else if (gridEnabled) { 24476 var firstSlideInColumn = swiper.slides.find(function (slideEl) { 24477 return slideEl.column === activeIndex; 24478 }); 24479 var activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10); 24480 if (Number.isNaN(activeSlideIndex)) { 24481 activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0); 24482 } 24483 realIndex = Math.floor(activeSlideIndex / params.grid.rows); 24484 } else if (swiper.slides[activeIndex]) { 24485 var slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index'); 24486 if (slideIndex) { 24487 realIndex = parseInt(slideIndex, 10); 24488 } else { 24489 realIndex = activeIndex; 24490 } 24491 } else { 24492 realIndex = activeIndex; 24493 } 24494 _extends(swiper, { 24495 previousSnapIndex: previousSnapIndex,
24496 snapIndex: snapIndex, 24497 previousRealIndex: previousRealIndex, 24498 realIndex: realIndex, 24499 previousIndex: previousIndex, 24500 activeIndex: activeIndex 24501 }); 24502 if (swiper.initialized) { 24503 preload(swiper); 24504 } 24505 swiper.emit('activeIndexChange'); 24506 swiper.emit('snapIndexChange'); 24507 if (swiper.initialized || swiper.params.runCallbacksOnInit) { 24508 if (previousRealIndex !== realIndex) { 24509 swiper.emit('realIndexChange'); 24510 } 24511 swiper.emit('slideChange'); 24512 } 24513} 24514function updateClickedSlide(el, path) { 24515 var swiper = this; 24516 var params = swiper.params; 24517 var slide = el.closest(".".concat(params.slideClass, ", swiper-slide")); 24518 if (!slide && swiper.isElement && path && path.length > 1 && path.includes(el)) { 24519 _toConsumableArray(path.slice(path.indexOf(el) + 1, path.length)).forEach(function (pathEl) { 24520 if (!slide && pathEl.matches && pathEl.matches(".".concat(params.slideClass, ", swiper-slide"))) { 24521 slide = pathEl; 24522 } 24523 }); 24524 } 24525 var slideFound = false; 24526 var slideIndex; 24527 if (slide) { 24528 for (var i = 0; i < swiper.slides.length; i += 1) { 24529 if (swiper.slides[i] === slide) { 24530 slideFound = true; 24531 slideIndex = i; 24532 break; 24533 } 24534 } 24535 } 24536 if (slide && slideFound) { 24537 swiper.clickedSlide = slide; 24538 if (swiper.virtual && swiper.params.virtual.enabled) { 24539 swiper.clickedIndex = parseInt(slide.getAttribute('data-swiper-slide-index'), 10); 24540 } else { 24541 swiper.clickedIndex = slideIndex; 24542 } 24543 } else { 24544 swiper.clickedSlide = undefined; 24545 swiper.clickedIndex = undefined; 24546 return; 24547 } 24548 if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) { 24549 swiper.slideToClickedSlide(); 24550 } 24551} 24552var update = { 24553 updateSize: updateSize, 24554 updateSlides: updateSlides, 24555 updateAutoHeight: updateAutoHeight, 24556 updateSlidesOffset: updateSlidesOffset, 24557 updateSlidesProgress: updateSlidesProgress, 24558 updateProgress: updateProgress, 24559 updateSlidesClasses: updateSlidesClasses, 24560 updateActiveIndex: updateActiveIndex, 24561 updateClickedSlide: updateClickedSlide 24562}; 24563function getSwiperTranslate() { 24564 var axis = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.isHorizontal() ? 'x' : 'y'; 24565 var swiper = this; 24566 var params = swiper.params, 24567 rtl = swiper.rtlTranslate, 24568 translate = swiper.translate, 24569 wrapperEl = swiper.wrapperEl; 24570 if (params.virtualTranslate) { 24571 return rtl ? -translate : translate; 24572 } 24573 if (params.cssMode) { 24574 return translate; 24575 } 24576 var currentTranslate = (0, _utils.l)(wrapperEl, axis); 24577 currentTranslate += swiper.cssOverflowAdjustment(); 24578 if (rtl) currentTranslate = -currentTranslate; 24579 return currentTranslate || 0; 24580} 24581function setTranslate(translate, byController) { 24582 var swiper = this; 24583 var rtl = swiper.rtlTranslate, 24584 params = swiper.params, 24585 wrapperEl = swiper.wrapperEl, 24586 progress = swiper.progress; 24587 var x = 0; 24588 var y = 0; 24589 var z = 0; 24590 if (swiper.isHorizontal()) { 24591 x = rtl ? -translate : translate; 24592 } else { 24593 y = translate; 24594 } 24595 if (params.roundLengths) { 24596 x = Math.floor(x); 24597 y = Math.floor(y); 24598 } 24599 swiper.previousTranslate = swiper.translate; 24600 swiper.translate = swiper.isHorizontal() ? x : y; 24601 if (params.cssMode) { 24602 wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y; 24603 } else if (!params.virtualTranslate) { 24604 if (swiper.isHorizontal()) { 24605 x -= swiper.cssOverflowAdjustment(); 24606 } else { 24607 y -= swiper.cssOverflowAdjustment(); 24608 } 24609 wrapperEl.style.transform = "translate3d(".concat(x, "px, ").concat(y, "px, ").concat(z, "px)"); 24610 } 24611 24612 // Check if we need to update progress 24613 var newProgress; 24614 var translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 24615 if (translatesDiff === 0) { 24616 newProgress = 0; 24617 } else { 24618 newProgress = (translate - swiper.minTranslate()) / translatesDiff; 24619 } 24620 if (newProgress !== progress) { 24621 swiper.updateProgress(translate); 24622 } 24623 swiper.emit('setTranslate', swiper.translate, byController); 24624} 24625function minTranslate() { 24626 return -this.snapGrid[0]; 24627} 24628function maxTranslate() { 24629 return -this.snapGrid[this.snapGrid.length - 1]; 24630} 24631function translateTo() { 24632 var translate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; 24633 var speed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.params.speed; 24634 var runCallbacks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; 24635 var translateBounds = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; 24636 var internal = arguments.length > 4 ? arguments[4] : undefined; 24637 var swiper = this; 24638 var params = swiper.params, 24639 wrapperEl = swiper.wrapperEl; 24640 if (swiper.animating && params.preventInteractionOnTransition) { 24641 return false;
24642 } 24643 var minTranslate = swiper.minTranslate(); 24644 var maxTranslate = swiper.maxTranslate(); 24645 var newTranslate; 24646 if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; 24647 24648 // Update progress 24649 swiper.updateProgress(newTranslate); 24650 if (params.cssMode) { 24651 var isH = swiper.isHorizontal(); 24652 if (speed === 0) { 24653 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate; 24654 } else { 24655 if (!swiper.support.smoothScroll) { 24656 (0, _utils.u)({ 24657 swiper: swiper, 24658 targetPosition: -newTranslate, 24659 side: isH ? 'left' : 'top' 24660 }); 24661 return true; 24662 } 24663 wrapperEl.scrollTo(_defineProperty(_defineProperty({}, isH ? 'left' : 'top', -newTranslate), "behavior", 'smooth')); 24664 } 24665 return true; 24666 } 24667 if (speed === 0) { 24668 swiper.setTransition(0); 24669 swiper.setTranslate(newTranslate); 24670 if (runCallbacks) { 24671 swiper.emit('beforeTransitionStart', speed, internal); 24672 swiper.emit('transitionEnd'); 24673 } 24674 } else { 24675 swiper.setTransition(speed); 24676 swiper.setTranslate(newTranslate); 24677 if (runCallbacks) { 24678 swiper.emit('beforeTransitionStart', speed, internal); 24679 swiper.emit('transitionStart'); 24680 } 24681 if (!swiper.animating) { 24682 swiper.animating = true; 24683 if (!swiper.onTranslateToWrapperTransitionEnd) { 24684 swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) { 24685 if (!swiper || swiper.destroyed) return; 24686 if (e.target !== this) return; 24687 swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 24688 swiper.onTranslateToWrapperTransitionEnd = null; 24689 delete swiper.onTranslateToWrapperTransitionEnd; 24690 swiper.animating = false; 24691 if (runCallbacks) { 24692 swiper.emit('transitionEnd'); 24693 } 24694 }; 24695 } 24696 swiper.wrapperEl.addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 24697 } 24698 } 24699 return true; 24700} 24701var translate = { 24702 getTranslate: getSwiperTranslate, 24703 setTranslate: setTranslate, 24704 minTranslate: minTranslate, 24705 maxTranslate: maxTranslate, 24706 translateTo: translateTo 24707}; 24708function setTransition(duration, byController) { 24709 var swiper = this; 24710 if (!swiper.params.cssMode) { 24711 swiper.wrapperEl.style.transitionDuration = "".concat(duration, "ms"); 24712 swiper.wrapperEl.style.transitionDelay = duration === 0 ? "0ms" : ''; 24713 } 24714 swiper.emit('setTransition', duration, byController); 24715} 24716function transitionEmit(_ref5) { 24717 var swiper = _ref5.swiper, 24718 runCallbacks = _ref5.runCallbacks, 24719 direction = _ref5.direction, 24720 step = _ref5.step; 24721 var activeIndex = swiper.activeIndex, 24722 previousIndex = swiper.previousIndex; 24723 var dir = direction; 24724 if (!dir) { 24725 if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset'; 24726 } 24727 swiper.emit("transition".concat(step)); 24728 if (runCallbacks && dir === 'reset') { 24729 swiper.emit("slideResetTransition".concat(step)); 24730 } else if (runCallbacks && activeIndex !== previousIndex) { 24731 swiper.emit("slideChangeTransition".concat(step)); 24732 if (dir === 'next') { 24733 swiper.emit("slideNextTransition".concat(step)); 24734 } else { 24735 swiper.emit("slidePrevTransition".concat(step)); 24736 } 24737 } 24738} 24739function transitionStart() { 24740 var runCallbacks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; 24741 var direction = arguments.length > 1 ? arguments[1] : undefined; 24742 var swiper = this; 24743 var params = swiper.params; 24744 if (params.cssMode) return; 24745 if (params.autoHeight) { 24746 swiper.updateAutoHeight(); 24747 } 24748 transitionEmit({ 24749 swiper: swiper, 24750 runCallbacks: runCallbacks, 24751 direction: direction, 24752 step: 'Start' 24753 }); 24754} 24755function transitionEnd() { 24756 var runCallbacks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; 24757 var direction = arguments.length > 1 ? arguments[1] : undefined; 24758 var swiper = this; 24759 var params = swiper.params; 24760 swiper.animating = false;
24761 if (params.cssMode) return; 24762 swiper.setTransition(0); 24763 transitionEmit({ 24764 swiper: swiper, 24765 runCallbacks: runCallbacks, 24766 direction: direction, 24767 step: 'End' 24768 }); 24769} 24770var transition = { 24771 setTransition: setTransition, 24772 transitionStart: transitionStart, 24773 transitionEnd: transitionEnd 24774}; 24775function slideTo() { 24776 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; 24777 var speed = arguments.length > 1 ? arguments[1] : undefined; 24778 var runCallbacks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; 24779 var internal = arguments.length > 3 ? arguments[3] : undefined; 24780 var initial = arguments.length > 4 ? arguments[4] : undefined; 24781 if (typeof index === 'string') { 24782 index = parseInt(index, 10); 24783 } 24784 var swiper = this; 24785 var slideIndex = index; 24786 if (slideIndex < 0) slideIndex = 0; 24787 var params = swiper.params, 24788 snapGrid = swiper.snapGrid, 24789 slidesGrid = swiper.slidesGrid, 24790 previousIndex = swiper.previousIndex, 24791 activeIndex = swiper.activeIndex, 24792 rtl = swiper.rtlTranslate, 24793 wrapperEl = swiper.wrapperEl, 24794 enabled = swiper.enabled; 24795 if (!enabled && !internal && !initial || swiper.destroyed || swiper.animating && params.preventInteractionOnTransition) { 24796 return false; 24797 } 24798 if (typeof speed === 'undefined') { 24799 speed = swiper.params.speed; 24800 } 24801 var skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex); 24802 var snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup); 24803 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 24804 var translate = -snapGrid[snapIndex]; 24805 // Normalize slideIndex 24806 if (params.normalizeSlideIndex) { 24807 for (var i = 0; i < slidesGrid.length; i += 1) { 24808 var normalizedTranslate = -Math.floor(translate * 100); 24809 var normalizedGrid = Math.floor(slidesGrid[i] * 100); 24810 var normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100); 24811 if (typeof slidesGrid[i + 1] !== 'undefined') { 24812 if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) { 24813 slideIndex = i; 24814 } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) { 24815 slideIndex = i + 1; 24816 } 24817 } else if (normalizedTranslate >= normalizedGrid) { 24818 slideIndex = i; 24819 } 24820 } 24821 } 24822 // Directions locks 24823 if (swiper.initialized && slideIndex !== activeIndex) { 24824 if (!swiper.allowSlideNext && (rtl ? translate > swiper.translate && translate > swiper.minTranslate() : translate < swiper.translate && translate < swiper.minTranslate())) { 24825 return false; 24826 } 24827 if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) { 24828 if ((activeIndex || 0) !== slideIndex) { 24829 return false; 24830 } 24831 } 24832 } 24833 if (slideIndex !== (previousIndex || 0) && runCallbacks) { 24834 swiper.emit('beforeSlideChangeStart'); 24835 } 24836 24837 // Update progress 24838 swiper.updateProgress(translate); 24839 var direction; 24840 if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; 24841 24842 // initial virtual 24843 var isVirtual = swiper.virtual && swiper.params.virtual.enabled; 24844 var isInitialVirtual = isVirtual && initial; 24845 // Update Index 24846 if (!isInitialVirtual && (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate)) { 24847 swiper.updateActiveIndex(slideIndex); 24848 // Update Height 24849 if (params.autoHeight) { 24850 swiper.updateAutoHeight(); 24851 } 24852 swiper.updateSlidesClasses(); 24853 if (params.effect !== 'slide') { 24854 swiper.setTranslate(translate); 24855 } 24856 if (direction !== 'reset') { 24857 swiper.transitionStart(runCallbacks, direction); 24858 swiper.transitionEnd(runCallbacks, direction); 24859 } 24860 return false; 24861 } 24862 if (params.cssMode) { 24863 var isH = swiper.isHorizontal(); 24864 var t = rtl ? translate : -translate; 24865 if (speed === 0) { 24866 if (isVirtual) { 24867 swiper.wrapperEl.style.scrollSnapType = 'none'; 24868 swiper._immediateVirtual = true; 24869 } 24870 if (isVirtual && !swiper._cssModeVirtualInitialSet && swiper.params.initialSlide > 0) { 24871 swiper._cssModeVirtualInitialSet = true; 24872 requestAnimationFrame(function () { 24873 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t; 24874 }); 24875 } else { 24876 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t; 24877 } 24878 if (isVirtual) { 24879 requestAnimationFrame(function () { 24880 swiper.wrapperEl.style.scrollSnapType = ''; 24881 swiper._immediateVirtual = false;
24882 }); 24883 } 24884 } else { 24885 if (!swiper.support.smoothScroll) { 24886 (0, _utils.u)({ 24887 swiper: swiper, 24888 targetPosition: t, 24889 side: isH ? 'left' : 'top' 24890 }); 24891 return true; 24892 } 24893 wrapperEl.scrollTo(_defineProperty(_defineProperty({}, isH ? 'left' : 'top', t), "behavior", 'smooth')); 24894 } 24895 return true; 24896 } 24897 var browser = getBrowser(); 24898 var isSafari = browser.isSafari; 24899 if (isVirtual && !initial && isSafari && swiper.isElement) { 24900 swiper.virtual.update(false, false, slideIndex); 24901 } 24902 swiper.setTransition(speed); 24903 swiper.setTranslate(translate); 24904 swiper.updateActiveIndex(slideIndex); 24905 swiper.updateSlidesClasses(); 24906 swiper.emit('beforeTransitionStart', speed, internal); 24907 swiper.transitionStart(runCallbacks, direction); 24908 if (speed === 0) { 24909 swiper.transitionEnd(runCallbacks, direction); 24910 } else if (!swiper.animating) { 24911 swiper.animating = true; 24912 if (!swiper.onSlideToWrapperTransitionEnd) { 24913 swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) { 24914 if (!swiper || swiper.destroyed) return; 24915 if (e.target !== this) return; 24916 swiper.wrapperEl.removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 24917 swiper.onSlideToWrapperTransitionEnd = null; 24918 delete swiper.onSlideToWrapperTransitionEnd; 24919 swiper.transitionEnd(runCallbacks, direction); 24920 }; 24921 } 24922 swiper.wrapperEl.addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 24923 } 24924 return true; 24925} 24926function slideToLoop() { 24927 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; 24928 var speed = arguments.length > 1 ? arguments[1] : undefined; 24929 var runCallbacks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; 24930 var internal = arguments.length > 3 ? arguments[3] : undefined; 24931 if (typeof index === 'string') { 24932 var indexAsNumber = parseInt(index, 10); 24933 index = indexAsNumber; 24934 } 24935 var swiper = this; 24936 if (swiper.destroyed) return; 24937 if (typeof speed === 'undefined') { 24938 speed = swiper.params.speed; 24939 } 24940 var gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1; 24941 var newIndex = index; 24942 if (swiper.params.loop) { 24943 if (swiper.virtual && swiper.params.virtual.enabled) { 24944 // eslint-disable-next-line 24945 newIndex = newIndex + swiper.virtual.slidesBefore; 24946 } else { 24947 var targetSlideIndex; 24948 if (gridEnabled) { 24949 var slideIndex = newIndex * swiper.params.grid.rows; 24950 targetSlideIndex = swiper.slides.find(function (slideEl) { 24951 return slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex; 24952 }).column; 24953 } else { 24954 targetSlideIndex = swiper.getSlideIndexByData(newIndex); 24955 } 24956 var cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length; 24957 var _swiper$params = swiper.params, 24958 centeredSlides = _swiper$params.centeredSlides, 24959 slidesOffsetBefore = _swiper$params.slidesOffsetBefore, 24960 slidesOffsetAfter = _swiper$params.slidesOffsetAfter; 24961 var bothDirections = centeredSlides || !!slidesOffsetBefore || !!slidesOffsetAfter; 24962 var slidesPerView = swiper.params.slidesPerView; 24963 if (slidesPerView === 'auto') { 24964 slidesPerView = swiper.slidesPerViewDynamic(); 24965 } else { 24966 slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10)); 24967 if (bothDirections && slidesPerView % 2 === 0) { 24968 slidesPerView = slidesPerView + 1; 24969 } 24970 } 24971 var needLoopFix = cols - targetSlideIndex < slidesPerView; 24972 if (bothDirections) { 24973 needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2); 24974 } 24975 if (internal && bothDirections && swiper.params.slidesPerView !== 'auto' && !gridEnabled) { 24976 needLoopFix = false; 24977 } 24978 if (needLoopFix) { 24979 var direction = bothDirections ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev'; 24980 swiper.loopFix({ 24981 direction: direction, 24982 slideTo: true, 24983 activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1, 24984 slideRealIndex: direction === 'next' ? swiper.realIndex : undefined 24985 }); 24986 } 24987 if (gridEnabled) { 24988 var _slideIndex = newIndex * swiper.params.grid.rows; 24989 newIndex = swiper.slides.find(function (slideEl) { 24990 return slideEl.getAttribute('data-swiper-slide-index') * 1 === _slideIndex; 24991 }).column; 24992 } else { 24993 newIndex = swiper.getSlideIndexByData(newIndex); 24994 } 24995 } 24996 } 24997 requestAnimationFrame(function () { 24998 swiper.slideTo(newIndex, speed, runCallbacks, internal); 24999 }); 25000 return swiper; 25001} 25002 25003/* eslint no-unused-vars: "off" */ 25004function slideNext(speed) { 25005 var runCallbacks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 25006 var internal = arguments.length > 2 ? arguments[2] : undefined; 25007 var swiper = this; 25008 var enabled = swiper.enabled, 25009 params = swiper.params, 25010 animating = swiper.animating; 25011 if (!enabled || swiper.destroyed) return swiper; 25012 if (typeof speed === 'undefined') { 25013 speed = swiper.params.speed; 25014 } 25015 var perGroup = params.slidesPerGroup; 25016 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 25017 perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1); 25018 } 25019 var increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup; 25020 var isVirtual = swiper.virtual && params.virtual.enabled; 25021 if (params.loop) { 25022 if (animating && !isVirtual && params.loopPreventsSliding) return false;
25023 swiper.loopFix({ 25024 direction: 'next' 25025 }); 25026 // eslint-disable-next-line 25027 swiper._clientLeft = swiper.wrapperEl.clientLeft; 25028 if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) { 25029 requestAnimationFrame(function () { 25030 swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); 25031 }); 25032 return true; 25033 } 25034 } 25035 if (params.rewind && swiper.isEnd) { 25036 return swiper.slideTo(0, speed, runCallbacks, internal); 25037 } 25038 return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); 25039} 25040 25041/* eslint no-unused-vars: "off" */ 25042function slidePrev(speed) { 25043 var runCallbacks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 25044 var internal = arguments.length > 2 ? arguments[2] : undefined; 25045 var swiper = this; 25046 var params = swiper.params, 25047 snapGrid = swiper.snapGrid, 25048 slidesGrid = swiper.slidesGrid, 25049 rtlTranslate = swiper.rtlTranslate, 25050 enabled = swiper.enabled, 25051 animating = swiper.animating; 25052 if (!enabled || swiper.destroyed) return swiper; 25053 if (typeof speed === 'undefined') { 25054 speed = swiper.params.speed; 25055 } 25056 var isVirtual = swiper.virtual && params.virtual.enabled; 25057 if (params.loop) { 25058 if (animating && !isVirtual && params.loopPreventsSliding) return false; 25059 swiper.loopFix({ 25060 direction: 'prev' 25061 }); 25062 // eslint-disable-next-line 25063 swiper._clientLeft = swiper.wrapperEl.clientLeft; 25064 } 25065 var translate = rtlTranslate ? swiper.translate : -swiper.translate; 25066 function normalize(val) { 25067 if (val < 0) return -Math.floor(Math.abs(val)); 25068 return Math.floor(val); 25069 } 25070 var normalizedTranslate = normalize(translate); 25071 var normalizedSnapGrid = snapGrid.map(function (val) { 25072 return normalize(val); 25073 }); 25074 var isFreeMode = params.freeMode && params.freeMode.enabled; 25075 var prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1]; 25076 if (typeof prevSnap === 'undefined' && (params.cssMode || isFreeMode)) { 25077 var prevSnapIndex; 25078 snapGrid.forEach(function (snap, snapIndex) { 25079 if (normalizedTranslate >= snap) { 25080 // prevSnap = snap; 25081 prevSnapIndex = snapIndex; 25082 } 25083 }); 25084 if (typeof prevSnapIndex !== 'undefined') { 25085 prevSnap = isFreeMode ? snapGrid[prevSnapIndex] : snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex]; 25086 } 25087 } 25088 var prevIndex = 0; 25089 if (typeof prevSnap !== 'undefined') { 25090 prevIndex = slidesGrid.indexOf(prevSnap); 25091 if (prevIndex < 0) prevIndex = swiper.activeIndex - 1; 25092 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 25093 prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1; 25094 prevIndex = Math.max(prevIndex, 0); 25095 } 25096 } 25097 if (params.rewind && swiper.isBeginning) { 25098 var lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; 25099 return swiper.slideTo(lastIndex, speed, runCallbacks, internal); 25100 } else if (params.loop && swiper.activeIndex === 0 && params.cssMode) { 25101 requestAnimationFrame(function () { 25102 swiper.slideTo(prevIndex, speed, runCallbacks, internal); 25103 }); 25104 return true; 25105 } 25106 return swiper.slideTo(prevIndex, speed, runCallbacks, internal); 25107} 25108 25109/* eslint no-unused-vars: "off" */ 25110function slideReset(speed) { 25111 var runCallbacks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 25112 var internal = arguments.length > 2 ? arguments[2] : undefined; 25113 var swiper = this; 25114 if (swiper.destroyed) return; 25115 if (typeof speed === 'undefined') { 25116 speed = swiper.params.speed; 25117 } 25118 return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal); 25119} 25120 25121/* eslint no-unused-vars: "off" */ 25122function slideToClosest(speed) { 25123 var runCallbacks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 25124 var internal = arguments.length > 2 ? arguments[2] : undefined; 25125 var threshold = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0.5; 25126 var swiper = this; 25127 if (swiper.destroyed) return; 25128 if (typeof speed === 'undefined') { 25129 speed = swiper.params.speed; 25130 } 25131 var index = swiper.activeIndex; 25132 var skip = Math.min(swiper.params.slidesPerGroupSkip, index); 25133 var snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
25134 var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 25135 if (translate >= swiper.snapGrid[snapIndex]) { 25136 // The current translate is on or after the current snap index, so the choice 25137 // is between the current index and the one after it. 25138 var currentSnap = swiper.snapGrid[snapIndex]; 25139 var nextSnap = swiper.snapGrid[snapIndex + 1]; 25140 if (translate - currentSnap > (nextSnap - currentSnap) * threshold) { 25141 index += swiper.params.slidesPerGroup; 25142 } 25143 } else { 25144 // The current translate is before the current snap index, so the choice 25145 // is between the current index and the one before it. 25146 var prevSnap = swiper.snapGrid[snapIndex - 1]; 25147 var _currentSnap = swiper.snapGrid[snapIndex]; 25148 if (translate - prevSnap <= (_currentSnap - prevSnap) * threshold) { 25149 index -= swiper.params.slidesPerGroup; 25150 } 25151 } 25152 index = Math.max(index, 0); 25153 index = Math.min(index, swiper.slidesGrid.length - 1); 25154 return swiper.slideTo(index, speed, runCallbacks, internal); 25155} 25156function slideToClickedSlide() { 25157 var swiper = this; 25158 if (swiper.destroyed) return; 25159 var params = swiper.params, 25160 slidesEl = swiper.slidesEl; 25161 var slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView; 25162 var slideToIndex = swiper.getSlideIndexWhenGrid(swiper.clickedIndex); 25163 var realIndex; 25164 var slideSelector = swiper.isElement ? "swiper-slide" : ".".concat(params.slideClass); 25165 var isGrid = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1; 25166 if (params.loop) { 25167 if (swiper.animating) return; 25168 realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10); 25169 if (params.centeredSlides) { 25170 swiper.slideToLoop(realIndex); 25171 } else if (slideToIndex > (isGrid ? (swiper.slides.length - slidesPerView) / 2 - (swiper.params.grid.rows - 1) : swiper.slides.length - slidesPerView)) { 25172 swiper.loopFix(); 25173 slideToIndex = swiper.getSlideIndex((0, _utils.e)(slidesEl, "".concat(slideSelector, "[data-swiper-slide-index=\"").concat(realIndex, "\"]"))[0]); 25174 (0, _utils.n)(function () { 25175 swiper.slideTo(slideToIndex); 25176 }); 25177 } else { 25178 swiper.slideTo(slideToIndex); 25179 } 25180 } else { 25181 swiper.slideTo(slideToIndex); 25182 } 25183} 25184var slide = { 25185 slideTo: slideTo, 25186 slideToLoop: slideToLoop, 25187 slideNext: slideNext, 25188 slidePrev: slidePrev, 25189 slideReset: slideReset, 25190 slideToClosest: slideToClosest, 25191 slideToClickedSlide: slideToClickedSlide 25192}; 25193function loopCreate(slideRealIndex, initial) { 25194 var swiper = this; 25195 var params = swiper.params, 25196 slidesEl = swiper.slidesEl; 25197 if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return; 25198 var initSlides = function initSlides() { 25199 var slides = (0, _utils.e)(slidesEl, ".".concat(params.slideClass, ", swiper-slide")); 25200 slides.forEach(function (el, index) { 25201 el.setAttribute('data-swiper-slide-index', index); 25202 }); 25203 }; 25204 var clearBlankSlides = function clearBlankSlides() { 25205 var slides = (0, _utils.e)(slidesEl, ".".concat(params.slideBlankClass)); 25206 slides.forEach(function (el) { 25207 el.remove(); 25208 }); 25209 if (slides.length > 0) { 25210 swiper.recalcSlides(); 25211 swiper.updateSlides(); 25212 } 25213 }; 25214 var gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 25215 if (params.loopAddBlankSlides && (params.slidesPerGroup > 1 || gridEnabled)) { 25216 clearBlankSlides(); 25217 } 25218 var slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1); 25219 var shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0; 25220 var shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0; 25221 var addBlankSlides = function addBlankSlides(amountOfSlides) { 25222 for (var i = 0; i < amountOfSlides; i += 1) { 25223 var slideEl = swiper.isElement ? (0, _utils.c)('swiper-slide', [params.slideBlankClass]) : (0, _utils.c)('div', [params.slideClass, params.slideBlankClass]); 25224 swiper.slidesEl.append(slideEl); 25225 } 25226 }; 25227 if (shouldFillGroup) { 25228 if (params.loopAddBlankSlides) { 25229 var slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup; 25230 addBlankSlides(slidesToAdd); 25231 swiper.recalcSlides(); 25232 swiper.updateSlides(); 25233 } else { 25234 (0, _utils.v)('Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may
25234not function properly. You need to add more slides (or make duplicates, or empty slides)'); 25235 } 25236 initSlides(); 25237 } else if (shouldFillGrid) { 25238 if (params.loopAddBlankSlides) { 25239 var _slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows; 25240 addBlankSlides(_slidesToAdd); 25241 swiper.recalcSlides(); 25242 swiper.updateSlides(); 25243 } else { 25244 (0, _utils.v)('Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)'); 25245 } 25246 initSlides(); 25247 } else { 25248 initSlides(); 25249 } 25250 var bothDirections = params.centeredSlides || !!params.slidesOffsetBefore || !!params.slidesOffsetAfter; 25251 swiper.loopFix({ 25252 slideRealIndex: slideRealIndex, 25253 direction: bothDirections ? undefined : 'next', 25254 initial: initial 25255 }); 25256} 25257function loopFix() { 25258 var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, 25259 slideRealIndex = _ref6.slideRealIndex, 25260 _ref6$slideTo = _ref6.slideTo, 25261 slideTo = _ref6$slideTo === void 0 ? true : _ref6$slideTo, 25262 direction = _ref6.direction, 25263 setTranslate = _ref6.setTranslate, 25264 activeSlideIndex = _ref6.activeSlideIndex, 25265 initial = _ref6.initial, 25266 byController = _ref6.byController, 25267 byMousewheel = _ref6.byMousewheel; 25268 var swiper = this; 25269 if (!swiper.params.loop) return; 25270 swiper.emit('beforeLoopFix'); 25271 var slides = swiper.slides, 25272 allowSlidePrev = swiper.allowSlidePrev, 25273 allowSlideNext = swiper.allowSlideNext, 25274 slidesEl = swiper.slidesEl, 25275 params = swiper.params; 25276 var centeredSlides = params.centeredSlides, 25277 slidesOffsetBefore = params.slidesOffsetBefore, 25278 slidesOffsetAfter = params.slidesOffsetAfter, 25279 initialSlide = params.initialSlide; 25280 var bothDirections = centeredSlides || !!slidesOffsetBefore || !!slidesOffsetAfter; 25281 swiper.allowSlidePrev = true; 25282 swiper.allowSlideNext = true; 25283 if (swiper.virtual && params.virtual.enabled) { 25284 if (slideTo) { 25285 if (!bothDirections && swiper.snapIndex === 0) { 25286 swiper.slideTo(swiper.virtual.slides.length, 0, false, true); 25287 } else if (bothDirections && swiper.snapIndex < params.slidesPerView) { 25288 swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true); 25289 } else if (swiper.snapIndex === swiper.snapGrid.length - 1) { 25290 swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true); 25291 } 25292 } 25293 swiper.allowSlidePrev = allowSlidePrev; 25294 swiper.allowSlideNext = allowSlideNext; 25295 swiper.emit('loopFix'); 25296 return; 25297 } 25298 var slidesPerView = params.slidesPerView; 25299 if (slidesPerView === 'auto') { 25300 slidesPerView = swiper.slidesPerViewDynamic(); 25301 } else { 25302 slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10)); 25303 if (bothDirections && slidesPerView % 2 === 0) { 25304 slidesPerView = slidesPerView + 1; 25305 } 25306 } 25307 var slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup; 25308 var loopedSlides = bothDirections ? Math.max(slidesPerGroup, Math.ceil(slidesPerView / 2)) : slidesPerGroup; 25309 if (loopedSlides % slidesPerGroup !== 0) { 25310 loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup; 25311 } 25312 loopedSlides += params.loopAdditionalSlides; 25313 swiper.loopedSlides = loopedSlides; 25314 var gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 25315 if (slides.length < slidesPerView + loopedSlides || swiper.params.effect === 'cards' && slides.length < slidesPerView + loopedSlides * 2) { 25316 (0, _utils.v)('Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters'); 25317 } else if (gridEnabled && params.grid.fill === 'row') { 25318 (0, _utils.v)('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`'); 25319 } 25320 var prependSlidesIndexes = []; 25321 var appendSlidesIndexes = []; 25322 var cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length; 25323 var isInitialOverflow = initial && cols - initialSlide < slidesPerView && !bothDirections; 25324 var activeIndex = isInitialOverflow ? initialSlide : swiper.activeIndex; 25325 if (typeof activeSlideIndex === 'undefined') { 25326 activeSlideIndex = swiper.getSlideIndex(slides.find(function (el) { 25327 return el.classList.contains(params.slideActiveClass); 25328 })); 25329 } else { 25330 activeIndex = activeSlideIndex; 25331 } 25332 var isNext = direction === 'next' || !direction; 25333 var isPrev = direction === 'prev' || !direction; 25334 var slidesPrepended = 0; 25335 var slidesAppended = 0; 25336 var activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex; 25337 var activeColIndexWithShift = activeColIndex + (bothDirections && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0); 25338 // prepend last slides before start 25339 if (activeColIndexWithShift < loopedSlides) { 25340 slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup); 25341 for (var i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) {
25342 var index = i - Math.floor(i / cols) * cols; 25343 if (gridEnabled) { 25344 var colIndexToPrepend = cols - index - 1; 25345 for (var _i6 = slides.length - 1; _i6 >= 0; _i6 -= 1) { 25346 if (slides[_i6].column === colIndexToPrepend) prependSlidesIndexes.push(_i6); 25347 } 25348 // slides.forEach((slide, slideIndex) => { 25349 // if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex); 25350 // }); 25351 } else { 25352 prependSlidesIndexes.push(cols - index - 1); 25353 } 25354 } 25355 } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) { 25356 slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup); 25357 if (isInitialOverflow) { 25358 slidesAppended = Math.max(slidesAppended, slidesPerView - cols + initialSlide + 1); 25359 } 25360 var _loop = function _loop() { 25361 var index = _i7 - Math.floor(_i7 / cols) * cols; 25362 if (gridEnabled) { 25363 slides.forEach(function (slide, slideIndex) { 25364 if (slide.column === index) appendSlidesIndexes.push(slideIndex); 25365 }); 25366 } else { 25367 appendSlidesIndexes.push(index); 25368 } 25369 }; 25370 for (var _i7 = 0; _i7 < slidesAppended; _i7 += 1) { 25371 _loop(); 25372 } 25373 } 25374 swiper.__preventObserver__ = true; 25375 requestAnimationFrame(function () { 25376 swiper.__preventObserver__ = false; 25377 }); 25378 if (swiper.params.effect === 'cards' && slides.length < slidesPerView + loopedSlides * 2) { 25379 if (appendSlidesIndexes.includes(activeSlideIndex)) { 25380 appendSlidesIndexes.splice(appendSlidesIndexes.indexOf(activeSlideIndex), 1); 25381 } 25382 if (prependSlidesIndexes.includes(activeSlideIndex)) { 25383 prependSlidesIndexes.splice(prependSlidesIndexes.indexOf(activeSlideIndex), 1); 25384 } 25385 } 25386 if (isPrev) { 25387 prependSlidesIndexes.forEach(function (index) { 25388 slides[index].swiperLoopMoveDOM = true; 25389 slidesEl.prepend(slides[index]); 25390 slides[index].swiperLoopMoveDOM = false; 25391 }); 25392 } 25393 if (isNext) { 25394 appendSlidesIndexes.forEach(function (index) { 25395 slides[index].swiperLoopMoveDOM = true; 25396 slidesEl.append(slides[index]); 25397 slides[index].swiperLoopMoveDOM = false; 25398 }); 25399 } 25400 swiper.recalcSlides(); 25401 if (params.slidesPerView === 'auto') { 25402 swiper.updateSlides(); 25403 } else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) { 25404 swiper.slides.forEach(function (slide, slideIndex) { 25405 swiper.grid.updateSlide(slideIndex, slide, swiper.slides); 25406 }); 25407 } 25408 if (params.watchSlidesProgress) { 25409 swiper.updateSlidesOffset(); 25410 } 25411 if (slideTo) { 25412 if (prependSlidesIndexes.length > 0 && isPrev) { 25413 if (typeof slideRealIndex === 'undefined') { 25414 var currentSlideTranslate = swiper.slidesGrid[activeIndex]; 25415 var newSlideTranslate = swiper.slidesGrid[activeIndex + slidesPrepended]; 25416 var diff = newSlideTranslate - currentSlideTranslate; 25417 if (byMousewheel) { 25418 swiper.setTranslate(swiper.translate - diff); 25419 } else { 25420 swiper.slideTo(activeIndex + Math.ceil(slidesPrepended), 0, false, true); 25421 if (setTranslate) { 25422 swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff; 25423 swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff; 25424 } 25425 } 25426 } else { 25427 if (setTranslate) { 25428 var shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length; 25429 swiper.slideTo(swiper.activeIndex + shift, 0, false, true); 25430 swiper.touchEventsData.currentTranslate = swiper.translate; 25431 } 25432 } 25433 } else if (appendSlidesIndexes.length > 0 && isNext) { 25434 if (typeof slideRealIndex === 'undefined') { 25435 var _currentSlideTranslate = swiper.slidesGrid[activeIndex]; 25436 var _newSlideTranslate = swiper.slidesGrid[activeIndex - slidesAppended]; 25437 var _diff = _newSlideTranslate - _currentSlideTranslate; 25438 if (byMousewheel) { 25439 swiper.setTranslate(swiper.translate - _diff); 25440 } else { 25441 swiper.slideTo(activeIndex - slidesAppended, 0, false, true); 25442 if (setTranslate) { 25443 swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - _diff; 25444 swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - _diff; 25445 } 25446 } 25447 } else { 25448 var _shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length; 25449 swiper.slideTo(swiper.activeIndex - _shift, 0, false, true); 25450 } 25451 } 25452 } 25453 swiper.allowSlidePrev = allowSlidePrev; 25454 swiper.allowSlideNext = allowSlideNext; 25455 if (swiper.controller && swiper.controller.control && !byController) { 25456 var loopParams = { 25457 slideRealIndex: slideRealIndex, 25458 direction: direction, 25459 setTranslate: setTranslate, 25460 activeSlideIndex: activeSlideIndex, 25461 byController: true 25462 }; 25463 if (Array.isArray(swiper.controller.control)) { 25464 swiper.controller.control.forEach(function (c) { 25465 if (!c.destroyed && c.params.loop) c.loopFix(_objectSpread(_objectSpread({}, loopParams), {}, { 25466 slideTo: c.params.slidesPerView === params.slidesPerView ? slideTo : false 25467 })); 25468 }); 25469 } else if (swiper.controller.control instanceof swiper.constructor && swiper.controller.control.params.loop) { 25470 swiper.controller.control.loopFix(_objectSpread(_objectSpread({}, loopParams), {}, { 25471 slideTo: swiper.controller.control.params.slidesPerView === params.slidesPerView ? slideTo : false 25472 })); 25473 } 25474 } 25475 swiper.emit('loopFix'); 25476} 25477function loopDestroy() { 25478 var swiper = this; 25479 var params = swiper.params, 25480 slidesEl = swiper.slidesEl; 25481 if (!params.loop || !slidesEl || swiper.virtual && swiper.params.virtual.enabled) return; 25482 swiper.recalcSlides(); 25483 var newSlidesOrder = [];
25484 swiper.slides.forEach(function (slideEl) { 25485 var index = typeof slideEl.swiperSlideIndex === 'undefined' ? slideEl.getAttribute('data-swiper-slide-index') * 1 : slideEl.swiperSlideIndex; 25486 newSlidesOrder[index] = slideEl; 25487 }); 25488 swiper.slides.forEach(function (slideEl) { 25489 slideEl.removeAttribute('data-swiper-slide-index'); 25490 }); 25491 newSlidesOrder.forEach(function (slideEl) { 25492 slidesEl.append(slideEl); 25493 }); 25494 swiper.recalcSlides(); 25495 swiper.slideTo(swiper.realIndex, 0); 25496} 25497var loop = { 25498 loopCreate: loopCreate, 25499 loopFix: loopFix, 25500 loopDestroy: loopDestroy 25501}; 25502function setGrabCursor(moving) { 25503 var swiper = this; 25504 if (!swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return; 25505 var el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl; 25506 if (swiper.isElement) { 25507 swiper.__preventObserver__ = true; 25508 } 25509 el.style.cursor = 'move'; 25510 el.style.cursor = moving ? 'grabbing' : 'grab'; 25511 if (swiper.isElement) { 25512 requestAnimationFrame(function () { 25513 swiper.__preventObserver__ = false; 25514 }); 25515 } 25516} 25517function unsetGrabCursor() { 25518 var swiper = this; 25519 if (swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) { 25520 return; 25521 } 25522 if (swiper.isElement) { 25523 swiper.__preventObserver__ = true; 25524 } 25525 swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = ''; 25526 if (swiper.isElement) { 25527 requestAnimationFrame(function () { 25528 swiper.__preventObserver__ = false; 25529 }); 25530 } 25531} 25532var grabCursor = { 25533 setGrabCursor: setGrabCursor, 25534 unsetGrabCursor: unsetGrabCursor 25535}; 25536 25537// Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd 25538function closestElement(selector) { 25539 var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this; 25540 function __closestFrom(el) { 25541 if (!el || el === (0, _ssrWindowEsm.g)() || el === (0, _ssrWindowEsm.a)()) return null; 25542 if (el.assignedSlot) el = el.assignedSlot; 25543 var found = el.closest(selector); 25544 if (!found && !el.getRootNode) { 25545 return null; 25546 } 25547 return found || __closestFrom(el.getRootNode().host); 25548 } 25549 return __closestFrom(base); 25550} 25551function preventEdgeSwipe(swiper, event, startX) { 25552 var window = (0, _ssrWindowEsm.a)(); 25553 var params = swiper.params; 25554 var edgeSwipeDetection = params.edgeSwipeDetection; 25555 var edgeSwipeThreshold = params.edgeSwipeThreshold; 25556 if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) { 25557 if (edgeSwipeDetection === 'prevent') { 25558 event.preventDefault(); 25559 return true; 25560 } 25561 return false; 25562 } 25563 return true; 25564} 25565function onTouchStart(event) { 25566 var swiper = this; 25567 var document = (0, _ssrWindowEsm.g)(); 25568 var e = event; 25569 if (e.originalEvent) e = e.originalEvent; 25570 var data = swiper.touchEventsData; 25571 if (e.type === 'pointerdown') { 25572 if (data.pointerId !== null && data.pointerId !== e.pointerId) { 25573 return; 25574 } 25575 data.pointerId = e.pointerId; 25576 } else if (e.type === 'touchstart' && e.targetTouches.length === 1) { 25577 data.touchId = e.targetTouches[0].identifier; 25578 } 25579 if (e.type === 'touchstart') { 25580 // don't proceed touch event 25581 preventEdgeSwipe(swiper, e, e.targetTouches[0].pageX); 25582 return; 25583 } 25584 var params = swiper.params, 25585 touches = swiper.touches, 25586 enabled = swiper.enabled; 25587 if (!enabled) return; 25588 if (!params.simulateTouch && e.pointerType === 'mouse') return; 25589 if (swiper.animating && params.preventInteractionOnTransition) { 25590 return; 25591 } 25592 if (!swiper.animating && params.cssMode && params.loop) { 25593 swiper.loopFix(); 25594 } 25595 var targetEl = e.target; 25596 if (params.touchEventsTarget === 'wrapper') { 25597 if (!(0, _utils.w)(targetEl, swiper.wrapperEl)) return; 25598 } 25599 if ('which' in e && e.which === 3) return; 25600 if ('button' in e && e.button > 0) return; 25601 if (data.isTouched && data.isMoved) return; 25602 25603 // change target el for shadow root component 25604 var swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== ''; 25605 // eslint-disable-next-line 25606 var eventPath = e.composedPath ? e.composedPath() : e.path; 25607 if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) { 25608 targetEl = eventPath[0]; 25609 } 25610 var noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : ".".concat(params.noSwipingClass); 25611 var isTargetShadow = !!(e.target && e.target.shadowRoot); 25612 25613 // use closestElement for shadow root element to get the actual closest for nested shadow root element 25614 if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, targetEl) : targetEl.closest(noSwipingSelector))) { 25615 swiper.allowClick = true; 25616 return; 25617 } 25618 if (params.swipeHandler) { 25619 if (!targetEl.closest(params.swipeHandler)) return; 25620 } 25621 touches.currentX = e.pageX; 25622 touches.currentY = e.pageY; 25623 var startX = touches.currentX; 25624 var startY = touches.currentY; 25625 25626 // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore 25627 25628 if (!preventEdgeSwipe(swiper, e, startX)) { 25629 return; 25630 } 25631 _extends(data, { 25632 isTouched: true, 25633 isMoved: false, 25634 allowTouchCallbacks: true, 25635 isScrolling: undefined, 25636 startMoving: undefined 25637 }); 25638 touches.startX = startX; 25639 touches.startY = startY; 25640 data.touchStartTime = (0, _utils.h)(); 25641 swiper.allowClick = true; 25642 swiper.updateSize(); 25643 swiper.swipeDirection = undefined; 25644 if (params.threshold > 0) data.allowThresholdMove = false;
25645 var preventDefault = true; 25646 if (targetEl.matches(data.focusableElements)) { 25647 preventDefault = false; 25648 if (targetEl.nodeName === 'SELECT') { 25649 data.isTouched = false; 25650 } 25651 } 25652 if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== targetEl && (e.pointerType === 'mouse' || e.pointerType !== 'mouse' && !targetEl.matches(data.focusableElements))) { 25653 document.activeElement.blur(); 25654 } 25655 var shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault; 25656 if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !targetEl.isContentEditable) { 25657 e.preventDefault(); 25658 } 25659 if (params.freeMode && params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) { 25660 swiper.freeMode.onTouchStart(); 25661 } 25662 swiper.emit('touchStart', e); 25663} 25664function onTouchMove(event) { 25665 var document = (0, _ssrWindowEsm.g)(); 25666 var swiper = this; 25667 var data = swiper.touchEventsData; 25668 var params = swiper.params, 25669 touches = swiper.touches, 25670 rtl = swiper.rtlTranslate, 25671 enabled = swiper.enabled; 25672 if (!enabled) return; 25673 if (!params.simulateTouch && event.pointerType === 'mouse') return; 25674 var e = event; 25675 if (e.originalEvent) e = e.originalEvent; 25676 if (e.type === 'pointermove') { 25677 if (data.touchId !== null) return; // return from pointer if we use touch 25678 var id = e.pointerId; 25679 if (id !== data.pointerId) return; 25680 } 25681 var targetTouch; 25682 if (e.type === 'touchmove') { 25683 targetTouch = _toConsumableArray(e.changedTouches).find(function (t) { 25684 return t.identifier === data.touchId; 25685 }); 25686 if (!targetTouch || targetTouch.identifier !== data.touchId) return; 25687 } else { 25688 targetTouch = e; 25689 } 25690 if (!data.isTouched) { 25691 if (data.startMoving && data.isScrolling) { 25692 swiper.emit('touchMoveOpposite', e); 25693 } 25694 return; 25695 } 25696 var pageX = targetTouch.pageX; 25697 var pageY = targetTouch.pageY; 25698 if (e.preventedByNestedSwiper) { 25699 touches.startX = pageX; 25700 touches.startY = pageY; 25701 return; 25702 } 25703 if (!swiper.allowTouchMove) { 25704 if (!e.target.matches(data.focusableElements)) { 25705 swiper.allowClick = false; 25706 } 25707 if (data.isTouched) { 25708 _extends(touches, { 25709 startX: pageX, 25710 startY: pageY, 25711 currentX: pageX, 25712 currentY: pageY 25713 }); 25714 data.touchStartTime = (0, _utils.h)(); 25715 } 25716 return; 25717 } 25718 if (params.touchReleaseOnEdges && !params.loop) { 25719 if (swiper.isVertical()) { 25720 // Vertical 25721 if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) { 25722 data.isTouched = false; 25723 data.isMoved = false; 25724 return; 25725 } 25726 } else if (rtl && (pageX > touches.startX && -swiper.translate <= swiper.maxTranslate() || pageX < touches.startX && -swiper.translate >= swiper.minTranslate())) { 25727 return; 25728 } else if (!rtl && (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate())) { 25729 return; 25730 } 25731 } 25732 if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== e.target && e.pointerType !== 'mouse') { 25733 document.activeElement.blur(); 25734 } 25735 if (document.activeElement) { 25736 if (e.target === document.activeElement && e.target.matches(data.focusableElements)) { 25737 data.isMoved = true; 25738 swiper.allowClick = false; 25739 return; 25740 } 25741 } 25742 if (data.allowTouchCallbacks) { 25743 swiper.emit('touchMove', e); 25744 } 25745 touches.previousX = touches.currentX; 25746 touches.previousY = touches.currentY; 25747 touches.currentX = pageX; 25748 touches.currentY = pageY; 25749 var diffX = touches.currentX - touches.startX; 25750 var diffY = touches.currentY - touches.startY; 25751 if (swiper.params.threshold && Math.sqrt(Math.pow(diffX, 2) + Math.pow(diffY, 2)) < swiper.params.threshold) return; 25752 if (typeof data.isScrolling === 'undefined') { 25753 var touchAngle; 25754 if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) { 25755 data.isScrolling = false;
vendor: 3,835 bytes, lines 25756-25859
25756 } else { 25757 // eslint-disable-next-line 25758 if (diffX * diffX + diffY * diffY >= 25) { 25759 touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI; 25760 data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle; 25761 } 25762 } 25763 } 25764 if (data.isScrolling) { 25765 swiper.emit('touchMoveOpposite', e); 25766 } 25767 if (typeof data.startMoving === 'undefined') { 25768 if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) { 25769 data.startMoving = true; 25770 } 25771 } 25772 if (data.isScrolling || e.type === 'touchmove' && data.preventTouchMoveFromPointerMove) { 25773 data.isTouched = false; 25774 return; 25775 } 25776 if (!data.startMoving) { 25777 return; 25778 } 25779 swiper.allowClick = false; 25780 if (!params.cssMode && e.cancelable) { 25781 e.preventDefault(); 25782 } 25783 if (params.touchMoveStopPropagation && !params.nested) { 25784 e.stopPropagation(); 25785 } 25786 var diff = swiper.isHorizontal() ? diffX : diffY; 25787 var touchesDiff = swiper.isHorizontal() ? touches.currentX - touches.previousX : touches.currentY - touches.previousY; 25788 if (params.oneWayMovement) { 25789 diff = Math.abs(diff) * (rtl ? 1 : -1); 25790 touchesDiff = Math.abs(touchesDiff) * (rtl ? 1 : -1); 25791 } 25792 touches.diff = diff; 25793 diff *= params.touchRatio; 25794 if (rtl) { 25795 diff = -diff; 25796 touchesDiff = -touchesDiff; 25797 } 25798 var prevTouchesDirection = swiper.touchesDirection; 25799 swiper.swipeDirection = diff > 0 ? 'prev' : 'next'; 25800 swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next'; 25801 var isLoop = swiper.params.loop && !params.cssMode; 25802 var allowLoopFix = swiper.touchesDirection === 'next' && swiper.allowSlideNext || swiper.touchesDirection === 'prev' && swiper.allowSlidePrev; 25803 if (!data.isMoved) { 25804 if (isLoop && allowLoopFix) { 25805 swiper.loopFix({ 25806 direction: swiper.swipeDirection 25807 }); 25808 } 25809 data.startTranslate = swiper.getTranslate(); 25810 swiper.setTransition(0); 25811 if (swiper.animating) { 25812 var evt = new window.CustomEvent('transitionend', { 25813 bubbles: true, 25814 cancelable: true, 25815 detail: { 25816 bySwiperTouchMove: true 25817 } 25818 }); 25819 swiper.wrapperEl.dispatchEvent(evt); 25820 } 25821 data.allowMomentumBounce = false; 25822 // Grab Cursor 25823 if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 25824 swiper.setGrabCursor(true); 25825 } 25826 swiper.emit('sliderFirstMove', e); 25827 } 25828 var loopFixed; 25829 new Date().getTime(); 25830 if (params._loopSwapReset !== false && data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) { 25831 _extends(touches, { 25832 startX: pageX, 25833 startY: pageY, 25834 currentX: pageX, 25835 currentY: pageY, 25836 startTranslate: data.currentTranslate 25837 }); 25838 data.loopSwapReset = true; 25839 data.startTranslate = data.currentTranslate; 25840 return; 25841 } 25842 swiper.emit('sliderMove', e); 25843 data.isMoved = true; 25844 data.currentTranslate = diff + data.startTranslate; 25845 var disableParentSwiper = true; 25846 var resistanceRatio = params.resistanceRatio; 25847 if (params.touchReleaseOnEdges) { 25848 resistanceRatio = 0; 25849 } 25850 if (diff > 0) { 25851 if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] - (params.slidesPerView !== 'auto' && swiper.slides.length - params.slidesPerView >= 2 ? swiper.slidesSizesGrid[swiper.activeIndex + 1] + swiper.params.spaceBetween : 0) - swiper.params.spaceBetween : swiper.minTranslate())) { 25852 swiper.loopFix({ 25853 direction: 'prev', 25854 setTranslate: true, 25855 activeSlideIndex: 0 25856 }); 25857 } 25858 if (data.currentTranslate > swiper.minTranslate()) { 25859 disableParentSwiper = false;
25860 if (params.resistance) { 25861 data.currentTranslate = swiper.minTranslate() - 1 + Math.pow(-swiper.minTranslate() + data.startTranslate + diff, resistanceRatio); 25862 } 25863 } 25864 } else if (diff < 0) { 25865 if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + swiper.params.spaceBetween + (params.slidesPerView !== 'auto' && swiper.slides.length - params.slidesPerView >= 2 ? swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + swiper.params.spaceBetween : 0) : swiper.maxTranslate())) { 25866 swiper.loopFix({ 25867 direction: 'next', 25868 setTranslate: true, 25869 activeSlideIndex: swiper.slides.length - (params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10))) 25870 }); 25871 } 25872 if (data.currentTranslate < swiper.maxTranslate()) { 25873 disableParentSwiper = false; 25874 if (params.resistance) { 25875 data.currentTranslate = swiper.maxTranslate() + 1 - Math.pow(swiper.maxTranslate() - data.startTranslate - diff, resistanceRatio); 25876 } 25877 } 25878 } 25879 if (disableParentSwiper) { 25880 e.preventedByNestedSwiper = true; 25881 } 25882 25883 // Directions locks 25884 if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) { 25885 data.currentTranslate = data.startTranslate; 25886 } 25887 if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) { 25888 data.currentTranslate = data.startTranslate; 25889 } 25890 if (!swiper.allowSlidePrev && !swiper.allowSlideNext) { 25891 data.currentTranslate = data.startTranslate; 25892 } 25893 25894 // Threshold 25895 if (params.threshold > 0) { 25896 if (Math.abs(diff) > params.threshold || data.allowThresholdMove) { 25897 if (!data.allowThresholdMove) { 25898 data.allowThresholdMove = true; 25899 touches.startX = touches.currentX; 25900 touches.startY = touches.currentY; 25901 data.currentTranslate = data.startTranslate; 25902 touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY; 25903 return; 25904 } 25905 } else { 25906 data.currentTranslate = data.startTranslate; 25907 return; 25908 } 25909 } 25910 if (!params.followFinger || params.cssMode) return; 25911 25912 // Update active index in free mode 25913 if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) { 25914 swiper.updateActiveIndex(); 25915 swiper.updateSlidesClasses(); 25916 } 25917 if (params.freeMode && params.freeMode.enabled && swiper.freeMode) { 25918 swiper.freeMode.onTouchMove(); 25919 } 25920 // Update progress 25921 swiper.updateProgress(data.currentTranslate); 25922 // Update translate 25923 swiper.setTranslate(data.currentTranslate); 25924} 25925function onTouchEnd(event) { 25926 var swiper = this; 25927 var data = swiper.touchEventsData; 25928 var e = event; 25929 if (e.originalEvent) e = e.originalEvent; 25930 var targetTouch; 25931 var isTouchEvent = e.type === 'touchend' || e.type === 'touchcancel'; 25932 if (!isTouchEvent) { 25933 if (data.touchId !== null) return; // return from pointer if we use touch 25934 if (e.pointerId !== data.pointerId) return; 25935 targetTouch = e; 25936 } else { 25937 targetTouch = _toConsumableArray(e.changedTouches).find(function (t) { 25938 return t.identifier === data.touchId; 25939 }); 25940 if (!targetTouch || targetTouch.identifier !== data.touchId) return; 25941 } 25942 if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e.type)) { 25943 var proceed = ['pointercancel', 'contextmenu'].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView); 25944 if (!proceed) { 25945 return; 25946 } 25947 } 25948 data.pointerId = null; 25949 data.touchId = null; 25950 var params = swiper.params, 25951 touches = swiper.touches, 25952 rtl = swiper.rtlTranslate, 25953 slidesGrid = swiper.slidesGrid, 25954 enabled = swiper.enabled; 25955 if (!enabled) return; 25956 if (!params.simulateTouch && e.pointerType === 'mouse') return; 25957 if (data.allowTouchCallbacks) { 25958 swiper.emit('touchEnd', e); 25959 } 25960 data.allowTouchCallbacks = false; 25961 if (!data.isTouched) { 25962 if (data.isMoved && params.grabCursor) { 25963 swiper.setGrabCursor(false); 25964 } 25965 data.isMoved = false;
25966 data.startMoving = false; 25967 return; 25968 } 25969 25970 // Return Grab Cursor 25971 if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 25972 swiper.setGrabCursor(false); 25973 } 25974 25975 // Time diff 25976 var touchEndTime = (0, _utils.h)(); 25977 var timeDiff = touchEndTime - data.touchStartTime; 25978 25979 // Tap, doubleTap, Click 25980 if (swiper.allowClick) { 25981 var pathTree = e.path || e.composedPath && e.composedPath(); 25982 swiper.updateClickedSlide(pathTree && pathTree[0] || e.target, pathTree); 25983 swiper.emit('tap click', e); 25984 if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) { 25985 swiper.emit('doubleTap doubleClick', e); 25986 } 25987 } 25988 data.lastClickTime = (0, _utils.h)(); 25989 (0, _utils.n)(function () { 25990 if (!swiper.destroyed) swiper.allowClick = true; 25991 }); 25992 if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) { 25993 data.isTouched = false; 25994 data.isMoved = false; 25995 data.startMoving = false; 25996 return; 25997 } 25998 data.isTouched = false; 25999 data.isMoved = false; 26000 data.startMoving = false; 26001 var currentPos; 26002 if (params.followFinger) { 26003 currentPos = rtl ? swiper.translate : -swiper.translate; 26004 } else { 26005 currentPos = -data.currentTranslate; 26006 } 26007 if (params.cssMode) { 26008 return; 26009 } 26010 if (params.freeMode && params.freeMode.enabled) { 26011 swiper.freeMode.onTouchEnd({ 26012 currentPos: currentPos 26013 }); 26014 return; 26015 } 26016 26017 // Find current slide 26018 var swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop; 26019 var stopIndex = 0; 26020 var groupSize = swiper.slidesSizesGrid[0]; 26021 for (var i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) { 26022 var _increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 26023 if (typeof slidesGrid[i + _increment] !== 'undefined') { 26024 if (swipeToLast || currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + _increment]) { 26025 stopIndex = i; 26026 groupSize = slidesGrid[i + _increment] - slidesGrid[i]; 26027 } 26028 } else if (swipeToLast || currentPos >= slidesGrid[i]) { 26029 stopIndex = i; 26030 groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2]; 26031 } 26032 } 26033 var rewindFirstIndex = null; 26034 var rewindLastIndex = null; 26035 if (params.rewind) { 26036 if (swiper.isBeginning) { 26037 rewindLastIndex = params.virtual && params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; 26038 } else if (swiper.isEnd) { 26039 rewindFirstIndex = 0; 26040 } 26041 } 26042 // Find current slide size 26043 var ratio = (currentPos - slidesGrid[stopIndex]) / groupSize; 26044 var increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 26045 if (timeDiff > params.longSwipesMs) { 26046 // Long touches 26047 if (!params.longSwipes) { 26048 swiper.slideTo(swiper.activeIndex); 26049 return; 26050 } 26051 if (swiper.swipeDirection === 'next') { 26052 if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex); 26053 } 26054 if (swiper.swipeDirection === 'prev') { 26055 if (ratio > 1 - params.longSwipesRatio) { 26056 swiper.slideTo(stopIndex + increment); 26057 } else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) { 26058 swiper.slideTo(rewindLastIndex); 26059 } else { 26060 swiper.slideTo(stopIndex); 26061 } 26062 } 26063 } else { 26064 // Short swipes 26065 if (!params.shortSwipes) { 26066 swiper.slideTo(swiper.activeIndex); 26067 return; 26068 } 26069 var isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl); 26070 if (!isNavButtonTarget) { 26071 if (swiper.swipeDirection === 'next') { 26072 swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment); 26073 } 26074 if (swiper.swipeDirection === 'prev') { 26075 swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex); 26076 } 26077 } else if (e.target === swiper.navigation.nextEl) { 26078 swiper.slideTo(stopIndex + increment); 26079 } else { 26080 swiper.slideTo(stopIndex); 26081 } 26082 } 26083} 26084function onResize() { 26085 var swiper = this; 26086 var params = swiper.params, 26087 el = swiper.el; 26088 if (el && el.offsetWidth === 0) return; 26089
26090 // Breakpoints 26091 if (params.breakpoints) { 26092 swiper.setBreakpoint(); 26093 } 26094 26095 // Save locks 26096 var allowSlideNext = swiper.allowSlideNext, 26097 allowSlidePrev = swiper.allowSlidePrev, 26098 snapGrid = swiper.snapGrid; 26099 var isVirtual = swiper.virtual && swiper.params.virtual.enabled; 26100 26101 // Disable locks on resize 26102 swiper.allowSlideNext = true; 26103 swiper.allowSlidePrev = true; 26104 swiper.updateSize(); 26105 swiper.updateSlides(); 26106 swiper.updateSlidesClasses(); 26107 var isVirtualLoop = isVirtual && params.loop; 26108 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) { 26109 var slides = isVirtual ? swiper.virtual.slides : swiper.slides; 26110 swiper.slideTo(slides.length - 1, 0, false, true); 26111 } else { 26112 if (swiper.params.loop && !isVirtual) { 26113 swiper.slideToLoop(swiper.realIndex, 0, false, true); 26114 } else { 26115 swiper.slideTo(swiper.activeIndex, 0, false, true); 26116 } 26117 } 26118 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { 26119 clearTimeout(swiper.autoplay.resizeTimeout); 26120 swiper.autoplay.resizeTimeout = setTimeout(function () { 26121 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { 26122 swiper.autoplay.resume(); 26123 } 26124 }, 500); 26125 } 26126 // Return locks after resize 26127 swiper.allowSlidePrev = allowSlidePrev; 26128 swiper.allowSlideNext = allowSlideNext; 26129 if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) { 26130 swiper.checkOverflow(); 26131 } 26132} 26133function onClick(e) { 26134 var swiper = this; 26135 if (!swiper.enabled) return; 26136 if (!swiper.allowClick) { 26137 if (swiper.params.preventClicks) e.preventDefault(); 26138 if (swiper.params.preventClicksPropagation && swiper.animating) { 26139 e.stopPropagation(); 26140 e.stopImmediatePropagation(); 26141 } 26142 } 26143} 26144function onScroll() { 26145 var swiper = this; 26146 var wrapperEl = swiper.wrapperEl, 26147 rtlTranslate = swiper.rtlTranslate, 26148 enabled = swiper.enabled; 26149 if (!enabled) return; 26150 swiper.previousTranslate = swiper.translate; 26151 if (swiper.isHorizontal()) { 26152 swiper.translate = -wrapperEl.scrollLeft; 26153 } else { 26154 swiper.translate = -wrapperEl.scrollTop; 26155 } 26156 // eslint-disable-next-line 26157 if (swiper.translate === 0) swiper.translate = 0; 26158 swiper.updateActiveIndex(); 26159 swiper.updateSlidesClasses(); 26160 var newProgress; 26161 var translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 26162 if (translatesDiff === 0) { 26163 newProgress = 0; 26164 } else { 26165 newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff; 26166 } 26167 if (newProgress !== swiper.progress) { 26168 swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate); 26169 } 26170 swiper.emit('setTranslate', swiper.translate, false); 26171} 26172function onLoad(e) { 26173 var swiper = this; 26174 processLazyPreloader(swiper, e.target); 26175 if (swiper.params.cssMode || swiper.params.slidesPerView !== 'auto' && !swiper.params.autoHeight) { 26176 return; 26177 } 26178 swiper.update(); 26179} 26180function onDocumentTouchStart() { 26181 var swiper = this; 26182 if (swiper.documentTouchHandlerProceeded) return; 26183 swiper.documentTouchHandlerProceeded = true; 26184 if (swiper.params.touchReleaseOnEdges) { 26185 swiper.el.style.touchAction = 'auto'; 26186 } 26187} 26188var events = function events(swiper, method) { 26189 var document = (0, _ssrWindowEsm.g)(); 26190 var params = swiper.params, 26191 el = swiper.el, 26192 wrapperEl = swiper.wrapperEl, 26193 device = swiper.device; 26194 var capture = !!params.nested; 26195 var domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; 26196 var swiperMethod = method; 26197 if (!el || typeof el === 'string') return; 26198 26199 // Touch Events 26200 document[domMethod]('touchstart', swiper.onDocumentTouchStart, { 26201 passive: false, 26202 capture: capture 26203 }); 26204 el[domMethod]('touchstart', swiper.onTouchStart, { 26205 passive: false 26206 }); 26207 el[domMethod]('pointerdown', swiper.onTouchStart, { 26208 passive: false 26209 }); 26210 document[domMethod]('touchmove', swiper.onTouchMove, { 26211 passive: false, 26212 capture: capture 26213 }); 26214 document[domMethod]('pointermove', swiper.onTouchMove, { 26215 passive: false, 26216 capture: capture 26217 }); 26218 document[domMethod]('touchend', swiper.onTouchEnd, { 26219 passive: true 26220 }); 26221 document[domMethod]('pointerup', swiper.onTouchEnd, { 26222 passive: true 26223 }); 26224 document[domMethod]('pointercancel', swiper.onTouchEnd, { 26225 passive: true 26226 }); 26227 document[domMethod]('touchcancel', swiper.onTouchEnd, { 26228 passive: true 26229 }); 26230 document[domMethod]('pointerout', swiper.onTouchEnd, { 26231 passive: true 26232 }); 26233 document[domMethod]('pointerleave', swiper.onTouchEnd, { 26234 passive: true 26235 }); 26236 document[domMethod]('contextmenu', swiper.onTouchEnd, { 26237 passive: true 26238 }); 26239 26240 // Prevent Links Clicks 26241 if (params.preventClicks || params.preventClicksPropagation) { 26242 el[domMethod]('click', swiper.onClick, true); 26243 } 26244 if (params.cssMode) { 26245 wrapperEl[domMethod]('scroll', swiper.onScroll); 26246 } 26247 26248 // Resize handler 26249 if (params.updateOnWindowResize) { 26250 swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true); 26251 } else { 26252 swiper[swiperMethod]('observerUpdate', onResize, true); 26253 } 26254 26255 // Images loader 26256 el[domMethod]('load', swiper.onLoad, { 26257 capture: true 26258 }); 26259}; 26260function attachEvents() { 26261 var swiper = this; 26262 var params = swiper.params; 26263 swiper.onTouchStart = onTouchStart.bind(swiper); 26264 swiper.onTouchMove = onTouchMove.bind(swiper); 26265 swiper.onTouchEnd = onTouchEnd.bind(swiper); 26266 swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper); 26267 if (params.cssMode) { 26268 swiper.onScroll = onScroll.bind(swiper); 26269 } 26270 swiper.onClick = onClick.bind(swiper); 26271 swiper.onLoad = onLoad.bind(swiper); 26272 events(swiper, 'on'); 26273} 26274function detachEvents() { 26275 var swiper = this; 26276 events(swiper, 'off'); 26277} 26278var events$1 = { 26279 attachEvents: attachEvents, 26280 detachEvents: detachEvents 26281}; 26282var isGridEnabled = function isGridEnabled(swiper, params) { 26283 return swiper.grid && params.grid && params.grid.rows > 1; 26284}; 26285function setBreakpoint() { 26286 var swiper = this; 26287 var realIndex = swiper.realIndex, 26288 initialized = swiper.initialized, 26289 params = swiper.params, 26290 el = swiper.el; 26291 var breakpoints = params.breakpoints; 26292 if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; 26293 var document = (0, _ssrWindowEsm.g)(); 26294 26295 // Get breakpoint for window/container width and update parameters 26296 var breakpointsBase = params.breakpointsBase === 'window' || !params.breakpointsBase ? params.breakpointsBase : 'container'; 26297 var breakpointContainer = ['window', 'container'].includes(params.breakpointsBase) || !params.breakpointsBase ? swiper.el : document.querySelector(params.breakpointsBase);
26298 var breakpoint = swiper.getBreakpoint(breakpoints, breakpointsBase, breakpointContainer); 26299 if (!breakpoint || swiper.currentBreakpoint === breakpoint) return; 26300 var breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined; 26301 var breakpointParams = breakpointOnlyParams || swiper.originalParams; 26302 var wasMultiRow = isGridEnabled(swiper, params); 26303 var isMultiRow = isGridEnabled(swiper, breakpointParams); 26304 var wasGrabCursor = swiper.params.grabCursor; 26305 var isGrabCursor = breakpointParams.grabCursor; 26306 var wasEnabled = params.enabled; 26307 if (wasMultiRow && !isMultiRow) { 26308 el.classList.remove("".concat(params.containerModifierClass, "grid"), "".concat(params.containerModifierClass, "grid-column")); 26309 swiper.emitContainerClasses(); 26310 } else if (!wasMultiRow && isMultiRow) { 26311 el.classList.add("".concat(params.containerModifierClass, "grid")); 26312 if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') { 26313 el.classList.add("".concat(params.containerModifierClass, "grid-column")); 26314 } 26315 swiper.emitContainerClasses(); 26316 } 26317 if (wasGrabCursor && !isGrabCursor) { 26318 swiper.unsetGrabCursor(); 26319 } else if (!wasGrabCursor && isGrabCursor) { 26320 swiper.setGrabCursor(); 26321 } 26322 26323 // Toggle navigation, pagination, scrollbar 26324 ['navigation', 'pagination', 'scrollbar'].forEach(function (prop) { 26325 if (typeof breakpointParams[prop] === 'undefined') return; 26326 var wasModuleEnabled = params[prop] && params[prop].enabled; 26327 var isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled; 26328 if (wasModuleEnabled && !isModuleEnabled) { 26329 swiper[prop].disable(); 26330 } 26331 if (!wasModuleEnabled && isModuleEnabled) { 26332 swiper[prop].enable(); 26333 } 26334 }); 26335 var directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction; 26336 var needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged); 26337 var wasLoop = params.loop; 26338 if (directionChanged && initialized) { 26339 swiper.changeDirection(); 26340 } 26341 (0, _utils.x)(swiper.params, breakpointParams); 26342 var isEnabled = swiper.params.enabled; 26343 var hasLoop = swiper.params.loop; 26344 _extends(swiper, { 26345 allowTouchMove: swiper.params.allowTouchMove, 26346 allowSlideNext: swiper.params.allowSlideNext, 26347 allowSlidePrev: swiper.params.allowSlidePrev 26348 }); 26349 if (wasEnabled && !isEnabled) { 26350 swiper.disable(); 26351 } else if (!wasEnabled && isEnabled) { 26352 swiper.enable(); 26353 } 26354 swiper.currentBreakpoint = breakpoint; 26355 swiper.emit('_beforeBreakpoint', breakpointParams); 26356 if (initialized) { 26357 if (needsReLoop) { 26358 swiper.loopDestroy(); 26359 swiper.loopCreate(realIndex); 26360 swiper.updateSlides(); 26361 } else if (!wasLoop && hasLoop) { 26362 swiper.loopCreate(realIndex); 26363 swiper.updateSlides(); 26364 } else if (wasLoop && !hasLoop) { 26365 swiper.loopDestroy(); 26366 } 26367 } 26368 swiper.emit('breakpoint', breakpointParams); 26369} 26370function getBreakpoint(breakpoints) { 26371 var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'window'; 26372 var containerEl = arguments.length > 2 ? arguments[2] : undefined; 26373 if (!breakpoints || base === 'container' && !containerEl) return undefined; 26374 var breakpoint = false; 26375 var window = (0, _ssrWindowEsm.a)(); 26376 var currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight; 26377 var points = Object.keys(breakpoints).map(function (point) { 26378 if (typeof point === 'string' && point.indexOf('@') === 0) { 26379 var minRatio = parseFloat(point.substr(1)); 26380 var value = currentHeight * minRatio; 26381 return { 26382 value: value, 26383 point: point 26384 }; 26385 } 26386 return { 26387 value: point, 26388 point: point 26389 }; 26390 }); 26391 points.sort(function (a, b) { 26392 return parseInt(a.value, 10) - parseInt(b.value, 10); 26393 }); 26394 for (var i = 0; i < points.length; i += 1) { 26395 var _points$i = points[i], 26396 point = _points$i.point, 26397 value = _points$i.value; 26398 if (base === 'window') { 26399 if (window.matchMedia("(min-width: ".concat(value, "px)")).matches) { 26400 breakpoint = point; 26401 } 26402 } else if (value <= containerEl.clientWidth) { 26403 breakpoint = point; 26404 } 26405 } 26406 return breakpoint || 'max'; 26407} 26408var breakpoints = { 26409 setBreakpoint: setBreakpoint,
26410 getBreakpoint: getBreakpoint 26411}; 26412function prepareClasses(entries, prefix) { 26413 var resultClasses = []; 26414 entries.forEach(function (item) { 26415 if (_typeof(item) === 'object') { 26416 Object.keys(item).forEach(function (classNames) { 26417 if (item[classNames]) { 26418 resultClasses.push(prefix + classNames); 26419 } 26420 }); 26421 } else if (typeof item === 'string') { 26422 resultClasses.push(prefix + item); 26423 } 26424 }); 26425 return resultClasses; 26426} 26427function addClasses() { 26428 var _el$classList; 26429 var swiper = this; 26430 var classNames = swiper.classNames, 26431 params = swiper.params, 26432 rtl = swiper.rtl, 26433 el = swiper.el, 26434 device = swiper.device; 26435 // prettier-ignore 26436 var suffixes = prepareClasses(['initialized', params.direction, { 26437 'free-mode': swiper.params.freeMode && params.freeMode.enabled 26438 }, { 26439 'autoheight': params.autoHeight 26440 }, { 26441 'rtl': rtl 26442 }, { 26443 'grid': params.grid && params.grid.rows > 1 26444 }, { 26445 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column' 26446 }, { 26447 'android': device.android 26448 }, { 26449 'ios': device.ios 26450 }, { 26451 'css-mode': params.cssMode 26452 }, { 26453 'centered': params.cssMode && params.centeredSlides 26454 }, { 26455 'watch-progress': params.watchSlidesProgress 26456 }], params.containerModifierClass); 26457 classNames.push.apply(classNames, _toConsumableArray(suffixes)); 26458 (_el$classList = el.classList).add.apply(_el$classList, _toConsumableArray(classNames)); 26459 swiper.emitContainerClasses(); 26460} 26461function removeClasses() { 26462 var _el$classList2; 26463 var swiper = this; 26464 var el = swiper.el, 26465 classNames = swiper.classNames; 26466 if (!el || typeof el === 'string') return; 26467 (_el$classList2 = el.classList).remove.apply(_el$classList2, _toConsumableArray(classNames)); 26468 swiper.emitContainerClasses(); 26469} 26470var classes = { 26471 addClasses: addClasses, 26472 removeClasses: removeClasses 26473}; 26474function checkOverflow() { 26475 var swiper = this; 26476 var wasLocked = swiper.isLocked, 26477 params = swiper.params; 26478 var slidesOffsetBefore = params.slidesOffsetBefore; 26479 if (slidesOffsetBefore) { 26480 var lastSlideIndex = swiper.slides.length - 1; 26481 var lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2; 26482 swiper.isLocked = swiper.size > lastSlideRightEdge; 26483 } else { 26484 swiper.isLocked = swiper.snapGrid.length === 1; 26485 } 26486 if (params.allowSlideNext === true) { 26487 swiper.allowSlideNext = !swiper.isLocked; 26488 } 26489 if (params.allowSlidePrev === true) { 26490 swiper.allowSlidePrev = !swiper.isLocked; 26491 } 26492 if (wasLocked && wasLocked !== swiper.isLocked) { 26493 swiper.isEnd = false; 26494 } 26495 if (wasLocked !== swiper.isLocked) { 26496 swiper.emit(swiper.isLocked ? 'lock' : 'unlock'); 26497 } 26498} 26499var checkOverflow$1 = { 26500 checkOverflow: checkOverflow 26501}; 26502var defaults = exports.d = { 26503 init: true, 26504 direction: 'horizontal', 26505 oneWayMovement: false, 26506 swiperElementNodeName: 'SWIPER-CONTAINER', 26507 touchEventsTarget: 'wrapper', 26508 initialSlide: 0, 26509 speed: 300, 26510 cssMode: false, 26511 updateOnWindowResize: true, 26512 resizeObserver: true, 26513 nested: false, 26514 createElements: false, 26515 eventsPrefix: 'swiper', 26516 enabled: true, 26517 focusableElements: 'input, select, option, textarea, button, video, label', 26518 // Overrides 26519 width: null, 26520 height: null, 26521 // 26522 preventInteractionOnTransition: false, 26523 // ssr 26524 userAgent: null, 26525 url: null, 26526 // To support iOS's swipe-to-go-back gesture (when being used in-app). 26527 edgeSwipeDetection: false, 26528 edgeSwipeThreshold: 20, 26529 // Autoheight 26530 autoHeight: false, 26531 // Set wrapper width 26532 setWrapperSize: false, 26533 // Virtual Translate 26534 virtualTranslate: false, 26535 // Effects 26536 effect: 'slide', 26537 // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip' 26538 26539 // Breakpoints 26540 breakpoints: undefined, 26541 breakpointsBase: 'window', 26542 // Slides grid 26543 spaceBetween: 0, 26544 slidesPerView: 1, 26545 slidesPerGroup: 1, 26546 slidesPerGroupSkip: 0, 26547 slidesPerGroupAuto: false, 26548 centeredSlides: false, 26549 centeredSlidesBounds: false, 26550 slidesOffsetBefore: 0, 26551 // in px 26552 slidesOffsetAfter: 0, 26553 // in px 26554 normalizeSlideIndex: true, 26555 centerInsufficientSlides: false, 26556 snapToSlideEdge: false, 26557 // Disable swiper and hide navigation when container not overflow 26558 watchOverflow: true, 26559 // Round length 26560 roundLengths: false, 26561 // Touches 26562 touchRatio: 1, 26563 touchAngle: 45, 26564 simulateTouch: true, 26565 shortSwipes: true, 26566 longSwipes: true, 26567 longSwipesRatio: 0.5, 26568 longSwipesMs: 300, 26569 followFinger: true, 26570 allowTouchMove: true, 26571 threshold: 5, 26572 touchMoveStopPropagation: false, 26573 touchStartPreventDefault: true, 26574 touchStartForcePreventDefault: false, 26575 touchReleaseOnEdges: false, 26576 // Unique Navigation Elements 26577 uniqueNavElements: true, 26578 // Resistance 26579 resistance: true, 26580 resistanceRatio: 0.85, 26581 // Progress 26582 watchSlidesProgress: false, 26583 // Cursor 26584 grabCursor: false, 26585 // Clicks 26586 preventClicks: true, 26587 preventClicksPropagation: true, 26588 slideToClickedSlide: false, 26589 // loop 26590 loop: false, 26591 loopAddBlankSlides: true, 26592 loopAdditionalSlides: 0, 26593 loopPreventsSliding: true, 26594 // rewind 26595 rewind: false, 26596 // Swiping/no swiping 26597 allowSlidePrev: true, 26598 allowSlideNext: true, 26599 swipeHandler: null, 26600 // '.swipe-handler', 26601 noSwiping: true, 26602 noSwipingClass: 'swiper-no-swiping', 26603 noSwipingSelector: null, 26604 // Passive Listeners 26605 passiveListeners: true, 26606 maxBackfaceHiddenSlides: 10, 26607 // NS 26608 containerModifierClass: 'swiper-', 26609 // NEW 26610 slideClass: 'swiper-slide', 26611 slideBlankClass: 'swiper-slide-blank', 26612 slideActiveClass: 'swiper-slide-active', 26613 slideVisibleClass: 'swiper-slide-visible', 26614 slideFullyVisibleClass: 'swiper-slide-fully-visible', 26615 slideNextClass: 'swiper-slide-next', 26616 slidePrevClass: 'swiper-slide-prev', 26617 wrapperClass: 'swiper-wrapper', 26618 lazyPreloaderClass: 'swiper-lazy-preloader', 26619 lazyPreloadPrevNext: 0, 26620 // Callbacks 26621 runCallbacksOnInit: true, 26622 // Internals 26623 _emitClasses: false 26624}; 26625function moduleExtendParams(params, allModulesParams) { 26626 return function extendParams() { 26627 var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 26628 var moduleParamName = Object.keys(obj)[0]; 26629 var moduleParams = obj[moduleParamName]; 26630 if (_typeof(moduleParams) !== 'object' || moduleParams === null) { 26631 (0, _utils.x)(allModulesParams, obj); 26632 return; 26633 } 26634 if (params[moduleParamName] === true) { 26635 params[moduleParamName] = { 26636 enabled: true 26637 }; 26638 } 26639 if (moduleParamName === 'navigation' && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].prevEl && !params[moduleParamName].nextEl) { 26640 params[moduleParamName].auto = true; 26641 } 26642 if (['pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].el) { 26643 params[moduleParamName].auto = true; 26644 } 26645 if (!(moduleParamName in params && 'enabled' in moduleParams)) { 26646 (0, _utils.x)(allModulesParams, obj); 26647 return; 26648 } 26649 if (_typeof(params[moduleParamName]) === 'object' && !('enabled' in params[moduleParamName])) { 26650 params[moduleParamName].enabled = true; 26651 } 26652 if (!params[moduleParamName]) params[moduleParamName] = { 26653 enabled: false 26654 }; 26655 (0, _utils.x)(allModulesParams, obj); 26656 }; 26657} 26658 26659/* eslint no-param-reassign: "off" */ 26660var prototypes = { 26661 eventsEmitter: eventsEmitter, 26662 update: update, 26663 translate: translate, 26664 transition: transition, 26665 slide: slide, 26666 loop: loop, 26667 grabCursor: grabCursor, 26668 events: events$1, 26669 breakpoints: breakpoints, 26670 checkOverflow: checkOverflow$1, 26671 classes: classes 26672}; 26673var extendedDefaults = {}; 26674var Swiper = exports.S = /*#__PURE__*/function () { 26675 function Swiper() { 26676 _classCallCheck(this, Swiper); 26677 var el; 26678 var params; 26679 for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { 26680 args[_key3] = arguments[_key3]; 26681 }
26682 if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') { 26683 params = args[0]; 26684 } else { 26685 el = args[0]; 26686 params = args[1]; 26687 } 26688 if (!params) params = {}; 26689 params = (0, _utils.x)({}, params); 26690 if (el && !params.el) params.el = el; 26691 var document = (0, _ssrWindowEsm.g)(); 26692 if (params.el && typeof params.el === 'string' && document.querySelectorAll(params.el).length > 1) { 26693 var swipers = []; 26694 document.querySelectorAll(params.el).forEach(function (containerEl) { 26695 var newParams = (0, _utils.x)({}, params, { 26696 el: containerEl 26697 }); 26698 swipers.push(new Swiper(newParams)); 26699 }); 26700 // eslint-disable-next-line no-constructor-return 26701 return swipers; 26702 } 26703 26704 // Swiper Instance 26705 var swiper = this; 26706 swiper.__swiper__ = true; 26707 swiper.support = getSupport(); 26708 swiper.device = getDevice({ 26709 userAgent: params.userAgent 26710 }); 26711 swiper.browser = getBrowser(); 26712 swiper.eventsListeners = {}; 26713 swiper.eventsAnyListeners = []; 26714 swiper.modules = _toConsumableArray(swiper.__modules__); 26715 if (params.modules && Array.isArray(params.modules)) { 26716 params.modules.forEach(function (mod) { 26717 if (typeof mod === 'function' && swiper.modules.indexOf(mod) < 0) { 26718 swiper.modules.push(mod); 26719 } 26720 }); 26721 } 26722 var allModulesParams = {}; 26723 swiper.modules.forEach(function (mod) { 26724 mod({ 26725 params: params, 26726 swiper: swiper, 26727 extendParams: moduleExtendParams(params, allModulesParams), 26728 on: swiper.on.bind(swiper), 26729 once: swiper.once.bind(swiper), 26730 off: swiper.off.bind(swiper), 26731 emit: swiper.emit.bind(swiper) 26732 }); 26733 }); 26734 26735 // Extend defaults with modules params 26736 var swiperParams = (0, _utils.x)({}, defaults, allModulesParams); 26737 26738 // Extend defaults with passed params 26739 swiper.params = (0, _utils.x)({}, swiperParams, extendedDefaults, params); 26740 swiper.originalParams = (0, _utils.x)({}, swiper.params); 26741 swiper.passedParams = (0, _utils.x)({}, params); 26742 26743 // add event listeners 26744 if (swiper.params && swiper.params.on) {
26745 Object.keys(swiper.params.on).forEach(function (eventName) { 26746 swiper.on(eventName, swiper.params.on[eventName]); 26747 }); 26748 } 26749 if (swiper.params && swiper.params.onAny) { 26750 swiper.onAny(swiper.params.onAny); 26751 } 26752 26753 // Extend Swiper 26754 _extends(swiper, { 26755 enabled: swiper.params.enabled, 26756 el: el, 26757 // Classes 26758 classNames: [], 26759 // Slides 26760 slides: [], 26761 slidesGrid: [], 26762 snapGrid: [], 26763 slidesSizesGrid: [], 26764 // isDirection 26765 isHorizontal: function isHorizontal() { 26766 return swiper.params.direction === 'horizontal'; 26767 }, 26768 isVertical: function isVertical() { 26769 return swiper.params.direction === 'vertical'; 26770 }, 26771 // Indexes 26772 activeIndex: 0, 26773 realIndex: 0, 26774 // 26775 isBeginning: true, 26776 isEnd: false, 26777 // Props 26778 translate: 0, 26779 previousTranslate: 0, 26780 progress: 0, 26781 velocity: 0, 26782 animating: false, 26783 cssOverflowAdjustment: function cssOverflowAdjustment() { 26784 // Returns 0 unless `translate` is > 2**23 26785 // Should be subtracted from css values to prevent overflow 26786 return Math.trunc(this.translate / Math.pow(2, 23)) * Math.pow(2, 23); 26787 }, 26788 // Locks 26789 allowSlideNext: swiper.params.allowSlideNext, 26790 allowSlidePrev: swiper.params.allowSlidePrev, 26791 // Touch Events 26792 touchEventsData: { 26793 isTouched: undefined, 26794 isMoved: undefined, 26795 allowTouchCallbacks: undefined, 26796 touchStartTime: undefined, 26797 isScrolling: undefined, 26798 currentTranslate: undefined, 26799 startTranslate: undefined, 26800 allowThresholdMove: undefined, 26801 // Form elements to match 26802 focusableElements: swiper.params.focusableElements, 26803 // Last click time 26804 lastClickTime: 0, 26805 clickTimeout: undefined, 26806 // Velocities 26807 velocities: [], 26808 allowMomentumBounce: undefined, 26809 startMoving: undefined, 26810 pointerId: null, 26811 touchId: null 26812 }, 26813 // Clicks 26814 allowClick: true, 26815 // Touches 26816 allowTouchMove: swiper.params.allowTouchMove, 26817 touches: { 26818 startX: 0, 26819 startY: 0, 26820 currentX: 0, 26821 currentY: 0, 26822 diff: 0 26823 }, 26824 // Images 26825 imagesToLoad: [], 26826 imagesLoaded: 0 26827 }); 26828 swiper.emit('_swiper'); 26829 26830 // Init 26831 if (swiper.params.init) { 26832 swiper.init(); 26833 } 26834 26835 // Return app instance 26836 // eslint-disable-next-line no-constructor-return 26837 return swiper; 26838 } 26839 return _createClass(Swiper, [{ 26840 key: "getDirectionLabel", 26841 value: function getDirectionLabel(property) { 26842 if (this.isHorizontal()) { 26843 return property; 26844 } 26845 // prettier-ignore 26846 return { 26847 'width': 'height', 26848 'margin-top': 'margin-left', 26849 'margin-bottom ': 'margin-right', 26850 'margin-left': 'margin-top', 26851 'margin-right': 'margin-bottom', 26852 'padding-left': 'padding-top', 26853 'padding-right': 'padding-bottom', 26854 'marginRight': 'marginBottom' 26855 }[property]; 26856 } 26857 }, { 26858 key: "getSlideIndex", 26859 value: function getSlideIndex(slideEl) { 26860 var slidesEl = this.slidesEl, 26861 params = this.params; 26862 var slides = (0, _utils.e)(slidesEl, ".".concat(params.slideClass, ", swiper-slide")); 26863 var firstSlideIndex = (0, _utils.j)(slides[0]); 26864 return (0, _utils.j)(slideEl) - firstSlideIndex; 26865 } 26866 }, { 26867 key: "getSlideIndexByData", 26868 value: function getSlideIndexByData(index) { 26869 return this.getSlideIndex(this.slides.find(function (slideEl) { 26870 return slideEl.getAttribute('data-swiper-slide-index') * 1 === index; 26871 })); 26872 } 26873 }, { 26874 key: "getSlideIndexWhenGrid", 26875 value: function getSlideIndexWhenGrid(index) { 26876 if (this.grid && this.params.grid && this.params.grid.rows > 1) { 26877 if (this.params.grid.fill === 'column') { 26878 index = Math.floor(index / this.params.grid.rows); 26879 } else if (this.params.grid.fill === 'row') {
26880 index = index % Math.ceil(this.slides.length / this.params.grid.rows); 26881 } 26882 } 26883 return index; 26884 } 26885 }, { 26886 key: "recalcSlides", 26887 value: function recalcSlides() { 26888 var swiper = this; 26889 var slidesEl = swiper.slidesEl, 26890 params = swiper.params; 26891 swiper.slides = (0, _utils.e)(slidesEl, ".".concat(params.slideClass, ", swiper-slide")); 26892 } 26893 }, { 26894 key: "enable", 26895 value: function enable() { 26896 var swiper = this; 26897 if (swiper.enabled) return; 26898 swiper.enabled = true; 26899 if (swiper.params.grabCursor) { 26900 swiper.setGrabCursor(); 26901 } 26902 swiper.emit('enable'); 26903 } 26904 }, { 26905 key: "disable", 26906 value: function disable() { 26907 var swiper = this; 26908 if (!swiper.enabled) return; 26909 swiper.enabled = false; 26910 if (swiper.params.grabCursor) { 26911 swiper.unsetGrabCursor(); 26912 } 26913 swiper.emit('disable'); 26914 } 26915 }, { 26916 key: "setProgress", 26917 value: function setProgress(progress, speed) { 26918 var swiper = this; 26919 progress = Math.min(Math.max(progress, 0), 1); 26920 var min = swiper.minTranslate(); 26921 var max = swiper.maxTranslate(); 26922 var current = (max - min) * progress + min; 26923 swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed); 26924 swiper.updateActiveIndex(); 26925 swiper.updateSlidesClasses(); 26926 } 26927 }, { 26928 key: "emitContainerClasses", 26929 value: function emitContainerClasses() { 26930 var swiper = this; 26931 if (!swiper.params._emitClasses || !swiper.el) return; 26932 var cls = swiper.el.className.split(' ').filter(function (className) { 26933 return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0; 26934 }); 26935 swiper.emit('_containerClasses', cls.join(' ')); 26936 } 26937 }, { 26938 key: "getSlideClasses", 26939 value: function getSlideClasses(slideEl) { 26940 var swiper = this; 26941 if (swiper.destroyed) return ''; 26942 return slideEl.className.split(' ').filter(function (className) { 26943 return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0; 26944 }).join(' '); 26945 } 26946 }, { 26947 key: "emitSlidesClasses", 26948 value: function emitSlidesClasses() { 26949 var swiper = this; 26950 if (!swiper.params._emitClasses || !swiper.el) return; 26951 var updates = []; 26952 swiper.slides.forEach(function (slideEl) { 26953 var classNames = swiper.getSlideClasses(slideEl); 26954 updates.push({ 26955 slideEl: slideEl, 26956 classNames: classNames 26957 }); 26958 swiper.emit('_slideClass', slideEl, classNames); 26959 }); 26960 swiper.emit('_slideClasses', updates); 26961 } 26962 }, { 26963 key: "slidesPerViewDynamic", 26964 value: function slidesPerViewDynamic() { 26965 var view = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'current'; 26966 var exact = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 26967 var swiper = this; 26968 var params = swiper.params, 26969 slides = swiper.slides, 26970 slidesGrid = swiper.slidesGrid, 26971 slidesSizesGrid = swiper.slidesSizesGrid, 26972 swiperSize = swiper.size, 26973 activeIndex = swiper.activeIndex; 26974 var spv = 1; 26975 if (typeof params.slidesPerView === 'number') return params.slidesPerView; 26976 if (params.centeredSlides) { 26977 var slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize) : 0; 26978 var breakLoop; 26979 for (var i = activeIndex + 1; i < slides.length; i += 1) { 26980 if (slides[i] && !breakLoop) { 26981 slideSize += Math.ceil(slides[i].swiperSlideSize); 26982 spv += 1; 26983 if (slideSize > swiperSize) breakLoop = true; 26984 } 26985 } 26986 for (var _i8 = activeIndex - 1; _i8 >= 0; _i8 -= 1) { 26987 if (slides[_i8] && !breakLoop) { 26988 slideSize += slides[_i8].swiperSlideSize; 26989 spv += 1; 26990 if (slideSize > swiperSize) breakLoop = true; 26991 } 26992 } 26993 } else { 26994 // eslint-disable-next-line 26995 if (view === 'current') { 26996 for (var _i9 = activeIndex + 1; _i9 < slides.length; _i9 += 1) { 26997 var slideInView = exact ? slidesGrid[_i9] + slidesSizesGrid[_i9] - slidesGrid[activeIndex] < swiperSize : slidesGrid[_i9] - slidesGrid[activeIndex] < swiperSize; 26998 if (slideInView) { 26999 spv += 1; 27000 } 27001 } 27002 } else { 27003 // previous 27004 for (var _i0 = activeIndex - 1; _i0 >= 0; _i0 -= 1) { 27005 var _slideInView = slidesGrid[activeIndex] - slidesGrid[_i0] < swiperSize; 27006 if (_slideInView) { 27007 spv += 1; 27008 } 27009 } 27010 } 27011 } 27012 return spv; 27013 } 27014 }, { 27015 key: "update",
27016 value: function update() { 27017 var swiper = this; 27018 if (!swiper || swiper.destroyed) return; 27019 var snapGrid = swiper.snapGrid, 27020 params = swiper.params; 27021 // Breakpoints 27022 if (params.breakpoints) { 27023 swiper.setBreakpoint(); 27024 } 27025 _toConsumableArray(swiper.el.querySelectorAll('[loading="lazy"]')).forEach(function (imageEl) { 27026 if (imageEl.complete) { 27027 processLazyPreloader(swiper, imageEl); 27028 } 27029 }); 27030 swiper.updateSize(); 27031 swiper.updateSlides(); 27032 swiper.updateProgress(); 27033 swiper.updateSlidesClasses(); 27034 function setTranslate() { 27035 var translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate; 27036 var newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate()); 27037 swiper.setTranslate(newTranslate); 27038 swiper.updateActiveIndex(); 27039 swiper.updateSlidesClasses(); 27040 } 27041 var translated; 27042 if (params.freeMode && params.freeMode.enabled && !params.cssMode) { 27043 setTranslate(); 27044 if (params.autoHeight) { 27045 swiper.updateAutoHeight(); 27046 } 27047 } else { 27048 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !params.centeredSlides) { 27049 var slides = swiper.virtual && params.virtual.enabled ? swiper.virtual.slides : swiper.slides; 27050 translated = swiper.slideTo(slides.length - 1, 0, false, true); 27051 } else { 27052 translated = swiper.slideTo(swiper.activeIndex, 0, false, true); 27053 } 27054 if (!translated) { 27055 setTranslate(); 27056 } 27057 } 27058 if (params.watchOverflow && snapGrid !== swiper.snapGrid) { 27059 swiper.checkOverflow(); 27060 } 27061 swiper.emit('update'); 27062 } 27063 }, { 27064 key: "changeDirection", 27065 value: function changeDirection(newDirection) { 27066 var needUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 27067 var swiper = this; 27068 var currentDirection = swiper.params.direction; 27069 if (!newDirection) { 27070 // eslint-disable-next-line 27071 newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal'; 27072 } 27073 if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') { 27074 return swiper; 27075 } 27076 swiper.el.classList.remove("".concat(swiper.params.containerModifierClass).concat(currentDirection)); 27077 swiper.el.classList.add("".concat(swiper.params.containerModifierClass).concat(newDirection)); 27078 swiper.emitContainerClasses(); 27079 swiper.params.direction = newDirection; 27080 swiper.slides.forEach(function (slideEl) { 27081 if (newDirection === 'vertical') { 27082 slideEl.style.width = ''; 27083 } else { 27084 slideEl.style.height = ''; 27085 } 27086 }); 27087 swiper.emit('changeDirection'); 27088 if (needUpdate) swiper.update(); 27089 return swiper; 27090 } 27091 }, { 27092 key: "changeLanguageDirection", 27093 value: function changeLanguageDirection(direction) { 27094 var swiper = this; 27095 if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return; 27096 swiper.rtl = direction === 'rtl'; 27097 swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl; 27098 if (swiper.rtl) { 27099 swiper.el.classList.add("".concat(swiper.params.containerModifierClass, "rtl")); 27100 swiper.el.dir = 'rtl'; 27101 } else { 27102 swiper.el.classList.remove("".concat(swiper.params.containerModifierClass, "rtl")); 27103 swiper.el.dir = 'ltr'; 27104 } 27105 swiper.update(); 27106 } 27107 }, { 27108 key: "mount", 27109 value: function mount(element) { 27110 var swiper = this; 27111 if (swiper.mounted) return true; 27112 27113 // Find el 27114 var el = element || swiper.params.el; 27115 if (typeof el === 'string') { 27116 el = document.querySelector(el); 27117 } 27118 if (!el) { 27119 return false; 27120 } 27121 el.swiper = swiper; 27122 if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) { 27123 swiper.isElement = true; 27124 } 27125 var getWrapperSelector = function getWrapperSelector() { 27126 return ".".concat((swiper.params.wrapperClass || '').trim().split(' ').join('.')); 27127 }; 27128 var getWrapper = function getWrapper() { 27129 if (el && el.shadowRoot && el.shadowRoot.querySelector) { 27130 var res = el.shadowRoot.querySelector(getWrapperSelector()); 27131 // Children needs to return slot items 27132 return res; 27133 } 27134 return (0, _utils.e)(el, getWrapperSelector())[0]; 27135 }; 27136 // Find Wrapper 27137 var wrapperEl = getWrapper(); 27138 if (!wrapperEl && swiper.params.createElements) { 27139 wrapperEl = (0, _utils.c)('div', swiper.params.wrapperClass); 27140 el.append(wrapperEl); 27141 (0, _utils.e)(el, ".".concat(swiper.params.slideClass)).forEac
27141h(function (slideEl) { 27142 wrapperEl.append(slideEl); 27143 }); 27144 } 27145 _extends(swiper, { 27146 el: el, 27147 wrapperEl: wrapperEl, 27148 slidesEl: swiper.isElement && !el.parentNode.host.slideSlots ? el.parentNode.host : wrapperEl, 27149 hostEl: swiper.isElement ? el.parentNode.host : el, 27150 mounted: true, 27151 // RTL 27152 rtl: el.dir.toLowerCase() === 'rtl' || (0, _utils.q)(el, 'direction') === 'rtl', 27153 rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || (0, _utils.q)(el, 'direction') === 'rtl'), 27154 wrongRTL: (0, _utils.q)(wrapperEl, 'display') === '-webkit-box' 27155 }); 27156 return true; 27157 } 27158 }, { 27159 key: "init", 27160 value: function init(el) { 27161 var swiper = this; 27162 if (swiper.initialized) return swiper; 27163 var mounted = swiper.mount(el); 27164 if (mounted === false) return swiper; 27165 swiper.emit('beforeInit'); 27166 27167 // Set breakpoint 27168 if (swiper.params.breakpoints) { 27169 swiper.setBreakpoint(); 27170 } 27171 27172 // Add Classes 27173 swiper.addClasses(); 27174 27175 // Update size 27176 swiper.updateSize(); 27177 27178 // Update slides 27179 swiper.updateSlides(); 27180 if (swiper.params.watchOverflow) { 27181 swiper.checkOverflow(); 27182 } 27183 27184 // Set Grab Cursor 27185 if (swiper.params.grabCursor && swiper.enabled) { 27186 swiper.setGrabCursor(); 27187 } 27188 27189 // Slide To Initial Slide 27190 if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) { 27191 swiper.slideTo(swiper.params.initialSlide + swiper.virtual.slidesBefore, 0, swiper.params.runCallbacksOnInit, false, true); 27192 } else { 27193 swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true); 27194 } 27195 27196 // Create loop 27197 if (swiper.params.loop) { 27198 swiper.loopCreate(undefined, true); 27199 } 27200 27201 // Attach events 27202 swiper.attachEvents(); 27203 var lazyElements = _toConsumableArray(swiper.el.querySelectorAll('[loading="lazy"]')); 27204 if (swiper.isElement) { 27205 lazyElements.push.apply(lazyElements, _toConsumableArray(swiper.hostEl.querySelectorAll('[loading="lazy"]'))); 27206 } 27207 lazyElements.forEach(function (imageEl) { 27208 if (imageEl.complete) { 27209 processLazyPreloader(swiper, imageEl); 27210 } else { 27211 imageEl.addEventListener('load', function (e) { 27212 processLazyPreloader(swiper, e.target); 27213 }); 27214 } 27215 }); 27216 preload(swiper); 27217 27218 // Init Flag 27219 swiper.initialized = true; 27220 preload(swiper); 27221 27222 // Emit 27223 swiper.emit('init'); 27224 swiper.emit('afterInit'); 27225 return swiper; 27226 } 27227 }, { 27228 key: "destroy", 27229 value: function destroy() { 27230 var deleteInstance = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; 27231 var cleanStyles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 27232 var swiper = this; 27233 var params = swiper.params, 27234 el = swiper.el, 27235 wrapperEl = swiper.wrapperEl, 27236 slides = swiper.slides; 27237 if (typeof swiper.params === 'undefined' || swiper.destroyed) { 27238 return null; 27239 } 27240 swiper.emit('beforeDestroy'); 27241 27242 // Init Flag 27243 swiper.initialized = false; 27244 27245 // Detach events 27246 swiper.detachEvents(); 27247 27248 // Destroy loop 27249 if (params.loop) { 27250 swiper.loopDestroy(); 27251 } 27252 27253 // Cleanup styles 27254 if (cleanStyles) { 27255 swiper.removeClasses(); 27256 if (el && typeof el !== 'string') { 27257 el.removeAttribute('style'); 27258 } 27259 if (wrapperEl) { 27260 wrapperEl.removeAttribute('style'); 27261 } 27262 if (slides && slides.length) { 27263 slides.forEach(function (slideEl) { 27264 slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass); 27265 slideEl.removeAttribute('style'); 27266 slideEl.removeAttribute('data-swiper-slide-index'); 27267 }); 27268 } 27269 } 27270 swiper.emit('destroy'); 27271 27272 // Detach emitter events
27273 Object.keys(swiper.eventsListeners).forEach(function (eventName) { 27274 swiper.off(eventName); 27275 }); 27276 if (deleteInstance !== false) { 27277 if (swiper.el && typeof swiper.el !== 'string') { 27278 swiper.el.swiper = null; 27279 } 27280 (0, _utils.y)(swiper); 27281 } 27282 swiper.destroyed = true; 27283 return null; 27284 } 27285 }], [{ 27286 key: "extendDefaults", 27287 value: function extendDefaults(newDefaults) { 27288 (0, _utils.x)(extendedDefaults, newDefaults); 27289 } 27290 }, { 27291 key: "extendedDefaults", 27292 get: function get() { 27293 return extendedDefaults; 27294 } 27295 }, { 27296 key: "defaults", 27297 get: function get() { 27298 return defaults; 27299 } 27300 }, { 27301 key: "installModule", 27302 value: function installModule(mod) { 27303 if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = []; 27304 var modules = Swiper.prototype.__modules__; 27305 if (typeof mod === 'function' && modules.indexOf(mod) < 0) { 27306 modules.push(mod); 27307 } 27308 } 27309 }, { 27310 key: "use", 27311 value: function use(module) { 27312 if (Array.isArray(module)) { 27313 module.forEach(function (m) { 27314 return Swiper.installModule(m); 27315 }); 27316 return Swiper; 27317 } 27318 Swiper.installModule(module); 27319 return Swiper; 27320 } 27321 }]); 27322}(); 27323Object.keys(prototypes).forEach(function (prototypeGroup) { 27324 Object.keys(prototypes[prototypeGroup]).forEach(function (protoMethod) { 27325 Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod]; 27326 }); 27327}); 27328Swiper.use([Resize, Observer]); 27329 27330},{"./ssr-window.esm.mjs":67,"./utils.mjs":69}],69:[function(require,module,exports){ 27331"use strict"; 27332 27333Object.defineProperty(exports, "__esModule", { 27334 value: true 27335}); 27336exports.a = getRotateFix; 27337exports.b = setCSSProperty; 27338exports.c = createElement; 27339exports.d = elementParents; 27340exports.e = elementChildren; 27341exports.f = elementOffset; 27342exports.g = getSlideTransformEl; 27343exports.h = now; 27344exports.i = elementOuterSize; 27345exports.j = elementIndex; 27346exports.k = classesToTokens; 27347exports.l = getTranslate; 27348exports.m = makeElementsArray; 27349exports.n = nextTick; 27350exports.o = elementTransitionEnd; 27351exports.p = isObject; 27352exports.q = elementStyle; 27353exports.r = elementNextAll; 27354exports.s = setInnerHTML; 27355exports.t = elementPrevAll; 27356exports.u = animateCSSModeScroll; 27357exports.v = showWarning; 27358exports.w = elementIsChildOf; 27359exports.x = extend; 27360exports.y = deleteProps; 27361var _ssrWindowEsm = require("./ssr-window.esm.mjs"); 27362function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } 27363function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 27364function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 27365function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } 27366function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } 27367function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 27368function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } 27369function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 27370function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 27371function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 27372function classesToTokens() { 27373 var classes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; 27374 return classes.trim().split(' ').filter(function (c) { 27375 return !!c.trim(); 27376 }); 27377} 27378function deleteProps(obj) { 27379 var object = obj; 27380 Object.keys(object).forEach(function (key) { 27381 try { 27382 object[key] = null; 27383 } catch (e) { 27384 // no getter for object 27385 } 27386 try { 27387 delete object[key]; 27388 } catch (e) { 27389 // something got wrong 27390 } 27391 }); 27392} 27393function nextTick(callback) {
27394 var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; 27395 return setTimeout(callback, delay); 27396} 27397function now() { 27398 return Date.now(); 27399} 27400function getComputedStyle(el) { 27401 var window = (0, _ssrWindowEsm.a)(); 27402 var style; 27403 if (window.getComputedStyle) { 27404 style = window.getComputedStyle(el, null); 27405 } 27406 if (!style && el.currentStyle) { 27407 style = el.currentStyle; 27408 } 27409 if (!style) { 27410 style = el.style; 27411 } 27412 return style; 27413} 27414function getTranslate(el) { 27415 var axis = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'x'; 27416 var window = (0, _ssrWindowEsm.a)(); 27417 var matrix; 27418 var curTransform; 27419 var transformMatrix; 27420 var curStyle = getComputedStyle(el); 27421 if (window.WebKitCSSMatrix) { 27422 curTransform = curStyle.transform || curStyle.webkitTransform; 27423 if (curTransform.split(',').length > 6) { 27424 curTransform = curTransform.split(', ').map(function (a) { 27425 return a.replace(',', '.'); 27426 }).join(', '); 27427 } 27428 // Some old versions of Webkit choke when 'none' is passed; pass 27429 // empty string instead in this case 27430 transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); 27431 } else { 27432 transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); 27433 matrix = transformMatrix.toString().split(','); 27434 } 27435 if (axis === 'x') { 27436 // Latest Chrome and webkits Fix 27437 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; 27438 // Crazy IE10 Matrix 27439 else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); 27440 // Normal Browsers 27441 else curTransform = parseFloat(matrix[4]); 27442 } 27443 if (axis === 'y') { 27444 // Latest Chrome and webkits Fix 27445 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; 27446 // Crazy IE10 Matrix 27447 else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); 27448 // Normal Browsers 27449 else curTransform = parseFloat(matrix[5]); 27450 } 27451 return curTransform || 0; 27452} 27453function isObject(o) { 27454 return _typeof(o) === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object'; 27455} 27456function isNode(node) { 27457 // eslint-disable-next-line 27458 if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') { 27459 return node instanceof HTMLElement; 27460 } 27461 return node && (node.nodeType === 1 || node.nodeType === 11); 27462} 27463function extend() { 27464 var to = Object(arguments.length <= 0 ? undefined : arguments[0]); 27465 for (var i = 1; i < arguments.length; i += 1) { 27466 var nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i]; 27467 if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) { 27468 var keysArray = Object.keys(Object(nextSource)).filter(function (key) { 27469 return key !== '__proto__' && key !== 'constructor' && key !== 'prototype'; 27470 }); 27471 for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) { 27472 var nextKey = keysArray[nextIndex]; 27473 var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); 27474 if (desc !== undefined && desc.enumerable) { 27475 if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) { 27476 if (nextSource[nextKey].__swiper__) { 27477 to[nextKey] = nextSource[nextKey]; 27478 } else { 27479 extend(to[nextKey], nextSource[nextKey]); 27480 } 27481 } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) { 27482 to[nextKey] = {}; 27483 if (nextSource[nextKey].__swiper__) { 27484 to[nextKey] = nextSource[nextKey]; 27485 } else { 27486 extend(to[nextKey], nextSource[nextKey]); 27487 } 27488 } else { 27489 to[nextKey] = nextSource[nextKey]; 27490 } 27491 } 27492 } 27493 } 27494 } 27495 return to; 27496} 27497function setCSSProperty(el, varName, varValue) { 27498 el.style.setProperty(varName, varValue); 27499} 27500function animateCSSModeScroll(_ref) { 27501 var swiper = _ref.swiper, 27502 targetPosition = _ref.targetPosition, 27503 side = _ref.side; 27504 var window = (0, _ssrWindowEsm.a)(); 27505 var startPosition = -swiper.translate; 27506 var startTime = null; 27507 var time; 27508 var duration = swiper.params.speed; 27509 swiper.wrapperEl.style.scrollSnapType = 'none'; 27510 window.cancelAnimationFrame(swiper.cssModeFrameID); 27511 var dir = targetPosition > startPosition ? 'next' : 'prev'; 27512 var isOutOfBound = function isOutOfBound(current, target) { 27513 return dir === 'next' && current >= target || dir === 'prev' && current <= target; 27514 }; 27515 var _animate = function animate() { 27516 time = new Date().getTime(); 27517 if (startTime === null) { 27518 startTime = time; 27519 } 27520 var progress = Math.max(Math.min((time - startTime) / duration, 1), 0); 27521 var easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2; 27522 var currentPosition = startPosition + easeProgress * (targetPosition - startPosition); 27523 if (isOutOfBound(currentPosition, targetPosition)) { 27524 currentPosition = targetPosition; 27525 } 27526 swiper.wrapperEl.scrollTo(_defineProperty({}, side, currentPosition)); 27527 if (isOutOfBound(currentPosition, targetPosition)) { 27528 swiper.wrapperEl.style.overflow = 'hidden'; 27529 swiper.wrapperEl.style.scrollSnapType = ''; 27530 setTimeout(function () { 27531 swiper.wrapperEl.style.overflow = ''; 27532 swiper.wrapperEl.scrollTo(_defineProperty({}, side, currentPosition)); 27533 }); 27534 window.cancelAnimationFrame(swiper.cssModeFrameID); 27535 return; 27536 } 27537 swiper.cssModeFrameID = window.requestAnimationFrame(_animate); 27538 }; 27539 _animate(); 27540} 27541function getSlideTransformEl(slideEl) { 27542 return slideEl.querySelector('.swiper-slide-transform') || slideEl.shadowRoot && slideEl.shadowRoot.querySelector('.swiper-slide-transform') || slideEl; 27543} 27544function elementChildren(element) { 27545 var selector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; 27546 var window = (0, _ssrWindowEsm.a)(); 27547 var children = _toConsumableArray(element.children); 27548 if (window.HTMLSlotElement && element instanceof HTMLSlotElement) { 27549 children.push.apply(children, _toConsumableArray(element.assignedElements())); 27550 } 27551 if (!selector) { 27552 return children; 27553 } 27554 return children.filter(function (el) { 27555 return el.matches(selector); 27556 }); 27557} 27558function elementIsChildOfSlot(el, slot) { 27559 // Breadth-first search through all parent's children and assigned elements 27560 var elementsQueue = [slot]; 27561 while (elementsQueue.length > 0) { 27562 var elementToCheck = elementsQueue.shift(); 27563 if (el === elementToCheck) { 27564 return true; 27565 } 27566 elementsQueue.push.apply(elementsQueue, _toConsumableArray(elementToCheck.children).concat(_toConsumableArray(elementToCheck.shadowRoot ? elementToCheck.shadowRoot.children : []), _toConsumableArray(elementToCheck.assignedElements ? elementToCheck.assignedElements() : []))); 27567 } 27568} 27569function elementIsChildOf(el, parent) { 27570 var window = (0, _ssrWindowEsm.a)(); 27571 var isChild = parent.contains(el); 27572 if (!isChild && window.HTMLSlotElement && parent instanceof HTMLSlotElement) { 27573 var children = _toConsumableArray(parent.assignedElements()); 27574 isChild = children.includes(el); 27575 if (!isChild) { 27576 isChild = elementIsChildOfSlot(el, parent); 27577 } 27578 } 27579 return isChild; 27580} 27581function showWarning(text) { 27582 try { 27583 console.warn(text); 27584 return; 27585 } catch (err) { 27586 // err 27587 } 27588} 27589function createElement(tag) { 27590 var _el$classList; 27591 var classes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; 27592 var el = document.createElement(tag); 27593 (_el$classList = el.classList).add.apply(_el$classList, _toConsumableArray(Array.isArray(classe
27593s) ? classes : classesToTokens(classes))); 27594 return el; 27595} 27596function elementOffset(el) { 27597 var window = (0, _ssrWindowEsm.a)(); 27598 var document = (0, _ssrWindowEsm.g)(); 27599 var box = el.getBoundingClientRect(); 27600 var body = document.body; 27601 var clientTop = el.clientTop || body.clientTop || 0; 27602 var clientLeft = el.clientLeft || body.clientLeft || 0; 27603 var scrollTop = el === window ? window.scrollY : el.scrollTop; 27604 var scrollLeft = el === window ? window.scrollX : el.scrollLeft; 27605 return { 27606 top: box.top + scrollTop - clientTop, 27607 left: box.left + scrollLeft - clientLeft 27608 }; 27609} 27610function elementPrevAll(el, selector) { 27611 var prevEls = []; 27612 while (el.previousElementSibling) { 27613 var prev = el.previousElementSibling; // eslint-disable-line 27614 if (selector) { 27615 if (prev.matches(selector)) prevEls.push(prev); 27616 } else prevEls.push(prev); 27617 el = prev; 27618 } 27619 return prevEls; 27620} 27621function elementNextAll(el, selector) { 27622 var nextEls = []; 27623 while (el.nextElementSibling) { 27624 var next = el.nextElementSibling; // eslint-disable-line 27625 if (selector) { 27626 if (next.matches(selector)) nextEls.push(next); 27627 } else nextEls.push(next); 27628 el = next; 27629 } 27630 return nextEls; 27631} 27632function elementStyle(el, prop) { 27633 var window = (0, _ssrWindowEsm.a)(); 27634 return window.getComputedStyle(el, null).getPropertyValue(prop); 27635} 27636function elementIndex(el) { 27637 var child = el; 27638 var i; 27639 if (child) { 27640 i = 0; 27641 // eslint-disable-next-line 27642 while ((child = child.previousSibling) !== null) { 27643 if (child.nodeType === 1) i += 1; 27644 } 27645 return i; 27646 } 27647 return undefined; 27648} 27649function elementParents(el, selector) { 27650 var parents = []; // eslint-disable-line 27651 var parent = el.parentElement; // eslint-disable-line 27652 while (parent) { 27653 if (selector) { 27654 if (parent.matches(selector)) parents.push(parent); 27655 } else { 27656 parents.push(parent); 27657 } 27658 parent = parent.parentElement; 27659 } 27660 return parents; 27661} 27662function elementTransitionEnd(el, callback) { 27663 function fireCallBack(e) { 27664 if (e.target !== el) return; 27665 callback.call(el, e); 27666 el.removeEventListener('transitionend', fireCallBack); 27667 } 27668 if (callback) { 27669 el.addEventListener('transitionend', fireCallBack); 27670 } 27671} 27672function elementOuterSize(el, size, includeMargins) { 27673 var window = (0, _ssrWindowEsm.a)(); 27674 if (includeMargins) { 27675 return el[size === 'width' ? 'offsetWidth' : 'offsetHeight'] + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-right' : 'margin-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-left' : 'margin-bottom')); 27676 } 27677 return el.offsetWidth; 27678} 27679function makeElementsArray(el) { 27680 return (Array.isArray(el) ? el : [el]).filter(function (e) { 27681 return !!e; 27682 }); 27683} 27684function getRotateFix(swiper) { 27685 return function (v) { 27686 if (Math.abs(v) > 0 && swiper.browser && swiper.browser.need3dFix && Math.abs(v) % 90 === 0) { 27687 return v + 0.001; 27688 } 27689 return v; 27690 }; 27691} 27692function setInnerHTML(el) { 27693 var html = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; 27694 if (typeof trustedTypes !== 'undefined') { 27695 el.innerHTML = trustedTypes.createPolicy('html', { 27696 createHTML: function createHTML(s) { 27697 return s; 27698 } 27699 }).createHTML(html); 27700 } else { 27701 el.innerHTML = html; 27702 } 27703} 27704 27705},{"./ssr-window.esm.mjs":67}],70:[function(require,module,exports){ 27706"use strict"; 27707 27708Object.defineProperty(exports, "__esModule", { 27709 value: true 27710}); 27711Object.defineProperty(exports, "Swiper", { 27712 enumerable: true, 27713 get: function get() { 27714 return _swiperCore.S; 27715 } 27716}); 27717Object.defineProperty(exports, "default", { 27718 enumerable: true, 27719 get: function get() { 27720 return _swiperCore.S; 27721 } 27722}); 27723var _swiperCore = require("./shared/swiper-core.mjs"); 27724 27725},{"./shared/swiper-core.mjs":68}],71:[function(require,module,exports){ 27726/*! 27727* tabbable 6.5.0 27728* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE 27729*/ 27730'use strict'; 27731 27732// NOTE: separate `:not()` selectors has broader browser support than the newer 27733// `:not([inert], [inert] *)` (Feb 2023) 27734var candidateSelectors = ['input:not([inert]):not([inert] *)', 'select:not([inert]):not([inert] *)', 'textarea:not([inert]):not([inert] *)', 'a[href]:not([inert]):not([inert] *)', 'are
vendor: 16,413 bytes, lines 27734-28065
27734a[href]:not([inert]):not([inert] *)', 'button:not([inert]):not([inert] *)', '[tabindex]:not(slot):not([inert]):not([inert] *)', 'audio[controls]:not([inert]):not([inert] *)', 'video[controls]:not([inert]):not([inert] *)', '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', 'details>summary:first-of-type:not([inert]):not([inert] *)', 'details:not([inert]):not([inert] *)']; 27735var candidateSelector = /* #__PURE__ */candidateSelectors.join(','); 27736var NoElement = typeof Element === 'undefined'; 27737var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 27738var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) { 27739 var _element$getRootNode; 27740 return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element); 27741} : function (element) { 27742 return element === null || element === void 0 ? void 0 : element.ownerDocument; 27743}; 27744 27745/** 27746 * Determines if a node is inert or in an inert ancestor. 27747 * @param {Node} [node] 27748 * @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to 27749 * see if any of them are inert. If false, only `node` itself is considered. 27750 * @returns {boolean} True if inert itself or by way of being in an inert ancestor. 27751 * False if `node` is falsy. 27752 */ 27753var _isInert = function isInert(node, lookUp) { 27754 var _node$getAttribute; 27755 if (lookUp === void 0) { 27756 lookUp = true; 27757 } 27758 // CAREFUL: JSDom does not support inert at all, so we can't use the `HTMLElement.inert` 27759 // JS API property; we have to check the attribute, which can either be empty or 'true'; 27760 // if it's `null` (not specified) or 'false', it's an active element 27761 var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, 'inert'); 27762 var inert = inertAtt === '' || inertAtt === 'true'; 27763 27764 // NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')` 27765 // if it weren't for `matches()` not being a function on shadow roots; the following 27766 // code works for any kind of node 27767 var result = inert || lookUp && node && ( 27768 // closest does not exist on shadow roots, so we fall back to a manual 27769 // lookup upward, in case it is not defined. 27770 typeof node.closest === 'function' ? node.closest('[inert]') : _isInert(node.parentNode)); 27771 return result; 27772}; 27773 27774/** 27775 * Determines if a node's content is editable. 27776 * @param {Element} [node] 27777 * @returns True if it's content-editable; false if it's not or `node` is falsy. 27778 */ 27779var isContentEditable = function isContentEditable(node) { 27780 var _node$getAttribute2; 27781 // CAREFUL: JSDom does not support the `HTMLElement.isContentEditable` API so we have 27782 // to use the attribute directly to check for this, which can either be empty or 'true'; 27783 // if it's `null` (not specified) or 'false', it's a non-editable element 27784 var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, 'contenteditable'); 27785 return attValue === '' || attValue === 'true'; 27786}; 27787 27788/** 27789 * @param {Element} el container to check in 27790 * @param {boolean} includeContainer add container to check 27791 * @param {(node: Element) => boolean} filter filter candidates 27792 * @returns {Element[]} 27793 */ 27794var getCandidates = function getCandidates(el, includeContainer, filter) { 27795 // even if `includeContainer=false`, we still have to check it for inertness because 27796 // if it's inert (either by itself or via its parent), then all its children are inert 27797 if (_isInert(el)) { 27798 return []; 27799 } 27800 var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector)); 27801 if (includeContainer && matches.call(el, candidateSelector)) { 27802 candidates.unshift(el); 27803 } 27804 candidates = candidates.filter(filter); 27805 return candidates; 27806}; 27807 27808/** 27809 * @callback GetShadowRoot 27810 * @param {Element} element to check for shadow root 27811 * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available. 27812 */ 27813 27814/** 27815 * @callback ShadowRootFilter 27816 * @param {Element} shadowHostNode the element which contains shadow content 27817 * @returns {boolean} true if a shadow root could potentially contain valid candidates. 27818 */ 27819 27820/** 27821 * @typedef {Object} CandidateScope 27822 * @property {Element} scopeParent contains inner candidates 27823 * @property {Element[]} candidates list of candidates found in the scope parent 27824 */ 27825 27826/** 27827 * @typedef {Object} IterativeOptions 27828 * @property {GetShadowRoot|boolean} getShadowRoot true if shadow support is enabled; falsy if not; 27829 * if a function, implies shadow support is enabled and either returns the shadow root of an element 27830 * or a boolean stating if it has an undisclosed shadow root 27831 * @property {(node: Element) => boolean} filter filter candidates 27832 * @property {boolean} flatten if true then result will flatten any CandidateScope into the returned list 27833 * @property {ShadowRootFilter} shadowRootFilter filter shadow roots; 27834 */ 27835 27836/** 27837 * @param {Element[]} elements list of element containers to match candidates from 27838 * @param {boolean} includeContainer add container list to check 27839 * @param {IterativeOptions} options 27840 * @returns {Array.<Element|CandidateScope>} 27841 */ 27842var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) { 27843 var candidates = []; 27844 var elementsToCheck = Array.from(elements); 27845 while (elementsToCheck.length) { 27846 var element = elementsToCheck.shift(); 27847 if (_isInert(element, false)) { 27848 // no need to look up since we're drilling down 27849 // anything inside this container will also be inert 27850 continue; 27851 } 27852 if (element.tagName === 'SLOT') { 27853 // add shadow dom slot scope (slot itself cannot be focusable) 27854 var assigned = element.assignedElements(); 27855 var content = assigned.length ? assigned : element.children; 27856 var nestedCandidates = _getCandidatesIteratively(content, true, options); 27857 if (options.flatten) { 27858 candidates.push.apply(candidates, nestedCandidates); 27859 } else { 27860 candidates.push({ 27861 scopeParent: element, 27862 candidates: nestedCandidates 27863 }); 27864 } 27865 } else { 27866 // check candidate element 27867 var validCandidate = matches.call(element, candidateSelector); 27868 if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) { 27869 candidates.push(element); 27870 } 27871 27872 // iterate over shadow content if possible 27873 var shadowRoot = element.shadowRoot || 27874 // check for an undisclosed shadow 27875 typeof options.getShadowRoot === 'function' && options.getShadowRoot(element); 27876 27877 // no inert look up because we're already drilling down and checking for inertness 27878 // on the way down, so all containers to this root node should have already been 27879 // vetted as non-inert 27880 var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element)); 27881 if (shadowRoot && validShadowRoot) { 27882 // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed 27883 // shadow exists, so look at light dom children as fallback BUT create a scope for any 27884 // child candidates found because they're likely slotted elements (elements that are 27885 // children of the web component element (which has the shadow), in the light dom, but 27886 // slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below, 27887 // _after_ we return from this recursive call 27888 var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options); 27889 if (options.flatten) { 27890 candidates.push.apply(candidates, _nestedCandidates); 27891 } else { 27892 candidates.push({ 27893 scopeParent: element, 27894 candidates: _nestedCandidates 27895 }); 27896 } 27897 } else { 27898 // there's not shadow so just dig into the element's (light dom) children 27899 // __without__ giving the element special scope treatment 27900 elementsToCheck.unshift.apply(elementsToCheck, element.children); 27901 } 27902 } 27903 } 27904 return candidates; 27905}; 27906 27907/** 27908 * @private 27909 * Determines if the node has an explicitly specified `tabindex` attribute. 27910 * @param {HTMLElement} node 27911 * @returns {boolean} True if so; false if not. 27912 */ 27913var hasTabIndex = function hasTabIndex(node) { 27914 return !isNaN(parseInt(node.getAttribute('tabindex'), 10)); 27915}; 27916 27917/** 27918 * Determine the tab index of a given node. 27919 * @param {HTMLElement} node 27920 * @returns {number} Tab order (negative, 0, or positive number). 27921 * @throws {Error} If `node` is falsy. 27922 */ 27923var getTabIndex = function getTabIndex(node) { 27924 if (!node) { 27925 throw new Error('No node provided'); 27926 } 27927 if (node.tabIndex < 0) { 27928 // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default 27929 // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM, 27930 // yet they are still part of the regular tab order; in FF, they get a default 27931 // `tabIndex` of 0; since Chrome still puts those elements in the regular tab 27932 // order, consider their tab index to be 0. 27933 // Also browsers do not return `tabIndex` correctly for contentEditable nodes; 27934 // so if they don't have a tabindex attribute specifically set, assume it's 0. 27935 if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) { 27936 return 0; 27937 } 27938 } 27939 return node.tabIndex; 27940}; 27941 27942/** 27943 * Determine the tab index of a given node __for sort order purposes__. 27944 * @param {HTMLElement} node 27945 * @param {boolean} [isScope] True for a custom element with shadow root or slot that, by default, 27946 * has tabIndex -1, but needs to be sorted by document order in order for its content to be 27947 * inserted into the correct sort position. 27948 * @returns {number} Tab order (negative, 0, or positive number). 27949 */ 27950var getSortOrderTabIndex = function getSortOrderTabIndex(node, isScope) { 27951 var tabIndex = getTabIndex(node); 27952 if (tabIndex < 0 && isScope && !hasTabIndex(node)) { 27953 return 0; 27954 } 27955 return tabIndex; 27956}; 27957var sortOrderedTabbables = function sortOrderedTabbables(a, b) { 27958 return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex; 27959}; 27960var isInput = function isInput(node) { 27961 return node.tagName === 'INPUT'; 27962}; 27963var isHiddenInput = function isHiddenInput(node) { 27964 return isInput(node) && node.type === 'hidden'; 27965}; 27966var isDetailsWithSummary = function isDetailsWithSummary(node) { 27967 var r = node.tagName === 'DETAILS' && Array.prototype.slice.apply(node.children).some(function (child) { 27968 return child.tagName === 'SUMMARY'; 27969 }); 27970 return r; 27971}; 27972var getCheckedRadio = function getCheckedRadio(nodes, form) { 27973 for (var i = 0; i < nodes.length; i++) { 27974 if (nodes[i].checked && nodes[i].form === form) { 27975 return nodes[i]; 27976 } 27977 } 27978}; 27979var isTabbableRadio = function isTabbableRadio(node) { 27980 if (!node.name) { 27981 return true; 27982 } 27983 var radioScope = node.form || getRootNode(node); 27984 var queryRadios = function queryRadios(name) { 27985 return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]'); 27986 }; 27987 var radioSet; 27988 if (typeof window !== 'undefined' && typeof window.CSS !== 'undefined' && typeof window.CSS.escape === 'function') { 27989 radioSet = queryRadios(window.CSS.escape(node.name)); 27990 } else { 27991 try { 27992 radioSet = queryRadios(node.name); 27993 } catch (err) { 27994 // eslint-disable-next-line no-console 27995 console.error('Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s', err.message); 27996 return false; 27997 } 27998 } 27999 var checked = getCheckedRadio(radioSet, node.form); 28000 return !checked || checked === node; 28001}; 28002var isRadio = function isRadio(node) { 28003 return isInput(node) && node.type === 'radio'; 28004}; 28005var isNonTabbableRadio = function isNonTabbableRadio(node) { 28006 return isRadio(node) && !isTabbableRadio(node); 28007}; 28008 28009// determines if a node is ultimately attached to the window's document 28010var isNodeAttached = function isNodeAttached(node) { 28011 var _nodeRoot; 28012 // The root node is the shadow root if the node is in a shadow DOM; some document otherwise 28013 // (but NOT _the_ document; see second 'If' comment below for more). 28014 // If rootNode is shadow root, it'll have a host, which is the element to which the shadow 28015 // is attached, and the one we need to check if it's in the document or not (because the 28016 // shadow, and all nodes it contains, is never considered in the document since shadows 28017 // behave like self-contained DOMs; but if the shadow's HOST, which is part of the document, 28018 // is hidden, or is not in the document itself but is detached, it will affect the shadow's 28019 // visibility, including all the nodes it contains). The host could be any normal node, 28020 // or a custom element (i.e. web component). Either way, that's the one that is considered 28021 // part of the document, not the shadow root, nor any of its children (i.e. the node being 28022 // tested). 28023 // To further complicate things, we have to look all the way up until we find a shadow HOST 28024 // that is attached (or find none) because the node might be in nested shadows... 28025 // If rootNode is not a shadow root, it won't have a host, and so rootNode should be the 28026 // document (per the docs) and while it's a Document-type object, that document does not 28027 // appear to be the same as the node's `ownerDocument` for some reason, so it's safer 28028 // to ignore the rootNode at this point, and use `node.ownerDocument`. Otherwise, 28029 // using `rootNode.contains(node)` will _always_ be true we'll get false-positives when 28030 // node is actually detached. 28031 // NOTE: If `nodeRootHost` or `node` happens to be the `document` itself (which is possible 28032 // if a tabbable/focusable node was quickly added to the DOM, focused, and then removed 28033 // from the DOM as in https://github.com/focus-trap/focus-trap-react/issues/905), then 28034 // `ownerDocument` will be `null`, hence the optional chaining on it. 28035 var nodeRoot = node && getRootNode(node); 28036 var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host; 28037 28038 // in some cases, a detached node will return itself as the root instead of a document or 28039 // shadow root object, in which case, we shouldn't try to look further up the host chain 28040 var attached = false; 28041 if (nodeRoot && nodeRoot !== node) { 28042 var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument; 28043 attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node)); 28044 while (!attached && nodeRootHost) { 28045 var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD; 28046 // since it's not attached and we have a root host, the node MUST be in a nested shadow DOM, 28047 // which means we need to get the host's host and check if that parent host is contained 28048 // in (i.e. attached to) the document 28049 nodeRoot = getRootNode(nodeRootHost); 28050 nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host; 28051 attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost)); 28052 } 28053 } 28054 return attached; 28055}; 28056var isZeroArea = function isZeroArea(node) { 28057 var _node$getBoundingClie = node.getBoundingClientRect(), 28058 width = _node$getBoundingClie.width, 28059 height = _node$getBoundingClie.height; 28060 return width === 0 && height === 0; 28061}; 28062var isHidden = function isHidden(node, _ref) { 28063 var displayCheck = _ref.displayCheck, 28064 getShadowRoot = _ref.getShadowRoot; 28065 if (displayCheck === 'full-native') {
vendor: 5,407 bytes, lines 28066-28170
28066 if ('checkVisibility' in node) { 28067 // Chrome >= 105, Edge >= 105, Firefox >= 106, Safari >= 17.4 28068 // @see https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility#browser_compatibility 28069 var visible = node.checkVisibility({ 28070 // Checking opacity might be desirable for some use cases, but natively, 28071 // opacity zero elements _are_ focusable and tabbable. 28072 checkOpacity: false, 28073 opacityProperty: false, 28074 contentVisibilityAuto: true, 28075 visibilityProperty: true, 28076 // This is an alias for `visibilityProperty`. Contemporary browsers 28077 // support both. However, this alias has wider browser support (Chrome 28078 // >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so 28079 // we include it anyway. 28080 checkVisibilityCSS: true 28081 }); 28082 return !visible; 28083 } 28084 // Fall through to manual visibility checks 28085 } 28086 28087 // NOTE: visibility will be `undefined` if node is detached from the document 28088 // (see notes about this further down), which means we will consider it visible 28089 // (this is legacy behavior from a very long way back) 28090 // NOTE: we check this regardless of `displayCheck="none"` because this is a 28091 // _visibility_ check, not a _display_ check 28092 var _getComputedStyle = getComputedStyle(node), 28093 visibility = _getComputedStyle.visibility; 28094 if (visibility === 'hidden' || visibility === 'collapse') { 28095 return true; 28096 } 28097 var isDirectSummary = matches.call(node, 'details>summary:first-of-type'); 28098 var nodeUnderDetails = isDirectSummary ? node.parentElement : node; 28099 if (matches.call(nodeUnderDetails, 'details:not([open]) *')) { 28100 return true; 28101 } 28102 if (!displayCheck || displayCheck === 'full' || 28103 // full-native can run this branch when it falls through in case 28104 // Element#checkVisibility is unsupported 28105 displayCheck === 'full-native' || displayCheck === 'legacy-full') { 28106 if (typeof getShadowRoot === 'function') { 28107 // figure out if we should consider the node to be in an undisclosed shadow and use the 28108 // 'non-zero-area' fallback 28109 var originalNode = node; 28110 while (node) { 28111 var parentElement = node.parentElement; 28112 var rootNode = getRootNode(node); 28113 if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true // check if there's an undisclosed shadow 28114 ) { 28115 // node has an undisclosed shadow which means we can only treat it as a black box, so we 28116 // fall back to a non-zero-area test 28117 return isZeroArea(node); 28118 } else if (node.assignedSlot) { 28119 // iterate up slot 28120 node = node.assignedSlot; 28121 } else if (!parentElement && rootNode !== node.ownerDocument) { 28122 // cross shadow boundary 28123 node = rootNode.host; 28124 } else { 28125 // iterate up normal dom 28126 node = parentElement; 28127 } 28128 } 28129 node = originalNode; 28130 } 28131 // else, `getShadowRoot` might be true, but all that does is enable shadow DOM support 28132 // (i.e. it does not also presume that all nodes might have undisclosed shadows); or 28133 // it might be a falsy value, which means shadow DOM support is disabled 28134 28135 // Since we didn't find it sitting in an undisclosed shadow (or shadows are disabled) 28136 // now we can just test to see if it would normally be visible or not, provided it's 28137 // attached to the main document. 28138 // NOTE: We must consider case where node is inside a shadow DOM and given directly to 28139 // `isTabbable()` or `isFocusable()` -- regardless of `getShadowRoot` option setting. 28140 28141 if (isNodeAttached(node)) { 28142 // this works wherever the node is: if there's at least one client rect, it's 28143 // somehow displayed; it also covers the CSS 'display: contents' case where the 28144 // node itself is hidden in place of its contents; and there's no need to search 28145 // up the hierarchy either 28146 return !node.getClientRects().length; 28147 } 28148 28149 // Else, the node isn't attached to the document, which means the `getClientRects()` 28150 // API will __always__ return zero rects (this can happen, for example, if React 28151 // is used to render nodes onto a detached tree, as confirmed in this thread: 28152 // https://github.com/facebook/react/issues/9117#issuecomment-284228870) 28153 // 28154 // It also means that even window.getComputedStyle(node).display will return `undefined` 28155 // because styles are only computed for nodes that are in the document. 28156 // 28157 // NOTE: THIS HAS BEEN THE CASE FOR YEARS. It is not new, nor is it caused by tabbable 28158 // somehow. Though it was never stated officially, anyone who has ever used tabbable 28159 // APIs on nodes in detached containers has actually implicitly used tabbable in what 28160 // was later (as of v5.2.0 on Apr 9, 2021) called `displayCheck="none"` mode -- essentially 28161 // considering __everything__ to be visible because of the innability to determine styles. 28162 // 28163 // v6.0.0: As of this major release, the default 'full' option __no longer treats detached 28164 // nodes as visible with the 'none' fallback.__ 28165 if (displayCheck !== 'legacy-full') { 28166 return true; // hidden 28167 } 28168 // else, fallback to 'none' mode and consider the node visible 28169 } else if (displayCheck === 'non-zero-area') { 28170 // NOTE: Even though this tests that the node's client rect is non-zero to determine
vendor: 5,628 bytes, lines 28171-28315
28171 // whether it's displayed, and that a detached node will __always__ have a zero-area 28172 // client rect, we don't special-case for whether the node is attached or not. In 28173 // this mode, we do want to consider nodes that have a zero area to be hidden at all 28174 // times, and that includes attached or not. 28175 return isZeroArea(node); 28176 } 28177 28178 // visible, as far as we can tell, or per current `displayCheck=none` mode, we assume 28179 // it's visible 28180 return false; 28181}; 28182 28183// form fields (nested) inside a disabled fieldset are not focusable/tabbable 28184// unless they are in the _first_ <legend> element of the top-most disabled 28185// fieldset 28186var isDisabledFromFieldset = function isDisabledFromFieldset(node) { 28187 if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) { 28188 var parentNode = node.parentElement; 28189 // check if `node` is contained in a disabled <fieldset> 28190 while (parentNode) { 28191 if (parentNode.tagName === 'FIELDSET' && parentNode.disabled) { 28192 // look for the first <legend> among the children of the disabled <fieldset> 28193 for (var i = 0; i < parentNode.children.length; i++) { 28194 var child = parentNode.children.item(i); 28195 // when the first <legend> (in document order) is found 28196 if (child.tagName === 'LEGEND') { 28197 // if its parent <fieldset> is not nested in another disabled <fieldset>, 28198 // return whether `node` is a descendant of its first <legend> 28199 return matches.call(parentNode, 'fieldset[disabled] *') ? true : !child.contains(node); 28200 } 28201 } 28202 // the disabled <fieldset> containing `node` has no <legend> 28203 return true; 28204 } 28205 parentNode = parentNode.parentElement; 28206 } 28207 } 28208 28209 // else, node's tabbable/focusable state should not be affected by a fieldset's 28210 // enabled/disabled state 28211 return false; 28212}; 28213var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) { 28214 if (node.disabled || isHiddenInput(node) || isHidden(node, options) || 28215 // For a details element with a summary, the summary element gets the focus 28216 isDetailsWithSummary(node) || isDisabledFromFieldset(node)) { 28217 return false; 28218 } 28219 return true; 28220}; 28221var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) { 28222 if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) { 28223 return false; 28224 } 28225 return true; 28226}; 28227var isShadowRootTabbable = function isShadowRootTabbable(shadowHostNode) { 28228 var tabIndex = parseInt(shadowHostNode.getAttribute('tabindex'), 10); 28229 if (isNaN(tabIndex) || tabIndex >= 0) { 28230 return true; 28231 } 28232 // If a custom element has an explicit negative tabindex, 28233 // browsers will not allow tab targeting said element's children. 28234 return false; 28235}; 28236 28237/** 28238 * @param {Array.<Element|CandidateScope>} candidates 28239 * @returns Element[] 28240 */ 28241var _sortByOrder = function sortByOrder(candidates) { 28242 var regularTabbables = []; 28243 var orderedTabbables = []; 28244 candidates.forEach(function (item, i) { 28245 var isScope = !!item.scopeParent; 28246 var element = isScope ? item.scopeParent : item; 28247 var candidateTabindex = getSortOrderTabIndex(element, isScope); 28248 var elements = isScope ? _sortByOrder(item.candidates) : element; 28249 if (candidateTabindex === 0) { 28250 isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element); 28251 } else { 28252 orderedTabbables.push({ 28253 documentOrder: i, 28254 tabIndex: candidateTabindex, 28255 item: item, 28256 isScope: isScope, 28257 content: elements 28258 }); 28259 } 28260 }); 28261 return orderedTabbables.sort(sortOrderedTabbables).reduce(function (acc, sortable) { 28262 sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content); 28263 return acc; 28264 }, []).concat(regularTabbables); 28265}; 28266var tabbable = function tabbable(container, options) { 28267 options = options || {}; 28268 var candidates; 28269 if (options.getShadowRoot) { 28270 candidates = _getCandidatesIteratively([container], options.includeContainer, { 28271 filter: isNodeMatchingSelectorTabbable.bind(null, options), 28272 flatten: false, 28273 getShadowRoot: options.getShadowRoot, 28274 shadowRootFilter: isShadowRootTabbable 28275 }); 28276 } else { 28277 candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options)); 28278 } 28279 return _sortByOrder(candidates); 28280}; 28281var focusable = function focusable(container, options) { 28282 options = options || {}; 28283 var candidates; 28284 if (options.getShadowRoot) { 28285 candidates = _getCandidatesIteratively([container], options.includeContainer, { 28286 filter: isNodeMatchingSelectorFocusable.bind(null, options), 28287 flatten: true, 28288 getShadowRoot: options.getShadowRoot 28289 }); 28290 } else { 28291 candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options)); 28292 } 28293 return candidates; 28294}; 28295var isTabbable = function isTabbable(node, options) { 28296 options = options || {}; 28297 if (!node) { 28298 throw new Error('No node provided'); 28299 } 28300 if (matches.call(node, candidateSelector) === false) { 28301 return false; 28302 } 28303 return isNodeMatchingSelectorTabbable(options, node); 28304}; 28305var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe:not([inert]):not([inert] *)').join(','); 28306var isFocusable = function isFocusable(node, options) { 28307 options = options || {}; 28308 if (!node) { 28309 throw new Error('No node provided'); 28310 } 28311 if (matches.call(node, focusableCandidateSelector) === false) { 28312 return false; 28313 } 28314 return isNodeMatchingSelectorFocusable(options, node); 28315};
28316exports.focusable = focusable; 28317exports.getTabIndex = getTabIndex; 28318exports.isFocusable = isFocusable; 28319exports.isTabbable = isTabbable; 28320exports.tabbable = tabbable; 28321 28322},{}],72:[function(require,module,exports){ 28323function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 28324/*! VelocityJS.org (1.5.2). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ 28325 28326/************************* 28327 Velocity jQuery Shim 28328 *************************/ 28329 28330/*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */ 28331 28332/* This file contains the jQuery functions that Velocity relies on, thereby removing Velocity's dependency on a full copy of jQuery, and allowing it to work in any environment. */ 28333/* These shimmed functions are only used if jQuery isn't present. If both this shim and jQuery are loaded, Velocity defaults to jQuery proper. */ 28334/* Browser support: Using this shim instead of jQuery proper removes support for IE8. */ 28335 28336(function (window) { 28337 "use strict"; 28338 28339 /*************** 28340 Setup 28341 ***************/ 28342 28343 /* If jQuery is already loaded, there's no point in loading this shim. */ 28344 if (window.jQuery) { 28345 return; 28346 } 28347 28348 /* jQuery base. */ 28349 var _$ = function $(selector, context) { 28350 return new _$.fn.init(selector, context); 28351 }; 28352 28353 /******************** 28354 Private Methods 28355 ********************/ 28356 28357 /* jQuery */ 28358 _$.isWindow = function (obj) { 28359 /* jshint eqeqeq: false */ 28360 return obj && obj === obj.window; 28361 }; 28362 28363 /* jQuery */ 28364 _$.type = function (obj) { 28365 if (!obj) { 28366 return obj + ""; 28367 } 28368 return _typeof(obj) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : _typeof(obj); 28369 }; 28370 28371 /* jQuery */ 28372 _$.isArray = Array.isArray || function (obj) { 28373 return _$.type(obj) === "array"; 28374 }; 28375 28376 /* jQuery */ 28377 function isArraylike(obj) { 28378 var length = obj.length, 28379 type = _$.type(obj); 28380 if (type === "function" || _$.isWindow(obj)) { 28381 return false; 28382 } 28383 if (obj.nodeType === 1 && length) { 28384 return true; 28385 } 28386 return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj; 28387 } 28388 28389 /*************** 28390 $ Methods 28391 ***************/ 28392 28393 /* jQuery: Support removed for IE<9. */ 28394 _$.isPlainObject = function (obj) { 28395 var key; 28396 if (!obj || _$.type(obj) !== "object" || obj.nodeType || _$.isWindow(obj)) { 28397 return false; 28398 } 28399 try { 28400 if (obj.constructor && !hasOwn.call(obj, "constructor") && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) { 28401 return false; 28402 } 28403 } catch (e) { 28404 return false; 28405 } 28406 for (key in obj) {} 28407 return key === undefined || hasOwn.call(obj, key); 28408 }; 28409 28410 /* jQuery */ 28411 _$.each = function (obj, callback, args) { 28412 var value, 28413 i = 0, 28414 length = obj.length, 28415 isArray = isArraylike(obj); 28416 if (args) { 28417 if (isArray) { 28418 for (; i < length; i++) { 28419 value = callback.apply(obj[i], args); 28420 if (value === false) { 28421 break; 28422 } 28423 } 28424 } else { 28425 for (i in obj) { 28426 if (!obj.hasOwnProperty(i)) { 28427 continue; 28428 } 28429 value = callback.apply(obj[i], args); 28430 if (value === false) { 28431 break; 28432 } 28433 } 28434 } 28435 } else { 28436 if (isArray) { 28437 for (; i < length; i++) { 28438 value = callback.call(obj[i], i, obj[i]); 28439 if (value === false) { 28440 break; 28441 } 28442 } 28443 } else { 28444 for (i in obj) { 28445 if (!obj.hasOwnProperty(i)) { 28446 continue; 28447 } 28448 value = callback.call(obj[i], i, obj[i]); 28449 if (value === false) { 28450 break; 28451 } 28452 } 28453 } 28454 } 28455 return obj; 28456 }; 28457 28458 /* Custom */ 28459 _$.data = function (node, key, value) { 28460 /* $.getData() */ 28461 if (value === undefined) { 28462 var getId = node[_$.expando], 28463 store = getId && cache[getId]; 28464 if (key === undefined) { 28465 return store; 28466 } else if (store) { 28467 if (key in store) { 28468 return store[key]; 28469 } 28470 } 28471 /* $.setData() */ 28472 } else if (key !== undefined) { 28473 var setId = node[_$.expando] || (node[_$.expando] = ++_$.uuid); 28474 cache[setId] = cache[setId] || {}; 28475 cache[setId][key] = value; 28476 return value; 28477 } 28478 }; 28479 28480 /* Custom */ 28481 _$.removeData = function (node, keys) { 28482 var id = node[_$.expando],
vendor: 4,222 bytes, lines 28483-28642
28483 store = id && cache[id]; 28484 if (store) { 28485 // Cleanup the entire store if no keys are provided. 28486 if (!keys) { 28487 delete cache[id]; 28488 } else { 28489 _$.each(keys, function (_, key) { 28490 delete store[key]; 28491 }); 28492 } 28493 } 28494 }; 28495 28496 /* jQuery */ 28497 _$.extend = function () { 28498 var src, 28499 copyIsArray, 28500 copy, 28501 name, 28502 options, 28503 clone, 28504 target = arguments[0] || {}, 28505 i = 1, 28506 length = arguments.length, 28507 deep = false; 28508 if (typeof target === "boolean") { 28509 deep = target; 28510 target = arguments[i] || {}; 28511 i++; 28512 } 28513 if (_typeof(target) !== "object" && _$.type(target) !== "function") { 28514 target = {}; 28515 } 28516 if (i === length) { 28517 target = this; 28518 i--; 28519 } 28520 for (; i < length; i++) { 28521 if (options = arguments[i]) { 28522 for (name in options) { 28523 if (!options.hasOwnProperty(name)) { 28524 continue; 28525 } 28526 src = target[name]; 28527 copy = options[name]; 28528 if (target === copy) { 28529 continue; 28530 } 28531 if (deep && copy && (_$.isPlainObject(copy) || (copyIsArray = _$.isArray(copy)))) { 28532 if (copyIsArray) { 28533 copyIsArray = false; 28534 clone = src && _$.isArray(src) ? src : []; 28535 } else { 28536 clone = src && _$.isPlainObject(src) ? src : {}; 28537 } 28538 target[name] = _$.extend(deep, clone, copy); 28539 } else if (copy !== undefined) { 28540 target[name] = copy; 28541 } 28542 } 28543 } 28544 } 28545 return target; 28546 }; 28547 28548 /* jQuery 1.4.3 */ 28549 _$.queue = function (elem, type, data) { 28550 function $makeArray(arr, results) { 28551 var ret = results || []; 28552 if (arr) { 28553 if (isArraylike(Object(arr))) { 28554 /* $.merge */ 28555 (function (first, second) { 28556 var len = +second.length, 28557 j = 0, 28558 i = first.length; 28559 while (j < len) { 28560 first[i++] = second[j++]; 28561 } 28562 if (len !== len) { 28563 while (second[j] !== undefined) { 28564 first[i++] = second[j++]; 28565 } 28566 } 28567 first.length = i; 28568 return first; 28569 })(ret, typeof arr === "string" ? [arr] : arr); 28570 } else { 28571 [].push.call(ret, arr); 28572 } 28573 } 28574 return ret; 28575 } 28576 if (!elem) { 28577 return; 28578 } 28579 type = (type || "fx") + "queue"; 28580 var q = _$.data(elem, type); 28581 if (!data) { 28582 return q || []; 28583 } 28584 if (!q || _$.isArray(data)) { 28585 q = _$.data(elem, type, $makeArray(data)); 28586 } else { 28587 q.push(data); 28588 } 28589 return q; 28590 }; 28591 28592 /* jQuery 1.4.3 */ 28593 _$.dequeue = function (elems, type) { 28594 /* Custom: Embed element iteration. */ 28595 _$.each(elems.nodeType ? [elems] : elems, function (i, elem) { 28596 type = type || "fx"; 28597 var queue = _$.queue(elem, type), 28598 fn = queue.shift(); 28599 if (fn === "inprogress") { 28600 fn = queue.shift(); 28601 } 28602 if (fn) { 28603 if (type === "fx") { 28604 queue.unshift("inprogress"); 28605 } 28606 fn.call(elem, function () { 28607 _$.dequeue(elem, type); 28608 }); 28609 } 28610 }); 28611 }; 28612 28613 /****************** 28614 $.fn Methods 28615 ******************/ 28616 28617 /* jQuery */ 28618 _$.fn = _$.prototype = { 28619 init: function init(selector) { 28620 /* Just return the element wrapped inside an array; don't proceed with the actual jQuery node wrapping process. */ 28621 if (selector.nodeType) { 28622 this[0] = selector; 28623 return this; 28624 } else { 28625 throw new Error("Not a DOM node."); 28626 } 28627 }, 28628 offset: function offset() { 28629 /* jQuery altered code: Dropped disconnected DOM node checking. */ 28630 var box = this[0].getBoundingClientRect ? this[0].getBoundingClientRect() : { 28631 top: 0, 28632 left: 0 28633 }; 28634 return { 28635 top: box.top + (window.pageYOffset || document.scrollTop || 0) - (document.clientTop || 0), 28636 left: box.left + (window.pageXOffset || document.scrollLeft || 0) - (document.clientLeft || 0) 28637 }; 28638 }, 28639 position: function position() { 28640 /* jQuery */ 28641 function offsetParentFn(elem) { 28642 var offsetParent = elem.offsetParent;
28643 while (offsetParent && offsetParent.nodeName.toLowerCase() !== "html" && offsetParent.style && offsetParent.style.position.toLowerCase() === "static") { 28644 offsetParent = offsetParent.offsetParent; 28645 } 28646 return offsetParent || document; 28647 } 28648 28649 /* Zepto */ 28650 var elem = this[0], 28651 offsetParent = offsetParentFn(elem), 28652 offset = this.offset(), 28653 parentOffset = /^(?:body|html)$/i.test(offsetParent.nodeName) ? { 28654 top: 0, 28655 left: 0 28656 } : _$(offsetParent).offset(); 28657 offset.top -= parseFloat(elem.style.marginTop) || 0; 28658 offset.left -= parseFloat(elem.style.marginLeft) || 0; 28659 if (offsetParent.style) { 28660 parentOffset.top += parseFloat(offsetParent.style.borderTopWidth) || 0; 28661 parentOffset.left += parseFloat(offsetParent.style.borderLeftWidth) || 0; 28662 } 28663 return { 28664 top: offset.top - parentOffset.top, 28665 left: offset.left - parentOffset.left 28666 }; 28667 } 28668 }; 28669 28670 /********************** 28671 Private Variables 28672 **********************/ 28673 28674 /* For $.data() */ 28675 var cache = {}; 28676 _$.expando = "velocity" + new Date().getTime(); 28677 _$.uuid = 0; 28678 28679 /* For $.queue() */ 28680 var class2type = {}, 28681 hasOwn = class2type.hasOwnProperty, 28682 toString = class2type.toString; 28683 var types = "Boolean Number String Function Array Date RegExp Object Error".split(" "); 28684 for (var i = 0; i < types.length; i++) { 28685 class2type["[object " + types[i] + "]"] = types[i].toLowerCase(); 28686 } 28687 28688 /* Makes $(node) possible, without having to call init. */ 28689 _$.fn.init.prototype = _$.fn; 28690 28691 /* Globalize Velocity onto the window, and assign its Utilities property. */ 28692 window.Velocity = { 28693 Utilities: _$ 28694 }; 28695})(window); 28696 28697/****************** 28698 Velocity.js 28699 ******************/ 28700 28701(function (factory) { 28702 "use strict"; 28703 28704 /* CommonJS module. */ 28705 if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === "object" && _typeof(module.exports) === "object") { 28706 module.exports = factory(); 28707 /* AMD module. */ 28708 } else if (typeof define === "function" && define.amd) { 28709 define(factory); 28710 /* Browser globals. */ 28711 } else { 28712 factory(); 28713 } 28714})(function () { 28715 "use strict"; 28716 28717 return function (global, window, document, undefined) { 28718 /*************** 28719 Summary 28720 ***************/ 28721 28722 /* 28723 - CSS: CSS stack that works independently from the rest of Velocity. 28724 - animate(): Core animation method that iterates over the targeted elements and queues the incoming call onto each element individually. 28725 - Pre-Queueing: Prepare the element for animation by instantiating its data cache and processing the call's options. 28726 - Queueing: The logic that runs once the call has reached its point of execution in the element's $.queue() stack. 28727 Most logic is placed here to avoid risking it becoming stale (if the element's properties have changed). 28728 - Pushing: Consolidation of the tween data followed by its push onto the global in-progress calls container. 28729 - tick(): The single requestAnimationFrame loop responsible for tweening all in-progress calls. 28730 - completeCall(): Handles the cleanup process for each Velocity call. 28731 */ 28732 28733 /********************* 28734 Helper Functions 28735 *********************/ 28736 28737 /* IE detection. Gist: https://gist.github.com/julianshapiro/9098609 */ 28738 var IE = function () { 28739 if (document.documentMode) { 28740 return document.documentMode; 28741 } else { 28742 for (var i = 7; i > 4; i--) { 28743 var div = document.createElement("div"); 28744 div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->"; 28745 if (div.getElementsByTagName("span").length) { 28746 div = null; 28747 return i; 28748 } 28749 } 28750 } 28751 return undefined; 28752 }(); 28753 28754 /* rAF shim. Gist: https://gist.github.com/julianshapiro/9497513 */ 28755 var rAFShim = function () { 28756 var timeLast = 0; 28757 return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function (callback) { 28758 var timeCurrent = new Date().getTime(), 28759 timeDelta; 28760 28761 /* Dynamically set delay on a per-tick basis to match 60fps. */ 28762 /* Technique by Erik Moller. MIT license: https://gist.github.com/paulirish/1579671 */ 28763 timeDelta = Math.max(0, 16 - (timeCurrent - timeLast)); 28764 timeLast = timeCurrent + timeDelta; 28765 return setTimeout(function () { 28766 callback(timeCurrent + timeDelta); 28767 }, timeDelta); 28768 }; 28769 }(); 28770 var performance = function () { 28771 var perf = window.performance || {}; 28772 if (typeof perf.now !== "function") { 28773 var nowOffset = perf.timing && perf.timing.navigationStart ? perf.timing.navigationStart : new Date().getTime(); 28774 perf.now = function () { 28775 return new Date().getTime() - nowOffset; 28776 }; 28777 } 28778 return perf; 28779 }(); 28780 28781 /* Array compacting. Copyright Lo-Dash. MIT License: https://github.com/lodash/lodash/blob/master/LICENSE.txt */ 28782 function compactSparseArray(array) { 28783 var index = -1, 28784 length = array ? array.length : 0, 28785 result = []; 28786 while (++index < length) { 28787 var value = array[index]; 28788 if (value) { 28789 result.push(value); 28790 } 28791 } 28792 return result; 28793 } 28794 28795 /** 28796 * Shim for "fixing" IE's lack of support (IE < 9) for applying slice 28797 * on host objects like NamedNodeMap, NodeList, and HTMLCollection 28798 * (technically, since host objects have been implementation-dependent, 28799 * at least before ES2015, IE hasn't needed to work this way). 28800 * Also works on strings, fixes IE < 9 to allow an explicit undefined 28801 * for the 2nd argument (as in Firefox), and prevents errors when 28802 * called on other DOM objects. 28803 */ 28804 var _slice = function () { 28805 var slice = Array.prototype.slice;
28806 try { 28807 // Can't be used with DOM elements in IE < 9 28808 slice.call(document.documentElement); 28809 return slice; 28810 } catch (e) { 28811 // Fails in IE < 9 28812 28813 // This will work for genuine arrays, array-like objects, 28814 // NamedNodeMap (attributes, entities, notations), 28815 // NodeList (e.g., getElementsByTagName), HTMLCollection (e.g., childNodes), 28816 // and will not fail on other DOM objects (as do DOM elements in IE < 9) 28817 return function (begin, end) { 28818 var len = this.length; 28819 if (typeof begin !== "number") { 28820 begin = 0; 28821 } 28822 // IE < 9 gets unhappy with an undefined end argument 28823 if (typeof end !== "number") { 28824 end = len; 28825 } 28826 // For native Array objects, we use the native slice function 28827 if (this.slice) { 28828 return slice.call(this, begin, end); 28829 } 28830 // For array like object we handle it ourselves. 28831 var i, 28832 cloned = [], 28833 // Handle negative value for "begin" 28834 start = begin >= 0 ? begin : Math.max(0, len + begin), 28835 // Handle negative value for "end" 28836 upTo = end < 0 ? len + end : Math.min(end, len), 28837 // Actual expected size of the slice 28838 size = upTo - start; 28839 if (size > 0) { 28840 cloned = new Array(size); 28841 if (this.charAt) { 28842 for (i = 0; i < size; i++) { 28843 cloned[i] = this.charAt(start + i); 28844 } 28845 } else { 28846 for (i = 0; i < size; i++) { 28847 cloned[i] = this[start + i]; 28848 } 28849 } 28850 } 28851 return cloned; 28852 }; 28853 } 28854 }(); 28855 28856 /* .indexOf doesn't exist in IE<9 */ 28857 var _inArray = function _inArray() { 28858 if (Array.prototype.includes) { 28859 return function (arr, val) { 28860 return arr.includes(val); 28861 }; 28862 } 28863 if (Array.prototype.indexOf) { 28864 return function (arr, val) { 28865 return arr.indexOf(val) >= 0; 28866 }; 28867 } 28868 return function (arr, val) { 28869 for (var i = 0; i < arr.length; i++) { 28870 if (arr[i] === val) { 28871 return true; 28872 } 28873 } 28874 return false; 28875 }; 28876 }; 28877 function sanitizeElements(elements) { 28878 /* Unwrap jQuery/Zepto objects. */ 28879 if (Type.isWrapped(elements)) { 28880 elements = _slice.call(elements); 28881 /* Wrap a single element in an array so that $.each() can iterate with the element instead of its node's children. */ 28882 } else if (Type.isNode(elements)) { 28883 elements = [elements]; 28884 } 28885 return elements; 28886 } 28887 var Type = { 28888 isNumber: function isNumber(variable) { 28889 return typeof variable === "number"; 28890 }, 28891 isString: function isString(variable) { 28892 return typeof variable === "string"; 28893 }, 28894 isArray: Array.isArray || function (variable) { 28895 return Object.prototype.toString.call(variable) === "[object Array]"; 28896 }, 28897 isFunction: function isFunction(variable) { 28898 return Object.prototype.toString.call(variable) === "[object Function]"; 28899 }, 28900 isNode: function isNode(variable) { 28901 return variable && variable.nodeType; 28902 }, 28903 /* Determine if variable is an array-like wrapped jQuery, Zepto or similar element, or even a NodeList etc. */ 28904 /* NOTE: HTMLFormElements also have a length. */ 28905 isWrapped: function isWrapped(variable) { 28906 return variable && variable !== window && Type.isNumber(variable.length) && !Type.isString(variable) && !Type.isFunction(variable) && !Type.isNode(variable) && (variable.length === 0 || Type.isNode(variable[0])); 28907 }, 28908 isSVG: function isSVG(variable) { 28909 return window.SVGElement && variable instanceof window.SVGElement; 28910 }, 28911 isEmptyObject: function isEmptyObject(variable) { 28912 for (var name in variable) { 28913 if (variable.hasOwnProperty(name)) { 28914 return false; 28915 } 28916 } 28917 return true; 28918 } 28919 }; 28920 28921 /***************** 28922 Dependencies 28923 *****************/ 28924 28925 var $, 28926 isJQuery = false;
vendor: 13,543 bytes, lines 28927-29272
28927 if (global.fn && global.fn.jquery) { 28928 $ = global; 28929 isJQuery = true; 28930 } else { 28931 $ = window.Velocity.Utilities; 28932 } 28933 if (IE <= 8 && !isJQuery) { 28934 throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity."); 28935 } else if (IE <= 7) { 28936 /* Revert to jQuery's $.animate(), and lose Velocity's extra features. */ 28937 jQuery.fn.velocity = jQuery.fn.animate; 28938 28939 /* Now that $.fn.velocity is aliased, abort this Velocity declaration. */ 28940 return; 28941 } 28942 28943 /***************** 28944 Constants 28945 *****************/ 28946 28947 var DURATION_DEFAULT = 400, 28948 EASING_DEFAULT = "swing"; 28949 28950 /************* 28951 State 28952 *************/ 28953 28954 var Velocity = { 28955 /* Container for page-wide Velocity state data. */ 28956 State: { 28957 /* Detect mobile devices to determine if mobileHA should be turned on. */ 28958 isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(window.navigator.userAgent), 28959 /* The mobileHA option's behavior changes on older Android devices (Gingerbread, versions 2.3.3-2.3.7). */ 28960 isAndroid: /Android/i.test(window.navigator.userAgent), 28961 isGingerbread: /Android 2\.3\.[3-7]/i.test(window.navigator.userAgent), 28962 isChrome: window.chrome, 28963 isFirefox: /Firefox/i.test(window.navigator.userAgent), 28964 /* Create a cached element for re-use when checking for CSS property prefixes. */ 28965 prefixElement: document.createElement("div"), 28966 /* Cache every prefix match to avoid repeating lookups. */ 28967 prefixMatches: {}, 28968 /* Cache the anchor used for animating window scrolling. */ 28969 scrollAnchor: null, 28970 /* Cache the browser-specific property names associated with the scroll anchor. */ 28971 scrollPropertyLeft: null, 28972 scrollPropertyTop: null, 28973 /* Keep track of whether our RAF tick is running. */ 28974 isTicking: false, 28975 /* Container for every in-progress call to Velocity. */ 28976 calls: [], 28977 delayedElements: { 28978 count: 0 28979 } 28980 }, 28981 /* Velocity's custom CSS stack. Made global for unit testing. */ 28982 CSS: {/* Defined below. */}, 28983 /* A shim of the jQuery utility functions used by Velocity -- provided by Velocity's optional jQuery shim. */ 28984 Utilities: $, 28985 /* Container for the user's custom animation redirects that are referenced by name in place of the properties map argument. */ 28986 Redirects: {/* Manually registered by the user. */}, 28987 Easings: {/* Defined below. */}, 28988 /* Attempt to use ES6 Promises by default. Users can override this with a third-party promises library. */ 28989 Promise: window.Promise, 28990 /* Velocity option defaults, which can be overriden by the user. */ 28991 defaults: { 28992 queue: "", 28993 duration: DURATION_DEFAULT, 28994 easing: EASING_DEFAULT, 28995 begin: undefined, 28996 complete: undefined, 28997 progress: undefined, 28998 display: undefined, 28999 visibility: undefined, 29000 loop: false, 29001 delay: false, 29002 mobileHA: true, 29003 /* Advanced: Set to false to prevent property values from being cached between consecutive Velocity-initiated chain calls. */ 29004 _cacheValues: true, 29005 /* Advanced: Set to false if the promise should always resolve on empty element lists. */ 29006 promiseRejectEmpty: true 29007 }, 29008 /* A design goal of Velocity is to cache data wherever possible in order to avoid DOM requerying. Accordingly, each element has a data cache. */ 29009 init: function init(element) { 29010 $.data(element, "velocity", { 29011 /* Store whether this is an SVG element, since its properties are retrieved and updated differently than standard HTML elements. */ 29012 isSVG: Type.isSVG(element), 29013 /* Keep track of whether the element is currently being animated by Velocity. 29014 This is used to ensure that property values are not transferred between non-consecutive (stale) calls. */ 29015 isAnimating: false, 29016 /* A reference to the element's live computedStyle object. Learn more here: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle */ 29017 computedStyle: null, 29018 /* Tween data is cached for each animation on the element so that data can be passed across calls -- 29019 in particular, end values are used as subsequent start values in consecutive Velocity calls. */ 29020 tweensContainer: null, 29021 /* The full root property values of each CSS hook being animated on this element are cached so that: 29022 1) Concurrently-animating hooks sharing the same root can have their root values' merged into one while tweening. 29023 2) Post-hook-injection root values can be transferred over to consecutively chained Velocity calls as starting root values. */ 29024 rootPropertyValueCache: {}, 29025 /* A cache for transform updates, which must be manually flushed via CSS.flushTransformCache(). */ 29026 transformCache: {} 29027 }); 29028 }, 29029 /* A parallel to jQuery's $.css(), used for getting/setting Velocity's hooked CSS properties. */ 29030 hook: null, 29031 /* Defined below. */ 29032 /* Velocity-wide animation time remapping for testing purposes. */ 29033 mock: false, 29034 version: { 29035 major: 1, 29036 minor: 5, 29037 patch: 2 29038 }, 29039 /* Set to 1 or 2 (most verbose) to output debug info to console. */ 29040 debug: false, 29041 /* Use rAF high resolution timestamp when available */ 29042 timestamp: true, 29043 /* Pause all animations */ 29044 pauseAll: function pauseAll(queueName) { 29045 var currentTime = new Date().getTime(); 29046 $.each(Velocity.State.calls, function (i, activeCall) { 29047 if (activeCall) { 29048 /* If we have a queueName and this call is not on that queue, skip */ 29049 if (queueName !== undefined && (activeCall[2].queue !== queueName || activeCall[2].queue === false)) { 29050 return true; 29051 } 29052 29053 /* Set call to paused */ 29054 activeCall[5] = { 29055 resume: false 29056 }; 29057 } 29058 }); 29059 29060 /* Pause timers on any currently delayed calls */ 29061 $.each(Velocity.State.delayedElements, function (k, element) { 29062 if (!element) { 29063 return; 29064 } 29065 pauseDelayOnElement(element, currentTime); 29066 }); 29067 }, 29068 /* Resume all animations */ 29069 resumeAll: function resumeAll(queueName) { 29070 var currentTime = new Date().getTime(); 29071 $.each(Velocity.State.calls, function (i, activeCall) { 29072 if (activeCall) { 29073 /* If we have a queueName and this call is not on that queue, skip */ 29074 if (queueName !== undefined && (activeCall[2].queue !== queueName || activeCall[2].queue === false)) { 29075 return true; 29076 } 29077 29078 /* Set call to resumed if it was paused */ 29079 if (activeCall[5]) { 29080 activeCall[5].resume = true; 29081 } 29082 } 29083 }); 29084 /* Resume timers on any currently delayed calls */ 29085 $.each(Velocity.State.delayedElements, function (k, element) { 29086 if (!element) { 29087 return; 29088 } 29089 resumeDelayOnElement(element, currentTime); 29090 }); 29091 } 29092 }; 29093 29094 /* Retrieve the appropriate scroll anchor and property name for the browser: https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY */ 29095 if (window.pageYOffset !== undefined) { 29096 Velocity.State.scrollAnchor = window; 29097 Velocity.State.scrollPropertyLeft = "pageXOffset"; 29098 Velocity.State.scrollPropertyTop = "pageYOffset"; 29099 } else { 29100 Velocity.State.scrollAnchor = document.documentElement || document.body.parentNode || document.body; 29101 Velocity.State.scrollPropertyLeft = "scrollLeft"; 29102 Velocity.State.scrollPropertyTop = "scrollTop"; 29103 } 29104 29105 /* Shorthand alias for jQuery's $.data() utility. */ 29106 function Data(element) { 29107 /* Hardcode a reference to the plugin name. */ 29108 var response = $.data(element, "velocity"); 29109 29110 /* jQuery <=1.4.2 returns null instead of undefined when no match is found. We normalize this behavior. */ 29111 return response === null ? undefined : response; 29112 } 29113 29114 /************** 29115 Delay Timer 29116 **************/ 29117 29118 function pauseDelayOnElement(element, currentTime) { 29119 /* Check for any delay timers, and pause the set timeouts (while preserving time data) 29120 to be resumed when the "resume" command is issued */ 29121 var data = Data(element); 29122 if (data && data.delayTimer && !data.delayPaused) { 29123 data.delayRemaining = data.delay - currentTime + data.delayBegin; 29124 data.delayPaused = true; 29125 clearTimeout(data.delayTimer.setTimeout); 29126 } 29127 } 29128 function resumeDelayOnElement(element, currentTime) { 29129 /* Check for any paused timers and resume */ 29130 var data = Data(element); 29131 if (data && data.delayTimer && data.delayPaused) { 29132 /* If the element was mid-delay, re initiate the timeout with the remaining delay */ 29133 data.delayPaused = false; 29134 data.delayTimer.setTimeout = setTimeout(data.delayTimer.next, data.delayRemaining); 29135 } 29136 } 29137 29138 /************** 29139 Easing 29140 **************/ 29141 29142 /* Step easing generator. */ 29143 function generateStep(steps) { 29144 return function (p) { 29145 return Math.round(p * steps) * (1 / steps); 29146 }; 29147 } 29148 29149 /* Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */ 29150 function generateBezier(mX1, mY1, mX2, mY2) { 29151 var NEWTON_ITERATIONS = 4, 29152 NEWTON_MIN_SLOPE = 0.001, 29153 SUBDIVISION_PRECISION = 0.0000001, 29154 SUBDIVISION_MAX_ITERATIONS = 10, 29155 kSplineTableSize = 11, 29156 kSampleStepSize = 1.0 / (kSplineTableSize - 1.0), 29157 float32ArraySupported = "Float32Array" in window; 29158 29159 /* Must contain four arguments. */ 29160 if (arguments.length !== 4) { 29161 return false; 29162 } 29163 29164 /* Arguments must be numbers. */ 29165 for (var i = 0; i < 4; ++i) { 29166 if (typeof arguments[i] !== "number" || isNaN(arguments[i]) || !isFinite(arguments[i])) { 29167 return false; 29168 } 29169 } 29170 29171 /* X values must be in the [0, 1] range. */ 29172 mX1 = Math.min(mX1, 1); 29173 mX2 = Math.min(mX2, 1); 29174 mX1 = Math.max(mX1, 0); 29175 mX2 = Math.max(mX2, 0); 29176 var mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); 29177 function A(aA1, aA2) { 29178 return 1.0 - 3.0 * aA2 + 3.0 * aA1; 29179 } 29180 function B(aA1, aA2) { 29181 return 3.0 * aA2 - 6.0 * aA1; 29182 } 29183 function C(aA1) { 29184 return 3.0 * aA1; 29185 } 29186 function calcBezier(aT, aA1, aA2) { 29187 return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; 29188 } 29189 function getSlope(aT, aA1, aA2) { 29190 return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); 29191 } 29192 function newtonRaphsonIterate(aX, aGuessT) { 29193 for (var i = 0; i < NEWTON_ITERATIONS; ++i) { 29194 var currentSlope = getSlope(aGuessT, mX1, mX2); 29195 if (currentSlope === 0.0) { 29196 return aGuessT; 29197 } 29198 var currentX = calcBezier(aGuessT, mX1, mX2) - aX; 29199 aGuessT -= currentX / currentSlope; 29200 } 29201 return aGuessT; 29202 } 29203 function calcSampleValues() { 29204 for (var i = 0; i < kSplineTableSize; ++i) { 29205 mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2); 29206 } 29207 } 29208 function binarySubdivide(aX, aA, aB) { 29209 var currentX, 29210 currentT, 29211 i = 0; 29212 do { 29213 currentT = aA + (aB - aA) / 2.0; 29214 currentX = calcBezier(currentT, mX1, mX2) - aX; 29215 if (currentX > 0.0) { 29216 aB = currentT; 29217 } else { 29218 aA = currentT; 29219 } 29220 } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); 29221 return currentT; 29222 } 29223 function getTForX(aX) { 29224 var intervalStart = 0.0, 29225 currentSample = 1, 29226 lastSample = kSplineTableSize - 1; 29227 for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) { 29228 intervalStart += kSampleStepSize; 29229 } 29230 --currentSample; 29231 var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]), 29232 guessForT = intervalStart + dist * kSampleStepSize, 29233 initialSlope = getSlope(guessForT, mX1, mX2); 29234 if (initialSlope >= NEWTON_MIN_SLOPE) { 29235 return newtonRaphsonIterate(aX, guessForT); 29236 } else if (initialSlope === 0.0) { 29237 return guessForT; 29238 } else { 29239 return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize); 29240 } 29241 } 29242 var _precomputed = false; 29243 function precompute() { 29244 _precomputed = true; 29245 if (mX1 !== mY1 || mX2 !== mY2) { 29246 calcSampleValues(); 29247 } 29248 } 29249 var f = function f(aX) { 29250 if (!_precomputed) { 29251 precompute(); 29252 } 29253 if (mX1 === mY1 && mX2 === mY2) { 29254 return aX; 29255 } 29256 if (aX === 0) { 29257 return 0; 29258 } 29259 if (aX === 1) { 29260 return 1; 29261 } 29262 return calcBezier(getTForX(aX), mY1, mY2); 29263 }; 29264 f.getControlPoints = function () { 29265 return [{ 29266 x: mX1, 29267 y: mY1 29268 }, { 29269 x: mX2, 29270 y: mY2 29271 }]; 29272 };
29273 var str = "generateBezier(" + [mX1, mY1, mX2, mY2] + ")"; 29274 f.toString = function () { 29275 return str; 29276 }; 29277 return f; 29278 } 29279 29280 /* Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ 29281 /* Given a tension, friction, and duration, a simulation at 60FPS will first run without a defined duration in order to calculate the full path. A second pass 29282 then adjusts the time delta -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */ 29283 var generateSpringRK4 = function () { 29284 function springAccelerationForState(state) { 29285 return -state.tension * state.x - state.friction * state.v; 29286 } 29287 function springEvaluateStateWithDerivative(initialState, dt, derivative) { 29288 var state = { 29289 x: initialState.x + derivative.dx * dt, 29290 v: initialState.v + derivative.dv * dt, 29291 tension: initialState.tension, 29292 friction: initialState.friction 29293 }; 29294 return { 29295 dx: state.v, 29296 dv: springAccelerationForState(state) 29297 }; 29298 } 29299 function springIntegrateState(state, dt) { 29300 var a = { 29301 dx: state.v, 29302 dv: springAccelerationForState(state) 29303 }, 29304 b = springEvaluateStateWithDerivative(state, dt * 0.5, a), 29305 c = springEvaluateStateWithDerivative(state, dt * 0.5, b), 29306 d = springEvaluateStateWithDerivative(state, dt, c), 29307 dxdt = 1.0 / 6.0 * (a.dx + 2.0 * (b.dx + c.dx) + d.dx), 29308 dvdt = 1.0 / 6.0 * (a.dv + 2.0 * (b.dv + c.dv) + d.dv); 29309 state.x = state.x + dxdt * dt; 29310 state.v = state.v + dvdt * dt; 29311 return state; 29312 } 29313 return function springRK4Factory(tension, friction, duration) { 29314 var initState = { 29315 x: -1, 29316 v: 0, 29317 tension: null, 29318 friction: null 29319 }, 29320 path = [0], 29321 time_lapsed = 0, 29322 tolerance = 1 / 10000, 29323 DT = 16 / 1000, 29324 have_duration, 29325 dt, 29326 last_state; 29327 tension = parseFloat(tension) || 500; 29328 friction = parseFloat(friction) || 20; 29329 duration = duration || null; 29330 initState.tension = tension; 29331 initState.friction = friction; 29332 have_duration = duration !== null; 29333 29334 /* Calculate the actual time it takes for this animation to complete with the provided conditions. */ 29335 if (have_duration) { 29336 /* Run the simulation without a duration. */ 29337 time_lapsed = springRK4Factory(tension, friction); 29338 /* Compute the adjusted time delta. */ 29339 dt = time_lapsed / duration * DT; 29340 } else { 29341 dt = DT; 29342 } 29343 while (true) { 29344 /* Next/step function .*/ 29345 last_state = springIntegrateState(last_state || initState, dt); 29346 /* Store the position. */ 29347 path.push(1 + last_state.x); 29348 time_lapsed += 16; 29349 /* If the change threshold is reached, break. */ 29350 if (!(Math.abs(last_state.x) > tolerance && Math.abs(last_state.v) > tolerance)) { 29351 break; 29352 } 29353 } 29354 29355 /* If duration is not defined, return the actual time required for completing this animation. Otherwise, return a closure that holds the 29356 computed path and returns a snapshot of the position according to a given percentComplete. */ 29357 return !have_duration ? time_lapsed : function (percentComplete) { 29358 return path[percentComplete * (path.length - 1) | 0]; 29359 }; 29360 }; 29361 }(); 29362 29363 /* jQuery easings. */ 29364 Velocity.Easings = { 29365 linear: function linear(p) { 29366 return p; 29367 }, 29368 swing: function swing(p) { 29369 return 0.5 - Math.cos(p * Math.PI) / 2; 29370 },
29371 /* Bonus "spring" easing, which is a less exaggerated version of easeInOutElastic. */ 29372 spring: function spring(p) { 29373 return 1 - Math.cos(p * 4.5 * Math.PI) * Math.exp(-p * 6); 29374 } 29375 }; 29376 29377 /* CSS3 and Robert Penner easings. */ 29378 $.each([["ease", [0.25, 0.1, 0.25, 1.0]], ["ease-in", [0.42, 0.0, 1.00, 1.0]], ["ease-out", [0.00, 0.0, 0.58, 1.0]], ["ease-in-out", [0.42, 0.0, 0.58, 1.0]], ["easeInSine", [0.47, 0, 0.745, 0.715]], ["easeOutSine", [0.39, 0.575, 0.565, 1]], ["easeInOutSine", [0.445, 0.05, 0.55, 0.95]], ["easeInQuad", [0.55, 0.085, 0.68, 0.53]], ["easeOutQuad", [0.25, 0.46, 0.45, 0.94]], ["easeInOutQuad", [0.455, 0.03, 0.515, 0.955]], ["easeInCubic", [0.55, 0.055, 0.675, 0.19]], ["easeOutCubic", [0.215, 0.61, 0.355, 1]], ["easeInOutCubic", [0.645, 0.045, 0.355, 1]], ["easeInQuart", [0.895, 0.03, 0.685, 0.22]], ["easeOutQuart", [0.165, 0.84, 0.44, 1]], ["easeInOutQuart", [0.77, 0, 0.175, 1]], ["easeInQuint", [0.755, 0.05, 0.855, 0.06]], ["easeOutQuint", [0.23, 1, 0.32, 1]], ["easeInOutQuint", [0.86, 0, 0.07, 1]], ["easeInExpo", [0.95, 0.05, 0.795, 0.035]], ["easeOutExpo", [0.19, 1, 0.22, 1]], ["easeInOutExpo", [1, 0, 0, 1]], ["easeInCirc", [0.6, 0.04, 0.98, 0.335]], ["easeOutCirc", [0.075, 0.82, 0.165, 1]], ["easeInOutCirc", [0.785, 0.135, 0.15, 0.86]]], function (i, easingArray) { 29379 Velocity.Easings[easingArray[0]] = generateBezier.apply(null, easingArray[1]); 29380 }); 29381 29382 /* Determine the appropriate easing type given an easing input. */ 29383 function getEasing(value, duration) { 29384 var easing = value; 29385 29386 /* The easing option can either be a string that references a pre-registered easing, 29387 or it can be a two-/four-item array of integers to be converted into a bezier/spring function. */ 29388 if (Type.isString(value)) { 29389 /* Ensure that the easing has been assigned to jQuery's Velocity.Easings object. */ 29390 if (!Velocity.Easings[value]) { 29391 easing = false; 29392 } 29393 } else if (Type.isArray(value) && value.length === 1) { 29394 easing = generateStep.apply(null, value); 29395 } else if (Type.isArray(value) && value.length === 2) { 29396 /* springRK4 must be passed the animation's duration. */ 29397 /* Note: If the springRK4 array contains non-numbers, generateSpringRK4() returns an easing
vendor: 6,075 bytes, lines 29398-29551
29398 function generated with default tension and friction values. */ 29399 easing = generateSpringRK4.apply(null, value.concat([duration])); 29400 } else if (Type.isArray(value) && value.length === 4) { 29401 /* Note: If the bezier array contains non-numbers, generateBezier() returns false. */ 29402 easing = generateBezier.apply(null, value); 29403 } else { 29404 easing = false; 29405 } 29406 29407 /* Revert to the Velocity-wide default easing type, or fall back to "swing" (which is also jQuery's default) 29408 if the Velocity-wide default has been incorrectly modified. */ 29409 if (easing === false) { 29410 if (Velocity.Easings[Velocity.defaults.easing]) { 29411 easing = Velocity.defaults.easing; 29412 } else { 29413 easing = EASING_DEFAULT; 29414 } 29415 } 29416 return easing; 29417 } 29418 29419 /***************** 29420 CSS Stack 29421 *****************/ 29422 29423 /* The CSS object is a highly condensed and performant CSS stack that fully replaces jQuery's. 29424 It handles the validation, getting, and setting of both standard CSS properties and CSS property hooks. */ 29425 /* Note: A "CSS" shorthand is aliased so that our code is easier to read. */ 29426 var CSS = Velocity.CSS = { 29427 /************* 29428 RegEx 29429 *************/ 29430 29431 RegEx: { 29432 isHex: /^#([A-f\d]{3}){1,2}$/i, 29433 /* Unwrap a property value's surrounding text, e.g. "rgba(4, 3, 2, 1)" ==> "4, 3, 2, 1" and "rect(4px 3px 2px 1px)" ==> "4px 3px 2px 1px". */ 29434 valueUnwrap: /^[A-z]+\((.*)\)$/i, 29435 wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/, 29436 /* Split a multi-value property into an array of subvalues, e.g. "rgba(4, 3, 2, 1) 4px 3px 2px 1px" ==> [ "rgba(4, 3, 2, 1)", "4px", "3px", "2px", "1px" ]. */ 29437 valueSplit: /([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/ig 29438 }, 29439 /************ 29440 Lists 29441 ************/ 29442 29443 Lists: { 29444 colors: ["fill", "stroke", "stopColor", "color", "backgroundColor", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "outlineColor"], 29445 transformsBase: ["translateX", "translateY", "scale", "scaleX", "scaleY", "skewX", "skewY", "rotateZ"], 29446 transforms3D: ["transformPerspective", "translateZ", "scaleZ", "rotateX", "rotateY"], 29447 units: ["%", 29448 // relative 29449 "em", "ex", "ch", "rem", 29450 // font relative 29451 "vw", "vh", "vmin", "vmax", 29452 // viewport relative 29453 "cm", "mm", "Q", "in", "pc", "pt", "px", 29454 // absolute lengths 29455 "deg", "grad", "rad", "turn", 29456 // angles 29457 "s", "ms" // time 29458 ], 29459 colorNames: { 29460 "aliceblue": "240,248,255", 29461 "antiquewhite": "250,235,215", 29462 "aquamarine": "127,255,212", 29463 "aqua": "0,255,255", 29464 "azure": "240,255,255", 29465 "beige": "245,245,220", 29466 "bisque": "255,228,196", 29467 "black": "0,0,0", 29468 "blanchedalmond": "255,235,205", 29469 "blueviolet": "138,43,226", 29470 "blue": "0,0,255", 29471 "brown": "165,42,42", 29472 "burlywood": "222,184,135", 29473 "cadetblue": "95,158,160", 29474 "chartreuse": "127,255,0", 29475 "chocolate": "210,105,30", 29476 "coral": "255,127,80", 29477 "cornflowerblue": "100,149,237", 29478 "cornsilk": "255,248,220", 29479 "crimson": "220,20,60", 29480 "cyan": "0,255,255", 29481 "darkblue": "0,0,139", 29482 "darkcyan": "0,139,139", 29483 "darkgoldenrod": "184,134,11", 29484 "darkgray": "169,169,169", 29485 "darkgrey": "169,169,169", 29486 "darkgreen": "0,100,0", 29487 "darkkhaki": "189,183,107", 29488 "darkmagenta": "139,0,139", 29489 "darkolivegreen": "85,107,47", 29490 "darkorange": "255,140,0", 29491 "darkorchid": "153,50,204", 29492 "darkred": "139,0,0", 29493 "darksalmon": "233,150,122", 29494 "darkseagreen": "143,188,143", 29495 "darkslateblue": "72,61,139", 29496 "darkslategray": "47,79,79", 29497 "darkturquoise": "0,206,209", 29498 "darkviolet": "148,0,211", 29499 "deeppink": "255,20,147", 29500 "deepskyblue": "0,191,255", 29501 "dimgray": "105,105,105", 29502 "dimgrey": "105,105,105", 29503 "dodgerblue": "30,144,255", 29504 "firebrick": "178,34,34", 29505 "floralwhite": "255,250,240", 29506 "forestgreen": "34,139,34", 29507 "fuchsia": "255,0,255", 29508 "gainsboro": "220,220,220", 29509 "ghostwhite": "248,248,255", 29510 "gold": "255,215,0", 29511 "goldenrod": "218,165,32", 29512 "gray": "128,128,128", 29513 "grey": "128,128,128", 29514 "greenyellow": "173,255,47", 29515 "green": "0,128,0", 29516 "honeydew": "240,255,240", 29517 "hotpink": "255,105,180", 29518 "indianred": "205,92,92", 29519 "indigo": "75,0,130", 29520 "ivory": "255,255,240", 29521 "khaki": "240,230,140", 29522 "lavenderblush": "255,240,245", 29523 "lavender": "230,230,250", 29524 "lawngreen": "124,252,0", 29525 "lemonchiffon": "255,250,205", 29526 "lightblue": "173,216,230", 29527 "lightcoral": "240,128,128", 29528 "lightcyan": "224,255,255", 29529 "lightgoldenrodyellow": "250,250,210", 29530 "lightgray": "211,211,211", 29531 "lightgrey": "211,211,211", 29532 "lightgreen": "144,238,144", 29533 "lightpink": "255,182,193", 29534 "lightsalmon": "255,160,122", 29535 "lightseagreen": "32,178,170", 29536 "lightskyblue": "135,206,250", 29537 "lightslategray": "119,136,153", 29538 "lightsteelblue": "176,196,222", 29539 "lightyellow": "255,255,224", 29540 "limegreen": "50,205,50", 29541 "lime": "0,255,0", 29542 "linen": "250,240,230", 29543 "magenta": "255,0,255", 29544 "maroon": "128,0,0", 29545 "mediumaquamarine": "102,205,170", 29546 "mediumblue": "0,0,205", 29547 "mediumorchid": "186,85,211", 29548 "mediumpurple": "147,112,219", 29549 "mediumseagreen": "60,179,113", 29550 "mediumslateblue": "123,104,238", 29551 "mediumspringgreen": "0,250,154",
29552 "mediumturquoise": "72,209,204", 29553 "mediumvioletred": "199,21,133", 29554 "midnightblue": "25,25,112", 29555 "mintcream": "245,255,250", 29556 "mistyrose": "255,228,225", 29557 "moccasin": "255,228,181", 29558 "navajowhite": "255,222,173", 29559 "navy": "0,0,128", 29560 "oldlace": "253,245,230", 29561 "olivedrab": "107,142,35", 29562 "olive": "128,128,0", 29563 "orangered": "255,69,0", 29564 "orange": "255,165,0", 29565 "orchid": "218,112,214", 29566 "palegoldenrod": "238,232,170", 29567 "palegreen": "152,251,152", 29568 "paleturquoise": "175,238,238", 29569 "palevioletred": "219,112,147", 29570 "papayawhip": "255,239,213", 29571 "peachpuff": "255,218,185", 29572 "peru": "205,133,63", 29573 "pink": "255,192,203", 29574 "plum": "221,160,221", 29575 "powderblue": "176,224,230", 29576 "purple": "128,0,128", 29577 "red": "255,0,0", 29578 "rosybrown": "188,143,143", 29579 "royalblue": "65,105,225", 29580 "saddlebrown": "139,69,19", 29581 "salmon": "250,128,114", 29582 "sandybrown": "244,164,96", 29583 "seagreen": "46,139,87", 29584 "seashell": "255,245,238", 29585 "sienna": "160,82,45", 29586 "silver": "192,192,192", 29587 "skyblue": "135,206,235", 29588 "slateblue": "106,90,205", 29589 "slategray": "112,128,144", 29590 "snow": "255,250,250", 29591 "springgreen": "0,255,127", 29592 "steelblue": "70,130,180", 29593 "tan": "210,180,140", 29594 "teal": "0,128,128", 29595 "thistle": "216,191,216", 29596 "tomato": "255,99,71", 29597 "turquoise": "64,224,208", 29598 "violet": "238,130,238", 29599 "wheat": "245,222,179", 29600 "whitesmoke": "245,245,245", 29601 "white": "255,255,255", 29602 "yellowgreen": "154,205,50", 29603 "yellow": "255,255,0" 29604 } 29605 }, 29606 /************ 29607 Hooks 29608 ************/ 29609 29610 /* Hooks allow a subproperty (e.g. "boxShadowBlur") of a compound-value CSS property 29611 (e.g. "boxShadow: X Y Blur Spread Color") to be animated as if it were a discrete property. */ 29612 /* Note: Beyond enabling fine-grained property animation, hooking is necessary since Velocity only 29613 tweens properties with single numeric values; unlike CSS transitions, Velocity does not interpolate compound-values. */ 29614 Hooks: { 29615 /******************** 29616 Registration 29617 ********************/ 29618 29619 /* Templates are a concise way of indicating which subproperties must be individually registered for each compound-value CSS property. */ 29620 /* Each template consists of the compound-value's base name, its constituent subproperty names, and those subproperties' default values. */ 29621 templates: { 29622 "textShadow": ["Color X Y Blur", "black 0px 0px 0px"], 29623 "boxShadow": ["Color X Y Blur Spread", "black 0px 0px 0px 0px"], 29624 "clip": ["Top Right Bottom Left", "0px 0px 0px 0px"], 29625 "backgroundPosition": ["X Y", "0% 0%"], 29626 "transformOrigin": ["X Y Z", "50% 50% 0px"], 29627 "perspectiveOrigin": ["X Y", "50% 50%"] 29628 }, 29629 /* A "registered" hook is one that has been converted from its template form into a live, 29630 tweenable property. It contains data to associate it with its root property. */ 29631 registered: { 29632 /* Note: A registered hook looks like this ==> textShadowBlur: [ "textShadow", 3 ], 29633 which consists of the subproperty's name, the associated root property's name, 29634 and the subproperty's position in the root's value. */ 29635 }, 29636 /* Convert the templates into individual hooks then append them to the registered object above. */ 29637 register: function register() { 29638 /* Color hooks registration: Colors are defaulted to white -- as opposed to black -- since colors that are 29639 currently set to "transparent" default to their respective template below when color-animated, 29640 and white is typically a closer match to transparent than black is. An exception is made for text ("color"), 29641 which is almost always set closer to black than white. */ 29642 for (var i = 0; i < CSS.Lists.colors.length; i++) { 29643 var rgbComponents = CSS.Lists.colors[i] === "color" ? "0 0 0 1" : "255 255 255 1"; 29644 CSS.Hooks.templates[CSS.Lists.colors[i]] = ["Red Green Blue Alp
vendor: 11,141 bytes, lines 29644-29861
29644ha", rgbComponents]; 29645 } 29646 var rootProperty, hookTemplate, hookNames; 29647 29648 /* In IE, color values inside compound-value properties are positioned at the end the value instead of at the beginning. 29649 Thus, we re-arrange the templates accordingly. */ 29650 if (IE) { 29651 for (rootProperty in CSS.Hooks.templates) { 29652 if (!CSS.Hooks.templates.hasOwnProperty(rootProperty)) { 29653 continue; 29654 } 29655 hookTemplate = CSS.Hooks.templates[rootProperty]; 29656 hookNames = hookTemplate[0].split(" "); 29657 var defaultValues = hookTemplate[1].match(CSS.RegEx.valueSplit); 29658 if (hookNames[0] === "Color") { 29659 /* Reposition both the hook's name and its default value to the end of their respective strings. */ 29660 hookNames.push(hookNames.shift()); 29661 defaultValues.push(defaultValues.shift()); 29662 29663 /* Replace the existing template for the hook's root property. */ 29664 CSS.Hooks.templates[rootProperty] = [hookNames.join(" "), defaultValues.join(" ")]; 29665 } 29666 } 29667 } 29668 29669 /* Hook registration. */ 29670 for (rootProperty in CSS.Hooks.templates) { 29671 if (!CSS.Hooks.templates.hasOwnProperty(rootProperty)) { 29672 continue; 29673 } 29674 hookTemplate = CSS.Hooks.templates[rootProperty]; 29675 hookNames = hookTemplate[0].split(" "); 29676 for (var j in hookNames) { 29677 if (!hookNames.hasOwnProperty(j)) { 29678 continue; 29679 } 29680 var fullHookName = rootProperty + hookNames[j], 29681 hookPosition = j; 29682 29683 /* For each hook, register its full name (e.g. textShadowBlur) with its root property (e.g. textShadow) 29684 and the hook's position in its template's default value string. */ 29685 CSS.Hooks.registered[fullHookName] = [rootProperty, hookPosition]; 29686 } 29687 } 29688 }, 29689 /***************************** 29690 Injection and Extraction 29691 *****************************/ 29692 29693 /* Look up the root property associated with the hook (e.g. return "textShadow" for "textShadowBlur"). */ 29694 /* Since a hook cannot be set directly (the browser won't recognize it), style updating for hooks is routed through the hook's root property. */ 29695 getRoot: function getRoot(property) { 29696 var hookData = CSS.Hooks.registered[property]; 29697 if (hookData) { 29698 return hookData[0]; 29699 } else { 29700 /* If there was no hook match, return the property name untouched. */ 29701 return property; 29702 } 29703 }, 29704 getUnit: function getUnit(str, start) { 29705 var unit = (str.substr(start || 0, 5).match(/^[a-z%]+/) || [])[0] || ""; 29706 if (unit && _inArray(CSS.Lists.units, unit)) { 29707 return unit; 29708 } 29709 return ""; 29710 }, 29711 fixColors: function fixColors(str) { 29712 return str.replace(/(rgba?\(\s*)?(\b[a-z]+\b)/g, function ($0, $1, $2) { 29713 if (CSS.Lists.colorNames.hasOwnProperty($2)) { 29714 return ($1 ? $1 : "rgba(") + CSS.Lists.colorNames[$2] + ($1 ? "" : ",1)"); 29715 } 29716 return $1 + $2; 29717 }); 29718 }, 29719 /* Convert any rootPropertyValue, null or otherwise, into a space-delimited list of hook values so that 29720 the targeted hook can be injected or extracted at its standard position. */ 29721 cleanRootPropertyValue: function cleanRootPropertyValue(rootProperty, rootPropertyValue) { 29722 /* If the rootPropertyValue is wrapped with "rgb()", "clip()", etc., remove the wrapping to normalize the value before manipulation. */ 29723 if (CSS.RegEx.valueUnwrap.test(rootPropertyValue)) { 29724 rootPropertyValue = rootPropertyValue.match(CSS.RegEx.valueUnwrap)[1]; 29725 } 29726 29727 /* If rootPropertyValue is a CSS null-value (from which there's inherently no hook value to extract), 29728 default to the root's default value as defined in CSS.Hooks.templates. */ 29729 /* Note: CSS null-values include "none", "auto", and "transparent". They must be converted into their 29730 zero-values (e.g. textShadow: "none" ==> textShadow: "0px 0px 0px black") for hook manipulation to proceed. */ 29731 if (CSS.Values.isCSSNullValue(rootPropertyValue)) { 29732 rootPropertyValue = CSS.Hooks.templates[rootProperty][1]; 29733 } 29734 return rootPropertyValue; 29735 }, 29736 /* Extracted the hook's value from its root property's value. This is used to get the starting value of an animating hook. */ 29737 extractValue: function extractValue(fullHookName, rootPropertyValue) { 29738 var hookData = CSS.Hooks.registered[fullHookName]; 29739 if (hookData) { 29740 var hookRoot = hookData[0], 29741 hookPosition = hookData[1]; 29742 rootPropertyValue = CSS.Hooks.cleanRootPropertyValue(hookRoot, rootPropertyValue); 29743 29744 /* Split rootPropertyValue into its constituent hook values then grab the desired hook at its standard position. */ 29745 return rootPropertyValue.toString().match(CSS.RegEx.valueSplit)[hookPosition]; 29746 } else { 29747 /* If the provided fullHookName isn't a registered hook, return the rootPropertyValue that was passed in. */ 29748 return rootPropertyValue; 29749 } 29750 }, 29751 /* Inject the hook's value into its root property's value. This is used to piece back together the root property 29752 once Velocity has updated one of its individually hooked values through tweening. */ 29753 injectValue: function injectValue(fullHookName, hookValue, rootPropertyValue) { 29754 var hookData = CSS.Hooks.registered[fullHookName]; 29755 if (hookData) { 29756 var hookRoot = hookData[0], 29757 hookPosition = hookData[1], 29758 rootPropertyValueParts, 29759 rootPropertyValueUpdated; 29760 rootPropertyValue = CSS.Hooks.cleanRootPropertyValue(hookRoot, rootPropertyValue); 29761 29762 /* Split rootPropertyValue into its individual hook values, replace the targeted value with hookValue, 29763 then reconstruct the rootPropertyValue string. */ 29764 rootPropertyValueParts = rootPropertyValue.toString().match(CSS.RegEx.valueSplit); 29765 rootPropertyValueParts[hookPosition] = hookValue; 29766 rootPropertyValueUpdated = rootPropertyValueParts.join(" "); 29767 return rootPropertyValueUpdated; 29768 } else { 29769 /* If the provided fullHookName isn't a registered hook, return the rootPropertyValue that was passed in. */ 29770 return rootPropertyValue; 29771 } 29772 } 29773 }, 29774 /******************* 29775 Normalizations 29776 *******************/ 29777 29778 /* Normalizations standardize CSS property manipulation by pollyfilling browser-specific implementations (e.g. opacity) 29779 and reformatting special properties (e.g. clip, rgba) to look like standard ones. */ 29780 Normalizations: { 29781 /* Normalizations are passed a normalization target (either the property's name, its extracted value, or its injected value), 29782 the targeted element (which may need to be queried), and the targeted property value. */ 29783 registered: { 29784 clip: function clip(type, element, propertyValue) { 29785 switch (type) { 29786 case "name": 29787 return "clip"; 29788 /* Clip needs to be unwrapped and stripped of its commas during extraction. */ 29789 case "extract": 29790 var extracted; 29791 29792 /* If Velocity also extracted this value, skip extraction. */ 29793 if (CSS.RegEx.wrappedValueAlreadyExtracted.test(propertyValue)) { 29794 extracted = propertyValue; 29795 } else { 29796 /* Remove the "rect()" wrapper. */ 29797 extracted = propertyValue.toString().match(CSS.RegEx.valueUnwrap); 29798 29799 /* Strip off commas. */ 29800 extracted = extracted ? extracted[1].replace(/,(\s+)?/g, " ") : propertyValue; 29801 } 29802 return extracted; 29803 /* Clip needs to be re-wrapped during injection. */ 29804 case "inject": 29805 return "rect(" + propertyValue + ")"; 29806 } 29807 }, 29808 blur: function blur(type, element, propertyValue) { 29809 switch (type) { 29810 case "name": 29811 return Velocity.State.isFirefox ? "filter" : "-webkit-filter"; 29812 case "extract": 29813 var extracted = parseFloat(propertyValue); 29814 29815 /* If extracted is NaN, meaning the value isn't already extracted. */ 29816 if (!(extracted || extracted === 0)) { 29817 var blurComponent = propertyValue.toString().match(/blur\(([0-9]+[A-z]+)\)/i); 29818 29819 /* If the filter string had a blur component, return just the blur value and unit type. */ 29820 if (blurComponent) { 29821 extracted = blurComponent[1]; 29822 /* If the component doesn't exist, default blur to 0. */ 29823 } else { 29824 extracted = 0; 29825 } 29826 } 29827 return extracted; 29828 /* Blur needs to be re-wrapped during injection. */ 29829 case "inject": 29830 /* For the blur effect to be fully de-applied, it needs to be set to "none" instead of 0. */ 29831 if (!parseFloat(propertyValue)) { 29832 return "none"; 29833 } else { 29834 return "blur(" + propertyValue + ")"; 29835 } 29836 } 29837 }, 29838 /* <=IE8 do not support the standard opacity property. They use filter:alpha(opacity=INT) instead. */ 29839 opacity: function opacity(type, element, propertyValue) { 29840 if (IE <= 8) { 29841 switch (type) { 29842 case "name": 29843 return "filter"; 29844 case "extract": 29845 /* <=IE8 return a "filter" value of "alpha(opacity=\d{1,3})". 29846 Extract the value and convert it to a decimal value to match the standard CSS opacity property's formatting. */ 29847 var extracted = propertyValue.toString().match(/alpha\(opacity=(.*)\)/i); 29848 if (extracted) { 29849 /* Convert to decimal value. */ 29850 propertyValue = extracted[1] / 100; 29851 } else { 29852 /* When extracting opacity, default to 1 since a null value means opacity hasn't been set. */ 29853 propertyValue = 1; 29854 } 29855 return propertyValue; 29856 case "inject": 29857 /* Opacified elements are required to have their zoom property set to a non-zero value. */ 29858 element.style.zoom = 1; 29859 29860 /* Setting the filter property on elements with certain font property combinations can result in a 29861 highly unappealing ultra-bolding effect. There's no way to remedy this throughout a t
29861ween, but dropping the 29862 value altogether (when opacity hits 1) at leasts ensures that the glitch is gone post-tweening. */ 29863 if (parseFloat(propertyValue) >= 1) { 29864 return ""; 29865 } else { 29866 /* As per the filter property's spec, convert the decimal value to a whole number and wrap the value. */ 29867 return "alpha(opacity=" + parseInt(parseFloat(propertyValue) * 100, 10) + ")"; 29868 } 29869 } 29870 /* With all other browsers, normalization is not required; return the same values that were passed in. */ 29871 } else { 29872 switch (type) { 29873 case "name": 29874 return "opacity"; 29875 case "extract": 29876 return propertyValue; 29877 case "inject": 29878 return propertyValue; 29879 } 29880 } 29881 } 29882 }, 29883 /***************************** 29884 Batched Registrations 29885 *****************************/ 29886 29887 /* Note: Batched normalizations extend the CSS.Normalizations.registered object. */ 29888 register: function register() { 29889 /***************** 29890 Transforms 29891 *****************/ 29892 29893 /* Transforms are the subproperties contained by the CSS "transform" property. Transforms must undergo normalization 29894 so that they can be referenced in a properties map by their individual names. */ 29895 /* Note: When transforms are "set", they are actually assigned to a per-element transformCache. When all transform 29896 setting is complete complete, CSS.flushTransformCache() must be manually called to flush the values to the DOM. 29897 Transform setting is batched in this way to improve performance: the transform style only needs to be updated 29898 once when multiple transform subproperties are being animated simultaneously. */ 29899 /* Note: IE9 and Android Gingerbread have support for 2D -- but not 3D -- transforms. Since animating unsupported 29900 transform properties results in the browser ignoring the *entire* transform string, we prevent these 3D values 29901 from being normalized for these browsers so that tweening skips these properties altogether 29902 (since it will ignore them as being unsupported by the browser.) */ 29903 if ((!IE || IE > 9) && !Velocity.State.isGingerbread) { 29904 /* Note: Since the standalone CSS "perspective" property and the CSS transform "perspective" subproperty 29905 share the same name, the latter is given a unique token within Velocity: "transformPerspective". */ 29906 CSS.Lists.transformsBase = CSS.Lists.transformsBase.concat(CSS.Lists.transforms3D); 29907 } 29908 for (var i = 0; i < CSS.Lists.transformsBase.length; i++) { 29909 /* Wrap the dynamically generated normalization function in a new scope so that transformName's value is 29910 paired with its respective function. (Otherwise, all functions would take the final for loop's transformName.) */ 29911 (function () { 29912 var transformName = CSS.Lists.transformsBase[i]; 29913 CSS.Normalizations.registered[transformName] = function (type, element, propertyValue) { 29914 switch (type) { 29915 /* The normalized property name is the parent "transform" property -- the property that is actually set in CSS. */ 29916 case "name": 29917 return "transform"; 29918 /* Transform values are cached onto a per-element transformCache object. */ 29919 case "extract": 29920 /* If this transform has yet to be assigned a value, return its null value. */ 29921 if (Data(element) === undefined || Data(element).transformCache[transformName] === undefined) { 29922 /* Scale CSS.Lists.transformsBase default to 1 whereas all other transform properties default to 0. */ 29923 return /^scale/i.test(transformName) ? 1 : 0; 29924 /* When transform values are set, they are wrapped in parentheses as per the CSS spec. 29925 Thus, when extracting their values (for tween calculations), we strip off the parentheses. */ 29926 } 29927 return Data(element).transformCache[transformName].replace(/[()]/g, ""); 29928 case "inject": 29929 var invalid = false;
vendor: 42,422 bytes, lines 29930-30644
29930 29931 /* If an individual transform property contains an unsupported unit type, the browser ignores the *entire* transform property. 29932 Thus, protect users from themselves by skipping setting for transform values supplied with invalid unit types. */ 29933 /* Switch on the base transform type; ignore the axis by removing the last letter from the transform's name. */ 29934 switch (transformName.substr(0, transformName.length - 1)) { 29935 /* Whitelist unit types for each transform. */ 29936 case "translate": 29937 invalid = !/(%|px|em|rem|vw|vh|\d)$/i.test(propertyValue); 29938 break; 29939 /* Since an axis-free "scale" property is supported as well, a little hack is used here to detect it by chopping off its last letter. */ 29940 case "scal": 29941 case "scale": 29942 /* Chrome on Android has a bug in which scaled elements blur if their initial scale 29943 value is below 1 (which can happen with forcefeeding). Thus, we detect a yet-unset scale property 29944 and ensure that its first value is always 1. More info: http://stackoverflow.com/questions/10417890/css3-animations-with-transform-causes-blurred-elements-on-webkit/10417962#10417962 */ 29945 if (Velocity.State.isAndroid && Data(element).transformCache[transformName] === undefined && propertyValue < 1) { 29946 propertyValue = 1; 29947 } 29948 invalid = !/(\d)$/i.test(propertyValue); 29949 break; 29950 case "skew": 29951 invalid = !/(deg|\d)$/i.test(propertyValue); 29952 break; 29953 case "rotate": 29954 invalid = !/(deg|\d)$/i.test(propertyValue); 29955 break; 29956 } 29957 if (!invalid) { 29958 /* As per the CSS spec, wrap the value in parentheses. */ 29959 Data(element).transformCache[transformName] = "(" + propertyValue + ")"; 29960 } 29961 29962 /* Although the value is set on the transformCache object, return the newly-updated value for the calling code to process as normal. */ 29963 return Data(element).transformCache[transformName]; 29964 } 29965 }; 29966 })(); 29967 } 29968 29969 /************* 29970 Colors 29971 *************/ 29972 29973 /* Since Velocity only animates a single numeric value per property, color animation is achieved by hooking the individual RGBA components of CSS color properties. 29974 Accordingly, color values must be normalized (e.g. "#ff0000", "red", and "rgb(255, 0, 0)" ==> "255 0 0 1") so that their components can be injected/extracted by CSS.Hooks logic. */ 29975 for (var j = 0; j < CSS.Lists.colors.length; j++) { 29976 /* Wrap the dynamically generated normalization function in a new scope so that colorName's value is paired with its respective function. 29977 (Otherwise, all functions would take the final for loop's colorName.) */ 29978 (function () { 29979 var colorName = CSS.Lists.colors[j]; 29980 29981 /* Note: In IE<=8, which support rgb but not rgba, color properties are reverted to rgb by stripping off the alpha component. */ 29982 CSS.Normalizations.registered[colorName] = function (type, element, propertyValue) { 29983 switch (type) { 29984 case "name": 29985 return colorName; 29986 /* Convert all color values into the rgb format. (Old IE can return hex values and color names instead of rgb/rgba.) */ 29987 case "extract": 29988 var extracted; 29989 29990 /* If the color is already in its hookable form (e.g. "255 255 255 1") due to having been previously extracted, skip extraction. */ 29991 if (CSS.RegEx.wrappedValueAlreadyExtracted.test(propertyValue)) { 29992 extracted = propertyValue; 29993 } else { 29994 var converted, 29995 colorNames = { 29996 black: "rgb(0, 0, 0)", 29997 blue: "rgb(0, 0, 255)", 29998 gray: "rgb(128, 128, 128)", 29999 green: "rgb(0, 128, 0)", 30000 red: "rgb(255, 0, 0)", 30001 white: "rgb(255, 255, 255)" 30002 }; 30003 30004 /* Convert color names to rgb. */ 30005 if (/^[A-z]+$/i.test(propertyValue)) { 30006 if (colorNames[propertyValue] !== undefined) { 30007 converted = colorNames[propertyValue]; 30008 } else { 30009 /* If an unmatched color name is provided, default to black. */ 30010 converted = colorNames.black; 30011 } 30012 /* Convert hex values to rgb. */ 30013 } else if (CSS.RegEx.isHex.test(propertyValue)) { 30014 converted = "rgb(" + CSS.Values.hexToRgb(propertyValue).join(" ") + ")"; 30015 /* If the provided color doesn't match any of the accepted color formats, default to black. */ 30016 } else if (!/^rgba?\(/i.test(propertyValue)) { 30017 converted = colorNames.black; 30018 } 30019 30020 /* Remove the surrounding "rgb/rgba()" string then replace commas with spaces and strip 30021 repeated spaces (in case the value included spaces to begin with). */ 30022 extracted = (converted || propertyValue).toString().match(CSS.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g, " "); 30023 } 30024 30025 /* So long as this isn't <=IE8, add a fourth (alpha) component if it's missing and default it to 1 (visible). */ 30026 if ((!IE || IE > 8) && extracted.split(" ").length === 3) { 30027 extracted += " 1"; 30028 } 30029 return extracted; 30030 case "inject": 30031 /* If we have a pattern then it might already have the right values */ 30032 if (/^rgb/.test(propertyValue)) { 30033 return propertyValue; 30034 } 30035 30036 /* If this is IE<=8 and an alpha component exists, strip it off. */ 30037 if (IE <= 8) { 30038 if (propertyValue.split(" ").length === 4) { 30039 propertyValue = propertyValue.split(/\s+/).slice(0, 3).join(" "); 30040 } 30041 /* Otherwise, add a fourth (alpha) component if it's missing and default it to 1 (visible). */ 30042 } else if (propertyValue.split(" ").length === 3) { 30043 propertyValue += " 1"; 30044 } 30045 30046 /* Re-insert the browser-appropriate wrapper("rgb/rgba()"), insert commas, and strip off decimal units 30047 on all values but the fourth (R, G, and B only accept whole numbers). */ 30048 return (IE <= 8 ? "rgb" : "rgba") + "(" + propertyValue.replace(/\s+/g, ",").replace(/\.(\d)+(?=,)/g, "") + ")"; 30049 } 30050 }; 30051 })(); 30052 } 30053 30054 /************** 30055 Dimensions 30056 **************/ 30057 function augmentDimension(name, element, wantInner) { 30058 var isBorderBox = CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() === "border-box"; 30059 if (isBorderBox === (wantInner || false)) { 30060 /* in box-sizing mode, the CSS width / height accessors already give the outerWidth / outerHeight. */ 30061 var i, 30062 value, 30063 augment = 0, 30064 sides = name === "width" ? ["Left", "Right"] : ["Top", "Bottom"], 30065 fields = ["padding" + sides[0], "padding" + sides[1], "border" + sides[0] + "Width", "border" + sides[1] + "Width"]; 30066 for (i = 0; i < fields.length; i++) { 30067 value = parseFloat(CSS.getPropertyValue(element, fields[i])); 30068 if (!isNaN(value)) { 30069 augment += value; 30070 } 30071 } 30072 return wantInner ? -augment : augment; 30073 } 30074 return 0; 30075 } 30076 function getDimension(name, wantInner) { 30077 return function (type, element, propertyValue) { 30078 switch (type) { 30079 case "name": 30080 return name; 30081 case "extract": 30082 return parseFloat(propertyValue) + augmentDimension(name, element, wantInner); 30083 case "inject": 30084 return parseFloat(propertyValue) - augmentDimension(name, element, wantInner) + "px"; 30085 } 30086 }; 30087 } 30088 CSS.Normalizations.registered.innerWidth = getDimension("width", true); 30089 CSS.Normalizations.registered.innerHeight = getDimension("height", true); 30090 CSS.Normalizations.registered.outerWidth = getDimension("width"); 30091 CSS.Normalizations.registered.outerHeight = getDimension("height"); 30092 } 30093 }, 30094 /************************ 30095 CSS Property Names 30096 ************************/ 30097 30098 Names: { 30099 /* Camelcase a property name into its JavaScript notation (e.g. "background-color" ==> "backgroundColor"). 30100 Camelcasing is used to normalize property names between and across calls. */ 30101 camelCase: function camelCase(property) { 30102 return property.replace(/-(\w)/g, function (match, subMatch) { 30103 return subMatch.toUpperCase(); 30104 }); 30105 }, 30106 /* For SVG elements, some properties (namely, dimensional ones) are GET/SET via the element's HTML attributes (instead of via CSS styles). */ 30107 SVGAttribute: function SVGAttribute(property) { 30108 var SVGAttributes = "width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2"; 30109 30110 /* Certain browsers require an SVG transform to be applied as an attribute. (Otherwise, application via CSS is preferable due to 3D support.) */ 30111 if (IE || Velocity.State.isAndroid && !Velocity.State.isChrome) { 30112 SVGAttributes += "|transform"; 30113 } 30114 return new RegExp("^(" + SVGAttributes + ")$", "i").test(property); 30115 }, 30116 /* Determine whether a property should be set with a vendor prefix. */ 30117 /* If a prefixed version of the property exists, return it. Otherwise, return the original property name. 30118 If the property is not at all supported by the browser, return a false flag. */ 30119 prefixCheck: function prefixCheck(property) { 30120 /* If this property has already been checked, return the cached value. */ 30121 if (Velocity.State.prefixMatches[property]) { 30122 return [Velocity.State.prefixMatches[property], true]; 30123 } else { 30124 var vendors = ["", "Webkit", "Moz", "ms", "O"]; 30125 for (var i = 0, vendorsLength = vendors.length; i < vendorsLength; i++) { 30126 var propertyPrefixed; 30127 if (i === 0) { 30128 propertyPrefixed = property; 30129 } else { 30130 /* Capitalize the first letter of the property to conform to JavaScript vendor prefix notation (e.g. webkitFilter). */ 30131 propertyPrefixed = vendors[i] + property.replace(/^\w/, function (match) { 30132 return match.toUpperCase(); 30133 }); 30134 } 30135 30136 /* Check if the browser supports this property as prefixed. */ 30137 if (Type.isString(Velocity.State.prefixElement.style[propertyPrefixed])) { 30138 /* Cache the match. */ 30139 Velocity.State.prefixMatches[property] = propertyPrefixed; 30140 return [propertyPrefixed, true]; 30141 } 30142 } 30143 30144 /* If the browser doesn't support this property in any form, include a false flag so that the caller can decide how to proceed. */ 30145 return [property, false]; 30146 } 30147 } 30148 }, 30149 /************************ 30150 CSS Property Values 30151 ************************/ 30152 30153 Values: { 30154 /* Hex to RGB conversion. Copyright Tim Down: http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb */ 30155 hexToRgb: function hexToRgb(hex) { 30156 var shortformRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, 30157 longformRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, 30158 rgbParts; 30159 hex = hex.replace(shortformRegex, function (m, r, g, b) { 30160 return r + r + g + g + b + b; 30161 }); 30162 rgbParts = longformRegex.exec(hex); 30163 return rgbParts ? [parseInt(rgbParts[1], 16), parseInt(rgbParts[2], 16), parseInt(rgbParts[3], 16)] : [0, 0, 0]; 30164 }, 30165 isCSSNullValue: function isCSSNullValue(value) { 30166 /* The browser defaults CSS values that have not been set to either 0 or one of several possible null-value strings. 30167 Thus, we check for both falsiness and these special strings. */ 30168 /* Null-value checking is performed to default the special strings to 0 (for the sake of tweening) or their hook 30169 templates as defined as CSS.Hooks (for the sake of hook injection/extraction). */ 30170 /* Note: Chrome returns "rgba(0, 0, 0, 0)" for an undefined color whereas IE returns "transparent". */ 30171 return !value || /^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(value); 30172 }, 30173 /* Retrieve a property's default unit type. Used for assigning a unit type when one is not supplied by the user. */ 30174 getUnitType: function getUnitType(property) { 30175 if (/^(rotate|skew)/i.test(property)) { 30176 return "deg"; 30177 } else if (/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(property)) { 30178 /* The above properties are unitless. */ 30179 return ""; 30180 } else { 30181 /* Default to px for all other properties. */ 30182 return "px"; 30183 } 30184 }, 30185 /* HTML elements default to an associated display type when they're not set to display:none. */ 30186 /* Note: This function is used for correctly setting the non-"none" display value in certain Velocity redirects, such as fadeIn/Out. */ 30187 getDisplayType: function getDisplayType(element) { 30188 var tagName = element && element.tagName.toString().toLowerCase(); 30189 if (/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(tagName)) { 30190 return "inline"; 30191 } else if (/^(li)$/i.test(tagName)) { 30192 return "list-item"; 30193 } else if (/^(tr)$/i.test(tagName)) { 30194 return "table-row"; 30195 } else if (/^(table)$/i.test(tagName)) { 30196 return "table"; 30197 } else if (/^(tbody)$/i.test(tagName)) { 30198 return "table-row-group"; 30199 /* Default to "block" when no match is found. */ 30200 } else { 30201 return "block"; 30202 } 30203 }, 30204 /* The class add/remove functions are used to temporarily apply a "velocity-animating" class to elements while they're animating. */ 30205 addClass: function addClass(element, className) { 30206 if (element) { 30207 if (element.classList) { 30208 element.classList.add(className); 30209 } else if (Type.isString(element.className)) { 30210 // Element.className is around 15% faster then set/getAttribute 30211 element.className += (element.className.length ? " " : "") + className; 30212 } else { 30213 // Work around for IE strict mode animating SVG - and anything else that doesn't behave correctly - the same way jQuery does it 30214 var currentClass = element.getAttribute(IE <= 7 ? "className" : "class") || ""; 30215 element.setAttribute("class", currentClass + (currentClass ? " " : "") + className); 30216 } 30217 } 30218 }, 30219 removeClass: function removeClass(element, className) { 30220 if (element) { 30221 if (element.classList) { 30222 element.classList.remove(className); 30223 } else if (Type.isString(element.className)) { 30224 // Element.className is around 15% faster then set/getAttribute 30225 // TODO: Need some jsperf tests on performance - can we get rid of the regex and maybe use split / array manipulation? 30226 element.className = element.className.toString().replace(new RegExp("(^|\\s)" + className.split(" ").join("|") + "(\\s|$)", "gi"), " "); 30227 } else { 30228 // Work around for IE strict mode animating SVG - and anything else that doesn't behave correctly - the same way jQuery does it 30229 var currentClass = element.getAttribute(IE <= 7 ? "className" : "class") || ""; 30230 element.setAttribute("class", currentClass.replace(new RegExp("(^|\s)" + className.split(" ").join("|") + "(\s|$)", "gi"), " ")); 30231 } 30232 } 30233 } 30234 }, 30235 /**************************** 30236 Style Getting & Setting 30237 ****************************/ 30238 30239 /* The singular getPropertyValue, which routes the logic for all normalizations, hooks, and standard CSS properties. */ 30240 getPropertyValue: function getPropertyValue(element, property, rootPropertyValue, forceStyleLookup) { 30241 /* Get an element's computed property value. */ 30242 /* Note: Retrieving the value of a CSS property cannot simply be performed by checking an element's 30243 style attribute (which only reflects user-defined values). Instead, the browser must be queried for a property's 30244 *computed* value. You can read more about getComputedStyle here: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle */ 30245 function computePropertyValue(element, property) { 30246 /* When box-sizing isn't set to border-box, height and width style values are incorrectly computed when an 30247 element's scrollbars are visible (which expands the element's dimensions). Thus, we defer to the more accurate 30248 offsetHeight/Width property, which includes the total dimensions for interior, border, padding, and scrollbar. 30249 We subtract border and padding to get the sum of interior + scrollbar. */ 30250 var computedValue = 0; 30251 30252 /* IE<=8 doesn't support window.getComputedStyle, thus we defer to jQuery, which has an extensive array 30253 of hacks to accurately retrieve IE8 property values. Re-implementing that logic here is not worth bloating the 30254 codebase for a dying browser. The performance repercussions of using jQuery here are minimal since 30255 Velocity is optimized to rarely (and sometimes never) query the DOM. Further, the $.css() codepath isn't that slow. */ 30256 if (IE <= 8) { 30257 computedValue = $.css(element, property); /* GET */ 30258 /* All other browsers support getComputedStyle. The returned live object reference is cached onto its 30259 associated element so that it does not need to be refetched upon every GET. */ 30260 } else { 30261 /* Browsers do not return height and width values for elements that are set to display:"none". Thus, we temporarily 30262 toggle display to the element type's default value. */ 30263 var toggleDisplay = false; 30264 if (/^(width|height)$/.test(property) && CSS.getPropertyValue(element, "display") === 0) { 30265 toggleDisplay = true; 30266 CSS.setPropertyValue(element, "display", CSS.Values.getDisplayType(element)); 30267 } 30268 var revertDisplay = function revertDisplay() { 30269 if (toggleDisplay) { 30270 CSS.setPropertyValue(element, "display", "none"); 30271 } 30272 }; 30273 if (!forceStyleLookup) { 30274 if (property === "height" && CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() !== "border-box") { 30275 var contentBoxHeight = element.offsetHeight - (parseFloat(CSS.getPropertyValue(element, "borderTopWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "borderBottomWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingTop")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingBottom")) || 0); 30276 revertDisplay(); 30277 return contentBoxHeight; 30278 } else if (property === "width" && CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() !== "border-box") { 30279 var contentBoxWidth = element.offsetWidth - (parseFloat(CSS.getPropertyValue(element, "borderLeftWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "borderRightWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingLeft")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingRight")) || 0); 30280 revertDisplay(); 30281 return contentBoxWidth; 30282 } 30283 } 30284 var computedStyle; 30285 30286 /* For elements that Velocity hasn't been called on directly (e.g. when Velocity queries the DOM on behalf 30287 of a parent of an element its animating), perform a direct getComputedStyle lookup since the object isn't cached. */ 30288 if (Data(element) === undefined) { 30289 computedStyle = window.getComputedStyle(element, null); /* GET */ 30290 /* If the computedStyle object has yet to be cached, do so now. */ 30291 } else if (!Data(element).computedStyle) { 30292 computedStyle = Data(element).computedStyle = window.getComputedStyle(element, null); /* GET */ 30293 /* If computedStyle is cached, use it. */ 30294 } else { 30295 computedStyle = Data(element).computedStyle; 30296 } 30297 30298 /* IE and Firefox do not return a value for the generic borderColor -- they only return individual values for each border side's color. 30299 Also, in all browsers, when border colors aren't all the same, a compound value is returned that Velocity isn't setup to parse. 30300 So, as a polyfill for querying individual border side colors, we just return the top border's color and animate all borders from that value. */ 30301 if (property === "borderColor") { 30302 property = "borderTopColor"; 30303 } 30304 30305 /* IE9 has a bug in which the "filter" property must be accessed from computedStyle using the getPropertyValue method 30306 instead of a direct property lookup. The getPropertyValue method is slower than a direct lookup, which is why we avoid it by default. */ 30307 if (IE === 9 && property === "filter") { 30308 computedValue = computedStyle.getPropertyValue(property); /* GET */ 30309 } else { 30310 computedValue = computedStyle[property]; 30311 } 30312 30313 /* Fall back to the property's style value (if defined) when computedValue returns nothing, 30314 which can happen when the element hasn't been painted. */ 30315 if (computedValue === "" || computedValue === null) { 30316 computedValue = element.style[property]; 30317 } 30318 revertDisplay(); 30319 } 30320 30321 /* For top, right, bottom, and left (TRBL) values that are set to "auto" on elements of "fixed" or "absolute" position, 30322 defer to jQuery for converting "auto" to a numeric value. (For elements with a "static" or "relative" position, "auto" has the same 30323 effect as being set to 0, so no conversion is necessary.) */ 30324 /* An example of why numeric conversion is necessary: When an element with "position:absolute" has an untouched "left" 30325 property, which reverts to "auto", left's value is 0 relative to its parent element, but is often non-zero relative 30326 to its *containing* (not parent) element, which is the nearest "position:relative" ancestor or the viewport (and always the viewport in the case of "position:fixed"). */ 30327 if (computedValue === "auto" && /^(top|right|bottom|left)$/i.test(property)) { 30328 var position = computePropertyValue(element, "position"); /* GET */ 30329 30330 /* For absolute positioning, jQuery's $.position() only returns values for top and left; 30331 right and bottom will have their "auto" value reverted to 0. */ 30332 /* Note: A jQuery object must be created here since jQuery doesn't have a low-level alias for $.position(). 30333 Not a big deal since we're currently in a GET batch anyway. */ 30334 if (position === "fixed" || position === "absolute" && /top|left/i.test(property)) { 30335 /* Note: jQuery strips the pixel unit from its returned values; we re-add it here to conform with computePropertyValue's behavior. */ 30336 computedValue = $(element).position()[property] + "px"; /* GET */ 30337 } 30338 } 30339 return computedValue; 30340 } 30341 var propertyValue; 30342 30343 /* If this is a hooked property (e.g. "clipLeft" instead of the root property of "clip"), 30344 extract the hook's value from a normalized rootPropertyValue using CSS.Hooks.extractValue(). */ 30345 if (CSS.Hooks.registered[property]) { 30346 var hook = property, 30347 hookRoot = CSS.Hooks.getRoot(hook); 30348 30349 /* If a cached rootPropertyValue wasn't passed in (which Velocity always attempts to do in order to avoid requerying the DOM), 30350 query the DOM for the root property's value. */ 30351 if (rootPropertyValue === undefined) { 30352 /* Since the browser is now being directly queried, use the official post-prefixing property name for this lookup. */ 30353 rootPropertyValue = CSS.getPropertyValue(element, CSS.Names.prefixCheck(hookRoot)[0]); /* GET */ 30354 } 30355 30356 /* If this root has a normalization registered, peform the associated normalization extraction. */ 30357 if (CSS.Normalizations.registered[hookRoot]) { 30358 rootPropertyValue = CSS.Normalizations.registered[hookRoot]("extract", element, rootPropertyValue); 30359 } 30360 30361 /* Extract the hook's value. */ 30362 propertyValue = CSS.Hooks.extractValue(hook, rootPropertyValue); 30363 30364 /* If this is a normalized property (e.g. "opacity" becomes "filter" in <=IE8) or "translateX" becomes "transform"), 30365 normalize the property's name and value, and handle the special case of transforms. */ 30366 /* Note: Normalizing a property is mutually exclusive from hooking a property since hook-extracted values are strictly 30367 numerical and therefore do not require normalization extraction. */ 30368 } else if (CSS.Normalizations.registered[property]) { 30369 var normalizedPropertyName, normalizedPropertyValue; 30370 normalizedPropertyName = CSS.Normalizations.registered[property]("name", element); 30371 30372 /* Transform values are calculated via normalization extraction (see below), which checks against the element's transformCache. 30373 At no point do transform GETs ever actually query the DOM; initial stylesheet values are never processed. 30374 This is because parsing 3D transform matrices is not always accurate and would bloat our codebase; 30375 thus, normalization extraction defaults initial transform values to their zero-values (e.g. 1 for scaleX and 0 for translateX). */ 30376 if (normalizedPropertyName !== "transform") { 30377 normalizedPropertyValue = computePropertyValue(element, CSS.Names.prefixCheck(normalizedPropertyName)[0]); /* GET */ 30378 30379 /* If the value is a CSS null-value and this property has a hook template, use that zero-value template so that hooks can be extracted from it. */ 30380 if (CSS.Values.isCSSNullValue(normalizedPropertyValue) && CSS.Hooks.templates[property]) { 30381 normalizedPropertyValue = CSS.Hooks.templates[property][1]; 30382 } 30383 } 30384 propertyValue = CSS.Normalizations.registered[property]("extract", element, normalizedPropertyValue); 30385 } 30386 30387 /* If a (numeric) value wasn't produced via hook extraction or normalization, query the DOM. */ 30388 if (!/^[\d-]/.test(propertyValue)) { 30389 /* For SVG elements, dimensional properties (which SVGAttribute() detects) are tweened via 30390 their HTML attribute values instead of their CSS style values. */ 30391 var data = Data(element); 30392 if (data && data.isSVG && CSS.Names.SVGAttribute(property)) { 30393 /* Since the height/width attribute values must be set manually, they don't reflect computed values. 30394 Thus, we use use getBBox() to ensure we always get values for elements with undefined height/width attributes. */ 30395 if (/^(height|width)$/i.test(property)) { 30396 /* Firefox throws an error if .getBBox() is called on an SVG that isn't attached to the DOM. */ 30397 try { 30398 propertyValue = element.getBBox()[property]; 30399 } catch (error) { 30400 propertyValue = 0; 30401 } 30402 /* Otherwise, access the attribute value directly. */ 30403 } else { 30404 propertyValue = element.getAttribute(property); 30405 } 30406 } else { 30407 propertyValue = computePropertyValue(element, CSS.Names.prefixCheck(property)[0]); /* GET */ 30408 } 30409 } 30410 30411 /* Since property lookups are for animation purposes (which entails computing the numeric delta between start and end values), 30412 convert CSS null-values to an integer of value 0. */ 30413 if (CSS.Values.isCSSNullValue(propertyValue)) { 30414 propertyValue = 0; 30415 } 30416 if (Velocity.debug >= 2) { 30417 console.log("Get " + property + ": " + propertyValue); 30418 } 30419 return propertyValue; 30420 }, 30421 /* The singular setPropertyValue, which routes the logic for all normalizations, hooks, and standard CSS properties. */ 30422 setPropertyValue: function setPropertyValue(element, property, propertyValue, rootPropertyValue, scrollData) { 30423 var propertyName = property; 30424 30425 /* In order to be subjected to call options and element queueing, scroll animation is routed through Velocity as if it were a standard CSS property. */ 30426 if (property === "scroll") { 30427 /* If a container option is present, scroll the container instead of the browser window. */ 30428 if (scrollData.container) { 30429 scrollData.container["scroll" + scrollData.direction] = propertyValue; 30430 /* Otherwise, Velocity defaults to scrolling the browser window. */ 30431 } else { 30432 if (scrollData.direction === "Left") { 30433 window.scrollTo(propertyValue, scrollData.alternateValue); 30434 } else { 30435 window.scrollTo(scrollData.alternateValue, propertyValue); 30436 } 30437 } 30438 } else { 30439 /* Transforms (translateX, rotateZ, etc.) are applied to a per-element transformCache object, which is manually flushed via flushTransformCache(). 30440 Thus, for now, we merely cache transforms being SET. */ 30441 if (CSS.Normalizations.registered[property] && CSS.Normalizations.registered[property]("name", element) === "transform") { 30442 /* Perform a normalization injection. */ 30443 /* Note: The normalization logic handles the transformCache updating. */ 30444 CSS.Normalizations.registered[property]("inject", element, propertyValue); 30445 propertyName = "transform"; 30446 propertyValue = Data(element).transformCache[property]; 30447 } else { 30448 /* Inject hooks. */ 30449 if (CSS.Hooks.registered[property]) { 30450 var hookName = property, 30451 hookRoot = CSS.Hooks.getRoot(property); 30452 30453 /* If a cached rootPropertyValue was not provided, query the DOM for the hookRoot's current value. */ 30454 rootPropertyValue = rootPropertyValue || CSS.getPropertyValue(element, hookRoot); /* GET */ 30455 30456 propertyValue = CSS.Hooks.injectValue(hookName, propertyValue, rootPropertyValue); 30457 property = hookRoot; 30458 } 30459 30460 /* Normalize names and values. */ 30461 if (CSS.Normalizations.registered[property]) { 30462 propertyValue = CSS.Normalizations.registered[property]("inject", element, propertyValue); 30463 property = CSS.Normalizations.registered[property]("name", element); 30464 } 30465 30466 /* Assign the appropriate vendor prefix before performing an official style update. */ 30467 propertyName = CSS.Names.prefixCheck(property)[0]; 30468 30469 /* A try/catch is used for IE<=8, which throws an error when "invalid" CSS values are set, e.g. a negative width. 30470 Try/catch is avoided for other browsers since it incurs a performance overhead. */ 30471 if (IE <= 8) { 30472 try { 30473 element.style[propertyName] = propertyValue; 30474 } catch (error) { 30475 if (Velocity.debug) { 30476 console.log("Browser does not support [" + propertyValue + "] for [" + propertyName + "]"); 30477 } 30478 } 30479 /* SVG elements have their dimensional properties (width, height, x, y, cx, etc.) applied directly as attributes instead of as styles. */ 30480 /* Note: IE8 does not support SVG elements, so it's okay that we skip it for SVG animation. */ 30481 } else { 30482 var data = Data(element); 30483 if (data && data.isSVG && CSS.Names.SVGAttribute(property)) { 30484 /* Note: For SVG attributes, vendor-prefixed property names are never used. */ 30485 /* Note: Not all CSS properties can be animated via attributes, but the browser won't throw an error for unsupported properties. */ 30486 element.setAttribute(property, propertyValue); 30487 } else { 30488 element.style[propertyName] = propertyValue; 30489 } 30490 } 30491 if (Velocity.debug >= 2) { 30492 console.log("Set " + property + " (" + propertyName + "): " + propertyValue); 30493 } 30494 } 30495 } 30496 30497 /* Return the normalized property name and value in case the caller wants to know how these values were modified before being applied to the DOM. */ 30498 return [propertyName, propertyValue]; 30499 }, 30500 /* To increase performance by batching transform updates into a single SET, transforms are not directly applied to an element until flushTransformCache() is called. */ 30501 /* Note: Velocity applies transform properties in the same order that they are chronogically introduced to the element's CSS styles. */ 30502 flushTransformCache: function flushTransformCache(element) { 30503 var transformString = "", 30504 data = Data(element); 30505 30506 /* Certain browsers require that SVG transforms be applied as an attribute. However, the SVG transform attribute takes a modified version of CSS's transform string 30507 (units are dropped and, except for skewX/Y, subproperties are merged into their master property -- e.g. scaleX and scaleY are merged into scale(X Y). */ 30508 if ((IE || Velocity.State.isAndroid && !Velocity.State.isChrome) && data && data.isSVG) { 30509 /* Since transform values are stored in their parentheses-wrapped form, we use a helper function to strip out their numeric values. 30510 Further, SVG transform properties only take unitless (representing pixels) values, so it's okay that parseFloat() strips the unit suffixed to the float value. */ 30511 var getTransformFloat = function getTransformFloat(transformProperty) { 30512 return parseFloat(CSS.getPropertyValue(element, transformProperty)); 30513 }; 30514 30515 /* Create an object to organize all the transforms that we'll apply to the SVG element. To keep the logic simple, 30516 we process *all* transform properties -- even those that may not be explicitly applied (since they default to their zero-values anyway). */ 30517 var SVGTransforms = { 30518 translate: [getTransformFloat("translateX"), getTransformFloat("translateY")], 30519 skewX: [getTransformFloat("skewX")], 30520 skewY: [getTransformFloat("skewY")], 30521 /* If the scale property is set (non-1), use that value for the scaleX and scaleY values 30522 (this behavior mimics the result of animating all these properties at once on HTML elements). */ 30523 scale: getTransformFloat("scale") !== 1 ? [getTransformFloat("scale"), getTransformFloat("scale")] : [getTransformFloat("scaleX"), getTransformFloat("scaleY")], 30524 /* Note: SVG's rotate transform takes three values: rotation degrees followed by the X and Y values 30525 defining the rotation's origin point. We ignore the origin values (default them to 0). */ 30526 rotate: [getTransformFloat("rotateZ"), 0, 0] 30527 }; 30528 30529 /* Iterate through the transform properties in the user-defined property map order. 30530 (This mimics the behavior of non-SVG transform animation.) */ 30531 $.each(Data(element).transformCache, function (transformName) { 30532 /* Except for with skewX/Y, revert the axis-specific transform subproperties to their axis-free master 30533 properties so that they match up with SVG's accepted transform properties. */ 30534 if (/^translate/i.test(transformName)) { 30535 transformName = "translate"; 30536 } else if (/^scale/i.test(transformName)) { 30537 transformName = "scale"; 30538 } else if (/^rotate/i.test(transformName)) { 30539 transformName = "rotate"; 30540 } 30541 30542 /* Check that we haven't yet deleted the property from the SVGTransforms container. */ 30543 if (SVGTransforms[transformName]) { 30544 /* Append the transform property in the SVG-supported transform format. As per the spec, surround the space-delimited values in parentheses. */ 30545 transformString += transformName + "(" + SVGTransforms[transformName].join(" ") + ")" + " "; 30546 30547 /* After processing an SVG transform property, delete it from the SVGTransforms container so we don't 30548 re-insert the same master property if we encounter another one of its axis-specific properties. */ 30549 delete SVGTransforms[transformName]; 30550 } 30551 }); 30552 } else { 30553 var transformValue, perspective; 30554 30555 /* Transform properties are stored as members of the transformCache object. Concatenate all the members into a string. */ 30556 $.each(Data(element).transformCache, function (transformName) { 30557 transformValue = Data(element).transformCache[transformName]; 30558 30559 /* Transform's perspective subproperty must be set first in order to take effect. Store it temporarily. */ 30560 if (transformName === "transformPerspective") { 30561 perspective = transformValue; 30562 return true; 30563 } 30564 30565 /* IE9 only supports one rotation type, rotateZ, which it refers to as "rotate". */ 30566 if (IE === 9 && transformName === "rotateZ") { 30567 transformName = "rotate"; 30568 } 30569 transformString += transformName + transformValue + " "; 30570 }); 30571 30572 /* If present, set the perspective subproperty first. */ 30573 if (perspective) { 30574 transformString = "perspective" + perspective + " " + transformString; 30575 } 30576 } 30577 CSS.setPropertyValue(element, "transform", transformString); 30578 } 30579 }; 30580 30581 /* Register hooks and normalizations. */ 30582 CSS.Hooks.register(); 30583 CSS.Normalizations.register(); 30584 30585 /* Allow hook setting in the same fashion as jQuery's $.css(). */ 30586 Velocity.hook = function (elements, arg2, arg3) { 30587 var value; 30588 elements = sanitizeElements(elements); 30589 $.each(elements, function (i, element) { 30590 /* Initialize Velocity's per-element data cache if this element hasn't previously been animated. */ 30591 if (Data(element) === undefined) { 30592 Velocity.init(element); 30593 } 30594 30595 /* Get property value. If an element set was passed in, only return the value for the first element. */ 30596 if (arg3 === undefined) { 30597 if (value === undefined) { 30598 value = CSS.getPropertyValue(element, arg2); 30599 } 30600 /* Set property value. */ 30601 } else { 30602 /* sPV returns an array of the normalized propertyName/propertyValue pair used to update the DOM. */ 30603 var adjustedSet = CSS.setPropertyValue(element, arg2, arg3); 30604 30605 /* Transform properties don't automatically set. They have to be flushed to the DOM. */ 30606 if (adjustedSet[0] === "transform") { 30607 Velocity.CSS.flushTransformCache(element); 30608 } 30609 value = adjustedSet; 30610 } 30611 }); 30612 return value; 30613 }; 30614 30615 /***************** 30616 Animation 30617 *****************/ 30618 30619 var _animate = function animate() { 30620 var opts; 30621 30622 /****************** 30623 Call Chain 30624 ******************/ 30625 30626 /* Logic for determining what to return to the call stack when exiting out of Velocity. */ 30627 function getChain() { 30628 /* If we are using the utility function, attempt to return this call's promise. If no promise library was detected, 30629 default to null instead of returning the targeted elements so that utility function's return value is standardized. */ 30630 if (isUtility) { 30631 return promiseData.promise || null; 30632 /* Otherwise, if we're using $.fn, return the jQuery-/Zepto-wrapped element set. */ 30633 } else { 30634 return elementsWrapped; 30635 } 30636 } 30637 30638 /************************* 30639 Arguments Assignment 30640 *************************/ 30641 30642 /* To allow for expressive CoffeeScript code, Velocity supports an alternative syntax in which "elements" (or "e"), "properties" (or "p"), and "options" (or "o") 30643 objects are defined on a container object that's passed in as Velocity's sole argument. */ 30644 /* Note: Some browsers automatically populate arguments with a "properties" object. We detect it by checking for its default "n
30644ames" property. */ 30645 var syntacticSugar = arguments[0] && (arguments[0].p || $.isPlainObject(arguments[0].properties) && !arguments[0].properties.names || Type.isString(arguments[0].properties)), 30646 /* Whether Velocity was called via the utility function (as opposed to on a jQuery/Zepto object). */ 30647 isUtility, 30648 /* When Velocity is called via the utility function ($.Velocity()/Velocity()), elements are explicitly 30649 passed in as the first parameter. Thus, argument positioning varies. We normalize them here. */ 30650 elementsWrapped, 30651 argumentIndex; 30652 var elements, propertiesMap, options; 30653 30654 /* Detect jQuery/Zepto elements being animated via the $.fn method. */ 30655 if (Type.isWrapped(this)) { 30656 isUtility = false; 30657 argumentIndex = 0; 30658 elements = this; 30659 elementsWrapped = this; 30660 /* Otherwise, raw elements are being animated via the utility function. */ 30661 } else { 30662 isUtility = true; 30663 argumentIndex = 1; 30664 elements = syntacticSugar ? arguments[0].elements || arguments[0].e : arguments[0]; 30665 } 30666 30667 /*************** 30668 Promises 30669 ***************/ 30670 30671 var promiseData = { 30672 promise: null, 30673 resolver: null, 30674 rejecter: null 30675 }; 30676 30677 /* If this call was made via the utility function (which is the default method of invocation when jQuery/Zepto are not being used), and if 30678 promise support was detected, create a promise object for this call and store references to its resolver and rejecter methods. The resolve 30679 method is used when a call completes naturally or is prematurely stopped by the user. In both cases, completeCall() handles the associated 30680 call cleanup and promise resolving logic. The reject method is used when an invalid set of arguments is passed into a Velocity call. */ 30681 /* Note: Velocity employs a call-based queueing architecture, which means that stopping an animating element actually stops the full call that 30682 triggered it -- not that one element exclusively. Similarly, there is one promise per call, and all elements targeted by a Velocity call are 30683 grouped together for the purposes of resolving and rejecting a promise. */ 30684 if (isUtility && Velocity.Promise) { 30685 promiseData.promise = new Velocity.Promise(function (resolve, reject) { 30686 promiseData.resolver = resolve; 30687 promiseData.rejecter = reject; 30688 }); 30689 } 30690 if (syntacticSugar) { 30691 propertiesMap = arguments[0].properties || arguments[0].p; 30692 options = arguments[0].options || arguments[0].o; 30693 } else { 30694 propertiesMap = arguments[argumentIndex]; 30695 options = arguments[argumentIndex + 1]; 30696 } 30697 elements = sanitizeElements(elements); 30698 if (!elements) { 30699 if (promiseData.promise) {
vendor: 58,017 bytes, lines 30700-31743
30700 if (!propertiesMap || !options || options.promiseRejectEmpty !== false) { 30701 promiseData.rejecter(); 30702 } else { 30703 promiseData.resolver(); 30704 } 30705 } 30706 return; 30707 } 30708 30709 /* The length of the element set (in the form of a nodeList or an array of elements) is defaulted to 1 in case a 30710 single raw DOM element is passed in (which doesn't contain a length property). */ 30711 var elementsLength = elements.length, 30712 elementsIndex = 0; 30713 30714 /*************************** 30715 Argument Overloading 30716 ***************************/ 30717 30718 /* Support is included for jQuery's argument overloading: $.animate(propertyMap [, duration] [, easing] [, complete]). 30719 Overloading is detected by checking for the absence of an object being passed into options. */ 30720 /* Note: The stop/finish/pause/resume actions do not accept animation options, and are therefore excluded from this check. */ 30721 if (!/^(stop|finish|finishAll|pause|resume)$/i.test(propertiesMap) && !$.isPlainObject(options)) { 30722 /* The utility function shifts all arguments one position to the right, so we adjust for that offset. */ 30723 var startingArgumentPosition = argumentIndex + 1; 30724 options = {}; 30725 30726 /* Iterate through all options arguments */ 30727 for (var i = startingArgumentPosition; i < arguments.length; i++) { 30728 /* Treat a number as a duration. Parse it out. */ 30729 /* Note: The following RegEx will return true if passed an array with a number as its first item. 30730 Thus, arrays are skipped from this check. */ 30731 if (!Type.isArray(arguments[i]) && (/^(fast|normal|slow)$/i.test(arguments[i]) || /^\d/.test(arguments[i]))) { 30732 options.duration = arguments[i]; 30733 /* Treat strings and arrays as easings. */ 30734 } else if (Type.isString(arguments[i]) || Type.isArray(arguments[i])) { 30735 options.easing = arguments[i]; 30736 /* Treat a function as a complete callback. */ 30737 } else if (Type.isFunction(arguments[i])) { 30738 options.complete = arguments[i]; 30739 } 30740 } 30741 } 30742 30743 /********************* 30744 Action Detection 30745 *********************/ 30746 30747 /* Velocity's behavior is categorized into "actions": Elements can either be specially scrolled into view, 30748 or they can be started, stopped, paused, resumed, or reversed . If a literal or referenced properties map is passed in as Velocity's 30749 first argument, the associated action is "start". Alternatively, "scroll", "reverse", "pause", "resume" or "stop" can be passed in 30750 instead of a properties map. */ 30751 var action; 30752 switch (propertiesMap) { 30753 case "scroll": 30754 action = "scroll"; 30755 break; 30756 case "reverse": 30757 action = "reverse"; 30758 break; 30759 case "pause": 30760 /******************* 30761 Action: Pause 30762 *******************/ 30763 30764 var currentTime = new Date().getTime(); 30765 30766 /* Handle delay timers */ 30767 $.each(elements, function (i, element) { 30768 pauseDelayOnElement(element, currentTime); 30769 }); 30770 30771 /* Pause and Resume are call-wide (not on a per element basis). Thus, calling pause or resume on a 30772 single element will cause any calls that containt tweens for that element to be paused/resumed 30773 as well. */ 30774 30775 /* Iterate through all calls and pause any that contain any of our elements */ 30776 $.each(Velocity.State.calls, function (i, activeCall) { 30777 var found = false; 30778 /* Inactive calls are set to false by the logic inside completeCall(). Skip them. */ 30779 if (activeCall) { 30780 /* Iterate through the active call's targeted elements. */ 30781 $.each(activeCall[1], function (k, activeElement) { 30782 var queueName = options === undefined ? "" : options; 30783 if (queueName !== true && activeCall[2].queue !== queueName && !(options === undefined && activeCall[2].queue === false)) { 30784 return true; 30785 } 30786 30787 /* Iterate through the calls targeted by the stop command. */ 30788 $.each(elements, function (l, element) { 30789 /* Check that this call was applied to the target element. */ 30790 if (element === activeElement) { 30791 /* Set call to paused */ 30792 activeCall[5] = { 30793 resume: false 30794 }; 30795 30796 /* Once we match an element, we can bounce out to the next call entirely */ 30797 found = true; 30798 return false; 30799 } 30800 }); 30801 30802 /* Proceed to check next call if we have already matched */ 30803 if (found) { 30804 return false; 30805 } 30806 }); 30807 } 30808 }); 30809 30810 /* Since pause creates no new tweens, exit out of Velocity. */ 30811 return getChain(); 30812 case "resume": 30813 /******************* 30814 Action: Resume 30815 *******************/ 30816 30817 /* Handle delay timers */ 30818 $.each(elements, function (i, element) { 30819 resumeDelayOnElement(element, currentTime); 30820 }); 30821 30822 /* Pause and Resume are call-wide (not on a per elemnt basis). Thus, calling pause or resume on a 30823 single element will cause any calls that containt tweens for that element to be paused/resumed 30824 as well. */ 30825 30826 /* Iterate through all calls and pause any that contain any of our elements */ 30827 $.each(Velocity.State.calls, function (i, activeCall) { 30828 var found = false; 30829 /* Inactive calls are set to false by the logic inside completeCall(). Skip them. */ 30830 if (activeCall) { 30831 /* Iterate through the active call's targeted elements. */ 30832 $.each(activeCall[1], function (k, activeElement) { 30833 var queueName = options === undefined ? "" : options; 30834 if (queueName !== true && activeCall[2].queue !== queueName && !(options === undefined && activeCall[2].queue === false)) { 30835 return true; 30836 } 30837 30838 /* Skip any calls that have never been paused */ 30839 if (!activeCall[5]) { 30840 return true; 30841 } 30842 30843 /* Iterate through the calls targeted by the stop command. */ 30844 $.each(elements, function (l, element) { 30845 /* Check that this call was applied to the target element. */ 30846 if (element === activeElement) { 30847 /* Flag a pause object to be resumed, which will occur during the next tick. In 30848 addition, the pause object will at that time be deleted */ 30849 activeCall[5].resume = true; 30850 30851 /* Once we match an element, we can bounce out to the next call entirely */ 30852 found = true; 30853 return false; 30854 } 30855 }); 30856 30857 /* Proceed to check next call if we have already matched */ 30858 if (found) { 30859 return false; 30860 } 30861 }); 30862 } 30863 }); 30864 30865 /* Since resume creates no new tweens, exit out of Velocity. */ 30866 return getChain(); 30867 case "finish": 30868 case "finishAll": 30869 case "stop": 30870 /******************* 30871 Action: Stop 30872 *******************/ 30873 30874 /* Clear the currently-active delay on each targeted element. */ 30875 $.each(elements, function (i, element) { 30876 if (Data(element) && Data(element).delayTimer) { 30877 /* Stop the timer from triggering its cached next() function. */ 30878 clearTimeout(Data(element).delayTimer.setTimeout); 30879 30880 /* Manually call the next() function so that the subsequent queue items can progress. */ 30881 if (Data(element).delayTimer.next) { 30882 Data(element).delayTimer.next(); 30883 } 30884 delete Data(element).delayTimer; 30885 } 30886 30887 /* If we want to finish everything in the queue, we have to iterate through it 30888 and call each function. This will make them active calls below, which will 30889 cause them to be applied via the duration setting. */ 30890 if (propertiesMap === "finishAll" && (options === true || Type.isString(options))) { 30891 /* Iterate through the items in the element's queue. */ 30892 $.each($.queue(element, Type.isString(options) ? options : ""), function (_, item) { 30893 /* The queue array can contain an "inprogress" string, which we skip. */ 30894 if (Type.isFunction(item)) { 30895 item(); 30896 } 30897 }); 30898 30899 /* Clearing the $.queue() array is achieved by resetting it to []. */ 30900 $.queue(element, Type.isString(options) ? options : "", []); 30901 } 30902 }); 30903 var callsToStop = []; 30904 30905 /* When the stop action is triggered, the elements' currently active call is immediately stopped. The active call might have 30906 been applied to multiple elements, in which case all of the call's elements will be stopped. When an element 30907 is stopped, the next item in its animation queue is immediately triggered. */ 30908 /* An additional argument may be passed in to clear an element's remaining queued calls. Either true (which defaults to the "fx" queue) 30909 or a custom queue string can be passed in. */ 30910 /* Note: The stop command runs prior to Velocity's Queueing phase since its behavior is intended to take effect *immediately*, 30911 regardless of the element's current queue state. */ 30912 30913 /* Iterate through every active call. */ 30914 $.each(Velocity.State.calls, function (i, activeCall) { 30915 /* Inactive calls are set to false by the logic inside completeCall(). Skip them. */ 30916 if (activeCall) { 30917 /* Iterate through the active call's targeted elements. */ 30918 $.each(activeCall[1], function (k, activeElement) { 30919 /* If true was passed in as a secondary argument, clear absolutely all calls on this element. Otherwise, only 30920 clear calls associated with the relevant queue. */ 30921 /* Call stopping logic works as follows: 30922 - options === true --> stop current default queue calls (and queue:false calls), including remaining queued ones. 30923 - options === undefined --> stop current queue:"" call and all queue:false calls. 30924 - options === false --> stop only queue:false calls. 30925 - options === "custom" --> stop current queue:"custom" call, including remaining queued ones (there is no functionality to only clear the currently-running queue:"custom" call). */ 30926 var queueName = options === undefined ? "" : options; 30927 if (queueName !== true && activeCall[2].queue !== queueName && !(options === undefined && activeCall[2].queue === false)) { 30928 return true; 30929 } 30930 30931 /* Iterate through the calls targeted by the stop command. */ 30932 $.each(elements, function (l, element) { 30933 /* Check that this call was applied to the target element. */ 30934 if (element === activeElement) { 30935 /* Optionally clear the remaining queued calls. If we're doing "finishAll" this won't find anything, 30936 due to the queue-clearing above. */ 30937 if (options === true || Type.isString(options)) { 30938 /* Iterate through the items in the element's queue. */ 30939 $.each($.queue(element, Type.isString(options) ? options : ""), function (_, item) { 30940 /* The queue array can contain an "inprogress" string, which we skip. */ 30941 if (Type.isFunction(item)) { 30942 /* Pass the item's callback a flag indicating that we want to abort from the queue call. 30943 (Specifically, the queue will resolve the call's associated promise then abort.) */ 30944 item(null, true); 30945 } 30946 }); 30947 30948 /* Clearing the $.queue() array is achieved by resetting it to []. */ 30949 $.queue(element, Type.isString(options) ? options : "", []); 30950 } 30951 if (propertiesMap === "stop") { 30952 /* Since "reverse" uses cached start values (the previous call's endValues), these values must be 30953 changed to reflect the final value that the elements were actually tweened to. */ 30954 /* Note: If only queue:false/queue:"custom" animations are currently running on an element, it won't have a tweensContainer 30955 object. Also, queue:false/queue:"custom" animations can't be reversed. */ 30956 var data = Data(element); 30957 if (data && data.tweensContainer && (queueName === true || queueName === "")) { 30958 $.each(data.tweensContainer, function (m, activeTween) { 30959 activeTween.endValue = activeTween.currentValue; 30960 }); 30961 } 30962 callsToStop.push(i); 30963 } else if (propertiesMap === "finish" || propertiesMap === "finishAll") { 30964 /* To get active tweens to finish immediately, we forcefully shorten their durations to 1ms so that 30965 they finish upon the next rAf tick then proceed with normal call completion logic. */ 30966 activeCall[2].duration = 1; 30967 } 30968 } 30969 }); 30970 }); 30971 } 30972 }); 30973 30974 /* Prematurely call completeCall() on each matched active call. Pass an additional flag for "stop" to indicate 30975 that the complete callback and display:none setting should be skipped since we're completing prematurely. */ 30976 if (propertiesMap === "stop") { 30977 $.each(callsToStop, function (i, j) { 30978 completeCall(j, true); 30979 }); 30980 if (promiseData.promise) { 30981 /* Immediately resolve the promise associated with this stop call since stop runs synchronously. */ 30982 promiseData.resolver(elements); 30983 } 30984 } 30985 30986 /* Since we're stopping, and not proceeding with queueing, exit out of Velocity. */ 30987 return getChain(); 30988 default: 30989 /* Treat a non-empty plain object as a literal properties map. */ 30990 if ($.isPlainObject(propertiesMap) && !Type.isEmptyObject(propertiesMap)) { 30991 action = "start"; 30992 30993 /**************** 30994 Redirects 30995 ****************/ 30996 30997 /* Check if a string matches a registered redirect (see Redirects above). */ 30998 } else if (Type.isString(propertiesMap) && Velocity.Redirects[propertiesMap]) { 30999 opts = $.extend({}, options); 31000 var durationOriginal = opts.duration, 31001 delayOriginal = opts.delay || 0; 31002 31003 /* If the backwards option was passed in, reverse the element set so that elements animate from the last to the first. */ 31004 if (opts.backwards === true) { 31005 elements = $.extend(true, [], elements).reverse(); 31006 } 31007 31008 /* Individually trigger the redirect for each element in the set to prevent users from having to handle iteration logic in their redirect. */ 31009 $.each(elements, function (elementIndex, element) { 31010 /* If the stagger option was passed in, successively delay each element by the stagger value (in ms). Retain the original delay value. */ 31011 if (parseFloat(opts.stagger)) { 31012 opts.delay = delayOriginal + parseFloat(opts.stagger) * elementIndex; 31013 } else if (Type.isFunction(opts.stagger)) { 31014 opts.delay = delayOriginal + opts.stagger.call(element, elementIndex, elementsLength); 31015 } 31016 31017 /* If the drag option was passed in, successively increase/decrease (depending on the presense of opts.backwards) 31018 the duration of each element's animation, using floors to prevent producing very short durations. */ 31019 if (opts.drag) { 31020 /* Default the duration of UI pack effects (callouts and transitions) to 1000ms instead of the usual default duration of 400ms. */ 31021 opts.duration = parseFloat(durationOriginal) || (/^(callout|transition)/.test(propertiesMap) ? 1000 : DURATION_DEFAULT); 31022 31023 /* For each element, take the greater duration of: A) animation completion percentage relative to the original duration, 31024 B) 75% of the original duration, or C) a 200ms fallback (in case duration is already set to a low value). 31025 The end result is a baseline of 75% of the redirect's duration that increases/decreases as the end of the element set is approached. */ 31026 opts.duration = Math.max(opts.duration * (opts.backwards ? 1 - elementIndex / elementsLength : (elementIndex + 1) / elementsLength), opts.duration * 0.75, 200); 31027 } 31028 31029 /* Pass in the call's opts object so that the redirect can optionally extend it. It defaults to an empty object instead of null to 31030 reduce the opts checking logic required inside the redirect. */ 31031 Velocity.Redirects[propertiesMap].call(element, element, opts || {}, elementIndex, elementsLength, elements, promiseData.promise ? promiseData : undefined); 31032 }); 31033 31034 /* Since the animation logic resides within the redirect's own code, abort the remainder of this call. 31035 (The performance overhead up to this point is virtually non-existant.) */ 31036 /* Note: The jQuery call chain is kept intact by returning the complete element set. */ 31037 return getChain(); 31038 } else { 31039 var abortError = "Velocity: First argument (" + propertiesMap + ") was not a property map, a known action, or a registered redirect. Aborting."; 31040 if (promiseData.promise) { 31041 promiseData.rejecter(new Error(abortError)); 31042 } else if (window.console) { 31043 console.log(abortError); 31044 } 31045 return getChain(); 31046 } 31047 } 31048 31049 /************************** 31050 Call-Wide Variables 31051 **************************/ 31052 31053 /* A container for CSS unit conversion ratios (e.g. %, rem, and em ==> px) that is used to cache ratios across all elements 31054 being animated in a single Velocity call. Calculating unit ratios necessitates DOM querying and updating, and is therefore 31055 avoided (via caching) wherever possible. This container is call-wide instead of page-wide to avoid the risk of using stale 31056 conversion metrics across Velocity animations that are not immediately consecutively chained. */ 31057 var callUnitConversionData = { 31058 lastParent: null, 31059 lastPosition: null, 31060 lastFontSize: null, 31061 lastPercentToPxWidth: null, 31062 lastPercentToPxHeight: null, 31063 lastEmToPx: null, 31064 remToPx: null, 31065 vwToPx: null, 31066 vhToPx: null 31067 }; 31068 31069 /* A container for all the ensuing tween data and metadata associated with this call. This container gets pushed to the page-wide 31070 Velocity.State.calls array that is processed during animation ticking. */ 31071 var call = []; 31072 31073 /************************ 31074 Element Processing 31075 ************************/ 31076 31077 /* Element processing consists of three parts -- data processing that cannot go stale and data processing that *can* go stale (i.e. third-party style modifications): 31078 1) Pre-Queueing: Element-wide variables, including the element's data storage, are instantiated. Call options are prepared. If triggered, the Stop action is executed. 31079 2) Queueing: The logic that runs once this call has reached its point of execution in the element's $.queue() stack. Most logic is placed here to avoid risking it becoming stale. 31080 3) Pushing: Consolidation of the tween data followed by its push onto the global in-progress calls container. 31081 `elementArrayIndex` allows passing index of the element in the original array to value functions. 31082 If `elementsIndex` were used instead the index would be determined by the elements' per-element queue. 31083 */ 31084 function processElement(element, elementArrayIndex) { 31085 /************************* 31086 Part I: Pre-Queueing 31087 *************************/ 31088 31089 /*************************** 31090 Element-Wide Variables 31091 ***************************/ 31092 31093 var /* The runtime opts object is the extension of the current call's options and Velocity's page-wide option defaults. */ 31094 opts = $.extend({}, Velocity.defaults, options), 31095 /* A container for the processed data associated with each property in the propertyMap. 31096 (Each property in the map produces its own "tween".) */ 31097 tweensContainer = {}, 31098 elementUnitConversionData; 31099 31100 /****************** 31101 Element Init 31102 ******************/ 31103 31104 if (Data(element) === undefined) { 31105 Velocity.init(element); 31106 } 31107 31108 /****************** 31109 Option: Delay 31110 ******************/ 31111 31112 /* Since queue:false doesn't respect the item's existing queue, we avoid injecting its delay here (it's set later on). */ 31113 /* Note: Velocity rolls its own delay function since jQuery doesn't have a utility alias for $.fn.delay() 31114 (and thus requires jQuery element creation, which we avoid since its overhead includes DOM querying). */ 31115 if (parseFloat(opts.delay) && opts.queue !== false) { 31116 $.queue(element, opts.queue, function (next, clearQueue) { 31117 if (clearQueue === true) { 31118 /* Do not continue with animation queueing. */ 31119 return true; 31120 } 31121 31122 /* This is a flag used to indicate to the upcoming completeCall() function that this queue entry was initiated by Velocity. See completeCall() for further details. */ 31123 Velocity.velocityQueueEntryFlag = true; 31124 31125 /* The ensuing queue item (which is assigned to the "next" argument that $.queue() automatically passes in) will be triggered after a setTimeout delay. 31126 The setTimeout is stored so that it can be subjected to clearTimeout() if this animation is prematurely stopped via Velocity's "stop" command, and 31127 delayBegin/delayTime is used to ensure we can "pause" and "resume" a tween that is still mid-delay. */ 31128 31129 /* Temporarily store delayed elements to facilite access for global pause/resume */ 31130 var callIndex = Velocity.State.delayedElements.count++; 31131 Velocity.State.delayedElements[callIndex] = element; 31132 var delayComplete = function (index) { 31133 return function () { 31134 /* Clear the temporary element */ 31135 Velocity.State.delayedElements[index] = false; 31136 31137 /* Finally, issue the call */ 31138 next(); 31139 }; 31140 }(callIndex); 31141 Data(element).delayBegin = new Date().getTime(); 31142 Data(element).delay = parseFloat(opts.delay); 31143 Data(element).delayTimer = { 31144 setTimeout: setTimeout(next, parseFloat(opts.delay)), 31145 next: delayComplete 31146 }; 31147 }); 31148 } 31149 31150 /********************* 31151 Option: Duration 31152 *********************/ 31153 31154 /* Support for jQuery's named durations. */ 31155 switch (opts.duration.toString().toLowerCase()) { 31156 case "fast": 31157 opts.duration = 200; 31158 break; 31159 case "normal": 31160 opts.duration = DURATION_DEFAULT; 31161 break; 31162 case "slow": 31163 opts.duration = 600; 31164 break; 31165 default: 31166 /* Remove the potential "ms" suffix and default to 1 if the user is attempting to set a duration of 0 (in order to produce an immediate style change). */ 31167 opts.duration = parseFloat(opts.duration) || 1; 31168 } 31169 31170 /************************ 31171 Global Option: Mock 31172 ************************/ 31173 31174 if (Velocity.mock !== false) { 31175 /* In mock mode, all animations are forced to 1ms so that they occur immediately upon the next rAF tick. 31176 Alternatively, a multiplier can be passed in to time remap all delays and durations. */ 31177 if (Velocity.mock === true) { 31178 opts.duration = opts.delay = 1; 31179 } else { 31180 opts.duration *= parseFloat(Velocity.mock) || 1; 31181 opts.delay *= parseFloat(Velocity.mock) || 1; 31182 } 31183 } 31184 31185 /******************* 31186 Option: Easing 31187 *******************/ 31188 31189 opts.easing = getEasing(opts.easing, opts.duration); 31190 31191 /********************** 31192 Option: Callbacks 31193 **********************/ 31194 31195 /* Callbacks must functions. Otherwise, default to null. */ 31196 if (opts.begin && !Type.isFunction(opts.begin)) { 31197 opts.begin = null; 31198 } 31199 if (opts.progress && !Type.isFunction(opts.progress)) { 31200 opts.progress = null; 31201 } 31202 if (opts.complete && !Type.isFunction(opts.complete)) { 31203 opts.complete = null; 31204 } 31205 31206 /********************************* 31207 Option: Display & Visibility 31208 *********************************/ 31209 31210 /* Refer to Velocity's documentation (VelocityJS.org/#displayAndVisibility) for a description of the display and visibility options' behavior. */ 31211 /* Note: We strictly check for undefined instead of falsiness because display accepts an empty string value. */ 31212 if (opts.display !== undefined && opts.display !== null) { 31213 opts.display = opts.display.toString().toLowerCase(); 31214 31215 /* Users can pass in a special "auto" value to instruct Velocity to set the element to its default display value. */ 31216 if (opts.display === "auto") { 31217 opts.display = Velocity.CSS.Values.getDisplayType(element); 31218 } 31219 } 31220 if (opts.visibility !== undefined && opts.visibility !== null) { 31221 opts.visibility = opts.visibility.toString().toLowerCase(); 31222 } 31223 31224 /********************** 31225 Option: mobileHA 31226 **********************/ 31227 31228 /* When set to true, and if this is a mobile device, mobileHA automatically enables hardware acceleration (via a null transform hack) 31229 on animating elements. HA is removed from the element at the completion of its animation. */ 31230 /* Note: Android Gingerbread doesn't support HA. If a null transform hack (mobileHA) is in fact set, it will prevent other tranform subproperties from taking effect. */ 31231 /* Note: You can read more about the use of mobileHA in Velocity's documentation: VelocityJS.org/#mobileHA. */ 31232 opts.mobileHA = opts.mobileHA && Velocity.State.isMobile && !Velocity.State.isGingerbread; 31233 31234 /*********************** 31235 Part II: Queueing 31236 ***********************/ 31237 31238 /* When a set of elements is targeted by a Velocity call, the set is broken up and each element has the current Velocity call individually queued onto it. 31239 In this way, each element's existing queue is respected; some elements may already be animating and accordingly should not have this current Velocity call triggered immediately. */ 31240 /* In each queue, tween data is processed for each animating property then pushed onto the call-wide calls array. When the last element in the set has had its tweens processed, 31241 the call array is pushed to Velocity.State.calls for live processing by the requestAnimationFrame tick. */ 31242 function buildQueue(next) { 31243 var data, lastTweensContainer; 31244 31245 /******************* 31246 Option: Begin 31247 *******************/ 31248 31249 /* The begin callback is fired once per call -- not once per elemenet -- and is passed the full raw DOM element set as both its context and its first argument. */ 31250 if (opts.begin && elementsIndex === 0) { 31251 /* We throw callbacks in a setTimeout so that thrown errors don't halt the execution of Velocity itself. */ 31252 try { 31253 opts.begin.call(elements, elements); 31254 } catch (error) { 31255 setTimeout(function () { 31256 throw error; 31257 }, 1); 31258 } 31259 } 31260 31261 /***************************************** 31262 Tween Data Construction (for Scroll) 31263 *****************************************/ 31264 31265 /* Note: In order to be subjected to chaining and animation options, scroll's tweening is routed through Velocity as if it were a standard CSS property animation. */ 31266 if (action === "scroll") { 31267 /* The scroll action uniquely takes an optional "offset" option -- specified in pixels -- that offsets the targeted scroll position. */ 31268 var scrollDirection = /^x$/i.test(opts.axis) ? "Left" : "Top", 31269 scrollOffset = parseFloat(opts.offset) || 0, 31270 scrollPositionCurrent, 31271 scrollPositionCurrentAlternate, 31272 scrollPositionEnd; 31273 31274 /* Scroll also uniquely takes an optional "container" option, which indicates the parent element that should be scrolled -- 31275 as opposed to the browser window itself. This is useful for scrolling toward an element that's inside an overflowing parent element. */ 31276 if (opts.container) { 31277 /* Ensure that either a jQuery object or a raw DOM element was passed in. */ 31278 if (Type.isWrapped(opts.container) || Type.isNode(opts.container)) { 31279 /* Extract the raw DOM element from the jQuery wrapper. */ 31280 opts.container = opts.container[0] || opts.container; 31281 /* Note: Unlike other properties in Velocity, the browser's scroll position is never cached since it so frequently changes 31282 (due to the user's natural interaction with the page). */ 31283 scrollPositionCurrent = opts.container["scroll" + scrollDirection]; /* GET */ 31284 31285 /* $.position() values are relative to the container's currently viewable area (without taking into account the container's true dimensions 31286 -- say, for example, if the container was not overflowing). Thus, the scroll end value is the sum of the child element's position *and* 31287 the scroll container's current scroll position. */ 31288 scrollPositionEnd = scrollPositionCurrent + $(element).position()[scrollDirection.toLowerCase()] + scrollOffset; /* GET */ 31289 /* If a value other than a jQuery object or a raw DOM element was passed in, default to null so that this option is ignored. */ 31290 } else { 31291 opts.container = null; 31292 } 31293 } else { 31294 /* If the window itself is being scrolled -- not a containing element -- perform a live scroll position lookup using 31295 the appropriate cached property names (which differ based on browser type). */ 31296 scrollPositionCurrent = Velocity.State.scrollAnchor[Velocity.State["scrollProperty" + scrollDirection]]; /* GET */ 31297 /* When scrolling the browser window, cache the alternate axis's current value since window.scrollTo() doesn't let us change only one value at a time. */ 31298 scrollPositionCurrentAlternate = Velocity.State.scrollAnchor[Velocity.State["scrollProperty" + (scrollDirection === "Left" ? "Top" : "Left")]]; /* GET */ 31299 31300 /* Unlike $.position(), $.offset() values are relative to the browser window's true dimensions -- not merely its currently viewable area -- 31301 and therefore end values do not need to be compounded onto current values. */ 31302 scrollPositionEnd = $(element).offset()[scrollDirection.toLowerCase()] + scrollOffset; /* GET */ 31303 } 31304 31305 /* Since there's only one format that scroll's associated tweensContainer can take, we create it manually. */ 31306 tweensContainer = { 31307 scroll: { 31308 rootPropertyValue: false, 31309 startValue: scrollPositionCurrent, 31310 currentValue: scrollPositionCurrent, 31311 endValue: scrollPositionEnd, 31312 unitType: "", 31313 easing: opts.easing, 31314 scrollData: { 31315 container: opts.container, 31316 direction: scrollDirection, 31317 alternateValue: scrollPositionCurrentAlternate 31318 } 31319 }, 31320 element: element 31321 }; 31322 if (Velocity.debug) { 31323 console.log("tweensContainer (scroll): ", tweensContainer.scroll, element); 31324 } 31325 31326 /****************************************** 31327 Tween Data Construction (for Reverse) 31328 ******************************************/ 31329 31330 /* Reverse acts like a "start" action in that a property map is animated toward. The only difference is 31331 that the property map used for reverse is the inverse of the map used in the previous call. Thus, we manipulate 31332 the previous call to construct our new map: use the previous map's end values as our new map's start values. Copy over all other data. */ 31333 /* Note: Reverse can be directly called via the "reverse" parameter, or it can be indirectly triggered via the loop option. (Loops are composed of multiple reverses.) */ 31334 /* Note: Reverse calls do not need to be consecutively chained onto a currently-animating element in order to operate on cached values; 31335 there is no harm to reverse being called on a potentially stale data cache since reverse's behavior is simply defined 31336 as reverting to the element's values as they were prior to the previous *Velocity* call. */ 31337 } else if (action === "reverse") { 31338 data = Data(element); 31339 31340 /* Abort if there is no prior animation data to reverse to. */ 31341 if (!data) { 31342 return; 31343 } 31344 if (!data.tweensContainer) { 31345 /* Dequeue the element so that this queue entry releases itself immediately, allowing subsequent queue entries to run. */ 31346 $.dequeue(element, opts.queue); 31347 return; 31348 } else { 31349 /********************* 31350 Options Parsing 31351 *********************/ 31352 31353 /* If the element was hidden via the display option in the previous call, 31354 revert display to "auto" prior to reversal so that the element is visible again. */ 31355 if (data.opts.display === "none") { 31356 data.opts.display = "auto"; 31357 } 31358 if (data.opts.visibility === "hidden") { 31359 data.opts.visibility = "visible"; 31360 } 31361 31362 /* If the loop option was set in the previous call, disable it so that "reverse" calls aren't recursively generated. 31363 Further, remove the previous call's callback options; typically, users do not want these to be refired. */ 31364 data.opts.loop = false; 31365 data.opts.begin = null; 31366 data.opts.complete = null; 31367 31368 /* Since we're extending an opts object that has already been extended with the defaults options object, 31369 we remove non-explicitly-defined properties that are auto-assigned values. */ 31370 if (!options.easing) { 31371 delete opts.easing; 31372 } 31373 if (!options.duration) { 31374 delete opts.duration; 31375 } 31376 31377 /* The opts object used for reversal is an extension of the options object optionally passed into this 31378 reverse call plus the options used in the previous Velocity call. */ 31379 opts = $.extend({}, data.opts, opts); 31380 31381 /************************************* 31382 Tweens Container Reconstruction 31383 *************************************/ 31384 31385 /* Create a deepy copy (indicated via the true flag) of the previous call's tweensContainer. */ 31386 lastTweensContainer = $.extend(true, {}, data ? data.tweensContainer : null); 31387 31388 /* Manipulate the previous tweensContainer by replacing its end values and currentValues with its start values. */ 31389 for (var lastTween in lastTweensContainer) { 31390 /* In addition to tween data, tweensContainers contain an element property that we ignore here. */ 31391 if (lastTweensContainer.hasOwnProperty(lastTween) && lastTween !== "element") { 31392 var lastStartValue = lastTweensContainer[lastTween].startValue; 31393 lastTweensContainer[lastTween].startValue = lastTweensContainer[lastTween].currentValue = lastTweensContainer[lastTween].endValue; 31394 lastTweensContainer[lastTween].endValue = lastStartValue; 31395 31396 /* Easing is the only option that embeds into the individual tween data (since it can be defined on a per-property basis). 31397 Accordingly, every property's easing value must be updated when an options object is passed in with a reverse call. 31398 The side effect of this extensibility is that all per-property easing values are forcefully reset to the new value. */ 31399 if (!Type.isEmptyObject(options)) { 31400 lastTweensContainer[lastTween].easing = opts.easing; 31401 } 31402 if (Velocity.debug) { 31403 console.log("reverse tweensContainer (" + lastTween + "): " + JSON.stringify(lastTweensContainer[lastTween]), element); 31404 } 31405 } 31406 } 31407 tweensContainer = lastTweensContainer; 31408 } 31409 31410 /***************************************** 31411 Tween Data Construction (for Start) 31412 *****************************************/ 31413 } else if (action === "start") { 31414 /************************* 31415 Value Transferring 31416 *************************/ 31417 31418 /* If this queue entry follows a previous Velocity-initiated queue entry *and* if this entry was created 31419 while the element was in the process of being animated by Velocity, then this current call is safe to use 31420 the end values from the prior call as its start values. Velocity attempts to perform this value transfer 31421 process whenever possible in order to avoid requerying the DOM. */ 31422 /* If values aren't transferred from a prior call and start values were not forcefed by the user (more on this below), 31423 then the DOM is queried for the element's current values as a last resort. */ 31424 /* Note: Conversely, animation reversal (and looping) *always* perform inter-call value transfers; they never requery the DOM. */ 31425 31426 data = Data(element); 31427 31428 /* The per-element isAnimating flag is used to indicate whether it's safe (i.e. the data isn't stale) 31429 to transfer over end values to use as start values. If it's set to true and there is a previous 31430 Velocity call to pull values from, do so. */ 31431 if (data && data.tweensContainer && data.isAnimating === true) { 31432 lastTweensContainer = data.tweensContainer; 31433 } 31434 31435 /*************************** 31436 Tween Data Calculation 31437 ***************************/ 31438 31439 /* This function parses property data and defaults endValue, easing, and startValue as appropriate. */ 31440 /* Property map values can either take the form of 1) a single value representing the end value, 31441 or 2) an array in the form of [ endValue, [, easing] [, startValue] ]. 31442 The optional third parameter is a forcefed startValue to be used instead of querying the DOM for 31443 the element's current value. Read Velocity's docmentation to learn more about forcefeeding: VelocityJS.org/#forcefeeding */ 31444 var parsePropertyValue = function parsePropertyValue(valueData, skipResolvingEasing) { 31445 var endValue, easing, startValue; 31446 31447 /* If we have a function as the main argument then resolve it first, in case it returns an array that needs to be split */ 31448 if (Type.isFunction(valueData)) { 31449 valueData = valueData.call(element, elementArrayIndex, elementsLength); 31450 } 31451 31452 /* Handle the array format, which can be structured as one of three potential overloads: 31453 A) [ endValue, easing, startValue ], B) [ endValue, easing ], or C) [ endValue, startValue ] */ 31454 if (Type.isArray(valueData)) { 31455 /* endValue is always the first item in the array. Don't bother validating endValue's value now 31456 since the ensuing property cycling logic does that. */ 31457 endValue = valueData[0]; 31458 31459 /* Two-item array format: If the second item is a number, function, or hex string, treat it as a 31460 start value since easings can only be non-hex strings or arrays. */ 31461 if (!Type.isArray(valueData[1]) && /^[\d-]/.test(valueData[1]) || Type.isFunction(valueData[1]) || CSS.RegEx.isHex.test(valueData[1])) { 31462 startValue = valueData[1]; 31463 /* Two or three-item array: If the second item is a non-hex string easing name or an array, treat it as an easing. */ 31464 } else if (Type.isString(valueData[1]) && !CSS.RegEx.isHex.test(valueData[1]) && Velocity.Easings[valueData[1]] || Type.isArray(valueData[1])) { 31465 easing = skipResolvingEasing ? valueData[1] : getEasing(valueData[1], opts.duration); 31466 31467 /* Don't bother validating startValue's value now since the ensuing property cycling logic inherently does that. */ 31468 startValue = valueData[2]; 31469 } else { 31470 startValue = valueData[1] || valueData[2]; 31471 } 31472 /* Handle the single-value format. */ 31473 } else { 31474 endValue = valueData; 31475 } 31476 31477 /* Default to the call's easing if a per-property easing type was not defined. */ 31478 if (!skipResolvingEasing) { 31479 easing = easing || opts.easing; 31480 } 31481 31482 /* If functions were passed in as values, pass the function the current element as its context, 31483 plus the element's index and the element set's size as arguments. Then, assign the returned value. */ 31484 if (Type.isFunction(endValue)) { 31485 endValue = endValue.call(element, elementArrayIndex, elementsLength); 31486 } 31487 if (Type.isFunction(startValue)) { 31488 startValue = startValue.call(element, elementArrayIndex, elementsLength); 31489 } 31490 31491 /* Allow startValue to be left as undefined to indicate to the ensuing code that its value was not forcefed. */ 31492 return [endValue || 0, easing, startValue]; 31493 }; 31494 var fixPropertyValue = function fixPropertyValue(property, valueData) { 31495 /* In case this property is a hook, there are circumstances where we will intend to work on the hook's root property and not the hooked subproperty. */ 31496 var rootProperty = CSS.Hooks.getRoot(property), 31497 rootPropertyValue = false, 31498 /* Parse out endValue, easing, and startValue from the property's data. */ 31499 endValue = valueData[0], 31500 easing = valueData[1], 31501 startValue = valueData[2], 31502 pattern; 31503 31504 /************************** 31505 Start Value Sourcing 31506 **************************/ 31507 31508 /* Other than for the dummy tween property, properties that are not supported by the browser (and do not have an associated normalization) will 31509 inherently produce no style changes when set, so they are skipped in order to decrease animation tick overhead. 31510 Property support is determined via prefixCheck(), which returns a false flag when no supported is detected. */ 31511 /* Note: Since SVG elements have some of their properties directly applied as HTML attributes, 31512 there is no way to check for their explicit browser support, and so we skip skip this check for them. */ 31513 if ((!data || !data.isSVG) && rootProperty !== "tween" && CSS.Names.prefixCheck(rootProperty)[1] === false && CSS.Normalizations.registered[rootProperty] === undefined) { 31514 if (Velocity.debug) { 31515 console.log("Skipping [" + rootProperty + "] due to a lack of browser support."); 31516 } 31517 return; 31518 } 31519 31520 /* If the display option is being set to a non-"none" (e.g. "block") and opacity (filter on IE<=8) is being 31521 animated to an endValue of non-zero, the user's intention is to fade in from invisible, thus we forcefeed opacity 31522 a startValue of 0 if its startValue hasn't already been sourced by value transferring or prior forcefeeding. */ 31523 if ((opts.display !== undefined && opts.display !== null && opts.display !== "none" || opts.visibility !== undefined && opts.visibility !== "hidden") && /opacity|filter/.test(property) && !startValue && endValue !== 0) { 31524 startValue = 0; 31525 } 31526 31527 /* If values have been transferred from the previous Velocity call, extract the endValue and rootPropertyValue 31528 for all of the current call's properties that were *also* animated in the previous call. */ 31529 /* Note: Value transferring can optionally be disabled by the user via the _cacheValues option. */ 31530 if (opts._cacheValues && lastTweensContainer && lastTweensContainer[property]) { 31531 if (startValue === undefined) { 31532 startValue = lastTweensContainer[property].endValue + lastTweensContainer[property].unitType; 31533 } 31534 31535 /* The previous call's rootPropertyValue is extracted from the element's data cache since that's the 31536 instance of rootPropertyValue that gets freshly updated by the tweening process, whereas the rootPropertyValue 31537 attached to the incoming lastTweensContainer is equal to the root property's value prior to any tweening. */ 31538 rootPropertyValue = data.rootPropertyValueCache[rootProperty]; 31539 /* If values were not transferred from a previous Velocity call, query the DOM as needed. */ 31540 } else { 31541 /* Handle hooked properties. */ 31542 if (CSS.Hooks.registered[property]) { 31543 if (startValue === undefined) { 31544 rootPropertyValue = CSS.getPropertyValue(element, rootProperty); /* GET */ 31545 /* Note: The following getPropertyValue() call does not actually trigger a DOM query; 31546 getPropertyValue() will extract the hook from rootPropertyValue. */ 31547 startValue = CSS.getPropertyValue(element, property, rootPropertyValue); 31548 /* If startValue is already defined via forcefeeding, do not query the DOM for the root property's value; 31549 just grab rootProperty's zero-value template from CSS.Hooks. This overwrites the element's actual 31550 root property value (if one is set), but this is acceptable since the primary reason users forcefeed is 31551 to avoid DOM queries, and thus we likewise avoid querying the DOM for the root property's value. */ 31552 } else { 31553 /* Grab this hook's zero-value template, e.g. "0px 0px 0px black". */ 31554 rootPropertyValue = CSS.Hooks.templates[rootProperty][1]; 31555 } 31556 /* Handle non-hooked properties that haven't already been defined via forcefeeding. */ 31557 } else if (startValue === undefined) { 31558 startValue = CSS.getPropertyValue(element, property); /* GET */ 31559 } 31560 } 31561 31562 /************************** 31563 Value Data Extraction 31564 **************************/ 31565 31566 var separatedValue, 31567 endValueUnitType, 31568 startValueUnitType, 31569 operator = false; 31570 31571 /* Separates a property value into its numeric value and its unit type. */ 31572 var separateValue = function separateValue(property, value) { 31573 var unitType, numericValue; 31574 numericValue = (value || "0").toString().toLowerCase() 31575 /* Match the unit type at the end of the value. */.replace(/[%A-z]+$/, function (match) { 31576 /* Grab the unit type. */ 31577 unitType = match; 31578 31579 /* Strip the unit type off of value. */ 31580 return ""; 31581 }); 31582 31583 /* If no unit type was supplied, assign one that is appropriate for this property (e.g. "deg" for rotateZ or "px" for width). */ 31584 if (!unitType) { 31585 unitType = CSS.Values.getUnitType(property); 31586 } 31587 return [numericValue, unitType]; 31588 }; 31589 if (startValue !== endValue && Type.isString(startValue) && Type.isString(endValue)) { 31590 pattern = ""; 31591 var iStart = 0, 31592 // index in startValue 31593 iEnd = 0, 31594 // index in endValue 31595 aStart = [], 31596 // array of startValue numbers 31597 aEnd = [], 31598 // array of endValue numbers 31599 inCalc = 0, 31600 // Keep track of being inside a "calc()" so we don't duplicate it 31601 inRGB = 0, 31602 // Keep track of being inside an RGB as we can't use fractional values 31603 inRGBA = 0; // Keep track of being inside an RGBA as we must pass fractional for the alpha channel 31604 31605 startValue = CSS.Hooks.fixColors(startValue); 31606 endValue = CSS.Hooks.fixColors(endValue); 31607 while (iStart < startValue.length && iEnd < endValue.length) { 31608 var cStart = startValue[iStart], 31609 cEnd = endValue[iEnd]; 31610 if (/[\d\.-]/.test(cStart) && /[\d\.-]/.test(cEnd)) { 31611 var tStart = cStart, 31612 // temporary character buffer 31613 tEnd = cEnd, 31614 // temporary character buffer 31615 dotStart = ".", 31616 // Make sure we can only ever match a single dot in a decimal 31617 dotEnd = "."; // Make sure we can only ever match a single dot in a decimal 31618 31619 while (++iStart < startValue.length) { 31620 cStart = startValue[iStart]; 31621 if (cStart === dotStart) { 31622 dotStart = ".."; // Can never match two characters 31623 } else if (!/\d/.test(cStart)) { 31624 break; 31625 } 31626 tStart += cStart; 31627 } 31628 while (++iEnd < endValue.length) { 31629 cEnd = endValue[iEnd]; 31630 if (cEnd === dotEnd) { 31631 dotEnd = ".."; // Can never match two characters 31632 } else if (!/\d/.test(cEnd)) { 31633 break; 31634 } 31635 tEnd += cEnd; 31636 } 31637 var uStart = CSS.Hooks.getUnit(startValue, iStart), 31638 // temporary unit type 31639 uEnd = CSS.Hooks.getUnit(endValue, iEnd); // temporary unit type 31640 31641 iStart += uStart.length; 31642 iEnd += uEnd.length; 31643 if (uStart === uEnd) { 31644 // Same units 31645 if (tStart === tEnd) { 31646 // Same numbers, so just copy over 31647 pattern += tStart + uStart; 31648 } else { 31649 // Different numbers, so store them 31650 pattern += "{" + aStart.length + (inRGB ? "!" : "") + "}" + uStart; 31651 aStart.push(parseFloat(tStart)); 31652 aEnd.push(parseFloat(tEnd)); 31653 } 31654 } else { 31655 // Different units, so put into a "calc(from + to)" and animate each side to/from zero 31656 var nStart = parseFloat(tStart), 31657 nEnd = parseFloat(tEnd); 31658 pattern += (inCalc < 5 ? "calc" : "") + "(" + (nStart ? "{" + aStart.length + (inRGB ? "!" : "") + "}" : "0") + uStart + " + " + (nEnd ? "{" + (aStart.length + (nStart ? 1 : 0)) + (inRGB ? "!" : "") + "}" : "0") + uEnd + ")"; 31659 if (nStart) { 31660 aStart.push(nStart); 31661 aEnd.push(0); 31662 } 31663 if (nEnd) { 31664 aStart.push(0); 31665 aEnd.push(nEnd); 31666 } 31667 } 31668 } else if (cStart === cEnd) { 31669 pattern += cStart; 31670 iStart++; 31671 iEnd++; 31672 // Keep track of being inside a calc() 31673 if (inCalc === 0 && cStart === "c" || inCalc === 1 && cStart === "a" || inCalc === 2 && cStart === "l" || inCalc === 3 && cStart === "c" || inCalc >= 4 && cStart === "(") { 31674 inCalc++; 31675 } else if (inCalc && inCalc < 5 || inCalc >= 4 && cStart === ")" && --inCalc < 5) { 31676 inCalc = 0; 31677 } 31678 // Keep track of being inside an rgb() / rgba() 31679 if (inRGB === 0 && cStart === "r" || inRGB === 1 && cStart === "g" || inRGB === 2 && cStart === "b" || inRGB === 3 && cStart === "a" || inRGB >= 3 && cStart === "(") { 31680 if (inRGB === 3 && cStart === "a") { 31681 inRGBA = 1; 31682 } 31683 inRGB++; 31684 } else if (inRGBA && cStart === ",") { 31685 if (++inRGBA > 3) { 31686 inRGB = inRGBA = 0; 31687 } 31688 } else if (inRGBA && inRGB < (inRGBA ? 5 : 4) || inRGB >= (inRGBA ? 4 : 3) && cStart === ")" && --inRGB < (inRGBA ? 5 : 4)) { 31689 inRGB = inRGBA = 0; 31690 } 31691 } else { 31692 inCalc = 0; 31693 // TODO: changing units, fixing colours 31694 break; 31695 } 31696 } 31697 if (iStart !== startValue.length || iEnd !== endValue.length) { 31698 if (Velocity.debug) { 31699 console.error("Trying to pattern match mis-matched strings [\"" + endValue + "\", \"" + startValue + "\"]"); 31700 } 31701 pattern = undefined; 31702 } 31703 if (pattern) { 31704 if (aStart.length) { 31705 if (Velocity.debug) { 31706 console.log("Pattern found \"" + pattern + "\" -> ", aStart, aEnd, "[" + startValue + "," + endValue + "]"); 31707 } 31708 startValue = aStart; 31709 endValue = aEnd; 31710 endValueUnitType = startValueUnitType = ""; 31711 } else { 31712 pattern = undefined; 31713 } 31714 } 31715 } 31716 if (!pattern) { 31717 /* Separate startValue. */ 31718 separatedValue = separateValue(property, startValue); 31719 startValue = separatedValue[0]; 31720 startValueUnitType = separatedValue[1]; 31721 31722 /* Separate endValue, and extract a value operator (e.g. "+=", "-=") if one exists. */ 31723 separatedValue = separateValue(property, endValue); 31724 endValue = separatedValue[0].replace(/^([+-\/*])=/, function (match, subMatch) { 31725 operator = subMatch; 31726 31727 /* Strip the operator off of the value. */ 31728 return ""; 31729 }); 31730 endValueUnitType = separatedValue[1]; 31731 31732 /* Parse float values from endValue and startValue. Default to 0 if NaN is returned. */ 31733 startValue = parseFloat(startValue) || 0; 31734 endValue = parseFloat(endValue) || 0; 31735 31736 /*************************************** 31737 Property-Specific Value Conversion 31738 ***************************************/ 31739 31740 /* Custom support for properties that don't actually accept the % unit type, but where pollyfilling is trivial and relatively foolproof. */ 31741 if (endValueUnitType === "%") { 31742 /* A %-value fontSize/lineHeight is relative to the parent's fontSize (as opposed to the parent's dimensions), 31743 which is identical to the em unit's behavior, so we pigg
31743yback off of that. */ 31744 if (/^(fontSize|lineHeight)$/.test(property)) { 31745 /* Convert % into an em decimal value. */ 31746 endValue = endValue / 100; 31747 endValueUnitType = "em"; 31748 /* For scaleX and scaleY, convert the value into its decimal format and strip off the unit type. */ 31749 } else if (/^scale/.test(property)) { 31750 endValue = endValue / 100; 31751 endValueUnitType = ""; 31752 /* For RGB components, take the defined percentage of 255 and strip off the unit type. */ 31753 } else if (/(Red|Green|Blue)$/i.test(property)) { 31754 endValue = endValue / 100 * 255; 31755 endValueUnitType = ""; 31756 } 31757 } 31758 } 31759 31760 /*************************** 31761 Unit Ratio Calculation 31762 ***************************/ 31763 31764 /* When queried, the browser returns (most) CSS property values in pixels. Therefore, if an endValue with a unit type of 31765 %, em, or rem is animated toward, startValue must be converted from pixels into the same unit type as endValue in order 31766 for value manipulation logic (increment/decrement) to proceed. Further, if the startValue was forcefed or transferred 31767 from a previous call, startValue may also not be in pixels. Unit conversion logic therefore consists of two steps: 31768 1) Calculating the ratio of %/em/rem/vh/vw relative to pixels 31769 2) Converting startValue into the same unit of measurement as endValue based on these ratios. */ 31770 /* Unit conversion ratios are calculated by inserting a sibling node next to the target node, copying over its position property, 31771 setting values with the target unit type then comparing the returned pixel value. */ 31772 /* Note: Even if only one of these unit types is being animated, all unit ratios are calculated at once since the overhead 31773 of batching the SETs and GETs together upfront outweights the potential overhead 31774 of layout thrashing caused by re-querying for uncalculated ratios for subsequently-processed properties. */ 31775 /* Todo: Shift this logic into the calls' first tick instance so that it's synced with RAF. */ 31776 var calculateUnitRatios = function calculateUnitRatios() { 31777 /************************ 31778 Same Ratio Checks 31779 ************************/ 31780 31781 /* The properties below are used to determine whether the element differs sufficiently from this call's 31782 previously iterated element to also differ in its unit conversion ratios. If the properties match up with those 31783 of the prior element, the prior element's conversion ratios are used. Like most optimizations in Velocity, 31784 this is done to minimize DOM querying. */ 31785 var sameRatioIndicators = { 31786 myParent: element.parentNode || document.body, 31787 /* GET */ 31788 position: CSS.getPropertyValue(element, "position"), 31789 /* GET */ 31790 fontSize: CSS.getPropertyValue(element, "fontSize") /* GET */ 31791 }, 31792 /* Determine if the same % ratio can be used. % is based on the element's position value and its parent's width and height dimensions. */ 31793 samePercentRatio = sameRatioIndicators.position === callUnitConversionData.lastPosition && sameRatioIndicators.myParent === callUnitConversionData.lastParent, 31794 /* Determine if the same em ratio can be used. em is relative to the element's fontSize. */ 31795 sameEmRatio = sameRatioIndicators.fontSize === callUnitConversionData.lastFontSize; 31796 31797 /* Store these ratio indicators call-wide for the next element to compare against. */ 31798 callUnitConversionData.lastParent = sameRatioIndicators.myParent; 31799 callUnitConversionData.lastPosition = sameRatioIndicators.position; 31800 callUnitConversionData.lastFontSize = sameRatioIndicators.fontSize; 31801 31802 /*************************** 31803 Element-Specific Units 31804 ***************************/ 31805 31806 /* Note: IE8 rounds to the nearest pixel when returning CSS values, thus we perform conversions using a measurement 31807 of 100 (instead of 1) to give our ratios a precision of at least 2 decimal values. */ 31808 var measurement = 100, 31809 unitRatios = {}; 31810 if (!sameEmRatio || !samePercentRatio) { 31811 var dummy = data && data.isSVG ? document.createElementNS("http://www.w3.org/2000/svg", "rect") : document.createElement("div"); 31812 Velocity.init(dummy); 31813 sameRatioIndicators.myParent.appendChild(dummy); 31814 31815 /* To accurately and consistently calculate conversion ratios, the element's cascaded overflow and box-sizing are stripped. 31816 Similarly, since width/height can be artificially constrained by their min-/max- equivalents, these are controlled for as well. */
vendor: 4,360 bytes, lines 31817-31878
31817 /* Note: Overflow must be also be controlled for per-axis since the overflow property overwrites its per-axis values. */ 31818 $.each(["overflow", "overflowX", "overflowY"], function (i, property) { 31819 Velocity.CSS.setPropertyValue(dummy, property, "hidden"); 31820 }); 31821 Velocity.CSS.setPropertyValue(dummy, "position", sameRatioIndicators.position); 31822 Velocity.CSS.setPropertyValue(dummy, "fontSize", sameRatioIndicators.fontSize); 31823 Velocity.CSS.setPropertyValue(dummy, "boxSizing", "content-box"); 31824 31825 /* width and height act as our proxy properties for measuring the horizontal and vertical % ratios. */ 31826 $.each(["minWidth", "maxWidth", "width", "minHeight", "maxHeight", "height"], function (i, property) { 31827 Velocity.CSS.setPropertyValue(dummy, property, measurement + "%"); 31828 }); 31829 /* paddingLeft arbitrarily acts as our proxy property for the em ratio. */ 31830 Velocity.CSS.setPropertyValue(dummy, "paddingLeft", measurement + "em"); 31831 31832 /* Divide the returned value by the measurement to get the ratio between 1% and 1px. Default to 1 since working with 0 can produce Infinite. */ 31833 unitRatios.percentToPxWidth = callUnitConversionData.lastPercentToPxWidth = (parseFloat(CSS.getPropertyValue(dummy, "width", null, true)) || 1) / measurement; /* GET */ 31834 unitRatios.percentToPxHeight = callUnitConversionData.lastPercentToPxHeight = (parseFloat(CSS.getPropertyValue(dummy, "height", null, true)) || 1) / measurement; /* GET */ 31835 unitRatios.emToPx = callUnitConversionData.lastEmToPx = (parseFloat(CSS.getPropertyValue(dummy, "paddingLeft")) || 1) / measurement; /* GET */ 31836 31837 sameRatioIndicators.myParent.removeChild(dummy); 31838 } else { 31839 unitRatios.emToPx = callUnitConversionData.lastEmToPx; 31840 unitRatios.percentToPxWidth = callUnitConversionData.lastPercentToPxWidth; 31841 unitRatios.percentToPxHeight = callUnitConversionData.lastPercentToPxHeight; 31842 } 31843 31844 /*************************** 31845 Element-Agnostic Units 31846 ***************************/ 31847 31848 /* Whereas % and em ratios are determined on a per-element basis, the rem unit only needs to be checked 31849 once per call since it's exclusively dependant upon document.body's fontSize. If this is the first time 31850 that calculateUnitRatios() is being run during this call, remToPx will still be set to its default value of null, 31851 so we calculate it now. */ 31852 if (callUnitConversionData.remToPx === null) { 31853 /* Default to browsers' default fontSize of 16px in the case of 0. */ 31854 callUnitConversionData.remToPx = parseFloat(CSS.getPropertyValue(document.body, "fontSize")) || 16; /* GET */ 31855 } 31856 31857 /* Similarly, viewport units are %-relative to the window's inner dimensions. */ 31858 if (callUnitConversionData.vwToPx === null) { 31859 callUnitConversionData.vwToPx = parseFloat(window.innerWidth) / 100; /* GET */ 31860 callUnitConversionData.vhToPx = parseFloat(window.innerHeight) / 100; /* GET */ 31861 } 31862 unitRatios.remToPx = callUnitConversionData.remToPx; 31863 unitRatios.vwToPx = callUnitConversionData.vwToPx; 31864 unitRatios.vhToPx = callUnitConversionData.vhToPx; 31865 if (Velocity.debug >= 1) { 31866 console.log("Unit ratios: " + JSON.stringify(unitRatios), element); 31867 } 31868 return unitRatios; 31869 }; 31870 31871 /******************** 31872 Unit Conversion 31873 ********************/ 31874 31875 /* The * and / operators, which are not passed in with an associated unit, inherently use startValue's unit. Skip value and unit conversion. */ 31876 if (/[\/*]/.test(operator)) { 31877 endValueUnitType = startValueUnitType; 31878 /* If startValue and endValue differ in unit type, convert startValue into the same unit type as endValue so that if endValueUnitType
31879 is a relative unit (%, em, rem), the values set during tweening will continue to be accurately relative even if the metrics they depend 31880 on are dynamically changing during the course of the animation. Conversely, if we always normalized into px and used px for setting values, the px ratio 31881 would become stale if the original unit being animated toward was relative and the underlying metrics change during the animation. */ 31882 /* Since 0 is 0 in any unit type, no conversion is necessary when startValue is 0 -- we just start at 0 with endValueUnitType. */ 31883 } else if (startValueUnitType !== endValueUnitType && startValue !== 0) { 31884 /* Unit conversion is also skipped when endValue is 0, but *startValueUnitType* must be used for tween values to remain accurate. */ 31885 /* Note: Skipping unit conversion here means that if endValueUnitType was originally a relative unit, the animation won't relatively 31886 match the underlying metrics if they change, but this is acceptable since we're animating toward invisibility instead of toward visibility, 31887 which remains past the point of the animation's completion. */ 31888 if (endValue === 0) { 31889 endValueUnitType = startValueUnitType; 31890 } else { 31891 /* By this point, we cannot avoid unit conversion (it's undesirable since it causes layout thrashing). 31892 If we haven't already, we trigger calculateUnitRatios(), which runs once per element per call. */ 31893 elementUnitConversionData = elementUnitConversionData || calculateUnitRatios(); 31894 31895 /* The following RegEx matches CSS properties that have their % values measured relative to the x-axis. */ 31896 /* Note: W3C spec mandates that all of margin and padding's properties (even top and bottom) are %-relative to the *width* of the parent element. */ 31897 var axis = /margin|padding|left|right|width|text|word|letter/i.test(property) || /X$/.test(property) || property === "x" ? "x" : "y"; 31898 31899 /* In order to avoid generating n^2 bespoke conversion functions, unit conversion is a two-step process: 31900 1) Convert startValue into pixels. 2) Convert this new pixel value into endValue's unit type. */ 31901 switch (startValueUnitType) { 31902 case "%": 31903 /* Note: translateX and translateY are the only properties that are %-relative to an element's own dimensions -- not its parent's dimensions. 31904 Velocity does not include a special conversion process to account for this behavior. Therefore, animating translateX/Y from a % value 31905 to a non-% value will produce an incorrect start value. Fortunately, this sort of cross-unit conversion is rarely done by users in practice. */ 31906 startValue *= axis === "x" ? elementUnitConversionData.percentToPxWidth : elementUnitConversionData.percentToPxHeight; 31907 break; 31908 case "px": 31909 /* px acts as our midpoint in the unit conversion process; do nothing. */ 31910 break; 31911 default: 31912 startValue *= elementUnitConversionData[startValueUnitType + "ToPx"]; 31913 } 31914 31915 /* Invert the px ratios to convert into to the target unit. */ 31916 switch (endValueUnitType) { 31917 case "%": 31918 startValue *= 1 / (axis === "x" ? elementUnitConversionData.percentToPxWidth : elementUnitConversionData.percentToPxHeight); 31919 break; 31920 case "px": 31921 /* startValue is already in px, do nothing; we're done. */ 31922 break; 31923 default: 31924 startValue *= 1 / elementUnitConversionData[endValueUnitType + "ToPx"]; 31925 } 31926 } 31927 } 31928 31929 /********************* 31930 Relative Values 31931 *********************/ 31932 31933 /* Operator logic must be performed last since it requires unit-normalized start and end values. */ 31934 /* Note: Relative *percent values* do not behave how most people think; while one would expect "+=50%" 31935 to increase the property 1.5x its current value, it in fact increases the percent units in absolute terms: 31936 50 points is added on top of the current % value. */ 31937 switch (operator) { 31938 case "+": 31939 endValue = startValue + endValue; 31940 break; 31941 case "-": 31942 endValue = startValue - endValue; 31943 break; 31944 case "*": 31945 endValue = startValue * endValue; 31946 break; 31947 case "/": 31948 endValue = startValue / endValue; 31949 break; 31950 } 31951 31952 /************************** 31953 tweensContainer Push 31954 **************************/ 31955 31956 /* Construct the per-property tween object, and push it to the element's tweensContainer. */ 31957 tweensContainer[property] = { 31958 rootPropertyValue: rootPropertyValue, 31959 startValue: startValue, 31960 currentValue: startValue, 31961 endValue: endValue, 31962 unitType: endValueUnitType, 31963 easing: easing 31964 }; 31965 if (pattern) { 31966 tweensContainer[property].pattern = pattern; 31967 } 31968 if (Velocity.debug) { 31969 console.log("tweensContainer (" + property + "): " + JSON.stringify(tweensContainer[property]), element); 31970 } 31971 }; 31972 31973 /* Create a tween out of each property, and append its associated data to tweensContainer. */ 31974 for (var property in propertiesMap) { 31975 if (!propertiesMap.hasOwnProperty(property)) { 31976 continue; 31977 } 31978 /* The original property name's format must be used for the parsePropertyValue() lookup, 31979 but we then use its camelCase styling to normalize it for manipulation. */
vendor: 25,727 bytes, lines 31980-32455
31980 var propertyName = CSS.Names.camelCase(property), 31981 valueData = parsePropertyValue(propertiesMap[property]); 31982 31983 /* Find shorthand color properties that have been passed a hex string. */ 31984 /* Would be quicker to use CSS.Lists.colors.includes() if possible */ 31985 if (_inArray(CSS.Lists.colors, propertyName)) { 31986 /* Parse the value data for each shorthand. */ 31987 var endValue = valueData[0], 31988 easing = valueData[1], 31989 startValue = valueData[2]; 31990 if (CSS.RegEx.isHex.test(endValue)) { 31991 /* Convert the hex strings into their RGB component arrays. */ 31992 var colorComponents = ["Red", "Green", "Blue"], 31993 endValueRGB = CSS.Values.hexToRgb(endValue), 31994 startValueRGB = startValue ? CSS.Values.hexToRgb(startValue) : undefined; 31995 31996 /* Inject the RGB component tweens into propertiesMap. */ 31997 for (var i = 0; i < colorComponents.length; i++) { 31998 var dataArray = [endValueRGB[i]]; 31999 if (easing) { 32000 dataArray.push(easing); 32001 } 32002 if (startValueRGB !== undefined) { 32003 dataArray.push(startValueRGB[i]); 32004 } 32005 fixPropertyValue(propertyName + colorComponents[i], dataArray); 32006 } 32007 /* If we have replaced a shortcut color value then don't update the standard property name */ 32008 continue; 32009 } 32010 } 32011 fixPropertyValue(propertyName, valueData); 32012 } 32013 32014 /* Along with its property data, store a reference to the element itself onto tweensContainer. */ 32015 tweensContainer.element = element; 32016 } 32017 32018 /***************** 32019 Call Push 32020 *****************/ 32021 32022 /* Note: tweensContainer can be empty if all of the properties in this call's property map were skipped due to not 32023 being supported by the browser. The element property is used for checking that the tweensContainer has been appended to. */ 32024 if (tweensContainer.element) { 32025 /* Apply the "velocity-animating" indicator class. */ 32026 CSS.Values.addClass(element, "velocity-animating"); 32027 32028 /* The call array houses the tweensContainers for each element being animated in the current call. */ 32029 call.push(tweensContainer); 32030 data = Data(element); 32031 if (data) { 32032 /* Store the tweensContainer and options if we're working on the default effects queue, so that they can be used by the reverse command. */ 32033 if (opts.queue === "") { 32034 data.tweensContainer = tweensContainer; 32035 data.opts = opts; 32036 } 32037 32038 /* Switch on the element's animating flag. */ 32039 data.isAnimating = true; 32040 } 32041 32042 /* Once the final element in this call's element set has been processed, push the call array onto 32043 Velocity.State.calls for the animation tick to immediately begin processing. */ 32044 if (elementsIndex === elementsLength - 1) { 32045 /* Add the current call plus its associated metadata (the element set and the call's options) onto the global call container. 32046 Anything on this call container is subjected to tick() processing. */ 32047 Velocity.State.calls.push([call, elements, opts, null, promiseData.resolver, null, 0]); 32048 32049 /* If the animation tick isn't running, start it. (Velocity shuts it off when there are no active calls to process.) */ 32050 if (Velocity.State.isTicking === false) { 32051 Velocity.State.isTicking = true; 32052 32053 /* Start the tick loop. */ 32054 tick(); 32055 } 32056 } else { 32057 elementsIndex++; 32058 } 32059 } 32060 } 32061 32062 /* When the queue option is set to false, the call skips the element's queue and fires immediately. */ 32063 if (opts.queue === false) { 32064 /* Since this buildQueue call doesn't respect the element's existing queue (which is where a delay option would have been appended), 32065 we manually inject the delay property here with an explicit setTimeout. */ 32066 if (opts.delay) { 32067 /* Temporarily store delayed elements to facilitate access for global pause/resume */ 32068 var callIndex = Velocity.State.delayedElements.count++; 32069 Velocity.State.delayedElements[callIndex] = element; 32070 var delayComplete = function (index) { 32071 return function () { 32072 /* Clear the temporary element */ 32073 Velocity.State.delayedElements[index] = false; 32074 32075 /* Finally, issue the call */ 32076 buildQueue(); 32077 }; 32078 }(callIndex); 32079 Data(element).delayBegin = new Date().getTime(); 32080 Data(element).delay = parseFloat(opts.delay); 32081 Data(element).delayTimer = { 32082 setTimeout: setTimeout(buildQueue, parseFloat(opts.delay)), 32083 next: delayComplete 32084 }; 32085 } else { 32086 buildQueue(); 32087 } 32088 /* Otherwise, the call undergoes element queueing as normal. */ 32089 /* Note: To interoperate with jQuery, Velocity uses jQuery's own $.queue() stack for queuing logic. */ 32090 } else { 32091 $.queue(element, opts.queue, function (next, clearQueue) { 32092 /* If the clearQueue flag was passed in by the stop command, resolve this call's promise. (Promises can only be resolved once, 32093 so it's fine if this is repeatedly triggered for each element in the associated call.) */ 32094 if (clearQueue === true) { 32095 if (promiseData.promise) { 32096 promiseData.resolver(elements); 32097 } 32098 32099 /* Do not continue with animation queueing. */ 32100 return true; 32101 } 32102 32103 /* This flag indicates to the upcoming completeCall() function that this queue entry was initiated by Velocity. 32104 See completeCall() for further details. */ 32105 Velocity.velocityQueueEntryFlag = true; 32106 buildQueue(next); 32107 }); 32108 } 32109 32110 /********************* 32111 Auto-Dequeuing 32112 *********************/ 32113 32114 /* As per jQuery's $.queue() behavior, to fire the first non-custom-queue entry on an element, the element 32115 must be dequeued if its queue stack consists *solely* of the current call. (This can be determined by checking 32116 for the "inprogress" item that jQuery prepends to active queue stack arrays.) Regardless, whenever the element's 32117 queue is further appended with additional items -- including $.delay()'s or even $.animate() calls, the queue's 32118 first entry is automatically fired. This behavior contrasts that of custom queues, which never auto-fire. */ 32119 /* Note: When an element set is being subjected to a non-parallel Velocity call, the animation will not begin until 32120 each one of the elements in the set has reached the end of its individually pre-existing queue chain. */ 32121 /* Note: Unfortunately, most people don't fully grasp jQuery's powerful, yet quirky, $.queue() function. 32122 Lean more here: http://stackoverflow.com/questions/1058158/can-somebody-explain-jquery-queue-to-me */ 32123 if ((opts.queue === "" || opts.queue === "fx") && $.queue(element)[0] !== "inprogress") { 32124 $.dequeue(element); 32125 } 32126 } 32127 32128 /************************** 32129 Element Set Iteration 32130 **************************/ 32131 32132 /* If the "nodeType" property exists on the elements variable, we're animating a single element. 32133 Place it in an array so that $.each() can iterate over it. */ 32134 $.each(elements, function (i, element) { 32135 /* Ensure each element in a set has a nodeType (is a real element) to avoid throwing errors. */ 32136 if (Type.isNode(element)) { 32137 processElement(element, i); 32138 } 32139 }); 32140 32141 /****************** 32142 Option: Loop 32143 ******************/ 32144 32145 /* The loop option accepts an integer indicating how many times the element should loop between the values in the 32146 current call's properties map and the element's property values prior to this call. */ 32147 /* Note: The loop option's logic is performed here -- after element processing -- because the current call needs 32148 to undergo its queue insertion prior to the loop option generating its series of constituent "reverse" calls, 32149 which chain after the current call. Two reverse calls (two "alternations") constitute one loop. */ 32150 opts = $.extend({}, Velocity.defaults, options); 32151 opts.loop = parseInt(opts.loop, 10); 32152 var reverseCallsCount = opts.loop * 2 - 1; 32153 if (opts.loop) { 32154 /* Double the loop count to convert it into its appropriate number of "reverse" calls. 32155 Subtract 1 from the resulting value since the current call is included in the total alternation count. */ 32156 for (var x = 0; x < reverseCallsCount; x++) { 32157 /* Since the logic for the reverse action occurs inside Queueing and therefore this call's options object 32158 isn't parsed until then as well, the current call's delay option must be explicitly passed into the reverse 32159 call so that the delay logic that occurs inside *Pre-Queueing* can process it. */ 32160 var reverseOptions = { 32161 delay: opts.delay, 32162 progress: opts.progress 32163 }; 32164 32165 /* If a complete callback was passed into this call, transfer it to the loop redirect's final "reverse" call 32166 so that it's triggered when the entire redirect is complete (and not when the very first animation is complete). */ 32167 if (x === reverseCallsCount - 1) { 32168 reverseOptions.display = opts.display; 32169 reverseOptions.visibility = opts.visibility; 32170 reverseOptions.complete = opts.complete; 32171 } 32172 _animate(elements, "reverse", reverseOptions); 32173 } 32174 } 32175 32176 /*************** 32177 Chaining 32178 ***************/ 32179 32180 /* Return the elements back to the call chain, with wrapped elements taking precedence in case Velocity was called via the $.fn. extension. */ 32181 return getChain(); 32182 }; 32183 32184 /* Turn Velocity into the animation function, extended with the pre-existing Velocity object. */ 32185 Velocity = $.extend(_animate, Velocity); 32186 /* For legacy support, also expose the literal animate method. */ 32187 Velocity.animate = _animate; 32188 32189 /************** 32190 Timing 32191 **************/ 32192 32193 /* Ticker function. */ 32194 var ticker = window.requestAnimationFrame || rAFShim; 32195 32196 /* Inactive browser tabs pause rAF, which results in all active animations immediately sprinting to their completion states when the tab refocuses. 32197 To get around this, we dynamically switch rAF to setTimeout (which the browser *doesn't* pause) when the tab loses focus. We skip this for mobile 32198 devices to avoid wasting battery power on inactive tabs. */ 32199 /* Note: Tab focus detection doesn't work on older versions of IE, but that's okay since they don't support rAF to begin with. */ 32200 if (!Velocity.State.isMobile && document.hidden !== undefined) { 32201 var updateTicker = function updateTicker() { 32202 /* Reassign the rAF function (which the global tick() function uses) based on the tab's focus state. */ 32203 if (document.hidden) { 32204 ticker = function ticker(callback) { 32205 /* The tick function needs a truthy first argument in order to pass its internal timestamp check. */ 32206 return setTimeout(function () { 32207 callback(true); 32208 }, 16); 32209 }; 32210 32211 /* The rAF loop has been paused by the browser, so we manually restart the tick. */ 32212 tick(); 32213 } else { 32214 ticker = window.requestAnimationFrame || rAFShim; 32215 } 32216 }; 32217 32218 /* Page could be sitting in the background at this time (i.e. opened as new tab) so making sure we use correct ticker from the start */ 32219 updateTicker(); 32220 32221 /* And then run check again every time visibility changes */ 32222 document.addEventListener("visibilitychange", updateTicker); 32223 } 32224 32225 /************ 32226 Tick 32227 ************/ 32228 32229 /* Note: All calls to Velocity are pushed to the Velocity.State.calls array, which is fully iterated through upon each tick. */ 32230 function tick(timestamp) { 32231 /* An empty timestamp argument indicates that this is the first tick occurence since ticking was turned on. 32232 We leverage this metadata to fully ignore the first tick pass since RAF's initial pass is fired whenever 32233 the browser's next tick sync time occurs, which results in the first elements subjected to Velocity 32234 calls being animated out of sync with any elements animated immediately thereafter. In short, we ignore 32235 the first RAF tick pass so that elements being immediately consecutively animated -- instead of simultaneously animated 32236 by the same Velocity call -- are properly batched into the same initial RAF tick and consequently remain in sync thereafter. */ 32237 if (timestamp) { 32238 /* We normally use RAF's high resolution timestamp but as it can be significantly offset when the browser is 32239 under high stress we give the option for choppiness over allowing the browser to drop huge chunks of frames. 32240 We use performance.now() and shim it if it doesn't exist for when the tab is hidden. */ 32241 var timeCurrent = Velocity.timestamp && timestamp !== true ? timestamp : performance.now(); 32242 32243 /******************** 32244 Call Iteration 32245 ********************/ 32246 32247 var callsLength = Velocity.State.calls.length; 32248 32249 /* To speed up iterating over this array, it is compacted (falsey items -- calls that have completed -- are removed) 32250 when its length has ballooned to a point that can impact tick performance. This only becomes necessary when animation 32251 has been continuous with many elements over a long period of time; whenever all active calls are completed, completeCall() clears Velocity.State.calls. */ 32252 if (callsLength > 10000) { 32253 Velocity.State.calls = compactSparseArray(Velocity.State.calls); 32254 callsLength = Velocity.State.calls.length; 32255 } 32256 32257 /* Iterate through each active call. */ 32258 for (var i = 0; i < callsLength; i++) { 32259 /* When a Velocity call is completed, its Velocity.State.calls entry is set to false. Continue on to the next call. */ 32260 if (!Velocity.State.calls[i]) { 32261 continue; 32262 } 32263 32264 /************************ 32265 Call-Wide Variables 32266 ************************/ 32267 32268 var callContainer = Velocity.State.calls[i], 32269 call = callContainer[0], 32270 opts = callContainer[2], 32271 timeStart = callContainer[3], 32272 firstTick = !timeStart, 32273 tweenDummyValue = null, 32274 pauseObject = callContainer[5], 32275 millisecondsEllapsed = callContainer[6]; 32276 32277 /* If timeStart is undefined, then this is the first time that this call has been processed by tick(). 32278 We assign timeStart now so that its value is as close to the real animation start time as possible. 32279 (Conversely, had timeStart been defined when this call was added to Velocity.State.calls, the delay 32280 between that time and now would cause the first few frames of the tween to be skipped since 32281 percentComplete is calculated relative to timeStart.) */ 32282 /* Further, subtract 16ms (the approximate resolution of RAF) from the current time value so that the 32283 first tick iteration isn't wasted by animating at 0% tween completion, which would produce the 32284 same style value as the element's current value. */ 32285 if (!timeStart) { 32286 timeStart = Velocity.State.calls[i][3] = timeCurrent - 16; 32287 } 32288 32289 /* If a pause object is present, skip processing unless it has been set to resume */ 32290 if (pauseObject) { 32291 if (pauseObject.resume === true) { 32292 /* Update the time start to accomodate the paused completion amount */ 32293 timeStart = callContainer[3] = Math.round(timeCurrent - millisecondsEllapsed - 16); 32294 32295 /* Remove pause object after processing */ 32296 callContainer[5] = null; 32297 } else { 32298 continue; 32299 } 32300 } 32301 millisecondsEllapsed = callContainer[6] = timeCurrent - timeStart; 32302 32303 /* The tween's completion percentage is relative to the tween's start time, not the tween's start value 32304 (which would result in unpredictable tween durations since JavaScript's timers are not particularly accurate). 32305 Accordingly, we ensure that percentComplete does not exceed 1. */ 32306 var percentComplete = Math.min(millisecondsEllapsed / opts.duration, 1); 32307 32308 /********************** 32309 Element Iteration 32310 **********************/ 32311 32312 /* For every call, iterate through each of the elements in its set. */ 32313 for (var j = 0, callLength = call.length; j < callLength; j++) { 32314 var tweensContainer = call[j], 32315 element = tweensContainer.element; 32316 32317 /* Check to see if this element has been deleted midway through the animation by checking for the 32318 continued existence of its data cache. If it's gone, or the element is currently paused, skip animating this element. */ 32319 if (!Data(element)) { 32320 continue; 32321 } 32322 var transformPropertyExists = false; 32323 32324 /********************************** 32325 Display & Visibility Toggling 32326 **********************************/ 32327 32328 /* If the display option is set to non-"none", set it upfront so that the element can become visible before tweening begins. 32329 (Otherwise, display's "none" value is set in completeCall() once the animation has completed.) */ 32330 if (opts.display !== undefined && opts.display !== null && opts.display !== "none") { 32331 if (opts.display === "flex") { 32332 var flexValues = ["-webkit-box", "-moz-box", "-ms-flexbox", "-webkit-flex"]; 32333 $.each(flexValues, function (i, flexValue) { 32334 CSS.setPropertyValue(element, "display", flexValue); 32335 }); 32336 } 32337 CSS.setPropertyValue(element, "display", opts.display); 32338 } 32339 32340 /* Same goes with the visibility option, but its "none" equivalent is "hidden". */ 32341 if (opts.visibility !== undefined && opts.visibility !== "hidden") { 32342 CSS.setPropertyValue(element, "visibility", opts.visibility); 32343 } 32344 32345 /************************ 32346 Property Iteration 32347 ************************/ 32348 32349 /* For every element, iterate through each property. */ 32350 for (var property in tweensContainer) { 32351 /* Note: In addition to property tween data, tweensContainer contains a reference to its associated element. */ 32352 if (tweensContainer.hasOwnProperty(property) && property !== "element") { 32353 var tween = tweensContainer[property], 32354 currentValue, 32355 /* Easing can either be a pre-genereated function or a string that references a pre-registered easing 32356 on the Velocity.Easings object. In either case, return the appropriate easing *function*. */ 32357 easing = Type.isString(tween.easing) ? Velocity.Easings[tween.easing] : tween.easing; 32358 32359 /****************************** 32360 Current Value Calculation 32361 ******************************/ 32362 32363 if (Type.isString(tween.pattern)) { 32364 var patternReplace = percentComplete === 1 ? function ($0, index, round) { 32365 var result = tween.endValue[index]; 32366 return round ? Math.round(result) : result; 32367 } : function ($0, index, round) { 32368 var startValue = tween.startValue[index], 32369 tweenDelta = tween.endValue[index] - startValue, 32370 result = startValue + tweenDelta * easing(percentComplete, opts, tweenDelta); 32371 return round ? Math.round(result) : result; 32372 }; 32373 currentValue = tween.pattern.replace(/{(\d+)(!)?}/g, patternReplace); 32374 } else if (percentComplete === 1) { 32375 /* If this is the last tick pass (if we've reached 100% completion for this tween), 32376 ensure that currentValue is explicitly set to its target endValue so that it's not subjected to any rounding. */ 32377 currentValue = tween.endValue; 32378 } else { 32379 /* Otherwise, calculate currentValue based on the current delta from startValue. */ 32380 var tweenDelta = tween.endValue - tween.startValue; 32381 currentValue = tween.startValue + tweenDelta * easing(percentComplete, opts, tweenDelta); 32382 /* If no value change is occurring, don't proceed with DOM updating. */ 32383 } 32384 if (!firstTick && currentValue === tween.currentValue) { 32385 continue; 32386 } 32387 tween.currentValue = currentValue; 32388 32389 /* If we're tweening a fake 'tween' property in order to log transition values, update the one-per-call variable so that 32390 it can be passed into the progress callback. */ 32391 if (property === "tween") { 32392 tweenDummyValue = currentValue; 32393 } else { 32394 /****************** 32395 Hooks: Part I 32396 ******************/ 32397 var hookRoot; 32398 32399 /* For hooked properties, the newly-updated rootPropertyValueCache is cached onto the element so that it can be used 32400 for subsequent hooks in this call that are associated with the same root property. If we didn't cache the updated 32401 rootPropertyValue, each subsequent update to the root property in this tick pass would reset the previous hook's 32402 updates to rootPropertyValue prior to injection. A nice performance byproduct of rootPropertyValue caching is that 32403 subsequently chained animations using the same hookRoot but a different hook can use this cached rootPropertyValue. */ 32404 if (CSS.Hooks.registered[property]) { 32405 hookRoot = CSS.Hooks.getRoot(property); 32406 var rootPropertyValueCache = Data(element).rootPropertyValueCache[hookRoot]; 32407 if (rootPropertyValueCache) { 32408 tween.rootPropertyValue = rootPropertyValueCache; 32409 } 32410 } 32411 32412 /***************** 32413 DOM Update 32414 *****************/ 32415 32416 /* setPropertyValue() returns an array of the property name and property value post any normalization that may have been performed. */ 32417 /* Note: To solve an IE<=8 positioning bug, the unit type is dropped when setting a property value of 0. */ 32418 var adjustedSetData = CSS.setPropertyValue(element, /* SET */ 32419 property, tween.currentValue + (IE < 9 && parseFloat(currentValue) === 0 ? "" : tween.unitType), tween.rootPropertyValue, tween.scrollData); 32420 32421 /******************* 32422 Hooks: Part II 32423 *******************/ 32424 32425 /* Now that we have the hook's updated rootPropertyValue (the post-processed value provided by adjustedSetData), cache it onto the element. */ 32426 if (CSS.Hooks.registered[property]) { 32427 /* Since adjustedSetData contains normalized data ready for DOM updating, the rootPropertyValue needs to be re-extracted from its normalized form. ?? */ 32428 if (CSS.Normalizations.registered[hookRoot]) { 32429 Data(element).rootPropertyValueCache[hookRoot] = CSS.Normalizations.registered[hookRoot]("extract", null, adjustedSetData[1]); 32430 } else { 32431 Data(element).rootPropertyValueCache[hookRoot] = adjustedSetData[1]; 32432 } 32433 } 32434 32435 /*************** 32436 Transforms 32437 ***************/ 32438 32439 /* Flag whether a transform property is being animated so that flushTransformCache() can be triggered once this tick pass is complete. */ 32440 if (adjustedSetData[0] === "transform") { 32441 transformPropertyExists = true; 32442 } 32443 } 32444 } 32445 } 32446 32447 /**************** 32448 mobileHA 32449 ****************/ 32450 32451 /* If mobileHA is enabled, set the translate3d transform to null to force hardware acceleration. 32452 It's safe to override this property since Velocity doesn't actually support its animation (hooks are used in its place). */ 32453 if (opts.mobileHA) { 32454 /* Don't set the null transform hack if we've already done so. */ 32455 if (Data(element).transformCache.translate3d === undefined) {
32456 /* All entries on the transformCache object are later concatenated into a single transform string via flushTransformCache(). */ 32457 Data(element).transformCache.translate3d = "(0px, 0px, 0px)"; 32458 transformPropertyExists = true; 32459 } 32460 } 32461 if (transformPropertyExists) { 32462 CSS.flushTransformCache(element); 32463 } 32464 } 32465 32466 /* The non-"none" display value is only applied to an element once -- when its associated call is first ticked through. 32467 Accordingly, it's set to false so that it isn't re-processed by this call in the next tick. */ 32468 if (opts.display !== undefined && opts.display !== "none") { 32469 Velocity.State.calls[i][2].display = false; 32470 } 32471 if (opts.visibility !== undefined && opts.visibility !== "hidden") { 32472 Velocity.State.calls[i][2].visibility = false; 32473 } 32474 32475 /* Pass the elements and the timing data (percentComplete, msRemaining, timeStart, tweenDummyValue) into the progress callback. */ 32476 if (opts.progress) { 32477 opts.progress.call(callContainer[1], callContainer[1], percentComplete, Math.max(0, timeStart + opts.duration - timeCurrent), timeStart, tweenDummyValue); 32478 } 32479 32480 /* If this call has finished tweening, pass its index to completeCall() to handle call cleanup. */ 32481 if (percentComplete === 1) { 32482 completeCall(i); 32483 } 32484 } 32485 } 32486 32487 /* Note: completeCall() sets the isTicking flag to false when the last call on Velocity.State.calls has completed. */ 32488 if (Velocity.State.isTicking) { 32489 ticker(tick); 32490 } 32491 } 32492 32493 /********************** 32494 Call Completion 32495 **********************/ 32496 32497 /* Note: Unlike tick(), which processes all active calls at once, call completion is handled on a per-call basis. */ 32498 function completeCall(callIndex, isStopped) { 32499 /* Ensure the call exists. */ 32500 if (!Velocity.State.calls[callIndex]) { 32501 return false; 32502 } 32503 32504 /* Pull the metadata from the call. */ 32505 var call = Velocity.State.calls[callIndex][0], 32506 elements = Velocity.State.calls[callIndex][1], 32507 opts = Velocity.State.calls[callIndex][2], 32508 resolver = Velocity.State.calls[callIndex][4]; 32509 var remainingCallsExist = false; 32510 32511 /************************* 32512 Element Finalization 32513 *************************/ 32514 var _loop = function _loop() { 32515 element = call[i].element; 32516 /* If the user set display to "none" (intending to hide the element), set it now that the animation has completed. */ 32517 /* Note: display:none isn't set when calls are manually stopped (via Velocity("stop"). */ 32518 /* Note: Display gets ignored with "reverse" calls and infinite loops, since this behavior would be undesirable. */ 32519 if (!isStopped && !opts.loop) { 32520 if (opts.display === "none") { 32521 CSS.setPropertyValue(element, "display", opts.display); 32522 } 32523 if (opts.visibility === "hidden") { 32524 CSS.setPropertyValue(element, "visibility", opts.visibility); 32525 } 32526 } 32527 32528 /* If the element's queue is empty (if only the "inprogress" item is left at position 0) or if its queue is about to run 32529 a non-Velocity-initiated entry, turn off the isAnimating flag. A non-Velocity-initiatied queue entry's logic might alter 32530 an element's CSS values and thereby cause Velocity's cached value data to go stale. To detect if a queue entry was initiated by Velocity, 32531 we check for the existence of our special Velocity.queueEntryFlag declaration, which minifiers won't rename since the flag 32532 is assigned to jQuery's global $ object and thus exists out of Velocity's own scope. */ 32533 data = Data(element); 32534 if (opts.loop !== true && ($.queue(element)[1] === undefined || !/\.velocityQueueEntryFlag/i.test($.queue(element)[1]))) { 32535 /* The element may have been deleted. Ensure that its data cache still exists before acting on it. */ 32536 if (data) { 32537 data.isAnimating = false;
32538 /* Clear the element's rootPropertyValueCache, which will become stale. */ 32539 data.rootPropertyValueCache = {}; 32540 transformHAPropertyExists = false; 32541 /* If any 3D transform subproperty is at its default value (regardless of unit type), remove it. */ 32542 $.each(CSS.Lists.transforms3D, function (i, transformName) { 32543 var defaultValue = /^scale/.test(transformName) ? 1 : 0, 32544 currentValue = data.transformCache[transformName]; 32545 if (data.transformCache[transformName] !== undefined && new RegExp("^\\(" + defaultValue + "[^.]").test(currentValue)) { 32546 transformHAPropertyExists = true; 32547 delete data.transformCache[transformName]; 32548 } 32549 }); 32550 32551 /* Mobile devices have hardware acceleration removed at the end of the animation in order to avoid hogging the GPU's memory. */ 32552 if (opts.mobileHA) { 32553 transformHAPropertyExists = true; 32554 delete data.transformCache.translate3d; 32555 } 32556 32557 /* Flush the subproperty removals to the DOM. */ 32558 if (transformHAPropertyExists) { 32559 CSS.flushTransformCache(element); 32560 } 32561 32562 /* Remove the "velocity-animating" indicator class. */ 32563 CSS.Values.removeClass(element, "velocity-animating"); 32564 } 32565 } 32566 32567 /********************* 32568 Option: Complete 32569 *********************/ 32570 32571 /* Complete is fired once per call (not once per element) and is passed the full raw DOM element set as both its context and its first argument. */ 32572 /* Note: Callbacks aren't fired when calls are manually stopped (via Velocity("stop"). */ 32573 if (!isStopped && opts.complete && !opts.loop && i === callLength - 1) { 32574 /* We throw callbacks in a setTimeout so that thrown errors don't halt the execution of Velocity itself. */ 32575 try { 32576 opts.complete.call(elements, elements); 32577 } catch (error) { 32578 setTimeout(function () { 32579 throw error; 32580 }, 1); 32581 } 32582 } 32583 32584 /********************** 32585 Promise Resolving 32586 **********************/ 32587 32588 /* Note: Infinite loops don't return promises. */ 32589 if (resolver && opts.loop !== true) { 32590 resolver(elements); 32591 } 32592 32593 /**************************** 32594 Option: Loop (Infinite) 32595 ****************************/ 32596 32597 if (data && opts.loop === true && !isStopped) { 32598 /* If a rotateX/Y/Z property is being animated by 360 deg with loop:true, swap tween start/end values to enable 32599 continuous iterative rotation looping. (Otherise, the element would just rotate back and forth.) */ 32600 $.each(data.tweensContainer, function (propertyName, tweenContainer) { 32601 if (/^rotate/.test(propertyName) && (parseFloat(tweenContainer.startValue) - parseFloat(tweenContainer.endValue)) % 360 === 0) { 32602 var oldStartValue = tweenContainer.startValue; 32603 tweenContainer.startValue = tweenContainer.endValue; 32604 tweenContainer.endValue = oldStartValue; 32605 } 32606 if (/^backgroundPosition/.test(propertyName) && parseFloat(tweenContainer.endValue) === 100 && tweenContainer.unitType === "%") { 32607 tweenContainer.endValue = 0; 32608 tweenContainer.startValue = 100; 32609 } 32610 }); 32611 Velocity(element, "reverse", { 32612 loop: true, 32613 delay: opts.delay 32614 }); 32615 } 32616 32617 /*************** 32618 Dequeueing 32619 ***************/ 32620 32621 /* Fire the next call in the queue so long as this call's queue wasn't set to false (to trigger a parallel animation), 32622 which would have already caused the next call to fire. Note: Even if the end of the animation queue has been reached, 32623 $.dequeue() must still be called in order to completely clear jQuery's animation queue. */ 32624 if (opts.queue !== false) { 32625 $.dequeue(element, opts.queue); 32626 } 32627 }, 32628 element, 32629 data, 32630 transformHAPropertyExists; 32631 for (var i = 0, callLength = call.length; i < callLength; i++) { 32632 _loop(); 32633 } 32634 32635 /************************ 32636 Calls Array Cleanup 32637 ************************/ 32638 32639 /* Since this call is complete, set it to false so that the rAF tick skips it. This array is later compacted via compactSparseArray(). 32640 (For performance reasons, the call is set to false instead of being deleted from the array: http://www.html5rocks.com/en/tutorials/speed/v8/) */ 32641 Velocity.State.calls[callIndex] = false;
vendor: 4,889 bytes, lines 32642-32749
32642 32643 /* Iterate through the calls array to determine if this was the final in-progress animation. 32644 If so, set a flag to end ticking and clear the calls array. */ 32645 for (var j = 0, callsLength = Velocity.State.calls.length; j < callsLength; j++) { 32646 if (Velocity.State.calls[j] !== false) { 32647 remainingCallsExist = true; 32648 break; 32649 } 32650 } 32651 if (remainingCallsExist === false) { 32652 /* tick() will detect this flag upon its next iteration and subsequently turn itself off. */ 32653 Velocity.State.isTicking = false; 32654 32655 /* Clear the calls array so that its length is reset. */ 32656 delete Velocity.State.calls; 32657 Velocity.State.calls = []; 32658 } 32659 } 32660 32661 /****************** 32662 Frameworks 32663 ******************/ 32664 32665 /* Both jQuery and Zepto allow their $.fn object to be extended to allow wrapped elements to be subjected to plugin calls. 32666 If either framework is loaded, register a "velocity" extension pointing to Velocity's core animate() method. Velocity 32667 also registers itself onto a global container (window.jQuery || window.Zepto || window) so that certain features are 32668 accessible beyond just a per-element scope. This master object contains an .animate() method, which is later assigned to $.fn 32669 (if jQuery or Zepto are present). Accordingly, Velocity can both act on wrapped DOM elements and stand alone for targeting raw DOM elements. */ 32670 global.Velocity = Velocity; 32671 if (global !== window) { 32672 /* Assign the element function to Velocity's core animate() method. */ 32673 global.fn.velocity = _animate; 32674 /* Assign the object function's defaults to Velocity's global defaults object. */ 32675 global.fn.velocity.defaults = Velocity.defaults; 32676 } 32677 32678 /*********************** 32679 Packaged Redirects 32680 ***********************/ 32681 32682 /* slideUp, slideDown */ 32683 $.each(["Down", "Up"], function (i, direction) { 32684 Velocity.Redirects["slide" + direction] = function (element, options, elementsIndex, elementsSize, elements, promiseData) { 32685 var opts = $.extend({}, options), 32686 begin = opts.begin, 32687 complete = opts.complete, 32688 inlineValues = {}, 32689 computedValues = { 32690 height: "", 32691 marginTop: "", 32692 marginBottom: "", 32693 paddingTop: "", 32694 paddingBottom: "" 32695 }; 32696 if (opts.display === undefined) { 32697 /* Show the element before slideDown begins and hide the element after slideUp completes. */ 32698 /* Note: Inline elements cannot have dimensions animated, so they're reverted to inline-block. */ 32699 opts.display = direction === "Down" ? Velocity.CSS.Values.getDisplayType(element) === "inline" ? "inline-block" : "block" : "none"; 32700 } 32701 opts.begin = function () { 32702 /* If the user passed in a begin callback, fire it now. */ 32703 if (elementsIndex === 0 && begin) { 32704 begin.call(elements, elements); 32705 } 32706 32707 /* Cache the elements' original vertical dimensional property values so that we can animate back to them. */ 32708 for (var property in computedValues) { 32709 if (!computedValues.hasOwnProperty(property)) { 32710 continue; 32711 } 32712 inlineValues[property] = element.style[property]; 32713 32714 /* For slideDown, use forcefeeding to animate all vertical properties from 0. For slideUp, 32715 use forcefeeding to start from computed values and animate down to 0. */ 32716 var propertyValue = CSS.getPropertyValue(element, property); 32717 computedValues[property] = direction === "Down" ? [propertyValue, 0] : [0, propertyValue]; 32718 } 32719 32720 /* Force vertical overflow content to clip so that sliding works as expected. */ 32721 inlineValues.overflow = element.style.overflow; 32722 element.style.overflow = "hidden"; 32723 }; 32724 opts.complete = function () { 32725 /* Reset element to its pre-slide inline values once its slide animation is complete. */ 32726 for (var property in inlineValues) { 32727 if (inlineValues.hasOwnProperty(property)) { 32728 element.style[property] = inlineValues[property]; 32729 } 32730 } 32731 32732 /* If the user passed in a complete callback, fire it now. */ 32733 if (elementsIndex === elementsSize - 1) { 32734 if (complete) { 32735 complete.call(elements, elements); 32736 } 32737 if (promiseData) { 32738 promiseData.resolver(elements); 32739 } 32740 } 32741 }; 32742 Velocity(element, computedValues, opts); 32743 }; 32744 }); 32745 32746 /* fadeIn, fadeOut */ 32747 $.each(["In", "Out"], function (i, direction) { 32748 Velocity.Redirects["fade" + direction] = function (element, options, elementsIndex, elementsSize, elements, promiseData) { 32749 var opts = $.extend({}, options),
32750 complete = opts.complete, 32751 propertiesMap = { 32752 opacity: direction === "In" ? 1 : 0 32753 }; 32754 32755 /* Since redirects are triggered individually for each element in the animated set, avoid repeatedly triggering 32756 callbacks by firing them only when the final element has been reached. */ 32757 if (elementsIndex !== 0) { 32758 opts.begin = null; 32759 } 32760 if (elementsIndex !== elementsSize - 1) { 32761 opts.complete = null; 32762 } else { 32763 opts.complete = function () { 32764 if (complete) { 32765 complete.call(elements, elements); 32766 } 32767 if (promiseData) { 32768 promiseData.resolver(elements); 32769 } 32770 }; 32771 } 32772 32773 /* If a display was passed in, use it. Otherwise, default to "none" for fadeOut or the element-specific default for fadeIn. */ 32774 /* Note: We allow users to pass in "null" to skip display setting altogether. */ 32775 if (opts.display === undefined) { 32776 opts.display = direction === "In" ? "auto" : "none"; 32777 } 32778 Velocity(this, propertiesMap, opts); 32779 }; 32780 }); 32781 return Velocity; 32782 }(window.jQuery || window.Zepto || window, window, window ? window.document : undefined); 32783}); 32784 32785/****************** 32786 Known Issues
32787 ******************/ 32788 32789/* The CSS spec mandates that the translateX/Y/Z transforms are %-relative to the element itself -- not its parent. 32790 Velocity, however, doesn't make this distinction. Thus, converting to or from the % unit with these subproperties 32791 will produce an inaccurate conversion value. The same issue exists with the cx/cy attributes of SVG circles and ellipses. */ 32792 32793},{}],73:[function(require,module,exports){ 32794"use strict"; 32795 32796Object.defineProperty(exports, "__esModule", { 32797 value: true 32798}); 32799exports["default"] = void 0; 32800var _EventEmitter = _interopRequireDefault(require("EventEmitter")); 32801function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 32802function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 32803function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 32804function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 32805function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 32806function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 32807function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 32808var EventComponent = exports["default"] = /*#__PURE__*/function () { 32809 function EventComponent(ele, eventGroup) { 32810 _classCallCheck(this, EventComponent); 32811 this.ele = $(ele); 32812 this.eventGroup = eventGroup ? ".".concat(eventGroup) : ""; 32813 } 32814 return _createClass(EventComponent, [{ 32815 key: "getEventQualifier", 32816 value: function getEventQualifier(name, moduleName) { 32817 return "".concat(moduleName, ".").concat(name).concat(this.eventGroup); 32818 } 32819 }, { 32820 key: "registerListener", 32821 value: function registerListener() { 32822 var listener = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 32823 for (var i = 0; i < listener.length; i++) { 32824 _EventEmitter["default"].on(this.getEventQualifier(listener[i].event, listener[i].namespace), listener[i].callback); 32825 } 32826 } 32827 }]); 32828}(); 32829 32830},{"EventEmitter":74}],74:[function(require,module,exports){ 32831'use strict'; 32832 32833Object.defineProperty(exports, "__esModule", { 32834 value: true 32835}); 32836exports["default"] = void 0; 32837function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 32838function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } 32839function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 32840function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 32841function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } 32842function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } 32843function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 32844function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 32845function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 32846function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 32847function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 32848function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 32849var EventEmitter = /*#__PURE__*/function () { 32850 function EventEmitter() { 32851 _classCallCheck(this, EventEmitter); 32852 this.events = {}; 32853 } 32854 return _createClass(EventEmitter, [{ 32855 key: "on", 32856 value: function on(eventName, fn) { 32857 var _this = this; 32858 if (!this.events[eventName]) { 32859 this.events[eventName] = []; 32860 } 32861 this.events[eventName].push(fn); 32862 return function () { 32863 _this.events[eventName] = _this.events[eventName].filter(function (eventFn) { 32864 return fn !== eventFn; 32865 }); 32866 }; 32867 } 32868 }, { 32869 key: "emit", 32870 value: function emit(eventName, data) { 32871 var regex = /\.[0-9]+$/i; 32872 var m = regex.exec(eventName); 32873 var listener = this.events[eventName]; 32874 32875 //check if there are any global event listener for eventName 32876 if (m) { 32877 var globalListener = this.events[eventName.replace(m[0], ".*")]; 32878 if (globalListener) { 32879 listener = [].concat(_toConsumableArray(listener), _toConsumableArray(globalListener)); 32880 } 32881 } 32882 if (listener) { 32883 for (var i = 0; i < listener.length; i++) { 32884 listener[i].call(null, data); 32885 } 32886 } 32887 } 32888 }, { 32889 key: "remove", 32890 value: function remove(eventName, listener) { 32891 var event = this.events[eventName]; 32892 if (event) { 32893 var index = event.indexOf(listener); 32894 if (index > -1) { 32895 this.events[event].splice(index, 1); 32896 } 32897 } 32898 } 32899 }]); 32900}(); 32901var _default = exports["default"] = new EventEmitter(); 32902 32903},{}],75:[function(require,module,exports){ 32904'use strict'; 32905 32906Object.defineProperty(exports, "__esModule", { 32907 value: true 32908}); 32909exports["default"] = void 0; 32910var _FoundationCore = require("FoundationCore.js"); 32911var _foundationAbide = require("foundation-sites/js/foundation.abide.js"); 32912_FoundationCore.Foundation.plugin(_foundationAbide.Abide, 'Abide'); 32913var _default = exports["default"] = _foundationAbide.Abide; 32914 32915},{"FoundationCore.js":77,"foundation-sites/js/foundation.abide.js":15}],76:[function(require,module,exports){ 32916'use strict'; 32917 32918Object.defineProperty(exports, "__esModule", { 32919 value: true 32920}); 32921exports["default"] = void 0; 32922var _FoundationCore = require("FoundationCore.js"); 32923var _foundationAccordion = require("foundation-sites/js/foundation.accordion.js"); 32924_FoundationCore.Foundation.plugin(_foundationAccordion.Accordion, 'Accordion'); 32925var _default = exports["default"] = _foundationAccordion.Accordion; 32926 32927},{"FoundationCore.js":77,"foundation-sites/js/foundation.accordion.js":16}],77:[function(require,module,exports){ 32928'use strict'; 32929 32930function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 32931Object.defineProperty(exports, "__esModule", { 32932 value: true 32933}); 32934Object.defineProperty(exports, "Box", { 32935 enumerable: true, 32936 get: function get() { 32937 return _foundationUtilBox.Box; 32938 } 32939}); 32940exports.CoreUtils = void 0; 32941Object.defineProperty(exports, "Foundation", { 32942 enumerable: true, 32943 get: function get() { 32944 return _foundationCore.Foundation; 32945 } 32946}); 32947Object.defineProperty(exports, "Keyboard", { 32948 enumerable: true, 32949 get: function get() { 32950 return _foundationUtilKeyboard.Keyboard; 32951 } 32952}); 32953Object.defineProperty(exports, "MediaQuery", { 32954 enumerable: true, 32955 get: function get() { 32956 return _foundationUtilMediaQuery.MediaQuery; 32957 } 32958}); 32959Object.defineProperty(exports, "Motion", { 32960 enumerable: true, 32961 get: function get() { 32962 return _foundationUtilMotion.Motion; 32963 } 32964}); 32965Object.defineProperty(exports, "Nest", { 32966 enumerable: true, 32967 get: function get() { 32968 return _foundationUtilNest.Nest; 32969 } 32970}); 32971Object.defineProperty(exports, "Timer", { 32972 enumerable: true, 32973 get: function get() { 32974 return _foundationUtilTimer.Timer; 32975 } 32976}); 32977Object.defineProperty(exports, "Touch", { 32978 enumerable: true, 32979 get: function get() { 32980 return _foundationUtilTouch.Touch; 32981 } 32982}); 32983Object.defineProperty(exports, "Triggers", { 32984 enumerable: true, 32985 get: function get() { 32986 return _foundationUtilTriggers.Triggers; 32987 } 32988}); 32989exports["default"] = void 0; 32990Object.defineProperty(exports, "onImagesLoaded", { 32991 enumerable: true, 32992 get: function get() { 32993 return _foundationUtilImageLoader.onImagesLoaded; 32994 } 32995}); 32996var _foundationCore = require("foundation-sites/js/foundation.core.js"); 32997var CoreUtils = _interopRequireWildcard(require("foundation-sites/js/foundation.core.utils.js")); 32998exports.CoreUtils = CoreUtils; 32999var _foundationUtilBox = require("foundation-sites/js/foundation.util.box.js"); 33000var _foundationUtilImageLoader = require("foundation-sites/js/foundation.util.imageLoader.js"); 33001var _foundationUtilKeyboard = require("foundation-sites/js/foundation.util.keyboard.js"); 33002var _foundationUtilMediaQuery = require("foundation-sites/js/foundation.util.mediaQuery.js"); 33003var _foundationUtilMotion = require("foundation-sites/js/foundation.util.motion.js"); 33004var _foundationUtilNest = require("foundation-sites/js/foundation.util.nest.js"); 33005var _foundationUtilTimer = require("foundation-sites/js/foundation.util.timer.js"); 33006var _foundationUtilTouch = require("foundation-sites/js/foundation.util.touch.js"); 33007var _foundationUtilTriggers = require("foundation-sites/js/foundation.util.triggers.js"); 33008function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esMo
vendor: 4,600 bytes, lines 33008-33068
33008dule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } 33009_foundationCore.Foundation.addToJquery($); 33010_foundationCore.Foundation.rtl = CoreUtils.rtl; 33011_foundationCore.Foundation.GetYoDigits = CoreUtils.GetYoDigits; 33012_foundationCore.Foundation.transitionend = CoreUtils.transitionend; 33013_foundationCore.Foundation.RegExpEscape = CoreUtils.RegExpEscape; 33014_foundationCore.Foundation.onLoad = CoreUtils.onLoad; 33015_foundationCore.Foundation.Box = _foundationUtilBox.Box; 33016_foundationCore.Foundation.onImagesLoaded = _foundationUtilImageLoader.onImagesLoaded; 33017_foundationCore.Foundation.Keyboard = _foundationUtilKeyboard.Keyboard; 33018_foundationCore.Foundation.MediaQuery = _foundationUtilMediaQuery.MediaQuery; 33019_foundationCore.Foundation.Motion = _foundationUtilMotion.Motion; 33020_foundationCore.Foundation.Move = _foundationUtilMotion.Move; 33021_foundationCore.Foundation.Nest = _foundationUtilNest.Nest; 33022_foundationCore.Foundation.Timer = _foundationUtilTimer.Timer; 33023_foundationUtilTouch.Touch.init($); 33024_foundationUtilTriggers.Triggers.init($, _foundationCore.Foundation); 33025_foundationUtilMediaQuery.MediaQuery._init(); 33026var _default = exports["default"] = _foundationCore.Foundation; 33027 33028},{"foundation-sites/js/foundation.core.js":17,"foundation-sites/js/foundation.core.utils.js":19,"foundation-sites/js/foundation.util.box.js":21,"foundation-sites/js/foundation.util.imageLoader.js":22,"foundation-sites/js/foundation.util.keyboard.js":23,"foundation-sites/js/foundation.util.mediaQuery.js":24,"foundation-sites/js/foundation.util.motion.js":25,"foundation-sites/js/foundation.util.nest.js":26,"foundation-sites/js/foundation.util.timer.js":27,"foundation-sites/js/foundation.util.touch.js":28,"foundation-sites/js/foundation.util.triggers.js":29}],78:[function(require,module,exports){ 33029'use strict'; 33030 33031Object.defineProperty(exports, "__esModule", { 33032 value: true 33033}); 33034exports["default"] = void 0; 33035var _FoundationCore = require("FoundationCore.js"); 33036var _foundationSlider = require("foundation-sites/js/foundation.slider.js"); 33037_FoundationCore.Foundation.plugin(_foundationSlider.Slider, 'Slider'); 33038var _default = exports["default"] = _foundationSlider.Slider; 33039 33040},{"FoundationCore.js":77,"foundation-sites/js/foundation.slider.js":20}],79:[function(require,module,exports){ 33041'use strict'; 33042 33043function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 33044function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 33045function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 33046function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 33047function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 33048function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 33049!function ($) { 33050 /** 33051 * TooltipExt module. 33052 * @module foundation.tooltipExt 33053 * @requires foundation.util.box 33054 * @requires foundation.util.triggers 33055 */ 33056 var TooltipExt = /*#__PURE__*/function () { 33057 /** 33058 * Creates a new instance of a TooltipExt. 33059 * @class 33060 * @fires TooltipExt#init 33061 * @param {jQuery} element - jQuery object to attach a tooltip to. 33062 * @param {Object} options - object to extend the default configuration. 33063 */ 33064 function TooltipExt(element, options) { 33065 _classCallCheck(this, TooltipExt); 33066 this.$element = element; 33067 this.options = $.extend({}, TooltipExt.defaults, this.$element.data(), options); 33068 this.isActive = false;
33069 this.isClick = false; 33070 this._init(); 33071 Foundation.registerPlugin(this, 'TooltipExt'); 33072 } 33073 33074 /** 33075 * Initializes the tooltip by setting the creating the tip element, adding it's text, setting private variables and setting attributes on the anchor. 33076 * @private 33077 */ 33078 return _createClass(TooltipExt, [{ 33079 key: "_init", 33080 value: function _init() { 33081 var elemId = this.$element.attr('aria-describedby') || Foundation.GetYoDigits(6, 'tooltip-ext'); 33082 this.options.positionClass = this.options.positionClass || this._getPositionClass(this.$element); 33083 this.options.tipText = this.options.tipText || this.$element.attr('title'); 33084 this.template = this.options.template ? $(this.options.template) : this._buildTemplate(elemId); 33085 switch (this.options.source) { 33086 default: 33087 { 33088 var tipText = this.options.tipText; 33089 tipText = $("<textarea/>").html(tipText).val(); 33090 this._initFinal(tipText, elemId); 33091 break; 33092 } 33093 case 'selector': 33094 { 33095 var tipText = $(this.options.sourceValue).first().html(); 33096 this._initFinal(tipText, elemId); 33097 break; 33098 } 33099 case 'ajax': 33100 { 33101 var tooltipElement = this; 33102 $.ajax({ 33103 type: 'GET', 33104 dataType: 'html', 33105 url: this.options.sourceValue 33106 }).done(function (data) { 33107 tooltipElement._initFinal(data, elemId); 33108 }); 33109 break; 33110 } 33111 } 33112 } 33113 }, { 33114 key: "_initFinal", 33115 value: function _initFinal(tipText, elemId) { 33116 var t = this.template.appendTo(document.body).html(tipText).hide(); 33117 if (typeof this.options.section !== 'undefined') { 33118 var elementContent = this.options.section; 33119 } else { 33120 var elementContent = $(this.$element).text(); 33121 } 33122 $(t).find('.js-tooltip-ext-section').each(function () { 33123 var sectionText = $(this).find('.js-tooltip-ext-section-value').text(); 33124 if (sectionText !== '' && sectionText.toLowerCase().trim() === elementContent.toLowerCase().trim()) { 33125 $(this).show(); 33126 } else { 33127 $(this).hide(); 33128 } 33129 }); 33130 this.$element.attr({ 33131 'title': '', 33132 'aria-describedby': elemId, 33133 'data-yeti-box': elemId, 33134 'data-toggle': elemId, 33135 'data-resize': elemId 33136 }).addClass(this.triggerClass); 33137 33138 //helper variables to track movement on collisions 33139 this.usedPositions = []; 33140 this.counter = 4; 33141 this.classChanged = false; 33142 this._events(); 33143 } 33144 33145 /** 33146 * Grabs the current positioning class, if present, and returns the value or an empty string. 33147 * @private 33148 */ 33149 }, { 33150 key: "_getPositionClass", 33151 value: function _getPositionClass(element) { 33152 if (!element) { 33153 return ''; 33154 } 33155 // var position = element.attr('class').match(/top|left|right/g); 33156 var position = element[0].className.match(/\b(top|left|right)\b/g); 33157 position = position ? position[0] : ''; 33158 return position; 33159 } 33160 }, { 33161 key: "_buildTemplate", 33162 value: 33163 /** 33164 * builds the tooltip element, adds attributes, and returns the template. 33165 * @private 33166 */ 33167 function _buildTemplate(id) { 33168 var templateClasses = "".concat(this.options.tooltipExtClass, " ").concat(this.options.positionClass, " ").concat(this.options.templateClasses).trim(); 33169 var $template = $('<div></div>').addClass(templateClasses).attr({ 33170 'role': 'tooltip', 33171 'aria-hidden': true, 33172 'data-is-active': false, 33173 'data-is-focus': false, 33174 'id': id 33175 }); 33176 return $template; 33177 } 33178 33179 /** 33180 * Function that gets called if a collision event is detected. 33181 * @param {String} position - positioning class to try 33182 * @private 33183 */ 33184 }, { 33185 key: "_reposition", 33186 value: function _reposition(position) { 33187 this.usedPositions.push(position ? position : 'bottom'); 33188 33189 //default, try switching to opposite side 33190 if (!position && this.usedPositions.indexOf('top') < 0) { 33191 this.template.addClass('top'); 33192 } else if (position === 'top' && this.usedPositions.indexOf('bottom') < 0) { 33193 this.template.removeClass(position); 33194 } else if (position === 'left' && this.usedPositions.indexOf('right') < 0) { 33195 this.template.removeClass(position).addClass('right'); 33196 } else if (position === 'right' && this.usedPositions.indexOf('left') < 0) { 33197 this.template.removeClass(position).addClass('left'); 33198 } 33199 33200 //if default change didn't work, try bottom or left first 33201 else if (!position && this.usedPositions.indexOf('top') > -1 && this.usedPositions.indexOf('left') < 0) { 33202 this.template.addClass('left'); 33203 } else if (position === 'top' && this.usedPositions.indexOf('bottom') > -1 && this.usedPositions.indexOf('left') < 0) { 33204 this.template.removeClass(position).addClass('left'); 33205 } else if (position === 'left' && this.usedPositions.indexOf('right') > -1 && this.usedPositions.indexOf('bottom') < 0) { 33206 this.template.removeClass(position); 33207 } else if (position === 'right' && this.usedPositions.indexOf('left') > -1 && this.usedPositions.indexOf('bottom') < 0) { 33208 this.template.removeClass(position); 33209 } 33210 //if nothing cleared, set to bottom 33211 else { 33212 this.template.removeClass(position); 33213 } 33214 this.classChanged = true; 33215 this.counter--; 33216 } 33217 33218 /** 33219 * sets the position class of an element and recursively calls itself until there are no more possible positions to attempt, or the tooltip element is no longer colliding. 33220 * if the tooltip is larger than the screen width, default to full width - any user selected margin 33221 * @private 33222 */ 33223 }, {
33224 key: "_setPosition", 33225 value: function _setPosition() { 33226 var position = this._getPositionClass(this.template), 33227 $tipDims = Foundation.Box.GetDimensions(this.template), 33228 $anchorDims = Foundation.Box.GetDimensions(this.$element), 33229 direction = position === 'left' ? 'left' : position === 'right' ? 'left' : 'top', 33230 param = direction === 'top' ? 'height' : 'width', 33231 offset = param === 'height' ? this.options.vOffset : this.options.hOffset, 33232 _this = this; 33233 if ($tipDims.width >= $tipDims.windowDims.width || !this.counter && !Foundation.Box.ImNotTouchingYou(this.template)) { 33234 this.template.offset(Foundation.Box.GetExplicitOffsets(this.template, this.$element, 'bottom', 'center', this.options.vOffset, this.options.hOffset, true)).css({ 33235 // this.$element.offset(Foundation.GetOffsets(this.template, this.$element, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({ 33236 'width': $anchorDims.windowDims.width - this.options.hOffset * 2, 33237 'height': 'auto' 33238 }); 33239 return false; 33240 } 33241 this.template.offset(Foundation.Box.GetExplicitOffsets(this.template, this.$element, position || 'bottom', 'center', this.options.vOffset, this.options.hOffset)); 33242 while (!Foundation.Box.ImNotTouchingYou(this.template) && this.counter) { 33243 this._reposition(position); 33244 this._setPosition(); 33245 } 33246 } 33247 33248 /** 33249 * reveals the tooltip, and fires an event to close any other open tooltips on the page 33250 * @fires TooltipExt#closeme 33251 * @fires TooltipExt#show 33252 * @function 33253 */ 33254 }, { 33255 key: "show", 33256 value: function show() { 33257 if (this.options.showOn !== 'all' && !Foundation.MediaQuery.atLeast(this.options.showOn)) { 33258 // console.error('The screen is too small to display this tooltip'); 33259 return false; 33260 } 33261 var _this = this; 33262 this.template.css('visibility', 'hidden').show(); 33263 this._setPosition(); 33264 33265 /** 33266 * Fires to close all other open tooltips on the page 33267 * @event Closeme#tooltip 33268 */ 33269 this.$element.trigger('closeme.zf.tooltip', this.template.attr('id')); 33270 this.template.attr({ 33271 'data-is-active': true, 33272 'aria-hidden': false 33273 }); 33274 _this.isActive = true; 33275 // console.log(this.template); 33276 this.template.stop().hide().css('visibility', '').fadeIn(this.options.fadeInDuration, function () { 33277 //maybe do stuff? 33278 }); 33279 /** 33280 * Fires when the tooltip is shown 33281 * @event TooltipExt#show 33282 */ 33283 this.$element.trigger('show.zf.tooltip'); 33284 } 33285 33286 /** 33287 * Hides the current tooltip, and resets the positioning class if it was changed due to collision 33288 * @fires TooltipExt#hide 33289 * @function 33290 */ 33291 }, { 33292 key: "hide", 33293 value: function hide() { 33294 // console.log('hiding', this.$element.data('yeti-box')); 33295 var _this = this; 33296 this.template.stop().attr({ 33297 'aria-hidden': true, 33298 'data-is-active': false 33299 }).fadeOut(this.options.fadeOutDuration, function () { 33300 _this.isActive = false; 33301 _this.isClick = false; 33302 if (_this.classChanged) { 33303 _this.template.removeClass(_this._getPositionClass(_this.template)).addClass(_this.options.positionClass); 33304 _this.usedPositions = []; 33305 _this.counter = 4; 33306 _this.classChanged = false; 33307 } 33308 }); 33309 /** 33310 * fires when the tooltip is hidden 33311 * @event TooltipExt#hide 33312 */ 33313 this.$element.trigger('hide.zf.tooltip'); 33314 } 33315 33316 /** 33317 * adds event listeners for the tooltip and its anchor
33318 * TODO combine some of the listeners like focus and mouseenter, etc. 33319 * @private 33320 */ 33321 }, { 33322 key: "_events", 33323 value: function _events() { 33324 var _this = this; 33325 var $template = this.template; 33326 var isFocus = false; 33327 if (!this.options.disableHover) { 33328 this.$element.on('mouseenter.zf.tooltip', function (e) { 33329 if (!_this.isActive) { 33330 _this.timeout = setTimeout(function () { 33331 _this.show(); 33332 }, _this.options.hoverDelay); 33333 } 33334 }).on('mouseleave.zf.tooltip', function (e) { 33335 clearTimeout(_this.timeout); 33336 if (!isFocus || _this.isClick && !_this.options.clickOpen) { 33337 _this.hide(); 33338 } 33339 }); 33340 } 33341 if (this.options.clickOpen) { 33342 this.$element.on('mousedown.zf.tooltip', function (e) { 33343 e.stopImmediatePropagation(); 33344 if (_this.isClick) { 33345 //_this.hide(); 33346 // _this.isClick = false; 33347 } else { 33348 _this.isClick = true; 33349 if ((_this.options.disableHover || !_this.$element.attr('tabindex')) && !_this.isActive) { 33350 _this.show(); 33351 } 33352 } 33353 }); 33354 } else { 33355 this.$element.on('mousedown.zf.tooltip', function (e) { 33356 e.stopImmediatePropagation(); 33357 _this.isClick = true; 33358 }); 33359 } 33360 $('.tooltip-ext').off('click'); 33361 $('.tooltip-ext').on('click', function (e) { 33362 this.hide(); 33363 }); 33364 if (!this.options.disableForTouch) { 33365 this.$element.on('tap.zf.tooltipExt touchend.zf.tooltip', function (e) { 33366 _this.isActive ? _this.hide() : _this.show(); 33367 }); 33368 } 33369 this.$element.on({ 33370 // 'toggle.zf.trigger': this.toggle.bind(this), 33371 // 'close.zf.trigger': this.hide.bind(this) 33372 'close.zf.trigger': this.hide.bind(this) 33373 }); 33374 this.$element.on('focus.zf.tooltip', function (e) { 33375 isFocus = true; 33376 if (_this.isClick) { 33377 // If we're not showing open on clicks, we need to pretend a click-launched focus isn't 33378 // a real focus, otherwise on hover and come back we get bad behavior 33379 if (!_this.options.clickOpen) { 33380 isFocus = false; 33381 } 33382 return false; 33383 } else { 33384 _this.show(); 33385 } 33386 }).on('focusout.zf.tooltip', function (e) { 33387 isFocus = false; 33388 _this.isClick = false; 33389 _this.hide(); 33390 }).on('resizeme.zf.trigger', function () { 33391 if (_this.isActive) { 33392 _this._setPosition(); 33393 } 33394 }); 33395 } 33396 33397 /** 33398 * adds a toggle method, in addition to the static show() & hide() functions 33399 * @function 33400 */ 33401 }, { 33402 key: "toggle", 33403 value: function toggle() { 33404 if (this.isActive) { 33405 this.hide(); 33406 } else { 33407 this.show(); 33408 } 33409 } 33410 33411 /** 33412 * Destroys an instance of tooltipExt, removes template element from the view. 33413 * @function 33414 */ 33415 }, { 33416 key: "destroy", 33417 value: function destroy() { 33418 this.$element.attr('title', this.template.text()).off('.zf.trigger .zf.tootip') 33419 // .removeClass('has-tip') 33420 .removeAttr('aria-describedby').removeAttr('data-yeti-box').removeAttr('data-toggle').removeAttr('data-resize'); 33421 this.template.remove(); 33422 Foundation.unregisterPlugin(this); 33423 } 33424 }]); 33425 }(); 33426 TooltipExt.defaults = { 33427 disableForTouch: false, 33428 /** 33429 * Time, in ms, before a tooltip should open on hover. 33430 * @option 33431 * @example 200 33432 */ 33433 hoverDelay: 200, 33434 /** 33435 * Time, in ms, a tooltip should take to fade into view. 33436 * @option 33437 * @example 150 33438 */ 33439 fadeInDuration: 150, 33440 /** 33441 * Time, in ms, a tooltip should take to fade out of view. 33442 * @option 33443 * @example 150 33444 */ 33445 fadeOutDuration: 150, 33446 /** 33447 * Disables hover events from opening the tooltip if set to true 33448 * @option 33449 * @example false 33450 */ 33451 disableHover: false, 33452 /** 33453 * Optional addtional classes to apply to the tooltip template on init. 33454 * @option
33455 * @example 'my-cool-tip-class' 33456 */ 33457 templateClasses: '', 33458 /** 33459 * Non-optional class added to tooltip templates. Foundation default is 'tooltip'. 33460 * @option 33461 * @example 'tooltip' 33462 */ 33463 tooltipExtClass: 'tooltip-ext', 33464 /** 33465 * Class applied to the tooltip anchor element. 33466 * @option 33467 * @example 'has-tip' 33468 */ 33469 triggerClass: 'has-tip-ext', 33470 /** 33471 * Minimum breakpoint size at which to open the tooltip. 33472 * @option 33473 * @example 'small' 33474 */ 33475 showOn: 'small', 33476 /** 33477 * Custom template to be used to generate markup for tooltip. 33478 * @option 33479 * @example '<div class="tooltip"></div>' 33480 */ 33481 template: '', 33482 /** 33483 * Text displayed in the tooltip template on open. 33484 * @option 33485 * @example 'Some cool space fact here.' 33486 */ 33487 tipText: '', 33488 touchCloseText: 'Tap to close.', 33489 /** 33490 * Allows the tooltip to remain open if triggered with a click or touch event. 33491 * @option 33492 * @example true 33493 */ 33494 clickOpen: true, 33495 /** 33496 * Additional positioning classes, set by the JS 33497 * @option 33498 * @example 'top' 33499 */ 33500 positionClass: '', 33501 /** 33502 * Distance, in pixels, the template should push away from the anch
33502or on the Y axis. 33503 * @option 33504 * @example 10 33505 */ 33506 vOffset: 10, 33507 /** 33508 * Distance, in pixels, the template should push away from the anchor on the X axis, if aligned to a side. 33509 * @option 33510 * @example 12 33511 */ 33512 hOffset: 12, 33513 /** 33514 */ 33515 source: 'title', 33516 /** 33517 */ 33518 sourceValue: '' 33519 }; 33520 33521 /** 33522 * TODO utilize resize event trigger 33523 */ 33524 33525 // Window exports 33526 Foundation.plugin(TooltipExt, 'TooltipExt'); 33527}(jQuery); 33528 33529},{}],80:[function(require,module,exports){ 33530"use strict"; 33531 33532Object.defineProperty(exports, "__esModule", { 33533 value: true 33534}); 33535exports.getCurrentPosition = getCurrentPosition; 33536exports.gps = void 0; 33537var gps = exports.gps = navigator.geolocation; 33538function getCurrentPosition(successClb, errorClb) { 33539 if (gps) { 33540 gps.getCurrentPosition(successClb ? successClb : function (success) { 33541 //standard implementation 33542 }, errorClb ? errorClb : function (error) { 33543 //standard implementation 33544 }); 33545 } 33546} 33547 33548},{}],81:[function(require,module,exports){ 33549"use strict"; 33550 33551Object.defineProperty(exports, "__esModule", { 33552 value: true 33553}); 33554exports.getApiUrl = getApiUrl; 33555/** 33556 * Funktion zum Ermitteln einer Google Maps API Url mit spezifischen API-Keys 33557 */ 33558 33559function getApiUrl(hostName, channelName) { 33560 var channel = getChannel(channelName); 33561 var brand = getBrand(hostName); 33562 var keyMapping = { 33563 md: { 33564 'sap_commerce': 'AIzaSyAm9hPsS9h-SqiPR0aN97Y21lNWVeimbYQ', 33565 'default': 'AIzaSyDqZ86MI4Zuk1e9RELTuL-SHg0_MV79KCk' 33566 }, 33567 km: { 33568 'sap_commerce': 'AIzaSyD85dZEN94xlQNOqyYnMoYbLVHu4ZzB4z4', 33569 'prepaid': 'AIzaSyAQn4GonVMFZymKq37Wcoo1EN0W0UZtqL8', 33570 'default': 'AIzaSyBKlpbBb2WJ-Q_2IkTYbt1eaxJS2FOpEo8' 33571 }, 33572 fm: { 33573 'sap_commerce': 'AIzaSyCpm8Tja3q3Vs06nnWsnyiAE1RVAN8uzls', 33574 'default': 'AIzaSyAUtkm1IOXKz5CcEyJqsXejG1AQlwJtJ-k' 33575 }, 33576 "default": { 33577 'default': 'AIzaSyB5JjnhicxcqOUICCRwSjmSyhFJ1oFiQk8' 33578 } 33579 }; 33580 var tempKey = keyMapping[brand] || keyMapping["default"]; 33581 var key = tempKey[channel] || tempKey["default"]; 33582 var apiUrl = 'https://maps.googleapis.com/maps/api/js?key=' + key; 33583 return apiUrl; 33584} 33585function getBrand(hostName) { 33586 hostName = hostName || null; 33587 var brand = ''; 33588 switch (true) { 33589 case /^((.*)\.klarmobil\.de)$/.test(hostName): 33590 brand = 'km'; 33591 break; 33592 case /^((.*)\.(mobilcom-debitel|freenet(-mobilfunk)?)\.de)$/.test(hostName): 33593 brand = 'md'; 33594 break; 33595 case /^((.*)\.freenetmobile\.de)$/.test(hostName): 33596 brand = 'fm'; 33597 break; 33598 default: 33599 brand = 'default'; 33600 } 33601 return brand; 33602} 33603function getChannel(channelName) { 33604 var channelList = ['prepaid', 'sap_commerce', 'default']; 33605 var c = channelName || null; 33606 var channel = channelList.find(function (chn) { 33607 return chn === c; 33608 }); 33609 return channel || 'default'; 33610} 33611 33612},{}],82:[function(require,module,exports){ 33613'use strict'; 33614 33615function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 33616var _SGComponent2 = require("SGComponent"); 33617function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 33618function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 33619function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 33620function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 33621function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
33622function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 33623function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 33624function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 33625function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 33626function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 33627function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 33628function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 33629function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 33630function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 33631function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 33632var LazyLoad = /*#__PURE__*/function (_SGComponent) { 33633 function LazyLoad() { 33634 _classCallCheck(this, LazyLoad); 33635 return _callSuper(this, LazyLoad, arguments); 33636 } 33637 _inherits(LazyLoad, _SGComponent); 33638 return _createClass(LazyLoad, [{ 33639 key: "initialize", 33640 value: 33641 /** 33642 * jQuery Unveil 33643 * A very lightweight jQuery plugin to lazy load images 33644 * http://luis-almeida.github.com/unveil 33645 * 33646 * Licensed under the MIT license. 33647 * Copyright 2013 LuÃÂs Almeida 33648 * https://github.com/luis-almeida 33649 * 33650 * 33651 * ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! 33652 * 33653 * !!! Editiert um auf andere data-Attribute zu reagieren !!! 33654 * -> Plugin umbenannt in lazyLoad 33655 * 33656 * ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! 33657 * 33658 */ 33659 33660 function initialize() { 33661 _superPropGet(LazyLoad, "initialize", this, 3)([]); 33662 $.fn.lazyLoad = function (threshold, callback) { 33663 var $w = $(window), 33664 th = threshold || 0, 33665 retina = window.devicePixelRatio > 1, 33666 attrib = retina ? "data-lazy-src-retina" : "data-lazy-src", 33667 images = this, 33668 loaded; 33669 this.one("lazyLoad", function () { 33670 var source = this.getAttribute(attrib); 33671 source = source || this.getAttribute("data-lazy-src"); 33672 if (source) { 33673 this.setAttribute("src", source); 33674 if (typeof callback === "function") callback.call(this); 33675 } 33676 }); 33677 function lazyLoad() { 33678 var inview = images.filter(function () { 33679 var $e = $(this); 33680 if ($e.is(":hidden")) return; 33681 var wt = $w.scrollTop(), 33682 wb = wt + $w.height(), 33683 et = $e.offset().top, 33684 eb = et + $e.height(); 33685 return eb >= wt - th && et <= wb + th; 33686 }); 33687 loaded = inview.trigger("lazyLoad"); 33688 images = images.not(loaded); 33689 } 33690 $w.on("scroll.lazyLoad resize.lazyLoad lookup.lazyLoad", lazyLoad); 33691 lazyLoad(); 33692 return this; 33693 }; 33694 } 33695 }]); 33696}(_SGComponent2.SGComponent);
33697var lazyLoad = new LazyLoad(); // jshint ignore:line 33698 33699},{"SGComponent":83}],83:[function(require,module,exports){ 33700'use strict'; 33701 33702/* 33703 domReady !== false -> document.ready event wird nicht ausgelöst 33704 autoInit !== false -> init() wird nicht automatisch ausgeführt, setzt domReady automatisch auf true 33705*/ 33706Object.defineProperty(exports, "__esModule", { 33707 value: true 33708}); 33709exports.SGComponent = void 0; 33710function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 33711function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 33712function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 33713function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 33714function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 33715function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 33716if (!window.theme) window.theme = {}; 33717var SGComponent = exports.SGComponent = /*#__PURE__*/function () { 33718 function SGComponent(domReady, autoInit) { 33719 _classCallCheck(this, SGComponent); 33720 if (domReady !== false || autoInit !== false) { 33721 var instance = this; 33722 $(document).ready(function () { 33723 instance.initializeReady(); 33724 if (autoInit !== false) { 33725 instance.init(); 33726 } 33727 }); 33728 } 33729 this.initialize(); 33730 } 33731 return _createClass(SGComponent, [{ 33732 key: "initializeReady", 33733 value: function initializeReady() {} 33734 }, { 33735 key: "initialize", 33736 value: function initialize() {} 33737 }, { 33738 key: "init", 33739 value: function init(container) { 33740 if (!container) { 33741 container = document; 33742 } 33743 return container; 33744 } 33745 }]); 33746}(); 33747 33748},{}],84:[function(require,module,exports){ 33749"use strict"; 33750 33751Object.defineProperty(exports, "__esModule", { 33752 value: true 33753}); 33754exports.hashString = hashString; 33755exports.loadScript = loadScript; 33756exports.urlQueryString = urlQueryString; 33757exports.uuid = uuid; 33758var _es6Promise = require("es6-promise/dist/es6-promise.js"); 33759/** 33760 * Creates a universally unique identifier 33761 * 33762 * @returns {string} 33763 */ 33764function uuid() { 33765 var uuid = "", 33766 i, 33767 random; 33768 for (i = 0; i < 32; i++) { 33769 random = Math.random() * 16 | 0; 33770 if (i === 8 || i === 12 || i === 16 || i === 20) { 33771 uuid += "-"; 33772 } 33773 uuid += (i === 12 ? 4 : i === 16 ? random & 3 | 8 : random).toString(16); 33774 } 33775 return uuid; 33776} 33777 33778/** 33779 * creates a string specific 32bit hash 33780 * 33781 * @param str 33782 * @returns {number} 33783 */ 33784function hashString(str) { 33785 var hash = 0, 33786 i, 33787 chr; 33788 if (str.length === 0) return hash; 33789 for (i = 0; i < str.length; i++) { 33790 chr = str.charCodeAt(i); 33791 hash = (hash << 5) - hash + chr; 33792 hash |= 0; // Convert to 32bit integer 33793 } 33794 return hash; 33795} 33796var scriptPromises = []; 33797 33798/** 33799 * Use a promise in order to check if a specific script has already been loaded 33800 * prevent downloading and parsing it multiple times. 33801 * 33802 * @param url 33803 * @returns {Promise} 33804 */ 33805function loadScript(url) { 33806 var hash = hashString(url.split("?")[0]); 33807 if (scriptPromises[hash]) { 33808 return scriptPromises[hash]; 33809 } 33810 scriptPromises[hash] = new _es6Promise.Promise(function (resolve) { 33811 $.getScript(url, function () { 33812 return resolve(); 33813 }); 33814 }); 33815 return scriptPromises[hash]; 33816} 33817 33818/** 33819 * Generates a specific query string. 33820 * Turns arrays in to comma separated lists: 33821 * Sample: ?key=value&array=first,second,third 33822 * 33823 * @param args 33824 * @returns {string} 33825 */ 33826function urlQueryString(args) { 33827 return "?" + Object.keys(args).map(function (key) { 33828 return key + "=" + args[key]; 33829 }).join("&"); 33830} 33831 33832},{"es6-promise/dist/es6-promise.js":11}],85:[function(require,module,exports){ 33833'use strict'; 33834 33835function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 33836Object.defineProperty(exports, "__esModule", { 33837 value: true 33838}); 33839exports.LinkHotline = void 0; 33840var _SGComponent2 = require("SGComponent"); 33841function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 33842function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 33843function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 33844function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 33845function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
33846function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 33847function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 33848function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 33849function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 33850function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 33851function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 33852function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 33853function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 33854function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 33855function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 33856var LinkHotline = exports.LinkHotline = /*#__PURE__*/function (_SGComponent) { 33857 function LinkHotline() { 33858 _classCallCheck(this, LinkHotline); 33859 return _callSuper(this, LinkHotline, arguments); 33860 } 33861 _inherits(LinkHotline, _SGComponent); 33862 return _createClass(LinkHotline, [{ 33863 key: "init", 33864 value: function init(container) { 33865 container = _superPropGet(LinkHotline, "init", this, 3)([container]); 33866 var instance = this; 33867 $(container).find('.link-hotline').each(function () { 33868 if (!instance.isMobile()) { 33869 $(this).addClass('-not-clickable'); 33870 $(this).on('click', function (e) { 33871 e.preventDefault(); 33872 }); 33873 } 33874 }); 33875 } 33876 }, { 33877 key: "isMobile", 33878 value: function isMobile() { 33879 return typeof window.orientation !== "undefined" || navigator.userAgent.indexOf('IEMobile') !== -1; 33880 } 33881 }]); 33882}(_SGComponent2.SGComponent); 33883window.theme.linkHotline = new LinkHotline(); 33884 33885},{"SGComponent":83}],86:[function(require,module,exports){ 33886'use strict'; 33887 33888function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 33889Object.defineProperty(exports, "__esModule", { 33890 value: true 33891}); 33892exports.LinkAnchor = void 0; 33893var _SGComponent2 = require("SGComponent"); 33894var _jump = _interopRequireDefault(require("jump.js")); 33895function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 33896function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 33897function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 33898function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 33899function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 33900function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
33901function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 33902function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 33903function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 33904function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 33905function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 33906function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 33907function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 33908function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 33909function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 33910function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 33911var LinkAnchor = exports.LinkAnchor = /*#__PURE__*/function (_SGComponent) { 33912 function LinkAnchor() { 33913 _classCallCheck(this, LinkAnchor); 33914 return _callSuper(this, LinkAnchor, arguments); 33915 } 33916 _inherits(LinkAnchor, _SGComponent); 33917 return _createClass(LinkAnchor, [{ 33918 key: "init", 33919 value: function init(container) { 33920 container = _superPropGet(LinkAnchor, "init", this, 3)([container]); 33921 $(container).find('a').each(function () { 33922 var anchorElem = $(this); 33923 var href = anchorElem.attr('href'); 33924 var offsetSelector = anchorElem.data('offsetElement') || false; 33925 if (offsetSelector && href && href.match(/#.*/)) { 33926 anchorElem.on('click', function (e) { 33927 e.preventDefault(); 33928 var offset = 0; 33929 var offsetElem = $(offsetSelector); 33930 if (offsetElem) { 33931 offset = offsetElem.height(); 33932 } 33933 (0, _jump["default"])(href, { 33934 duration: 800, 33935 offset: -offset 33936 }); 33937 }); 33938 } 33939 }); 33940 } 33941 }]); 33942}(_SGComponent2.SGComponent); 33943window.theme.LinkAnchor = new LinkAnchor(); 33944 33945},{"SGComponent":83,"jump.js":31}],87:[function(require,module,exports){ 33946'use strict'; 33947 33948function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 33949Object.defineProperty(exports, "__esModule", { 33950 value: true 33951}); 33952exports.ButtonIconScrollUp = void 0; 33953var _SGComponent2 = require("SGComponent"); 33954require("FoundationCore.js"); 33955function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 33956function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 33957function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 33958function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 33959function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
vendor: 2,194 bytes, lines 33960-33969
33960function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 33961function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 33962function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 33963function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 33964function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 33965function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 33966function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 33967function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 33968function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 33969function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
33970var ButtonIconScrollUp = exports.ButtonIconScrollUp = /*#__PURE__*/function (_SGComponent) { 33971 function ButtonIconScrollUp() { 33972 _classCallCheck(this, ButtonIconScrollUp); 33973 return _callSuper(this, ButtonIconScrollUp, arguments); 33974 } 33975 _inherits(ButtonIconScrollUp, _SGComponent); 33976 return _createClass(ButtonIconScrollUp, [{ 33977 key: "initialize", 33978 value: function initialize() { 33979 _superPropGet(ButtonIconScrollUp, "initialize", this, 3)([]); 33980 $('.button-icon--scrollup').hide(); 33981 } 33982 }, { 33983 key: "init", 33984 value: function init(container) { 33985 container = _superPropGet(ButtonIconScrollUp, "init", this, 3)([container]); 33986 $(container).find('.button-icon--scrollup').each(function () { 33987 var instance = this; 33988 $(this).on('click.ButtonIconScrollUp', function () { 33989 var ele = $(this).data('scrollTop') || 'body'; 33990 ele = $(ele).offset().top; 33991 $('html, body').animate({ 33992 scrollTop: ele 33993 }, 'slow'); 33994 }); 33995 $(document).on('scroll.ButtonIconScrollUp', function () { 33996 var topEle = $(instance).data('topEle') || 'body'; 33997 var topOffset = $(instance).data('topOffset') || 0; 33998 var bottomEle = $(instance).data('bottomEle') || 'body'; 33999 var bottomOffset = $(instance).data('bottomOffset') || 0; 34000 var top = $(topEle).offset().top + parseInt(topOffset); 34001 var bottom = $(bottomEle).offset().top + $(bottomEle).height() + parseInt(bottomOffset); 34002 var offset = $(document).scrollTop(); 34003 if (offset > top && offset < bottom) { 34004 var w = window.innerWidth - 1104; 34005 w = Math.round(w / 2); 34006 if (w < 0) { 34007 w = 0; 34008 } else { 34009 w = w - $(instance).width() - 80; 34010 } 34011 if (window.Foundation.MediaQuery.is('small only')) { 34012 w = w + 10; 34013 } else { 34014 w = w + 20; 34015 } 34016 $(instance).css("right", w + "px"); 34017 $(instance).fadeIn(); 34018 } else { 34019 $(instance).fadeOut(); 34020 } 34021 }).trigger('scroll'); 34022 }); 34023 } 34024 }]); 34025}(_SGComponent2.SGComponent); 34026window.theme.buttonIconScrollUp = new ButtonIconScrollUp(); 34027 34028},{"FoundationCore.js":77,"SGComponent":83}],88:[function(require,module,exports){ 34029'use strict'; 34030 34031function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 34032Object.defineProperty(exports, "__esModule", { 34033 value: true 34034}); 34035exports.SliderForm = void 0; 34036var _SGComponent2 = require("SGComponent"); 34037require("FoundationCore.js"); 34038require("FoundationSlider.js"); 34039function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 34040function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 34041function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 34042function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 34043function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 34044function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 34045function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 34046function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 34047function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 34048function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 34049function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 34050function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 34051function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 34052function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
34052 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 34053function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 34054var SliderForm = exports.SliderForm = /*#__PURE__*/function (_SGComponent) { 34055 function SliderForm() { 34056 _classCallCheck(this, SliderForm); 34057 return _callSuper(this, SliderForm, arguments); 34058 } 34059 _inherits(SliderForm, _SGComponent); 34060 return _createClass(SliderForm, [{ 34061 key: "init", 34062 value: function init(container) { 34063 var _this = this; 34064 container = _superPropGet(SliderForm, "init", this, 3)([container]); 34065 this.initTabIndices(); 34066 $('.slider').foundation(); 34067 $(document).on('moved.zf.slider', Foundation.util.throttle(function (e) { 34068 return _this.handleSliderChange(e); 34069 }, 300)); 34070 $('.slider[data-slider-numbers]').each(function (_, sliderEle) { 34071 _this.handleSliderChange({ 34072 target: sliderEle 34073 }); 34074 }); 34075 } 34076 34077 /** 34078 * saves the initial tab indices of the slider elements 34079 */ 34080 }, { 34081 key: "initTabIndices", 34082 value: function initTabIndices() { 34083 $('.slider').each(function (_, sliderEle) { 34084 var $slider = $(sliderEle); 34085 var $handles = $slider.find('.slider-handle'); 34086 var tabindex = {}; 34087 $handles.each(function (index, handle) { 34088 var $handle = $(handle); 34089 tabindex[index] = $handle.attr('tabindex'); 34090 }); 34091 $slider.data('tabindex', tabindex); 34092 }); 34093 } 34094 }, { 34095 key: "handleSliderChange", 34096 value: function handleSliderChange(e) { 34097 var sliderEle = $(e.target); 34098 var start = 0; 34099 var end = sliderEle.data('end'); 34100 var current = $('input[type=hidden]', sliderEle).val(); 34101 if (sliderEle.data('sliderNumbers') !== undefined) { 34102 this.initSliderNumbers(sliderEle, start, end, current); 34103 } 34104 var $handles = sliderEle.find('.slider-handle'); 34105 var tabindex = sliderEle.data('tabindex'); 34106 if ($handles.length > 0) { 34107 $handles.each(function (index, handle) { 34108 var $handle = $(handle); 34109 $handle.attr('tabindex', tabindex[index]); 34110 }); 34111 } 34112 var callback = sliderEle.data('callback'); 34113 if (callback !== undefined) { 34114 this.triggerEvent(callback, current); 34115 } 34116 } 34117 }, { 34118 key: "triggerEvent", 34119 value: function triggerEvent(callbackData, current) { 34120 try { 34121 var callback = JSON.parse(callbackData.replace(/\'/g, '"')); 34122 if (callback.event && callback.target) { 34123 $(callback.target).trigger(callback.event, current); 34124 } 34125 } catch (_) {} 34126 } 34127 }, { 34128 key: "initSliderNumbers", 34129 value: function initSliderNumbers(sliderEle, start, end, current) { 34130 sliderEle.find('.js-numbers').remove(); 34131 sliderEle.append(this.renderNumbers(sliderEle, start, end, current)); 34132 } 34133 }, { 34134 key: "renderNumbers", 34135 value: function renderNumbers(sliderEle, start, end, current) { 34136 var _this2 = this; 34137 var positions = []; 34138 var width = sliderEle.outerWidth(); 34139 var handleWidth = sliderEle.find('.slider-handle').outerWidth(); 34140 for (var i = start; i <= end; i++) { 34141 var frac = parseFloat((end > 0 ? i / end : 0).toFixed(2)); 34142 var pxToMove = (width - handleWidth) * frac; 34143 var percentOfHandle = handleWidth / width / 2; 34144 positions[i] = ((pxToMove / width + percentOfHandle) * 100).toFixed(2); 34145 } 34146 var numberWrapper = $("\n <div class=\"slider__numbers js-numbers\">\n ".concat(Array(end + 1).join(0).split(0).map(function (_, i) { 34147 return _this2.renderNumber(start, i, current, positions[i]); 34148 }).join(''), "\n </div>\n ")); 34149 return numberWrapper; 34150 } 34151 }, { 34152 key: "renderNumber", 34153 value: function renderNumber(start, current, active, position) { 34154 var activeClass = current == active ? '-active' : ''; 34155 return "<div style=\"left:".concat(position, "%\" class=\"slider__numbers-item ").concat(activeClass, "\"><span>").concat(start + current + 1, "</span></div>"); 34156 } 34157 }]); 34158}(_SGComponent2.SGComponent); 34159window.theme.sliderForm = new SliderForm(); 34160 34161},{"FoundationCore.js":77,"FoundationSlider.js":78,"SGComponent":83}],89:[function(require,module,exports){ 34162'use strict'; 34163 34164function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 34165Object.defineProperty(exports, "__esModule", { 34166 value: true 34167}); 34168exports.InputFile = void 0; 34169var _SGComponent2 = require("SGComponent"); 34170require("blueimp-file-upload/js/vendor/jquery.ui.widget.js"); 34171require("blueimp-file-upload/js/jquery.iframe-transport.js"); 34172require("blueimp-file-upload/js/jquery.fileupload.js"); 34173function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 34174function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 34175function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 34176function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 34177function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
34178function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 34179function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 34180function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 34181function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 34182function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 34183function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 34184function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 34185function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 34186function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 34187function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 34188var InputFile = exports.InputFile = /*#__PURE__*/function (_SGComponent) { 34189 function InputFile() { 34190 _classCallCheck(this, InputFile); 34191 return _callSuper(this, InputFile, arguments); 34192 } 34193 _inherits(InputFile, _SGComponent); 34194 return _createClass(InputFile, [{ 34195 key: "init", 34196 value: function init(container) { 34197 var _this = this; 34198 container = _superPropGet(InputFile, "init", this, 3)([container]); 34199 this.inputSelector = '.input--file__input'; 34200 this.fileListSelector = '.input--file__file-list'; 34201 this.fileItemSelector = '.input--file__file-list__item'; 34202 this.fileItemRemoveButtonSelector = '.input--file__file-list__remove-button'; 34203 $(container).find('.input--file').each(function (i, instance) { 34204 _this.initFileItemRemoveButton(instance); 34205 _this.initFileUpload(instance); 34206 }); 34207 } 34208 }, { 34209 key: "initFileItemRemoveButton", 34210 value: function initFileItemRemoveButton(instance) { 34211 var self = this; 34212 $(self.fileItemSelector, instance).each(function (i, fileListItem) { 34213 $(self.fileItemRemoveButtonSelector, fileListItem).on('click', { 34214 fileListItem: fileListItem 34215 }, function (e) { 34216 self.handleRemoveButtonClick($(e.data.fileListItem), instance); 34217 }); 34218 }); 34219 } 34220 }, { 34221 key: "initFileUpload", 34222 value: function initFileUpload(instance) { 34223 var _this2 = this; 34224 $(this.inputSelector, instance).fileupload({ 34225 add: function add(e, data) { 34226 _this2.onFileUploadAdd(data, instance); 34227 }, 34228 fail: function fail(e, data) { 34229 _this2.onFileUploadFail(data, instance); 34230 }, 34231 progress: this.onFileUploadProgress 34232 }); 34233 } 34234 }, { 34235 key: "onFileUploadAdd", 34236 value: function onFileUploadAdd(data, instance) { 34237 var _this3 = this; 34238 var $fileListItem = this.getFileListItemMarkup(data); 34239 data.context = $fileListItem; 34240 data.submit(); 34241 $(this.fileItemRemoveButtonSelector, $fileListItem).on('click', function (e) { 34242 _this3.handleRemoveButtonClick($fileListItem, instance, data); 34243 }); 34244 $(this.fileListSelector, instance).append($fileListItem); 34245 } 34246 }, { 34247 key: "onFileUploadFail", 34248 value: function onFileUploadFail(data, instance) { 34249 data.context.remove(); 34250 } 34251 }, { 34252 key: "onFileUploadProgress", 34253 value: function onFileUploadProgress(e, data) { 34254 if (parseInt(data.loaded) && parseInt(data.total)) { 34255 var progress = Math.round(data.loaded / data.total * 100); 34256 $('.input--file__file-list__progress', data.context).css("width", progress + "%"); 34257 } 34258 } 34259 }, { 34260 key: "handleRemoveButtonClick", 34261 value: function handleRemoveButtonClick($fileListItem, instance, data) { 34262 var readyStateDone = 4;
34263 if (data && data.jqXHR.readyState !== readyStateDone) { 34264 data.jqXHR.abort(); 34265 $(this.inputSelector, instance).trigger('fileuploadcancel', $fileListItem); 34266 } else { 34267 $(this.inputSelector, instance).trigger('fileuploaddelete', $fileListItem); 34268 } 34269 $fileListItem.remove(); 34270 } 34271 }, { 34272 key: "getFileListItemMarkup", 34273 value: function getFileListItemMarkup(data) { 34274 var $removeButton = $('<button type="button" class="input--file__file-list__remove-button"></button>').append($('<i class="fas fa-times"></i>')); 34275 return $('<li class="input--file__file-list__item">').append($('<span class="input--file__file-list__progress"></span>')).append($('<span class="input--file__file-list__label"></span>').text(data.files[0].name)).append($removeButton); 34276 } 34277 }]); 34278}(_SGComponent2.SGComponent); 34279window.theme.inputFile = new InputFile(); 34280 34281},{"SGComponent":83,"blueimp-file-upload/js/jquery.fileupload.js":3,"blueimp-file-upload/js/jquery.iframe-transport.js":4,"blueimp-file-upload/js/vendor/jquery.ui.widget.js":5}],90:[function(require,module,exports){ 34282'use strict'; 34283 34284function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 34285Object.defineProperty(exports, "__esModule", { 34286 value: true 34287}); 34288exports.DateInput = void 0; 34289var _SGComponent2 = require("SGComponent"); 34290var _flatpickr = _interopRequireDefault(require("flatpickr")); 34291function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 34292function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 34293function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 34294function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 34295function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 34296function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 34297function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 34298function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 34299function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 34300function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 34301function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 34302function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 34303function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 34304function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 34305function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
34305 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 34306function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 34307var German = require("flatpickr/dist/l10n/de.js")["default"].de; 34308var DateInput = exports.DateInput = /*#__PURE__*/function (_SGComponent) { 34309 function DateInput() { 34310 _classCallCheck(this, DateInput); 34311 return _callSuper(this, DateInput, arguments); 34312 } 34313 _inherits(DateInput, _SGComponent); 34314 return _createClass(DateInput, [{ 34315 key: "init", 34316 value: function init(container) { 34317 container = _superPropGet(DateInput, "init", this, 3)([container]); 34318 this._inputContainer = $(container).find('.date-input'); 34319 this._input = $(container).find('.date-input__input'); 34320 if (this._input.length) { 34321 var $calendar = (0, _flatpickr["default"])(this._input[0], { 34322 locale: German, 34323 dateFormat: 'd.m.Y', 34324 allowInput: true, 34325 disableMobile: true 34326 }); 34327 } 34328 } 34329 }]); 34330}(_SGComponent2.SGComponent); 34331window.theme.dateInput = new DateInput(); 34332 34333},{"SGComponent":83,"flatpickr":12,"flatpickr/dist/l10n/de.js":13}],91:[function(require,module,exports){ 34334'use strict'; 34335 34336function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 34337Object.defineProperty(exports, "__esModule", { 34338 value: true 34339}); 34340exports.FormError = void 0; 34341var _SGComponent2 = require("SGComponent"); 34342require("FoundationCore.js"); 34343require("FoundationAbide.js"); 34344function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 34345function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 34346function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 34347function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 34348function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 34349function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 34350function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 34351function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 34352function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 34353function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 34354function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 34355function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 34356function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 34357function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
vendor: 4,673 bytes, lines 34357-34400
34357 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 34358function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 34359var FormError = exports.FormError = /*#__PURE__*/function (_SGComponent) { 34360 function FormError() { 34361 _classCallCheck(this, FormError); 34362 return _callSuper(this, FormError, arguments); 34363 } 34364 _inherits(FormError, _SGComponent); 34365 return _createClass(FormError, [{ 34366 key: "init", 34367 value: function init(container) { 34368 container = _superPropGet(FormError, "init", this, 3)([container]); 34369 $('form[data-abide]').not('.js-personal-data[data-abide], .js-login [data-abide], .js-order-status-page[data-abide], .js-kmheader-loginform[data-abide]').foundation(); 34370 $('form[data-abide][data-abide-error-scroll="true"]').not('.js-personal-data[data-abide], .js-login [data-abide], .js-order-status-page[data-abide], .js-kmheader-loginform[data-abide]').on('forminvalid.zf.abide', function () { 34371 $(document).scrollTop($(this).offset().top); 34372 }); 34373 } 34374 }]); 34375}(_SGComponent2.SGComponent); 34376window.theme.formError = new FormError(); 34377 34378},{"FoundationAbide.js":75,"FoundationCore.js":77,"SGComponent":83}],92:[function(require,module,exports){ 34379'use strict'; 34380 34381function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 34382Object.defineProperty(exports, "__esModule", { 34383 value: true 34384}); 34385exports.SwitchForm = void 0; 34386var _SGComponent2 = require("SGComponent"); 34387function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 34388function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 34389function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 34390function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 34391function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 34392function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 34393function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 34394function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 34395function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 34396function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 34397function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 34398function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 34399function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 34400function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
34400 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 34401function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 34402var SwitchForm = exports.SwitchForm = /*#__PURE__*/function (_SGComponent) { 34403 function SwitchForm() { 34404 _classCallCheck(this, SwitchForm); 34405 return _callSuper(this, SwitchForm, arguments); 34406 } 34407 _inherits(SwitchForm, _SGComponent); 34408 return _createClass(SwitchForm, [{ 34409 key: "init", 34410 value: function init(container) { 34411 container = _superPropGet(SwitchForm, "init", this, 3)([container]); 34412 var instance = this; 34413 $(container).find('.switch').each(function () { 34414 var ele = $(this); 34415 if (ele.find(".js-switch-item").first().hasClass("-inactive")) { 34416 ele.addClass("-switched"); 34417 } 34418 ele.find(".js-switch-item").on("click.switchForm", function () { 34419 instance.handleSwitchClick(ele); 34420 }); 34421 }); 34422 this.handleSwitchClick = this.handleSwitchClick.bind(this); 34423 } 34424 }, { 34425 key: "getState", 34426 value: function getState(ele) { 34427 return this.getItemValue(ele, ele.hasClass("-switched") ? ":last-child" : ":first-child"); 34428 } 34429 }, { 34430 key: "getItemValue", 34431 value: function getItemValue(ele, item) { 34432 if (typeof ele.find(".js-switch-item" + item).data("value") !== "undefined") { 34433 return ele.find(".js-switch-item" + item).data("value"); 34434 } else { 34435 return ele.find(".js-switch-item" + item).text(); 34436 } 34437 } 34438 }, { 34439 key: "handleSwitchClick", 34440 value: function handleSwitchClick(ele) { 34441 var inactive = false; 34442 ele.find(".js-switch-item").each(function () { 34443 if ($(this).hasClass("-inactive")) inactive = true; 34444 }); 34445 if (inactive) { 34446 if (ele.find(".js-switch-item").first().hasClass("-inactive")) { 34447 ele.addClass("-switched"); 34448 } else if (ele.find(".js-switch-item").last().hasClass("-inactive")) { 34449 ele.removeClass("-switched"); 34450 } 34451 } else { 34452 ele.toggleClass("-switched"); 34453 } 34454 var val = this.getState(ele); 34455 ele.trigger("change", val); 34456 } 34457 }, { 34458 key: "setState", 34459 value: function setState(ele, state) { 34460 var instance = this; 34461 ele.find(".js-switch-item").each(function (index) { 34462 if ($(this).data("value") == state) { 34463 var isFirst = false; 34464 if (index == 0) isFirst = true; 34465 if (!isFirst && !ele.hasClass("-switched") || isFirst && ele.hasClass("-switched")) { 34466 instance.handleSwitchClick(ele); 34467 } 34468 } 34469 }); 34470 } 34471 }, { 34472 key: "setInactive", 34473 value: function setInactive(ele, state, inactive) { 34474 ele.find(".js-switch-item").each(function () { 34475 if ($(this).data("value") == state) { 34476 if (inactive) { 34477 if (!ele.find(".js-switch-item").hasClass("-inactive")) { 34478 $(this).addClass("-inactive"); 34479 $(this).trigger("click"); 34480 } 34481 } else { 34482 $(this).removeClass("-inactive"); 34483 } 34484 } 34485 }); 34486 } 34487 }]); 34488}(_SGComponent2.SGComponent); 34489window.theme.switchForm = new SwitchForm(); 34490 34491},{"SGComponent":83}],93:[function(require,module,exports){ 34492"use strict"; 34493 34494function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 34495Object.defineProperty(exports, "__esModule", { 34496 value: true 34497}); 34498exports.suggestSearchBar = void 0; 34499var _SGComponent2 = require("SGComponent"); 34500function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 34501function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 34502function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 34503function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 34504function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
34505function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 34506function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 34507function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 34508function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 34509function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 34510function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 34511function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 34512function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 34513function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 34514function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 34515var suggestSearchBar = exports.suggestSearchBar = /*#__PURE__*/function (_SGComponent) { 34516 function suggestSearchBar() { 34517 var _this; 34518 _classCallCheck(this, suggestSearchBar); 34519 _this = _callSuper(this, suggestSearchBar); 34520 _this.instanceList = []; 34521 return _this; 34522 } 34523 _inherits(suggestSearchBar, _SGComponent); 34524 return _createClass(suggestSearchBar, [{ 34525 key: "init", 34526 value: function init(container) { 34527 var _this2 = this; 34528 container = _superPropGet(suggestSearchBar, "init", this, 3)([container]); 34529 $(container).find(".js-search-bar").each(function (i, searchBar) { 34530 _this2.instanceList.push(new SearchBar($(searchBar))); 34531 }); 34532 } 34533 34534 /** 34535 * @param {string} selector 34536 * @param {string[]} list 34537 */ 34538 }, { 34539 key: "updateSuggestions", 34540 value: function updateSuggestions(selector, list) { 34541 this.instanceList.forEach(function (searchBar) { 34542 if (searchBar.$instance.is(selector)) { 34543 searchBar.updateSuggestions(list); 34544 } 34545 }); 34546 } 34547 }]); 34548}(_SGComponent2.SGComponent); 34549var SearchBar = /*#__PURE__*/function () { 34550 function SearchBar($instance) { 34551 _classCallCheck(this, SearchBar); 34552 this.$instance = $instance; 34553 this.$suggestionWrapper = $(".form-search__suggestion-wrapper", this.$instance); 34554 this.$searchInput = $(".form-search__input", this.$instance); 34555 this.$searchSubmit = $(".form-search__search", this.$instance); 34556 this.$mainContent = $('header + section, header + [class$="main-content"]'); 34557 this.keyCodeArrowDown = 40; 34558 this.keyCodeArrowUp = 38; 34559 this.keyCodeEnter = 13; 34560 this.suggestionListActiveIndex = 0; 34561 this.init(); 34562 } 34563 return _createClass(SearchBar, [{ 34564 key: "init", 34565 value: function init() { 34566 this.initEventHandlers(); 34567 this.handleInsertedText(); 34568 } 34569 }, { 34570 key: "initEventHandlers", 34571 value: function initEventHandlers() { 34572 var _this3 = this; 34573 this.$searchInput.on("mousedown", function (e) { 34574 _this3.startSearching(e); 34575 }); 34576 $("form", this.$instance).on({ 34577 keyup: function keyup(e) { 34578 _this3.handleKeysPressed(e); 34579 }, 34580 keydown: function keydown(e) { 34581 _this3.preventScrolling(e); 34582 }, 34583 // Used to be able to use the search suggestions properly on IE because of 34584 // the lack of a ':focus-within' option 34585 focusout: function focusout(e) { 34586 _this3.handleFocusOut(e); 34587 } 34588 }); 34589 this.$suggestionWrapper.on("mouseenter", function (e) { 34590 _this3.focusSearchInput(e); 34591 }); 34592 $(".form-search__delete", this.$instance).on("click", function (e) { 34593 _this3.deleteSearchInput(e); 34594 }); 34595 $(".form-search__end-search", this.$instance).on("click", function (e) { 34596 _this3.endSearch(e); 34597 }); 34598 this.$searchSubmit.on("click", function (e) { 34599 _this3.handleSearchButtonClick(e); 34600 }); 34601 } 34602 }, { 34603 key: "handleInsertedText", 34604 value: function handleInsertedText() {
34605 var searchInstructionsSel = ".form-search__search-instructions"; 34606 var searchHasInput = this.searchHasInput(); 34607 $(searchInstructionsSel, this.$instance).toggleClass("hide", searchHasInput); 34608 this.$instance.toggleClass("-has-input", searchHasInput); 34609 if (!searchHasInput) { 34610 $("ul", this.$suggestionWrapper).remove(); 34611 } 34612 } 34613 34614 /** 34615 * @returns {boolean} 34616 */ 34617 }, { 34618 key: "searchHasInput", 34619 value: function searchHasInput() { 34620 return this.$searchInput.val() !== ""; 34621 } 34622 }, { 34623 key: "startSearching", 34624 value: function startSearching() { 34625 this.$instance.addClass("-searching -focused"); 34626 var mainContent = this.$mainContent.first(); 34627 if (mainContent) { 34628 var mainContentOffset = mainContent.offset(); 34629 if (mainContentOffset) { 34630 var mainContentOffsetTop = mainContentOffset.top; 34631 this.$instance.css("top", mainContentOffsetTop + "px"); 34632 if (!Foundation.MediaQuery.is("large")) { 34633 this.$suggestionWrapper.css("height", window.innerHeight - mainContentOffsetTop - this.$searchInput.offsetHeight + "px"); 34634 } 34635 this.$searchInput.focus(); 34636 } 34637 } 34638 } 34639 }, { 34640 key: "handleKeysPressed", 34641 value: function handleKeysPressed(e) { 34642 switch (e.originalEvent.keyCode) { 34643 case this.keyCodeArrowDown: 34644 this.selectNextListItem(); 34645 break; 34646 case this.keyCodeArrowUp: 34647 this.selectPreviousListItem(); 34648 break; 34649 case this.keyCodeEnter: 34650 if ($.contains(this.$suggestionWrapper.get(0), e.target)) { 34651 this.chooseSuggestion(e.target.innerText); 34652 } 34653 break; 34654 } 34655 this.handleInsertedText(); 34656 } 34657 34658 /** 34659 * Move down in suggestionList with keyboard 34660 */ 34661 }, { 34662 key: "selectNextListItem", 34663 value: function selectNextListItem() { 34664 var $suggestionList = $("ul", this.$suggestionWrapper); 34665 if (this.$searchInput.is(":focus")) { 34666 this.suggestionListActiveIndex = 0; 34667 } else if (this.suggestionListActiveIndex < $("button", $suggestionList).length - 1) { 34668 this.suggestionListActiveIndex++; 34669 } 34670 $("button", $suggestionList).eq(this.suggestionListActiveIndex).focus(); 34671 } 34672 34673 /** 34674 * Move up in suggestionList with keyboard 34675 */ 34676 }, { 34677 key: "selectPreviousListItem", 34678 value: function selectPreviousListItem() { 34679 var $suggestionList = $("ul", this.$suggestionWrapper); 34680 if (this.suggestionListActiveIndex > 0) { 34681 this.suggestionListActiveIndex--; 34682 $("button", $suggestionList).eq(this.suggestionListActiveIndex).focus(); 34683 } else { 34684 this.$searchInput.focus(); 34685 } 34686 } 34687 }, { 34688 key: "preventScrolling", 34689 value: function preventScrolling(e) { 34690 var pressedKey = e.originalEvent.keyCode; 34691 if (pressedKey === this.keyCodeArrowDown || pressedKey === this.keyCodeArrowUp) { 34692 e.preventDefault(); 34693 } 34694 } 34695 }, { 34696 key: "handleFocusOut", 34697 value: function handleFocusOut(e) { 34698 var form = e.currentTarget; 34699 var elementWithinForm = e.relatedTarget; 34700 var isLeavingForm = !$.contains(form, elementWithinForm); 34701 if (isLeavingForm) { 34702 this.$instance.removeClass("-focused"); 34703 } 34704 } 34705 }, { 34706 key: "focusSearchInput", 34707 value: function focusSearchInput() { 34708 this.$searchInput.focus(); 34709 } 34710 }, { 34711 key: "deleteSearchInput", 34712 value: function deleteSearchInput() { 34713 this.clearSearchInput(); 34714 this.$searchInput.focus(); 34715 $("ul", this.$suggestionWrapper).remove(); 34716 } 34717 }, { 34718 key: "clearSearchInput", 34719 value: function clearSearchInput() { 34720 this.$searchInput.val(""); 34721 this.handleInsertedText(); 34722 } 34723 }, { 34724 key: "endSearch", 34725 value: function endSearch() { 34726 this.$instance.removeClass("-searching").removeAttr("style"); 34727 this.$suggestionWrapper.removeAttr("style"); 34728 this.clearSearchInput(); 34729 } 34730 34731 /** 34732 * Select a suggestion from suggestionList 34733 * @param suggestion 34734 */ 34735 }, { 34736 key: "chooseSuggestion", 34737 value: function chooseSuggestion(suggestion) { 34738 this.$searchInput.val(suggestion); 34739 this.$searchSubmit.click(); 34740 } 34741 34742 /** 34743 * Prevent form submit when input is empty 34744 * @param e 34745 */ 34746 }, { 34747 key: "handleSearchButtonClick", 34748 value: function handleSearchButtonClick(e) { 34749 if (!this.searchHasInput()) { 34750 e.preventDefault(); 34751 } 34752 } 34753 }, { 34754 key: "updateSuggestions", 34755 value: function updateSuggestions(list) { 34756 var _this4 = this; 34757 if (this.searchHasInput()) { 34758 // Init suggestion list 34759 if ($("ul", this.$suggestionWrapper).length === 0) { 34760 this.$suggestionWrapper.append('<ul class="form-search__suggestions"></ul>'); 34761 } 34762 var $suggestionList = $("ul", this.$suggestionWrapper); 34763 34764 // Clear previous suggestion list items 34765 $("li", $suggestionList).remove(); 34766 34767 // Build new suggestion list items 34768 var searchInputText = new RegExp(this.$searchInput.val(), "i"); 34769 list.forEach(function (listItem) { 34770 listItem = listItem.replace(searchInputText, '<span class="highlighted">$&</span>'); 34771 $suggestionList.append('<li><button type="button"><span class="form-search__suggestion-text">' + listItem + "</span></button></li>"); 34772 }); 34773 // Mousedown instead of click 34774 // see https://stackoverflow.com/questions/13980448/jquery-focusout-click-conflict 34775 $("button", $suggestionList).on("mousedown", function (e) { 34776 _this4.chooseSuggestion(e.currentTarget.innerText); 34777 }); 34778 } 34779 } 34780 }]); 34781}(); 34782window.theme.suggestSearchBar = new suggestSearchBar(); 34783 34784},{"SGComponent":83}],94:[function(require,module,exports){ 34785'use strict'; 34786 34787function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 34788Object.defineProperty(exports, "__esModule", { 34789 value: true 34790}); 34791exports.ImageExt = void 0; 34792var _SGComponent2 = require("SGComponent"); 34793var _LazyLoad = require("LazyLoad"); 34794function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 34795function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 34796function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 34797function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 34798function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
34799function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 34800function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 34801function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 34802function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 34803function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 34804function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 34805function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 34806function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 34807function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 34808function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } /* jshint ignore:start */ 34809/* jshint ignore:end */ 34810var ImageExt = exports.ImageExt = /*#__PURE__*/function (_SGComponent) { 34811 function ImageExt() { 34812 _classCallCheck(this, ImageExt); 34813 return _callSuper(this, ImageExt, arguments); 34814 } 34815 _inherits(ImageExt, _SGComponent); 34816 return _createClass(ImageExt, [{ 34817 key: "init", 34818 value: function init(container) { 34819 container = _superPropGet(ImageExt, "init", this, 3)([container]); 34820 this.initialize(container); 34821 34822 // HYBRIS-12673 34823 $(window).on('GridSlider.initialized', function () { 34824 this.initialize(container); 34825 }.bind(this)); 34826 } 34827 }, { 34828 key: "initialize", 34829 value: function initialize(container) { 34830 $(container).find('.js-image-ext-lazy').each(function () { 34831 var preload = $(this).data('lazyPreload') || 500; 34832 $(this).addClass('-loading'); 34833 $(this).lazyLoad(preload, function () { 34834 $(this).one('load.ImageExt', function () { 34835 $(this).removeClass('-loading').addClass('-loaded'); 34836 }); 34837 }); 34838 }); 34839 } 34840 }]); 34841}(_SGComponent2.SGComponent); 34842window.theme.imageExt = new ImageExt(); 34843 34844},{"LazyLoad":82,"SGComponent":83}],95:[function(require,module,exports){ 34845'use strict'; 34846 34847function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 34848Object.defineProperty(exports, "__esModule", { 34849 value: true 34850}); 34851exports["default"] = void 0; 34852var _enterView = _interopRequireDefault(require("enter-view")); 34853var _SGComponent2 = require("SGComponent"); 34854function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 34855function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 34856function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 34857function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 34858function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 34859function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
34860function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 34861function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 34862function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 34863function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 34864function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 34865function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 34866function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 34867function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 34868function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 34869function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 34870var PictureTag = exports["default"] = /*#__PURE__*/function (_SGComponent) { 34871 function PictureTag() { 34872 _classCallCheck(this, PictureTag); 34873 return _callSuper(this, PictureTag, arguments); 34874 } 34875 _inherits(PictureTag, _SGComponent); 34876 return _createClass(PictureTag, [{ 34877 key: "init", 34878 value: function init(container) { 34879 container = _superPropGet(PictureTag, "init", this, 3)([container]); 34880 var _self = this; 34881 _self.selector = '.picture-tag'; 34882 $(_self.selector).each(function () { 34883 var lazy = _self.isActive(this, 'lazyLoad'); 34884 if (lazy === false) { 34885 _self.initTag($(this), _self.getOptions(this)); 34886 } 34887 }); 34888 if ($(_self.selector + '[data-lazy-load]').length > 0) { 34889 (0, _enterView["default"])({ 34890 selector: _self.selector + '[data-lazy-load]', 34891 enter: function enter(ele) { 34892 _self.initTag($(ele), _self.getOptions(ele)); 34893 }, 34894 once: true, 34895 offset: 0 34896 }); 34897 } 34898 } 34899 }, { 34900 key: "getOptions", 34901 value: function getOptions(ele) { 34902 var options = {}, 34903 genSizes = '', 34904 _self = this; 34905 options.breakpoints = { 34906 xsmall: '(max-width: 400px)', 34907 small: '(min-width: 401px) and (max-width: 639px)', 34908 medium: '(min-width: 640px) and (max-width: 770px)', 34909 landscape: '(min-width: 771px) and (max-width: 1023px)', 34910 large: '(min-width: 1024px)' 34911 }; 34912 options.sizes = ['xsmall', 'small', 'medium', 'landscape', 'large', 'fallback']; 34913 34914 // prüfe ob bestimmte größen definiert werden sollen, wenn keine gefunden generiere alle 34915 genSizes = $(ele).data('autoGenSizes') || options.sizes.join(','); 34916 genSizes = genSizes.split(','); 34917 genSizes = genSizes.filter(Boolean); 34918 $.each(genSizes, function (i, v) { 34919 genSizes[i] = v.trim(); 34920 }); 34921 genSizes = options.sizes.filter(function (e) { 34922 return this.indexOf(e) !== -1 || _self.isActive(ele, e); 34923 }, genSizes); 34924 options.generateSizes = genSizes.length > 0 ? genSizes : options.sizes; 34925 options.generateSizes = options.generateSizes.filter(function (value) { 34926 return value !== 'fallback'; 34927 }); 34928 options.settings = { 34929 'autogen': this.isActive(ele, 'autoGen'), 34930 'webp': this.isActive(ele, 'webp'), 34931 'webpgen': this.isActive(ele, 'webpGen'), 34932 'retina': this.isActive(ele, 'retina') 34933 }; 34934 return options; 34935 } 34936 }, { 34937 key: "isActive", 34938 value: function isActive(ele, dataName) { 34939 return typeof $(ele).data(dataName) !== 'undefined'; 34940 } 34941 }, { 34942 key: "initTag", 34943 value: function initTag(ele, options) { 34944 var _self = this; 34945 var pictureTag = $('<picture></picture>'); 34946 var fallbackUrl = $(ele).data('fallback') || false; 34947 if (fallbackUrl) { 34948 // Fallback initialisieren, Eigenschaften vom img tag auf den neuen fallback tag übertragen 34949 var fallback = _self.generateFallbackTag(ele, fallbackUrl); 34950 var sourceTags = []; 34951 if (options.settings.autogen) { 34952 $.each(options.generateSizes, function (index, value) { 34953 var imageObj = _self.getImageInfo(fallbackUrl); 34954 if (typeof options.breakpoints[value] !== 'undefined') { 34955 var newImageName = imageObj.name + '_' + value + '.' + imageObj.ext; 34956 var newImageUrl = _self.replaceImageInPath(newImageName, fallbackUrl); 34957 34958 // überschreibe bild falls manuell gesetzt 34959 34960 if ($(ele).data(value) || false) { 34961 imageObj = _self.getImageInfo($(ele).data(value)); 34962 newImageName = imageObj.fullName; 34963 newImageUrl = $(ele).data(value); 34964 } 34965 var st = _self.getSourceTag(ele, newImageUrl, value, options); 34966 if (st) sourceTags.push(st); 34967 sourceTags.push(_self.generateSourceTag(newImageUrl, value, options, false)); 34968 } 34969 }); 34970 } else { 34971 $.each(options.sizes, function (index, value) { 34972 if (typeof options.breakpoints[value] !== 'undefined' && ($(ele).data(value) || false)) { 34973 var st = _self.getSourceTag(ele, $(ele).data(value), value, options); 34974 if (st) sourceTags.push(st); 34975 sourceTags.push(_self.generateSourceTag($(ele).data(value), value, options, false)); 34976 } 34977 }); 34978 } 34979 $.each(sourceTags, function (i, e) { 34980 pictureTag.append(e); 34981 }); 34982 pictureTag.append(fallback); 34983 ele.replaceWith(pictureTag); 34984 } 34985 } 34986 }, { 34987 key: "getSourceTag", 34988 value: function getSourceTag(ele, url, sizeName, options) { 34989 var _self = this; 34990 var imageObj = _self.getImageInfo(url); 34991 if (options.settings.webpgen) { 34992 var genUrl = $(ele).data('webpUrl') || ''; 34993 return _self.generateSourceTag(genUrl + url, sizeName, options, true); 34994 } else if (options.settings.webp) { 34995 var webpImageName = imageObj.name + '_' + sizeName + '.webp'; 34996 var webpImageUrl = _self.replaceImageInPath(webpImageName, url); 34997 return _self.generateSourceTag(webpImageUrl, sizeName, options, true); 34998 } 34999 return null; 35000 } 35001 }, { 35002 key: "generateFallbackTag", 35003 value: function generateFallbackTag(ele, url) { 35004 var _self = this; 35005 var attributes = ele.prop('attributes'); 35006 var fallback = $('<img />'); 35007 $.each(attributes, function () { 35008 if (this.name === 'class') { 35009 this.value = _self.removeClass(this.value, _self.selector.substring(1)); 35010 } 35011 fallback.attr(this.name, this.value); 35012 }); 35013 fallback.attr('src', url); 35014 return fallback; 35015 } 35016 }, { 35017 key: "generateSourceTag", 35018 value: function generateSourceTag(url, size, options, webp) { 35019 var type = ''; 35020 if (options.settings.retina) { 35021 var imageName = this.getImageInfo(url); 35022 url += ' 1x, ' + this.replaceImageInPath(imageName.name + '-2x.' + imageName.ext, url) + ' 2x'; 35023 } 35024 if (webp) { 35025 type = 'type="image/webp"'; 35026 } 35027 return $("<source media=\"".concat(options.breakpoints[size], "\" srcset=\"").concat(url, "\" ").concat(type, ">")); 35028 } 35029 }, { 35030 key: "getImageInfo", 35031 value: function getImageInfo(imageUrl) { 35032 var imageName = imageUrl.replace(/^.*[\\\/]/, ''); 35033 var imageData = imageName.split('.'); 35034 var extension = imageData.splice(-1)[0]; 35035 imageName = imageData.join('.'); 35036 return { 35037 fullName: imageName + '.' + extension, 35038 name: imageName, 35039 ext: extension 35040 }; 35041 } 35042 }, { 35043 key: "replaceImageInPath", 35044 value: function replaceImageInPath(newFullName, url) { 35045 var i = this.getImageInfo(url); 35046 return url.replace(i.fullName, newFullName); 35047 } 35048 }, { 35049 key: "removeClass", 35050 value: function removeClass(classString, className) { 35051 var reg = new RegExp('(\\s|^)' + className + '(\\s|$)'); 35052 return classString.replace(reg, ' '); 35053 } 35054 }]); 35055}(_SGComponent2.SGComponent); 35056window.theme.pictureTag = new PictureTag(); 35057 35058},{"SGComponent":83,"enter-view":10}],96:[function(require,module,exports){ 35059'use strict'; 35060 35061Object.defineProperty(exports, "__esModule", { 35062 value: true 35063}); 35064exports.EmbeddedOptinYt = void 0; 35065var _SGComponent2 = require("SGComponent"); 35066var _jsCookie = _interopRequireDefault(require("js-cookie"));
vendor: 4,687 bytes, lines 35067-35112
35067function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 35068function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 35069function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 35070function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 35071function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 35072function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 35073function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 35074function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 35075function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 35076function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 35077function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 35078function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 35079function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 35080function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 35081function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 35082function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 35083function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 35084var EmbeddedOptinYt = exports.EmbeddedOptinYt = /*#__PURE__*/function (_SGComponent) { 35085 function EmbeddedOptinYt() { 35086 _classCallCheck(this, EmbeddedOptinYt); 35087 return _callSuper(this, EmbeddedOptinYt, arguments); 35088 } 35089 _inherits(EmbeddedOptinYt, _SGComponent); 35090 return _createClass(EmbeddedOptinYt, [{ 35091 key: "init", 35092 value: function init(container) { 35093 container = _superPropGet(EmbeddedOptinYt, "init", this, 3)([container]); 35094 var _self = this; 35095 this.storageAgreeKey = 'youtubeAgreed'; 35096 $(container).find('.embedded-optin-yt').each(function (i, ele) { 35097 var force = window.theme || false; 35098 if (force) force = window.theme.cfg || false; 35099 if (force) force = window.theme.cfg.embeddedOptinYt || false; 35100 if (force) force = window.theme.cfg.embeddedOptinYt.force || false; 35101 if (!_self.userHasAgreed() || force) { 35102 _self.createOverlay($(ele)); 35103 } else { 35104 _self.loadVideo($(ele), false); 35105 } 35106 }); 35107 } 35108 }, { 35109 key: "userHasAgreed", 35110 value: function userHasAgreed() { 35111 var cName = this.storageAgreeKey; 35112 var accepted = false;
35113 var hasLocal = (typeof localStorage === "undefined" ? "undefined" : _typeof(localStorage)) && window.localStorage.getItem(cName) ? window.localStorage.getItem(cName) : null; 35114 var hasCookie = _jsCookie["default"].get(cName); 35115 if (hasLocal == 1 || hasCookie == 1) { 35116 if (hasLocal == 1 && hasCookie == 1) return true; 35117 this.setAgreed(); 35118 accepted = true; 35119 } 35120 return accepted; 35121 } 35122 }, { 35123 key: "setAgreed", 35124 value: function setAgreed() { 35125 if (window.localStorage) { 35126 window.localStorage.setItem(this.storageAgreeKey, 1); 35127 } 35128 _jsCookie["default"].set(this.storageAgreeKey, 1, { 35129 expires: 365, 35130 path: '/', 35131 domain: window.location.hostname 35132 }); 35133 } 35134 }, { 35135 key: "createOverlay", 35136 value: function createOverlay(container) { 35137 var content = $('.js-iframe', container).data('content'); 35138 var link = $('.js-iframe', container).data('link'); 35139 var linkTitle = $('.js-iframe', container).data('linkTitle'); 35140 var previewUrl = $('.js-iframe', container).data('preview'); 35141 var accept = $('.js-iframe', container).data('accept'); 35142 var overlayHtml = $("\n <div class=\"embedded-optin-yt__overlay js-overlay\"></div>\n <div class=\"embedded-optin-yt__wrapper js-overlay-wrapper\">\n <div class=\"embedded-optin-yt__content\">\n ".concat(content, " <a class=\"link-text\" href=\"").concat(link, "\">").concat(linkTitle, "</a>\n </div>\n <div class=\"embedded-optin-yt__cta\">\n <a href=\"#\" class=\"button-text js-overlay-accept\">").concat(accept, "</a>\n </div>\n </div>\n ")); 35143 $('.js-iframe', container).css('background-image', "url('".concat(previewUrl, "')")); 35144 var overlayEle = $(container).prepend(overlayHtml); 35145 this.bindClicks(overlayEle); 35146 } 35147 }, { 35148 key: "bindClicks", 35149 value: function bindClicks(overlayEle) { 35150 var _self = this; 35151 $('.js-overlay', overlayEle).on('click.EmbeddedOptinYt', function (event) { 35152 $('.js-overlay-wrapper', overlayEle).fadeIn({ 35153 start: function start(event) { 35154 $(event.elem).css('display', 'flex'); 35155 } 35156 }); 35157 }); 35158 $('.js-overlay-accept', overlayEle).on('click.EmbeddedOptinYt', function (event) { 35159 event.preventDefault(); 35160 _self.accept(overlayEle); 35161 }); 35162 } 35163 }, { 35164 key: "accept", 35165 value: function accept(overlayEle) { 35166 this.loadVideo(overlayEle, true); 35167 this.removeOverlay(overlayEle); 35168 this.setAgreed(); 35169 } 35170 }, { 35171 key: "loadVideo", 35172 value: function loadVideo(overlayEle, autoplay) { 35173 var targetUrl = $('.js-iframe', overlayEle).attr('data-src'); 35174 if (autoplay) { 35175 targetUrl = targetUrl + (targetUrl.indexOf('?') > -1 ? '&' : '?') + 'autoplay=1'; 35176 } 35177 $('.js-iframe', overlayEle).attr('src', targetUrl); 35178 } 35179 }, { 35180 key: "removeOverlay", 35181 value: function removeOverlay(overlayEle) { 35182 $('.js-overlay, .js-overlay-wrapper', overlayEle).fadeOut({ 35183 done: function done(event) { 35184 $(event.elem).remove(); 35185 } 35186 }); 35187 } 35188 }]); 35189}(_SGComponent2.SGComponent); 35190window.theme.embeddedOptinYt = new EmbeddedOptinYt(); 35191 35192},{"SGComponent":83,"js-cookie":30}],97:[function(require,module,exports){ 35193'use strict'; 35194 35195function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 35196Object.defineProperty(exports, "__esModule", { 35197 value: true 35198}); 35199exports.ToolTipExt = void 0; 35200var _SGComponent2 = require("SGComponent"); 35201require("FoundationCore.js"); 35202require("FoundationTooltipExt.js"); 35203function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 35204function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 35205function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 35206function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 35207function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
35208function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 35209function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 35210function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 35211function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 35212function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 35213function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 35214function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 35215function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 35216function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 35217function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } /* jshint ignore:start */ 35218/* jshint ignore:end */ 35219var ToolTipExt = exports.ToolTipExt = /*#__PURE__*/function (_SGComponent) { 35220 function ToolTipExt() { 35221 _classCallCheck(this, ToolTipExt); 35222 return _callSuper(this, ToolTipExt, arguments); 35223 } 35224 _inherits(ToolTipExt, _SGComponent); 35225 return _createClass(ToolTipExt, [{ 35226 key: "init", 35227 value: function init(container) { 35228 container = _superPropGet(ToolTipExt, "init", this, 3)([container]); 35229 $(container).find('.has-tip-ext').each(function () { 35230 if (!$(this).data('zfPlugin')) { 35231 $(this).foundation(); 35232 } 35233 }); 35234 } 35235 35236 // TODO: ersetzen? 35237 }, { 35238 key: "initFragment", 35239 value: function initFragment(ele) { 35240 $(ele).find('.has-tip-ext').each(function () { 35241 if (!$(this).data('zfPlugin')) { 35242 $(this).foundation(); 35243 } 35244 }); 35245 } 35246 35247 // TODO: wozu? löschen? kein nutzen? 35248 }, { 35249 key: "initAjax", 35250 value: function initAjax() { 35251 $('[data-tooltip-ext-hover]').on('mouseover', function () { 35252 $(this).removeAttr('data-tooltip-ext-hover'); 35253 $(this).attr('data-tooltip-ext', ''); 35254 $(this).foundation(); 35255 }); 35256 } 35257 }]); 35258}(_SGComponent2.SGComponent); 35259window.theme.toolTipExt = new ToolTipExt(); 35260 35261},{"FoundationCore.js":77,"FoundationTooltipExt.js":79,"SGComponent":83}],98:[function(require,module,exports){ 35262//TODO: JS Inhalt prüfen, Ausführen der einzelnen Popups, CSS bei allen Styles 35263// Unterschied: MFP komplett geladen 35264'use strict'; 35265 35266function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 35267Object.defineProperty(exports, "__esModule", { 35268 value: true 35269}); 35270exports.Popup = void 0; 35271var _SGComponent2 = require("SGComponent"); 35272var _EventEmitter = _interopRequireDefault(require("EventEmitter")); 35273var _jqueryMagnificPopup = _interopRequireDefault(require("../../../../vendor/magnific-popup/dist/jquery.magnific-popup.js"));
vendor: 5,086 bytes, lines 35274-35336
35274function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 35275function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 35276function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 35277function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 35278function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 35279function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 35280function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 35281function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 35282function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 35283function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 35284function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 35285function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 35286function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 35287function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 35288function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 35289function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 35290function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } /* jshint ignore:start */ 35291/* jshint ignore:end */ 35292var Popup = exports.Popup = /*#__PURE__*/function (_SGComponent) { 35293 function Popup() { 35294 _classCallCheck(this, Popup); 35295 return _callSuper(this, Popup, arguments); 35296 } 35297 _inherits(Popup, _SGComponent); 35298 return _createClass(Popup, [{ 35299 key: "initialize", 35300 value: function initialize() { 35301 _superPropGet(Popup, "initialize", this, 3)([]); 35302 this.initFormResult = this.initFormResult.bind(this); 35303 } 35304 }, { 35305 key: "init", 35306 value: function init(container) { 35307 container = _superPropGet(Popup, "init", this, 3)([container]); 35308 $.extend(true, $.magnificPopup.defaults, { 35309 tClose: 'Schließen (Esc)', 35310 tLoading: 'Wird geladen...', 35311 gallery: { 35312 tPrev: 'Zurück (Pfeiltaste links)', 35313 tNext: 'Weiter (Pfeiltaste rechts)', 35314 tCounter: '%curr% von %total%' 35315 }, 35316 image: { 35317 tError: '<a href="%url%">Das Bild</a> konnte nicht geladen werden.' 35318 }, 35319 ajax: { 35320 tError: '<a href="%url%">Der Inhalt</a> konnte nicht geladen werden.' 35321 } 35322 }); 35323 this.popupSettings = { 35324 closeBtnInside: true, 35325 closeOnBgClick: true, 35326 showCloseBtn: true, 35327 callbacks: { 35328 open: function open() { 35329 $(this.st.el).trigger('open'); 35330 $(this.content).trigger('open'); 35331 }, 35332 close: function close() { 35333 $(this.st.el).trigger('close'); 35334 $(this.content).trigger('close'); 35335 }, 35336 ajaxContentAdded: function ajaxContentAdded() {
35337 $(this.st.el).trigger('ajaxContentAdded'); 35338 $(this.content).trigger('ajaxContentAdded'); 35339 var eventName = $(this.st.el).data('popupAjaxEvent'); 35340 if (eventName) { 35341 _EventEmitter["default"].emit("Popup.".concat(eventName)); 35342 } 35343 }, 35344 resize: function resize() { 35345 $(this.st.el).trigger('popupResize'); 35346 $(this.content).trigger('popupResize'); 35347 }, 35348 beforeOpen: function beforeOpen() { 35349 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 35350 this.st.mainClass = 'mfp-zoom-in'; 35351 } 35352 } 35353 }; 35354 this.initImage(container); 35355 this.initAjax(container); 35356 this.initIframe(container); 35357 this.initGallery(container); 35358 this.initInline(container); 35359 this.initFormResult(container); 35360 this.addEventToCustomCloseButton(container); 35361 } 35362 }, { 35363 key: "initImage", 35364 value: function initImage(container) { 35365 var instance = this; 35366 $(container).find('.popup-image').each(function () { 35367 var title = $(this).data('popupTitle') ? '<div class="headline3 -bar -no-margin-bottom">' + $(this).data('popupTitle') + '</div>' : ''; 35368 var popupImage = { 35369 type: 'image', 35370 modal: $(this).data('popupModal') ? true : false, 35371 image: { 35372 markup: '<div class="mfp-figure">' + '<div class="mfp-popup-box">' + '<div class="mfp-close"></div>' + title + '<div class="mfp-img"></div>' + '<div class="mfp-bottom-bar">' + '<div class="mfp-counter"></div>' + '</div>' + '</div>' + '</div>' 35373 } 35374 }; 35375 $.extend(true, popupImage, Popup.overrideDefaultSettings($(this), instance.popupSettings)); 35376 $(this).magnificPopup(popupImage); 35377 }); 35378 } 35379 }, { 35380 key: "initAjax", 35381 value: function initAjax(container) { 35382 var instance = this; 35383 $(container).find('.popup-ajax').each(function () { 35384 var title = $(this).data('popupTitle') ? '<h3 class="headline3 -bar -no-margin-bottom">' + $(this).data('popupTitle') + '</h3>' : ''; 35385 var popupAjax = { 35386 type: 'ajax', 35387 modal: $(this).data('popupModal') ? true : false, 35388 closeOnContentClick: false, 35389 callbacks: { 35390 parseAjax: function parseAjax(mfpResponse) { 35391 mfpResponse.data = '<div>' + title + '<div class="mfp-popup-content-holder">' + mfpResponse.data + '</div>' + '</div>'; 35392 } 35393 } 35394 }; 35395 $.extend(true, popupAjax, Popup.overrideDefaultSettings($(this), instance.popupSettings)); 35396 $(this).magnificPopup(popupAjax); 35397 }); 35398 } 35399 }, { 35400 key: "initIframe", 35401 value: function initIframe(container) { 35402 var instance = this; 35403 $(container).find('.popup-iframe').each(function () { 35404 var title = $(this).data('popupTitle') ? '<h3 class="headline3 -bar -no-margin-bottom">' + $(this).data('popupTitle') + '</h3>' : ''; 35405 var popupIframe = { 35406 type: 'iframe', 35407 modal: $(this).data('popupModal') ? true : false, 35408 iframe: { 35409 markup: '<div class="mfp-iframe-scaler">' + '<div class="mfp-close"></div>' + title + '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>' + '</div>' 35410 } 35411 }; 35412 $.extend(true, popupIframe, Popup.overrideDefaultSettings($(this), instance.popupSettings)); 35413 $(this).magnificPopup(popupIframe); 35414 }); 35415 } 35416 }, { 35417 key: "initGallery", 35418 value: function initGallery(container) { 35419 var instance = this; 35420 $(container).find('.popup-gallery').each(function () { 35421 var popupGallery = { 35422 type: 'image', 35423 delegate: 'a', 35424 modal: $(this).data('popupModal') ? true : false, 35425 gallery: { 35426 enabled: true 35427 }, 35428 callbacks: { 35429 buildControls: function buildControls() { 35430 this.contentContainer.append(this.arrowLeft.add(this.arrowRight)); 35431 } 35432 }, 35433 image: { 35434 markup: '<div class="mfp-figure">' + '<div class="mfp-popup-box">' + '<div class="mfp-close"></div>' + '<div class="mfp-img"></div>' + '<div class="mfp-bottom-bar">' + '<div class="mfp-counter"></div>' + '</div>' + '</div>' + '</div>' 35435 } 35436 }; 35437 $.extend(true, popupGallery, Popup.overrideDefaultSettings($(this), instance.popupSettings)); 35438 $(this).magnificPopup(popupGallery); 35439 }); 35440 $(container).find('.popup-multi-gallery').each(function () { 35441 var c = $(this).data('popupContent'); 35442 if (c.match(/^\[\{(.*)\}\]$/g)) { 35443 c = eval(c); // jshint ignore:line 35444 var popupMultiGallery = { 35445 type: 'image', 35446 items: c, 35447 modal: $(this).data('popupModal') ? true : false, 35448 gallery: { 35449 enabled: true 35450 }, 35451 callbacks: { 35452 buildControls: function buildControls() { 35453 this.contentContainer.append(this.arrowLeft.add(this.arrowRight)); 35454 } 35455 }, 35456 image: { 35457 markup: '<div class="mfp-figure">' + '<div class="mfp-popup-box">' + '<div class="mfp-close"></div>' + '<div class="mfp-img"></div>' + '<div class="mfp-bottom-bar">' + '<div class="mfp-counter"></div>' + '</div>' + '</div>' + '</div>' 35458 }, 35459 iframe: { 35460 markup: '<div class="mfp-iframe-scaler">' + '<div class="mfp-close"></div>' + '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>' + '</div>' 35461 } 35462 }; 35463 $.extend(true, popupMultiGallery, Popup.overrideDefaultSettings($(this), instance.popupSettings)); 35464 $(this).magnificPopup(popupMultiGallery); 35465 } 35466 }); 35467 } 35468 }, { 35469 key: "initInline", 35470 value: function initInline(container) { 35471 var instance = this; 35472 $(container).find('.popup-inline').each(function () { 35473 var content; 35474 if (typeof $(this).data('popupOnPageLoad') != 'undefined') { 35475 content = $(this); 35476 } else if ($(this).data('popupInline') != 'undefined') { 35477 content = $(this).data('popupInline'); 35478 content = $('#' + content); 35479 } else { 35480 return; 35481 } 35482 var title = $(this).data('popupTitle') ? '<h3 class="mfp-title headline3 -bar">' + $(this).data('popupTitle') + '</h3>' : ''; 35483 if (content.find('.mfp-title').length === 0) {
35484 content.prepend(title); 35485 } 35486 var popupInline = { 35487 type: 'inline', 35488 modal: $(this).data('popupModal') ? true : false, 35489 items: { 35490 src: content, 35491 type: 'inline' 35492 } 35493 }; 35494 $.extend(true, popupInline, Popup.overrideDefaultSettings($(this), instance.popupSettings)); 35495 $(this).magnificPopup(popupInline); 35496 if (typeof $(this).data('popupOnPageLoad') != 'undefined') { 35497 $(this).magnificPopup('open'); // TODO: close Btn funktioniert nicht 35498 } 35499 }); 35500 } 35501 }, { 35502 key: "initFormResult", 35503 value: function initFormResult(container) { 35504 //TODO: funktioniert im SG nicht 35505 var instance = this; 35506 $(container).find('.popup-form-result').each(function () { 35507 var currentElement = $(this); 35508 var modalValue = $(this).data('popupModal') ? true : false; 35509 currentElement.on('click.popup', function (e) { 35510 e.preventDefault(); 35511 if (currentElement.closest("form").length > 0) { 35512 var form = currentElement.closest("form"); 35513 currentElement.addClass('-loading'); 35514 if (form.find(".js-popup-form-result-toggle").length > 0) { 35515 form.find(".js-popup-form-result-toggle").val(true); 35516 } 35517 35518 // Load Animation 35519 if ($('.js-popup-form-result-bg').length === 0) { 35520 $('body').append('<div class="popup-form-result-bg js-popup-form-result-bg"></div>'); 35521 } 35522 $('.js-popup-form-result-bg').show(); 35523 $.ajax({ 35524 type: form.attr('method'), 35525 url: form.attr('action'), 35526 data: form.serialize(), 35527 cache: false, 35528 dataType: "html", 35529 success: function success(data) { 35530 // Remove Loading 35531 $('.js-popup-form-result-bg').hide(); 35532 var content = $(data); 35533 var trackingJs = /<script class="js-tracking-data">[\s\S]*?<\/script>/.exec(data); 35534 var trackingNode = $(".js-tracking-data"); 35535 trackingNode.last().after(trackingJs); 35536 var popupInline = { 35537 type: 'inline', 35538 modal: modalValue, 35539 mainClass: 'mfp-noanimation', 35540 items: { 35541 src: content.prop('outerHTML'), 35542 type: 'inline' 35543 } 35544 }; 35545 currentElement.magnificPopup(Popup.overrideDefaultSettings($(this), popupInline)); 35546 currentElement.magnificPopup('open'); 35547 instance.addEventToCustomCloseButton(container); 35548 currentElement.removeClass('-loading'); 35549 }, 35550 error: function error(XMLHttpRequest, textStatus, errorThrown) { 35551 if (form.find(".js-popup-form-result-toggle").length > 0) { 35552 form.find(".js-popup-form-result-toggle").val(false); 35553 } 35554 if (console && console.error) { 35555 console.error("Status: " + textStatus); 35556 console.error("Error: " + errorThrown); 35557 } 35558 form.submit(); 35559 currentElement.removeClass('-loading'); 35560 } 35561 }); 35562 } 35563 }); 35564 }); 35565 } 35566 }, { 35567 key: "addEventToCustomCloseButton", 35568 value: function addEventToCustomCloseButton(container) { 35569 $.magnificPopup.instance.close = function () { 35570 $(document).trigger('popup-overlay-closed'); 35571 $.magnificPopup.proto.close.call(this); 35572 }; 35573 $(container).find('.popup-close').each(function () { 35574 var currentElement = $(this); 35575 var currentTitle = currentElement.attr('title'); 35576 currentElement.attr('title', currentTitle ? currentTitle.replace(/%title%/i, $.magnificPopup.defaults.tClose) : $.magnificPopup.defaults.tClose); 35577 currentElement.on('click.popup', function () { 35578 $.magnificPopup.close(); 35579 }); 35580 }); 35581 } 35582 }], [{ 35583 key: "overrideDefaultSettings", 35584 value: 35585 // Werden bestimmte PopupSettings via data-Attribute gesetzt, dann kann das default setting damit überschrieben werden 35586 function overrideDefaultSettings(el, settings) { 35587 var result = {}; 35588 _extends(result, settings); 35589 if (el.data('popupShowCloseBtn') === false) { 35590 result.showCloseBtn = false;
vendor: 4,375 bytes, lines 35591-35630
35591 } else if (el.data('popupCloseMarkup')) { 35592 result.closeMarkup = el.data('popupCloseMarkup'); 35593 } 35594 if (el.data('popupCloseOnBgClick') === false) { 35595 result.closeOnBgClick = false; 35596 } 35597 return result; 35598 } 35599 }]); 35600}(_SGComponent2.SGComponent); 35601window.theme.popup = new Popup(); 35602 35603},{"../../../../vendor/magnific-popup/dist/jquery.magnific-popup.js":139,"EventEmitter":74,"SGComponent":83}],99:[function(require,module,exports){ 35604'use strict'; 35605 35606Object.defineProperty(exports, "__esModule", { 35607 value: true 35608}); 35609exports.MessageOutdated = void 0; 35610var _SGComponent2 = require("SGComponent"); 35611var _browserDetect = _interopRequireDefault(require("browser-detect")); 35612var _jsCookie = _interopRequireDefault(require("js-cookie")); 35613function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 35614function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 35615function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 35616function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 35617function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 35618function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 35619function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 35620function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 35621function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 35622function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 35623function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 35624function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 35625function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 35626function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 35627function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 35628function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 35629function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 35630var MessageOutdated = exports.MessageOutdated = /*#__PURE__*/function (_
35630SGComponent) { 35631 function MessageOutdated() { 35632 _classCallCheck(this, MessageOutdated); 35633 return _callSuper(this, MessageOutdated, arguments); 35634 } 35635 _inherits(MessageOutdated, _SGComponent); 35636 return _createClass(MessageOutdated, [{ 35637 key: "init", 35638 value: function init(container) { 35639 container = _superPropGet(MessageOutdated, "init", this, 3)([container]); 35640 this.outdated = $('#outdated-browser'); 35641 this.supportedBrowser = { 35642 ie: 12, 35643 // IE >= 10 35644 firefox: 60, 35645 // Firefox >= 50 35646 opera: 23, 35647 // Opera >= 23 35648 safari: 11, 35649 // Safari >= 10 35650 edge: 15, 35651 // Edge >= 15 35652 chrome: 60, 35653 // Chrome >= 60 35654 crios: 60 // Chrome on iOS >= 60 35655 }; 35656 this.browserResult = (0, _browserDetect["default"])(); 35657 if (this.isOutdatedBrowser() && !this.isBotOrCrawler() && !this.isExcluded() && !this.isWebView() && !this.alreadyAccepted()) { 35658 this.startStylesAndEvents(); 35659 } 35660 } 35661 }, { 35662 key: "isOutdatedBrowser", 35663 value: function isOutdatedBrowser() { 35664 var outdated = false; 35665 if (this.supportedBrowser.hasOwnProperty(this.browserResult.name)) { 35666 var browserSetting = this.supportedBrowser[this.browserResult.name]; 35667 if (this.browserResult.versionNumber < browserSetting) { 35668 outdated = true; 35669 } 35670 } 35671 if (this.isAndroidStockBrowser()) { 35672 outdated = true; 35673 } 35674 return outdated; 35675 } 35676 }, { 35677 key: "isBotOrCrawler", 35678 value: function isBotOrCrawler() { 35679 var navU = navigator.userAgent; 35680 var re = new RegExp(/(googlebot\/|Google Search Console|Googlebot-Mobile|Googlebot-Image|Google favicon|Mediapartners-Google|bingbot|slurp|java|wget|curl|Commons-HttpClient|Python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|biglotron|teoma|convera|seekbot|gigablast|exabot|ngbot|ia_archiver|GingerCrawler|webmon |httrack|webcrawler|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|bibnum.bnf|findlink|msrbot|panscient|yacybot|AISearchBot|IOI|ips-agent|tagoobot|MJ12bot|dotbot|woriobot|yanga|buzzbot|mlbot|yandexbot|purebot|Linguee Bot|Voyager|CyberPatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|Adidxbot|blekkobot|ezooms|dotbot|Mail.RU_Bot|discobot|heritrix|findthatfile|europarchive.org|NerdByNature.Bot|sistrix crawler|ahrefsbot|Aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|facebookexternalhit|yeti|RetrevoPageAnalyzer|lb-spider|sogou|lssbot|careerbot|wotbox|wocbot|ichiro|DuckDuckBot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnam gnam spider|web-archive-net.com.bot|backlinkcrawler|coccoc|integromedb|content crawler spider|toplistbot|seokicks-robot|it2media-domain-crawler|ip-web-crawler.com|siteexplorer.info|elisabot|proximic|changedetection|blexbot|arabot|WeSEE:Search|niki-bot|CrystalSemanticsBot|rogerbot|360Spider|psbot|InterfaxScanBot|Lipperhey SEO Service|CC Metadata Scaper|g00g1e.net|GrapeshotCrawler|urlappendbot|brainobot|fr-crawler|binlar|SimpleCrawler|Livelapbot|Twitterbot|cXensebot|smtbot|bnf.fr_bot|A6-Indexer|ADmantX|Facebot|Twitterbot|OrangeBot|memorybot|AdvBot|MegaIndex|SemanticScholarBot|ltx71|nerdybot|xovibot|BUbiNG|Qwantify|archive.org_bot|Applebot|TweetmemeBot|crawler4j|findxbot|SemrushBot|yoozBot|lipperhey|y!j-asr|Domain Re-Animator Bot|AddThis)/i); 35681 return re.test(navU); 35682 } 35683 }, { 35684 key: "isExcluded", 35685 value: function isExcluded() { 35686 var navU = navigator.userAgent; 35687 var re = new RegExp(/(FBAN|FBAV|SAMSUNG)/i); 35688 return re.test(navU); 35689 } 35690 }, { 35691 key: "isWebView", 35692 value: function isWebView() { 35693 var navU = navigator.userAgent; 35694 var hasChrome = /Chrome\//.test(navU); 35695 var hasWv = /wv/.test(navU); 35696 return hasChrome && hasWv; 35697 } 35698 35699 /** 35700 * Android Stock-Browser on device with older android system version 35701 * are not supported too. We will declare all browser without chrome 35702 * engine for outdated. 35703 * 35704 * @property isAndroidStockBrowser 35705 * @see http://stackoverflow.com/a/19915132/1295622 35706 * @see https://developer.chrome.com/multidevice/webview/overview#webview_faq 35707 * @return {Boolean} [description] 35708 */ 35709 }, { 35710 key: "isAndroidStockBrowser", 35711 value: function isAndroidStockBrowser() { 35712 var navU = navigator.userAgent; 35713 35714 // Android Mobile 35715 var isAndroidMobile = navU.indexOf('Android') > -1 && navU.indexOf('Mozilla/5.0') > -1 && navU.indexOf('AppleWebKit') > -1; 35716 35717 // Apple webkit
35718 var regExAppleWebKit = new RegExp(/AppleWebKit\/([\d.]+)/); 35719 var resultAppleWebKitRegEx = regExAppleWebKit.exec(navU); 35720 var appleWebKitVersion = resultAppleWebKitRegEx === null ? null : parseFloat(regExAppleWebKit.exec(navU)[1]); 35721 35722 // Chrome 35723 var regExChrome = new RegExp(/Chrome\/([\d.]+)/); 35724 var resultChromeRegEx = regExChrome.exec(navU); 35725 var chromeVersion = resultChromeRegEx === null ? null : parseFloat(regExChrome.exec(navU)[1]); 35726 35727 // Native Android Browser 35728 return isAndroidMobile && appleWebKitVersion !== null && appleWebKitVersion < 537 || chromeVersion !== null && chromeVersion < 30; 35729 } 35730 }, { 35731 key: "startStylesAndEvents", 35732 value: function startStylesAndEvents() { 35733 var instance = this; 35734 var btnClose = $('#message-outdatedCloseBtn'); 35735 var wrapper = $(".pushmenu-wrapper"); 35736 var overlay = $('<div id="message-outdatedOverlay"></div'); 35737 35738 //Outdated Modul einfärben 35739 instance.outdated.css("background-color", instance.bkgColor).css("color", instance.txtColor).children(0).css("color", instance.txtColor).children(1).css("color", instance.txtColor); 35740 instance.outdated.show(); 35741 $('body').addClass("is-outdated"); 35742 wrapper.append(overlay); 35743 35744 //Click Event 35745 btnClose.css("color", instance.txtColor); 35746 btnClose.on('click.MessageOutdated', function (event) { 35747 $(overlay, wrapper).remove(); 35748 $('body').removeClass("is-outdated"); 35749 instance.setAcceptedState(); 35750 instance.outdated.hide(); 35751 }); 35752 } 35753 }, { 35754 key: "setAcceptedState", 35755 value: function setAcceptedState() { 35756 var cName = 'sg-outdated'; 35757 if (window.localStorage) { 35758 window.localStorage.setItem(cName, 1); 35759 } 35760 var domain = window.location.hostname.split('.'); 35761 if (domain.length === 3) { 35762 domain.shift(); 35763 domain = domain.join('.'); 35764 } else { 35765 domain = window.location.hostname; 35766 } 35767 _jsCookie["default"].set(cName, 1, { 35768 expires: 365, 35769 path: '/', 35770 domain: domain 35771 }); 35772 } 35773 }, { 35774 key: "alreadyAccepted", 35775 value: function alreadyAccepted() { 35776 var cName = 'sg-outdated'; 35777 var accepted = false; 35778 var hasLocal = (typeof localStorage === "undefined" ? "undefined" : _typeof(localStorage)) && window.localStorage.getItem(cName) ? window.localStorage.getItem(cName) : null; 35779 var hasCookie = _jsCookie["default"].get(cName); 35780 if (hasLocal || hasCookie) { 35781 if (hasLocal && hasCookie) return true; 35782 this.setAcceptedState(); 35783 accepted = true; 35784 } 35785 return accepted; 35786 } 35787 }]); 35788}(_SGComponent2.SGComponent); 35789window.theme.messageOutdated = new MessageOutdated(); 35790 35791},{"SGComponent":83,"browser-detect":7,"js-cookie":30}],100:[function(require,module,exports){ 35792'use strict'; 35793 35794function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 35795Object.defineProperty(exports, "__esModule", { 35796 value: true 35797}); 35798exports.Accordion = void 0; 35799var _SGComponent2 = require("SGComponent"); 35800require("FoundationCore.js"); 35801require("FoundationAccordion.js"); 35802function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 35803function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 35804function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 35805function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 35806function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
vendor: 4,294 bytes, lines 35807-35847
35807function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 35808function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 35809function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 35810function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 35811function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 35812function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 35813function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 35814function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 35815function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 35816function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 35817var Accordion = exports.Accordion = /*#__PURE__*/function (_SGComponent) { 35818 function Accordion() { 35819 _classCallCheck(this, Accordion); 35820 return _callSuper(this, Accordion, arguments); 35821 } 35822 _inherits(Accordion, _SGComponent); 35823 return _createClass(Accordion, [{ 35824 key: "init", 35825 value: function init(container) { 35826 container = _superPropGet(Accordion, "init", this, 3)([container]); 35827 $(container).find('.accordion').foundation(); 35828 } 35829 }]); 35830}(_SGComponent2.SGComponent); 35831window.theme.accordion = new Accordion(); 35832 35833},{"FoundationAccordion.js":76,"FoundationCore.js":77,"SGComponent":83}],101:[function(require,module,exports){ 35834'use strict'; 35835 35836function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 35837Object.defineProperty(exports, "__esModule", { 35838 value: true 35839}); 35840exports.ProductOptions = void 0; 35841var _SGComponent2 = require("SGComponent"); 35842require("FoundationCore.js"); 35843function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 35844function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 35845function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 35846function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 35847function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
35848function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 35849function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 35850function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 35851function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 35852function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 35853function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 35854function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 35855function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 35856function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 35857function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 35858var ProductOptions = exports.ProductOptions = /*#__PURE__*/function (_SGComponent) { 35859 function ProductOptions() { 35860 _classCallCheck(this, ProductOptions); 35861 return _callSuper(this, ProductOptions, arguments); 35862 } 35863 _inherits(ProductOptions, _SGComponent); 35864 return _createClass(ProductOptions, [{ 35865 key: "init", 35866 value: function init(container) { 35867 container = _superPropGet(ProductOptions, "init", this, 3)([container]); 35868 var instance = this; 35869 var $context = $(container); 35870 $context.on('click touchstart', '.js-flip-card', function (e) { 35871 $(this).closest('.options-card').toggleClass('is-flipped'); 35872 }); 35873 $context.on('change', '.js-select-option', function (e) { 35874 var card = $(this).closest('.options-card'); 35875 var checked = $(this).prop('checked'); 35876 card.find('input[type=checkbox]').prop('checked', checked); 35877 card.trigger('option-selected', { 35878 checked: checked, 35879 card: card 35880 }); 35881 }); 35882 $context.on('option-selected', '.options-card', function (e, data) { 35883 var card = $(data.card); 35884 card.toggleClass('is-selected', data.checked); 35885 var selectTextElement = card.find('.select-text'); 35886 selectTextElement.text(data.checked ? selectTextElement.data('selected-text') : selectTextElement.data('default-text')); 35887 }); 35888 } 35889 }]); 35890}(_SGComponent2.SGComponent); 35891window.theme.productOptions = new ProductOptions(); 35892 35893},{"FoundationCore.js":77,"SGComponent":83}],102:[function(require,module,exports){ 35894'use strict'; 35895 35896function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 35897Object.defineProperty(exports, "__esModule", { 35898 value: true 35899}); 35900exports.ProductCrossselling = void 0; 35901var _SGComponent2 = require("SGComponent"); 35902require("FoundationCore.js"); 35903function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 35904function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 35905function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 35906function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 35907function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
vendor: 5,215 bytes, lines 35908-35967
35908function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 35909function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 35910function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 35911function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 35912function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 35913function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 35914function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 35915function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 35916function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 35917function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 35918var ProductCrossselling = exports.ProductCrossselling = /*#__PURE__*/function (_SGComponent) { 35919 function ProductCrossselling() { 35920 _classCallCheck(this, ProductCrossselling); 35921 return _callSuper(this, ProductCrossselling, arguments); 35922 } 35923 _inherits(ProductCrossselling, _SGComponent); 35924 return _createClass(ProductCrossselling, [{ 35925 key: "init", 35926 value: function init(container) { 35927 container = _superPropGet(ProductCrossselling, "init", this, 3)([container]); 35928 // const instance = this; 35929 // const $context = $(container); 35930 } 35931 35932 /** 35933 * click handler für Klick auf die Category Header 35934 * @param e 35935 */ 35936 }, { 35937 key: "categoryClickHandler", 35938 value: function categoryClickHandler(e) { 35939 var contentContainer = $(e.currentTarget).siblings(".tariff-detail-layer__category-content"); 35940 if (contentContainer.hasClass("-is-active")) { 35941 contentContainer.removeClass("-is-active").css("max-height", contentContainer[0].scrollHeight + "px").siblings(".tariff-detail-layer__category").removeClass("-is-active"); 35942 window.setTimeout(function () { 35943 contentContainer.css('max-height', 0); 35944 }, 50); 35945 } else { 35946 contentContainer.addClass("-is-active").css("max-height", parseInt(contentContainer[0].scrollHeight + 10) + "px"); 35947 contentContainer.siblings(".tariff-detail-layer__category").addClass("-is-active"); 35948 } 35949 } 35950 }]); 35951}(_SGComponent2.SGComponent); 35952window.theme.ProductCrossselling = new ProductCrossselling(); 35953 35954},{"FoundationCore.js":77,"SGComponent":83}],103:[function(require,module,exports){ 35955"use strict"; 35956 35957function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 35958Object.defineProperty(exports, "__esModule", { 35959 value: true 35960}); 35961exports.VariantSwitch = void 0; 35962var _SGComponent2 = require("SGComponent"); 35963function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 35964function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 35965function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 35966function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 35967function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
35968function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 35969function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 35970function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 35971function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 35972function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 35973function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 35974function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 35975function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 35976function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 35977function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 35978var VariantSwitch = exports.VariantSwitch = /*#__PURE__*/function (_SGComponent) { 35979 function VariantSwitch() { 35980 _classCallCheck(this, VariantSwitch); 35981 return _callSuper(this, VariantSwitch, arguments); 35982 } 35983 _inherits(VariantSwitch, _SGComponent); 35984 return _createClass(VariantSwitch, [{ 35985 key: "init", 35986 value: function init(container) { 35987 container = _superPropGet(VariantSwitch, "init", this, 3)([container]); 35988 var instance = this; 35989 $(container).find(".variant-switch").each(function () { 35990 var ele = this; 35991 instance.initState(ele); 35992 $(".js-variant-button", ele).on("click.VariantSwitch", function (e) { 35993 e.preventDefault(); 35994 if (!$(this).hasClass("-disabled")) { 35995 instance.setState(ele, $(this)); 35996 instance.triggerCallbackEvent(ele); 35997 } 35998 }); 35999 $(".js-variant-select", ele).on("change.ConfigNavigation", function (e) { 36000 e.preventDefault(); 36001 var selected = $(this).val(); 36002 if (!$(this).hasClass("-disabled")) { 36003 $(ele).data("value", selected); 36004 instance.triggerCallbackEvent(ele); 36005 } 36006 }); 36007 }); 36008 } 36009 }, { 36010 key: "initState", 36011 value: function initState(ele) { 36012 $(ele).find(".js-variant-button").removeClass("-active"); 36013 var multiselect = $(ele).data("multiselect") || false; 36014 var required = $(ele).data("required") || false; 36015 var dataValue = $(ele).data("value") || false; 36016 if (dataValue) { 36017 dataValue = $(ele).data("value").toString().split("|"); 36018 var i = dataValue.length; 36019 while (i--) { 36020 if ($('.js-variant-button[data-button-value="' + dataValue[i] + '"]', ele).hasClass("-disabled") || $('.js-variant-button[data-button-value="' + dataValue[i] + '"]', ele).length == 0) dataValue.splice(i, 1); 36021 } 36022 } 36023 var checkVariants = dataValue && dataValue.length > 0 ? dataValue : required ? [$(ele).find(".js-variant-button").first().data("buttonValue")] : []; 36024 if (checkVariants.length > 0) { 36025 checkVariants = multiselect ? checkVariants : [checkVariants.shift()]; 36026 } 36027 $(ele).data("value", checkVariants); 36028 $(".js-variant-input", ele).val(checkVariants.join("|")); 36029 for (var j = 0; j < checkVariants.length; j++) { 36030 $('.js-variant-button[data-button-value="' + checkVariants[j] + '"]', ele).addClass("-active"); 36031 } 36032 } 36033 }, { 36034 key: "setState", 36035 value: function setState(ele, button) { 36036 var multiselect = $(ele).data("multiselect") || false; 36037 var required = $(ele).data("required") || false; 36038 if (!$(button).hasClass("-active") && !multiselect) { 36039 $(ele).find(".js-variant-button").removeClass("-active"); 36040 $(button).addClass("-active"); 36041 } else if (!$(button).hasClass("-active") && multiselect) { 36042 $(button).addClass("-active"); 36043 } else { 36044 if (multiselect && required && $(ele).find(".js-variant-button").filter(".-active").length > 1) { 36045 $(button).removeClass("-active"); 36046 } else if (multiselect && !required) { 36047 $(button).removeClass("-active"); 36048 } else if (!required) { 36049 $(button).removeClass("-active"); 36050 } 36051 } 36052 var variantValues = this.findActiveButtons(ele); 36053 variantValues = variantValues.join("|"); 36054 $(ele).data("value", variantValues); 36055 $(".js-variant-input", ele).val(variantValues); 36056 } 36057 }, { 36058 key: "findActiveButtons", 36059 value: function findActiveButtons(ele) { 36060 var a = $(".js-variant-wrapper", ele).find(".-active"); 36061 if (a.length > 0) { 36062 return $(".js-variant-wrapper", ele).find(".-active").map(function () { 36063 return $.trim($(this).data("buttonValue")); 36064 }).get(); 36065 } else { 36066 return []; 36067 } 36068 } 36069 }, { 36070 key: "triggerCallbackEvent", 36071 value: function triggerCallbackEvent(ele) { 36072 var cb = $(ele).data("callback") || false; 36073 if (cb) { 36074 var callback = JSON.parse(cb.replace(/\'/g, '"')); 36075 if (callback.event && callback.target) { 36076 $(callback.target).trigger(callback.event, $(ele).data("value")); 36077 } 36078 } 36079 } 36080 }]); 36081}(_SGComponent2.SGComponent); 36082window.theme.variantSwitch = new VariantSwitch(); 36083 36084},{"SGComponent":83}],104:[function(require,module,exports){ 36085'use strict'; 36086 36087function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 36088Object.defineProperty(exports, "__esModule", { 36089 value: true 36090}); 36091exports.LegalTexts = void 0; 36092var _SGComponent2 = require("SGComponent"); 36093function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 36094function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 36095function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 36096function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 36097function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
36098function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 36099function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 36100function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 36101function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 36102function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 36103function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 36104function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 36105function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 36106function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 36107function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 36108var LegalTexts = exports.LegalTexts = /*#__PURE__*/function (_SGComponent) { 36109 function LegalTexts() { 36110 _classCallCheck(this, LegalTexts); 36111 return _callSuper(this, LegalTexts, arguments); 36112 } 36113 _inherits(LegalTexts, _SGComponent); 36114 return _createClass(LegalTexts, [{ 36115 key: "init", 36116 value: function init(container) { 36117 container = _superPropGet(LegalTexts, "init", this, 3)([container]); 36118 $(container).find('.legal-texts').each(function () { 36119 var ele = $(this); 36120 if (ele.find('.legal-texts__switch').css('display') !== 'none') { 36121 ele.find('.js-legal').off('click.LegalTexts'); 36122 ele.find('.js-legal').on('click.LegalTexts', function (e) { 36123 e.preventDefault(); 36124 if ($(this).hasClass('-is-visible')) { 36125 $(this).removeClass('-is-visible'); 36126 } else { 36127 $(this).addClass('-is-visible'); 36128 } 36129 }); 36130 } else { 36131 ele.find('.js-legal').off('click.LegalTexts'); 36132 ele.find('.js-legal').on('click.LegalTexts', function (e) { 36133 e.preventDefault(); 36134 }); 36135 } 36136 if (ele.find('.legal-texts__block').css('display') === 'none') { 36137 ele.find('.js-legal-opener').off('click.LegalTexts'); 36138 ele.find('.js-legal-opener').on('click.LegalTexts', function (e) { 36139 e.preventDefault(); 36140 if ($(this).next('.js-legal-block').is(':visible')) { 36141 $(this).next('.js-legal-block').slideUp('slow', function () { 36142 $(this).prev('.js-legal-opener').removeClass('-is-open'); 36143 }); 36144 } else { 36145 $(this).addClass('-is-open'); 36146 $(this).next('.js-legal-block').slideDown('slow', function () { 36147 if ($(this).closest('.tariff-detail-layer').length === 0) { 36148 $(window).scrollTop($(document).height()); 36149 } 36150 }); 36151 } 36152 }); 36153 } else { 36154 ele.find('.js-legal-opener').off('click.LegalTexts'); 36155 ele.find('.js-legal-opener').on('click.LegalTexts', function (e) { 36156 e.preventDefault(); 36157 }); 36158 } 36159 }); 36160 } 36161 }]); 36162}(_SGComponent2.SGComponent); 36163window.theme.legalTexts = new LegalTexts(); 36164 36165},{"SGComponent":83}],105:[function(require,module,exports){ 36166'use strict'; 36167 36168function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 36169Object.defineProperty(exports, "__esModule", { 36170 value: true 36171}); 36172exports.ProductRatingIcon = void 0; 36173var _SGComponent2 = require("SGComponent"); 36174function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 36175function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 36176function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 36177function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 36178function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
36179function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 36180function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 36181function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 36182function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 36183function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 36184function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 36185function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 36186function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 36187function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 36188function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 36189var ProductRatingIcon = exports.ProductRatingIcon = /*#__PURE__*/function (_SGComponent) { 36190 function ProductRatingIcon() { 36191 _classCallCheck(this, ProductRatingIcon); 36192 return _callSuper(this, ProductRatingIcon, arguments); 36193 } 36194 _inherits(ProductRatingIcon, _SGComponent); 36195 return _createClass(ProductRatingIcon, [{ 36196 key: "init", 36197 value: function init(container) { 36198 container = _superPropGet(ProductRatingIcon, "init", this, 3)([container]); 36199 var _self = this; 36200 _self.tplStar = "<i class=\"fas fa-star\" aria-hidden=\"true\"></i>"; 36201 _self.tplHalf = "<i class=\"fas fa-star-half-alt\" aria-hidden=\"true\"></i>"; 36202 _self.tplEmpty = "<i class=\"far fa-star\" aria-hidden=\"true\"></i>"; 36203 $(container).find('.product-rating--icon').each(function () { 36204 var rating = $(this).data('rating') || false; 36205 if (rating) { 36206 var items = $(this).data('items') || 5; 36207 var half = $(this).data('allowHalf') || true; 36208 var reviews = $(this).data('reviews') || false; 36209 var html = ''; 36210 var r = Math.floor(rating); 36211 for (var i = 0; i < r; i++) { 36212 html = html + _self.tplStar; 36213 items--; 36214 } 36215 var p = rating - r; 36216 if (p >= 0.5) { 36217 if (half) { 36218 html = html + _self.tplHalf; 36219 } else { 36220 html = html + _self.tplStar; 36221 } 36222 items--; 36223 } 36224 for (var x = 0; x < items; x++) { 36225 html = html + _self.tplEmpty; 36226 } 36227 var hr = ''; 36228 if (reviews) { 36229 hr = "<a href=\"#\" class=\"product-rating--icon__link js-product-rating-icon-link\">(".concat(reviews, ") Kundenbewertungen</a>"); 36230 } 36231 $(this).html("\n <div class=\"product-rating--icon__container\">".concat(html, "</div>\n <div class=\"product-rating--icon__link-wrapper\">\n ").concat(hr, "\n </div>\n ")); 36232 } 36233 $(this).find('.js-product-rating-icon-link').on('click.ProductRatingIcon', function (e) { 36234 var cb = $(e.target).closest('.product-rating--icon').data('callback') || false; 36235 if (cb) { 36236 e.preventDefault(); 36237 var callback = JSON.parse(cb.replace(/\'/g, '"')); 36238 if (callback.event && callback.target) { 36239 $(callback.target).trigger(callback.event); 36240 } 36241 } 36242 }); 36243 }); 36244 } 36245 }]); 36246}(_SGComponent2.SGComponent); 36247window.theme.productRatingIcon = new ProductRatingIcon(); 36248 36249},{"SGComponent":83}],106:[function(require,module,exports){ 36250'use strict'; 36251 36252function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 36253Object.defineProperty(exports, "__esModule", { 36254 value: true 36255}); 36256exports.CostOverview = void 0; 36257var _SGComponent2 = require("SGComponent"); 36258require("FoundationCore.js");
36259var _enterView = _interopRequireDefault(require("enter-view")); 36260function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 36261function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 36262function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 36263function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 36264function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 36265function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 36266function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 36267function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 36268function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 36269function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 36270function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 36271function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 36272function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 36273function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 36274function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 36275function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 36276var CostOverview = exports.CostOverview = /*#__PURE__*/function (_SGComponent) { 36277 function CostOverview() { 36278 _classCallCheck(this, CostOverview); 36279 return _callSuper(this, CostOverview, arguments); 36280 } 36281 _inherits(CostOverview, _SGComponent); 36282 return _createClass(CostOverview, [{ 36283 key: "init", 36284 value: function init(container) { 36285 container = _superPropGet(CostOverview, "init", this, 3)([container]); 36286 var instance = this; 36287 instance.moduleName = '.cost-overview'; 36288 $(window).on('changed.zf.mediaquery', function () { 36289 $(instance.moduleName, container).each(function () { 36290 instance.initViewportAnim(this); 36291 }); 36292 }); 36293 if ($(instance.moduleName).length > 0) { 36294 (0, _enterView["default"])({ 36295 selector: instance.moduleName, 36296 enter: instance.initViewportAnim, 36297 once: true, 36298 offset: 0.5 36299 }); 36300 } 36301 } 36302 }, { 36303 key: "initViewportAnim", 36304 value: function initViewportAnim(ele) { 36305 if (Foundation.MediaQuery.is('large up')) { 36306 $('.js-cost-overview-tooltip-wrapper', $(ele)).each(function () { 36307 if (!$(this).hasClass('-tooltip-anim')) { 36308 $(this).addClass('-tooltip-anim'); 36309 } 36310 }); 36311 } 36312 } 36313 }]); 36314}(_SGComponent2.SGComponent); 36315window.theme.costOverview = new CostOverview(); 36316 36317},{"FoundationCore.js":77,"SGComponent":83,"enter-view":10}],107:[function(require,module,exports){ 36318'use strict'; 36319 36320function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 36321Object.defineProperty(exports, "__esModule", { 36322 value: true 36323}); 36324exports.CounterTime = void 0; 36325var _SGComponent2 = require("SGComponent"); 36326function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 36327function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 36328function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 36329function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 36330function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
36331function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 36332function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 36333function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 36334function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 36335function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 36336function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 36337function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 36338function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 36339function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 36340function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 36341var CounterTime = exports.CounterTime = /*#__PURE__*/function (_SGComponent) { 36342 function CounterTime() { 36343 _classCallCheck(this, CounterTime); 36344 return _callSuper(this, CounterTime, arguments); 36345 } 36346 _inherits(CounterTime, _SGComponent); 36347 return _createClass(CounterTime, [{ 36348 key: "initialize", 36349 value: function initialize() { 36350 _superPropGet(CounterTime, "initialize", this, 3)([]); 36351 this.render = this.render.bind(this); 36352 } 36353 }, { 36354 key: "init", 36355 value: function init(container) { 36356 container = _superPropGet(CounterTime, "init", this, 3)([container]); 36357 var instance = this; 36358 $(container).find('.js-counter-time').each(function () { 36359 var target = new Date().getTime() + (24 * 60 * 60 + 60) * 1000; 36360 var t = $(this).data('target'); 36361 if (typeof t !== 'undefined') { 36362 target = Date.parse(t); 36363 } 36364 target = new Date(target); 36365 instance.render($(this), target); 36366 }); 36367 } 36368 }, { 36369 key: "render", 36370 value: function render(ele, target) { 36371 var jetzt = new Date(); 36372 var dif = Math.floor((target.getTime() - jetzt.getTime()) / 1000); 36373 var hour = 0; 36374 var minute = 0; 36375 var second = 0; 36376 var day = 0; 36377 if (dif > 0) { 36378 day = Math.floor(dif / 60 / 60 / 24); 36379 hour = Math.floor((dif - day * 24 * 60 * 60) / 60 / 60); 36380 minute = Math.floor((dif - day * 24 * 60 * 60 - hour * 60 * 60) / 60); 36381 second = dif - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60; 36382 } 36383 if (day < 10) day = "0" + day; 36384 if (hour < 10) hour = "0" + hour; 36385 if (minute < 10) minute = "0" + minute; 36386 if (second < 10) second = "0" + second; 36387 day = String(day); 36388 hour = String(hour); 36389 minute = String(minute); 36390 second = String(second); 36391 36392 /* Richtige Anzahl von Stellen bei der Stundenanzeige setzen */ 36393 var dayLength = $(ele).find('.js-counter-time-day').children().length; 36394 if (dayLength > hour.length) { 36395 while ($(ele).find('.js-counter-time-day').children().length !== day.length) {
36396 $(ele).find('.js-counter-time-day').children().last().first().remove(); 36397 } 36398 } else if (dayLength < day.length) { 36399 while ($(ele).find('.js-counter-time-day').children().length !== day.length) { 36400 $(ele).find('.js-counter-time-day').append('<div class="counter-time__digit">0</div>'); 36401 } 36402 } 36403 var dayIndex = 0; 36404 $(ele).find('.js-counter-time-day').children().each(function () { 36405 $(this).html(day.substr(dayIndex, 1)); 36406 dayIndex++; 36407 }); 36408 var hourIndex = 0; 36409 $(ele).find('.js-counter-time-hour').children().each(function () { 36410 $(this).html(hour.substr(hourIndex, 1)); 36411 hourIndex++; 36412 }); 36413 var minuteIndex = 0; 36414 $(ele).find('.js-counter-time-minute').children().each(function () { 36415 $(this).html(minute.substr(minuteIndex, 1)); 36416 minuteIndex++; 36417 }); 36418 var secondIndex = 0; 36419 $(ele).find('.js-counter-time-second').children().each(function () { 36420 $(this).html(second.substr(secondIndex, 1)); 36421 secondIndex++; 36422 }); 36423 if (dif > 0) { 36424 var instance = this; 36425 setTimeout(function () { 36426 instance.render(ele, target); 36427 }, 1000); 36428 } else { 36429 //Trigger Event wenn Countdown abgelaufen 36430 $(ele).trigger('finished'); 36431 } 36432 } 36433 }]); 36434}(_SGComponent2.SGComponent); 36435window.theme.counterTime = new CounterTime(); 36436 36437},{"SGComponent":83}],108:[function(require,module,exports){ 36438'use strict'; 36439 36440function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 36441Object.defineProperty(exports, "__esModule", { 36442 value: true 36443}); 36444exports.ProductDetailsTariffOffer = void 0; 36445var _SGComponent2 = require("SGComponent"); 36446function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 36447function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 36448function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 36449function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 36450function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 36451function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 36452function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 36453function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 36454function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 36455function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 36456function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 36457function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 36458function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 36459function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
vendor: 4,921 bytes, lines 36459-36513
36459 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 36460function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 36461var ProductDetailsTariffOffer = exports.ProductDetailsTariffOffer = /*#__PURE__*/function (_SGComponent) { 36462 function ProductDetailsTariffOffer() { 36463 _classCallCheck(this, ProductDetailsTariffOffer); 36464 return _callSuper(this, ProductDetailsTariffOffer, arguments); 36465 } 36466 _inherits(ProductDetailsTariffOffer, _SGComponent); 36467 return _createClass(ProductDetailsTariffOffer, [{ 36468 key: "init", 36469 value: function init(container) { 36470 container = _superPropGet(ProductDetailsTariffOffer, "init", this, 3)([container]); 36471 var instance = this; 36472 $(container).find('.product-detail-tariff-offer').each(function () { 36473 var ele = this; 36474 $('.js-product-detail-tariff-offer-nav').on('change.ProductDetailsTariffOffer', function (e, data) { 36475 instance.showOfferBox(ele, data); 36476 }); 36477 }); 36478 } 36479 }, { 36480 key: "showOfferBox", 36481 value: function showOfferBox(ele, data) { 36482 var offerBox = $(ele).find('.js-product-detail-tariff-offerbox'); 36483 offerBox.addClass('-hide'); 36484 offerBox.filter('[data-variant=' + data + ']').removeClass('-hide'); 36485 } 36486 }]); 36487}(_SGComponent2.SGComponent); 36488window.theme.productDetailsTariffOffer = new ProductDetailsTariffOffer(); 36489 36490},{"SGComponent":83}],109:[function(require,module,exports){ 36491'use strict'; 36492 36493function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 36494Object.defineProperty(exports, "__esModule", { 36495 value: true 36496}); 36497exports.ProductInfoBoxText = void 0; 36498var _SGComponent2 = require("SGComponent"); 36499require("FoundationCore.js"); 36500function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 36501function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 36502function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 36503function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 36504function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 36505function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 36506function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 36507function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 36508function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 36509function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 36510function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 36511function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 36512function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 36513function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
36513 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 36514function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 36515var ProductInfoBoxText = exports.ProductInfoBoxText = /*#__PURE__*/function (_SGComponent) { 36516 function ProductInfoBoxText() { 36517 _classCallCheck(this, ProductInfoBoxText); 36518 return _callSuper(this, ProductInfoBoxText, arguments); 36519 } 36520 _inherits(ProductInfoBoxText, _SGComponent); 36521 return _createClass(ProductInfoBoxText, [{ 36522 key: "init", 36523 value: function init(container) { 36524 container = _superPropGet(ProductInfoBoxText, "init", this, 3)([container]); 36525 var instance = this; 36526 var expandOnAllViewports = false; 36527 $(container).find('.product-info-box-text').each(function () { 36528 expandOnAllViewports = $(this).hasClass('-all-viewports'); 36529 var self = this; 36530 $(this).find('.js-product-info-box-text-toggle').on('click.ProductInfoBoxText', function () { 36531 $(self).toggleClass('-expanded'); 36532 instance.checkOffset(self, expandOnAllViewports); 36533 }); 36534 }); 36535 $(window).on('resize.ProductInfoBoxText', function () { 36536 $(container).find('.product-info-box-text').each(function () { 36537 expandOnAllViewports = $(this).hasClass('-all-viewports'); 36538 if (!Foundation.MediaQuery.is('small only') && !expandOnAllViewports) { 36539 $(this).find('.js-product-info-box-text-toggle').removeClass('-expanded'); 36540 } 36541 instance.checkOffset(this, expandOnAllViewports); 36542 }); 36543 }).trigger('resize'); 36544 } 36545 }, { 36546 key: "checkOffset", 36547 value: function checkOffset(ele, viewportModifier) { 36548 var offset = $(ele).data('offset') || false; 36549 var infoBox = $(ele); 36550 var offsetBox = $(ele).find('.js-product-info-box-text-offset'); 36551 if (offset && (Foundation.MediaQuery.is('small only') || viewportModifier)) { 36552 if (!infoBox.hasClass('-expanded')) { 36553 offsetBox.css('max-height', offset); 36554 } else if (infoBox.hasClass('-expanded')) { 36555 offsetBox.css('max-height', '999rem'); 36556 } 36557 } else { 36558 offsetBox.css('max-height', ''); 36559 } 36560 } 36561 }]); 36562}(_SGComponent2.SGComponent); 36563window.theme.productInfoBoxText = new ProductInfoBoxText(); 36564 36565},{"FoundationCore.js":77,"SGComponent":83}],110:[function(require,module,exports){ 36566'use strict'; 36567 36568function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 36569Object.defineProperty(exports, "__esModule", { 36570 value: true 36571}); 36572exports.ConfigVariant = void 0; 36573var _SGComponent2 = require("SGComponent"); 36574function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 36575function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 36576function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 36577function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 36578function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 36579function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 36580function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 36581function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 36582function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 36583function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 36584function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 36585function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 36586function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 36587function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
36587 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 36588function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 36589var ConfigVariant = exports.ConfigVariant = /*#__PURE__*/function (_SGComponent) { 36590 function ConfigVariant() { 36591 _classCallCheck(this, ConfigVariant); 36592 return _callSuper(this, ConfigVariant, arguments); 36593 } 36594 _inherits(ConfigVariant, _SGComponent); 36595 return _createClass(ConfigVariant, [{ 36596 key: "init", 36597 value: function init(container) { 36598 container = _superPropGet(ConfigVariant, "init", this, 3)([container]); 36599 var _self = this; 36600 $(container).find('.config-variant').each(function () { 36601 var ele = this; 36602 _self.initState(ele, true); 36603 $(this).on('switchColor.ConfigVariant', function (e, data) { 36604 if (e.target == ele) { 36605 _self.switchVariant(ele, data, null); 36606 } 36607 }); 36608 $(this).on('switchMemory.ConfigVariant', function (e, data) { 36609 if (e.target == ele) { 36610 _self.switchVariant(ele, null, data); 36611 } 36612 }); 36613 $('.js-config-variant-more', $(this)).on('click.ConfigVariant', function (e) { 36614 e.preventDefault(); 36615 _self.toggleContent(ele, false); 36616 }); 36617 }); 36618 $(window).resize(function () { 36619 $(container).find('.config-variant').each(function () { 36620 _self.toggleContent($(this), true); 36621 }); 36622 }).trigger('resize'); 36623 } 36624 }, { 36625 key: "toggleContent", 36626 value: function toggleContent(ele, resizeEvent) { 36627 ele = $(ele).find('.js-config-variant-wrapper-box'); 36628 var itemEle = ele.find('.js-config-variant-item').not('.-hide'), 36629 imageEle = itemEle.find('.js-config-variant-image-wrapper'), 36630 textEle = ele.find('.js-config-variant-more'), 36631 padding = parseInt(ele.css('padding-top')); 36632 if (Foundation.MediaQuery.is('small only') || Foundation.MediaQuery.is('medium only')) { 36633 if (!resizeEvent || resizeEvent && typeof ele.data('init') === 'undefined') { 36634 this.toggleState(ele, imageEle, textEle, padding, itemEle); 36635 } 36636 } else { 36637 this.showProduct(ele, textEle, imageEle); 36638 } 36639 ele.data('init', 'true'); 36640 } 36641 }, { 36642 key: "toggleState", 36643 value: function toggleState(ele, imageEle, textEle, padding, itemEle) { 36644 var newHeight = padding * 2 + (itemEle.outerHeight() - imageEle.outerHeight()); 36645 if (!imageEle.hasClass('-hide')) { 36646 this.hideProduct(ele, textEle, imageEle, newHeight); 36647 } else { 36648 this.showProduct(ele, textEle, imageEle, newHeight); 36649 } 36650 } 36651 }, { 36652 key: "hideProduct", 36653 value: function hideProduct(ele, textEle, imageEle, newHeight) { 36654 textEle.html("mehr <i class=\"fas fa-angle-down\" aria-hidden=\"true\"></i>"); 36655 ele.css('max-height', newHeight + 'px'); 36656 imageEle.addClass('-hide'); 36657 } 36658 }, { 36659 key: "showProduct", 36660 value: function showProduct(ele, textEle, imageEle) { 36661 textEle.html("weniger <i class=\"fas fa-angle-up\" aria-hidden=\"true\"></i>"); 36662 ele.css('max-height', '5000px'); 36663 imageEle.removeClass('-hide'); 36664 } 36665 }, { 36666 key: "initState", 36667 value: function initState(ele, trigger) { 36668 var items = $(ele).find('.js-config-variant-item'); 36669 36670 // Nur eine oder erste Variante sichtbar machen 36671 var selected = null; 36672 for (var i = items.length - 1; i >= 0; i--) { 36673 if (!items.eq(i).hasClass('-hide')) { 36674 selected = i; 36675 } 36676 } 36677 if (selected === null) selected = 0; 36678 items.addClass('-hide'); 36679 var active = items.eq(selected); 36680 active.removeClass('-hide'); 36681 36682 // Sichtbare Variante auswählen 36683 this.switchState(ele, active.data('color'), active.data('memory'), active.data('product'), trigger); 36684 } 36685 }, { 36686 key: "switchState", 36687 value: function switchState(ele, color, memory, product, trigger) { 36688 $(ele).data('color', color).data('memory', memory).data('product', product); 36689 if (trigger !== false) { 36690 // Callback 36691 var cb = $(ele).data('callback') || false; 36692 if (cb) { 36693 var callback = JSON.parse(cb.replace(/\'/g, '"')); 36694 if (callback.event && callback.target) { 36695 var values = { 36696 color: $(ele).data('color'), 36697 memory: $(ele).data('memory'), 36698 product: $(ele).data('product') 36699 }; 36700 $(callback.target).trigger(callback.event, values); 36701 } 36702 } 36703 } 36704 } 36705 }, { 36706 key: "switchVariant", 36707 value: function switchVariant(ele, color, memory) { 36708 var active = null; 36709 if (color !== null) {
36710 // prüfen welche Speichergrößen für die gewählte Farbe verfügbar ist 36711 var mem = []; 36712 $(ele).find('.js-config-variant-item[data-color="' + color + '"]').each(function () { 36713 mem.push($(this).data('memory')); 36714 }); 36715 var doSwitch = true; 36716 $(ele).find('.js-config-variant-memory-switch .js-variant-button').each(function () { 36717 if ($.inArray($(this).data('buttonValue'), mem) == -1) { 36718 $(this).addClass('-disabled'); 36719 if ($(this).hasClass('-active')) { 36720 $(ele).find('.js-config-variant-memory-switch .js-variant-button').not('-disabled').first().trigger('click'); 36721 doSwitch = false; 36722 } 36723 } else { 36724 $(this).removeClass('-disabled'); 36725 } 36726 }); 36727 if (doSwitch) { 36728 active = $(ele).find('.js-config-variant-item').not('.-hide'); 36729 $(ele).find('.js-config-variant-item').addClass('-hide'); 36730 $(ele).find('.js-config-variant-item[data-color="' + color + '"][data-memory="' + active.data('memory') + '"]').removeClass('-hide'); 36731 } 36732 } else if (memory !== null) { 36733 active = $(ele).find('.js-config-variant-item').not('.-hide'); 36734 $(ele).find('.js-config-variant-item').addClass('-hide'); 36735 $(ele).find('.js-config-variant-item[data-color="' + active.data('color') + '"][data-memory="' + memory + '"]').removeClass('-hide'); 36736 } else { 36737 // Fehler 36738 this.initState(ele, true); 36739 } 36740 36741 // Zustand für aktive Variante setzen 36742 var item = $(ele).find('.js-config-variant-item').not('.-hide'); 36743 this.switchState(ele, item.data('color'), item.data('memory'), item.data('product'), true); 36744 } 36745 }, { 36746 key: "selectVariant", 36747 value: function selectVariant(ele, variantId, trigger) { 36748 var active = $(ele).find('.js-config-variant-item[data-product="' + variantId + '"]') || $(ele).find('.js-config-variant-item').first(); 36749 if (active.length > 0) { 36750 this.switchVariant(ele, active.data('color'), active.data('memory')); 36751 this.switchState(ele, active.data('color'), active.data('memory'), active.data('product'), trigger); 36752 window.theme.variantSwitch.setState($(ele).find('.js-config-variant-color-switch'), $(ele).find('.js-config-variant-color-switch .js-variant-button[data-button-value="' + active.data('color') + '"]')); 36753 window.theme.variantSwitch.setState($(ele).find('.js-config-variant-memory-switch'), $(ele).find('.js-config-variant-memory-switch .js-variant-button[data-button-value="' + active.data('memory') + '"]')); 36754 } 36755 } 36756 }]); 36757}(_SGComponent2.SGComponent); 36758window.theme.configVariant = new ConfigVariant(); 36759 36760},{"SGComponent":83}],111:[function(require,module,exports){ 36761'use strict'; 36762 36763function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 36764Object.defineProperty(exports, "__esModule", { 36765 value: true 36766}); 36767exports.ConfigNavigation = void 0; 36768var _SGComponent2 = require("SGComponent"); 36769function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 36770function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 36771function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 36772function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 36773function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
36774function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 36775function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 36776function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 36777function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 36778function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 36779function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 36780function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 36781function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 36782function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 36783function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 36784var ConfigNavigation = exports.ConfigNavigation = /*#__PURE__*/function (_SGComponent) { 36785 function ConfigNavigation() { 36786 _classCallCheck(this, ConfigNavigation); 36787 return _callSuper(this, ConfigNavigation, arguments); 36788 } 36789 _inherits(ConfigNavigation, _SGComponent); 36790 return _createClass(ConfigNavigation, [{ 36791 key: "init", 36792 value: function init(container) { 36793 container = _superPropGet(ConfigNavigation, "init", this, 3)([container]); 36794 var _self = this; 36795 $(container).find('.config-navigation').each(function () { 36796 var baseEle = $(this); 36797 baseEle.filter('.js-async-sort').on('sort.ConfigNavigation', function (e, data) { 36798 var config = $(this).data('sort'), 36799 terms = { 36800 page: 0 36801 }, 36802 keys = data ? Object.keys(data) : '', 36803 spinner = $($(this).data('spinnerTarget')), 36804 productList = $($(this).data('productTarget')), 36805 loadMore = $($(this).data('loadMoreTarget')), 36806 url = location.pathname + config.url, 36807 params = config.params, 36808 xhrUrl = ''; 36809 if (data) { 36810 terms.q = data[keys[0]] + '-' + keys[0]; 36811 } else { 36812 terms.page = $(this).data('page'); 36813 } 36814 if (config.params) { 36815 params = params.replace(/%[\w]+%/g, function (match) { 36816 return terms[match.replace(/%+/g, '')]; 36817 }); 36818 } 36819 var urlParams = new window.URLSearchParams(params), 36820 currentParams = new window.URLSearchParams(window.location.search); 36821 currentParams.get('q') ? urlParams.set('q', currentParams.get('q')) : null; 36822 xhrUrl = url + urlParams.toString(); 36823 $.ajax({ 36824 url: xhrUrl, 36825 beforeSend: function beforeSend() { 36826 if (terms.page < 1) { 36827 spinner.show(); 36828 productList.hide();
36829 loadMore.addClass('-hide'); 36830 } 36831 } 36832 }).done(function (response) { 36833 if (terms.page > 0) { 36834 productList.append(response); 36835 } else { 36836 setTimeout(function () { 36837 productList.html(response).fadeIn(); 36838 loadMore.removeClass('-hide'); 36839 spinner.hide(); 36840 }, 1000); 36841 } 36842 }); 36843 loadMore.on('click.ConfigNavigation', function (e) { 36844 e.preventDefault(); 36845 var target = $(this).data('target'), 36846 targetObj = $(target), 36847 currentPage = parseInt(targetObj.data('page')), 36848 nextPage = currentPage + 1; 36849 targetObj.data('page', nextPage); 36850 if (nextPage >= $(this).data('maxPages') - 1) { 36851 $(this).hide(); 36852 } 36853 targetObj.trigger('sort'); 36854 }); 36855 }); 36856 36857 // ECFE-3478 36858 $('.js-sort-select', baseEle).on('change.ConfigNavigation', function (e) { 36859 e.preventDefault(); 36860 var $selected = $(this).find('option:selected'); 36861 if (!$selected.length) { 36862 return; 36863 } 36864 var itemStates = {}; 36865 var key = $selected.data('direction') || 'asc', 36866 val = $selected.prop('value') || 'price'; 36867 itemStates[key] = val; 36868 if (val == 'custom') { 36869 $(this).parents('.config-navigation__button').removeClass('-active'); 36870 } else { 36871 $(this).parents('.config-navigation__button').addClass('-active'); 36872 } 36873 var callback = $(baseEle).data('callback') || false; 36874 _self.triggerEvent(callback, itemStates); 36875 }); 36876 $('.js-sort-item', baseEle).on('click.ConfigNavigation', function (e) { 36877 e.preventDefault(); 36878 _self.toggleItemState($(this), baseEle); 36879 }); 36880 $('.js-filter-button', baseEle).on('click.ConfigNavigation', function (e) { 36881 e.preventDefault(); 36882 _self.showFilterOverlay(baseEle); 36883 }); 36884 $('.js-delete-filter', baseEle).on('click.ConfigNavigation', function (e) { 36885 e.preventDefault(); 36886 $('.config-navigation__content.is-sticky').removeClass('is-sticky'); 36887 var callback = $(baseEle).data('filterCallback') || false; 36888 _self.triggerEvent(callback, true); 36889 }); 36890 var event = baseEle.data('filterEvent') || false; 36891 if (event) { 36892 $('.js-filter-button', baseEle).data('baseText', $('.js-filter-button', baseEle).html()); 36893 baseEle.on(event, function (e, data) { 36894 if (typeof data.count == 'number') _self.updateFilterButton(baseEle, data.count); 36895 }); 36896 } 36897 _self.toggleItemState(null, baseEle); 36898 }); 36899 $(window).resize(function () { 36900 $(container).find('.config-navigation').each(function () { 36901 if (!Foundation.MediaQuery.is('small only') && !Foundation.MediaQuery.is('medium only')) $('.js-sort-container', $(this)).css('display', ''); 36902 }); 36903 }); 36904 } 36905 }, { 36906 key: "updateFilterButton", 36907 value: function updateFilterButton(baseEle, count) { 36908 var btn = $('.js-filter-button', baseEle); 36909 var baseText = btn.data('baseText'); 36910 var newText = baseText; 36911 if (count > 0) { 36912 newText = baseText + ' (' + count + ')'; 36913 $('.js-delete-filter', baseEle).addClass('-active'); 36914 btn.addClass('-active'); 36915 } else { 36916 $('.js-delete-filter', baseEle).removeClass('-active'); 36917 btn.removeClass('-active'); 36918 } 36919 if (Foundation.MediaQuery.is('large up')) { 36920 btn.html(newText); 36921 } 36922 } 36923 }, { 36924 key: "showFilterOverlay", 36925 value: function showFilterOverlay(baseEle) { 36926 var _self = this; 36927 var filterContainer = $('.js-filter-overlay', baseEle); 36928 var filterContent = $(baseEle).data('filterElement') || false; 36929 if (filterContent) $(baseEle).data('data-detached', $(filterContent).parent()); 36930 var filterContentHtml = filterContent ? $(filterContent).detach() : false; 36931 if (filterContent && filterContentHtml) { 36932 var innerContainer = $('.js-filter-content', filterContainer); 36933 $(document.body).css('overflow', 'hidden'); 36934 filterContentHtml.appendTo(innerContainer); 36935 var acceptBtn = $("\n <div class=\"config-navigation__filter-overlay-accept js-accept-wrapper\">\n <div class=\"button-text js-accept-filter\">Anwenden</div>\n </div>\n "); 36936 innerContainer.append(acceptBtn); 36937 $('.js-accept-filter, .js-filter-close', filterContainer).on('click.ConfigNavigation', function () { 36938 $('.js-accept-wrapper', filterContainer).remove(); 36939 filterContentHtml = $(filterContent, innerContainer).detach(); 36940 _self.hideFilterOverlay(filterContainer, innerContainer); 36941 $($(baseEle).data('data-detached')).append(filterContentHtml); 36942 }); 36943 filterContainer.show(); 36944 } 36945 } 36946 }, { 36947 key: "hideFilterOverlay", 36948 value: function hideFilterOverlay(filterContainer, innerContainer) { 36949 $(document.body).css('overflow', ''); 36950 filterContainer.hide(); 36951 innerContainer.empty(); 36952 } 36953 }, { 36954 key: "toggleItemState", 36955 value: function toggleItemState(clickedEle, baseEle) { 36956 if (clickedEle) { 36957 var nextStateClass = this.getNextStateClass(clickedEle); 36958 $('.js-sort-item', baseEle).removeClass('-up -down'); 36959 $(clickedEle).addClass(nextStateClass); 36960 } 36961 var d = baseEle.data('default') || false; 36962 if (d && $('.js-sort-item.-up', baseEle).length == 0 && $('.js-sort-item.-down', baseEle).length == 0) { 36963 var defaultEle = $('.js-sort-item[data-identifier="' + d + '"]'); 36964 defaultEle.addClass(this.getNextStateClass(defaultEle)); 36965 } 36966 this.triggerItemStatesEvent(baseEle); 36967 } 36968 }, { 36969 key: "triggerItemStatesEvent", 36970 value: function triggerItemStatesEvent(baseEle) { 36971 var itemStates = this.getItemStates(baseEle); 36972 var callback = $(baseEle).data('callback') || false; 36973 this.triggerEvent(callback, itemStates); 36974 } 36975 }, { 36976 key: "getItemStates", 36977 value: function getItemStates(baseEle) { 36978 var data = { 36979 'asc': null, 36980 'desc': null 36981 }; 36982 data.asc = $('.js-sort-item.-up', baseEle).not('.-down').map(function () { 36983 return $(this).data('identifier'); 36984 }).get(0); 36985 if (data.asc == null) { 36986 delete data.asc; 36987 data.desc = $('.js-sort-item.-down', baseEle).not('.-up').map(function () { 36988 return $(this).data('identifier'); 36989 }).get(0); 36990 if (data.desc == null) data.desc = 'custom'; 36991 } else { 36992 delete data.desc; 36993 } 36994 return data; 36995 } 36996 }, { 36997 key: "getNextStateClass", 36998 value: function getNextStateClass(clickedEle) { 36999 var nextStateClass = ''; 37000 if (clickedEle.hasClass('-only-down')) return '-down'; 37001 if (clickedEle.hasClass('-only-up')) return '-up'; 37002 if (clickedEle.hasClass('-down')) nextStateClass = '-up'; 37003 if (clickedEle.hasClass('-up')) nextStateClass = '-down'; 37004 if (!clickedEle.hasClass('-up') && !clickedEle.hasClass('-down')) nextStateClass = '-down'; 37005 return nextStateClass; 37006 } 37007 }, { 37008 key: "triggerEvent", 37009 value: function triggerEvent(callback, data) { 37010 if (callback) { 37011 callback = JSON.parse(callback.replace(/\'/g, '"')); 37012 if (callback.event && callback.target) { 37013 $(callback.target).trigger(callback.event, data); 37014 } 37015 } 37016 } 37017 }]); 37018}(_SGComponent2.SGComponent); 37019window.theme.configNavigation = new ConfigNavigation(); 37020 37021},{"SGComponent":83}],112:[function(require,module,exports){ 37022'use strict'; 37023 37024function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 37025Object.defineProperty(exports, "__esModule", { 37026 value: true 37027}); 37028exports.QuickStart = void 0; 37029var _SGComponent2 = require("SGComponent"); 37030var _queryString = _interopRequireDefault(require("query-string")); 37031require("FoundationCore.js");
37032function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 37033function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 37034function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 37035function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 37036function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 37037function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 37038function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 37039function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 37040function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 37041function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 37042function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 37043function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 37044function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 37045function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 37046function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 37047function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 37048var QuickStart = exports.QuickStart = /*#__PURE__*/function (_SGComponent) { 37049 function QuickStart() { 37050 _classCallCheck(this, QuickStart); 37051 return _callSuper(this, QuickStart, arguments); 37052 } 37053 _inherits(QuickStart, _SGComponent); 37054 return _createClass(QuickStart, [{ 37055 key: "init", 37056 value: function init(container) { 37057 container = _superPropGet(QuickStart, "init", this, 3)([container]); 37058 var i = 0; 37059 var instance = this; 37060 $(container).find('.quick-start').each(function () { 37061 var _self = this; 37062 37063 // init top radioboxes 37064 instance.initTopRadioboxes($(this)); 37065 37066 // toggle top radiobox 37067 instance.toggleTopRadioboxes($(this)); 37068 37069 // init model selection after producer selection 37070 instance.initModelSelection($(this)); 37071 37072 // desktop tab init 37073 instance.initTabs($(this)); 37074 37075 // generate unique id/for attributes for multiple quick start modules per page 37076 instance.initUniqueId($(this), i); 37077 37078 // request data 37079 instance.loadTariffData($(this)); 37080 instance.loadDeviceData($(this)); 37081 $(this).find('.js-quick-start-select-model, .js-quick-start-datavolume').on('change.QuickStart, click.QuickStart', function () { 37082 instance.updateSubmitButton($(_self)); 37083 }); 37084 instance.updateSubmitButton($(this)); 37085 i++; 37086 }); 37087 $(window).on('resize.QuickStart', function () { 37088 $('.quick-start').each(function () { 37089 // reset quick start module settings 37090 instance.resetQuickStart($(this)); 37091 }); 37092 }); 37093 } 37094 37095 /** 37096 * Gets the default or url defined settings for the preselection 37097 * @param {*} param 37098 */ 37099 }, { 37100 key: "getUrlSetting", 37101 value: function getUrlSetting(elem, param) {
37102 var validRadioValues = $('.js-quick-start-title-radiobox', elem).map(function (_, ele) { 37103 return $(ele).val(); 37104 }).toArray(); 37105 var validDatavolumeValues = $('.js-variant-button', elem).map(function (_, ele) { 37106 return $(ele).data('buttonValue'); 37107 }).toArray(); 37108 var validDropDownSelection = $('.js-quick-start-select-producer option', elem).map(function (_, ele) { 37109 return $(ele).val(); 37110 }).toArray(); 37111 var validDropDownModelSelection = $('.js-quick-start-select-model option', elem).map(function (_, ele) { 37112 return $(ele).val(); 37113 }).toArray(); 37114 var urlParams = _queryString["default"].parse(location.search); 37115 var dvIndex = validDatavolumeValues.length >= 2 ? Math.floor(validDatavolumeValues.length / 2) - 1 : 0; 37116 var paramConfig = { 37117 fl: validRadioValues[0] || null, 37118 dv: validDatavolumeValues[dvIndex] || null, 37119 mf: validDropDownSelection[0] || null, 37120 mm: validDropDownModelSelection[0] || null 37121 }; 37122 if (validRadioValues.includes(urlParams.fl)) { 37123 paramConfig.fl = urlParams.fl; 37124 } 37125 if (validDatavolumeValues.includes(parseInt(urlParams.dv))) { 37126 paramConfig.dv = urlParams.dv; 37127 } 37128 if (validDropDownSelection.includes(urlParams.mf)) { 37129 paramConfig.mf = urlParams.mf; 37130 } 37131 if (validDropDownModelSelection.includes(urlParams.mm)) { 37132 paramConfig.mm = urlParams.mm; 37133 } 37134 return paramConfig[param] || null; 37135 } 37136 37137 /** 37138 * Generate unique id/for attributes for multiple quick start modules per page 37139 * @param elem 37140 * @param index 37141 */ 37142 }, { 37143 key: "initUniqueId", 37144 value: function initUniqueId(elem, index) { 37145 elem.find('.js-quick-start-title-radiobox').each(function () { 37146 var topRadiobox = $(this); 37147 var newTopRadioboxId = topRadiobox.attr('id') + '-' + index; 37148 var newTopRadioboxName = topRadiobox.attr('name') + '-' + index; 37149 topRadiobox.attr('id', newTopRadioboxId); 37150 topRadiobox.attr('name', newTopRadioboxName); 37151 topRadiobox.closest('.quick-start__title-radiobox-label').attr('for', newTopRadioboxId); 37152 }); 37153 } 37154 37155 /** 37156 * Init radiobox // mobil = accordion => at start no active element; desktop = tab => first active 37157 * @param elem 37158 */ 37159 }, { 37160 key: "initTopRadioboxes", 37161 value: function initTopRadioboxes(elem) { 37162 var selectedRadioBox = this.getUrlSetting(elem, 'fl'); 37163 if (Foundation.MediaQuery.is('large up')) { 37164 // desktop 37165 37166 // check first radiobox 37167 var checkBox = elem.find(".js-quick-start-title-radiobox[value=".concat(selectedRadioBox, "]")); 37168 if (selectedRadioBox && checkBox.length > 0) { 37169 checkBox.prop('checked', true); 37170 checkBox.closest('.js-accordion-item').addClass('is-active'); 37171 } else { 37172 elem.find('.js-accordion-item:first-child .js-quick-start-title-radiobox').prop('checked', true); 37173 elem.find('.js-accordion-item:first-child').addClass('is-active'); 37174 } 37175 } else { 37176 // mobile 37177 37178 // no radiobox checked 37179 elem.find('.js-accordion-item .js-quick-start-title-radiobox').prop('checked', false); 37180 elem.find('.js-accordion-item').removeClass('is-active'); 37181 } 37182 } 37183 37184 /** 37185 * Handle click event at accordion/tab radioboxes 37186 * @param elem 37187 */ 37188 }, { 37189 key: "toggleTopRadioboxes", 37190 value: function toggleTopRadioboxes(elem) { 37191 var _self = this; 37192 elem.find('.js-accordion-title').on('click.QuickStart', function (e) { 37193 e.preventDefault(); 37194 var titleElem = $(this); 37195 var parent = titleElem.closest('.js-accordion-item'); 37196 37197 // move content form for selected area 37198 if (parent.find('.js-quick-start-form').length === 0) { 37199 var formContent = elem.find('.js-quick-start-form'); 37200 parent.find('.js-accordion-content').remove('.js-quick-start-form'); 37201 parent.find('.js-accordion-content').append(formContent); 37202 } 37203 if (Foundation.MediaQuery.is('large up')) { 37204 // desktop 37205 37206 // change classes for selected area 37207 elem.find('.js-accordion-item').removeClass('current is-active'); 37208 if (!parent.hasClass('current')) { 37209 parent.addClass('current is-active'); 37210 } 37211 37212 // update radiobox 37213 window.setTimeout(function () { 37214 titleElem.find('.js-quick-start-title-radiobox').prop('checked', true); 37215 _self.updateSubmitButton(elem); 37216 }, 0); 37217 37218 // switch (desktop) icon bubble 37219 elem.find('.js-icons-category').removeClass('is-active'); 37220 if (parent.hasClass('-content-phone-incl-contract')) { 37221 elem.find('.js-icons-category.-icon-phone-incl-contract').addClass('is-active'); 37222 } else if (parent.hasClass('-content-phone')) { 37223 elem.find('.js-icons-category.-icon-phone').addClass('is-active'); 37224 } else if (parent.hasClass('-content-contract')) { 37225 elem.find('.js-icons-category.-icon-contract').addClass('is-active'); 37226 } 37227 37228 // update content width 37229 elem.find('.js-accordion-content').css('width', elem.find('.js-quick-start-accordion').outerWidth()); 37230 } else { 37231 // mobile 37232 37233 // update classes and radiobox for selected area 37234 if (!parent.hasClass('is-active')) { 37235 elem.find('.js-accordion-item').removeClass('current'); 37236 parent.addClass('current'); 37237 window.setTimeout(function () { 37238 parent.find('.js-quick-start-title-radiobox').prop('checked', true); 37239 _self.updateSubmitButton(elem); 37240 }, 0); 37241 } else { 37242 elem.find('.js-accordion-item').removeClass('current'); 37243 window.setTimeout(function () { 37244 parent.find('.js-quick-start-title-radiobox').prop('checked', false); 37245 _self.updateSubmitButton(elem); 37246 }, 0); 37247 } 37248 } 37249 if (!parent.hasClass('-content-contract')) { 37250 window.setTimeout(function () { 37251 _self.loadDeviceData(elem); 37252 }, 0); 37253 } 37254 }); 37255 var selectedRadioBox = this.getUrlSetting(elem, 'fl'); 37256 var checkBox = elem.find(".js-quick-start-title-radiobox[value=".concat(selectedRadioBox, "]")); 37257 if (selectedRadioBox && checkBox.length > 0) { 37258 checkBox.closest('.js-accordion-title').trigger('click'); 37259 } 37260 } 37261 37262 /** 37263 * Handle model selection after change producer selection 37264 */ 37265 }, { 37266 key: "initModelSelection", 37267 value: function initModelSelection() { 37268 var _self = this; 37269 $(document).on('change', '.js-quick-start-select-producer', function () { 37270 var valueSelected = this.value; 37271 var isManufacturer = $(this).find('[value="' + valueSelected + '"]').parent().data('manufacturer') || false; 37272 var producerSelection = $(this); 37273 if (isManufacturer) { 37274 _self.loadDeviceData($(this).closest('.quick-start'), valueSelected); 37275 producerSelection.closest('.js-quick-start-device').find('.js-quick-start-device-label-model').addClass('active'); 37276 } else { 37277 producerSelection.closest('.js-quick-start-device').find('.js-quick-start-device-label-model').removeClass('active'); 37278 } 37279 _self.updateSubmitButton($(this).closest('.quick-start')); 37280 }); 37281 } 37282 37283 /** 37284 * Init accordion/tab 37285 * @param elem 37286 */ 37287 }, { 37288 key: "initTabs", 37289 value: function initTabs(elem) { 37290 if (Foundation.MediaQuery.is('large up')) { 37291 // desktop 37292 37293 // disable accordion settings 37294 if (elem.find('.accordion').length > 0) { 37295 elem.find('.accordion').foundation('destroy'); 37296 } 37297 elem.find('.js-quick-start-accordion').removeClass('accordion'); 37298 elem.find('.js-quick-start-accordion').removeAttr('data-accordion'); 37299 37300 // update first tab item 37301 elem.find('.js-accordion-item:first-child').addClass('is-active current'); 37302 37303 // update content width 37304 elem.find('.js-accordion-content').css('width', elem.find('.js-quick-start-accordion').outerWidth()); 37305 } else { 37306 // mobile 37307 37308 // enable accordion settings 37309 elem.find('.js-quick-start-accordion').addClass('accordion'); 37310 elem.find('.js-quick-start-accordion').attr('data-accordion', ''); 37311 elem.find('.accordion').foundation(); 37312 } 37313 } 37314 37315 /** 37316 * Reset quick start module settings 37317 * @param elem 37318 */ 37319 }, { 37320 key: "resetQuickStart", 37321 value: function resetQuickStart(elem) { 37322 if (Foundation.MediaQuery.is('large up')) { 37323 // desktop 37324 37325 // disable accordion settings 37326 if (elem.find('.accordion').length > 0) { 37327 elem.find('.accordion').foundation('destroy'); 37328 } 37329 elem.find('.js-quick-start-accordion').removeClass('accordion'); 37330 elem.find('.js-quick-start-accordion').removeAttr('data-accordion'); 37331 37332 // update content width 37333 elem.find('.js-accordion-content').css('width', elem.find('.js-quick-start-accordion').outerWidth()); 37334 setTimeout(function () { 37335 // Workaround 37336 elem.find('.js-accordion-content').show(); 37337 }, 0); 37338 37339 // activate first tab 37340 if (elem.find('.js-accordion-item.current').length === 0) { 37341 elem.find('.js-accordion-item:first-child .js-accordion-title').trigger('click'); 37342 } 37343 } else { 37344 // mobile 37345 37346 // enable accordion settings 37347 elem.find('.js-quick-start-accordion').attr('data-accordion', ''); 37348 elem.find('.js-quick-start-accordion').addClass('accordion'); 37349 elem.find('.accordion').foundation(); 37350 37351 // reset content width behavior 37352 elem.find('.js-accordion-content').css('width', 'inherit'); 37353 elem.find('.js-accordion-content').css('left', ''); 37354 } 37355 this.updateSubmitButton($(this)); 37356 } 37357 37358 /** 37359 * Request tariff infos 37360 * @param elem 37361 */ 37362 }, { 37363 key: "loadTariffData", 37364 value: function loadTariffData(elem) { 37365 var self = this; 37366 var tariffRequest = $(elem).data('tariff') || false; 37367 if (tariffRequest) { 37368 this.request(elem, tariffRequest, function (result) { 37369 var volumeInMb = 0; 37370 $(elem).find('.js-variant-wrapper').empty(); 37371 for (var i = 0; i < result.datavolume.length; i++) { 37372 if (result.datavolume[i].indexOf('GB') > -1) { 37373 volumeInMb = parseInt(result.datavolume[i]) * 1000; 37374 } else if (result.datavolume[i].indexOf('unbegrenzt') > -1) { 37375 volumeInMb = 999424; 37376 } else { 37377 volumeInMb = parseInt(result.datavolume[i]); 37378 } 37379 $(elem).find('.js-variant-wrapper').append('<a href="#" class="variant-switch__button-wrapper js-variant-button" data-button-value="' + volumeInMb + '">' + result.datavolume[i] + '</a>'); 37380 } 37381 window.theme.variantSwitch.init($(elem)); 37382 var b = $(elem).find('.js-variant-button'); 37383 var selectedDataVolume = self.getUrlSetting(elem, 'dv'); 37384 if (selectedDataVolume && b.filter("[data-button-value=".concat(selectedDataVolume, "]"))) { 37385 b = b.filter("[data-button-value=".concat(selectedDataVolume, "]")).trigger('click'); 37386 } else { 37387 b = b.eq(Math.floor(b.length / 2) - 1).trigger('click'); 37388 } 37389 }); 37390 } 37391 } 37392 37393 /** 37394 * Request helper function 37395 * @param elem 37396 * @param url 37397 * @parm callback 37398 */ 37399 }, { 37400 key: "request", 37401 value: function request(elem, url, callback) { 37402 var _self = this; 37403 $.ajax({ 37404 url: url, 37405 method: 'GET', 37406 dataType: 'json' 37407 }).done(function (result) { 37408 if (result.maintenance) { 37409 _self.showError(elem, 'Derzeit führen wir Wartungsarbeiten durch.<br><br>Bitte versuchen Sie es später erneut'); 37410 } else { 37411 callback(result); 37412 } 37413 })["catch"](function () { 37414 _self.showError(elem); 37415 }); 37416 } 37417 37418 /** 37419 * Show errormessage 37420 */ 37421 }, { 37422 key: "showError", 37423 value: function showError(ele, message) { 37424 var m = message || false; 37425 if (m) $('.js-qs-error-message', ele).html(m); 37426 $(ele).addClass('-error'); 37427 } 37428 37429 /** 37430 * Request device infos 37431 * @param elem 37432 */ 37433 }, { 37434 key: "loadDeviceData", 37435 value: function loadDeviceData(elem, manufacturer) { 37436 var _self = this; 37437 var deviceOnly = elem.find('.js-accordion-item.current.-content-phone').length > 0; 37438 var deviceRequest = $(elem).data('device1') || false; 37439 var appendix = null; 37440 if (deviceRequest && !manufacturer) { 37441 if (deviceOnly) { 37442 appendix = deviceRequest.indexOf('?') == -1 ? '?' : '&'; 37443 deviceRequest += appendix + 'hwo=1'; 37444 } 37445 this.request(elem, deviceRequest, function (result) { 37446 var items = $(elem).find('.js-quick-start-select-producer'); 37447 var selectedItem = items.val(); 37448 var foundItem = false;
37449 items.empty(); 37450 items.append('<option value="all" selected="selected">Alle Hersteller</option>'); 37451 var itemgroup; 37452 if (result.topseller.length > 0) { 37453 itemgroup = ""; 37454 itemgroup += '<optgroup label="Topseller">'; 37455 result.topseller.forEach(function (entry) { 37456 foundItem = foundItem || selectedItem === entry.id; 37457 itemgroup += '<option value="' + entry.id + '">' + entry.label + '</option>'; 37458 }); 37459 itemgroup += '</optgroup>'; 37460 items.append(itemgroup); 37461 } 37462 if (result.manufacturer.length > 0) { 37463 itemgroup = ""; 37464 itemgroup += '<optgroup label="Hersteller" data-manufacturer="true">'; 37465 result.manufacturer.forEach(function (entry) { 37466 foundItem = foundItem || selectedItem === entry.id; 37467 itemgroup += '<option value="' + entry.id + '">' + entry.label + '</option>'; 37468 }); 37469 itemgroup += '</optgroup>'; 37470 items.append(itemgroup); 37471 } 37472 if (foundItem) { 37473 items.val(selectedItem); 37474 } 37475 items.change(); 37476 var selectedProducer = _self.getUrlSetting(elem, 'mf'); 37477 if (selectedProducer !== 'all') { 37478 items.find('option[selected=selected]').removeAttr('selected'); 37479 items.find("option[value=".concat(selectedProducer, "]")).attr('selected', 'selected'); 37480 items.trigger('change'); 37481 } 37482 _self.updateSubmitButton(elem); 37483 }); 37484 } else if (manufacturer) { 37485 var manufacturerRequest = $(elem).data('device2') || false; 37486 if (manufacturerRequest) { 37487 appendix = manufacturerRequest.indexOf('?') == -1 ? '?' : '&'; 37488 manufacturerRequest += appendix + 'm=' + manufacturer; 37489 if (deviceOnly) { 37490 manufacturerRequest += '&hwo=1'; 37491 } 37492 this.request(elem, manufacturerRequest, function (result) { 37493 var items = $(elem).find('.js-quick-start-select-model'); 37494 var selectedItem = items.val(); 37495 var foundItem = false; 37496 items.empty(); 37497 items.append('<option value="all" selected="selected">Alle Modelle</option>'); 37498 result.devices.forEach(function (entry) { 37499 foundItem = foundItem || selectedItem === entry.id; 37500 items.append('<option value="' + entry.id + '">' + entry.label + '</option>'); 37501 }); 37502 if (foundItem) { 37503 items.val(selectedItem).change(); 37504 } 37505 var selectedModel = _self.getUrlSetting(elem, 'mm'); 37506 if (selectedModel !== 'all') { 37507 items.find('option[selected=selected]').removeAttr('selected'); 37508 items.find("option[value=".concat(selectedModel, "]")).attr('selected', 'selected'); 37509 items.find('option[selected=selected]').trigger('change'); 37510 } 37511 _self.updateSubmitButton(elem); 37512 }); 37513 } 37514 } 37515 } 37516 }, { 37517 key: "updateSubmitButton", 37518 value: function updateSubmitButton(elem) { 37519 var category = $(elem).find('.js-quick-start-title-radiobox:checked').val(), 37520 producer = $(elem).find('.js-quick-start-select-producer').val(), 37521 model = $(elem).find('.js-quick-start-select-model').val(), 37522 modelVisible = $(elem).find('.js-quick-start-select-model').is(':visible'), 37523 datavolume = $(elem).find('.js-quick-start-datavolume').data('value') || false; 37524 var url = "#"; 37525 switch (category) { 37526 case "bundle": 37527 { 37528 var deviceBundleAll = $(elem).data('deviceBundleAll') || false, 37529 deviceBundleProduct = $(elem).data('deviceBundleProduct') || false, 37530 deviceBundleBrand = $(elem).data('deviceBundleBrand') || false, 37531 dataParamBundle = $(elem).data('dataParam') || false; 37532 if (producer == "all") { 37533 url = deviceBundleAll; 37534 } else if (modelVisible) { 37535 if (model == "all") { 37536 url = deviceBundleBrand.replace("%1", producer); 37537 } else { 37538 url = deviceBundleProduct.replace("%1", model); 37539 } 37540 } else if (producer !== null) { 37541 url = deviceBundleProduct.replace("%1", producer); 37542 } 37543 if (url.indexOf('?') == -1) url += '?';else url += '&'; 37544 url += dataParamBundle + "=" + encodeURIComponent(datavolume); 37545 break; 37546 } 37547 case "hwo": 37548 { 37549 var deviceAll = $(elem).data('deviceAll') || false, 37550 deviceProduct = $(elem).data('deviceProduct') || false, 37551 deviceBrand = $(elem).data('deviceBrand') || false; 37552 if (producer == "all") { 37553 url = deviceAll; 37554 } else if (modelVisible) { 37555 if (model == "all") { 37556 url = deviceBrand.replace("%1", producer); 37557 } else { 37558 url = deviceProduct.replace("%1", model); 37559 } 37560 } else if (producer !== null) { 37561 url = deviceProduct.replace("%1", producer); 37562 } 37563 break; 37564 } 37565 case "simonly": 37566 { 37567 var tariffs = $(elem).data('tariffs') || false, 37568 dataParam = $(elem).data('dataParam') || false; 37569 url = tariffs; 37570 if (url.indexOf('?') == -1) url += '?';else url += '&'; 37571 url += dataParam + "=" + encodeURIComponent(datavolume); 37572 break; 37573 } 37574 } 37575 $(elem).find('.js-quick-start-submit').attr('href', url); 37576 } 37577 }]); 37578}(_SGComponent2.SGComponent); 37579window.theme.quickStart = new QuickStart(); 37580 37581},{"FoundationCore.js":77,"SGComponent":83,"query-string":34}
vendor: 4,455 bytes, lines 37581-37622
37581],113:[function(require,module,exports){ 37582'use strict'; 37583 37584function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 37585Object.defineProperty(exports, "__esModule", { 37586 value: true 37587}); 37588exports.QuickStartRedesignWrapper = exports.QuickStartRedesign = void 0; 37589var _SGComponent3 = require("SGComponent"); 37590function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 37591function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 37592function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 37593function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 37594function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 37595function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 37596function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 37597function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 37598function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 37599function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 37600function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 37601function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 37602function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 37603function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 37604function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 37605var QuickStartRedesignWrapper = exports.QuickStartRedesignWrapper = /*#__PURE__*/function (_SGComponent) { 37606 function QuickStartRedesignWrapper() { 37607 _classCallCheck(this, QuickStartRedesignWrapper); 37608 return _callSuper(this, QuickStartRedesignWrapper); 37609 } 37610 _inherits(QuickStartRedesignWrapper, _SGComponent); 37611 return _createClass(QuickStartRedesignWrapper, [{ 37612 key: "init", 37613 value: function init(container) { 37614 container = _superPropGet(QuickStartRedesignWrapper, "init", this, 3)([container]); 37615 var instance = this; 37616 this.quickStarts = []; 37617 $(container).find('.quick-start-modern').each(function () { 37618 instance.quickStarts.push(new QuickStartRedesign($(this))); 37619 }); 37620 } 37621 }]); 37622}(_SGComponent3.SGComponent);
37623var QuickStartRedesign = exports.QuickStartRedesign = /*#__PURE__*/function (_SGComponent2) { 37624 function QuickStartRedesign(base) { 37625 var _this; 37626 _classCallCheck(this, QuickStartRedesign); 37627 _this = _callSuper(this, QuickStartRedesign); 37628 _this.base = base; 37629 _this.expandState = false; 37630 _this.registerEvents(); 37631 _this.resetSelection(); 37632 return _this; 37633 } 37634 _inherits(QuickStartRedesign, _SGComponent2); 37635 return _createClass(QuickStartRedesign, [{ 37636 key: "registerEvents", 37637 value: function registerEvents() { 37638 var _this2 = this; 37639 this.base.find('.js-quick-start-navitem').on('click.QuickStartRedesign', function (e) { 37640 return _this2.handleTabClick(e); 37641 }); 37642 this.base.find('.js-quick-start-box').on('click.QuickStartRedesign', function (e) { 37643 return _this2.handleBoxClick(e); 37644 }); 37645 } 37646 }, { 37647 key: "updateOffer", 37648 value: function updateOffer() { 37649 if (this.offerButton) { 37650 this.setOfferUrl(this.buildOfferUrl()); 37651 this.setOfferEvent(); 37652 } 37653 } 37654 }, { 37655 key: "buildOfferUrl", 37656 value: function buildOfferUrl() { 37657 var _this$currentContent$ = this.currentContent.data(), 37658 url = _this$currentContent$.url; 37659 var base = url.indexOf('?') !== -1 ? url : "".concat(url, "?"); 37660 var parameters = this.selection.filter(function (row) { 37661 return !!row.length; 37662 }).map(function (row) { 37663 var _$$data = $(row[0]).data(), 37664 param = _$$data.param; 37665 return param ? "&".concat(param, "=") + row.map(function (element) { 37666 return $(element).data().value; 37667 }).join('|') : ''; 37668 }).join(''); 37669 return base + parameters; 37670 } 37671 }, { 37672 key: "setOfferUrl", 37673 value: function setOfferUrl(url) { 37674 if (this.offerButton) { 37675 this.offerButton.attr('href', url); 37676 } 37677 } 37678 }, { 37679 key: "setOfferEvent", 37680 value: function setOfferEvent() { 37681 if (this.offerButton) { 37682 // remove last element from string 37683 var currentEvent = this.offerButton.data('gaClick').split('|'); 37684 currentEvent.splice(-1, 1); 37685 currentEvent.push(''); 37686 var clickEvent = currentEvent.join('|'); 37687 var parameters = this.selection.filter(function (row) { 37688 return !!row.length; 37689 }).map(function (row) { 37690 return row.map(function (element) { 37691 var eventData = $(element).data('gaClick').replace('tm|vf|tf', 'alle Netze'); 37692 var separated = eventData.split('|'); 37693 return separated[separated.length - 1]; 37694 }); 37695 }).join('+'); 37696 var combined = clickEvent + (parameters === '' ? 'keine Auswahl' : parameters); 37697 this.offerButton.data('gaClick', combined); 37698 } 37699 } 37700 }, { 37701 key: "toggleExpandContent", 37702 value: function toggleExpandContent() { 37703 this.expandState = !this.expandState; 37704 this.toggleClassesExpandContent(this.expandState); 37705 } 37706 }, { 37707 key: "toggleClassesExpandContent", 37708 value: function toggleClassesExpandContent(state) { 37709 this.expandBlock.toggleClass('-show-all', state); 37710 this.expandBlock.toggleClass('-show-first', !state); 37711 // change icons 37712 var icon = $(this.currentContent).find('.js-toggle-expand-content-icon'); 37713 icon.toggleClass('fa-chevron-down', !state); 37714 icon.toggleClass('fa-chevron-up', state); 37715 // change message 37716 var open = $(this.currentContent).find('.js-toggle-expand-content-open-message'); 37717 var close = $(this.currentContent).find('.js-toggle-expand-content-close-message'); 37718 open.toggleClass('hide', state); 37719 close.toggleClass('hide', !state); 37720 // Dispatch a resize event to trigger a new max-height value for the tab content 37721 $(window).trigger('resize'); 37722 } 37723 37724 // Reset box selection, offer state and offer url 37725 }, { 37726 key: "resetSelection", 37727 value: function resetSelection() { 37728 var _this3 = this; 37729 // unbind handler 37730 if (this.expandToggle) { 37731 this.expandToggle.unbind(); 37732 } 37733 // get elements 37734 this.currentContent = $(this.base.find('.js-quick-start-content.-is-active')); 37735 this.boxes = this.currentContent.find('.js-quick-start-box'); 37736 this.expandBlock = this.currentContent.find('.js-expand-content'); 37737 this.expandToggle = this.currentContent.find('.js-toggle-expand-content'); 37738 this.expandToggle.on('click.QuickStartRedesign', function (e) { 37739 return _this3.toggleExpandContent(e); 37740 }); 37741 this.offerButton = this.currentContent.find('.js-offer-button'); 37742 this.offerParagraph = this.currentContent.find('.js-offer-paragraph'); 37743 // reset selection 37744 if (this.selection) { 37745 this.selection.forEach(function (element) { 37746 return element && $(element).removeClass('-is-active'); 37747 }); 37748 } 37749 // create new selection for each block (e.g. a row of devices or sim cards) 37750 var numberOfBlocks = this.currentContent.find('.js-quick-start-block').length; 37751 this.selection = Array.from({ 37752 length: numberOfBlocks 37753 }, function () { 37754 return []; 37755 }); 37756 // find default selection 37757 var defaults = this.currentContent.find('[data-default]').trigger('click.QuickStartRedesign'); 37758 // reset expand content 37759 this.toggleClassesExpandContent(false); 37760 this.expandState = false;
37761 } 37762 }, { 37763 key: "handleTabClick", 37764 value: function handleTabClick(_ref) { 37765 var _this4 = this; 37766 var target = _ref.target; 37767 if (target != this.currentTab) { 37768 this.currentTab = target; 37769 window.setTimeout(function () { 37770 return _this4.resetSelection(); 37771 }); 37772 } 37773 } 37774 }, { 37775 key: "handleBoxClick", 37776 value: function handleBoxClick(_ref2) { 37777 var target = _ref2.target; 37778 var selector = $(target).hasClass('js-second-row') ? 1 : 0; 37779 var usesMultiSelect = $(target).parent().hasClass('js-use-multiselect'); 37780 if (usesMultiSelect) { 37781 this.multiSelect(target, selector); 37782 } else { 37783 this.singleSelect(target, selector); 37784 } 37785 $(target).removeClass('-is-active'); 37786 this.selection[selector].forEach(function (element) { 37787 return $(element).addClass('-is-active'); 37788 }); 37789 this.updateOffer(); 37790 } 37791 }, { 37792 key: "multiSelect", 37793 value: function multiSelect(target, selector) { 37794 var selection = this.selection[selector]; 37795 var isActive = $(target).hasClass('-is-active'); 37796 // if element was already selected => remove it, else add it to the current selection 37797 return isActive ? selection.splice(selection.indexOf(target), 1) : selection.push(target); 37798 } 37799 }, { 37800 key: "singleSelect", 37801 value: function singleSelect(target, selector) { 37802 var selection = this.selection[selector]; 37803 // deselect all elements 37804 selection.forEach(function (element) { 37805 return $(element).removeClass('-is-active'); 37806 }); 37807 // if element was already selected => remove it, else make it the current selection 37808 this.selection[selector] = target !== selection[0] ? [target] : []; 37809 } 37810 }]); 37811}(_SGComponent3.SGComponent); 37812window.theme.quickstartRedesign = new QuickStartRedesignWrapper(); 37813 37814},{"SGComponent":83}],114:[function(require,module,exports){ 37815'use strict'; 37816 37817function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 37818Object.defineProperty(exports, "__esModule", { 37819 value: true 37820}); 37821exports.ConfigList = void 0; 37822var _SGComponent2 = require("SGComponent"); 37823var focusTrap = _interopRequireWildcard(require("focus-trap")); 37824function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } 37825function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 37826function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 37827function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 37828function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 37829function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 37830function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 37831function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 37832function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 37833function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 37834function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 37835function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 37836function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 37837function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 37838function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
37838 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 37839function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 37840var ConfigList = exports.ConfigList = /*#__PURE__*/function (_SGComponent) { 37841 function ConfigList() { 37842 _classCallCheck(this, ConfigList); 37843 return _callSuper(this, ConfigList, arguments); 37844 } 37845 _inherits(ConfigList, _SGComponent); 37846 return _createClass(ConfigList, [{ 37847 key: "init", 37848 value: function init(container) { 37849 container = _superPropGet(ConfigList, "init", this, 3)([container]); 37850 var _self = this; 37851 $(container).find('.config-list').each(function () { 37852 $(this).data("requests", []); 37853 if (!$(this).data('filter')) { 37854 $(this).data('filter', {}); 37855 } 37856 if (!$(this).data('variant')) { 37857 $(this).data('variant', ''); 37858 } 37859 if (!$(this).data('sort')) { 37860 $(this).data('sort', ''); 37861 } 37862 //_self.loadProducts(this); Auskommentiert um doppelte Requests zu vermeiden 37863 37864 $(this).on('changeVariant.ConfigList', function (e, data) { 37865 $(e.target).data('page', 1); 37866 if (typeof data.product !== "undefined") { 37867 $(e.target).data('variant', data.product); 37868 _self.loadProducts(e.target); 37869 } 37870 }); 37871 $(this).on('changeFilter.ConfigList', function (e, data) { 37872 $(e.target).data('page', 1); 37873 $(e.target).data('filter', data); 37874 _self.loadProducts(e.target); 37875 }); 37876 $(this).on('changeSort.ConfigList', function (e, data) { 37877 $(e.target).data('page', 1); 37878 $(e.target).data('sort', data); 37879 _self.loadProducts(e.target); 37880 }); 37881 }); 37882 } 37883 }, { 37884 key: "loadProducts", 37885 value: function loadProducts(ele) { 37886 var _self = this; 37887 var url = $(ele).data('provider') || false; 37888 var page = $(ele).data('page') || 1; 37889 if (url) { 37890 _self.showLoading(ele, page > 1); 37891 if (!$(ele).data("timeout")) { 37892 var timeout = setTimeout(function () { 37893 var requests = $(ele).data("requests") || []; 37894 requests.push(requests.length); 37895 $(ele).data("requests", requests); 37896 var urlPrefix = url.indexOf('?') !== -1 ? '&' : '?'; 37897 /* Filter */ 37898 var filter = $(ele).data('filter') || {}; 37899 filter = JSON.stringify(filter); 37900 filter = encodeURIComponent(filter); 37901 url += filter !== '{}' ? urlPrefix + 'f=' + filter : ''; 37902 37903 /* Sortierung */ 37904 urlPrefix = url.indexOf('?') !== -1 ? '&' : '?'; 37905 var sort = $(ele).data('sort') || {}; 37906 sort = JSON.stringify(sort); 37907 sort = encodeURIComponent(sort); 37908 url += sort !== '{}' ? urlPrefix + 's=' + sort : ''; 37909 37910 /* Variant */ 37911 urlPrefix = url.indexOf('?') !== -1 ? '&' : '?'; 37912 var variant = $(ele).data('variant') || ''; 37913 url += variant !== '' ? urlPrefix + 'v=' + variant : ''; 37914 37915 /* Page */ 37916 urlPrefix = url.indexOf('?') !== -1 ? '&' : '?'; 37917 url += page > 1 ? urlPrefix + 'p=' + page : ''; 37918 $.ajax({ 37919 'url': url, 37920 'method': 'GET', 37921 'dataType': 'html', 37922 'timeout': 25000, 37923 'cache': false, 37924 'beforeSend': function beforeSend(jqXHR, settings) { 37925 jqXHR.id = requests.length - 1; 37926 } 37927 }).done(function (data, status, xhr) { 37928 if (_self.isLastRequest(ele, xhr)) _self.showDataWithEvents(ele, data); 37929 })["catch"](function (xhr, status, error) { 37930 if (_self.isLastRequest(ele, xhr)) _self.showServiceError(ele, status); 37931 }).always(function () { 37932 $('body').removeClass('-loading'); 37933 }); 37934 }, 350); 37935 $(ele).data("timeout", timeout); 37936 } else { 37937 clearTimeout($(ele).data("timeout")); 37938 $(ele).removeData("timeout"); 37939 _self.loadProducts(ele); 37940 } 37941 } else { 37942 _self.showServiceError(ele, 'unknown url'); 37943 } 37944 } 37945 }, { 37946 key: "isLastRequest", 37947 value: function isLastRequest(ele, xhr) { 37948 var requests = $(ele).data('requests') || []; 37949 return requests.length > 0 && requests[requests.length - 1] === xhr.id; 37950 } 37951 }, { 37952 key: "showDataWithEvents", 37953 value: function showDataWithEvents(ele, data) { 37954 var _self = this; 37955 $('.js-loading-block', ele).remove(); 37956 $(ele).on("click.ConfigList", '.js-load-more', function (e) { 37957 e.preventDefault(); 37958 var buttonEle = $(this); 37959 var page = buttonEle.data('page') || 1; 37960 $(ele).data('page', parseInt(page) + 1); 37961 buttonEle.remove(); 37962 _self.loadProducts(ele); 37963 }); 37964 data = $(data).css('opacity', 0); 37965 if ($(ele).data('page') > 1) { 37966 $(ele).append(data); 37967 // 0. div --> erstes Element mit tabindex 37968 var newFocusElement = $(document).find(data[0]).find('[tabindex]'); 37969 if (newFocusElement.length > 0) { 37970 newFocusElement[0].focus(); 37971 } 37972 } else { 37973 $(ele).html(data); 37974 } 37975 37976 // BFSG 37977 var trap = null; 37978 $(ele).find('.js-promo-item a').each(function (index, a) { 37979 $(a).off('opened').on('opened', function () { 37980 if (!trap) {
37981 trap = focusTrap.createFocusTrap($('.js-content-overlay-wrapper')[0], { 37982 initialFocus: $('.js-content-overlay-close')[1] // [0] ist das backdrop 37983 }); 37984 } 37985 trap.activate(); 37986 return trap; 37987 }).off('closed').on('closed', function () { 37988 if (trap) { 37989 trap.deactivate(); 37990 trap = null; 37991 } 37992 }); 37993 }); 37994 37995 // initialize Modules 37996 window.theme.toolTipExt.init($(ele)); 37997 this.triggerCallback(ele, ''); 37998 data.animate({ 37999 'opacity': 1 38000 }, 'slow'); 38001 } 38002 }, { 38003 key: "triggerCallback", 38004 value: function triggerCallback(ele, data) { 38005 var cb = $(ele).data('callback') || false; 38006 if (cb) { 38007 var callback = JSON.parse(cb.replace(/\'/g, '"')); 38008 if (callback.event && callback.target) { 38009 $(callback.target).trigger(callback.event, data); 38010 } 38011 } 38012 } 38013 }, { 38014 key: "showServiceError", 38015 value: function showServiceError(ele, type) { 38016 this.triggerCallback(ele, type); 38017 $(ele).html("\n <div class=\"config-list__error\">\n Der Service steht zur Zeit leider nicht zur Verf\xFCgung. Bitte versuchen Sie es sp\xE4ter erneut.\n </div>\n "); 38018 } 38019 }, { 38020 key: "showLoading", 38021 value: function showLoading(ele, append) { 38022 $('body').addClass('-loading'); 38023 var html = "\n <div class=\"config-list__loading js-loading-block\">\n <img src=\"/theme/images/loading40.svg\" />\n <div class=\"config-list__loading-text\">\n Wird geladen...\n </div>\n </div>\n "; 38024 if ($('.js-loading-block', ele).length == 0) { 38025 if (append) { 38026 $(ele).append(html); 38027 } else { 38028 $(ele).children().fadeOut(function () { 38029 $(ele).html(html); 38030 }); 38031 } 38032 } 38033 } 38034 }]); 38035}(_SGComponent2.SGComponent); 38036window.theme.configList = new ConfigList(); 38037 38038},{"SGComponent":83,"focus-trap":14}],115:[function(require,module,exports){ 38039"use strict"; 38040 38041Object.defineProperty(exports, "__esModule", { 38042 value: true 38043}); 38044exports.ConfigFilter = void 0; 38045var _SGComponent2 = require("SGComponent"); 38046function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 38047function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 38048function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 38049function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 38050function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 38051function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 38052function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 38053function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 38054function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 38055function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 38056function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 38057function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 38058function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 38059function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 38060function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
38060 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 38061function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 38062var ConfigFilter = exports.ConfigFilter = /*#__PURE__*/function (_SGComponent) { 38063 function ConfigFilter() { 38064 _classCallCheck(this, ConfigFilter); 38065 return _callSuper(this, ConfigFilter, arguments); 38066 } 38067 _inherits(ConfigFilter, _SGComponent); 38068 return _createClass(ConfigFilter, [{ 38069 key: "init", 38070 value: function init(container) { 38071 container = _superPropGet(ConfigFilter, "init", this, 3)([container]); 38072 var _self = this; 38073 $(container).find(".config-filter").each(function () { 38074 var ele = this; 38075 var filter = $(this).data("filter") || null; 38076 if (typeof filter === "string") { 38077 filter = JSON.parse(filter.replace(/\'/g, '"')); 38078 } 38079 _self.setFilter(this, filter); 38080 _self.initialShown(this); 38081 _self.updateFilterItems(this); 38082 $(this).on("updateFilterLimits.ConfigFilter", function (e, data) { 38083 // TODO: Phase 2 38084 }); 38085 $(this).on("deleteFilter.ConfigFilter", function (e, data) { 38086 if (data) { 38087 _self.resetFilter(ele); 38088 } 38089 }); 38090 38091 /* 38092 Recalc slider on show 38093 */ 38094 $(this).find(".accordion").on("down.zf.accordion", function (e, tab) { 38095 if ($(tab).hasClass("js-config-filter-slider")) { 38096 var slider = $(tab).find(".slider"); 38097 _self.reinitSlider(slider); 38098 } 38099 }); 38100 38101 /* 38102 calculate slider values 38103 */ 38104 $(this).find(".js-config-filter-slider").each(function () { 38105 var s = $(this).find(".slider"); 38106 s.on("changed.zf.slider", function (e, slider) { 38107 var isInitial = s.data("initial"); 38108 var ident = s.data("ident") || ""; 38109 var iStart = parseFloat($(s).data("initialStart")); 38110 var cStart = parseFloat($(".js-config-filter-" + ident + "-min", s).val()); 38111 var iEnd = parseFloat($(s).data("initialEnd")); 38112 var cEnd = parseFloat($(".js-config-filter-" + ident + "-max", s).val()); 38113 var isOnInitialStart = iStart === cStart; 38114 var isOnInitialEnd = iEnd === cEnd; 38115 var division = s.data("division") || 1; 38116 var min = s.find(".js-config-filter-" + ident + "-min").val() / division; 38117 var max = s.find(".js-config-filter-" + ident + "-max").val() / division; 38118 var value = s.prev(".js-config-filter-value"); 38119 var unit = value.data("unit") || ""; 38120 min = min.toString().replace(".", ","); 38121 max = max.toString().replace(".", ","); 38122 value.html(min + " - " + max + " " + unit); 38123 if (!isOnInitialStart || !isOnInitialEnd || isInitial === false) { 38124 s.data("initial", false); 38125 _self.triggerFilterUpdate(ele); 38126 } 38127 }); 38128 }); 38129 38130 /* 38131 Filter change 38132 */ 38133 $(this).on("switchFilter.ConfigFilter", function (e, data) { 38134 if (e.target == ele) { 38135 _self.triggerFilterUpdate(ele); 38136 } 38137 }); 38138 }); 38139 } 38140 }, { 38141 key: "isHiddenFilter", 38142 value: function isHiddenFilter(ele, ident) { 38143 return $(".js-config-filter-item[data-ident=" + ident + "]", ele).hasClass("-hide"); 38144 } 38145 }, { 38146 key: "resetFilter", 38147 value: function resetFilter(ele) { 38148 var _self = this; 38149 $(ele).find(".js-config-filter-item").each(function (i, filterItem) { 38150 var type = $(filterItem).data("type") || false; 38151 var identifier = $(filterItem).data("ident") || ""; 38152 var isHidden = _self.isHiddenFilter(ele, identifier);
38153 if (!isHidden) { 38154 switch (type) { 38155 case "variant": 38156 case "color": 38157 $(".js-variant-button", filterItem).removeClass("-active"); 38158 var variantEle = $(".js-config-filter-" + identifier, ele); 38159 variantEle.data("value", ""); 38160 window.theme.variantSwitch.initState(variantEle); 38161 break; 38162 case "range": 38163 var slider = $(".js-config-filter-" + identifier, filterItem); 38164 var min = slider.data("initialStart"); 38165 var max = slider.data("initialEnd"); 38166 slider.attr("data-start", min); 38167 slider.attr("data-end", max); 38168 slider.find(".js-config-filter-" + identifier + "-min").val(min); 38169 slider.find(".js-config-filter-" + identifier + "-max").val(max); 38170 _self.reinitSlider(slider); 38171 break; 38172 default: 38173 break; 38174 } 38175 } 38176 }); 38177 // setTimeout(function() { 38178 _self.triggerFilterUpdate(ele); 38179 // }, 200); 38180 } 38181 }, { 38182 key: "countActiveFilter", 38183 value: function countActiveFilter(ele) { 38184 var _self = this; 38185 var count = 0; 38186 $(ele).find(".js-config-filter-item").each(function (i, filterItem) { 38187 var type = $(filterItem).data("type") || false; 38188 var identifier = $(filterItem).data("ident") || ""; 38189 var isHidden = _self.isHiddenFilter(ele, identifier); 38190 var filter = $(".js-config-filter-" + identifier, filterItem);
38191 if (!isHidden) { 38192 switch (type) { 38193 case "variant": 38194 case "color": 38195 if ($(".js-variant-button.-active", filter).length > 0) count++; 38196 break; 38197 case "range": 38198 var min = filter.data("initialStart"); 38199 var max = filter.data("initialEnd"); 38200 if (min != filter.find(".js-config-filter-" + identifier + "-min").val() || max != filter.find(".js-config-filter-" + identifier + "-max").val()) { 38201 count++; 38202 } 38203 break; 38204 default: 38205 break; 38206 } 38207 } 38208 }); 38209 return count; 38210 } 38211 38212 /* 38213 Callback nach Filter Änderung 38214 */ 38215 }, { 38216 key: "triggerFilterUpdate", 38217 value: function triggerFilterUpdate(ele) { 38218 var cb = $(ele).data("callback") || false; 38219 if (cb) { 38220 var callback = JSON.parse(cb.replace(/\'/g, '"')); 38221 if (callback.event && callback.target) { 38222 var filter = []; 38223 filter = this.getFilterValues(ele); 38224 $(callback.target).trigger(callback.event, filter); 38225 } 38226 } 38227 } 38228 }, { 38229 key: "getFilterValues", 38230 value: function getFilterValues(ele) { 38231 var filter = {}; 38232 var tmp = ""; 38233 var cat = $(ele).data("categories") || ""; 38234 filter.categories = cat; 38235 filter.count = this.countActiveFilter(ele); 38236 $(ele).find(".js-config-filter-item").each(function (i, filterItem) { 38237 var type = $(filterItem).data("type") || false; 38238 var ident = $(filterItem).data("ident") || ""; 38239 var param = $(filterItem).data("param") || ""; 38240 if (type === "variant" || type === "color" || type === "dropdown") { 38241 tmp = $(filterItem).find(".js-config-filter-" + ident).data("value").toString(); 38242 filter[ident + "|" + param] = tmp == "" ? [] : tmp.split("|"); 38243 } else if (type === "range") { 38244 var min = $(ele).find(".js-config-filter-" + ident + "-min").val() || 0, 38245 max = $(ele).find(".js-config-filter-" + ident + "-max").val() || 0; 38246 var rangeMin = $(ele).find(".js-config-filter-" + ident).data("start") || 0, 38247 rangeMax = $(ele).find(".js-config-filter-" + ident).data("end") || 0; 38248 var range = []; 38249 if (parseInt(min) !== parseInt(rangeMin) || parseInt(max) !== parseInt(rangeMax)) { 38250 range = [min, max]; 38251 } 38252 filter[ident + "|" + param] = range; 38253 } 38254 }); 38255 return filter; 38256 } 38257 38258 /* 38259 Slider neu berechnen 38260 */ 38261 }, { 38262 key: "reinitSlider", 38263 value: function reinitSlider(slider) { 38264 setTimeout(function () { 38265 slider.foundation("_reflow"); 38266 setTimeout(function () { 38267 slider.foundation("_reflow"); 38268 }, 300); 38269 }, 200); 38270 } 38271 38272 /* 38273 Filter initial ausklappen 38274 */ 38275 }, { 38276 key: "initialShown", 38277 value: function initialShown(ele) { 38278 var s = $(ele).data("initialShown") || 0; 38279 if (s > 0) { 38280 var e = $(ele).find(".accordion"); 38281 for (var i = 0; i < s; i++) { 38282 e.foundation("down", $(ele).find(".accordion-content").eq(i)); 38283 } 38284 } 38285 } 38286 38287 /* 38288 Filter Objekt berechnen und in data-attribut speichern 38289 */ 38290 }, { 38291 key: "setFilter", 38292 value: function setFilter(ele, filter) { 38293 var base = this.getFilterValues(ele); 38294 if (_typeof(filter) === "object") { 38295 $.extend(base, filter); 38296 } 38297 $(ele).data("filter", base); 38298 var cb = $(ele).data("callback") || false; 38299 if (cb) { 38300 var callback = JSON.parse(cb.replace(/\'/g, '"')); 38301 if (callback.event && callback.target) { 38302 $(callback.target).trigger(callback.event, $(ele).data("filter")); 38303 } 38304 } 38305 } 38306 38307 /* 38308 Filter aus data-attribut setzen 38309 */ 38310 }, { 38311 key: "updateFilterItems", 38312 value: function updateFilterItems(ele) { 38313 var filter = $(ele).data("filter") || {}; 38314 for (var _i = 0, _Object$keys = Object.keys(filter); _i < _Object$keys.length; _i++) { 38315 var identifierStr = _Object$keys[_i]; 38316 var identifierSplit = identifierStr.split("|"); 38317 if (identifierSplit.length > 1) { 38318 var identifier = identifierSplit[0] || ""; 38319 var param = identifierSplit[1] || ""; 38320 var item = $(ele).find(".js-config-filter-item[data-ident=" + identifier + "][data-param=" + param + "]"); 38321 var variant = item.data("type") || false; 38322 if (variant) { 38323 if (variant === "variant" || variant === "color") { 38324 var variantEle = $(item).find(".js-config-filter-" + identifier); 38325 for (var i = 0; i < filter[identifierStr].length; i++) { 38326 var activeElement = $(variantEle).find('.js-variant-button[data-button-value="' + filter[identifierStr][i] + '"]'); 38327 if (activeElement.length > 0) window.theme.variantSwitch.setState(variantEle, activeElement); 38328 } 38329 } else if (variant === "range") { 38330 var slider = $(ele).find(".js-config-filter-" + identifier); 38331 if (typeof filter[identifierStr] !== "undefined" && $.isArray(filter[identifierStr]) && filter[identifierStr].length > 0) {
vendor: 4,231 bytes, lines 38332-38369
38332 if (filter[identifierStr][1] !== "") slider.find(".js-config-filter-" + identifier + "-min").val(filter[identifierStr][0]); 38333 if (filter[identifierStr][0] !== "") slider.find(".js-config-filter-" + identifier + "-max").val(filter[identifierStr][1]); 38334 } 38335 this.reinitSlider(slider); 38336 } 38337 } 38338 } 38339 } 38340 } 38341 }]); 38342}(_SGComponent2.SGComponent); 38343window.theme.configFilter = new ConfigFilter(); 38344 38345},{"SGComponent":83}],116:[function(require,module,exports){ 38346'use strict'; 38347 38348function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 38349Object.defineProperty(exports, "__esModule", { 38350 value: true 38351}); 38352exports.TariffDetailLayer = void 0; 38353var _SGComponent2 = require("SGComponent"); 38354function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 38355function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 38356function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 38357function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 38358function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 38359function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 38360function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 38361function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 38362function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 38363function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 38364function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 38365function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 38366function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 38367function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 38368function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 38369var TariffDetailLayer = exports.TariffDetailLayer = /*#__PURE__*/function (_
38369SGComponent) { 38370 function TariffDetailLayer() { 38371 _classCallCheck(this, TariffDetailLayer); 38372 return _callSuper(this, TariffDetailLayer, arguments); 38373 } 38374 _inherits(TariffDetailLayer, _SGComponent); 38375 return _createClass(TariffDetailLayer, [{ 38376 key: "init", 38377 value: function init(container) { 38378 container = _superPropGet(TariffDetailLayer, "init", this, 3)([container]); 38379 var instance = this; 38380 $(container).find('.tariff-detail-layer').each(function () { 38381 //mark open containers as "is-active" 38382 instance.initCategoryView($(this)); 38383 38384 // Fix: 0.00 € -> kostenlos 38385 $(this).find(".tariff-detail-layer__keyvalue-value").each(function (index, item) { 38386 if ($.trim($(item).text()) == '0.00 €' || $.trim($(item).text()) == '0,00 €') { 38387 $(item).html('kostenlos'); 38388 } 38389 }); 38390 38391 // TODO: js class für event muss in Markup angelegt werden 38392 $(this).find(".tariff-detail-layer__category").on("click.TariffDetailLayer"); 38393 $(this).find(".tariff-detail-layer__category").on("click.TariffDetailLayer", instance.categoryClickHandler.bind(this)); 38394 }); 38395 $(window).resize(function () { 38396 $('.tariff-detail-layer').each(function () { 38397 instance.initCategoryView($(this)); 38398 }); 38399 }); 38400 } 38401 }, { 38402 key: "initCategoryView", 38403 value: function initCategoryView(rootElement) { 38404 if (window.innerWidth <= 640) { 38405 //TODO: MQ 38406 rootElement.find(".tariff-detail-layer__category").removeClass("-is-active"); 38407 rootElement.find(".tariff-detail-layer__category-content").removeClass("-is-active"); 38408 } else { 38409 rootElement.find(".tariff-detail-layer__category").addClass("-is-active"); 38410 rootElement.find(".tariff-detail-layer__category-content").addClass("-is-active"); 38411 } 38412 } 38413 38414 /** 38415 * click handler für Klick auf die Category Header 38416 * @param e 38417 */ 38418 }, { 38419 key: "categoryClickHandler", 38420 value: function categoryClickHandler(e) { 38421 var contentContainer = $(e.currentTarget).siblings(".tariff-detail-layer__category-content"); 38422 if (contentContainer.hasClass("-is-active")) { 38423 contentContainer.removeClass("-is-active").css("max-height", contentContainer[0].scrollHeight + "px").siblings(".tariff-detail-layer__category").removeClass("-is-active"); 38424 window.setTimeout(function () { 38425 contentContainer.css('max-height', 0); 38426 }, 50); 38427 } else { 38428 contentContainer.addClass("-is-active").css("max-height", parseInt(contentContainer[0].scrollHeight + 10) + "px"); 38429 contentContainer.siblings(".tariff-detail-layer__category").addClass("-is-active"); 38430 } 38431 } 38432 }]); 38433}(_SGComponent2.SGComponent); 38434window.theme.tariffDetailLayer = new TariffDetailLayer(); 38435 38436},{"SGComponent":83}],117:[function(require,module,exports){ 38437'use strict'; 38438 38439function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 38440Object.defineProperty(exports, "__esModule", { 38441 value: true 38442}); 38443exports.MdCampaignBoxExpandable = void 0; 38444var _SGComponent2 = require("SGComponent"); 38445require("velocity-animate"); 38446function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 38447function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 38448function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 38449function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 38450function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
38451function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 38452function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 38453function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 38454function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 38455function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 38456function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 38457function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 38458var MdCampaignBoxExpandable = exports.MdCampaignBoxExpandable = /*#__PURE__*/function (_SGComponent) { 38459 function MdCampaignBoxExpandable() { 38460 _classCallCheck(this, MdCampaignBoxExpandable); 38461 return _callSuper(this, MdCampaignBoxExpandable, arguments); 38462 } 38463 _inherits(MdCampaignBoxExpandable, _SGComponent); 38464 return _createClass(MdCampaignBoxExpandable, [{ 38465 key: "init", 38466 value: function init(container) { 38467 var _self = this; 38468 $('.md-campaign-box.-expandable', container).each(function () { 38469 var ele = $(this); 38470 _self.setUpData(ele, function () { 38471 _self.bindClickEvent(ele); 38472 }); 38473 }); 38474 $(window).on('resize.MdCampaignBoxExpandable', function () { 38475 $('.md-campaign-box.-expandable', container).each(function () { 38476 var ele = $(this); 38477 _self.setUpData(ele); 38478 }); 38479 }); 38480 } 38481 }, { 38482 key: "setUpData", 38483 value: function setUpData(ele, callback) { 38484 var heightEle = $('.js-expanded-height', ele); 38485 var imageEle = $('.js-campaign-image', ele); 38486 var image = window.document.createElement('img'); 38487 image.onload = function () { 38488 ele.data('maxHeight', parseFloat(imageEle.outerHeight())); 38489 $('.js-expander-box', ele).show(); 38490 if ($('.js-expander-bg', ele).hasClass('-expanded')) { 38491 heightEle.css('height', 'auto'); 38492 } else { 38493 heightEle.css('height', ele.data('maxHeight')); 38494 } 38495 if (typeof callback === 'function') { 38496 callback(); 38497 } 38498 }; 38499 image.src = imageEle.attr('src'); 38500 } 38501 }, { 38502 key: "bindClickEvent", 38503 value: function bindClickEvent(ele) { 38504 var _self = this; 38505 $('.js-expand-down, .js-expand-up', ele).off('click.MdCampaignBoxExpandable').on('click.MdCampaignBoxExpandable', function () { 38506 _self.expandText(ele); 38507 }); 38508 } 38509 }, { 38510 key: "expandText", 38511 value: function expandText(ele) { 38512 var div = $('.js-expanded-height', ele); 38513 var currentAnim = typeof div.data('anim') == 'boolean' && div.data('anim'); 38514 var maxHeight = ele.data('maxHeight'); 38515 var divHeight = div.outerHeight(); 38516 var contentHeight = div.css('height', 'auto').outerHeight(); 38517 div.css('height', divHeight); 38518 if (!currentAnim) { 38519 div.data('anim', true); 38520 div.velocity({ 38521 height: parseInt(maxHeight) == parseInt(divHeight) ? contentHeight : maxHeight 38522 }, { 38523 duration: 500, 38524 complete: function complete() { 38525 if (maxHeight == divHeight) div.css('height', 'auto'); 38526 div.data('anim', false); 38527 } 38528 }); 38529 $('.js-expander-bg', ele).toggleClass('-expanded'); 38530 $('.js-expander-box', ele).toggleClass('-expanded'); 38531 $('.js-expand-down', ele).toggleClass('-up'); 38532 } 38533 } 38534 }]); 38535}(_SGComponent2.SGComponent); 38536window.theme.mdCampaignBoxExpandable = new MdCampaignBoxExpandable(); 38537 38538},{"SGComponent":83,"velocity-animate":72}],118:[function(require,module,exports){ 38539'use strict'; 38540 38541function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 38542Object.defineProperty(exports, "__esModule", { 38543 value: true 38544}); 38545exports.MdStageBasic = void 0; 38546var _SGComponent2 = require("SGComponent"); 38547function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 38548function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 38549function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 38550function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 38551function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
38552function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 38553function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 38554function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 38555function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 38556function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 38557function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 38558function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 38559function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 38560function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 38561function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 38562var MdStageBasic = exports.MdStageBasic = /*#__PURE__*/function (_SGComponent) { 38563 function MdStageBasic() { 38564 _classCallCheck(this, MdStageBasic); 38565 return _callSuper(this, MdStageBasic, arguments); 38566 } 38567 _inherits(MdStageBasic, _SGComponent); 38568 return _createClass(MdStageBasic, [{ 38569 key: "init", 38570 value: function init(container) { 38571 container = _superPropGet(MdStageBasic, "init", this, 3)([container]); 38572 var instance = this; 38573 $(container).find('.md-stage-basic').each(function () { 38574 var elem = this; 38575 instance.initStageElements(elem); 38576 instance.initClickEvent(elem); 38577 }); 38578 $(window).off('resize.MdStageBasic'); 38579 $(window).on('resize.MdStageBasic', function () { 38580 $('.md-stage-basic').each(function () { 38581 var elem = this; 38582 instance.initStageElements(elem); 38583 }); 38584 }); 38585 } 38586 }, { 38587 key: "reinitEvents", 38588 value: function reinitEvents(container) { 38589 var instance = this; 38590 $(container).find('.md-stage-basic').each(function () { 38591 instance.initClickEvent(this); 38592 }); 38593 } 38594 }, { 38595 key: "initClickEvent", 38596 value: function initClickEvent(elem) { 38597 var href = $(elem).data('href') || false; 38598 if (href) { 38599 $(elem).on('click.MdStageBasic', function (e) { 38600 if (e.ctrlKey) { 38601 window.open(href, '_blank'); 38602 } else { 38603 window.location.href = href; 38604 } 38605 }); 38606 } 38607 } 38608 }, { 38609 key: "initStageElements", 38610 value: function initStageElements(elem) { 38611 var instance = this; 38612 instance.initHeadlineSize(elem); 38613 instance.initButtonColor(elem); 38614 instance.initUspIcons(elem); 38615 instance.initPriceSize(elem); 38616 } 38617 }, { 38618 key: "initHeadlineSize", 38619 value: function initHeadlineSize(elem) { 38620 if ($(elem).find('.js-md-stage-basic-headline').length > 0) { 38621 var headline = $(elem).find('.js-md-stage-basic-headline'); 38622 if (Foundation.MediaQuery.is('small only') || Foundation.MediaQuery.is('medium only')) { 38623 headline.removeClass('headline1'); 38624 headline.addClass('headline2'); 38625 $('.headline1__subline', headline).addClass('headline2__subline').removeClass('headline1__subline'); 38626 } else if (Foundation.MediaQuery.is('medium up')) { 38627 headline.removeClass('headline2'); 38628 headline.addClass('headline1'); 38629 $('.headline2__subline', headline).addClass('headline1__subline').removeClass('headline2__subline'); 38630 } 38631 } 38632 } 38633 }, { 38634 key: "initButtonColor", 38635 value: function initButtonColor(elem) { 38636 if ($(elem).find('.js-md-stage-basic-product-button').length > 0) { 38637 var btnLink = $(elem).find('.js-md-stage-basic-product-button'); 38638 var changeButtonColor = $(elem).hasClass('-change-button-color'); 38639 if (changeButtonColor) { 38640 if (Foundation.MediaQuery.is('small only')) { 38641 btnLink.addClass('-color-secondary'); 38642 } else if (Foundation.MediaQuery.is('medium up')) { 38643 btnLink.removeClass('-color-secondary'); 38644 } 38645 } 38646 } 38647 } 38648 }, { 38649 key: "initUspIcons", 38650 value: function initUspIcons(elem) { 38651 if ($(elem).hasClass('-background-full')) { 38652 $(elem).find('.js-md-stage-basic-product-usps-small').removeClass('-icon-color-primary'); 38653 } else { 38654 $(elem).find('.js-md-stage-basic-product-usps-small').addClass('-icon-color-primary'); 38655 } 38656 } 38657 }, { 38658 key: "initPriceSize", 38659 value: function initPriceSize(elem) { 38660 var priceTop = $(elem).find('.js-md-stage-basic-product-price-top'); 38661 var priceBottom = $(elem).find('.js-md-stage-basic-product-price-bottom'); 38662 var classBottomLarge = priceBottom.data('classLarge') || '-scale250'; 38663 var classTopLarge = priceTop.data('classLarge') || '-scale150'; 38664 if (Foundation.MediaQuery.is('small only') || Foundation.MediaQuery.is('medium only')) { 38665 if (priceTop.length > 0) { 38666 priceTop.addClass('-scale75').removeClass(classTopLarge); 38667 } 38668 if (priceBottom.length > 0) { 38669 priceBottom.removeClass(classBottomLarge); 38670 } 38671 } else if (Foundation.MediaQuery.is('large up')) { 38672 if (priceTop.length > 0) { 38673 priceTop.removeClass('-scale75').addClass(classTopLarge); 38674 } 38675 if (priceBottom.length > 0) { 38676 priceBottom.addClass(classBottomLarge); 38677 } 38678 } 38679 priceBottom.add(priceTop).removeClass('-hidden'); 38680 } 38681 }]); 38682}(_SGComponent2.SGComponent); 38683window.theme.mdStageBasic = new MdStageBasic(); 38684 38685},{"SGComponent":83}],119:[function(require,module,exports){ 38686'use strict'; 38687 38688function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 38689Object.defineProperty(exports, "__esModule", { 38690 value: true 38691}); 38692exports.MdStageOffer = void 0; 38693var _SGComponent2 = require("SGComponent"); 38694function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 38695function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 38696function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 38697function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 38698function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
38699function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 38700function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 38701function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 38702function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 38703function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 38704function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 38705function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 38706function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 38707function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 38708function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 38709var MdStageOffer = exports.MdStageOffer = /*#__PURE__*/function (_SGComponent) { 38710 function MdStageOffer() { 38711 _classCallCheck(this, MdStageOffer); 38712 return _callSuper(this, MdStageOffer, arguments); 38713 } 38714 _inherits(MdStageOffer, _SGComponent); 38715 return _createClass(MdStageOffer, [{ 38716 key: "init", 38717 value: function init(container) { 38718 container = _superPropGet(MdStageOffer, "init", this, 3)([container]); 38719 var instance = this; 38720 $(container).find('.md-stage-offer').each(function () { 38721 var elem = this; 38722 instance.initStageElements(elem); 38723 instance.initClickEvent(elem); 38724 }); 38725 $(window).off('resize.MdStageOffer'); 38726 $(window).on('resize.MdStageOffer', function () { 38727 $('.md-stage-offer').each(function () { 38728 var elem = this; 38729 instance.initStageElements(elem); 38730 }); 38731 }); 38732 } 38733 }, { 38734 key: "reinitEvents", 38735 value: function reinitEvents(container) { 38736 var instance = this; 38737 $(container).find('.md-stage-offer').each(function () { 38738 instance.initClickEvent(this); 38739 }); 38740 } 38741 }, { 38742 key: "initClickEvent", 38743 value: function initClickEvent(elem) { 38744 var href = $(elem).data('href') || false; 38745 if (href) { 38746 $(elem).on('click.MdStageBasic', function (e) { 38747 if (e.ctrlKey) { 38748 window.open(href, '_blank'); 38749 } else { 38750 window.location.href = href; 38751 } 38752 }); 38753 } 38754 } 38755 }, { 38756 key: "initStageElements", 38757 value: function initStageElements(elem) { 38758 var instance = this; 38759 instance.initHeadlineSize(elem); 38760 instance.initPriceSize(elem); 38761 } 38762 }, { 38763 key: "initHeadlineSize", 38764 value: function initHeadlineSize(elem) { 38765 if ($(elem).find('.js-md-stage-offer-headline').length > 0) { 38766 var headline = $(elem).find('.js-md-stage-offer-headline'); 38767 if (Foundation.MediaQuery.is('small only') || Foundation.MediaQuery.is('medium only')) { 38768 headline.removeClass('headline1'); 38769 headline.addClass('headline2'); 38770 } else if (Foundation.MediaQuery.is('medium up')) { 38771 headline.removeClass('headline2'); 38772 headline.addClass('headline1'); 38773 } 38774 } 38775 } 38776 }, { 38777 key: "initPriceSize", 38778 value: function initPriceSize(elem) { 38779 var priceBottom = $(elem).find('.js-md-stage-offer-product-price-bottom'); 38780 if (Foundation.MediaQuery.is('small only') || Foundation.MediaQuery.is('medium only')) { 38781 if (priceBottom.length > 0) { 38782 priceBottom.removeClass('-scale200'); 38783 } 38784 } else if (Foundation.MediaQuery.is('large up')) { 38785 if (priceBottom.length > 0) { 38786 priceBottom.addClass('-scale200'); 38787 } 38788 } 38789 } 38790 }]); 38791}(_SGComponent2.SGComponent); 38792window.theme.mdStageOffer = new MdStageOffer(); 38793 38794},{"SGComponent":83}],120:[function(require,module,exports){ 38795"use strict"; 38796 38797function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 38798Object.defineProperty(exports, "__esModule", { 38799 value: true 38800}); 38801exports.MdHeader = void 0; 38802var _SGComponent2 = require("SGComponent"); 38803var _bodyScrollLock = require("body-scroll-lock"); 38804function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 38805function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 38806function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 38807function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 38808function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
38809function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 38810function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 38811function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 38812function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 38813function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 38814function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 38815function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 38816function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 38817function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 38818function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 38819var MdHeader = exports.MdHeader = /*#__PURE__*/function (_SGComponent) { 38820 function MdHeader() { 38821 _classCallCheck(this, MdHeader); 38822 return _callSuper(this, MdHeader, arguments); 38823 } 38824 _inherits(MdHeader, _SGComponent); 38825 return _createClass(MdHeader, [{ 38826 key: "init", 38827 value: function init(container) { 38828 container = _superPropGet(MdHeader, "init", this, 3)([container]); 38829 38830 /** 38831 * Selektoren 38832 */ 38833 this.moduleClass = ".md-header"; 38834 this.primaryContainer = ".js-md-header-menu-primary-container"; 38835 this.primaryContainerItem = ".js-md-header-menu-primary-item"; 38836 this.primaryContainerLink = ".js-primary-link"; 38837 this.secondaryContainer = ".js-md-header-menu-secondary-container"; 38838 this.secondaryContainerHeadline = ".js-md-header-menu-secondary-headline"; 38839 this.secondaryContainerItem = ".js-md-header-menu-secondary-item"; 38840 this.secondaryContainerButton = ".js-md-header-menu-secondary-button"; 38841 this.secondaryContainerLink = ".js-secondary-link"; 38842 this.tertiaryContainer = ".js-md-header-menu-tertiary-container"; 38843 this.tertiaryContainerHeadline = ".js-md-header-menu-tertiary-headline"; 38844 this.tertiaryContainerItem = ".js-md-header-menu-tertiary-item"; 38845 this.tertiaryContainerLink = ".js-tertiary-link"; 38846 this.mobileMenuItem = ".js-md-header-menu"; 38847 this.desktopShadow = ".js-md-header-menu-shadow"; 38848 this.shadow = ".js-md-header-shadow"; 38849 this.headerContent = ".js-md-header-content"; 38850 this.desktopCategoryButton = ".js-md-header-menu-desktop-button"; 38851 this.navigationContainer = ".js-md-header-navigation-container"; 38852 this.detachContainer = ".js-md-header-menu-detach-container"; 38853 this.navigationWrapper = ".js-md-header-menu-wrapper"; 38854 this.navigationOffer = ".js-md-header-menu-offer"; 38855 this.navigationOfferContainer = ".js-md-header-menu-offer-container"; 38856 this.navigationClose = ".js-md-header-menu-close"; 38857 this.navigationCloseButton = ".js-md-header-menu-close-button"; 38858 this.searchBar = ".js-md-header-search"; 38859 this.searchBarItem = ".js-md-header-search-item"; 38860 this.loginState = { 38861 loggedIn: false, 38862 vvl: false 38863 }; 38864 this.addEventHandling(container); 38865 this.initMenu(container); 38866 } 38867 }, { 38868 key: "addEventHandling", 38869 value: function addEventHandling(container) { 38870 var _self = this; 38871 38872 /** 38873 * Breakpoint change 38874 */ 38875 $(window).on("changed.zf.mediaquery", function () { 38876 _self.reset(container); 38877 }); 38878 38879 /** 38880 * Resize softInit nur für Desktop relevant 38881 */ 38882 $(window).on("resize.MdHeader", function () { 38883 _self.softInit(container); 38884 }); 38885 } 38886 38887 /** 38888 * Berechnet die Breite des Containers für die innere Navigation neu 38889 */ 38890 }, { 38891 key: "softInit", 38892 value: function softInit(container) { 38893 var _self = this; 38894 $(container).find(_self.moduleClass).each(function () { 38895 var ele = $(this); 38896 if (!_self.onMobile()) { 38897 _self.updateNavigationContainerHeight(ele, ""); 38898 _self.recalcContainerWidth(ele, $(this.headerContent, ele).outerWidth()); 38899 } 38900 }); 38901 } 38902 38903 /** 38904 * Setzt alle Klassen zurück und schließt das Menü 38905 */ 38906 }, { 38907 key: "reset", 38908 value: function reset(container) { 38909 var _self = this; 38910 $(container).find(_self.moduleClass).each(function () { 38911 var ele = $(this); 38912 _self.closePrimaryMenu(ele); 38913 $(_self.mobileMenuItem, ele).add(_self.navigationContainer, ele).add(_self.desktopShadow, ele).add(_self.shadow, ele).add(_self.primaryContainer, ele).add(_self.secondaryContainer, ele).add(_self.tertiaryContainer, ele).add($(_self.primaryContainerItem, ele).children()).add($(_self.secondaryContainerItem, ele).children()).add($(_self.tertiaryContainerItem, ele).children()).add($(_self.navigationWrapper, ele)).add($(_self.navigationWrapper, ele).children()).removeClass("-active -inactive"); 38914 }); 38915 this.init(); 38916 } 38917 38918 /** 38919 * Initialisiert das Menü und verknüpft die Events neu 38920 */ 38921 }, { 38922 key: "initMenu", 38923 value: function initMenu(container) { 38924 var _self = this; 38925 $(container).find(_self.moduleClass).each(function () { 38926 var ele = $(this); 38927 /** 38928 * Eventhandling für die Searchbar hinzugefügt 38929 */ 38930 _self.addSearchEvents(ele); 38931 38932 /** 38933 * Zeige mobile Menü 38934 */
38935 $(_self.mobileMenuItem, ele).off("click.MdHeader").on("click.MdHeader", function () { 38936 var clickedEle = $(this); 38937 if (clickedEle.hasClass("-active")) { 38938 window.dispatchEvent(new Event("mobileMenuClosed")); 38939 _self.closePrimaryMenu(ele); 38940 $(window.document).focus(); 38941 } else { 38942 window.dispatchEvent(new Event("mobileMenuOpened")); 38943 clickedEle.addClass("-active"); 38944 _self.openPrimaryMenu(ele); 38945 } 38946 }); 38947 38948 /** 38949 * Menü öffnen 38950 */ 38951 var openType = ele.data("open") || "hover"; 38952 if (openType === "click") { 38953 _self.openOnClick(ele); 38954 } else { 38955 _self.openOnHover(ele); 38956 } 38957 38958 /** 38959 * Menühandling 38960 */ 38961 $(_self.secondaryContainerHeadline, ele).off("click.MdHeader").on("click.MdHeader", function () { 38962 if (_self.onMobile()) _self.closeSubMenu(ele, "primary"); 38963 }); 38964 $(_self.secondaryContainerItem, ele).children().off("click.MdHeader").on("click.MdHeader", function () { 38965 if (_self.onMobile()) _self.openSubMenu(ele, $(this), "tertiary"); 38966 }); 38967 $(_self.tertiaryContainerHeadline, ele).off("click.MdHeader").on("click.MdHeader", function () { 38968 if (_self.onMobile()) _self.closeSubMenu(ele, "secondary"); 38969 }); 38970 $(_self.tertiaryContainerItem, ele).children().off("click.MdHeader").on("click.MdHeader", function () { 38971 if (_self.onMobile()) _self.openSubMenu(ele, $(this), ""); 38972 _self.pushClickToDataLayer($(this)); 38973 }); 38974 38975 /** 38976 * Link handling 38977 */ 38978 var links = $(_self.primaryContainerLink, ele).add(_self.secondaryContainerLink, ele); 38979 links = _self.onMobile() ? links.add(_self.tertiaryContainerLink, ele) : links; 38980 links.off("click.MdHeader").on("click.MdHeader", function (e) { 38981 e.preventDefault(); 38982 }); 38983 var closeLinks = !_self.onMobile() ? $(_self.tertiaryContainerLink, ele) : $(); 38984 closeLinks.off("click.MdHeader").on("click.MdHeader", function () { 38985 if (!_self.onMobile()) _self.closeSubMenu(ele, "secondary", true); 38986 }); 38987 }); 38988 } 38989 38990 /** 38991 * Bindet die Events für den Suchbutton 38992 */ 38993 }, { 38994 key: "addSearchEvents", 38995 value: function addSearchEvents(ele) { 38996 $(this.searchBarItem, ele).add(this.searchBar, ele).on("mouseenter.MdHeader", function () { 38997 this.toogleSearchBar(ele, true); 38998 }.bind(this)).on("mouseleave.MdHeader", function () { 38999 this.toogleSearchBar(ele, false); 39000 }.bind(this)); 39001 } 39002 39003 /** 39004 * Zeigt oder versteckt die Suche 39005 */ 39006 }, { 39007 key: "toogleSearchBar", 39008 value: function toogleSearchBar(ele, show) { 39009 if (show) { 39010 $(this.searchBarItem, ele).addClass("-active"); 39011 $(this.searchBar, ele).addClass("-show"); 39012 } else { 39013 $(this.searchBarItem, ele).removeClass("-active"); 39014 $(this.searchBar, ele).removeClass("-show"); 39015 } 39016 } 39017 39018 /** 39019 * Prüft ob die Surche ausgeblendet werden soll 39020 */ 39021 }, { 39022 key: "addSearchbarEvents", 39023 value: function addSearchbarEvents(ele) { 39024 var _self = this; 39025 $(document).on("click.MdHeader", function (e) { 39026 $(ele).find(_self.moduleClass).each(function () { 39027 var headerEle = $(this); 39028 var clickedOutsideHeader = !headerEle.is(e.target) && headerEle.has(e.target).length === 0; 39029 var searchBarActive = $(_self.searchBarItem, headerEle).hasClass("-active"); 39030 if (clickedOutsideHeader && searchBarActive && _self.isMobile()) { 39031 e.preventDefault(); 39032 _self.toogleSearchBar(ele, false); 39033 } 39034 }); 39035 }); 39036 } 39037 39038 /** 39039 * Liest den Status aus dem identity-provider aus 39040 */ 39041 }, { 39042 key: "setLoginState", 39043 value: function setLoginState(ele) { 39044 var _this = this; 39045 var classList = ele.attr("class").split(/\s+/); 39046 if ($.inArray("-b2b", classList) > -1) { 39047 return; 39048 }
39049 if (window.common && window.common.identityProvider) { 39050 window.common.identityProvider.init(); 39051 this.loginState.loggedIn = window.common.identityProvider.identity.loginStatus > 0; 39052 this.loginState.vvl = window.common.identityProvider.identity.vvl > 0; 39053 } else { 39054 var icp = document.createElement("script"); 39055 icp.setAttribute("src", "/common/js/icp.min.js"); 39056 document.body.appendChild(icp); 39057 icp.addEventListener("load", function () { 39058 _this.setLoginState(); 39059 }); 39060 } 39061 } 39062 39063 /** 39064 * liefert eine Stringdarstellung für den Loginstatus 39065 */ 39066 }, { 39067 key: "getLoginStateAsStringParam", 39068 value: function getLoginStateAsStringParam() { 39069 if (this.loginState.loggedIn && this.loginState.vvl) { 39070 return "_loggedin_vvl"; 39071 } else if (this.loginState.loggedIn) { 39072 return "_loggedin"; 39073 } else { 39074 return ""; 39075 } 39076 } 39077 39078 /** 39079 * Öffne Primärmenü auf Hover 39080 */ 39081 }, { 39082 key: "openOnHover", 39083 value: function openOnHover(ele) { 39084 var _self = this; 39085 var primaryEvent = _self.onMobile() ? "click.MdHeader" : "mouseenter.MdHeader"; 39086 $(_self.primaryContainerItem + " li", ele).off(primaryEvent).on(primaryEvent, function () { 39087 var timeout = $(ele).data("hoverTimeout") || false; 39088 if (timeout) window.clearTimeout(timeout); 39089 _self.openSubMenu(ele, $(this), "secondary"); 39090 if (!_self.onMobile()) { 39091 _self.openAllMenus(ele, $(this)); 39092 } 39093 }); 39094 $(_self.primaryContainerItem, ele).children().add(_self.navigationContainer, ele).off("mouseleave.MdHeader").on("mouseleave.MdHeader", function () { 39095 if (!_self.onMobile()) _self.closeSubMenu(ele, "secondary"); 39096 }); 39097 $(_self.desktopShadow, ele).off("mouseenter.MdHeader").on("mouseenter.MdHeader", function () { 39098 if (!_self.onMobile()) _self.closeSubMenu(ele, "secondary", true); 39099 }); 39100 $(_self.navigationCloseButton, ele).off("click.MdHeader").on("click.MdHeader", function () { 39101 if (!_self.onMobile()) _self.closeSubMenu(ele, "secondary", true); 39102 }); 39103 } 39104 39105 /** 39106 * Öffne Primärmenü auf Click 39107 */ 39108 }, { 39109 key: "openOnClick", 39110 value: function openOnClick(ele) { 39111 var _self = this; 39112 $(_self.primaryContainerItem, ele).children().off("click.MdHeader").on("click.MdHeader", function () { 39113 var ident = $(this).data("menuLink"); 39114 if (!_self.isMenuActive(ele, ident) && !_self.isEmptyMenu(ele, ident)) { 39115 _self.openSubMenu(ele, $(this), "secondary"); 39116 if (!_self.onMobile()) { 39117 _self.openAllMenus(ele, $(this)); 39118 } 39119 } else if ($(this).data("categoryHref")) { 39120 _self.closeSubMenu(ele, ident); 39121 _self.pushClickToDataLayer($(this)); 39122 _self.redirectTo($(this).data("categoryHref")); 39123 } 39124 }); 39125 $(_self.desktopShadow, ele).off("click.MdHeader").on("click.MdHeader", function () { 39126 if (!_self.onMobile()) _self.closeSubMenu(ele, "secondary", true); 39127 }); 39128 $(_self.navigationCloseButton, ele).off("click.MdHeader").on("click.MdHeader", function () { 39129 if (!_self.onMobile()) _self.closeSubMenu(ele, "secondary", true); 39130 }); 39131 $(_self.shadow, ele).off("click.MdHeader").on("click.MdHeader", function () { 39132 if (_self.onMobile()) _self.closePrimaryMenu(ele); 39133 }); 39134 } 39135 }, { 39136 key: "isEmptyMenu", 39137 value: function isEmptyMenu(ele, ident) { 39138 return $(this.secondaryContainerItem + "[data-menu-content=".concat(ident, "]"), $(this.secondaryContainer, ele)).children().length === 0; 39139 } 39140 }, { 39141 key: "pushClickToDataLayer", 39142 value: function pushClickToDataLayer(clickedEle) { 39143 var path = $(clickedEle).data("menuPath") || ""; 39144 if (path) { 39145 window.dataLayer = window.dataLayer || []; 39146 var obj = { 39147 event: "gaClick", 39148 eventCategory: "Navigation", 39149 eventAction: "Headernavigation", 39150 eventLabel: path, 39151 eventValue: "" 39152 }; 39153 window.dataLayer.push(obj); 39154 } 39155 } 39156 39157 /** 39158 * Teste ob Sekundärmenü offen ist 39159 */ 39160 }, { 39161 key: "isMenuActive", 39162 value: function isMenuActive(ele, ident) { 39163 return $(this.secondaryContainer, ele).hasClass("-active") && $(this.secondaryContainerItem, ele).filter("[data-menu-content=" + ident + "]").is(":visible"); 39164 } 39165 39166 /** 39167 * Prüfung auf Tablet & Smartphone 39168 */ 39169 }, { 39170 key: "onMobile", 39171 value: function onMobile() { 39172 var breakpoints = Foundation.MediaQuery.queries; 39173 if (breakpoints.some(function (breakpoint) { 39174 return breakpoint.name === "tablet"; 39175 })) { 39176 return Foundation.MediaQuery.upTo("tablet") || this.lowHeight(); 39177 } else if (breakpoints.some(function (breakpoint) { 39178 return breakpoint.name === "mobile"; 39179 })) { 39180 return Foundation.MediaQuery.upTo("mobile") || this.lowHeight(); 39181 } else { 39182 return this.lowHeight(); 39183 } 39184 } 39185 39186 /** 39187 * Check for very low height on viewport 39188 */ 39189 }, { 39190 key: "lowHeight", 39191 value: function lowHeight() { 39192 return window.innerHeight < 640; 39193 } 39194 39195 /** 39196 * Promise for actions that run after animation of element 39197 */ 39198 }, { 39199 key: "afterAnim", 39200 value: function afterAnim(element) { 39201 return new Promise(function (resolve, reject) { 39202 $(element).one("webkitTransitionEnd.MdHeader otransitionend.MdHeader oTransitionEnd.MdHeader msTransitionEnd.MdHeader transitionend.MdHeader", function (e) { 39203 $(this).off("webkitTransitionEnd.MdHeader otransitionend.MdHeader oTransitionEnd.MdHeader msTransitionEnd.MdHeader transitionend.MdHeader"); 39204 resolve(); 39205 }); 39206 }); 39207 } 39208 39209 /** 39210 * Öffnet das Primäre Menü (nur für mobile relevant) 39211 */ 39212 }, { 39213 key: "openPrimaryMenu", 39214 value: function openPrimaryMenu(ele) { 39215 this.setLoginState(ele); 39216 this.reAtachMenus(ele); 39217 var navCont = $(this.navigationContainer, ele); 39218 var primaryCont = $(this.primaryContainer, ele).add(this.secondaryContainer, ele).add(this.tertiaryContainer, ele).filter(".-active"); 39219 primaryCont = primaryCont.length > 0 ? primaryCont : $(this.primaryContainer, ele); 39220 navCont.addClass("-notrans"); 39221 this.hideArrowsOnSingleSubMenuitem($(this.primaryContainerItem, ele), $(this.secondaryContainer, ele)); 39222 this.updateNavigationContainerHeight(ele, primaryCont.outerHeight()); 39223 this.toggleShadow(ele, true); 39224 this.afterAnim($(this.mobileMenuItem, ele)).then(function () { 39225 var scrollPos = $(window).scrollTop(); 39226 navCont.removeClass("-notrans").add(primaryCont).addClass("-active"); 39227 (0, _bodyScrollLock.disableBodyScroll)(ele, { 39228 reserveScrollBarGap: true 39229 }); 39230 39231 // Workaround um die scrollPosition beizubehalten 39232 var found = false;
39233 var interval = window.setInterval(function () { 39234 var hidden = $("body").css("overflow") === "hidden"; 39235 if (hidden && found) { 39236 window.clearInterval(interval); 39237 $(window).scrollTop(scrollPos); 39238 } else if (hidden) { 39239 found = true; 39240 } 39241 }, 0); 39242 }); 39243 } 39244 39245 /** 39246 * Zeigt oder versteckt den Schatten unter dem Menü 39247 */ 39248 }, { 39249 key: "toggleShadow", 39250 value: function toggleShadow(ele, show) { 39251 var shadowEle = $(this.shadow, ele); 39252 if (show) { 39253 shadowEle.show(); 39254 shadowEle.addClass("-active"); 39255 } else { 39256 shadowEle.removeClass("-active"); 39257 this.afterAnim(shadowEle).then(function () { 39258 shadowEle.hide(); 39259 }); 39260 } 39261 } 39262 39263 /** 39264 * Schließt das Primäre Menü (nur für mobile relevant) 39265 */ 39266 }, { 39267 key: "closePrimaryMenu", 39268 value: function closePrimaryMenu(ele) { 39269 var _self = this; 39270 var navigationCont = $(this.navigationContainer, ele); 39271 var primaryCont = $(this.primaryContainer, ele); 39272 navigationCont.removeClass("-active"); 39273 (0, _bodyScrollLock.clearAllBodyScrollLocks)(); 39274 this.afterAnim($(this.navigationContainer, ele)).then(function () { 39275 primaryCont.add(primaryCont.parent()).add(_self.mobileMenuItem, ele).add(_self.desktopShadow, ele).removeClass("-active"); 39276 _self.toggleShadow(ele, false); 39277 }); 39278 } 39279 39280 /** 39281 * Setzt die Höhe des NavigationsContainers neu (nur für mobile relevant) 39282 */ 39283 }, { 39284 key: "updateNavigationContainerHeight", 39285 value: function updateNavigationContainerHeight(ele, h) { 39286 $(this.navigationContainer, ele).height(h); 39287 } 39288 39289 /** 39290 * Ruft die State-Konfiguration für die nächste Navigationsebene ab (nur für mobile relevant) 39291 */ 39292 }, { 39293 key: "getOpenSubMenuContainerConfig", 39294 value: function getOpenSubMenuContainerConfig(ele, menuIdent) { 39295 var c = { 39296 container: null, 39297 item: null, 39298 prevContainer: null, 39299 button: null, 39300 desktopButton: null 39301 }; 39302 if (menuIdent == "secondary") { 39303 c.container = $(this.secondaryContainer, ele); 39304 c.containerHeadline = $(this.secondaryContainerHeadline, ele); 39305 c.item = $(this.secondaryContainerItem, ele); 39306 c.prevContainer = $(this.primaryContainer, ele); 39307 c.nextContainer = $(this.tertiaryContainer, ele); 39308 c.button = $(this.secondaryContainerButton, ele); 39309 c.desktopButton = $(this.desktopCategoryButton, ele); 39310 } else if (menuIdent == "tertiary") { 39311 c.container = $(this.tertiaryContainer, ele); 39312 c.containerHeadline = $(this.tertiaryContainerHeadline, ele); 39313 c.item = $(this.tertiaryContainerItem, ele); 39314 c.prevContainer = $(this.secondaryContainer, ele); 39315 c.nextContainer = null; 39316 c.button = null; 39317 c.desktopButton = null; 39318 } 39319 return c; 39320 } 39321 39322 /** 39323 * Prüft ob die nächste Navigationsebene geöffnet oder der User weitergeleitet werden soll 39324 */ 39325 }, { 39326 key: "openSubMenu", 39327 value: function openSubMenu(ele, clickedMenu, menuIdent) { 39328 this.setLoginState(ele); 39329 var c = this.getOpenSubMenuContainerConfig(ele, menuIdent); 39330 var menuTarget = clickedMenu.data("menuLink"); 39331 var targetLink = clickedMenu.data("hrefLink"); 39332 var targetItemsContainer = this.getItemContainerList(c.item, menuTarget + this.getLoginStateAsStringParam()); 39333 if (targetItemsContainer.length === 0) { 39334 targetItemsContainer = this.getItemContainerList(c.item, menuTarget); 39335 } 39336 if (c.item) { 39337 c.item.hide(); 39338 } 39339 this.reAtachMenus(ele); 39340 if (this.getAmountOfChildMenuitems(c.item, menuTarget) === 1) { 39341 targetLink = $(targetItemsContainer.children().get(0)).data("hrefLink"); 39342 } 39343 if (targetLink) { 39344 this.closePrimaryMenu(ele); 39345 this.redirectTo(targetLink); 39346 return; 39347 } 39348 if (menuTarget) { 39349 if (c.nextContainer) this.hideArrowsOnSingleSubMenuitem(targetItemsContainer, c.nextContainer); 39350 this.open(ele, targetItemsContainer, clickedMenu, c); 39351 window.setTimeout(function () { 39352 var a = clickedMenu.find("a"); 39353 a.trigger("tabIndex", [a, menuTarget]); 39354 }, 100); 39355 clickedMenu.find("a.js-primary-link").trigger("tabIndex.MdHeader"); 39356 } 39357 } 39358 39359 /** 39360 * Prüft ob die nächste Navigationsebene Unterpunkte mit nur einem Navigationspunkt hat und versteckt daraufhin den Pfeil (nur für mobile relevant) 39361 */ 39362 }, { 39363 key: "hideArrowsOnSingleSubMenuitem", 39364 value: function hideArrowsOnSingleSubMenuitem(targetItemsContainer, nextMenuLevel) { 39365 return $(targetItemsContainer).children().map(function () { 39366 var targetMenu = $(this).data("menuLink"); 39367 var amount = nextMenuLevel.find("[data-menu-content=" + targetMenu + "]").children().length; 39368 if (amount < 1) { 39369 $(this).removeClass("-arrow"); 39370 } 39371 return { 39372 link: $(this), 39373 amount: amount 39374 }; 39375 }).toArray(); 39376 } 39377 39378 /** 39379 * Öffnet ein Untermenüpunkt 39380 */ 39381 }, { 39382 key: "open", 39383 value: function open(ele, targetItemsContainer, clickedMenu, c) { 39384 targetItemsContainer.show(); 39385 var categoryLink = clickedMenu.data("categoryHref"); 39386 var menuText = $(clickedMenu).text(); 39387 $(this.primaryContainer + " li", ele).removeClass("-active"); 39388 $(c.containerHeadline, c.container).html(menuText); 39389 clickedMenu.add(c.container).addClass("-active"); 39390 c.prevContainer.removeClass("-active").addClass("-inactive"); 39391 var buttonToShow = this.onMobile() ? c.button : c.desktopButton; 39392 console.log(this.onMobile()); 39393 if (categoryLink) { 39394 if (this.onMobile() && c.button) { 39395 c.button.remove(); 39396 } 39397 if (!this.onMobile() && c.desktopButton) { 39398 c.desktopButton.parent().addClass("-active"); 39399 } else if (c.desktopButton) { 39400 c.desktopButton.parent().removeClass("-active"); 39401 } 39402 this.showCategoryButton(buttonToShow, menuText, categoryLink, clickedMenu.data("buttonText")); 39403 } 39404 var newHeight = c.container.height(); 39405 var w = ""; 39406 if (this.onMobile()) { 39407 this.updateNavigationContainerHeight(ele, newHeight); 39408 } else { 39409 w = $(this.headerContent, ele).outerWidth(); 39410 } 39411 this.recalcContainerWidth(ele, w); 39412 } 39413 39414 /** 39415 * Liefert die Anzahl der Unterlemente eines Containers 39416 */ 39417 }, { 39418 key: "getAmountOfChildMenuitems", 39419 value: function getAmountOfChildMenuitems(items, target) { 39420 return this.getItemContainerList(items, target).children().length; 39421 } 39422 39423 /** 39424 * Filtert einen Navigationscontainer nach einem identifier 39425 */ 39426 }, { 39427 key: "getItemContainerList", 39428 value: function getItemContainerList(items, target) { 39429 return items && items.length > 0 ? items.filter("[data-menu-content=" + target + "]") : $(); 39430 } 39431 39432 /** 39433 * Setzt die Weite der Navigationscontainer neu 39434 */ 39435 }, {
39436 key: "recalcContainerWidth", 39437 value: function recalcContainerWidth(ele, w) { 39438 $(this.secondaryContainer, ele).add(this.tertiaryContainer, ele).add(this.navigationOffer, ele).add(this.navigationClose, ele).add(this.detachContainer).css("max-width", w); 39439 } 39440 39441 /** 39442 * Zeigt einen Navigationsbutton an und konfiguriert die Attribute 39443 */ 39444 }, { 39445 key: "showCategoryButton", 39446 value: function showCategoryButton(button, text, link, customText) { 39447 var _self = this; 39448 if (typeof customText !== "undefined") { 39449 text = customText.replace("{category}", text); 39450 } 39451 button.html(text.trim()); 39452 button.attr("href", link); 39453 button.show(); 39454 button.data("menuPath", "Button " + text.replace(/(\r\n|\n|\r)/gm, "").replace(/ +(?= )/g, "").trim().toLowerCase()); 39455 button.off("click.mdHeader").on("click.mdHeader", function () { 39456 _self.pushClickToDataLayer($(this)); 39457 }); 39458 } 39459 39460 /** 39461 * Ruft die State-konfiguration für das Schließen einer Unternavigation ab 39462 */ 39463 }, { 39464 key: "getCloseSubmenuContainerConfig", 39465 value: function getCloseSubmenuContainerConfig(menuIdent) { 39466 var c = { 39467 container: null, 39468 item: null, 39469 prevContainerItem: null 39470 }; 39471 if (menuIdent == "primary") { 39472 c.container = this.secondaryContainer; 39473 c.item = this.secondaryContainerItem; 39474 c.prevContainer = this.primaryContainer; 39475 c.prevContainerItem = this.primaryContainerItem; 39476 } else if (menuIdent == "secondary") { 39477 c.container = this.tertiaryContainer; 39478 c.item = this.tertiaryContainerItem; 39479 c.prevContainer = this.secondaryContainer; 39480 c.prevContainerItem = this.secondaryContainerItem; 39481 } 39482 return c; 39483 } 39484 39485 /** 39486 * Schließt eine Unternavigation 39487 */ 39488 }, { 39489 key: "closeSubMenu", 39490 value: function closeSubMenu(ele, menuIdent, force) { 39491 force = force || false; 39492 var _self = this; 39493 var c = this.getCloseSubmenuContainerConfig(menuIdent); 39494 39495 // Prüfe ob Maus auf Desktop innerhalb des Menüs ist 39496 39497 if (!_self.onMobile() || force) { 39498 $(ele).data("hoverTimeout", window.setTimeout(function () { 39499 if (!$(_self.navigationWrapper, ele).is(":hover") || force) { 39500 $(_self.secondaryContainer, ele).add($(_self.primaryContainerItem, ele).children()).add(_self.desktopShadow, ele).add(_self.detachContainer, ele).add(_self.navigationOffer, ele).add(_self.navigationOfferContainer, ele).add(_self.navigationWrapper, ele).add(_self.navigationClose, ele).add($(_self.desktopCategoryButton, ele).parent()).removeClass("-active"); 39501 $(_self.secondaryContainerItem, ele).add(_self.tertiaryContainerItem, ele).hide(); 39502 } 39503 }, 1)); 39504 } 39505 if (_self.onMobile()) { 39506 var newHeight = $(c.prevContainer, ele).height(); 39507 $(c.container, ele).removeClass("-active"); 39508 $(c.prevContainer, ele).removeClass("-inactive").addClass("-active"); 39509 _self.updateNavigationContainerHeight(ele, newHeight); 39510 } 39511 } 39512 39513 /** 39514 * Öffnet alle Untermenüs (für Desktop relevant) 39515 */ 39516 }, { 39517 key: "openAllMenus", 39518 value: function openAllMenus(ele, clickedMenu) { 39519 this.reAtachMenus(ele); 39520 var _self = this; 39521 var tertiaryMenus = []; 39522 var menuLink = clickedMenu.data("menuLink"); 39523 var secondaryMenu = $(this.secondaryContainerItem, ele).filter('[data-menu-content="' + menuLink + this.getLoginStateAsStringParam() + '"]'); 39524 if (secondaryMenu.length === 0) { 39525 secondaryMenu = $(this.secondaryContainerItem, ele).filter('[data-menu-content="' + menuLink + '"]'); 39526 } 39527 39528 // Liste alle sekundären Kategorien auf und zeige diese an 39529 var secondaryCategories = secondaryMenu.children().map(function () { 39530 return $(this).data("menuLink"); 39531 }); 39532 $(this.tertiaryContainer, ele).add(_self.desktopShadow, ele).addClass("-active"); 39533 $(this.tertiaryContainerItem, ele).hide(); 39534 $.each(secondaryCategories, function (i, v) { 39535 var tertiaryItem = $(_self.tertiaryContainerItem + '[data-menu-content="' + v + _self.getLoginStateAsStringParam() + '"]', ele); 39536 if (tertiaryItem.length === 0) { 39537 tertiaryItem = $(_self.tertiaryContainerItem + '[data-menu-content="' + v + '"]', ele); 39538 } 39539 tertiaryMenus.push(tertiaryItem); 39540 tertiaryMenus[tertiaryMenus.length - 1].show(); 39541 }); 39542 39543 // Prüfe ob sekundärnavigation mehr als 4 Einträge hat und splitte daraufhin die navigation 39544 if (secondaryCategories.length > 4) { 39545 this.cloneAndPlaceMenus(ele, secondaryMenu, tertiaryMenus); 39546 } 39547 39548 // Öffne das passende Offermodul 39549 var offerItems = $(this.navigationOffer, ele).add(this.navigationOfferContainer, ele).removeClass("-active"); 39550 var oItems = offerItems.filter('[data-menu-content="' + clickedMenu.data("menuLink") + this.getLoginStateAsStringParam() + '"]'); 39551 if (oItems.length === 0) { 39552 oItems = offerItems.filter('[data-menu-content="' + clickedMenu.data("menuLink") + '"]'); 39553 } 39554 if (oItems.length > 0) { 39555 oItems.add(this.navigationOfferContainer, ele).addClass("-active"); 39556 } 39557 39558 // Füge active klasse hinzu 39559 $(this.navigationWrapper, ele).add(this.navigationClose, ele).addClass("-active"); 39560 } 39561 39562 /** 39563 * Splitted auf Desktop die Unternavigationen mit mehr als 4 Unterpunkten auf 39564 */ 39565 }, { 39566 key: "cloneAndPlaceMenus", 39567 value: function cloneAndPlaceMenus(ele, secondaryMenu, tertiaryMenus) { 39568 var newSecondaryMenu = secondaryMenu.clone(); 39569 var newSecondaryMenuWrapper = secondaryMenu.parent().clone().empty(); 39570 var items = $(secondaryMenu.children().splice(4)).detach(); 39571 newSecondaryMenu.empty().data("detachOrigin", secondaryMenu); 39572 newSecondaryMenu.attr("data-origin", true); 39573 var newTertiaryMenuWrapper = $(tertiaryMenus[0], ele).parent().clone().empty(); 39574 newTertiaryMenuWrapper.data("detachOrigin", $(tertiaryMenus[0], ele).parent()); 39575 newTertiaryMenuWrapper.attr("data-origin", true); 39576 $.each(items, function (i, item) { 39577 newSecondaryMenu.append($(item).detach()); 39578 }); 39579 var fillteredMenus = []; 39580 $.each(tertiaryMenus, function (i, f) { 39581 if (typeof f.length !== "undefined" && f.length > 0) { 39582 fillteredMenus.push(f); 39583 } 39584 }); 39585 if (fillteredMenus.length > 4) { 39586 $.each(fillteredMenus.splice(4), function (i, item) { 39587 newTertiaryMenuWrapper.append($(item).detach()); 39588 }); 39589 } 39590 newSecondaryMenuWrapper.append(newSecondaryMenu); 39591 $(this.detachContainer, ele).append(newSecondaryMenuWrapper); 39592 $(this.detachContainer, ele).append(newTertiaryMenuWrapper); 39593 $(this.detachContainer, ele).addClass("-active"); 39594 } 39595 39596 /** 39597 * Fügt die Navigationen wieder zusammen 39598 */ 39599 }, { 39600 key: "reAtachMenus", 39601 value: function reAtachMenus(ele) { 39602 var dt = $(this.detachContainer, ele).find('[data-origin="true"]'); 39603 dt.each(function () { 39604 var origin = $(this).data("detachOrigin"); 39605 var reAtach = $(this).children().detach(); 39606 origin.append(reAtach); 39607 }); 39608 $(this.detachContainer, ele).html(""); 39609 $(this.detachContainer, ele).removeClass("-active"); 39610 } 39611 39612 /** 39613 * Leitet auf eine Url weiter 39614 */ 39615 }, { 39616 key: "redirectTo", 39617 value: function redirectTo(url) { 39618 window.location = url; 39619 } 39620 }]); 39621}(_SGComponent2.SGComponent); 39622window.theme.mdHeader = new MdHeader(); 39623 39624},{"SGComponent":83,"body-scroll-lock":6}],121:[function(require,module,exports){ 39625'use strict'; 39626 39627function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 39628Object.defineProperty(exports, "__esModule", { 39629 value: true 39630}); 39631exports.NavBox = void 0; 39632var _SGComponent2 = require("SGComponent"); 39633var _jump = _interopRequireDefault(require("jump.js"));
vendor: 4,117 bytes, lines 39634-39671
39634function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 39635function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 39636function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 39637function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 39638function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 39639function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 39640function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 39641function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 39642function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 39643function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 39644function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 39645function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 39646function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 39647function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 39648function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 39649function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 39650var NavBox = exports.NavBox = /*#__PURE__*/function (_SGComponent) { 39651 function NavBox() { 39652 _classCallCheck(this, NavBox); 39653 return _callSuper(this, NavBox, arguments); 39654 } 39655 _inherits(NavBox, _SGComponent); 39656 return _createClass(NavBox, [{ 39657 key: "init", 39658 value: function init(container) { 39659 container = _superPropGet(NavBox, "init", this, 3)([container]); 39660 $(container).find('.nav-box.-anchor-link').each(function () { 39661 $(this).find('.link-icon').on('click.NavBox', function (e) { 39662 e.preventDefault(); 39663 var elm = $(this).closest('.nav-box').data('target') || false; 39664 var offset = $(this).closest('.nav-box').data('offsetElement') || false; 39665 if (elm) { 39666 if (offset) { 39667 offset = $(offset).height(); 39668 } else { 39669 offset = 0; 39670 } 39671 (0, _jump["default"])(elm, {
vendor: 5,227 bytes, lines 39672-39716
39672 duration: 800, 39673 offset: -offset 39674 }); 39675 } 39676 }); 39677 }); 39678 } 39679 }]); 39680}(_SGComponent2.SGComponent); 39681window.theme.NavBox = new NavBox(); 39682 39683},{"SGComponent":83,"jump.js":31}],122:[function(require,module,exports){ 39684'use strict'; 39685 39686function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 39687Object.defineProperty(exports, "__esModule", { 39688 value: true 39689}); 39690exports.GridSlider = void 0; 39691var _SGComponent2 = require("SGComponent"); 39692require("FoundationCore.js"); 39693var _dragdealer = require("dragdealer"); 39694var _swiper = _interopRequireDefault(require("swiper")); 39695var _modules = require("swiper/modules"); 39696function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 39697function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } 39698function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 39699function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 39700function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 39701function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } 39702function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } 39703function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 39704function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 39705function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 39706function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 39707function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 39708function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 39709function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 39710function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 39711function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 39712function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 39713function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 39714function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 39715function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 39716function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
39716 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 39717function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 39718var GridSlider = exports.GridSlider = /*#__PURE__*/function (_SGComponent) { 39719 function GridSlider() { 39720 _classCallCheck(this, GridSlider); 39721 return _callSuper(this, GridSlider, arguments); 39722 } 39723 _inherits(GridSlider, _SGComponent); 39724 return _createClass(GridSlider, [{ 39725 key: "init", 39726 value: function init(container) { 39727 container = _superPropGet(GridSlider, "init", this, 3)([container]); 39728 var instance = this; 39729 39730 // general slider settings 39731 this.sliderPerPage = []; 39732 this.scrollSelection = ['none', 'invisible', 'set', 'scrollbar']; 39733 39734 // default slider settings 39735 this.defaultSliderSettings = { 39736 slidesPerView: 'auto', 39737 setGroup: 0, 39738 slidesPerGroup: 1, 39739 scroll: 'set', 39740 autoplay: false, 39741 autoplayOption: false, 39742 autoplayDelay: 3000, 39743 arrows: false, 39744 arrowsOption: {}, 39745 animation: false, 39746 loop: false, 39747 loopFillGroupWithBlank: false, 39748 loopedSlides: null, 39749 padding: 0, 39750 spaceBetween: 0, 39751 freeMode: true, 39752 initialSlide: 0, 39753 swiping: true, 39754 autoHeight: true, 39755 centeredSlides: true 39756 }; 39757 $(window).off('resize.GridSlider'); 39758 $(window).on('resize.GridSlider', function () { 39759 instance.initGridSlider(container); 39760 }); 39761 } 39762 39763 /** 39764 * Init grid slider 39765 * @param container 39766 */ 39767 }, { 39768 key: "initGridSlider", 39769 value: function initGridSlider(container) { 39770 var i = 0; 39771 var instance = this; 39772 $(container).find('.grid-slider:not(.-no-slide)').each(function () { 39773 if (!instance.needSlider($(this))) { 39774 $(this).removeClass('grid-slider'); // sonst hidden 39775 return; // next 39776 } 39777 39778 // generate unique id for this container 39779 instance.initContainerId($(this), i); 39780 39781 // set container height per modifier 39782 instance.setContainerHeight($(this)); 39783 39784 // clean up slider tags 39785 instance.cleanUpSliderTags($(this)); 39786 39787 // general functions 39788 if (instance.attrBreakpoint(this, 'scroll', 'value') !== 'none') { 39789 instance.initGeneral($(this)); 39790 } 39791 39792 // flickering helper 39793 instance.loadFlickeringHelper($(this)); 39794 39795 // trigger callback 39796 var cb = $(this).data('callback') || false; 39797 if (cb) { 39798 cb = JSON.parse(cb.replace(/\'/g, '"')); 39799 if (cb.event && cb.target) { 39800 $(cb.target).trigger(cb.event); 39801 } 39802 } 39803 i++; 39804 }); 39805 39806 // HYBRIS-12673 39807 $(window).trigger('GridSlider.initialized'); 39808 } 39809 }, { 39810 key: "needSlider", 39811 value: function needSlider($elem) { 39812 // gilt sowieso nur für contentful-Seiten 39813 if ($('.cf-page').length === 0) { 39814 return true; 39815 } 39816 var self = this; 39817 var breakpoint = this.getBreakpoint(); 39818 var $rows = $elem.find('.columns, .column, .grid-slider__item'); 39819 var maxColumns = 0; 39820 $rows.each(function (i, row) { 39821 maxColumns += self.columnCountFromTile(breakpoint, row.classList); 39822 }); 39823 return maxColumns > 12; 39824 } 39825 }, { 39826 key: "columnCountFromTile", 39827 value: function columnCountFromTile(breakpoint, classes) { 39828 var actBreakpoint = 0; 39829 var breakp, count; 39830 var sort = { 39831 'small': 0, 39832 medium: 1, 39833 large: 2 39834 }; 39835 var max = 0; 39836 classes.forEach(function (item) { 39837 // Klasse eine von den breakpoint-Klassen? 39838 var _item$split = item.split('-'); 39839 var _item$split2 = _slicedToArray(_item$split, 2); 39840 breakp = _item$split2[0]; 39841 count = _item$split2[1]; 39842 if (sort[breakp] != undefined && !isNaN(count)) { 39843 count = parseInt(count); 39844 // Klasse kleiner/gleich zum breakpint 39845 if (sort[breakp] <= sort[breakpoint]) { 39846 // Klasse nicht schon zu klein? 39847 if (sort[breakp] >= actBreakpoint) { 39848 actBreakpoint = sort[breakp]; 39849 max = count; 39850 } 39851 } 39852 } 39853 }, classes); 39854 return max; 39855 } 39856 39857 /** 39858 * Get data-value (query param 'value') or check if data-value exists (query param 'exist') for current breakpoint 39859 * @param elem 39860 * @param attr 39861 * @param query - Query type: 'value' or 'exist' 39862 */ 39863 }, {
39864 key: "attrBreakpoint", 39865 value: function attrBreakpoint(elem, attr, query) { 39866 var instance = this; 39867 var breakpoint = instance.getBreakpoint(); 39868 var ret = null; 39869 39870 // query = 'value' -> return null or data-value 39871 // query = 'exist' -> return false or true 39872 39873 if (query === 'value') { 39874 attr += breakpoint[0].toUpperCase() + breakpoint.substring(1); 39875 if (!(typeof $(elem).data(attr) === 'undefined' || typeof $(elem).data(attr) === 'string' && $(elem).data(attr) === '')) { 39876 ret = $(elem).data(attr); 39877 } 39878 } else if (query === 'exist') { 39879 if (typeof breakpoint === 'string' && (typeof elem.attr('data-' + attr + '-small') !== 'undefined' || typeof elem.attr('data-' + attr + '-medium') !== 'undefined' || typeof elem.attr('data-' + attr + '-large') !== 'undefined')) { 39880 ret = true; 39881 } else { 39882 ret = false; 39883 } 39884 } 39885 return ret; 39886 } 39887 39888 /** 39889 * Get current breakpoint 39890 */ 39891 }, { 39892 key: "getBreakpoint", 39893 value: function getBreakpoint() { 39894 var breakpoint; 39895 if (Foundation.MediaQuery.is('small only')) { 39896 breakpoint = 'small'; 39897 } else if (Foundation.MediaQuery.is('mobile only')) { 39898 breakpoint = 'small'; 39899 } else if (Foundation.MediaQuery.is('medium only')) { 39900 breakpoint = 'medium'; 39901 } else if (Foundation.MediaQuery.is('tablet only')) { 39902 breakpoint = 'medium'; 39903 } else if (Foundation.MediaQuery.is('large up')) { 39904 breakpoint = 'large'; 39905 } 39906 return breakpoint; 39907 } 39908 39909 /** 39910 * Generate unique id for this container 39911 * @param elem 39912 * @param index 39913 */ 39914 }, { 39915 key: "initContainerId", 39916 value: function initContainerId(elem, index) { 39917 var uniqueId = elem.attr('id'); 39918 if (typeof uniqueId === 'undefined') { 39919 uniqueId = 'gridSlider' + index; 39920 elem.attr('id', uniqueId); 39921 } 39922 } 39923 39924 /** 39925 * Set container height via modifier to avoid flickering effect at start 39926 * Fallback within CSS 39927 * @param elem 39928 */ 39929 }, { 39930 key: "setContainerHeight", 39931 value: function setContainerHeight(elem) { 39932 var elemClasses = elem.attr('class'); 39933 var arrElemClasses = elemClasses.split(' '); 39934 $.each(arrElemClasses, function (index, value) { 39935 if (value.match('^-height-')) { 39936 elem.outerHeight(parseInt(value.replace('-height-', ''))); 39937 } 39938 }); 39939 } 39940 39941 /** 39942 * General function calls 39943 * * @param elem 39944 */ 39945 }, { 39946 key: "initGeneral", 39947 value: function initGeneral(elem) { 39948 var instance = this; 39949 39950 // update column width 39951 instance.updateColumnWidth(elem); 39952 39953 // init container settings 39954 instance.initContainerSettings(elem); 39955 39956 // calc element amount within viewport 39957 instance.initAttrSetGroup(elem); 39958 39959 // add slider container 39960 instance.initSliderContainer(elem); 39961 39962 // modifiy columns class for slider 39963 instance.initSliderColumns(elem); 39964 39965 // update container settings with global attributes 39966 instance.getGlobalAttributes(elem); 39967 39968 // update container settings with breakpoint attributes 39969 instance.getBreakpointAttributes(elem); 39970 39971 // set attribute dependencies for container settings 39972 instance.setAttributeDependencies(elem); 39973 39974 // init slider itself with its attributes etc. 39975 instance.initSlider(elem); 39976 } 39977 39978 /** 39979 * Update column styles for swiper 39980 * @param elem 39981 */ 39982 }, { 39983 key: "updateColumnWidth", 39984 value: function updateColumnWidth(elem) { 39985 var columns = elem.find('.columns, .column, .grid-slider__item'); 39986 columns.removeAttr('style'); 39987 var parentWidth = elem.width(); 39988 var firstChildWidth = elem.find('.columns, .column, .grid-slider__item').eq(0).outerWidth(); 39989 columns.each(function (index) { 39990 var newWidth; 39991 if (Math.floor(parentWidth / firstChildWidth) === 1) { 39992 newWidth = Math.round($(this).outerWidth()) !== 0 ? Math.round($(this).outerWidth()) : 'unset'; 39993 } else { 39994 newWidth = Math.round($(this).width()) !== 0 ? Math.round($(this).width()) : 'unset'; 39995 } 39996 $(this).css('width', newWidth); 39997 $(this).css('max-width', newWidth); 39998 $(this).css('padding', '0'); 39999 }); 40000 } 40001 40002 /** 40003 * Init default container settings 40004 * @param elem 40005 */ 40006 }, { 40007 key: "initContainerSettings", 40008 value: function initContainerSettings(elem) { 40009 this.sliderPerPage[elem.attr('id')] = { 40010 small: $.extend(true, {}, this.defaultSliderSettings), 40011 medium: $.extend(true, {}, this.defaultSliderSettings), 40012 large: $.extend(true, {}, this.defaultSliderSettings) 40013 }; 40014 } 40015 40016 /** 40017 * Initial setup for data-set-group attribute 40018 * @param elem 40019 */ 40020 }, { 40021 key: "initAttrSetGroup", 40022 value: function initAttrSetGroup(elem) { 40023 var instance = this; 40024 var parentWidth = elem.width(); 40025 var firstChildWidth = elem.find('.columns, .column, .grid-slider__item').eq(0).outerWidth();
40026 var breakpoint = instance.getBreakpoint(); 40027 instance.sliderPerPage[elem.attr('id')][breakpoint].setGroup = Math.floor(parentWidth / firstChildWidth); 40028 } 40029 40030 /** 40031 * Init swiper slider container - add wrapper, column classes and pagination 40032 * @param elem 40033 */ 40034 }, { 40035 key: "initSliderContainer", 40036 value: function initSliderContainer(elem) { 40037 var children; 40038 var wrapper = "\n <div class=\"swiper-container grid-slider__container js-grid-slider-container swiper\">\n <div class=\"swiper-wrapper js-grid-slider-wrapper\"></div>\n </div>\n "; 40039 var pagination = "\n <div class=\"grid-slider__pagination js-grid-slider-pagination swiper-pagination\"></div>\n "; 40040 if (elem.find('.js-grid-slider-container').length > 0) { 40041 // children elements if swiper container exists 40042 children = elem.find('.js-grid-slider-container .columns, .js-grid-slider-container .column, .js-grid-slider-container .grid-slider__item'); 40043 } else { 40044 // children elements if swiper container not exists 40045 children = elem.find('.columns:not(.js-grid-slider-scrollbar-column), .column:not(.js-grid-slider-scrollbar-column), .grid-slider__item:not(.js-grid-slider-scrollbar-column)'); 40046 } 40047 40048 // empty parent element and append wrapper, children and pagination 40049 elem.empty(); 40050 elem.append(wrapper); 40051 elem.find('.js-grid-slider-wrapper').append(children); 40052 elem.find('.js-grid-slider-wrapper').after(pagination); 40053 } 40054 40055 /** 40056 * Init swiper slider slides - add class for all columns 40057 * @param elem 40058 */ 40059 }, { 40060 key: "initSliderColumns", 40061 value: function initSliderColumns(elem) { 40062 var columns = elem.find('.columns, .column, .grid-slider__item'); 40063 columns.each(function () { 40064 $(this).addClass('swiper-slide'); 40065 }); 40066 } 40067 40068 /** 40069 * Collect slider settings with global data attributes 40070 * @param elem 40071 */ 40072 }, { 40073 key: "getGlobalAttributes", 40074 value: function getGlobalAttributes(elem) { 40075 var instance = this; 40076 var breakpoint = instance.getBreakpoint(); 40077 40078 // scroll 40079 if (typeof elem.data('scroll') === 'string' && instance.scrollSelection.indexOf(elem.data('scroll')) > -1) { 40080 instance.sliderPerPage[elem.attr('id')][breakpoint].scroll = elem.data('scroll'); 40081 } 40082 40083 // padding 40084 if (typeof elem.data('padding') === 'number' && elem.data('padding') >= 0) { 40085 instance.sliderPerPage[elem.attr('id')][breakpoint].padding = elem.data('padding'); 40086 } 40087 40088 // loop 40089 if (typeof elem.data('loop') === 'boolean' && elem.data('loop')) { 40090 instance.sliderPerPage[elem.attr('id')][breakpoint].loop = elem.data('loop'); 40091 } 40092 40093 // autoplay 40094 if (typeof elem.data('autoplay') === 'boolean' && elem.data('autoplay')) { 40095 instance.sliderPerPage[elem.attr('id')][breakpoint].autoplay = elem.data('autoplay'); 40096 } 40097 40098 // autoplay delay 40099 if (typeof elem.data('autoplayDelay') === 'number' && elem.data('autoplayDelay') > 0) { 40100 instance.sliderPerPage[elem.attr('id')][breakpoint].autoplayDelay = elem.data('autoplayDelay'); 40101 } 40102 40103 // arrows 40104 if (typeof elem.data('arrows') === 'boolean' && elem.data('arrows')) { 40105 instance.sliderPerPage[elem.attr('id')][breakpoint].arrows = elem.data('arrows'); 40106 } 40107 40108 // animation 40109 if (typeof elem.data('animation') === 'boolean' && elem.data('animation')) { 40110 instance.sliderPerPage[elem.attr('id')][breakpoint].animation = elem.data('animation'); 40111 } 40112 40113 // swiping 40114 if (typeof elem.data('swiping') === 'boolean' && elem.data('swiping')) { 40115 instance.sliderPerPage[elem.attr('id')][breakpoint].swiping = elem.data('swiping'); 40116 } 40117 40118 // initialslide 40119 if (typeof elem.data('initial') === 'number' && elem.data('initial')) { 40120 instance.sliderPerPage[elem.attr('id')][breakpoint].initialSlide = elem.data('initial'); 40121 } 40122 40123 // autoheight 40124 if (typeof elem.data('autoheight') === 'boolean' && elem.data('autoheight')) { 40125 instance.sliderPerPage[elem.attr('id')][breakpoint].autoHeight = elem.data('autoheight'); 40126 } 40127 } 40128 40129 /** 40130 * Collect slider settings with breakpoint data attributes 40131 * @param elem 40132 */ 40133 }, {
40134 key: "getBreakpointAttributes", 40135 value: function getBreakpointAttributes(elem) { 40136 var instance = this; 40137 var breakpoint = instance.getBreakpoint(); 40138 if (breakpoint === 'small') { 40139 // scroll 40140 if (instance.attrBreakpoint(elem, 'scroll', 'exist') && typeof instance.attrBreakpoint(elem, 'scroll', 'value') === 'string' && instance.scrollSelection.indexOf(instance.attrBreakpoint(elem, 'scroll', 'value')) > -1 && instance.attrBreakpoint(elem, 'scroll', 'value') !== 'scrollbar') { 40141 // only allowed values are: set, none, invisible 40142 // (no scrollbar possible) 40143 instance.sliderPerPage[elem.attr('id')][breakpoint].scroll = instance.attrBreakpoint(elem, 'scroll', 'value'); 40144 } 40145 } else { 40146 // scroll 40147 if (instance.attrBreakpoint(elem, 'scroll', 'exist') && typeof instance.attrBreakpoint(elem, 'scroll', 'value') === 'string' && instance.scrollSelection.indexOf(instance.attrBreakpoint(elem, 'scroll', 'value')) > -1) { 40148 instance.sliderPerPage[elem.attr('id')][breakpoint].scroll = instance.attrBreakpoint(elem, 'scroll', 'value'); 40149 } 40150 } 40151 40152 // padding 40153 if (instance.attrBreakpoint(elem, 'padding', 'exist') && typeof instance.attrBreakpoint(elem, 'padding', 'value') === 'number' && instance.attrBreakpoint(elem, 'padding', 'value') >= 0) { 40154 instance.sliderPerPage[elem.attr('id')][breakpoint].padding = instance.attrBreakpoint(elem, 'padding', 'value'); 40155 } 40156 40157 // loop 40158 if (instance.attrBreakpoint(elem, 'loop', 'exist')) { 40159 instance.sliderPerPage[elem.attr('id')][breakpoint].loop = instance.attrBreakpoint(elem, 'loop', 'value'); 40160 } 40161 40162 // autoplay 40163 if (instance.attrBreakpoint(elem, 'autoplay', 'exist')) { 40164 instance.sliderPerPage[elem.attr('id')][breakpoint].autoplay = instance.attrBreakpoint(elem, 'autoplay', 'value'); 40165 } 40166 40167 // arrows 40168 if (instance.attrBreakpoint(elem, 'arrows', 'exist')) { 40169 instance.sliderPerPage[elem.attr('id')][breakpoint].arrows = instance.attrBreakpoint(elem, 'arrows', 'value'); 40170 } 40171 40172 // animation 40173 if (instance.attrBreakpoint(elem, 'animation', 'exist')) { 40174 instance.sliderPerPage[elem.attr('id')][breakpoint].animation = instance.attrBreakpoint(elem, 'animation', 'value'); 40175 } 40176 40177 // swiping 40178 if (instance.attrBreakpoint(elem, 'swiping', 'exist')) { 40179 instance.sliderPerPage[elem.attr('id')][breakpoint].swiping = instance.attrBreakpoint(elem, 'swiping', 'value'); 40180 } 40181 } 40182 40183 /** 40184 * Set attribute dependencies 40185 * @param elem 40186 */ 40187 }, { 40188 key: "setAttributeDependencies", 40189 value: function setAttributeDependencies(elem) { 40190 var instance = this; 40191 var breakpoint = instance.getBreakpoint(); 40192 var parentWidth = elem.width(); 40193 var firstChildWidth = elem.find('.columns, .column, .grid-slider__item').eq(0).outerWidth(); 40194 40195 // space between 40196 if (instance.sliderPerPage[elem.attr('id')][breakpoint].setGroup > 1) { 40197 if (instance.sliderPerPage[elem.attr('id')][breakpoint].scroll === 'scrollbar') { 40198 if (instance.sliderPerPage[elem.attr('id')][breakpoint].padding > 0) { 40199 instance.sliderPerPage[elem.attr('id')][breakpoint].spaceBetween = instance.sliderPerPage[elem.attr('id')][breakpoint].padding; 40200 } else { 40201 instance.sliderPerPage[elem.attr('id')][breakpoint].spaceBetween = 0; 40202 } 40203 } else { 40204 if (typeof elem.data('padding') === 'number' || instance.attrBreakpoint(elem, 'padding', 'exist') && typeof instance.attrBreakpoint(elem, 'padding', 'value') === 'number') { 40205 instance.sliderPerPage[elem.attr('id')][breakpoint].spaceBetween = instance.sliderPerPage[elem.attr('id')][breakpoint].padding; 40206 } else { 40207 instance.sliderPerPage[elem.attr('id')][breakpoint].spaceBetween = (parentWidth - instance.sliderPerPage[elem.attr('id')][breakpoint].setGroup * firstChildWidth) / (instance.sliderPerPage[elem.attr('id')][breakpoint].setGroup - 1); 40208 } 40209 } 40210 } else if (instance.sliderPerPage[elem.attr('id')][breakpoint].setGroup === 1) { 40211 instance.sliderPerPage[elem.attr('id')][breakpoint].spaceBetween = 0; 40212 } 40213 40214 // looped slides (necessary if loop=true and slidesPerView='auto') 40215 // slides per view 40216 if (instance.sliderPerPage[elem.attr('id')][breakpoint].loop) { 40217 instance.sliderPerPage[elem.attr('id')][breakpoint].slidesPerView = instance.sliderPerPage[elem.attr('id')][breakpoint].setGroup; 40218 instance.sliderPerPage[elem.attr('id')][breakpoint].loopedSlides = instance.sliderPerPage[elem.attr('id')][breakpoint].setGroup; 40219 } 40220 40221 // slides per group 40222 instance.sliderPerPage[elem.attr('id')][breakpoint].slidesPerGroup = instance.sliderPerPage[elem.attr('id')][breakpoint].setGroup; 40223 40224 // free mode, loop fill 40225 if (instance.sliderPerPage[elem.attr('id')][breakpoint].scroll !== 'scrollbar') { 40226 instance.sliderPerPage[elem.attr('id')][breakpoint].freeMode = false;
40227 instance.sliderPerPage[elem.attr('id')][breakpoint].loopFillGroupWithBlank = true; 40228 } 40229 40230 // autoplay option 40231 if (instance.sliderPerPage[elem.attr('id')][breakpoint].autoplay) { 40232 instance.sliderPerPage[elem.attr('id')][breakpoint].autoplayOption = { 40233 delay: instance.sliderPerPage[elem.attr('id')][breakpoint].autoplayDelay, 40234 stopOnLastSlide: true, 40235 disableOnInteraction: false 40236 }; 40237 } 40238 40239 // arrows option 40240 if (instance.sliderPerPage[elem.attr('id')][breakpoint].arrows && instance.sliderPerPage[elem.attr('id')][breakpoint].scroll !== 'scrollbar') { 40241 instance.sliderPerPage[elem.attr('id')][breakpoint].arrowsOption = { 40242 prevEl: '.js-grid-slider-pagination-button-prev', 40243 nextEl: '.js-grid-slider-pagination-button-next', 40244 addIcons: false 40245 }; 40246 } 40247 } 40248 40249 /** 40250 * Get slider breakpoint settings 40251 * @param elem 40252 */ 40253 }, { 40254 key: "getSliderSettingsPerBreakpoint", 40255 value: function getSliderSettingsPerBreakpoint(elem) { 40256 var instance = this; 40257 var arrows, arrowsOption, animation, scroll, autoplay, slidesPerView, slidesPerGroup, spaceBetween, setGroup, autoplayOption, loop, loopFillGroupWithBlank, loopedSlides, freeMode, initialSlide, swiping; 40258 var breakpoint = instance.getBreakpoint(); 40259 40260 /* ********************************************************************************************************* */ 40261 40262 // set elem pagination attribute 40263 // ATTENTION: attr(...) instead of data(...) in case of css use 40264 if (instance.sliderPerPage[elem.attr('id')][breakpoint].scroll === 'scrollbar') { 40265 elem.attr('data-pagination', 'scrollbar'); 40266 } else if (instance.sliderPerPage[elem.attr('id')][breakpoint].scroll === 'set') { 40267 elem.attr('data-pagination', 'set'); 40268 } else if (instance.sliderPerPage[elem.attr('id')][breakpoint].scroll === 'invisible') { 40269 elem.attr('data-pagination', 'invisible'); 40270 } 40271 40272 // update slider arrows options 40273 if (instance.sliderPerPage[elem.attr('id')][breakpoint].arrows && instance.sliderPerPage[elem.attr('id')][breakpoint].scroll !== 'scrollbar') { 40274 elem.attr('data-navigation', 'show'); 40275 } else { 40276 elem.attr('data-navigation', 'hidden'); 40277 } 40278 40279 // update slider animation options 40280 // ATTENTION: attr(...) instead of data(...) in case of css use 40281 if (instance.sliderPerPage[elem.attr('id')][breakpoint].autoplay && instance.sliderPerPage[elem.attr('id')][breakpoint].animation === true && instance.sliderPerPage[elem.attr('id')][breakpoint].scroll === 'set') { 40282 elem.attr('data-animation', 'show'); 40283 } else { 40284 elem.attr('data-animation', 'hidden'); 40285 } 40286 40287 /* ********************************************************************************************************* */ 40288 40289 // several options (autoplay, arrows, animation, scroll, etc.) 40290 arrows = instance.sliderPerPage[elem.attr('id')][breakpoint].arrows; 40291 arrowsOption = instance.sliderPerPage[elem.attr('id')][breakpoint].arrowsOption; 40292 animation = instance.sliderPerPage[elem.attr('id')][breakpoint].animation; 40293 scroll = instance.sliderPerPage[elem.attr('id')][breakpoint].scroll; 40294 autoplay = instance.sliderPerPage[elem.attr('id')][breakpoint].autoplay; 40295 autoplayOption = instance.sliderPerPage[elem.attr('id')][breakpoint].autoplayOption; 40296 slidesPerView = instance.sliderPerPage[elem.attr('id')][breakpoint].slidesPerView; 40297 slidesPerGroup = instance.sliderPerPage[elem.attr('id')][breakpoint].slidesPerGroup; 40298 spaceBetween = instance.sliderPerPage[elem.attr('id')][breakpoint].spaceBetween; 40299 setGroup = instance.sliderPerPage[elem.attr('id')][breakpoint].setGroup; 40300 loop = instance.sliderPerPage[elem.attr('id')][breakpoint].loop; 40301 loopFillGroupWithBlank = instance.sliderPerPage[elem.attr('id')][breakpoint].loopFillGroupWithBlank; 40302 loopedSlides = instance.sliderPerPage[elem.attr('id')][breakpoint].loopedSlides; 40303 freeMode = instance.sliderPerPage[elem.attr('id')][breakpoint].freeMode; 40304 initialSlide = instance.sliderPerPage[elem.attr('id')][breakpoint].initialSlide; 40305 swiping = instance.sliderPerPage[elem.attr('id')][breakpoint].swiping; 40306 40307 /* ********************************************************************************************************* */ 40308 40309 var returnArr = {}; 40310 returnArr.arrows = arrows; 40311 returnArr.arrowsOption = arrowsOption; 40312 returnArr.animation = animation; 40313 returnArr.scroll = scroll; 40314 returnArr.autoplay = autoplay; 40315 returnArr.autoplayOption = autoplayOption; 40316 returnArr.slidesPerView = slidesPerView; 40317 returnArr.slidesPerGroup = slidesPerGroup; 40318 returnArr.spaceBetween = spaceBetween; 40319 returnArr.setGroup = setGroup; 40320 returnArr.loop = loop; 40321 returnArr.loopFillGroupWithBlank = loopFillGroupWithBlank; 40322 returnArr.loopedSlides = loopedSlides; 40323 returnArr.freeMode = freeMode; 40324 returnArr.initialSlide = initialSlide; 40325 returnArr.swiping = swiping; 40326 var ImageSliderTabIndex = elem.data('imagesSliderBulletsTabIndex') || 0; 40327 if (ImageSliderTabIndex) { 40328 returnArr.ImageSliderTabIndex = ImageSliderTabIndex; 40329 } 40330 return returnArr; 40331 } 40332 40333 /** 40334 * Init swiper slider 40335 * @param elem 40336 */ 40337 }, { 40338 key: "initSlider", 40339 value: function initSlider(elem) { 40340 var instance = this; 40341 var myswiper; 40342 var settingOptions; 40343 40344 /***********************************************************************************/ 40345 40346 // get slider breakpoint settings 40347 var data = instance.getSliderSettingsPerBreakpoint(elem); 40348 40349 /***********************************************************************************/ 40350 var arrowPrev = '<div class="swiper-button-prev grid-slider__pagination-button-prev js-grid-slider-pagination-button-prev fal fa-custom-angle-back"></div>'; 40351 var arrowNext = '<div class="swiper-button-next grid-slider__pagination-button-next js-grid-slider-pagination-button-next fal fa-custom-angle-link"></div>'; 40352 elem.find('.js-grid-slider-container').append(arrowPrev); 40353 elem.find('.js-grid-slider-container').append(arrowNext); 40354 40355 /***********************************************************************************/ 40356 40357 // if scrollbar exists remove 40358 if (elem.find('.js-grid-slider-scrollbar').length > 0) { 40359 elem.find('.js-grid-slider-scrollbar').remove(); 40360 } 40361
40362 // slider options - depend on scroll value 40363 40364 if (data.scroll === 'scrollbar') { 40365 settingOptions = { 40366 slidesPerView: instance.defaultSliderSettings.slidesPerView, 40367 slidesPerGroup: instance.defaultSliderSettings.slidesPerGroup, 40368 spaceBetween: data.spaceBetween, 40369 autoplay: instance.defaultSliderSettings.autoplay, 40370 loop: instance.defaultSliderSettings.loop, 40371 loopFillGroupWithBlank: instance.defaultSliderSettings.loopFillGroupWithBlank, 40372 loopedSlides: instance.defaultSliderSettings.loopedSlides, 40373 freeMode: instance.defaultSliderSettings.freeMode, 40374 arrowsOption: instance.defaultSliderSettings.arrowsOption, 40375 initialSlide: data.initialSlide, 40376 swiping: data.swiping 40377 }; 40378 } else { 40379 settingOptions = { 40380 slidesPerView: data.slidesPerView, 40381 slidesPerGroup: data.slidesPerGroup, 40382 spaceBetween: data.spaceBetween, 40383 autoplay: data.autoplayOption, 40384 loop: data.loop, 40385 loopFillGroupWithBlank: data.loopFillGroupWithBlank, 40386 loopedSlides: data.loopedSlides, 40387 freeMode: data.freeMode, 40388 arrowsOption: data.arrowsOption, 40389 initialSlide: data.initialSlide, 40390 swiping: data.swiping 40391 }; 40392 } 40393 var pagination = { 40394 el: '.js-grid-slider-pagination', 40395 clickable: true, 40396 bulletClass: 'js-grid-slider-pagination-bullet', 40397 bulletActiveClass: 'swiper-pagination-bullet-active grid-slider__pagination-bullet-active js-grid-slider-pagination-bullet-active', 40398 renderBullet: function renderBullet(index, className) { 40399 return "\n <span class=\"swiper-pagination-bullet grid-slider__pagination-bullet ".concat(className, "\">\n <span class=\"grid-slider__pagination-bullet-inner\">\n <span class=\"grid-slider__pagination-bullet-inner-fill js-grid-slider-pagination-bullet-inner-fill\"></span>\n </span>\n </span>\n "); 40400 } 40401 }; 40402 40403 // slider options 40404 var sliderSettings = { 40405 wrapperClass: 'js-grid-slider-wrapper', 40406 slidesPerView: settingOptions.slidesPerView, 40407 slidesPerGroup: settingOptions.slidesPerGroup, 40408 spaceBetween: settingOptions.spaceBetween, 40409 autoplay: settingOptions.autoplay, 40410 loop: settingOptions.loop, 40411 loopFillGroupWithBlank: settingOptions.loopFillGroupWithBlank, 40412 loopedSlides: settingOptions.loopedSlides, 40413 freeMode: settingOptions.freeMode, 40414 pagination: pagination, 40415 navigation: settingOptions.arrowsOption, 40416 initialSlide: settingOptions.initialSlide, 40417 swiping: settingOptions.swiping, 40418 observer: true, 40419 observeParents: true, 40420 modules: [_modules.Navigation, _modules.Pagination], 40421 on: { 40422 paginationRender: function paginationRender() { 40423 // pagination animation update at start; parameter 'first' in case of the first children within the current grid slider 40424 instance.paginationAnimation(elem, 'first'); 40425 }, 40426 transitionStart: function transitionStart() { 40427 // remove styling from pagination animation 40428 elem.find('.js-grid-slider-pagination-bullet-inner-fill').removeAttr('style'); 40429 // scrollbar settings update 40430 if (data.scroll === 'scrollbar') { 40431 // scrollbar update - no loop 40432 if (!isNaN(this.progress)) { 40433 var value = this.progress; 40434 setTimeout(function () { 40435 instance.updateScrollBarSettings(elem, data.loop, value); 40436 }, 1); 40437 } 40438 } 40439 }, 40440 transitionEnd: function transitionEnd() { 40441 if (data.animation === true && data.scroll === 'set' && data.autoplay === true) { 40442 // pagination animation update for the current active children within the current grid slider 40443 instance.paginationAnimation(elem, 'active'); 40444 } 40445 } 40446 } 40447 }; 40448 40449 /***********************************************************************************/ 40450 if (data.swiping === false) { 40451 elem.addClass('swiper-no-swiping'); 40452 } else { 40453 elem.removeClass('swiper-no-swiping'); 40454 } 40455 // generate swiper slider 40456 myswiper = new _swiper["default"](elem.find('.js-grid-slider-container')[0], sliderSettings); 40457 // nur für die Device-Images 40458 if (data.ImageSliderTabIndex && elem.hasClass('js-product-detail-device-images')) { 40459 var observerCallback = function observerCallback(e, mutations) { 40460 var tabindex = data.ImageSliderTabIndex; 40461 elem.find('.js-grid-slider-pagination-button-prev').attr('tabindex', tabindex++); 40462 elem.find('.js-grid-slider-pagination-button-next').attr('tabindex', tabindex++); 40463 elem.find('.js-grid-slider-pagination-bullet').each(function (index) { 40464 $(this).attr('tabindex', tabindex++); 40465 }); 40466 }; 40467 myswiper.on('observerUpdate', observerCallback).on('slideNextTransitionEnd', observerCallback).on('slidePrevTransitionEnd', observerCallback); 40468 } 40469 40470 // mouseenter - stop autoplay if set
40471 $(myswiper.el).on('mouseenter.GridSlider', function () { 40472 if (myswiper.params.autoplay.enabled) { 40473 myswiper.autoplay.stop(); 40474 } 40475 }); 40476 40477 // mouseleave - start autoplay again if set 40478 $(myswiper.el).on('mouseleave.GridSlider', function () { 40479 if (myswiper.params.autoplay.enabled) { 40480 myswiper.autoplay.start(); 40481 } 40482 }); 40483 40484 // init scrollbar or pagination 40485 if (data.scroll === 'scrollbar') { 40486 instance.initScrollBar(elem, myswiper); 40487 } else if (data.scroll === 'set') { 40488 instance.calcPaginationItemWidth(elem); 40489 } 40490 } 40491 40492 /** 40493 * Animate pagination items 40494 * @param elem 40495 * @param type - 'active' or 'first' 40496 */ 40497 }, { 40498 key: "paginationAnimation", 40499 value: function paginationAnimation(elem, type) { 40500 // Do not animate when using secondary style 40501 var usesSecondaryStyle = elem.hasClass('-style-secondary'); 40502 if (usesSecondaryStyle) { 40503 return; 40504 } 40505 var instance = this; 40506 var item; 40507 var breakpoint = instance.getBreakpoint(); 40508 if (type === 'first') { 40509 item = elem.find('.js-grid-slider-pagination .js-grid-slider-pagination-bullet:first-child'); 40510 } else if (type === 'active') { 40511 item = elem.find('.js-grid-slider-pagination .js-grid-slider-pagination-bullet-active'); 40512 } 40513 if (item.length > 0) { 40514 item.find('.js-grid-slider-pagination-bullet-inner-fill').animate({ 40515 width: '100%' 40516 }, instance.sliderPerPage[elem.attr('id')][breakpoint].autoplayDelay); 40517 } 40518 } 40519 40520 /** 40521 * Update scrollbar settings 40522 * @param elem 40523 * @param loop 40524 * @param value - progress or real index value, depends on loop setting 40525 */ 40526 }, { 40527 key: "updateScrollBarSettings", 40528 value: function updateScrollBarSettings(elem, loop, value) { 40529 var instance = this; 40530 if (Foundation.MediaQuery.is('small only')) { 40531 instance.scrollbarArrS[elem.attr('id')].setValue(value.toPrecision(2), 0, false); 40532 } else if (Foundation.MediaQuery.is('medium only')) { 40533 instance.scrollbarArrM[elem.attr('id')].setValue(value.toPrecision(2), 0, false); 40534 } else if (Foundation.MediaQuery.is('large up')) { 40535 instance.scrollbarArrL[elem.attr('id')].setValue(value.toPrecision(2), 0, false); 40536 } 40537 } 40538 40539 /** 40540 * Clean up slider tags 40541 * @param elem 40542 */ 40543 }, { 40544 key: "cleanUpSliderTags", 40545 value: function cleanUpSliderTags(elem) { 40546 // remove duplicated slides from activated loop 40547 elem.find('.swiper-slide-duplicate').remove(); 40548 var columns = elem.find('.columns, .column, .grid-slider__item'); 40549 40550 // remove slider css classes 40551 columns.each(function () { 40552 $(this).removeAttr('style'); 40553 $(this).removeClass('swiper-slide swiper-slide-active swiper-slide-next'); 40554 }); 40555 elem.find('.js-grid-slider-container').remove(); 40556 elem.append(columns); 40557 } 40558 40559 /** 40560 * Init scrollbar 40561 * @param elem 40562 * @param myswiper 40563 */ 40564 }, { 40565 key: "initScrollBar", 40566 value: function initScrollBar(elem, myswiper) { 40567 var instance = this; 40568 var scrollbarId = ''; 40569 var scrollbar = ''; 40570 var oldNumber = 0; 40571 var columns = elem.find('.swiper-slide'); 40572 var colWidth = 0;
40573 var availWidth = 0; 40574 40575 // if scrollbar exists remove - replacement if necessary in an additional step 40576 if (elem.find('.js-grid-slider-scrollbar').length > 0) { 40577 elem.find('.js-grid-slider-scrollbar').remove(); 40578 } 40579 40580 // calculate columns and available width 40581 columns.each(function (index) { 40582 if (index === columns.length - 1) { 40583 colWidth += $(this).outerWidth(); 40584 } else { 40585 colWidth += $(this).outerWidth() + parseInt($(this).css('margin-right')); 40586 } 40587 }); 40588 availWidth = colWidth - elem.outerWidth(); 40589 if (availWidth > 0) { 40590 // children elements amount > available container width 40591 40592 // replacement scrollbar 40593 scrollbarId = elem.attr('id') + '-scrollbar'; 40594 scrollbar = "\n <div class=\"grid-slider__scrollbar js-grid-slider-scrollbar\">\n <div class=\"grid-slider__scrollbar-column js-grid-slider-scrollbar-column\">\n <div id=\"".concat(scrollbarId, "\" class=\"grid-slider__scrollbar-handle-outer js-grid-slider-scrollbar-handle-outer dragdealer\">\n <div class=\"grid-slider__scrollbar-line\"></div>\n <div class=\"grid-slider__scrollbar-handle js-grid-slider-scrollbar-handle\">\n <div class=\"grid-slider__scrollbar-handle-inner\"> </div>\n </div>\n </div>\n </div>\n </div>"); 40595 elem.append(scrollbar); 40596 40597 // calculate scrollbar handle width 40598 var handleWidth = elem.find('.js-grid-slider-scrollbar-handle-outer').outerWidth() / elem.find('.js-grid-slider-wrapper').children(':not(.swiper-slide-duplicate)').length; 40599 elem.find('.js-grid-slider-scrollbar-handle').width(handleWidth); 40600 40601 // scrollbar handle options 40602 var dragdealerOptions = { 40603 handleClass: 'js-grid-slider-scrollbar-handle', 40604 animationCallback: function animationCallback(x) { 40605 var number = this.getValue()[0]; 40606 if (oldNumber !== number) { 40607 var translateVal = -Math.abs(number * availWidth); 40608 myswiper.setTranslate(translateVal); 40609 oldNumber = number; 40610 } 40611 } 40612 }; 40613 40614 // init scrollbar handle 40615 if (Foundation.MediaQuery.is('small only')) { 40616 if (typeof instance.scrollbarArrS === 'undefined') { 40617 instance.scrollbarArrS = []; 40618 } 40619 instance.scrollbarArrS[elem.attr('id')] = new _dragdealer.Dragdealer(scrollbarId, dragdealerOptions); 40620 } else if (Foundation.MediaQuery.is('medium only')) { 40621 if (typeof instance.scrollbarArrM === 'undefined') { 40622 instance.scrollbarArrM = []; 40623 } 40624 instance.scrollbarArrM[elem.attr('id')] = new _dragdealer.Dragdealer(scrollbarId, dragdealerOptions); 40625 } else if (Foundation.MediaQuery.is('large up')) { 40626 if (typeof instance.scrollbarArrL === 'undefined') { 40627 instance.scrollbarArrL = []; 40628 } 40629 instance.scrollbarArrL[elem.attr('id')] = new _dragdealer.Dragdealer(scrollbarId, dragdealerOptions); 40630 } 40631 } 40632 } 40633 40634 /** 40635 * Calculate width of pagination items 40636 * @param elem 40637 */ 40638 }, { 40639 key: "calcPaginationItemWidth", 40640 value: function calcPaginationItemWidth(elem) { 40641 var usesSecondaryStyle = elem.hasClass('-style-secondary'); 40642 var pagination = elem.find('.js-grid-slider-pagination'); 40643 var paginationWidth = pagination.width(); 40644 var bullets = pagination.find('.js-grid-slider-pagination-bullet'); 40645 var bulletFallbackValue = 150; 40646 40647 // Do not apply pagination padding when using the secondary style 40648 if (usesSecondaryStyle) { 40649 return; 40650 } 40651 if (elem.hasClass('-pagination-no-gap')) { 40652 bullets.each(function () { 40653 $(this).css('flex', '0 0 ' + (paginationWidth / bullets.length - (bullets.length - 1)) + 'px'); 40654 }); 40655 } else { 40656 // if there is no css class '-pagination-no-gap', pagination children has a max-length (bulletFallbackValue) 40657 bullets.each(function () { 40658 if (paginationWidth / bullets.length - bullets.length >= bulletFallbackValue) {} else { 40659 $(this).css('flex', '0 0 ' + (paginationWidth / bullets.length - (bullets.length - 1)) + 'px'); 40660 } 40661 }); 40662 } 40663 } 40664 40665 /** 40666 * Load flickering helper 40667 * @param elem 40668 */ 40669 }, { 40670 key: "loadFlickeringHelper", 40671 value: function loadFlickeringHelper(elem) { 40672 if (!elem.hasClass('-fix-height')) { 40673 elem.outerHeight('inherit'); 40674 } 40675 elem.addClass('-load-flickering-helper'); 40676 } 40677 }]); 40678}(_SGComponent2.SGComponent); 40679window.theme.gridSlider = new GridSlider(); 40680 40681},{"FoundationCore.js":77,"SGComponent":83,"dragdealer":9,"swiper":70,"swiper/modules":50}],123:[function(require,module,exports){ 40682'use strict'; 40683 40684function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 40685Object.defineProperty(exports, "__esModule", { 40686 value: true 40687}); 40688exports.PlpBar = void 0; 40689var _SGComponent2 = require("SGComponent"); 40690function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 40691function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 40692function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 40693function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 40694function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
40695function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 40696function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 40697function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 40698function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 40699function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 40700function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 40701function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 40702function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 40703function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 40704function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 40705var PlpBar = exports.PlpBar = /*#__PURE__*/function (_SGComponent) { 40706 function PlpBar() { 40707 _classCallCheck(this, PlpBar); 40708 return _callSuper(this, PlpBar, arguments); 40709 } 40710 _inherits(PlpBar, _SGComponent); 40711 return _createClass(PlpBar, [{ 40712 key: "init", 40713 value: function init(container) { 40714 container = _superPropGet(PlpBar, "init", this, 3)([container]); 40715 $(container).find('.plp-bar').each(function () { 40716 var jsViewSwitch = $(this).find('.js-view-switch'); 40717 var linkToFilters = $(this).find('.js-link-to-filters'); 40718 var listIcon = jsViewSwitch.children(".js-listview"); 40719 var barIcon = jsViewSwitch.children(".js-barview"); 40720 40721 /* 40722 simple toggle 40723 */ 40724 listIcon.on("click.PlpBar", function (e) { 40725 e.preventDefault(); 40726 barIcon.removeClass("-is-active"); 40727 listIcon.addClass("-is-active"); 40728 jsViewSwitch.trigger("viewChanged.PlpBar", ["listView"]); 40729 }); 40730 barIcon.on("click.PlpBar", function (e) { 40731 e.preventDefault(); 40732 listIcon.removeClass("-is-active"); 40733 barIcon.addClass("-is-active"); 40734 jsViewSwitch.trigger("viewChanged.PlpBar", ["barView"]); 40735 }); 40736 40737 /* 40738 scroll to filters 40739 */ 40740 linkToFilters.on("click.PlpBar", function (e) { 40741 e.preventDefault(); 40742 $('html, body').animate({ 40743 scrollTop: $("#facet").offset().top - 100 //TODO: falscher selector 40744 }, 1000); 40745 }); 40746 $(this).find('.js-viewtypeselect').on('click.PlpBar', function () { 40747 $('input.js-selectedviewtype').val($(this).attr('data-viewtype')); 40748 $(this).closest("form").submit(); 40749 }); 40750 $(this).find('.js-sortselect').on('change.PlpBar', function () { 40751 $(this).closest("form").submit(); 40752 }); 40753 }); 40754 } 40755 }]); 40756}(_SGComponent2.SGComponent); 40757window.theme.plpbar = new PlpBar(); 40758 40759},{"SGComponent":83}],124:[function(require,module,exports){ 40760"use strict"; 40761 40762function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 40763Object.defineProperty(exports, "__esModule", { 40764 value: true 40765});
40766exports.TabContent = void 0; 40767var _SGComponent2 = require("SGComponent"); 40768function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 40769function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 40770function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 40771function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 40772function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 40773function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 40774function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 40775function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 40776function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 40777function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 40778function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 40779function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 40780function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 40781function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 40782function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 40783var TabContent = exports.TabContent = /*#__PURE__*/function (_SGComponent) { 40784 function TabContent() { 40785 _classCallCheck(this, TabContent); 40786 return _callSuper(this, TabContent, arguments); 40787 } 40788 _inherits(TabContent, _SGComponent); 40789 return _createClass(TabContent, [{ 40790 key: "initialize", 40791 value: function initialize() { 40792 this.smallViewpoint = 639; 40793 this.mediumViewpoint = 1103; 40794 } 40795 }, { 40796 key: "init", 40797 value: function init(container) { 40798 container = _superPropGet(TabContent, "init", this, 3)([container]); 40799 var instance = this; 40800 $(container).find(".tabcontent").each(function () { 40801 var tabContentNavigation = $(this); 40802 instance.orderTabs(tabContentNavigation); 40803 instance.activateActiveTab(tabContentNavigation); 40804 if (tabContentNavigation.data("use-url-hash") === true) { 40805 instance.setActiveTabByHash(tabContentNavigation); 40806 } 40807 tabContentNavigation.find(".tabcontent__navitem").off("click.TabContent").on("click.TabContent", $.proxy(instance.tabClickHandler, instance)); 40808 40809 // dynamically set ::before->left value for tabs on .-large 40810 var navWrapper = tabContentNavigation.find(".tabcontent__navwrapper"); 40811 var hasLargeModifier = tabContentNavigation.hasClass("-large"); 40812 if (navWrapper && hasLargeModifier) { 40813 var children = tabContentNavigation.find(".tabcontent__content"); 40814 var step = 100 / children.length; 40815 for (var i = 0; i < children.length; i++) { 40816 var percentage = step * i + step / 2; 40817 var className = "-position-".concat(Math.round(percentage / 2.5)); 40818 $(children[i]).addClass(className); 40819 } 40820 } 40821 40822 // "0 Euro" durch "kostenlos" ersetzen 40823 $(this).find(".usp-details__keyvalue-value").each(function (index, item) { 40824 if ($.trim($(item).text()) == "0.00 €" || $.trim($(item).text()) == "0,00 €") { 40825 $(item).html("kostenlos"); 40826 } 40827 }); 40828 }); 40829 $(window).resize(this.windowResizeHandler.bind(this)); 40830 } 40831 40832 /** 40833 * activate the active tab on page load 40834 * @param tabContentNavigation 40835 */ 40836 }, { 40837 key: "setActiveTabByHash", 40838 value: function setActiveTabByHash(tabContentNavigation) { 40839 var hash = location.hash.replace("#", "") || ""; 40840 var naviItems = tabContentNavigation.find(".tabcontent__navitem"); 40841 var contentItems = tabContentNavigation.find(".tabcontent__content"); 40842 if (!hash) { 40843 naviItems.first().addClass("-is-active"); 40844 contentItems.first().addClass("-is-active"); 40845 } else { 40846 naviItems.removeClass("-is-active").filter('[data-hash="' + hash + '"]').addClass("-is-active"); 40847 contentItems.removeClass("-is-active").filter('[data-hash="' + hash + '"]').addClass("-is-active"); 40848 } 40849 } 40850 40851 /** 40852 * handle window beeing resized by user 40853 */ 40854 }, { 40855 key: "windowResizeHandler", 40856 value: function windowResizeHandler() { 40857 this.orderTabs($(".js-tabcontent-navigation")); 40858 this.activateActiveTab($(".js-tabcontent-navigation")); 40859 } 40860 40861 /** 40862 * add crossbrowser css order 40863 * @param item 40864 * @param orderNr 40865 */ 40866 }, { 40867 key: "addCssOrder", 40868 value: function addCssOrder(item, orderNr) { 40869 //TODO ersetzen durch addClass() 40870 $(item).css({ 40871 "-webkit-box-ordinal-group": orderNr, 40872 "-moz-box-ordinal-group": orderNr, 40873 "-ms-flex-order": orderNr, 40874 "-webkit-order": orderNr, 40875 order: orderNr 40876 }); 40877 } 40878 40879 /** 40880 * order the tabs depending on viewpoint 40881 * @param tabContentNavigation 40882 */ 40883 }, { 40884 key: "orderTabs", 40885 value: function orderTabs(tabContentNavigation) { 40886 var naviItems = tabContentNavigation.find(".tabcontent__navitem"); 40887 var contentItems = tabContentNavigation.find(".tabcontent__content"); 40888 var self = this; 40889 var numberOfNaviItems = naviItems.length; 40890 if (window.innerWidth > this.mediumViewpoint) { 40891 naviItems.each(function (index, item) { 40892 self.addCssOrder(item, index); 40893 }); 40894 contentItems.each(function (index, item) { 40895 self.addCssOrder(item, numberOfNaviItems + index); 40896 $(item).css("maxHeight", ""); 40897 }); 40898 } else { 40899 naviItems.each(function (index, item) { 40900 self.addCssOrder(item, (index + 1) * 2 - 1); 40901 }); 40902 contentItems.each(function (index, item) { 40903 self.addCssOrder(item, (index + 1) * 2); 40904 if (tabContentNavigation.hasClass("-content-expanded-small")) { 40905 if ($(item).hasClass("-is-active")) { 40906 $(item).css("max-height", "unset"); 40907 } 40908 } 40909 }); 40910 } 40911 } 40912 40913 /** 40914 * activate the active tab on page load 40915 * @param tabContentNavigation 40916 */ 40917 }, { 40918 key: "activateActiveTab", 40919 value: function activateActiveTab(tabContentNavigation) { 40920 // Nach Absprache mit @Jonas Ebel: Setting max-height disabled because content is sticking out of the container 40921 // var activeContent = tabContentNavigation.find(".tabcontent__content.-is-active"); 40922 // if (activeContent.length){ 40923 // activeContent.css("max-height", parseInt(activeContent[0].scrollHeight + 100) + "px"); 40924 // } 40925 } 40926 40927 /** 40928 * handler to handle a click on the navigation tabs (only on
40928small viewpoint) 40929 * @param e 40930 */ 40931 }, { 40932 key: "tabClickHandler", 40933 value: function tabClickHandler(e) { 40934 $(document).trigger("click.TabContent"); 40935 var index = $(e.currentTarget).index(); 40936 var clickedTab = $(e.currentTarget); 40937 var usesNavwrapper = clickedTab.parent().hasClass("tabcontent__navwrapper"); 40938 // if the optional navwrapper is used, use clicked tab's parent instead 40939 var tabHandler = usesNavwrapper ? clickedTab.parent() : clickedTab; 40940 var contentForClickedTab = tabHandler.siblings(".tabcontent__content").eq(index); 40941 tabHandler.siblings(".tabcontent__content").find(".grid-slider").removeClass("js-initialized"); 40942 var activeContent = tabHandler.siblings(".tabcontent__content.-is-active"); 40943 var activeNavigationTab = clickedTab.siblings(".tabcontent__navitem.-is-active"); 40944 if (clickedTab.attr("data-hash")) { 40945 location.hash = clickedTab.attr("data-hash"); 40946 } 40947 if (clickedTab.hasClass("-is-active")) { 40948 if (window.innerWidth <= this.mediumViewpoint) { 40949 var parentTabHandler = tabHandler.parent(); 40950 var hasBorderModifier = parentTabHandler.hasClass("-border"); 40951 var collapseActiveTab = parentTabHandler.attr("data-active-collapse") === "true"; 40952 if (!hasBorderModifier && collapseActiveTab) { 40953 contentForClickedTab.removeClass("-is-active"); 40954 clickedTab.removeClass("-is-active"); 40955 contentForClickedTab.css("max-height", 0); 40956 } 40957 } 40958 } else { 40959 //remove active class from active tab 40960 activeNavigationTab.removeClass("-is-active"); 40961 40962 //add active class to clicked tab 40963 clickedTab.addClass("-is-active"); 40964 40965 //add active class to content, that belongs to the clicked tab 40966 contentForClickedTab.addClass("-is-active"); 40967 //HYBRIS-12103 40968 if (contentForClickedTab.find(".grid-slider:not(.js-initialized)").length) { 40969 contentForClickedTab.find(".grid-slider").addClass("js-initialized"); 40970 setTimeout(function () { 40971 $(window).trigger("resize"); 40972 }, 1); 40973 } 40974 activeContent.removeClass("-is-active"); 40975 40976 //resize content, if viewpoint is 'small' 40977 if (window.innerWidth <= this.mediumViewpoint) { 40978 activeContent.css("max-height", 0); 40979 if (contentForClickedTab.length > 0) { 40980 contentForClickedTab.css("max-height", "unset"); 40981 } 40982 } 40983 } 40984 //scroll after height-animation has finished (500ms animation in scss) 40985 window.setTimeout(function () { 40986 var positionOfClickedTab = clickedTab.offset().top; 40987 var positionOfWindow = $(window).scrollTop(); 40988 if (positionOfClickedTab < positionOfWindow) { 40989 $("html, body").animate({ 40990 scrollTop: positionOfClickedTab - 67 40991 }, 50); 40992 } 40993 }, 500); 40994 } 40995 }]); 40996}(_SGComponent2.SGComponent); 40997window.theme.tabContent = new TabContent(); 40998 40999},{"SGComponent":83}],125:[function(require,module,exports){ 41000'use strict'; 41001 41002function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 41003Object.defineProperty(exports, "__esModule", { 41004 value: true 41005}); 41006exports.NavigationTabs = void 0; 41007var _SGComponent2 = require("SGComponent"); 41008function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 41009function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 41010function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 41011function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 41012function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
41013function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 41014function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 41015function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 41016function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 41017function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 41018function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 41019function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 41020function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 41021function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 41022function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 41023var NavigationTabs = exports.NavigationTabs = /*#__PURE__*/function (_SGComponent) { 41024 function NavigationTabs() { 41025 _classCallCheck(this, NavigationTabs); 41026 return _callSuper(this, NavigationTabs, arguments); 41027 } 41028 _inherits(NavigationTabs, _SGComponent); 41029 return _createClass(NavigationTabs, [{ 41030 key: "init", 41031 value: function init(container) { 41032 container = _superPropGet(NavigationTabs, "init", this, 3)([container]); 41033 var instance = this; 41034 $(container).find('.navigation-tabs').each(function () { 41035 var _self = this; 41036 $(this).find('.js-navigation-tabs-item').off('click.NavigationTabs'); 41037 $(this).find('.js-navigation-tabs-item').on('click.NavigationTabs', function (e) { 41038 var url = $(this).attr('href') || ''; 41039 if (url.substr(0, 1) == "#" || url == "") { 41040 e.preventDefault(); 41041 var section = $(this).attr('href').replace('#', ''); 41042 url = window.location.href.split('#'); 41043 if (section != "") { 41044 window.history.replaceState(null, null, url[0] + '#' + section); 41045 if (window.dataLayer) { 41046 window.dataLayer.push({ 41047 'element': 'navigationTabs', 41048 'event': 'click', 41049 'value': section 41050 }); 41051 } 41052 } 41053 } 41054 var rootNode = $(this).closest('.navigation-tabs'); 41055 rootNode.find('.js-navigation-tabs-item').removeClass('-active'); 41056 $(this).addClass('-active'); 41057 instance.getActiveElement(rootNode, true); 41058 var cb = $(_self).data('callback') || false; 41059 if (cb) { 41060 e.preventDefault(); 41061 var callback = JSON.parse(cb.replace(/\'/g, '"')); 41062 if (callback.event && callback.target) { 41063 $(callback.target).trigger(callback.event, $(_self).data('value')); 41064 } 41065 } 41066 }); 41067 var initialChange = $(this).data('initTrigger'); 41068 var trigger = false;
41069 if (typeof initialChange === 'undefined' || initialChange !== false) { 41070 trigger = true; 41071 } 41072 instance.getActiveElement($(this), trigger); 41073 }); 41074 } 41075 }, { 41076 key: "getActiveElement", 41077 value: function getActiveElement(ele, trigger) { 41078 var val = ''; 41079 ele.find('.js-navigation-tabs-item').each(function () { 41080 if ($(this).hasClass('-active')) { 41081 val = $(this).data('item') || $(this).text(); 41082 } 41083 }); 41084 ele.data('value', val); 41085 if (trigger) { 41086 ele.trigger('change', val); 41087 } 41088 return val; 41089 } 41090 }]); 41091}(_SGComponent2.SGComponent); 41092window.theme.navigationTabs = new NavigationTabs(); 41093 41094},{"SGComponent":83}],126:[function(require,module,exports){ 41095'use strict'; 41096 41097function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 41098Object.defineProperty(exports, "__esModule", { 41099 value: true 41100}); 41101exports.NavigationTabsBig = void 0; 41102var _SGComponent2 = require("SGComponent"); 41103function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 41104function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 41105function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 41106function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 41107function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 41108function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 41109function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 41110function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 41111function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 41112function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 41113function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 41114function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 41115function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 41116function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 41117function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 41118var NavigationTabsBig = exports.NavigationTabsBig = /*#__PURE__*/function (_
41118SGComponent) { 41119 function NavigationTabsBig() { 41120 _classCallCheck(this, NavigationTabsBig); 41121 return _callSuper(this, NavigationTabsBig, arguments); 41122 } 41123 _inherits(NavigationTabsBig, _SGComponent); 41124 return _createClass(NavigationTabsBig, [{ 41125 key: "init", 41126 value: function init(container) { 41127 container = _superPropGet(NavigationTabsBig, "init", this, 3)([container]); 41128 var _self = this; 41129 var module = $('.navigation-tabs.-big', container); 41130 module.each(function () { 41131 var moduleEle = this; 41132 $('.js-navigation-tabs-item', moduleEle).on('click.NavigationTabsBig', function (e) { 41133 _self.moveSliderToItem(moduleEle, $(this)); 41134 }); 41135 $(window).on('changed.zf.mediaquery', function (event, newSize, oldSize) { 41136 $('.js-navigation-tabs-slider', moduleEle).hide().delay(0).fadeIn(); 41137 }); 41138 }); 41139 $(window).resize(function () { 41140 module.each(function () { 41141 _self.updateSlider($(this)); 41142 }); 41143 }).trigger('resize'); 41144 } 41145 }, { 41146 key: "updateSlider", 41147 value: function updateSlider(moduleEle) { 41148 var activeItem = $('.js-navigation-tabs-item.-active', moduleEle); 41149 if (activeItem.length == 1) this.moveSliderToItem(moduleEle, $(activeItem)); 41150 } 41151 }, { 41152 key: "moveSliderToItem", 41153 value: function moveSliderToItem(moduleEle, tabEle) { 41154 var slider = $('.js-navigation-tabs-slider', moduleEle); 41155 var left = tabEle.offset().left - tabEle.parent().parent().offset().left; 41156 var top = tabEle.offset().top - tabEle.parent().parent().offset().top; 41157 if (!Foundation.MediaQuery.is('large up')) { 41158 slider.css('width', ''); 41159 slider.css('transform', "translate3d(0, ".concat(top, "px, 0)")); 41160 slider.css('height', tabEle.outerHeight() + 'px'); 41161 } else { 41162 slider.css('height', ''); 41163 slider.css('transform', "translate3d(".concat(left, "px , 0, 0)")); 41164 slider.css('width', tabEle.outerWidth() + 'px'); 41165 } 41166 } 41167 }]); 41168}(_SGComponent2.SGComponent); 41169window.theme.navigationTabsBig = new NavigationTabsBig(); 41170 41171},{"SGComponent":83}],127:[function(require,module,exports){ 41172'use strict'; 41173 41174function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 41175Object.defineProperty(exports, "__esModule", { 41176 value: true 41177}); 41178exports.SliderSteps = void 0; 41179var _SGComponent2 = require("SGComponent"); 41180require("FoundationCore.js"); 41181require("slick-carousel"); 41182function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 41183function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 41184function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 41185function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 41186function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 41187function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 41188function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 41189function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 41190function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 41191function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 41192function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 41193function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 41194function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 41195function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
41195 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 41196function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 41197var SliderSteps = exports.SliderSteps = /*#__PURE__*/function (_SGComponent) { 41198 function SliderSteps() { 41199 _classCallCheck(this, SliderSteps); 41200 return _callSuper(this, SliderSteps, arguments); 41201 } 41202 _inherits(SliderSteps, _SGComponent); 41203 return _createClass(SliderSteps, [{ 41204 key: "init", 41205 value: function init(container) { 41206 container = _superPropGet(SliderSteps, "init", this, 3)([container]); 41207 $(container).find('.slider-steps').each(function (i, element) { 41208 var $this = $(this); 41209 var isSlick = false; 41210 var isPhone = Foundation.MediaQuery.is('small only'); 41211 var settings = { 41212 infinite: false, 41213 slidesToShow: 1, 41214 slidesToScroll: 1 41215 }; 41216 var controlSlick = function controlSlick() { 41217 isPhone = Foundation.MediaQuery.is('small only'); 41218 if (!isPhone && isSlick) { 41219 setTimeout(function () { 41220 $this.slick('unslick'); 41221 }, 200); 41222 isSlick = false; 41223 } else if (isPhone && !isSlick) { 41224 setTimeout(function () { 41225 $this.slick(settings); 41226 }, 200); 41227 isSlick = true; 41228 } 41229 }; 41230 if (isPhone) { 41231 $this.slick(settings); 41232 isSlick = true; 41233 } 41234 $(window).on('resize.SliderSteps', controlSlick); 41235 }); 41236 } 41237 }]); 41238}(_SGComponent2.SGComponent); 41239window.theme.sliderSteps = new SliderSteps(); 41240 41241},{"FoundationCore.js":77,"SGComponent":83,"slick-carousel":35}],128:[function(require,module,exports){ 41242'use strict'; 41243 41244function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 41245Object.defineProperty(exports, "__esModule", { 41246 value: true 41247}); 41248exports.ContentOverlay = void 0; 41249var _SGComponent2 = require("SGComponent"); 41250var _bodyScrollLock = require("body-scroll-lock"); 41251function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 41252function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 41253function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 41254function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 41255function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 41256function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 41257function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 41258function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 41259function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 41260function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 41261function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 41262function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 41263function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 41264function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
41264 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 41265function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 41266var ContentOverlay = exports.ContentOverlay = /*#__PURE__*/function (_SGComponent) { 41267 function ContentOverlay() { 41268 _classCallCheck(this, ContentOverlay); 41269 return _callSuper(this, ContentOverlay, arguments); 41270 } 41271 _inherits(ContentOverlay, _SGComponent); 41272 return _createClass(ContentOverlay, [{ 41273 key: "init", 41274 value: function init(container) { 41275 container = _superPropGet(ContentOverlay, "init", this, 3)([container]); 41276 this.moduleClass = '.content-overlay'; 41277 this.moduleName = this.moduleClass.substr(1); 41278 this.modulePadding = 10; 41279 this.moduleMinHeight = 200; 41280 this.iframeMessageCallback = null; 41281 this.iframeDynamicHeight = null; 41282 this.iframeDynamicWidth = null; 41283 this.debounceHeight = null; 41284 this.debounceWidth = null; 41285 this.overruleQuit = false; 41286 $("[data-".concat(this.moduleName, "]"), container).each(this.initOverlayEvents.bind(this)); 41287 this.messageCallback = this.messageCallback.bind(this); 41288 } 41289 }, { 41290 key: "getOverlay", 41291 value: function getOverlay() { 41292 return $(this.moduleClass); 41293 } 41294 }, { 41295 key: "callback", 41296 value: function callback(func, type, data) { 41297 if (typeof func === 'function') { 41298 var r = func(type, data); 41299 return r === undefined ? true : r; 41300 } 41301 return true; 41302 } 41303 }, { 41304 key: "initOverlayEvents", 41305 value: function initOverlayEvents(_, linkEle) { 41306 linkEle = $(linkEle); 41307 var openOnInit = linkEle.attr('data-auto-open') !== undefined; 41308 switch (linkEle.data('contentOverlay')) { 41309 case 'id': 41310 this.addIdOverlayEvents(linkEle, openOnInit); 41311 break; 41312 case 'ajax': 41313 this.addAjaxOverlayEvents(linkEle, openOnInit); 41314 break; 41315 case 'iframe': 41316 this.addIframeOverlayEvents(linkEle, openOnInit); 41317 break; 41318 default: 41319 console.warn('Overlaykonfiguration unvollständig: ', linkEle); 41320 break; 41321 } 41322 } 41323 }, { 41324 key: "addIdOverlayEvents", 41325 value: function addIdOverlayEvents(ele) { 41326 var openOnInit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 41327 $(ele) 41328 // .off('click.ContentOverlay') 41329 .on('click.ContentOverlay', function (e) { 41330 var settings = this.getSettings(e.target); 41331 var contentLink = $(ele).data('content'); 41332 this.openIdOverlay(contentLink, settings); 41333 }.bind(this)); 41334 if (openOnInit) { 41335 $(ele).trigger('click'); 41336 } 41337 } 41338 }, { 41339 key: "openIdOverlay", 41340 value: function openIdOverlay(contentId, settings) { 41341 var contentEle, 41342 markup, 41343 m = ''; 41344 contentEle = $("[data-".concat(this.moduleName, "-id=").concat(contentId, "]")); 41345 settings = $.extend(this.getSettings($()), settings); 41346 switch (settings.behavior) { 41347 case 'clone': 41348 m = contentEle.clone(true).removeAttr('data-content-overlay-id'); 41349 break; 41350 case 'detach': 41351 m = contentEle.detach().removeAttr('data-content-overlay-id'); 41352 break; 41353 default: 41354 m = contentEle.html(); 41355 break; 41356 } 41357 markup = this.buildMarkup(m, settings, 'id', contentId); 41358 if (this.callback(settings.callback.beforeOpen, 'id', contentId)) { 41359 this.showOverlay(markup); 41360 this.addHistoryEvents(markup); 41361 this.toggleLoading(false); 41362 this.callback(settings.callback.opened, 'id', contentId); 41363 } 41364 } 41365 }, { 41366 key: "addAjaxOverlayEvents", 41367 value: function addAjaxOverlayEvents(ele) { 41368 var openOnInit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 41369 $(ele) 41370 // wird fehlerhafterweise viel zu oft aufgerufen 41371 // aber keine Zeit, das zu debuggen bzw. alle use cases zu testen 41372 .off('click.ContentOverlay').on('click.ContentOverlay', function (e) {
41373 var settings = this.getSettings(e.target); 41374 var contentLink = $(ele).data('content'); 41375 this.openAjaxOverlay(contentLink, settings); 41376 }.bind(this)); 41377 if (openOnInit) { 41378 $(ele).trigger('click'); 41379 } 41380 } 41381 }, { 41382 key: "openAjaxOverlay", 41383 value: function openAjaxOverlay(contentLink, settings) { 41384 settings = $.extend(this.getSettings($()), settings); 41385 var markup = this.buildMarkup('', settings, 'ajax', contentLink); 41386 if (this.callback(settings.callback.beforeOpen, 'ajax', contentLink)) { 41387 this.showOverlay(markup); 41388 this.addHistoryEvents(markup); 41389 $.ajax({ 41390 url: contentLink, 41391 timeout: 10000, 41392 dataType: 'html' 41393 }).then(this.showAjaxResponse.bind({ 41394 self: this, 41395 markup: markup, 41396 settings: settings, 41397 contentLink: contentLink 41398 })) 41399 // .catch(this.showError.bind(this)); 41400 ["catch"](function (jqXHR, textStatus, errorThrown) { 41401 console.error('Error loading content:', textStatus, errorThrown); 41402 }); 41403 } 41404 } 41405 }, { 41406 key: "showAjaxResponse", 41407 value: function showAjaxResponse(response) { 41408 var contentScriptTag = '', 41409 contentClass = 'co-' + Math.floor(Math.random() * 10000000); 41410 response = response.replace(/<script type="text\/co">[^<]+<\/script>/, function (match) { 41411 contentScriptTag = match; 41412 return ''; 41413 }); 41414 this.self.toggleLoading(false); 41415 $(".js-".concat(this.self.moduleName, "-scrollable"), this.self.getOverlay()).html(response); 41416 if (contentScriptTag) { 41417 contentScriptTag = contentScriptTag.replace('text/co', 'text/javascript'); 41418 contentScriptTag = contentScriptTag.replace(/\{\$container\}/g, "$('.".concat(contentClass, "')")); 41419 $(".js-".concat(this.self.moduleName, "-scrollable"), this.self.getOverlay()).addClass(contentClass); 41420 $(".js-".concat(this.self.moduleName, "-scrollable"), this.self.getOverlay()).append(contentScriptTag); 41421 } 41422 this.self.callback(this.settings.callback.opened, 'ajax', this.contentLink); 41423 } 41424 }, { 41425 key: "addIframeOverlayEvents", 41426 value: function addIframeOverlayEvents(ele) { 41427 var openOnInit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 41428 $(ele).on('click.ContentOverlay', function (e) { 41429 var settings = this.getSettings(e.target); 41430 var contentLink = $(ele).data('content'); 41431 this.openIframeOverlay(contentLink, settings); 41432 }.bind(this)); 41433 if (openOnInit) { 41434 $(ele).trigger('click'); 41435 } 41436 } 41437 }, { 41438 key: "openIframeOverlay", 41439 value: function openIframeOverlay(src, settings) { 41440 settings = $.extend(this.getSettings($()), settings); 41441 var iframe = this.buildIframe(src, settings.closeTabIndex ? settings.closeTabIndex + 1 : undefined); 41442 var markup = this.buildMarkup(iframe, settings, 'iframe', src); 41443 if (this.callback(settings.callback.beforeOpen, 'iframe', src)) { 41444 this.showOverlay(markup); 41445 this.addHistoryEvents(markup); 41446 this.bindIframeEvents(settings); 41447 } 41448 if (settings.callback.iframeMessage) { 41449 this.iframeMessageCallback = settings.callback.iframeMessage; 41450 window.addEventListener('message', this.messageCallback); 41451 } else { 41452 this.iframeMessageCallback = null; 41453 } 41454 this.iframeDynamicHeight = null; 41455 } 41456 }, { 41457 key: "messageCallback", 41458 value: function messageCallback(e) { 41459 if (this.iframeMessageCallback) { 41460 this.iframeMessageCallback(e.data || null); 41461 } 41462 if (e.data.removeListener) { 41463 window.removeEventListener('message', this.messageCallback); 41464 this.iframeMessageCallback = null; 41465 } 41466 if (e.data.closeOverlay) { 41467 this.closeOverlay(); 41468 } 41469 } 41470 }, { 41471 key: "bindIframeEvents", 41472 value: function bindIframeEvents(settings) { 41473 var _this = this; 41474 $(".js-".concat(this.moduleName, "-iframe"), this.moduleClass).on('load.ContentOverlay', function () { 41475 this.toggleLoading(false);
41476 this.recalculateIframeSize(settings); 41477 this.callback(settings.callback.opened, 'iframe', $(".js-".concat(this.moduleName, "-iframe"), this.moduleClass).attr('src')); 41478 }.bind(this)); 41479 $(".js-".concat(this.moduleName, "-iframe"), this.moduleClass).on('error.ContentOverlay', this.showError.bind(this)); 41480 $(window).off('resize.ContentOverlay').on('resize.ContentOverlay', function () { 41481 this.recalculateIframeSize(settings); 41482 }.bind(this)); 41483 $(window).trigger('resize'); 41484 if (settings.iframeSize === 'dynamic') { 41485 window.addEventListener('message', function (e) { 41486 var name = e.data[0]; 41487 var value = e.data[1]; 41488 var debounce = e.data[2] || 0; 41489 if (name === "setHeight.".concat(_this.moduleName)) { 41490 if (value !== _this.iframeDynamicHeight) { 41491 _this.iframeDynamicHeight = value; 41492 // do not allow to call this multiple times within debounce time 41493 if (_this.debounceHeight || debounce === 0) { 41494 clearTimeout(_this.debounceHeight); 41495 } 41496 _this.debounceHeight = setTimeout(function () { 41497 $(".js-content-overlay-header").toggleClass('hide', value !== 1000); 41498 _this.recalculateIframeSize(settings, value); 41499 }, debounce); 41500 } 41501 } else if (name === "setWidth.".concat(_this.moduleName)) { 41502 if (value !== _this.iframeDynamicWidth) { 41503 _this.iframeDynamicWidth = value; 41504 // do not allow to call this multiple times within debounce time 41505 if (_this.debounceWidth || debounce === 0) { 41506 clearTimeout(_this.debounceWidth); 41507 } 41508 _this.debounceWidth = setTimeout(function () { 41509 $(".".concat(_this.moduleName)).removeClass("-".concat(settings.width)); 41510 $(".".concat(_this.moduleName)).addClass("-".concat(value)); 41511 settings.width = value; 41512 }, debounce); 41513 } 41514 } else if (name === "close.".concat(_this.moduleName)) { 41515 $(".js-".concat(_this.moduleName, "-close")).trigger('click.ContentOverlay'); 41516 } else if (e.data === 'closeQSIWindow') { 41517 /* post message from qualtrics questionnaire which indicates that the questionnaire is finished */ 41518 _this.overruleQuit = true; 41519 } 41520 }); 41521 } 41522 } 41523 }, { 41524 key: "buildIframe", 41525 value: function buildIframe(src, tabindex) { 41526 var tabindexAttr = tabindex ? "tabindex=\"".concat(tabindex, "\"") : ''; 41527 return $("<iframe class=\"".concat(this.moduleName, "__iframe js-").concat(this.moduleName, "-iframe\" frameBorder=\"0\" src=\"").concat(src, "\" ").concat(tabindexAttr, " />")); 41528 } 41529 }, { 41530 key: "recalculateIframeSize", 41531 value: function recalculateIframeSize(settings) { 41532 var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 41533 var iframeHeight = 0; 41534 var overlayEle = $(this.moduleClass); 41535 var headerHeight = $(".js-".concat(this.moduleName, "-header"), overlayEle).outerHeight(); 41536 if (settings.iframeSize === 'dynamic') { 41537 if (data) { 41538 var staticOffset = 2; 41539 iframeHeight = data + headerHeight + staticOffset; 41540 } else { 41541 return; 41542 } 41543 } else { 41544 var iframeSizes = { 41545 medium: 0.5, 41546 small: 0.2 41547 }; 41548 var scrollContainerMargin = parseInt($(".js-".concat(this.moduleName, "-scrollable"), overlayEle).css('margin-bottom')); 41549 if (typeof iframeSizes[settings.iframeSize] !== 'undefined') { 41550 iframeHeight = overlayEle.outerHeight() * iframeSizes[settings.iframeSize]; 41551 } else if (Foundation.MediaQuery.is('small only')) { 41552 iframeHeight = overlayEle.outerHeight(); 41553 } else { 41554 iframeHeight = overlayEle.outerHeight() * 0.9; 41555 } 41556 iframeHeight = iframeHeight - scrollContainerMargin - headerHeight - this.modulePadding * 2; 41557 if (iframeHeight < this.moduleMinHeight - headerHeight - scrollC
41557ontainerMargin) { 41558 iframeHeight = this.moduleMinHeight - headerHeight - scrollContainerMargin; 41559 } 41560 } 41561 $(".js-".concat(this.moduleName, "-iframe"), overlayEle).css('min-height', iframeHeight + 'px'); 41562 } 41563 }, { 41564 key: "getSettings", 41565 value: function getSettings(ele) { 41566 var settings = { 41567 exitBar: true, 41568 width: '', 41569 iframeSize: 0, 41570 behavior: 'html', 41571 callback: { 41572 opened: null, 41573 beforeOpen: null, 41574 beforeClose: null, 41575 closed: null 41576 }, 41577 closeTabIndex: null, 41578 focusTrap: null 41579 }; 41580 var w = $(ele).data('width') || ''; 41581 var h = $(ele).data('iframe') || ''; 41582 var c = $(ele).data('behavior') || 'html'; 41583 var e = $(ele).data('callback') || {}; 41584 var x = $(ele).data('exitBar'); 41585 var closeTabIndex = $(ele).data('closeTabIndex') || null; 41586 var focusTrap = $(ele).data('focusTrap') || null; 41587 var events = $(ele).data('events'); 41588 if (typeof events !== 'undefined') { 41589 settings.callback = { 41590 opened: events.hasOwnProperty('opened') ? function () { 41591 return $(ele).trigger('opened'); 41592 } : null, 41593 beforeOpen: events.hasOwnProperty('beforeOpen') ? function () { 41594 return $(ele).trigger('beforeOpen'); 41595 } : null, 41596 beforeClose: events.hasOwnProperty('beforeClose') ? function () { 41597 return $(ele).trigger('beforeClose'); 41598 } : null, 41599 closed: events.hasOwnProperty('closed') ? function () { 41600 return $(ele).trigger('closed'); 41601 } : null 41602 }; 41603 } 41604 if ($.inArray(w, ['small', 'large']) > -1) { 41605 settings.width = w; 41606 } 41607 if ($.inArray(h, ['small', 'large', 'dynamic']) > -1) { 41608 settings.iframeSize = h; 41609 } else { 41610 settings.iframeSize = 'medium'; 41611 } 41612 if ($.inArray(c, ['html', 'clone', 'detach']) > -1) { 41613 settings.behavior = c; 41614 } 41615 if (e.hasOwnProperty('event') && e.hasOwnProperty('data') && e.hasOwnProperty('target')) { 41616 settings.event = e; 41617 } 41618 if (typeof x !== 'undefined') { 41619 settings.exitBar = x; 41620 } 41621 if (closeTabIndex !== null) { 41622 settings.closeTabIndex = closeTabIndex; 41623 } 41624 if (focusTrap !== null) { 41625 settings.focusTrap = focusTrap; 41626 } 41627 return settings; 41628 } 41629 }, { 41630 key: "showError", 41631 value: function showError() { 41632 $(".js-".concat(this.moduleName, "-scrollable"), this.getOverlay()).html(''); 41633 this.getOverlay().addClass('-error').removeClass('-loading'); 41634 } 41635 }, { 41636 key: "toggleLoading", 41637 value: function toggleLoading(loading) { 41638 if (loading) { 41639 this.getOverlay().addClass('-loading'); 41640 } else { 41641 this.getOverlay().removeClass('-loading'); 41642 } 41643 } 41644 }, { 41645 key: "showOverlay", 41646 value: function showOverlay(markup) { 41647 var $body = $('body'); 41648 // add scroll blocking on ios while overlay is open 41649 $body.addClass('block-scroll'); 41650 this.getOverlay().remove(); 41651 41652 // ECFE-1480 41653 // Overlay vorher schließen 41654 if (!!document.querySelector('.js-content-overlay-wrapper')) { 41655 window.theme.contentOverlay.closeOverlay(); 41656 } 41657 41658 // PopUp vorher schließen 41659 if (!!document.querySelector('.mfp-container')) { 41660 $.magnificPopup.close(); 41661 } 41662 $body.prepend(markup); 41663 var scrollElement = $(".js-".concat(this.moduleName, "-scrollable"), this.getOverlay()).get(0); 41664 var scrollPos = $(window).scrollTop(); 41665 (0, _bodyScrollLock.disableBodyScroll)(scrollElement, { 41666 reserveScrollBarGap: true 41667 }); 41668 41669 // Workaround um die scrollPosition beizubehalten 41670 var found = false; 41671 var interval = window.setInterval(function () { 41672 var hidden = $('body').css('overflow') === 'hidden'; 41673 if (hidden && found) { 41674 window.clearInterval(interval); 41675 $(window).scrollTop(scrollPos); 41676 } else if (hidden) { 41677 found = true; 41678 } 41679 }, 0); 41680 $(window).on('resize.ContentOverlay', function () { 41681 window.document.body.height = window.innerHeight; 41682 }); 41683 $(document).trigger('content-overlay-open'); 41684 return this.getOverlay(); 41685 } 41686 }, { 41687 key: "closeOverlay", 41688 value: function closeOverlay() { 41689 // this removes scroll blocking, while overlay is open on ios. 41690 $('body').removeClass('block-scroll'); 41691 var settings = this.getOverlay().data('settings'), 41692 type = this.getOverlay().data('type'), 41693 data = this.getOverlay().data('data'); 41694 window.history.replaceState({}, window.document.title, window.location.href); 41695 $(window).off('resize.ContentOverlay'); 41696 $(window.document).off('keyup.ContentOverlay'); 41697 (0, _bodyScrollLock.clearAllBodyScrollLocks)(); 41698 this.callback(settings.callback.closed, type, data); 41699 this.getOverlay().remove(); 41700 $(document).trigger('content-overlay-closed'); 41701 } 41702 }, { 41703 key: "addHistoryEvents", 41704 value: function addHistoryEvents() { 41705 $(window).off('popstate.ContentOverlay'); 41706 window.history.pushState({ 41707 overlay: true 41708 }, window.document.title, window.location.href); 41709 41710 // timeout verhindert das doppelte triggern von popstate 41711 window.setTimeout(function () { 41712 $(window).on('popstate.ContentOverlay', function () { 41713 if (this.getOverlay().length > 0) { 41714 var settings = this.getOverlay().data('settings'), 41715 type = this.getOverlay().data('type'), 41716 data = this.getOverlay().data('data'); 41717 if (this.callback(settings.callback.beforeClose, type, data)) { 41718 this.closeOverlay(); 41719 } 41720 } 41721 }.bind(this)); 41722 }.bind(this), 100); 41723 } 41724 }, { 41725 key: "buildMarkup", 41726 value: function buildMarkup(content, settings, type, data) { 41727 var mClass = this.moduleName; 41728 var width = settings.width ? '-' + settings.width : ''; 41729 var handlesCloseInMarkup = settings.exitBar; 41730 var closeTabIndexMarkup = settings.closeTabIndex ? "tabindex=\"".concat(settings.closeTabIndex, "\"") : ''; 41731 var markup = $("\n <div class=\"".concat(mClass, " ").concat(width, " -loading js-").concat(mClass, "-close\">\n <div class=\"").concat(mClass, "__wrapper js-").concat(mClass, "-wrapper\">\n <div class=\"").concat(mClass, "__header js-").concat(mClass, "-header ").concat(handlesCloseInMarkup ? '' : 'hide', "\">\n <div class=\"").concat(mClass, "__close js-").concat(mClass, "-close\" role=\"button\" aria-label=\"Overlay schlie\xDFen\" ").concat(closeTabIndexMarkup, "></div>\n </div>\n <div class=\"").concat(mClass, "__container js-").concat(mClass, "-scrollable\"></div>\n </div>\n </div>\n ")); 41732 this.addOverlayEvents(markup); 41733 if (content) { 41734 $(content).prependTo($(".js-".concat(mClass, "-scrollable"), markup)); 41735 } 41736 markup.data('settings', settings); 41737 markup.data('type', type); 41738 markup.data('data', data); 41739 return markup; 41740 } 41741 }, { 41742 key: "addOverlayEvents", 41743 value: function addOverlayEvents(markup) { 41744 $(".js-".concat(this.moduleName, "-close"), markup).add(markup).on('click.ContentOverlay', function (e) { 41745 var settings = this.getOverlay().data('settings'), 41746 type = this.getOverlay().data('type'), 41747 data = this.getOverlay().data('data'); 41748 if (e.target === e.currentTarget && (this.overruleQuit || this.callback(settings.callback.beforeClose, type, data))) { 41749 this.closeOverlay(); 41750 if (settings.iframeSize !== 'dynamic') { 41751 window.history.back(); 41752 } 41753 } 41754 }.bind(this)).on('keydown', function (e) { 41755 if (e.keyCode == 13) { 41756 e.preventDefault(); 41757 this.closeOverlay(); 41758 } 41759 }.bind(this)); // Added .bind(this) to ensure the correct context 41760 41761 $(window.document).on('keyup.ContentOverlay', function (e) { 41762 var settings = this.getOverlay().data('settings'), 41763 type = this.getOverlay().data('type'), 41764 data = this.getOverlay().data('data'); 41765 if (e.keyCode == 27 && this.getOverlay().length > 0 && this.callback(settings.callback.beforeClose, type, data)) { 41766 this.closeOverlay(); 41767 window.history.back(); 41768 } 41769 }.bind(this)); 41770 } 41771 }]); 41772}(_SGComponent2.SGComponent); 41773window.theme.contentOverlay = new ContentOverlay(); 41774 41775},{"SGComponent":83,"body-scroll-lock":6}],129:[function(require,module,exports){ 41776'use strict'; 41777 41778function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 41779Object.defineProperty(exports, "__esModule", { 41780 value: true 41781}); 41782exports["default"] = void 0; 41783var _es6Promise = require("es6-promise/dist/es6-promise.js"); 41784var _EventEmitter = _interopRequireDefault(require("EventEmitter")); 41785var _EventComponent2 = _interopRequireDefault(require("EventComponent")); 41786var _Utils = require("Utils"); 41787var _Geolocation = require("Geolocation"); 41788var _Gmaps = require("Gmaps.js");
41789function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 41790function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 41791function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 41792function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 41793function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 41794function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 41795function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 41796function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 41797function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 41798function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 41799function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 41800function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 41801function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 41802function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 41803function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 41804function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 41805function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 41806var LocationSearchModule = exports["default"] = /*#__PURE__*/function (_EventComponent) { 41807 function LocationSearchModule(ele, eventGroup) { 41808 var _this; 41809 _classCallCheck(this, LocationSearchModule); 41810 _this = _callSuper(this, LocationSearchModule, [ele, eventGroup]); 41811 _this.url = _this.ele.data('url'); 41812 _this.submitUrl = _this.ele.data('submit'); 41813 _this.geoLocationButton = _this.ele.find('.js-location-search-geolocation'); 41814 _this.inputField = _this.ele.find('.js-location-search-input'); 41815 _this.messageContainer = _this.ele.find('.js-location-search-messages'); 41816 _this.ele.find('.js-location-search-radius').val($(_this.ele).data('distance') || ''); 41817 var searchFeatures = $(_this.ele).data('features'); 41818 if (searchFeatures) { 41819 _this.ele.find('.location-search__shops input[type=checkbox]').each(function () { 41820 if (searchFeatures.includes($(this).attr('name'))) { 41821 $(this).attr('checked', true); 41822 } 41823 }); 41824 } 41825 _this.options = { 41826 displayInPopup: $(_this.ele).data('displayPopup') 41827 }; 41828 _this.ele.find('.js-location-search-submit').on("click.".concat(_this.name), _this.prepareAndSubmitForm.bind(_this)); 41829 _this.geoLocationButton.on("click.".concat(_this.name), _this.getGeolocation.bind(_this)); 41830 _this.initializeFoundation(); 41831 _this.disableGeolocation(); 41832 var hostName = window.location.hostname || null; 41833 var channel = _this.ele.data('channel') || null; 41834 var mapsApi = _this.ele.data('mapsApi') || (0, _Gmaps.getApiUrl)(hostName, channel); 41835 if (mapsApi) { 41836 (0, _Utils.loadScript)(mapsApi).then(function () { 41837 //if input field is prefilled, trigger form submission automatically 41838 if (_this.inputField.val()) {
41839 _this.prepareAndSubmitForm(); 41840 } 41841 }); 41842 _this.registerListener(); 41843 } 41844 return _this; 41845 } 41846 _inherits(LocationSearchModule, _EventComponent); 41847 return _createClass(LocationSearchModule, [{ 41848 key: "registerListener", 41849 value: function registerListener() { 41850 var _this2 = this; 41851 _superPropGet(LocationSearchModule, "registerListener", this, 3)([[{ 41852 event: 'updateGeolocation', 41853 namespace: 'LocationMapModule', 41854 callback: this.processGeolocation.bind(this) 41855 }]]); 41856 41857 /** 41858 * enter should trigger form submission 41859 */ 41860 this.inputField.on('keyup.LocationSearchModule', function (e) { 41861 if (e.keyCode === 13) { 41862 _this2.prepareAndSubmitForm(); 41863 } 41864 }); 41865 } 41866 }, { 41867 key: "initializeFoundation", 41868 value: function initializeFoundation() { 41869 if (this.options.displayInPopup) { 41870 $(this.ele).foundation(); 41871 } 41872 } 41873 }, { 41874 key: "toggleForm", 41875 value: function toggleForm() { 41876 var disable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; 41877 if (disable) { 41878 this.closeTab(); 41879 } 41880 this.ele.find('input, button').each(function () { 41881 var ele = $(this); 41882 ele.attr('disabled', disable); 41883 if (ele.hasClass('js-location-search-submit')) { 41884 if (disable) { 41885 ele.addClass('-loading'); 41886 } else { 41887 ele.removeClass('-loading'); 41888 } 41889 } 41890 }); 41891 } 41892 }, { 41893 key: "getGeolocation", 41894 value: function getGeolocation() { 41895 var _this3 = this; 41896 this.toggleForm(); 41897 (0, _Geolocation.getCurrentPosition)(function (position) { 41898 _this3.processGeolocation({ 41899 latitude: position.coords.latitude, 41900 longitude: position.coords.longitude 41901 }); 41902 }, function (err) { 41903 _this3.toggleMessage(err.message, "error"); 41904 _this3.toggleForm(false); 41905 }); 41906 } 41907 }, { 41908 key: "clearMessages", 41909 value: function clearMessages() { 41910 this.messageContainer.html(""); 41911 } 41912 }, { 41913 key: "toggleMessage", 41914 value: function toggleMessage(msg) { 41915 var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "success"; 41916 this.clearMessages(); 41917 this.messageContainer.append("\n <div class=\"status-message ".concat(status === 'success' ? '-success' : '-error', "\">\n <span class=\"status-message__text\"><i class=\"fa fa-lg status-message__icon\" aria-hidden=\"true\"></i>").concat(msg, "</span>\n </div>\n ")); 41918 } 41919 }, { 41920 key: "processGeolocation", 41921 value: function processGeolocation(res) { 41922 var _this4 = this; 41923 this.inputField.val(""); 41924 this.collectFormData(false).then(function (data) { 41925 _extends(data, res); 41926 _this4.submitForm(data); 41927 })["catch"](function (e) { 41928 _this4.toggleMessage(e.msg, e.status); 41929 _this4.toggleForm(false); 41930 _this4.inputField.focus(); 41931 }); 41932 } 41933 }, { 41934 key: "disableGeolocation", 41935 value: function disableGeolocation() { 41936 if (!_Geolocation.gps) { 41937 this.geoLocationButton.hide(); 41938 } 41939 } 41940 }, { 41941 key: "collectFormData", 41942 value: function collectFormData() { 41943 var _this5 = this; 41944 var respectInput = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; 41945 var queryParams = { 41946 distance: this.ele.find('.js-location-search-radius').val() || 10, 41947 productCode: this.ele.data('productCode') || '', 41948 shopBrand: this.ele.data('shopBrand') || '', 41949 features: [] 41950 }; 41951 this.ele.find('.location-search__shops input:checked').each(function (index, ele) { 41952 queryParams.features.push($(ele).attr('name')); 41953 }); 41954 return new _es6Promise.Promise(function (resolve, reject) { 41955 if (respectInput) { 41956 if (_this5.inputField.val()) { 41957 // Convert entered location into geodata 41958 var geocoder = new window.google.maps.Geocoder(); 41959 geocoder.geocode({ 41960 'address': _this5.inputField.val(), 41961 'region': 'de' 41962 }, function (results, status) { 41963 // Error in case no location found 41964 if (status !== window.google.maps.GeocoderStatus.OK) { 41965 reject({ 41966 msg: "Ihre Eingabe wurde leider nicht erkannt. Bitte geben Sie einen Ort oder eine PLZ ein.", 41967 status: "error" 41968 }); 41969 } 41970 _this5.inputField.val(results[0].formatted_address); 41971 resolve(_extends(queryParams, { 41972 latitude: results[0].geometry.location.lat(), 41973 longitude: results[0].geometry.location.lng() 41974 })); 41975 }); 41976 } else { 41977 reject({ 41978 msg: "Bitte geben Sie einen Ort oder eine Postleitzahl ein.", 41979 status: "error" 41980 }); 41981 } 41982 } else { 41983 resolve(queryParams); 41984 } 41985 }); 41986 } 41987 }, { 41988 key: "closeTab", 41989 value: function closeTab() { 41990 var accordion = this.ele.find('.accordion'); 41991 accordion.foundation('up', accordion.find('.accordion-content:first')); 41992 } 41993 }, { 41994 key: "submitForm", 41995 value: function submitForm(data) { 41996 var _this6 = this; 41997 this.clearMessages(); 41998 if (this.submitUrl) { 41999 window.location = "".concat(this.submitUrl).concat((0, _Utils.urlQueryString)(data)); 42000 return false;
42001 } else { 42002 return $.get({ 42003 url: "".concat(this.url).concat((0, _Utils.urlQueryString)(data)), 42004 dataType: 'json' 42005 }).then(function (result) { 42006 _this6.toggleForm(false); 42007 if (result.results.length === 0) { 42008 _this6.toggleMessage("Für diese Suche wurde leider kein Ergebnis gefunden.<br>Bitte geben Sie eine andere Postleitzahl/Stadt ein oder wählen Sie einen größeren Umkreis.", "error"); 42009 } 42010 _EventEmitter["default"].emit(_this6.getEventQualifier('update', 'LocationSearchModule'), { 42011 result: result, 42012 params: data 42013 }); 42014 })["catch"](function () { 42015 return new _es6Promise.Promise(function (resolve, reject) { 42016 reject({ 42017 msg: "Der Service ist zur Zeit nicht verfügbar. Bitte versuchen Sie es später erneut.", 42018 status: "error" 42019 }); 42020 }); 42021 }); 42022 } 42023 } 42024 }, { 42025 key: "prepareAndSubmitForm", 42026 value: function prepareAndSubmitForm() { 42027 var _this7 = this; 42028 this.toggleForm(); 42029 this.collectFormData().then(function (data) { 42030 return _this7.submitForm(data); 42031 })["catch"](function (e) { 42032 _this7.toggleMessage(e.msg, e.status); 42033 _this7.toggleForm(false); 42034 _this7.inputField.focus(); 42035 }); 42036 } 42037 }]); 42038}(_EventComponent2["default"]); 42039 42040},{"EventComponent":73,"EventEmitter":74,"Geolocation":80,"Gmaps.js":81,"Utils":84,"es6-promise/dist/es6-promise.js":11}],130:[function(require,module,exports){ 42041'use strict'; 42042 42043function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 42044Object.defineProperty(exports, "__esModule", { 42045 value: true 42046}); 42047exports.LocationSearch = void 0; 42048var _SGComponent2 = require("SGComponent"); 42049var _10LocationSearchModule = _interopRequireDefault(require("./_10.location-search-module.js")); 42050function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 42051function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 42052function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 42053function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 42054function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 42055function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 42056function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 42057function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 42058function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 42059function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 42060function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 42061function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 42062function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 42063function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 42064function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
42064 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 42065function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 42066var LocationSearch = exports.LocationSearch = /*#__PURE__*/function (_SGComponent) { 42067 function LocationSearch() { 42068 _classCallCheck(this, LocationSearch); 42069 return _callSuper(this, LocationSearch, arguments); 42070 } 42071 _inherits(LocationSearch, _SGComponent); 42072 return _createClass(LocationSearch, [{ 42073 key: "initialize", 42074 value: function initialize() { 42075 _superPropGet(LocationSearch, "initialize", this, 3)([]); 42076 } 42077 }, { 42078 key: "init", 42079 value: function init(container) { 42080 container = _superPropGet(LocationSearch, "init", this, 3)([container]); 42081 $(container).find('.location-search').each(function () { 42082 new _10LocationSearchModule["default"](this, $(this).data('eventGroup')); 42083 }); 42084 } 42085 }]); 42086}(_SGComponent2.SGComponent); 42087window.theme.locationSearch = new LocationSearch(); 42088 42089},{"./_10.location-search-module.js":129,"SGComponent":83}],131:[function(require,module,exports){ 42090'use strict'; 42091 42092function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 42093Object.defineProperty(exports, "__esModule", { 42094 value: true 42095}); 42096exports["default"] = void 0; 42097var _EventEmitter = _interopRequireDefault(require("EventEmitter")); 42098var _EventComponent2 = _interopRequireDefault(require("EventComponent")); 42099function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 42100function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 42101function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 42102function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 42103function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 42104function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 42105function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 42106function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 42107function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 42108function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 42109function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 42110function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 42111function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 42112function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 42113function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
42113 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 42114function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 42115var LocationResultsModule = exports["default"] = /*#__PURE__*/function (_EventComponent) { 42116 function LocationResultsModule(ele, eventGroup) { 42117 var _this; 42118 _classCallCheck(this, LocationResultsModule); 42119 _this = _callSuper(this, LocationResultsModule, [ele, eventGroup]); 42120 _this.resultEntries = []; 42121 _this.resultListTitleNode = _this.ele.find('.js-show-location-results'); 42122 _this.resultListContentNode = _this.ele.find('.js-location-results-list'); 42123 _this.accordionNode = _this.ele.find('.accordion'); 42124 _this.features = { 42125 "Handyankauf": { 42126 title: "Ankauf-Service", 42127 description: "Wir kaufen Ihr altes Handy.<br>Wir machen Ihnen ein faires Angebot.", 42128 iconCls: "-ankaufservice" 42129 }, 42130 "Rechnung bar bezahlen": { 42131 title: "Barzahlen", 42132 description: "Kaufen Sie online ein und<br>zahlen bei uns Ihre Rechnung in bar.", 42133 iconCls: "-barzahlen" 42134 }, 42135 "Repairannahme": { 42136 title: "Reparaturannahme", 42137 description: "Wir nehmen Ihr defektes Handy an und<br>reparieren es schnell und zuverlässig.", 42138 iconCls: "-reparaturannahme" 42139 }, 42140 "Repairstation": { 42141 title: "Repair-Techniker vor Ort", 42142 description: "In Über 30 Shops mit Repairpoint<br>ist eine Sofort-Reperatur möglich.", 42143 iconCls: "-repairvorort" 42144 } 42145 }; 42146 _this.options = { 42147 displayInPopup: $(_this.ele).data('displayPopup') 42148 }; 42149 _this.initializeFoundation(); 42150 _this.registerEventListener(); 42151 return _this; 42152 } 42153 _inherits(LocationResultsModule, _EventComponent); 42154 return _createClass(LocationResultsModule, [{ 42155 key: "registerEventListener", 42156 value: function registerEventListener() { 42157 _superPropGet(LocationResultsModule, "registerListener", this, 3)([[{ 42158 event: 'update', 42159 namespace: 'LocationSearchModule', 42160 callback: this.renderResultList.bind(this) 42161 }]]); 42162 } 42163 }, { 42164 key: "initializeFoundation", 42165 value: function initializeFoundation() { 42166 if (this.options.displayInPopup) { 42167 $(this.ele).foundation(); 42168 } 42169 } 42170 }, { 42171 key: "toggleTab", 42172 value: function toggleTab() { 42173 var status = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'up'; 42174 if (!this.accordionNode.data('zfPlugin')) { 42175 this.initializeFoundation(); 42176 } 42177 this.accordionNode.foundation(status, this.accordionNode.find('.accordion-content:first')); 42178 } 42179 }, { 42180 key: "clearResultList", 42181 value: function clearResultList() { 42182 this.resultListTitleNode.html("0 Ergebnisse"); 42183 this.resultListContentNode.html(""); 42184 } 42185 }, { 42186 key: "resetResultList", 42187 value: function resetResultList() { 42188 this.toggleTab(); 42189 this.clearResultList(); 42190 this.resultEntries.length = 0; 42191 } 42192 }, { 42193 key: "openMarker", 42194 value: function openMarker(e) { 42195 e.preventDefault(); 42196 _EventEmitter["default"].emit(this.getEventQualifier('openMarkerPopup', 'LocationMapModule'), $(e.currentTarget).parent().index()); 42197 } 42198 }, { 42199 key: "removeClickListener", 42200 value: function removeClickListener() { 42201 this.resultListContentNode.find('.js-location-results-open-marker').off('click', this.openMarker.bind(this)); 42202 } 42203 }, { 42204 key: "addClickListener", 42205 value: function addClickListener() { 42206 this.removeClickListener(); 42207 this.resultListContentNode.find('.js-location-results-open-marker').on('click', this.openMarker.bind(this)); 42208 } 42209 }, { 42210 key: "initTooltips", 42211 value: function initTooltips() { 42212 window.theme.toolTipExt.init(this.resultListContentNode); 42213 } 42214 }, { 42215 key: "populateResultList", 42216 value: function populateResultList() { 42217 this.ele.show(); 42218 this.resultListTitleNode.html("".concat(this.resultEntries.length, " Ergebnis").concat(this.resultEntries.length !== 1 ? 'se' : '', ".")); 42219 this.resultListContentNode.html(this.resultEntries.join('')); 42220 this.initTooltips(); 42221 this.addClickListener(); 42222 if (this.resultEntries.length) { 42223 this.toggleTab('down'); 42224 } 42225 } 42226 }, { 42227 key: "getFeatures", 42228 value: function getFeatures(store) { 42229 var _this2 = this; 42230 if (store.features) { 42231 return "\n <div class=\"location-results__shop-icons\">\n ".concat(Object.keys(store.features).filter(function (feature) { 42232 return _this2.features[feature] !== null && typeof _this2.features[feature] !== 'undefined'; 42233 }).map(function (feature) {
42234 return "\n <span data-tooltip-ext data-tip-text=\"<p class="paragraph -bold -no-margin-bottom">".concat(_this2.features[feature].title, "</p><p class="paragraph">").concat(_this2.features[feature].description, "</p>\" aria-haspopup=\"true\" class=\"has-tip-ext top -no-marker\" data-disable-hover=\"false\">\n ").concat(_this2.createIcon(store, _this2.features[feature].iconCls), "\n </span>\n "); 42235 }).join(''), "\n </div>\n "); 42236 } 42237 return ""; 42238 } 42239 }, { 42240 key: "pushInteractionEvent", 42241 value: function pushInteractionEvent() { 42242 var event = { 42243 "event": "component_interaction", 42244 "Komponente": "Shopsuche Ergebnisliste", 42245 "Aktion": "Termin vereinbaren", 42246 "Kontext": "Navigation" 42247 }; 42248 if (window.dataLayer) { 42249 window.dataLayer.push(event); 42250 } 42251 } 42252 }, { 42253 key: "createResultEntry", 42254 value: function createResultEntry(store) { 42255 var storeHtml = "\n <div class=\"location-results__result-container\">\n <div class=\"location-results__shop-name js-location-results-open-marker\">\n <a href=\"#\" class=\"link-text -color-secondary\">\n <strong>".concat(store.displayName, "</strong>\n </a>\n </div>\n <div class=\"location-results__shop-data\">\n <div class=\"location-results__shop-address\">\n <ul class=\"list-unordered -no-list-style\">\n ").concat(store.address.remarks ? "<li>".concat(store.address.remarks, "</li>") : "", "\n <li>").concat(store.address.line1, " ").concat(store.address.streetnumber, "</li>\n <li>").concat(store.address.postalCode, " ").concat(store.address.town, "</li>\n </ul>\n </div>\n ").concat(this.getFeatures(store), "\n </div>\n <p class=\"paragraph -no-margin-bottom -color-primary pt-3\">\n <i class=\"fas fa-custom-angle-link -right fa-lg -no-padding\"></i>\n <a class=\"js-shop-info-link-interaction-marker\" href=\"").concat(store.address.url, "#/#baa\" target=\"_blank\" data-shopID=\"").concat(store.vpId, "\"> Termin vereinbaren</a>\n </p>\n </div>"); 42256 this.resultEntries.push(storeHtml); 42257 } 42258 }, { 42259 key: "createIcon", 42260 value: function createIcon(store, icon) { 42261 var servicePricelistLinkHtmlOpen = ''; 42262 var servicePricelistLinkHtmlClose = ''; 42263 if (!this.isEmpty(store.servicePricelistLink)) { 42264 servicePricelistLinkHtmlOpen = "<a href=\"".concat(store.servicePricelistLink, "\" target=\"_blank\">"); 42265 servicePricelistLinkHtmlClose = "</a>"; 42266 } 42267 return "".concat(servicePricelistLinkHtmlOpen, "<div class=\"location-results__icon ").concat(icon, "\"></div>").concat(servicePricelistLinkHtmlClose); 42268 } 42269 }, { 42270 key: "renderResultList", 42271 value: function renderResultList(data) { 42272 var _this3 = this; 42273 this.resetResultList(); 42274 $.each(data.result.results, function (index, store) { 42275 _this3.createResultEntry(store); 42276 $(document).on('click', '.js-shop-info-link-interaction-marker[data-shopID=' + store.vpId + ']', function () { 42277 _this3.pushInteractionEvent(); 42278 }); 42279 }); 42280 this.populateResultList(); 42281 } 42282 }, { 42283 key: "isEmpty", 42284 value: function isEmpty(str) { 42285 return !str || 0 === str.length; 42286 } 42287 }]); 42288}(_EventComponent2["default"]); 42289 42290},{"EventComponent":73,"EventEmitter":74}],132:[function(require,module,exports){ 42291'use strict'; 42292 42293function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 42294Object.defineProperty(exports, "__esModule", { 42295 value: true 42296}); 42297exports.LocationResults = void 0; 42298var _SGComponent2 = require("SGComponent"); 42299var _20LocationResultsModule = _interopRequireDefault(require("./_20.location-results-module.js"));
vendor: 4,970 bytes, lines 42300-42352
42300function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 42301function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 42302function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 42303function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 42304function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 42305function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 42306function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 42307function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 42308function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 42309function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 42310function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 42311function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 42312function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 42313function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 42314function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 42315function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 42316var LocationResults = exports.LocationResults = /*#__PURE__*/function (_SGComponent) { 42317 function LocationResults() { 42318 _classCallCheck(this, LocationResults); 42319 return _callSuper(this, LocationResults, arguments); 42320 } 42321 _inherits(LocationResults, _SGComponent); 42322 return _createClass(LocationResults, [{ 42323 key: "initialize", 42324 value: function initialize() { 42325 _superPropGet(LocationResults, "initialize", this, 3)([]); 42326 } 42327 }, { 42328 key: "init", 42329 value: function init(container) { 42330 container = _superPropGet(LocationResults, "init", this, 3)([container]); 42331 $(container).find('.location-results').each(function () { 42332 new _20LocationResultsModule["default"](this, $(this).data('eventGroup')); 42333 }); 42334 } 42335 }]); 42336}(_SGComponent2.SGComponent); 42337window.theme.locationResults = new LocationResults(); 42338 42339},{"./_20.location-results-module.js":131,"SGComponent":83}],133:[function(require,module,exports){ 42340'use strict'; 42341 42342function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 42343Object.defineProperty(exports, "__esModule", { 42344 value: true 42345}); 42346exports["default"] = void 0; 42347var _markerclusterer = _interopRequireDefault(require("@google/markerclustererplus/src/markerclusterer")); 42348var _EventEmitter = _interopRequireDefault(require("EventEmitter")); 42349var _EventComponent2 = _interopRequireDefault(require("EventComponent")); 42350var _jsCookie = _interopRequireDefault(require("js-cookie")); 42351var _Utils = require("Utils"); 42352var _Gmaps = require("Gmaps.js");
42353function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 42354function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } 42355function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 42356function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 42357function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 42358function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 42359function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 42360function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 42361function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 42362function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 42363function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 42364function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 42365function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 42366function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 42367function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 42368function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 42369function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 42370var LocationMapModule = exports["default"] = /*#__PURE__*/function (_EventComponent) { 42371 function LocationMapModule(ele, eventGroup) { 42372 var _this; 42373 _classCallCheck(this, LocationMapModule); 42374 _this = _callSuper(this, LocationMapModule, [ele, eventGroup]); 42375 _this.id = (0, _Utils.uuid)(); 42376 _this.map = null; 42377 _this.markerCluster = null; 42378 _this.markers = []; 42379 _this.infoWindows = []; 42380 _this.placeholders = []; 42381 _this.options = { 42382 showSelectStoreLink: _this.ele.data('showSelectStore'), 42383 bookAnAppointment: _this.ele.data('bookAnAppointment'), 42384 selectStoreURL: _this.ele.data('selectStoreUrl'), 42385 map: { 42386 center: { 42387 lat: 51.2, 42388 lng: 10.0 42389 }, 42390 zoom: 6, 42391 streetViewControl: true 42392 }, 42393 markerCluster: { 42394 imagePath: '/theme/images/location-map--marker', 42395 maxZoom: 11 42396 }, 42397 displayInPopup: _this.ele.data('displayPopup'), 42398 showStandaloneShop: _this.ele.data('showStandaloneShop'), 42399 moduleName: _this.ele.data('module') 42400 }; 42401 _this.isPackstation = _this.options.moduleName === 'packstationfinder'; 42402 _this.activeInfoWindow = null; 42403 _this.overlayWrapper = _this.ele.find('.js-location-map-overlay-wrapper'); 42404 _this.closePopupButtonSelector = _this.ele.data('closePopupButton'); 42405 _this.fullscreenOverlaySelector = _this.ele.data('fullscreenOverlay'); 42406 _this.resultOffset = parseFloat(_this.ele.data('resultOffset') || 0); 42407 _this.registerListener(); 42408 _this.registerStoreLinkListener(); 42409 _this.registerMobileListener(); 42410 var hostName = window.location.hostname || null; 42411 var channel = _this.ele.data('channel') || null; 42412 var apiUrl = _this.ele.data('mapsApi') || (0, _Gmaps.getApiUrl)(hostName, channel); 42413 (0, _Utils.loadScript)(apiUrl).then(function () { 42414 _this.initMap(ele); 42415 }); 42416 return _this; 42417 } 42418 _inherits(LocationMapModule, _EventComponent); 42419 return _createClass(LocationMapModule, [{ 42420 key: "registerListener", 42421 value: function registerListener() { 42422 _superPropGet(LocationMapModule, "registerListener", this, 3)([[{ 42423 event: 'openMarkerPopup', 42424 namespace: 'LocationMapModule', 42425 callback: this.openMarkerPopup.bind(this) 42426 }, { 42427 event: 'update', 42428 namespace: 'LocationSearchModule', 42429 callback: this.updateMap.bind(this) 42430 }]]); 42431 } 42432 }, { 42433 key: "offsetCenter", 42434 value: function offsetCenter(latlng, offsetX, offsetY) { 42435 var scale = Math.pow(2, this.map.getZoom()); 42436 var worldCoordinateCenter = this.map.getProjection().fromLatLngToPoint(latlng); 42437 var pixelOffset = new window.google.maps.Point(offsetX / scale || 0, offsetY / scale || 0); 42438 var worldCoordinateNewCenter = new window.google.maps.Point(worldCoordinateCenter.x - pixelOffset.x, worldCoordinateCenter.y + pixelOffset.y); 42439 var newCenter = this.map.getProjection().fromPointToLatLng(worldCoordinateNewCenter); 42440 this.map.setCenter(newCenter); 42441 } 42442 }, { 42443 key: "setCenter", 42444 value: function setCenter(position, offsetX, offsetY) { 42445 if (!window.Foundation.MediaQuery.is('small only')) { 42446 this.offsetCenter(position, offsetX ? offsetX : 200, offsetY ? offsetY : -100); 42447 } else { 42448 this.offsetCenter(position, 0, -200); 42449 } 42450 } 42451 }, { 42452 key: "openMarkerPopup", 42453 value: function openMarkerPopup(index) { 42454 this.toggleOverlay(); 42455 if (this.activeInfoWindow) { 42456 this.activeInfoWindow.close(); 42457 } 42458 this.activeInfoWindow = this.infoWindows[index]; 42459 this.infoWindows[index].open(this.map, this.markers[index]); 42460 this.map.setZoom(this.options.markerCluster.maxZoom + 1); 42461 this.setCenter(this.markers[index].getPosition(), 180, -180); 42462 } 42463 }, { 42464 key: "clearMarkers", 42465 value: function clearMarkers() { 42466 if (this.markerCluster) { 42467 this.markerCluster.clearMarkers(); 42468 } 42469 } 42470 }, { 42471 key: "resetMap", 42472 value: function resetMap() { 42473 if (this.activeInfoWindow) { 42474 this.activeInfoWindow.close(); 42475 this.activeInfoWindow = null; 42476 } 42477 this.clearMarkers(); 42478 this.markers.length = 0; 42479 this.infoWindows.length = 0; 42480 this.map.setCenter(new window.google.maps.LatLng(this.options.map.center.lat, this.options.map.center.lng)); 42481 this.map.setZoom(this.options.map.zoom); 42482 } 42483 }, { 42484 key: "getOpeningHours", 42485 value: function getOpeningHours(store) { 42486 var WeekDayOpeningHours = {}; 42487 if (store.openingHours === null) { 42488 return ''; 42489 } 42490 if (store.openingHours.weekDayOpeningList === null) { 42491 return ''; 42492 } 42493 for (var i = 0; i < store.openingHours.weekDayOpeningList.length; i++) { 42494 var currentDay = store.openingHours.weekDayOpeningList[i]; 42495 if (currentDay.closed || currentDay.openingTimes == null) continue; 42496 var template = "\n".concat(currentDay.weekDay, ": "); 42497 var maxLength = currentDay.openingTimes.length; 42498 for (var j = 0; j < maxLength; j++) { 42499 var currentShift = currentDay.openingTimes[j]; 42500 if (j > 0) { 42501 template = template.concat(", "); 42502 } 42503 template = template.concat(currentShift.openingTime.formattedHour, " - ").concat(currentShift.closingTime.formattedHour); 42504 if (j === maxLength - 1) { 42505 template = template.concat(" Uhr"); 42506 } 42507 } 42508 WeekDayOpeningHours[i] = { 42509 template: template 42510 }; 42511 } 42512 var specialDays = []; 42513 for (var _j = 0; _j < store.openingHours.specialDayOpeningList.length; _j++) { 42514 var specialDay = store.openingHours.specialDayOpeningList[_j]; 42515 specialDays.push({ 42516 template: "\n ".concat(specialDay.name, " (").concat(specialDay.formattedDate, "): ").concat(specialDay.closed ? "-" : "".concat(specialDay.openingTime.formattedHour, " - ").concat(specialDay.closingTime.formattedHour, " Uhr"), "\n ") 42517 }); 42518 } 42519 if (!$.isEmptyObject(WeekDayOpeningHours)) { 42520 return "\n <p class=\"paragraph\">\n ".concat(Object.keys(WeekDayOpeningHours).map(function (entry) { 42521 return WeekDayOpeningHours[entry].template; 42522 }).join('<br/>'), "\n ").concat(specialDays.map(function (entry) { 42523 return entry.template; 42524 }).join('<br/>'), "\n </p>\n "); 42525 } else return ''; 42526 } 42527 }, { 42528 key: "getAvailability", 42529 value: function getAvailability(store) { 42530 var showAvailability = store.availabilityMsg && store.pickupAllowed != undefined; 42531 if (showAvailability) { 42532 return "\n <div class=\"availability-status\">\n <div class=\"availability-status__icon-wrapper\">\n <i class=\"fa fa-check availability-status__icon -is".concat(!store.pickupAllowed ? "-not" : "", "-available\" aria-hidden=\"true\"></i>\n </div>\n <div class=\"availability-status__content\">
42532\n <span class=\"availability-status__text\">").concat(store.availabilityMsg, "</span>\n </div>\n </div>\n "); 42533 } 42534 return ''; 42535 } 42536 }, { 42537 key: "getSetStoreLink", 42538 value: function getSetStoreLink(store) { 42539 var showSelectStoreLink = this.options.showSelectStoreLink && store.pickupAllowed !== false; 42540 var buttonText = this.isPackstation ? 'Packstation auswählen' : 'Filiale auswählen'; 42541 if (showSelectStoreLink) { 42542 return "\n <p class=\"paragraph storefinder_resultlist_store_availability_links\">\n <a class=\"button-text js-select-store\" data-store-name=\"".concat(store.name, "\"\n data-postal-code=\"").concat(store.address.postalCode, "\" data-city=\"").concat(store.address.town, "\" data-vpid=\"").concat(store.vpId || '', "\" href=\"#\">\n ").concat(buttonText, "\n </a>\n ").concat(showSelectStoreLink && this.options.bookAnAppointment ? "\n </p><p class=\"paragraph\">\n <a class=\"link-icon js-select-store\" data-store-name=\"".concat(store.name, "\" data-book-an-appoinment=\"true\"\n data-postal-code=\"").concat(store.address.postalCode, "\" data-city=\"").concat(store.address.town, "\" data-vpid=\"").concat(store.vpId || '', "\" href=\"#\">\n <i class=\"fa fa-calendar\" aria-hidden=\"true\"></i>Filiale ausw\xE4hlen und Termin vereinbaren\n </a>\n ") : '', "\n </p>\n "); 42543 } else { 42544 if (store.pickupAllowed === undefined && store.address.url && store.type !== "RESELLER") { 42545 return "\n <p class=\"paragraph\"><a href=\"".concat(store.address.url, "#/#baa\" class=\"button-text\" target=\"_blank\"> Termin vereinbaren</a> <a href=\"").concat(store.address.url, "\" class=\"button-text\" target=\"_blank\"> Zum Shop</a></p>"); 42546 } 42547 } 42548 return ''; 42549 } 42550 }, { 42551 key: "getStoreIcon", 42552 value: function getStoreIcon(store) { 42553 var storeIcons = { 42554 'packstation': '/theme/images/location-map--packstation.png', 42555 'allowed': '/theme/images/location-map--store-available.png', 42556 'notAllowed': '/theme/images/location-map--store-notavailable.png', 42557 'default': '/theme/images/location-map--store.png' 42558 }; 42559 if (!$.isEmptyObject(store.storeIcons)) { 42560 storeIcons = _extends(storeIcons, store.storeIcons); 42561 } 42562 if (this.isPackstation) { 42563 return storeIcons.packstation; 42564 } 42565 switch (store.pickupAllowed) { 42566 case true: 42567 { 42568 return storeIcons.allowed; 42569 } 42570 case false: 42571 { 42572 return storeIcons.notAllowed; 42573 } 42574 default: 42575 { 42576 return storeIcons["default"]; 42577 } 42578 } 42579 } 42580 }, { 42581 key: "createMarker", 42582 value: function createMarker(store) { 42583 var _this2 = this; 42584 var storeIcon = this.getStoreIcon(store); 42585 var marker = new window.google.maps.Marker({ 42586 position: new window.google.maps.LatLng(store.geoPoint.latitude, store.geoPoint.longitude), 42587 icon: storeIcon 42588 }); 42589 var tooltipTemplate = "\n <div class=\"storefinder__store_tooltip\">\n <div class=\"headline4 -padding-top-0 -margin-bottom-0\">\n ".concat(store.displayName, "\n </div>\n ").concat(store.description ? "<p class=\"paragraph\">".concat(store.description, "</p>") : '', "\n <p class=\"paragraph\">\n ").concat(store.address.remarks ? "".concat(store.address.remarks, "<br />") : "", "\n ").concat(store.address.line1, " ").concat(store.address.streetnumber, "\n <br />\n ").concat(store.address.postalCode, " ").concat(store.address.town, "\n </p>\n ").concat(store.address.phone ? "\n <h4 class=\"headline4 -padding-top-0 -margin-bottom-0\">Telefon</h4>\n <p class=\"paragraph\">".concat(store.address.phone, "</p>\n ") : '', "\n ").concat(this.getOpeningHours(store) !== '' || this.getAvailability(store) ? "\n <h4 class=\"headline4 -padding-top-0 -margin-bottom-0\">\n \xD6ffnungszeiten\n </h4>\n " : '', "\n ").concat(this.getOpeningHours(store), "\n ").concat(this.getAvailability(store), "\n ").concat(this.getSetStoreLink(store), "\n </div>\n "); 42590 var infoWindow = new window.google.maps.InfoWindow({ 42591 content: tooltipTemplate, 42592 disableAutoPan: true, 42593 maxWidth: 360 42594 }); 42595 marker.addListener('click', function () { 42596 if (_this2.activeInfoWindow) { 42597 _this2.activeInfoWindow.close(); 42598 } 42599 _this2.closeOverlay(); 42600 _this2.setCenter(marker.getPosition(), 180, -180); 42601 _this2.activeInfoWindow = infoWindow; 42602 infoWindow.open(_this2.map, marker); 42603 }); 42604 this.markers.push(marker); 42605 this.infoWindows.push(infoWindow); 42606 } 42607 }, { 42608 key: "addMarkers", 42609 value: function addMarkers() { 42610 if (this.markerCluster) { 42611 this.markerCluster.setMap(null); 42612 } 42613 if (this.markers.length) { 42614 this.markerCluster = new _markerclusterer["default"](this.map, this.markers, this.options.markerCluster); 42615 } 42616 } 42617 }, { 42618 key: "zoomToBounds", 42619 value: function zoomToBounds() { 42620 var formParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 42621 if (this.markers.length) { 42622 this.markerCluster.fitMapToMarkers(); 42623 var center = this.map.getCenter(); 42624 42625 // move result map by offset 42626 if (!window.Foundation.MediaQuery.is('small only')) { 42627 this.map.setCenter(new window.google.maps.LatLng(center.lat(), center.lng() + this.resultOffset)); 42628 } 42629 } else { 42630 this.map.setCenter(new window.google.maps.LatLng(formParams.latitude ? formParams.latitude : this.options.map.center.lat, formParams.longitude ? formParams.longitude : this.options.map.center.lng)); 42631 } 42632 if (this.map.getZoom() > 17) { 42633 this.map.setZoom(17); 42634 } 42635 } 42636 }, { 42637 key: "updateMap", 42638 value: function updateMap(data) { 42639 var _this3 = this; 42640 this.resetMap(); 42641 $.each(data.result.results, function (index, store) { 42642 _this3.createMarker(store); 42643 }); 42644 this.addMarkers(); 42645 this.zoomToBounds(data.params); 42646 } 42647 }, { 42648 key: "handleStoreSelection", 42649 value: function handleStoreSelection(ele) { 42650 var _this4 = this; 42651 var storeName = ele.data('storeName'); 42652 var postalCode = ele.data('postalCode'); 42653 var city = ele.data('city'); 42654 var vpid = ele.data('vpid'); 42655 var bookAnAppointmentRequested = ele.data('bookanappoinment'); 42656 var closePopupButton = $(this.closePopupButtonSelector); 42657 if (this.isPackstation) { 42658 if (this.options.displayInPopup && closePopupButton.length) { 42659 closePopupButton.trigger('click'); 42660 } 42661 _EventEmitter["default"].emit('DeliveryAddressModule.selectedPackstationChanged', { 42662 name: storeName, 42663 postalCode: postalCode, 42664 city: city 42665 }); 42666 _EventEmitter["default"].emit(this.getEventQualifier('update', 'DeliveryAddressModule')); 42667 return; 42668 } 42669 // Query hybris to save selected store 42670 $.ajax({ 42671 'url': this.options.selectStoreURL + '?storeName=' + storeName, 42672 'dataType': 'json' 42673 }).then(function (data) { 42674 if (data.success) { 42675 // Set myRepairStore Cookie 42676 var cookieName = _this4.ele.data('vpid') || null; 42677 if (cookieName && vpid !== '') { 42678 _this4.setStoreCookie(cookieName, vpid); 42679 } 42680 if (_this4.options.displayInPopup && closePopupButton.length) { 42681 closePopupButton.trigger('click'); 42682 } 42683 if (_this4.options.bookAnAppointment && bookAnAppointmentRequested) { 42684 _EventEmitter["default"].emit('DeliveryAddressModule.selectedStoreChangedAndApp
42684ointmentRequested'); 42685 } else { 42686 _EventEmitter["default"].emit('DeliveryAddressModule.selectedStoreChanged'); 42687 } 42688 _EventEmitter["default"].emit(_this4.getEventQualifier('update', 'DeliveryAddressModule')); 42689 } 42690 }); 42691 } 42692 }, { 42693 key: "setStoreCookie", 42694 value: function setStoreCookie(cookieName, vpid) { 42695 var domain = window.location.hostname.split('.'); 42696 if (domain.length > 1) { 42697 domain = domain[domain.length - 2] + '.' + domain[domain.length - 1]; 42698 } else { 42699 domain = window.location.hostname; 42700 } 42701 _jsCookie["default"].set(cookieName, vpid, { 42702 expires: 30, 42703 path: '/', 42704 domain: domain 42705 }); 42706 } 42707 }, { 42708 key: "registerStoreLinkListener", 42709 value: function registerStoreLinkListener() { 42710 var _this5 = this; 42711 // Handle store selection 42712 this.ele.on('click', 'a.js-select-store[data-store-name]', function (event) { 42713 _this5.handleStoreSelection($(event.currentTarget)); 42714 return false; 42715 }); 42716 } 42717 }, { 42718 key: "toggleOverlay", 42719 value: function toggleOverlay() { 42720 this.overlayWrapper.toggleClass('-is-active'); 42721 } 42722 }, { 42723 key: "closeOverlay", 42724 value: function closeOverlay() { 42725 this.overlayWrapper.removeClass('-is-active'); 42726 } 42727 }, { 42728 key: "registerMobileListener", 42729 value: function registerMobileListener() { 42730 var _this6 = this; 42731 this.ele.find('.js-location-map-toggle').on('click', function () { 42732 _this6.toggleOverlay(); 42733 }); 42734 } 42735 }, { 42736 key: "registerFullscreenListener", 42737 value: function registerFullscreenListener() { 42738 var _this7 = this; 42739 var fullscreenElement = $(this.map.getDiv()).children()[0]; 42740 var userAgent = navigator.userAgent || navigator.vendor || window.opera; 42741 var eventTarget = userAgent.indexOf('MSIE') > -1 || userAgent.indexOf('Trident') > -1 ? document : fullscreenElement; 42742 var eventNamespace = '.LocationMapModule' + this.eventGroup; 42743 $(eventTarget).on('fullscreenchange' + eventNamespace + ' ' + 'webkitfullscreenchange' + eventNamespace + ' ' + 'mozfullscreenchange' + eventNamespace + ' ' + 'MSFullscreenChange' + eventNamespace, function (event) { 42744 _this7.handleFullscreenChange(fullscreenElement); 42745 }); 42746 } 42747 }, { 42748 key: "handleFullscreenChange", 42749 value: function handleFullscreenChange(ele) { 42750 var _this8 = this; 42751 var fullscreenOverlays; 42752 var isFullscreen = document.fullscreenElement === ele || document.webkitFullscreenElement === ele || document.mozFullScreenElement === ele || document.msFullscreenElement === ele; 42753 var fullscreenPlaceholder = $(ele).children().first(); 42754 if (isFullscreen) { 42755 fullscreenOverlays = $(this.fullscreenOverlaySelector).filter(function (index, element) { 42756 return '.' + $(element).data('eventGroup') === _this8.eventGroup; 42757 }); 42758 fullscreenOverlays.each(function (index, element) { 42759 _this8.createPlaceholder($(element)); 42760 $(element).insertBefore(fullscreenPlaceholder); 42761 }); 42762 } else { 42763 this.placeholders.forEach(function (element, index) { 42764 var className = $(element).removeClass('js-location-placeholder').attr('class'); 42765 element.replaceWith($(ele).find("[class=\"".concat(className, "\"]"))); 42766 }); 42767 this.placeholders = []; 42768 } 42769 } 42770 }, { 42771 key: "createPlaceholder", 42772 value: function createPlaceholder(ele) { 42773 var className = $(ele).attr('class'); 42774 var placeholderTemplate = "\n <div class=\"js-location-placeholder ".concat(className, "\"></div>\n "); 42775 var placeholder = $(placeholderTemplate); 42776 placeholder.insertAfter(ele); 42777 this.placeholders.push(placeholder); 42778 } 42779 }, { 42780 key: "initMap", 42781 value: function initMap(ele) { 42782 var mapzoom = $(ele).data('shopZoom'), 42783 lat = $(ele).data('shopLat'), 42784 lng = $(ele).data('shopLng'); 42785 var storeIcon = '/theme/images/location-map--store.png'; 42786 var mapOptions = { 42787 center: lat && lng ? new window.google.maps.LatLng(lat, lng) : this.options.map.center, 42788 zoom: mapzoom || this.options.map.zoom, 42789 streetViewControl: this.options.map.streetViewControl, 42790 mapTypeControl: false 42791 }; 42792 $(ele).data('gmapIndex', this.id); 42793 this.map = new window.google.maps.Map($(ele).find('.js-gmap')[0], mapOptions); 42794 if (this.options.showStandaloneShop) { 42795 new window.google.maps.Marker({ 42796 position: mapOptions.center, 42797 icon: storeIcon 42798 }).setMap(this.map); 42799 } 42800 this.registerFullscreenListener(); 42801 } 42802 }]); 42803}(_EventComponent2["default"]); 42804 42805},{"@google/markerclustererplus/src/markerclusterer":2,"EventComponent":73,"EventEmitter":74,"Gmaps.js":81,"Utils":84,"js-cookie":30}],134:[function(require,module,exports){ 42806'use strict'; 42807 42808function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 42809Object.defineProperty(exports, "__esModule", { 42810 value: true 42811}); 42812exports.LocationMap = void 0; 42813var _SGComponent2 = require("SGComponent"); 42814var _30LocationMapModule = _interopRequireDefault(require("./_30.location-map-module.js"));
vendor: 5,529 bytes, lines 42815-42867
42815function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 42816function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 42817function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 42818function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 42819function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 42820function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 42821function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 42822function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 42823function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 42824function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 42825function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 42826function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 42827function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 42828function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 42829function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 42830function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 42831var LocationMap = exports.LocationMap = /*#__PURE__*/function (_SGComponent) { 42832 function LocationMap() { 42833 _classCallCheck(this, LocationMap); 42834 return _callSuper(this, LocationMap, arguments); 42835 } 42836 _inherits(LocationMap, _SGComponent); 42837 return _createClass(LocationMap, [{ 42838 key: "initialize", 42839 value: function initialize() { 42840 _superPropGet(LocationMap, "initialize", this, 3)([]); 42841 } 42842 }, { 42843 key: "init", 42844 value: function init(container) { 42845 container = _superPropGet(LocationMap, "init", this, 3)([container]); 42846 $(container).find('.location-map').each(function () { 42847 new _30LocationMapModule["default"](this, $(this).data('eventGroup')); 42848 }); 42849 } 42850 }]); 42851}(_SGComponent2.SGComponent); 42852window.theme.locationMap = new LocationMap(); 42853 42854},{"./_30.location-map-module.js":133,"SGComponent":83}],135:[function(require,module,exports){ 42855'use strict'; 42856 42857function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 42858Object.defineProperty(exports, "__esModule", { 42859 value: true 42860}); 42861exports["default"] = void 0; 42862var _SGComponent2 = require("SGComponent"); 42863function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 42864function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 42865function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 42866function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 42867function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
42868function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 42869function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 42870function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 42871function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 42872function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 42873function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 42874function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 42875function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 42876function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 42877function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 42878var EmbeddedTrustedShops = exports["default"] = /*#__PURE__*/function (_SGComponent) { 42879 function EmbeddedTrustedShops() { 42880 _classCallCheck(this, EmbeddedTrustedShops); 42881 return _callSuper(this, EmbeddedTrustedShops, arguments); 42882 } 42883 _inherits(EmbeddedTrustedShops, _SGComponent); 42884 return _createClass(EmbeddedTrustedShops, [{ 42885 key: "init", 42886 value: function init(container) { 42887 container = _superPropGet(EmbeddedTrustedShops, "init", this, 3)([container]); 42888 var instance = this; 42889 var hookDiv = $('.trusted-shops-snippet').first(); 42890 instance.config = { 42891 tsID: '', 42892 tsConfig: { 42893 'yOffset': '0', 42894 /* offset from page bottom */ 42895 'variant': 'custom_reviews', 42896 /* default, reviews, custom, custom_reviews */ 42897 'customElementId': 'trusted-shops-snippet', 42898 /* required for variants custom and custom_reviews */ 42899 'disableResponsive': 'false', 42900 /* deactivate responsive behaviour */ 42901 'disableTrustbadge': 'false' /* deactivate trustbadge */ 42902 } 42903 }; 42904 if (hookDiv.length && instance.loadConfig(hookDiv)) { 42905 instance.initBadge(); 42906 $(document).ready(function () { 42907 instance.waitForBadgeDiv(hookDiv); 42908 }); 42909 $(window).on('scroll', function () { 42910 if (Foundation.MediaQuery.is('small only')) { 42911 instance.hideOnScroll(hookDiv); 42912 } 42913 }); 42914 } 42915 } 42916 }, { 42917 key: "loadConfig", 42918 value: function loadConfig(hookDiv) { 42919 var size = { 42920 w: $(hookDiv).data('width') || 100, 42921 h: $(hookDiv).data('height') || 120 42922 }; 42923 this.config.tsID = hookDiv.data('tsId') || ''; 42924 this.config.tsPosition = $(hookDiv).data('position') || 'inline'; 42925 this.config.tsConfig.disableResponsive = typeof $(hookDiv).data('responsive') == 'boolean' && $(hookDiv).data('responsive') ? 'false' : 'true'; 42926 this.config.tsConfig.hideOn = typeof $(hookDiv).data('hideOn') !== 'undefined' ? $(hookDiv).data('hideOn').split(',') : []; 42927 if (!this.config.tsConfig.showOnSmall) { 42928 this.config.tsConfig.disableResponsive = 'true'; 42929 } 42930 this.config.tsConfig.customBadgeHeight = size.h.toString(); 42931 this.config.tsConfig.customBadgeWidth = size.w.toString(); 42932 return !!this.config.tsID; 42933 } 42934 }, { 42935 key: "initBadge", 42936 value: function initBadge() { 42937 var _tsid = this.config.tsID; 42938 window._tsConfig = this.config.tsConfig; 42939 var _ts = document.createElement('script'); 42940 _ts.type = 'text/javascript'; 42941 _ts.charset = 'utf-8'; 42942 _ts.async = true; 42943 _ts.src = '//widgets.trustedshops.com/js/' + _tsid + '.js'; 42944 var __ts = document.getElementsByTagName('script')[0]; 42945 __ts.parentNode.insertBefore(_ts, __ts); 42946 } 42947 }, { 42948 key: "waitForBadgeDiv", 42949 value: function waitForBadgeDiv(hookDiv) { 42950 var instance = this; 42951 instance.interval = setInterval(function () { 42952 var badge = $(hookDiv).children().get(0); 42953 if (typeof badge !== 'undefined') { 42954 clearInterval(instance.interval); 42955 instance.setPosition(badge, hookDiv); 42956 instance.hideForSize(hookDiv); 42957 } 42958 }, 10); 42959 } 42960 }, { 42961 key: "getBadgeElement", 42962 value: function getBadgeElement(el, start, end) { 42963 var id = el.id.split('_')[1]; 42964 start = start + '_'; 42965 end = end || ''; 42966 return $(start + id + end).get(0); 42967 } 42968 }, {
42969 key: "recalculateSize", 42970 value: function recalculateSize(el, style) { 42971 var badgeEle = this.getBadgeElement(el, '#tsCustomBadge4'); 42972 var customFooter = this.getBadgeElement(el, '.trustbadge-custom-footer', '__sub-text'); 42973 var customFooterContainer = $(customFooter).parent().get(0); 42974 var triangleBadge = this.getBadgeElement(el, '#TriangleCustomBadge'); 42975 var logoBadge = this.getBadgeElement(el, '.trustbadge-custom-footer', '__logo'); 42976 if (style != 'inline' && typeof el !== 'undefined') { 42977 el.style.setProperty('z-index', '2', 'important'); 42978 el.style.setProperty('width', this.config.tsConfig.customBadgeWidth + 'px'); 42979 el.style.setProperty('position', 'fixed'); 42980 el.style.setProperty('bottom', '0'); 42981 if (typeof badgeEle !== 'undefined') { 42982 badgeEle.style.setProperty('width', this.config.tsConfig.customBadgeWidth + 'px', 'important'); 42983 badgeEle.style.setProperty('height', this.config.tsConfig.customBadgeHeight + 'px', 'important'); 42984 } 42985 $(customFooter).html('Kunden­bewertungen'); 42986 if (typeof customFooter !== 'undefined') { 42987 customFooter.style.setProperty('max-width', '50%'); 42988 customFooter.style.setProperty('font-size', '100%'); 42989 } 42990 if (typeof customFooterContainer !== 'undefined') { 42991 customFooterContainer.style.setProperty('height', $(customFooter).outerHeight() + 10 + 'px'); 42992 customFooterContainer.style.setProperty('border-bottom', $(customFooter).outerHeight() + 10 + 'px solid rgb(255, 220, 15)'); 42993 } 42994 if (typeof triangleBadge !== 'undefined' && typeof logoBadge !== 'undefined') { 42995 triangleBadge.style.setProperty('bottom', $(customFooter).outerHeight() - 2 + 'px'); 42996 logoBadge.style.setProperty('margin-bottom', '0px'); 42997 } 42998 } 42999 var responsiveTop = this.getBadgeElement(el, '#tsbadgeResponsiveTop'); 43000 if (this.config.tsConfig.disableResponsive == 'false') { 43001 if (typeof responsiveTop !== 'undefined') { 43002 responsiveTop.style.setProperty('position', 'fixed'); 43003 responsiveTop.style.setProperty('bottom', '0'); 43004 responsiveTop.style.setProperty('z-index', '3'); 43005 } 43006 } 43007 return { 43008 w: $(badgeEle).outerWidth(), 43009 h: $(badgeEle).outerHeight() 43010 }; 43011 } 43012 }, { 43013 key: "hideForSize", 43014 value: function hideForSize(el) { 43015 var hideSizes = this.config.tsConfig.hideOn; 43016 var hide = false;
43017 if (hideSizes.length > 0) { 43018 hideSizes.forEach(function (h) { 43019 if (Foundation.MediaQuery.is(h + ' only')) hide = true; 43020 }); 43021 } 43022 if (hide) $(el).addClass('-hide'); 43023 if (!hide) $(el).removeClass('-hide'); 43024 } 43025 }, { 43026 key: "setPosition", 43027 value: function setPosition(el, container) { 43028 var instance = this; 43029 var config = this.config; 43030 var size = this.recalculateSize(el, config.tsPosition); 43031 $(window).on('resize.EmbeddedTrustedShops', function () { 43032 instance.hideForSize(container); 43033 if (typeof el !== 'undefined') { 43034 var left = container.offset().left; 43035 var offset = 10; 43036 var right = container.offset().left + container.outerWidth(); 43037 var badgeOverScreenToRight = right + offset + size.w > $(window).width(); 43038 var badgeOverScreenToLeft = left - (size.w + offset) < 0; 43039 var overlay = $('.etrusted-tb-card .etrusted-tb-card__container'); 43040 switch (config.tsPosition) { 43041 case 'over-left': 43042 if (!badgeOverScreenToLeft) el.style.setProperty('left', left - $(el).outerWidth() - offset + 'px', 'important'); 43043 if (badgeOverScreenToLeft) el.style.setProperty('left', left + 'px', 'important'); 43044 overlay.addClass('-left'); 43045 break; 43046 case 'over-right': 43047 if (!badgeOverScreenToRight) el.style.setProperty('left', right + offset + 'px', 'important'); 43048 if (badgeOverScreenToRight) el.style.setProperty('left', right - $(el).outerWidth() + 'px', 'important'); 43049 overlay.addClass('-right'); 43050 break; 43051 case 'right': 43052 el.style.setProperty('left', right - $(el).outerWidth() + 'px', 'important'); 43053 overlay.addClass('-right'); 43054 break; 43055 case 'left': 43056 el.style.setProperty('left', left + 'px', 'important'); 43057 overlay.addClass('-left'); 43058 break; 43059 default: 43060 break; 43061 } 43062 } 43063 }).trigger('resize'); 43064 } 43065 }, { 43066 key: "hideOnScroll", 43067 value: function hideOnScroll(el) { 43068 if ($(window).scrollTop() > 0) { 43069 $(el).fadeOut(); 43070 } else { 43071 $(el).fadeIn(); 43072 } 43073 } 43074 }]); 43075}(_SGComponent2.SGComponent); 43076window.theme.embeddedTrustedShops = new EmbeddedTrustedShops(); 43077 43078},{"SGComponent":83}],136:[function(require,module,exports){ 43079'use strict'; 43080 43081Object.defineProperty(exports, "__esModule", { 43082 value: true 43083}); 43084exports.NfOfferBoxModern = void 0; 43085var _SGComponent2 = require("SGComponent"); 43086require("velocity-animate"); 43087function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 43088function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 43089function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 43090function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 43091function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 43092function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 43093function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 43094function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 43095function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 43096function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 43097function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 43098function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 43099function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 43100function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 43101function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
43101 t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 43102function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 43103var NfOfferBoxModern = exports.NfOfferBoxModern = /*#__PURE__*/function (_SGComponent) { 43104 function NfOfferBoxModern() { 43105 _classCallCheck(this, NfOfferBoxModern); 43106 return _callSuper(this, NfOfferBoxModern, arguments); 43107 } 43108 _inherits(NfOfferBoxModern, _SGComponent); 43109 return _createClass(NfOfferBoxModern, [{ 43110 key: "init", 43111 value: function init(container) { 43112 container = _superPropGet(NfOfferBoxModern, "init", this, 3)([container]); 43113 var instance = this; 43114 $(container).find('.nf-offer-box-modern').each(function () { 43115 var ele = this; 43116 $('.js-offer-option-item, .js-offer-checkbox-item', ele).off('click.NfOfferBoxModern'); 43117 $('.js-offer-option-item', ele).on('click.NfOfferBoxModern', function () { 43118 var option = $(this).val(); 43119 instance.fadeElement(ele, option, $(ele).hasClass('js-no-fade-effect')); 43120 }); 43121 $('.js-offer-checkbox-item', ele).on('click.NfOfferBoxModern', function () { 43122 var option = instance.getCheckedOption($(this)); 43123 instance.fadeElement(ele, option, $(ele).hasClass('js-no-fade-effect')); 43124 }); 43125 if (typeof window.theme.tariffListingPage !== 'undefined') { 43126 window.theme.tariffListingPage.init(ele); 43127 } 43128 var checkedOption = $('.js-offer-option-item:checked', ele).val(); 43129 if (typeof checkedOption === 'undefined') { 43130 checkedOption = instance.getCheckedOption($('.js-offer-checkbox-item', ele)); 43131 } 43132 instance.fadeElement(ele, checkedOption, true); 43133 window.theme.toolTipExt.init(ele); 43134 $('.js-add2card', ele).on('click.NfOfferBoxModern', instance.handleAdd2CardEvent); 43135 var addToCartClicked = false; 43136 $('.js-offer-option-link-value', ele).on('click.NfOfferBoxModernAddToCart', function () { 43137 if (addToCartClicked) { 43138 return false; 43139 } 43140 addToCartClicked = true; 43141 }); 43142 }); 43143 } 43144 }, { 43145 key: "getCheckedOption", 43146 value: function getCheckedOption(checkbox) { 43147 return !checkbox.prop('checked') ? checkbox.data('uncheckedOption') : checkbox.data('checkedOption'); 43148 } 43149 }, { 43150 key: "handleAdd2CardEvent", 43151 value: function handleAdd2CardEvent() { 43152 var add2card = JSON.parse(decodeURIComponent($(this).data('a2c') || false)); 43153 if (add2card && _typeof(add2card) === 'object') { 43154 window.dataLayer = window.dataLayer || []; 43155 window.dataLayer.push({ 43156 "ecommerce": { 43157 "add": { 43158 "products": [add2card] 43159 }, 43160 "currencyCode": "EUR" 43161 }, 43162 "event": "addToCart" 43163 }); 43164 } 43165 } 43166 }, { 43167 key: "fadeElement", 43168 value: function fadeElement(ele, option, noFadeEffect) { 43169 var instance = this; 43170 var optContainer = $('.js-offer-option-item, .js-offer-checkbox-item', ele).closest('.js-offer-option-container') || []; 43171 optContainer.parent().find('.js-offer-option-container').removeClass('-active'); 43172 optContainer = $('.js-offer-option-item:checked, .js-offer-checkbox-item:checked', ele).closest('.js-offer-option-container') || []; 43173 if (optContainer.length > 0) { 43174 optContainer.addClass('-active'); 43175 } 43176 if (noFadeEffect) { 43177 instance.changeValue(ele, option); 43178 window.theme.toolTipExt.init(ele); 43179 } else { 43180 $('.js-offer-option-fade', ele).velocity({ 43181 'opacity': 0 43182 }, 200, 'ease-in', function () { 43183 instance.changeValue(ele, option); 43184 window.theme.toolTipExt.init(ele); 43185 }); 43186 $('.js-offer-option-fade', ele).velocity({ 43187 'opacity': 1 43188 }, 400, 'ease-in'); 43189 } 43190 } 43191 }, { 43192 key: "changeValue", 43193 value: function changeValue(ele, option) { 43194 var instance = this; 43195 $(ele).find('.js-offer-option-text-value[data-' + option + ']').each(function () { 43196 var value = decodeURIComponent($(this).data(option)); 43197 $(this).html(value); 43198 }); 43199 $(ele).find('.js-offer-option-link-value[data-' + option + ']').each(function () { 43200 var value = $(this).data(option); 43201 $(this).attr('href', value); 43202 }); 43203 instance.changeClasses(ele, option); 43204 instance.toggleElement(ele, option); 43205 } 43206 }, { 43207 key: "changeClasses", 43208 value: function changeClasses(ele, option) { 43209 if (typeof $(ele).data('class') !== 'undefined') { 43210 var modifiers = JSON.parse($(ele).data('class').replace(/\'/g, '"')) || {}; 43211 if (_typeof(modifiers) === 'object') { 43212 $.each(modifiers, function (i, v) { 43213 if (i != option) { 43214 $(ele).removeClass(v); 43215 } else { 43216 $(ele).addClass(v); 43217 } 43218 }); 43219 } 43220 } 43221 } 43222 }, { 43223 key: "toggleElement", 43224 value: function toggleElement(ele, option) { 43225 $('.js-offer-option-toggle', ele).hide(); 43226 $(ele).find('.js-offer-option-toggle').each(function () { 43227 var showOptions = $(this).data('show') || ''; 43228 showOptions = showOptions.split(','); 43229 if (showOptions.indexOf(option) > -1) $(this).show(); 43230 }); 43231 } 43232 }]); 43233}(_SGComponent2.SGComponent); 43234window.theme.nfOfferBoxModern = new NfOfferBoxModern(); 43235 43236},{"SGComponent":83,"velocity-animate":72}],137:[function(require,module,exports){ 43237'use strict'; 43238 43239function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 43240Object.defineProperty(exports, "__esModule", { 43241 value: true 43242}); 43243exports.NfNavigationTariff = void 0; 43244var _SGComponent2 = require("SGComponent"); 43245var _jump = _interopRequireDefault(require("jump.js"));
43246function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 43247function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 43248function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 43249function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 43250function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 43251function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 43252function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 43253function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 43254function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 43255function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 43256function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 43257function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 43258function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 43259function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 43260function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 43261function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 43262var NfNavigationTariff = exports.NfNavigationTariff = /*#__PURE__*/function (_SGComponent) { 43263 function NfNavigationTariff() { 43264 _classCallCheck(this, NfNavigationTariff); 43265 return _callSuper(this, NfNavigationTariff, arguments); 43266 } 43267 _inherits(NfNavigationTariff, _SGComponent); 43268 return _createClass(NfNavigationTariff, [{ 43269 key: "init", 43270 value: function init(container) { 43271 container = _superPropGet(NfNavigationTariff, "init", this, 3)([container]); 43272 var instance = this; 43273 $(container).find('.nf-navigation-tariff').each(function () { 43274 var ele = this; 43275 $('.js-target-jump', ele).on('click.NfNavigationTariff', function (e) { 43276 e.preventDefault(); 43277 var target = $(this).data('jumpTarget') || false; 43278 var offset = $(this).data('jumpOffset') || 0; 43279 if ($(target).length > 0) { 43280 (0, _jump["default"])(target, { 43281 offset: offset 43282 }); 43283 } 43284 }); 43285 }); 43286 } 43287 }]); 43288}(_SGComponent2.SGComponent); 43289window.theme.nfNavigationTariff = new NfNavigationTariff(); 43290 43291},{"SGComponent":83,"jump.js":31}],138:[function(require,module,exports){ 43292'use strict'; 43293 43294function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 43295Object.defineProperty(exports, "__esModule", { 43296 value: true 43297}); 43298exports.TariffListingPage = void 0; 43299var _SGComponent2 = require("SGComponent"); 43300var focusTrap = _interopRequireWildcard(require("focus-trap")); 43301var _jqueryMagnificPopup = _interopRequireDefault(require("../../../vendor/magnific-popup/dist/jquery.magnific-popup.js"));
43302function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } 43303function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } 43304function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 43305function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 43306function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 43307function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 43308function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 43309function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 43310function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 43311function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 43312function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 43313function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 43314function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 43315function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 43316function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 43317function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 43318function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } /* jshint ignore:start */ 43319/* jshint ignore:end */ 43320var TariffListingPage = exports.TariffListingPage = /*#__PURE__*/function (_SGComponent) { 43321 function TariffListingPage() { 43322 _classCallCheck(this, TariffListingPage); 43323 return _callSuper(this, TariffListingPage, arguments); 43324 }
43325 _inherits(TariffListingPage, _SGComponent); 43326 return _createClass(TariffListingPage, [{ 43327 key: "init", 43328 value: function init(container) { 43329 container = _superPropGet(TariffListingPage, "init", this, 3)([container]); 43330 this.initTariffOverlay(); 43331 } 43332 }, { 43333 key: "initTariffOverlay", 43334 value: function initTariffOverlay() { 43335 var title = $(this).data('popupTitle') ? '<h3 class="mfp-title headline3 -bar -no-margin-bottom">' + $(this).data('popupTitle') + '</h3>' : ''; 43336 var trap = null; 43337 $('.js-tariff-detail-layer').magnificPopup({ 43338 closeOnContentClick: false, 43339 closeOnBgClick: true, 43340 type: 'ajax', 43341 alignTop: true, 43342 overflowY: 'scroll', 43343 // as we know that popup content is tall we set scroll overflow by default to avoid jump 43344 callbacks: { 43345 close: function close() { 43346 trap.deactivate(); 43347 trap = null; 43348 }, 43349 ajaxContentAdded: function ajaxContentAdded() { 43350 window.theme.tariffDetailLayer.init($(this.contentContainer[0])); 43351 window.theme.legalTexts.init($(this.contentContainer[0])); 43352 trap = focusTrap.createFocusTrap($('.mfp-content')[0], { 43353 initialFocus: $('.mfp-close')[0] 43354 }); 43355 trap.activate(); 43356 }, 43357 parseAjax: function parseAjax(mfpResponse) { 43358 mfpResponse.data = '<div>' + title + mfpResponse.data + '</div>'; 43359 } 43360 } 43361 }); 43362 } 43363 }]); 43364}(_SGComponent2.SGComponent); 43365window.theme.tariffListingPage = new TariffListingPage(); 43366 43367},{"../../../vendor/magnific-popup/dist/jquery.magnific-popup.js":139,"SGComponent":83,"focus-trap":14}],139:[function(require,module,exports){ 43368(function (global){(function (){ 43369function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 43370/*! Magnific Popup - v1.1.0 - 2016-02-20 43371* http://dimsemenov.com/plugins/magnific-popup/ 43372* Copyright (c) 2016 Dmitry Semenov; */ 43373; 43374(function (factory) { 43375 if (typeof define === 'function' && define.amd) { 43376 // AMD. Register as an anonymous module. 43377 define(['jquery'], factory); 43378 } else if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object') { 43379 // Node/CommonJS 43380 factory((typeof window !== "undefined" ? window['$'] : typeof global !== "undefined" ? global['$'] : null)); 43381 } else { 43382 // Browser globals 43383 factory(window.jQuery || window.Zepto); 43384 } 43385})(function ($) { 43386 /*>>core*/ 43387 /** 43388 * 43389 * Magnific Popup Core JS file 43390 * 43391 */ 43392 43393 /** 43394 * Private static constants 43395 */ 43396 var CLOSE_EVENT = 'Close', 43397 BEFORE_CLOSE_EVENT = 'BeforeClose', 43398 AFTER_CLOSE_EVENT = 'AfterClose', 43399 BEFORE_APPEND_EVENT = 'BeforeAppend', 43400 MARKUP_PARSE_EVENT = 'MarkupParse', 43401 OPEN_EVENT = 'Open', 43402 CHANGE_EVENT = 'Change', 43403 NS = 'mfp', 43404 EVENT_NS = '.' + NS, 43405 READY_CLASS = 'mfp-ready', 43406 REMOVING_CLASS = 'mfp-removing', 43407 PREVENT_CLOSE_CLASS = 'mfp-prevent-close'; 43408 43409 /** 43410 * Private vars 43411 */ 43412 /*jshint -W079 */ 43413 var mfp, 43414 // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this' 43415 MagnificPopup = function MagnificPopup() {}, 43416 _isJQ = !!window.jQuery, 43417 _prevStatus, 43418 _window = $(window), 43419 _document, 43420 _prevContentType, 43421 _wrapClasses, 43422 _currPopupType; 43423 43424 /** 43425 * Private functions 43426 */ 43427 var _mfpOn = function _mfpOn(name, f) { 43428 mfp.ev.on(NS + name + EVENT_NS, f); 43429 }, 43430 _getEl = function _getEl(className, appendTo, html, raw) { 43431 var el = document.createElement('div'); 43432 el.className = 'mfp-' + className; 43433 if (html) { 43434 el.innerHTML = html; 43435 } 43436 if (!raw) { 43437 el = $(el); 43438 if (appendTo) { 43439 el.appendTo(appendTo); 43440 } 43441 } else if (appendTo) { 43442 appendTo.appendChild(el); 43443 } 43444 return el; 43445 }, 43446 _mfpTrigger = function _mfpTrigger(e, data) { 43447 mfp.ev.triggerHandler(NS + e, data); 43448 if (mfp.st.callbacks) { 43449 // converts "mfpEventName" to "eventName" callback and triggers it if it's present 43450 e = e.charAt(0).toLowerCase() + e.slice(1); 43451 if (mfp.st.callbacks[e]) { 43452 mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]); 43453 } 43454 } 43455 }, 43456 _getCloseBtn = function _getCloseBtn(type) { 43457 if (type !== _currPopupType || !mfp.currTemplate.closeBtn) { 43458 mfp.currTemplate.closeBtn = $(mfp.st.closeMarkup.replace('%title%', mfp.st.tClose)); 43459 _currPopupType = type; 43460 } 43461 return mfp.currTemplate.closeBtn; 43462 }, 43463 // Initialize Magnific Popup only when called at least once 43464 _checkInstance = function _checkInstance() { 43465 if (!$.magnificPopup.instance) { 43466 /*jshint -W020 */ 43467 mfp = new MagnificPopup(); 43468 mfp.init(); 43469 $.magnificPopup.instance = mfp; 43470 } 43471 }, 43472 // CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr 43473 supportsTransitions = function supportsTransitions() { 43474 var s = document.createElement('p').style, 43475 // 's' for style. better to create an element if body yet to exist 43476 v = ['ms', 'O', 'Moz', 'Webkit']; // 'v' for vendor 43477 43478 if (s['transition'] !== undefined) { 43479 return true; 43480 } 43481 while (v.length) { 43482 if (v.pop() + 'Transition' in s) { 43483 return true; 43484 } 43485 } 43486 return false;
vendor: 13,068 bytes, lines 43487-43899
43487 }; 43488 43489 /** 43490 * Public functions 43491 */ 43492 MagnificPopup.prototype = { 43493 constructor: MagnificPopup, 43494 /** 43495 * Initializes Magnific Popup plugin. 43496 * This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed 43497 */ 43498 init: function init() { 43499 var appVersion = navigator.appVersion; 43500 mfp.isLowIE = mfp.isIE8 = document.all && !document.addEventListener; 43501 mfp.isAndroid = /android/gi.test(appVersion); 43502 mfp.isIOS = /iphone|ipad|ipod/gi.test(appVersion); 43503 mfp.supportsTransition = supportsTransitions(); 43504 43505 // We disable fixed positioned lightbox on devices that don't handle it nicely. 43506 // If you know a better way of detecting this - let me know. 43507 mfp.probablyMobile = mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent); 43508 _document = $(document); 43509 mfp.popupsCache = {}; 43510 }, 43511 /** 43512 * Opens popup 43513 * @param data [description] 43514 */ 43515 open: function open(data) { 43516 var i; 43517 if (data.isObj === false) { 43518 // convert jQuery collection to array to avoid conflicts later 43519 mfp.items = data.items.toArray(); 43520 mfp.index = 0; 43521 var items = data.items, 43522 item; 43523 for (i = 0; i < items.length; i++) { 43524 item = items[i]; 43525 if (item.parsed) { 43526 item = item.el[0]; 43527 } 43528 if (item === data.el[0]) { 43529 mfp.index = i; 43530 break; 43531 } 43532 } 43533 } else { 43534 mfp.items = $.isArray(data.items) ? data.items : [data.items]; 43535 mfp.index = data.index || 0; 43536 } 43537 43538 // if popup is already opened - we just update the content 43539 if (mfp.isOpen) { 43540 mfp.updateItemHTML(); 43541 return; 43542 } 43543 mfp.types = []; 43544 _wrapClasses = ''; 43545 if (data.mainEl && data.mainEl.length) { 43546 mfp.ev = data.mainEl.eq(0); 43547 } else { 43548 mfp.ev = _document; 43549 } 43550 if (data.key) { 43551 if (!mfp.popupsCache[data.key]) { 43552 mfp.popupsCache[data.key] = {}; 43553 } 43554 mfp.currTemplate = mfp.popupsCache[data.key]; 43555 } else { 43556 mfp.currTemplate = {}; 43557 } 43558 mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data); 43559 mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos; 43560 if (mfp.st.modal) { 43561 mfp.st.closeOnContentClick = false; 43562 mfp.st.closeOnBgClick = false; 43563 mfp.st.showCloseBtn = false; 43564 mfp.st.enableEscapeKey = false; 43565 } 43566 43567 // Building markup 43568 // main containers are created only once 43569 if (!mfp.bgOverlay) { 43570 // Dark overlay 43571 mfp.bgOverlay = _getEl('bg').on('click' + EVENT_NS, function () { 43572 mfp.close(); 43573 }); 43574 mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click' + EVENT_NS, function (e) { 43575 if (mfp._checkIfClose(e.target)) { 43576 mfp.close(); 43577 } 43578 }); 43579 mfp.container = _getEl('container', mfp.wrap); 43580 } 43581 mfp.contentContainer = _getEl('content'); 43582 if (mfp.st.preloader) { 43583 mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading); 43584 } 43585 43586 // Initializing modules 43587 var modules = $.magnificPopup.modules; 43588 for (i = 0; i < modules.length; i++) { 43589 var n = modules[i]; 43590 n = n.charAt(0).toUpperCase() + n.slice(1); 43591 mfp['init' + n].call(mfp); 43592 } 43593 _mfpTrigger('BeforeOpen'); 43594 if (mfp.st.showCloseBtn) { 43595 // Close button 43596 if (!mfp.st.closeBtnInside) { 43597 mfp.wrap.append(_getCloseBtn()); 43598 } else { 43599 _mfpOn(MARKUP_PARSE_EVENT, function (e, template, values, item) { 43600 values.close_replaceWith = _getCloseBtn(item.type); 43601 }); 43602 _wrapClasses += ' mfp-close-btn-in'; 43603 } 43604 } 43605 if (mfp.st.alignTop) { 43606 _wrapClasses += ' mfp-align-top'; 43607 } 43608 if (mfp.fixedContentPos) { 43609 mfp.wrap.css({ 43610 overflow: mfp.st.overflowY, 43611 overflowX: 'hidden', 43612 overflowY: mfp.st.overflowY 43613 }); 43614 } else { 43615 mfp.wrap.css({ 43616 top: _window.scrollTop(), 43617 position: 'absolute' 43618 }); 43619 } 43620 if (mfp.st.fixedBgPos === false || mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos) { 43621 mfp.bgOverlay.css({ 43622 height: _document.height(), 43623 position: 'absolute' 43624 }); 43625 } 43626 if (mfp.st.enableEscapeKey) { 43627 // Close on ESC key 43628 _document.on('keyup' + EVENT_NS, function (e) { 43629 if (e.keyCode === 27) { 43630 mfp.close(); 43631 } 43632 }); 43633 } 43634 _window.on('resize' + EVENT_NS, function () { 43635 mfp.updateSize(); 43636 }); 43637 if (!mfp.st.closeOnContentClick) { 43638 _wrapClasses += ' mfp-auto-cursor'; 43639 } 43640 if (_wrapClasses) mfp.wrap.addClass(_wrapClasses); 43641 43642 // this triggers recalculation of layout, so we get it once to not to trigger twice 43643 var windowHeight = mfp.wH = _window.height(); 43644 var windowStyles = {}; 43645 if (mfp.fixedContentPos) { 43646 if (mfp._hasScrollBar(windowHeight)) { 43647 var s = mfp._getScrollbarSize(); 43648 if (s) { 43649 windowStyles.marginRight = s; 43650 } 43651 } 43652 } 43653 if (mfp.fixedContentPos) { 43654 if (!mfp.isIE7) { 43655 windowStyles.overflow = 'hidden'; 43656 } else { 43657 // ie7 double-scroll bug 43658 $('body, html').css('overflow', 'hidden'); 43659 } 43660 } 43661 var classesToadd = mfp.st.mainClass; 43662 if (mfp.isIE7) { 43663 classesToadd += ' mfp-ie7'; 43664 } 43665 if (classesToadd) { 43666 mfp._addClassToMFP(classesToadd); 43667 } 43668 43669 // add content 43670 mfp.updateItemHTML(); 43671 _mfpTrigger('BuildControls'); 43672 43673 // remove scrollbar, add margin e.t.c 43674 $('html').css(windowStyles); 43675 43676 // add everything to DOM 43677 mfp.bgOverlay.add(mfp.wrap).prependTo(mfp.st.prependTo || $(document.body)); 43678 43679 // Save last focused element 43680 mfp._lastFocusedEl = document.activeElement; 43681 43682 // Wait for next cycle to allow CSS transition 43683 setTimeout(function () { 43684 if (mfp.content) { 43685 mfp._addClassToMFP(READY_CLASS); 43686 mfp._setFocus(); 43687 } else { 43688 // if content is not defined (not loaded e.t.c) we add class only for BG 43689 mfp.bgOverlay.addClass(READY_CLASS); 43690 } 43691 43692 // Trap the focus in popup 43693 _document.on('focusin' + EVENT_NS, mfp._onFocusIn); 43694 }, 16); 43695 mfp.isOpen = true; 43696 mfp.updateSize(windowHeight); 43697 _mfpTrigger(OPEN_EVENT); 43698 return data; 43699 }, 43700 /** 43701 * Closes the popup 43702 */ 43703 close: function close() { 43704 if (!mfp.isOpen) return; 43705 _mfpTrigger(BEFORE_CLOSE_EVENT); 43706 mfp.isOpen = false; 43707 // for CSS3 animation 43708 if (mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition) { 43709 mfp._addClassToMFP(REMOVING_CLASS); 43710 setTimeout(function () { 43711 mfp._close(); 43712 }, mfp.st.removalDelay); 43713 } else { 43714 mfp._close(); 43715 } 43716 }, 43717 /** 43718 * Helper for close() function 43719 */ 43720 _close: function _close() { 43721 _mfpTrigger(CLOSE_EVENT); 43722 var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' '; 43723 mfp.bgOverlay.detach(); 43724 mfp.wrap.detach(); 43725 mfp.container.empty(); 43726 if (mfp.st.mainClass) { 43727 classesToRemove += mfp.st.mainClass + ' '; 43728 } 43729 mfp._removeClassFromMFP(classesToRemove); 43730 if (mfp.fixedContentPos) { 43731 var windowStyles = { 43732 marginRight: '' 43733 }; 43734 if (mfp.isIE7) { 43735 $('body, html').css('overflow', ''); 43736 } else { 43737 windowStyles.overflow = ''; 43738 } 43739 $('html').css(windowStyles); 43740 } 43741 _document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS); 43742 mfp.ev.off(EVENT_NS); 43743 43744 // clean up DOM elements that aren't removed 43745 mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style'); 43746 mfp.bgOverlay.attr('class', 'mfp-bg'); 43747 mfp.container.attr('class', 'mfp-container'); 43748 43749 // remove close button from target element 43750 if (mfp.st.showCloseBtn && (!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) { 43751 if (mfp.currTemplate.closeBtn) mfp.currTemplate.closeBtn.detach(); 43752 } 43753 if (mfp.st.autoFocusLast && mfp._lastFocusedEl) { 43754 $(mfp._lastFocusedEl).focus(); // put tab focus back 43755 } 43756 mfp.currItem = null; 43757 mfp.content = null; 43758 mfp.currTemplate = null; 43759 mfp.prevHeight = 0; 43760 _mfpTrigger(AFTER_CLOSE_EVENT); 43761 }, 43762 updateSize: function updateSize(winHeight) { 43763 if (mfp.isIOS) { 43764 // fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2 43765 var zoomLevel = document.documentElement.clientWidth / window.innerWidth; 43766 var height = window.innerHeight * zoomLevel; 43767 mfp.wrap.css('height', height); 43768 mfp.wH = height; 43769 } else { 43770 mfp.wH = winHeight || _window.height(); 43771 } 43772 // Fixes #84: popup incorrectly positioned with position:relative on body 43773 if (!mfp.fixedContentPos) { 43774 mfp.wrap.css('height', mfp.wH); 43775 } 43776 _mfpTrigger('Resize'); 43777 }, 43778 /** 43779 * Set content of popup based on current index 43780 */ 43781 updateItemHTML: function updateItemHTML() { 43782 var item = mfp.items[mfp.index]; 43783 43784 // Detach and perform modifications 43785 mfp.contentContainer.detach(); 43786 if (mfp.content) mfp.content.detach(); 43787 if (!item.parsed) { 43788 item = mfp.parseEl(mfp.index); 43789 } 43790 var type = item.type; 43791 _mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]); 43792 // BeforeChange event works like so: 43793 // _mfpOn('BeforeChange', function(e, prevType, newType) { }); 43794 43795 mfp.currItem = item; 43796 if (!mfp.currTemplate[type]) { 43797 var markup = mfp.st[type] ? mfp.st[type].markup : false; 43798 43799 // allows to modify markup 43800 _mfpTrigger('FirstMarkupParse', markup); 43801 if (markup) { 43802 mfp.currTemplate[type] = $(markup); 43803 } else { 43804 // if there is no markup found we just define that template is parsed 43805 mfp.currTemplate[type] = true; 43806 } 43807 } 43808 if (_prevContentType && _prevContentType !== item.type) { 43809 mfp.container.removeClass('mfp-' + _prevContentType + '-holder'); 43810 } 43811 var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]); 43812 mfp.appendContent(newContent, type); 43813 item.preloaded = true; 43814 _mfpTrigger(CHANGE_EVENT, item); 43815 _prevContentType = item.type; 43816 43817 // Append container back after its content changed 43818 mfp.container.prepend(mfp.contentContainer); 43819 _mfpTrigger('AfterChange'); 43820 }, 43821 /** 43822 * Set HTML content of popup 43823 */ 43824 appendContent: function appendContent(newContent, type) { 43825 mfp.content = newContent; 43826 if (newContent) { 43827 if (mfp.st.showCloseBtn && mfp.st.closeBtnInside && mfp.currTemplate[type] === true) { 43828 // if there is no markup, we just append close button element inside 43829 if (!mfp.content.find('.mfp-close').length) { 43830 mfp.content.append(_getCloseBtn()); 43831 } 43832 } else { 43833 mfp.content = newContent; 43834 } 43835 } else { 43836 mfp.content = ''; 43837 } 43838 _mfpTrigger(BEFORE_APPEND_EVENT); 43839 mfp.container.addClass('mfp-' + type + '-holder'); 43840 mfp.contentContainer.append(mfp.content); 43841 }, 43842 /** 43843 * Creates Magnific Popup data object based on given data 43844 * @param {int} index Index of item to parse 43845 */ 43846 parseEl: function parseEl(index) { 43847 var item = mfp.items[index], 43848 type; 43849 if (item.tagName) { 43850 item = { 43851 el: $(item) 43852 }; 43853 } else { 43854 type = item.type; 43855 item = { 43856 data: item, 43857 src: item.src 43858 }; 43859 } 43860 if (item.el) { 43861 var types = mfp.types; 43862 43863 // check for 'mfp-TYPE' class 43864 for (var i = 0; i < types.length; i++) { 43865 if (item.el.hasClass('mfp-' + types[i])) { 43866 type = types[i]; 43867 break; 43868 } 43869 } 43870 item.src = item.el.attr('data-mfp-src'); 43871 if (!item.src) { 43872 item.src = item.el.attr('href'); 43873 } 43874 } 43875 item.type = type || mfp.st.type || 'inline'; 43876 item.index = index; 43877 item.parsed = true; 43878 mfp.items[index] = item; 43879 _mfpTrigger('ElementParse', item); 43880 return mfp.items[index]; 43881 }, 43882 /** 43883 * Initializes single popup or a group of popups 43884 */ 43885 addGroup: function addGroup(el, options) { 43886 var eHandler = function eHandler(e) { 43887 e.mfpEl = this; 43888 mfp._openClick(e, el, options); 43889 }; 43890 if (!options) { 43891 options = {}; 43892 } 43893 var eName = 'click.magnificPopup'; 43894 options.mainEl = el; 43895 if (options.items) { 43896 options.isObj = true; 43897 el.off(eName).on(eName, eHandler); 43898 } else { 43899 options.isObj = false;
43900 if (options.delegate) { 43901 el.off(eName).on(eName, options.delegate, eHandler); 43902 } else { 43903 options.items = el; 43904 el.off(eName).on(eName, eHandler); 43905 } 43906 } 43907 }, 43908 _openClick: function _openClick(e, el, options) { 43909 var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick; 43910 if (!midClick && (e.which === 2 || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey)) { 43911 return; 43912 } 43913 var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn; 43914 if (disableOn) { 43915 if ($.isFunction(disableOn)) { 43916 if (!disableOn.call(mfp)) { 43917 return true; 43918 } 43919 } else { 43920 // else it's number 43921 if (_window.width() < disableOn) { 43922 return true; 43923 } 43924 } 43925 } 43926 if (e.type) { 43927 e.preventDefault(); 43928 43929 // This will prevent popup from closing if element is inside and popup is already opened 43930 if (mfp.isOpen) { 43931 e.stopPropagation(); 43932 } 43933 } 43934 options.el = $(e.mfpEl); 43935 if (options.delegate) { 43936 options.items = el.find(options.delegate); 43937 } 43938 mfp.open(options); 43939 }, 43940 /** 43941 * Updates text on preloader 43942 */ 43943 updateStatus: function updateStatus(status, text) { 43944 if (mfp.preloader) { 43945 if (_prevStatus !== status) { 43946 mfp.container.removeClass('mfp-s-' + _prevStatus); 43947 } 43948 if (!text && status === 'loading') { 43949 text = mfp.st.tLoading; 43950 } 43951 var data = { 43952 status: status, 43953 text: text 43954 }; 43955 // allows to modify status 43956 _mfpTrigger('UpdateStatus', data); 43957 status = data.status; 43958 text = data.text; 43959 mfp.preloader.html(text); 43960 mfp.preloader.find('a').on('click', function (e) { 43961 e.stopImmediatePropagation(); 43962 }); 43963 mfp.container.addClass('mfp-s-' + status); 43964 _prevStatus = status; 43965 } 43966 }, 43967 /* 43968 "Private" helpers that aren't private at all 43969 */ 43970 // Check to close popup or not 43971 // "target" is an element that was clicked 43972 _checkIfClose: function _checkIfClose(target) { 43973 if ($(target).hasClass(PREVENT_CLOSE_CLASS)) { 43974 return; 43975 } 43976 var closeOnContent = mfp.st.closeOnContentClick; 43977 var closeOnBg = mfp.st.closeOnBgClick; 43978 if (closeOnContent && closeOnBg) { 43979 return true; 43980 } else { 43981 // We close the popup if click is on close button or on preloader. Or if there is no content. 43982 if (!mfp.content || $(target).hasClass('mfp-close') || mfp.preloader && target === mfp.preloader[0]) { 43983 return true; 43984 } 43985 43986 // if click is outside the content 43987 if (target !== mfp.content[0] && !$.contains(mfp.content[0], target)) { 43988 if (closeOnBg) { 43989 // last check, if the clicked element is in DOM, (in case it's removed onclick) 43990 if ($.contains(document, target)) { 43991 return true; 43992 } 43993 } 43994 } else if (closeOnContent) { 43995 return true; 43996 } 43997 } 43998 return false; 43999 }, 44000 _addClassToMFP: function _addClassToMFP(cName) { 44001 mfp.bgOverlay.addClass(cName); 44002 mfp.wrap.addClass(cName); 44003 }, 44004 _removeClassFromMFP: function _removeClassFromMFP(cName) { 44005 this.bgOverlay.removeClass(cName); 44006 mfp.wrap.removeClass(cName); 44007 }, 44008 _hasScrollBar: function _hasScrollBar(winHeight) { 44009 return (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()); 44010 }, 44011 _setFocus: function _setFocus() { 44012 (mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus(); 44013 }, 44014 _onFocusIn: function _onFocusIn(e) { 44015 if (e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target)) { 44016 mfp._setFocus(); 44017 return false; 44018 } 44019 }, 44020 _parseMarkup: function _parseMarkup(template, values, item) { 44021 var arr; 44022 if (item.data) { 44023 values = $.extend(item.data, values); 44024 } 44025 _mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item]); 44026 $.each(values, function (key, value) { 44027 if (value === undefined || value === false) { 44028 return true; 44029 } 44030 arr = key.split('_'); 44031 if (arr.length > 1) { 44032 var el = template.find(EVENT_NS + '-' + arr[0]); 44033 if (el.length > 0) { 44034 var attr = arr[1]; 44035 if (attr === 'replaceWith') { 44036 if (el[0] !== value[0]) { 44037 el.replaceWith(value); 44038 } 44039 } else if (attr === 'img') { 44040 if (el.is('img')) { 44041 el.attr('src', value); 44042 } else { 44043 el.replaceWith($('<img>').attr('src', value).attr('class', el.attr('class'))); 44044 } 44045 } else { 44046 el.attr(arr[1], value); 44047 } 44048 } 44049 } else { 44050 template.find(EVENT_NS + '-' + key).html(value); 44051 } 44052 }); 44053 }, 44054 _getScrollbarSize: function _getScrollbarSize() { 44055 // thx David 44056 if (mfp.scrollbarSize === undefined) { 44057 var scrollDiv = document.createElement("div"); 44058 scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;'; 44059 document.body.appendChild(scrollDiv); 44060 mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth; 44061 document.body.removeChild(scrollDiv); 44062 } 44063 return mfp.scrollbarSize; 44064 } 44065 }; /* MagnificPopup core prototype end */ 44066 44067 /** 44068 * Public static functions 44069 */ 44070 $.magnificPopup = { 44071 instance: null, 44072 proto: MagnificPopup.prototype, 44073 modules: [], 44074 open: function open(options, index) { 44075 _checkInstance(); 44076 if (!options) { 44077 options = {}; 44078 } else { 44079 options = $.extend(true, {}, options); 44080 } 44081 options.isObj = true; 44082 options.index = index || 0; 44083 return this.instance.open(options); 44084 }, 44085 close: function close() { 44086 return $.magnificPopup.instance && $.magnificPopup.instance.close(); 44087 }, 44088 registerModule: function registerModule(name, module) { 44089 if (module.options) { 44090 $.magnificPopup.defaults[name] = module.options; 44091 } 44092 $.extend(this.proto, module.proto); 44093 this.modules.push(name); 44094 }, 44095 defaults: { 44096 // Info about options is in docs:
vendor: 6,041 bytes, lines 44097-44298
44097 // http://dimsemenov.com/plugins/magnific-popup/documentation.html#options 44098 44099 disableOn: 0, 44100 key: null, 44101 midClick: false, 44102 mainClass: '', 44103 preloader: true, 44104 focus: '', 44105 // CSS selector of input to focus after popup is opened 44106 44107 closeOnContentClick: false, 44108 closeOnBgClick: true, 44109 closeBtnInside: true, 44110 showCloseBtn: true, 44111 enableEscapeKey: true, 44112 modal: false, 44113 alignTop: false, 44114 removalDelay: 0, 44115 prependTo: null, 44116 fixedContentPos: 'auto', 44117 fixedBgPos: 'auto', 44118 overflowY: 'auto', 44119 closeMarkup: '<button title="%title%" type="button" class="mfp-close">×</button>', 44120 tClose: 'Close (Esc)', 44121 tLoading: 'Loading...', 44122 autoFocusLast: true 44123 } 44124 }; 44125 $.fn.magnificPopup = function (options) { 44126 _checkInstance(); 44127 var jqEl = $(this); 44128 44129 // We call some API method of first param is a string 44130 if (typeof options === "string") { 44131 if (options === 'open') { 44132 var items, 44133 itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup, 44134 index = parseInt(arguments[1], 10) || 0; 44135 if (itemOpts.items) { 44136 items = itemOpts.items[index]; 44137 } else { 44138 items = jqEl; 44139 if (itemOpts.delegate) { 44140 items = items.find(itemOpts.delegate); 44141 } 44142 items = items.eq(index); 44143 } 44144 mfp._openClick({ 44145 mfpEl: items 44146 }, jqEl, itemOpts); 44147 } else { 44148 if (mfp.isOpen) mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1)); 44149 } 44150 } else { 44151 // clone options obj 44152 options = $.extend(true, {}, options); 44153 44154 /* 44155 * As Zepto doesn't support .data() method for objects 44156 * and it works only in normal browsers 44157 * we assign "options" object directly to the DOM element. FTW! 44158 */ 44159 if (_isJQ) { 44160 jqEl.data('magnificPopup', options); 44161 } else { 44162 jqEl[0].magnificPopup = options; 44163 } 44164 mfp.addGroup(jqEl, options); 44165 } 44166 return jqEl; 44167 }; 44168 44169 /*>>core*/ 44170 44171 /*>>inline*/ 44172 44173 var INLINE_NS = 'inline', 44174 _hiddenClass, 44175 _inlinePlaceholder, 44176 _lastInlineElement, 44177 _putInlineElementsBack = function _putInlineElementsBack() { 44178 if (_lastInlineElement) { 44179 _inlinePlaceholder.after(_lastInlineElement.addClass(_hiddenClass)).detach(); 44180 _lastInlineElement = null; 44181 } 44182 }; 44183 $.magnificPopup.registerModule(INLINE_NS, { 44184 options: { 44185 hiddenClass: 'hide', 44186 // will be appended with `mfp-` prefix 44187 markup: '', 44188 tNotFound: 'Content not found' 44189 }, 44190 proto: { 44191 initInline: function initInline() { 44192 mfp.types.push(INLINE_NS); 44193 _mfpOn(CLOSE_EVENT + '.' + INLINE_NS, function () { 44194 _putInlineElementsBack(); 44195 }); 44196 }, 44197 getInline: function getInline(item, template) { 44198 _putInlineElementsBack(); 44199 if (item.src) { 44200 var inlineSt = mfp.st.inline, 44201 el = $(item.src); 44202 if (el.length) { 44203 // If target element has parent - we replace it with placeholder and put it back after popup is closed 44204 var parent = el[0].parentNode; 44205 if (parent && parent.tagName) { 44206 if (!_inlinePlaceholder) { 44207 _hiddenClass = inlineSt.hiddenClass; 44208 _inlinePlaceholder = _getEl(_hiddenClass); 44209 _hiddenClass = 'mfp-' + _hiddenClass; 44210 } 44211 // replace target inline element with placeholder 44212 _lastInlineElement = el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass); 44213 } 44214 mfp.updateStatus('ready'); 44215 } else { 44216 mfp.updateStatus('error', inlineSt.tNotFound); 44217 el = $('<div>'); 44218 } 44219 item.inlineElement = el; 44220 return el; 44221 } 44222 mfp.updateStatus('ready'); 44223 mfp._parseMarkup(template, {}, item); 44224 return template; 44225 } 44226 } 44227 }); 44228 44229 /*>>inline*/ 44230 44231 /*>>ajax*/ 44232 var AJAX_NS = 'ajax', 44233 _ajaxCur, 44234 _removeAjaxCursor = function _removeAjaxCursor() { 44235 if (_ajaxCur) { 44236 $(document.body).removeClass(_ajaxCur); 44237 } 44238 }, 44239 _destroyAjaxRequest = function _destroyAjaxRequest() { 44240 _removeAjaxCursor(); 44241 if (mfp.req) { 44242 mfp.req.abort(); 44243 } 44244 }; 44245 $.magnificPopup.registerModule(AJAX_NS, { 44246 options: { 44247 settings: null, 44248 cursor: 'mfp-ajax-cur', 44249 tError: '<a href="%url%">The content</a> could not be loaded.' 44250 }, 44251 proto: { 44252 initAjax: function initAjax() { 44253 mfp.types.push(AJAX_NS); 44254 _ajaxCur = mfp.st.ajax.cursor; 44255 _mfpOn(CLOSE_EVENT + '.' + AJAX_NS, _destroyAjaxRequest); 44256 _mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest); 44257 }, 44258 getAjax: function getAjax(item) { 44259 if (_ajaxCur) { 44260 $(document.body).addClass(_ajaxCur); 44261 } 44262 mfp.updateStatus('loading'); 44263 var opts = $.extend({ 44264 url: item.src, 44265 success: function success(data, textStatus, jqXHR) { 44266 var temp = { 44267 data: data, 44268 xhr: jqXHR 44269 }; 44270 _mfpTrigger('ParseAjax', temp); 44271 mfp.appendContent($(temp.data), AJAX_NS); 44272 item.finished = true; 44273 _removeAjaxCursor(); 44274 mfp._setFocus(); 44275 setTimeout(function () { 44276 mfp.wrap.addClass(READY_CLASS); 44277 }, 16); 44278 mfp.updateStatus('ready'); 44279 _mfpTrigger('AjaxContentAdded'); 44280 }, 44281 error: function error() { 44282 _removeAjaxCursor(); 44283 item.finished = item.loadError = true; 44284 mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src)); 44285 } 44286 }, mfp.st.ajax.settings); 44287 mfp.req = $.ajax(opts); 44288 return ''; 44289 } 44290 } 44291 }); 44292 44293 /*>>ajax*/ 44294 44295 /*>>image*/ 44296 var _imgInterval, 44297 _getTitle = function _getTitle(item) { 44298 if (item.data && item.data.title !== undefined) return item.data.title;
44299 var src = mfp.st.image.titleSrc; 44300 if (src) { 44301 if ($.isFunction(src)) { 44302 return src.call(mfp, item); 44303 } else if (item.el) { 44304 return item.el.attr(src) || ''; 44305 } 44306 } 44307 return ''; 44308 }; 44309 $.magnificPopup.registerModule('image', { 44310 options: { 44311 markup: '<div class="mfp-figure">' + '<div class="mfp-close"></div>' + '<figure>' + '<div class="mfp-img"></div>' + '<figcaption>' + '<div class="mfp-bottom-bar">' + '<div class="mfp-title"></div>' + '<div class="mfp-counter"></div>' + '</div>' + '</figcaption>' + '</figure>' + '</div>', 44312 cursor: 'mfp-zoom-out-cur', 44313 titleSrc: 'title', 44314 verticalFit: true, 44315 tError: '<a href="%url%">The image</a> could not be loaded.' 44316 }, 44317 proto: { 44318 initImage: function initImage() { 44319 var imgSt = mfp.st.image, 44320 ns = '.image'; 44321 mfp.types.push('image'); 44322 _mfpOn(OPEN_EVENT + ns, function () { 44323 if (mfp.currItem.type === 'image' && imgSt.cursor) { 44324 $(document.body).addClass(imgSt.cursor); 44325 } 44326 }); 44327 _mfpOn(CLOSE_EVENT + ns, function () { 44328 if (imgSt.cursor) { 44329 $(document.body).removeClass(imgSt.cursor); 44330 } 44331 _window.off('resize' + EVENT_NS); 44332 }); 44333 _mfpOn('Resize' + ns, mfp.resizeImage); 44334 if (mfp.isLowIE) { 44335 _mfpOn('AfterChange', mfp.resizeImage); 44336 } 44337 }, 44338 resizeImage: function resizeImage() { 44339 var item = mfp.currItem; 44340 if (!item || !item.img) return; 44341 if (mfp.st.image.verticalFit) { 44342 var decr = 0; 44343 // fix box-sizing in ie7/8 44344 if (mfp.isLowIE) { 44345 decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'), 10); 44346 } 44347 item.img.css('max-height', mfp.wH - decr); 44348 } 44349 }, 44350 _onImageHasSize: function _onImageHasSize(item) { 44351 if (item.img) { 44352 item.hasSize = true; 44353 if (_imgInterval) { 44354 clearInterval(_imgInterval); 44355 } 44356 item.isCheckingImgSize = false; 44357 _mfpTrigger('ImageHasSize', item); 44358 if (item.imgHidden) { 44359 if (mfp.content) mfp.content.removeClass('mfp-loading'); 44360 item.imgHidden = false; 44361 } 44362 } 44363 }, 44364 /** 44365 * Function that loops until the image has size to display elements that rely on it asap 44366 */ 44367 findImageSize: function findImageSize(item) { 44368 var counter = 0, 44369 img = item.img[0], 44370 _mfpSetInterval = function mfpSetInterval(delay) { 44371 if (_imgInterval) { 44372 clearInterval(_imgInterval); 44373 } 44374 // decelerating interval that checks for size of an image 44375 _imgInterval = setInterval(function () { 44376 if (img.naturalWidth > 0) { 44377 mfp._onImageHasSize(item); 44378 return; 44379 } 44380 if (counter > 200) { 44381 clearInterval(_imgInterval); 44382 } 44383 counter++; 44384 if (counter === 3) { 44385 _mfpSetInterval(10); 44386 } else if (counter === 40) { 44387 _mfpSetInterval(50); 44388 } else if (counter === 100) { 44389 _mfpSetInterval(500); 44390 } 44391 }, delay); 44392 }; 44393 _mfpSetInterval(1); 44394 }, 44395 getImage: function getImage(item, template) { 44396 var guard = 0, 44397 // image load complete handler 44398 _onLoadComplete = function onLoadComplete() { 44399 if (item) { 44400 if (item.img[0].complete) { 44401 item.img.off('.mfploader'); 44402 if (item === mfp.currItem) { 44403 mfp._onImageHasSize(item); 44404 mfp.updateStatus('ready'); 44405 } 44406 item.hasSize = true; 44407 item.loaded = true; 44408 _mfpTrigger('ImageLoadComplete'); 44409 } else { 44410 // if image complete check fails 200 times (20 sec), we assume that there was an error. 44411 guard++; 44412 if (guard < 200) { 44413 setTimeout(_onLoadComplete, 100); 44414 } else { 44415 onLoadError(); 44416 } 44417 } 44418 } 44419 }, 44420 // image error handler 44421 onLoadError = function onLoadError() { 44422 if (item) { 44423 item.img.off('.mfploader'); 44424 if (item === mfp.currItem) { 44425 mfp._onImageHasSize(item); 44426 mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src)); 44427 } 44428 item.hasSize = true; 44429 item.loaded = true; 44430 item.loadError = true; 44431 } 44432 }, 44433 imgSt = mfp.st.image; 44434 var el = template.find('.mfp-img'); 44435 if (el.length) { 44436 var img = document.createElement('img'); 44437 img.className = 'mfp-img'; 44438 if (item.el && item.el.find('img').length) { 44439 img.alt = item.el.find('img').attr('alt'); 44440 } 44441 item.img = $(img).on('load.mfploader', _onLoadComplete).on('error.mfploader', onLoadError); 44442 img.src = item.src; 44443 44444 // without clone() "error" event is not firing when IMG is replaced by new IMG
vendor: 10,374 bytes, lines 44445-44759
44445 // TODO: find a way to avoid such cloning 44446 if (el.is('img')) { 44447 item.img = item.img.clone(); 44448 } 44449 img = item.img[0]; 44450 if (img.naturalWidth > 0) { 44451 item.hasSize = true; 44452 } else if (!img.width) { 44453 item.hasSize = false; 44454 } 44455 } 44456 mfp._parseMarkup(template, { 44457 title: _getTitle(item), 44458 img_replaceWith: item.img 44459 }, item); 44460 mfp.resizeImage(); 44461 if (item.hasSize) { 44462 if (_imgInterval) clearInterval(_imgInterval); 44463 if (item.loadError) { 44464 template.addClass('mfp-loading'); 44465 mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src)); 44466 } else { 44467 template.removeClass('mfp-loading'); 44468 mfp.updateStatus('ready'); 44469 } 44470 return template; 44471 } 44472 mfp.updateStatus('loading'); 44473 item.loading = true; 44474 if (!item.hasSize) { 44475 item.imgHidden = true; 44476 template.addClass('mfp-loading'); 44477 mfp.findImageSize(item); 44478 } 44479 return template; 44480 } 44481 } 44482 }); 44483 44484 /*>>image*/ 44485 44486 /*>>zoom*/ 44487 var hasMozTransform, 44488 getHasMozTransform = function getHasMozTransform() { 44489 if (hasMozTransform === undefined) { 44490 hasMozTransform = document.createElement('p').style.MozTransform !== undefined; 44491 } 44492 return hasMozTransform; 44493 }; 44494 $.magnificPopup.registerModule('zoom', { 44495 options: { 44496 enabled: false, 44497 easing: 'ease-in-out', 44498 duration: 300, 44499 opener: function opener(element) { 44500 return element.is('img') ? element : element.find('img'); 44501 } 44502 }, 44503 proto: { 44504 initZoom: function initZoom() { 44505 var zoomSt = mfp.st.zoom, 44506 ns = '.zoom', 44507 image; 44508 if (!zoomSt.enabled || !mfp.supportsTransition) { 44509 return; 44510 } 44511 var duration = zoomSt.duration, 44512 getElToAnimate = function getElToAnimate(image) { 44513 var newImg = image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'), 44514 transition = 'all ' + zoomSt.duration / 1000 + 's ' + zoomSt.easing, 44515 cssObj = { 44516 position: 'fixed', 44517 zIndex: 9999, 44518 left: 0, 44519 top: 0, 44520 '-webkit-backface-visibility': 'hidden' 44521 }, 44522 t = 'transition'; 44523 cssObj['-webkit-' + t] = cssObj['-moz-' + t] = cssObj['-o-' + t] = cssObj[t] = transition; 44524 newImg.css(cssObj); 44525 return newImg; 44526 }, 44527 showMainContent = function showMainContent() { 44528 mfp.content.css('visibility', 'visible'); 44529 }, 44530 openTimeout, 44531 animatedImg; 44532 _mfpOn('BuildControls' + ns, function () { 44533 if (mfp._allowZoom()) { 44534 clearTimeout(openTimeout); 44535 mfp.content.css('visibility', 'hidden'); 44536 44537 // Basically, all code below does is clones existing image, puts in on top of the current one and animated it 44538 44539 image = mfp._getItemToZoom(); 44540 if (!image) { 44541 showMainContent(); 44542 return; 44543 } 44544 animatedImg = getElToAnimate(image); 44545 animatedImg.css(mfp._getOffset()); 44546 mfp.wrap.append(animatedImg); 44547 openTimeout = setTimeout(function () { 44548 animatedImg.css(mfp._getOffset(true)); 44549 openTimeout = setTimeout(function () { 44550 showMainContent(); 44551 setTimeout(function () { 44552 animatedImg.remove(); 44553 image = animatedImg = null; 44554 _mfpTrigger('ZoomAnimationEnded'); 44555 }, 16); // avoid blink when switching images 44556 }, duration); // this timeout equals animation duration 44557 }, 16); // by adding this timeout we avoid short glitch at the beginning of animation 44558 44559 // Lots of timeouts... 44560 } 44561 }); 44562 _mfpOn(BEFORE_CLOSE_EVENT + ns, function () { 44563 if (mfp._allowZoom()) { 44564 clearTimeout(openTimeout); 44565 mfp.st.removalDelay = duration; 44566 if (!image) { 44567 image = mfp._getItemToZoom(); 44568 if (!image) { 44569 return; 44570 } 44571 animatedImg = getElToAnimate(image); 44572 } 44573 animatedImg.css(mfp._getOffset(true)); 44574 mfp.wrap.append(animatedImg); 44575 mfp.content.css('visibility', 'hidden'); 44576 setTimeout(function () { 44577 animatedImg.css(mfp._getOffset()); 44578 }, 16); 44579 } 44580 }); 44581 _mfpOn(CLOSE_EVENT + ns, function () { 44582 if (mfp._allowZoom()) { 44583 showMainContent(); 44584 if (animatedImg) { 44585 animatedImg.remove(); 44586 } 44587 image = null; 44588 } 44589 }); 44590 }, 44591 _allowZoom: function _allowZoom() { 44592 return mfp.currItem.type === 'image'; 44593 }, 44594 _getItemToZoom: function _getItemToZoom() { 44595 if (mfp.currItem.hasSize) { 44596 return mfp.currItem.img; 44597 } else { 44598 return false; 44599 } 44600 }, 44601 // Get element postion relative to viewport 44602 _getOffset: function _getOffset(isLarge) { 44603 var el; 44604 if (isLarge) { 44605 el = mfp.currItem.img; 44606 } else { 44607 el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem); 44608 } 44609 var offset = el.offset(); 44610 var paddingTop = parseInt(el.css('padding-top'), 10); 44611 var paddingBottom = parseInt(el.css('padding-bottom'), 10); 44612 offset.top -= $(window).scrollTop() - paddingTop; 44613 44614 /* 44615 Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa. 44616 */ 44617 var obj = { 44618 width: el.width(), 44619 // fix Zepto height+padding issue 44620 height: (_isJQ ? el.innerHeight() : el[0].offsetHeight) - paddingBottom - paddingTop 44621 }; 44622 44623 // I hate to do this, but there is no another option 44624 if (getHasMozTransform()) { 44625 obj['-moz-transform'] = obj['transform'] = 'translate(' + offset.left + 'px,' + offset.top + 'px)'; 44626 } else { 44627 obj.left = offset.left; 44628 obj.top = offset.top; 44629 } 44630 return obj; 44631 } 44632 } 44633 }); 44634 44635 /*>>zoom*/ 44636 44637 /*>>iframe*/ 44638 44639 var IFRAME_NS = 'iframe', 44640 _emptyPage = '//about:blank', 44641 _fixIframeBugs = function _fixIframeBugs(isShowing) { 44642 if (mfp.currTemplate[IFRAME_NS]) { 44643 var el = mfp.currTemplate[IFRAME_NS].find('iframe'); 44644 if (el.length) { 44645 // reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug 44646 if (!isShowing) { 44647 el[0].src = _emptyPage; 44648 } 44649 44650 // IE8 black screen bug fix 44651 if (mfp.isIE8) { 44652 el.css('display', isShowing ? 'block' : 'none'); 44653 } 44654 } 44655 } 44656 }; 44657 $.magnificPopup.registerModule(IFRAME_NS, { 44658 options: { 44659 markup: '<div class="mfp-iframe-scaler">' + '<div class="mfp-close"></div>' + '<iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe>' + '</div>', 44660 srcAction: 'iframe_src', 44661 // we don't care and support only one default type of URL by default 44662 patterns: { 44663 youtube: { 44664 index: 'youtube.com', 44665 id: 'v=', 44666 src: '//www.youtube.com/embed/%id%?autoplay=1' 44667 }, 44668 vimeo: { 44669 index: 'vimeo.com/', 44670 id: '/', 44671 src: '//player.vimeo.com/video/%id%?autoplay=1' 44672 }, 44673 gmaps: { 44674 index: '//maps.google.', 44675 src: '%id%&output=embed' 44676 } 44677 } 44678 }, 44679 proto: { 44680 initIframe: function initIframe() { 44681 mfp.types.push(IFRAME_NS); 44682 _mfpOn('BeforeChange', function (e, prevType, newType) { 44683 if (prevType !== newType) { 44684 if (prevType === IFRAME_NS) { 44685 _fixIframeBugs(); // iframe if removed 44686 } else if (newType === IFRAME_NS) { 44687 _fixIframeBugs(true); // iframe is showing 44688 } 44689 } // else { 44690 // iframe source is switched, don't do anything 44691 //} 44692 }); 44693 _mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, function () { 44694 _fixIframeBugs(); 44695 }); 44696 }, 44697 getIframe: function getIframe(item, template) { 44698 var embedSrc = item.src; 44699 var iframeSt = mfp.st.iframe; 44700 $.each(iframeSt.patterns, function () { 44701 if (embedSrc.indexOf(this.index) > -1) { 44702 if (this.id) { 44703 if (typeof this.id === 'string') { 44704 embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id) + this.id.length, embedSrc.length); 44705 } else { 44706 embedSrc = this.id.call(this, embedSrc); 44707 } 44708 } 44709 embedSrc = this.src.replace('%id%', embedSrc); 44710 return false; // break; 44711 } 44712 }); 44713 var dataObj = {}; 44714 if (iframeSt.srcAction) { 44715 dataObj[iframeSt.srcAction] = embedSrc; 44716 } 44717 mfp._parseMarkup(template, dataObj, item); 44718 mfp.updateStatus('ready'); 44719 return template; 44720 } 44721 } 44722 }); 44723 44724 /*>>iframe*/ 44725 44726 /*>>gallery*/ 44727 /** 44728 * Get looped index depending on number of slides 44729 */ 44730 var _getLoopedId = function _getLoopedId(index) { 44731 var numSlides = mfp.items.length; 44732 if (index > numSlides - 1) { 44733 return index - numSlides; 44734 } else if (index < 0) { 44735 return numSlides + index; 44736 } 44737 return index; 44738 }, 44739 _replaceCurrTotal = function _replaceCurrTotal(text, curr, total) { 44740 return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total); 44741 }; 44742 $.magnificPopup.registerModule('gallery', { 44743 options: { 44744 enabled: false, 44745 arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', 44746 preload: [0, 2], 44747 navigateByImgClick: true, 44748 arrows: true, 44749 tPrev: 'Previous (Left arrow key)', 44750 tNext: 'Next (Right arrow key)', 44751 tCounter: '%curr% of %total%' 44752 }, 44753 proto: { 44754 initGallery: function initGallery() { 44755 var gSt = mfp.st.gallery, 44756 ns = '.mfp-gallery'; 44757 mfp.direction = true; // true - next, false - prev 44758 44759 if (!gSt || !gSt.enabled) return false;
44760 _wrapClasses += ' mfp-gallery'; 44761 _mfpOn(OPEN_EVENT + ns, function () { 44762 if (gSt.navigateByImgClick) { 44763 mfp.wrap.on('click' + ns, '.mfp-img', function () { 44764 if (mfp.items.length > 1) { 44765 mfp.next(); 44766 return false; 44767 } 44768 }); 44769 } 44770 _document.on('keydown' + ns, function (e) { 44771 if (e.keyCode === 37) { 44772 mfp.prev(); 44773 } else if (e.keyCode === 39) { 44774 mfp.next(); 44775 } 44776 }); 44777 }); 44778 _mfpOn('UpdateStatus' + ns, function (e, data) { 44779 if (data.text) { 44780 data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length); 44781 } 44782 }); 44783 _mfpOn(MARKUP_PARSE_EVENT + ns, function (e, element, values, item) { 44784 var l = mfp.items.length; 44785 values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : ''; 44786 }); 44787 _mfpOn('BuildControls' + ns, function () { 44788 if (mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) { 44789 var markup = gSt.arrowMarkup, 44790 arrowLeft = mfp.arrowLeft = $(markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left')).addClass(PREVENT_CLOSE_CLASS), 44791 arrowRight = mfp.arrowRight = $(markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right')).addClass(PREVENT_CLOSE_CLASS); 44792 arrowLeft.click(function () { 44793 mfp.prev(); 44794 }); 44795 arrowRight.click(function () { 44796 mfp.next(); 44797 }); 44798 mfp.container.append(arrowLeft.add(arrowRight)); 44799 } 44800 }); 44801 _mfpOn(CHANGE_EVENT + ns, function () { 44802 if (mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout); 44803 mfp._preloadTimeout = setTimeout(function () { 44804 mfp.preloadNearbyImages(); 44805 mfp._preloadTimeout = null; 44806 }, 16); 44807 }); 44808 _mfpOn(CLOSE_EVENT + ns, function () { 44809 _document.off(ns); 44810 mfp.wrap.off('click' + ns); 44811 mfp.arrowRight = mfp.arrowLeft = null; 44812 }); 44813 }, 44814 next: function next() { 44815 mfp.direction = true; 44816 mfp.index = _getLoopedId(mfp.index + 1); 44817 mfp.updateItemHTML(); 44818 }, 44819 prev: function prev() { 44820 mfp.direction = false; 44821 mfp.index = _getLoopedId(mfp.index - 1); 44822 mfp.updateItemHTML(); 44823 }, 44824 goTo: function goTo(newIndex) { 44825 mfp.direction = newIndex >= mfp.index; 44826 mfp.index = newIndex; 44827 mfp.updateItemHTML(); 44828 }, 44829 preloadNearbyImages: function preloadNearbyImages() { 44830 var p = mfp.st.gallery.preload, 44831 preloadBefore = Math.min(p[0], mfp.items.length), 44832 preloadAfter = Math.min(p[1], mfp.items.length), 44833 i; 44834 for (i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) { 44835 mfp._preloadItem(mfp.index + i); 44836 } 44837 for (i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) { 44838 mfp._preloadItem(mfp.index - i); 44839 } 44840 }, 44841 _preloadItem: function _preloadItem(index) { 44842 index = _getLoopedId(index); 44843 if (mfp.items[index].preloaded) { 44844 return; 44845 } 44846 var item = mfp.items[index]; 44847 if (!item.parsed) { 44848 item = mfp.parseEl(index); 44849 } 44850 _mfpTrigger('LazyLoad', item); 44851 if (item.type === 'image') { 44852 item.img = $('<img class="mfp-img" />').on('load.mfploader', function () { 44853 item.hasSize = true; 44854 }).on('error.mfploader', function () { 44855 item.hasSize = true; 44856 item.loadError = true; 44857 _mfpTrigger('LazyLoadError', item); 44858 }).attr('src', item.src); 44859 } 44860 item.preloaded = true; 44861 } 44862 } 44863 }); 44864 44865 /*>>gallery*/ 44866 44867 /*>>retina*/ 44868 44869 var RETINA_NS = 'retina'; 44870 $.magnificPopup.registerModule(RETINA_NS, { 44871 options: { 44872 replaceSrc: function replaceSrc(item) { 44873 return item.src.replace(/\.\w+$/, function (m) { 44874 return '@2x' + m; 44875 }); 44876 }, 44877 ratio: 1 // Function or number. Set to 1 to disable. 44878 }, 44879 proto: { 44880 initRetina: function initRetina() { 44881 if (window.devicePixelRatio > 1) { 44882 var st = mfp.st.retina, 44883 ratio = st.ratio;
44884 ratio = !isNaN(ratio) ? ratio : ratio(); 44885 if (ratio > 1) { 44886 _mfpOn('ImageHasSize' + '.' + RETINA_NS, function (e, item) { 44887 item.img.css({ 44888 'max-width': item.img[0].naturalWidth / ratio, 44889 'width': '100%' 44890 }); 44891 }); 44892 _mfpOn('ElementParse' + '.' + RETINA_NS, function (e, item) { 44893 item.src = st.replaceSrc(item, ratio); 44894 }); 44895 } 44896 } 44897 } 44898 } 44899 }); 44900 44901 /*>>retina*/ 44902 _checkInstance(); 44903}); 44904 44905}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 44906},{}]},{},[1]);
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.