PageSourceSearch

https://post.lt/sites/default/files/js/js_cV3hp_5OjiUnIvlTuU6pLGFhAHxT7dTkukV5EYi3NuA.js

js post.lt collected 2026-10-02 02:45:34 UTC 241,357 bytes, 4,979 lines download raw bytes

vendor: 4,642 bytes, lines 1-152
1// ==ClosureCompiler==
2// @compilation_level ADVANCED_OPTIMIZATIONS
3// @externs_url http://closure-compiler.googlecode.com/svn/trunk/contrib/externs/maps/google_maps_api_v3_3.js
4// ==/ClosureCompiler==
5
6/**
7 * @name MarkerClusterer for Google Maps v3
8 * @version version 1.0.1
9 * @author Luke Mahe
10 * @fileoverview
11 * The library creates and manages per-zoom-level clusters for large amounts of
12 * markers.
13 * <br/>
14 * This is a v3 implementation of the
15 * <a href="http://gmaps-utility-library-dev.googlecode.com/svn/tags/markerclusterer/"
16 * >v2 MarkerClusterer</a>.
17 */
18
19/**
20 * Licensed under the Apache License, Version 2.0 (the "License");
21 * you may not use this file except in compliance with the License.
22 * You may obtain a copy of the License at
23 *
24 *     http://www.apache.org/licenses/LICENSE-2.0
25 *
26 * Unless required by applicable law or agreed to in writing, software
27 * distributed under the License is distributed on an "AS IS" BASIS,
28 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29 * See the License for the specific language governing permissions and
30 * limitations under the License.
31 */
32
33
34/**
35 * A Marker Clusterer that clusters markers.
36 *
37 * @param {google.maps.Map} map The Google map to attach to.
38 * @param {Array.<google.maps.Marker>=} opt_markers Optional markers to add to
39 *   the cluster.
40 * @param {Object=} opt_options support the following options:
41 *     'gridSize': (number) The grid size of a cluster in pixels.
42 *     'maxZoom': (number) The maximum zoom level that a marker can be part of a
43 *                cluster.
44 *     'zoomOnClick': (boolean) Whether the default behaviour of clicking on a
45 *                    cluster is to zoom into it.
46 *     'imagePath': (string) The base URL where the images representing
47 *                  clusters will be found. The full URL will be:
48 *                  {imagePath}[1-5].{imageExtension}
49 *                  Default: '../images/m'.
50 *     'imageExtension': (string) The suffix for images URL representing
51 *                       clusters will be found. See _imagePath_ for details.
52 *                       Default: 'png'.
53 *     'averageCenter': (boolean) Whether the center of each cluster should be
54 *                      the average of all markers in the cluster.
55 *     'minimumClusterSize': (number) The minimum number of markers to be in a
56 *                           cluster before the markers are hidden and a count
57 *                           is shown.
58 *     'styles': (object) An object that has style properties:
59 *       'url': (string) The image url.
60 *       'height': (number) The image height.
61 *       'width': (number) The image width.
62 *       'anchor': (Array) The anchor position of the label text.
63 *       'textColor': (string) The text color.
64 *       'textSize': (number) The text size.
65 *       'backgroundPosition': (string) The position of the backgound x, y.
66 * @constructor
67 * @extends google.maps.OverlayView
68 */
69function MarkerClusterer(map, opt_markers, opt_options) {
70  // MarkerClusterer implements google.maps.OverlayView interface. We use the
71  // extend function to extend MarkerClusterer with google.maps.OverlayView
72  // because it might not always be available when the code is defined so we
73  // look for it at the last possible moment. If it doesn't exist now then
74  // there is no point going ahead :)
75  this.extend(MarkerClusterer, google.maps.OverlayView);
76  this.map_ = map;
77
78  /**
79   * @type {Array.<google.maps.Marker>}
80   * @private
81   */
82  this.markers_ = [];
83
84  /**
85   *  @type {Array.<Cluster>}
86   */
87  this.clusters_ = [];
88
89  this.sizes = [53, 56, 66, 78, 90];
90
91  /**
92   * @private
93   */
94  this.styles_ = [];
95
96  /**
97   * @type {boolean}
98   * @private
99   */
100  this.ready_ = false;
101
102  var options = opt_options || {};
103
104  /**
105   * @type {number}
106   * @private
107   */
108  this.gridSize_ = options['gridSize'] || 60;
109
110  /**
111   * @private
112   */
113  this.minClusterSize_ = options['minimumClusterSize'] || 2;
114
115
116  /**
117   * @type {?number}
118   * @private
119   */
120  this.maxZoom_ = options['maxZoom'] || null;
121
122  this.styles_ = options['styles'] || [];
123
124  /**
125   * @type {string}
126   * @private
127   */
128  this.imagePath_ = options['imagePath'] ||
129      this.MARKER_CLUSTER_IMAGE_PATH_;
130
131  /**
132   * @type {string}
133   * @private
134   */
135  this.imageExtension_ = options['imageExtension'] ||
136      this.MARKER_CLUSTER_IMAGE_EXTENSION_;
137
138  /**
139   * @type {boolean}
140   * @private
141   */
142  this.zoomOnClick_ = true;
143
144  if (options['zoomOnClick'] != undefined) {
145    this.zoomOnClick_ = options['zoomOnClick'];
146  }
147
148  /**
149   * @type {boolean}
150   * @private
151   */
152  this.averageCenter_ = false;
153
154  if (options['averageCenter'] != undefined) {
155    this.averageCenter_ = options['averageCenter'];
156  }
157
158  this.setupStyles_();
159
160  this.setMap(map);
161
162  /**
163   * @type {number}
164   * @private
165   */
166  this.prevZoom_ = this.map_.getZoom();
167
168  // Add the map event listeners
169  var that = this;
170  google.maps.event.addListener(this.map_, 'zoom_changed', function() {
171    // Determines map type and prevent illegal zoom levels
172    var zoom = that.map_.getZoom();
173    var minZoom = that.map_.minZoom || 0;
174    var maxZoom = Math.min(that.map_.maxZoom || 100,
175                         that.map_.mapTypes[that.map_.getMapTypeId()].maxZoom);
176    zoom = Math.min(Math.max(zoom,minZoom),maxZoom);
177
178    if (that.prevZoom_ != zoom) {
179      that.prevZoom_ = zoom;
180      that.resetViewport();
181    }
182  });
183
184  google.maps.event.addListener(this.map_, 'idle', function() {
185    that.redraw();
186  });
187
188  // Finally, add the markers
189  if (opt_markers && (opt_markers.length || Object.keys(opt_markers).length)) {
190    this.addMarkers(opt_markers, false);
191  }
192}
193
194
195/**
196 * The marker cluster image path.
197 *
198 * @type {string}
199 * @private
200 */
201MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_ = '../images/m';
202
203
204/**
205 * The marker cluster image path.
206 *
207 * @type {string}
208 * @private
209 */
210MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_ = 'png';
211
212
213/**
214 * Extends a objects prototype by anothers.
215 *
216 * @param {Object} obj1 The object to be extended.
217 * @param {Object} obj2 The object to extend with.
218 * @return {Object} The new extended object.
219 * @ignore
220 */
221MarkerClusterer.prototype.extend = function(obj1, obj2) {
222  return (function(object) {
223    for (var property in object.prototype) {
224      this.prototype[property] = object.prototype[property];
225    }
226    return this;
227  }).apply(obj1, [obj2]);
228};
229
230
231/**
232 * Implementaion of the interface method.
233 * @ignore
234 */
235MarkerClusterer.prototype.onAdd = function() {
236  this.setReady_(true);
237};
238
239/**
240 * Implementaion of the interface method.
241 * @ignore
242 */
243MarkerClusterer.prototype.draw = function() {};
244
245/**
246 * Sets up the styles object.
247 *
248 * @private
249 */
250MarkerClusterer.prototype.setupStyles_ = function() {
251  if (this.styles_.length) {
252    return;
253  }
254
255  for (var i = 0, size; size = this.sizes[i]; i++) {
256    this.styles_.push({
257      url: this.imagePath_ + (i + 1) + '.' + this.imageExtension_,
258      height: size,
259      width: size
260    });
261  }
262};
263
264/**
265 *  Fit the map to the bounds of the markers in the clusterer.
266 */
267MarkerClusterer.prototype.fitMapToMarkers = function() {
268  var markers = this.getMarkers();
269  var bounds = new google.maps.LatLngBounds();
270  for (var i = 0, marker; marker = markers[i]; i++) {
271    bounds.extend(marker.getPosition());
272  }
273
274  this.map_.fitBounds(bounds);
275};
276
277
278/**
279 *  Sets the styles.
280 *
281 *  @param {Object} styles The style to set.
282 */
283MarkerClusterer.prototype.setStyles = function(styles) {
284  this.styles_ = styles;
285};
286
287
288/**
289 *  Gets the styles.
290 *
291 *  @return {Object} The styles object.
292 */
293MarkerClusterer.prototype.getStyles = function() {
294  return this.styles_;
295};
296
297
298/**
299 * Whether zoom on click is set.
300 *
301 * @return {boolean} True if zoomOnClick_ is set.
302 */
303MarkerClusterer.prototype.isZoomOnClick = function() {
304  return this.zoomOnClick_;
305};
306
307/**
308 * Whether average center is set.
309 *
310 * @return {boolean} True if averageCenter_ is set.
311 */
312MarkerClusterer.prototype.isAverageCenter = function() {
313  return this.averageCenter_;
314};
315
316
317/**
318 *  Returns the array of markers in the clusterer.
319 *
320 *  @return {Array.<google.maps.Marker>} The markers.
321 */
322MarkerClusterer.prototype.getMarkers = function() {
323  return this.markers_;
324};
325
326
327/**
328 *  Returns the number of markers in the clusterer
329 *
330 *  @return {Number} The number of markers.
331 */
332MarkerClusterer.prototype.getTotalMarkers = function() {
333  return this.markers_.length;
334};
335
336
337/**
338 *  Sets the max zoom for the clusterer.
339 *
340 *  @param {number} maxZoom The max zoom level.
341 */
342MarkerClusterer.prototype.setMaxZoom = function(maxZoom) {
343  this.maxZoom_ = maxZoom;
344};
345
346
347/**
348 *  Gets the max zoom for the clusterer.
349 *
350 *  @return {number} The max zoom level.
351 */
352MarkerClusterer.prototype.getMaxZoom = function() {
353  return this.maxZoom_;
354};
355
356
357/**
358 *  The function for calculating the cluster icon image.
359 *
360 *  @param {Array.<google.maps.Marker>} markers The markers in the clusterer.
361 *  @param {number} numStyles The number of styles available.
362 *  @return {Object} A object properties: 'text' (string) and 'index' (number).
363 *  @private
364 */
365MarkerClusterer.prototype.calculator_ = function(markers, numStyles) {
366  var index = 0;
367  var count = markers.length;
368  var dv = count;
369  while (dv !== 0) {
370    dv = parseInt(dv / 10, 10);
371    index++;
372  }
373
374  index = Math.min(index, numStyles);
375  return {
376    text: count,
377    index: index
378  };
379};
380
381
382/**
383 * Set the calculator function.
384 *
385 * @param {function(Array, number)} calculator The function to set as the
386 *     calculator. The function should return a object properties:
387 *     'text' (string) and 'index' (number).
388 *
389 */
390MarkerClusterer.prototype.setCalculator = function(calculator) {
391  this.calculator_ = calculator;
392};
393
394
395/**
396 * Get the calculator function.
397 *
398 * @return {function(Array, number)} the calculator function.
399 */
400MarkerClusterer.prototype.getCalculator = function() {
401  return this.calculator_;
402};
403
404
405/**
406 * Add an array of markers to the clusterer.
407 *
408 * @param {Array.<google.maps.Marker>} markers The markers to add.
409 * @param {boolean=}
409 opt_nodraw Whether to redraw the clusters.
410 */
411MarkerClusterer.prototype.addMarkers = function(markers, opt_nodraw) {
412  if (markers.length) {
413    for (var i = 0, marker; marker = markers[i]; i++) {
414      this.pushMarkerTo_(marker);
415    }
416  } else if (Object.keys(markers).length) {
417    for (var marker in markers) {
418      this.pushMarkerTo_(markers[marker]);
419    }
420  }
421  if (!opt_nodraw) {
422    this.redraw();
423  }
424};
425
426
427/**
428 * Pushes a marker to the clusterer.
429 *
430 * @param {google.maps.Marker} marker The marker to add.
431 * @private
432 */
433MarkerClusterer.prototype.pushMarkerTo_ = function(marker) {
434  marker.isAdded = false;
435  if (marker['draggable']) {
436    // If the marker is draggable add a listener so we update the clusters on
437    // the drag end.
438    var that = this;
439    google.maps.event.addListener(marker, 'dragend', function() {
440      marker.isAdded = false;
441      that.repaint();
442    });
443  }
444  this.markers_.push(marker);
445};
446
447
448/**
449 * Adds a marker to the clusterer and redraws if needed.
450 *
451 * @param {google.maps.Marker} marker The marker to add.
452 * @param {boolean=} opt_nodraw Whether to redraw the clusters.
453 */
454MarkerClusterer.prototype.addMarker = function(marker, opt_nodraw) {
455  this.pushMarkerTo_(marker);
456  if (!opt_nodraw) {
457    this.redraw();
458  }
459};
460
461
462/**
463 * Removes a marker and returns true if removed, false if not
464 *
465 * @param {google.maps.Marker} marker The marker to remove
466 * @return {boolean} Whether the marker was removed or not
467 * @private
468 */
469MarkerClusterer.prototype.removeMarker_ = function(marker) {
470  var index = -1;
471  if (this.markers_.indexOf) {
472    index = this.markers_.indexOf(marker);
473  } else {
474    for (var i = 0, m; m = this.markers_[i]; i++) {
475      if (m == marker) {
476        index = i;
477        break;
478      }
479    }
480  }
481
482  if (index == -1) {
483    // Marker is not in our list of markers.
484    return false;
485  }
486
487  marker.setMap(null);
488
489  this.markers_.splice(index, 1);
490
491  return true;
492};
493
494
495/**
496 * Remove a marker from the cluster.
497 *
498 * @param {google.maps.Marker} marker The marker to remove.
499 * @param {boolean=} opt_nodraw Optional boolean to force no redraw.
500 * @return {boolean} True if the marker was removed.
501 */
502MarkerClusterer.prototype.removeMarker = function(marker, opt_nodraw) {
503  var removed = this.removeMarker_(marker);
504
505  if (!opt_nodraw && removed) {
506    this.resetViewport();
507    this.redraw();
508    return true;
509  } else {
510   return false;
511  }
512};
513
514
515/**
516 * Removes an array of markers from the cluster.
517 *
518 * @param {Array.<google.maps.Marker>} markers The markers to remove.
519 * @param {boolean=} opt_nodraw Optional boolean to force no redraw.
520 */
521MarkerClusterer.prototype.removeMarkers = function(markers, opt_nodraw) {
522  // create a local copy of markers if required
523  // (removeMarker_ modifies the getMarkers() array in place)
524  var markersCopy = markers === this.getMarkers() ? markers.slice() : markers;
525  var removed = false;
526
527  for (var i = 0, marker; marker = markersCopy[i]; i++) {
528    var r = this.removeMarker_(marker);
529    removed = removed || r;
530  }
531
532  if (!opt_nodraw && removed) {
533    this.resetViewport();
534    this.redraw();
535    return true;
536  }
537};
538
539
540/**
541 * Sets the clusterer's ready state.
542 *
543 * @param {boolean} ready The state.
544 * @private
545 */
546MarkerClusterer.prototype.setReady_ = function(ready) {
547  if (!this.ready_) {
548    this.ready_ = ready;
549    this.createClusters_();
550  }
551};
552
553
554/**
555 * Returns the number of clusters in the clusterer.
556 *
557 * @return {number} The number of clusters.
558 */
559MarkerClusterer.prototype.getTotalClusters = function() {
560  return this.clusters_.length;
561};
562
563
564/**
565 * Returns the google map that the clusterer is associated with.
566 *
567 * @return {google.maps.Map} The map.
568 */
569MarkerClusterer.prototype.getMap = function() {
570  return this.map_;
571};
572
573
574/**
575 * Sets the google map that the clusterer is associated with.
576 *
577 * @param {google.maps.Map} map The map.
578 */
579MarkerClusterer.prototype.setMap = function(map) {
580  this.map_ = map;
581};
582
583
584/**
585 * Returns the size of the grid.
586 *
587 * @return {number} The grid size.
588 */
589MarkerClusterer.prototype.getGridSize = function() {
590  return this.gridSize_;
591};
592
593
594/**
595 * Sets the size of the grid.
596 *
597 * @param {number} size The grid size.
598 */
599MarkerClusterer.prototype.setGridSize = function(size) {
600  this.gridSize_ = size;
601};
602
603
604/**
605 * Returns the min cluster size.
606 *
607 * @return {number} The grid size.
608 */
609MarkerClusterer.prototype.getMinClusterSize = function() {
610  return this.minClusterSize_;
611};
612
613/**
614 * Sets the min cluster size.
615 *
616 * @param {number} size The grid size.
617 */
618MarkerClusterer.prototype.setMinClusterSize = function(size) {
619  this.minClusterSize_ = size;
620};
621
622
623/**
624 * Extends a bounds object by the grid size.
625 *
626 * @param {google.maps.LatLngBounds} bounds The bounds to extend.
627 * @return {google.maps.LatLngBounds}
627 The extended bounds.
628 */
629MarkerClusterer.prototype.getExtendedBounds = function(bounds) {
630  var projection = this.getProjection();
631
632  // Turn the bounds into latlng.
633  var tr = new google.maps.LatLng(bounds.getNorthEast().lat(),
634      bounds.getNorthEast().lng());
635  var bl = new google.maps.LatLng(bounds.getSouthWest().lat(),
636      bounds.getSouthWest().lng());
637
638  // Convert the points to pixels and the extend out by the grid size.
639  var trPix = projection.fromLatLngToDivPixel(tr);
640  trPix.x += this.gridSize_;
641  trPix.y -= this.gridSize_;
642
643  var blPix = projection.fromLatLngToDivPixel(bl);
644  blPix.x -= this.gridSize_;
645  blPix.y += this.gridSize_;
646
647  // Convert the pixel points back to LatLng
648  var ne = projection.fromDivPixelToLatLng(trPix);
649  var sw = projection.fromDivPixelToLatLng(blPix);
650
651  // Extend the bounds to contain the new bounds.
652  bounds.extend(ne);
653  bounds.extend(sw);
654
655  return bounds;
656};
657
658
659/**
660 * Determins if a marker is contained in a bounds.
661 *
662 * @param {google.maps.Marker} marker The marker to check.
663 * @param {google.maps.LatLngBounds} bounds The bounds to check against.
664 * @return {boolean} True if the marker is in the bounds.
665 * @private
666 */
667MarkerClusterer.prototype.isMarkerInBounds_ = function(marker, bounds) {
668  return bounds.contains(marker.getPosition());
669};
670
671
672/**
673 * Clears all clusters and markers from the clusterer.
674 */
675MarkerClusterer.prototype.clearMarkers = function() {
676  this.resetViewport(true);
677
678  // Set the markers a empty array.
679  this.markers_ = [];
680};
681
682
683/**
684 * Clears all existing clusters and recreates them.
685 * @param {boolean} opt_hide To also hide the marker.
686 */
687MarkerClusterer.prototype.resetViewport = function(opt_hide) {
688  // Remove all the clusters
689  for (var i = 0, cluster; cluster = this.clusters_[i]; i++) {
690    cluster.remove();
691  }
692
693  // Reset the markers to not be added and to be invisible.
694  for (var i = 0, marker; marker = this.markers_[i]; i++) {
695    marker.isAdded = false;
696    if (opt_hide) {
697      marker.setMap(null);
698    }
699  }
700
701  this.clusters_ = [];
702};
703
704/**
705 *
706 */
707MarkerClusterer.prototype.repaint = function() {
708  var oldClusters = this.clusters_.slice();
709  this.clusters_.length = 0;
710  this.resetViewport();
711  this.redraw();
712
713  // Remove the old clusters.
714  // Do it in a timeout so the other clusters have been drawn first.
715  window.setTimeout(function() {
716    for (var i = 0, cluster; cluster = oldClusters[i]; i++) {
717      cluster.remove();
718    }
719  }, 0);
720};
721
722
723/**
724 * Redraws the clusters.
725 */
726MarkerClusterer.prototype.redraw = function() {
727  this.createClusters_();
728};
729
730
731/**
732 * Calculates the distance between two latlng locations in km.
733 * @see http://www.movable-type.co.uk/scripts/latlong.html
734 *
735 * @param {google.maps.LatLng} p1 The first lat lng point.
736 * @param {google.maps.LatLng} p2 The second lat lng point.
737 * @return {number} The distance between the two points in km.
738 * @private
739*/
740MarkerClusterer.prototype.distanceBetweenPoints_ = function(p1, p2) {
741  if (!p1 || !p2) {
742    return 0;
743  }
744
745  var R = 6371; // Radius of the Earth in km
746  var dLat = (p2.lat() - p1.lat()) * Math.PI / 180;
747  var dLon = (p2.lng() - p1.lng()) * Math.PI / 180;
748  var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
749    Math.cos(p1.lat() * Math.PI / 180) * Math.cos(p2.lat() * Math.PI / 180) *
750    Math.sin(dLon / 2) * Math.sin(dLon / 2);
751  var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
752  var d = R * c;
753  return d;
754};
755
756
757/**
758 * Add a marker to a cluster, or creates a new cluster.
759 *
760 * @param {google.maps.Marker} marker The marker to add.
761 * @private
762 */
763MarkerClusterer.prototype.addToClosestCluster_ = function(marker) {
764  var distance = 40000; // Some large number
765  var clusterToAddTo = null;
766  var pos = marker.getPosition();
767  for (var i = 0, cluster; cluster = this.clusters_[i]; i++) {
768    var center = cluster.getCenter();
769    if (center) {
770      var d = this.distanceBetweenPoints_(center, marker.getPosition());
771      if (d < distance) {
772        distance = d;
773        clusterToAddTo = cluster;
774      }
775    }
776  }
777
778  if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)) {
779    clusterToAddTo.addMarker(marker);
780  } else {
781    var cluster = new Cluster(this);
782    cluster.addMarker(marker);
783    this.clusters_.push(cluster);
784  }
785};
786
787
788/**
789 * Creates the clusters.
790 *
791 * @private
792 */
793MarkerClusterer.prototype.createClusters_ = function() {
794  if (!this.ready_) {
795    return;
796  }
797
798  // Get our current map view bounds.
799  // Create a new bounds object so we don't affect the map.
800  var mapBounds = new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),
801      this.map_.getBounds().getNorthEast());
802  var bounds = this.getExtendedBounds(mapBounds);
803
804  for (var i = 0, marker; marker = this.markers_[i]; i++) {
805    if (!marker.isAdded && this.isMarkerInBounds_(marker, bounds)) {
806      this.addToClosestCluster_(marker);
807    }
808  }
809};
810
811
812/**
813 * A cluster that contains markers.
814 *
815 * @param {MarkerClusterer} markerClusterer The markerclusterer that this
816 *     cluster is associated with.
817 * @constructor
818 * @ignore
819 */
820function Cluster(markerClusterer) {
821  this.markerClusterer_ = markerClusterer;
822  this.map_ = markerClusterer.getMap();
823  this.gridSize_ = markerClusterer.getGridSize();
824  this.minClusterSize_ = markerClusterer.getMinClusterSize();
825  this.averageCenter_ = markerClusterer.isAverageCenter();
826  this.center_ = null;
827  this.markers_ = [];
828  this.bounds_ = null;
829  this.clusterIcon_ = new ClusterIcon(this, markerClusterer.getStyles(),
830      markerClusterer.getGridSize());
831}
832
833/**
834 * Determins if a marker is already added to the cluster.
835 *
836 * @param {google.maps.Marker} marker The marker to check.
837 * @return {boolean} True if the marker is already added.
838 */
839Cluster.prototype.isMarkerAlreadyAdded = function(marker) {
840  if (this.markers_.indexOf) {
841    return this.markers_.indexOf(marker) != -1;
842  } else {
843    for (var i = 0, m; m = this.markers_[i]; i++) {
844      if (m == marker) {
845        return true;
846      }
847    }
848  }
849  return false;
850};
851
852
853/**
854 * Add a marker the cluster.
855 *
856 * @param {google.maps.Marker} marker The marker to add.
857 * @return {boolean} True if the marker was added.
858 */
859Cluster.prototype.addMarker = function(marker) {
860  if (this.isMarkerAlreadyAdded(marker)) {
861    return false;
862  }
863
864  if (!this.center_) {
865    this.center_ = marker.getPosition();
866    this.calculateBounds_();
867  } else {
868    if (this.averageCenter_) {
869      var l = this.markers_.length + 1;
870      var lat = (this.center_.lat() * (l-1) + marker.getPosition().lat()) / l;
871      var lng = (this.center_.lng() * (l-1) + marker.getPosition().lng()) / l;
872      this.center_ = new google.maps.LatLng(lat, lng);
873      this.calculateBounds_();
874    }
875  }
876
877  marker.isAdded = true;
878  this.markers_.push(marker);
879
880  var len = this.markers_.length;
881  if (len < this.minClusterSize_ && marker.getMap() != this.map_) {
882    // Min cluster size not reached so show the marker.
883    marker.setMap(this.map_);
884  }
885
886  if (len == this.minClusterSize_) {
887    // Hide the markers that were showing.
888    for (var i = 0; i < len; i++) {
889      this.markers_[i].setMap(null);
890    }
891  }
892
893  if (len >= this.minClusterSize_) {
894    marker.setMap(null);
895  }
896
897  this.updateIcon();
898  return true;
899};
900
901
902/**
903 * Returns the marker clusterer that the cluster is associated with.
904 *
905 * @return {MarkerClusterer} The associated marker clusterer.
906 */
907Cluster.prototype.getMarkerClusterer = function() {
908  return this.markerClusterer_;
909};
910
911
912/**
913 * Returns the bounds of the cluster.
914 *
915 * @return {google.maps.LatLngBounds} the cluster bounds.
916 */
917Cluster.prototype.getBounds = function() {
918  var bounds = new google.maps.LatLngBounds(this.center_, this.center_);
919  var markers = this.getMarkers();
920  for (var i = 0, marker; marker = markers[i]; i++) {
921    bounds.extend(marker.getPosition());
922  }
923  return bounds;
924};
925
926
927/**
928 * Removes the cluster
929 */
930Cluster.prototype.remove = function() {
931  this.clusterIcon_.remove();
932  this.markers_.length = 0;
933  delete this.markers_;
934};
935
936
937/**
938 * Returns the number of markers in the cluster.
939 *
940 * @return {number} The number of markers in the cluster.
941 */
942Cluster.prototype.getSize = function() {
943  return this.markers_.length;
944};
945
946
947/**
948 * Returns a list of the markers in the cluster.
949 *
950 * @return {Array.<google.maps.Marker>} The markers in the cluster.
951 */
952Cluster.prototype.getMarkers = function() {
953  return this.markers_;
954};
955
956
957/**
958 * Returns the center of the cluster.
959 *
960 * @return {google.maps.LatLng} The cluster center.
961 */
962Cluster.prototype.getCenter = function() {
963  return this.center_;
964};
965
966
967/**
968 * Calculated the extended bounds of the cluster with the grid.
969 *
970 * @private
971 */
972Cluster.prototype.calculateBounds_ = function() {
973  var bounds = new google.maps.LatLngBounds(this.center_, this.center_);
974  this.bounds_ = this.markerClusterer_.getExtendedBounds(bounds);
975};
976
977
978/**
979 * Determines if a marker lies in the clusters bounds.
980 *
981 * @param {google.maps.Marker} marker The marker to check.
982 * @return {boolean} True if the marker lies in the bounds.
983 */
984Cluster.prototype.isMarkerInClusterBounds = function(marker) {
985  return this.bounds_.contains(marker.getPosition());
986};
987
988
989/**
990 * Returns the map that the cluster is associated with.
991 *
992 * @return {google.maps.Map} The map.
993 */
994Cluster.prototype.getMap = function() {
995  return this.map_;
996};
997
998
999/**
1000 * Updates the cluster icon
1001 */
1002Cluster.prototype.updateIcon = function() {
1003  var zoom = this.map_.getZoom();
1004  var mz = this.markerClusterer_.getMaxZoom();
1005
1006  if (mz && zoom > mz) {
1007    // The zoom is greater than our max zoom so show all the markers in cluster.
1008    for (var i = 0, marker; marker = this.markers_[i]; i++) {
1009      marker.setMap(this.map_);
1010    }
1011    return;
1012  }
1013
1014  if (this.markers_.length < this.minClusterSize_) {
1015    // Min cluster size not yet reached.
1016    this.clusterIcon_.hide();
1017    return;
1018  }
1019
1020  var numStyles = this.markerClusterer_.getStyles().length;
1021  var sums = this.markerClusterer_.getCalculator()(this.markers_, numStyles);
1022  this.clusterIcon_.setCenter(this.center_);
1023  this.clusterIcon_.setSums(sums);
1024  this.clusterIcon_.show();
1025};
1026
1027
1028/**
1029 * A cluster icon
1030 *
1031 * @param {Cluster} cluster The cluster to be associated with.
1032 * @param {Object} styles An object that has style properties:
1033 *     'url': (string) The image url.
1034 *     'height': (number) The image height.
1035 *     'width': (number) The image width.
1036 *     'anchor': (Array) The anchor position of the label text.
1037 *     'textColor': (string) The text color.
1038 *     'textSize': (number) The text size.
1039 *     'backgroundPosition: (string) The background postition x, y.
1040 * @param {number=} opt_padding Optional padding to apply to the cluster icon.
1041 * @constructor
1042 * @extends google.maps.OverlayView
1043 * @ignore
1044 */
1045function ClusterIcon(cluster, styles, opt_padding) {
1046  cluster.getMarkerClusterer().extend(ClusterIcon, google.maps.OverlayView);
1047
1048  this.styles_ = styles;
1049  this.padding_ = opt_padding || 0;
1050  this.cluster_ = cluster;
1051  this.center_ = null;
1052  this.map_ = cluster.getMap();
1053  this.div_ = null;
1054  this.sums_ = null;
1055  this.visible_ = false;
1056
1057  this.setMap(this.map_);
1058}
1059
1060
1061/**
1062 * Triggers the clusterclick event and zoom's if the option is set.
1063 */
1064ClusterIcon.prototype.triggerClusterClick = function() {
1065  var markerClusterer = this.cluster_.getMarkerClusterer();
1066
1067  // Trigger the clusterclick event.
1068  google.maps.event.trigger(markerClusterer, 'clusterclick', this.cluster_);
1069
1070  if (markerClusterer.isZoomOnClick()) {
1071    // Zoom into the cluster.
1072    this.map_.fitBounds(this.cluster_.getBounds());
1073  }
1074};
1075
1076
1077/**
1078 * Adding the cluster icon to the dom.
1079 * @ignore
1080 */
1081ClusterIcon.prototype.onAdd = function() {
1082  this.div_ = document.createElement('DIV');
1083  if (this.visible_) {
1084    var pos = this.getPosFromLatLng_(this.center_);
1085    this.div_.style.cssText = this.createCss(pos);
1086    this.div_.innerHTML = this.sums_.text;
1087  }
1088
1089  var panes = this.getPanes();
1090  panes.overlayMouseTarget.appendChild(this.div_);
1091
1092  var that = this;
1093  google.maps.event.addDomListener(this.div_, 'click', function() {
1094    that.triggerClusterClick();
1095  });
1096};
1097
1098
1099/**
1100 * Returns the position to place the div dending on the latlng.
1101 *
1102 * @param {google.maps.LatLng} latlng The position in latlng.
1103 * @return {google.maps.Point} The position in pixels.
1104 * @private
1105 */
1106ClusterIcon.prototype.getPosFromLatLng_ = function(latlng) {
1107  var pos = this.getProjection().fromLatLngToDivPixel(latlng);
1108  pos.x -= parseInt(this.width_ / 2, 10);
1109  pos.y -= parseInt(this.height_ / 2, 10);
1110  return pos;
1111};
1112
1113
1114/**
1115 * Draw the icon.
1116 * @ignore
1117 */
1118ClusterIcon.prototype.draw = function() {
1119  if (this.visible_) {
1120    var pos = this.getPosFromLatLng_(this.center_);
1121    this.div_.style.top = pos.y + 'px';
1122    this.div_.style.left = pos.x + 'px';
1123  }
1124};
1125
1126
1127/**
1128 * Hide the icon.
1129 */
1130ClusterIcon.prototype.hide = function() {
1131  if (this.div_) {
1132    this.div_.style.display = 'none';
1133  }
1134  this.visible_ = false;
1135};
1136
1137
1138/**
1139 * Position and show the icon.
1140 */
1141ClusterIcon.prototype.show = function() {
1142  if (this.div_) {
1143    var pos = this.getPosFromLatLng_(this.center_);
1144    this.div_.style.cssText = this.createCss(pos);
1145    this.div_.style.display = '';
1146  }
1147  this.visible_ = true;
1148};
1149
1150
1151/**
1152 * Remove the icon from the map
1153 */
1154ClusterIcon.prototype.remove = function() {
1155  this.setMap(null);
1156};
1157
1158
1159/**
1160 * Implementation of the onRemove interface.
1161 * @ignore
1162 */
1163ClusterIcon.prototype.onRemove = function() {
1164  if (this.div_ && this.div_.parentNode) {
1165    this.hide();
1166    this.div_.parentNode.removeChild(this.div_);
1167    this.div_ = null;
1168  }
1169};
1170
1171
1172/**
1173 * Set the sums of the icon.
1174 *
1175 * @param {Object} sums The sums containing:
1176 *   'text': (string) The text to display in the icon.
1177 *   'index': (number) The style index of the icon.
1178 */
1179ClusterIcon.prototype.setSums = function(sums) {
1180  this.sums_ = sums;
1181  this.text_ = sums.text;
1182  this.index_ = sums.index;
1183  if (this.div_) {
1184    this.div_.innerHTML = sums.text;
1185  }
1186
1187  this.useStyle();
1188};
1189
1190
1191/**
1192 * Sets the icon to the the styles.
1193 */
1194ClusterIcon.prototype.useStyle = function() {
1195  var index = Math.max(0, this.sums_.index - 1);
1196  index = Math.min(this.styles_.length - 1, index);
1197  var style = this.styles_[index];
1198  this.url_ = style['url'];
1199  this.height_ = style['height'];
1200  this.width_ = style['width'];
1201  this.textColor_ = style['textColor'];
1202  this.anchor_ = style['anchor'];
1203  this.textSize_ = style['textSize'];
1204  this.backgroundPosition_ = style['backgroundPosition'];
1205};
1206
1207
1208/**
1209 * Sets the center of the icon.
1210 *
1211 * @param {google.maps.LatLng} center The latlng to set as the center.
1212 */
1213ClusterIcon.prototype.setCenter = function(center) {
1214  this.center_ = center;
1215};
1216
1217
1218/**
1219 * Create the css text based on the position of the icon.
1220 *
1221 * @param {google.maps.Point} pos The position.
1222 * @return {string} The css style text.
1223 */
1224ClusterIcon.prototype.createCss = function(pos) {
1225  var style = [];
1226  style.push('background-image:url(' + this.url_ + ');');
1227  var backgroundPosition = this.backgroundPosition_ ? this.backgroundPosition_ : '0 0';
1228  style.push('background-position:' + backgroundPosition + ';');
1229
1230  if (typeof this.anchor_ === 'object') {
1231    if (typeof this.anchor_[0] === 'number' && this.anchor_[0] > 0 &&
1232        this.anchor_[0] < this.height_) {
1233      style.push('height:' + (this.height_ - this.anchor_[0]) +
1234          'px; padding-top:' + this.anchor_[0] + 'px;');
1235    } else {
1236      style.push('height:' + this.height_ + 'px; line-height:' + this.height_ +
1237          'px;');
1238    }
1239    if (typeof this.anchor_[1] === 'number' && this.anchor_[1] > 0 &&
1240        this.anchor_[1] < this.width_) {
1241      style.push('width:' + (this.width_ - this.anchor_[1]) +
1242          'px; padding-left:' + this.anchor_[1] + 'px;');
1243    } else {
1244      style.push('width:' + this.width_ + 'px; text-align:center;');
1245    }
1246  } else {
1247    style.push('height:' + this.height_ + 'px; line-height:' +
1248        this.height_ + 'px; width:' + this.width_ + 'px; text-align:center;');
1249  }
1250
1251  var txtColor = this.textColor_ ? this.textColor_ : 'black';
1252  var txtSize = this.textSize_ ? this.textSize_ : 11;
1253
1254  style.push('cursor:pointer; top:' + pos.y + 'px; left:' +
1255      pos.x + 'px; color:' + txtColor + '; position:absolute; font-size:' +
1256      txtSize + 'px; font-family:Arial,sans-serif; font-weight:bold');
1257  return style.join('');
1258};
1259
1260
1261// Export Symbols for Closure
1262// If you are not going to compile with closure then you can remove the
1263// code below.
1264window['MarkerClusterer'] = MarkerClusterer;
1265MarkerClusterer.prototype['addMarker'] = MarkerClusterer.prototype.addMarker;
1266MarkerClusterer.prototype['addMarkers'] = MarkerClusterer.prototype.addMarkers;
1267MarkerClusterer.prototype['clearMarkers'] =
1268    MarkerClusterer.prototype.clearMarkers;
1269MarkerClusterer.prototype['fitMapToMarkers'] =
1270    MarkerClusterer.prototype.fitMapToMarkers;
1271MarkerClusterer.prototype['getCalculator'] =
1272    MarkerClusterer.prototype.getCalculator;
1273MarkerClusterer.prototype['getGridSize'] =
1274    MarkerClusterer.prototype.getGridSize;
1275MarkerClusterer.prototype['getExtendedBounds'] =
1276    MarkerClusterer.prototype.getExtendedBounds;
1277MarkerClusterer.prototype['getMap'] = MarkerClusterer.prototype.getMap;
1278MarkerClusterer.prototype['getMarkers'] = MarkerClusterer.prototype.getMarkers;
1279MarkerClusterer.prototype['getMaxZoom'] = MarkerClusterer.prototype.getMaxZoom;
1280MarkerClusterer.prototype['getStyles'] = MarkerClusterer.prototype.getStyles;
1281MarkerClusterer.prototype['getTotalClusters'] =
1282    MarkerClusterer.prototype.getTotalClusters;
1283MarkerClusterer.prototype['getTotalMarkers'] =
1284    MarkerClusterer.prototype.getTotalMarkers;
1285MarkerClusterer.prototype['redraw'] = MarkerClusterer.prototype.redraw;
1286MarkerClusterer.prototype['removeMarker'] =
1287    MarkerClusterer.prototype.removeMarker;
1288MarkerClusterer.prototype['removeMarkers'] =
1289    MarkerClusterer.prototype.removeMarkers;
1290MarkerClusterer.prototype['resetViewport'] =
1291    MarkerClusterer.prototype.resetViewport;
1292MarkerClusterer.prototype['repaint'] =
1293    MarkerClusterer.prototype.repaint;
1294MarkerClusterer.prototype['setCalculator'] =
1295    MarkerClusterer.prototype.setCalculator;
1296MarkerClusterer.prototype['setGridSize'] =
1297    MarkerClusterer.prototype.setGridSize;
1298MarkerClusterer.prototype['setMaxZoom'] =
1299    MarkerClusterer.prototype.setMaxZoom;
1300MarkerClusterer.prototype['onAdd'] = MarkerClusterer.prototype.onAdd;
1301MarkerClusterer.prototype['draw'] = MarkerClusterer.prototype.draw;
1302
1303Cluster.prototype['getCenter'] = Cluster.prototype.getCenter;
1304Cluster.prototype['getSize'] = Cluster.prototype.getSize;
1305Cluster.prototype['getMarkers'] = Cluster.prototype.getMarkers;
1306
1307ClusterIcon.prototype['onAdd'] = ClusterIcon.prototype.onAdd;
1308ClusterIcon.prototype['draw'] = ClusterIcon.prototype.draw;
1309ClusterIcon.prototype['onRemove'] = ClusterIcon.prototype.onRemove;
1310
1311Object.keys = Object.keys || function(o) {  
1312    var result = [];  
1313    for(var name in o) {  
1314        if (o.hasOwnProperty(name))  
1315          result.push(name);  
1316    }  
1317    return result;  
1318};;
1319!function(a,b){function c(a){throw new Error("Pagination: "+a)}function d(a){a.dataSource||c('"dataSource" is required.'),"string"==typeof a.dataSource?void 0===a.totalNumberLocator?void 0===a.totalNumber?c('"totalNumber" is required.'):b.isNumeric(a.totalNumber)||c('"totalNumber" is incorrect. (Number)'):b.isFunction(a.totalNumberLocator)||c('"totalNumberLocator" should be a Function.'):i.isObject(a.dataSource)&&(void 0===a.locator?c('"dataSource" is an Object, please specify "locator".'):"string"==typeof a.locator||b.isFunction(a.locator)||c(a.locator+" is incorrect. (String | Function)")),void 0===a.formatResult||b.isFunction(a.formatResult)||c('"formatResult" should be a Function.')}function e(a){var c=["go","previous","next","disable","enable","refresh","show","hide","destroy"];b.each(c,function(b,c){a.off(h+c)}),a.data("pagination",{}),b(".paginationjs",a).remove()}function f(a,b){return("object"==(b=typeof a)?null==a&&"null"||Object.prototype.toString.call(a).slice(8,-1):b).toLowerCase()}void 0===b&&c("Pagination requires jQuery.");var g="pagination",h="__pagination-";b.fn.pagination&&(g="pagination2"),b.fn[g]=function(f){if(void 0===f)return this;var j=b(this),k=b.extend({},b.fn[g].defaults,f),l={initialize:function(){var a=this;if(j.data("pagination")||j.data("pagination",{}),!1!==a.callHook("beforeInit")){j.data("pagination").initialized&&b(".paginationjs",j).remove(),a.disabled=!!k.disabled;var c=a.model={pageRange:k.pageRange,pageSize:k.pageSize};a.parseDataSource(k.dataSource,function(b){a.isAsync=i.isString(b),i.isArray(b)&&(c.totalNumber=k.totalNumber=b.length),a.isDynamicTotalNumber=a.isAsync&&k.totalNumberLocator;var d=a.render(!0);k.className&&d.addClass(k.className),c.el=d,j["bottom"===k.position?"append":"prepend"](d),a.observer(),j.data("pagination").initialized=!0,a.callHook("afterInit",d)})}},render:function(a){var c=this,d=c.model,e=d.el||b('<div class="paginationjs"></div>'),f=!0!==a;c.callHook("beforeRender",f);var g=d.pageNumber||k.pageNumber,h=k.pageRange||0,i=c.getTotalPage(),j=g-h,l=g+h;return l>i&&(l=i,j=i-2*h,j=j<1?1:j),j<=1&&(j=1,l=Math.min(2*h+1,i)),e.html(c.generateHTML({currentPage:g,pageRange:h,rangeStart:j,rangeEnd:l})),k.hideWhenLessThanOnePage&&e[i<=1?"hide":"show"](),c.callHook("afterRender",f),e},generatePageNumbersHTML:function(a){var b,c=this,d=a.currentPage,e=c.getTotalPage(),f=a.rangeStart,g=a.rangeEnd,h="",i=k.pageLink,j=k.ellipsisText,l=k.classPrefix,m=k.activeClassName,n=k.disableClassName;if(null===k.pageRange){for(b=1;b<=e;b++)h+=b==d?'<li class="'+l+"-page J-paginationjs-page "+m+'" data-num="'+b+'"><a>'+b+"</a></li>":'<li class="'+l+'-page J-paginationjs-page" data-num="'+b+'"><a href="'+i+'">'+b+"</a></li>";return h}if(f<=3)for(b=1;b<f;b++)h+=b==d?'<li class="'+l+"-page J-paginationjs-page "+m+'" data-num="'+b+'"><a>'+b+"</a></li>":'<li class="'+l+'-page J-paginationjs-page" data-num="'+b+'"><a href="'+i+'">'+b+"</a></li>";else k.showFirstOnEllipsisShow&&(h+='<li class="'+l+"-page "+l+'-first J-paginationjs-page" data-num="1"><a href="'+i+'">1</a></li>'),h+='<li class="'+l+"-ellipsis "+n+'"><a>'+j+"</a></li>";for(b=f;b<=g;b++)h+=b==d?'<li class="'+l+"-page J-paginationjs-page "+m+'" data-num="'+b+'"><a>'+b+"</a></li>":'<li class="'+l+'-page J-paginationjs-page" data-num="'+b+'"><a href="'+i+'">'+b+"</a></li>";if(g>=e-2)for(b=g+1;b<=e;b++)h+='<li class="'+l+'-page J-paginationjs-page" data-num="'+b+'"><a href="'+i+'">'+b+"</a></li>";else h+='<li class="'+l+"-ellipsis "+n+'"><a>'+j+"</a></li>",k.showLastOnEllipsisShow&&(h+='<li class="'+l+"-page "+l+'-last J-paginationjs-page" data-num="'+e+'"><a href="'+i+'">'+e+"</a></li>");return h},generateHTML:function(a){var c,d=this,e=a.currentPage,f=d.getTotalPage(),g=d.getTotalNumber(),h=k.showPrevious,i=k.showNext,j=k.showPageNumbers,l=k.showNavigator,m=k.showGoInput,n=k.showGoButton,o=k.pageLink,p=k.prevText,q=k.nextText,r=k.goButtonText,s=k.classPrefix,t=k.disableClassName,u=k.ulClassName,v="",w='<input type="text" class="J-paginationjs-go-pagenumber">',x='<input type="button" class="J-paginationjs-go-button" value="'+r+'">',y=b.isFunction(k.formatNavigator)?k.formatNavigator(e,f,g):k.formatNavigator,z=b.isFunction(k.formatGoInput)?k.formatGoInput(w,e,f,g):k.formatGoInput,A=b.isFunction(k.formatGoButton)?k.formatGoButton(x,e,f,g):k.formatGoButton,B=b.isFunction(k.autoHidePrevious)?k.autoHidePrevious():k.autoHidePrevious,C=b.isFunction(k.autoHideNext)?k.autoHideNext():k.autoHideNext,D=b.isFunction(k.header)?k.header(e,f,g):k.header,E=b.isFunction(k.footer)?k.footer(e,f,g):k.footer;return D&&(c=d.replaceVariables(D,{currentPage:e,totalPage:f,totalNumber:g}),v+=c),(h||j||i)&&(v+='<div class="paginationjs-pages">',v+=u?'<ul class="'+u+'">':"<ul>",h&&(e<=1?B||(v+='<li class="'+s+"-prev "+t+'"><a>'+p+"</a></li>"):v+='<li class="'+s+'-prev J-paginationjs-previous" data-num="'+(e-1)+'" title="Previous page"><a href="'+o+'">'+p+"</a></li>"),j&&(v+=d.generatePageNumbersHTML(a)),i&&(e>=f?C||(v+='<li class="'+s+"-next "+t+'"><a>
1319'+q+"</a></li>"):v+='<li class="'+s+'-next J-paginationjs-next" data-num="'+(e+1)+'" title="Next page"><a href="'+o+'">'+q+"</a></li>"),v+="</ul></div>"),l&&y&&(c=d.replaceVariables(y,{currentPage:e,totalPage:f,totalNumber:g}),v+='<div class="'+s+'-nav J-paginationjs-nav">'+c+"</div>"),m&&z&&(c=d.replaceVariables(z,{currentPage:e,totalPage:f,totalNumber:g,input:w}),v+='<div class="'+s+'-go-input">'+c+"</div>"),n&&A&&(c=d.replaceVariables(A,{currentPage:e,totalPage:f,totalNumber:g,button:x}),v+='<div class="'+s+'-go-button">'+c+"</div>"),E&&(c=d.replaceVariables(E,{currentPage:e,totalPage:f,totalNumber:g}),v+=c),v},findTotalNumberFromRemoteResponse:function(a){this.model.totalNumber=k.totalNumberLocator(a)},go:function(a,c){function d(a){if(!1===e.callHook("beforePaging",g))return!1;if(f.direction=void 0===f.pageNumber?0:g>f.pageNumber?1:-1,f.pageNumber=g,e.render(),e.disabled&&e.isAsync&&e.enable(),j.data("pagination").model=f,k.formatResult){var d=b.extend(!0,[],a);i.isArray(a=k.formatResult(d))||(a=d)}j.data("pagination").currentPageData=a,e.doCallback(a,c),e.callHook("afterPaging",g),1==g&&e.callHook("afterIsFirstPage"),g==e.getTotalPage()&&e.callHook("afterIsLastPage")}var e=this,f=e.model;if(!e.disabled){var g=a;if((g=parseInt(g))&&!(g<1)){var h=k.pageSize,l=e.getTotalNumber(),m=e.getTotalPage();if(!(l>0&&g>m)){if(!e.isAsync)return void d(e.getDataFragment(g));var n={},o=k.alias||{};n[o.pageSize?o.pageSize:"pageSize"]=h,n[o.pageNumber?o.pageNumber:"pageNumber"]=g;var p=b.isFunction(k.ajax)?k.ajax():k.ajax,q={type:"get",cache:!1,data:{},contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"json",async:!0};b.extend(!0,q,p),b.extend(q.data,n),q.url=k.dataSource,q.success=function(a){e.isDynamicTotalNumber?e.findTotalNumberFromRemoteResponse(a):e.model.totalNumber=k.totalNumber,d(e.filterDataByLocator(a))},q.error=function(a,b,c){k.formatAjaxError&&k.formatAjaxError(a,b,c),e.enable()},e.disable(),b.ajax(q)}}}},doCallback:function(a,c){var d=this,e=d.model;b.isFunction(c)?c(a,e):b.isFunction(k.callback)&&k.callback(a,e)},destroy:function(){!1!==this.callHook("beforeDestroy")&&(this.model.el.remove(),j.off(),b("#paginationjs-style").remove(),this.callHook("afterDestroy"))},previous:function(a){this.go(this.model.pageNumber-1,a)},next:function(a){this.go(this.model.pageNumber+1,a)},disable:function(){var a=this,b=a.isAsync?"async":"sync";!1!==a.callHook("beforeDisable",b)&&(a.disabled=!0,a.model.disabled=!0,a.callHook("afterDisable",b))},enable:function(){var a=this,b=a.isAsync?"async":"sync";!1!==a.callHook("beforeEnable",b)&&(a.disabled=!1,a.model.disabled=!1,a.callHook("afterEnable",b))},refresh:function(a){this.go(this.model.pageNumber,a)},show:function(){var a=this;a.model.el.is(":visible")||a.model.el.show()},hide:function(){var a=this;a.model.el.is(":visible")&&a.model.el.hide()},replaceVariables:function(a,b){var c;for(var d in b){var e=b[d],f=new RegExp("<%=\\s*"+d+"\\s*%>","img");c=(c||a).replace(f,e)}return c},getDataFragment:function(a){var b=k.pageSize,c=k.dataSource,d=this.getTotalNumber(),e=b*(a-1)+1,f=Math.min(a*b,d);return c.slice(e-1,f)},getTotalNumber:function(){return this.model.totalNumber||k.totalNumber||0},getTotalPage:function(){return Math.ceil(this.getTotalNumber()/k.pageSize)},getLocator:function(a){var d;return"string"==typeof a?d=a:b.isFunction(a)?d=a():c('"locator" is incorrect. (String | Function)'),d},filterDataByLocator:function(a){var d,e=this.getLocator(k.locator);if(i.isObject(a)){try{b.each(e.split("."),function(b,c){d=(d||a)[c]})}catch(a){}d?i.isArray(d)||c("dataSource."+e+" must be an Array."):c("dataSource."+e+" is undefined.")}return d||a},parseDataSource:function(a,d){var e=this;i.isObject(a)?d(k.dataSource=e.filterDataByLocator(a)):i.isArray(a)?d(k.dataSource=a):b.isFunction(a)?k.dataSource(function(a){i.isArray(a)||c('The parameter of "done" Function should be an Array.'),e.parseDataSource.call(e,a,d)}):"string"==typeof a?(/^https?|file:/.test(a)&&(k.ajaxDataType="jsonp"),d(a)):c('Unexpected type of "dataSource".')},callHook:function(c){var d,e=j.data("pagination"),f=Array.prototype.slice.apply(arguments);return f.shift(),k[c]&&b.isFunction(k[c])&&!1===k[c].apply(a,f)&&(d=!1),e.hooks&&e.hooks[c]&&b.each(e.hooks[c],function(b,c){!1===c.apply(a,f)&&(d=!1)}),!1!==d},observer:function(){var a=this,d=a.model.el;j.on(h+"go",function(d,e,f){(e=parseInt(b.trim(e)))&&(b.isNumeric(e)||c('"pageNumber" is incorrect. (Number)'),a.go(e,f))}),d.delegate(".J-paginationjs-page","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));if(e&&!d.hasClass(k.disableClassName)&&!d.hasClass(k.activeClassName))return!1!==a.callHook("beforePageOnClick",c,e)&&(a.go(e),a.callHook("afterPageOnClick",c,e),!!k.pageLink&&void 0)}),d.delegate(".J-paginationjs-previous","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));if(e&&!d.hasClass(k.disableClassName))return!1!==a.callHook("beforePreviousOnClick",c,e)&&(a.go(e),a.callHook("afterPreviousOnClick",c,e),!!k.pageLink&&void 0)}),d.delegate(".J-paginationjs-next","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));if(e&&!d.hasClass(k.disableClassName))return!1!==a.callHook("beforeNextOnClick",c,e)&&(a.go(e),a.callHook("afterNextOnClick",c,e),!!k.pageLink&&void 0)}),d.delegate(".J-paginationjs-go-button","click",function(c){var e=b(".J-paginationjs-go-pagenumber",d).val();if(!1===a.callHook("beforeGoButtonOnClick",c,e))return!1;j.trigger(h+"go",e),a.callHook("afterGoButtonOnClick",c,e)}),d.delegate(".J-paginationjs-go-pagenumber","keyup",function(c){if(13===c.which){var e=b(c.currentTarget).val();if(!1===a.callHook("beforeGoInputOnEnter",c,e))return!1;j.trigger(h+"go",e),b(".J-paginationjs-go-pagenumber",d).focus(),a.callHook("afterGoInputOnEnter",c,e)}}),j.on(h+"previous",function(b,c){a.previous(c)}),j.on(h+"next",function(b,c){a.next(c)}),j.on(h+"disable",function(){a.disable()}),j.on(h+"enable",function(){a.enable()}),j.on(h+"refresh",function(b,c){a.refresh(c)}),j.on(h+"show",function(){a.show()}),j.on(h+"hide",function(){a.hide()}),j.on(h+"destroy",function(){a.destroy()});var e=Math.max(a.getTotalPage(),1),f=k.pageNumber;a.isDynamicTotalNumber&&(f=1),k.triggerPagingOnInit&&j.trigger(h+"go",Math.min(f,e))}};if(j.data("pagination")&&!0===j.data("pagination").initialized){if(b.isNumeric(f))return j.trigger.call(this,h+"go",f,arguments[1]),this;if("string"==typeof f){var m=Array.prototype.slice.apply(arguments);switch(m[0]=h+m[0],f){case"previous":case"next":case"go":case"disable":case"enable":case"refresh":case"show":case"hide":case"destroy":j.trigger.apply(this,m);break;case"getSelectedPageNum":return j.data("pagination").model?j.data("pagination").model.pageNumber:j.data("pagination").attributes.pageNumber;case"getTotalPage":return Math.ceil(j.data("pagination").model.totalNumber/j.data("pagination").model.pageSize);case"getSelectedPageData":return j.data("pagination").currentPageData;case"isDisabled":return!0===j.data("pagination").model.disabled;default:c("Unknown action: "+f)}return this}e(j)}
1319else i.isObject(f)||c("Illegal options");return d(k),l.initialize(),this},b.fn[g].defaults={totalNumber:0,pageNumber:1,pageSize:10,pageRange:2,showPrevious:!0,showNext:!0,showPageNumbers:!0,showNavigator:!1,showGoInput:!1,showGoButton:!1,pageLink:"",prevText:"&laquo;",nextText:"&raquo;",ellipsisText:"...",goButtonText:"Go",classPrefix:"paginationjs",activeClassName:"active",disableClassName:"disabled",inlineStyle:!0,formatNavigator:"<%= currentPage %> / <%= totalPage %>",formatGoInput:"<%= input %>",formatGoButton:"<%= button %>",position:"bottom",autoHidePrevious:!1,autoHideNext:!1,triggerPagingOnInit:!0,hideWhenLessThanOnePage:!1,showFirstOnEllipsisShow:!0,showLastOnEllipsisShow:!0,callback:function(){}},b.fn.addHook=function(a,d){arguments.length<2&&c("Missing argument."),b.isFunction(d)||c("callback must be a function.");var e=b(this),f=e.data("pagination");f||(e.data("pagination",{}),f=e.data("pagination")),!f.hooks&&(f.hooks={}),f.hooks[a]=f.hooks[a]||[],f.hooks[a].push(d)},b[g]=function(a,d){arguments.length<2&&c("Requires two parameters.");var e;if(e="string"!=typeof a&&a instanceof jQuery?a:b(a),e.length)return e.pagination(d),e};var i={};b.each(["Object","Array","String"],function(a,b){i["is"+b]=function(a){return f(a)===b.toLowerCase()}}),"function"==typeof define&&define.amd&&define(function(){return b})}(this,window.jQuery);;
1320/* global google */
1321/* global MarkerClusterer */
1322
1323var map;
1324
1325function gotToPin(lon, lat) {
1326  'use strict';
1327  if (typeof map == 'undefined') {return;}
1328
1329  var long = parseFloat(lon);
1330  var lati = parseFloat(lat);
1331
1332  if (long && lati) {
1333    var latLng = new google.maps.LatLng(lati, long);
1334    if (map.getZoom() < 17) {
1335      map.setZoom(19);
1336    }
1337    map.panTo(latLng);
1338    jQuery('html, body').animate({
1339      scrollTop: (jQuery('#map').offset().top - parseInt(jQuery('body').css('padding-top'))) + 'px'
1340    }, 1000);
1341  }
1342}
1343
1344(function ($, Drupal) {
1345  'use strict';
1346
1347  var markers = [];
1348  var latitude = 55.1700272;
1349  var longitude = 22.7739254;
1350  var map_zoom = 12;
1351  var bounds = null;
1352  var geocoder;
1353  var is_internetExplorer11 = navigator.userAgent.toLowerCase().indexOf('trident') > -1;
1354
1355  var clusterStyles = [{
1356    textColor: '#000',
1357    url: '/themes/posttheme/images/map/clusterer.png',
1358    height: 66,
1359    width: 66,
1360    fontFamily: 'Roboto, sans-serif',
1361    textSize: 20
1362  }];
1363
1364  var mcOptions = {gridSize: 50, styles: clusterStyles, maxZoom: 15};
1365  var map_options = {center: new google.maps.LatLng(latitude, longitude), zoom: map_zoom, scrollwheel: false};
1366  var infowindow = null;
1367  var icons = {
1368    PostOffice: {icon: (is_internetExplorer11) ? '/themes/posttheme/images/map/png/pin_type_1.png' : '/themes/posttheme/images/map/svg/pin_type_1.svg'},
1369    PostBox: {icon: (is_internetExplorer11) ? '/themes/posttheme/images/map/png/pin_type_2.png' : '/themes/posttheme/images/map/svg/pin_type_2.svg'},
1370    MobilePostBox: {icon: (is_internetExplorer11) ? '/themes/posttheme/images/map/png/pin_type_3.png' : '/themes/posttheme/images/map/svg/pin_type_3.svg'},
1371    PayPost: {icon: (is_internetExplorer11) ? '/themes/posttheme/images/map/png/pin_type_4.png' : '/themes/posttheme/images/map/svg/pin_type_4.svg'},
1372    PostTerminal: {icon: (is_internetExplorer11) ? '/themes/posttheme/images/map/png/pin_type_5.png' : '/themes/posttheme/images/map/svg/pin_type_5.svg'},
1373    PostMan: {icon: (is_internetExplorer11) ? '/themes/posttheme/images/map/png/pin_type_6.png' : '/themes/posttheme/images/map/svg/pin_type_6.svg'}
1374  };
1375
1376  function setMarkers(map) {
1377    for (var i = 0; i < window.data.posts.length; i++) {
1378      addMarker(window.data.posts[i]);
1379    }
1380  }
1381
1382  function addMarker(post) {
1383    var marker = new google.maps.Marker({
1384      position: new google.maps.LatLng(post.latitude, post.longitude),
1385      icon: icons[post.type].icon,
1386      map: map
1387    });
1388
1389    var myLatLng = new google.maps.LatLng(post.latitude, post.longitude);
1390    bounds.extend(myLatLng);
1391    markers.push(marker);
1392
1393    google.maps.event.addListener(marker, 'click', function () {
1394      var vH = post.breakHours ? '<h5>Pertrauka</h5><div style="font-size:14px">' + post.breakHours + '</div>' : '';
1395      infowindow.setContent('<div class="card card-map card-border card-radius">' +
1396        '<h4>' + post.post_title + '</h4>' +
1397        '<p>' + post.post_adress + '</hp>' +
1398        '<div class="row">' +
1399          '<div class="col-sm-6" '+ (post.workhours == '' ? 'style="display:none">' : '') + '>
1399' +
1400            '<h5>' + TR_KEY_WORKIN_HOURS + '</h5>' +
1401            '<ul class="list-worktime">' + post.workhours + '</ul>' + vH +
1402          '</div>' +
1403          '<div class="col-sm-6" '+ (!post.phone ? 'style="display:none"' : '') + '>' +
1404              '<h5>' + TR_KEY_CONTACTS + '</h5>' +
1405              '<ul>' +
1406                '<li style="white-space:nowrap">'+TR_KEY_TEL+'<a href="tel:' + post.phone + '">' + post.phone + '</a></li>' +
1407              '</ul>' +
1408            '</div>' +
1409        '</div>' +
1410      '</div>');
1411      infowindow.open(map, marker);
1412      $('.gm-style-iw').prev().css({display: 'none'});
1413      var iwCloseBtn = $('.gm-style-iw').next();
1414      iwCloseBtn.addClass('ficon fi-close');
1415      iwCloseBtn.css({ opacity: '1', width: '20px', height: '20px', right: '45px', top: '25px', fontSize: '16px' });
1416      iwCloseBtn.find('img').css({display: 'none'});
1417    });
1418
1419  }
1420
1421  function resizeMap() {
1422    if (typeof map == 'undefined') {return;}
1423    setTimeout(function () { resizinmap(); }, 400);
1424  }
1425
1426  function resizinmap() {
1427    if (typeof map == 'undefined') {return;}
1428    var center = map.getCenter();
1429    google.maps.event.trigger(map, 'resize');
1430    map.setCenter(center);
1431  }
1432
1433  function initialize() {
1434      map = new google.maps.Map(document.getElementById('map'), map_options);
1435      geocoder = new google.maps.Geocoder();
1436      bounds = new google.maps.LatLngBounds();
1437      infowindow = new google.maps.InfoWindow({content: '',maxWidth: 400});
1438  }
1439
1440  function typeToIcon(type) {
1441    if (type == 'PayPost') return 'paypost';
1442    if (type == 'PostBox') return 'mailbox';
1443    if (type == 'PostMan') return 'mobile-postman';
1444    if (type == 'PostTerminal') return 'terminal';
1445    if (type == 'MobilePostBox') return 'portable-post';
1446    if (type == 'PostOffice') return 'post';
1447    return 'post';
1448  }
1449
1450  google.maps.event.addDomListener(window, "load", initialize);
1451
1452  $(document).ready(function () {
1453    $('.map-pan').click(function () {
1454      gotToPin($(this).closest('tr'));
1455    });
1456
1457    $('.pf_ff').change(function () {
1458      if ($('#pc_city').val() !== '-1' && $('#pc_city').val() !== null) {
1459        $('#pc_find').prop('disabled', false);
1460      }
1461    });
1462
1463    $('#pc_locality').on('select2:select', function (e) {
1464      var val = e.params.data.id;
1465      if (val) {
1466        val = val.split(':');
1467        $('#pc_municipality_id').val(val[0]);
1468        $('#pc_locality_id').val(val[1]);
1469        $('#pc_street').val('');
1470        $('#pc_street').prop('disabled', false);
1471        $('#pc_find').prop('disabled', false);
1472      } else {
1473        $('#pc_street').val('');
1474        $('#pc_street').prop('disabled', true);
1475        $('#pc_find').prop('disabled', true);
1476      }
1477    });
1478
1479    $('.pc_locality_select').select2({
1480      placeholder: 'Įveskite miesto ar kaimo pavadinimą',
1481      language: (drupalSettings.path.currentLanguage || 'lt'),
1482      minimumInputLength: 2,
1483      ajax: {
1484          url: '/post/codes/search/city',
1485          dataType: 'json',
1486          data: function (params) {
1487              var query = {
1488                name: params.term
1489              }
1490              return query;
1491          }
1492      }
1493    });  
1494
1495
1496    $('#pc_street').change(function () {
1497      $('#pc_find').prop('disabled', false);
1498    });
1499
1500    function makeSearch() {
1501      geocoder.geocode({
1502        address: $('#pc_street').val() + ', ' + $('#pc_city').find('option:selected').html() + ', LT'
1503      }, function (results, status) {
1504        if (status === 'OK') {
1505          $('#LA').val(results[0].geometry.location.lat().toString());
1506          $('#LO').val(results[0].geometry.location.lng().toString());
1507        }
1508        else {
1509          $('#LA').val('');
1510          $('#LO').val('');
1511        }
1512        var types = [];
1513        $('.pf_ff:checked').each(function (idx, i) {
1514          types.push($(i).val());
1515        });
1516
1517        var pf_fm = $('#pf_fm').val();
1518        if(pf_fm) {
1519          types.push(pf_fm);
1520        }
1521
1522        $.post('/post/codes/search/getPlaces', {
1523          municipality: $('#pc_municipality_id').val(),
1524          city: $('#pc_locality_id').val(),
1525          street: $('#pc_street').val(),
1526          la: $('#LA').val(),
1527          lo: $('#LO').val(),
1528          types: types
1529        }, function (results) {
1530
1531          if (results.length) {
1532            window.data.posts = [];
1533            window.data.posts = results.map(function (i) {
1534              var workhours = '', withdrawals = '';
1535              i.workHours.forEach(function (wh) {
1536                workhours += '<li data-day="' + wh.days + '">' + wh.hours + '</li>';
1537              });
1538              i.withdrawals.forEach(function (wh) {
1539                withdrawals += '<li data-day="' + wh.days + '">' + wh.hours + '</li>';
1540              });
1541              return {
1542                post_id: i.id,
1543                post_title: i.name,
1544                post_adress: i.addressText,
1545                longitude: i.map.longitude,
1546                latitude: i.map.latitude,
1547                type: i.type,
1548                workhours: workhours,
1549                withdrawals: withdrawals,
1550                breakHours: i.breakHoursText,
1551                phone: i.phone
1552              };
1553            });
1554
1555            $('#results').show();
1556            $('#results_count').html(results.length);
1557            $('#map_container').show();
1558            $('#results_container').show();
1559
1560            map = new google.maps.Map(document.getElementById('map'), map_options);
1561            bounds = new google.maps.LatLngBounds();
1562            for (var id = 0; id < markers.length; id++) {
1563              markers[id].setMap(null);
1564            } markers = [];
1565            setMarkers(map);
1566            new MarkerClusterer(map, markers, mcOptions);
1567            map.fitBounds(bounds);
1568            resizeMap();
1569
1570
1571            $(window).scrollTop($('#results').offset().top - 30);
1572            $('#tbl_results').empty();
1573            $('#pagination').pagination({
1574              dataSource: results,
1575              ulClassName: 'pagination',
1576              pageSize: 30,
1577              autoHidePrevious: true,
1578              autoHideNext: true,
1579              callback: function(data, pagination) {
1580                $('#tbl_results').empty();
1581
1582                data.forEach(function (item, index) {
1583                  var tpl = $('.row_tpl').clone();
1584                  tpl.removeClass('row_tpl');
1585                  tpl.attr('data-post-id', item.id);
1586                  tpl.attr('data-office-type', item.type);
1587                  tpl.attr('data-office-longitude', item.map.longitude);
1588                  tpl.attr('data-office-latitude', item.map.latitude);
1589                  tpl.find('.ficon').addClass('fi-' + typeToIcon(item.type) +' fi-32');
1590                  tpl.find('.f-sm').html(item.name);
1591                  tpl.find('.post-adress').html(item.addressDetails.streetName + ' ' + item.addressDetails.houseNumber);
1592                  tpl.find('.aditDetails').html(
1593                    (item.addressDetails.postCode ? item.addressDetails.postCode + ' ' : '' ) +
1594                    item.addressDetails.settlementName + ', ' +
1595                    item.addressDetails.municipalityName + ' ' +
1596                    '<a href="javascript:gotToPin(' + item.map.longitude + ',' + item.map.latitude + ')" class="map-pan hidden-xs">'+TR_KEY_MAP+'<i class="ficon fi-14 fi-sm-arr-right"></i></a>' +
1597                    '<a target="_blank" href="https://maps.google.com?saddr=&daddr=' + item.map.latitude + ',' + item.map.longitude + '&dirflg=d" class="map-pan visible-xs">'+TR_KEY_MAP+'<i class="ficon fi-14 fi-sm-arr-right"></i></a>'
1598                  );
1599                  tpl.find('.post-contact').html(item.phone);
1600                  if ($.trim(item.comment)) {
1601                    tpl.find('.ccom').show();
1602                    tpl.find('.comment').html(item.comment);
1603                  }
1604                  if (item.type !== 'PostTerminal') {
1605                    item.workHours.forEach(function (wh) {
1606                      tpl.find('.list-worktime').append('<li data-day="' + wh.days + '">' + wh.hours + '</li>');
1607                    });
1608                  }
1609                  if (item.withdrawals.length) {
1610                    tpl.find('.list-worktime').append('<li></li>');
1611                    tpl.find('.list-worktime').append('<li style="padding-left:0px;font-size:14px;">Siuntas surenkame:</li>');
1612                    item.withdrawals.forEach(function (wh) {
1613                      tpl.find('.list-worktime').append('<li data-day="' + wh.days + '">' + wh.hours + '</li>');
1614                    });
1615                  }
1616                  $(".mobilesOnly").attr('href', 'tel:'+ item.phone);
1617    
1618                  if (item.breakHoursText) {
1619                    tpl.find('.bhrs').show();
1620                    tpl.find('.bhText').html(item.breakHoursText);
1621                  }
1622                  item.services.forEach(function (service) {
1623                    tpl.find('.list-tick').append('<li>' + service.name + '</li>');
1624                  });
1625                  $('#tbl_results').append(tpl);
1626                });
1627                $(window).scrollTop($('#results').offset().top - 30);
1628              }
1629            });
1630            $('#pagination').show();
1631          } else {
1632            $('#results').show();
1633            $('#results_count').html('0');
1634            $('#map_container').show();
1635            $('#results_container').show();
1636            $('#tbl_results').empty();
1637          }
1638        }).fail(function () {
1639          alert('Sistemos klaida. Prašome pabandyti vėliau.');
1640        });
1641      });
1642    }
1643
1644    $('#pc_find').click(function () {
1645      makeSearch();
1646    });
1647
1648    $('#postCodes').submit(function (e) {
1649      makeSearch();
1650      e.preventDefault();
1651    })
1652
1653    $('.list-label:not(.list-search-services) input[type=checkbox]').change(function () {
1654      $('.list-label > li').removeClass('active');
1655      $(this).parents('li').toggleClass('active');
1656    });
1657
1658    $('.list-search-services input[type=checkbox]').change(function () {
1659      $(this).parents('li').toggleClass('active');
1660    });
1661  });
1662})(jQuery, Drupal);
1663;
1664/**
1665* DO NOT EDIT THIS FILE.
1666* See the following change record for more information,
1667* https://www.drupal.org/node/2815083
1668* @preserve
1669**/
1670
1671Drupal.debounce = function (func, wait, immediate) {
1672  var timeout = void 0;
1673  var result = void 0;
1674  return function () {
1675    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
1676      args[_key] = arguments[_key];
1677    }
1678
1679    var context = this;
1680    var later = function later() {
1681      timeout = null;
1682      if (!immediate) {
1683        result = func.apply(context, args);
1684      }
1685    };
1686    var callNow = immediate && !timeout;
1687    clearTimeout(timeout);
1688    timeout = setTimeout(later, wait);
1689    if (callNow) {
1690      result = func.apply(context, args);
1691    }
1692    return result;
1693  };
1694};;
1695/**
1696* DO NOT EDIT THIS FILE.
1697* See the following change record for more information,
1698* https://www.drupal.org/node/2815083
1699* @preserve
1700**/
1701
1702(function ($, Drupal, debounce) {
1703  $.fn.drupalGetSummary = function () {
1704    var callback = this.data('summaryCallback');
1705    return this[0] && callback ? $.trim(callback(this[0])) : '';
1706  };
1707
1708  $.fn.drupalSetSummary = function (callback) {
1709    var self = this;
1710
1711    if (typeof callback !== 'function') {
1712      var val = callback;
1713      callback = function callback() {
1714        return val;
1715      };
1716    }
1717
1718    return this.data('summaryCallback', callback).off('formUpdated.summary').on('formUpdated.summary', function () {
1719      self.trigger('summaryUpdated');
1720    }).trigger('summaryUpdated');
1721  };
1722
1723  Drupal.behaviors.formSingleSubmit = {
1724    attach: function attach() {
1725      function onFormSubmit(e) {
1726        var $form = $(e.currentTarget);
1727        var formValues = $form.serialize();
1728        var previousValues = $form.attr('data-drupal-form-submit-last');
1729        if (previousValues === formValues) {
1730          e.preventDefault();
1731        } else {
1732          $form.attr('data-drupal-form-submit-last', formValues);
1733        }
1734      }
1735
1736      $('body').once('form-single-submit').on('submit.singleSubmit', 'form:not([method~="GET"])', onFormSubmit);
1737    }
1738  };
1739
1740  function triggerFormUpdated(element) {
1741    $(element).trigger('formUpdated');
1742  }
1743
1744  function fieldsList(form) {
1745    var $fieldList = $(form).find('[name]').map(function (index, element) {
1746      return element.getAttribute('id');
1747    });
1748
1749    return $.makeArray($fieldList);
1750  }
1751
1752  Drupal.behaviors.formUpdated = {
1753    attach: function attach(context) {
1754      var $context = $(context);
1755      var contextIsForm = $context.is('form');
1756      var $forms = (contextIsForm ? $context : $context.find('form')).once('form-updated');
1757      var formFields = void 0;
1758
1759      if ($forms.length) {
1760        $.makeArray($forms).forEach(function (form) {
1761          var events = 'change.formUpdated input.formUpdated ';
1762          var eventHandler = debounce(function (event) {
1763            triggerFormUpdated(event.target);
1764          }, 300);
1765          formFields = fieldsList(form).join(',');
1766
1767          form.setAttribute('data-drupal-form-fields', formFields);
1768          $(form).on(events, eventHandler);
1769        });
1770      }
1771
1772      if (contextIsForm) {
1773        formFields = fieldsList(context).join(',');
1774
1775        var currentFields = $(context).attr('data-drupal-form-fields');
1776
1777        if (formFields !== currentFields) {
1778          triggerFormUpdated(context);
1779        }
1780      }
1781    },
1782    detach: function detach(context, settings, trigger) {
1783      var $context = $(context);
1784      var contextIsForm = $context.is('form');
1785      if (trigger === 'unload') {
1786        var $forms = (contextIsForm ? $context : $context.find('form')).removeOnce('form-updated');
1787        if ($forms.length) {
1788          $.makeArray($forms).forEach(function (form) {
1789            form.removeAttribute('data-drupal-form-fields');
1790            $(form).off('.formUpdated');
1791          });
1792        }
1793      }
1794    }
1795  };
1796
1797  Drupal.behaviors.fillUserInfoFromBrowser = {
1798    attach: function attach(context, settings) {
1799      var userInfo = ['name', 'mail', 'homepage'];
1800      var $forms = $('[data-user-info-from-browser]').once('user-info-from-browser');
1801      if ($forms.length) {
1802        userInfo.forEach(function (info) {
1803          var $element = $forms.find('[name=' + info + ']');
1804          var browserData = localStorage.getItem('Drupal.visitor.' + info);
1805          var emptyOrDefault = $element.val() === '' || $element.attr('data-drupal-default-value') === $element.val();
1806          if ($element.length && emptyOrDefault && browserData) {
1807            $element.val(browserData);
1808          }
1809        });
1810      }
1811      $forms.on('submit', function () {
1812        userInfo.forEach(function (info) {
1813          var $element = $forms.find('[name=' + info + ']');
1814          if ($element.length) {
1815            localStorage.setItem('Drupal.visitor.' + info, $element.val());
1816          }
1817        });
1818      });
1819    }
1820  };
1821
1822  var handleFragmentLinkClickOrHashChange = function handleFragmentLinkClickOrHashChange(e) {
1823    var url = void 0;
1824    if (e.type === 'click') {
1825      url = e.currentTarget.location ? e.currentTarget.location : e.currentTarget;
1826    } else {
1827      url = window.location;
1828    }
1829    var hash = url.hash.substr(1);
1830    if (hash) {
1831      var $target = $('#' + hash);
1832      $('body').trigger('formFragmentLinkClickOrHashChange', [$target]);
1833
1834      setTimeout(function () {
1835        return $target.trigger('focus');
1836      }, 300);
1837    }
1838  };
1839
1840  var debouncedHandleFragmentLinkClickOrHashChange = debounce(handleFragmentLinkClickOrHashChange, 300, true);
1841
1842  $(window).on('hashchange.form-fragment', debouncedHandleFragmentLinkClickOrHashChange);
1843
1844  $(document).on('click.form-fragment', 'a[href*="#"]', debouncedHandleFragmentLinkClickOrHashChange);
1845})(jQuery, Drupal, Drupal.debounce);;
1846/**
1847 * @file
1848 * Webform behaviors.
1849 */
1850
1851(function ($, Drupal) {
1852
1853  'use strict';
1854
1855  // Trigger Drupal's attaching of behaviors after the page is
1856  // completely loaded.
1857  // @see https://stackoverflow.com/questions/37838430/detect-if-page-is-load-from-back-button
1858  // @see https://stackoverflow.com/questions/20899274/how-to-refresh-page-on-back-button-click/20899422#20899422
1859  var isChrome = (/chrom(e|ium)/.test(window.navigator.userAgent.toLowerCase()));
1860  if (isChrome) {
1861    // Track back button in navigation.
1862    // @see https://stackoverflow.com/questions/37838430/detect-if-page-is-load-from-back-button
1863    var backButton = false;
1864    if (window.performance) {
1865      var navEntries = window.performance.getEntriesByType('navigation');
1866      if (navEntries.length > 0 && navEntries[0].type === 'back_forward') {
1867        backButton = true;
1868      }
1869      else if (window.performance.navigation
1870        && window.performance.navigation.type === window.performance.navigation.TYPE_BACK_FORWARD) {
1871        backButton = true;
1872      }
1873    }
1874
1875    // If the back button is pressed, delay Drupal's attaching of behaviors.
1876    if (backButton) {
1877      var attachBehaviors = Drupal.attachBehaviors;
1878      Drupal.attachBehaviors = function (context, settings) {
1879        setTimeout(function (context, settings) {
1880          attachBehaviors(context, settings);
1881        }, 300);
1882      };
1883    }
1884  }
1885
1886})(jQuery, Drupal);
1887;
1888/**
1889* DO NOT EDIT THIS FILE.
1890* See the following change record for more information,
1891* https://www.drupal.org/node/2815083
1892* @preserve
1893**/
1894
1895(function ($, Drupal) {
1896  var states = {
1897    postponed: []
1898  };
1899
1900  Drupal.states = states;
1901
1902  function invert(a, invertState) {
1903    return invertState && typeof a !== 'undefined' ? !a : a;
1904  }
1905
1906  function _compare2(a, b) {
1907    if (a === b) {
1908      return typeof a === 'undefined' ? a : true;
1909    }
1910
1911    return typeof a === 'undefined' || typeof b === 'undefined';
1912  }
1913
1914  function ternary(a, b) {
1915    if (typeof a === 'undefined') {
1916      return b;
1917    }
1918    if (typeof b === 'undefined') {
1919      return a;
1920    }
1921
1922    return a && b;
1923  }
1924
1925  Drupal.behaviors.states = {
1926    attach: function attach(context, settings) {
1927      var $states = $(context).find('[data-drupal-states]');
1928      var il = $states.length;
1929
1930      var _loop = function _loop(i) {
1931        var config = JSON.parse($states[i].getAttribute('data-drupal-states'));
1932        Object.keys(config || {}
1932).forEach(function (state) {
1933          new states.Dependent({
1934            element: $($states[i]),
1935            state: states.State.sanitize(state),
1936            constraints: config[state]
1937          });
1938        });
1939      };
1940
1941      for (var i = 0; i < il; i++) {
1942        _loop(i);
1943      }
1944
1945      while (states.postponed.length) {
1946        states.postponed.shift()();
1947      }
1948    }
1949  };
1950
1951  states.Dependent = function (args) {
1952    var _this = this;
1953
1954    $.extend(this, { values: {}, oldValue: null }, args);
1955
1956    this.dependees = this.getDependees();
1957    Object.keys(this.dependees || {}).forEach(function (selector) {
1958      _this.initializeDependee(selector, _this.dependees[selector]);
1959    });
1960  };
1961
1962  states.Dependent.comparisons = {
1963    RegExp: function RegExp(reference, value) {
1964      return reference.test(value);
1965    },
1966    Function: function Function(reference, value) {
1967      return reference(value);
1968    },
1969    Number: function Number(reference, value) {
1970      return typeof value === 'string' ? _compare2(reference.toString(), value) : _compare2(reference, value);
1971    }
1972  };
1973
1974  states.Dependent.prototype = {
1975    initializeDependee: function initializeDependee(selector, dependeeStates) {
1976      var _this2 = this;
1977
1978      this.values[selector] = {};
1979
1980      Object.keys(dependeeStates).forEach(function (i) {
1981        var state = dependeeStates[i];
1982
1983        if ($.inArray(state, dependeeStates) === -1) {
1984          return;
1985        }
1986
1987        state = states.State.sanitize(state);
1988
1989        _this2.values[selector][state.name] = null;
1990
1991        $(selector).on('state:' + state, { selector: selector, state: state }, function (e) {
1992          _this2.update(e.data.selector, e.data.state, e.value);
1993        });
1994
1995        new states.Trigger({ selector: selector, state: state });
1996      });
1997    },
1998    compare: function compare(reference, selector, state) {
1999      var value = this.values[selector][state.name];
2000      if (reference.constructor.name in states.Dependent.comparisons) {
2001        return states.Dependent.comparisons[reference.constructor.name](reference, value);
2002      }
2003
2004      return _compare2(reference, value);
2005    },
2006    update: function update(selector, state, value) {
2007      if (value !== this.values[selector][state.name]) {
2008        this.values[selector][state.name] = value;
2009        this.reevaluate();
2010      }
2011    },
2012    reevaluate: function reevaluate() {
2013      var value = this.verifyConstraints(this.constraints);
2014
2015      if (value !== this.oldValue) {
2016        this.oldValue = value;
2017
2018        value = invert(value, this.state.invert);
2019
2020        this.element.trigger({
2021          type: 'state:' + this.state,
2022          value: value,
2023          trigger: true
2024        });
2025      }
2026    },
2027    verifyConstraints: function verifyConstraints(constraints, selector) {
2028      var result = void 0;
2029      if ($.isArray(constraints)) {
2030        var hasXor = $.inArray('xor', constraints) === -1;
2031        var len = constraints.length;
2032        for (var i = 0; i < len; i++) {
2033          if (constraints[i] !== 'xor') {
2034            var constraint = this.checkConstraints(constraints[i], selector, i);
2035
2036            if (constraint && (hasXor || result)) {
2037              return hasXor;
2038            }
2039            result = result || constraint;
2040          }
2041        }
2042      } else if ($.isPlainObject(constraints)) {
2043          for (var n in constraints) {
2044            if (constraints.hasOwnProperty(n)) {
2045              result = ternary(result, this.checkConstraints(constraints[n], selector, n));
2046
2047              if (result === false) {
2048                return false;
2049              }
2050            }
2051          }
2052        }
2053      return result;
2054    },
2055    checkConstraints: function checkConstraints(value, selector, state) {
2056      if (typeof state !== 'string' || /[0-9]/.test(state[0])) {
2057        state = null;
2058      } else if (typeof selector === 'undefined') {
2059        selector = state;
2060        state = null;
2061      }
2062
2063      if (state !== null) {
2064        state = states.State.sanitize(state);
2065        return invert(this.compare(value, selector, state), state.invert);
2066      }
2067
2068      return this.verifyConstraints(value, selector);
2069    },
2070    getDependees: function getDependees() {
2071      var cache = {};
2072
2073      var _compare = this.compare;
2074      this.compare = function (reference, selector, state) {
2075        (cache[selector] || (cache[selector] = [])).push(state.name);
2076      };
2077
2078      this.verifyConstraints(this.constraints);
2079
2080      this.compare = _compare;
2081
2082      return cache;
2083    }
2084  };
2085
2086  states.Trigger = function (args) {
2087    $.extend(this, args);
2088
2089    if (this.state in states.Trigger.states) {
2090      this.element = $(this.selector);
2091
2092      if (!this.element.data('trigger:' + this.state)) {
2093        this.initialize();
2094      }
2095    }
2096  };
2097
2098  states.Trigger.prototype = {
2099    initialize: function initialize() {
2100      var _this3 = this;
2101
2102      var trigger = states.Trigger.states[this.state];
2103
2104      if (typeof trigger === 'function') {
2105        trigger.call(window, this.element);
2106      } else {
2107        Object.keys(trigger || {}
2107).forEach(function (event) {
2108          _this3.defaultTrigger(event, trigger[event]);
2109        });
2110      }
2111
2112      this.element.data('trigger:' + this.state, true);
2113    },
2114    defaultTrigger: function defaultTrigger(event, valueFn) {
2115      var oldValue = valueFn.call(this.element);
2116
2117      this.element.on(event, $.proxy(function (e) {
2118        var value = valueFn.call(this.element, e);
2119
2120        if (oldValue !== value) {
2121          this.element.trigger({
2122            type: 'state:' + this.state,
2123            value: value,
2124            oldValue: oldValue
2125          });
2126          oldValue = value;
2127        }
2128      }, this));
2129
2130      states.postponed.push($.proxy(function () {
2131        this.element.trigger({
2132          type: 'state:' + this.state,
2133          value: oldValue,
2134          oldValue: null
2135        });
2136      }, this));
2137    }
2138  };
2139
2140  states.Trigger.states = {
2141    empty: {
2142      keyup: function keyup() {
2143        return this.val() === '';
2144      }
2145    },
2146
2147    checked: {
2148      change: function change() {
2149        var checked = false;
2150        this.each(function () {
2151          checked = $(this).prop('checked');
2152
2153          return !checked;
2154        });
2155        return checked;
2156      }
2157    },
2158
2159    value: {
2160      keyup: function keyup() {
2161        if (this.length > 1) {
2162          return this.filter(':checked').val() || false;
2163        }
2164        return this.val();
2165      },
2166      change: function change() {
2167        if (this.length > 1) {
2168          return this.filter(':checked').val() || false;
2169        }
2170        return this.val();
2171      }
2172    },
2173
2174    collapsed: {
2175      collapsed: function collapsed(e) {
2176        return typeof e !== 'undefined' && 'value' in e ? e.value : !this.is('[open]');
2177      }
2178    }
2179  };
2180
2181  states.State = function (state) {
2182    this.pristine = state;
2183    this.name = state;
2184
2185    var process = true;
2186    do {
2187      while (this.name.charAt(0) === '!') {
2188        this.name = this.name.substring(1);
2189        this.invert = !this.invert;
2190      }
2191
2192      if (this.name in states.State.aliases) {
2193        this.name = states.State.aliases[this.name];
2194      } else {
2195        process = false;
2196      }
2197    } while (process);
2198  };
2199
2200  states.State.sanitize = function (state) {
2201    if (state instanceof states.State) {
2202      return state;
2203    }
2204
2205    return new states.State(state);
2206  };
2207
2208  states.State.aliases = {
2209    enabled: '!disabled',
2210    invisible: '!visible',
2211    invalid: '!valid',
2212    untouched: '!touched',
2213    optional: '!required',
2214    filled: '!empty',
2215    unchecked: '!checked',
2216    irrelevant: '!relevant',
2217    expanded: '!collapsed',
2218    open: '!collapsed',
2219    closed: 'collapsed',
2220    readwrite: '!readonly'
2221  };
2222
2223  states.State.prototype = {
2224    invert: false,
2225
2226    toString: function toString() {
2227      return this.name;
2228    }
2229  };
2230
2231  var $document = $(document);
2232  $document.on('state:disabled', function (e) {
2233    if (e.trigger) {
2234      $(e.target).prop('disabled', e.value).closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggleClass('form-disabled', e.value).find('select, input, textarea').prop('disabled', e.value);
2235    }
2236  });
2237
2238  $document.on('state:required', function (e) {
2239    if (e.trigger) {
2240      if (e.value) {
2241        var label = 'label' + (e.target.id ? '[for=' + e.target.id + ']' : '');
2242        var $label = $(e.target).attr({ required: 'required', 'aria-required': 'true' }).closest('.js-form-item, .js-form-wrapper').find(label);
2243
2244        if (!$label.hasClass('js-form-required').length) {
2245          $label.addClass('js-form-required form-required');
2246        }
2247      } else {
2248        $(e.target).removeAttr('required aria-required').closest('.js-form-item, .js-form-wrapper').find('label.js-form-required').removeClass('js-form-required form-required');
2249      }
2250    }
2251  });
2252
2253  $document.on('state:visible', function (e) {
2254    if (e.trigger) {
2255      $(e.target).closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggle(e.value);
2256    }
2257  });
2258
2259  $document.on('state:checked', function (e) {
2260    if (e.trigger) {
2261      $(e.target).prop('checked', e.value);
2262    }
2263  });
2264
2265  $document.on('state:collapsed', function (e) {
2266    if (e.trigger) {
2267      if ($(e.target).is('[open]') === e.value) {
2268        $(e.target).find('> summary').trigger('click');
2269      }
2270    }
2271  });
2272})(jQuery, Drupal);;
2273/**
2274 * @file
2275 * JavaScript behaviors for custom webform #states.
2276 */
2277
2278(function ($, Drupal) {
2279
2280  'use strict';
2281
2282  Drupal.webform = Drupal.webform || {};
2283  Drupal.webform.states = Drupal.webform.states || {};
2284  Drupal.webform.states.slideDown = Drupal.webform.states.slideDown || {};
2285  Drupal.webform.states.slideDown.duration = 'slow';
2286  Drupal.webform.states.slideUp = Drupal.webform.states.slideUp || {};
2287  Drupal.webform.states.slideUp.duration = 'fast';
2288
2289  /* ************************************************************************ */
2290  // jQuery functions.
2291  /* ************************************************************************ */
2292
2293  /**
2294   * Check if an element has a specified data attribute.
2295   *
2296   * @param {string} data
2297   *   The data attribute name.
2298   *
2299   * @return {boolean}
2300   *   TRUE if an element has a specified data attribute.
2301   */
2302  $.fn.hasData = function (data) {
2303    return (typeof this.data(data) !== 'undefined');
2304  };
2305
2306  /**
2307   * Check if element is within the webform or not.
2308   *
2309   * @return {boolean}
2310   *   TRUE if element is within the webform.
2311   */
2312  $.fn.isWebform = function () {
2313    return $(this).closest('form[id^="webform"], form[data-is-webform]').length ? true : false;
2314  };
2315
2316  /**
2317   * Check if element is to be treated as a webform element.
2318   *
2319   * @return {boolean}
2320   *   TRUE if element is to be treated as a webform element.
2321   */
2322  $.fn.isWebformElement = function () {
2323    return ($(this).isWebform() || $(this).closest('[data-is-webform-element]').length) ? true : false;
2324  };
2325
2326  /* ************************************************************************ */
2327  // Trigger.
2328  /* ************************************************************************ */
2329
2330  // The change event is triggered by cut-n-paste and select menus.
2331  // Issue #2445271: #states element empty check not triggered on mouse
2332  // based paste.
2333  // @see https://www.drupal.org/node/2445271
2334  Drupal.states.Trigger.states.empty.change = function change() {
2335    return this.val() === '';
2336  };
2337
2338  /* ************************************************************************ */
2339  // Dependents.
2340  /* ************************************************************************ */
2341
2342
2343  // Apply solution included in #1962800 patch.
2344  // Issue #1962800: Form #states not working with literal integers as
2345  // values in IE11.
2346  // @see https://www.drupal.org/project/drupal/issues/1962800
2347  // @see https://www.drupal.org/files/issues/core-states-not-working-with-integers-ie11_1962800_46.patch
2348  //
2349  // This issue causes pattern, less than, and greater than support to break.
2350  // @see https://www.drupal.org/project/webform/issues/2981724
2351  var states = Drupal.states;
2352  Drupal.states.Dependent.prototype.compare = function compare(reference, selector, state) {
2353    var value = this.values[selector][state.name];
2354
2355    var name = reference.constructor.name;
2356    if (!name) {
2357      name = $.type(reference);
2358
2359      name = name.charAt(0).toUpperCase() + name.slice(1);
2360    }
2361    if (name in states.Dependent.comparisons) {
2362      return states.Dependent.comparisons[name](reference, value);
2363    }
2364
2365    if (reference.constructor.name in states.Dependent.comparisons) {
2366      return states.Dependent.comparisons[reference.constructor.name](reference, value);
2367    }
2368
2369    return _compare2(reference, value);
2370  };
2371  function _compare2(a, b) {
2372    if (a === b) {
2373      return typeof a === 'undefined' ? a : true;
2374    }
2375
2376    return typeof a === 'undefined' || typeof b === 'undefined';
2377  }
2378
2379  // Adds pattern, less than, and greater than support to #state API.
2380  // @see http://drupalsun.com/julia-evans/2012/03/09/extending-form-api-states-regular-expressions
2381  Drupal.states.Dependent.comparisons.Object = function (reference, value) {
2382    if ('pattern' in reference) {
2383      return (new RegExp(reference['pattern'])).test(value);
2384    }
2385    else if ('!pattern' in reference) {
2386      return !((new RegExp(reference['!pattern'])).test(value));
2387    }
2388    else if ('less' in reference) {
2389      return (value !== '' && parseFloat(reference['less']) > parseFloat(value));
2390    }
2391    else if ('less_equal' in reference) {
2392      return (value !== '' && parseFloat(reference['less_equal']) >= parseFloat(value));
2393    }
2394    else if ('greater' in reference) {
2395      return (value !== '' && parseFloat(reference['greater']) < parseFloat(value));
2396    }
2397    else if ('greater_equal' in reference) {
2398      return (value !== '' && parseFloat(reference['greater_equal']) <= parseFloat(value));
2399    }
2400    else if ('between' in reference || '!between' in reference) {
2401      if (value === '') {
2402        return false;
2403      }
2404
2405      var between = reference['between'] || reference['!between'];
2406      var betweenParts = between.split(':');
2407      var greater = betweenParts[0];
2408      var less = (typeof betweenParts[1] !== 'undefined') ? betweenParts[1] : null;
2409      var isGreaterThan = (greater === null || greater === '' || parseFloat(value) >= parseFloat(greater));
2410      var isLessThan = (less === null || less === '' || parseFloat(value) <= parseFloat(less));
2411      var result = (isGreaterThan && isLessThan);
2412      return (reference['!between']) ? !result : result;
2413    }
2414    else {
2415      return reference.indexOf(value) !== false;
2416    }
2417  };
2418
2419  /* ************************************************************************ */
2420  // States events.
2421  /* ************************************************************************ */
2422
2423  var $document = $(document);
2424
2425  $document.on('state:required', function (e) {
2426    if (e.trigger && $(e.target).isWebformElement()) {
2427      var $target = $(e.target);
2428      // Fix #required file upload.
2429      // @see Issue #2860529: Conditional required File upload field don't work.
2430      toggleRequired($target.find('input[type="file"]'), e.value);
2431
2432      // Fix #required for radios.
2433      // @see Issue #2856795: If radio buttons are required but not filled form is nevertheless submitted.
2434      if ($target.is('.js-form-type-radios, .js-form-type-webform-radios-other, .js-webform-type-radios, .js-webform-type-webform-radios-other')) {
2435        toggleRequired($target.find('input[type="radio"]'), e.value);
2436      }
2437
2438      // Fix #required for checkboxes.
2439      // @see Issue #2938414: Checkboxes don't support #states required.
2440      // @see checkboxRequiredhandler
2441      if ($target.is('.js-form-type-checkboxes, .js-form-type-webform-checkboxes-other, .js-webform-type-checkboxes, .js-webform-type-webform-checkboxes-other')) {
2442        var $checkboxes = $target.find('input[type="checkbox"]');
2443        if (e.value) {
2444          // Add event handler.
2445          $checkboxes.on('click', statesCheckboxesRequiredEventHandler);
2446          // Initialize and add required attribute.
2447          checkboxesRequired($target);
2448        }
2449        else {
2450          // Remove event handler.
2451          $checkboxes.off('click', statesCheckboxesRequiredEventHandler);
2452          // Remove required attribute.
2453          toggleRequired($checkboxes, false);
2454        }
2455      }
2456
2457      // Fix required label for elements without the for attribute.
2458      // @see Issue #3145300: Conditional Visible Select Other not working.
2459      if ($target.is('.js-form-type-webform-select-other, .js-webform-type-webform-select-other')) {
2460        var $select = $target.find('select');
2461        toggleRequired($select, e.value);
2462        copyRequireMessage($target, $select);
2463      }
2464      if ($target.find('> label:not([for])').length) {
2465        $target.find('> label').toggleClass('js-form-required form-required', e.value);
2466      }
2467
2468      // Fix required label for checkboxes and radios.
2469      // @see Issue #2938414: Checkboxes don't support #states required
2470      // @see Issue #2731991: Setting required on radios marks all options required.
2471      // @see Issue #2856315: Conditional Logic - Requiring Radios in a Fieldset.
2472      // Fix #required for fieldsets.
2473      // @see Issue #2977569: Hidden fieldsets that become visible with conditional logic cannot be made required.
2474      if ($target.is('.js-webform-type-radios, .js-webform-type-checkboxes, fieldset')) {
2475        $target.find('legend span.fieldset-legend:not(.visually-hidden)').toggleClass('js-form-required form-required', e.value);
2476      }
2477
2478      // Issue #2986017: Fieldsets shouldn't have required attribute.
2479      if ($target.is('fieldset')) {
2480        $target.removeAttr('required aria-required');
2481      }
2482    }
2483  });
2484
2485  $document.on('state:checked', function (e) {
2486    if (e.trigger) {
2487      $(e.target).trigger('change');
2488    }
2489  });
2490
2491  $document.on('state:readonly', function (e) {
2492    if (e.trigger && $(e.target).isWebformElement()) {
2493      $(e.target).prop('readonly', e.value).closest('.js-form-item, .js-form-wrapper').toggleClass('webform-readonly', e.value).find('input, textarea').prop('readonly', e.value);
2494
2495      // Trigger webform:readonly.
2496      $(e.target).trigger('webform:readonly')
2497        .find('select, input, textarea, button').trigger('webform:readonly');
2498    }
2499  });
2500
2501  $document.on('state:visible state:visible-slide', function (e) {
2502    if (e.trigger && $(e.target).isWebformElement()) {
2503      if (e.value) {
2504        $(':input', e.target).addBack().each(function () {
2505          restoreValueAndRequired(this);
2506          triggerEventHandlers(this);
2507        });
2508      }
2509      else {
2510        // @see https://www.sitepoint.com/jquery-function-clear-form-data/
2511        $(':input', e.target).addBack().each(function () {
2512          backupValueAndRequired(this);
2513          clearValueAndRequired(this);
2514          triggerEventHandlers(this);
2515        });
2516      }
2517    }
2518  });
2519
2520  $document.on('state:visible-slide', function (e) {
2521    if (e.trigger && $(e.target).isWebformElement()) {
2522      var effect = e.value ? 'slideDown' : 'slideUp';
2523      var duration = Drupal.webform.states[effect].duration;
2524      $(e.target).closest('.js-form-item, .js-form-submit, .js-form-wrapper')[effect](duration);
2525    }
2526  });
2527  Drupal.states.State.aliases['invisible-slide'] = '!visible-slide';
2528
2529  $document.on('state:disabled', function (e) {
2530    if (e.trigger && $(e.target).isWebformElement()) {
2531      // Make sure disabled property is set before triggering webform:disabled.
2532      // Copied from: core/misc/states.js
2533      $(e.target)
2534        .prop('disabled', e.value)
2535        .closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggleClass('form-disabled', e.value)
2536        .find('select, input, textarea, button').prop('disabled', e.value);
2537
2538      // Never disable hidden file[fids] because the existing values will
2539      // be completely lost when the webform is submitted.
2540      var fileElements = $(e.target)
2541        .find(':input[type="hidden"][name$="[fids]"]');
2542      if (fileElements.length) {
2543        // Remove 'disabled' attribute from fieldset which will block
2544        // all disabled elements from being submitted.
2545        if ($(e.target).is('fieldset')) {
2546          $(e.target).prop('disabled', false);
2547        }
2548        fileElements.removeAttr('disabled');
2549      }
2550
2551      // Trigger webform:disabled.
2552      $(e.target).trigger('webform:disabled')
2553        .find('select, input, textarea, button').trigger('webform:disabled');
2554    }
2555  });
2556
2557  /* ************************************************************************ */
2558  // Behaviors.
2559  /* ************************************************************************ */
2560
2561  /**
2562   * Adds HTML5 validation to required checkboxes.
2563   *
2564   * @type {Drupal~behavior}
2565   *
2566   * @see https://www.drupal.org/project/webform/issues/3068998
2567   */
2568  Drupal.behaviors.webformCheckboxesRequired = {
2569    attach: function (context) {
2570      $('.js-form-type-checkboxes.required, .js-form-type-webform-checkboxes-other.required, .js-webform-type-checkboxes.required, .js-webform-type-webform-checkboxes-other.required, .js-webform-type-webform-radios-other.checkboxes', context)
2571        .once('webform-checkboxes-required')
2572        .each(function () {
2573          var $element = $(this);
2574          $element.find('input[type="checkbox"]').on('click', statesCheckboxesRequiredEventHandler);
2575          setTimeout(function () {checkboxesRequired($element);});
2576        });
2577    }
2578  };
2579
2580  /**
2581   * Adds HTML5 validation to required radios.
2582   *
2583   * @type {Drupal~behavior}
2584   *
2585   * @see https://www.drupal.org/project/webform/issues/2856795
2586   */
2587  Drupal.behaviors.webformRadiosRequired = {
2588    attach: function (context) {
2589      $('.js-form-type-radios, .js-form-type-webform-radios-other, .js-webform-type-radios, .js-webform-type-webform-radios-other', context)
2590        .once('webform-radios-required')
2591        .each(function () {
2592          var $element = $(this);
2593          setTimeout(function () {radiosRequired($element);});
2594        });
2595    }
2596  };
2597
2598  /**
2599   * Add HTML5 multiple checkboxes required validation.
2600   *
2601   * @param {jQuery} $element
2602   *   An jQuery object containing HTML5 radios.
2603   *
2604   * @see https://stackoverflow.com/a/37825072/145846
2605   */
2606  function checkboxesRequired($element) {
2607    var $firstCheckbox = $element.find('input[type="checkbox"]').first();
2608    var isChecked = $element.find('input[type="checkbox"]').is(':checked');
2609    toggleRequired($firstCheckbox, !isChecked);
2610    copyRequireMessage($element, $firstCheckbox);
2611  }
2612
2613  /**
2614   * Add HTML5 radios required validation.
2615   *
2616   * @param {jQuery} $element
2617   *   An jQuery object containing HTML5 radios.
2618   *
2619   * @see https://www.drupal.org/project/webform/issues/2856795
2620   */
2621  function radiosRequired($element) {
2622    var $radios = $element.find('input[type="radio"]');
2623    var isRequired = $element.hasClass('required');
2624    toggleRequired($radios, isRequired);
2625    copyRequireMessage($element, $radios);
2626  }
2627
2628  /* ************************************************************************ */
2629  // Event handlers.
2630  /* ************************************************************************ */
2631
2632  /**
2633   * Trigger #states API HTML5 multiple checkboxes required validation.
2634   *
2635   * @see https://stackoverflow.com/a/37825072/145846
2636   */
2637  function statesCheckboxesRequiredEventHandler() {
2638    var $element = $(this).closest('.js-webform-type-checkboxes, .js-webform-type-webform-checkboxes-other');
2639    checkboxesRequired($element);
2640  }
2641
2642  /**
2643   * Trigger an input's event handlers.
2644   *
2645   * @param {element} input
2646   *   An input.
2647   */
2648  function triggerEventHandlers(input) {
2649    var $input = $(input);
2650    var type = input.type;
2651    var tag = input.tagName.toLowerCase();
2652    // Add 'webform.states' as extra parameter to event handlers.
2653    // @see Drupal.behaviors.webformUnsaved
2654    var extraParameters = ['webform.states'];
2655    if (type === 'checkbox' || type === 'radio') {
2656      $input
2657        .trigger('change', extraParameters)
2658        .trigger('blur', extraParameters);
2659    }
2660    else if (tag === 'select') {
2661      $input
2662        .trigger('change', extraParameters)
2663        .trigger('blur', extraParameters);
2664    }
2665    else if (type !== 'submit' && type !== 'button' && type !== 'file') {
2666      $input
2667        .trigger('input', extraParameters)
2668        .trigger('change', extraParameters)
2669        .trigger('keydown', extraParameters)
2670        .trigger('keyup', extraParameters)
2671        .trigger('blur', extraParameters);
2672
2673      // Make sure input mask is reset when value is restored.
2674      // @see https://www.drupal.org/project/webform/issues/3124155
2675      if ($input.attr('data-inputmask-mask')) {
2676        setTimeout(function () {$input.inputmask('remove').inputmask();});
2677      }
2678    }
2679  }
2680
2681  /* ************************************************************************ */
2682  // Backup and restore value functions.
2683  /* ************************************************************************ */
2684
2685  /**
2686   * Backup an input's current value and required attribute
2687   *
2688   * @param {element} input
2689   *   An input.
2690   */
2691  function backupValueAndRequired(input) {
2692    var $input = $(input);
2693    var type = input.type;
2694    var tag = input.tagName.toLowerCase(); // Normalize case.
2695
2696    // Backup required.
2697    if ($input.prop('required') && !$input.hasData('webform-required')) {
2698      $input.data('webform-required', true);
2699    }
2700
2701    // Backup value.
2702    if (!$input.hasData('webform-value')) {
2703      if (type === 'checkbox' || type === 'radio') {
2704        $input.data('webform-value', $input.prop('checked'));
2705      }
2706      else if (tag === 'select') {
2707        var values = [];
2708        $input.find('option:selected').each(function (i, option) {
2709          values[i] = option.value;
2710        });
2711        $input.data('webform-value', values);
2712      }
2713      else if (type !== 'submit' && type !== 'button') {
2714        $input.data('webform-value', input.value);
2715      }
2716    }
2717  }
2718
2719  /**
2720   * Restore an input's value and required attribute.
2721   *
2722   * @param {element} input
2723   *   An input.
2724   */
2725  function restoreValueAndRequired(input) {
2726    var $input = $(input);
2727
2728    // Restore value.
2729    var value = $input.data('webform-value');
2730    if (typeof value !== 'undefined') {
2731      var type = input.type;
2732      var tag = input.tagName.toLowerCase(); // Normalize case.
2733
2734      if (type === 'checkbox' || type === 'radio') {
2735        $input.prop('checked', value);
2736      }
2737      else if (tag === 'select') {
2738        $.each(value, function (i, option_value) {
2739          $input.find("option[value='" + option_value + "']").prop('selected', true);
2740        });
2741      }
2742      else if (type !== 'submit' && type !== 'button') {
2743        input.value = value;
2744      }
2745      $input.removeData('webform-value');
2746    }
2747
2748    // Restore required.
2749    var required = $input.data('webform-required');
2750    if (typeof required !== 'undefined') {
2751      if (required) {
2752        $input.prop('required', true);
2753      }
2754      $input.removeData('webform-required');
2755    }
2756  }
2757
2758  /**
2759   * Clear an input's value and required attributes.
2760   *
2761   * @param {element} input
2762   *   An input.
2763   */
2764  function clearValueAndRequired(input) {
2765    var $input = $(input);
2766
2767    // Check for #states no clear attribute.
2768    // @see https://css-tricks.com/snippets/jquery/make-an-jquery-hasattr/
2769    if ($input.closest('[data-webform-states-no-clear]').length) {
2770      return;
2771    }
2772
2773    // Clear value.
2774    var type = input.type;
2775    var tag = input.tagName.toLowerCase(); // Normalize case.
2776    if (type === 'checkbox' || type === 'radio') {
2777      $input.prop('checked', false);
2778    }
2779    else if (tag === 'select') {
2780      if ($input.find('option[value=""]').length) {
2781        $input.val('');
2782      }
2783      else {
2784        input.selectedIndex = -1;
2785      }
2786    }
2787    else if (type !== 'submit' && type !== 'button') {
2788      input.value = (type === 'color') ? '#000000' : '';
2789    }
2790
2791    // Clear required.
2792    $input.prop('required', false);
2793  }
2794
2795  /* ************************************************************************ */
2796  // Helper functions.
2797  /* ************************************************************************ */
2798
2799  /**
2800   * Toggle an input's required attributes.
2801   *
2802   * @param {element} $input
2803   *   An input.
2804   * @param {boolean} required
2805   *   Is input required.
2806   */
2807  function toggleRequired($input, required) {
2808    if (required) {
2809      $input.attr({'required': 'required', 'aria-required': 'true'});
2810    }
2811    else {
2812      $input.removeAttr('required aria-required');
2813    }
2814  }
2815
2816  /**
2817   * Copy the clientside_validation.module's message.
2818   *
2819   * @param {jQuery} $source
2820   *   The source element.
2821   * @param {jQuery} $destination
2822   *   The destination element.
2823   */
2824  function copyRequireMessage($source, $destination) {
2825    if ($source.attr('data-msg-required')) {
2826      $destination.attr('data-msg-required', $source.attr('data-msg-required'));
2827    }
2828  }
2829
2830})(jQuery, Drupal);
2831;
2832/**
2833 * @file
2834 * JavaScript behaviors for webforms.
2835 */
2836
2837(function ($, Drupal) {
2838
2839  'use strict';
2840
2841  /**
2842   * Remove single submit event listener.
2843   *
2844   * @type {Drupal~behavior}
2845   *
2846   * @prop {Drupal~behaviorAttach} attach
2847   *   Attaches the behavior for removing single submit event listener.
2848   *
2849   * @see Drupal.behaviors.formSingleSubmit
2850   */
2851  Drupal.behaviors.webformRemoveFormSingleSubmit = {
2852    attach: function attach() {
2853      function onFormSubmit(e) {
2854        var $form = $(e.currentTarget);
2855        $form.removeAttr('data-drupal-form-submit-last');
2856      }
2857      $('body')
2858        .once('webform-single-submit')
2859        .on('submit.singleSubmit', 'form.webform-remove-single-submit', onFormSubmit);
2860    }
2861  };
2862
2863  /**
2864   * Prevent webform autosubmit on wizard pages.
2865   *
2866   * @type {Drupal~behavior}
2867   *
2868   * @prop {Drupal~behaviorAttach} attach
2869   *   Attaches the behavior for disabling webform autosubmit.
2870   *   Wizard pages need to be progressed with the Previous or Next buttons,
2871   *   not by pressing Enter.
2872   */
2873  Drupal.behaviors.webformDisableAutoSubmit = {
2874    attach: function (context) {
2875      // Not using context so that inputs loaded via Ajax will have autosubmit
2876      // disabled.
2877      // @see http://stackoverflow.com/questions/11235622/jquery-disable-form-submit-on-enter
2878      $('.js-webform-disable-autosubmit input')
2879        .not(':button, :submit, :reset, :image, :file')
2880        .once('webform-disable-autosubmit')
2881        .on('keyup keypress', function (e) {
2882          if (e.which === 13) {
2883            e.preventDefault();
2884            return false;
2885          }
2886        });
2887    }
2888  };
2889
2890  /**
2891   * Skip client-side validation when submit button is pressed.
2892   *
2893   * @type {Drupal~behavior}
2894   *
2895   * @prop {Drupal~behaviorAttach} attach
2896   *   Attaches the behavior for the skipping client-side validation.
2897   *
2898   * @deprecated in Webform 8.x-5.x and will be removed in Webform 8.x-6.x.
2899   *   Use 'formnovalidate' attribute instead.
2900   */
2901  Drupal.behaviors.webformSubmitNoValidate = {
2902    attach: function (context) {
2903      $(context).find(':submit.js-webform-novalidate')
2904        .once('webform-novalidate')
2905        .attr('formnovalidate', 'formnovalidate');
2906    }
2907  };
2908
2909  /**
2910   * Custom required and pattern validation error messages.
2911   *
2912   * @type {Drupal~behavior}
2913   *
2914   * @prop {Drupal~behaviorAttach} attach
2915   *   Attaches the behavior for the webform custom required and pattern
2916   *   validation error messages.
2917   *
2918   * @see http://stackoverflow.com/questions/5272433/html5-form-required-attribute-set-custom-validation-message
2919   **/
2920  Drupal.behaviors.webformRequiredError = {
2921    attach: function (context) {
2922      $(context).find(':input[data-webform-required-error], :input[data-webform-pattern-error]').once('webform-required-error')
2923        .on('invalid', function () {
2924          this.setCustomValidity('');
2925          if (this.valid) {
2926            return;
2927          }
2928
2929          if (this.validity.patternMismatch && $(this).attr('data-webform-pattern-error')) {
2930            this.setCustomValidity($(this).attr('data-webform-pattern-error'));
2931          }
2932          else if (this.validity.valueMissing && $(this).attr('data-webform-required-error')) {
2933            this.setCustomValidity($(this).attr('data-webform-required-error'));
2934          }
2935        })
2936        .on('input change', function () {
2937          // Find all related elements by name and reset custom validity.
2938          // This specifically applies to required radios and checkboxes.
2939          var name = $(this).attr('name');
2940          $(this.form).find(':input[name="' + name + '"]').each(function () {
2941            this.setCustomValidity('');
2942          });
2943        });
2944    }
2945  };
2946
2947  // When #state:required is triggered we need to reset the target elements
2948  // custom validity.
2949  $(document).on('state:required', function (e) {
2950    $(e.target).filter('[data-webform-required-error]')
2951      .each(function () {this.setCustomValidity('');});
2952  });
2953
2954})(jQuery, Drupal);
2955;
2956/**
2957* DO NOT EDIT THIS FILE.
2958* See the following change record for more information,
2959* https://www.drupal.org/node/2815083
2960* @preserve
2961**/
2962
2963(function ($, Drupal) {
2964  Drupal.theme.progressBar = function (id) {
2965    return '<div id="' + id + '" class="progress" aria-live="polite">' + '<div class="progress__label">&nbsp;</div>' + '<div class="progress__track"><div class="progress__bar"></div></div>' + '<div class="progress__percentage"></div>' + '<div class="progress__description">&nbsp;</div>' + '</div>';
2966  };
2967
2968  Drupal.ProgressBar = function (id, updateCallback, method, errorCallback) {
2969    this.id = id;
2970    this.method = method || 'GET';
2971    this.updateCallback = updateCallback;
2972    this.errorCallback = errorCallback;
2973
2974    this.element = $(Drupal.theme('progressBar', id));
2975  };
2976
2977  $.extend(Drupal.ProgressBar.prototype, {
2978    setProgress: function setProgress(percentage, message, label) {
2979      if (percentage >= 0 && percentage <= 100) {
2980        $(this.element).find('div.progress__bar').css('width', percentage + '%');
2981        $(this.element).find('div.progress__percentage').html(percentage + '%');
2982      }
2983      $('div.progress__description', this.element).html(message);
2984      $('div.progress__label', this.element).html(label);
2985      if (this.updateCallback) {
2986        this.updateCallback(percentage, message, this);
2987      }
2988    },
2989    startMonitoring: function startMonitoring(uri, delay) {
2990      this.delay = delay;
2991      this.uri = uri;
2992      this.sendPing();
2993    },
2994    stopMonitoring: function stopMonitoring() {
2995      clearTimeout(this.timer);
2996
2997      this.uri = null;
2998    },
2999    sendPing: function sendPing() {
3000      if (this.timer) {
3001        clearTimeout(this.timer);
3002      }
3003      if (this.uri) {
3004        var pb = this;
3005
3006        var uri = this.uri;
3007        if (uri.indexOf('?') === -1) {
3008          uri += '?';
3009        } else {
3010          uri += '&';
3011        }
3012        uri += '_format=json';
3013        $.ajax({
3014          type: this.method,
3015          url: uri,
3016          data: '',
3017          dataType: 'json',
3018          success: function success(progress) {
3019            if (progress.status === 0) {
3020              pb.displayError(progress.data);
3021              return;
3022            }
3023
3024            pb.setProgress(progress.percentage, progress.message, progress.label);
3025
3026            pb.timer = setTimeout(function () {
3027              pb.sendPing();
3028            }, pb.delay);
3029          },
3030          error: function error(xmlhttp) {
3031            var e = new Drupal.AjaxError(xmlhttp, pb.uri);
3032            pb.displayError('<pre>' + e.message + '</pre>');
3033          }
3034        });
3035      }
3036    },
3037    displayError: function displayError(string) {
3038      var error = $('<div class="messages messages--error"></div>').html(string);
3039      $(this.element).before(error).hide();
3040
3041      if (this.errorCallback) {
3042        this.errorCallback(this);
3043      }
3044    }
3045  });
3046})(jQuery, Drupal);;
3047/**
3048* DO NOT EDIT THIS FILE.
3049* See the following change record for more information,
3050* https://www.drupal.org/node/2815083
3051* @preserve
3052**/
3053
3054(function (Drupal) {
3055  Drupal.behaviors.responsiveImageAJAX = {
3056    attach: function attach() {
3057      if (window.picturefill) {
3058        window.picturefill();
3059      }
3060    }
3061  };
3062})(Drupal);;
3063/**
3064* DO NOT EDIT THIS FILE.
3065* See the following change record for more information,
3066* https://www.drupal.org/node/2815083
3067* @preserve
3068**/
3069function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
3070
3071(function ($, window, Drupal, drupalSettings) {
3072  Drupal.behaviors.AJAX = {
3073    attach: function attach(context, settings) {
3074      function loadAjaxBehavior(base) {
3075        var elementSettings = settings.ajax[base];
3076        if (typeof elementSettings.selector === 'undefined') {
3077          elementSettings.selector = '#' + base;
3078        }
3079        $(elementSettings.selector).once('drupal-ajax').each(function () {
3080          elementSettings.element = this;
3081          elementSettings.base = base;
3082          Drupal.ajax(elementSettings);
3083        });
3084      }
3085
3086      Object.keys(settings.ajax || {}).forEach(function (base) {
3087        return loadAjaxBehavior(base);
3088      });
3089
3090      Drupal.ajax.bindAjaxLinks(document.body);
3091
3092      $('.use-ajax-submit').once('ajax').each(function () {
3093        var elementSettings = {};
3094
3095        elementSettings.url = $(this.form).attr('action');
3096
3097        elementSettings.setClick = true;
3098
3099        elementSettings.event = 'click';
3100
3101        elementSettings.progress = { type: 'throbber' };
3102        elementSettings.base = $(this).attr('id');
3103        elementSettings.element = this;
3104
3105        Drupal.ajax(elementSettings);
3106      });
3107    },
3108    detach: function detach(context, settings, trigger) {
3109      if (trigger === 'unload') {
3110        Drupal.ajax.expired().forEach(function (instance) {
3111          Drupal.ajax.instances[instance.instanceIndex] = null;
3112        });
3113      }
3114    }
3115  };
3116
3117  Drupal.AjaxError = function (xmlhttp, uri, customMessage) {
3118    var statusCode = void 0;
3119    var statusText = void 0;
3120    var responseText = void 0;
3121    if (xmlhttp.status) {
3122      statusCode = '\n' + Drupal.t('An AJAX HTTP error occurred.') + '\n' + Drupal.t('HTTP Result Code: !status', {
3123        '!status': xmlhttp.status
3124      });
3125    } else {
3126      statusCode = '\n' + Drupal.t('An AJAX HTTP request terminated abnormally.');
3127    }
3128    statusCode += '\n' + Drupal.t('Debugging information follows.');
3129    var pathText = '\n' + Drupal.t('Path: !uri', { '!uri': uri });
3130    statusText = '';
3131
3132    try {
3133      statusText = '\n' + Drupal.t('StatusText: !statusText', {
3134        '!statusText': $.trim(xmlhttp.statusText)
3135      });
3136    } catch (e) {}
3137
3138    responseText = '';
3139
3140    try {
3141      responseText = '\n' + Drupal.t('ResponseText: !responseText', {
3142        '!responseText': $.trim(xmlhttp.responseText)
3143      });
3144    } catch (e) {}
3145
3146    responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, '');
3147    responseText = responseText.replace(/[\n]+\s+/g, '\n');
3148
3149    var readyStateText = xmlhttp.status === 0 ? '\n' + Drupal.t('ReadyState: !readyState', {
3150      '!readyState': xmlhttp.readyState
3151    }) : '';
3152
3153    customMessage = customMessage ? '\n' + Drupal.t('CustomMessage: !customMessage', {
3154      '!customMessage': customMessage
3155    }) : '';
3156
3157    this.message = statusCode + pathText + statusText + customMessage + responseText + readyStateText;
3158
3159    this.name = 'AjaxError';
3160  };
3161
3162  Drupal.AjaxError.prototype = new Error();
3163  Drupal.AjaxError.prototype.constructor = Drupal.AjaxError;
3164
3165  Drupal.ajax = function (settings) {
3166    if (arguments.length !== 1) {
3167      throw new Error('Drupal.ajax() function must be called with one configuration object only');
3168    }
3169
3170    var base = settings.base || false;
3171    var element = settings.element || false;
3172    delete settings.base;
3173    delete settings.element;
3174
3175    if (!settings.progress && !element) {
3176      settings.progress = false;
3177    }
3178
3179    var ajax = new Drupal.Ajax(base, element, settings);
3180    ajax.instanceIndex = Drupal.ajax.instances.length;
3181    Drupal.ajax.instances.push(ajax);
3182
3183    return ajax;
3184  };
3185
3186  Drupal.ajax.instances = [];
3187
3188  Drupal.ajax.expired = function () {
3189    return Drupal.ajax.instances.filter(function (instance) {
3190      return instance && instance.element !== false && !document.body.contains(instance.element);
3191    });
3192  };
3193
3194  Drupal.ajax.bindAjaxLinks = function (element) {
3195    $(element).find('.use-ajax').once('ajax').each(function (i, ajaxLink) {
3196      var $linkElement = $(ajaxLink);
3197
3198      var elementSettings = {
3199        progress: { type: 'throbber' },
3200        dialogType: $linkElement.data('dialog-type'),
3201        dialog: $linkElement.data('dialog-options'),
3202        dialogRenderer: $linkElement.data('dialog-renderer'),
3203        base: $linkElement.attr('id'),
3204        element: ajaxLink
3205      };
3206      var href = $linkElement.attr('href');
3207
3208      if (href) {
3209        elementSettings.url = href;
3210        elementSettings.event = 'click';
3211      }
3212      Drupal.ajax(elementSettings);
3213    });
3214  };
3215
3216  Drupal.Ajax = function (base, element, elementSettings) {
3217    var defaults = {
3218      event: element ? 'mousedown' : null,
3219      keypress: true,
3220      selector: base ? '#' + base : null,
3221      effect: 'none',
3222      speed: 'none',
3223      method: 'replaceWith',
3224      progress: {
3225        type: 'throbber',
3226        message: Drupal.t('Please wait...')
3227      },
3228      submit: {
3229        js: true
3230      }
3231    };
3232
3233    $.extend(this, defaults, elementSettings);
3234
3235    this.commands = new Drupal.AjaxCommands();
3236
3237    this.instanceIndex = false;
3238
3239    if (this.wrapper) {
3240      this.wrapper = '#' + this.wrapper;
3241    }
3242
3243    this.element = element;
3244
3245    this.element_settings = elementSettings;
3246
3247    this.elementSettings = elementSettings;
3248
3249    if (this.element && this.element.form) {
3250      this.$form = $(this.element.form);
3251    }
3252
3253    if (!this.url) {
3254      var $element = $(this.element);
3255      if ($element.is('a')) {
3256        this.url = $element.attr('href');
3257      } else if (this.element && element.form) {
3258        this.url = this.$form.attr('action');
3259      }
3260    }
3261
3262    var originalUrl = this.url;
3263
3264    this.url = this.url.replace(/\/nojs(\/|$|\?|#)/, '/ajax$1');
3265
3266    if (drupalSettings.ajaxTrustedUrl[originalUrl]) {
3267      drupalSettings.ajaxTrustedUrl[this.url] = true;
3268    }
3269
3270    var ajax = this;
3271
3272    ajax.options = {
3273      url: ajax.url,
3274      data: ajax.submit,
3275      beforeSerialize: function beforeSerialize(elementSettings, options) {
3276        return ajax.beforeSerialize(elementSettings, options);
3277      },
3278      beforeSubmit: function beforeSubmit(formValues, elementSettings, options) {
3279        ajax.ajaxing = true;
3280        return ajax.beforeSubmit(formValues, elementSettings, options);
3281      },
3282      beforeSend: function beforeSend(xmlhttprequest, options) {
3283        ajax.ajaxing = true;
3284        return ajax.beforeSend(xmlhttprequest, options);
3285      },
3286      success: function success(response, status, xmlhttprequest) {
3287        if (typeof response === 'string') {
3288          response = $.parseJSON(response);
3289        }
3290
3291        if (response !== null && !drupalSettings.ajaxTrustedUrl[ajax.url]) {
3292          if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') {
3293            var customMessage = Drupal.t('The response failed verification so will not be processed.');
3294            return ajax.error(xmlhttprequest, ajax.url, customMessage);
3295          }
3296        }
3297
3298        return ajax.success(response, status);
3299      },
3300      complete: function complete(xmlhttprequest, status) {
3301        ajax.ajaxing = false;
3302        if (status === 'error' || status === 'parsererror') {
3303          return ajax.error(xmlhttprequest, ajax.url);
3304        }
3305      },
3306
3307      dataType: 'json',
3308      jsonp: false,
3309      type: 'POST'
3310    };
3311
3312    if (elementSettings.dialog) {
3313      ajax.options.data.dialogOptions = elementSettings.dialog;
3314    }
3315
3316    if (ajax.options.url.indexOf('?') === -1) {
3317      ajax.options.url += '?';
3318    } else {
3319      ajax.options.url += '&';
3320    }
3321
3322    var wrapper = 'drupal_' + (elementSettings.dialogType || 'ajax');
3323    if (elementSettings.dialogRenderer) {
3324      wrapper += '.' + elementSettings.dialogRenderer;
3325    }
3326    ajax.options.url += Drupal.ajax.WRAPPER_FORMAT + '=' + wrapper;
3327
3328    $(ajax.element).on(elementSettings.event, function (event) {
3329      if (!drupalSettings.ajaxTrustedUrl[ajax.url] && !Drupal.url.isLocal(ajax.url)) {
3330        throw new Error(Drupal.t('The callback URL is not local and not trusted: !url', {
3331          '!url': ajax.url
3332        }));
3333      }
3334      return ajax.eventResponse(this, event);
3335    });
3336
3337    if (elementSettings.keypress) {
3338      $(ajax.element).on('keypress', function (event) {
3339        return ajax.keypressResponse(this, event);
3340      });
3341    }
3342
3343    if (elementSettings.prevent) {
3344      $(ajax.element).on(elementSettings.prevent, false);
3345    }
3346  };
3347
3348  Drupal.ajax.WRAPPER_FORMAT = '_wrapper_format';
3349
3350  Drupal.Ajax.AJAX_REQUEST_PARAMETER = '_drupal_ajax';
3351
3352  Drupal.Ajax.prototype.execute = function () {
3353    if (this.ajaxing) {
3354      return;
3355    }
3356
3357    try {
3358      this.beforeSerialize(this.element, this.options);
3359
3360      return $.ajax(this.options);
3361    } catch (e) {
3362      this.ajaxing = false;
3363      window.alert('An error occurred while attempting to process ' + this.options.url + ': ' + e.message);
3364
3365      return $.Deferred().reject();
3366    }
3367  };
3368
3369  Drupal.Ajax.prototype.keypressResponse = function (element, event) {
3370    var ajax = this;
3371
3372    if (event.which === 13 || event.which === 32 && element.type !== 'text' && element.type !== 'textarea' && element.type !== 'tel' && element.type !== 'number') {
3373      event.preventDefault();
3374      event.stopPropagation();
3375      $(element).trigger(ajax.elementSettings.event);
3376    }
3377  };
3378
3379  Drupal.Ajax.prototype.eventResponse = function (element, event) {
3380    event.preventDefault();
3381    event.stopPropagation();
3382
3383    var ajax = this;
3384
3385    if (ajax.ajaxing) {
3386      return;
3387    }
3388
3389    try {
3390      if (ajax.$form) {
3391        if (ajax.setClick) {
3392          element.form.clk = element;
3393        }
3394
3395        ajax.$form.ajaxSubmit(ajax.options);
3396      } else {
3397        ajax.beforeSerialize(ajax.element, ajax.options);
3398        $.ajax(ajax.options);
3399      }
3400    } catch (e) {
3401      ajax.ajaxing = false;
3402      window.alert('An error occurred while attempting to process ' + ajax.options.url + ': ' + e.message);
3403    }
3404  };
3405
3406  Drupal.Ajax.prototype.beforeSerialize = function (element, options) {
3407    if (this.$form && document.body.contains(this.$form.get(0))) {
3408      var settings = this.settings || drupalSettings;
3409      Drupal.detachBehaviors(this.$form.get(0), settings, 'serialize');
3410    }
3411
3412    options.data[Drupal.Ajax.AJAX_REQUEST_PARAMETER] = 1;
3413
3414    var pageState = drupalSettings.ajaxPageState;
3415    options.data['ajax_page_state[theme]'] = pageState.theme;
3416    options.data['ajax_page_state[theme_token]'] = pageState.theme_token;
3417    options.data['ajax_page_state[libraries]'] = pageState.libraries;
3418  };
3419
3420  Drupal.Ajax.prototype.beforeSubmit = function (formValues, element, options) {};
3421
3422  Drupal.Ajax.prototype.beforeSend = function (xmlhttprequest, options) {
3423    if (this.$form) {
3424      options.extraData = options.extraData || {};
3425
3426      options.extraData.ajax_iframe_upload = '1';
3427
3428      var v = $.fieldValue(this.element);
3429      if (v !== null) {
3430        options.extraData[this.element.name] = v;
3431      }
3432    }
3433
3434    $(this.element).prop('disabled', true);
3435
3436    if (!this.progress || !this.progress.type) {
3437      return;
3438    }
3439
3440    var progressIndicatorMethod = 'setProgressIndicator' + this.progress.type.slice(0, 1).toUpperCase() + this.progress.type.slice(1).toLowerCase();
3441    if (progressIndicatorMethod in this && typeof this[progressIndicatorMethod] === 'function') {
3442      this[progressIndicatorMethod].call(this);
3443    }
3444  };
3445
3446  Drupal.theme.ajaxProgressThrobber = function (message) {
3447    var messageMarkup = typeof message === 'string' ? Drupal.theme('ajaxProgressMessage', message) : '';
3448    var throbber = '<div class="throbber">&nbsp;</div>';
3449
3450    return '<div class="ajax-progress ajax-progress-throbber">' + throbber + messageMarkup + '</div>';
3451  };
3452
3453  Drupal.theme.ajaxProgressIndicatorFullscreen = function () {
3454    return '<div class="ajax-progress ajax-progress-fullscreen">&nbsp;</div>';
3455  };
3456
3457  Drupal.theme.ajaxProgressMessage = function (message) {
3458    return '<div class="message">' + message + '</div>';
3459  };
3460
3461  Drupal.theme.ajaxProgressBar = function ($element) {
3462    return $('<div class="ajax-progress ajax-progress-bar"></div>').append($element);
3463  };
3464
3465  Drupal.Ajax.prototype.setProgressIndicatorBar = function () {
3466    var progressBar = new Drupal.ProgressBar('ajax-progress-' + this.element.id, $.noop, this.progress.method, $.noop);
3467    if (this.progress.message) {
3468      progressBar.setProgress(-1, this.progress.message);
3469    }
3470    if (this.progress.url) {
3471      progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500);
3472    }
3473    this.progress.element = $(Drupal.theme('ajaxProgressBar', progressBar.element));
3474    this.progress.object = progressBar;
3475    $(this.element).after(this.progress.element);
3476  };
3477
3478  Drupal.Ajax.prototype.setProgressIndicatorThrobber = function () {
3479    this.progress.element = $(Drupal.theme('ajaxProgressThrobber', this.progress.message));
3480    $(this.element).after(this.progress.element);
3481  };
3482
3483  Drupal.Ajax.prototype.setProgressIndicatorFullscreen = function () {
3484    this.progress.element = $(Drupal.theme('ajaxProgressIndicatorFullscreen'));
3485    $('body').append(this.progress.element);
3486  };
3487
3488  Drupal.Ajax.prototype.success = function (response, status) {
3489    var _this = this;
3490
3491    if (this.progress.element) {
3492      $(this.progress.element).remove();
3493    }
3494    if (this.progress.object) {
3495      this.progress.object.stopMonitoring();
3496    }
3497    $(this.element).prop('disabled', false);
3498
3499    var elementParents = $(this.element).parents('[data-drupal-selector]').addBack().toArray();
3500
3501    var focusChanged = false;
3502    Object.keys(response || {}).forEach(function (i) {
3503      if (response[i].command && _this.commands[response[i].command]) {
3504        _this.commands[response[i].command](_this, response[i], status);
3505        if (response[i].command === 'invoke' && response[i].method === 'focus') {
3506          focusChanged = true;
3507        }
3508      }
3509    });
3510
3511    if (!focusChanged && this.element && !$(this.element).data('disable-refocus')) {
3512      var target = false;
3513
3514      for (var n = elementParents.length - 1; !target && n >= 0; n--) {
3515        target = document.querySelector('[data-drupal-selector="' + elementParents[n].getAttribute('data-drupal-selector') + '"]');
3516      }
3517
3518      if (target) {
3519        $(target).trigger('focus');
3520      }
3521    }
3522
3523    if (this.$form && document.body.contains(this.$form.get(0))) {
3524      var settings = this.settings || drupalSettings;
3525      Drupal.attachBehaviors(this.$form.get(0), settings);
3526    }
3527
3528    this.settings = null;
3529  };
3530
3531  Drupal.Ajax.prototype.getEffect = function (response) {
3532    var type = response.effect || this.effect;
3533    var speed = response.speed || this.speed;
3534
3535    var effect = {};
3536    if (type === 'none') {
3537      effect.showEffect = 'show';
3538      effect.hideEffect = 'hide';
3539      effect.showSpeed = '';
3540    } else if (type === 'fade') {
3541      effect.showEffect = 'fadeIn';
3542      effect.hideEffect = 'fadeOut';
3543      effect.showSpeed = speed;
3544    } else {
3545      effect.showEffect = type + 'Toggle';
3546      effect.hideEffect = type + 'Toggle';
3547      effect.showSpeed = speed;
3548    }
3549
3550    return effect;
3551  };
3552
3553  Drupal.Ajax.prototype.error = function (xmlhttprequest, uri, customMessage) {
3554    if (this.progress.element) {
3555      $(this.progress.element).remove();
3556    }
3557    if (this.progress.object) {
3558      this.progress.object.stopMonitoring();
3559    }
3560
3561    $(this.wrapper).show();
3562
3563    $(this.element).prop('disabled', false);
3564
3565    if (this.$form && document.body.contains(this.$form.get(0))) {
3566      var settings = this.settings || drupalSettings;
3567      Drupal.attachBehaviors(this.$form.get(0), settings);
3568    }
3569    throw new Drupal.AjaxError(xmlhttprequest, uri, customMessage);
3570  };
3571
3572  Drupal.theme.ajaxWrapperNewContent = function ($newContent, ajax, response) {
3573    return (response.effect || ajax.effect) !== 'none' && $newContent.filter(function (i) {
3574      return !($newContent[i].nodeName === '#comment' || $newContent[i].nodeName === '#text' && /^(\s|\n|\r)*$/.test($newContent[i].textContent));
3575    }).length > 1 ? Drupal.theme('ajaxWrapperMultipleRootElements', $newContent) : $newContent;
3576  };
3577
3578  Drupal.theme.ajaxWrapperMultipleRootElements = function ($elements) {
3579    return $('<div></div>').append($elements);
3580  };
3581
3582  Drupal.AjaxCommands = function () {};
3583  Drupal.AjaxCommands.prototype = {
3584    insert: function insert(ajax, response) {
3585      var $wrapper = response.selector ? $(response.selector) : $(ajax.wrapper);
3586      var method = response.method || ajax.method;
3587      var effect = ajax.getEffect(response);
3588
3589      var settings = response.settings || ajax.settings || drupalSettings;
3590
3591      var $newContent = $($.parseHTML(response.data, document, true));
3592
3593      $newContent = Drupal.theme('ajaxWrapperNewContent', $newContent, ajax, response);
3594
3595      switch (method) {
3596        case 'html':
3597        case 'replaceWith':
3598        case 'replaceAll':
3599        case 'empty':
3600        case 'remove':
3601          Drupal.detachBehaviors($wrapper.get(0), settings);
3602          break;
3603        default:
3604          break;
3605      }
3606
3607      $wrapper[method]($newContent);
3608
3609      if (effect.showEffect !== 'show') {
3610        $newContent.hide();
3611      }
3612
3613      var $ajaxNewContent = $newContent.find('.ajax-new-content');
3614      if ($ajaxNewContent.length) {
3615        $ajaxNewContent.hide();
3616        $newContent.show();
3617        $ajaxNewContent[effect.showEffect](effect.showSpeed);
3618      } else if (effect.showEffect !== 'show') {
3619        $newContent[effect.showEffect](effect.showSpeed);
3620      }
3621
3622      if ($newContent.parents('html').length) {
3623        $newContent.each(function (index, element) {
3624          if (element.nodeType === Node.ELEMENT_NODE) {
3625            Drupal.attachBehaviors(element, settings);
3626          }
3627        });
3628      }
3629    },
3630    remove: function remove(ajax, response, status) {
3631      var settings = response.settings || ajax.settings || drupalSettings;
3632      $(response.selector).each(function () {
3633        Drupal.detachBehaviors(this, settings);
3634      }).remove();
3635    },
3636    changed: function changed(ajax, response, status) {
3637      var $element = $(response.selector);
3638      if (!$element.hasClass('ajax-changed')) {
3639        $element.addClass('ajax-changed');
3640        if (response.asterisk) {
3641          $element.find(response.asterisk).append(' <abbr class="ajax-changed" title="' + Drupal.t('Changed') + '">*</abbr> ');
3642        }
3643      }
3644    },
3645    alert: function alert(ajax, response, status) {
3646      window.alert(response.text, response.title);
3647    },
3648    announce: function announce(ajax, response) {
3649      if (response.priority) {
3650        Drupal.announce(response.text, response.priority);
3651      } else {
3652        Drupal.announce(response.text);
3653      }
3654    },
3655    redirect: function redirect(ajax, response, status) {
3656      window.location = response.url;
3657    },
3658    css: function css(ajax, response, status) {
3659      $(response.selector).css(response.argument);
3660    },
3661    settings: function settings(ajax, response, status) {
3662      var ajaxSettings = drupalSettings.ajax;
3663
3664      if (ajaxSettings) {
3665        Drupal.ajax.expired().forEach(function (instance) {
3666
3667          if (instance.selector) {
3668            var selector = instance.selector.replace('#', '');
3669            if (selector in ajaxSettings) {
3670              delete ajaxSettings[selector];
3671            }
3672          }
3673        });
3674      }
3675
3676      if (response.merge) {
3677        $.extend(true, drupalSettings, response.settings);
3678      } else {
3679        ajax.settings = response.settings;
3680      }
3681    },
3682    data: function data(ajax, response, status) {
3683      $(response.selector).data(response.name, response.value);
3684    },
3685    invoke: function invoke(ajax, response, status) {
3686      var $element = $(response.selector);
3687      $element[response.method].apply($element, _toConsumableArray(response.args));
3688    },
3689    restripe: function restripe(ajax, response, status) {
3690      $(response.selector).find('> tbody > tr:visible, > tr:visible').removeClass('odd even').filter(':even').addClass('odd').end().filter(':odd').addClass('even');
3691    },
3692    update_build_id: function update_build_id(ajax, response, status) {
3693      $('input[name="form_build_id"][value="' + response.old + '"]').val(response.new);
3694    },
3695    add_css: function add_css(ajax, response, status) {
3696      $('head').prepend(response.data);
3697    },
3698    message: function message(ajax, response) {
3699      var messages = new Drupal.Message(document.querySelector(response.messageWrapperQuerySelector));
3700      if (response.clearPrevious) {
3701        messages.clear();
3702      }
3703      messages.add(response.message, response.messageOptions);
3704    }
3705  };
3706})(jQuery, window, Drupal, drupalSettings);;
3707/**
3708* DO NOT EDIT THIS FILE.
3709* See the following change record for more information,
3710* https://www.drupal.org/node/2815083
3711* @preserve
3712**/
3713
3714(function (Drupal) {
3715  Drupal.theme.ajaxProgressBar = function ($element) {
3716    return $element.addClass('ajax-progress ajax-progress-bar');
3717  };
3718})(Drupal);;
3719/**
3720 * @file
3721 * JavaScript behaviors for preventing duplicate webform submissions.
3722 */
3723
3724(function ($, Drupal) {
3725
3726  'use strict';
3727
3728  /**
3729   * Submit once.
3730   *
3731   * @type {Drupal~behavior}
3732   *
3733   * @prop {Drupal~behaviorAttach} attach
3734   *   Attaches the behavior for preventing duplicate webform submissions.
3735   */
3736  Drupal.behaviors.webformSubmitOnce = {
3737    clear: function () {
3738      var $form = $('.js-webform-submit-once');
3739      $form.removeData('webform-submitted');
3740      $form.find('.js-webform-wizard-pages-links :submit, .form-actions :submit').removeClass('is-disabled');
3741      $form.find('.form-actions .ajax-progress.ajax-progress-throbber').remove();
3742    },
3743    attach: function (context) {
3744      $('.js-webform-submit-once', context).once('webform-submit-once').each(function () {
3745        var $form = $(this);
3746        // Remove data-webform-submitted.
3747        $form.removeData('webform-submitted');
3748        // Remove .js-webform-submit-clicked.
3749        $form.find('.js-webform-wizard-pages-links :submit, .form-actions :submit').removeClass('js-webform-submit-clicked');
3750
3751        // Track which submit button was clicked.
3752        // @see http://stackoverflow.com/questions/5721724/jquery-how-to-get-which-button-was-clicked-upon-form-submission
3753        $form.find('.js-webform-wizard-pages-links :submit, .form-actions :submit').on('click', function () {
3754          $form.find('.js-webform-wizard-pages-links :submit, .form-actions :submit')
3755            .removeClass('js-webform-submit-clicked');
3756          $(this)
3757            .addClass('js-webform-submit-clicked');
3758        });
3759
3760        $(this).on('submit', function () {
3761          // Find clicked button
3762          var $clickedButton = $form.find('.js-webform-wizard-pages-links :submit.js-webform-submit-clicked, .form-actions :submit.js-webform-submit-clicked');
3763
3764          // Don't submit if client-side validation has failed.
3765          if (!$clickedButton.attr('formnovalidate') && $.isFunction(jQuery.fn.valid) && !($form.valid())) {
3766            return false;
3767          }
3768
3769          // Track webform submitted.
3770          if ($form.data('webform-submitted')) {
3771            return false;
3772          }
3773          $form.data('webform-submitted', 'true');
3774
3775          // Visually disable all submit buttons.
3776          // Submit buttons can't disabled because their op(eration) must to be posted back to the server.
3777          $form.find('.js-webform-wizard-pages-links :submit, .form-actions :submit').addClass('is-disabled');
3778
3779          // Set the throbber progress indicator.
3780          $clickedButton.after(Drupal.theme.ajaxProgressThrobber());
3781        });
3782      });
3783    }
3784  };
3785
3786})(jQuery, Drupal);
3787;
3788/**
3789 * @file
3790 * JavaScript behaviors for details element.
3791 */
3792
3793(function ($, Drupal) {
3794
3795  'use strict';
3796
3797  // Determine if local storage exists and is enabled.
3798  // This approach is copied from Modernizr.
3799  // @see https://github.com/Modernizr/Modernizr/blob/c56fb8b09515f629806ca44742932902ac145302/modernizr.js#L696-731
3800  var hasLocalStorage = (function () {
3801    try {
3802      localStorage.setItem('webform', 'webform');
3803      localStorage.removeItem('webform');
3804      return true;
3805    }
3806    catch (e) {
3807      return false;
3808    }
3809  }());
3810
3811  /**
3812   * Attach handler to save details open/close state.
3813   *
3814   * @type {Drupal~behavior}
3815   */
3816  Drupal.behaviors.webformDetailsSave = {
3817    attach: function (context) {
3818      if (!hasLocalStorage) {
3819        return;
3820      }
3821
3822      // Summary click event handler.
3823      $('details > summary', context).once('webform-details-summary-save').on('click', function () {
3824        var $details = $(this).parent();
3825
3826        // @see https://css-tricks.com/snippets/jquery/make-an-jquery-hasattr/
3827        if ($details[0].hasAttribute('data-webform-details-nosave')) {
3828          return;
3829        }
3830
3831        var name = Drupal.webformDetailsSaveGetName($details);
3832        if (!name) {
3833          return;
3834        }
3835
3836        var open = ($details.attr('open') !== 'open') ? '1' : '0';
3837        localStorage.setItem(name, open);
3838      });
3839
3840      // Initialize details open state via local storage.
3841      $('details', context).once('webform-details-save').each(function () {
3842        var $details = $(this);
3843
3844        var name = Drupal.webformDetailsSaveGetName($details);
3845        if (!name) {
3846          return;
3847        }
3848
3849        var open = localStorage.getItem(name);
3850        if (open === null) {
3851          return;
3852        }
3853
3854        if (open === '1') {
3855          $details.attr('open', 'open');
3856        }
3857        else {
3858          $details.removeAttr('open');
3859        }
3860      });
3861    }
3862
3863  };
3864
3865  /**
3866   * Get the name used to store the state of details element.
3867   *
3868   * @param {jQuery} $details
3869   *   A details element.
3870   *
3871   * @return {string}
3872   *   The name used to store the state of details element.
3873   */
3874  Drupal.webformDetailsSaveGetName = function ($details) {
3875    if (!hasLocalStorage) {
3876      return '';
3877    }
3878
3879    // Ignore details that are vertical tabs pane.
3880    if ($details.hasClass('vertical-tabs__pane')) {
3881      return '';
3882    }
3883
3884    // Any details element not included a webform must have define its own id.
3885    var webformId = $details.attr('data-webform-element-id');
3886    if (webformId) {
3887      return 'Drupal.webform.' + webformId.replace('--', '.');
3888    }
3889
3890    var detailsId = $details.attr('id');
3891    if (!detailsId) {
3892      return '';
3893    }
3894
3895    var $form = $details.parents('form');
3896    if (!$form.length || !$form.attr('id')) {
3897      return '';
3898    }
3899
3900    var formId = $form.attr('id');
3901    if (!formId) {
3902      return '';
3903    }
3904
3905    // ISSUE: When Drupal renders a webform in a modal dialog it appends a unique
3906    // identifier to webform ids and details ids. (i.e. my-form--FeSFISegTUI)
3907    // WORKAROUND: Remove the unique id that delimited using double dashes.
3908    formId = formId.replace(/--.+?$/, '').replace(/-/g, '_');
3909    detailsId = detailsId.replace(/--.+?$/, '').replace(/-/g, '_');
3910    return 'Drupal.webform.' + formId + '.' + detailsId;
3911  };
3912
3913})(jQuery, Drupal);
3914;
3915/**
3916* DO NOT EDIT THIS FILE.
3917* See the following change record for more information,
3918* https://www.drupal.org/node/2815083
3919* @preserve
3920**/
3921
3922(function (Drupal, debounce) {
3923  var liveElement = void 0;
3924  var announcements = [];
3925
3926  Drupal.behaviors.drupalAnnounce = {
3927    attach: function attach(context) {
3928      if (!liveElement) {
3929        liveElement = document.createElement('div');
3930        liveElement.id = 'drupal-live-announce';
3931        liveElement.className = 'visually-hidden';
3932        liveElement.setAttribute('aria-live', 'polite');
3933        liveElement.setAttribute('aria-busy', 'false');
3934        document.body.appendChild(liveElement);
3935      }
3936    }
3937  };
3938
3939  function announce() {
3940    var text = [];
3941    var priority = 'polite';
3942    var announcement = void 0;
3943
3944    var il = announcements.length;
3945    for (var i = 0; i < il; i++) {
3946      announcement = announcements.pop();
3947      text.unshift(announcement.text);
3948
3949      if (announcement.priority === 'assertive') {
3950        priority = 'assertive';
3951      }
3952    }
3953
3954    if (text.length) {
3955      liveElement.innerHTML = '';
3956
3957      liveElement.setAttribute('aria-busy', 'true');
3958
3959      liveElement.setAttribute('aria-live', priority);
3960
3961      liveElement.innerHTML = text.join('\n');
3962
3963      liveElement.setAttribute('aria-busy', 'false');
3964    }
3965  }
3966
3967  Drupal.announce = function (text, priority) {
3968    announcements.push({
3969      text: text,
3970      priority: priority
3971    });
3972
3973    return debounce(announce, 200)();
3974  };
3975})(Drupal, Drupal.debounce);;
3976/**
3977 * @file
3978 * JavaScript behaviors for details element.
3979 */
3980
3981(function ($, Drupal) {
3982
3983  'use strict';
3984
3985  Drupal.webform = Drupal.webform || {};
3986  Drupal.webform.detailsToggle = Drupal.webform.detailsToggle || {};
3987  Drupal.webform.detailsToggle.options = Drupal.webform.detailsToggle.options || {};
3988
3989  /**
3990   * Attach handler to toggle details open/close state.
3991   *
3992   * @type {Drupal~behavior}
3993   */
3994  Drupal.behaviors.webformDetailsToggle = {
3995    attach: function (context) {
3996      $('.js-webform-details-toggle', context).once('webform-details-toggle').each(function () {
3997        var $form = $(this);
3998        var $tabs = $form.find('.webform-tabs');
3999
4000        // Get only the main details elements and ignore all nested details.
4001        var selector = ($tabs.length) ? '.webform-tab' : '.js-webform-details-toggle, .webform-elements';
4002        var $details = $form.find('details').filter(function () {
4003          var $parents = $(this).parentsUntil(selector);
4004          return ($parents.find('details').length === 0);
4005        });
4006
4007        // Toggle is only useful when there are two or more details elements.
4008        if ($details.length < 2) {
4009          return;
4010        }
4011
4012        var options = $.extend({
4013          button: '<button type="button" class="webform-details-toggle-state"></button>'
4014        }, Drupal.webform.detailsToggle.options);
4015
4016        // Create toggle buttons.
4017        var $toggle = $(options.button)
4018          .attr('title', Drupal.t('Toggle details widget state.'))
4019          .on('click', function (e) {
4020            // Get details that are not vertical tabs pane.
4021            var $details = $form.find('details:not(.vertical-tabs__pane)');
4022            var open;
4023            if (Drupal.webform.detailsToggle.isFormDetailsOpen($form)) {
4024              $details.removeAttr('open');
4025              open = 0;
4026            }
4027            else {
4028              $details.attr('open', 'open');
4029              open = 1;
4030            }
4031            Drupal.webform.detailsToggle.setDetailsToggleLabel($form);
4032
4033            // Set the saved states for all the details elements.
4034            // @see webform.element.details.save.js
4035            if (Drupal.webformDetailsSaveGetName) {
4036              $details.each(function () {
4037                // Note: Drupal.webformDetailsSaveGetName checks if localStorage
4038                // exists and is enabled.
4039                // @see webform.element.details.save.js
4040                var name = Drupal.webformDetailsSaveGetName($(this));
4041                if (name) {
4042                  localStorage.setItem(name, open);
4043                }
4044              });
4045            }
4046          })
4047          .wrap('<div class="webform-details-toggle-state-wrapper"></div>')
4048          .parent();
4049
4050        if ($tabs.length) {
4051          // Add toggle state before the tabs.
4052          $tabs.find('.item-list:first-child').eq(0).before($toggle);
4053        }
4054        else {
4055          // Add toggle state link to first details element.
4056          $details.eq(0).before($toggle);
4057        }
4058
4059        Drupal.webform.detailsToggle.setDetailsToggleLabel($form);
4060      });
4061    }
4062  };
4063
4064  /**
4065   * Determine if a webform's details are all opened.
4066   *
4067   * @param {jQuery} $form
4068   *   A webform.
4069   *
4070   * @return {boolean}
4071   *   TRUE if a webform's details are all opened.
4072   */
4073  Drupal.webform.detailsToggle.isFormDetailsOpen = function ($form) {
4074    return ($form.find('details[open]').length === $form.find('details').length);
4075  };
4076
4077  /**
4078   * Set a webform's details toggle state widget label.
4079   *
4080   * @param {jQuery} $form
4081   *   A webform.
4082   */
4083  Drupal.webform.detailsToggle.setDetailsToggleLabel = function ($form) {
4084    var isOpen = Drupal.webform.detailsToggle.isFormDetailsOpen($form);
4085
4086    var label = (isOpen) ? Drupal.t('Collapse all') : Drupal.t('Expand all');
4087    $form.find('.webform-details-toggle-state').html(label);
4088
4089    var text = (isOpen) ? Drupal.t('All details have been expanded.') : Drupal.t('All details have been collapsed.');
4090    Drupal.announce(text);
4091  };
4092
4093})(jQuery, Drupal);
4094;
4095/*!
4096 * jQuery Form Plugin
4097 * version: 4.2.2
4098 * Requires jQuery v1.7.2 or later
4099 * Project repository: https://github.com/jquery-form/form
4100
4101 * Copyright 2017 Kevin Morris
4102 * Copyright 2006 M. Alsup
4103
4104 * Dual licensed under the LGPL-2.1+ or MIT licenses
4105 * https://github.com/jquery-form/form#license
4106
4107 * This library is free software; you can redistribute it and/or
4108 * modify it under the terms of the GNU Lesser General Public
4109 * License as published by the Free Software Foundation; either
4110 * version 2.1 of the License, or (at your option) any later version.
4111 * This library is distributed in the hope that it will be useful,
4112 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4113 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4114 * Lesser General Public License for more details.
4115 */
4116!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,r){return void 0===r&&(r="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(r),r}:e(jQuery)}(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).closest("form").ajaxSubmit(r))}function r(t){var r=t.target,a=e(r);if(!a.is("[type=submit],[type=image]")){var n=a.closest("[type=submit]");if(0===n.length)return;r=n[0]}var i=r.form;if(i.clk=r,"image"===r.type)if(void 0!==t.offsetX)i.clk_x=t.offsetX,i.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var o=a.offset();i.clk_x=t.pageX-o.left,i.clk_y=t.pageY-o.top}else i.clk_x=t.pageX-r.offsetLeft,i.clk_y=t.pageY-r.offsetTop;setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}function a(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var n=/\r?\n/g,i={};i.fileapi=void 0!==e('<input type="file">').get(0).files,i.formdata=void 0!==window.FormData;var o=!!e.fn.prop;e.fn.attr2=function(){if(!o)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,s){function u(r){var a,n,i=e.param(r,t.traditional).split("&"),o=i.length,s=[];for(a=0;a<o;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),s.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return s}function c(r){function n(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(e){a("cannot get iframe.contentWindow document: "+e)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(r){a("cannot get iframe.contentDocument: "+r),t=e.document}return t}function i(){function t(){try{var e=n(v).readyState;a("state = "+e),e&&"uninitialized"===e.toLowerCase()&&setTimeout(t,50)}catch(e){a("Server abort: ",e," (",e.name,")"),s(L),j&&clearTimeout(j),j=void 0}}
vendor: 4,531 bytes, line 4116
4116var r=p.attr2("target"),i=p.attr2("action"),o=p.attr("enctype")||p.attr("encoding")||"multipart/form-data";w.setAttribute("target",m),l&&!/post/i.test(l)||w.setAttribute("method","POST"),i!==f.url&&w.setAttribute("action",f.url),f.skipEncodingOverride||l&&!/post/i.test(l)||p.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),f.timeout&&(j=setTimeout(function(){T=!0,s(A)},f.timeout));var u=[];try{if(f.extraData)for(var c in f.extraData)f.extraData.hasOwnProperty(c)&&(e.isPlainObject(f.extraData[c])&&f.extraData[c].hasOwnProperty("name")&&f.extraData[c].hasOwnProperty("value")?u.push(e('<input type="hidden" name="'+f.extraData[c].name+'">',k).val(f.extraData[c].value).appendTo(w)[0]):u.push(e('<input type="hidden" name="'+c+'">',k).val(f.extraData[c]).appendTo(w)[0]));f.iframeTarget||h.appendTo(D),v.attachEvent?v.attachEvent("onload",s):v.addEventListener("load",s,!1),setTimeout(t,15);try{w.submit()}catch(e){document.createElement("form").submit.apply(w)}}finally{w.setAttribute("action",i),w.setAttribute("enctype",o),r?w.setAttribute("target",r):p.removeAttr("target"),e(u).remove()}}function s(t){if(!x.aborted&&!X){if((O=n(v))||(a("cannot access response document"),t=L),t===A&&x)return x.abort("timeout"),void S.reject(x,"timeout");if(t===L&&x)return x.abort("server abort"),void S.reject(x,"error","server abort");if(O&&O.location.href!==f.iframeSrc||T){v.detachEvent?v.detachEvent("onload",s):v.removeEventListener("load",s,!1);var r,i="success";try{if(T)throw"timeout";var o="xml"===f.dataType||O.XMLDocument||e.isXMLDoc(O);if(a("isXml="+o),!o&&window.opera&&(null===O.body||!O.body.innerHTML)&&--C)return a("requeing onLoad callback, DOM not available"),void setTimeout(s,250);var u=O.body?O.body:O.documentElement;x.responseText=u?u.innerHTML:null,x.responseXML=O.XMLDocument?O.XMLDocument:O,o&&(f.dataType="xml"),x.getResponseHeader=function(e){return{"content-type":f.dataType}[e.toLowerCase()]},u&&(x.status=Number(u.getAttribute("status"))||x.status,x.statusText=u.getAttribute("statusText")||x.statusText);var c=(f.dataType||"").toLowerCase(),l=/(json|script|text)/.test(c);if(l||f.textarea){var p=O.getElementsByTagName("textarea")[0];if(p)x.responseText=p.value,x.status=Number(p.getAttribute("status"))||x.status,x.statusText=p.getAttribute("statusText")||x.statusText;else if(l){var m=O.getElementsByTagName("pre")[0],g=O.getElementsByTagName("body")[0];m?x.responseText=m.textContent?m.textContent:m.innerText:g&&(x.responseText=g.textContent?g.textContent:g.innerText)}}else"xml"===c&&!x.responseXML&&x.responseText&&(x.responseXML=q(x.responseText));try{M=N(x,c,f)}catch(e){i="parsererror",x.error=r=e||i}}catch(e){a("error caught: ",e),i="error",x.error=r=e||i}x.aborted&&(a("upload aborted"),i=null),x.status&&(i=x.status>=200&&x.status<300||304===x.status?"success":"error"),"success"===i?(f.success&&f.success.call(f.context,M,"success",x),S.resolve(x.responseText,"success",x),d&&e.event.trigger("ajaxSuccess",[x,f])):i&&(void 0===r&&(r=x.statusText),f.error&&f.error.call(f.context,x,i,r),S.reject(x,"error",r),d&&e.event.trigger("ajaxError",[x,f,r])),d&&e.event.trigger("ajaxComplete",[x,f]),d&&!--e.active&&e.event.trigger("ajaxStop"),f.complete&&f.complete.call(f.context,x,i),X=!0,f.timeout&&clearTimeout(j),setTimeout(function(){f.iframeTarget?h.attr("src",f.iframeSrc):h.remove(),x.responseXML=null},100)}}}var u,c,f,d,m,h,v,x,y,b,T,j,w=p[0],S=e.Deferred();if(S.abort=function(e){x.abort(e)},r)for(c=0;c<g.length;c++)u=e(g[c]),o?u.prop("disabled",!1):u.removeAttr("disabled");(f=e.extend(!0,{},e.ajaxSettings,t)).context=f.context||f,m="jqFormIO"+(new Date).getTime();var k=w.ownerDocument,D=p.closest("body");if(f.iframeTarget?(b=(h=e(f.iframeTarget,k)).attr2("name"))?m=b:h.attr2("name",m):(h=e('<iframe name="'+m+'" src="'+f.iframeSrc+'" />',k)).css({position:"absolute",top:"-1000px",left:"-1000px"}),v=h[0],x={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r="timeout"===t?"timeout":"aborted";a("aborting upload... "+r),this.aborted=1;try{v.contentWindow.document.execCommand&&v.contentWindow.document.execCommand("Stop")}catch(e){}h.attr("src",f.iframeSrc),x.error=r,f.error&&f.error.call(f.context,x,r,t),d&&e.event.trigger("ajaxError",[x,f,r]),f.complete&&f.complete.call(f.context,x,r)}},(d=f.global)&&0==e.active++&&e.event.trigger("ajaxStart"),d&&e.event.trigger("ajaxSend",[x,f]),f.beforeSend&&!1===f.beforeSend.c
4116all(f.context,x,f))return f.global&&e.active--,S.reject(),S;if(x.aborted)return S.reject(),S;(y=w.clk)&&(b=y.name)&&!y.disabled&&(f.extraData=f.extraData||{},f.extraData[b]=y.value,"image"===y.type&&(f.extraData[b+".x"]=w.clk_x,f.extraData[b+".y"]=w.clk_y));var A=1,L=2,F=e("meta[name=csrf-token]").attr("content"),E=e("meta[name=csrf-param]").attr("content");E&&F&&(f.extraData=f.extraData||{},f.extraData[E]=F),f.forceSync?i():setTimeout(i,10);var M,O,X,C=50,q=e.parseXML||function(e,t){return window.ActiveXObject?((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!==t.documentElement.nodeName?t:null},_=e.parseJSON||function(e){return window.eval("("+e+")")},N=function(t,r,a){var n=t.getResponseHeader("content-type")||"",i=("xml"===r||!r)&&n.indexOf("xml")>=0,o=i?t.responseXML:t.responseText;return i&&"parsererror"===o.documentElement.nodeName&&e.error&&e.error("parsererror"),a&&a.dataFilter&&(o=a.dataFilter(o,r)),"string"==typeof o&&(("json"===r||!r)&&n.indexOf("json")>=0?o=_(o):("script"===r||!r)&&n.indexOf("javascript")>=0&&e.globalEval(o)),o};return S}if(!this.length)return a("ajaxSubmit: skipping submit process - no element selected"),this;var l,f,d,p=this;"function"==typeof t?t={success:t}
4116:"string"==typeof t||!1===t&&arguments.length>0?(t={url:t,data:r,dataType:n},"function"==typeof s&&(t.success=s)):void 0===t&&(t={}),l=t.method||t.type||this.attr2("method"),(d=(d="string"==typeof(f=t.url||this.attr2("action"))?e.trim(f):"")||window.location.href||"")&&(d=(d.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:d,success:e.ajaxSettings.success,type:l||e.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var m={};if(this.trigger("form-pre-serialize",[this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&!1===t.beforeSerialize(this,t))return a("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var h=t.traditional;void 0===h&&(h=e.ajaxSettings.traditional);var v,g=[],x=this.formToArray(t.semantic,g,t.filtering);if(t.data){var y=e.isFunction(t.data)?t.data(x):t.data;t.extraData=y,v=e.param(y,h)}if(t.beforeSubmit&&!1===t.beforeSubmit(x,this,t))return a("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[x,this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var b=e.param(x,h);v&&(b=b?b+"&"+v:v),"GET"===t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+b,t.data=null):t.data=b;var T=[];
4116if(t.resetForm&&T.push(function(){p.resetForm()}),t.clearForm&&T.push(function(){p.clearForm(t.includeHidden)}),!t.dataType&&t.target){var j=t.success||function(){};T.push(function(r,a,n){var i=arguments,o=t.replaceTarget?"replaceWith":"html";e(t.target)[o](r).each(function(){j.apply(this,i)})})}else t.success&&(e.isArray(t.success)?e.merge(T,t.success):T.push(t.success));if(t.success=function(e,r,a){for(var n=t.context||this,i=0,o=T.length;i<o;i++)T[i].apply(n,[e,r,a||p,p])},t.error){var w=t.error;t.error=function(e,r,a){var n=t.context||this;w.apply(n,[e,r,a,p])}}if(t.complete){var S=t.complete;t.complete=function(e,r){var a=t.context||this;S.apply(a,[e,r,p])}}var k=e("input[type=file]:enabled",this).filter(function(){return""!==e(this).val()}).length>0,D="multipart/form-data",A=p.attr("enctype")===D||p.attr("encoding")===D,L=i.fileapi&&i.formdata;a("fileAPI :"+L);var F,E=(k||A)&&!L;!1!==t.iframe&&(t.iframe||E)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){F=c(x)}):F=c(x):F=(k||A)&&L?function(r){for(var a=new FormData,n=0;n<r.length;n++)a.append(r[n].name,r[n].value);if(t.extraData){var i=u(t.extraData);for(n=0;n<i.length;n++)i[n]&&a.append(i[n][0],i[n][1])}t.data=null;var o=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:l||"POST"});t.uploadProgress&&(o.xhr=function(){var r=e.ajaxSettings.xhr();return r.upload&&r.upload.addEventListener("progress",function(e){var r=0,a=e.loaded||e.position,n=e.total;e.lengthComputable&&(r=Math.ceil(a/n*100)),t.uploadProgress(e,a,n,r)},!1),r}),o.data=null;var s=o.beforeSend;return o.beforeSend=function(e,r){t.formData?r.data=t.formData:r.data=a,s&&s.call(this,e,r)},e.ajax(o)}(x):e.ajax(t),p.removeData("jqxhr").data("jqxhr",F);for(var M=0;M<g.length;M++)g[M]=null;return this.trigger("form-submit-notify",[this,t]),this},e.fn.ajaxForm=function(n,i,o,s){if(("string"==typeof n||!1===n&&arguments.length>0)&&(n={url:n,data:i,dataType:o},"function"==typeof s&&(n.success=s)),n=n||{},n.delegation=n.delegation&&e.isFunction(e.fn.on),!n.delegation&&0===this.length){var u={s:this.selector,c:this.context};return!e.isReady&&u.s?(a("DOM not ready, queuing ajaxForm"),e(function(){e(u.s,u.c).ajaxForm(n)}),this):(a("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return n.delegation?(e(document).off("submit.form-plugin",this.selector,t).off("click.form-plugin",this.selector,r).on("submit.form-plugin",this.selector,n,t).on("click.form-plugin",this.selector,n,r),this):this.ajaxFormUnbind().on("submit.form-plugin",n,t).on("click.form-plugin",n,r)},e.fn.ajaxFormUnbind=function(){return this.off("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,r,a){var n=[];if(0===this.length)return n;var o,s=this[0],u=this.attr("id"),c=t||void 0===s.elements?s.getElementsByTagName("*"):s.elements;if(c&&(c=e.makeArray(c)),u&&(t||/(Edge|Trident)\//.test(navigator.userAgent))&&(o=e(':input[form="'+u+'"]').get()).length&&(c=(c||[]).concat(o)),!c||!c.length)return n;e.isFunction(a)&&(c=e.map(c,a));var l,f,d,p,m,h,v;for(l=0,h=c.length;l<h;l++)if(m=c[l],(d=m.name)&&!m.disabled)if(t&&s.clk&&"image"===m.type)s.clk===m&&(n.push({name:d,value:e(m).val(),type:m.type}),n.push({name:d+".x",value:s.clk_x},{name:d+".y",value:s.clk_y}));else if((p=e.fieldValue(m,!0))&&p.constructor===Array)for(r&&r.push(m),f=0,v=p.length;f<v;f++)n.push({name:d,value:p[f]});else if(i.fileapi&&"file"===m.type){r&&r.push(m);var g=m.files;if(g.length)for(f=0;f<g.length;f++)n.push({name:d,value:g[f],type:m.type});else n.push({name:d,value:"",type:m.type})}else null!==p&&void 0!==p&&(r&&r.push(m),n.push({name:d,value:p,type:m.type,required:m.required}));if(!t&&s.clk){var x=e(s.clk),y=x[0];(d=y.name)&&!y.disabled&&"image"===y.type&&(n.push({name:d,value:x.val()}),n.push({name:d+".x",value:s.clk_x},{name:d+".y",value:s.clk_y}))}return n},e.fn.formSerialize=function(t){return e.param(this.formToArray(t))},e.fn.fieldSerialize=function(t){var r=[];return this.each(function(){var a=this.name;if(a){var n=e.fieldValue(this,t);if(n&&n.constructor===Array)for(var i=0,o=n.length;i<o;i++)r.push({name:a,value:n[i]});else null!==n&&void 0!==n&&r.push({name:this.name,value:n})}}),e.param(r)},e.fn.fieldValue=function(t){for(var r=[],a=0,n=this.length;a<n;a++){var i=this[a],o=e.fieldValue(i,t);null===o||void 0===o||o.constructor===Array&&!o.length||(o.constructor===Array?e.merge(r,o):r.push(o))}return r},e.fieldValue=function(t,r){var a=t.name,i=t.type,o=t.tagName.toLowerCase();if(void 0===r&&(r=!0),r&&(!a||t.disabled||"reset"===i||"button"===i||("checkbox"===i||"radio"===i)&&!t.checked||("submit"===i||"image"===i)&&t.form&&t.form.clk!==t||"select"===o&&-1===t.selectedIndex))return null;if("select"===o){var s=t.selectedIndex;if(s<0)return null;for(var u=[],c=t.options,l="select-one"===i,f=l?s+1:c.length,d=l?s:0;d<f;d++){var p=c[d];if(p.selected&&!p.disabled){var m=p.value;if(m||(m=p.attributes&&p.attributes.value&&!p.attributes.value.specified?p.text:p.value),l)return m;u.push(m)}}return u}return e(t).val().replace(n,"\r\n")},e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})},e.fn.clearFields=e.fn.clearInputs=function(t){var r=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();r.test(a)||"textarea"===n?this.value="":"checkbox"===a||"radio"===a?this.checked=!1:"select"===n?this.selectedIndex=-1:"file"===a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(!0===t&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")}
4116)},e.fn.resetForm=function(){return this.each(function(){var t=e(this),r=this.tagName.toLowerCase();switch(r){case"input":this.checked=this.defaultChecked;case"textarea":return this.value=this.defaultValue,!0;case"option":case"optgroup":var a=t.parents("select");return a.length&&a[0].multiple?"option"===r?this.selected=this.defaultSelected:t.find("option").resetForm():a.resetForm(),!0;case"select":return t.find("option").each(function(e){if(this.selected=this.defaultSelected,this.defaultSelected&&!t[0].multiple)return t[0].selectedIndex=e,!1}),!0;case"label":var n=e(t.attr("for")),i=t.find("input,select,textarea");return n[0]&&i.unshift(n[0]),i.resetForm(),!0;case"form":return("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset(),!0;default:return t.find("form,input,label,select,textarea").resetForm(),!0}})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var r=this.type;if("checkbox"===r||"radio"===r)this.checked=t;else if("option"===this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"===a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1});
4117
4118;
4119/**
4120 * @file
4121 * JavaScript behaviors for webform scroll top.
4122 */
4123
4124(function ($, Drupal) {
4125
4126  'use strict';
4127
4128  Drupal.webform = Drupal.webform || {};
4129  // Allow scrollTopOffset to be custom defined or based on whether there is a
4130  // floating toolbar.
4131  Drupal.webform.scrollTopOffset = Drupal.webform.scrollTopOffset || ($('#toolbar-administration').length ? 140 : 10);
4132
4133  /**
4134   * Scroll to top ajax command.
4135   *
4136   * @param element
4137   *
4138   * @param {string} target
4139   *   Scroll to target. (form or page)
4140   */
4141  Drupal.webformScrollTop = function (element, target) {
4142    if (!target) {
4143      return;
4144    }
4145
4146    var $element = $(element);
4147
4148    // Scroll to the top of the view. This will allow users
4149    // to browse newly loaded content after e.g. clicking a pager
4150    // link.
4151    var offset = $element.offset();
4152    // We can't guarantee that the scrollable object should be
4153    // the body, as the view could be embedded in something
4154    // more complex such as a modal popup. Recurse up the DOM
4155    // and scroll the first element that has a non-zero top.
4156    var $scrollTarget = $element;
4157    while ($scrollTarget.scrollTop() === 0 && $($scrollTarget).parent()) {
4158      $scrollTarget = $scrollTarget.parent();
4159    }
4160
4161    if (target === 'page' && $scrollTarget.length && $scrollTarget[0].tagName === 'HTML') {
4162      // Scroll to top when scroll target is the entire page.
4163      // @see https://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport
4164      var rect = $($scrollTarget)[0].getBoundingClientRect();
4165      if (!(rect.top >= 0 && rect.left >= 0 && rect.bottom <= $(window).height() && rect.right <= $(window).width())) {
4166        $scrollTarget.animate({scrollTop: 0}, 500);
4167      }
4168    }
4169    else {
4170      // Only scroll upward.
4171      if (offset.top - Drupal.webform.scrollTopOffset < $scrollTarget.scrollTop()) {
4172        $scrollTarget.animate({scrollTop: (offset.top - Drupal.webform.scrollTopOffset)}, 500);
4173      }
4174    }
4175  };
4176
4177  /**
4178   * Scroll element into view.
4179   *
4180   * @param {Element} element
4181   *   An element.
4182   */
4183  Drupal.webformScrolledIntoView = function($element) {
4184    if (!Drupal.webformIsScrolledIntoView($element)) {
4185      $('html, body').animate({scrollTop: $element.offset().top - Drupal.webform.scrollTopOffset}, 500);
4186    }
4187  }
4188
4189  /**
4190   * Determine if element is visible in the viewport.
4191   *
4192   * @param {Element} element
4193   *   An element.
4194   *
4195   * @return {boolean}
4196   *   TRUE if element is visible in the viewport.
4197   *
4198   * @see https://stackoverflow.com/questions/487073/check-if-element-is-visible-after-scrolling
4199   */
4200  Drupal.webformIsScrolledIntoView = function(element) {
4201    var docViewTop = $(window).scrollTop();
4202    var docViewBottom = docViewTop + $(window).height();
4203
4204    var elemTop = $(element).offset().top;
4205    var elemBottom = elemTop + $(element).height();
4206
4207    return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
4208  }
4209
4210})(jQuery, Drupal);
4211;
4212/**
4213 * @file
4214 * JavaScript behaviors for Ajax.
4215 */
4216
4217(function ($, Drupal, drupalSettings) {
4218
4219  'use strict';
4220
4221  Drupal.webform = Drupal.webform || {};
4222  Drupal.webform.ajax = Drupal.webform.ajax || {};
4223  // Allow scrollTopOffset to be custom defined or based on whether there is a
4224  // floating toolbar.
4225  Drupal.webform.ajax.scrollTopOffset = Drupal.webform.ajax.scrollTopOffset || ($('#toolbar-administration').length ? 140 : 10);
4226
4227  // Set global scroll top offset.
4228  // @todo Remove in Webform 6.x.
4229  Drupal.webform.scrollTopOffset = Drupal.webform.ajax.scrollTopOffset;
4230
4231  /**
4232   * Provide Webform Ajax link behavior.
4233   *
4234   * Display fullscreen progress indicator instead of throbber.
4235   * Copied from: Drupal.behaviors.AJAX
4236   *
4237   * @type {Drupal~behavior}
4238   *
4239   * @prop {Drupal~behaviorAttach} attach
4240   *   Attaches the behavior to a.webform-ajax-link.
4241   */
4242  Drupal.behaviors.webformAjaxLink = {
4243    attach: function (context) {
4244      $('.webform-ajax-link', context).once('webform-ajax-link').each(function () {
4245        var element_settings = {};
4246        element_settings.progress = {type: 'fullscreen'};
4247
4248        // For anchor tags, these will go to the target of the anch
4248or rather
4249        // than the usual location.
4250        var href = $(this).attr('href');
4251        if (href) {
4252          element_settings.url = href;
4253          element_settings.event = 'click';
4254        }
4255        element_settings.dialogType = $(this).data('dialog-type');
4256        element_settings.dialogRenderer = $(this).data('dialog-renderer');
4257        element_settings.dialog = $(this).data('dialog-options');
4258        element_settings.base = $(this).attr('id');
4259        element_settings.element = this;
4260        Drupal.ajax(element_settings);
4261
4262        // Close all open modal dialogs when opening off-canvas dialog.
4263        if (element_settings.dialogRenderer === 'off_canvas') {
4264          $(this).on('click', function () {
4265            $('.ui-dialog.webform-ui-dialog:visible').find('.ui-dialog-content').dialog('close');
4266          });
4267        }
4268      });
4269    }
4270  };
4271
4272  /**
4273   * Adds a hash (#) to current pages location for links and buttons
4274   *
4275   * @type {Drupal~behavior}
4276   *
4277   * @prop {Drupal~behaviorAttach} attach
4278   *   Attaches the behavior to a[data-hash] or :button[data-hash].
4279   *
4280   * @see \Drupal\webform_ui\WebformUiEntityElementsForm::getElementRow
4281   * @see Drupal.behaviors.webformFormTabs
4282   */
4283  Drupal.behaviors.webformAjaxHash = {
4284    attach: function (context) {
4285      $('[data-hash]', context).once('webform-ajax-hash').each(function () {
4286        var hash = $(this).data('hash');
4287        if (hash) {
4288          $(this).on('click', function () {
4289            location.hash = $(this).data('hash');
4290          });
4291        }
4292      });
4293    }
4294  };
4295
4296  /**
4297   * Provide Ajax callback for confirmation back to link.
4298   *
4299   * @type {Drupal~behavior}
4300   *
4301   * @prop {Drupal~behaviorAttach} attach
4302   *   Attaches the behavior to confirmation back to link.
4303   */
4304  Drupal.behaviors.webformConfirmationBackAjax = {
4305    attach: function (context) {
4306      $('.js-webform-confirmation-back-link-ajax', context)
4307        .once('webform-confirmation-back-ajax')
4308        .on('click', function (event) {
4309          var $form = $(this).parents('form');
4310
4311          // Trigger the Ajax call back for the hidden submit button.
4312          // @see \Drupal\webform\WebformSubmissionForm::getCustomForm
4313          $form.find('.js-webform-confirmation-back-submit-ajax').trigger('click');
4314
4315          // Move the progress indicator from the submit button to after this link.
4316          // @todo Figure out a better way to set a progress indicator.
4317          var $progress_indicator = $form.find('.ajax-progress');
4318          if ($progress_indicator) {
4319            $(this).after($progress_indicator);
4320          }
4321
4322          // Cancel the click event.
4323          event.preventDefault();
4324          event.stopPropagation();
4325        });
4326    }
4327  };
4328
4329  /** ********************************************************************** **/
4330  // Ajax commands.
4331  /** ********************************************************************** **/
4332
4333  /**
4334   * Track the updated table row key.
4335   */
4336  var updateKey;
4337
4338  /**
4339   * Track the add element key.
4340   */
4341  var addElement;
4342
4343  /**
4344   * Command to insert new content into the DOM.
4345   *
4346   * @param {Drupal.Ajax} ajax
4347   *   {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
4348   * @param {object} response
4349   *   The response from the Ajax request.
4350   * @param {string} response.data
4351   *   The data to use with the jQuery method.
4352   * @param {string} [response.method]
4353   *   The jQuery DOM manipulation method to be used.
4354   * @param {string} [response.selector]
4355   *   A optional jQuery selector string.
4356   * @param {object} [response.settings]
4357   *   An optional array of settings that will be used.
4358   * @param {number} [status]
4359   *   The XMLHttpRequest status.
4360   */
4361  Drupal.AjaxCommands.prototype.webformInsert = function (ajax, response, status) {
4362    // Insert the HTML.
4363    this.insert(ajax, response, status);
4364
4365    // Add element.
4366    if (addElement) {
4367      var addSelector = (addElement === '_root_')
4368        ? '#webform-ui-add-element'
4369        : '[data-drupal-selector="edit-webform-ui-elements-' + addElement + '-add"]';
4370      $(addSelector).trigger('click');
4371    }
4372
4373    // If not add element, then scroll to and highlight the updated table row.
4374    if (!addElement && updateKey) {
4375      var $element = $('tr[data-webform-key="' + updateKey + '"]');
4376
4377      // Highlight the updated element's row.
4378      $element.addClass('color-success');
4379      setTimeout(function () {$element.removeClass('color-success');}, 3000);
4380
4381      // Focus first tabbable item for the updated elements and handlers.
4382      $element.find(':tabbable:not(.tabledrag-handle)').eq(0).trigger('focus');
4383
4384      // Scroll element into view.
4385      Drupal.webformScrolledIntoView($element);
4386    }
4387    else {
4388      // Focus main content.
4389      $('#main-content').trigger('focus');
4390    }
4391
4392    // Display main page's status message in a floating container.
4393    var $wrapper = $(response.selector);
4394    if ($wrapper.parents('.ui-dialog').length === 0) {
4395      var $messages = $wrapper.find('.messages');
4396      // If 'add element' don't show any messages.
4397      if (addElement) {
4398        $messages.remove();
4399      }
4400      else if ($messages.length) {
4401        var $floatingMessage = $('#webform-ajax-messages');
4402        if ($floatingMessage.length === 0) {
4403          $floatingMessage = $('<div id="webform-ajax-messages" class="webform-ajax-messages"></div>');
4404          $('body').append($floatingMessage);
4405        }
4406        if ($floatingMessage.is(':animated')) {
4407          $floatingMessage.stop(true, true);
4408        }
4409        $floatingMessage.html($messages).show().delay(3000).fadeOut(1000);
4410      }
4411    }
4412
4413    updateKey = null; // Reset element update.
4414    addElement = null; // Reset add element.
4415  };
4416
4417  /**
4418   * Scroll to top ajax command.
4419   *
4420   * @param {Drupal.Ajax} [ajax]
4421   *   A {@link Drupal.ajax} object.
4422   * @param {object} response
4423   *   Ajax response.
4424   * @param {string} response.selector
4425   *   Selector to use.
4426   *
4427   * @see Drupal.AjaxCommands.prototype.viewScrollTop
4428   */
4429  Drupal.AjaxCommands.prototype.webformScrollTop = function (ajax, response) {
4430    // Scroll top.
4431    Drupal.webformScrollTop(response.selector, response.target);
4432
4433    // Focus on the form wrapper content bookmark if
4434    // .js-webform-autofocus is not enabled.
4435    // @see \Drupal\webform\Form\WebformAjaxFormTrait::buildAjaxForm
4436    var $form = $(response.selector + '-content').find('form');
4437    if (!$form.hasClass('js-webform-autofocus')) {
4438      $(response.selector + '-content').trigger('focus');
4439    }
4440  };
4441
4442  /**
4443   * Command to refresh the current webform page.
4444   *
4445   * @param {Drupal.Ajax} [ajax]
4446   *   {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
4447   * @param {object} response
4448   *   The response from the Ajax request.
4449   * @param {string} response.url
4450   *   The URL to redirect to.
4451   * @param {number} [status]
4452   *   The XMLHttpRequest status.
4453   */
4454  Drupal.AjaxCommands.prototype.webformRefresh = function (ajax, response, status) {
4455    // Get URL path name.
4456    // @see https://stackoverflow.com/questions/6944744/javascript-get-portion-of-url-path
4457    var a = document.createElement('a');
4458    a.href = response.url;
4459    var forceReload = (response.url.match(/\?reload=([^&]+)($|&)/)) ? RegExp.$1 : null;
4460    if (forceReload) {
4461      response.url = response.url.replace(/\?reload=([^&]+)($|&)/, '');
4462      this.redirect(ajax, response, status);
4463      return;
4464    }
4465
4466    if (a.pathname === window.location.pathname && $('.webform-ajax-refresh').length) {
4467      updateKey = (response.url.match(/[?|&]update=([^&]+)($|&)/)) ? RegExp.$1 : null;
4468      addElement = (response.url.match(/[?|&]add_element=([^&]+)($|&)/)) ? RegExp.$1 : null;
4469      $('.webform-ajax-refresh').trigger('click');
4470    }
4471    else {
4472      // Clear unsaved information flag so that the current webform page
4473      // can be redirected.
4474      // @see Drupal.behaviors.webformUnsaved.clear
4475      if (Drupal.behaviors.webformUnsaved) {
4476        Drupal.behaviors.webformUnsaved.clear();
4477      }
4478
4479      // For webform embedded in an iframe, open all redirects in the top
4480      // of the browser window.
4481      // @see \Drupal\webform_share\Controller\WebformShareController::page
4482      if (drupalSettings.webform_share &&
4483        drupalSettings.webform_share.page) {
4484        window.top.location = response.url;
4485      }
4486      else {
4487        this.redirect(ajax, response, status);
4488      }
4489    }
4490  };
4491
4492  /**
4493   * Command to close a off-canvas and modal dialog.
4494   *
4495   * If no selector is given, it defaults to trying to close the modal.
4496   *
4497   * @param {Drupal.Ajax} [ajax]
4498   *   {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
4499   * @param {object} response
4500   *   The response from the Ajax request.
4501   * @param {string} response.selector
4502   *   Selector to use.
4503   * @param {bool} response.persist
4504   *   Whether to persist the dialog element or not.
4505   * @param {number} [status]
4506   *   The HTTP status code.
4507   */
4508  Drupal.AjaxCommands.prototype.webformCloseDialog = function (ajax, response, status) {
4509    if ($('#drupal-off-canvas').length) {
4510      // Close off-canvas system tray which is not triggered by close dialog
4511      // command.
4512      // @see Drupal.behaviors.offCanvasEvents
4513      $('#drupal-off-canvas').remove();
4514      $('body').removeClass('js-tray-open');
4515      // Remove all *.off-canvas events
4516      $(document).off('.off-canvas');
4517      $(window).off('.off-canvas');
4518      var edge = document.documentElement.dir === 'rtl' ? 'left' : 'right';
4519      var $mainCanvasWrapper = $('[data-off-canvas-main-canvas]');
4520      $mainCanvasWrapper.css('padding-' + edge, 0);
4521
4522      // Resize tabs when closing off-canvas system tray.
4523      $(window).trigger('resize.tabs');
4524    }
4525
4526    // https://stackoverflow.com/questions/15763909/jquery-ui-dialog-check-if-exists-by-instance-method
4527    if ($(response.selector).hasClass('ui-dialog-content')) {
4528      this.closeDialog(ajax, response, status);
4529    }
4530  };
4531
4532  /**
4533   * Triggers confirm page reload.
4534   *
4535   * @param {Drupal.Ajax} [ajax]
4536   *   A {@link Drupal.ajax} object.
4537   * @param {object} response
4538   *   Ajax response.
4539   * @param {string} response.message
4540   *   A message to be displayed in the confirm dialog.
4541   */
4542  Drupal.AjaxCommands.prototype.webformConfirmReload = function (ajax, response) {
4543    if (window.confirm(response.message)) {
4544      window.location.reload(true);
4545    }
4546  };
4547
4548})(jQuery, Drupal, drupalSettings);
4549;
4550/**
4551 * @file
4552 * JavaScript behaviors for message element integration.
4553 */
4554
4555(function ($, Drupal) {
4556
4557  'use strict';
4558
4559  // Determine if local storage exists and is enabled.
4560  // This approach is copied from Modernizr.
4561  // @see https://github.com/Modernizr/Modernizr/blob/c56fb8b09515f629806ca44742932902ac145302/modernizr.js#L696-731
4562  var hasLocalStorage = (function () {
4563    try {
4564      localStorage.setItem('webform', 'webform');
4565      localStorage.removeItem('webform');
4566      return true;
4567    }
4568    catch (e) {
4569      return false;
4570    }
4571  }());
4572
4573  // Determine if session storage exists and is enabled.
4574  // This approach is copied from Modernizr.
4575  // @see https://github.com/Modernizr/Modernizr/blob/c56fb8b09515f629806ca44742932902ac145302/modernizr.js#L696-731
4576  var hasSessionStorage = (function () {
4577    try {
4578      sessionStorage.setItem('webform', 'webform');
4579      sessionStorage.removeItem('webform');
4580      return true;
4581    }
4582    catch (e) {
4583      return false;
4584    }
4585  }());
4586
4587  /**
4588   * Behavior for handler message close.
4589   *
4590   * @type {Drupal~behavior}
4591   */
4592  Drupal.behaviors.webformMessageClose = {
4593    attach: function (context) {
4594      $(context).find('.js-webform-message--close').once('webform-message--close').each(function () {
4595        var $element = $(this);
4596
4597        var id = $element.attr('data-message-id');
4598        var storage = $element.attr('data-message-storage');
4599        var effect = $element.attr('data-message-close-effect') || 'hide';
4600        switch (effect) {
4601          case 'slide': effect = 'slideUp'; break;
4602
4603          case 'fade': effect = 'fadeOut'; break;
4604        }
4605
4606        // Check storage status.
4607        if (isClosed($element, storage, id)) {
4608          return;
4609        }
4610
4611        // Only show element if it's style is not set to 'display: none'.
4612        if ($element.attr('style') !== 'display: none;') {
4613          $element.show();
4614        }
4615
4616        $element.find('.js-webform-message__link').on('click', function (event) {
4617          $element[effect]();
4618          setClosed($element, storage, id);
4619          $element.trigger('close');
4620          event.preventDefault();
4621        });
4622      });
4623    }
4624  };
4625
4626  function isClosed($element, storage, id) {
4627    if (!id || !storage) {
4628      return false;
4629    }
4630
4631    switch (storage) {
4632      case 'local':
4633        if (hasLocalStorage) {
4634          return localStorage.getItem('Drupal.webform.message.' + id) || false;
4635        }
4636        return false;
4637
4638      case 'session':
4639        if (hasSessionStorage) {
4640          return sessionStorage.getItem('Drupal.webform.message.' + id) || false;
4641        }
4642        return false;
4643
4644      default:
4645        return false;
4646    }
4647  }
4648
4649  function setClosed($element, storage, id) {
4650    if (!id || !storage) {
4651      return;
4652    }
4653
4654    switch (storage) {
4655      case 'local':
4656        if (hasLocalStorage) {
4657          localStorage.setItem('Drupal.webform.message.' + id, true);
4658        }
4659        break;
4660
4661      case 'session':
4662        if (hasSessionStorage) {
4663          sessionStorage.setItem('Drupal.webform.message.' + id, true);
4664        }
4665        break;
4666
4667      case 'user':
4668      case 'state':
4669      case 'custom':
4670        $.get($element.find('.js-webform-message__link').attr('href'));
4671        return true;
4672    }
4673  }
4674
4675})(jQuery, Drupal);
4676;
4677/**
4678 * @file
4679 * Attaches behaviors for the Clientside Validation jQuery module.
4680 */
4681(function ($, Drupal, drupalSettings) {
4682  'use strict';
4683
4684  /**
4685   * Attaches jQuery validate behavior to forms.
4686   *
4687   * @type {Drupal~behavior}
4688   *
4689   * @prop {Drupal~behaviorAttach} attach
4690   *  Attaches the outline behavior to the right context.
4691   */
4692  Drupal.behaviors.cvJqueryValidate = {
4693    attach: function (context) {
4694      if (typeof drupalSettings.cvJqueryValidateOptions === 'undefined') {
4695        drupalSettings.cvJqueryValidateOptions = {};
4696      }
4697
4698      if (typeof Drupal.Ajax !== 'undefined') {
4699        // Update Drupal.Ajax.prototype.beforeSend only once.
4700        if (typeof Drupal.Ajax.prototype.beforeSubmitCVOriginal === 'undefined') {
4701          var validateAll = 2;
4702          try {
4703            validateAll = drupalSettings.clientside_validation_jquery.validate_all_ajax_forms;
4704          }
4705          catch(e) {
4706            // Do nothing if we do not have settings or value in settings.
4707          }
4708
4709          Drupal.Ajax.prototype.beforeSubmitCVOriginal = Drupal.Ajax.prototype.beforeSubmit;
4710          Drupal.Ajax.prototype.beforeSubmit = function (form_values, element_settings, options) {
4711            if (typeof this.$form !== 'undefined' && (validateAll === 1 || $(this.element).hasClass('cv-validate-before-ajax'))) {
4712              $(this.$form).removeClass('ajax-submit-prevented');
4713
4714              $(this.$form).validate();
4715              if (!($(this.$form).valid())) {
4716                this.ajaxing = false;
4717                $(this.$form).addClass('ajax-submit-prevented');
4718                return false;
4719              }
4720            }
4721
4722            return this.beforeSubmitCVOriginal();
4723          };
4724        }
4725      }
4726
4727      if (drupalSettings.clientside_validation_jquery.force_validate_on_blur) {
4728        drupalSettings.cvJqueryValidateOptions.onfocusout = function(element) {
4729          // "eager" validation
4730          this.element(element);
4731        };
4732      }
4733
4734      // Allow all modules to update the validate options.
4735      // Example of how to do this is shown below.
4736      $(document).trigger('cv-jquery-validate-options-update', drupalSettings.cvJqueryValidateOptions);
4737
4738      $(context).find('form').each(function() {
4739        $(this).validate(drupalSettings.cvJqueryValidateOptions);
4740      });
4741    }
4742  };
4743})(jQuery, Drupal, drupalSettings);
4744;
4745/**
4746 * @file
4747 * Attaches behaviors for the Clientside Validation jQuery module.
4748 */
4749(function ($, Drupal, debounce, CKEDITOR) {
4750  /**
4751   * Attaches jQuery validate behavoir to forms.
4752   *
4753   * @type {Drupal~behavior}
4754   *
4755   * @prop {Drupal~behaviorAttach} attach
4756   *  Attaches the outline behavior to the right context.
4757   */
4758  Drupal.behaviors.cvJqueryValidateCKEditor = {
4759    attach: function (context) {
4760      if (typeof CKEDITOR === 'undefined') {
4761        return;
4762      }
4763      var ignore = ':hidden';
4764      var not = [];
4765      for (var instance in CKEDITOR.instances) {
4766        if (CKEDITOR.instances.hasOwnProperty(instance)) {
4767          not.push('#' + instance);
4768        }
4769      }
4770      ignore += not.length ? ':not(' + not.join(', ') + ')' : '';
4771      $('form').each(function () {
4772        var validator = $(this).data('validator');
4773        if (!validator) {
4774          return;
4775        }
4776        validator.settings.ignore = ignore;
4777        validator.settings.errorPlacement = function(place, $element) {
4778          var id = $element.attr('id');
4779          var afterElement = $element[0];
4780          if (CKEDITOR.instances.hasOwnProperty(id)) {
4781            afterElement = CKEDITOR.instances[id].container.$;
4782          }
4783          place.insertAfter(afterElement);
4784        };
4785      });
4786      var updateText = function (instance) {
4787        return debounce(function (e) {
4788          instance.updateElement();
4789          var event = $.extend(true, {}, e.data.$);
4790          delete event.target;
4791          delete event.explicitOriginalTarget;
4792          delete event.originalTarget;
4793          delete event.currentTarget;
4794          $(instance.element.$).trigger(new $.Event(e.name, event));
4795        }, 250);
4796      };
4797      CKEDITOR.on('instanceReady', function () {
4798        for (var instance in CKEDITOR.instances) {
4799          if (CKEDITOR.instances.hasOwnProperty(instance)) {
4800            CKEDITOR.instances[instance].document.on("keyup", updateText(CKEDITOR.instances[instance]));
4801            CKEDITOR.instances[instance].document.on("paste", updateText(CKEDITOR.instances[instance]));
4802            CKEDITOR.instances[instance].document.on("keypress", updateText(CKEDITOR.instances[instance]));
4803            CKEDITOR.instances[instance].document.on("blur", updateText(CKEDITOR.instances[instance]));
4804            CKEDITOR.instances[instance].document.on("change", updateText(CKEDITOR.instances[instance]));
4805          }
4806        }
4807      });
4808    }
4809  };
4810})(jQuery, Drupal, Drupal.debounce, (typeof CKEDITOR === 'undefined') ? undefined : CKEDITOR);
4811;
4812/**
4813 * @file
4814 * JavaScript behaviors for element help text (tooltip).
4815 */
4816
4817(function ($, Drupal) {
4818
4819  'use strict';
4820
4821  // @see http://api.jqueryui.com/tooltip/
4822  Drupal.webform = Drupal.webform || {};
4823  Drupal.webform.elementHelpIcon = Drupal.webform.elementHelpIcon || {};
4824  Drupal.webform.elementHelpIcon.options = Drupal.webform.elementHelpIcon.options || {
4825    position: {my: 'left+5 top+5', at: 'left bottom', collision: 'flipfit'},
4826    tooltipClass: 'webform-element-help--tooltip',
4827    // @see https://stackoverflow.com/questions/18231315/jquery-ui-tooltip-html-with-links
4828    show: {delay: 100},
4829    close: function (event, ui) {
4830      ui.tooltip.hover(
4831        function () {
4832          $(this).stop(true).fadeTo(400, 1);
4833        },
4834        function () {
4835          $(this).fadeOut('400', function () {
4836            $(this).remove();
4837          });
4838        });
4839    }
4840  };
4841
4842  /**
4843   * Element help icon.
4844   *
4845   * @type {Drupal~behavior}
4846   */
4847  Drupal.behaviors.webformElementHelpIcon = {
4848    attach: function (context) {
4849      $(context).find('.js-webform-element-help').once('webform-element-help').each(function () {
4850        var $link = $(this);
4851
4852        var options = $.extend({
4853          // Use 'data-webform-help' attribute which can include HTML markup.
4854          content: $link.attr('data-webform-help'),
4855          items: '[data-webform-help]'
4856        }, Drupal.webform.elementHelpIcon.options);
4857
4858        $link.tooltip(options)
4859          .on('click', function (event) {
4860            // Prevent click from toggling <label>s wrapped around help.
4861            event.preventDefault();
4862          }).on('keydown', function (event) {
4863            // Prevent ESC from from closing dialogs.
4864            if (event.keyCode === $.ui.keyCode.ESCAPE) {
4865              event.stopPropagation();
4866            }
4867          });
4868
4869        // Help tooltips are generally placed with <label> tags.
4870        // Screen readers are also reading the <label> and the
4871        // 'aria-describedby' attribute.
4872        // To prevent this issue we are removing the <label>'s 'for' attribute
4873        // when the tooltip is focused.
4874        var $label = $(this).parent('label');
4875        var labelFor = $label.attr('for') || '';
4876        if ($label.length && labelFor) {
4877          $link
4878            .on('focus', function () {
4879              $label.removeAttr('for');
4880            })
4881            .on('blur', function () {
4882              $label.attr('for', labelFor);
4883            });
4884        }
4885      });
4886    }
4887  };
4888
4889})(jQuery, Drupal);
4890;
4891/*
4892 * International Telephone Input v17.0.8
4893 * https://github.com/jackocnr/intl-tel-input.git
4894 * Licensed under the MIT license
4895 */
4896
4897!function(a){"object"==typeof module&&module.exports?module.exports=a():window.intlTelInput=a()}(function(a){"use strict";return function(){function b(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function c(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}function d(a,b,d){return b&&c(a.prototype,b),d&&c(a,d),a}for(var e=[["Afghanistan (‫افغانستان‬‎)","af","93"],["Albania (Shqipëri)","al","355"],["Algeria (‫الجزائر‬‎)","dz","213"],["American Samoa","as","1",5,["684"]],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1",6,["264"]],["Antigua and Barbuda","ag","1",7,["268"]],["Argentina","ar","54"],["Armenia (Հայաստան)","am","374"],["Aruba","aw","297"],["Australia","au","61",0],["Austr
4897ia (Österreich)","at","43"],["Azerbaijan (Azərbaycan)","az","994"],["Bahamas","bs","1",8,["242"]],["Bahrain (‫البحرين‬‎)","bh","973"],["Bangladesh (বাংলাদেশ)","bd","880"],["Barbados","bb","1",9,["246"]],["Belarus (Беларусь)","by","375"],["Belgium (België)","be","32"],["Belize","bz","501"],["Benin (Bénin)","bj","229"],["Bermuda","bm","1",10,["441"]],["Bhutan (འབྲུག)","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina (Босна и Херцеговина)","ba","387"],["Botswana","bw","267"],["Brazil (Brasil)","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1",11,["284"]],["Brunei","bn","673"],["Bulgaria (България)","bg","359"],["Burkina Faso","bf","226"],["Burundi (Uburundi)","bi","257"],["Cambodia (កម្ពុជា)","kh","855"],["Cameroon (Cameroun)","cm","237"],["Canada","ca","1",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde (Kabu Verdi)","cv","238"],["Caribbean Netherlands","bq","599",1,["3","4","7"]],["Cayman Islands","ky","1",12,["345"]],["Central African Republic (République centrafricaine)","cf","236"],["Chad (Tchad)","td","235"],["Chile","cl","56"],["China (中国)","cn","86"],["Christmas Island","cx","61",2,["89164"]],["Cocos (Keeling) Islands","cc","61",1,["89162"]],["Colombia","co","57"],["Comoros (‫جزر القمر‬‎)","km","269"],["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)","cd","243"],["Congo (Republic) (Congo-Brazzaville)","cg","242"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia (Hrvatska)","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599",0],["Cyprus (Κύπρος)","cy","357"],["Czech Republic (Česká republika)","cz","420"],["Denmark (Danmark)","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1",13,["767"]],["Dominican Republic (República Dominicana)","do","1",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt (‫مصر‬‎)","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea (Guinea Ecuatorial)","gq","240"],["Eritrea","er","291"],["Estonia (Eesti)","ee","372"],["Eswatini","sz","268"],["Ethiopia","et","251"],["Falkland Islands (Islas Malvinas)","fk","500"],["Faroe Islands (Føroyar)","fo","298"],["Fiji","fj","679"],["Finland (Suomi)","fi","358",0],["France","fr","33"],["French Guiana (Guyane française)","gf","594"],["French Polynesia (Polynésie française)","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia (საქართველო)","ge","995"],["Germany (Deutschland)","de","49"],["Ghana (Gaana)","gh","233"],["Gibraltar","gi","350"],["Greece (Ελλάδα)","gr","30"],["Greenland (Kalaallit Nunaat)","gl","299"],["Grenada","gd","1",14,["473"]],["Guadeloupe","gp","590",0],["Guam","gu","1",15,["671"]],["Guatemala","gt","502"],["Guernsey","gg","44",1,["1481","7781","7839","7911"]],["Guinea (Guinée)","gn","224"],["Guinea-Bissau (Guiné Bissau)","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong (香港)","hk","852"],["Hungary (Magyarország)","hu","36"],["Iceland (Ísland)","is","354"],["India (भारत)","in","91"],["Indonesia","id","62"],["Iran (‫ایران‬‎)","ir","98"],["Iraq (‫العراق‬‎)","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44",2,["1624","74576","7524","7924","7624"]],["Israel (‫ישראל‬‎)","il","972"],["Italy (Italia)","it","39",0],["Jamaica","jm","1",4,["876","658"]],["Japan (日本)","jp","81"],["Jersey","je","44",3,["1534","7509","7700","7797","7829","7937"]],["Jordan (‫الأردن‬‎)","jo","962"],["Kazakhstan (Казахстан)","kz","7",1,["33","7"]],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait (‫الكويت‬‎)","kw","965"],["Kyrgyzstan (Кыргызстан)","kg","996"],["Laos (ລາວ)","la","856"],["Latvia (Latvija)","lv","371"],["Lebanon (‫لبنان‬‎)","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya (‫ليبيا‬‎)","ly","218"],["Liechtenstein","li","423"],["Lithuania (Lietuva)","lt","370"],["Luxembourg","lu","352"],["Macau (澳門)","mo","853"],["Macedonia (FYROM) (Македонија)","mk","389"],["Madagascar (Madagasikara)","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania (‫موريتانيا‬‎)","mr","222"],["Mauritius (Moris)","mu","230"],["Mayotte","yt","262",1,["269","639"]],["Mexico (México)","mx","52"],["Micronesia","fm","691"],["Moldova (Republica Moldova)","md","373"],["Monaco","mc","377"],["Mongolia (Монгол)","mn","976"],["Montenegro (Crna Gora)","me","382"],["Montserrat","ms","1",16,["664"]],["Morocco (‫المغرب‬‎)","ma","212",0],["Mozambique (Moçambique)","mz","258"],["Myanmar (Burma) (မြန်မာ)","mm","95"],["Namibia (Namibië)","na","264"],["Nauru","nr","674"],["Nepal (नेपाल)","np","977"],["Netherlands (Nederland)","nl","31"],["New Caledonia (Nouvelle-Calédonie)","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger (Nijar)","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea (조선 민주주의 인민 공화국)","kp","850"],["Northern Mariana Islands","mp","1",17,["670"]],["Norway (Norge)","no","47",0],["Oman (‫عُمان‬‎)","om","968"],["Pakistan (‫پاکستان‬‎)","pk","92"],["Palau","pw","680"],["Palestine (‫فلسطين‬‎)","ps","970"],["Panama (Panamá)","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru (Perú)","pe","51"],["Philippines","ph","63"],["Poland (Polska)","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1",3,["787","939"]],["Qatar (‫قطر‬‎)","qa","974"],["Réunion (La Réunion)","re","262",0],["Romania (România)","ro","40"],["Russia (Россия)","ru","7",0],["Rwanda","rw","250"],["Saint Barthélemy","bl","590",1],["Saint Helena","sh","290"],["Saint Kitts and Nevis","kn","1",18,["869"]],["Saint Lucia","lc","1",19,["758"]],["Saint Martin (Saint-Martin (partie française))","mf","590",2],["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)","pm","508"],["Saint Vincent and the Grenadines","vc","1",20,["784"]],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe (São Tomé e Príncipe)","st","239"],["Saudi Arabia (‫المملكة العربية السعودية‬‎)","sa","966"],["Senegal (Sénégal)","sn","221"],["Serbia (Србија)","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1",21,["721"]],["Slovakia (Slovensko)","sk","421"],["Slovenia (Slovenija)","si","386"],["Solomon Islands","sb","677"],["S
4897omalia (Soomaaliya)","so","252"],["South Africa","za","27"],["South Korea (대한민국)","kr","82"],["South Sudan (‫جنوب السودان‬‎)","ss","211"],["Spain (España)","es","34"],["Sri Lanka (ශ්‍රී ලංකාව)","lk","94"],["Sudan (‫السودان‬‎)","sd","249"],["Suriname","sr","597"],["Svalbard and Jan Mayen","sj","47",1,["79"]],["Sweden (Sverige)","se","46"],["Switzerland (Schweiz)","ch","41"],["Syria (‫سوريا‬‎)","sy","963"],["Taiwan (台灣)","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand (ไทย)","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad and Tobago","tt","1",22,["868"]],["Tunisia (‫تونس‬‎)","tn","216"],["Turkey (Türkiye)","tr","90"],["Turkmenistan","tm","993"],["Turks and Caicos Islands","tc","1",23,["649"]],["Tuvalu","tv","688"],["U.S. Virgin Islands","vi","1",24,["340"]],["Uganda","ug","256"],["Ukraine (Україна)","ua","380"],["United Arab Emirates (‫الإمارات العربية المتحدة‬‎)","ae","971"],["United Kingdom","gb","44",0],["United States","us","1",0],["Uruguay","uy","598"],["Uzbekistan (Oʻzbekiston)","uz","998"],["Vanuatu","vu","678"],["Vatican City (Città del Vaticano)","va","39",1,["06698"]],["Venezuela","ve","58"],["Vietnam (Việt Nam)","vn","84"],["Wallis and Futuna (Wallis-et-Futuna)","wf","681"],["Western Sahara (‫الصحراء الغربية‬‎)","eh","212",1,["5288","5289"]],["Yemen (‫اليمن‬‎)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1,["18"]]],f=0;f<e.length;f++){var g=e[f];e[f]={name:g[0],iso2:g[1],dialCode:g[2],priority:g[3]||0,areaCodes:g[4]||null}}var h={getInstance:function(a){var b=a.getAttribute("data-intl-tel-input-id");return window.intlTelInputGlobals.instances[b]},instances:{},documentReady:function(){return"complete"===document.readyState}};"object"==typeof window&&(window.intlTelInputGlobals=h);var i=0,j={allowDropdown:!0,autoHideDialCode:!0,autoPlaceholder:"polite",customContainer:"",customPlaceholder:null,dropdownContainer:null,excludeCountries:[],formatOnDisplay:!0,geoIpLookup:null,hiddenInput:"",initialCountry:"",localizedCountries:null,nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:["us","gb"],separateDialCode:!1,utilsScript:""},k=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],l=function(a,b){for(var c=Object.keys(a),d=0;d<c.length;d++)b(c[d],a[c[d]])},m=function(a){l(window.intlTelInputGlobals.instances,function(b){window.intlTelInputGlobals.instances[b][a]()})},n=function(){function c(a,d){var e=this;b(this,c),this.id=i++,this.a=a,this.b=null,this.c=null;var f=d||{};this.d={},l(j,function(a,b){e.d[a]=f.hasOwnProperty(a)?f[a]:b}),this.e=Boolean(a.getAttribute("placeholder"))}return d(c,[{key:"_init",value:function(){var a=this;if(this.d.nationalMode&&(this.d.autoHideDialCode=!1),this.d.separateDialCode&&(this.d.autoHideDialCode=this.d.nationalMode=!1),this.g=/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),this.g&&(document.body.classList.add("iti-mobile"),this.d.dropdownContainer||(this.d.dropdownContainer=document.body)),"undefined"!=typeof Promise){var b=new Promise(function(b,c){a.h=b,a.i=c}),c=new Promise(function(b,c){a.i0=b,a.i1=c});this.promise=Promise.all([b,c])}else this.h=this.i=function(){},this.i0=this.i1=function(){};this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}},{key:"_b",value:function(){this._d(),this._d2(),this._e(),this.d.localizedCountries&&this._d0(),(this.d.onlyCountries.length||this.d.localizedCountries)&&this.p.sort(this._d1)}},{key:"_c",value:function(b,c,d){c.length>this.countryCodeMaxLen&&(this.countryCodeMaxLen=c.length),this.q.hasOwnProperty(c)||(this.q[c]=[]);for(var e=0;e<this.q[c].length;e++)if(this.q[c][e]===b)return;var f=d!==a?d:this.q[c].length;this.q[c][f]=b}},{key:"_d",value:function(){if(this.d.onlyCountries.length){var a=this.d.onlyCountries.map(function(a){return a.toLowerCase()});this.p=e.filter(function(b){return a.indexOf(b.iso2)>-1})}else if(this.d.excludeCountries.length){var b=this.d.excludeCountries.map(function(a){return a.toLowerCase()});this.p=e.filter(function(a){return-1===b.indexOf(a.iso2)})}else this.p=e}},{key:"_d0",value:function(){for(var a=0;a<this.p.length;a++){var b=this.p[a].iso2.toLowerCase();this.d.localizedCountries.hasOwnProperty(b)&&(this.p[a].name=this.d.localizedCountries[b])}}},{key:"_d1",value:function(a,b){return a.name.localeCompare(b.name)}},{key:"_d2",value:function(){this.countryCodeMaxLen=0,this.dialCodes={},this.q={};for(var a=0;a<this.p.length;a++){var b=this.p[a];this.dialCodes[b.dialCode]||(this.dialCodes[b.dialCode]=!0),this._c(b.iso2,b.dialCode,b.priority)}for(var c=0;c<this.p.length;c++){var d=this.p[c];if(d.areaCodes)for(var e=this.q[d.dialCode][0],f=0;f<d.areaCodes.length;f++){for(var g=d.areaCodes[f],h=1;h<g.length;h++){var i=d.dialCode+g.substr(0,h);this._c(e,i),this._c(d.iso2,i)}this._c(d.iso2,d.dialCode+g)}}}},{key:"_e",value:function(){this.preferredCountries=[];for(var a=0;a<this.d.preferredCountries.length;a++){var b=this.d.preferredCountries[a].toLowerCase(),c=this._y(b,!1,!0);c&&this.preferredCountries.push(c)}}},{key:"_e2",value:function(a,b,c){var d=document.createElement(a);return b&&l(b,function(a,b){return d.setAttribute(a,b)}),c&&c.appendChild(d),d}},{key:"_f",value:function(){this.a.hasAttribute("autocomplete")||this.a.form&&this.a.form.hasAttribute("autocomplete")||this.a.setAttribute("autocomplete","off");var a="iti";this.d.allowDropdown&&(a+=" iti--allow-dropdown"),this.d.separateDialCode&&(a+=" iti--separate-dial-code"),this.d.customContainer&&(a+=" ",a+=this.d.customContainer);var b=this._e2("div",{"class":a});if(this.a.parentNode.insertBefore(b,this.a),this.k=this._e2("div",{"class":"iti__flag-container"},b),b.appendChild(this.a),this.selectedFlag=this._e2("div",{"class":"iti__selected-flag",role:"combobox","aria-controls":"iti-".concat(this.id,"__country-listbox"),"aria-owns":"iti-".concat(this.id,"__country-listbox"),"aria-expanded":"false"},this.k),this.l=this._e2("div",{"class":"iti__flag"},this.selectedFlag),this.d.separateDialCode&&(this.t=this._e2("div",{"class":"iti__selected-dial-code"},this.selectedFlag)),this.d.allowDropdown&&(this.selectedFlag.setAttribute("tabindex","0"),this.u=this._e2("div",{"class":"iti__arrow"},this.selectedFlag),this.m=this._e2("ul",{"class":"iti__country-list iti__hide",id:"iti-".concat(this.id,"__country-listbox"),role:"listbox","aria-label":"List of countries"}),this.preferredCountries.length&&(this._g(this.preferredCountries,"iti__preferred",!0),this._e2("li",{"class":"iti__divider",role:"separator","aria-disabled":"true"},this.m)),this._g(this.p,"iti__standard"),this.d.dropdownContainer?(this.dropdown=this._e2("div",{"class":"iti iti--container"}),this.dropdown.appendChild(this.m)):this.k.appendChild(this.m)),this.d.hiddenInput){var c=this.d.hiddenInput,d=this.a.getAttribute("name");if(d){var e=d.lastIndexOf("[");-1!==e&&(c="".concat(d.substr(0,e),"[").concat(c,"]"))}this.hiddenInput=this._e2("input",{type:"hidden",name:c}
4897),b.appendChild(this.hiddenInput)}}},{key:"_g",value:function(a,b,c){for(var d="",e=0;e<a.length;e++){var f=a[e],g=c?"-preferred":"";d+="<li class='iti__country ".concat(b,"' tabIndex='-1' id='iti-").concat(this.id,"__item-").concat(f.iso2).concat(g,"' role='option' data-dial-code='").concat(f.dialCode,"' data-country-code='").concat(f.iso2,"' aria-selected='false'>"),d+="<div class='iti__flag-box'><div class='iti__flag iti__".concat(f.iso2,"'></div></div>"),d+="<span class='iti__country-name'>".concat(f.name,"</span>"),d+="<span class='iti__dial-code'>+".concat(f.dialCode,"</span>"),d+="</li>"}this.m.insertAdjacentHTML("beforeend",d)}},{key:"_h",value:function(){var a=this.a.value,b=this._5(a),c=this._w(a),d=this.d,e=d.initialCountry,f=d.nationalMode,g=d.autoHideDialCode,h=d.separateDialCode;b&&!c?this._v(a):"auto"!==e&&(e?this._z(e.toLowerCase()):b&&c?this._z("us"):(this.j=this.preferredCountries.length?this.preferredCountries[0].iso2:this.p[0].iso2,a||this._z(this.j)),a||f||g||h||(this.a.value="+".concat(this.s.dialCode))),a&&this._u(a)}},{key:"_i",value:function(){this._j(),this.d.autoHideDialCode&&this._l(),this.d.allowDropdown&&this._i2(),this.hiddenInput&&this._i0()}},{key:"_i0",value:function(){var a=this;this._a14=function(){a.hiddenInput.value=a.getNumber()},this.a.form&&this.a.form.addEventListener("submit",this._a14)}},{key:"_i1",value:function(){for(var a=this.a;a&&"LABEL"!==a.tagName;)a=a.parentNode;return a}},{key:"_i2",value:function(){var a=this;this._a9=function(b){a.m.classList.contains("iti__hide")?a.a.focus():b.preventDefault()};var b=this._i1();b&&b.addEventListener("click",this._a9),this._a10=function(){!a.m.classList.contains("iti__hide")||a.a.disabled||a.a.readOnly||a._n()},this.selectedFlag.addEventListener("click",this._a10),this._a11=function(b){a.m.classList.contains("iti__hide")&&-1!==["ArrowUp","Up","ArrowDown","Down"," ","Enter"].indexOf(b.key)&&(b.preventDefault(),b.stopPropagation(),a._n()),"Tab"===b.key&&a._2()},this.k.addEventListener("keydown",this._a11)}},{key:"_i3",value:function(){var a=this;this.d.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.d.utilsScript):window.addEventListener("load",function(){window.intlTelInputGlobals.loadUtils(a.d.utilsScript)}):this.i0(),"auto"===this.d.initialCountry?this._i4():this.h()}},{key:"_i4",value:function(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,"function"==typeof this.d.geoIpLookup&&this.d.geoIpLookup(function(a){window.intlTelInputGlobals.autoCountry=a.toLowerCase(),setTimeout(function(){return m("handleAutoCountry")})},function(){return m("rejectAutoCountryPromise")}))}},{key:"_j",value:function(){var a=this;this._a12=function(){a._v(a.a.value)&&a._m2CountryChange()},this.a.addEventListener("keyup",this._a12),this._a13=function(){setTimeout(a._a12)},this.a.addEventListener("cut",this._a13),this.a.addEventListener("paste",this._a13)}},{key:"_j2",value:function(a){var b=this.a.getAttribute("maxlength");return b&&a.length>b?a.substr(0,b):a}},{key:"_l",value:function(){var a=this;this._a8=function(){a._l2()},this.a.form&&this.a.form.addEventListener("submit",this._a8),this.a.addEventListener("blur",this._a8)}},{key:"_l2",value:function(){if("+"===this.a.value.charAt(0)){var a=this._m(this.a.value);a&&this.s.dialCode!==a||(this.a.value="")}}},{key:"_m",value:function(a){return a.replace(/\D/g,"")}},{key:"_m2",value:function(a){var b=document.createEvent("Event");b.initEvent(a,!0,!0),this.a.dispatchEvent(b)}},{key:"_n",value:function(){this.m.classList.remove("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","true"),this._o(),this.b&&(this._x(this.b,!1),this._3(this.b,!0)),this._p(),this.u.classList.add("iti__arrow--up"),this._m2("open:countrydropdown")}},{key:"_n2",value:function(a,b,c){c&&!a.classList.contains(b)?a.classList.add(b):!c&&a.classList.contains(b)&&a.classList.remove(b)}},{key:"_o",value:function(){var a=this;if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.g){var b=this.a.getBoundingClientRect(),c=window.pageYOffset||document.documentElement.scrollTop,d=b.top+c,e=this.m.offsetHeight,f=d+this.a.offsetHeight+e<c+window.innerHeight,g=d-e>c;if(this._n2(this.m,"iti__country-list--dropup",!f&&g),this.d.dropdownContainer){var h=!f&&g?0:this.a.offsetHeight;this.dropdown.style.top="".concat(d+h,"px"),this.dropdown.style.left="".concat(b.left+document.body.scrollLeft,"px"),this._a4=function(){return a._2()},window.addEventListener("scroll",this._a4)}}}},{key:"_o2",value:function(a){for(var b=a;b&&b!==this.m&&!b.classList.contains("iti__country");)b=b.parentNode;return b===this.m?null:b}},{key:"_p",value:function(){var a=this;this._a0=function(b){var c=a._o2(b.target);c&&a._x(c,!1)},this.m.addEventListener("mouseover",this._a0),this._a1=function(b){var c=a._o2(b.target);c&&a._1(c)},this.m.addEventListener("click",this._a1);var b=!0;this._a2=function(){b||a._2(),b=!1},document.documentElement.addEventListener("click",this._a2);var c="",d=null;this._a3=function(b){b.preventDefault(),"ArrowUp"===b.key||"Up"===b.key||"ArrowDown"===b.key||"Down"===b.key?a._q(b.key):"Enter"===b.key?a._r():"Escape"===b.key?a._2():/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(b.key)&&(d&&clearTimeout(d),c+=b.key.toLowerCase(),a._s(c),d=setTimeout(function(){c=""},1e3))},document.addEventListener("keydown",this._a3)}},{key:"_q",value:function(a){var b="ArrowUp"===a||"Up"===a?this.c.previousElementSibling:this.c.nextElementSibling;b&&(b.classList.contains("iti__divider")&&(b="ArrowUp"===a||"Up"===a?b.previousElementSibling:b.nextElementSibling),this._x(b,!0))}},{key:"_r",value:function(){this.c&&this._1(this.c)}},{key:"_s",value:function(a){for(var b=0;b<this.p.length;b++)if(this._t(this.p[b].name,a)){var c=this.m.querySelector("#iti-".concat(this.id,"__item-").concat(this.p[b].iso2));this._x(c,!1),this._3(c,!0);break}}},{key:"_t",value:function(a,b){return a.substr(0,b.length).toLowerCase()===b}},{key:"_u",value:function(a){var b=a;if(this.d.formatOnDisplay&&window.intlTelInputUtils&&this.s){var c=!this.d.separateDialCode&&(this.d.nationalMode||"+"!==b.charAt(0)),d=intlTelInputUtils.numberFormat,e=d.NATIONAL,f=d.INTERNATIONAL,g=c?e:f;b=intlTelInputUtils.formatNumber(b,this.s.iso2,g)}b=this._7(b),this.a.value=b}},{key:"_v",value:function(a){var b=a,c=this.s.dialCode,d="1"===c;b&&this.d.nationalMode&&d&&"+"!==b.charAt(0)&&("1"!==b.charAt(0)&&(b="
48971".concat(b)),b="+".concat(b)),this.d.separateDialCode&&c&&"+"!==b.charAt(0)&&(b="+".concat(c).concat(b));var e=this._5(b,!0),f=this._m(b),g=null;if(e){var h=this.q[this._m(e)],i=-1!==h.indexOf(this.s.iso2)&&f.length<=e.length-1;if(!("1"===c&&this._w(f))&&!i)for(var j=0;j<h.length;j++)if(h[j]){g=h[j];break}}else"+"===b.charAt(0)&&f.length?g="":b&&"+"!==b||(g=this.j);return null!==g&&this._z(g)}},{key:"_w",value:function(a){var b=this._m(a);if("1"===b.charAt(0)){var c=b.substr(1,3);return-1!==k.indexOf(c)}return!1}},{key:"_x",value:function(a,b){var c=this.c;c&&c.classList.remove("iti__highlight"),this.c=a,this.c.classList.add("iti__highlight"),b&&this.c.focus()}},{key:"_y",value:function(a,b,c){for(var d=b?e:this.p,f=0;f<d.length;f++)if(d[f].iso2===a)return d[f];if(c)return null;throw new Error("No country data for '".concat(a,"'"))}},{key:"_z",value:function(a){var b=this.s.iso2?this.s:{};this.s=a?this._y(a,!1,!1):{},this.s.iso2&&(this.j=this.s.iso2),this.l.setAttribute("class","iti__flag iti__".concat(a));var c=a?"".concat(this.s.name,": +").concat(this.s.dialCode):"Unknown";if(this.selectedFlag.setAttribute("title",c),this.d.separateDialCode){var d=this.s.dialCode?"+".concat(this.s.dialCode):"";this.t.innerHTML=d;var e=this.selectedFlag.offsetWidth||this._z2();this.a.style.paddingLeft="".concat(e+6,"px")}if(this._0(),this.d.allowDropdown){var f=this.b;if(f&&(f.classList.remove("iti__active"),f.setAttribute("aria-selected","false")),a){var g=this.m.querySelector("#iti-".concat(this.id,"__item-").concat(a,"-preferred"))||this.m.querySelector("#iti-".concat(this.id,"__item-").concat(a));g.setAttribute("aria-selected","true"),g.classList.add("iti__active"),this.b=g,this.selectedFlag.setAttribute("aria-activedescendant",g.getAttribute("id"))}}return b.iso2!==a}},{key:"_z2",value:function(){var a=this.a.parentNode.cloneNode();a.style.visibility="hidden",document.body.appendChild(a);var b=this.k.cloneNode();a.appendChild(b);var c=this.selectedFlag.cloneNode(!0);b.appendChild(c);var d=c.offsetWidth;return a.parentNode.removeChild(a),d}},{key:"_0",value:function(){var a="aggressive"===this.d.autoPlaceholder||!this.e&&"polite"===this.d.autoPlaceholder;if(window.intlTelInputUtils&&a){var b=intlTelInputUtils.numberType[this.d.placeholderNumberType],c=this.s.iso2?intlTelInputUtils.getExampleNumber(this.s.iso2,this.d.nationalMode,b):"";c=this._7(c),"function"==typeof this.d.customPlaceholder&&(c=this.d.customPlaceholder(c,this.s)),this.a.setAttribute("placeholder",c)}}},{key:"_1",value:function(a){var b=this._z(a.getAttribute("data-country-code"));this._2(),this._4(a.getAttribute("data-dial-code"),!0),this.a.focus();var c=this.a.value.length;this.a.setSelectionRange(c,c),b&&this._m2CountryChange()}},{key:"_2",value:function(){this.m.classList.add("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","false"),this.u.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._a3),document.documentElement.removeEventListener("click",this._a2),this.m.removeEventListener("mouseover",this._a0),this.m.removeEventListener("click",this._a1),this.d.dropdownContainer&&(this.g||window.removeEventListener("scroll",this._a4),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._m2("close:countrydropdown")}},{key:"_3",value:function(a,b){var c=this.m,d=window.pageYOffset||document.documentElement.scrollTop,e=c.offsetHeight,f=c.getBoundingClientRect().top+d,g=f+e,h=a.offsetHeight,i=a.getBoundingClientRect().top+d,j=i+h,k=i-f+c.scrollTop,l=e/2-h/2;if(i<f)b&&(k-=l),c.scrollTop=k;else if(j>g){b&&(k+=l);var m=e-h;c.scrollTop=k-m}}},{key:"_4",value:function(a,b){var c,d=this.a.value,e="+".concat(a);if("+"===d.charAt(0)){var f=this._5(d);c=f?d.replace(f,e):e}else{if(this.d.nationalMode||this.d.separateDialCode)return;if(d)c=e+d;else{if(!b&&this.d.autoHideDialCode)return;c=e}}this.a.value=c}},{key:"_5",value:function(a,b){var c="";if("+"===a.charAt(0))for(var d="",e=0;e<a.length;e++){var f=a.charAt(e);if(!isNaN(parseInt(f,10))){if(d+=f,b)this.q[d]&&(c=a.substr(0,e+1));else if(this.dialCodes[d]){c=a.substr(0,e+1);break}if(d.length===this.countryCodeMaxLen)break}}return c}},{key:"_6",value:function(){var a=this.a.value.trim(),b=this.s.dialCode,c=this._m(a);return(this.d.separateDialCode&&"+"!==a.charAt(0)&&b&&c?"+".concat(b):"")+a}},{key:"_7",value:function(a){var b=a;if(this.d.separateDialCode){var c=this._5(b);if(c){c="+".concat(this.s.dialCode);var d=" "===b[c.length]||"-"===b[c.length]?c.length+1:c.length;b=b.substr(d)}}return this._j2(b)}},{key:"_m2CountryChange",value:function(){this._m2("countrychange")}},{key:"handleAutoCountry",value:function(){"auto"===this.d.initialCountry&&(this.j=window.intlTelInputGlobals.autoCountry,this.a.value||this.setCountry(this.j),this.h())}},{key:"handleUtils",value:function(){window.intlTelInputUtils&&(this.a.value&&this._u(this.a.value),this._0()),this.i0()}},{key:"destroy",value:function(){var a=this.a.form;if(this.d.allowDropdown){this._2(),this.selectedFlag.removeEventListener("click",this._a10),this.k.removeEventListener("keydown",this._a11);var b=this._i1();b&&b.removeEventListener("click",this._a9)}this.hiddenInput&&a&&a.removeEventListener("submit",this._a14),this.d.autoHideDialCode&&(a&&a.removeEventListener("submit",this._a8),this.a.removeEventListener("blur",this._a8)),this.a.removeEventListener("keyup",this._a12),this.a.removeEventListener("cut",this._a13),this.a.removeEventListener("paste",this._a13),this.a.removeAttribute("data-intl-tel-input-id");var c=this.a.parentNode;c.parentNode.insertBefore(this.a,c),c.parentNode.removeChild(c),delete window.intlTelInputGlobals.instances[this.id]}},{key:"getExtension",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getExtension(this._6(),this.s.iso2):""}}
4897,{key:"getNumber",value:function(a){if(window.intlTelInputUtils){var b=this.s.iso2;return intlTelInputUtils.formatNumber(this._6(),b,a)}return""}},{key:"getNumberType",value:function(){
4898return window.intlTelInputUtils?intlTelInputUtils.getNumberType(this._6(),this.s.iso2):-99}},{key:"getSelectedCountryData",value:function(){return this.s}},{key:"getValidationError",value:function(){if(window.intlTelInputUtils){var a=this.s.iso2;return intlTelInputUtils.getValidationError(this._6(),a)}return-99}},{key:"isValidNumber",value:function(){var a=this._6().trim(),b=this.d.nationalMode?this.s.iso2:"";return window.intlTelInputUtils?intlTelInputUtils.isValidNumber(a,b):null}},{key:"setCountry",value:function(a){var b=a.toLowerCase();this.l.classList.contains("iti__".concat(b))||(this._z(b),this._4(this.s.dialCode,!1),this._m2CountryChange())}},{key:"setNumber",value:function(a){var b=this._v(a);this._u(a),b&&this._m2CountryChange()}},{key:"setPlaceholderNumberType",value:function(a){this.d.placeholderNumberType=a,this._0()}}]),c}();h.getCountryData=function(){return e};var o=function(a,b,c){var d=document.createElement("script");d.onload=function(){m("handleUtils"),b&&b()},d.onerror=function(){m("rejectUtilsScriptPromise"),c&&c()},d.className="iti-load-utils",d.async=!0,d.src=a,document.body.appendChild(d)};return h.loadUtils=function(a){if(!window.intlTelInputUtils&&!window.intlTelInputGlobals.startedLoadingUtilsScript){if(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,"undefined"!=typeof Promise)return new Promise(function(b,c){return o(a,b,c)});o(a)}return null},h.defaults=j,h.version="17.0.8",function(a,b){var c=new n(a,b);return c._init(),a.setAttribute("data-intl-tel-input-id",c.id),window.intlTelInputGlobals.instances[c.id]=c,c}}()});;
4899/*
4900 * International Telephone Input v17.0.8
4901 * https://github.com/jackocnr/intl-tel-input.git
4902 * Licensed under the MIT license
4903 */
4904
4905!function(a){"object"==typeof module&&module.exports?module.exports=a(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],function(b){a(b)}):a(jQuery)}(function(a,b){"use strict";function c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function d(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}function e(a,b,c){return b&&d(a.prototype,b),c&&d(a,c),a}for(var f=[["Afghanistan (‫افغانستان‬‎)","af","93"],["Albania (Shqipëri)","al","355"],["Algeria (‫الجزائر‬‎)","dz","213"],["American Samoa","as","1",5,["684"]],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1",6,["264"]],["Antigua and Barbuda","ag","1",7,["268"]],["Argentina","ar","54"],["Armenia (Հայաստան)","am","374"],["Aruba","aw","297"],["Australia","au","61",0],["Austria (Österreich)","at","43"],["Azerbaijan (Azərbaycan)","az","994"],["Bahamas","bs","1",8,["242"]],["Bahrain (‫البحرين‬‎)","bh","973"],["Bangladesh (বাংলাদেশ)","bd","880"],["Barbados","bb","1",9,["246"]],["Belarus (Беларусь)","by","375"],["Belgium (België)","be","32"],["Belize","bz","501"],["Benin (Bénin)","bj","229"],["Bermuda","bm","1",10,["441"]],["Bhutan (འབྲུག)","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina (Босна и Херцеговина)","ba","387"],["Botswana","bw","267"],["Brazil (Brasil)","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1",11,["284"]],["Brunei","bn","673"],["Bulgaria (България)","bg","359"],["Burkina Faso","bf","226"],["Burundi (Uburundi)","bi","257"],["Cambodia (កម្ពុជា)","kh","855"],["Cameroon (Cameroun)","cm","237"],["Canada","ca","1",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde (Kabu Verdi)","cv","238"],["Caribbean Netherlands","bq","599",1,["3","4","7"]],["Cayman Islands","ky","1",12,["345"]],["Central African Republic (République centrafricaine)","cf","236"],["Chad (Tchad)","td","235"],["Chile","cl","56"],["China (中国)","cn","86"],["Christmas Island","cx","61",2,["89164"]],["Cocos (Keeling) Islands","cc","61",1,["89162"]],["Colombia","co","57"],["Comoros (‫جزر القمر‬‎)","km","269"],["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)","cd","243"],["Congo (Republic) (Congo-Brazzaville)","cg","242"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia (Hrvatska)","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599",0],["Cyprus (Κύπρος)","cy","357"],["Czech Republic (Česká republika)","cz","420"],["Denmark (Danmark)","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1",13,["767"]
4905],["Dominican Republic (República Dominicana)","do","1",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt (‫مصر‬‎)","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea (Guinea Ecuatorial)","gq","240"],["Eritrea","er","291"],["Estonia (Eesti)","ee","372"],["Eswatini","sz","268"],["Ethiopia","et","251"],["Falkland Islands (Islas Malvinas)","fk","500"],["Faroe Islands (Føroyar)","fo","298"],["Fiji","fj","679"],["Finland (Suomi)","fi","358",0],["France","fr","33"],["French Guiana (Guyane française)","gf","594"],["French Polynesia (Polynésie française)","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia (საქართველო)","ge","995"],["Germany (Deutschland)","de","49"],["Ghana (Gaana)","gh","233"],["Gibraltar","gi","350"],["Greece (Ελλάδα)","gr","30"],["Greenland (Kalaallit Nunaat)","gl","299"],["Grenada","gd","1",14,["473"]],["Guadeloupe","gp","590",0],["Guam","gu","1",15,["671"]],["Guatemala","gt","502"],["Guernsey","gg","44",1,["1481","7781","7839","7911"]],["Guinea (Guinée)","gn","224"],["Guinea-Bissau (Guiné Bissau)","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong (香港)","hk","852"],["Hungary (Magyarország)","hu","36"],["Iceland (Ísland)","is","354"],["India (भारत)","in","91"],["Indonesia","id","62"],["Iran (‫ایران‬‎)","ir","98"],["Iraq (‫العراق‬‎)","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44",2,["1624","74576","7524","7924","7624"]],["Israel (‫ישראל‬‎)","il","972"],["Italy (Italia)","it","39",0],["Jamaica","jm","1",4,["876","658"]],["Japan (日本)","jp","81"],["Jersey","je","44",3,["1534","7509","7700","7797","7829","7937"]],["Jordan (‫الأردن‬‎)","jo","962"],["Kazakhstan (Казахстан)","kz","7",1,["33","7"]],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait (‫الكويت‬‎)","kw","965"],["Kyrgyzstan (Кыргызстан)","kg","996"],["Laos (ລາວ)","la","856"],["Latvia (Latvija)","lv","371"],["Lebanon (‫لبنان‬‎)","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya (‫ليبيا‬‎)","ly","218"],["Liechtenstein","li","423"],["Lithuania (Lietuva)","lt","370"],["Luxembourg","lu","352"],["Macau (澳門)","mo","853"],["Macedonia (FYROM) (Македонија)","mk","389"],["Madagascar (Madagasikara)","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania (‫موريتانيا‬‎)","mr","222"],["Mauritius (Moris)","mu","230"],["Mayotte","yt","262",1,["269","639"]],["Mexico (México)","mx","52"],["Micronesia","fm","691"],["Moldova (Republica Moldova)","md","373"],["Monaco","mc","377"],["Mongolia (Монгол)","mn","976"],["Montenegro (Crna Gora)","me","382"],["Montserrat","ms","1",16,["664"]],["Morocco (‫المغرب‬‎)","ma","212",0],["Mozambique (Moçambique)","mz","258"],["Myanmar (Burma) (မြန်မာ)","mm","95"],["Namibia (Namibië)","na","264"],["Nauru","nr","674"],["Nepal (नेपाल)","np","977"],["Netherlands (Nederland)","nl","31"],["New Caledonia (Nouvelle-Calédonie)","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger (Nijar)","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea (조선 민주주의 인민 공화국)","kp","850"],["Northern Mariana Islands","mp","1",17,["670"]],["Norway (Norge)","no","47",0],["Oman (‫عُمان‬‎)","om","968"],["Pakistan (‫پاکستان‬‎)","pk","92"],["Palau","pw","680"],["Palestine (‫فلسطين‬‎)","ps","970"],["Panama (Panamá)","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru (Perú)","pe","51"],["Philippines","ph","63"],["Poland (Polska)","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1",3,["787","939"]],["Qatar (‫قطر‬‎)","qa","974"],["Réunion (La Réunion)","re","262",0],["Romania (România)","ro","40"],["Russia (Россия)","ru","7",0],["Rwanda","rw","250"],["Saint Barthélemy","bl","590",1],["Saint Helena","sh","290"],["Saint Kitts and Nevis","kn","1",18,["869"]],["Saint Lucia","lc","1",19,["758"]],["Saint Martin (Saint-Martin (partie française))","mf","590",2],["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)","pm","508"],["Saint Vincent and the Grenadines","vc","1",20,["784"]],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe (São Tomé e Príncipe)","st","239"],["Saudi Arabia (‫المملكة العربية السعودية‬‎)","sa","966"],["Senegal (Sénégal)","sn","221"],["Serbia (Србија)","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1",21,["721"]],["Slovakia (Slovensko)","sk","421"],["Slovenia (Slovenija)","si","386"],["Solomon Islands","sb","677"],["S
4905omalia (Soomaaliya)","so","252"],["South Africa","za","27"],["South Korea (대한민국)","kr","82"],["South Sudan (‫جنوب السودان‬‎)","ss","211"],["Spain (España)","es","34"],["Sri Lanka (ශ්‍රී ලංකාව)","lk","94"],["Sudan (‫السودان‬‎)","sd","249"],["Suriname","sr","597"],["Svalbard and Jan Mayen","sj","47",1,["79"]],["Sweden (Sverige)","se","46"],["Switzerland (Schweiz)","ch","41"],["Syria (‫سوريا‬‎)","sy","963"],["Taiwan (台灣)","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand (ไทย)","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad and Tobago","tt","1",22,["868"]],["Tunisia (‫تونس‬‎)","tn","216"],["Turkey (Türkiye)","tr","90"],["Turkmenistan","tm","993"],["Turks and Caicos Islands","tc","1",23,["649"]],["Tuvalu","tv","688"],["U.S. Virgin Islands","vi","1",24,["340"]],["Uganda","ug","256"],["Ukraine (Україна)","ua","380"],["United Arab Emirates (‫الإمارات العربية المتحدة‬‎)","ae","971"],["United Kingdom","gb","44",0],["United States","us","1",0],["Uruguay","uy","598"],["Uzbekistan (Oʻzbekiston)","uz","998"],["Vanuatu","vu","678"],["Vatican City (Città del Vaticano)","va","39",1,["06698"]],["Venezuela","ve","58"],["Vietnam (Việt Nam)","vn","84"],["Wallis and Futuna (Wallis-et-Futuna)","wf","681"],["Western Sahara (‫الصحراء الغربية‬‎)","eh","212",1,["5288","5289"]],["Yemen (‫اليمن‬‎)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1,["18"]]],g=0;g<f.length;g++){var h=f[g];f[g]={name:h[0],iso2:h[1],dialCode:h[2],priority:h[3]||0,areaCodes:h[4]||null}}var i={getInstance:function(a){var b=a.getAttribute("data-intl-tel-input-id");return window.intlTelInputGlobals.instances[b]},instances:{},documentReady:function(){return"complete"===document.readyState}};"object"==typeof window&&(window.intlTelInputGlobals=i);var j=0,k={allowDropdown:!0,autoHideDialCode:!0,autoPlaceholder:"polite",customContainer:"",customPlaceholder:null,dropdownContainer:null,excludeCountries:[],formatOnDisplay:!0,geoIpLookup:null,hiddenInput:"",initialCountry:"",localizedCountries:null,nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:["us","gb"],separateDialCode:!1,utilsScript:""},l=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],m=function(a,b){for(var c=Object.keys(a),d=0;d<c.length;d++)b(c[d],a[c[d]])},n=function(a){m(window.intlTelInputGlobals.instances,function(b){window.intlTelInputGlobals.instances[b][a]()})},o=function(){function a(b,d){var e=this;c(this,a),this.id=j++,this.a=b,this.b=null,this.c=null;var f=d||{};this.d={},m(k,function(a,b){e.d[a]=f.hasOwnProperty(a)?f[a]:b}),this.e=Boolean(b.getAttribute("placeholder"))}return e(a,[{key:"_init",value:function(){var a=this;if(this.d.nationalMode&&(this.d.autoHideDialCode=!1),this.d.separateDialCode&&(this.d.autoHideDialCode=this.d.nationalMode=!1),this.g=/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),this.g&&(document.body.classList.add("iti-mobile"),this.d.dropdownContainer||(this.d.dropdownContainer=document.body)),"undefined"!=typeof Promise){var b=new Promise(function(b,c){a.h=b,a.i=c}),c=new Promise(function(b,c){a.i0=b,a.i1=c});this.promise=Promise.all([b,c])}else this.h=this.i=function(){},this.i0=this.i1=function(){};this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}},{key:"_b",value:function(){this._d(),this._d2(),this._e(),this.d.localizedCountries&&this._d0(),(this.d.onlyCountries.length||this.d.localizedCountries)&&this.p.sort(this._d1)}},{key:"_c",value:function(a,c,d){c.length>this.countryCodeMaxLen&&(this.countryCodeMaxLen=c.length),this.q.hasOwnProperty(c)||(this.q[c]=[]);for(var e=0;e<this.q[c].length;e++)if(this.q[c][e]===a)return;var f=d!==b?d:this.q[c].length;this.q[c][f]=a}},{key:"_d",value:function(){if(this.d.onlyCountries.length){var a=this.d.onlyCountries.map(function(a){return a.toLowerCase()});this.p=f.filter(function(b){return a.indexOf(b.iso2)>-1})}else if(this.d.excludeCountries.length){var b=this.d.excludeCountries.map(function(a){return a.toLowerCase()});this.p=f.filter(function(a){return-1===b.indexOf(a.iso2)})}else this.p=f}},{key:"_d0",value:function(){for(var a=0;a<this.p.length;a++){var b=this.p[a].iso2.toLowerCase();this.d.localizedCountries.hasOwnProperty(b)&&(this.p[a].name=this.d.localizedCountries[b])}}},{key:"_d1",value:function(a,b){return a.name.localeCompare(b.name)}},{key:"_d2",value:function(){this.countryCodeMaxLen=0,this.dialCodes={},this.q={};for(var a=0;a<this.p.length;a++){var b=this.p[a];this.dialCodes[b.dialCode]||(this.dialCodes[b.dialCode]=!0),this._c(b.iso2,b.dialCode,b.priority)}for(var c=0;c<this.p.length;c++){var d=this.p[c];if(d.areaCodes)for(var e=this.q[d.dialCode][0],f=0;f<d.areaCodes.length;f++){for(var g=d.areaCodes[f],h=1;h<g.length;h++){var i=d.dialCode+g.substr(0,h);this._c(e,i),this._c(d.iso2,i)}this._c(d.iso2,d.dialCode+g)}}}},{key:"_e",value:function(){this.preferredCountries=[];for(var a=0;a<this.d.preferredCountries.length;a++){var b=this.d.preferredCountries[a].toLowerCase(),c=this._y(b,!1,!0);c&&this.preferredCountries.push(c)}}},{key:"_e2",value:function(a,b,c){var d=document.createElement(a);return b&&m(b,function(a,b){return d.setAttribute(a,b)}),c&&c.appendChild(d),d}},{key:"_f",value:function(){this.a.hasAttribute("autocomplete")||this.a.form&&this.a.form.hasAttribute("autocomplete")||this.a.setAttribute("autocomplete","off");var a="iti";this.d.allowDropdown&&(a+=" iti--allow-dropdown"),this.d.separateDialCode&&(a+=" iti--separate-dial-code"),this.d.customContainer&&(a+=" ",a+=this.d.customContainer);var b=this._e2("div",{"class":a});if(this.a.parentNode.insertBefore(b,this.a),this.k=this._e2("div",{"class":"iti__flag-container"},b),b.appendChild(this.a),this.selectedFlag=this._e2("div",{"class":"iti__selected-flag",role:"combobox","aria-controls":"iti-".concat(this.id,"__country-listbox"),"aria-owns":"iti-".concat(this.id,"__country-listbox"),"aria-expanded":"false"},this.k),this.l=this._e2("div",{"class":"iti__flag"},this.selectedFlag),this.d.separateDialCode&&(this.t=this._e2("div",{"class":"iti__selected-dial-code"},this.selectedFlag)),this.d.allowDropdown&&(this.selectedFlag.setAttribute("tabindex","0"),this.u=this._e2("div",{"class":"iti__arrow"},this.selectedFlag),this.m=this._e2("ul",{"class":"iti__country-list iti__hide",id:"iti-".concat(this.id,"__country-listbox"),role:"listbox","aria-label":"List of countries"}),this.preferredCountries.length&&(this._g(this.preferredCountries,"iti__preferred",!0),this._e2("li",{"class":"iti__divider",role:"separator","aria-disabled":"true"},this.m)),this._g(this.p,"iti__standard"),this.d.dropdownContainer?(this.dropdown=this._e2("div",{"class":"iti iti--container"}),this.dropdown.appendChild(this.m)):this.k.appendChild(this.m)),this.d.hiddenInput){var c=this.d.hiddenInput,d=this.a.getAttribute("name");if(d){var e=d.lastIndexOf("[");-1!==e&&(c="".concat(d.substr(0,e),"[").concat(c,"]"))}this.hiddenInput=this._e2("input",{type:"hidden",name:c}
4905),b.appendChild(this.hiddenInput)}}},{key:"_g",value:function(a,b,c){for(var d="",e=0;e<a.length;e++){var f=a[e],g=c?"-preferred":"";d+="<li class='iti__country ".concat(b,"' tabIndex='-1' id='iti-").concat(this.id,"__item-").concat(f.iso2).concat(g,"' role='option' data-dial-code='").concat(f.dialCode,"' data-country-code='").concat(f.iso2,"' aria-selected='false'>"),d+="<div class='iti__flag-box'><div class='iti__flag iti__".concat(f.iso2,"'></div></div>"),d+="<span class='iti__country-name'>".concat(f.name,"</span>"),d+="<span class='iti__dial-code'>+".concat(f.dialCode,"</span>"),d+="</li>"}this.m.insertAdjacentHTML("beforeend",d)}},{key:"_h",value:function(){var a=this.a.value,b=this._5(a),c=this._w(a),d=this.d,e=d.initialCountry,f=d.nationalMode,g=d.autoHideDialCode,h=d.separateDialCode;b&&!c?this._v(a):"auto"!==e&&(e?this._z(e.toLowerCase()):b&&c?this._z("us"):(this.j=this.preferredCountries.length?this.preferredCountries[0].iso2:this.p[0].iso2,a||this._z(this.j)),a||f||g||h||(this.a.value="+".concat(this.s.dialCode))),a&&this._u(a)}},{key:"_i",value:function(){this._j(),this.d.autoHideDialCode&&this._l(),this.d.allowDropdown&&this._i2(),this.hiddenInput&&this._i0()}},{key:"_i0",value:function(){var a=this;this._a14=function(){a.hiddenInput.value=a.getNumber()},this.a.form&&this.a.form.addEventListener("submit",this._a14)}},{key:"_i1",value:function(){for(var a=this.a;a&&"LABEL"!==a.tagName;)a=a.parentNode;return a}},{key:"_i2",value:function(){var a=this;this._a9=function(b){a.m.classList.contains("iti__hide")?a.a.focus():b.preventDefault()};var b=this._i1();b&&b.addEventListener("click",this._a9),this._a10=function(){!a.m.classList.contains("iti__hide")||a.a.disabled||a.a.readOnly||a._n()},this.selectedFlag.addEventListener("click",this._a10),this._a11=function(b){a.m.classList.contains("iti__hide")&&-1!==["ArrowUp","Up","ArrowDown","Down"," ","Enter"].indexOf(b.key)&&(b.preventDefault(),b.stopPropagation(),a._n()),"Tab"===b.key&&a._2()},this.k.addEventListener("keydown",this._a11)}},{key:"_i3",value:function(){var a=this;this.d.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.d.utilsScript):window.addEventListener("load",function(){window.intlTelInputGlobals.loadUtils(a.d.utilsScript)}):this.i0(),"auto"===this.d.initialCountry?this._i4():this.h()}},{key:"_i4",value:function(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,"function"==typeof this.d.geoIpLookup&&this.d.geoIpLookup(function(a){window.intlTelInputGlobals.autoCountry=a.toLowerCase(),setTimeout(function(){return n("handleAutoCountry")})},function(){return n("rejectAutoCountryPromise")}))}},{key:"_j",value:function(){var a=this;this._a12=function(){a._v(a.a.value)&&a._m2CountryChange()},this.a.addEventListener("keyup",this._a12),this._a13=function(){setTimeout(a._a12)},this.a.addEventListener("cut",this._a13),this.a.addEventListener("paste",this._a13)}},{key:"_j2",value:function(a){var b=this.a.getAttribute("maxlength");return b&&a.length>b?a.substr(0,b):a}},{key:"_l",value:function(){var a=this;this._a8=function(){a._l2()},this.a.form&&this.a.form.addEventListener("submit",this._a8),this.a.addEventListener("blur",this._a8)}},{key:"_l2",value:function(){if("+"===this.a.value.charAt(0)){var a=this._m(this.a.value);a&&this.s.dialCode!==a||(this.a.value="")}}},{key:"_m",value:function(a){return a.replace(/\D/g,"")}},{key:"_m2",value:function(a){var b=document.createEvent("Event");b.initEvent(a,!0,!0),this.a.dispatchEvent(b)}},{key:"_n",value:function(){this.m.classList.remove("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","true"),this._o(),this.b&&(this._x(this.b,!1),this._3(this.b,!0)),this._p(),this.u.classList.add("iti__arrow--up"),this._m2("open:countrydropdown")}},{key:"_n2",value:function(a,b,c){c&&!a.classList.contains(b)?a.classList.add(b):!c&&a.classList.contains(b)&&a.classList.remove(b)}},{key:"_o",value:function(){var a=this;if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.g){var b=this.a.getBoundingClientRect(),c=window.pageYOffset||document.documentElement.scrollTop,d=b.top+c,e=this.m.offsetHeight,f=d+this.a.offsetHeight+e<c+window.innerHeight,g=d-e>c;if(this._n2(this.m,"iti__country-list--dropup",!f&&g),this.d.dropdownContainer){var h=!f&&g?0:this.a.offsetHeight;this.dropdown.style.top="".concat(d+h,"px"),this.dropdown.style.left="".concat(b.left+document.body.scrollLeft,"px"),this._a4=function(){return a._2()},window.addEventListener("scroll",this._a4)}}}},{key:"_o2",value:function(a){for(var b=a;b&&b!==this.m&&!b.classList.contains("iti__country");)b=b.parentNode;return b===this.m?null:b}},{key:"_p",value:function(){var a=this;this._a0=function(b){var c=a._o2(b.target);c&&a._x(c,!1)},this.m.addEventListener("mouseover",this._a0),this._a1=function(b){var c=a._o2(b.target);c&&a._1(c)},this.m.addEventListener("click",this._a1);var b=!0;this._a2=function(){b||a._2(),b=!1},document.documentElement.addEventListener("click",this._a2);var c="",d=null;this._a3=function(b){b.preventDefault(),"ArrowUp"===b.key||"Up"===b.key||"ArrowDown"===b.key||"Down"===b.key?a._q(b.key):"Enter"===b.key?a._r():"Escape"===b.key?a._2():/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(b.key)&&(d&&clearTimeout(d),c+=b.key.toLowerCase(),a._s(c),d=setTimeout(function(){c=""},1e3))},document.addEventListener("keydown",this._a3)}},{key:"_q",value:function(a){var b="ArrowUp"===a||"Up"===a?this.c.previousElementSibling:this.c.nextElementSibling;b&&(b.classList.contains("iti__divider")&&(b="ArrowUp"===a||"Up"===a?b.previousElementSibling:b.nextElementSibling),this._x(b,!0))}},{key:"_r",value:function(){this.c&&this._1(this.c)}},{key:"_s",value:function(a){for(var b=0;b<this.p.length;b++)if(this._t(this.p[b].name,a)){var c=this.m.querySelector("#iti-".concat(this.id,"__item-").concat(this.p[b].iso2));this._x(c,!1),this._3(c,!0);break}}},{key:"_t",value:function(a,b){return a.substr(0,b.length).toLowerCase()===b}},{key:"_u",value:function(a){var b=a;if(this.d.formatOnDisplay&&window.intlTelInputUtils&&this.s){var c=!this.d.separateDialCode&&(this.d.nationalMode||"+"!==b.charAt(0)),d=intlTelInputUtils.numberFormat,e=d.NATIONAL,f=d.INTERNATIONAL,g=c?e:f;b=intlTelInputUtils.formatNumber(b,this.s.iso2,g)}b=this._7(b),this.a.value=b}},{key:"_v",value:function(a){var b=a,c=this.s.dialCode,d="1"===c;b&&this.d.nationalMode&&d&&"+"!==b.charAt(0)&&("1"!==b.charAt(0)&&(b="
49051".concat(b)),b="+".concat(b)),this.d.separateDialCode&&c&&"+"!==b.charAt(0)&&(b="+".concat(c).concat(b));var e=this._5(b,!0),f=this._m(b),g=null;if(e){var h=this.q[this._m(e)],i=-1!==h.indexOf(this.s.iso2)&&f.length<=e.length-1;if(!("1"===c&&this._w(f))&&!i)for(var j=0;j<h.length;j++)if(h[j]){g=h[j];break}}else"+"===b.charAt(0)&&f.length?g="":b&&"+"!==b||(g=this.j);return null!==g&&this._z(g)}},{key:"_w",value:function(a){var b=this._m(a);if("1"===b.charAt(0)){var c=b.substr(1,3);return-1!==l.indexOf(c)}return!1}},{key:"_x",value:function(a,b){var c=this.c;c&&c.classList.remove("iti__highlight"),this.c=a,this.c.classList.add("iti__highlight"),b&&this.c.focus()}},{key:"_y",value:function(a,b,c){for(var d=b?f:this.p,e=0;e<d.length;e++)if(d[e].iso2===a)return d[e];if(c)return null;throw new Error("No country data for '".concat(a,"'"))}},{key:"_z",value:function(a){var b=this.s.iso2?this.s:{};this.s=a?this._y(a,!1,!1):{},this.s.iso2&&(this.j=this.s.iso2),this.l.setAttribute("class","iti__flag iti__".concat(a));var c=a?"".concat(this.s.name,": +").concat(this.s.dialCode):"Unknown";if(this.selectedFlag.setAttribute("title",c),this.d.separateDialCode){var d=this.s.dialCode?"+".concat(this.s.dialCode):"";this.t.innerHTML=d;var e=this.selectedFlag.offsetWidth||this._z2();this.a.style.paddingLeft="".concat(e+6,"px")}if(this._0(),this.d.allowDropdown){var f=this.b;if(f&&(f.classList.remove("iti__active"),f.setAttribute("aria-selected","false")),a){var g=this.m.querySelector("#iti-".concat(this.id,"__item-").concat(a,"-preferred"))||this.m.querySelector("#iti-".concat(this.id,"__item-").concat(a));g.setAttribute("aria-selected","true"),g.classList.add("iti__active"),this.b=g,this.selectedFlag.setAttribute("aria-activedescendant",g.getAttribute("id"))}}return b.iso2!==a}},{key:"_z2",value:function(){var a=this.a.parentNode.cloneNode();a.style.visibility="hidden",document.body.appendChild(a);var b=this.k.cloneNode();a.appendChild(b);var c=this.selectedFlag.cloneNode(!0);b.appendChild(c);var d=c.offsetWidth;return a.parentNode.removeChild(a),d}},{key:"_0",value:function(){var a="aggressive"===this.d.autoPlaceholder||!this.e&&"polite"===this.d.autoPlaceholder;if(window.intlTelInputUtils&&a){var b=intlTelInputUtils.numberType[this.d.placeholderNumberType],c=this.s.iso2?intlTelInputUtils.getExampleNumber(this.s.iso2,this.d.nationalMode,b):"";c=this._7(c),"function"==typeof this.d.customPlaceholder&&(c=this.d.customPlaceholder(c,this.s)),this.a.setAttribute("placeholder",c)}}},{key:"_1",value:function(a){var b=this._z(a.getAttribute("data-country-code"));this._2(),this._4(a.getAttribute("data-dial-code"),!0),this.a.focus();var c=this.a.value.length;this.a.setSelectionRange(c,c),b&&this._m2CountryChange()}},{key:"_2",value:function(){this.m.classList.add("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","false"),this.u.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._a3),document.documentElement.removeEventListener("click",this._a2),this.m.removeEventListener("mouseover",this._a0),this.m.removeEventListener("click",this._a1),this.d.dropdownContainer&&(this.g||window.removeEventListener("scroll",this._a4),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._m2("close:countrydropdown")}},{key:"_3",value:function(a,b){var c=this.m,d=window.pageYOffset||document.documentElement.scrollTop,e=c.offsetHeight,f=c.getBoundingClientRect().top+d,g=f+e,h=a.offsetHeight,i=a.getBoundingClientRect().top+d,j=i+h,k=i-f+c.scrollTop,l=e/2-h/2;if(i<f)b&&(k-=l),c.scrollTop=k;else if(j>g){b&&(k+=l);var m=e-h;c.scrollTop=k-m}}},{key:"_4",value:function(a,b){var c,d=this.a.value,e="+".concat(a);if("+"===d.charAt(0)){var f=this._5(d);c=f?d.replace(f,e):e}else{if(this.d.nationalMode||this.d.separateDialCode)return;if(d)c=e+d;else{if(!b&&this.d.autoHideDialCode)return;c=e}}this.a.value=c}},{key:"_5",value:function(a,b){var c="";if("+"===a.charAt(0))for(var d="",e=0;e<a.length;e++){var f=a.charAt(e);if(!isNaN(parseInt(f,10))){if(d+=f,b)this.q[d]&&(c=a.substr(0,e+1));else if(this.dialCodes[d]){c=a.substr(0,e+1);break}if(d.length===this.countryCodeMaxLen)break}}return c}},{key:"_6",value:function(){var a=this.a.value.trim(),b=this.s.dialCode,c=this._m(a);return(this.d.separateDialCode&&"+"!==a.charAt(0)&&b&&c?"+".concat(b):"")+a}},{key:"_7",value:function(a){var b=a;if(this.d.separateDialCode){var c=this._5(b);if(c){c="+".concat(this.s.dialCode);var d=" "===b[c.length]||"-"===b[c.length]?c.length+1:c.length;b=b.substr(d)}}return this._j2(b)}},{key:"_m2CountryChange",value:function(){this._m2("countrychange")}},{key:"handleAutoCountry",value:function(){"auto"===this.d.initialCountry&&(this.j=window.intlTelInputGlobals.autoCountry,this.a.value||this.setCountry(this.j),this.h())}},{key:"handleUtils",value:function(){window.intlTelInputUtils&&(this.a.value&&this._u(this.a.value),this._0()),this.i0()}},{key:"destroy",value:function(){var a=this.a.form;if(this.d.allowDropdown){this._2(),this.selectedFlag.removeEventListener("click",this._a10),this.k.removeEventListener("keydown",this._a11);var b=this._i1();b&&b.removeEventListener("click",this._a9)}this.hiddenInput&&a&&a.removeEventListener("submit",this._a14),this.d.autoHideDialCode&&(a&&a.removeEventListener("submit",this._a8),this.a.removeEventListener("blur",this._a8)),this.a.removeEventListener("keyup",this._a12),this.a.removeEventListener("cut",this._a13),this.a.removeEventListener("paste",this._a13),this.a.removeAttribute("data-intl-tel-input-id");var c=this.a.parentNode;c.parentNode.insertBefore(this.a,c),c.parentNode.removeChild(c),delete window.intlTelInputGlobals.instances[this.id]}},{key:"getExtension",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getExtension(this._6(),this.s.iso2):""}}
4905,{key:"getNumber",value:function(a){if(window.intlTelInputUtils){var b=this.s.iso2
4906;return intlTelInputUtils.formatNumber(this._6(),b,a)}return""}},{key:"getNumberType",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getNumberType(this._6(),this.s.iso2):-99}},{key:"getSelectedCountryData",value:function(){return this.s}},{key:"getValidationError",value:function(){if(window.intlTelInputUtils){var a=this.s.iso2;return intlTelInputUtils.getValidationError(this._6(),a)}return-99}},{key:"isValidNumber",value:function(){var a=this._6().trim(),b=this.d.nationalMode?this.s.iso2:"";return window.intlTelInputUtils?intlTelInputUtils.isValidNumber(a,b):null}},{key:"setCountry",value:function(a){var b=a.toLowerCase();this.l.classList.contains("iti__".concat(b))||(this._z(b),this._4(this.s.dialCode,!1),this._m2CountryChange())}},{key:"setNumber",value:function(a){var b=this._v(a);this._u(a),b&&this._m2CountryChange()}},{key:"setPlaceholderNumberType",value:function(a){this.d.placeholderNumberType=a,this._0()}}]),a}();i.getCountryData=function(){return f};var p=function(a,b,c){var d=document.createElement("script");d.onload=function(){n("handleUtils"),b&&b()},d.onerror=function(){n("rejectUtilsScriptPromise"),c&&c()},d.className="iti-load-utils",d.async=!0,d.src=a,document.body.appendChild(d)};i.loadUtils=function(a){if(!window.intlTelInputUtils&&!window.intlTelInputGlobals.startedLoadingUtilsScript){if(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,"undefined"!=typeof Promise)return new Promise(function(b,c){return p(a,b,c)});p(a)}return null},i.defaults=k,i.version="17.0.8";a.fn.intlTelInput=function(c){var d=arguments;if(c===b||"object"==typeof c)return this.each(function(){if(!a.data(this,"plugin_intlTelInput")){var b=new o(this,c);b._init(),window.intlTelInputGlobals.instances[b.id]=b,a.data(this,"plugin_intlTelInput",b)}});if("string"==typeof c&&"_"!==c[0]){var e;return this.each(function(){var b=a.data(this,"plugin_intlTelInput");b instanceof o&&"function"==typeof b[c]&&(e=b[c].apply(b,Array.prototype.slice.call(d,1))),"destroy"===c&&a.data(this,"plugin_intlTelInput",null)}),e!==b?e:this}}});;
4907/**
4908 * @file
4909 * JavaScript behaviors for Telephone element.
4910 */
4911
4912(function ($, Drupal, drupalSettings) {
4913
4914  'use strict';
4915
4916  // @see https://github.com/jackocnr/intl-tel-input#options
4917  Drupal.webform = Drupal.webform || {};
4918  Drupal.webform.intlTelInput = Drupal.webform.intlTelInput || {};
4919  Drupal.webform.intlTelInput.options = Drupal.webform.intlTelInput.options || {};
4920
4921  /**
4922   * Initialize Telephone international element.
4923   * @see http://intl-tel-input.com/node_modules/intl-tel-input/examples/gen/is-valid-number.html
4924   * @type {Drupal~behavior}
4925   */
4926  Drupal.behaviors.webformTelephoneInternational = {
4927    attach: function (context) {
4928      if (!$.fn.intlTelInput) {
4929        return;
4930      }
4931
4932      $(context).find('input.js-webform-telephone-international').once('webform-telephone-international').each(function () {
4933        var $telephone = $(this);
4934
4935        // Add error message container.
4936        var $error = $('<div class="form-item--error-message">' + Drupal.t('Invalid phone number') + '</div>').hide();
4937        $telephone.closest('.js-form-item').append($error);
4938
4939        var options = {
4940          // The utilsScript is fetched when the page has finished.
4941          // @see \Drupal\webform\Plugin\WebformElement\Telephone::prepare
4942          // @see https://github.com/jackocnr/intl-tel-input
4943          utilsScript: drupalSettings.webform.intlTelInput.utilsScript,
4944          nationalMode: false
4945        };
4946
4947        // Parse data attributes.
4948        if ($telephone.attr('data-webform-telephone-international-initial-country')) {
4949          options.initialCountry = $telephone.attr('data-webform-telephone-international-initial-country');
4950        }
4951        if ($telephone.attr('data-webform-telephone-international-preferred-countries')) {
4952          options.preferredCountries = JSON.parse($telephone.attr('data-webform-telephone-international-preferred-countries'));
4953        }
4954
4955        options = $.extend(options, Drupal.webform.intlTelInput.options);
4956        $telephone.intlTelInput(options);
4957
4958        var reset = function () {
4959          $telephone.removeClass('error');
4960          $error.hide();
4961        };
4962
4963        $telephone.on('blur', function () {
4964          reset();
4965          if ($.trim($telephone.val())) {
4966            if (!$telephone.intlTelInput('isValidNumber')) {
4967              $telephone.addClass('error');
4968              $error.show();
4969            }
4970          }
4971        });
4972
4973        $telephone.on('keyup change', reset);
4974      });
4975    }
4976  };
4977
4978})(jQuery, Drupal, drupalSettings);
4979;

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.